Revert test changes for post startup methods change
Test is still flaky.
Bug: 63635729
Test: test/run-test --host 595-profile-saving
Change-Id: I77d40fcd033869e3f5396e6824255856276f5812
diff --git a/test/595-profile-saving/profile-saving.cc b/test/595-profile-saving/profile-saving.cc
index 00aa944..ae3dad8 100644
--- a/test/595-profile-saving/profile-saving.cc
+++ b/test/595-profile-saving/profile-saving.cc
@@ -48,9 +48,8 @@
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 @@
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 197c4e7..18c0598 100644
--- a/test/595-profile-saving/src/Main.java
+++ b/test/595-profile-saving/src/Main.java
@@ -42,14 +42,6 @@
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 @@
}
}
- 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";