Fix test failure with -DNDEBUG.
authorCarlos O'Donell <carlos@redhat.com>
Thu, 30 Aug 2018 15:01:33 +0000 (11:01 -0400)
committerCarlos O'Donell <carlos@redhat.com>
Thu, 30 Aug 2018 16:33:22 +0000 (12:33 -0400)
The elf/tst-dlopen-aout.c test uses asserts to verify properties of the
test execution.  Instead of using assert it should use xpthread_create
and xpthread_join to catch errors starting the threads and fail the
test.  This shows up in Fedora 28 when building for i686-pc-linux-gnu
and using gcc 8.1.1.

Tested on i686, and fixes a check failure with -DNDEBUG.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
ChangeLog
elf/tst-dlopen-aout.c

index b3689a68c910676e689330e273ac3018b17cf1a9..21d914141c6a9e6c13aa5b5b6f8e09020731333c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-30  Carlos O'Donell  <carlos@redhat.com>
+
+       * elf/tst-dlopen-aout.c: Include support/xthread.h. Use
+       xpthread_create and xpthread_join.
+
 2018-08-30  Florian Weimer  <fweimer@redhat.com>
 
        * stdlib/stdlib.h (reallocarray): Make available under __USE_MISC.
index 9038e2096add8798992dc32fbb3d0a40de2ed3db..b0264515cfe62276f6eac9f95ae3baf986dd7cc9 100644 (file)
@@ -27,6 +27,7 @@
 #include <dlfcn.h>
 #include <stdio.h>
 #include <pthread.h>
+#include <support/xthread.h>
 
 __thread int x;
 
@@ -45,7 +46,6 @@ do_test (int argc, char *argv[])
     {
       pthread_t thr;
       void *p;
-      int rc;
 
       p = dlopen (argv[0], RTLD_LAZY);
       if (p != NULL)
@@ -53,11 +53,11 @@ do_test (int argc, char *argv[])
           fprintf (stderr, "dlopen unexpectedly succeeded\n");
           return 1;
         }
-      rc = pthread_create (&thr, NULL, fn, NULL);
-      assert (rc == 0);
-
-      rc = pthread_join (thr, NULL);
-      assert (rc == 0);
+      /* We create threads to force TLS allocation, which triggers
+        the original bug i.e. running out of surplus slotinfo entries
+        for TLS.  */
+      thr = xpthread_create (NULL, fn, NULL);
+      xpthread_join (thr);
     }
 
   return 0;