Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

deUnit_Getting Started

Unknown edited this page Jul 1, 2020 · 1 revision

Getting Started with deUnit

This document descripts how to do the first steps with deUnit with dependency reduction. It is divided into two Parts:

using the examples
use in your own projects

The deUnit-Framework also allows to use a "Selftest-Mode" mode without the use of the GDB Manipulator(gdbMann). Using the provided examples

Requirements

In order to use this system it is necessary to flash and debug the target by the GDB. This example is using the “Atollic TrueSTUDIO for STM32”. Once installed its provide an working flash and update mechanism. But feel free to use your own build and debug environment.

Using an Example

build the whole target project
build gdbMann 

Now you need the commands to:

command to call the GDB-Server (alternative if the gdb-Server is already running in background skip this command )
command to call the GDB-Client
Elf-File location

If you are using the Atollic true studio those applications are per default at : ‘/opt/Atollic_TrueSTUDIO_for_STM32_x86…’

for example you can use: -s "/opt/Atollic_TrueSTUDIO_for_STM32_x86_64_9.0.0/Servers/ST-LINK_gdbserver/ST-LINK_gdbserver -d" –c /opt/Atollic_TrueSTUDIO_for_STM32_x86_64_9.0.0/ARMTools/bin/arm-atollic-eabi-gdb –elf /home/testUser/git/EmbeddedTesting/examples/Stm32F4/Debug/EmbeddedTesting.elf

If the Target is not jet flashed you need additional to add ‘-f’ to flash the target with the elf-file For Further information’s see the Wiki entry: “Program Arguments”

Run the Application ‘gdbMann’ with those arguments. e.g.

./gdbMann -elf <elfFile> -s "/opt/Atollic_TrueSTUDIO_for_STM32_x86_64_9.0.0/Servers/ST-LINK_gdbserver/ST-LINK_gdbserver -d" -c /opt/Atollic_TrueSTUDIO_for_STM32_x86_64_9.0.0/ARMTools/bin/arm-atollic-eabi-gdb

Now you should see the test output like:

  [ RUN      ]        
  [       OK ] EQ_SUCCESS::NEQ_SUCCESS
 
 ….
 
  [  FAILED  ] MockSucces::NEQ_FAIL        
                (int32) Expected: 0	not to be equals to : 0        
 …        
  [ RUN      ]        
  [  FAILED  ] MockSucces::NEQ_FAIL        
 				     is<3> :	 01 02 03   |  ...        
 				 should<3> :	 02 ** **   |  ...        
 ….        
 test result : test run : 23  	 test failed : 9	 errors : 0         
 buffer reads : 4

Different Test-Levels:

To speedup the testcases there are some Test-Levels. Each additional level provides more information about the failed test but decrease the test execution. It is possible the change the testlevel with the program argument ‘-t ’ or –testLevel arguments are:

"justSuccess" : boolean information about the test-status
"testName" : (default) + name and group of the executed test
"testResults" + result and expected value of an failed test
"lineNumber" + number of the failed test

Add deUnit into your Projects

To add ‘deUnit’ to you own projects it is just necessary to copy the folder ‘/deUnit’ into you project and call the ‘invokeAllTest()’ from the main. To create your own tests each test must get called in the ‘invokeAllTest()’ Function. See: Test creation

It is highly recommended to generate those functions with the provided ‘awk’-script. Further information’s are provided in the wiki entry: “Test Syntax and Test creation”

Clone this wiki locally