From bfc17942cd4c02cb6a43f64dc020932c18fb3e10 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Wed, 22 Jan 2020 11:22:47 -0700 Subject: [PATCH] Added header to SMART self-test output * Matches badblocks header * Also added Initializing message --- scripts/wk/cfg/hw.py | 2 +- scripts/wk/hw/diags.py | 2 +- scripts/wk/hw/obj.py | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/wk/cfg/hw.py b/scripts/wk/cfg/hw.py index 59cd7248..f97e3acc 100644 --- a/scripts/wk/cfg/hw.py +++ b/scripts/wk/cfg/hw.py @@ -130,7 +130,7 @@ TMUX_LAYOUT = OrderedDict({ # Testing panes 'Temps': {'height': 1000, 'Check': False}, 'Prime95': {'height': 11, 'Check': False}, - 'SMART': {'height': 3, 'Check': True}, + 'SMART': {'height': 4, 'Check': True}, 'badblocks': {'height': 5, 'Check': True}, 'I/O Benchmark': {'height': 1000, 'Check': False}, }) diff --git a/scripts/wk/hw/diags.py b/scripts/wk/hw/diags.py index 741dba50..6ad9e8c9 100644 --- a/scripts/wk/hw/diags.py +++ b/scripts/wk/hw/diags.py @@ -933,7 +933,7 @@ def disk_self_test(state, test_objects): # Show progress if threads[-1].is_alive(): state.panes['SMART'].append( - tmux.split_window(lines=3, vertical=True, watch_file=test_log), + tmux.split_window(lines=4, vertical=True, watch_file=test_log), ) # Wait for all tests to complete diff --git a/scripts/wk/hw/obj.py b/scripts/wk/hw/obj.py index a9e8cd57..d934b30d 100644 --- a/scripts/wk/hw/obj.py +++ b/scripts/wk/hw/obj.py @@ -452,6 +452,12 @@ class Disk(BaseObj): status_str = 'Starting self-test...' test_details = self.get_smart_self_test_details() test_minutes = 15 + size_str = bytes_to_string(self.details["size"], use_binary=False) + header_str = color_string( + ['[', self.path.name, ' ', size_str, ']'], + [None, 'BLUE', None, 'CYAN', None], + sep='', + ) # Check if disk supports self-tests if not test_details: @@ -463,6 +469,8 @@ class Disk(BaseObj): test_minutes = int(test_minutes) + 10 # Start test + with open(log_path, 'w') as _f: + _f.write(f'{header_str}\nInitializing...') cmd = [ 'sudo', 'smartctl', @@ -487,7 +495,7 @@ class Disk(BaseObj): # Update log with open(log_path, 'w') as _f: - _f.write(f'SMART self-test status for {self.path}:\n {status_str}') + _f.write(f'{header_str}\nSMART self-test status:\n {status_str}') # Check if finished if 'remaining_percent' not in test_details['status']: