Skip to content

Commit

Permalink
Removing line ending matches in tests to be compatible on Windows
Browse files Browse the repository at this point in the history
grep was upgraded to 3.5 after updating MSYS on Winodws VM, which no longer matches CRLF line endings with `$`.

Fixes bazelbuild#13816

RELNOTES: None
PiperOrigin-RevId: 389600750
  • Loading branch information
meteorcloudy committed Aug 13, 2021
1 parent 7bbff61 commit f4e1036
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/test/shell/bazel/resource_compiler_toolchain_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
8 changes: 4 additions & 4 deletions src/test/shell/integration/loading_phase_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -598,24 +598,24 @@ 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() {
local -r pkg="${FUNCNAME}"
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() {
local -r pkg="${FUNCNAME}"
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() {
Expand Down
12 changes: 6 additions & 6 deletions src/test/shell/integration/target_compatible_with_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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'
}
Expand Down Expand Up @@ -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'
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit f4e1036

Please sign in to comment.