8303921: serviceability/sa/UniqueVtableTest.java timed out
Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
parent
4486f1b720
commit
02a4ee206a
test/hotspot/jtreg
@ -123,7 +123,6 @@ serviceability/sa/ClhsdbPmap.java#core 8294316,8267433 macosx-x64
|
||||
serviceability/sa/ClhsdbPstack.java#core 8294316,8267433 macosx-x64
|
||||
serviceability/sa/TestJmapCore.java 8294316,8267433 macosx-x64
|
||||
serviceability/sa/TestJmapCoreMetaspace.java 8294316,8267433 macosx-x64
|
||||
serviceability/sa/UniqueVtableTest.java 8303921 generic-all
|
||||
|
||||
serviceability/attach/ConcAttachTest.java 8290043 linux-all
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,7 +35,6 @@ import jtreg.SkippedException;
|
||||
* @bug 8190307
|
||||
* @requires vm.hasSA
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.apps.*
|
||||
* @run main/othervm TestIntConstant
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,6 @@ import jtreg.SkippedException;
|
||||
* @library /test/lib
|
||||
* @requires vm.hasSA
|
||||
* @requires vm.flavor == "server" & !vm.emulatedClient & !(vm.opt.TieredStopAtLevel == 1)
|
||||
* @build jdk.test.lib.apps.*
|
||||
* @run main/othervm TestPrintMdo
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,7 +35,6 @@ import jtreg.SkippedException;
|
||||
* @bug 8190307
|
||||
* @requires vm.hasSA
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.apps.*
|
||||
* @run main/othervm TestType
|
||||
*/
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,7 +37,6 @@ import jdk.test.whitebox.gc.GC;
|
||||
* @requires vm.hasSA
|
||||
* @bug 8190307
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.apps.*
|
||||
* @build jdk.test.whitebox.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
|
||||
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse
|
||||
|
@ -31,7 +31,7 @@
|
||||
* jdk.hotspot.agent/sun.jvm.hotspot.types
|
||||
* jdk.hotspot.agent/sun.jvm.hotspot.types.basic
|
||||
*
|
||||
* @run main/othervm UniqueVtableTest
|
||||
* @run driver UniqueVtableTest
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -46,16 +46,13 @@ import sun.jvm.hotspot.types.Type;
|
||||
import sun.jvm.hotspot.types.basic.BasicTypeDataBase;
|
||||
|
||||
import jdk.test.lib.apps.LingeredApp;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.SA.SATestUtils;
|
||||
|
||||
|
||||
public class UniqueVtableTest {
|
||||
|
||||
private HotSpotAgent agent;
|
||||
|
||||
public UniqueVtableTest() {
|
||||
}
|
||||
|
||||
private static String type2String(Type t) {
|
||||
return t + " (extends " + t.getSuperclass() + ")";
|
||||
}
|
||||
@ -64,20 +61,36 @@ public class UniqueVtableTest {
|
||||
System.out.println(o);
|
||||
}
|
||||
|
||||
private void attach(long pid) throws Throwable {
|
||||
agent = new HotSpotAgent();
|
||||
private static void runTest(long pid) throws Throwable {
|
||||
HotSpotAgent agent = new HotSpotAgent();
|
||||
log("Attaching to process ID " + pid + "...");
|
||||
agent.attach((int) pid);
|
||||
log("Attached successfully.");
|
||||
}
|
||||
|
||||
private void detach() {
|
||||
if (agent != null) {
|
||||
agent.detach();
|
||||
Throwable reasonToFail = null;
|
||||
|
||||
try {
|
||||
runTest(agent);
|
||||
} catch (Throwable ex) {
|
||||
reasonToFail = ex;
|
||||
} finally {
|
||||
try {
|
||||
agent.detach();
|
||||
} catch (Exception ex) {
|
||||
log("detach error:");
|
||||
ex.printStackTrace(System.out);
|
||||
// do not override original error
|
||||
if (reasonToFail != null) {
|
||||
reasonToFail = ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reasonToFail != null) {
|
||||
throw reasonToFail;
|
||||
}
|
||||
}
|
||||
|
||||
private void runTest() throws Throwable {
|
||||
private static void runTest(HotSpotAgent agent) throws Throwable {
|
||||
Map<Address, List<Type>> vtableToTypesMap = new HashMap<>();
|
||||
Iterator<Type> it = agent.getTypeDataBase().getTypes();
|
||||
int dupsFound = 0;
|
||||
@ -131,26 +144,31 @@ public class UniqueVtableTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void run() throws Throwable {
|
||||
private static void createAnotherToAttach(long lingeredAppPid) throws Throwable {
|
||||
// Start a new process to attach to the lingered app
|
||||
ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(
|
||||
"--add-modules=jdk.hotspot.agent",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.types=ALL-UNNAMED",
|
||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.types.basic=ALL-UNNAMED",
|
||||
"UniqueVtableTest",
|
||||
Long.toString(lingeredAppPid));
|
||||
SATestUtils.addPrivilegesIfNeeded(processBuilder);
|
||||
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
||||
output.shouldHaveExitValue(0);
|
||||
System.out.println(output.getOutput());
|
||||
}
|
||||
|
||||
private static void runMain() throws Throwable {
|
||||
Throwable reasonToFail = null;
|
||||
LingeredApp app = null;
|
||||
try {
|
||||
app = LingeredApp.startApp();
|
||||
attach(app.getPid());
|
||||
runTest();
|
||||
createAnotherToAttach(app.getPid());
|
||||
} catch (Throwable ex) {
|
||||
reasonToFail = ex;
|
||||
} finally {
|
||||
try {
|
||||
detach();
|
||||
} catch (Exception ex) {
|
||||
log("detach error:");
|
||||
ex.printStackTrace(System.out);
|
||||
// do not override original error
|
||||
if (reasonToFail != null) {
|
||||
reasonToFail = ex;
|
||||
}
|
||||
}
|
||||
try {
|
||||
LingeredApp.stopApp(app);
|
||||
} catch (Exception ex) {
|
||||
@ -170,9 +188,13 @@ public class UniqueVtableTest {
|
||||
public static void main(String... args) throws Throwable {
|
||||
SATestUtils.skipIfCannotAttach(); // throws SkippedException if attach not expected to work.
|
||||
|
||||
UniqueVtableTest test = new UniqueVtableTest();
|
||||
|
||||
test.run();
|
||||
if (args == null || args.length == 0) {
|
||||
// Main test process.
|
||||
runMain();
|
||||
} else {
|
||||
// Sub-process to attach, arg[0] is the target process pid.
|
||||
runTest(Long.parseLong(args[0]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user