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:
parent
7e6942253c
commit
44ac019c96
1 changed files with 22 additions and 6 deletions
|
@ -30,6 +30,8 @@ def get_results():
|
||||||
def show_progress(scr):
|
def show_progress(scr):
|
||||||
global num_servers
|
global num_servers
|
||||||
global vm
|
global vm
|
||||||
|
global dir
|
||||||
|
global timestamp
|
||||||
|
|
||||||
scr.leaveok(1)
|
scr.leaveok(1)
|
||||||
scr.addstr(0, 0, "Parallel test execution status", curses.A_BOLD)
|
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']
|
vm[i]['done'] = vm[i]['total']
|
||||||
scr.move(i + 1, 10)
|
scr.move(i + 1, 10)
|
||||||
scr.clrtoeol()
|
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
|
updated = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -118,6 +125,8 @@ def show_progress(scr):
|
||||||
def main():
|
def main():
|
||||||
global num_servers
|
global num_servers
|
||||||
global vm
|
global vm
|
||||||
|
global dir
|
||||||
|
global timestamp
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
sys.exit("Usage: %s <number of VMs> [params..]" % sys.argv[0])
|
sys.exit("Usage: %s <number of VMs> [params..]" % sys.argv[0])
|
||||||
|
@ -125,6 +134,12 @@ def main():
|
||||||
if num_servers < 1:
|
if num_servers < 1:
|
||||||
sys.exit("Too small number of VMs")
|
sys.exit("Too small number of VMs")
|
||||||
|
|
||||||
|
dir = '/tmp/hwsim-test-logs'
|
||||||
|
try:
|
||||||
|
os.mkdir(dir)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
vm = {}
|
vm = {}
|
||||||
for i in range(0, num_servers):
|
for i in range(0, num_servers):
|
||||||
|
@ -150,11 +165,6 @@ def main():
|
||||||
|
|
||||||
curses.wrapper(show_progress)
|
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:
|
with open('{}/{}-parallel.log'.format(dir, timestamp), 'w') as f:
|
||||||
for i in range(0, num_servers):
|
for i in range(0, num_servers):
|
||||||
f.write('VM {}\n{}\n{}\n'.format(i, vm[i]['out'], vm[i]['err']))
|
f.write('VM {}\n{}\n{}\n'.format(i, vm[i]['out'], vm[i]['err']))
|
||||||
|
@ -168,5 +178,11 @@ def main():
|
||||||
print
|
print
|
||||||
print("TOTAL={} PASS={} FAIL={} SKIP={}".format(len(started), len(passed), len(failed), len(skipped)))
|
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__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue