All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Anibal Limon" <anibal.limon@linaro.org>
To: yocto@yoctoproject.org
Cc: yifan.yu@windriver.com, Randy.MacLeod@windriver.com,
	nicolas.dechesne@linaro.org,
	"Aníbal Limón" <anibal.limon@linaro.org>
Subject: [ptest-runner][PATCH 2/4] utils.c: Fix exit status of a child
Date: Mon, 22 Mar 2021 20:10:36 -0600	[thread overview]
Message-ID: <20210323021038.1049654-2-anibal.limon@linaro.org> (raw)
In-Reply-To: <20210323021038.1049654-1-anibal.limon@linaro.org>

Modify testcase to validate the actual exit status.

[YOCTO #14217]

Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
---
 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


  reply	other threads:[~2021-03-23  2:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  2:10 [ptest-runner][PATCH 1/4] utils.c: get_available_ptests allow to specify relative directories Anibal Limon
2021-03-23  2:10 ` Anibal Limon [this message]
2021-03-23  2:10 ` [ptest-runner][PATCH 3/4] utils.c: Use a thread to read from child Anibal Limon
2021-03-23  2:10 ` [ptest-runner][PATCH 4/4] utils.c: wait_child reimplement timeout using alarm Anibal Limon
2021-03-24 15:56   ` Yi Fan Yu
2021-03-24 18:30     ` Anibal Limon

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=20210323021038.1049654-2-anibal.limon@linaro.org \
    --to=anibal.limon@linaro.org \
    --cc=Randy.MacLeod@windriver.com \
    --cc=nicolas.dechesne@linaro.org \
    --cc=yifan.yu@windriver.com \
    --cc=yocto@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.