tools: Allow testing with javac on buildbot
By running these scripts with 'ANDROID_COMPILE_WITH_JACK=false',
they will instead use javac/desugar/dx to compile the .java files.
Test: art/tools/buildbot-build.sh && art/tools/run-jdwp-tests.sh --mode=host
Test: art/tools/buildbot-build.sh && art/tools/run-libcore-tests.sh --mode=device
Test: art/tools/buildbot-build.sh && art/tools/run-libcore-tests.sh --mode=host
Bug: 36902714
Bug: 37461882
Change-Id: I118d3ec2a3fa31bf85cdcef63d2772df26e07c5e
diff --git a/tools/buildbot-build.sh b/tools/buildbot-build.sh
index 963efa4..bf7692a 100755
--- a/tools/buildbot-build.sh
+++ b/tools/buildbot-build.sh
@@ -30,8 +30,13 @@
out_dir=${OUT_DIR}
fi
+using_jack=true
+if [[ $ANDROID_COMPILE_WITH_JACK == false ]]; then
+ using_jack=false
+fi
+
java_libraries_dir=${out_dir}/target/common/obj/JAVA_LIBRARIES
-common_targets="vogar core-tests apache-harmony-jdwp-tests-hostdex jsr166-tests mockito-target ${out_dir}/host/linux-x86/bin/jack"
+common_targets="vogar core-tests apache-harmony-jdwp-tests-hostdex jsr166-tests mockito-target"
mode="target"
j_arg="-j$(nproc)"
showcommands=
@@ -58,6 +63,10 @@
fi
done
+if $using_jack; then
+ common_targets="$common_targets ${out_dir}/host/linux-x86/bin/jack"
+fi
+
if [[ $mode == "host" ]]; then
make_command="make $j_arg $showcommands build-art-host-tests $common_targets"
make_command+=" ${out_dir}/host/linux-x86/lib/libjavacoretests.so "
diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh
index d48d857..f742767 100755
--- a/tools/run-jdwp-tests.sh
+++ b/tools/run-jdwp-tests.sh
@@ -23,10 +23,24 @@
ANDROID_HOST_OUT=${OUT_DIR-$ANDROID_BUILD_TOP/out}/host/linux-x86
fi
-# Jar containing all the tests.
-test_jack=${ANDROID_HOST_OUT}/../common/obj/JAVA_LIBRARIES/apache-harmony-jdwp-tests-hostdex_intermediates/classes.jack
+using_jack=true
+if [[ $ANDROID_COMPILE_WITH_JACK == false ]]; then
+ using_jack=false
+fi
-if [ ! -f $test_jack ]; then
+function jlib_suffix {
+ local str=$1
+ local suffix="jar"
+ if $using_jack; then
+ suffix="jack"
+ fi
+ echo "$str.$suffix"
+}
+
+# Jar containing all the tests.
+test_jar=$(jlib_suffix "${ANDROID_HOST_OUT}/../common/obj/JAVA_LIBRARIES/apache-harmony-jdwp-tests-hostdex_intermediates/classes")
+
+if [ ! -f $test_jar ]; then
echo "Before running, you must build jdwp tests and vogar:" \
"make apache-harmony-jdwp-tests-hostdex vogar"
exit 1
@@ -147,6 +161,12 @@
art_debugee="$art_debugee -verbose:jdwp"
fi
+if $using_jack; then
+ toolchain_args="--toolchain jack --language JN --jack-arg -g"
+else
+ toolchain_args="--toolchain jdk --language CUR"
+fi
+
# Run the tests using vogar.
vogar $vm_command \
$vm_args \
@@ -160,10 +180,9 @@
--vm-arg -Djpda.settings.waitingTime=$jdwp_test_timeout \
--vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \
--vm-arg -Djpda.settings.debuggeeJavaPath="$art_debugee $image $debuggee_args" \
- --classpath $test_jack \
- --toolchain jack --language JN \
+ --classpath "$test_jar" \
+ $toolchain_args \
--vm-arg -Xcompiler-option --vm-arg --debuggable \
- --jack-arg -g \
$test
vogar_exit_status=$?
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index b860a62..f9f3754 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -25,10 +25,26 @@
JAVA_LIBRARIES=${ANDROID_PRODUCT_OUT}/../../common/obj/JAVA_LIBRARIES
fi
+using_jack=true
+if [[ $ANDROID_COMPILE_WITH_JACK == false ]]; then
+ using_jack=false
+fi
+
+function classes_jar_path {
+ local var="$1"
+ local suffix="jar"
+
+ if $using_jack; then
+ suffix="jack"
+ fi
+
+ echo "${JAVA_LIBRARIES}/${var}_intermediates/classes.${suffix}"
+}
+
function cparg {
for var
do
- printf -- "--classpath ${JAVA_LIBRARIES}/${var}_intermediates/classes.jack ";
+ printf -- "--classpath $(classes_jar_path "$var") ";
done
}
@@ -36,7 +52,7 @@
for lib in $DEPS
do
- if [ ! -f "${JAVA_LIBRARIES}/${lib}_intermediates/classes.jack" ]; then
+ if [[ ! -f "$(classes_jar_path "$lib")" ]]; then
echo "${lib} is missing. Before running, you must run art/tools/buildbot-build.sh"
exit 1
fi
@@ -122,8 +138,12 @@
# the default timeout.
vogar_args="$vogar_args --timeout 480"
-# Use Jack with "1.8" configuration.
-vogar_args="$vogar_args --toolchain jack --language JO"
+# Switch between using jack or javac+desugar+dx
+if $using_jack; then
+ vogar_args="$vogar_args --toolchain jack --language JO"
+else
+ vogar_args="$vogar_args --toolchain jdk --language CUR"
+fi
# JIT settings.
if $use_jit; then