1 /* Copyright (C) 2003-2013 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
28 static pthread_barrier_t b
;
30 e = pthread_barrier_wait (&b); \
31 if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) \
33 puts ("barrier_wait failed"); \
45 char *p2
= getcwd (NULL
, 0);
48 puts ("2nd getcwd failed");
52 if (strcmp (p
, p2
) != 0)
54 printf ("initial cwd mismatch: \"%s\" vs \"%s\"\n", p
, p2
);
61 if (chdir ("..") != 0)
63 puts ("chdir failed");
70 puts ("getcwd failed");
81 if (pthread_barrier_init (&b
, NULL
, 2) != 0)
83 puts ("barrier_init failed");
88 if (pthread_create (&th
, NULL
, tf
, NULL
) != 0)
90 puts ("create failed");
97 puts ("getcwd failed");
104 if (pthread_join (th
, NULL
) != 0)
106 puts ("join failed");
110 char *p2
= getcwd (NULL
, 0);
113 puts ("2nd getcwd failed");
117 if (strcmp (p
, p2
) != 0)
119 printf ("cwd after chdir mismatch: \"%s\" vs \"%s\"\n", p
, p2
);
130 #define TEST_FUNCTION do_test ()
131 #include "../test-skeleton.c"