Fix System Info section in HW diags

Avoid running every time, use the menu selection in stead.
This commit is contained in:
2Shirt 2022-12-03 19:00:31 -08:00
parent aa3dc51740
commit 2431e2e00e
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -56,7 +56,7 @@ IO_SIZE_SKIP_NAME = (
TEST_GROUPS = { TEST_GROUPS = {
# Also used to build the menu options # Also used to build the menu options
## NOTE: This needs to be above MENU_SETS ## NOTE: This needs to be above MENU_SETS
'System Info': 'system_info', 'System Info': 'post_system_info',
'CPU & Cooling': 'cpu_stress_tests', 'CPU & Cooling': 'cpu_stress_tests',
'Disk Attributes': 'disk_attribute_check', 'Disk Attributes': 'disk_attribute_check',
'Disk Self-Test': 'disk_self_test', 'Disk Self-Test': 'disk_self_test',
@ -208,6 +208,16 @@ class State():
# Only add selected options # Only add selected options
continue continue
if 'System' in name:
test = Test(dev=self.system, label=name, name=name)
self.test_groups.append(
TestGroup(
name=name,
function=globals()[TEST_GROUPS[name]],
test_objects=[test],
)
)
if 'CPU' in name: if 'CPU' in name:
# Create two Test objects which will both be used by cpu_stress_tests # Create two Test objects which will both be used by cpu_stress_tests
# NOTE: Prime95 should be added first # NOTE: Prime95 should be added first
@ -890,7 +900,8 @@ def main() -> None:
state.update_top_pane('Main Menu') state.update_top_pane('Main Menu')
def post_system_info(state) -> None: def post_system_info(state, quick_mode=False, test_mode=False) -> None:
# pylint: disable=unused-argument
"""Post system info to osTicket.""" """Post system info to osTicket."""
report = state.system.generate_full_report() report = state.system.generate_full_report()
if state.disks: if state.disks:
@ -956,17 +967,13 @@ def run_diags(state, menu, quick_mode=False, test_mode=False) -> None:
# Just return if no tests were selected # Just return if no tests were selected
if not state.test_groups: if not state.test_groups:
if not menu.options['System Info']['Selected']: std.print_warning('No tests selected?')
std.print_warning('No tests selected?') std.pause()
std.pause() return
return
# osTicket # osTicket
_init_osticket() _init_osticket()
# Post system info
post_system_info(state)
# Run tests # Run tests
for group in state.test_groups: for group in state.test_groups: