Skip to content

Commit 4c80ba1

Browse files
committed
[docs] Improve testing Readme
1 parent f6f0fd6 commit 4c80ba1

File tree

2 files changed

+51
-60
lines changed

2 files changed

+51
-60
lines changed

docs/src/guide/custom-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ want [to choose one at this point](../../reference/build-systems). Add the
5757
```xml
5858
<library>
5959
<repositories>
60-
<repository><path>../modm/repo.lb</path></repository>
60+
<repository><path>../../ext/modm/repo.lb</path></repository>
6161
</repositories>
6262
<options>
6363
<option name="modm:build:project.name">custom_name</option>

test/README.md

Lines changed: 50 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Testing modm
22

33
modm includes a large number of example as well as an extensive unit test suite
4-
which can be compiled and execute on hosted and embedded targets. Weve written
4+
which can be compiled and execute on hosted and embedded targets. We've written
55
our own small test harness to be able to fit the tests onto very small devices
66
like AVRs. As part of our Continuous Integration checks, all examples are
77
compiled and hundreds of unit tests are executed to help us catch regressions.
@@ -19,7 +19,7 @@ abilities we have available today.
1919

2020
## Manual Tests
2121

22-
There is plenty of opportunity to customize modm, either using lbuilds module
22+
There is plenty of opportunity to customize modm, either using lbuild's module
2323
options or simply by using the HAL on your specific hardware. This means the
2424
more examples we have of different configurations and use-cases the better we
2525
can debug existing problems and prevent new ones.
@@ -29,58 +29,70 @@ so that others have an idea of the environment in which it was developed.
2929
Test your new code on real hardware with the compiler toolchain we use and make
3030
sure to document any caveats you discover.
3131

32-
You can compile all examples locally using our helper script.
32+
You can compile all or parts of the examples locally using our helper script.
3333

3434
```sh
35-
$ cd examples
36-
$ ../tools/scripts/examples_compile.py .
35+
cd examples
36+
../tools/scripts/examples_compile.py .
37+
# Or only a subset of the examples
38+
../tools/scripts/examples_compile.py generic/blinky
3739
```
3840

39-
!!! tip "Add your example to our CI"
40-
If you created a new folder inside `modm/examples`, you need to add it to
41-
one of the jobs in `.circleci/config.yml`:
42-
```sh
43-
- run:
44-
name: Examples YOUR TARGET
45-
command: |
46-
(cd examples && ../tools/scripts/examples_compile.py new_folder)
47-
```
41+
42+
## Continuous Integration
43+
44+
modm uses [GitHub Actions for CI][gha] to compile all the examples and to run
45+
the unit tests on Linux. It also generates a bunch of artifacts that you can
46+
download to check what the CI has been doing.
47+
48+
If you create a new folder inside `modm/examples`, you need to add it to the
49+
appropriate job in in `.github/workflows/linux.yml`:
50+
51+
```yml
52+
- name: Examples for new or existing families
53+
if: always()
54+
run: |
55+
(cd examples && ../tools/scripts/examples_compile.py your_example_folder)
56+
```
57+
58+
[gha]: https://github.com/modm-io/modm/actions
4859
4960
5061
## Unit Tests
5162
5263
Our unit tests are located in the `modm/test` directory and are generated using
5364
lbuild as well. They are all submodules of `modm:test` and are all platform
54-
independent. Weve written a small Makefile for the most commonly used commands.
65+
independent. We've written a small Makefile for the most commonly used commands.
5566

5667
```sh
57-
$ cd tests
58-
# generates, compiles and executes the unit tests for hosted targets
59-
$ make run-hosted-linux
60-
$ make run-hosted-darwin
61-
# generates and compiles the unit tests for embedded targets
62-
$ make compile-nucleo-f411
63-
$ make compile-nucleo-f103
64-
$ make compile-al-avreb-can
65-
# executes the unit tests on the embedded targets
66-
$ make run-nucleo-f411
67-
$ make run-nucleo-f103
68-
$ make run-al-avreb-can
68+
cd tests
69+
# generates, compiles and executes the unit tests for hosted targets
70+
make run-hosted-linux
71+
make run-hosted-darwin
72+
# generates and compiles the unit tests for embedded targets
73+
make compile-nucleo-f411
74+
make compile-nucleo-f103_A
75+
make compile-nucleo-f103_B
76+
make compile-arduino-nano_A # to _H
77+
# executes the unit tests on the embedded targets
78+
make run-nucleo-f411
79+
make run-nucleo-f103_A
80+
make run-nucleo-f103_B
81+
make run-arduino-nano_A # to _H
6982
```
7083

71-
!!! info "Monitor the serial output"
72-
The embedded test targets all use the `modm::Board` interface to initialize
73-
the targets and output unit tests results via the default serial connection.
84+
The embedded test targets all use the `modm::Board` interface to initialize the
85+
targets and output unit tests results via the default serial connection.
7486

75-
The unit test library we use is located in `modm/src/unittest` which is the
76-
`modm:unittest` modules. See the existing unit tests for example on how to write
77-
your own.
87+
The unit test library we use is located in `modm/src/unittest` which corresponds
88+
to the `modm:unittest` modules. See the existing unit tests for examples on how
89+
to write your own.
7890

79-
!!! bug "Running unit tests on small targets"
80-
Fitting all unit tests into one executable image is not possible on smaller
81-
AVR and STM32 targets. For these targets only a subset of unit tests must be
82-
selected in the `project.xml` file and multiple images must be executed
83-
manually. We would like to automate this in the future.
91+
Fitting all unit tests into one executable image is not possible on smaller AVR
92+
and STM32 targets. For these targets multiple compile targets generate multiple
93+
images with partial unit tests that must be executed manually. In the future we
94+
would like to execute the unit tests as well as the examples automatically on
95+
the target hardware as well.
8496

8597

8698
## Test all Targets
@@ -90,7 +102,6 @@ for ALL targets we support and compile it with a simple GPIO example.
90102
This doesn't catch everything, but it does make sure that these modules are at
91103
least compilable, which is particularly interesting when writing new peripheral
92104
drivers which may have different implementations on other targets.
93-
You may call
94105

95106
```sh
96107
$ cd test/all
@@ -109,23 +120,3 @@ FAIL 0
109120
Total: 209
110121
$ make run-failed # only run those that failed the last test
111122
```
112-
113-
!!! info "Target Compilation Logs"
114-
The individual compilation logs are all saved as artifacts, so that when
115-
something fails, it‘s easy to understand why.
116-
You can access them in [the Artifacts tab of a build][logs].
117-
118-
119-
## Continuous Integration
120-
121-
modm uses [CircleCI as a Continuous Integration service][circleci]. It compiles
122-
all the examples and executes the unit tests on Linux, then generates and
123-
compiles the full library for a blinky example for all targets that we support.
124-
125-
In the future we would like to execute the unit tests as well as the examples
126-
automatically on the target hardware as well. However, there isn‘t any
127-
third-party framework to make that easy, so we probably have to write our own.
128-
129-
130-
[logs]: https://circleci.com/gh/modm-io/modm/971#artifacts/containers/0
131-
[circleci]: https://circleci.com/gh/modm-io/workflows/modm/tree/develop

0 commit comments

Comments
 (0)