tests: Report kernel panic clearly in parallel-vm.py

Previously, it was possible for a kernel panic to be missed since the
only sign of it in stdout was reduced number of passed test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-11-16 22:34:54 +02:00
parent 7e6942253c
commit 44ac019c96

View file

@ -30,6 +30,8 @@ def get_results():
def show_progress(scr):
global num_servers
global vm
global dir
global timestamp
scr.leaveok(1)
scr.addstr(0, 0, "Parallel test execution status", curses.A_BOLD)
@ -50,7 +52,12 @@ def show_progress(scr):
vm[i]['done'] = vm[i]['total']
scr.move(i + 1, 10)
scr.clrtoeol()
scr.addstr("completed run")
log = '{}/{}.srv.{}/console'.format(dir, timestamp, i + 1)
with open(log, 'r') as f:
if "Kernel panic" in f.read():
scr.addstr("kernel panic")
else:
scr.addstr("completed run")
updated = True
continue
@ -118,6 +125,8 @@ def show_progress(scr):
def main():
global num_servers
global vm
global dir
global timestamp
if len(sys.argv) < 2:
sys.exit("Usage: %s <number of VMs> [params..]" % sys.argv[0])
@ -125,6 +134,12 @@ def main():
if num_servers < 1:
sys.exit("Too small number of VMs")
dir = '/tmp/hwsim-test-logs'
try:
os.mkdir(dir)
except:
pass
timestamp = int(time.time())
vm = {}
for i in range(0, num_servers):
@ -150,11 +165,6 @@ def main():
curses.wrapper(show_progress)
dir = '/tmp/hwsim-test-logs'
try:
os.mkdir(dir)
except:
pass
with open('{}/{}-parallel.log'.format(dir, timestamp), 'w') as f:
for i in range(0, num_servers):
f.write('VM {}\n{}\n{}\n'.format(i, vm[i]['out'], vm[i]['err']))
@ -168,5 +178,11 @@ def main():
print
print("TOTAL={} PASS={} FAIL={} SKIP={}".format(len(started), len(passed), len(failed), len(skipped)))
for i in range(0, num_servers):
log = '{}/{}.srv.{}/console'.format(dir, timestamp, i + 1)
with open(log, 'r') as f:
if "Kernel panic" in f.read():
print "Kernel panic in " + log
if __name__ == "__main__":
main()