Moves HW-Diags settings to separate file
This commit is contained in:
parent
cd4bb7c867
commit
e2c83aad6e
3 changed files with 110 additions and 91 deletions
|
|
@ -8,88 +8,13 @@ from collections import OrderedDict
|
|||
from functions.sensors import *
|
||||
from functions.threading import *
|
||||
from functions.tmux import *
|
||||
from settings.hw_diags import *
|
||||
|
||||
|
||||
# STATIC VARIABLES
|
||||
ATTRIBUTES = {
|
||||
'NVMe': {
|
||||
'critical_warning': {'Error': 1, 'Critical': True},
|
||||
'media_errors': {'Error': 1, 'Critical': True},
|
||||
'power_on_hours': {'Warning': 12000, 'Error': 26298, 'Ignore': True},
|
||||
'unsafe_shutdowns': {'Warning': 1},
|
||||
},
|
||||
'SMART': {
|
||||
5: {'Hex': '05', 'Error': 1, 'Critical': True},
|
||||
9: {'Hex': '09', 'Warning': 12000, 'Error': 26298, 'Ignore': True},
|
||||
10: {'Hex': '0A', 'Error': 1},
|
||||
184: {'Hex': 'B8', 'Error': 1},
|
||||
187: {'Hex': 'BB', 'Error': 1},
|
||||
188: {'Hex': 'BC', 'Error': 1},
|
||||
196: {'Hex': 'C4', 'Error': 1},
|
||||
197: {'Hex': 'C5', 'Error': 1, 'Critical': True},
|
||||
198: {'Hex': 'C6', 'Error': 1, 'Critical': True},
|
||||
199: {'Hex': 'C7', 'Error': 1, 'Ignore': True},
|
||||
201: {'Hex': 'C9', 'Error': 1},
|
||||
},
|
||||
}
|
||||
HW_OVERRIDES_FORCED = HW_OVERRIDES_FORCED and not HW_OVERRIDES_LIMITED
|
||||
IO_VARS = {
|
||||
'Block Size': 512*1024,
|
||||
'Chunk Size': 32*1024**2,
|
||||
'Minimum Test Size': 10*1024**3,
|
||||
'Alt Test Size Factor': 0.01,
|
||||
'Progress Refresh Rate': 5,
|
||||
'Scale 8': [2**(0.56*(x+1))+(16*(x+1)) for x in range(8)],
|
||||
'Scale 16': [2**(0.56*(x+1))+(16*(x+1)) for x in range(16)],
|
||||
'Scale 32': [2**(0.56*(x+1)/2)+(16*(x+1)/2) for x in range(32)],
|
||||
'Threshold Graph Fail': 65*1024**2,
|
||||
'Threshold Graph Warn': 135*1024**2,
|
||||
'Threshold Graph Great': 750*1024**2,
|
||||
'Threshold HDD Min': 50*1024**2,
|
||||
'Threshold HDD High Avg': 75*1024**2,
|
||||
'Threshold HDD Low Avg': 65*1024**2,
|
||||
'Threshold SSD Min': 90*1024**2,
|
||||
'Threshold SSD High Avg': 135*1024**2,
|
||||
'Threshold SSD Low Avg': 100*1024**2,
|
||||
'Graph Horizontal': ('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'),
|
||||
'Graph Horizontal Width': 40,
|
||||
'Graph Vertical': (
|
||||
'▏', '▎', '▍', '▌',
|
||||
'▋', '▊', '▉', '█',
|
||||
'█▏', '█▎', '█▍', '█▌',
|
||||
'█▋', '█▊', '█▉', '██',
|
||||
'██▏', '██▎', '██▍', '██▌',
|
||||
'██▋', '██▊', '██▉', '███',
|
||||
'███▏', '███▎', '███▍', '███▌',
|
||||
'███▋', '███▊', '███▉', '████'),
|
||||
}
|
||||
KEY_NVME = 'nvme_smart_health_information_log'
|
||||
KEY_SMART = 'ata_smart_attributes'
|
||||
QUICK_LABEL = '{YELLOW}(Quick){CLEAR}'.format(**COLORS)
|
||||
SIDE_PANE_WIDTH = 20
|
||||
STATUSES = {
|
||||
'RED': ['Denied', 'ERROR', 'NS', 'TimedOut'],
|
||||
'YELLOW': ['Aborted', 'N/A', 'OVERRIDE', 'Unknown', 'Working'],
|
||||
'GREEN': ['CS'],
|
||||
}
|
||||
TESTS_CPU = ['Prime95']
|
||||
TESTS_DISK = [
|
||||
'I/O Benchmark',
|
||||
'NVMe / SMART',
|
||||
'badblocks',
|
||||
]
|
||||
TOP_PANE_TEXT = '{GREEN}Hardware Diagnostics{CLEAR}'.format(**COLORS)
|
||||
TMUX_LAYOUT = OrderedDict({
|
||||
'Top': {'y': 2, 'Check': True},
|
||||
'Started': {'x': SIDE_PANE_WIDTH, 'Check': True},
|
||||
'Progress': {'x': SIDE_PANE_WIDTH, 'Check': True},
|
||||
# Testing panes
|
||||
'Prime95': {'y': 11, 'Check': False},
|
||||
'Temps': {'y': 1000, 'Check': False},
|
||||
'SMART': {'y': 3, 'Check': True},
|
||||
'badblocks': {'y': 5, 'Check': True},
|
||||
'I/O Benchmark': {'y': 1000, 'Check': False},
|
||||
})
|
||||
# Fix settings
|
||||
OVERRIDES_FORCED = OVERRIDES_FORCED and not OVERRIDES_LIMITED
|
||||
QUICK_LABEL = QUICK_LABEL.format(**COLORS)
|
||||
TOP_PANE_TEXT = TOP_PANE_TEXT.format(**COLORS)
|
||||
|
||||
|
||||
# Regex
|
||||
|
|
@ -266,8 +191,8 @@ class DiskObj():
|
|||
if override_disabled:
|
||||
print_standard('Tests disabled for this device')
|
||||
pause()
|
||||
elif not (len(self.tests) == 3 and HW_OVERRIDES_LIMITED):
|
||||
if HW_OVERRIDES_FORCED or ask('Run tests on this device anyway?'):
|
||||
elif not (len(self.tests) == 3 and OVERRIDES_LIMITED):
|
||||
if OVERRIDES_FORCED or ask('Run tests on this device anyway?'):
|
||||
self.disk_ok = True
|
||||
if 'NVMe / SMART' in self.tests:
|
||||
self.disable_test('NVMe / SMART', 'OVERRIDE')
|
||||
|
|
@ -498,12 +423,12 @@ class DiskObj():
|
|||
# No NVMe/SMART details
|
||||
self.disable_test('NVMe / SMART', 'N/A')
|
||||
if silent:
|
||||
self.disk_ok = HW_OVERRIDES_FORCED
|
||||
self.disk_ok = OVERRIDES_FORCED
|
||||
else:
|
||||
print_info('Device ({})'.format(self.name))
|
||||
print_standard(' {}'.format(self.description))
|
||||
print_warning(' No NVMe or SMART data available')
|
||||
self.disk_ok = HW_OVERRIDES_FORCED or ask(
|
||||
self.disk_ok = OVERRIDES_FORCED or ask(
|
||||
'Run tests on this device anyway?')
|
||||
print_standard(' ')
|
||||
|
||||
|
|
@ -1304,8 +1229,7 @@ def run_mprime_test(state, test):
|
|||
state.panes['Prime95'],
|
||||
command=['hw-diags-prime95', global_vars['TmpDir']],
|
||||
working_dir=global_vars['TmpDir'])
|
||||
time_limit = int(MPRIME_LIMIT) * 60
|
||||
thermal_limit = int(THERMAL_LIMIT)
|
||||
time_limit = MPRIME_LIMIT * 60
|
||||
try:
|
||||
for i in range(time_limit):
|
||||
clear_screen()
|
||||
|
|
@ -1322,7 +1246,7 @@ def run_mprime_test(state, test):
|
|||
# Not using print wrappers to avoid flooding the log
|
||||
print(_status_str)
|
||||
print('{YELLOW}{msg}{CLEAR}'.format(msg=test.abort_msg, **COLORS))
|
||||
update_sensor_data(test.sensor_data, thermal_limit)
|
||||
update_sensor_data(test.sensor_data, THERMAL_LIMIT)
|
||||
|
||||
# Wait
|
||||
sleep(1)
|
||||
|
|
|
|||
99
.bin/Scripts/settings/hw_diags.py
Normal file
99
.bin/Scripts/settings/hw_diags.py
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
# Wizard Kit: Settings - HW Diagnostics
|
||||
|
||||
# General
|
||||
OVERRIDES_FORCED = False
|
||||
OVERRIDES_LIMITED = True # If True this disables OVERRIDE_FORCED
|
||||
STATUSES = {
|
||||
'RED': ['Denied', 'ERROR', 'NS', 'TimedOut'],
|
||||
'YELLOW': ['Aborted', 'N/A', 'OVERRIDE', 'Unknown', 'Working'],
|
||||
'GREEN': ['CS'],
|
||||
}
|
||||
TESTS_CPU = ['Prime95']
|
||||
TESTS_DISK = [
|
||||
'I/O Benchmark',
|
||||
'NVMe / SMART',
|
||||
'badblocks',
|
||||
]
|
||||
|
||||
# Layout
|
||||
## NOTE: Colors will be applied in functions/hw_diags.py
|
||||
QUICK_LABEL = '{YELLOW}(Quick){CLEAR}'
|
||||
SIDE_PANE_WIDTH = 20
|
||||
TOP_PANE_TEXT = '{GREEN}Hardware Diagnostics{CLEAR}'
|
||||
TMUX_LAYOUT = OrderedDict({
|
||||
'Top': {'y': 2, 'Check': True},
|
||||
'Started': {'x': SIDE_PANE_WIDTH, 'Check': True},
|
||||
'Progress': {'x': SIDE_PANE_WIDTH, 'Check': True},
|
||||
# Testing panes
|
||||
'Prime95': {'y': 11, 'Check': False},
|
||||
'Temps': {'y': 1000, 'Check': False},
|
||||
'SMART': {'y': 3, 'Check': True},
|
||||
'badblocks': {'y': 5, 'Check': True},
|
||||
'I/O Benchmark': {'y': 1000, 'Check': False},
|
||||
})
|
||||
|
||||
# Tests: I/O Benchmark
|
||||
IO_VARS = {
|
||||
'Block Size': 512*1024,
|
||||
'Chunk Size': 32*1024**2,
|
||||
'Minimum Test Size': 10*1024**3,
|
||||
'Alt Test Size Factor': 0.01,
|
||||
'Progress Refresh Rate': 5,
|
||||
'Scale 8': [2**(0.56*(x+1))+(16*(x+1)) for x in range(8)],
|
||||
'Scale 16': [2**(0.56*(x+1))+(16*(x+1)) for x in range(16)],
|
||||
'Scale 32': [2**(0.56*(x+1)/2)+(16*(x+1)/2) for x in range(32)],
|
||||
'Threshold Graph Fail': 65*1024**2,
|
||||
'Threshold Graph Warn': 135*1024**2,
|
||||
'Threshold Graph Great': 750*1024**2,
|
||||
'Threshold HDD Min': 50*1024**2,
|
||||
'Threshold HDD High Avg': 75*1024**2,
|
||||
'Threshold HDD Low Avg': 65*1024**2,
|
||||
'Threshold SSD Min': 90*1024**2,
|
||||
'Threshold SSD High Avg': 135*1024**2,
|
||||
'Threshold SSD Low Avg': 100*1024**2,
|
||||
'Graph Horizontal': ('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'),
|
||||
'Graph Horizontal Width': 40,
|
||||
'Graph Vertical': (
|
||||
'▏', '▎', '▍', '▌',
|
||||
'▋', '▊', '▉', '█',
|
||||
'█▏', '█▎', '█▍', '█▌',
|
||||
'█▋', '█▊', '█▉', '██',
|
||||
'██▏', '██▎', '██▍', '██▌',
|
||||
'██▋', '██▊', '██▉', '███',
|
||||
'███▏', '███▎', '███▍', '███▌',
|
||||
'███▋', '███▊', '███▉', '████'),
|
||||
}
|
||||
|
||||
# Tests: NVMe/SMART
|
||||
ATTRIBUTES = {
|
||||
'NVMe': {
|
||||
'critical_warning': {'Error': 1, 'Critical': True},
|
||||
'media_errors': {'Error': 1, 'Critical': True},
|
||||
'power_on_hours': {'Warning': 12000, 'Error': 26298, 'Ignore': True},
|
||||
'unsafe_shutdowns': {'Warning': 1},
|
||||
},
|
||||
'SMART': {
|
||||
5: {'Hex': '05', 'Error': 1, 'Critical': True},
|
||||
9: {'Hex': '09', 'Warning': 12000, 'Error': 26298, 'Ignore': True},
|
||||
10: {'Hex': '0A', 'Error': 1},
|
||||
184: {'Hex': 'B8', 'Error': 1},
|
||||
187: {'Hex': 'BB', 'Error': 1},
|
||||
188: {'Hex': 'BC', 'Error': 1},
|
||||
196: {'Hex': 'C4', 'Error': 1},
|
||||
197: {'Hex': 'C5', 'Error': 1, 'Critical': True},
|
||||
198: {'Hex': 'C6', 'Error': 1, 'Critical': True},
|
||||
199: {'Hex': 'C7', 'Error': 1, 'Ignore': True},
|
||||
201: {'Hex': 'C9', 'Error': 1},
|
||||
},
|
||||
}
|
||||
KEY_NVME = 'nvme_smart_health_information_log'
|
||||
KEY_SMART = 'ata_smart_attributes'
|
||||
|
||||
# Tests: Prime95
|
||||
MPRIME_LIMIT = 7 # of minutes to run Prime95
|
||||
THERMAL_LIMIT = 95 # Prime95 abort temperature in Celsius
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("This file is not meant to be called directly.")
|
||||
|
||||
# vim: sts=2 sw=2 ts=2 tw=0
|
||||
|
|
@ -4,8 +4,6 @@
|
|||
ENABLED_OPEN_LOGS = False
|
||||
ENABLED_TICKET_NUMBERS = False
|
||||
ENABLED_UPLOAD_DATA = False
|
||||
HW_OVERRIDES_FORCED = False
|
||||
HW_OVERRIDES_LIMITED = True # If True this disables HW_OVERRIDE_FORCED
|
||||
|
||||
# STATIC VARIABLES (also used by BASH and BATCH files)
|
||||
## NOTE: There are no spaces around the = for easier parsing in BASH and BATCH
|
||||
|
|
@ -15,8 +13,6 @@ KIT_NAME_FULL='WizardKit'
|
|||
KIT_NAME_SHORT='WK'
|
||||
SUPPORT_MESSAGE='Please let 2Shirt know by opening an issue on GitHub'
|
||||
# Live Linux
|
||||
MPRIME_LIMIT='7' # of minutes to run Prime95 during hw-diags
|
||||
THERMAL_LIMIT='95' # Prime95 abort temperature in Celsius
|
||||
ROOT_PASSWORD='Abracadabra'
|
||||
TECH_PASSWORD='Abracadabra'
|
||||
# Server IP addresses
|
||||
|
|
|
|||
Loading…
Reference in a new issue