Skip to content

Commit 981f07b

Browse files
committed
feat: ignore-warning flag to more accurately filter messages
1 parent 98154e7 commit 981f07b

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

Tools/PC/c3-submission-helpers/parse-suspend-30-logs.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Input:
3838
no_meta: bool
3939
no_transform: bool
4040
no_color: bool
41+
ignore_warnings: bool
4142

4243

4344
class Color:
@@ -188,6 +189,12 @@ def parse_args() -> Input:
188189
action="store_true",
189190
help="Disables all colors and styles",
190191
)
192+
p.add_argument(
193+
"-iw",
194+
"--ignore-warnings",
195+
action="store_true",
196+
help="Ignore warnings like checkbox's sleep_test_log_check.py",
197+
)
191198

192199
out = p.parse_args()
193200
# have to wait until out.filename is populated
@@ -501,9 +508,14 @@ def print_summary_for_1_submission(
501508
msg = transform_err_msg(
502509
log_file_lines[error_msg_i]
503510
)
504-
failed_runs[fail_type][boot_i][suspend_i].add(msg)
511+
# handler iter earlier to avoid ugly if condition
505512
error_msg_i += 1
506513

514+
if args.ignore_warnings and "Warning:" in msg:
515+
# literally how the original test case filters warnings
516+
continue
517+
failed_runs[fail_type][boot_i][suspend_i].add(msg)
518+
507519
if args.write_individual_files:
508520
print(
509521
f"Writing boot_{boot_i}_suspend_{suspend_i}.txt...",
@@ -569,17 +581,19 @@ def main():
569581
else:
570582
transform_err_msg = default_err_msg_transform
571583

572-
print(
573-
C.medium("[ WARN ]"),
574-
"The summary file might not match",
575-
"the number of failures found by this script.",
576-
)
577-
print(
578-
C.medium("[ WARN ]"),
579-
"Please double check since the original test case",
580-
"may consider some failures to be not worth reporting",
581-
)
582-
print()
584+
if not args.ignore_warnings:
585+
print(
586+
C.medium("[ WARN ]"),
587+
"The test summary file might show less errors than this script.",
588+
)
589+
print(
590+
C.medium("[ WARN ]"),
591+
"Please double check since the original test case",
592+
"has the --ignore-warning flag enabled.",
593+
)
594+
print()
595+
else:
596+
print(C.low("[ INFO ]"), "Ignoring fwts warnings")
583597

584598
for filename in args.filenames:
585599
print_summary_for_1_submission(args, filename, transform_err_msg)

0 commit comments

Comments
 (0)