Skip to content

Commit

Permalink
Enable Blaze path mapping test for Bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Oct 4, 2023
1 parent 01ad342 commit 471cbc8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/test/shell/integration/config_stripped_outputs_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function assert_paths_stripped() {
found_identifying_output=0

# Check every output path in the action command line is stripped.
for o in $(echo $cmd | xargs -d' ' -n 1 | egrep -o "${bazel_out}[^)]*"); do
for o in $(echo $cmd | tr -s ' ' '\n' | xargs -n 1 | grep -E -o "${bazel_out}[^)]*"); do
echo "$o" | grep -v "${bazel_out}/bin" \
&& fail "expected all \"${bazel_out}\" paths to start with " \
"\"${bazel_out}/bin.*\": $o"
Expand All @@ -50,7 +50,7 @@ function assert_paths_stripped() {
done

# Check every output path in every .params file is stripped.
for o in $(echo $cmd | xargs -d' ' -n 1 | egrep -o "${bazel_out}[^)]*.params"); do
for o in $(echo $cmd | tr -s ' ' '\n' | xargs -n 1 | grep -E -o "${bazel_out}[^)]*.params"); do
bin_relative_path=$(echo $o | sed -r "s|${bazel_out}/bin/||")
local_path="${bazel_out:0:5}-bin/${bin_relative_path}"
for k in $(grep "${bazel_out}" $local_path); do
Expand Down
22 changes: 15 additions & 7 deletions src/test/shell/integration/config_stripped_outputs_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,11 @@ if "$is_windows"; then
export MSYS2_ARG_CONV_EXCL="*"
fi

add_to_bazelrc "test --notest_loasd"
add_to_bazelrc "build --package_path=%workspace%"

# This is what triggers config path stripping.
add_to_bazelrc "build --experimental_output_paths=strip"

# Remove this check when Bazel supports path mapping. This requires a complying
# executor. See https://github.com/bazelbuild/bazel/pull/18155.
function is_bazel() {
output_path=$(bazel info | grep '^output_path:')
bazel_out="${output_path##*/}"
Expand All @@ -92,11 +89,20 @@ function is_bazel() {
fi
}

# Remove this check when Javac actions support multiplex worker sandboxing.
if is_bazel; then
add_to_bazelrc "build --strategy=Javac=worker"
add_to_bazelrc "build --worker_sandboxing"
add_to_bazelrc "build --noexperimental_worker_multiplex"
fi

# Tests built-in Java support for stripping config path prefixes from
# platform-independent actions.
function test_builtin_java_support() {
# TODO(https://github.com/bazelbuild/bazel/pull/18155): support Bazel.
if is_bazel; then return; fi
if is_windows; then
echo "Skipping test_builtin_java_support on Windows."
return
fi

local -r pkg="${FUNCNAME[0]}"
mkdir -p "$pkg"
Expand Down Expand Up @@ -180,8 +186,10 @@ EOF
}

function test_inmemory_jdeps_support() {
# TODO(https://github.com/bazelbuild/bazel/pull/18155): support Bazel.
if is_bazel; then return; fi
if is_windows; then
echo "Skipping test_inmemory_jdeps_support on Windows."
return
fi

local -r pkg="${FUNCNAME[0]}"
write_java_classpath_reduction_files "$pkg"
Expand Down

0 comments on commit 471cbc8

Please sign in to comment.