[git commit] test: sync with glibc, use do_test
Bernhard Reutner-Fischer
rep.dot.nop at gmail.com
Thu Aug 28 11:15:55 UTC 2014
commit: http://git.uclibc.org/uClibc/commit/?id=512fd3804b963a6738ce59d25dd44a7d9143b8b7
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master
This breaks out of a deadlock, which occurs when testing for powerpc. (qemu)
Otherwise the test suite does not finish.
Signed-off-by: Waldemar Brodkorb <wbx at openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
test/nptl/tst-sem3.c | 33 ++++++++++++++++++---------------
test/nptl/tst-sem4.c | 7 +++++--
2 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/test/nptl/tst-sem3.c b/test/nptl/tst-sem3.c
index d14f6f6..7b75e29 100644
--- a/test/nptl/tst-sem3.c
+++ b/test/nptl/tst-sem3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
@@ -28,7 +28,7 @@
int
-main (void)
+do_test (void)
{
size_t ps = sysconf (_SC_PAGESIZE);
char tmpfname[] = "/tmp/tst-sem3.XXXXXX";
@@ -43,7 +43,7 @@ main (void)
if (fd == -1)
{
printf ("cannot open temporary file: %m\n");
- exit (1);
+ return 1;
}
/* Make sure it is always removed. */
@@ -56,14 +56,14 @@ main (void)
if (write (fd, data, ps) != (ssize_t) ps)
{
puts ("short write");
- exit (1);
+ return 1;
}
mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (mem == MAP_FAILED)
{
printf ("mmap failed: %m\n");
- exit (1);
+ return 1;
}
s = (sem_t *) (((uintptr_t) mem + __alignof (sem_t))
@@ -73,25 +73,25 @@ main (void)
if (sem_init (s, 1, 1) == -1)
{
puts ("init failed");
- exit (1);
+ return 1;
}
if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
{
puts ("1st wait failed");
- exit (1);
+ return 1;
}
errno = 0;
if (TEMP_FAILURE_RETRY (sem_trywait (s)) != -1)
{
puts ("trywait succeeded");
- exit (1);
+ return 1;
}
else if (errno != EAGAIN)
{
puts ("trywait didn't return EAGAIN");
- exit (1);
+ return 1;
}
*p = 0;
@@ -101,7 +101,7 @@ main (void)
if (pid == -1)
{
puts ("fork failed");
- exit (1);
+ return 1;
}
else if (pid == 0)
{
@@ -109,13 +109,13 @@ main (void)
if ((*p)++ != 0)
{
puts ("child: *p != 0");
- exit (1);
+ return 1;
}
if (sem_post (s) == -1)
{
puts ("child: 1st post failed");
- exit (1);
+ return 1;
}
puts ("child done");
@@ -125,17 +125,20 @@ main (void)
if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
{
printf ("parent: 2nd wait failed: %m\n");
- exit (1);
+ return 1;
}
if (*p != 1)
{
puts ("*p != 1");
- exit (1);
+ return 1;
}
puts ("parent done");
}
- exit (0);
+ return 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/nptl/tst-sem4.c b/test/nptl/tst-sem4.c
index 125759b..72ed97d 100644
--- a/test/nptl/tst-sem4.c
+++ b/test/nptl/tst-sem4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
@@ -32,7 +32,7 @@ remove_sem (int status, void *arg)
int
-main (void)
+do_test (void)
{
sem_t *s;
sem_t *s2;
@@ -144,3 +144,6 @@ main (void)
return 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
More information about the uClibc-cvs
mailing list