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

Add path mapping test for multiplex sandboxing #21837

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/test/shell/bazel/path_mapping_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,54 @@ function test_path_stripping_singleplex_worker() {
expect_not_log '[0-9] worker'
}

function test_path_stripping_multiplex_worker() {
if is_windows; then
echo "Skipping test_path_stripping_multiplex_worker on Windows as it requires sandboxing"
return
fi

mkdir toolchain
cat > toolchain/BUILD <<'EOF'
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")
default_java_toolchain(
name = "java_toolchain",
source_version = "17",
target_version = "17",
javac_supports_worker_multiplex_sandboxing = True,
)
EOF

cache_dir=$(mktemp -d)

bazel run -c fastbuild \
--disk_cache=$cache_dir \
--experimental_output_paths=strip \
--strategy=Javac=worker \
--experimental_worker_multiplex_sandboxing \
--extra_toolchains=//toolchain:java_toolchain_definition \
--java_language_version=17 \
//src/main/java/com/example:Main &> $TEST_log || fail "run failed unexpectedly"
expect_log 'Hello, World!'
# JavaToolchainCompileBootClasspath, JavaToolchainCompileClasses and header compilation.
expect_log '3 \(linux\|darwin\|processwrapper\)-sandbox'
# Actual compilation actions.
expect_log '2 worker'
expect_not_log 'disk cache hit'

bazel run -c opt \
--disk_cache=$cache_dir \
--experimental_output_paths=strip \
--strategy=Javac=worker \
--experimental_worker_multiplex_sandboxing \
--extra_toolchains=//toolchain:java_toolchain_definition \
--java_language_version=17 \
//src/main/java/com/example:Main &> $TEST_log || fail "run failed unexpectedly"
expect_log 'Hello, World!'
expect_log '5 disk cache hit'
expect_not_log '[0-9] \(linux\|darwin\|processwrapper\)-sandbox'
expect_not_log '[0-9] worker'
}

function test_path_stripping_remote() {
bazel run -c fastbuild \
--experimental_output_paths=strip \
Expand Down
Loading