Skip to content
Snippets Groups Projects
Unverified Commit 3974c460 authored by Alexandre Abadie's avatar Alexandre Abadie Committed by GitHub
Browse files

Merge pull request #10837 from aabadie/pr/tools/compile_test_board_checks

dist/tools/compile_and_test_for_board: add basic checks for script
parents 1f7292c3 613e05fd
No related branches found
No related tags found
No related merge requests found
# tox envs directory
.tox
......@@ -20,6 +20,20 @@ They can be checked with:
find results/ -name '*.failed'
find results/ -name 'test.success'
Script checks
-------------
Use [tox](https://tox.readthedocs.io/en/latest/) to run basic checks on the
script:
$ tox
This runs doctest (via pytest), pylint and flake8 checks in a row.
Use `-e` to run each check independently:
$ tox -e test
$ tox -e lint
$ tox -e flake8
Implementation TODO
-------------------
......@@ -31,6 +45,6 @@ simply adapt to be used from within RIOT.
* Provide a RIOT/Makefile integration
* Save output files into `${BUILD_DIR}/output/compile_and_test` directory by
default
* tox file to run `doctests/pylint/flake8`. Add tests.
* Add tests.
* Implement the `board_is_supported`/`board_has_enough_memory`/`has_tests` to
make targets instead of fiddling to get the value
......@@ -79,7 +79,7 @@ LOG_HANDLER.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
LOG_LEVELS = ('debug', 'info', 'warning', 'error', 'fatal', 'critical')
class TestError(Exception):
class ErrorInTest(Exception):
"""Custom exception for a failed test.
It contains the step that failed in 'message', the 'application' and the
......@@ -264,7 +264,7 @@ class RIOTApplication():
try:
self.compilation_and_test(**test_kwargs)
return None
except TestError as err:
except ErrorInTest as err:
self.logger.error('Failed during: %s', err)
return (str(err), err.application.appdir, err.errorfile)
......@@ -283,7 +283,7 @@ class RIOTApplication():
succeeds.
:param incremental: Do not rerun successful compilation and tests
:raises TestError: on execution failed during one step
:raises ErrorInTest: on execution failed during one step
"""
# Ignore incompatible APPS
......@@ -301,7 +301,7 @@ class RIOTApplication():
create_directory(self.resultdir, clean=not incremental)
# Run compilation and flash+test
# It raises TestError on error which is handled outside
# It raises ErrorInTest on error which is handled outside
compilation_cmd = list(self.COMPILE_TARGETS)
if jobs is not None:
......@@ -415,7 +415,7 @@ class RIOTApplication():
self.logger.warning(output)
self.logger.error('Error during %s, writing to %s', name, outfile)
raise TestError(name, self, outfile)
raise ErrorInTest(name, self, outfile)
def _write_resultfile(self, name, status, body=''):
"""Write `body` to result file `name.status`.
......
[tox]
envlist = test,lint,flake8
skipsdist = True
[testenv]
basepython = python3
setenv =
script = compile_and_test_for_board.py
commands =
test: {[testenv:test]commands}
lint: {[testenv:lint]commands}
flake8: {[testenv:flake8]commands}
[testenv:test]
deps = pytest
commands =
pytest -v --doctest-modules {env:script}
[testenv:lint]
deps = pylint
commands =
pylint {env:script}
[testenv:flake8]
deps = flake8
commands =
flake8 {env:script}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment