15d2baa95SAlex Brachet //===----------------------- Unittests for raise --------------------------===//
25d2baa95SAlex Brachet //
35d2baa95SAlex Brachet // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45d2baa95SAlex Brachet // See https://llvm.org/LICENSE.txt for license information.
55d2baa95SAlex Brachet // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65d2baa95SAlex Brachet //
75d2baa95SAlex Brachet //===----------------------------------------------------------------------===//
85d2baa95SAlex Brachet 
95d2baa95SAlex Brachet #include "include/signal.h"
105d2baa95SAlex Brachet #include "src/signal/raise.h"
11*cd76a026SAlex Brachet 
125d2baa95SAlex Brachet #include "utils/UnitTest/Test.h"
135d2baa95SAlex Brachet 
145d2baa95SAlex Brachet TEST(SignalTest, Raise) {
155d2baa95SAlex Brachet   // SIGCONT is ingored unless stopped, so we can use it to check the return
165d2baa95SAlex Brachet   // value of raise without needing to block.
175d2baa95SAlex Brachet   EXPECT_EQ(__llvm_libc::raise(SIGCONT), 0);
1803689974SAlex Brachet 
1903689974SAlex Brachet   // SIGKILL is chosen because other fatal signals could be caught by sanitizers
2003689974SAlex Brachet   // for example and incorrectly report test failure.
2103689974SAlex Brachet   EXPECT_DEATH([] { __llvm_libc::raise(SIGKILL); }, SIGKILL);
225d2baa95SAlex Brachet }
23