[rtems-tools commit] tester: Prevent crash with json output

Joel Sherrill joel at rtems.org
Mon Oct 5 23:59:04 UTC 2020


Module:    rtems-tools
Branch:    master
Commit:    79a9a46a207b5ed136dc7f0bc0f5f056c62fcfbc
Changeset: http://git.rtems.org/rtems-tools/commit/?id=79a9a46a207b5ed136dc7f0bc0f5f056c62fcfbc

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Mon Oct  5 15:41:33 2020 -0500

tester: Prevent crash with json output

This fixes an issue with json report output that causes a crash due to
the incorrect object member being accessed for test-too-long. This also
changes treatment of fatal errors to match how they are displayed in the
tester log output and changes "fatal error" to "fatal-error" to better
match the naming of all the other failure types.

---

 tester/rt/report.py | 2 +-
 tester/rt/test.py   | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tester/rt/report.py b/tester/rt/report.py
index 5f871dc..be8df74 100644
--- a/tester/rt/report.py
+++ b/tester/rt/report.py
@@ -194,7 +194,7 @@ class report(object):
                         status = 'passed'
                         self.passed += 1
                 elif fatal:
-                    status = 'fatal error'
+                    status = 'fatal-error'
                     self.failed += 1
                 elif timeout:
                     status = 'timeout'
diff --git a/tester/rt/test.py b/tester/rt/test.py
index fa9ddf5..9b157e9 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -235,7 +235,7 @@ def generate_json_report(args, reports, start_time, end_time,
     json_log['summary']['indeterminate_count'] = reports.indeterminate
     json_log['summary']['benchmark_count'] = reports.benchmark
     json_log['summary']['timeout_count'] = reports.timeouts
-    json_log['summary']['too_long_count'] = reports.too_long
+    json_log['summary']['test-too-long_count'] = reports.test_too_long
     json_log['summary']['invalid_count'] = reports.invalids
     json_log['summary']['wrong-version_count'] = reports.wrong_version
     json_log['summary']['wrong-build_count'] = reports.wrong_build
@@ -247,7 +247,7 @@ def generate_json_report(args, reports, start_time, end_time,
 
     result_types = [
             'failed', 'user-input', 'expected-fail', 'indeterminate',
-            'benchmark', 'timeout', 'too-long', 'invalid', 'wrong-version',
+            'benchmark', 'timeout', 'test-too-long', 'invalid', 'wrong-version',
             'wrong-build', 'wrong-tools'
     ]
     json_results = {}
@@ -257,6 +257,9 @@ def generate_json_report(args, reports, start_time, end_time,
     # collate results for JSON log
     for name in reports.results:
         result_type = reports.results[name]['result']
+        # map fatal-error on to failed since the report adds both to the failed count
+        if result_type == "fatal-error":
+            result_type = "failed"
         test_parts = name.split("/")
         test_category = test_parts[-2]
         test_name = test_parts[-1]
@@ -305,7 +308,7 @@ def generate_junit_report(args, reports, start_time, end_time,
     junit_prop['indeterminate_count'] = reports.indeterminate
     junit_prop['benchmark_count'] = reports.benchmark
     junit_prop['timeout_count'] = reports.timeouts
-    junit_prop['too_long_count'] = reports.too_long
+    junit_prop['test-too-long_count'] = reports.test_too_long
     junit_prop['invalid_count'] = reports.invalids
     junit_prop['wrong-version_count'] = reports.wrong_version
     junit_prop['wrong-build_count'] = reports.wrong_build



More information about the vc mailing list