Yocto Project Discussions
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: yocto@lists.yoctoproject.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [ptest-runner][PATCH] tests: Ensure that timeouts still print ERROR
Date: Thu, 20 Jul 2023 08:16:57 -0600	[thread overview]
Message-ID: <20230720141657.1086331-1-JPEWhacker@gmail.com> (raw)

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 <JPEWhacker@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



                 reply	other threads:[~2023-07-20 14:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230720141657.1086331-1-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox