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 "src/__support/OSUtil/syscall.h" // For internal syscall function.
12 #include "test/UnitTest/ErrnoSetterMatcher.h"
13 #include "test/UnitTest/Test.h"
16 #include <sys/syscall.h> // For syscall numbers.
18 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds
;
20 TEST(LlvmLibcKillTest
, TargetSelf
) {
21 pid_t parent_pid
= LIBC_NAMESPACE::syscall_impl
<pid_t
>(SYS_getpid
);
22 ASSERT_THAT(LIBC_NAMESPACE::kill(parent_pid
, 0), Succeeds(0));
26 pid_t child_pid
= LIBC_NAMESPACE::syscall_impl
<pid_t
>(SYS_getpid
);
27 LIBC_NAMESPACE::kill(child_pid
, SIGKILL
);
29 WITH_SIGNAL(SIGKILL
));