Override sections working

This commit is contained in:
2Shirt 2018-12-11 23:54:02 -07:00
parent 47084efe17
commit b5c93317dc
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -125,7 +125,7 @@ class DiskObj():
items = self.nvme_attributes.items() items = self.nvme_attributes.items()
elif self.smart_attributes: elif self.smart_attributes:
attr_type = 'SMART' attr_type = 'SMART'
items = self.smar_attributes.items() items = self.smart_attributes.items()
for k, v in items: for k, v in items:
if k in ATTRIBUTES[attr_type]: if k in ATTRIBUTES[attr_type]:
if 'Error' not in ATTRIBUTES[attr_type][k]: if 'Error' not in ATTRIBUTES[attr_type][k]:
@ -359,8 +359,6 @@ class TestObj():
def update_status(self, new_status=None): def update_status(self, new_status=None):
"""Update status strings.""" """Update status strings."""
if self.disabled:
return
if new_status: if new_status:
self.status = build_status_string( self.status = build_status_string(
self.label, new_status, self.info_label) self.label, new_status, self.info_label)
@ -650,11 +648,11 @@ def run_badblocks_test(state, test):
TOP_PANE_TEXT, 'badblocks')) TOP_PANE_TEXT, 'badblocks'))
print_standard('TODO: run_badblocks_test({})'.format( print_standard('TODO: run_badblocks_test({})'.format(
test.dev.path)) test.dev.path))
for disk in state.disks: test.started = True
disk.tests['badblocks']['Started'] = True test.update_status()
update_progress_pane(state) update_progress_pane(state)
sleep(3) sleep(3)
disk.tests['badblocks']['Result'] = 'OVERRIDE' test.update_status('Unknown')
update_progress_pane(state) update_progress_pane(state)
def run_hw_tests(state): def run_hw_tests(state):
@ -691,7 +689,7 @@ def run_hw_tests(state):
# Run safety checks # Run safety checks
for disk in state.disks: for disk in state.disks:
disk.safety_check() disk.safety_check(silent=state.quick_mode)
# Run tests # Run tests
## Because state.tests is an OrderedDict and the disks were added ## Because state.tests is an OrderedDict and the disks were added
@ -704,7 +702,7 @@ def run_hw_tests(state):
# Done # Done
show_results(state) show_results(state)
if '--quick' in sys.argv: if state.quick_mode:
pause('Press Enter to exit...') pause('Press Enter to exit...')
else: else:
pause('Press Enter to return to main menu... ') pause('Press Enter to return to main menu... ')
@ -719,11 +717,11 @@ def run_io_benchmark(state, test):
TOP_PANE_TEXT, 'I/O Benchmark')) TOP_PANE_TEXT, 'I/O Benchmark'))
print_standard('TODO: run_io_benchmark({})'.format( print_standard('TODO: run_io_benchmark({})'.format(
test.dev.path)) test.dev.path))
for disk in state.disks: test.started = True
disk.tests['I/O Benchmark']['Started'] = True test.update_status()
update_progress_pane(state) update_progress_pane(state)
sleep(3) sleep(3)
disk.tests['I/O Benchmark']['Result'] = 'Unknown' test.update_status('Unknown')
update_progress_pane(state) update_progress_pane(state)
def run_keyboard_test(): def run_keyboard_test():
@ -928,22 +926,42 @@ def run_nvme_smart_tests(state, test):
test.passed = True test.passed = True
test.update_status('CS') test.update_status('CS')
else: else:
# 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('NS')
elif test.dev.smart_attributes: elif test.dev.smart_attributes:
# NOTE: Pass/Fail based on both attributes and SMART short self-test
if test.dev.disk_ok: if test.dev.disk_ok:
# Run short test
pause('TODO: Run SMART short self-test')
# Check result
# TODO
short_test_passed = True
if short_test_passed:
test.passed = True test.passed = True
test.update_status('CS') test.update_status('CS')
else:
for t in ['badblocks', 'I/O Benchmark']:
if t in test.dev.tests:
test.dev.tests[t].disabled = True
test.dev.tests[t].update_status('Denied')
# TODO
if no_logs:
test.update_status('Unknown')
else: else:
test.failed = True test.failed = True
test.update_status('NS') test.update_status('NS')
else: else:
print_standard('Tests disabled for this device')
test.update_status('N/A')
if not ask('Run tests on this device anyway?'):
test.failed = True test.failed = True
test.update_status('NS')
else:
# NOTE: Pass/Fail not applicable without NVMe/SMART data
# Override request earlier disabled other test(s) as appropriate
test.update_status('N/A')
# Done
update_progress_pane(state) update_progress_pane(state)
sleep(3)
def secret_screensaver(screensaver=None): def secret_screensaver(screensaver=None):
"""Show screensaver.""" """Show screensaver."""