Browse Source

Tools: Autotest: add --coverage option

c415-sdk
Pierre Kancir 4 years ago committed by Peter Barker
parent
commit
cf350a52e9
  1. 9
      Tools/autotest/autotest.py
  2. 13
      Tools/autotest/pysim/util.py

9
Tools/autotest/autotest.py

@ -143,7 +143,6 @@ def build_unit_tests(**kwargs): @@ -143,7 +143,6 @@ def build_unit_tests(**kwargs):
"""Build tests."""
for target in ['linux']:
print("Running build.unit_tests for %s" % target)
print(*kwargs)
try:
util.build_tests(target, **kwargs)
except Exception as e:
@ -416,6 +415,7 @@ def run_step(step): @@ -416,6 +415,7 @@ def run_step(step):
"configure": not opts.no_configure,
"math_check_indexes": opts.math_check_indexes,
"extra_configure_args": opts.waf_configure_args,
"coverage": opts.coverage,
}
if opts.Werror:
@ -878,6 +878,10 @@ if __name__ == "__main__": @@ -878,6 +878,10 @@ if __name__ == "__main__":
default=False,
action='store_true',
help='make built binaries debug binaries')
group_build.add_option("--coverage",
default=False,
action='store_true',
help='make built binaries coverage binaries')
group_build.add_option("--enable-math-check-indexes",
default=False,
action="store_true",
@ -1132,9 +1136,6 @@ if __name__ == "__main__": @@ -1132,9 +1136,6 @@ if __name__ == "__main__":
try:
if not run_tests(steps_to_run):
if os.environ.get("COVERAGE", False):
# Don't report failure on coverage test
sys.exit(0)
sys.exit(1)
except KeyboardInterrupt:
print("KeyboardInterrupt caught; closing pexpect connections")

13
Tools/autotest/pysim/util.py

@ -96,10 +96,12 @@ def relwaf(): @@ -96,10 +96,12 @@ def relwaf():
return "./modules/waf/waf-light"
def waf_configure(board, j=None, debug=False, math_check_indexes=False, extra_args=[]):
def waf_configure(board, j=None, debug=False, math_check_indexes=False, coverage=False, extra_args=[]):
cmd_configure = [relwaf(), "configure", "--board", board]
if debug:
cmd_configure.append('--debug')
if coverage:
cmd_configure.append('--coverage')
if math_check_indexes:
cmd_configure.append('--enable-math-check-indexes')
if j is not None:
@ -114,7 +116,7 @@ def waf_clean(): @@ -114,7 +116,7 @@ def waf_clean():
run_cmd([relwaf(), "clean"], directory=topdir(), checkfail=True)
def build_SITL(build_target, j=None, debug=False, board='sitl', clean=True, configure=True, math_check_indexes=False, extra_configure_args=[]):
def build_SITL(build_target, j=None, debug=False, board='sitl', clean=True, configure=True, math_check_indexes=False, coverage=False, extra_configure_args=[]):
"""Build desktop SITL."""
# first configure
@ -123,6 +125,7 @@ def build_SITL(build_target, j=None, debug=False, board='sitl', clean=True, conf @@ -123,6 +125,7 @@ def build_SITL(build_target, j=None, debug=False, board='sitl', clean=True, conf
j=j,
debug=debug,
math_check_indexes=math_check_indexes,
coverage=coverage,
extra_args=extra_configure_args)
# then clean
@ -137,13 +140,14 @@ def build_SITL(build_target, j=None, debug=False, board='sitl', clean=True, conf @@ -137,13 +140,14 @@ def build_SITL(build_target, j=None, debug=False, board='sitl', clean=True, conf
return True
def build_examples(board, j=None, debug=False, clean=False, configure=True, math_check_indexes=False, extra_configure_args=[]):
def build_examples(board, j=None, debug=False, clean=False, configure=True, math_check_indexes=False, coverage=False, extra_configure_args=[]):
# first configure
if configure:
waf_configure(board,
j=j,
debug=debug,
math_check_indexes=math_check_indexes,
coverage=coverage,
extra_args=extra_configure_args)
# then clean
@ -168,13 +172,14 @@ def build_replay(board, j=None, debug=False, clean=False): @@ -168,13 +172,14 @@ def build_replay(board, j=None, debug=False, clean=False):
run_cmd(cmd_make, directory=topdir(), checkfail=True, show=True)
return True
def build_tests(board, j=None, debug=False, clean=False, configure=True, math_check_indexes=False, extra_configure_args=[]):
def build_tests(board, j=None, debug=False, clean=False, configure=True, math_check_indexes=False, coverage=False, extra_configure_args=[]):
# first configure
if configure:
waf_configure(board,
j=j,
debug=debug,
math_check_indexes=math_check_indexes,
coverage=coverage,
extra_args=extra_configure_args)
# then clean

Loading…
Cancel
Save