Chapter 8. Running an eCos Test Case

In the Section called Configuration Tool on Windows and Linux Quick Start in Chapter 7 or the Section called Ecosconfig on Windows and Linux Quick Start in Chapter 7 you created the eCos test cases as part of the build process. Now it is time to try and run one.

Using the Configuration Tool

Test executables that have been linked using the Build->Tests (Shift-F7)operation against the current configuration can be executed by selecting Tools->Run Tests (Ctrl+F5).

When a test run is invoked, a property sheet is displayed, see Figure 8-1. Press the Uncheck All button and then find and check just one test, bin_sem0 for example.

Figure 8-1. Run tests

Now press the Properties button to set up communications with the target. This will bring up a properties dialog shown in Figure 8-2. If you have connected the target board via a serial cable, check the Serial radio button, and select the serial port and baud rate for the board. If the target is connected via the network or Hardware debugger with gdb server (such as the Ronetix PEED, BDI2000 or OpenOCD in server mode) select the TCP/IP button and enter the IP address or DNS name that the board, hardware debugger or host has been given, and the port number (usually 9000 for RedBoot and the PEEDI, 2001 for the BDI2000). If you are using a hardware debugger locally and accessing it through a pipe, select Pipe and enter the command to invoke the hardware debugger in pipe mode in the Pipe Command field. Do not include the pipe (“|”) symbol.

Figure 8-2. Properties dialog box

Finally, if you wish to run multiple tests automatically, in Target Reset you may specify how the target hardware may be reset before running each test such that GDB can download and execute a test on the target hardware in an automated fashion. For example, if manual or physical intervention is required, such as a power cycle or pressing the reset button, set this field to Manual. You will then be asked by the eCos Configuration Tool to reset the board and clear a dialog Window by pressing OK once the target hardware has been reset and is ready to run a test. If no reset is required, for example when the board is connected to a hardware debugger that resets the board according to its configuration when a GDB client connects to it, set this field to None. If the target hardware can be reset through the local host execution of a command or script, set this field to Command and enter the command, complete with arguments, in the field alongside. Do not include the pipe (“|”) symbol. If the command is not on the path, the full path to the command must be entered. The reset command must also terminate with a zero exit code once the target hardware has been determined to successfully reset, otherwise all following test executions are cancelled as the hardware is determined as having failed.

Note: Certain targets and hardware debuggers may require additional parameters to GDB in order to sucessfully execute tests. For example, on Windows hosts, OpenOCD when run in Pipe mode, may not always respond to a GDB connection in a timely fashion and require the additional GDB command set remotetimeout 5 before a connection to GDB is attempted. See the Section called Platform Selection in Chapter 15 for details on how to insert set remotetimeout 5 before target remote.

Click OK on this dialog and go back to the Run Tests dialog. Press the Run button and the selected test will be downloaded and run. The Output tab will show you how this is progressing. If it seems to stop for a long time, check that the target board is correctly connected, and that eCos has been correctly configured -- especially the start-up type.

When the program runs you should see a couple of line similar to this appear:

PASS:<Binary Semaphore 0 OK>
EXIT:<done>

This indicates that the test has run successfully.

See Chapter 18 for further details.

2017-02-09
Documentation license for this page: Open Publication License