aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Yun Peng <pcloudy@google.com>2016-04-15 13:37:52 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-04-15 14:09:52 +0000
commit7a3abbecea9b02a711262527e10407dd76821252 (patch)
treed207af75a3dc21bddbc2301b23a8b553d41a4fca /src
parentd0dbedaccef18615de460241b4b89d0b96a61767 (diff)
Fixed bugs for "bazel test" command on Windows
After this fix, we can run shell test, python test and cpp test with msvc toolchain on Windows using bazel test command -- Change-Id: I61e3984b6df2c4aef8762037a91a0f3a29d01691 Reviewed-on: https://bazel-review.googlesource.com/#/c/3385 MOS_MIGRATED_REVID=119950353
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java9
2 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt
index a344e28ce6..bdce83eebe 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt
@@ -63,7 +63,8 @@ def Main():
stub_filename = os.path.join(os.path.dirname(stub_filename), link)
continue
- matchobj = re.match("(.*\.runfiles)/.*", os.path.abspath(sys.argv[0]))
+ runfiles_pattern = "(.*\.runfiles)\\.*" if IsWindows() else "(.*\.runfiles)/.*"
+ matchobj = re.match(runfiles_pattern, os.path.abspath(sys.argv[0]))
if matchobj:
module_space = matchobj.group(1)
break
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java b/src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java
index 9423f10c27..e1bd9dee9f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/TestStrategy.java
@@ -29,6 +29,7 @@ import com.google.devtools.build.lib.exec.ExecutionOptions;
import com.google.devtools.build.lib.exec.SymlinkTreeHelper;
import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.profiler.ProfilerTask;
+import com.google.devtools.build.lib.util.OS;
import com.google.devtools.build.lib.util.ShellEscaper;
import com.google.devtools.build.lib.util.io.FileWatcher;
import com.google.devtools.build.lib.util.io.OutErr;
@@ -192,7 +193,13 @@ public abstract class TestStrategy implements TestActionContext {
*/
protected List<String> getArgs(
String testScript, String coverageScript, TestRunnerAction testAction) {
- List<String> args = Lists.newArrayList(testScript);
+ List<String> args = Lists.newArrayList();
+ if (OS.getCurrent() == OS.WINDOWS) {
+ args.add(testAction.getShExecutable().getPathString());
+ args.add("-c");
+ args.add("$0 $*");
+ }
+ args.add(testScript);
TestTargetExecutionSettings execSettings = testAction.getExecutionSettings();
List<String> execArgs = new ArrayList<>();