Control: tags -1 + patch

On 06/09/13 03:07, Steven Chamberlain wrote:
> BTW it would be nice if failures in the testsuite would output the
> contents of libmissing/tests/test-suite.log into the build log.

Please see attached libprelude-0.diff for an easy way to do this.

On 06/09/13 09:12, Julien Cristau wrote:
> SO_REUSEADDR is requested after bind(), though, which is broken.

Right.  Attached libprelude-1.diff fixes that, making the test now fail
*consistently* on kfreebsd-*.

The real problem appears to be a race condition in the test program.
Please see libprelude-2.diff which illustrates where this happens, and
it might even be a suitable workaround for the problem.  (The test
succeeds now, and the package no longer FTBFS).

Regards,
-- 
Steven Chamberlain
ste...@pyro.eu.org
--- a/libprelude-1.0.0/libmissing/tests/test-select.c   2010-02-24 12:52:50.000000000 +0000
+++ b/libprelude-1.0.0/libmissing/tests/test-select.c   2014-01-23 17:15:58.800126424 +0000
@@ -113,15 +113,16 @@
   ia.sin_family = AF_INET;
   inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr);
   ia.sin_port = htons (TEST_PORT);
+
+  x = 1;
+  setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
+
   if (bind (s, (struct sockaddr *) &ia, sizeof (ia)) < 0)
     {
       perror ("bind");
       exit (77);
     }
 
-  x = 1;
-  setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
-
   if (listen (s, 1) < 0)
     {
       perror ("listen");
steven@sid:~$ diff -Nru [ab]/libprelude-1.0.0/libmissing/tests/test-poll.c                                                                                                                           
--- a/libprelude-1.0.0/libmissing/tests/test-poll.c     2010-02-24 12:52:50.000000000 +0000
+++ b/libprelude-1.0.0/libmissing/tests/test-poll.c     2014-01-23 17:47:23.578108763 +0000
@@ -98,15 +98,16 @@
   ia.sin_family = AF_INET;
   inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr);
   ia.sin_port = htons (TEST_PORT);
+
+  x = 1;
+  setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
+
   if (bind (s, (struct sockaddr *) &ia, sizeof (ia)) < 0)
     {
       perror ("bind");
       exit (77);
     }
 
-  x = 1;
-  setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
-
   if (listen (s, 1) < 0)
     {
       perror ("listen");
--- a/libprelude-1.0.0/debian/rules     2013-08-20 13:42:51.000000000 +0100
+++ b/libprelude-1.0.0/debian/rules     2014-01-23 17:17:59.954111332 +0000
@@ -4,6 +4,9 @@
 export DEB_BUILD_HARDENING=1
 export DEB_BUILD_HARDENING_FORMAT=0
 
+# Show test-suite.log in the build log after failures
+export VERBOSE=1
+
 PYVERS=$(shell pyversions -vr)
 
 override_dh_auto_configure:
--- a/libprelude-1.0.0/libmissing/tests/test-poll.c     2010-02-24 12:52:50.000000000 +0000
+++ b/libprelude-1.0.0/libmissing/tests/test-poll.c     2014-01-23 17:47:23.578108763 +0000
@@ -280,6 +281,7 @@
         failed ("cannot read data left in the socket by closed process");
       read (c, buf, 3);
       write (c, "foo", 3);
+      sleep(1); /* :XXX: race condition in test */
       if ((poll1_wait (c, POLLIN | POLLOUT) & (POLLHUP | POLLERR)) == 0)
         failed ("expecting POLLHUP after shutdown");
       close (c);
@@ -332,6 +334,7 @@
   test_pair (c1, c2);
   close (c1);
   write (c2, "foo", 3);
+  sleep(1); /* :XXX: race condition in test */
   if ((poll1_nowait (c2, POLLIN | POLLOUT) & (POLLHUP | POLLERR)) == 0)
     failed ("expecting POLLHUP after shutdown");
 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to