autotest: ensure RC thread is killed after each run_test

Every run_test starts a thread.  del is not being called.  So clean it
up in the caller
This commit is contained in:
Peter Barker 2021-03-31 23:36:14 +11:00 committed by Peter Barker
parent 500679ec5b
commit d2c00f7b26
2 changed files with 12 additions and 10 deletions

View File

@ -704,6 +704,15 @@ def run_tests(steps):
results.add(step,
'<span class="failed-text">FAILED</span>',
time.time() - t1)
global tester
if tester is not None and tester.rc_thread is not None:
if passed:
print("BAD: RC Thread still alive after run_step")
tester.rc_thread_should_quit = True
tester.rc_thread.join()
tester.rc_thread = None
if not passed:
keys = failed_testinstances.keys()
if len(keys):
@ -717,14 +726,6 @@ def run_tests(steps):
print("FAILED %u tests: %s" % (len(failed), failed))
global tester
if tester is not None and tester.rc_thread is not None:
if passed:
print("BAD: RC Thread still alive after tests passed")
tester.rc_thread_should_quit = True
tester.rc_thread.join()
tester.rc_thread = None
util.pexpect_close_all()
write_fullresults()

View File

@ -1274,7 +1274,7 @@ class AutoTest(ABC):
def __del__(self):
if self.rc_thread is not None:
self.progress("Joining thread in __del__")
self.progress("Joining RC thread in __del__")
self.rc_thread_should_quit = True
self.rc_thread.join()
self.rc_thread = None
@ -3474,6 +3474,7 @@ class AutoTest(ABC):
continue
bad_channels = ""
for chan in map_copy:
self.progress("RC values good")
chan_pwm = getattr(m, "chan" + str(chan) + "_raw")
if chan_pwm != map_copy[chan]:
bad_channels += " (ch=%u want=%u got=%u)" % (chan, map_copy[chan], chan_pwm)
@ -8616,7 +8617,7 @@ switch value'''
self.check_logs("FRAMEWORK")
if self.rc_thread is not None:
self.progress("Joining thread")
self.progress("Joining RC thread")
self.rc_thread_should_quit = True
self.rc_thread.join()
self.rc_thread = None