1//===-- Unittests for raise -----------------------------------------------===//
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
11#include "test/UnitTest/Test.h"
12
13#include <signal.h>
14
15TEST(LlvmLibcSignalTest, Raise) {
16 // SIGCONT is ingored unless stopped, so we can use it to check the return
17 // value of raise without needing to block.
18 EXPECT_EQ(LIBC_NAMESPACE::raise(SIGCONT), 0);
19
20 // SIGKILL is chosen because other fatal signals could be caught by sanitizers
21 // for example and incorrectly report test failure.
22 EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGKILL); }, WITH_SIGNAL(SIGKILL));
23}
24

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