summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/595-profile-saving/profile-saving.cc5
-rw-r--r--test/595-profile-saving/src/Main.java31
-rw-r--r--test/README.md73
-rw-r--r--test/README.txt13
-rwxr-xr-xtest/run-all-tests241
5 files changed, 79 insertions, 284 deletions
diff --git a/test/595-profile-saving/profile-saving.cc b/test/595-profile-saving/profile-saving.cc
index 00aa944726..ae3dad80d0 100644
--- a/test/595-profile-saving/profile-saving.cc
+++ b/test/595-profile-saving/profile-saving.cc
@@ -48,9 +48,8 @@ extern "C" JNIEXPORT void JNICALL Java_Main_ensureProfileProcessing(JNIEnv*, jcl
ProfileSaver::ForceProcessProfiles();
}
-extern "C" JNIEXPORT jboolean JNICALL Java_Main_profileHasMethod(JNIEnv* env,
+extern "C" JNIEXPORT jboolean JNICALL Java_Main_presentInProfile(JNIEnv* env,
jclass,
- jboolean hot,
jstring filename,
jobject method) {
ScopedUtfChars filename_chars(env, filename);
@@ -59,7 +58,7 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_profileHasMethod(JNIEnv* env,
ObjPtr<mirror::Executable> exec = soa.Decode<mirror::Executable>(method);
ArtMethod* art_method = exec->GetArtMethod();
return ProfileSaver::HasSeenMethod(std::string(filename_chars.c_str()),
- hot != JNI_FALSE,
+ /*hot*/ true,
MethodReference(art_method->GetDexFile(),
art_method->GetDexMethodIndex()));
}
diff --git a/test/595-profile-saving/src/Main.java b/test/595-profile-saving/src/Main.java
index 197c4e74ff..18c0598bef 100644
--- a/test/595-profile-saving/src/Main.java
+++ b/test/595-profile-saving/src/Main.java
@@ -42,14 +42,6 @@ public class Main {
System.out.println("Class loader does not match boot class");
}
testAddMethodToProfile(file, bootMethod);
-
- // Test a sampled method that is only warm and not hot.
- Method reflectMethod = Main.class.getDeclaredMethod("testReflectionInvoke");
- reflectMethod.invoke(null);
- testSampledMethodInProfile(file, reflectMethod);
- if (staticObj == null) {
- throw new AssertionError("Object was not set");
- }
} finally {
if (file != null) {
file.delete();
@@ -57,38 +49,23 @@ public class Main {
}
}
- static Object staticObj = null;
-
- static void testReflectionInvoke() {
- staticObj = new Object();
- }
-
static void testAddMethodToProfile(File file, Method m) {
// Make sure we have a profile info for this method without the need to loop.
ensureProfilingInfo(m);
- // Make sure the profile gets processed.
+ // Make sure the profile gets saved.
ensureProfileProcessing();
// Verify that the profile was saved and contains the method.
- if (!profileHasMethod(true, file.getPath(), m)) {
+ if (!presentInProfile(file.getPath(), m)) {
throw new RuntimeException("Method with index " + m + " not in the profile");
}
}
- static void testSampledMethodInProfile(File file, Method m) {
- // Make sure the profile gets processed.
- ensureProfileProcessing();
- // Verify that the profile was saved and contains the method.
- if (!profileHasMethod(false, file.getPath(), m)) {
- throw new RuntimeException("Method with index " + m + " not sampled in the profile");
- }
- }
-
// Ensure a method has a profiling info.
public static native void ensureProfilingInfo(Method method);
// Ensures the profile saver does its usual processing.
public static native void ensureProfileProcessing();
- // Checks if the profile saver has the method as a warm/sampled method.
- public static native boolean profileHasMethod(boolean hot, String profile, Method method);
+ // Checks if the profiles saver knows about the method.
+ public static native boolean presentInProfile(String profile, Method method);
private static final String TEMP_FILE_NAME_PREFIX = "dummy";
private static final String TEMP_FILE_NAME_SUFFIX = "-file";
diff --git a/test/README.md b/test/README.md
new file mode 100644
index 0000000000..c68b40b135
--- /dev/null
+++ b/test/README.md
@@ -0,0 +1,73 @@
+# VM test harness
+
+There are two suites of tests in this directory: run-tests and gtests.
+
+The run-tests are identified by directories named with with a numeric
+prefix and containing an info.txt file. For most run tests, the
+sources are in the "src" subdirectory. Sources found in the "src2"
+directory are compiled separately but to the same output directory;
+this can be used to exercise "API mismatch" situations by replacing
+class files created in the first pass. The "src-ex" directory is
+built separately, and is intended for exercising class loaders.
+
+The gtests are in named directories and contain a .java source
+file.
+
+All tests in either suite can be run using the "art/test.py"
+script. Additionally, run-tests can be run individidually. All of the
+tests can be run on the build host, on a USB-attached device, or using
+the build host "reference implementation".
+
+To see command flags run:
+
+```sh
+$ art/test.py -h
+```
+
+## Running all tests on the build host
+
+```sh
+$ art/test.py --host
+```
+
+## Running all tests on the target device
+
+```sh
+$ art/test.py --target
+```
+
+## Running all gtests on the build host
+
+```sh
+$ art/test.py --host -g
+```
+
+## Running all gtests on the target device
+
+```sh
+$ art/test.py --target -g
+```
+
+## Running all run-tests on the build host
+
+```sh
+$ art/test.py --host -r
+```
+
+## Running all run-tests on the target device
+
+```sh
+$ art/test.py --target -r
+```
+
+## Running one run-test on the build host
+
+```sh
+$ art/test.py --host -r -t 001-HelloWorld
+```
+
+## Running one run-test on the target device
+
+```sh
+$ art/test.py --target -r -t 001-HelloWorld
+```
diff --git a/test/README.txt b/test/README.txt
deleted file mode 100644
index eb1ce36f5d..0000000000
--- a/test/README.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-VM test harness.
-
-Use "./run-all-tests" to run all tests, or "./run-test <number>" to run a
-single test. Run "./run-test" with no arguments to see command flags;
-in particular, the tests can be run on the desktop, on a USB-attached
-device, or using the desktop "reference implementation".
-
-
-For most tests, the sources are in the "src" subdirectory. Sources found
-in the "src2" directory are compiled separately but to the same output
-directory; this can be used to exercise "API mismatch" situations by
-replacing class files created in the first pass. The "src-ex" directory
-is built separately, and is intended for exercising class loaders.
diff --git a/test/run-all-tests b/test/run-all-tests
deleted file mode 100755
index a0d2f23aa4..0000000000
--- a/test/run-all-tests
+++ /dev/null
@@ -1,241 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2007 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.
-
-# Set up prog to be the path of this script, including following symlinks,
-# and set up progdir to be the fully-qualified pathname of its directory.
-prog="$0"
-while [ -h "${prog}" ]; do
- newProg=`/bin/ls -ld "${prog}"`
- newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
- if expr "x${newProg}" : 'x/' >/dev/null; then
- prog="${newProg}"
- else
- progdir=`dirname "${prog}"`
- prog="${progdir}/${newProg}"
- fi
-done
-oldwd=`pwd`
-progdir=`dirname "${prog}"`
-cd "${progdir}"
-progdir=`pwd`
-prog="${progdir}"/`basename "${prog}"`
-
-run_args=""
-usage="no"
-sequental="no"
-
-while true; do
- if [ "x$1" = "x--host" ]; then
- run_args="${run_args} --host"
- shift
- elif [ "x$1" = "x--use-java-home" ]; then
- run_args="${run_args} --use-java-home"
- shift
- elif [ "x$1" = "x--no-image" ]; then
- run_args="${run_args} --no-image"
- shift
- elif [ "x$1" = "x--optimizing" ]; then
- run_args="${run_args} --optimizing"
- shift
- elif [ "x$1" = "x--image" ]; then
- run_args="${run_args} --image"
- shift
- elif [ "x$1" = "x--never-clean" ]; then
- run_args="${run_args} --never-clean"
- shift
- elif [ "x$1" = "x--jvm" ]; then
- run_args="${run_args} --jvm"
- shift
- elif [ "x$1" = "x--debug" ]; then
- run_args="${run_args} --debug"
- shift
- elif [ "x$1" = "x--build-only" ]; then
- run_args="${run_args} --build-only"
- shift
- elif [ "x$1" = "x--build-with-jack" ]; then
- run_args="${run_args} --build-with-jack"
- shift
- elif [ "x$1" = "x--build-with-javac-dx" ]; then
- run_args="${run_args} --build-with-javac-dx"
- shift
- elif [ "x$1" = "x--dex2oat-swap" ]; then
- run_args="${run_args} --dex2oat-swap"
- shift
- elif [ "x$1" = "x--dalvik" ]; then
- run_args="${run_args} --dalvik"
- shift
- elif [ "x$1" = "x--debuggable" ]; then
- run_args="${run_args} --debuggable"
- shift
- elif [ "x$1" = "x--zygote" ]; then
- run_args="${run_args} --zygote"
- shift
- elif [ "x$1" = "x--interpreter" ]; then
- run_args="${run_args} --interpreter"
- shift
- elif [ "x$1" = "x--jit" ]; then
- run_args="${run_args} --jit"
- shift
- elif [ "x$1" = "x--verify-soft-fail" ]; then
- run_args="${run_args} --verify-soft-fail"
- shift
- elif [ "x$1" = "x--no-verify" ]; then
- run_args="${run_args} --no-verify"
- shift
- elif [ "x$1" = "x--no-optimize" ]; then
- run_args="${run_args} --no-optimize"
- shift
- elif [ "x$1" = "x--dev" ]; then
- run_args="${run_args} --dev"
- shift
- elif [ "x$1" = "x--update" ]; then
- run_args="${run_args} --update"
- shift
- elif [ "x$1" = "x--help" ]; then
- usage="yes"
- shift
- elif [ "x$1" = "x--seq" ]; then
- sequental="yes"
- shift
- elif [ "x$1" = "x-O" ]; then
- run_args="${run_args} -O"
- shift
- elif [ "x$1" = "x--64" ]; then
- run_args="${run_args} --64"
- shift
- elif [ "x$1" = "x--gcstress" ]; then
- run_args="${run_args} --gcstress"
- shift
- elif [ "x$1" = "x--gcverify" ]; then
- run_args="${run_args} --gcverify"
- shift
- elif [ "x$1" = "x--trace" ]; then
- run_args="${run_args} --trace"
- shift
- elif [ "x$1" = "x--relocate" ]; then
- run_args="${run_args} --relocate"
- shift
- elif [ "x$1" = "x--no-relocate" ]; then
- run_args="${run_args} --no-relocate"
- shift
- elif [ "x$1" = "x--no-prebuild" ]; then
- run_args="${run_args} --no-prebuild"
- shift;
- elif [ "x$1" = "x--prebuild" ]; then
- run_args="${run_args} --prebuild"
- shift;
- elif [ "x$1" = "x--no-dex2oat" ]; then
- run_args="${run_args} --no-dex2oat"
- shift;
- elif [ "x$1" = "x--no-patchoat" ]; then
- run_args="${run_args} --no-patchoat"
- shift;
- elif [ "x$1" = "x--always-clean" ]; then
- run_args="${run_args} --always-clean"
- shift
- elif [ "x$1" = "x--pic-test" ]; then
- run_args="${run_args} --pic-test"
- shift
- elif [ "x$1" = "x--pic-image" ]; then
- run_args="${run_args} --pic-image"
- shift
- elif [ "x$1" = "x--strace" ]; then
- run_args="${run_args} --strace"
- shift
- elif [ "x$1" = "x--random-profile" ]; then
- run_args="${run_args} --random-profile"
- shift
- elif expr "x$1" : "x--" >/dev/null 2>&1; then
- echo "unknown $0 option: $1" 1>&2
- usage="yes"
- break
- else
- break
- fi
-done
-
-if [ "$usage" = "yes" ]; then
- prog=`basename $prog`
- (
- echo "usage:"
- echo " $prog --help Print this message."
- echo " $prog [options] Run all tests with the given options."
- echo " Options are all passed to run-test; refer to that for " \
- "further documentation:"
- echo " --debug --dev --host --interpreter --jit --jvm --no-optimize"
- echo " --no-verify --verify-soft-fail -O --update --zygote --64"
- echo " --relocate --prebuild --always-clean --gcstress --gcverify"
- echo " --trace --no-patchoat --no-dex2oat --use-java-home --pic-image"
- echo " --pic-test --strace --debuggable --dalvik --dex2oat-swap"
- echo " --build-only --build-with-jack --build-with-javac-dx"
- echo " --never-clean --image --no-image --optimizing"
- echo " --no-relocate --no-prebuild"
- echo " Specific Runtime Options:"
- echo " --seq Run tests one-by-one, avoiding failures caused by busy CPU"
- ) 1>&2
- exit 1
-fi
-
-if [ "$sequental" == "yes" ]; then
- i=0
- for test_name in *; do
- if [ -d "$test_name" -a -r "$test_name" -a -r "$test_name/info.txt" ]; then
- ./run-test ${run_args} "$test_name"
- RES=$?
- test_pids[i]=i
- test_names[test_pids[i]]="$test_name"
- if [ "$RES" != "0" ]; then
- let failure_count+=1
- failed_test_names="$failed_test_names ${test_names[i]}"
- else
- let succeeded_count+=1
- fi
- let i+=1
- fi
- done
-else
- # start all the tests
- i=0
- for test_name in *; do
- if [ -d "$test_name" -a -r "$test_name" -a -r "$test_name/info.txt" ]; then
- ./run-test ${run_args} "$test_name" &
- test_pids[i]=$!
- test_names[test_pids[i]]="$test_name"
- let i+=1
- fi
- done
-
- # wait for all the tests, collecting the failures
- failure_count=0
- succeeded_count=0
- failed_test_names=""
- for pid in ${test_pids[@]}; do
- wait $pid
- if [ "$?" != "0" ]; then
- let failure_count+=1
- failed_test_names="$failed_test_names ${test_names[$pid]}[pid=$pid]"
- else
- let succeeded_count+=1
- fi
- done
-fi
-
-echo "succeeded tests: $succeeded_count"
-echo "failed tests: $failure_count"
-
-for i in $failed_test_names; do
- echo "failed: $i"
-done