When a test times out, it should still print an ERROR message in the log
for parsing. Modify the timeout test suite to ensure this is done.

Signed-off-by: Joshua Watt <jpewhac...@gmail.com>
---
 tests/utils.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/utils.c b/tests/utils.c
index d82b90e..e493858 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -201,12 +201,13 @@ START_TEST(test_run_ptests)
 END_TEST
 
 static void
-search_for_timeout_and_duration(const int rp, FILE *fp_stdout)
+search_for_timeout_error_and_duration(const int rp, FILE *fp_stdout)
 {
        const char *timeout_str = "TIMEOUT";
        const char *duration_str = "DURATION";
+       const char *error_str = "ERROR";
        char line_buf[PRINT_PTEST_BUF_SIZE];
-       bool found_timeout = false, found_duration = false;
+       bool found_timeout = false, found_duration = false, found_error = false;
        char *line = NULL;
 
        ck_assert(rp != 0);
@@ -215,10 +216,12 @@ search_for_timeout_and_duration(const int rp, FILE 
*fp_stdout)
                // once true, stay true
                found_timeout = found_timeout ? found_timeout : find_word(line, 
timeout_str);
                found_duration = found_duration ? found_duration : 
find_word(line, duration_str);
+               found_error = found_error ? found_error : find_word(line, 
error_str);
        }
 
        ck_assert_msg(found_timeout == true, "TIMEOUT not found");
        ck_assert_msg(found_duration == true, "DURATION not found");
+       ck_assert_msg(found_error == true, "ERROR not found");
 }
 
 START_TEST(test_run_timeout_duration_ptest)
@@ -226,7 +229,7 @@ START_TEST(test_run_timeout_duration_ptest)
        struct ptest_list *head = get_available_ptests(opts_directory);
        unsigned int timeout = 1;
 
-       test_ptest_expected_failure(head, timeout, "hang", 
search_for_timeout_and_duration);
+       test_ptest_expected_failure(head, timeout, "hang", 
search_for_timeout_error_and_duration);
 
        ptest_list_free_all(head);
 }
-- 
2.33.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#60622): https://lists.yoctoproject.org/g/yocto/message/60622
Mute This Topic: https://lists.yoctoproject.org/mt/100256673/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to