24
24
25
25
[ -z " $TEST_SRCDIR " ] && { echo " TEST_SRCDIR not set!" >&2 ; exit 1; }
26
26
27
+ # --- begin runfiles.bash initialization v3 ---
28
+ # Copy-pasted from the Bazel Bash runfiles library v3.
29
+ set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
30
+ source " ${RUNFILES_DIR:-/ dev/ null} /$f " 2> /dev/null || \
31
+ # shellcheck disable=SC1090
32
+ source " $( grep -sm1 " ^$f " " ${RUNFILES_MANIFEST_FILE:-/ dev/ null} " | cut -f2- -d' ' ) " 2> /dev/null || \
33
+ source " $0 .runfiles/$f " 2> /dev/null || \
34
+ source " $( grep -sm1 " ^$f " " $0 .runfiles_manifest" | cut -f2- -d' ' ) " 2> /dev/null || \
35
+ source " $( grep -sm1 " ^$f " " $0 .exe.runfiles_manifest" | cut -f2- -d' ' ) " 2> /dev/null || \
36
+ { echo>&2 " ERROR: cannot find $f " ; exit 1; }; f=; set -e
37
+ # --- end runfiles.bash initialization v3 ---
38
+
27
39
# Load the unit-testing framework
28
40
source " $1 " || \
29
41
{ echo " Failed to load unit-testing framework $1 " >&2 ; exit 1; }
30
42
31
43
set +o errexit
32
44
33
45
unset TEST_PREMATURE_EXIT_FILE
34
- JAVA_HOME=" $2 "
46
+ JAVABASE=" $2 "
47
+ if [[ " $TEST_WORKSPACE " == " _main" ]]; then
48
+ # For Bazel
49
+ RUNFILES_JAVABASE=${JAVABASE# external/ }
50
+ else
51
+ # For Blaze
52
+ RUNFILES_JAVABASE=${TEST_WORKSPACE} /${JAVABASE}
53
+ fi
35
54
TESTBED_JAR=" ${PWD} /$3 "
36
55
37
56
shift 3
@@ -41,7 +60,7 @@ shift 3
41
60
# Test that we see a warning about missing the test suite Java system property
42
61
function test_Warning() {
43
62
test_pid=" "
44
- ${JAVA_HOME} /bin/java -jar $TESTBED_JAR >& $TEST_log && test_pid=$!
63
+ $( rlocation $RUNFILES_JAVABASE /bin/java) -jar $TESTBED_JAR >& $TEST_log && test_pid=$!
45
64
46
65
expect_log " The test suite Java system property .* is required but missing"
47
66
0 commit comments