autotest: cope with exceptions in tests leaving child processes

This commit is contained in:
Andrew Tridgell 2011-11-26 18:12:19 +11:00
parent f2a0a49d55
commit ee04c0ef50

View File

@ -14,6 +14,7 @@ def get_default_params(atype):
'''get default parameters''' '''get default parameters'''
sil = util.start_SIL(atype, wipe=True) sil = util.start_SIL(atype, wipe=True)
mavproxy = util.start_MAVProxy_SIL(atype) mavproxy = util.start_MAVProxy_SIL(atype)
print("Dumping defaults")
idx = mavproxy.expect(['Please Run Setup', 'Saved [0-9]+ parameters to (\S+)']) idx = mavproxy.expect(['Please Run Setup', 'Saved [0-9]+ parameters to (\S+)'])
if idx == 0: if idx == 0:
# we need to restart it after eeprom erase # we need to restart it after eeprom erase
@ -37,10 +38,14 @@ def dump_logs(atype):
logfile = util.reltopdir('../buildlogs/%s.flashlog' % atype) logfile = util.reltopdir('../buildlogs/%s.flashlog' % atype)
log = open(logfile, mode='w') log = open(logfile, mode='w')
mavproxy = util.start_MAVProxy_SIL(atype, setup=True, logfile=log) mavproxy = util.start_MAVProxy_SIL(atype, setup=True, logfile=log)
print("navigating menus")
mavproxy.expect(']') mavproxy.expect(']')
mavproxy.send("logs\n") mavproxy.send("logs\n")
mavproxy.expect("logs enabled:") mavproxy.expect("logs enabled:")
mavproxy.expect("(\d+) logs") i = mavproxy.expect(["No logs", "(\d+) logs"])
if i == 0:
numlogs = 0
else:
numlogs = int(mavproxy.match.group(1)) numlogs = int(mavproxy.match.group(1))
mavproxy.expect("Log]") mavproxy.expect("Log]")
for i in range(numlogs): for i in range(numlogs):
@ -243,6 +248,7 @@ def run_tests(steps):
print(">>>> FAILED STEP: %s at %s (%s)" % (step, time.asctime(), msg)) print(">>>> FAILED STEP: %s at %s (%s)" % (step, time.asctime(), msg))
traceback.print_exc(file=sys.stdout) traceback.print_exc(file=sys.stdout)
results.add(step, '<span class="failed-text">FAILED</span>', time.time() - t1) results.add(step, '<span class="failed-text">FAILED</span>', time.time() - t1)
util.pexpect_close_all()
continue continue
results.add(step, '<span class="passed-text">PASSED</span>', time.time() - t1) results.add(step, '<span class="passed-text">PASSED</span>', time.time() - t1)
print(">>>> PASSED STEP: %s at %s" % (step, time.asctime())) print(">>>> PASSED STEP: %s at %s" % (step, time.asctime()))