Skip to content

Commit

Permalink
Pass the manifest path by flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmeow committed Oct 23, 2024
1 parent e68e54d commit 72c37ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion toolchain/diagnostics/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ cc_test(
name = "emitted_diagnostics_test",
size = "small",
srcs = ["emitted_diagnostics_test.cpp"],
args = ["--testdata_manifest=$(location :all_testdata.txt)"],
data = [
"all_testdata.txt",
":all_testdata.txt",
"//toolchain/testing:all_testdata",
],
deps = [
":diagnostic_kind",
"//common:set",
"//testing/base:gtest_main",
"@abseil-cpp//absl/flags:flag",
"@googletest//:gtest",
"@llvm-project//llvm:Support",
"@re2",
Expand Down
6 changes: 5 additions & 1 deletion toolchain/diagnostics/emitted_diagnostics_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
#include <fstream>
#include <string>

#include "absl/flags/flag.h"
#include "common/set.h"
#include "llvm/ADT/StringExtras.h"
#include "re2/re2.h"
#include "toolchain/diagnostics/diagnostic_kind.h"

ABSL_FLAG(std::string, testdata_manifest, "",
"A path to a file containing repo-relative names of test files.");

namespace Carbon {
namespace {

Expand Down Expand Up @@ -70,7 +74,7 @@ static auto IsUntestedDiagnostic(DiagnosticKind diagnostic_kind) -> bool {
}

TEST(EmittedDiagnostics, Verify) {
std::ifstream manifest_in("toolchain/diagnostics/all_testdata.txt");
std::ifstream manifest_in(absl::GetFlag(FLAGS_testdata_manifest));
ASSERT_TRUE(manifest_in.good());

RE2 diagnostic_re(R"(\w\((\w+)\): )");
Expand Down

0 comments on commit 72c37ff

Please sign in to comment.