Catch CTRL+c aborts and show results
This commit is contained in:
parent
8b936f5413
commit
ef42b596d9
1 changed files with 52 additions and 26 deletions
|
|
@ -747,10 +747,13 @@ def run_badblocks_test(state, test):
|
||||||
|
|
||||||
# Start badblocks
|
# Start badblocks
|
||||||
print_standard('Running badblocks test...')
|
print_standard('Running badblocks test...')
|
||||||
|
try:
|
||||||
test.badblocks_proc = popen_program(
|
test.badblocks_proc = popen_program(
|
||||||
['sudo', 'hw-diags-badblocks', test.dev.path, test.badblocks_out],
|
['sudo', 'hw-diags-badblocks', test.dev.path, test.badblocks_out],
|
||||||
pipe=True)
|
pipe=True)
|
||||||
test.badblocks_proc.wait()
|
test.badblocks_proc.wait()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
raise GenericAbort('Aborted')
|
||||||
|
|
||||||
# Check result and create report
|
# Check result and create report
|
||||||
try:
|
try:
|
||||||
|
|
@ -833,11 +836,31 @@ def run_hw_tests(state):
|
||||||
# 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
|
||||||
## in order, the tests will be run in order.
|
## in order, the tests will be run in order.
|
||||||
|
try:
|
||||||
for k, v in state.tests.items():
|
for k, v in state.tests.items():
|
||||||
if v['Enabled']:
|
if v['Enabled']:
|
||||||
f = v['Function']
|
f = v['Function']
|
||||||
for test_obj in v['Objects']:
|
for test_obj in v['Objects']:
|
||||||
f(state, test_obj)
|
f(state, test_obj)
|
||||||
|
except GenericAbort:
|
||||||
|
# Cleanup
|
||||||
|
tmux_kill_pane(*state.panes.values())
|
||||||
|
|
||||||
|
# Rebuild panes
|
||||||
|
update_progress_pane(state)
|
||||||
|
build_outer_panes(state)
|
||||||
|
|
||||||
|
# Mark unfinished tests as aborted
|
||||||
|
for k, v in state.tests.items():
|
||||||
|
if v['Enabled']:
|
||||||
|
for test_obj in v['Objects']:
|
||||||
|
if re.search(r'(Pending|Working)', test_obj.status):
|
||||||
|
test_obj.update_status('Aborted')
|
||||||
|
test_obj.report.append(' {YELLOW}Aborted{CLEAR}'.format(
|
||||||
|
**COLORS))
|
||||||
|
|
||||||
|
# Update side pane
|
||||||
|
update_progress_pane(state)
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
show_results(state)
|
show_results(state)
|
||||||
|
|
@ -1130,6 +1153,7 @@ def run_nvme_smart_tests(state, test):
|
||||||
run_program(cmd, check=False)
|
run_program(cmd, check=False)
|
||||||
|
|
||||||
# Monitor progress (in 5 second increments)
|
# Monitor progress (in 5 second increments)
|
||||||
|
try:
|
||||||
for iteration in range(int(test.timeout*60/5)):
|
for iteration in range(int(test.timeout*60/5)):
|
||||||
sleep(5)
|
sleep(5)
|
||||||
|
|
||||||
|
|
@ -1151,6 +1175,8 @@ def run_nvme_smart_tests(state, test):
|
||||||
# Check if test has started
|
# Check if test has started
|
||||||
if 'remaining_percent' in test.dev.smart_self_test['status']:
|
if 'remaining_percent' in test.dev.smart_self_test['status']:
|
||||||
_self_test_started = True
|
_self_test_started = True
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
raise GenericAbort('Aborted')
|
||||||
|
|
||||||
# Check if timed out
|
# Check if timed out
|
||||||
if test.dev.smart_self_test['status'].get('passed', False):
|
if test.dev.smart_self_test['status'].get('passed', False):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue