diff options
author | Yun Peng <pcloudy@google.com> | 2016-04-19 14:55:36 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-04-20 11:16:33 +0000 |
commit | 2ad804cef42fbfc841dc3220de52fd406e3d69c5 (patch) | |
tree | 80039230dd5e86ad25a9166801b02b7633ced409 /src | |
parent | 857cda2c45a5cc68c3fa398311c48c571a64915d (diff) |
Fixed bugs blocking bazel shell test on Windows
--
Change-Id: I6a2f9026fda578905ccb72b317223eaca16b882b
Reviewed-on: https://bazel-review.googlesource.com/#/c/3440
MOS_MIGRATED_REVID=120228541
Diffstat (limited to 'src')
-rw-r--r-- | src/main/cpp/blaze_util.cc | 3 | ||||
-rwxr-xr-x | src/test/shell/bazel/test-setup.sh | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/main/cpp/blaze_util.cc b/src/main/cpp/blaze_util.cc index f1126db5bc..912f825680 100644 --- a/src/main/cpp/blaze_util.cc +++ b/src/main/cpp/blaze_util.cc @@ -63,9 +63,10 @@ string GetUserName() { // If called from working directory "/bar": // MakeAbsolute("foo") --> "/bar/foo" // MakeAbsolute("/foo") ---> "/foo" +// MakeAbsolute("C:/foo") ---> "C:/foo" string MakeAbsolute(const string &path) { // Check if path is already absolute. - if (path.empty() || path[0] == '/') { + if (path.empty() || path[0] == '/' || (isalpha(path[0]) && path[1] == ':')) { return path; } diff --git a/src/test/shell/bazel/test-setup.sh b/src/test/shell/bazel/test-setup.sh index 8ed875b2cf..e93fa4a814 100755 --- a/src/test/shell/bazel/test-setup.sh +++ b/src/test/shell/bazel/test-setup.sh @@ -32,8 +32,22 @@ echo "bazel binary is at $bazel" # Here we unset variable that were set by the invoking Blaze instance unset JAVA_RUNFILES +function is_windows() { + # On windows, the shell test actually running on msys + if [ "${PLATFORM}" == "msys_nt-6.1" ]; then + true + else + false + fi +} + function setup_bazelrc() { + # enable batch mode when running on windows + if is_windows; then + BATCH_MODE="startup --batch" + fi cat >$TEST_TMPDIR/bazelrc <<EOF +${BATCH_MODE:-} startup --output_user_root=${bazel_root} startup --host_javabase=${bazel_javabase} build -j 8 @@ -380,6 +394,9 @@ function setup_clean_workspace() { export BAZEL_INSTALL_BASE=$(bazel info install_base) export BAZEL_GENFILES_DIR=$(bazel info bazel-genfiles) export BAZEL_BIN_DIR=$(bazel info bazel-bin) + if is_windows; then + export BAZEL_SH="$(cygpath --windows /bin/bash)" + fi } # Clean up all files that are not in tools directories, to restart |