bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* execute tests: Avoid test failure on Android
@ 2023-01-17 14:21 Bruno Haible
  2023-01-17 19:42 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Bruno Haible @ 2023-01-17 14:21 UTC (permalink / raw)
  To: bug-gnulib

On Android 11, I'm seeing a test failure:

FAIL: test-execute.sh
=====================

test-execute-main: test-execute-child subprocess failed
../../gltests/test-execute-main.c:138: assertion 'ret == 127' failed
Aborted
test-execute.sh: test case 3 failed
../../gltests/test-execute-main.c:151: assertion 'ret == 0' failed
Aborted
test-execute.sh: test case 4 failed
FAIL test-execute.sh (exit status: 1)

When I run
  make check TESTS=test-execute.sh
or
  rm -f test-execute.sh.log; make test-execute.sh.log
I see the test cases 3 and 4 fail, because the child program has
exited with exit code 71.

Whereas when I run
  ../../gltests/test-execute.sh
directly, all the tests pass.

Apparently the SIGPIPE handler gets set to SIG_IGN, either by 'make' or
by the test-driver.

This patch implements a workaround.


2023-01-17  Bruno Haible  <bruno@clisp.org>

	execute tests: Avoid test failure on Android.
	* tests/test-execute-main.c (main): Reset the SIGPIPE handler to
	default.

diff --git a/tests/test-execute-main.c b/tests/test-execute-main.c
index d89b34465b..fbaa9c9d2e 100644
--- a/tests/test-execute-main.c
+++ b/tests/test-execute-main.c
@@ -58,6 +58,18 @@ main (int argc, char *argv[])
   const char *progname = "test-execute-child";
   int test = atoi (argv[2]);
 
+#if defined __ANDROID__
+  /* On Android 11, when this test is executed through 'make' (GNU make 4.4) and
+     build-aux/test-driver, i.e. through
+       make check TESTS=test-execute.sh
+     or
+       rm -f test-execute.sh.log; make test-execute.sh.log
+     the signal handler for SIGPIPE is set to SIG_IGN.  This causes the tests
+     3 and 4 to fail.  Work around it by resetting the signal handler for
+     SIGPIPE to the default.  */
+  signal (SIGPIPE, SIG_DFL);
+#endif
+
   switch (test)
     {
     case 14:





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: execute tests: Avoid test failure on Android
  2023-01-17 14:21 execute tests: Avoid test failure on Android Bruno Haible
@ 2023-01-17 19:42 ` Eric Blake
  2023-01-17 21:15   ` Bruno Haible
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2023-01-17 19:42 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib

On Tue, Jan 17, 2023 at 03:21:52PM +0100, Bruno Haible wrote:
> On Android 11, I'm seeing a test failure:
> 
> 
> Apparently the SIGPIPE handler gets set to SIG_IGN, either by 'make' or
> by the test-driver.

Known regression in make 4.4:
https://savannah.gnu.org/bugs/index.php?63307

and being fixed in 4.4.1, but it sounds like we'll have lots of
systems in the wild with 4.4, and thus lots of these workarounds
having to be applied elsewhere.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: execute tests: Avoid test failure on Android
  2023-01-17 19:42 ` Eric Blake
@ 2023-01-17 21:15   ` Bruno Haible
  0 siblings, 0 replies; 3+ messages in thread
From: Bruno Haible @ 2023-01-17 21:15 UTC (permalink / raw)
  To: Eric Blake; +Cc: bug-gnulib

Eric Blake wrote:
> > Apparently the SIGPIPE handler gets set to SIG_IGN, either by 'make' or
> > by the test-driver.
> 
> Known regression in make 4.4:
> https://savannah.gnu.org/bugs/index.php?63307

Thanks. Indeed, I can reproduce the test failure also on a glibc system,
with make 4.4 in $PATH. Thus I'm generalizing the workaround:


2023-01-17  Bruno Haible  <bruno@clisp.org>

	execute tests: Avoid test failure with GNU make 4.4.
	Reported by Eric Blake in
	<https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00157.html>.
	* tests/test-execute-main.c (main): Reset the SIGPIPE handler to
	default on all platforms.

diff --git a/tests/test-execute-main.c b/tests/test-execute-main.c
index fbaa9c9d2e..2088408756 100644
--- a/tests/test-execute-main.c
+++ b/tests/test-execute-main.c
@@ -58,17 +58,16 @@ main (int argc, char *argv[])
   const char *progname = "test-execute-child";
   int test = atoi (argv[2]);
 
-#if defined __ANDROID__
-  /* On Android 11, when this test is executed through 'make' (GNU make 4.4) and
+  /* When this test is executed through 'make' (GNU make 4.4) and
      build-aux/test-driver, i.e. through
        make check TESTS=test-execute.sh
      or
        rm -f test-execute.sh.log; make test-execute.sh.log
-     the signal handler for SIGPIPE is set to SIG_IGN.  This causes the tests
-     3 and 4 to fail.  Work around it by resetting the signal handler for
-     SIGPIPE to the default.  */
+     the signal handler for SIGPIPE is set to SIG_IGN.  This is a bug in
+     GNU make 4.4: <https://savannah.gnu.org/bugs/index.php?63307>.
+     It causes the tests 3 and 4 to fail.  Work around it by resetting
+     the signal handler for SIGPIPE to the default.  */
   signal (SIGPIPE, SIG_DFL);
-#endif
 
   switch (test)
     {





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-17 21:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 14:21 execute tests: Avoid test failure on Android Bruno Haible
2023-01-17 19:42 ` Eric Blake
2023-01-17 21:15   ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).