mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:30:12 +01:00
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) ```
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/flags/parse.h"
|
||||
#include "absl/strings/str_join.h"
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "common/check.h"
|
||||
#include "common/error.h"
|
||||
#include "common/exe_path.h"
|
||||
@@ -42,7 +41,6 @@
|
||||
#include "llvm/Support/PrettyStackTrace.h"
|
||||
#include "llvm/Support/Process.h"
|
||||
#include "llvm/Support/ThreadPool.h"
|
||||
#include "testing/base/file_helpers.h"
|
||||
#include "testing/file_test/autoupdate.h"
|
||||
#include "testing/file_test/run_test.h"
|
||||
#include "testing/file_test/test_file.h"
|
||||
@@ -298,14 +296,9 @@ static auto RegisterTests(FileTestFactory* test_factory,
|
||||
llvm::StringRef exe_path,
|
||||
llvm::SmallVectorImpl<FileTestInfo>& tests)
|
||||
-> ErrorOr<Success> {
|
||||
GetFileTestManifestPath();
|
||||
CARBON_ASSIGN_OR_RETURN(auto test_manifest,
|
||||
ReadFile(GetFileTestManifestPath()));
|
||||
|
||||
// Prepare the vector first, so that the location of entries won't change.
|
||||
for (const auto& test_name :
|
||||
absl::StrSplit(test_manifest, "\n", absl::SkipEmpty())) {
|
||||
tests.push_back({.test_name = std::string(test_name)});
|
||||
for (auto& test_name : GetFileTestManifest()) {
|
||||
tests.push_back({.test_name = test_name});
|
||||
}
|
||||
|
||||
// Amend entries with factory functions.
|
||||
|
||||
Reference in New Issue
Block a user