summaryrefslogtreecommitdiffstats
path: root/test/etc
diff options
context:
space:
mode:
authorjeffhao <jeffhao@google.com>2011-09-29 17:41:15 -0700
committerjeffhao <jeffhao@google.com>2011-09-29 17:41:15 -0700
commit5d1ac920fdaef5d4ec8f66bb734488cd9660b024 (patch)
treedd372f306ab70f4c86759869b1f74eca62ff6f2b /test/etc
parentc31664f3d82e6cd68275a529a8a73f067a52e8be (diff)
downloadart-5d1ac920fdaef5d4ec8f66bb734488cd9660b024.zip
art-5d1ac920fdaef5d4ec8f66bb734488cd9660b024.tar.gz
art-5d1ac920fdaef5d4ec8f66bb734488cd9660b024.tar.bz2
Adding old unit tests to test suite.
These tests are copied straight over. They'll still run, but they're using the old system. Change-Id: If494519e52ddf858a9febfc55bdae830468cb3c8
Diffstat (limited to 'test/etc')
-rwxr-xr-xtest/etc/default-build43
-rwxr-xr-xtest/etc/default-run17
-rwxr-xr-xtest/etc/host-run-test-jar159
-rwxr-xr-xtest/etc/push-and-run-test-jar135
-rwxr-xr-xtest/etc/reference-run-test-classes60
5 files changed, 414 insertions, 0 deletions
diff --git a/test/etc/default-build b/test/etc/default-build
new file mode 100755
index 0000000..b8df442
--- /dev/null
+++ b/test/etc/default-build
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Stop if something fails.
+set -e
+
+mkdir classes
+${JAVAC} -d classes `find src -name '*.java'`
+
+if [ -r src2 ]; then
+ ${JAVAC} -d classes `find src2 -name '*.java'`
+fi
+
+dx -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex \
+ --dump-width=1000 classes
+zip test.jar classes.dex
+
+if [ -r src-ex ]; then
+ mkdir classes-ex
+ ${JAVAC} -d classes-ex -cp classes `find src-ex -name '*.java'`
+ dx -JXmx256m --debug --dex --dump-to=classes-ex.lst \
+ --output=classes-ex.dex --dump-width=1000 classes-ex
+
+ # quick shuffle so that the stored name is "classes.dex"
+ mv classes.dex classes-1.dex
+ mv classes-ex.dex classes.dex
+ zip test-ex.jar classes.dex
+ mv classes.dex classes-ex.dex
+ mv classes-1.dex classes.dex
+fi
diff --git a/test/etc/default-run b/test/etc/default-run
new file mode 100755
index 0000000..ecbbbc7
--- /dev/null
+++ b/test/etc/default-run
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+exec ${RUN} "$@"
diff --git a/test/etc/host-run-test-jar b/test/etc/host-run-test-jar
new file mode 100755
index 0000000..d3c0fd5
--- /dev/null
+++ b/test/etc/host-run-test-jar
@@ -0,0 +1,159 @@
+#!/bin/sh
+#
+# Run the code in test.jar using the host-mode virtual machine. The jar should
+# contain a top-level class named Main to run.
+#
+# Options:
+# --quiet -- don't chatter
+# --fast -- use the fast interpreter (the default)
+# --jit -- use the jit
+# --portable -- use the portable interpreter
+# --debug -- wait for debugger to attach
+# --valgrind -- use valgrind
+# --no-verify -- turn off verification (on by default)
+# --no-optimize -- turn off optimization (on by default)
+
+msg() {
+ if [ "$QUIET" = "n" ]; then
+ echo "$@"
+ fi
+}
+
+INTERP=""
+DEBUG="n"
+GDB="n"
+VERIFY="y"
+OPTIMIZE="y"
+VALGRIND="n"
+DEV_MODE="n"
+QUIET="n"
+PRECISE="y"
+
+while true; do
+ if [ "x$1" = "x--quiet" ]; then
+ QUIET="y"
+ shift
+ elif [ "x$1" = "x--jit" ]; then
+ INTERP="jit"
+ msg "Using jit"
+ shift
+ elif [ "x$1" = "x--fast" ]; then
+ INTERP="fast"
+ msg "Using fast interpreter"
+ shift
+ elif [ "x$1" = "x--portable" ]; then
+ INTERP="portable"
+ msg "Using portable interpreter"
+ shift
+ elif [ "x$1" = "x--debug" ]; then
+ DEBUG="y"
+ shift
+ elif [ "x$1" = "x--gdb" ]; then
+ GDB="y"
+ shift
+ elif [ "x$1" = "x--valgrind" ]; then
+ VALGRIND="y"
+ shift
+ elif [ "x$1" = "x--dev" ]; then
+ DEV_MODE="y"
+ shift
+ elif [ "x$1" = "x--no-verify" ]; then
+ VERIFY="n"
+ shift
+ elif [ "x$1" = "x--no-optimize" ]; then
+ OPTIMIZE="n"
+ shift
+ elif [ "x$1" = "x--no-precise" ]; then
+ PRECISE="n"
+ shift
+ elif [ "x$1" = "x--" ]; then
+ shift
+ break
+ elif expr "x$1" : "x--" >/dev/null 2>&1; then
+ echo "unknown option: $1" 1>&2
+ exit 1
+ else
+ break
+ fi
+done
+
+if [ "x$INTERP" = "x" ]; then
+ INTERP="fast"
+ msg "Using fast interpreter by default"
+fi
+
+if [ "$OPTIMIZE" = "y" ]; then
+ if [ "$VERIFY" = "y" ]; then
+ DEX_OPTIMIZE="-Xdexopt:verified"
+ else
+ DEX_OPTIMIZE="-Xdexopt:all"
+ fi
+ msg "Performing optimizations"
+else
+ DEX_OPTIMIZE="-Xdexopt:none"
+ msg "Skipping optimizations"
+fi
+
+if [ "$VERIFY" = "y" ]; then
+ DEX_VERIFY=""
+ msg "Performing verification"
+else
+ DEX_VERIFY="-Xverify:none"
+ msg "Skipping verification"
+fi
+
+if [ "$VALGRIND" = "y" ]; then
+ msg "Running with valgrind"
+ valgrind_cmd="valgrind"
+ #valgrind_cmd="valgrind --leak-check=full"
+else
+ valgrind_cmd=""
+fi
+
+if [ "$PRECISE" = "y" ]; then
+ GC_OPTS="-Xgc:precise -Xgenregmap"
+else
+ GC_OPTS="-Xgc:noprecise"
+fi
+
+msg "------------------------------"
+
+HOSTBASE="${ANDROID_BUILD_TOP}/out/host"
+BASE="$OUT" # from build environment
+DATA_DIR=/tmp
+DEBUG_OPTS="-Xcheck:jni -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
+
+if [ ! -d $DATA_DIR/dalvik-cache ]; then
+ mkdir -p $DATA_DIR/dalvik-cache
+ [[ $? -ne 0 ]] && exit
+fi
+
+export ANDROID_PRINTF_LOG=brief
+if [ "$DEV_MODE" = "y" ]; then
+ export ANDROID_LOG_TAGS='*:d'
+else
+ export ANDROID_LOG_TAGS='*:s'
+fi
+export ANDROID_DATA="$DATA_DIR"
+export ANDROID_ROOT="${HOSTBASE}/linux-x86"
+export LD_LIBRARY_PATH="${ANDROID_ROOT}/lib"
+export DYLD_LIBRARY_PATH="${ANDROID_ROOT}/lib"
+
+exe="${ANDROID_ROOT}/bin/dalvikvm"
+framework="${BASE}/system/framework"
+bpath="${framework}/core.jar:${framework}/ext.jar:${framework}/framework.jar"
+
+if [ "$DEBUG" = "y" ]; then
+ PORT=8000
+ msg "Waiting for debugger to connect on localhost:$PORT"
+ DEX_DEBUG="-agentlib:jdwp=transport=dt_socket,addres=$PORT,server=y,suspend=y"
+fi
+
+if [ "$GDB" = "y" ]; then
+ gdb=gdb
+ gdbargs="--args $exe"
+fi
+
+$valgrind_cmd $gdb $exe $gdbargs "-Xbootclasspath:${bpath}" \
+ $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG $GC_OPTS "-Xint:${INTERP}" -ea \
+ -cp test.jar Main "$@"
diff --git a/test/etc/push-and-run-test-jar b/test/etc/push-and-run-test-jar
new file mode 100755
index 0000000..e2fde42
--- /dev/null
+++ b/test/etc/push-and-run-test-jar
@@ -0,0 +1,135 @@
+#!/bin/sh
+#
+# Run the code in test.jar on the device. The jar should contain a top-level
+# class named Main to run.
+#
+# Options:
+# --quiet -- don't chatter
+# --fast -- use the fast interpreter (the default)
+# --jit -- use the jit
+# --portable -- use the portable interpreter
+# --debug -- wait for debugger to attach
+# --zygote -- use the zygote (if so, all other options are ignored)
+# --dev -- development mode (print the vm invocation cmdline)
+# --no-verify -- turn off verification (on by default)
+# --no-optimize -- turn off optimization (on by default)
+# --no-precise -- turn off precise GC (on by default)
+
+msg() {
+ if [ "$QUIET" = "n" ]; then
+ echo "$@"
+ fi
+}
+
+INTERP=""
+DEBUG="n"
+VERIFY="y"
+OPTIMIZE="y"
+ZYGOTE="n"
+QUIET="n"
+PRECISE="y"
+DEV_MODE="n"
+
+while true; do
+ if [ "x$1" = "x--quiet" ]; then
+ QUIET="y"
+ shift
+ elif [ "x$1" = "x--fast" ]; then
+ INTERP="fast"
+ msg "Using fast interpreter"
+ shift
+ elif [ "x$1" = "x--jit" ]; then
+ INTERP="jit"
+ msg "Using jit"
+ shift
+ elif [ "x$1" = "x--portable" ]; then
+ INTERP="portable"
+ msg "Using portable interpreter"
+ shift
+ elif [ "x$1" = "x--debug" ]; then
+ DEBUG="y"
+ shift
+ elif [ "x$1" = "x--zygote" ]; then
+ ZYGOTE="y"
+ msg "Spawning from zygote"
+ shift
+ elif [ "x$1" = "x--dev" ]; then
+ DEV_MODE="y"
+ shift
+ elif [ "x$1" = "x--no-verify" ]; then
+ VERIFY="n"
+ shift
+ elif [ "x$1" = "x--no-optimize" ]; then
+ OPTIMIZE="n"
+ shift
+ elif [ "x$1" = "x--no-precise" ]; then
+ PRECISE="n"
+ shift
+ elif [ "x$1" = "x--" ]; then
+ shift
+ break
+ elif expr "x$1" : "x--" >/dev/null 2>&1; then
+ echo "unknown option: $1" 1>&2
+ exit 1
+ else
+ break
+ fi
+done
+
+if [ "$ZYGOTE" = "n" ]; then
+ if [ "x$INTERP" = "x" ]; then
+ INTERP="fast"
+ msg "Using fast interpreter by default"
+ fi
+
+ if [ "$OPTIMIZE" = "y" ]; then
+ if [ "$VERIFY" = "y" ]; then
+ DEX_OPTIMIZE="-Xdexopt:verified"
+ else
+ DEX_OPTIMIZE="-Xdexopt:all"
+ fi
+ msg "Performing optimizations"
+ else
+ DEX_OPTIMIZE="-Xdexopt:none"
+ msg "Skipping optimizations"
+ fi
+
+ if [ "$VERIFY" = "y" ]; then
+ DEX_VERIFY=""
+ msg "Performing verification"
+ else
+ DEX_VERIFY="-Xverify:none"
+ msg "Skipping verification"
+ fi
+fi
+
+msg "------------------------------"
+
+if [ "$QUIET" = "n" ]; then
+ adb push test.jar /data
+ adb push test-ex.jar /data
+else
+ adb push test.jar /data >/dev/null 2>&1
+ adb push test-ex.jar /data >/dev/null 2>&1
+fi
+
+if [ "$DEBUG" = "y" ]; then
+ DEX_DEBUG="-agentlib:jdwp=transport=dt_android_adb,server=y,suspend=y"
+fi
+
+if [ "$PRECISE" = "y" ]; then
+ GC_OPTS="-Xgc:precise -Xgenregmap"
+else
+ GC_OPTS="-Xgc:noprecise"
+fi
+
+if [ "$ZYGOTE" = "y" ]; then
+ adb shell cd /data \; dvz -classpath test.jar Main "$@"
+else
+ cmdline="cd /data; dalvikvm $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG \
+ $GC_OPTS -cp test.jar -Xint:${INTERP} -ea Main"
+ if [ "$DEV_MODE" = "y" ]; then
+ echo $cmdline "$@"
+ fi
+ adb shell $cmdline "$@"
+fi
diff --git a/test/etc/reference-run-test-classes b/test/etc/reference-run-test-classes
new file mode 100755
index 0000000..94c8050
--- /dev/null
+++ b/test/etc/reference-run-test-classes
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Run the code in a classes directory on a host-local reference virtual
+# machine. The jar should contain a top-level class named Main to run.
+#
+# Options:
+# --quiet -- don't chatter
+# --debug -- wait for debugger to attach
+# --no-verify -- turn off verification (on by default)
+# --dev -- development mode
+
+msg() {
+ if [ "$QUIET" = "n" ]; then
+ echo "$@"
+ fi
+}
+
+DEBUG="n"
+QUIET="n"
+VERIFY="y"
+
+while true; do
+ if [ "x$1" = "x--quiet" ]; then
+ QUIET="y"
+ shift
+ elif [ "x$1" = "x--debug" ]; then
+ DEBUG="y"
+ shift
+ elif [ "x$1" = "x--no-verify" ]; then
+ VERIFY="n"
+ shift
+ elif [ "x$1" = "x--dev" ]; then
+ # not used; ignore
+ shift
+ elif [ "x$1" = "x--" ]; then
+ shift
+ break
+ elif expr "x$1" : "x--" >/dev/null 2>&1; then
+ echo "unknown option: $1" 1>&2
+ exit 1
+ else
+ break
+ fi
+done
+
+if [ "$VERIFY" = "y" ]; then
+ VERIFY_ARG="-Xverify:all"
+ msg "Performing verification"
+else
+ VERIFY_ARG="-Xverify:none"
+ msg "Skipping verification"
+fi
+
+if [ "$DEBUG" = "y" ]; then
+ PORT=8000
+ msg "Waiting for debugger to connect on localhost:$PORT"
+ DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y"
+fi
+
+${JAVA} ${DEBUG_OPTS} -ea ${VERIFY_ARG} -classpath classes Main "$@"