Build Prime95 report
This commit is contained in:
parent
a00105f718
commit
8a8a63eb66
1 changed files with 58 additions and 25 deletions
|
|
@ -264,7 +264,7 @@ class TestObj():
|
||||||
self.disabled = False
|
self.disabled = False
|
||||||
self.failed = False
|
self.failed = False
|
||||||
self.passed = False
|
self.passed = False
|
||||||
self.report = ''
|
self.report = []
|
||||||
self.started = False
|
self.started = False
|
||||||
self.status = ''
|
self.status = ''
|
||||||
self.update_status()
|
self.update_status()
|
||||||
|
|
@ -615,6 +615,7 @@ def run_hw_tests(state):
|
||||||
f(state, test_obj)
|
f(state, test_obj)
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
show_results(state)
|
||||||
pause('Press Enter to return to main menu... ')
|
pause('Press Enter to return to main menu... ')
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
|
@ -738,42 +739,67 @@ def run_mprime_test(state, test):
|
||||||
item.path,
|
item.path,
|
||||||
global_vars['LogDir']))
|
global_vars['LogDir']))
|
||||||
|
|
||||||
# Check results
|
# Check results and build report
|
||||||
test.logs = {}
|
test.logs = {}
|
||||||
for log in ['results.txt', 'prime.log']:
|
for log in ['results.txt', 'prime.log']:
|
||||||
_data = ''
|
lines = []
|
||||||
log_path = '{}/{}'.format(global_vars['LogDir'], log)
|
log_path = '{}/{}'.format(global_vars['LogDir'], log)
|
||||||
|
|
||||||
# Read and save log
|
# Read and save log
|
||||||
try:
|
try:
|
||||||
with open(log_path, 'r') as f:
|
with open(log_path, 'r') as f:
|
||||||
_data = f.read()
|
lines = f.read().splitlines()
|
||||||
test.logs[log] = _data.splitlines()
|
test.logs[log] = lines
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# Ignore since files may be missing for slower CPUs
|
# Ignore since files may be missing for slower CPUs
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# results.txt: NS check
|
# results.txt (NS check)
|
||||||
if log == 'results.txt':
|
if log == 'results.txt':
|
||||||
if re.search(r'(error|fail)', _data, re.IGNORECASE):
|
_tmp = []
|
||||||
test.failed = True
|
for line in lines:
|
||||||
test.update_status('NS')
|
if re.search(r'(error|fail)', line, re.IGNORECASE):
|
||||||
|
test.failed = True
|
||||||
|
test.update_status('NS')
|
||||||
|
_tmp.append(' {YELLOW}{line}{CLEAR}'.format(**COLORS))
|
||||||
|
if _tmp:
|
||||||
|
test.report.append('{BLUE}Log: results.txt{CLEAR}'.format(**COLORS))
|
||||||
|
test.report.extend(_tmp)
|
||||||
|
|
||||||
# prime.log: CS check
|
# prime.log (CS check)
|
||||||
if log == 'prime.log':
|
if log == 'prime.log':
|
||||||
if re.search(
|
_tmp_pass = []
|
||||||
r'completed.*0 errors, 0 warnings', _data, re.IGNORECASE):
|
_tmp_warn = []
|
||||||
test.passed = True
|
for line in lines:
|
||||||
test.update_status('CS')
|
if re.search(
|
||||||
elif re.search(
|
r'completed.*0 errors, 0 warnings', line, re.IGNORECASE):
|
||||||
r'completed.*\d+ errors, \d+ warnings', _data, re.IGNORECASE):
|
_tmp_pass.append(line)
|
||||||
# If the first re.search does not match and this one does then
|
elif re.search(
|
||||||
# that means that either errors or warnings, or both, are non-zero
|
r'completed.*\d+ errors, \d+ warnings', line, re.IGNORECASE):
|
||||||
test.failed = True
|
# If the first re.search does not match and this one does then
|
||||||
test.passed = False
|
# that means that either errors or warnings, or both, are non-zero
|
||||||
test.update_status('NS')
|
_tmp_warn.append(line)
|
||||||
|
if len(_tmp_warn) > 0:
|
||||||
|
test.failed = True
|
||||||
|
test.passed = False
|
||||||
|
test.update_status('NS')
|
||||||
|
elif len(_tmp_pass) > 0:
|
||||||
|
test.passed = True
|
||||||
|
test.update_status('CS')
|
||||||
|
if len(_tmp_pass) + len(_tmp_warn) > 0:
|
||||||
|
test.report.append('{BLUE}Log: prime.log{CLEAR}'.format(**COLORS))
|
||||||
|
for line in _tmp_pass:
|
||||||
|
test.report.append(' {}'.format(line))
|
||||||
|
for line in _tmp_warn:
|
||||||
|
test.report.append(' {YELLOW}{line}{CLEAR}'.format(line, **COLORS))
|
||||||
|
test.report.append(' ')
|
||||||
|
|
||||||
|
# Finalize report
|
||||||
if not (test.aborted or test.failed or test.passed):
|
if not (test.aborted or test.failed or test.passed):
|
||||||
test.update_status('Unknown')
|
test.update_status('Unknown')
|
||||||
|
test.report.append('{BLUE}Temps{CLEAR}'.format(**COLORS))
|
||||||
|
for line in generate_report(test.sensor_data, 'Idle', 'Max', 'Cooldown'):
|
||||||
|
test.report.append(' {}'.format(line))
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
update_progress_pane(state)
|
update_progress_pane(state)
|
||||||
|
|
@ -782,10 +808,6 @@ def run_mprime_test(state, test):
|
||||||
tmux_kill_pane(state.panes['mprime'], state.panes['Temps'])
|
tmux_kill_pane(state.panes['mprime'], state.panes['Temps'])
|
||||||
test.monitor_proc.kill()
|
test.monitor_proc.kill()
|
||||||
|
|
||||||
# TODO Testing
|
|
||||||
print('\n'.join(
|
|
||||||
generate_report(test.sensor_data, 'Idle', 'Max', 'Cooldown')))
|
|
||||||
|
|
||||||
def run_network_test():
|
def run_network_test():
|
||||||
"""Run network test."""
|
"""Run network test."""
|
||||||
clear_screen()
|
clear_screen()
|
||||||
|
|
@ -840,6 +862,17 @@ def secret_screensaver(screensaver=None):
|
||||||
raise Exception('Invalid screensaver')
|
raise Exception('Invalid screensaver')
|
||||||
run_program(cmd, check=False, pipe=False)
|
run_program(cmd, check=False, pipe=False)
|
||||||
|
|
||||||
|
def show_results(state):
|
||||||
|
"""Show results for all tests."""
|
||||||
|
for k, v in state.tests.items():
|
||||||
|
print_success('{}:'.format(k))
|
||||||
|
for obj in v['Objects']:
|
||||||
|
for line in obj.report:
|
||||||
|
print(line)
|
||||||
|
print_log(strip_colors(line))
|
||||||
|
print_standard(' ')
|
||||||
|
print_standard(' ')
|
||||||
|
|
||||||
def update_main_options(state, selection, main_options):
|
def update_main_options(state, selection, main_options):
|
||||||
"""Update menu and state based on selection."""
|
"""Update menu and state based on selection."""
|
||||||
index = int(selection) - 1
|
index = int(selection) - 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue