Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Aug 19, 2024
1 parent 82eeac0 commit d4842e1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/test/shell/integration/runfiles_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -569,4 +569,37 @@ EOF
assert_contains '/link_two$' *-bin/a/go
}

function test_spaces_in_runfiles_paths() {
mkdir -p pkg
cat > pkg/defs.bzl <<'EOF'
def _spaces_impl(ctx):
out = ctx.actions.declare_file(" a b .txt")
ctx.actions.write(out, "my content")
return [DefaultInfo(files = depset([out]))]
spaces = rule(
implementation = _spaces_impl,
)
EOF
cat > pkg/BUILD <<'EOF'
load(":defs.bzl", "spaces")
spaces(name = "spaces")
sh_test(
name = "foo",
srcs = ["foo.sh"],
data = [":spaces"],
)
EOF
cat > pkg/foo.sh <<'EOF'
#!/bin/bash
if [[ "$(cat "pkg/ a b .txt")" != "my content" ]]; then
echo "unexpected content or not found"
exit 1
fi
EOF
chmod +x pkg/foo.sh

bazel test //pkg:foo $EXTRA_BUILD_FLAGS >&$TEST_log || fail "test failed"
}

run_suite "runfiles"

0 comments on commit d4842e1

Please sign in to comment.