[lint] Update warning/error exclusions in parser scripts
This updates the warning/error exclusions for more accurate reporting,
and aligns all three lint parser scripts such that they output the same
exit messages via the logger.
Signed-off-by: Michael Schaffner <msf@google.com>
diff --git a/hw/lint/tools/ascentlint/parse-lint-report.py b/hw/lint/tools/ascentlint/parse-lint-report.py
index d1a7ead..1bdbfed 100755
--- a/hw/lint/tools/ascentlint/parse-lint-report.py
+++ b/hw/lint/tools/ascentlint/parse-lint-report.py
@@ -5,6 +5,7 @@
r"""Parses lint report and dump filtered messages in hjson format.
"""
import argparse
+import logging as log
import re
import sys
from pathlib import Path
@@ -109,17 +110,16 @@
# return nonzero status if any warnings or errors are present
# lint infos do not count as failures
- nr_errors = len(results["errors"]) + len(results["lint_errors"])
- nr_warnings = len(results["warnings"]) + len(results["lint_warnings"])
- if nr_errors > 0 or nr_warnings > 0:
- print("Lint not successful, got %d warnings and %d errors." %
- (nr_warnings, nr_errors))
+ n_errors = len(results["errors"]) + len(results["lint_errors"])
+ n_warnings = len(results["warnings"]) + len(results["lint_warnings"])
+ if n_errors > 0 or n_warnings > 0:
+ log.info("Found %d lint errors and %d lint warnings", n_errors, n_warnings)
sys.exit(1)
- print("Lint successful, got %d warnings and %d errors." %
- (nr_warnings, nr_errors))
+ log.info("Lint logfile parsed succesfully")
sys.exit(0)
+
if __name__ == "__main__":
main()
diff --git a/hw/lint/tools/veriblelint/parse-lint-report.py b/hw/lint/tools/veriblelint/parse-lint-report.py
index 1077b9e..2546b88 100755
--- a/hw/lint/tools/veriblelint/parse-lint-report.py
+++ b/hw/lint/tools/veriblelint/parse-lint-report.py
@@ -5,6 +5,7 @@
r"""Parses lint report and dump filtered messages in hjson format.
"""
import argparse
+import logging as log
import re
import sys
from pathlib import Path
@@ -51,6 +52,7 @@
r"^(?!ERROR: Failed to run .* Lint failed)ERROR: .*"),
("errors", r"^Error: .*"),
("errors", r"^E .*"),
+ ("errors", r"^F .*"),
# TODO(https://github.com/olofk/edalize/issues/90):
# this is a workaround until we actually have native Edalize
# support for JasperGold and "formal" targets
@@ -117,12 +119,13 @@
# return nonzero status if any warnings or errors are present
# lint infos do not count as failures
- nr_errors = len(results["errors"]) + len(results["lint_errors"])
- nr_warnings = len(results["warnings"]) + len(results["lint_warnings"])
- print("Lint not successful, got %d warnings and %d errors." %
- (nr_warnings, nr_errors))
- if nr_errors > 0 or nr_warnings > 0:
+ n_errors = len(results["errors"]) + len(results["lint_errors"])
+ n_warnings = len(results["warnings"]) + len(results["lint_warnings"])
+ if n_errors > 0 or n_warnings > 0:
+ log.info("Found %d lint errors and %d lint warnings", n_errors, n_warnings)
sys.exit(1)
+
+ log.info("Lint logfile parsed succesfully")
sys.exit(0)
diff --git a/hw/lint/tools/verilator/parse-lint-report.py b/hw/lint/tools/verilator/parse-lint-report.py
index 7b3e62c..8dcadf6 100755
--- a/hw/lint/tools/verilator/parse-lint-report.py
+++ b/hw/lint/tools/verilator/parse-lint-report.py
@@ -38,7 +38,9 @@
# and we decided not to report it in the dashboard.
("errors",
r"^(?!ERROR: Failed to build .* 'make' exited with an error code)ERROR: .*"),
- ("errors", r"^Error: .*"),
+ ("errors",
+ # This is a redundant Verilator error that we ignore for the same reason as above.
+ r"^(?!%Error: Exiting due to .* warning.*)%Error: .*"),
# TODO(https://github.com/olofk/edalize/issues/90):
# this is a workaround until we actually have native Edalize
# support for JasperGold and "formal" targets
@@ -48,7 +50,7 @@
# remove once this has been fixed in Edalize or in the corefile.
r"^(?!WARNING: Unknown item symbiyosis in section Target)WARNING: .*"
),
- ("warnings", r"^Warning: .* "),
+ ("warnings", r"^%Warning: .* "),
("lint_errors", r"^%Error-.*"),
("lint_warnings", r"^%Warning-.*"),
}