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@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-/* 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@redhat.com>, 2002.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
{
size_t ps = sysconf (_SC_PAGESIZE);
char tmpfname[] = "/tmp/tst-sem3.XXXXXX";
{
size_t ps = sysconf (_SC_PAGESIZE);
char tmpfname[] = "/tmp/tst-sem3.XXXXXX";
if (fd == -1)
{
printf ("cannot open temporary file: %m\n");
if (fd == -1)
{
printf ("cannot open temporary file: %m\n");
}
/* Make sure it is always removed. */
}
/* Make sure it is always removed. */
if (write (fd, data, ps) != (ssize_t) ps)
{
puts ("short write");
if (write (fd, data, ps) != (ssize_t) ps)
{
puts ("short write");
}
mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (mem == MAP_FAILED)
{
printf ("mmap failed: %m\n");
}
mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (mem == MAP_FAILED)
{
printf ("mmap failed: %m\n");
}
s = (sem_t *) (((uintptr_t) mem + __alignof (sem_t))
}
s = (sem_t *) (((uintptr_t) mem + __alignof (sem_t))
if (sem_init (s, 1, 1) == -1)
{
puts ("init failed");
if (sem_init (s, 1, 1) == -1)
{
puts ("init failed");
}
if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
{
puts ("1st wait failed");
}
if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
{
puts ("1st wait failed");
}
errno = 0;
if (TEMP_FAILURE_RETRY (sem_trywait (s)) != -1)
{
puts ("trywait succeeded");
}
errno = 0;
if (TEMP_FAILURE_RETRY (sem_trywait (s)) != -1)
{
puts ("trywait succeeded");
}
else if (errno != EAGAIN)
{
puts ("trywait didn't return EAGAIN");
}
else if (errno != EAGAIN)
{
puts ("trywait didn't return EAGAIN");
if (pid == -1)
{
puts ("fork failed");
if (pid == -1)
{
puts ("fork failed");
if ((*p)++ != 0)
{
puts ("child: *p != 0");
if ((*p)++ != 0)
{
puts ("child: *p != 0");
}
if (sem_post (s) == -1)
{
puts ("child: 1st post failed");
}
if (sem_post (s) == -1)
{
puts ("child: 1st post failed");
if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
{
printf ("parent: 2nd wait failed: %m\n");
if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1)
{
printf ("parent: 2nd wait failed: %m\n");
}
if (*p != 1)
{
puts ("*p != 1");
}
if (*p != 1)
{
puts ("*p != 1");
}
puts ("parent done");
}
}
puts ("parent done");
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
-/* 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@redhat.com>, 2002.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"