aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/test
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2017-03-06 09:38:43 +0000
committerGravatar Yue Gan <yueg@google.com>2017-03-06 09:48:17 +0000
commit5c2f39bce83dbdaf5ae9bf938809ad6c08d4a1ec (patch)
tree4e758f91f420d1dfcd6fbe470766328be2bf7501 /src/main/java/com/google/devtools/build/lib/rules/test
parentc3c25dc3754193b413a6dc11032f1fdb86e0500e (diff)
Rewrite TestStrategy.getArgs
This changes command-line computation for tests: - run the coverage collector before the run_under command - no shell escaping: if all tools just call "$@", then this should work Note that we still wrap the command in a sub-shell to support shell built-ins and PATH lookup if the command does not contain a slash character '/'. A side effect of this change is that the --run_under command now executes in the test's runfiles directory, rather than in the exec root, if coverage is enabled at the same time. Inside Google, it's very rare for --run_under to be used in combination with coverage, and it seems likely to be rare externally as well, so I don't think it warrants covering it in the release notes. Also set TEST_BINARY to the root-relative path of the test executable for all tests (in TestRunnerAction.java). -- PiperOrigin-RevId: 149275688 MOS_MIGRATED_REVID=149275688
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/test')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java b/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java
index 06cb42116c..ac9ba6afdf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java
@@ -362,6 +362,9 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa
env.put("TEST_SIZE", getTestProperties().getSize().toString());
env.put("TEST_TIMEOUT", Integer.toString(timeoutInSeconds));
env.put("TEST_WORKSPACE", getRunfilesPrefix());
+ env.put(
+ "TEST_BINARY",
+ getExecutionSettings().getExecutable().getRootRelativePath().getCallablePathString());
// When we run test multiple times, set different TEST_RANDOM_SEED values for each run.
// Don't override any previous setting.