2023-05-21 15:31:55

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ 2/5] shared/tester: retain test failure status

If a test has called tester_test_failed, consider the test failed, even
if the test also called tester_test_passed/abort.

This avoids reporting success for misbehaving tests that call the
status report functions multiple times.
---
src/shared/tester.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/shared/tester.c b/src/shared/tester.c
index 34f807556..a1ee5b687 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
@@ -622,6 +622,9 @@ static void test_result(enum test_result result)
test->timeout_id = 0;
}

+ if (test->result == TEST_RESULT_FAILED)
+ result = TEST_RESULT_FAILED;
+
test->result = result;
switch (result) {
case TEST_RESULT_PASSED:
--
2.40.1