From 44ac019c964868dc7c90aa19c8ff54b4c2924d25 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 16 Nov 2014 22:34:54 +0200 Subject: [PATCH] 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 --- tests/hwsim/vm/parallel-vm.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py index 6436c341c..055380f85 100755 --- a/tests/hwsim/vm/parallel-vm.py +++ b/tests/hwsim/vm/parallel-vm.py @@ -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 [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()