summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2015-10-26 10:11:58 -0700
committer Alex Light <allight@google.com> 2015-10-26 11:07:41 -0700
commit8a0e0330c35a92262717b63ed53b7c604b02ea07 (patch)
treeeda0a7ad532545790377013245239865fa140883
parenta5ae8f3c5a0fe0ed4e3d9946a6c9d06893359ac7 (diff)
Cleanup some of the run-test system
Make run-test cleaner when using experimental default methods and lambdas. Adds a --experimental <type> flag that adds the required experimental compiler and runtime flags. Change-Id: Ia9327b44e14597a400bf279fc946a43619f1355c
-rwxr-xr-xtest/955-lambda-smali/run2
-rwxr-xr-xtest/960-default-smali/build4
-rw-r--r--test/960-default-smali/info.txt11
-rwxr-xr-xtest/960-default-smali/run6
-rwxr-xr-xtest/961-default-iface-resolution-generated/build2
-rwxr-xr-xtest/961-default-iface-resolution-generated/run6
-rwxr-xr-xtest/962-iface-static/build2
-rwxr-xr-xtest/962-iface-static/run6
-rwxr-xr-xtest/963-default-range-smali/build2
-rwxr-xr-xtest/963-default-range-smali/run6
-rwxr-xr-xtest/964-default-iface-init-generated/build2
-rwxr-xr-xtest/964-default-iface-init-generated/run6
-rwxr-xr-xtest/etc/default-build2
-rwxr-xr-xtest/etc/run-test-jar15
-rwxr-xr-xtest/run-test1
-rwxr-xr-xtest/utils/python/generate_smali_main.py (renamed from test/960-default-smali/util-src/generate_smali.py)2
16 files changed, 36 insertions, 39 deletions
diff --git a/test/955-lambda-smali/run b/test/955-lambda-smali/run
index b7546801b9..2fb2f89f6b 100755
--- a/test/955-lambda-smali/run
+++ b/test/955-lambda-smali/run
@@ -15,4 +15,4 @@
# limitations under the License.
# Ensure that the lambda experimental opcodes are turned on for dalvikvm and dex2oat
-${RUN} "$@" --runtime-option -Xexperimental:lambdas -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:lambdas
+${RUN} "$@" --experimental lambdas
diff --git a/test/960-default-smali/build b/test/960-default-smali/build
index c7866878e9..06692f93b8 100755
--- a/test/960-default-smali/build
+++ b/test/960-default-smali/build
@@ -18,7 +18,7 @@
set -e
# Generate the smali Main.smali file or fail
-./util-src/generate_smali.py ./smali
+${ANDROID_BUILD_TOP}/art/test/utils/python/generate_smali_main.py ./smali
if [[ $@ == *"--jvm"* ]]; then
# Build the Java files if we are running a --jvm test
@@ -29,5 +29,5 @@ if [[ $@ == *"--jvm"* ]]; then
fi
# Build the smali files and make a dex
-${SMALI} -JXmx256m --experimental --api-level 23 --output classes.dex $(find smali -name '*.smali')
+${SMALI} -JXmx256m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali')
zip "$TEST_NAME.jar" classes.dex
diff --git a/test/960-default-smali/info.txt b/test/960-default-smali/info.txt
index eb596e2c9f..9583abbdc1 100644
--- a/test/960-default-smali/info.txt
+++ b/test/960-default-smali/info.txt
@@ -2,15 +2,16 @@ Smali-based tests for experimental interface default methods.
Obviously needs to run under ART or a Java 8 Language runtime and compiler.
-When run a Main.smali file will be generated by the util-src/generate_smali.py
-script. If we run with --jvm we will use the tools/extract-embedded-java script to
-turn the smali into equivalent Java using the embedded Java code.
+When run a Main.smali file will be generated by the
+test/utils/python/generate_smali_main.py script. If we run with --jvm we will
+use the tools/extract-embedded-java script to turn the smali into equivalent
+Java using the embedded Java code.
When updating be sure to write the equivalent Java code in comments of the smali
files.
-Care should be taken when updating the generate_smali.py script. It must always
-return equivalent output when run multiple times.
+Care should be taken when updating the generate_smali_main.py script. It must
+always return equivalent output when run multiple times.
To update the test files do the following steps:
<Add new classes/interfaces>
diff --git a/test/960-default-smali/run b/test/960-default-smali/run
index e378b061d9..22f68006e7 100755
--- a/test/960-default-smali/run
+++ b/test/960-default-smali/run
@@ -14,8 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if echo $@ | grep -q -- "--jvm"; then
- ${RUN} "$@"
-else
- ${RUN} "$@" --runtime-option -Xexperimental:default-methods -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:default-methods
-fi
+${RUN} --experimental default-methods "$@"
diff --git a/test/961-default-iface-resolution-generated/build b/test/961-default-iface-resolution-generated/build
index 707c17e1cf..5eb851fa68 100755
--- a/test/961-default-iface-resolution-generated/build
+++ b/test/961-default-iface-resolution-generated/build
@@ -40,7 +40,7 @@ if [[ $@ == *"--jvm"* ]]; then
fi
# Build the smali files and make a dex
-${SMALI} -JXmx512m --experimental --api-level 23 --output classes.dex $(find smali -name '*.smali')
+${SMALI} -JXmx512m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali')
zip $TEST_NAME.jar classes.dex
# Reset the ulimit back to its initial value
diff --git a/test/961-default-iface-resolution-generated/run b/test/961-default-iface-resolution-generated/run
index e378b061d9..22f68006e7 100755
--- a/test/961-default-iface-resolution-generated/run
+++ b/test/961-default-iface-resolution-generated/run
@@ -14,8 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if echo $@ | grep -q -- "--jvm"; then
- ${RUN} "$@"
-else
- ${RUN} "$@" --runtime-option -Xexperimental:default-methods -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:default-methods
-fi
+${RUN} --experimental default-methods "$@"
diff --git a/test/962-iface-static/build b/test/962-iface-static/build
index 5ad82f70d1..06bb3bdfb8 100755
--- a/test/962-iface-static/build
+++ b/test/962-iface-static/build
@@ -26,5 +26,5 @@ if [[ $@ == *"--jvm"* ]]; then
fi
# Build the smali files and make a dex
-${SMALI} -JXmx512m --experimental --api-level 23 --output classes.dex $(find smali -name '*.smali')
+${SMALI} -JXmx512m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali')
zip $TEST_NAME.jar classes.dex
diff --git a/test/962-iface-static/run b/test/962-iface-static/run
index e713708c18..d37737f3da 100755
--- a/test/962-iface-static/run
+++ b/test/962-iface-static/run
@@ -14,8 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if echo $@ | grep -q -- "--jvm"; then
- ${RUN} "$@"
-else
- ${RUN} "$@" --runtime-option -Xexperimental:default-methods -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:default-methods
-fi
+${RUN} --experimental default-methods "$@"
diff --git a/test/963-default-range-smali/build b/test/963-default-range-smali/build
index 5ad82f70d1..06bb3bdfb8 100755
--- a/test/963-default-range-smali/build
+++ b/test/963-default-range-smali/build
@@ -26,5 +26,5 @@ if [[ $@ == *"--jvm"* ]]; then
fi
# Build the smali files and make a dex
-${SMALI} -JXmx512m --experimental --api-level 23 --output classes.dex $(find smali -name '*.smali')
+${SMALI} -JXmx512m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali')
zip $TEST_NAME.jar classes.dex
diff --git a/test/963-default-range-smali/run b/test/963-default-range-smali/run
index e713708c18..d37737f3da 100755
--- a/test/963-default-range-smali/run
+++ b/test/963-default-range-smali/run
@@ -14,8 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if echo $@ | grep -q -- "--jvm"; then
- ${RUN} "$@"
-else
- ${RUN} "$@" --runtime-option -Xexperimental:default-methods -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:default-methods
-fi
+${RUN} --experimental default-methods "$@"
diff --git a/test/964-default-iface-init-generated/build b/test/964-default-iface-init-generated/build
index deef803813..b0fbe4bf47 100755
--- a/test/964-default-iface-init-generated/build
+++ b/test/964-default-iface-init-generated/build
@@ -38,7 +38,7 @@ if [[ $@ == *"--jvm"* ]]; then
fi
# Build the smali files and make a dex
-${SMALI} -JXmx512m --experimental --api-level 23 --output classes.dex $(find smali -name '*.smali')
+${SMALI} -JXmx512m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali')
zip $TEST_NAME.jar classes.dex
# Reset the ulimit back to its initial value
diff --git a/test/964-default-iface-init-generated/run b/test/964-default-iface-init-generated/run
index e378b061d9..22f68006e7 100755
--- a/test/964-default-iface-init-generated/run
+++ b/test/964-default-iface-init-generated/run
@@ -14,8 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if echo $@ | grep -q -- "--jvm"; then
- ${RUN} "$@"
-else
- ${RUN} "$@" --runtime-option -Xexperimental:default-methods -Xcompiler-option --runtime-arg -Xcompiler-option -Xexperimental:default-methods
-fi
+${RUN} --experimental default-methods "$@"
diff --git a/test/etc/default-build b/test/etc/default-build
index c92402b529..47432168de 100755
--- a/test/etc/default-build
+++ b/test/etc/default-build
@@ -96,7 +96,7 @@ fi
if [ -d smali ]; then
# Compile Smali classes
- ${SMALI} -JXmx256m --experimental --api-level 23 --output smali_classes.dex `find smali -name '*.smali'`
+ ${SMALI} -JXmx256m ${SMALI_ARGS} --output smali_classes.dex `find smali -name '*.smali'`
# Don't bother with dexmerger if we provide our own main function in a smali file.
if [ ${SKIP_DX_MERGER} = "false" ]; then
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index fbefa073c4..280b4bcd84 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -18,6 +18,7 @@ DALVIKVM="dalvikvm32"
DEBUGGER="n"
DEV_MODE="n"
DEX2OAT=""
+EXPERIMENTAL=""
FALSE_BIN="/system/bin/false"
FLAGS=""
GDB=""
@@ -196,6 +197,13 @@ while true; do
FLAGS="${FLAGS} -Xcompiler-option --compile-pic"
COMPILE_FLAGS="${COMPILE_FLAGS} --compile-pic"
shift
+ elif [ "x$1" = "x--experimental" ]; then
+ if [ "$#" -lt 2 ]; then
+ echo "missing --experimental option" 1>&2
+ exit 1
+ fi
+ EXPERIMENTAL="$EXPERIMENTAL $2"
+ shift 2
elif expr "x$1" : "x--" >/dev/null 2>&1; then
echo "unknown $0 option: $1" 1>&2
exit 1
@@ -204,6 +212,13 @@ while true; do
fi
done
+if [ "$USE_JVM" = "n" ]; then
+ for feature in ${EXPERIMENTAL}; do
+ FLAGS="${FLAGS} -Xexperimental:${feature}"
+ COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xexperimental:${feature}"
+ done
+fi
+
if [ "x$1" = "x" ] ; then
MAIN="Main"
else
diff --git a/test/run-test b/test/run-test
index 293779f7c3..5a43fb05c3 100755
--- a/test/run-test
+++ b/test/run-test
@@ -46,6 +46,7 @@ export RUN="${progdir}/etc/run-test-jar"
export DEX_LOCATION=/data/run-test/${test_dir}
export NEED_DEX="true"
export USE_JACK="false"
+export SMALI_ARGS="--experimental --api-level 23"
# If dx was not set by the environment variable, assume it is in the path.
if [ -z "$DX" ]; then
diff --git a/test/960-default-smali/util-src/generate_smali.py b/test/utils/python/generate_smali_main.py
index b2bf1f0761..d796d313c6 100755
--- a/test/960-default-smali/util-src/generate_smali.py
+++ b/test/utils/python/generate_smali_main.py
@@ -15,7 +15,7 @@
# limitations under the License.
"""
-Generate Smali Main file for test 960
+Generate Smali Main file from a classes.xml file.
"""
import os