-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Description of the problem / feature request:
Suppose there is workspace foo that uses external dependency bar, and bar includes a test that uses runfiles. bar's test runs successfully if executed from within bar's workspace, but fails (since it can't find its runfile) if executed from foo's workspace, as @bar//:bar_test.
Here is a self-contained repro:
https://gist.github.com/mpwarres/b83539d17f92d63d9c25794a84a734ab
It appears that when @bar//:bar_test is run from workspace foo, TEST_WORKSPACE is "foo" (which makes sense, that is the main workspace after all), but cwd is $TEST_SRCDIR/foo when maybe it should be $TEST_SRCDIR/bar, if that is where the test's runfile lives. And if that change is made, then it might make sense to expose the immediate workspace name in some additional env var, so tests that want to compute the location of runfiles on their own can do so (as opposed to having to rely on cwd).
Context: this issue was encountered in Envoy while drafting envoyproxy/envoy#5868. Envoy's CI scripts contained 'blaze test' commands that invoked a combination of tests from multiple workspaces (the main workspace coming from https://github.com/envoyproxy/envoy-filter-example , with https://github.com/envoyproxy/envoy imported as an external dependency). See this comment for a summary.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
https://gist.github.com/mpwarres/b83539d17f92d63d9c25794a84a734ab
What operating system are you running Bazel on?
Linux
What's the output of bazel info release?
release 0.22.0
What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?
git@github.com:mpwarres/envoy.git
346e329d1db25eda09c2dee7af16772e940fae18
346e329d1db25eda09c2dee7af16772e940fae18
Have you found anything relevant by searching the web?
No
Any other information, logs, or outputs that you want to share?
No