From: Jouni Malinen Date: Tue, 17 Dec 2024 22:41:05 +0000 (+0200) Subject: tests: Remove the header line from VM tracking to free up space X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=951c6a33e4b84edcebafcc4b2255dbaf484ac276;p=thirdparty%2Fhostap.git tests: Remove the header line from VM tracking to free up space This allows one more VM to be tracked (or one more failed test case to be listed). Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py index 6ad390e2a..2a5f9b5ed 100755 --- a/tests/hwsim/vm/parallel-vm.py +++ b/tests/hwsim/vm/parallel-vm.py @@ -220,16 +220,16 @@ def vm_read_stderr(vm): def vm_next_step(_vm, scr, test_queue): max_y, max_x = scr.getmaxyx() - status_line = num_servers + 1 + status_line = num_servers if status_line >= max_y: status_line = max_y - 1 - if _vm['idx'] + 1 < status_line: - scr.move(_vm['idx'] + 1, 10) + if _vm['idx'] < status_line: + scr.move(_vm['idx'], 10) scr.clrtoeol() if not test_queue: _vm['proc'].stdin.write(b'\n') _vm['proc'].stdin.flush() - if _vm['idx'] + 1 < status_line: + if _vm['idx'] < status_line: scr.addstr("shutting down") logger.info("VM[%d] shutting down" % _vm['idx']) return @@ -238,14 +238,14 @@ def vm_next_step(_vm, scr, test_queue): _vm['current_count'] = count _vm['proc'].stdin.write(name.encode() + b'\n') _vm['proc'].stdin.flush() - if _vm['idx'] + 1 < status_line: + if _vm['idx'] < status_line: scr.addstr(name) logger.debug("VM[%d] start test %s" % (_vm['idx'], name)) def check_vm_start(scr, sel, test_queue): running = False max_y, max_x = scr.getmaxyx() - status_line = num_servers + 1 + status_line = num_servers if status_line >= max_y: status_line = max_y - 1 for i in range(num_servers): @@ -260,10 +260,10 @@ def check_vm_start(scr, sel, test_queue): num_starting = num_vm_starting() if vm[i]['cmd'] and len(test_queue) > num_starting and \ num_starting < max_start: - if i + 1 < status_line: - scr.move(i + 1, 10) + if i < status_line: + scr.move(i, 10) scr.clrtoeol() - scr.addstr(i + 1, 10, "starting VM") + scr.addstr(i, 10, "starting VM") start_vm(vm[i], sel) return True, True @@ -276,16 +276,16 @@ def vm_terminated(_vm, scr, sel, test_queue): sel.unregister(stream) _vm['proc'] = None max_y, max_x = scr.getmaxyx() - status_line = num_servers + 1 + status_line = num_servers if status_line >= max_y: status_line = max_y - 1 - if _vm['idx'] + 1 < status_line: - scr.move(_vm['idx'] + 1, 10) + if _vm['idx'] < status_line: + scr.move(_vm['idx'], 10) scr.clrtoeol() log = '{}/{}.srv.{}/console'.format(dir, timestamp, _vm['idx'] + 1) with open(log, 'r') as f: if "Kernel panic" in f.read(): - if _vm['idx'] + 1 < status_line: + if _vm['idx'] < status_line: scr.addstr("kernel panic") logger.info("VM[%d] kernel panic" % _vm['idx']) updated = True @@ -295,7 +295,7 @@ def vm_terminated(_vm, scr, sel, test_queue): if vm[i]['proc']: num_vm += 1 if len(test_queue) > num_vm: - if _vm['idx'] + 1 < status_line: + if _vm['idx'] < status_line: scr.addstr("unexpected exit") logger.info("VM[%d] unexpected exit" % _vm['idx']) updated = True @@ -303,7 +303,7 @@ def vm_terminated(_vm, scr, sel, test_queue): if _vm['current_name']: global total_failed, all_failed, first_run_failures, rerun_failures name = _vm['current_name'] - if _vm['idx'] + 1 < status_line: + if _vm['idx'] < status_line: if updated: scr.addstr(" - ") scr.addstr(name + " - did not complete") @@ -324,7 +324,7 @@ def vm_terminated(_vm, scr, sel, test_queue): def update_screen(scr, total_tests): max_y, max_x = scr.getmaxyx() - status_line = num_servers + 1 + status_line = num_servers if status_line >= max_y: status_line = max_y - 1 scr.move(status_line, 10) @@ -335,8 +335,8 @@ def update_screen(scr, total_tests): global all_failed max_y, max_x = scr.getmaxyx() max_lines = max_y - num_servers - 3 - if len(all_failed) > 0 and max_lines > 0 and num_servers + 2 < max_y - 1: - scr.move(num_servers + 2, 0) + if len(all_failed) > 0 and max_lines > 0 and num_servers + 1 < max_y - 1: + scr.move(num_servers + 1, 0) scr.addstr("Last failed test cases:") if max_lines >= len(all_failed): max_lines = len(all_failed) @@ -345,7 +345,7 @@ def update_screen(scr, total_tests): count += 1 if num_servers + 2 + count >= max_y: break - scr.move(num_servers + 2 + count, 0) + scr.move(num_servers + 1 + count, 0) scr.addstr(all_failed[i]) scr.clrtoeol() scr.refresh() @@ -368,15 +368,14 @@ def show_progress(scr): scr.leaveok(1) max_y, max_x = scr.getmaxyx() - status_line = num_servers + 1 - if status_line >= max_y: - status_line = max_y - 1 - scr.addstr(0, 0, "Parallel test execution status", curses.A_BOLD) + status_line = num_servers + if status_line > max_y: + status_line = max_y for i in range(0, num_servers): - if i + 1 < status_line: - scr.addstr(i + 1, 0, "VM %d:" % (i + 1), curses.A_BOLD) + if i < status_line: + scr.addstr(i, 0, "VM %d:" % (i + 1), curses.A_BOLD) status = "starting VM" if vm[i]['proc'] else "not yet started" - scr.addstr(i + 1, 10, status) + scr.addstr(i, 10, status) scr.addstr(status_line, 0, "Total:", curses.A_BOLD) scr.addstr(status_line, 20, "TOTAL={} STARTED=0 PASS=0 FAIL=0 SKIP=0".format(total_tests)) scr.refresh() @@ -408,7 +407,7 @@ def show_progress(scr): if not vm[i]['proc']: continue vm[i]['proc'] = None - scr.move(i + 1, 10) + scr.move(i, 10) scr.clrtoeol() scr.addstr("still running") logger.info("VM[%d] still running" % i)