Fixed status updates
This commit is contained in:
parent
bb93386fa0
commit
a00105f718
1 changed files with 25 additions and 21 deletions
|
|
@ -214,10 +214,10 @@ class State():
|
||||||
})
|
})
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
"""Set log and add devices."""
|
"""Remove test objects, set log, and add devices."""
|
||||||
self.disks = []
|
self.disks = []
|
||||||
for k in ['Result', 'Started', 'Status']:
|
for k, v in self.tests.items():
|
||||||
self.tests['Prime95'][k] = False if k == 'Started' else ''
|
v['Objects'] = []
|
||||||
|
|
||||||
# Update LogDir
|
# Update LogDir
|
||||||
if not self.quick_mode:
|
if not self.quick_mode:
|
||||||
|
|
@ -596,7 +596,7 @@ def run_hw_tests(state):
|
||||||
v['Objects'].append(test_obj)
|
v['Objects'].append(test_obj)
|
||||||
elif k in TESTS_DISK:
|
elif k in TESTS_DISK:
|
||||||
for disk in state.disks:
|
for disk in state.disks:
|
||||||
test_obj = TestObj(dev=k)
|
test_obj = TestObj(dev=k, label=disk.name)
|
||||||
disk.tests[k] = test_obj
|
disk.tests[k] = test_obj
|
||||||
v['Objects'].append(test_obj)
|
v['Objects'].append(test_obj)
|
||||||
print_standard('')
|
print_standard('')
|
||||||
|
|
@ -705,7 +705,7 @@ def run_mprime_test(state, test):
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
# Catch CTRL+C
|
# Catch CTRL+C
|
||||||
test.aborted = True
|
test.aborted = True
|
||||||
test.status = 'Aborted'
|
test.update_status('Aborted')
|
||||||
print_warning('\nAborted.')
|
print_warning('\nAborted.')
|
||||||
update_progress_pane(state)
|
update_progress_pane(state)
|
||||||
|
|
||||||
|
|
@ -757,23 +757,23 @@ def run_mprime_test(state, test):
|
||||||
if log == 'results.txt':
|
if log == 'results.txt':
|
||||||
if re.search(r'(error|fail)', _data, re.IGNORECASE):
|
if re.search(r'(error|fail)', _data, re.IGNORECASE):
|
||||||
test.failed = True
|
test.failed = True
|
||||||
test.status = 'NS'
|
test.update_status('NS')
|
||||||
|
|
||||||
# prime.log: CS check
|
# prime.log: CS check
|
||||||
if log == 'prime.log':
|
if log == 'prime.log':
|
||||||
if re.search(
|
if re.search(
|
||||||
r'completed.*0 errors, 0 warnings', _data, re.IGNORECASE):
|
r'completed.*0 errors, 0 warnings', _data, re.IGNORECASE):
|
||||||
test.passed = True
|
test.passed = True
|
||||||
test.status = 'CS'
|
test.update_status('CS')
|
||||||
elif re.search(
|
elif re.search(
|
||||||
r'completed.*\d+ errors, \d+ warnings', _data, re.IGNORECASE):
|
r'completed.*\d+ errors, \d+ warnings', _data, re.IGNORECASE):
|
||||||
# If the first re.search does not match and this one does then
|
# If the first re.search does not match and this one does then
|
||||||
# that means that either errors or warnings, or both, are non-zero
|
# that means that either errors or warnings, or both, are non-zero
|
||||||
test.failed = True
|
test.failed = True
|
||||||
test.passed = False
|
test.passed = False
|
||||||
test.status = 'NS'
|
test.update_status('NS')
|
||||||
if not (test.aborted or test.failed or test.passed):
|
if not (test.aborted or test.failed or test.passed):
|
||||||
test.status = 'Unknown'
|
test.update_status('Unknown')
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
update_progress_pane(state)
|
update_progress_pane(state)
|
||||||
|
|
@ -910,18 +910,22 @@ def update_io_progress(percent, rate, progress_file):
|
||||||
def update_progress_pane(state):
|
def update_progress_pane(state):
|
||||||
"""Update progress file for side pane."""
|
"""Update progress file for side pane."""
|
||||||
output = []
|
output = []
|
||||||
|
|
||||||
# Prime95
|
|
||||||
output.append(state.tests['Prime95']['Status'])
|
|
||||||
output.append(' ')
|
|
||||||
|
|
||||||
# Disks
|
|
||||||
for k, v in state.tests.items():
|
for k, v in state.tests.items():
|
||||||
if 'Prime95' not in k and v['Enabled']:
|
# Skip disabled sections
|
||||||
output.append('{BLUE}{test_name}{CLEAR}'.format(
|
if not v['Enabled']:
|
||||||
test_name=k, **COLORS))
|
continue
|
||||||
for disk in state.disks:
|
|
||||||
output.append(disk.tests[k]['Status'])
|
# Add section name
|
||||||
|
if k != 'Prime95':
|
||||||
|
output.append('{BLUE}{name}{CLEAR}'.format(name=k, **COLORS))
|
||||||
|
if 'SMART' in k and state.quick_mode:
|
||||||
|
output.append(' {YELLOW}(Quick Check){CLEAR}'.format(**COLORS))
|
||||||
|
|
||||||
|
# Add status from test object(s)
|
||||||
|
for test in v['Objects']:
|
||||||
|
output.append(test.status)
|
||||||
|
|
||||||
|
# Add spacer before next section
|
||||||
output.append(' ')
|
output.append(' ')
|
||||||
|
|
||||||
# Add line-endings
|
# Add line-endings
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue