[ptest-runner,2/2] tests: Update to cover ptest timeout by file

Submitted by Aníbal Limón on March 23, 2021, 6:57 p.m. | Patch ID: 179414

Details

Message ID 20210323185719.2949300-2-anibal.limon@linaro.org
State New
Headers show

Commit Message

Aníbal Limón March 23, 2021, 6:57 p.m.
Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
---
 tests/ptest_list.c | 10 +++++-----
 tests/utils.c      | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/ptest_list.c b/tests/ptest_list.c
index 081f027..37d19ae 100644
--- a/tests/ptest_list.c
+++ b/tests/ptest_list.c
@@ -52,7 +52,7 @@  END_TEST
 START_TEST(test_add)
 {
 	struct ptest_list *head = ptest_list_alloc();
-	ck_assert(ptest_list_add(head, strdup("perl"), NULL) != NULL);
+	ck_assert(ptest_list_add(head, strdup("perl"), NULL, 1) != NULL);
 	ptest_list_free_all(head);
 }
 END_TEST
@@ -67,7 +67,7 @@  START_TEST(test_free_all)
 
 	head = ptest_list_alloc();
 	for (i = 0; i < ptests_num; i++)
-		ptest_list_add(head, strdup(ptest_names[i]), NULL);
+		ptest_list_add(head, strdup(ptest_names[i]), NULL, 1);
 
 	ptest_list_free_all(head);
 }
@@ -84,7 +84,7 @@  START_TEST(test_length)
  
 	head = ptest_list_alloc();
 	for (i = 0; i < ptests_num; i++)
-		ptest_list_add(head, strdup(ptest_names[i]), NULL);
+		ptest_list_add(head, strdup(ptest_names[i]), NULL, 1);
 
 	ck_assert_int_eq(ptest_list_length(head), ptests_num);
 	ptest_list_free_all(head);
@@ -103,7 +103,7 @@  START_TEST(test_search)
 	head = ptest_list_alloc();
 	for (i = 0; i < ptests_num; i++) {
 		ptest = strdup(ptest_names[i]);
-		ptest_list_add(head, ptest, NULL);
+		ptest_list_add(head, ptest, NULL, 1);
 	}
 
 	for (i = ptests_num - 1; i >= 0; i--)
@@ -122,7 +122,7 @@  START_TEST(test_remove)
 
 	for (i = 0; i < ptests_num; i++) {
 		ptest = strdup(ptest_names[i]);
-		ptest_list_add(head, ptest, NULL);
+		ptest_list_add(head, ptest, NULL, 1);
 	}
 
 	/* Remove node free'ing */
diff --git a/tests/utils.c b/tests/utils.c
index 105e0c8..8df1b54 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -78,7 +78,7 @@  static void test_ptest_expected_failure(struct ptest_list *, const int, char *,
 
 START_TEST(test_get_available_ptests)
 {
-	struct ptest_list *head = get_available_ptests(opts_directory);
+	struct ptest_list *head = get_available_ptests(opts_directory, 1);
 	int i;
 
 	ck_assert(ptest_list_length(head) == ptests_found_length);
@@ -121,7 +121,7 @@  START_TEST(test_print_ptests)
 	ck_assert(line != NULL);
 	ck_assert(strcmp(line, PRINT_PTESTS_NOT_FOUND) == 0);
 
-	head = get_available_ptests(opts_directory);
+	head = get_available_ptests(opts_directory, 1);
 	ck_assert(print_ptests(head, fp) == 0);
 	ptest_list_free_all(head);
 	line = fgets(line_buf, PRINT_PTEST_BUF_SIZE, fp);
@@ -143,7 +143,7 @@  END_TEST
 
 START_TEST(test_filter_ptests)
 {
-	struct ptest_list *head = get_available_ptests(opts_directory);
+	struct ptest_list *head = get_available_ptests(opts_directory, 1);
 	struct ptest_list *head_new;
 	char *ptest_not_exists[] = {
 		"glib",
@@ -185,7 +185,7 @@  START_TEST(test_run_ptests)
 	fp_stderr = open_memstream(&buf_stderr, &size_stderr);
 	ck_assert(fp_stderr != NULL);
 
-	head = get_available_ptests(opts_directory);
+	head = get_available_ptests(opts_directory, 1);
 	ptest_list_remove(head, "hang", 1);
 	ptest_list_remove(head, "fail", 1);
 
@@ -222,8 +222,8 @@  search_for_timeout_and_duration(const int rp, FILE *fp_stdout)
 
 START_TEST(test_run_timeout_duration_ptest)
 {
-	struct ptest_list *head = get_available_ptests(opts_directory);
-	int timeout = 1;
+	int timeout = 20;
+	struct ptest_list *head = get_available_ptests(opts_directory, timeout);
 
 	test_ptest_expected_failure(head, timeout, "hang", search_for_timeout_and_duration);
 
@@ -250,8 +250,8 @@  search_for_fail(const int rp, FILE *fp_stdout)
 
 START_TEST(test_run_fail_ptest)
 {
-	struct ptest_list *head = get_available_ptests(opts_directory);
 	int timeout = 1;
+	struct ptest_list *head = get_available_ptests(opts_directory, timeout);
 
 	test_ptest_expected_failure(head, timeout, "fail", search_for_fail);