[oe-commits] [openembedded-core] 28/29: ptest-runner: fixes?
git at git.openembedded.org
git at git.openembedded.org
Fri Apr 5 06:52:32 UTC 2019
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch warrior-next
in repository openembedded-core.
commit c0ab3da45cbaa122bba9919a1b6adbd6719c7f39
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Thu Apr 4 14:27:09 2019 +0100
ptest-runner: fixes?
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
...01-utils-Ensure-stdout-stderr-are-flushed.patch | 39 ++++++++++++
.../0002-use-process-groups-when-spawning.patch | 31 ++++++++++
...03-utils-Ensure-pipes-are-read-after-exit.patch | 70 ++++++++++++++++++++++
.../ptest-runner/ptest-runner_2.3.1.bb | 6 +-
4 files changed, 145 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-support/ptest-runner/ptest-runner/0001-utils-Ensure-stdout-stderr-are-flushed.patch b/meta/recipes-support/ptest-runner/ptest-runner/0001-utils-Ensure-stdout-stderr-are-flushed.patch
new file mode 100644
index 0000000..6edcf24
--- /dev/null
+++ b/meta/recipes-support/ptest-runner/ptest-runner/0001-utils-Ensure-stdout-stderr-are-flushed.patch
@@ -0,0 +1,39 @@
+From 9b36993794c1de733c521b2477370c874c07b617 Mon Sep 17 00:00:00 2001
+From: Richard Purdie <richard.purdie at linuxfoundation.org>
+Date: Thu, 4 Apr 2019 14:18:55 +0100
+Subject: [PATCH 1/3] utils: Ensure stdout/stderr are flushed
+
+Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
+---
+ utils.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/utils.c b/utils.c
+index 504df0b..3ceb342 100644
+--- a/utils.c
++++ b/utils.c
+@@ -295,8 +295,11 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid,
+ }
+
+ if (pfds[1].revents != 0) {
+- while ((n = read(fds[1], buf, WAIT_CHILD_BUF_MAX_SIZE)) > 0)
++ while ((n = read(fds[1], buf, WAIT_CHILD_BUF_MAX_SIZE)) > 0) {
++ fflush(fps[0]);
+ fwrite(buf, n, 1, fps[1]);
++ fflush(fps[1]);
++ }
+ }
+
+ clock_gettime(clock, &sentinel);
+@@ -315,7 +318,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid,
+ break;
+ }
+
+-
++ fflush(fps[0]);
+ return status;
+ }
+
+--
+2.17.1
+
diff --git a/meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch b/meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch
new file mode 100644
index 0000000..96ba0af
--- /dev/null
+++ b/meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch
@@ -0,0 +1,31 @@
+From f0c42a65633341ad048718c7a6dbd035818e9eaf Mon Sep 17 00:00:00 2001
+From: Richard Purdie <richard.purdie at linuxfoundation.org>
+Date: Thu, 4 Apr 2019 14:20:31 +0100
+Subject: [PATCH 2/3] use process groups when spawning
+
+Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
+---
+ utils.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/utils.c b/utils.c
+index 3ceb342..c5b3b8d 100644
+--- a/utils.c
++++ b/utils.c
+@@ -309,7 +309,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid,
+ clock_gettime(clock, &time);
+ if ((time.tv_sec - sentinel.tv_sec) > timeout) {
+ *timeouted = 1;
+- kill(pid, SIGKILL);
++ kill(-pid, SIGKILL);
+ waitflags = 0;
+ }
+ }
+@@ -371,6 +371,7 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts,
+ rc = -1;
+ break;
+ } else if (child == 0) {
++ setsid();
+ run_child(p->run_ptest, pipefd_stdout[1], pipefd_stderr[1]);
+ } else {
+ int status;
diff --git a/meta/recipes-support/ptest-runner/ptest-runner/0003-utils-Ensure-pipes-are-read-after-exit.patch b/meta/recipes-support/ptest-runner/ptest-runner/0003-utils-Ensure-pipes-are-read-after-exit.patch
new file mode 100644
index 0000000..15ea83c
--- /dev/null
+++ b/meta/recipes-support/ptest-runner/ptest-runner/0003-utils-Ensure-pipes-are-read-after-exit.patch
@@ -0,0 +1,70 @@
+From e58e4e1a7f854953f823dc5135d35f728f253f31 Mon Sep 17 00:00:00 2001
+From: Richard Purdie <richard.purdie at linuxfoundation.org>
+Date: Thu, 4 Apr 2019 14:24:14 +0100
+Subject: [PATCH 3/3] utils: Ensure pipes are read after exit
+
+Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
+---
+ utils.c | 29 ++++++++++++++++-------------
+ 1 file changed, 16 insertions(+), 13 deletions(-)
+
+diff --git a/utils.c b/utils.c
+index c5b3b8d..37e88ab 100644
+--- a/utils.c
++++ b/utils.c
+@@ -264,6 +264,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid, pid_t group,
+ struct pollfd pfds[2];
+ struct timespec sentinel;
+ clockid_t clock = CLOCK_MONOTONIC;
++ int looping = 1;
+ int r;
+
+ int status;
+@@ -281,9 +282,23 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid, pid_t group,
+
+ *timeouted = 0;
+
+- while (1) {
++ while (looping) {
+ waitflags = WNOHANG;
+
++ if (timeout >= 0) {
++ struct timespec time;
++
++ clock_gettime(clock, &time);
++ if ((time.tv_sec - sentinel.tv_sec) > timeout) {
++ *timeouted = 1;
++ kill(-pid, SIGKILL);
++ waitflags = 0;
++ }
++ }
++
++ if (waitpid(pid, &status, waitflags) == pid)
++ looping = 0;
++
+ r = poll(pfds, 2, WAIT_CHILD_POLL_TIMEOUT_MS);
+ if (r > 0) {
+ char buf[WAIT_CHILD_BUF_MAX_SIZE];
+@@ -303,19 +318,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid, pid_t group,
+ }
+
+ clock_gettime(clock, &sentinel);
+- } else if (timeout >= 0) {
+- struct timespec time;
+-
+- clock_gettime(clock, &time);
+- if ((time.tv_sec - sentinel.tv_sec) > timeout) {
+- *timeouted = 1;
+- kill(-pid, SIGKILL);
+- waitflags = 0;
+- }
+ }
+-
+- if (waitpid(pid, &status, waitflags) == pid)
+- break;
+ }
+
+ fflush(fps[0]);
+--
+2.17.1
+
diff --git a/meta/recipes-support/ptest-runner/ptest-runner_2.3.1.bb b/meta/recipes-support/ptest-runner/ptest-runner_2.3.1.bb
index 4b7992b..e2eb258 100644
--- a/meta/recipes-support/ptest-runner/ptest-runner_2.3.1.bb
+++ b/meta/recipes-support/ptest-runner/ptest-runner_2.3.1.bb
@@ -10,7 +10,11 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe"
SRCREV = "05b112bda7ac2adba8e9b0f088d6e5843b148a38"
PV = "2.3.1+git${SRCPV}"
-SRC_URI = "git://git.yoctoproject.org/ptest-runner2"
+SRC_URI = "git://git.yoctoproject.org/ptest-runner2 \
+ file://0001-utils-Ensure-stdout-stderr-are-flushed.patch \
+ file://0002-use-process-groups-when-spawning.patch \
+ file://0003-utils-Ensure-pipes-are-read-after-exit.patch"
+
S = "${WORKDIR}/git"
FILES_${PN} = "${bindir}/ptest-runner"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list