Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Aug 18, 2024
1 parent ffdf41a commit ff8c1fe
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ bazel_fragments["CoreOptions"] = fragment(
"//command_line_option:experimental_exclude_defines_from_exec_config",
"//command_line_option:experimental_exclude_starlark_flags_from_exec_config",
"//command_line_option:experimental_propagate_custom_flag",
"//command_line_option:experimental_inprocess_symlink_creation",
],
inputs = ["//command_line_option:features"],
outputs = [
Expand Down
41 changes: 40 additions & 1 deletion src/test/shell/bazel/bazel_symlink_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,28 @@ function test_unresolved_symlink_as_input_local() {
bazel build //pkg:c || fail "symlink should resolve"
}

function test_unresolved_symlink_as_input_local_inprocess() {
if "$is_windows"; then
# TODO(#10298): Support unresolved symlinks on Windows.
return 0
fi

setup_unresolved_symlink_as_input
add_to_bazelrc build --spawn_strategy=local
add_to_bazelrc build --experimental_inprocess_symlink_creation

bazel build //pkg:b && fail "symlink should not resolve"

bazel clean
bazel build //pkg:file
# Since the build isn't sandboxed, the symlink to //:a resolves even though
# the action does not declare it as an input.
bazel build //pkg:b || fail "symlink expected to resolve non-hermetically"

bazel clean
bazel build //pkg:c || fail "symlink should resolve"
}

function test_unresolved_symlink_as_input_sandbox() {
if "$is_windows"; then
# TODO(#10298): Support unresolved symlinks on Windows.
Expand All @@ -797,7 +819,7 @@ function test_unresolved_symlink_as_input_sandbox() {

bazel clean
bazel build //pkg:a
# Since the build isn't sandboxed, the symlink to //:a does not resolves even
# Since the build is sandboxed, the symlink to //:a does not resolves even
# though it would in the unsandboxed exec root due to //:a having been built
# before.
bazel build //pkg:b && fail "sandboxed build is not hermetic"
Expand Down Expand Up @@ -886,6 +908,23 @@ function test_unresolved_symlink_as_runfile_local() {
bazel build //pkg:use_tool_non_hermetically && fail "symlink in runfiles resolved outside the runfiles tree" || true
}

function test_unresolved_symlink_as_runfile_local_inprocess() {
if "$is_windows"; then
# TODO(#10298): Support unresolved symlinks on Windows.
return 0
fi

setup_unresolved_symlink_as_runfile
add_to_bazelrc build --spawn_strategy=local
add_to_bazelrc build --experimental_inprocess_symlink_creation

bazel build //pkg:use_tool || fail "local build failed"
# Keep the implicitly built //pkg:a around to make the symlink resolve
# outside the runfiles tree. The build should still fail as the relative
# symlink is staged as is and doesn't resolve outside the runfiles tree.
bazel build //pkg:use_tool_non_hermetically && fail "symlink in runfiles resolved outside the runfiles tree" || true
}

function test_unresolved_symlink_as_runfile_symlink() {
if "$is_windows"; then
# TODO(#10298): Support unresolved symlinks on Windows.
Expand Down

0 comments on commit ff8c1fe

Please sign in to comment.