diff options
Diffstat (limited to 'test/run-test')
| -rwxr-xr-x | test/run-test | 148 |
1 files changed, 132 insertions, 16 deletions
diff --git a/test/run-test b/test/run-test index ffa25eb5ab..84c818b444 100755 --- a/test/run-test +++ b/test/run-test @@ -46,6 +46,7 @@ export JAVAC="javac -g" export RUN="${progdir}/etc/run-test-jar" export DEX_LOCATION=/data/run-test/${test_dir} export NEED_DEX="true" +export USE_JACK="false" # If dx was not set by the environment variable, assume it is in the path. if [ -z "$DX" ]; then @@ -67,6 +68,46 @@ if [ -z "$DXMERGER" ]; then export DXMERGER="dexmerger" fi +# If jack was not set by the environment variable, assume it is in the path. +if [ -z "$JACK" ]; then + export JACK="jack" +fi + +# If the tree is compiled with Jack, build test with Jack by default. +if [ "$ANDROID_COMPILE_WITH_JACK" = "true" ]; then + USE_JACK="true" +fi + +# ANDROID_BUILD_TOP is not set in a build environment. +if [ -z "$ANDROID_BUILD_TOP" ]; then + export ANDROID_BUILD_TOP=$oldwd +fi + +# If JACK_VM_COMMAND is not set, assume it launches the prebuilt jack-launcher. +if [ -z "$JACK_VM_COMMAND" ]; then + if [ ! -z "$TMPDIR" ]; then + jack_temp_dir="-Djava.io.tmpdir=$TMPDIR" + fi + export JACK_VM_COMMAND="java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation $jack_temp_dir -jar $ANDROID_BUILD_TOP/prebuilts/sdk/tools/jack-launcher.jar" +fi + +# If JACK_CLASSPATH is not set, assume it only contains core-libart. +if [ -z "$JACK_CLASSPATH" ]; then + export JACK_CLASSPATH="$ANDROID_BUILD_TOP/out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_intermediates/classes.jack" +fi + +# If JACK_JAR is not set, assume it is located in the prebuilts directory. +if [ -z "$JACK_JAR" ]; then + export JACK_JAR="$ANDROID_BUILD_TOP/prebuilts/sdk/tools/jack.jar" +fi + +# If JILL_JAR is not set, assume it is located in the prebuilts directory. +if [ -z "$JILL_JAR" ]; then + export JILL_JAR="$ANDROID_BUILD_TOP/prebuilts/sdk/tools/jill.jar" +fi + +export JACK="$JACK -g -cp $JACK_CLASSPATH" +export JILL="java -jar $JILL_JAR" info="info.txt" build="build" @@ -76,6 +117,7 @@ check_cmd="check" output="output.txt" build_output="build-output.txt" cfg_output="graph.cfg" +strace_output="strace-output.txt" lib="libartd.so" run_args="--quiet" build_args="" @@ -96,6 +138,7 @@ trace_stream="false" basic_verify="false" gc_verify="false" gc_stress="false" +strace="false" always_clean="no" never_clean="no" have_dex2oat="yes" @@ -116,6 +159,7 @@ while true; do runtime="jvm" prebuild_mode="no" NEED_DEX="false" + USE_JACK="false" run_args="${run_args} --jvm" shift elif [ "x$1" = "x-O" ]; then @@ -193,6 +237,10 @@ while true; do run_args="${run_args} --gdb" dev_mode="yes" shift + elif [ "x$1" = "x--strace" ]; then + strace="yes" + run_args="${run_args} --invoke-with strace --invoke-with -o --invoke-with $tmp_dir/$strace_output" + shift elif [ "x$1" = "x--zygote" ]; then run_args="${run_args} --zygote" shift @@ -214,6 +262,10 @@ while true; do elif [ "x$1" = "x--no-verify" ]; then run_args="${run_args} --no-verify" shift + elif [ "x$1" = "x--verify-soft-fail" ]; then + run_args="${run_args} --verify-soft-fail" + image_suffix="-interp-ac" + shift elif [ "x$1" = "x--no-optimize" ]; then run_args="${run_args} --no-optimize" shift @@ -237,6 +289,12 @@ while true; do elif [ "x$1" = "x--build-only" ]; then build_only="yes" shift + elif [ "x$1" = "x--build-with-javac-dx" ]; then + USE_JACK="false" + shift + elif [ "x$1" = "x--build-with-jack" ]; then + USE_JACK="true" + shift elif [ "x$1" = "x--output-path" ]; then shift tmp_dir=$1 @@ -281,6 +339,10 @@ while true; do elif [ "x$1" = "x--dex2oat-swap" ]; then run_args="${run_args} --dex2oat-swap" shift + elif [ "x$1" = "x--instruction-set-features" ]; then + shift + run_args="${run_args} --instruction-set-features $1" + shift elif expr "x$1" : "x--" >/dev/null 2>&1; then echo "unknown $0 option: $1" 1>&2 usage="yes" @@ -369,10 +431,7 @@ if [ "$runtime" = "dalvik" ]; then fi elif [ "$runtime" = "art" ]; then if [ "$target_mode" = "no" ]; then - # ANDROID_BUILD_TOP and ANDROID_HOST_OUT are not set in a build environment. - if [ -z "$ANDROID_BUILD_TOP" ]; then - export ANDROID_BUILD_TOP=$oldwd - fi + # ANDROID_HOST_OUT is not set in a build environment. if [ -z "$ANDROID_HOST_OUT" ]; then export ANDROID_HOST_OUT=$ANDROID_BUILD_TOP/out/host/linux-x86 fi @@ -462,11 +521,16 @@ if [ "$usage" = "yes" ]; then echo " --debuggable Whether to compile Java code for a debugger." echo " --gdb Run under gdb; incompatible with some tests." echo " --build-only Build test files only (off by default)." + echo " --build-with-javac-dx Build test files with javac and dx (on by default)." + echo " --build-with-jack Build test files with jack and jill (off by default)." echo " --interpreter Enable interpreter only mode (off by default)." echo " --jit Enable jit (off by default)." echo " --optimizing Enable optimizing compiler (default)." echo " --quick Use Quick compiler (off by default)." echo " --no-verify Turn off verification (on by default)." + echo " --verify-soft-fail Force soft fail verification (off by default)." + echo " Verification is enabled if neither --no-verify" + echo " nor --verify-soft-fail is specified." echo " --no-optimize Turn off optimization (on by default)." echo " --no-precise Turn off precise GC (on by default)." echo " --zygote Spawn the process from the Zygote." \ @@ -496,6 +560,8 @@ if [ "$usage" = "yes" ]; then echo " --never-clean Keep the test files even if the test succeeds." echo " --android-root [path] The path on target for the android root. (/system by default)." echo " --dex2oat-swap Use a dex2oat swap file." + echo " --instruction-set-features [string]" + echo " Set instruction-set-features for compilation." ) 1>&2 exit 1 fi @@ -556,22 +622,49 @@ if [[ "$TEST_NAME" =~ ^[0-9]+-checker- ]]; then # if Checker is not invoked and the test only runs the program. build_args="${build_args} --dx-option --no-optimize" - if [ "$runtime" = "art" -a "$image_suffix" = "-optimizing" -a "$target_mode" = "no" -a "$debuggable" = "no" ]; then - run_checker="yes" - run_args="${run_args} -Xcompiler-option --dump-cfg=$tmp_dir/$cfg_output \ - -Xcompiler-option -j1" + # Jack does not necessarily generate the same DEX output than dx. Because these tests depend + # on a particular DEX output, keep building them with dx for now (b/19467889). + USE_JACK="false" + + if [ "$runtime" = "art" -a "$image_suffix" = "-optimizing" -a "$debuggable" = "no" ]; then + # In no-prebuild mode, the compiler is only invoked if both dex2oat and + # patchoat are available. Disable Checker otherwise (b/22552692). + if [ "$prebuild_mode" = "yes" ] || [ "$have_patchoat" = "yes" -a "$have_dex2oat" = "yes" ]; then + run_checker="yes" + if [ "$target_mode" = "no" ]; then + cfg_output_dir="$tmp_dir" + checker_arch_option= + else + cfg_output_dir="$DEX_LOCATION" + checker_arch_option="--arch=${target_arch_name^^}" + fi + run_args="${run_args} -Xcompiler-option --dump-cfg=$cfg_output_dir/$cfg_output \ + -Xcompiler-option -j1" + fi fi fi # To cause tests to fail fast, limit the file sizes created by dx, dex2oat and ART output to 2MB. -file_size_limit=2048 +build_file_size_limit=2048 +run_file_size_limit=2048 if echo "$test_dir" | grep 089; then - file_size_limit=5120 + build_file_size_limit=5120 + run_file_size_limit=5120 elif echo "$test_dir" | grep 083; then - file_size_limit=5120 + build_file_size_limit=5120 + run_file_size_limit=5120 fi -if ! ulimit -S "$file_size_limit"; then - echo "ulimit file size setting failed" +if [ "$run_checker" = "yes" -a "$target_mode" = "yes" ]; then + # We will need to `adb pull` the .cfg output from the target onto the host to + # run checker on it. This file can be big. + build_file_size_limit=16384 + run_file_size_limit=16384 +fi +if [ ${USE_JACK} = "false" ]; then + # Set ulimit if we build with dx only, Jack can generate big temp files. + if ! ulimit -S "$build_file_size_limit"; then + echo "ulimit file size setting failed" + fi fi good="no" @@ -582,13 +675,19 @@ if [ "$dev_mode" = "yes" ]; then build_exit="$?" echo "build exit status: $build_exit" 1>&2 if [ "$build_exit" = '0' ]; then + if ! ulimit -S "$run_file_size_limit"; then + echo "ulimit file size setting failed" + fi echo "${test_dir}: running..." 1>&2 "./${run}" $run_args "$@" 2>&1 run_exit="$?" if [ "$run_exit" = "0" ]; then if [ "$run_checker" = "yes" ]; then - "$checker" "$cfg_output" "$tmp_dir" 2>&1 + if [ "$target_mode" = "yes" ]; then + adb pull $cfg_output_dir/$cfg_output &> /dev/null + fi + "$checker" $checker_arch_option "$cfg_output" "$tmp_dir" 2>&1 checker_exit="$?" if [ "$checker_exit" = "0" ]; then good="yes" @@ -604,10 +703,16 @@ elif [ "$update_mode" = "yes" ]; then "./${build}" $build_args >"$build_output" 2>&1 build_exit="$?" if [ "$build_exit" = '0' ]; then + if ! ulimit -S "$run_file_size_limit"; then + echo "ulimit file size setting failed" + fi echo "${test_dir}: running..." 1>&2 "./${run}" $run_args "$@" >"$output" 2>&1 if [ "$run_checker" = "yes" ]; then - "$checker" -q "$cfg_output" "$tmp_dir" >> "$output" 2>&1 + if [ "$target_mode" = "yes" ]; then + adb pull $cfg_output_dir/$cfg_output &> /dev/null + fi + "$checker" -q $checker_arch_option "$cfg_output" "$tmp_dir" >> "$output" 2>&1 fi sed -e 's/[[:cntrl:]]$//g' < "$output" >"${td_expected}" good="yes" @@ -635,6 +740,9 @@ else "./${build}" $build_args >"$build_output" 2>&1 build_exit="$?" if [ "$build_exit" = '0' ]; then + if ! ulimit -S "$run_file_size_limit"; then + echo "ulimit file size setting failed" + fi echo "${test_dir}: running..." 1>&2 "./${run}" $run_args "$@" >"$output" 2>&1 run_exit="$?" @@ -642,7 +750,10 @@ else echo "run exit status: $run_exit" 1>&2 good_run="no" elif [ "$run_checker" = "yes" ]; then - "$checker" -q "$cfg_output" "$tmp_dir" >> "$output" 2>&1 + if [ "$target_mode" = "yes" ]; then + adb pull $cfg_output_dir/$cfg_output &> /dev/null + fi + "$checker" -q $checker_arch_option "$cfg_output" "$tmp_dir" >> "$output" 2>&1 checker_exit="$?" if [ "$checker_exit" != "0" ]; then echo "checker exit status: $checker_exit" 1>&2 @@ -684,6 +795,11 @@ fi echo '#################### diffs' diff --strip-trailing-cr -u "$expected" "$output" | tail -n 2000 echo '####################' + if [ "$strace" = "yes" ]; then + echo '#################### strace output' + tail -n 2000 "$tmp_dir/$strace_output" + echo '####################' + fi echo ' ' fi |