aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell/testenv.sh
diff options
context:
space:
mode:
authorGravatar Yun Peng <pcloudy@google.com>2016-10-21 13:20:59 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-10-21 14:21:40 +0000
commit3eef69dbef66371d0d3633a8e5fbbfe9971df961 (patch)
treee36cf7b23d2bf362978b0661eaf87c65a1919862 /src/test/shell/testenv.sh
parentc17ee05daa4b7e9a9a6e63e90d610d37a934b0c6 (diff)
Fix and re-enable bazel_windows_example_test
-- Change-Id: I09d8ef5daceb48066ec40420ad5cf21514059f4a Reviewed-on: https://bazel-review.googlesource.com/#/c/6770 MOS_MIGRATED_REVID=136825145
Diffstat (limited to 'src/test/shell/testenv.sh')
-rwxr-xr-xsrc/test/shell/testenv.sh30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/test/shell/testenv.sh b/src/test/shell/testenv.sh
index d465c9f136..ec0fa47aa5 100755
--- a/src/test/shell/testenv.sh
+++ b/src/test/shell/testenv.sh
@@ -19,9 +19,26 @@
# TODO(bazel-team): This file is currently an append of the old testenv.sh and
# test-setup.sh files. This must be cleaned up eventually.
+# Windows
+PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
+function is_windows() {
+ # On windows, the shell test is actually running on msys
+ if [[ "${PLATFORM}" =~ msys_nt* ]]; then
+ true
+ else
+ false
+ fi
+}
+
# Make the command "bazel" available for tests.
PATH_TO_BAZEL_BIN=$(rlocation io_bazel/src/bazel)
-PATH_TO_BAZEL_WRAPPER="${TEST_SRCDIR}/io_bazel/src/test/shell/bin"
+PATH_TO_BAZEL_WRAPPER="$(dirname $(rlocation io_bazel/src/test/shell/bin/bazel))"
+# Convert PATH_TO_BAZEL_WRAPPER to Unix path style on Windows, because it will be
+# added into PATH. There's problem if PATH=C:/msys64/usr/bin:/usr/local,
+# because ':' is used as both path seperator and in C:/msys64/...
+if is_windows; then
+ PATH_TO_BAZEL_WRAPPER="$(cygpath -u "$PATH_TO_BAZEL_WRAPPER")"
+fi
if [ ! -f "${PATH_TO_BAZEL_WRAPPER}/bazel" ];
then
echo "Unable to find the Bazel binary at $PATH_TO_BAZEL_WRAPPER/bazel" >&2
@@ -53,17 +70,6 @@ workspace_file="${BAZEL_RUNFILES}/WORKSPACE"
bazel_tree="$(rlocation io_bazel/src/test/shell/bazel/doc-srcs.zip)"
bazel_data="${BAZEL_RUNFILES}"
-# Windows
-PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
-function is_windows() {
- # On windows, the shell test actually running on msys
- if [[ "${PLATFORM}" =~ msys_nt* ]]; then
- true
- else
- false
- fi
-}
-
# Java
if is_windows; then
jdk_dir="$(cygpath -m $(cd $(rlocation local_jdk/bin/java.exe)/../..; pwd))"