[riot-notifications] [RIOT-OS/RIOT] Makefile.include: add a 'test/available' target (#11269)

Gaƫtan Harter notifications at github.com
Mon Mar 25 18:12:28 CET 2019


### Contribution description

This allows querying the build system if there are test available.

Before, one should rely on 'info-debug-variable-TESTS' to print the list
of test files. But was not reliable as sometime the build system printed
messages anyway.

    BOARD=esp32-wroom-32 make --silent --no-print-directory \
        -C examples/hello-world/ info-debug-variable-TESTS
    ESP32_SDK_DIR should be defined as /path/to/esp-idf directory
    ESP32_SDK_DIR is set by default to /opt/esp/esp-idf
    # empty line here

I used the `test/available` pattern as I am thinking about defining new `test-manual` or `test-root` targets and wanted a pattern that would also work for these ones.

This pull request also updates `compile_and_test_for_board.py` to use this target and allow overwriting them as it would make sense when changing `--test-targets`


### Testing procedure

No test in `hello-world`
```
make --no-print-directory -C examples/hello-world/ test/available
/home/harter/work/git/worktree/riot_test/examples/hello-world/../../Makefile.include:581: recipe for target 'test/available' failed
make: *** [test/available] Error 1
```
Test in `bloom_bytes`
```
make --no-print-directory -C tests/bloom_bytes/ test/available
# Nothing and returncode 0
```

#### Testing `compile_and_test_for_board.py`

No test found when using the `esp32-wroom-32` anymore when there is not test

```
 BUILD_IN_DOCKER=1 DOCKER="sudo docker" ./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py . esp32-wroom-32 --applications=examples/hello-world 
INFO:esp32-wroom-32:Saving toolchain
INFO:esp32-wroom-32.examples/hello-world:Board supported: True
INFO:esp32-wroom-32.examples/hello-world:Board has enough memory: True
INFO:esp32-wroom-32.examples/hello-world:Run compilation
INFO:esp32-wroom-32.examples/hello-world:Success
INFO:esp32-wroom-32:Tests successful
```

In master it was finding a test when there was none.

```
INFO:esp32-wroom-32:Saving toolchain
INFO:esp32-wroom-32.examples/hello-world:Board supported: True
INFO:esp32-wroom-32.examples/hello-world:Board has enough memory: True
INFO:esp32-wroom-32.examples/hello-world:Run compilation
INFO:esp32-wroom-32.examples/hello-world:Run test
INFO:esp32-wroom-32.examples/hello-world:Run test.flash
...
```


Command can be overwritten with the option, this makes it think there is indeed a test.

```
./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py . native --applications=examples/hello-world --test-available-targets=info-build
INFO:native:Saving toolchain
INFO:native.examples/hello-world:Board supported: True
INFO:native.examples/hello-world:Board has enough memory: True
INFO:native.examples/hello-world:Run compilation
INFO:native.examples/hello-world:Run test
INFO:native.examples/hello-world:Run test.flash
INFO:native.examples/hello-world:Success
INFO:native:Tests successful
```

#### tox test suite

    cd dist/tools/compile_and_test_for_board/
    tox
    # executes without errors
### Issues/PRs references

It was found while trying to run the test suite on esp32.
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11269

-- Commit Summary --

  * Makefile.include: declare 'test' PHONY
  * Makefile.include: add a 'test/available' target
  * compile_and_test_for_board: use 'test/available' to detect test

-- File Changes --

    M Makefile.include (5)
    M dist/tools/compile_and_test_for_board/compile_and_test_for_board.py (22)
    M tests/README.md (7)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11269.patch
https://github.com/RIOT-OS/RIOT/pull/11269.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11269
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190325/ba3d88cb/attachment-0001.html>


More information about the notifications mailing list