[contrib] validate_failures.py: Another fix for GCC's results
Some of GCC's random .json results files cannot even be parsed.
(for instance gotools/check-go-dir/src/cmd/internal/test2json/testdata/ascii.json)
Skip them intead of crashing.
Change-Id: Ib8b0ecfffeef932a3114181c351d3460c558b52a
diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py
index c89c613..2efd70f 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -438,7 +438,15 @@
json_input = sum_fname.endswith('.json')
if json_input:
- file_results = json.load(sum_file)
+ try:
+ file_results = json.load(sum_file)
+ except:
+ if _OPTIONS.verbosity >= 2:
+ # GCC's testing generates random .json files, which we can detect
+ # as results. Some of them cannot even be parsed.
+ print(f'WARNING: cannot parse JSON result file "{sum_fname}"')
+ return result_set
+
if not 'tests' in file_results:
if _OPTIONS.verbosity >= 2:
# GCC's testing generates random .json files, which we can detect