[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / libc / test / src / signal / kill_test.cpp
blob7464f2c716dc210cd032279982ab6f1b8f241c72
1 //===-- Unittests for kill -----------------------------------------------===//
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 //===----------------------------------------------------------------------===//
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"
16 #include <errno.h>
17 #include <signal.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));
25 EXPECT_DEATH(
26 [] {
27 pid_t child_pid = __llvm_libc::syscall_impl(SYS_getpid);
28 __llvm_libc::kill(child_pid, SIGKILL);
30 WITH_SIGNAL(SIGKILL));