Skip to content

Commit 35d0759

Browse files
add death test
1 parent 7c26cda commit 35d0759

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

libc/test/src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ if(NOT LLVM_LIBC_FULL_BUILD)
6060
return()
6161
endif()
6262

63-
add_subdirectory(dirent)
6463
add_subdirectory(assert)
64+
add_subdirectory(compiler)
65+
add_subdirectory(dirent)
6566
add_subdirectory(network)
6667
add_subdirectory(setjmp)
6768
add_subdirectory(signal)

libc/test/src/compiler/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
add_custom_target(libc_stack_chk_guard_unittests)
2+
3+
add_libc_unittest(
4+
stack_chk_guard_test
5+
SUITE
6+
libc_stack_chk_guard_unittests
7+
SRCS
8+
stack_chk_guard_test.cpp
9+
DEPENDS
10+
libc.src.compiler.__stack_chk_fail
11+
)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//===-- Unittests for assert ----------------------------------------------===//
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 "llvm-libc-macros/signal-macros.h"
10+
#include "src/compiler/__stack_chk_fail.h"
11+
#include "test/UnitTest/Test.h"
12+
13+
TEST(LlvmLibcStackChkFail, Death) {
14+
EXPECT_DEATH([] { LIBC_NAMESPACE::__stack_chk_fail(); },
15+
WITH_SIGNAL(SIGABRT));
16+
}

0 commit comments

Comments
 (0)