Skip to content

Commit

Permalink
Use BAZEL_CURRENT_REPOSITORY to pick up test data files
Browse files Browse the repository at this point in the history
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 <[email protected]>
Auto-Submit: David Benjamin <[email protected]>
Reviewed-by: Bob Beck <[email protected]>
  • Loading branch information
davidben authored and Boringssl LUCI CQ committed Dec 9, 2024
1 parent 9559c45 commit bb13a96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/test/test_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(Runfiles::CreateForTest(&error));
std::unique_ptr<Runfiles> runfiles(
Runfiles::CreateForTest(BAZEL_CURRENT_REPOSITORY, &error));
if (runfiles == nullptr) {
fprintf(stderr, "Could not initialize runfiles: %s\n", error.c_str());
abort();
Expand Down

0 comments on commit bb13a96

Please sign in to comment.