Files
carbon-lang/explorer/BUILD
T
Jon Ross-Perkins 536bfd9cbf Switch test manifests to embedded C++ (#5036)
Inconsistent execution environments make using a path-as-define
difficult, so switch to an embedded file.

Also fixes the lldb launch so that passing tests run cleanly, and adds
TEST_TARGET to gdb (but without testing there). I'm dropping `sourceMap`
because it's not handled quite correctly (also not great to be trying to
pass source mappings in two different ways), and `env` didn't seem to be
working as intended either; maybe specifying `initCommands` causes other
things to not be evaluated. But the straight `initCommands` looks like
it's working. I used lldb to validate execution of these changes.

```
Running initCommands:
(lldb) command script import external/+llvm_project+llvm-project/llvm/utils/lldbDataFormatters.py
(lldb) settings set target.source-map "." "/usr/local/google/home/jperkins/dev/carbon-lang"
(lldb) settings set target.source-map "/proc/self/cwd" "/usr/local/google/home/jperkins/dev/carbon-lang"
(lldb) env TEST_TARGET=//toolchain/testing:file_test
(lldb) env TEST_TMPDIR=/tmp
Running tests with 128 thread(s)
.
Done!
Note: Google Test filter = ToolchainFileTest.toolchain/check/testdata/const/collapse.carbon
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from ToolchainFileTest
[ RUN      ] ToolchainFileTest.toolchain/check/testdata/const/collapse.carbon
[       OK ] ToolchainFileTest.toolchain/check/testdata/const/collapse.carbon (0 ms)
[----------] 1 test from ToolchainFileTest (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[  PASSED  ] 1 test.
Process 3869310 exited with status = 0 (0x00000000) 
```
2025-02-27 23:31:13 +00:00

110 lines
2.9 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_binary", "cc_library")
load("//bazel/cc_toolchains:defs.bzl", "cc_env")
load("//testing/file_test:rules.bzl", "file_test")
package(default_visibility = [
"//bazel/check_deps:__pkg__",
"//explorer:__subpackages__",
"//installers:__subpackages__",
])
filegroup(
name = "standard_libraries",
srcs = ["data/prelude.carbon"],
)
cc_library(
name = "main",
srcs = ["main.cpp"],
hdrs = ["main.h"],
# Running clang-tidy is slow, and explorer is currently feature frozen, so
# don't spend time linting it.
tags = ["no-clang-tidy"],
deps = [
"//common:error",
"//common:ostream",
"//explorer/base:trace_stream",
"//explorer/parse_and_execute",
"@llvm-project//llvm:Support",
],
)
cc_binary(
name = "explorer",
srcs = ["main_bin.cpp"],
env = cc_env(),
# Running clang-tidy is slow, and explorer is currently feature frozen, so
# don't spend time linting it.
tags = ["no-clang-tidy"],
deps = [
":main",
"//common:bazel_working_dir",
"@llvm-project//llvm:Support",
],
)
cc_binary(
name = "file_test",
testonly = 1,
srcs = ["file_test.cpp"],
# Running clang-tidy is slow, and explorer is currently feature frozen, so
# don't spend time linting it.
tags = ["no-clang-tidy"],
deps = [
":main",
"//common:check",
"//common:raw_string_ostream",
"//testing/base:file_helpers",
"//testing/file_test:file_test_base",
"//testing/file_test:manifest",
"@abseil-cpp//absl/flags:flag",
"@abseil-cpp//absl/strings",
"@re2",
],
)
file_test(
name = "file_test.notrace",
size = "small",
prebuilt_binary = ":file_test",
shard_count = 20,
tests = glob(["testdata/**/*.carbon"]),
)
file_test(
name = "file_test.trace",
size = "small",
args = ["--trace"],
prebuilt_binary = ":file_test",
shard_count = 30,
tests = glob(
["testdata/**/*.carbon"],
exclude = [
# `limits` tests check for various limit conditions (such as an
# infinite loop). The tests collectively don't test tracing
# because it creates substantial additional overhead.
"testdata/limits/**",
# `trace` tests do tracing by default.
"testdata/trace/**",
# Expensive tests to trace.
"testdata/assoc_const/rewrite_large_type.carbon",
"testdata/linked_list/typed_linked_list.carbon",
],
),
)
filegroup(
name = "tree_sitter_testdata",
srcs = glob(
["testdata/**/*.carbon"],
exclude = [
"testdata/**/fail_*",
],
),
visibility = ["//utils/tree_sitter:__pkg__"],
)