commit | 62c3105a159db52779d49f7fbd98099d71a51852 | [log] [tgz] |
---|---|---|
author | Yun Peng <pcloudy@google.com> | Wed Jun 07 15:06:51 2017 -0400 |
committer | John Cater <jcater@google.com> | Thu Jun 08 10:52:44 2017 -0400 |
tree | 8b969e46fe6d69e12cc46bb83d5d50a5640656c4 | |
parent | 4ed112830894161614d9b33ee26b0f9f74eb05d9 [diff] [blame] |
Switch to correct runfiles directory when running python test on Windows py_test cannot find it's data file at runtime. The reason is it's running in a wrong directory. The test directory is set to runfiles directory by test-setup.sh, but on Windows, python binary unzip itself to another temp directory which test-setup.sh doesn't know. So let the python stub template switch to the correct runfiles directory if RUN_UNDER_RUNFILES = 1 Fixed https://github.com/bazelbuild/bazel/issues/3134 Change-Id: If5dbee811330372d86484ebd871ea55d84bc29a8 PiperOrigin-RevId: 158299041
diff --git a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java index 58aed28..b3100c2 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
@@ -72,6 +72,7 @@ .put("PYTHON_RUNFILES", TestPolicy.RUNFILES_DIR) .put("RUNFILES_DIR", TestPolicy.RUNFILES_DIR) .put("TEST_TMPDIR", TestPolicy.TEST_TMP_DIR) + .put("RUN_UNDER_RUNFILES", "1") .build(); public static final TestPolicy DEFAULT_LOCAL_POLICY = new TestPolicy(ENV_VARS);