[PATCH 2/2] nptl: Convert tst-sem11 and tst-sem12 tests to use the test driver

Maciej W. Rozycki macro@orcam.me.uk
Thu Jul 11 13:17:20 GMT 2024


From: Maciej W. Rozycki <macro@redhat.com>

Fix an issue with commit 2af4e3e5668f ("Test of semaphores.") by making 
the tst-sem11 and tst-sem12 tests use the test driver, preventing them 
from ever causing testing to hang forever and never complete, such as 
currently happening with the 'mips-linux-gnu' (o32 ABI) target.  Adjust 
the name of the PREPARE macro, which clashes with the interpretation of 
its presence by the test driver, by using a TF_ prefix in reference to 
the name of the 'tf' function.
---
 nptl/tst-sem11.c |    8 +++++---
 nptl/tst-sem12.c |    2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

glibc-tst-sem11-test-driver.diff
Index: glibc/nptl/tst-sem11.c
===================================================================
--- glibc.orig/nptl/tst-sem11.c
+++ glibc/nptl/tst-sem11.c
@@ -29,15 +29,15 @@
 static void *
 tf (void *arg)
 {
-#ifdef PREPARE
-  PREPARE
+#ifdef TF_PREPARE
+  TF_PREPARE
 #endif
   SEM_WAIT (arg);
   return NULL;
 }
 
 int
-main (void)
+do_test (void)
 {
   int tries = 5;
   pthread_t th;
@@ -101,3 +101,5 @@ main (void)
 
   return 0;
 }
+
+#include <support/test-driver.c>
Index: glibc/nptl/tst-sem12.c
===================================================================
--- glibc.orig/nptl/tst-sem12.c
+++ glibc/nptl/tst-sem12.c
@@ -20,7 +20,7 @@
 #include <sys/time.h>
 
 
-#define PREPARE \
+#define TF_PREPARE \
   struct timespec ts; \
   struct timeval tv; \
   gettimeofday (&tv, NULL); \


More information about the Libc-alpha mailing list