diff options
author | Dimitrios Apostolou <jimis@qt.io> | 2022-04-21 16:20:15 +0200 |
---|---|---|
committer | Dimitrios Apostolou <jimis@qt.io> | 2022-04-22 15:38:59 +0200 |
commit | 399dbba775d322bb2c7097b17b5795d908f71373 (patch) | |
tree | 51ed5815f17637b38293f2aae0c2076bacc7747d /util | |
parent | 42444a18b018064f3c15a2b2bd7aaaec45c292d5 (diff) |
qt-testrunner: improve error logging
Do not print full stack traces when a controlled exception occurs,
instead print just the exception name and the message.
Change-Id: I5669862d2e98c550d88d1d11fb2bf49f197cfc17
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-x | util/testrunner/qt-testrunner.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/util/testrunner/qt-testrunner.py b/util/testrunner/qt-testrunner.py index 4dcde830ae..71dacbaf07 100755 --- a/util/testrunner/qt-testrunner.py +++ b/util/testrunner/qt-testrunner.py @@ -36,6 +36,8 @@ # # ./util/testrunner/tests/tst_testrunner.py -v [--debug] # +# ======== qt-testrunner ======== +# # This script wraps the execution of a Qt test executable, for example # tst_whatever, and tries to iron out unpredictable test failures. # In particular: @@ -207,10 +209,14 @@ def parse_log(results_file) -> List[WhatFailed]: except FileNotFoundError: L.error("XML log file not found: %s", results_file) raise - except ET.ParseError: + except Exception as e: L.error("Failed to parse the XML log file: %s", results_file) with open(results_file, "rb") as f: - L.error("File Contents:\n%s\n\n", f.read().decode("utf-8", "ignore")) + if os.stat(f.fileno()).st_size == 0: + L.error(" File is empty") + else: + L.error(" File Contents:\n%s\n\n", + f.read().decode("utf-8", "ignore")) raise root = tree.getroot() @@ -369,9 +375,8 @@ def main(): break # all is fine, goto re-running individual failed testcases except Exception as e: - L.exception("The test executable CRASHed uncontrollably!" - " Details about where we caught the problem:", - exc_info=e) + L.error("exception:%s %s", type(e).__name__, e) + L.error("The test executable probably crashed, see above for details") if args.max_repeats == 0: sys.exit(2) # Some tests failed but no re-runs were asked @@ -385,10 +390,8 @@ def main(): what_failed, args.max_repeats, args.passes_needed, dryrun=args.dry_run, timeout=args.timeout) except Exception as e: - L.exception("The test executable CRASHed uncontrollably!" - " Details about where we caught the problem:", - exc_info=e) - L.error("Test re-run exited unxpectedly, aborting!") + L.error("exception:%s %s", type(e).__name__, e) + L.error("The testcase re-run probably crashed, giving up") sys.exit(3) # Test re-run CRASH if not ret: |