x86: Add SSE2 optimized chacha20
[glibc.git] / nptl / tst-cond26.c
blob4f46c21e1ef921d4ce46e4d26b3c30fd3811bfb1
1 /* Test unsupported/bad clocks passed to pthread_cond_clockwait.
3 Copyright (C) 2019-2022 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
20 #include <errno.h>
21 #include <pthread.h>
22 #include <stdio.h>
23 #include <time.h>
24 #include <unistd.h>
25 #include <support/check.h>
26 #include <support/timespec.h>
27 #include <support/xthread.h>
29 static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
30 static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
32 #define NOT_A_VALID_CLOCK 123456
34 static int
35 do_test (void)
37 xpthread_mutex_lock (&mut);
39 const struct timespec ts = make_timespec (0, 0);
41 /* These clocks are meaningless to sem_clockwait. */
42 #if defined(CLOCK_PROCESS_CPUTIME_ID)
43 TEST_COMPARE (pthread_cond_clockwait (&cond, &mut,
44 CLOCK_PROCESS_CPUTIME_ID, &ts), EINVAL);
45 #endif
46 #if defined(CLOCK_THREAD_CPUTIME_ID)
47 TEST_COMPARE (pthread_cond_clockwait (&cond, &mut,
48 CLOCK_THREAD_CPUTIME_ID, &ts), EINVAL);
49 #endif
51 /* These clocks might be meaningful, but are currently unsupported
52 by pthread_cond_clockwait. */
53 #if defined(CLOCK_REALTIME_COARSE)
54 TEST_COMPARE (pthread_cond_clockwait (&cond, &mut,
55 CLOCK_REALTIME_COARSE, &ts), EINVAL);
56 #endif
57 #if defined(CLOCK_MONOTONIC_RAW)
58 TEST_COMPARE (pthread_cond_clockwait (&cond, &mut,
59 CLOCK_MONOTONIC_RAW, &ts), EINVAL);
60 #endif
61 #if defined(CLOCK_MONOTONIC_COARSE)
62 TEST_COMPARE (pthread_cond_clockwait (&cond, &mut,
63 CLOCK_MONOTONIC_COARSE, &ts), EINVAL);
64 #endif
65 #if defined(CLOCK_BOOTTIME)
66 TEST_COMPARE (pthread_cond_clockwait (&cond, &mut,
67 CLOCK_BOOTTIME, &ts), EINVAL);
68 #endif
70 /* This is a completely invalid clock. */
71 TEST_COMPARE (pthread_cond_clockwait (&cond, &mut,
72 NOT_A_VALID_CLOCK, &ts), EINVAL);
74 return 0;
77 #include <support/test-driver.c>