diff options
author | Al Semjonovs <asemjonovs@google.com> | 2022-11-16 16:14:39 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-11-18 22:36:56 +0000 |
commit | d01200c9c770b857ec642164cb767f9d86023184 (patch) | |
tree | 961158020ce275d6b00f805401c1fa5e81fe3a3b | |
parent | 24fa4c10964224b12799ae8b6b08ea85a52acbd4 (diff) | |
download | chrome-ec-d01200c9c770b857ec642164cb767f9d86023184.tar.gz |
twister: Upload full test suite logs to ResultDB
Include full testsuite log with test results
BUG=b:248067639
BRANCH=NONE
TEST=./twister -T zephyr/test
Signed-off-by: Al Semjonovs <asemjonovs@google.com>
Change-Id: I7cf0413ba4479fd09770851988c77e9206f8e923
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4033066
Reviewed-by: Simon Glass <sjg@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rwxr-xr-x | util/zephyr_to_resultdb.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/util/zephyr_to_resultdb.py b/util/zephyr_to_resultdb.py index 0375e42ddb..438a3cd4d1 100755 --- a/util/zephyr_to_resultdb.py +++ b/util/zephyr_to_resultdb.py @@ -62,9 +62,7 @@ def testcase_summary(testcase): or "reason" in testcase or translate_status(testcase["status"]) == "SKIP" ): - html = ( - '<p><text-artifact artifact-id="artifact-content-in-request"></p>' - ) + html = '<p><text-artifact artifact-id="test_log"></p>' return html @@ -85,6 +83,16 @@ def testcase_artifact(testcase): return base64.b64encode(artifact.encode()) +def testsuite_artifact(testsuite): + """Translates ZTEST testcase to ResultDB artifact""" + artifact = "Unknown" + + if "log" in testsuite and testsuite["log"]: + artifact = testsuite["log"] + + return base64.b64encode(artifact.encode()) + + def testcase_to_result(testsuite, testcase, base_tags, config_tags): """Translates ZTEST testcase to ResultDB format See TestResult type in @@ -96,9 +104,12 @@ def testcase_to_result(testsuite, testcase, base_tags, config_tags): "expected": translate_expected(testcase["status"]), "summaryHtml": testcase_summary(testcase), "artifacts": { - "artifact-content-in-request": { + "test_log": { "contents": testcase_artifact(testcase), - } + }, + "testsuite_log": { + "contents": testsuite_artifact(testsuite), + }, }, "tags": [ {"key": "platform", "value": testsuite["platform"]}, @@ -113,6 +124,12 @@ def testcase_to_result(testsuite, testcase, base_tags, config_tags): for (key, value) in config_tags: result["tags"].append({"key": key.lower(), "value": value}) + if result["status"] == "FAIL" and "log" in testcase and testcase["log"]: + assert_msg = re.findall( + r"Assertion failed.*$", testcase["log"], re.MULTILINE + ) + result["failureReason"] = {"primaryErrorMessage": assert_msg[0]} + return result |