From f4e10367df2d881f05e3ddd5bd0531b390a845fe Mon Sep 17 00:00:00 2001 From: pcloudy Date: Mon, 9 Aug 2021 04:18:50 -0700 Subject: [PATCH] Removing line ending matches in tests to be compatible on Windows grep was upgraded to 3.5 after updating MSYS on Winodws VM, which no longer matches CRLF line endings with `$`. Fixes https://github.com/bazelbuild/bazel/issues/13816 RELNOTES: None PiperOrigin-RevId: 389600750 --- .../shell/bazel/resource_compiler_toolchain_test.sh | 8 ++++---- src/test/shell/integration/loading_phase_test.sh | 8 ++++---- .../shell/integration/target_compatible_with_test.sh | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/test/shell/bazel/resource_compiler_toolchain_test.sh b/src/test/shell/bazel/resource_compiler_toolchain_test.sh index 34e733efe0ede1..aeab86ef6aa053 100755 --- a/src/test/shell/bazel/resource_compiler_toolchain_test.sh +++ b/src/test/shell/bazel/resource_compiler_toolchain_test.sh @@ -181,14 +181,14 @@ function _assert_outputs() { [[ -e bazel-bin/foo.res ]] || fail "missing output" grep -q "src=foo.rc" "bazel-bin/foo.res" || fail "bad output" grep -q "out=.*\bfoo.res" "bazel-bin/foo.res" || fail "bad output" - grep -q ".*\bres1.dat$" "bazel-bin/foo.res" || fail "bad output" - grep -q ".*\bres2.dat$" "bazel-bin/foo.res" || fail "bad output" + grep -q ".*\bres1.dat" "bazel-bin/foo.res" || fail "bad output" + grep -q ".*\bres2.dat" "bazel-bin/foo.res" || fail "bad output" [[ -e bazel-bin/bar.res ]] || fail "missing output" grep -q "src=bar.rc" "bazel-bin/bar.res" || fail "bad output" grep -q "out=.*\bbar.res" "bazel-bin/bar.res" || fail "bad output" - grep -q ".*\bres1.dat$" "bazel-bin/bar.res" || fail "bad output" - grep -q ".*\bres2.dat$" "bazel-bin/bar.res" || fail "bad output" + grep -q ".*\bres1.dat" "bazel-bin/bar.res" || fail "bad output" + grep -q ".*\bres2.dat" "bazel-bin/bar.res" || fail "bad output" } function _assert_no_outputs() { diff --git a/src/test/shell/integration/loading_phase_test.sh b/src/test/shell/integration/loading_phase_test.sh index 049c64e5bc87e4..dcefef9a1c8014 100755 --- a/src/test/shell/integration/loading_phase_test.sh +++ b/src/test/shell/integration/loading_phase_test.sh @@ -598,8 +598,8 @@ function test_path_from_subdir() { cd "$pkg/subdir" bazel query '../BUILD + ../foo' >output 2> "$TEST_log" \ || fail "Expected success" - assert_contains "^//$pkg:BUILD\$" output - assert_contains "^//$pkg:foo\$" output + assert_contains "^//$pkg:BUILD" output + assert_contains "^//$pkg:foo" output } function test_target_with_BUILD() { @@ -607,7 +607,7 @@ function test_target_with_BUILD() { mkdir -p "$pkg" || fail "could not create \"$pkg\"" echo 'filegroup(name = "foo/BUILD", srcs = [])' > "$pkg/BUILD" || fail "echo" bazel query "$pkg/foo/BUILD" >output 2> "$TEST_log" || fail "Expected success" - assert_contains "^//$pkg:foo/BUILD\$" output + assert_contains "^//$pkg:foo/BUILD" output } function test_directory_with_BUILD() { @@ -615,7 +615,7 @@ function test_directory_with_BUILD() { mkdir -p "$pkg/BUILD" || fail "could not create \"$pkg/BUILD\"" touch "$pkg/BUILD/BUILD" || fail "Couldn't touch" bazel query "$pkg/BUILD" >output 2> "$TEST_log" || fail "Expected success" - assert_contains "^//$pkg/BUILD:BUILD\$" output + assert_contains "^//$pkg/BUILD:BUILD" output } function test_missing_BUILD() { diff --git a/src/test/shell/integration/target_compatible_with_test.sh b/src/test/shell/integration/target_compatible_with_test.sh index 3766c89e4ae2da..c8582fde60a675 100755 --- a/src/test/shell/integration/target_compatible_with_test.sh +++ b/src/test/shell/integration/target_compatible_with_test.sh @@ -629,7 +629,7 @@ EOF # Validate that we get the dependency chain printed out. expect_log '^Dependency chain:$' expect_log '^ //target_skipping:generate_with_tool$' - expect_log "^ //target_skipping:generator_tool <-- target platform didn't satisfy constraint //target_skipping:foo1$" + expect_log "^ //target_skipping:generator_tool <-- target platform didn't satisfy constraint //target_skipping:foo1" expect_log 'FAILED: Build did NOT complete successfully' # Validate the test. @@ -644,7 +644,7 @@ EOF expect_log '^Dependency chain:$' expect_log '^ //target_skipping:generated_test$' expect_log '^ //target_skipping:generate_with_tool$' - expect_log "^ //target_skipping:generator_tool <-- target platform didn't satisfy constraint //target_skipping:foo1$" + expect_log "^ //target_skipping:generator_tool <-- target platform didn't satisfy constraint //target_skipping:foo1" expect_log 'FAILED: Build did NOT complete successfully' } @@ -692,7 +692,7 @@ EOF expect_log '^Dependency chain:$' expect_log '^ //target_skipping:generated_test$' expect_log '^ //target_skipping:generate_with_tool$' - expect_log "^ //target_skipping:generator_tool <-- target platform didn't satisfy constraints \[//target_skipping:foo1, //target_skipping:bar2\]$" + expect_log "^ //target_skipping:generator_tool <-- target platform didn't satisfy constraints \[//target_skipping:foo1, //target_skipping:bar2\]" expect_log 'FAILED: Build did NOT complete successfully' } @@ -848,7 +848,7 @@ EOF # Make sure that the contents of the file are what we expect. cp ../${PRODUCT_NAME}-bin/target_skipping/host_tool_message.txt "${TEST_log}" - expect_log '^Hello World$' + expect_log 'Hello World' } # Validates that we successfully skip analysistest rule targets when they @@ -916,8 +916,8 @@ function test_query() { bazel query \ 'deps(//target_skipping:sh_foo1)' &> "${TEST_log}" \ || fail "Bazel query failed unexpectedly." - expect_log '^//target_skipping:sh_foo1$' - expect_log '^//target_skipping:genrule_foo1$' + expect_log '^//target_skipping:sh_foo1' + expect_log '^//target_skipping:genrule_foo1' } # Run a cquery on a target that is compatible. This should pass.