From 1e5f72f79af41d4d576dfc6a1bfd6ed561c1cedc Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Tue, 8 Jan 2019 15:02:56 -0700 Subject: [PATCH] Switched to PASS/FAIL instead of CS/NS by request --- .bin/Scripts/functions/common.py | 8 +++---- .bin/Scripts/functions/hw_diags.py | 34 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.bin/Scripts/functions/common.py b/.bin/Scripts/functions/common.py index 1aa1e1da..f5f3cb77 100644 --- a/.bin/Scripts/functions/common.py +++ b/.bin/Scripts/functions/common.py @@ -327,10 +327,10 @@ def major_exception(): # No log file or uploading disabled sleep(10) except: - print_error('Upload: NS') + print_error('Upload: Failed') sleep(10) else: - print_success('Upload: CS') + print_success('Upload: Complete') pause('Press Enter to exit...') exit_script(1) @@ -575,7 +575,7 @@ def get_exception(s): def try_and_print(message='Trying...', - function=None, cs='CS', ns='NS', other_results={}, + function=None, cs='SUCCESS', ns='FAILED', other_results={}, catch_all=True, print_return=False, silent_function=True, indent=8, width=32, *args, **kwargs): """Run function, print if successful or not, and return dict. @@ -661,7 +661,7 @@ def upload_crash_details(): headers={'X-Requested-With': 'XMLHttpRequest'}, auth=(CRASH_SERVER['User'], CRASH_SERVER['Pass']), verify=certificate_authority) - # Raise exception if upload NS + # Raise exception if upload failed if not r.ok: raise Exception else: diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index 5a434a38..7682f5cc 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -69,9 +69,9 @@ KEY_SMART = 'ata_smart_attributes' QUICK_LABEL = '{YELLOW}(Quick){CLEAR}'.format(**COLORS) SIDE_PANE_WIDTH = 20 STATUSES = { - 'RED': ['Denied', 'ERROR', 'NS', 'TimedOut'], + 'RED': ['Denied', 'ERROR', 'FAIL', 'TimedOut'], 'YELLOW': ['Aborted', 'N/A', 'OVERRIDE', 'Unknown', 'Working'], - 'GREEN': ['CS'], + 'GREEN': ['PASS'], } TESTS_CPU = ['Prime95'] TESTS_DISK = [ @@ -507,7 +507,7 @@ class DiskObj(): if not self.disk_ok: if 'NVMe / SMART' in self.tests: # NOTE: This will not overwrite the existing status if set - self.disable_test('NVMe / SMART', 'NS') + self.disable_test('NVMe / SMART', 'FAIL') if not self.tests['NVMe / SMART'].report: self.tests['NVMe / SMART'].report = self.generate_attribute_report() for t in ['badblocks', 'I/O Benchmark']: @@ -988,9 +988,9 @@ def run_badblocks_test(state, test): # Update status if test.failed: - test.update_status('NS') + test.update_status('FAIL') elif test.passed: - test.update_status('CS') + test.update_status('PASS') else: test.update_status('Unknown') @@ -1278,9 +1278,9 @@ def run_io_benchmark(state, test): # Update status if test.failed: - test.update_status('NS') + test.update_status('FAIL') elif test.passed: - test.update_status('CS') + test.update_status('PASS') elif not 'N/A' in test.status: test.update_status('Unknown') @@ -1431,7 +1431,7 @@ def run_mprime_test(state, test): line = line.strip() if re.search(r'(error|fail)', line, re.IGNORECASE): test.failed = True - test.update_status('NS') + test.update_status('FAIL') test.report.append( ' {YELLOW}{line}{CLEAR}'.format(line=line, **COLORS)) @@ -1455,10 +1455,10 @@ def run_mprime_test(state, test): # NS test.failed = True test.passed = False - test.update_status('NS') + test.update_status('FAIL') elif len(_tmp['Pass']) > 0 and not test.aborted: test.passed = True - test.update_status('CS') + test.update_status('PASS') for line in sorted(_tmp['Pass'].keys()): test.report.append(' {}'.format(line)) for line in sorted(_tmp['Warn'].keys()): @@ -1519,25 +1519,25 @@ def run_nvme_smart_tests(state, test): # NOTE: Pass/Fail is just the attribute check if test.dev.disk_ok: test.passed = True - test.update_status('CS') + test.update_status('PASS') else: # NOTE: Other test(s) should've been disabled by DiskObj.safety_check() test.failed = True - test.update_status('NS') + test.update_status('FAIL') # SMART elif test.dev.smart_attributes: # NOTE: Pass/Fail based on both attributes and SMART short self-test if not (test.dev.disk_ok or 'OVERRIDE' in test.status): test.failed = True - test.update_status('NS') + test.update_status('FAIL') elif state.quick_mode: if test.dev.disk_ok: test.passed = True - test.update_status('CS') + test.update_status('PASS') else: test.failed = True - test.update_status('NS') + test.update_status('FAIL') else: # Prep test.timeout = test.dev.smart_self_test['polling_minutes'].get( @@ -1604,10 +1604,10 @@ def run_nvme_smart_tests(state, test): if test.dev.smart_self_test['status'].get('passed', False): if 'OVERRIDE' not in test.status: test.passed = True - test.update_status('CS') + test.update_status('PASS') else: test.failed = True - test.update_status('NS') + test.update_status('FAIL') else: test.dev.smart_timeout = True test.update_status('TimedOut')