Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the manifest path by flag. #4439

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading