Changes tests to init LLVM stack tracing (#1215)

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
This commit is contained in:
Jon Meow
2022-04-26 16:19:51 -07:00
committed by GitHub
co-authored by Chandler Carruth
parent 6013424b87
commit d3700d5cd0
12 changed files with 59 additions and 26 deletions
+20 -4
View File
@@ -18,7 +18,7 @@ cc_test(
srcs = ["check_test.cpp"],
deps = [
":check",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
],
)
@@ -37,7 +37,23 @@ cc_test(
srcs = ["error_test.cpp"],
deps = [
":error",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
],
)
# This does extra initialization on top of googletest's gtest_main in order to
# provide stack traces on unexpected exits, because we normally rely on LLVM
# code for that.
#
# This replaces "@com_google_googletest//:gtest_main";
# "@com_google_googletest//:gtest" should still be used directly.
cc_library(
name = "gtest_main",
testonly = 1,
srcs = ["gtest_main.cpp"],
deps = [
"@com_google_googletest//:gtest",
"@llvm-project//llvm:Support",
],
)
@@ -51,7 +67,7 @@ cc_test(
srcs = ["indirect_value_test.cpp"],
deps = [
":indirect_value",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
],
)
@@ -85,7 +101,7 @@ cc_test(
srcs = ["string_helpers_test.cpp"],
deps = [
":string_helpers",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//llvm:Support",
],
)
+17
View File
@@ -0,0 +1,17 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <gtest/gtest.h>
#include "llvm/Support/InitLLVM.h"
auto main(int argc, char** argv) -> int {
testing::InitGoogleTest(&argc, argv);
llvm::setBugReportMsg(
"Please report issues to "
"https://github.com/carbon-language/carbon-lang/issues and include the "
"crash backtrace.\n");
llvm::InitLLVM init_llvm(argc, argv);
return RUN_ALL_TESTS();
}
+3 -3
View File
@@ -64,8 +64,8 @@ cc_test(
":expression",
":pattern",
":statement",
"//common:gtest_main",
"//executable_semantics/common:arena",
"@com_google_googletest//:gtest_main",
],
)
@@ -144,8 +144,8 @@ cc_test(
deps = [
":expression",
":paren_contents",
"//common:gtest_main",
"//executable_semantics/common:arena",
"@com_google_googletest//:gtest_main",
"@llvm-project//llvm:Support",
],
)
@@ -188,8 +188,8 @@ cc_test(
":expression",
":paren_contents",
":pattern",
"//common:gtest_main",
"//executable_semantics/common:arena",
"@com_google_googletest//:gtest_main",
"@llvm-project//llvm:Support",
],
)
+1 -1
View File
@@ -27,7 +27,7 @@ cc_test(
deps = [
":error_builders",
":source_location",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
],
)
+2 -2
View File
@@ -20,8 +20,8 @@ cc_test(
srcs = ["parse_test.cpp"],
deps = [
":syntax",
"//common:gtest_main",
"//executable_semantics/common:arena",
"@com_google_googletest//:gtest_main",
],
)
@@ -150,7 +150,7 @@ cc_test(
deps = [
":parse_test_matchers",
":syntax",
"//common:gtest_main",
"//executable_semantics/ast:ast_test_matchers",
"@com_google_googletest//:gtest_main",
],
)
+3 -3
View File
@@ -62,7 +62,7 @@ cc_test(
deps = [
":fn_inserter",
":matcher_test_base",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//clang:tooling",
],
)
@@ -83,7 +83,7 @@ cc_test(
deps = [
":for_range",
":matcher_test_base",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//clang:tooling",
],
)
@@ -105,7 +105,7 @@ cc_test(
deps = [
":matcher_test_base",
":var_decl",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//clang:tooling",
],
)
+3 -3
View File
@@ -20,7 +20,7 @@ cc_test(
deps = [
":diagnostic_emitter",
":mocks",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//llvm:Support",
],
)
@@ -44,7 +44,7 @@ cc_test(
srcs = ["diagnostic_kind_test.cpp"],
deps = [
":diagnostic_kind",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//llvm:Support",
],
)
@@ -76,7 +76,7 @@ cc_test(
":diagnostic_emitter",
":mocks",
":sorting_diagnostic_consumer",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//llvm:Support",
],
)
+1 -1
View File
@@ -27,10 +27,10 @@ cc_test(
srcs = ["driver_test.cpp"],
deps = [
":driver",
"//common:gtest_main",
"//toolchain/common:yaml_test_helpers",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/lexer:tokenized_buffer_test_helpers",
"@com_google_googletest//:gtest_main",
"@llvm-project//llvm:Support",
],
)
+4 -4
View File
@@ -24,7 +24,7 @@ cc_test(
srcs = ["token_kind_test.cpp"],
deps = [
":token_kind",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//llvm:Support",
],
)
@@ -91,9 +91,9 @@ cc_test(
":numeric_literal",
":test_helpers",
"//common:check",
"//common:gtest_main",
"//common:ostream",
"//toolchain/diagnostics:diagnostic_emitter",
"@com_google_googletest//:gtest_main",
"@llvm-project//llvm:Support",
],
)
@@ -142,9 +142,9 @@ cc_test(
":string_literal",
":test_helpers",
"//common:check",
"//common:gtest_main",
"//common:ostream",
"//toolchain/diagnostics:diagnostic_emitter",
"@com_google_googletest//:gtest_main",
"@llvm-project//llvm:Support",
],
)
@@ -201,10 +201,10 @@ cc_test(
deps = [
":tokenized_buffer",
":tokenized_buffer_test_helpers",
"//common:gtest_main",
"//toolchain/common:yaml_test_helpers",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:mocks",
"@com_google_googletest//:gtest_main",
"@llvm-project//llvm:Support",
],
)
+3 -3
View File
@@ -20,7 +20,7 @@ cc_test(
srcs = ["parse_node_kind_test.cpp"],
deps = [
":parse_node_kind",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//llvm:Support",
],
)
@@ -67,12 +67,12 @@ cc_test(
":parse_node_kind",
":parse_test_helpers",
":parse_tree",
"//common:gtest_main",
"//common:ostream",
"//toolchain/common:yaml_test_helpers",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:mocks",
"//toolchain/lexer:tokenized_buffer",
"@com_google_googletest//:gtest_main",
"@llvm-project//llvm:Support",
],
)
@@ -109,7 +109,7 @@ cc_test(
srcs = ["precedence_test.cpp"],
deps = [
":precedence",
"//common:gtest_main",
"//toolchain/lexer:token_kind",
"@com_google_googletest//:gtest_main",
],
)
+1 -1
View File
@@ -43,11 +43,11 @@ cc_test(
srcs = ["semantics_ir_factory_test.cpp"],
deps = [
":semantics_ir_factory",
"//common:gtest_main",
"//toolchain/diagnostics:mocks",
"//toolchain/lexer:tokenized_buffer",
"//toolchain/parser:parse_tree",
"//toolchain/source:source_buffer",
"@com_google_googletest//:gtest_main",
"@llvm-project//llvm:Support",
],
)
+1 -1
View File
@@ -20,7 +20,7 @@ cc_test(
srcs = ["source_buffer_test.cpp"],
deps = [
":source_buffer",
"@com_google_googletest//:gtest_main",
"//common:gtest_main",
"@llvm-project//llvm:Support",
],
)