mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:10:14 +01:00
The benchmarks themselves aren't really specific to `driver`. Keeping the source generation near to the primary use case of benchmarking also seems like a more discoverable location. I feel a little bad doing this reorganization right after I gave a talk with links to a bunch of this code, but seems good to reorganize a bit before doing some work to extend things now that we have full standard library support for C++ benchmarking and other improvements. Assisted-by: Antigravity with Gemini
116 lines
2.8 KiB
Python
116 lines
2.8 KiB
Python
# 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
|
|
#
|
|
# Trivial, single-file testing libraries. More complex libraries should get
|
|
# their own directory.
|
|
|
|
load("//bazel/cc_rules:defs.bzl", "cc_library", "cc_test")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
# 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 "@googletest//:gtest_main";
|
|
# "@googletest//:gtest" should still be used directly.
|
|
cc_library(
|
|
name = "gtest_main",
|
|
testonly = 1,
|
|
srcs = ["gtest_main.cpp"],
|
|
deps = [
|
|
":global_exe_path",
|
|
"//common:init_llvm",
|
|
"@googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
# This does extra initialization on top of Google benchmark's main in order to
|
|
# provide stack traces and setup LLVM.
|
|
#
|
|
# This replaces `@google_benchmark//:benchmark_main`;
|
|
# `@google_benchmark//:benchmark` should still be used directly.
|
|
cc_library(
|
|
name = "benchmark_main",
|
|
testonly = 1,
|
|
srcs = ["benchmark_main.cpp"],
|
|
deps = [
|
|
":global_exe_path",
|
|
"//common:init_llvm",
|
|
"@abseil-cpp//absl/flags:parse",
|
|
"@google_benchmark//:benchmark",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "capture_std_streams",
|
|
testonly = 1,
|
|
srcs = ["capture_std_streams.cpp"],
|
|
hdrs = ["capture_std_streams.h"],
|
|
deps = [
|
|
"//common:ostream",
|
|
"@googletest//:gtest",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "file_helpers",
|
|
testonly = 1,
|
|
srcs = ["file_helpers.cpp"],
|
|
hdrs = ["file_helpers.h"],
|
|
deps = [
|
|
"//common:error",
|
|
"@googletest//:gtest",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "global_exe_path",
|
|
testonly = 1,
|
|
srcs = ["global_exe_path.cpp"],
|
|
hdrs = ["global_exe_path.h"],
|
|
deps = [
|
|
"//common:check",
|
|
"//common:exe_path",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "global_exe_path_test",
|
|
size = "small",
|
|
srcs = ["global_exe_path_test.cpp"],
|
|
deps = [
|
|
":global_exe_path",
|
|
":gtest_main",
|
|
"@googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "unified_diff_matcher",
|
|
testonly = 1,
|
|
hdrs = ["unified_diff_matcher.h"],
|
|
deps = [
|
|
"//common:check",
|
|
"@googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "unified_diff_matcher_test",
|
|
size = "small",
|
|
srcs = ["unified_diff_matcher_test.cpp"],
|
|
deps = [
|
|
":gtest_main",
|
|
":unified_diff_matcher",
|
|
"@googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|