Skip to content

Commit

Permalink
Try #19817:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Jul 21, 2023
2 parents d11255b + d12d592 commit d8f9002
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
31 changes: 21 additions & 10 deletions dist/tools/compile_and_test_for_board/compile_and_test_for_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
```
usage: compile_and_test_for_board.py [-h] [--applications APPLICATIONS]
[--applications-exclude APPLICATIONS_EXCLUDE]
[--no-test] [--with-test-only]
[--no-test] [--no-compile]
[--with-test-only]
[--loglevel {debug,info,warning,error,fatal,critical}]
[--incremental] [--clean-after]
[--compile-targets COMPILE_TARGETS]
Expand All @@ -61,12 +62,14 @@
applications. Also applied after "--applications".
(default: None)
--no-test Disable executing tests (default: False)
--no-compile Disable compiling tests, this assumes the compilation
was already done (default: False)
--with-test-only Only compile applications that have a test (default:
False)
--loglevel {debug,info,warning,error,fatal,critical}
Python logger log level (default: info)
--incremental Do not rerun successful compilation and tests
(default: False)
--incremental Do not rerun successful compilation and tests (default:
False)
--clean-after Clean after running each test (default: False)
--compile-targets COMPILE_TARGETS
List of make targets to compile (default: clean all)
Expand Down Expand Up @@ -360,6 +363,7 @@ def _skip(self, skip_reason, skip_reason_details=None, output=None):
def compilation_and_test(
self,
clean_after=False,
runcompile=True,
runtest=True,
incremental=False,
jobs=False,
Expand Down Expand Up @@ -408,13 +412,13 @@ def compilation_and_test(

# Run compilation and flash+test
# It raises ErrorInTest on error which is handled outside

compilation_cmd = list(self.COMPILE_TARGETS)
if jobs is not None:
compilation_cmd += ["--jobs"]
if jobs:
compilation_cmd += [str(jobs)]
self.make_with_outfile("compilation", compilation_cmd)
if runcompile:
compilation_cmd = list(self.COMPILE_TARGETS)
if jobs is not None:
compilation_cmd += ["--jobs"]
if jobs:
compilation_cmd += [str(jobs)]
self.make_with_outfile("compilation", compilation_cmd)
if clean_after:
self.clean_intermediates()

Expand Down Expand Up @@ -670,6 +674,12 @@ def _strip_board_equal(board):
PARSER.add_argument(
"--no-test", action="store_true", default=False, help="Disable executing tests"
)
PARSER.add_argument(
"--no-compile",
action="store_true",
default=False,
help="Disable compiling tests, this assumes the compilation was already done",
)
PARSER.add_argument(
"--with-test-only",
action="store_true",
Expand Down Expand Up @@ -783,6 +793,7 @@ def main(args):
errors = [
app.run_compilation_and_test(
clean_after=args.clean_after,
runcompile=not args.no_compile,
runtest=not args.no_test,
incremental=args.incremental,
jobs=args.jobs,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
"""Test compile_and_test_for_board script."""

import subprocess

import re
import compile_and_test_for_board


def _clean(my_str):
return re.sub(r'\s+', ' ', my_str)


def test_help_message():
"""Verify that the help message is in the script documentation."""
script = 'compile_and_test_for_board.py'
Expand All @@ -14,5 +18,7 @@ def test_help_message():
help_msg = help_bytes.decode('utf-8')

docstring = compile_and_test_for_board.__doc__

assert help_msg in docstring, "Help message not in the documentation"
assert _clean(help_msg) in _clean(docstring), ("Help message not in the",
"documentation")
help_msg += "garbage"
assert help_msg not in docstring, ("Negative help message test failed.")

0 comments on commit d8f9002

Please sign in to comment.