Updated badblocks sections
* Increaded pane height to 5 * Updated pass/fail/unknown logic * Reduced lines included in reports
This commit is contained in:
parent
b45dc74e5a
commit
a76d7775fd
2 changed files with 25 additions and 17 deletions
|
|
@ -124,7 +124,7 @@ TMUX_LAYOUT = OrderedDict({
|
||||||
'Temps': {'height': 1000, 'Check': False},
|
'Temps': {'height': 1000, 'Check': False},
|
||||||
'Prime95': {'height': 11, 'Check': False},
|
'Prime95': {'height': 11, 'Check': False},
|
||||||
'SMART': {'height': 3, 'Check': True},
|
'SMART': {'height': 3, 'Check': True},
|
||||||
'badblocks': {'height': 3, 'Check': True},
|
'badblocks': {'height': 5, 'Check': True},
|
||||||
'I/O Benchmark': {'height': 1000, 'Check': False},
|
'I/O Benchmark': {'height': 1000, 'Check': False},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@ Options:
|
||||||
-h --help Show this page
|
-h --help Show this page
|
||||||
-q --quick Skip menu and perform a quick check
|
-q --quick Skip menu and perform a quick check
|
||||||
'''
|
'''
|
||||||
|
BADBLOCKS_REGEX = re.compile(
|
||||||
|
r'^Pass completed, (\d+) bad blocks found. .(\d+)/(\d+)/(\d+) errors',
|
||||||
|
re.IGNORECASE,
|
||||||
|
)
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
MENU_ACTIONS = (
|
MENU_ACTIONS = (
|
||||||
'Audio Test',
|
'Audio Test',
|
||||||
|
|
@ -620,8 +624,9 @@ def disk_surface_scan(state, test_objects):
|
||||||
size_str = std.bytes_to_string(dev.details["size"], use_binary=False)
|
size_str = std.bytes_to_string(dev.details["size"], use_binary=False)
|
||||||
_f.write(
|
_f.write(
|
||||||
std.color_string(
|
std.color_string(
|
||||||
[dev.path.name, size_str, '\n'],
|
['[', dev.path.name, ' ', size_str, ']\n'],
|
||||||
['BLUE', 'CYAN', None],
|
[None, 'BLUE', None, 'CYAN', None],
|
||||||
|
sep='',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
_f.flush()
|
_f.flush()
|
||||||
|
|
@ -635,22 +640,23 @@ def disk_surface_scan(state, test_objects):
|
||||||
|
|
||||||
# Check results
|
# Check results
|
||||||
with open(log_path, 'r') as _f:
|
with open(log_path, 'r') as _f:
|
||||||
# Skip first line
|
|
||||||
_f.readline()
|
|
||||||
# Check the rest
|
|
||||||
for line in _f.readlines():
|
for line in _f.readlines():
|
||||||
line = line.strip()
|
line = std.strip_colors(line.strip())
|
||||||
if not line or line.startswith('Checking' or line.startswith('[')):
|
if not line or line.startswith('Checking') or line.startswith('['):
|
||||||
# Skip
|
# Skip
|
||||||
continue
|
continue
|
||||||
if re.search(f'^Pass completed.*0.*0/0/0', line, re.IGNORECASE):
|
match = BADBLOCKS_REGEX.search(line)
|
||||||
test_obj.passed = True
|
if match:
|
||||||
test_obj.report.append(f' {line}')
|
if all([s == '0' for s in match.groups()]):
|
||||||
test_obj.set_status('Passed')
|
test_obj.passed = True
|
||||||
|
test_obj.report.append(f' {line}')
|
||||||
|
test_obj.set_status('Passed')
|
||||||
|
else:
|
||||||
|
test_obj.failed = True
|
||||||
|
test_obj.report.append(f' {std.color_string(line, "YELLOW")}')
|
||||||
|
test_obj.set_status('Failed')
|
||||||
else:
|
else:
|
||||||
test_obj.failed = True
|
|
||||||
test_obj.report.append(f' {std.color_string(line, "YELLOW")}')
|
test_obj.report.append(f' {std.color_string(line, "YELLOW")}')
|
||||||
test_obj.set_status('Failed')
|
|
||||||
if not (test_obj.passed or test_obj.failed):
|
if not (test_obj.passed or test_obj.failed):
|
||||||
test_obj.set_status('Unknown')
|
test_obj.set_status('Unknown')
|
||||||
|
|
||||||
|
|
@ -671,7 +677,7 @@ def disk_surface_scan(state, test_objects):
|
||||||
if threads[-1].is_alive():
|
if threads[-1].is_alive():
|
||||||
state.panes['badblocks'].append(
|
state.panes['badblocks'].append(
|
||||||
tmux.split_window(
|
tmux.split_window(
|
||||||
lines=3,
|
lines=5,
|
||||||
vertical=True,
|
vertical=True,
|
||||||
watch_cmd='tail',
|
watch_cmd='tail',
|
||||||
watch_file=test_log,
|
watch_file=test_log,
|
||||||
|
|
@ -687,11 +693,12 @@ def disk_surface_scan(state, test_objects):
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
std.sleep(0.5)
|
||||||
# Handle aborts
|
# Handle aborts
|
||||||
for test in test_objects:
|
for test in test_objects:
|
||||||
if not (test.passed or test.failed or test.status == 'Unknown'):
|
if not (test.passed or test.failed):
|
||||||
test.set_status('Aborted')
|
test.set_status('Aborted')
|
||||||
test.report.append(std.color_string('Aborted', 'YELLOW'))
|
test.report.append(std.color_string(' Aborted', 'YELLOW'))
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
state.update_progress_pane()
|
state.update_progress_pane()
|
||||||
|
|
@ -991,6 +998,7 @@ def set_apple_fan_speed(speed):
|
||||||
|
|
||||||
def show_results(state):
|
def show_results(state):
|
||||||
"""Show test results by device."""
|
"""Show test results by device."""
|
||||||
|
std.sleep(0.5)
|
||||||
std.clear_screen()
|
std.clear_screen()
|
||||||
state.update_top_pane('Results')
|
state.update_top_pane('Results')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue