summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Semjonovs <asemjonovs@google.com>2023-02-23 09:46:43 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-23 18:49:05 +0000
commitf56b8b220c6cab3d3309ec34637a289e9a45cdea (patch)
tree7e5658b3c376858f3f4a18597d485f927cd3b883
parentad67dfda11c9495c3d3802e8082e388a7e8880df (diff)
downloadchrome-ec-f56b8b220c6cab3d3309ec34637a289e9a45cdea.tar.gz
zephyr: Handle scenario where an assert is not found in the log
Sometimes the assert occurs in the setup of a test which is outside of the `START` and `FAIL` markers of a test leaving the test with no valid assertion marker. BUG=None BRANCH=NONE TEST=Add failing assert in setup, ./twister -T zephyr/test Change-Id: I96999fe2eb40b33390df8c7ac24a48f8050b5767 Signed-off-by: Al Semjonovs <asemjonovs@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4287588 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
-rwxr-xr-xutil/zephyr_to_resultdb.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/zephyr_to_resultdb.py b/util/zephyr_to_resultdb.py
index 5d5edc6c99..e9cc191b43 100755
--- a/util/zephyr_to_resultdb.py
+++ b/util/zephyr_to_resultdb.py
@@ -2,6 +2,7 @@
# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
""" Upload twister results to ResultDB
Usage:
@@ -135,7 +136,12 @@ def testcase_to_result(testsuite, testcase, base_tags, config_tags):
assert_msg = re.findall(
r"Assertion failed.*$", testcase["log"], re.MULTILINE
)
- result["failureReason"] = {"primaryErrorMessage": assert_msg[0]}
+ if assert_msg:
+ result["failureReason"] = {"primaryErrorMessage": assert_msg[0]}
+ else:
+ result["failureReason"] = {
+ "primaryErrorMessage": "Assert not found - possibly occurred in test setup"
+ }
return result