Prime95 section complete
This commit is contained in:
parent
d9554314d5
commit
6c06a67fdf
2 changed files with 51 additions and 32 deletions
|
|
@ -674,7 +674,9 @@ def run_mprime_test(state, test):
|
||||||
try_and_print(
|
try_and_print(
|
||||||
message='Getting idle temps...', indent=0,
|
message='Getting idle temps...', indent=0,
|
||||||
function=save_average_temp, cs='Done',
|
function=save_average_temp, cs='Done',
|
||||||
sensor_data=test.sensor_data, temp_label='Idle')
|
sensor_data=test.sensor_data, temp_label='Idle',
|
||||||
|
seconds=3)
|
||||||
|
# TODO: Remove seconds kwarg above
|
||||||
|
|
||||||
# Stress CPU
|
# Stress CPU
|
||||||
print_log('Starting Prime95')
|
print_log('Starting Prime95')
|
||||||
|
|
@ -684,7 +686,9 @@ def run_mprime_test(state, test):
|
||||||
state.panes['mprime'],
|
state.panes['mprime'],
|
||||||
command=['hw-diags-prime95', global_vars['TmpDir']],
|
command=['hw-diags-prime95', global_vars['TmpDir']],
|
||||||
working_dir=global_vars['TmpDir'])
|
working_dir=global_vars['TmpDir'])
|
||||||
time_limit = int(MPRIME_LIMIT) * 60
|
#time_limit = int(MPRIME_LIMIT) * 60
|
||||||
|
# TODO: restore above line
|
||||||
|
time_limit = 10
|
||||||
try:
|
try:
|
||||||
for i in range(time_limit):
|
for i in range(time_limit):
|
||||||
clear_screen()
|
clear_screen()
|
||||||
|
|
@ -716,19 +720,23 @@ def run_mprime_test(state, test):
|
||||||
pipe=True)
|
pipe=True)
|
||||||
|
|
||||||
# Stop Prime95 (twice for good measure)
|
# Stop Prime95 (twice for good measure)
|
||||||
tmux_kill_pane(state.panes['mprime'])
|
|
||||||
run_program(['killall', '-s', 'INT', 'mprime'], check=False)
|
run_program(['killall', '-s', 'INT', 'mprime'], check=False)
|
||||||
|
sleep(1)
|
||||||
|
tmux_kill_pane(state.panes['mprime'])
|
||||||
|
|
||||||
# Get cooldown temp
|
# Get cooldown temp
|
||||||
run_program(['apple-fans', 'auto'])
|
run_program(['apple-fans', 'auto'])
|
||||||
clear_screen()
|
clear_screen()
|
||||||
try_and_print(
|
try_and_print(
|
||||||
message='Letting CPU cooldown for bit...', indent=0,
|
message='Letting CPU cooldown for bit...', indent=0,
|
||||||
function=sleep, cs='Done', seconds=10)
|
function=sleep, cs='Done', seconds=3)
|
||||||
|
# TODO: Above seconds should be 10
|
||||||
try_and_print(
|
try_and_print(
|
||||||
message='Getting cooldown temps...', indent=0,
|
message='Getting cooldown temps...', indent=0,
|
||||||
function=save_average_temp, cs='Done',
|
function=save_average_temp, cs='Done',
|
||||||
sensor_data=test.sensor_data, temp_label='Cooldown')
|
sensor_data=test.sensor_data, temp_label='Cooldown',
|
||||||
|
seconds=3)
|
||||||
|
# TODO: Remove seconds kwarg above
|
||||||
|
|
||||||
# Move logs to Ticket folder
|
# Move logs to Ticket folder
|
||||||
for item in os.scandir(global_vars['TmpDir']):
|
for item in os.scandir(global_vars['TmpDir']):
|
||||||
|
|
@ -761,44 +769,47 @@ def run_mprime_test(state, test):
|
||||||
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('NS')
|
||||||
_tmp.append(' {YELLOW}{line}{CLEAR}'.format(**COLORS))
|
_tmp.append(' {YELLOW}{line}{CLEAR}'.format(line=line, **COLORS))
|
||||||
if _tmp:
|
if _tmp:
|
||||||
test.report.append('{BLUE}Log: results.txt{CLEAR}'.format(**COLORS))
|
test.report.append('{BLUE}Log: results.txt{CLEAR}'.format(**COLORS))
|
||||||
test.report.extend(_tmp)
|
test.report.extend(_tmp)
|
||||||
|
|
||||||
# prime.log (CS check)
|
# prime.log (CS check)
|
||||||
if log == 'prime.log':
|
if log == 'prime.log':
|
||||||
_tmp_pass = []
|
_tmp = {'Pass': {}, 'Warn': {}}
|
||||||
_tmp_warn = []
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if re.search(
|
_r = re.search(
|
||||||
r'completed.*0 errors, 0 warnings', line, re.IGNORECASE):
|
r'(completed.*(\d+) errors, (\d+) warnings)',
|
||||||
_tmp_pass.append(line)
|
line,
|
||||||
elif re.search(
|
re.IGNORECASE)
|
||||||
r'completed.*\d+ errors, \d+ warnings', line, re.IGNORECASE):
|
if _r:
|
||||||
# If the first re.search does not match and this one does then
|
if int(_r.group(2)) + int(_r.group(3)) > 0:
|
||||||
# that means that either errors or warnings, or both, are non-zero
|
# Encountered errors and/or warnings
|
||||||
_tmp_warn.append(line)
|
_tmp['Warn'][_r.group(1)] = None
|
||||||
if len(_tmp_warn) > 0:
|
else:
|
||||||
test.failed = True
|
# No errors
|
||||||
test.passed = False
|
_tmp['Pass'][_r.group(1)] = None
|
||||||
test.update_status('NS')
|
if len(_tmp['Warn']) > 0:
|
||||||
elif len(_tmp_pass) > 0:
|
# NS
|
||||||
test.passed = True
|
test.failed = True
|
||||||
test.update_status('CS')
|
test.passed = False
|
||||||
if len(_tmp_pass) + len(_tmp_warn) > 0:
|
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))
|
test.report.append('{BLUE}Log: prime.log{CLEAR}'.format(**COLORS))
|
||||||
for line in _tmp_pass:
|
for line in sorted(_tmp['Pass'].keys()):
|
||||||
test.report.append(' {}'.format(line))
|
test.report.append(' {}'.format(line))
|
||||||
for line in _tmp_warn:
|
for line in sorted(_tmp['Warn'].keys()):
|
||||||
test.report.append(' {YELLOW}{line}{CLEAR}'.format(line, **COLORS))
|
test.report.append(' {YELLOW}{line}{CLEAR}'.format(line=line, **COLORS))
|
||||||
test.report.append(' ')
|
|
||||||
|
|
||||||
# Finalize report
|
# 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))
|
test.report.append('{BLUE}Temps{CLEAR}'.format(**COLORS))
|
||||||
for line in generate_report(test.sensor_data, 'Idle', 'Max', 'Cooldown'):
|
for line in generate_report(
|
||||||
|
test.sensor_data, 'Idle', 'Max', 'Cooldown', core_only=True):
|
||||||
test.report.append(' {}'.format(line))
|
test.report.append(' {}'.format(line))
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
|
@ -864,6 +875,7 @@ def secret_screensaver(screensaver=None):
|
||||||
|
|
||||||
def show_results(state):
|
def show_results(state):
|
||||||
"""Show results for all tests."""
|
"""Show results for all tests."""
|
||||||
|
clear_screen()
|
||||||
for k, v in state.tests.items():
|
for k, v in state.tests.items():
|
||||||
print_success('{}:'.format(k))
|
print_success('{}:'.format(k))
|
||||||
for obj in v['Objects']:
|
for obj in v['Objects']:
|
||||||
|
|
@ -871,7 +883,8 @@ def show_results(state):
|
||||||
print(line)
|
print(line)
|
||||||
print_log(strip_colors(line))
|
print_log(strip_colors(line))
|
||||||
print_standard(' ')
|
print_standard(' ')
|
||||||
print_standard(' ')
|
if 'Prime95' not in k:
|
||||||
|
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."""
|
||||||
|
|
|
||||||
|
|
@ -29,17 +29,22 @@ def fix_sensor_str(s):
|
||||||
s = s.title()
|
s = s.title()
|
||||||
s = s.replace('Coretemp', 'CoreTemp')
|
s = s.replace('Coretemp', 'CoreTemp')
|
||||||
s = s.replace('Acpi', 'ACPI')
|
s = s.replace('Acpi', 'ACPI')
|
||||||
|
s = s.replace('ACPItz', 'ACPI TZ')
|
||||||
s = s.replace('Isa ', 'ISA ')
|
s = s.replace('Isa ', 'ISA ')
|
||||||
s = s.replace('Id ', 'ID ')
|
s = s.replace('Id ', 'ID ')
|
||||||
s = re.sub(r'(\D+)(\d+)', r'\1 \2', s, re.IGNORECASE)
|
s = re.sub(r'(\D+)(\d+)', r'\1 \2', s, re.IGNORECASE)
|
||||||
s = s.replace(' ', ' ')
|
s = s.replace(' ', ' ')
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def generate_report(sensor_data, *temp_labels, colors=True):
|
def generate_report(
|
||||||
|
sensor_data, *temp_labels,
|
||||||
|
colors=True, core_only=False):
|
||||||
"""Generate report based on temp_labels, returns list if str."""
|
"""Generate report based on temp_labels, returns list if str."""
|
||||||
report = []
|
report = []
|
||||||
for _section, _adapters in sorted(sensor_data.items()):
|
for _section, _adapters in sorted(sensor_data.items()):
|
||||||
# CoreTemps then Other temps
|
# CoreTemps then Other temps
|
||||||
|
if core_only and 'Core' not in _section:
|
||||||
|
continue
|
||||||
for _adapter, _sources in sorted(_adapters.items()):
|
for _adapter, _sources in sorted(_adapters.items()):
|
||||||
# Adapter
|
# Adapter
|
||||||
report.append(fix_sensor_str(_adapter))
|
report.append(fix_sensor_str(_adapter))
|
||||||
|
|
@ -53,7 +58,8 @@ def generate_report(sensor_data, *temp_labels, colors=True):
|
||||||
': ' if _label != 'Current' else '',
|
': ' if _label != 'Current' else '',
|
||||||
get_temp_str(_data.get(_label, '???'), colors=colors))
|
get_temp_str(_data.get(_label, '???'), colors=colors))
|
||||||
report.append(_line)
|
report.append(_line)
|
||||||
report.append(' ')
|
if not core_only:
|
||||||
|
report.append(' ')
|
||||||
|
|
||||||
# Handle empty reports (i.e. no sensors detected)
|
# Handle empty reports (i.e. no sensors detected)
|
||||||
if not report:
|
if not report:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue