1 //===-- Unittests for kill -----------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "src/signal/kill.h"
11 #include "include/sys/syscall.h" // For syscall numbers.
12 #include "src/__support/OSUtil/syscall.h" // For internal syscall function.
13 #include "test/ErrnoSetterMatcher.h"
14 #include "test/UnitTest/Test.h"
19 using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds
;
21 TEST(LlvmLibcKillTest
, TargetSelf
) {
22 pid_t parent_pid
= __llvm_libc::syscall_impl(SYS_getpid
);
23 ASSERT_THAT(__llvm_libc::kill(parent_pid
, 0), Succeeds(0));
27 pid_t child_pid
= __llvm_libc::syscall_impl(SYS_getpid
);
28 __llvm_libc::kill(child_pid
, SIGKILL
);
30 WITH_SIGNAL(SIGKILL
));