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

java,runfiles: the runfiles library should not pick up TEST_SRCDIR #4598

Closed
laszlocsomor opened this issue Feb 7, 2018 · 2 comments
Closed
Assignees
Labels
P1 I'll work on this now. (Assignee required) type: bug

Comments

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Feb 7, 2018

Description of the problem / feature request:

The new java runfiles library in @bazel_tools//tools/runfiles, coming out with Bazel 0.11.0, should not pick up $TEST_SRCDIR when neither $RUNFILES_MANIFEST_FILE nor $RUNFILES_DIR is defined. In case a test runs Bazel to build and run a mock java_binary that uses the new runfiles library, the binary should not pick up the test's $TEST_SRCDIR but find its own runfiles insated.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. Cherry-pick https://bazel-review.googlesource.com/c/bazel/+/37210 into a Bazel repo:

    git checkout master
    git checkout -b bug-repro
    git fetch https://bazel.googlesource.com/bazel refs/changes/10/37210/1 && git cherry-pick FETCH_HEAD
    
  2. bazel test //src/test/py/bazel:runfiles_test

    This fails.

  3. Now add the bugfix, and run the test again:

    git reset --hard HEAD~1
    git fetch https://bazel.googlesource.com/bazel refs/changes/10/37210/1 && git checkout FETCH_HEAD
    bazel test //src/test/py/bazel:runfiles_test
    

    The test should now pass.

What operating system are you running Bazel on?

Debian testing.

What's the output of bazel info release?

  $ bazel info release
release 0.11.0rc1

Any other information, logs, or outputs that you want to share?

This is blocking #3959.
https://bazel-review.googlesource.com/c/bazel/+/37190 will fix it.

@laszlocsomor laszlocsomor added type: bug P1 I'll work on this now. (Assignee required) Release blocker labels Feb 7, 2018
@laszlocsomor laszlocsomor self-assigned this Feb 7, 2018
@laszlocsomor
Copy link
Contributor Author

Ironically this bug does not affect Bazel on Windows, because the native launcher we use for xx_binary rules sets RUNFILES_MANIFEST_{FILE,PATH} and RUNFILES_DIR.

@laszlocsomor
Copy link
Contributor Author

Fixed by: d855d81

Pending change https://bazel-review.googlesource.com/c/bazel/+/37210 will add a test.

bazel-io pushed a commit that referenced this issue Feb 8, 2018
Update //src/test/py/bazel:runfiles_test to test
that the Java (and Python) runfiles libraries do
NOT pick up TEST_SRCDIR from their environment.

See https://bazel-review.googlesource.com/c/bazel/+/37190
See #4598

Change-Id: I06eb50c8cb4c93a331e51cd38ebdd7c1bcf38bba
PiperOrigin-RevId: 184994372
bazel-io pushed a commit that referenced this issue Feb 8, 2018
The Python runfiles library will no longer pick up
the runfiles directory from $TEST_SRCDIR.

This is in accordance with the Java runfiles
library, see the motivation in
#4598

The commit also adds a test for this functionality
as well as exercising that the runfiles library
can find the runfiles directory even if no
RUNFILES_* envvars are exported.

See #4598
See #4460

Change-Id: I6e4d154cdca66b29d7c6e77743cf8109638238b5
PiperOrigin-RevId: 185009819
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) type: bug
Projects
None yet
Development

No branches or pull requests

1 participant