mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Make toolchain/testing/file_test more robust (#3235)
Support `toolchain/` being a subdirectory rather than the project root. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
85d5b40429
commit
e72226f31c
@@ -88,7 +88,11 @@ class ToolchainFileTest : public FileTestBase {
|
||||
private:
|
||||
// Returns the toolchain subdirectory being tested.
|
||||
static auto GetComponent(llvm::StringRef test_name) -> llvm::StringRef {
|
||||
CARBON_CHECK(test_name.consume_front("toolchain/"));
|
||||
// This handles cases where the toolchain directory may be copied into a
|
||||
// repository that doesn't put it at the root.
|
||||
auto pos = test_name.find("toolchain/");
|
||||
CARBON_CHECK(pos != llvm::StringRef::npos) << test_name;
|
||||
test_name = test_name.drop_front(pos + strlen("toolchain/"));
|
||||
test_name = test_name.take_front(test_name.find("/"));
|
||||
return test_name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user