From bb13a96931dd90d6570fa6151e19ef426d5c641f Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Mon, 9 Dec 2024 11:53:42 -0500 Subject: [PATCH] Use BAZEL_CURRENT_REPOSITORY to pick up test data files The old version of Bazel's runfiles.h header was incompatible with bzlmod. Modules consuming BoringSSL could not successfully run tests. There's now an extra parameter and a BAZEL_CURRENT_REPOSITORY macro injected into the build, which resolves this. With this, running tests from a downstream module now works: cd util/bazel-example bazelisk test @boringssl//:crypto_test Change-Id: I43061cd4bc94cf69ed5b0d0f63715542f2a95d0e Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/74067 Commit-Queue: Bob Beck Auto-Submit: David Benjamin Reviewed-by: Bob Beck --- crypto/test/test_data.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/test/test_data.cc b/crypto/test/test_data.cc index f0e69227b4..fd77b5fd3d 100644 --- a/crypto/test/test_data.cc +++ b/crypto/test/test_data.cc @@ -29,7 +29,8 @@ using bazel::tools::cpp::runfiles::Runfiles; std::string GetTestData(const char *path) { #if defined(BORINGSSL_USE_BAZEL_RUNFILES) std::string error; - std::unique_ptr runfiles(Runfiles::CreateForTest(&error)); + std::unique_ptr runfiles( + Runfiles::CreateForTest(BAZEL_CURRENT_REPOSITORY, &error)); if (runfiles == nullptr) { fprintf(stderr, "Could not initialize runfiles: %s\n", error.c_str()); abort();