Skip to content

Commit 81be7cf

Browse files
author
Felipe Torrezan
authored
Minor fixes in the README
1 parent bfc6adc commit 81be7cf

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ cmake --build .
9797
## Run
9898
Let's test the application. To run the executable you will need the non-interactive[^3] command line interface for the IAR C-SPY Debugger (`cspybat`) with the proper drivers for the desired target. Amongst the many ways of accomplishing this, let's take advantage of the `add_test()` for testing the application in a Arm Cortex-M4 simulated target.
9999

100-
In this example we will use Arm. To do so, we need to change the Tutorial's `CMakeLists.txt`:
100+
In this example we will use Arm. To do so, you need to change the Tutorial's `CMakeLists.txt`:
101101
- Firstly add [`enable_testing()`](https://cmake.org/cmake/help/latest/command/enable_testing.html#command:enable_testing) to enable testing:
102102
```cmake
103103
enable_testing()
@@ -119,7 +119,7 @@ add_test(NAME tutorialTest
119119
--semihosting)
120120
```
121121

122-
- Now use the [`PASS_REGULAR_EXPRESSION`](https://cmake.org/cmake/help/latest/prop_test/PASS_REGULAR_EXPRESSION.html#prop_test:PASS_REGULAR_EXPRESSION) test property to validate if the program emits the expected string to the standard output (`stdout`). In this case, verifying that the usage message is printed when an incorrect number of arguments is provided.
122+
- Now use the [`PASS_REGULAR_EXPRESSION`](https://cmake.org/cmake/help/latest/prop_test/PASS_REGULAR_EXPRESSION.html#prop_test:PASS_REGULAR_EXPRESSION) test property to validate if the program emits the expected string to the standard output (`stdout`). In this case, verifying that `printf()` prints the expected message.
123123
```cmake
124124
set_tests_properties(tutorialTest PROPERTIES PASS_REGULAR_EXPRESSION "Hello world!")
125125
```

tutorial/CMakeLists.txt

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,10 @@ target_compile_options(tutorial PRIVATE --cpu=cortex-m4)
1616
# linker options
1717
target_link_options(tutorial PRIVATE --semihosting)
1818

19-
enable_testing()
20-
21-
add_test(NAME tutorialTest
22-
COMMAND /opt/iarsystems/bxarm/common/bin/CSpyBat
23-
# C-SPY drivers for the Arm simulator via command line interface
24-
/opt/iarsystems/bxarm/arm/bin/libarmPROC.so
25-
/opt/iarsystems/bxarm/arm/bin/libarmSIM2.so
26-
--plugin=/opt/iarsystems/bxarm/arm/bin/libarmLibsupportUniversal.so
27-
# The target executable (built with debug information)
28-
--debug_file=$<TARGET_FILE:tutorial>
29-
# C-SPY driver options
30-
--backend
31-
--cpu=cortex-m4
32-
--semihosting)
33-
34-
set_tests_properties(tutorialTest PROPERTIES PASS_REGULAR_EXPRESSION "Hello world!")
19+
# TODO 1: Enable testing in CMake
20+
21+
# TODO 2: Add a test named `tutorialTest` for `tutorial` (hint: use CSpyBat)
22+
add_test()
23+
24+
# TODO 3: Set the `tutorialTest` test passing condition
25+
set_tests_properties()

0 commit comments

Comments
 (0)