diff --git a/trunner/harness/unity.py b/trunner/harness/unity.py index dab6c483..f981e973 100644 --- a/trunner/harness/unity.py +++ b/trunner/harness/unity.py @@ -6,7 +6,7 @@ def unity_harness(dut: Dut, ctx: TestContext, result: TestResult) -> Optional[TestResult]: - assert_re = r"ASSERTION (?P[\S]+):(?P\d+):(?PFAIL|INFO|IGNORE): (?P.*?)\r" + assert_re = r"ASSERTION [\S]+:\d+:(?PFAIL|INFO|IGNORE)(: (?P.*?))?\r" result_re = r"TEST\((?P\w+), (?P\w+)\) (?PPASS|IGNORE)" # Fail need to have its own regex due to greedy matching result_fail_re = r"TEST\((?P\w+), (?P\w+)\) (?PFAIL) at (?P.*?):(?P\d+)\r" @@ -27,14 +27,14 @@ def unity_harness(dut: Dut, ctx: TestContext, result: TestResult) -> Optional[Te if parsed["status"] in ["FAIL", "IGNORE"]: last_assertion = parsed elif idx in (1, 2): - if last_assertion: + if last_assertion.get("msg"): parsed["msg"] = last_assertion["msg"] last_assertion = {} status = Status.from_str(parsed["status"]) subname = f"{parsed['group']}.{parsed['name']}" if "path" in parsed and "line" in parsed: - parsed["msg"] = f"[{parsed['path']}:{parsed['line']}] " + parsed["msg"] + parsed["msg"] = f"[{parsed['path']}:{parsed['line']}] " + parsed.get("msg", "") result.add_subresult(subname, status, parsed.get("msg", "")) stats[parsed["status"]] += 1