Switched to PASS/FAIL instead of CS/NS by request

This commit is contained in:
2Shirt 2019-01-08 15:02:56 -07:00
parent a0a76ee15d
commit 1e5f72f79a
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 21 additions and 21 deletions

View file

@ -327,10 +327,10 @@ def major_exception():
# No log file or uploading disabled # No log file or uploading disabled
sleep(10) sleep(10)
except: except:
print_error('Upload: NS') print_error('Upload: Failed')
sleep(10) sleep(10)
else: else:
print_success('Upload: CS') print_success('Upload: Complete')
pause('Press Enter to exit...') pause('Press Enter to exit...')
exit_script(1) exit_script(1)
@ -575,7 +575,7 @@ def get_exception(s):
def try_and_print(message='Trying...', 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, catch_all=True, print_return=False, silent_function=True,
indent=8, width=32, *args, **kwargs): indent=8, width=32, *args, **kwargs):
"""Run function, print if successful or not, and return dict. """Run function, print if successful or not, and return dict.
@ -661,7 +661,7 @@ def upload_crash_details():
headers={'X-Requested-With': 'XMLHttpRequest'}, headers={'X-Requested-With': 'XMLHttpRequest'},
auth=(CRASH_SERVER['User'], CRASH_SERVER['Pass']), auth=(CRASH_SERVER['User'], CRASH_SERVER['Pass']),
verify=certificate_authority) verify=certificate_authority)
# Raise exception if upload NS # Raise exception if upload failed
if not r.ok: if not r.ok:
raise Exception raise Exception
else: else:

View file

@ -69,9 +69,9 @@ KEY_SMART = 'ata_smart_attributes'
QUICK_LABEL = '{YELLOW}(Quick){CLEAR}'.format(**COLORS) QUICK_LABEL = '{YELLOW}(Quick){CLEAR}'.format(**COLORS)
SIDE_PANE_WIDTH = 20 SIDE_PANE_WIDTH = 20
STATUSES = { STATUSES = {
'RED': ['Denied', 'ERROR', 'NS', 'TimedOut'], 'RED': ['Denied', 'ERROR', 'FAIL', 'TimedOut'],
'YELLOW': ['Aborted', 'N/A', 'OVERRIDE', 'Unknown', 'Working'], 'YELLOW': ['Aborted', 'N/A', 'OVERRIDE', 'Unknown', 'Working'],
'GREEN': ['CS'], 'GREEN': ['PASS'],
} }
TESTS_CPU = ['Prime95'] TESTS_CPU = ['Prime95']
TESTS_DISK = [ TESTS_DISK = [
@ -507,7 +507,7 @@ class DiskObj():
if not self.disk_ok: if not self.disk_ok:
if 'NVMe / SMART' in self.tests: if 'NVMe / SMART' in self.tests:
# NOTE: This will not overwrite the existing status if set # 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: if not self.tests['NVMe / SMART'].report:
self.tests['NVMe / SMART'].report = self.generate_attribute_report() self.tests['NVMe / SMART'].report = self.generate_attribute_report()
for t in ['badblocks', 'I/O Benchmark']: for t in ['badblocks', 'I/O Benchmark']:
@ -988,9 +988,9 @@ def run_badblocks_test(state, test):
# Update status # Update status
if test.failed: if test.failed:
test.update_status('NS') test.update_status('FAIL')
elif test.passed: elif test.passed:
test.update_status('CS') test.update_status('PASS')
else: else:
test.update_status('Unknown') test.update_status('Unknown')
@ -1278,9 +1278,9 @@ def run_io_benchmark(state, test):
# Update status # Update status
if test.failed: if test.failed:
test.update_status('NS') test.update_status('FAIL')
elif test.passed: elif test.passed:
test.update_status('CS') test.update_status('PASS')
elif not 'N/A' in test.status: elif not 'N/A' in test.status:
test.update_status('Unknown') test.update_status('Unknown')
@ -1431,7 +1431,7 @@ def run_mprime_test(state, test):
line = line.strip() line = line.strip()
if re.search(r'(error|fail)', line, re.IGNORECASE): if re.search(r'(error|fail)', line, re.IGNORECASE):
test.failed = True test.failed = True
test.update_status('NS') test.update_status('FAIL')
test.report.append( test.report.append(
' {YELLOW}{line}{CLEAR}'.format(line=line, **COLORS)) ' {YELLOW}{line}{CLEAR}'.format(line=line, **COLORS))
@ -1455,10 +1455,10 @@ def run_mprime_test(state, test):
# NS # NS
test.failed = True test.failed = True
test.passed = False test.passed = False
test.update_status('NS') test.update_status('FAIL')
elif len(_tmp['Pass']) > 0 and not test.aborted: elif len(_tmp['Pass']) > 0 and not test.aborted:
test.passed = True test.passed = True
test.update_status('CS') test.update_status('PASS')
for line in sorted(_tmp['Pass'].keys()): for line in sorted(_tmp['Pass'].keys()):
test.report.append(' {}'.format(line)) test.report.append(' {}'.format(line))
for line in sorted(_tmp['Warn'].keys()): 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 # NOTE: Pass/Fail is just the attribute check
if test.dev.disk_ok: if test.dev.disk_ok:
test.passed = True test.passed = True
test.update_status('CS') test.update_status('PASS')
else: else:
# NOTE: Other test(s) should've been disabled by DiskObj.safety_check() # NOTE: Other test(s) should've been disabled by DiskObj.safety_check()
test.failed = True test.failed = True
test.update_status('NS') test.update_status('FAIL')
# SMART # SMART
elif test.dev.smart_attributes: elif test.dev.smart_attributes:
# NOTE: Pass/Fail based on both attributes and SMART short self-test # NOTE: Pass/Fail based on both attributes and SMART short self-test
if not (test.dev.disk_ok or 'OVERRIDE' in test.status): if not (test.dev.disk_ok or 'OVERRIDE' in test.status):
test.failed = True test.failed = True
test.update_status('NS') test.update_status('FAIL')
elif state.quick_mode: elif state.quick_mode:
if test.dev.disk_ok: if test.dev.disk_ok:
test.passed = True test.passed = True
test.update_status('CS') test.update_status('PASS')
else: else:
test.failed = True test.failed = True
test.update_status('NS') test.update_status('FAIL')
else: else:
# Prep # Prep
test.timeout = test.dev.smart_self_test['polling_minutes'].get( 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 test.dev.smart_self_test['status'].get('passed', False):
if 'OVERRIDE' not in test.status: if 'OVERRIDE' not in test.status:
test.passed = True test.passed = True
test.update_status('CS') test.update_status('PASS')
else: else:
test.failed = True test.failed = True
test.update_status('NS') test.update_status('FAIL')
else: else:
test.dev.smart_timeout = True test.dev.smart_timeout = True
test.update_status('TimedOut') test.update_status('TimedOut')