about summary refs log tree commit diff
path: root/sysdeps/pthread/tst-pthread_kill-exited.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/pthread/tst-pthread_kill-exited.c')
-rw-r--r--sysdeps/pthread/tst-pthread_kill-exited.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sysdeps/pthread/tst-pthread_kill-exited.c b/sysdeps/pthread/tst-pthread_kill-exited.c
index 7575fb6d58..a2fddad526 100644
--- a/sysdeps/pthread/tst-pthread_kill-exited.c
+++ b/sysdeps/pthread/tst-pthread_kill-exited.c
@@ -16,11 +16,15 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* This test verifies that pthread_kill returns 0 (and not ESRCH) for
-   a thread that has exited on the kernel side.  */
+/* This test verifies that the default pthread_kill returns 0 (and not
+   ESRCH) for a thread that has exited on the kernel side.  */
 
+#include <errno.h>
+#include <pthread.h>
+#include <shlib-compat.h>
 #include <signal.h>
 #include <stddef.h>
+#include <support/check.h>
 #include <support/support.h>
 #include <support/xthread.h>
 
@@ -30,6 +34,12 @@ noop_thread (void *closure)
   return NULL;
 }
 
+#if TEST_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) && PTHREAD_IN_LIBC
+extern __typeof (pthread_kill) compat_pthread_kill;
+compat_symbol_reference (libpthread, compat_pthread_kill, pthread_kill,
+                         GLIBC_2_0);
+#endif
+
 static int
 do_test (void)
 {
@@ -37,7 +47,14 @@ do_test (void)
 
   support_wait_for_thread_exit ();
 
+  /* NB: Always uses the default symbol due to separate compilation.  */
   xpthread_kill (thr, SIGUSR1);
+
+#if TEST_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) && PTHREAD_IN_LIBC
+  /* Old binaries need the non-conforming ESRCH error code.  */
+  TEST_COMPARE (compat_pthread_kill (thr, SIGUSR1), ESRCH);
+#endif
+
   xpthread_join (thr);
 
   return 0;