Move MSan lit-tests under test/msan
[blocksruntime.git] / test / msan / sigwait.cc
blob29aa86c938f2a3fee3c7e485c7cdbe04a71bc3fe
1 // RUN: %clangxx_msan -std=c++11 -O0 -g %s -o %t && %t
3 #include <assert.h>
4 #include <sanitizer/msan_interface.h>
5 #include <signal.h>
6 #include <sys/time.h>
7 #include <unistd.h>
9 void test_sigwait() {
10 sigset_t s;
11 sigemptyset(&s);
12 sigaddset(&s, SIGUSR1);
13 sigprocmask(SIG_BLOCK, &s, 0);
15 if (pid_t pid = fork()) {
16 kill(pid, SIGUSR1);
17 _exit(0);
18 } else {
19 int sig;
20 int res = sigwait(&s, &sig);
21 assert(!res);
22 // The following checks that sig is initialized.
23 assert(sig == SIGUSR1);
27 int main(void) {
28 test_sigwait();
29 return 0;