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 "src/signal/raise.h"
10#include "src/signal/sigfillset.h"
11#include "src/signal/sigprocmask.h"
12
13#include "test/UnitTest/ErrnoSetterMatcher.h"
14#include "test/UnitTest/Test.h"
15
16#include <errno.h>
17#include <signal.h>
18
19TEST(LlvmLibcSigfillset, Invalid) {
20 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
21 EXPECT_THAT(LIBC_NAMESPACE::sigfillset(nullptr), Fails(EINVAL));
22}
23
24TEST(LlvmLibcSigfillset, BlocksAll) {
25 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
26 sigset_t set;
27 EXPECT_THAT(LIBC_NAMESPACE::sigfillset(&set), Succeeds());
28 EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &set, nullptr),
29 Succeeds());
30 EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0);
31}
32

source code of libc/test/src/signal/sigfillset_test.cpp