
@nico mentioned that FormatTests and BasicTests are small binaries with few dependencies, so keeping them separate is nice. I broke them out as distinct test binaries, and they are still pretty small: $ find tools/clang/unittests/ -type f -name '*Tests' | xargs du -cksh | sort -nr 708M total 276M tools/clang/unittests/AllClangUnitTests 244M tools/clang/unittests/Interpreter/ClangReplInterpreterTests 167M tools/clang/unittests/Interpreter/ExceptionTests/ClangReplInterpreterExceptionTests 13M tools/clang/unittests/Format/FormatTests 6.9M tools/clang/unittests/Basic/BasicTests 1.1M tools/clang/unittests/libclang/CrashTests/libclangCrashTests I also broke out libclangCrashTests and re-enabled the failing test to resolve llvm#137855.
38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
//===- unittests/libclang/LibclangCrashTest.cpp --- libclang tests --------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "../TestUtils.h"
|
|
#include "clang-c/FatalErrorHandler.h"
|
|
#include "gtest/gtest.h"
|
|
#include <string>
|
|
|
|
TEST_F(LibclangParseTest, InstallAbortingLLVMFatalErrorHandler) {
|
|
clang_toggleCrashRecovery(0);
|
|
clang_install_aborting_llvm_fatal_error_handler();
|
|
|
|
std::string Main = "main.h";
|
|
WriteFile(Main, "#pragma clang __debug llvm_fatal_error");
|
|
|
|
EXPECT_DEATH(clang_parseTranslationUnit(Index, Main.c_str(), nullptr, 0,
|
|
nullptr, 0, TUFlags),
|
|
"");
|
|
}
|
|
|
|
TEST_F(LibclangParseTest, UninstallAbortingLLVMFatalErrorHandler) {
|
|
clang_toggleCrashRecovery(0);
|
|
clang_install_aborting_llvm_fatal_error_handler();
|
|
clang_uninstall_llvm_fatal_error_handler();
|
|
|
|
std::string Main = "main.h";
|
|
WriteFile(Main, "#pragma clang __debug llvm_fatal_error");
|
|
|
|
EXPECT_DEATH(clang_parseTranslationUnit(Index, Main.c_str(), nullptr, 0,
|
|
nullptr, 0, TUFlags),
|
|
"ERROR");
|
|
}
|