summaryrefslogtreecommitdiffstats
path: root/test/run-test
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2015-01-15 19:07:08 +0000
committerDavid Brazdil <dbrazdil@google.com>2015-01-19 15:12:49 +0000
commit4846d13744f07e82571d2882acc823d811ec942d (patch)
tree8076f0fc13637500f1b9574fab1d44b32eeedf84 /test/run-test
parent1235c46dc5d5a329a9074e2168219a3e85ad6d48 (diff)
downloadart-4846d13744f07e82571d2882acc823d811ec942d.zip
art-4846d13744f07e82571d2882acc823d811ec942d.tar.gz
art-4846d13744f07e82571d2882acc823d811ec942d.tar.bz2
ART: Invoke Checker from run-test scripts
This patch moves Checker-based tests of the optimizing compiler into the art/test directory and modifies the run-test scripts to dump the CFG during compilation and to verify the graph using Checker as part of the "running" stage. Outputs generated by running the test and running Checker are concatenated and compared with expected.txt. Checker is invoked only if the test's name name matches the format "<number>-checker-*" and it's currently enabled only for optimizing + host configs. The tests are still invoked on other configs but without Checker. Change-Id: Ib24da808cd4bca66f07e0dbeb913a418065f2859
Diffstat (limited to 'test/run-test')
-rwxr-xr-xtest/run-test38
1 files changed, 34 insertions, 4 deletions
diff --git a/test/run-test b/test/run-test
index 2802b75..8ef3e3e 100755
--- a/test/run-test
+++ b/test/run-test
@@ -39,6 +39,7 @@ if [ -z "$TMPDIR" ]; then
else
tmp_dir="${TMPDIR}/$USER/${test_dir}"
fi
+checker="${progdir}/../tools/checker.py"
export JAVA="java"
export JAVAC="javac -g"
@@ -74,8 +75,10 @@ expected="expected.txt"
check_cmd="check"
output="output.txt"
build_output="build-output.txt"
+cfg_output="cfg-output.txt"
lib="libartd.so"
run_args="--quiet"
+build_args=""
prebuild_mode="yes"
target_mode="yes"
@@ -503,6 +506,21 @@ chmod 755 "$check_cmd"
export TEST_NAME=`basename ${test_dir}`
+# Tests named '<number>-checker-*' will also have their CFGs verified with
+# Checker when compiled with Optimizing on host.
+if [[ "$TEST_NAME" =~ ^[0-9]+-checker- ]]; then
+ # Build Checker DEX files without dx's optimizations so the input to dex2oat
+ # better resembles the Java source. We always build the DEX the same way, even
+ # 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" ]; then
+ run_checker="yes"
+ run_args="${run_args} -Xcompiler-option --dump-cfg=$tmp_dir/$cfg_output \
+ -Xcompiler-option -j1"
+ 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
if echo "$test_dir" | grep 089; then
@@ -518,7 +536,7 @@ good="no"
good_build="yes"
good_run="yes"
if [ "$dev_mode" = "yes" ]; then
- "./${build}" 2>&1
+ "./${build}" $build_args 2>&1
build_exit="$?"
echo "build exit status: $build_exit" 1>&2
if [ "$build_exit" = '0' ]; then
@@ -531,11 +549,14 @@ if [ "$dev_mode" = "yes" ]; then
fi
fi
elif [ "$update_mode" = "yes" ]; then
- "./${build}" >"$build_output" 2>&1
+ "./${build}" $build_args >"$build_output" 2>&1
build_exit="$?"
if [ "$build_exit" = '0' ]; then
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
+ fi
sed -e 's/[[:cntrl:]]$//g' < "$output" >"${td_expected}"
good="yes"
else
@@ -544,7 +565,7 @@ elif [ "$update_mode" = "yes" ]; then
fi
elif [ "$build_only" = "yes" ]; then
good="yes"
- "./${build}" >"$build_output" 2>&1
+ "./${build}" $build_args >"$build_output" 2>&1
build_exit="$?"
if [ "$build_exit" '!=' '0' ]; then
cp "$build_output" "$output"
@@ -559,7 +580,7 @@ elif [ "$build_only" = "yes" ]; then
find $tmp_dir -mindepth 1 ! -regex ".*/\(.*jar\|$output\|$expected\)" | xargs rm -rf
exit 0
else
- "./${build}" >"$build_output" 2>&1
+ "./${build}" $build_args >"$build_output" 2>&1
build_exit="$?"
if [ "$build_exit" = '0' ]; then
echo "${test_dir}: running..." 1>&2
@@ -568,6 +589,15 @@ else
if [ "$run_exit" != "0" ]; then
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
+ checker_exit="$?"
+ if [ "$checker_exit" != "0" ]; then
+ echo "checker exit status: $checker_exit" 1>&2
+ good_run="no"
+ else
+ good_run="yes"
+ fi
else
good_run="yes"
fi