diff --git a/ancert b/ancert index f9f2c0c3b7a88280121a8be891f0dd0cf02bad76..dd82a498290ff9176866e9feb8737cf4230f75ff 100755 --- a/ancert +++ b/ancert @@ -15,7 +15,7 @@ from lib.config import TESTS_DIR from lib.expection import NonAvaliableController, NonAvaliableDevice SUPPORT_COMPONENT = ['System', 'CPU', 'Memory', 'Video', 'GPU', 'Storage', 'Network', 'NVMe', 'FC'] - +RESULT = True def main(args): print('\n\t\t\tWelcome to use the Ancert!\n') @@ -147,7 +147,7 @@ def main(args): run_task(gname, tasks) total_finished_tasks.extend(tasks) - all_tests_pass = True + global RESULT if total_finished_tasks: print('Results Summary:') print('{:<12}{:22}{:<12}{:<52}'.format('Category:', 'Case:', 'Result:', 'Device name:')) @@ -157,12 +157,12 @@ def main(args): ret = 'PASS' else: ret = 'FAIL' - all_tests_pass = False + RESULT = False print('{:<12}{:22}{:<12}{:<52}'.format(t.test.controller.component.category, \ t.name, ret, t.test.controller.name.strip())) print('') - if all_tests_pass: + if RESULT: return 0 return 1 @@ -215,6 +215,9 @@ if '__main__' == __name__: @atexit.register def trigger_before_exit(): print('-' * 33) - pack_log_dir(logdir) + pack_log_dir(logdir, args, RESULT) - sys.exit(main(args)) + ret = main(args) + if ret != 0: + RESULT = False + sys.exit(ret) diff --git a/lib/component.py b/lib/component.py index 026cad8531e39747fa3e99cedd00b0f660a804ca..cb6c1da2ba789671198c9680a567b81d06e548a4 100644 --- a/lib/component.py +++ b/lib/component.py @@ -96,7 +96,7 @@ class Component(): def check_controller_state(self): for ctr in self.unavailable: if not ctr.get_property('DRIVER'): - raise NonDriverAttached('\nTest *FAILED* since following Controller was not claimed ' + raise NonDriverAttached('\nTest *FAIL* since following Controller was not claimed ' 'any driver, please manually attach driver or ask help from ' 'OpenAnolis community:\n %s' % ctr.name) diff --git a/lib/utils.py b/lib/utils.py index 6a5659fb5cc0bd6689137ae738e95c2e05101d86..ea5b8a4d45f817dee015daf96f401a82db917fa9 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -581,7 +581,7 @@ def get_boot_disk_hw_info(dk, ctr, dstree): return disk_name -def pack_log_dir(logdir): +def pack_log_dir(logdir, args, result): if not os.path.exists(logdir): print('Error: There are no log files to package in path {}'.format(logdir)) return False @@ -623,9 +623,11 @@ def pack_log_dir(logdir): print('Error: {}'.format(e)) return False - print('log pack success!') - print('log tar path: %s' % abs_log_tar_name) - print('please send log package to Alibaba hardware compatibility team') + if args.category: + print('%s Test *%s*!' % (args.category, 'PASS' if result else 'FAIL')) + print('Save tar log file to: %s' % abs_log_tar_name) + print('Please send tar log file %s OpenAnolis hardware compatibility team. ' + % ('to' if result else 'and ask help from')) return True