Clean badblocks results to remove backspaces

This commit is contained in:
2Shirt 2022-09-28 00:30:31 -07:00
parent 5aa49fe5e5
commit 926b32b574
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 7 additions and 0 deletions

View file

@ -20,6 +20,7 @@ BADBLOCKS_REGEX = re.compile(
r'^Pass completed, (\d+) bad blocks found. .(\d+)/(\d+)/(\d+) errors',
re.IGNORECASE,
)
BADBLOCKS_RESULTS_REGEX = re.compile(r'^(.*?)\x08.*\x08(.*)')
BADBLOCKS_SKIP_REGEX = re.compile(r'^(Checking|\[)', re.IGNORECASE)
CPU_CRITICAL_TEMP = 99
CPU_FAILURE_TEMP = 90

View file

@ -8,6 +8,7 @@ from subprocess import STDOUT
from wk.cfg.hw import (
BADBLOCKS_LARGE_DISK,
BADBLOCKS_REGEX,
BADBLOCKS_RESULTS_REGEX,
BADBLOCKS_SKIP_REGEX,
TEST_MODE_BADBLOCKS_LIMIT,
)
@ -33,6 +34,11 @@ def check_surface_scan_results(test_obj, log_path) -> None:
if not line or BADBLOCKS_SKIP_REGEX.match(line):
# Skip
continue
# Clean line by removing backspaces/etc
line = BADBLOCKS_RESULTS_REGEX.sub(r'\1 \2', line)
# Add to report
match = BADBLOCKS_REGEX.search(line)
if match:
if all(s == '0' for s in match.groups()):