3636#include " google/api/expr/v1alpha1/value.pb.h"
3737#include " cel/expr/value.pb.h"
3838#include " google/rpc/code.pb.h"
39+ #include " rules_cc/cc/runfiles/runfiles.h"
3940#include " absl/flags/flag.h"
4041#include " absl/log/absl_check.h"
4142#include " absl/status/status.h"
@@ -68,8 +69,6 @@ ABSL_FLAG(bool, select_optimization, false, "Enable select optimization.");
6869
6970namespace {
7071
71- using ::testing::IsEmpty;
72-
7372using cel::expr::conformance::test::SimpleTest;
7473using cel::expr::conformance::test::SimpleTestFile;
7574using google::api::expr::conformance::v1alpha1::CheckRequest;
@@ -78,6 +77,19 @@ using google::api::expr::conformance::v1alpha1::EvalRequest;
7877using google::api::expr::conformance::v1alpha1::EvalResponse;
7978using google::api::expr::conformance::v1alpha1::ParseRequest;
8079using google::api::expr::conformance::v1alpha1::ParseResponse;
80+ using ::testing::IsEmpty;
81+
82+ std::string ResolveRunfilesPath (absl::string_view path) {
83+ using ::rules_cc::cc::runfiles::Runfiles;
84+ static Runfiles* runfiles = []() {
85+ std::string error;
86+ auto runfiles = absl::WrapUnique (
87+ Runfiles::CreateForTest (BAZEL_CURRENT_REPOSITORY , &error));
88+ ABSL_QCHECK (runfiles != nullptr )
89+ << absl::StrCat (" failed to init runfiles" , error);
90+ }();
91+ return runfiles->Rlocation (path);
92+ }
8193
8294google::rpc::Code ToGrpcCode (absl::StatusCode code) {
8395 return static_cast <google::rpc::Code>(code);
@@ -282,8 +294,9 @@ int main(int argc, char** argv) {
282294 }
283295 }
284296 for (int argi = 1 ; argi < argc; argi++) {
297+ std::string path = ResolveRunfilesPath (argv[argi]);
285298 ABSL_CHECK_OK (RegisterTestsFromFile (service, tests_to_skip,
286- absl::string_view (argv[argi] )));
299+ absl::string_view (path )));
287300 }
288301 }
289302 int exit_code = RUN_ALL_TESTS ();
0 commit comments