From 941dbada54eaaf133bc05c37066d327eed2c285d Mon Sep 17 00:00:00 2001 From: smj01095381 Date: Fri, 11 Feb 2022 18:45:01 +0800 Subject: [PATCH 1/4] To optimize the output --- ancert | 14 +++++++++++--- lib/utils.py | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ancert b/ancert index d414929..8039222 100755 --- a/ancert +++ b/ancert @@ -129,15 +129,21 @@ def main(args): print(' {:<4}{:50}'.format('[-]', '%s [%s]' % (device.get_property('DRIVE_FULL_NAME'), device.get_property('DISK_SIZE')))) return 0 - + display_categories_lst = ['NVMe', 'Video', 'Network', 'Storage', 'GPU', 'FC', 'CPU'] + c = 0 for comp_inst in selected_components: printed = [] for gname, tasks in comp_inst.next_tasks(): if tasks[0].test.controller not in printed: + if comp_inst.name in display_categories_lst: + print('') + else: + if c == 0 and comp_inst.name not in ['memory']: + print('') if comp_inst.name in ['memory']: - print('\nTested controller: %s' % tasks[0].test.controller.name) + print('Tested controller: %s' % tasks[0].test.controller.name) else: - print('\nTested controller: %s [%s]' % (tasks[0].test.controller.name.strip(), + print('Tested controller: %s [%s]' % (tasks[0].test.controller.name.strip(), tasks[0].test.controller.driver)) printed.append(tasks[0].test.controller) run_task(gname, tasks) @@ -145,6 +151,8 @@ def main(args): all_tests_pass = True if total_finished_tasks: + sys.stdout.write(' '*200+'\r') + sys.stdout.flush() print('Results Summary:') print('{:<12}{:22}{:<12}{:<52}'.format('Category:', 'Case:', 'Result:', 'Device name:')) print('-'*66) diff --git a/lib/utils.py b/lib/utils.py index 4f8d0a6..ff9d05d 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -193,7 +193,7 @@ def status_bar(alarm, max_runtime, prefix, data, sleep_time=0.1): deploy(i, max_runtime+2) break deploy(i, int(i * sleep_time)) - sys.stdout.write(' '*200+'\r') + sys.stdout.write('\r') sys.stdout.flush() -- Gitee From c155c3eebd71edecb020eb7be3d5669e47b2df87 Mon Sep 17 00:00:00 2001 From: smj01095381 Date: Fri, 11 Feb 2022 18:48:00 +0800 Subject: [PATCH 2/4] To optimize the output --- ancert | 1 + 1 file changed, 1 insertion(+) diff --git a/ancert b/ancert index 8039222..6489323 100755 --- a/ancert +++ b/ancert @@ -147,6 +147,7 @@ def main(args): tasks[0].test.controller.driver)) printed.append(tasks[0].test.controller) run_task(gname, tasks) + c += 1 total_finished_tasks.extend(tasks) all_tests_pass = True -- Gitee From 7e76bcabc3fcf50078f305619c9af60c32397050 Mon Sep 17 00:00:00 2001 From: smj01095381 Date: Fri, 11 Feb 2022 18:54:06 +0800 Subject: [PATCH 3/4] To optimize the output --- ancert | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ancert b/ancert index 6489323..1782c45 100755 --- a/ancert +++ b/ancert @@ -219,7 +219,7 @@ if '__main__' == __name__: @atexit.register def trigger_before_exit(): - print('-' * 33) + print('-' * 66) pack_log_dir(logdir) sys.exit(main(args)) -- Gitee From 6cbd4a98f8f9f309634ee45786183c95b65b5c34 Mon Sep 17 00:00:00 2001 From: smj01095381 Date: Tue, 15 Feb 2022 19:36:35 +0800 Subject: [PATCH 4/4] To optimize the output --- ancert | 4 ++-- lib/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ancert b/ancert index acf314e..1158e90 100755 --- a/ancert +++ b/ancert @@ -133,6 +133,7 @@ def main(args): print(' {:<4}{:50}'.format('[-]', '%s [%s]' % (device.get_property('DRIVE_FULL_NAME'), device.get_property('DISK_SIZE')))) return 0 + display_categories_lst = ['NVMe', 'Video', 'Network', 'Storage', 'GPU', 'FC', 'CPU'] c = 0 for comp_inst in selected_components: @@ -156,8 +157,7 @@ def main(args): global RESULT if total_finished_tasks: - sys.stdout.write(' '*200+'\r') - sys.stdout.flush() + print('') print('Results Summary:') print('{:<12}{:22}{:<12}{:<52}'.format('Category:', 'Case:', 'Result:', 'Device name:')) print('-'*66) diff --git a/lib/utils.py b/lib/utils.py index c55606c..a215a1c 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -183,7 +183,7 @@ def status_bar(alarm, max_runtime, prefix, data, sleep_time=0.1): msg = msg + ' %s:%s' % (key, blinking(j+i, x, ti)) if i != length: msg = msg + ',' - msg = prefix + msg + '\r' + msg = '\r\x1b[K' + prefix + msg sys.stdout.write(msg) sys.stdout.flush() @@ -193,7 +193,7 @@ def status_bar(alarm, max_runtime, prefix, data, sleep_time=0.1): deploy(i, max_runtime+2) break deploy(i, int(i * sleep_time)) - sys.stdout.write('\r') + sys.stdout.write('\r\x1b[K') sys.stdout.flush() -- Gitee