Skip to content

Commit fab2429

Browse files
peterbarkertridge
authored andcommitted
autotest: only build and run the sitl unit tests under asan
--asan is implemented for the sitl board alone, so the linux half of the run was building and running the same tests a second time without any instrumentation. The unit-tests job already covers them.
1 parent 168767d commit fab2429

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

‎Tools/autotest/autotest.py‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,19 @@ def build_examples(**kwargs):
112112
return True
113113

114114

115+
def unit_test_boards(asan):
116+
"""Boards to build and run the unit tests for."""
117+
if asan:
118+
# --asan is only implemented for the sitl board, so building the
119+
# linux tests here would just run them uninstrumented a second
120+
# time - the unit-tests job already covers them
121+
return ['sitl']
122+
return ['linux', 'sitl']
123+
124+
115125
def build_unit_tests(**kwargs):
116126
"""Build tests."""
117-
for target in ['linux', 'sitl']:
127+
for target in unit_test_boards(kwargs.get('asan')):
118128
print("Running build.unit_tests for %s" % target)
119129
try:
120130
util.build_tests(target, **kwargs)
@@ -136,11 +146,11 @@ def run_unit_test(test):
136146
subprocess.check_call([test], env=env)
137147

138148

139-
def run_unit_tests():
149+
def run_unit_tests(asan=False):
140150
"""Run all unit tests files."""
141151
success = True
142152
fail_list = []
143-
for target in ['linux', 'sitl']:
153+
for target in unit_test_boards(asan):
144154
binary_dir = util.reltopdir(os.path.join('build',
145155
target,
146156
'tests',
@@ -601,7 +611,7 @@ def run_step(step):
601611
return build_unit_tests(**build_opts)
602612

603613
if step == 'run.unit_tests':
604-
return run_unit_tests()
614+
return run_unit_tests(asan=opts.asan)
605615

606616
if step == 'clang-scan-build':
607617
return run_clang_scan_build()

0 commit comments

Comments
 (0)