Make test more lenient for custom clang version strings
[llvm-project.git] / libc / test / src / signal / sigfillset_test.cpp
blob0604bc2a95bf6ff7789c5c961a136fc105ef17fa
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 //===----------------------------------------------------------------------===//
9 #include "src/signal/raise.h"
10 #include "src/signal/sigfillset.h"
11 #include "src/signal/sigprocmask.h"
13 #include "test/UnitTest/ErrnoSetterMatcher.h"
14 #include "test/UnitTest/Test.h"
16 #include <signal.h>
18 TEST(LlvmLibcSigfillset, Invalid) {
19 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
20 EXPECT_THAT(LIBC_NAMESPACE::sigfillset(nullptr), Fails(EINVAL));
23 TEST(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);