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 <signal.h>
17
18TEST(LlvmLibcSigfillset, Invalid) {
19 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
20 EXPECT_THAT(LIBC_NAMESPACE::sigfillset(nullptr), Fails(EINVAL));
21}
22
23TEST(LlvmLibcSigfillset, BlocksAll) {
24 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
25 sigset_t set;
26 EXPECT_THAT(LIBC_NAMESPACE::sigfillset(&set), Succeeds());
27 EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &set, nullptr),
28 Succeeds());
29 EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0);
30}
31

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

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