Fix tests that overwrite the WORKSPACE.
@@ -292,9 +292,8 @@ EOF
}
function test_workspace_name_change() {
- cat > WORKSPACE <<EOF
-workspace(name = "foo")
-EOF
+ # Rewrite the workspace name but leave the rest of WORKSPACE alone.
+ sed -ie 's,workspace(.*,workspace(name = "foo"),' WORKSPACE
cat > BUILD <<EOF
cc_binary(
@@ -309,9 +308,8 @@ EOF
bazel build //:thing $EXTRA_BUILD_FLAGS &> $TEST_log || fail "Build failed"
[[ -d ${PRODUCT_NAME}-bin/thing${EXT}.runfiles/foo ]] || fail "foo not found"
- cat > WORKSPACE <<EOF
-workspace(name = "bar")
-EOF
+ # Change workspace name to bar.
+ sed -ie 's,workspace(.*,workspace(name = "bar"),' WORKSPACE
bazel build //:thing $EXTRA_BUILD_FLAGS &> $TEST_log || fail "Build failed"
[[ -d ${PRODUCT_NAME}-bin/thing${EXT}.runfiles/bar ]] || fail "bar not found"
[[ ! -d ${PRODUCT_NAME}-bin/thing${EXT}.runfiles/foo ]] \
