Skip to content

Commit

Permalink
fix nonincremental_builds_test to properly depend on $(JAVABASE)
Browse files Browse the repository at this point in the history
- no longer uses $bazel_javabase from testenv.sh
- works with absolute $(JAVABASE) paths and JDK's other than loc

Progress towards bazelbuild#8033
  • Loading branch information
buchgr committed Apr 15, 2019
1 parent 6f90d01 commit e8cac68
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/test/shell/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,13 @@ sh_test(
name = "nonincremental_builds_test",
size = "medium",
srcs = ["nonincremental_builds_test.sh"],
args = ["$(JAVABASE)"],
data = [
":discard_graph_edges_lib.sh",
":test-deps",
"@bazel_tools//tools/bash/runfiles",
],
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
)

sh_test(
Expand Down
21 changes: 19 additions & 2 deletions src/test/shell/integration/nonincremental_builds_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ if "$is_windows"; then
export MSYS2_ARG_CONV_EXCL="*"
fi

if "$is_windows"; then
EXE_EXT=".exe"
else
EXE_EXT=""
fi

javabase="$1"
if [[ $javabase = /* || $javabase =~ [A-Za-z]:[/\\] ]]; then
jmaptool="$1/bin/jmap${EXE_EXT}"
else
if [[ $javabase = external/* ]]; then
javabase=${javabase#external/}
fi
jmaptool="$(rlocation "${javabase}/bin/jmap${EXE_EXT}")"
fi


if ! type try_with_timeout >&/dev/null; then
# Bazel's testenv.sh defines try_with_timeout but the Google-internal version
# uses a different testenv.sh.
Expand Down Expand Up @@ -129,7 +146,7 @@ function test_inmemory_state_present_after_build() {
bazel build $pkg:top &> "$TEST_log" \
|| fail "Couldn't build $pkg"
local server_pid="$(bazel info server_pid 2>> "$TEST_log")"
"$bazel_javabase"/bin/jmap -histo:live "$server_pid" > histo.txt
"$jmaptool" -histo:live "$server_pid" > histo.txt

cat histo.txt >> "$TEST_log"
assert_contains "GenRuleAction" histo.txt
Expand All @@ -143,7 +160,7 @@ function test_inmemory_state_absent_after_build_with_nokeep_state() {
bazel build --nokeep_state_after_build $pkg:top &> "$TEST_log" \
|| fail "Couldn't build $pkg"
local server_pid="$(bazel info server_pid 2>> "$TEST_log")"
"$bazel_javabase"/bin/jmap -histo:live "$server_pid" > histo.txt
"$jmaptool" -histo:live "$server_pid" > histo.txt

cat histo.txt >> "$TEST_log"
assert_not_contains "GenRuleAction$" histo.txt
Expand Down

0 comments on commit e8cac68

Please sign in to comment.