• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- Unittests for sigfillset ------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "include/errno.h"
10 #include "include/signal.h"
11 #include "src/signal/raise.h"
12 #include "src/signal/sigfillset.h"
13 #include "src/signal/sigprocmask.h"
14 
15 #include "test/ErrnoSetterMatcher.h"
16 #include "utils/UnitTest/Test.h"
17 
TEST(Sigfillset,Invalid)18 TEST(Sigfillset, Invalid) {
19   using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
20   EXPECT_THAT(__llvm_libc::sigfillset(nullptr), Fails(EINVAL));
21 }
22 
TEST(Sigfillset,BlocksAll)23 TEST(Sigfillset, BlocksAll) {
24   using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
25   sigset_t set;
26   EXPECT_THAT(__llvm_libc::sigfillset(&set), Succeeds());
27   EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, &set, nullptr), Succeeds());
28   EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0);
29 }
30