mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 00:10:27 +00:00
The INCLUDE-FILE option is only used in the toolchain tests for now. If specified in a file test, the given file path is added to the test's arguments. For toolchain tests this makes the file's package available to the test. The `--custom-core` command line flag is added to the driver, which avoids adding the production `Core` package to the command line. Together, these allow a test to provide their own minimal `Core` package. For example, this would replace `Core` with the package and prelude in `facet_types.carbon`. ``` // INCLUDE-FILE: toolchain/testing/min_prelude/facet_types.carbon // EXTRA-ARGS: --custom-core ``` To support this: * //testing knows how to parse INCLUDE-FILE out of the header of a test file. * //testing adds the file to the virtual file system, and includes it in the test's arguments. * //toolchain/driver grows the --custom-core command line flag to avoid loading the production `Core` package. Tests that were creating their own minimal prelude to define BitAnd on types are now pointed to toolchain/testing/min_prelude/facet_types.carbon as the prelude. They no longer need to `import Core` in each test as a result. Such tests are no longer `no_prelude`, but instead have their own prelude. So they are moved to a `min_prelude` subdirectory. Closes #5076
100 lines
2.3 KiB
Python
100 lines
2.3 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
|
|
|
|
load("@rules_cc//cc:defs.bzl", "cc_library")
|
|
load("rules.bzl", "file_test")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
cc_library(
|
|
name = "autoupdate",
|
|
testonly = 1,
|
|
srcs = ["autoupdate.cpp"],
|
|
hdrs = [
|
|
"autoupdate.h",
|
|
"line.h",
|
|
],
|
|
deps = [
|
|
"//common:check",
|
|
"//common:ostream",
|
|
"//common:raw_string_ostream",
|
|
"@abseil-cpp//absl/strings",
|
|
"@abseil-cpp//absl/strings:string_view",
|
|
"@llvm-project//llvm:Support",
|
|
"@re2",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "file_system",
|
|
testonly = 1,
|
|
srcs = [
|
|
"file_system.cpp",
|
|
],
|
|
hdrs = ["file_system.h"],
|
|
deps = [
|
|
"//common:error",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "file_test_base",
|
|
testonly = 1,
|
|
srcs = [
|
|
"file_test_base.cpp",
|
|
"run_test.cpp",
|
|
"run_test.h",
|
|
"test_file.cpp",
|
|
"test_file.h",
|
|
],
|
|
hdrs = ["file_test_base.h"],
|
|
deps = [
|
|
":autoupdate",
|
|
":file_system",
|
|
":manifest",
|
|
"//common:check",
|
|
"//common:error",
|
|
"//common:exe_path",
|
|
"//common:init_llvm",
|
|
"//common:ostream",
|
|
"//common:raw_string_ostream",
|
|
"//testing/base:file_helpers",
|
|
"@abseil-cpp//absl/flags:flag",
|
|
"@abseil-cpp//absl/flags:parse",
|
|
"@abseil-cpp//absl/strings",
|
|
"@googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
file_test(
|
|
name = "file_test_base_test",
|
|
size = "small",
|
|
srcs = ["file_test_base_test.cpp"],
|
|
tests = glob(["testdata/**"]),
|
|
deps = [
|
|
":file_test_base",
|
|
"//common:ostream",
|
|
"@googletest//:gtest",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
# Note this is separate from the implementation; see the .h file.
|
|
cc_library(
|
|
name = "manifest",
|
|
testonly = 1,
|
|
hdrs = ["manifest.h"],
|
|
deps = ["@llvm-project//llvm:Support"],
|
|
)
|
|
|
|
# Used through `file_test` in rules.bzl.
|
|
cc_library(
|
|
name = "manifest_impl",
|
|
testonly = 1,
|
|
srcs = ["manifest.cpp"],
|
|
deps = [":manifest"],
|
|
)
|