Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid creating test runfile trees when using sandboxfs #15153

Closed
pauldraper opened this issue Mar 31, 2022 · 7 comments
Closed

Avoid creating test runfile trees when using sandboxfs #15153

pauldraper opened this issue Mar 31, 2022 · 7 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Local-Exec Issues and PRs for the Execution (Local) team type: feature request

Comments

@pauldraper
Copy link
Contributor

Description of the problem / feature request:

Avoid creating test runfile trees when using sandboxfs.

Feature requests: what underlying problem are you trying to solve with this feature?

The entire point of sandboxfs is avoiding creating symlinks.

But when running bazel test, the symlink tree is created anyway. This seems unnecessary, no?

@sgowroji
Copy link
Member

sgowroji commented Apr 5, 2022

Hello @pauldraper, Could you please provide more details with respect to your query. Thanks!

@pauldraper
Copy link
Contributor Author

pauldraper commented Apr 5, 2022

Even with sandboxfs being used, runfiles trees are still being created in the output root for builds, tests, etc.

@sgowroji sgowroji added untriaged team-Local-Exec Issues and PRs for the Execution (Local) team and removed untriaged more data needed labels Apr 6, 2022
@meisterT
Copy link
Member

meisterT commented Apr 7, 2022

cc @larsrc-google

@meisterT meisterT added type: feature request P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Apr 7, 2022
@meisterT meisterT removed their assignment Apr 7, 2022
@larsrc-google
Copy link
Contributor

Possibly related to issue #7470.

Could you show a command line that prompts this behaviour, and what you're seeing that you didn't expect? A couple of tries didn't get me to get sandboxfs to work for tests at all.

@pauldraper
Copy link
Contributor Author

pauldraper commented Oct 31, 2022

WORKSPACE.bazel

workspace(name = "example")

BUILD.bazel

sh_binary(
  name = "test",
  data = ["data.txt"],
  srcs = ["test.sh"],
)

test.sh

#!/bin/sh

data.txt

Run

bazel  test --experimental_use_sandboxfs :test

Notice that the symlink bazel-bin/test.runfiles/example/data.txt is created. If there are many tests or many files (scripting languages, external dependencies, end-to-end tests, etc), populating the runfile trees can be costly.

Sandboxfs (when enabled) could be used to avoid materializing the runfile tree.

@benjaminp
Copy link
Collaborator

217fafe

@tjgq
Copy link
Contributor

tjgq commented Oct 12, 2023

FYI, we do have a flag to suppress the creation of runfile symlink trees (--nobuild_runfile_links). This is orthogonal to sandboxing, because the purpose of sandboxing is not to manage the output tree, but to create a hermetic environment separate from the output tree where an action can run.

@meisterT meisterT closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Local-Exec Issues and PRs for the Execution (Local) team type: feature request
Projects
None yet
Development

No branches or pull requests

6 participants