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