aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-10-30 23:51:27 -0200
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-11-07 22:09:42 -0200
commitd5b38790950533e80d1fc7c79cab4eacef626547 (patch)
treedf674f46d580085374d04314641e97d8eb267ce8 /nptl
parent06b9e94f797b910da782b4608545e416ec5af1df (diff)
downloadglibc-d5b38790950533e80d1fc7c79cab4eacef626547.tar
glibc-d5b38790950533e80d1fc7c79cab4eacef626547.tar.gz
glibc-d5b38790950533e80d1fc7c79cab4eacef626547.tar.bz2
glibc-d5b38790950533e80d1fc7c79cab4eacef626547.zip
Use write_message instead of write
In the test cases, there are writes to stdout which do not check the result value. This patch replaces such occurrences with calls to write_message, which properly deals with the unused result. Tested for powerpc64le.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/tst-kill3.c13
-rw-r--r--nptl/tst-kill6.c15
-rw-r--r--nptl/tst-tls2.c15
-rw-r--r--nptl/tst-tls3.c13
4 files changed, 30 insertions, 26 deletions
diff --git a/nptl/tst-kill3.c b/nptl/tst-kill3.c
index 308cc5a24d..86f3c6c6a2 100644
--- a/nptl/tst-kill3.c
+++ b/nptl/tst-kill3.c
@@ -25,6 +25,12 @@
#include <sys/time.h>
+static int do_test (void);
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
static pthread_cond_t c = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
static pthread_barrier_t b;
@@ -33,7 +39,7 @@ static pthread_barrier_t b;
static void
handler (int sig)
{
- write (1, "handler called\n", 15);
+ write_message ("handler called\n");
_exit (1);
}
@@ -151,8 +157,3 @@ do_test (void)
return 0;
}
-
-
-#define TIMEOUT 5
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/nptl/tst-kill6.c b/nptl/tst-kill6.c
index 80a0771808..2a9add27ad 100644
--- a/nptl/tst-kill6.c
+++ b/nptl/tst-kill6.c
@@ -25,6 +25,11 @@
#include <unistd.h>
+static int do_test (void);
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
static pthread_t receiver;
static sem_t sem;
static pthread_barrier_t b;
@@ -34,19 +39,19 @@ handler (int sig)
{
if (sig != SIGUSR1)
{
- write (STDOUT_FILENO, "wrong signal\n", 13);
+ write_message ("wrong signal\n");
_exit (1);
}
if (pthread_self () != receiver)
{
- write (STDOUT_FILENO, "not the intended receiver\n", 26);
+ write_message ("not the intended receiver\n");
_exit (1);
}
if (sem_post (&sem) != 0)
{
- write (STDOUT_FILENO, "sem_post failed\n", 16);
+ write_message ("sem_post failed\n");
_exit (1);
}
}
@@ -155,7 +160,3 @@ do_test (void)
return 0;
}
-
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/nptl/tst-tls2.c b/nptl/tst-tls2.c
index eb6d8a336b..054ab80172 100644
--- a/nptl/tst-tls2.c
+++ b/nptl/tst-tls2.c
@@ -29,13 +29,18 @@
static pthread_t th[N];
+static int do_test (void);
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
#define CB(n) \
static void \
cb##n (void) \
{ \
if (th[n] != pthread_self ()) \
{ \
- write (STDOUT_FILENO, "wrong callback\n", 15); \
+ write_message ("wrong callback\n"); \
_exit (1); \
} \
}
@@ -67,7 +72,7 @@ handler (int sig)
{
if (sig != THE_SIG)
{
- write (STDOUT_FILENO, "wrong signal\n", 13);
+ write_message ("wrong signal\n");
_exit (1);
}
@@ -75,7 +80,7 @@ handler (int sig)
if (sem_post (&s) != 0)
{
- write (STDOUT_FILENO, "sem_post failed\n", 16);
+ write_message ("sem_post failed\n");
_exit (1);
}
}
@@ -199,7 +204,3 @@ do_test (void)
return 0;
}
-
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/nptl/tst-tls3.c b/nptl/tst-tls3.c
index 649cb8f0d5..4b96974398 100644
--- a/nptl/tst-tls3.c
+++ b/nptl/tst-tls3.c
@@ -39,13 +39,19 @@ static long stack_size_in_mb;
static pthread_t th[N];
+static int do_test (void);
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
#define CB(n) \
static void \
cb##n (void) \
{ \
if (th[n] != pthread_self ()) \
{ \
- write (STDOUT_FILENO, "wrong callback\n", 15); \
+ write_message ("wrong callback\n"); \
_exit (1); \
} \
}
@@ -207,8 +213,3 @@ do_test (void)
return 0;
}
-
-
-#define TIMEOUT 5
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"