nptl: Using libsupport for tst-cancel4*

Checked on x86_64-linux-gnu.

	* nptl/tst-cancel4-common.c: Use libsupport.
	* nptl/tst-cancel4-common.h: Likewise.
	* nptl/tst-cancel4.c (tf_read): Likewise.
	(tf_readv): Likewise.
	(tf_write): Likewise.
	(tf_writev): Likewise.
	(tf_sleep): Likewise.
	(tf_usleep): Likewise.
	(tf_nanosleep): Likewise.
	(tf_select): Likewise.
	(tf_pselect): Likewise.
	(tf_poll): Likewise.
	(tf_ppoll): Likewise.
	(tf_wait): Likewise.
	(tf_waitpid): Likewise.
	(tf_waitid): Likewise.
	(tf_sigpause): Likewise.
	(tf_sigsuspend): Likewise.
	(tf_sigwait): Likewise.
	(tf_sigwaitinfo): Likewise.
	(tf_sigtimedwait): Likewise.
	(tf_pause): Likewise.
	(tf_accept): Likewise.
	(tf_send): Likewise.
	(tf_recv): Likewise.
	(tf_recvfrom): Likewise.
	(tf_recvmsg): Likewise.
	(tf_open): Likewise.
	(tf_close): Likewise.
	(tf_pread): Likewise.
	(tf_pwrite): Likewise.
	(tf_preadv): Likewise.
	(tf_pwritev): Likewise.
	(tf_fsync): Likewise.
	(tf_fdatasync): Likewise.
	(tf_msync): Likewise.
	(tf_sendto): Likewise.
	(tf_sendmsg): Likewise.
	(tf_creat): Likewise.
	(tf_connect): Likewise.
	(tf_tcdrain): Likewise.
	(tf_msgrcv): Likewise.
	(tf_msgsnd): Likewise.
	* nptl/tst-cancel4_1.c (tf_sendmmsg): Likewise.
	* nptl/tst-cancel4_2.c (tf_recvmmsg): Likewise.
This commit is contained in:
Adhemerval Zanella 2017-04-25 18:56:46 -03:00
parent ffd6023885
commit fa66f341a0
6 changed files with 250 additions and 946 deletions

View File

@ -1,5 +1,51 @@
2017-04-26 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* nptl/tst-cancel4-common.c: Use libsupport.
* nptl/tst-cancel4-common.h: Likewise.
* nptl/tst-cancel4.c (tf_read): Likewise.
(tf_readv): Likewise.
(tf_write): Likewise.
(tf_writev): Likewise.
(tf_sleep): Likewise.
(tf_usleep): Likewise.
(tf_nanosleep): Likewise.
(tf_select): Likewise.
(tf_pselect): Likewise.
(tf_poll): Likewise.
(tf_ppoll): Likewise.
(tf_wait): Likewise.
(tf_waitpid): Likewise.
(tf_waitid): Likewise.
(tf_sigpause): Likewise.
(tf_sigsuspend): Likewise.
(tf_sigwait): Likewise.
(tf_sigwaitinfo): Likewise.
(tf_sigtimedwait): Likewise.
(tf_pause): Likewise.
(tf_accept): Likewise.
(tf_send): Likewise.
(tf_recv): Likewise.
(tf_recvfrom): Likewise.
(tf_recvmsg): Likewise.
(tf_open): Likewise.
(tf_close): Likewise.
(tf_pread): Likewise.
(tf_pwrite): Likewise.
(tf_preadv): Likewise.
(tf_pwritev): Likewise.
(tf_fsync): Likewise.
(tf_fdatasync): Likewise.
(tf_msync): Likewise.
(tf_sendto): Likewise.
(tf_sendmsg): Likewise.
(tf_creat): Likewise.
(tf_connect): Likewise.
(tf_tcdrain): Likewise.
(tf_msgrcv): Likewise.
(tf_msgsnd): Likewise.
* nptl/tst-cancel4_1.c (tf_sendmmsg): Likewise.
* nptl/tst-cancel4_2.c (tf_recvmmsg): Likewise.
* misc/tst-preadvwritev-common.c (do_prepare): Use libsupport
expected arguments.
(do_test): Adapt to use libsupport.

View File

@ -259,5 +259,4 @@ do_test (void)
}
#define TIMEOUT 60
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
#include <support/test-driver.c>

View File

@ -19,6 +19,10 @@
#include <pthread.h>
#include <support/check.h>
#include <support/xthread.h>
#include <support/xunistd.h>
/* Pipe descriptors. */
static int fds[2];

File diff suppressed because it is too large Load Diff

View File

@ -44,25 +44,17 @@ tf_sendmmsg (void *arg)
tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
if (tempfd == -1)
{
printf ("%s: first socket call failed\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("socket (AF_UNIX, SOCK_DGRAM, 0): %m");
int tries = 0;
do
{
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
}
FAIL_EXIT1 ("too many unsuccessful bind calls");
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-7-XXXXXX");
if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("cannot generate temp file name");
sun.sun_family = AF_UNIX;
}
@ -73,24 +65,15 @@ tf_sendmmsg (void *arg)
tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0);
if (tempfd2 == -1)
{
printf ("%s: second socket call failed\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("socket (AF_UNIX, SOCK_DGRAM, 0): %m");
int r = pthread_barrier_wait (&b2);
if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("%s: barrier_wait failed\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("pthread_barrier_wait");
r = pthread_barrier_wait (&b2);
if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("pthread_barrier_wait");
pthread_cleanup_push (cl, NULL);
@ -114,9 +97,7 @@ tf_sendmmsg (void *arg)
pthread_cleanup_pop (0);
printf ("%s: sendmmsg returned\n", __FUNCTION__);
exit (1);
FAIL_EXIT1 ("sendmmsg returned");
}
struct cancel_tests tests[] =

View File

@ -39,25 +39,17 @@ tf_recvmmsg (void *arg)
tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
if (tempfd == -1)
{
printf ("%s: first socket call failed\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("socket (AF_UNIX, SOCK_DGRAM, 0): %m");
int tries = 0;
do
{
if (++tries > 10)
{
printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
}
FAIL_EXIT1 ("too many unsuccessful bind calls");
strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-5-XXXXXX");
if (mktemp (sun.sun_path) == NULL)
{
printf ("%s: cannot generate temp file name\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("cannot generate temp file name");
sun.sun_family = AF_UNIX;
}
@ -69,26 +61,17 @@ tf_recvmmsg (void *arg)
tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0);
if (tempfd2 == -1)
{
printf ("%s: second socket call failed\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("socket (AF_UNIX, SOCK_DGRAM, 0): %m");
int r = pthread_barrier_wait (&b2);
if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("%s: barrier_wait failed\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("pthread_barrier_wait");
if (arg != NULL)
{
r = pthread_barrier_wait (&b2);
if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
exit (1);
}
FAIL_EXIT1 ("pthread_barrier_wait");
}
pthread_cleanup_push (cl, NULL);
@ -112,9 +95,7 @@ tf_recvmmsg (void *arg)
pthread_cleanup_pop (0);
printf ("%s: recvmmsg returned\n", __FUNCTION__);
exit (1);
FAIL_EXIT1 ("recvmmsg returned");
}
struct cancel_tests tests[] =