Be able to run jvmti-stress on RI
This is useful for testing.
When running on RI no class redefinition is performed.
Test: ./test/run-test --dev --jvm --jvmti-stress 001-HelloWorld
Test: ./test/run-test --dev --jvm --jvmti-stress 902
Test: ./test/run-test --dev --jvm --jvmti-stress 986
Change-Id: If234ff553bf136312c5128d03b02b28f4ff94e3d
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 56cfd24..f8b008b 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -372,16 +372,18 @@
fi
if [[ "$JVMTI_STRESS" = "y" ]]; then
- if [[ "$USE_JVM" = "n" ]]; then
- plugin=libopenjdkjvmtid.so
- agent=libtistressd.so
- if [[ "$TEST_IS_NDEBUG" = "y" ]]; then
- agent=libtistress.so
- plugin=libopenjdkjvmti.so
- fi
+ plugin=libopenjdkjvmtid.so
+ agent=libtistressd.so
+ if [[ "$TEST_IS_NDEBUG" = "y" ]]; then
+ agent=libtistress.so
+ plugin=libopenjdkjvmti.so
+ fi
- file_1=$(mktemp --tmpdir=${DEX_LOCATION})
- file_2=$(mktemp --tmpdir=${DEX_LOCATION})
+ file_1=$(mktemp --tmpdir=${DEX_LOCATION})
+ file_2=$(mktemp --tmpdir=${DEX_LOCATION})
+ if [[ "$USE_JVM" = "y" ]]; then
+ FLAGS="${FLAGS} -agentpath:${ANDROID_HOST_OUT}/nativetest64/${agent}=/bin/false,${file_1},${file_2}"
+ else
# TODO Remove need for DEXTER_BINARY!
FLAGS="${FLAGS} -agentpath:${agent}=${DEXTER_BINARY},${file_1},${file_2}"
if [ "$IS_JVMTI_TEST" = "n" ]; then
diff --git a/test/ti-stress/stress.cc b/test/ti-stress/stress.cc
index e7d76dd..e8e3cc7 100644
--- a/test/ti-stress/stress.cc
+++ b/test/ti-stress/stress.cc
@@ -95,8 +95,8 @@
if (thread == nullptr) {
info.name = const_cast<char*>("<NULLPTR>");
} else if (jvmtienv->GetThreadInfo(thread, &info) != JVMTI_ERROR_NONE) {
- LOG(ERROR) << "Unable to get thread info!";
- return;
+ LOG(WARNING) << "Unable to get thread info!";
+ info.name = const_cast<char*>("<UNKNOWN THREAD>");
}
char *fname, *fsig, *fgen;
char *cname, *cgen;
@@ -185,7 +185,10 @@
LOG(INFO) << "manual load & initialization of class java/lang/VMClassLoader!";
jclass klass = jni_env->FindClass("java/lang/VMClassLoader");
if (klass == nullptr) {
- LOG(ERROR) << "Unable to find VMClassLoader class!";
+ // Probably on RI. Clear the exception so we can continue but don't mark vmclassloader as
+ // initialized.
+ LOG(WARNING) << "Unable to find VMClassLoader class!";
+ jni_env->ExceptionClear();
} else {
// GetMethodID is spec'd to cause the class to be initialized.
jni_env->GetMethodID(klass, "hashCode", "()I");