From 2918b0d0ecbf781400577d63aed7eaa4498dad91 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 14 Jun 2016 12:18:32 -0300 Subject: nptl: Add more coverage in tst-cancel4 This patch adds early cancel test for open syscall through a FIFO (thus makign subsequent call to open block until the other end is also opened). It also cleanup the sigpause tests by using sigpause along with SIGINT instead of __xpg_sigpause and SIGCANCEL. Since the idea is just to test the cancellation handling there is no need to expose internal glibc implementation details to the test through pthreadP.h inclusion. Tested x86_64. * nptl/tst-cancel4-common.c (do_test): Add temporary fifo creation. * nptl/tst-cancel4-common.h (fifoname): New variable. (fifofd): Likewise. (cl_fifo): New function. * nptl/tst-cancel4.c (tf_sigpause): Replace SIGCANCEL usage by SIGINT. (tf_open): Add early cancel test. --- nptl/tst-cancel4-common.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'nptl/tst-cancel4-common.c') diff --git a/nptl/tst-cancel4-common.c b/nptl/tst-cancel4-common.c index f235d534c8..7cb5411252 100644 --- a/nptl/tst-cancel4-common.c +++ b/nptl/tst-cancel4-common.c @@ -44,6 +44,12 @@ do_test (void) } setsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, sizeof(val)); + if (mktemp (fifoname) == NULL) + { + printf ("%s: cannot generate temp file name: %m\n", __func__); + exit (1); + } + int result = 0; size_t cnt; for (cnt = 0; cnt < ntest_tf; ++cnt) @@ -71,7 +77,7 @@ do_test (void) int r = pthread_barrier_wait (&b2); if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) { - printf ("%s: barrier_wait failed\n", __FUNCTION__); + printf ("%s: barrier_wait failed\n", __func__); result = 1; continue; } @@ -169,7 +175,7 @@ do_test (void) int r = pthread_barrier_wait (&b2); if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) { - printf ("%s: barrier_wait failed\n", __FUNCTION__); + printf ("%s: barrier_wait failed\n", __func__); result = 1; continue; } @@ -184,7 +190,7 @@ do_test (void) r = pthread_barrier_wait (&b2); if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) { - printf ("%s: barrier_wait failed\n", __FUNCTION__); + printf ("%s: barrier_wait failed\n", __func__); result = 1; continue; } -- cgit v1.2.3