Skip to content

Commit

Permalink
Windows Add tests for msys gcc toolchain and mingw gcc toolchain
Browse files Browse the repository at this point in the history
This will prevent #6610 from happening again.

RELNOTES: None
PiperOrigin-RevId: 220423789
  • Loading branch information
meteorcloudy authored and Copybara-Service committed Nov 7, 2018
1 parent b072690 commit 8e28083
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions src/test/shell/bazel/bazel_windows_example_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ fi
function set_up() {
copy_examples
setup_bazelrc
cat >>"$TEST_TMPDIR/bazelrc" <<EOF
# Workaround for https://github.com/bazelbuild/bazel/issues/2983
startup --host_jvm_args=-Dbazel.windows_unix_root=C:/fake/msys
EOF
export MSYS_NO_PATHCONV=1
export MSYS2_ARG_CONV_EXCL="*"
}
Expand Down Expand Up @@ -78,6 +74,40 @@ function test_cpp() {
assert_test_fails "//examples/cpp:hello-fail_test"
}

function test_cpp_with_msys_gcc() {
local cpp_pkg=examples/cpp
assert_build_output \
./bazel-bin/${cpp_pkg}/libhello-lib.a ${cpp_pkg}:hello-world \
--compiler=msys-gcc
assert_build_output \
./bazel-bin/${cpp_pkg}/libhello-lib.so ${cpp_pkg}:hello-lib\
--compiler=msys-gcc --output_groups=dynamic_library
assert_build ${cpp_pkg}:hello-world --compiler=msys-gcc
./bazel-bin/${cpp_pkg}/hello-world foo >& $TEST_log \
|| fail "./bazel-bin/${cpp_pkg}/hello-world foo execution failed"
expect_log "Hello foo"
assert_test_ok "//examples/cpp:hello-success_test" --compiler=msys-gcc
assert_test_fails "//examples/cpp:hello-fail_test" --compiler=msys-gcc
}

function test_cpp_with_mingw_gcc() {
local cpp_pkg=examples/cpp
( # mingw gcc should be in PATH
export PATH="/mingw64/bin:$PATH"
assert_build_output \
./bazel-bin/${cpp_pkg}/libhello-lib.a ${cpp_pkg}:hello-world \
--compiler=mingw-gcc
assert_build_output \
./bazel-bin/${cpp_pkg}/libhello-lib.so ${cpp_pkg}:hello-lib\
--compiler=mingw-gcc --output_groups=dynamic_library
assert_build ${cpp_pkg}:hello-world --compiler=mingw-gcc
./bazel-bin/${cpp_pkg}/hello-world foo >& $TEST_log \
|| fail "./bazel-bin/${cpp_pkg}/hello-world foo execution failed"
expect_log "Hello foo"
assert_test_ok "//examples/cpp:hello-success_test" --compiler=mingw-gcc
assert_test_fails "//examples/cpp:hello-fail_test" --compiler=mingw-gcc )
}

function test_cpp_alwayslink() {
mkdir -p cpp/main
cat >cpp/main/BUILD <<EOF
Expand Down

0 comments on commit 8e28083

Please sign in to comment.