autotest: correct running of single test

... and stop using run_tests entrypoint to the AutoTest objects as it does cause confusion
This commit is contained in:
Peter Barker 2022-09-11 14:32:17 +10:00 committed by Peter Barker
parent bb1c43b0a2
commit cd50b91904
2 changed files with 15 additions and 15 deletions

View File

@ -418,11 +418,11 @@ def run_specific_test(step, *args, **kwargs):
print("Got %s" % str(tester))
for a in tester.tests():
if not hasattr(a, 'name'):
a = Test(a[0], a[1], a[2])
if type(a) != 'Test':
a = Test(a)
print("Got %s" % (a.name))
if a.name == test:
return tester.run_tests([a])
return (tester.autotest(tests=[a], allow_skips=False), tester)
print("Failed to find test %s on %s" % (test, testname))
sys.exit(1)
@ -832,10 +832,8 @@ def list_subtests_for_vehicle(vehicle_type):
subtests = tester.tests()
sorted_list = []
for subtest in subtests:
if type(subtest) is tuple:
(name, description, function) = subtest
sorted_list.append([name, description])
else:
if type(subtest) != 'Test':
subtest = Test(subtest)
sorted_list.append([subtest.name, subtest.description])
sorted_list.sort()
for subtest in sorted_list:

View File

@ -12403,17 +12403,19 @@ switch value'''
print("Had to force-reset SITL %u times" %
(self.forced_post_test_sitl_reboots,))
def autotest(self):
def autotest(self, tests=None, allow_skips=True):
"""Autotest used by ArduPilot autotest CI."""
if tests is None:
tests = self.tests()
all_tests = []
for test in self.tests():
if type(test) == Test:
for test in tests:
if type(test) != Test:
test = Test(test)
all_tests.append(test)
continue
actual_test = Test(test)
all_tests.append(actual_test)
disabled = self.disabled_tests()
if not allow_skips:
disabled = {}
tests = []
for test in all_tests:
if test.name in disabled: