[ptest-runner][PATCH 2/4] utils.c: Fix exit status of a child


Anibal Limon
 

Modify testcase to validate the actual exit status.

[YOCTO #14217]

Signed-off-by: Aníbal Limón <anibal.limon@...>
---
tests/data/fail/ptest/run-ptest | 3 +++
tests/utils.c | 2 +-
utils.c | 3 +++
3 files changed, 7 insertions(+), 1 deletion(-)
mode change 100644 => 100755 tests/data/fail/ptest/run-ptest

diff --git a/tests/data/fail/ptest/run-ptest b/tests/data/fail/ptest/run-ptest
old mode 100644
new mode 100755
index e69de29..f4e5d0b
--- a/tests/data/fail/ptest/run-ptest
+++ b/tests/data/fail/ptest/run-ptest
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+exit 10
diff --git a/tests/utils.c b/tests/utils.c
index 132d98f..105e0c8 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -234,7 +234,7 @@ END_TEST
static void
search_for_fail(const int rp, FILE *fp_stdout)
{
- const char *fail_str = "ERROR: Exit status is";
+ const char *fail_str = "ERROR: Exit status is 10";
char line_buf[PRINT_PTEST_BUF_SIZE];
int found_fail = 0;
char *line = NULL;
diff --git a/utils.c b/utils.c
index 43ab03b..d784736 100644
--- a/utils.c
+++ b/utils.c
@@ -352,6 +352,9 @@ wait_child(pid_t pid, int timeout, int *fds, FILE **fps, int *timeouted)

clock_gettime(clock, &sentinel);
}
+
+ if (WIFEXITED(status))
+ status = WEXITSTATUS(status);
}

fflush(fps[0]);
--
2.31.0

Join yocto@lists.yoctoproject.org to automatically receive all group messages.