Started work on results screen
This commit is contained in:
parent
a6917fc129
commit
579a747878
1 changed files with 57 additions and 8 deletions
|
|
@ -174,12 +174,16 @@ def run_mprime():
|
||||||
log = '{}/results.txt'.format(global_vars['LogDir'])
|
log = '{}/results.txt'.format(global_vars['LogDir'])
|
||||||
if os.path.exists(log):
|
if os.path.exists(log):
|
||||||
with open(log, 'r') as f:
|
with open(log, 'r') as f:
|
||||||
r = re.search(r'(error|fail)', f.read())
|
text = f.read()
|
||||||
|
TESTS['Prime95']['results.txt'] = text
|
||||||
|
r = re.search(r'(error|fail)', text)
|
||||||
TESTS['Prime95']['NS'] = bool(r)
|
TESTS['Prime95']['NS'] = bool(r)
|
||||||
log = '{}/prime.log'.format(global_vars['LogDir'])
|
log = '{}/prime.log'.format(global_vars['LogDir'])
|
||||||
if os.path.exists(log):
|
if os.path.exists(log):
|
||||||
with open(log, 'r') as f:
|
with open(log, 'r') as f:
|
||||||
r = re.search(r'completed.*0 errors, 0 warnings', f.read())
|
text = f.read()
|
||||||
|
TESTS['Prime95']['prime.log'] = text
|
||||||
|
r = re.search(r'completed.*0 errors, 0 warnings', text)
|
||||||
TESTS['Prime95']['CS'] = bool(r)
|
TESTS['Prime95']['CS'] = bool(r)
|
||||||
|
|
||||||
# Update status
|
# Update status
|
||||||
|
|
@ -187,7 +191,9 @@ def run_mprime():
|
||||||
TESTS['Prime95']['Status'] = 'Aborted'
|
TESTS['Prime95']['Status'] = 'Aborted'
|
||||||
print_warning('\nAborted.')
|
print_warning('\nAborted.')
|
||||||
update_progress()
|
update_progress()
|
||||||
pause('Press Enter to return to menu... ')
|
if TESTS['NVMe/SMART']['Enabled'] or TESTS['badblocks']['Enabled']:
|
||||||
|
if not ask('Proceed to next test?'):
|
||||||
|
raise GenericError
|
||||||
else:
|
else:
|
||||||
if TESTS['Prime95']['NS']:
|
if TESTS['Prime95']['NS']:
|
||||||
TESTS['Prime95']['Status'] = 'NS'
|
TESTS['Prime95']['Status'] = 'NS'
|
||||||
|
|
@ -230,12 +236,20 @@ def run_tests(tests):
|
||||||
update_progress()
|
update_progress()
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
|
mprime_aborted = False
|
||||||
if TESTS['Prime95']['Enabled']:
|
if TESTS['Prime95']['Enabled']:
|
||||||
run_mprime()
|
try:
|
||||||
if TESTS['NVMe/SMART']['Enabled']:
|
run_mprime()
|
||||||
run_smart()
|
except GenericError:
|
||||||
if TESTS['badblocks']['Enabled']:
|
mprime_aborted = True
|
||||||
run_badblocks()
|
if not mprime_aborted:
|
||||||
|
if TESTS['NVMe/SMART']['Enabled']:
|
||||||
|
run_smart()
|
||||||
|
if TESTS['badblocks']['Enabled']:
|
||||||
|
run_badblocks()
|
||||||
|
|
||||||
|
# Show results
|
||||||
|
show_results()
|
||||||
|
|
||||||
def scan_disks():
|
def scan_disks():
|
||||||
clear_screen()
|
clear_screen()
|
||||||
|
|
@ -371,6 +385,41 @@ def show_disk_details(dev):
|
||||||
else:
|
else:
|
||||||
print_error('Failed.\n', timestamp=False)
|
print_error('Failed.\n', timestamp=False)
|
||||||
|
|
||||||
|
def show_results():
|
||||||
|
clear_screen()
|
||||||
|
print_standard('Results')
|
||||||
|
update_progress()
|
||||||
|
|
||||||
|
# Set Window layout and show progress
|
||||||
|
run_program('tmux split-window -dhl 15 watch -c -n1 -t cat {}'.format(
|
||||||
|
TESTS['Progress Out']).split())
|
||||||
|
|
||||||
|
# Prime95
|
||||||
|
print_info('\nPrime95:')
|
||||||
|
for log, regex in [
|
||||||
|
['results.txt', r'(error|fail)'],
|
||||||
|
['prime.log', r'completed.*0 errors, 0 warnings']]:
|
||||||
|
if log in TESTS['Prime95']:
|
||||||
|
#print_standard(log)
|
||||||
|
lines = [line.strip() for line
|
||||||
|
in TESTS['Prime95'][log].splitlines()
|
||||||
|
if re.search(regex, line, re.IGNORECASE)]
|
||||||
|
for line in lines[-4:]:
|
||||||
|
line = re.sub(r'^.*Worker #\d.*Torture Test (.*)', r'\1',
|
||||||
|
line, re.IGNORECASE)
|
||||||
|
if TESTS['Prime95'].get('NS', False):
|
||||||
|
print_error(' {}'.format(line))
|
||||||
|
else:
|
||||||
|
print_standard(' {}'.format(line))
|
||||||
|
|
||||||
|
# NVMe/SMART
|
||||||
|
|
||||||
|
# badblocks
|
||||||
|
|
||||||
|
# Done
|
||||||
|
pause('Press Enter to return to main menu... ')
|
||||||
|
run_program('tmux kill-pane -a'.split())
|
||||||
|
|
||||||
def update_progress():
|
def update_progress():
|
||||||
if 'Progress Out' not in TESTS:
|
if 'Progress Out' not in TESTS:
|
||||||
TESTS['Progress Out'] = '{}/progress.out'.format(global_vars['LogDir'])
|
TESTS['Progress Out'] = '{}/progress.out'.format(global_vars['LogDir'])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue