Disable benchmarks only for smaller USB drives

Addresses issue #128
This commit is contained in:
2Shirt 2021-04-09 03:46:43 -06:00
parent a42d5e06f4
commit 4b956cb488
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 20 additions and 9 deletions

View file

@ -19,6 +19,7 @@ BADBLOCKS_LARGE_DISK = 3 * 1024**4
CPU_CRITICAL_TEMP = 99
CPU_FAILURE_TEMP = 90
CPU_TEST_MINUTES = 7
IO_SMALL_DISK = 450 * 1000**3
KEY_NVME = 'nvme_smart_health_information_log'
KEY_SMART = 'ata_smart_attributes'
KNOWN_DISK_ATTRIBUTES = {

View file

@ -44,6 +44,10 @@ IO_MINIMUM_TEST_SIZE = 10 * 1024**3
IO_RATE_REGEX = re.compile(
r'(?P<bytes>\d+) bytes.* (?P<seconds>\S+) s(?:,|ecs )',
)
IO_SIZE_SKIP_NAME = (
'Skip USB Benchmarks '
f'(< {std.bytes_to_string(cfg.hw.IO_SMALL_DISK, use_binary=False)})'
)
MENU_ACTIONS = (
'Audio Test',
'Keyboard Test',
@ -76,7 +80,7 @@ MENU_SETS = {
MENU_TOGGLES = (
'osTicket Integration',
'osTicket Tech Note',
'Skip USB Benchmarks',
IO_SIZE_SKIP_NAME,
)
NUM_DISK_TESTS = len([s for s in MENU_OPTIONS if s.startswith('Disk')])
PLATFORM = std.PLATFORM
@ -963,17 +967,23 @@ def disk_io_benchmark(state, test_objects, skip_usb=True):
vertical=True,
text=' ',
)
# Skip USB devices if requested
for test in test_objects:
if (
skip_usb
and test.dev.details['bus'] == 'USB'
and test.dev.details['size'] < cfg.hw.IO_SMALL_DISK
):
test.set_status('Skipped')
test.disabled = True
continue
# Start benchmark
for test in test_objects:
if test.disabled:
# Skip
continue
# Skip USB devices if requested
if skip_usb and test.dev.details['bus'] == 'USB':
test.set_status('Skipped')
continue
# Start benchmark
if not aborted:
std.clear_screen()
std.print_report(test.dev.generate_report())
@ -1642,7 +1652,7 @@ def run_diags(state, menu, quick_mode=False):
function = details['Function']
args = [details['Objects']]
if name == 'Disk I/O Benchmark':
args.append(menu.toggles['Skip USB Benchmarks']['Selected'])
args.append(menu.toggles[IO_SIZE_SKIP_NAME]['Selected'])
std.clear_screen()
try:
function(state, *args)