mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
Improved robustness of UL tests by removing reliance on "java -version" and replacing with explicit code to trigger logging in all environments Reviewed-by: dholmes, iklam, mockner
This commit is contained in:
parent
e8e6b0e6f0
commit
6ee07f50c8
11 changed files with 128 additions and 60 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
|
@ -40,7 +40,10 @@ public class ClassInitializationTest {
|
|||
public static void main(String... args) throws Exception {
|
||||
|
||||
// (1)
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:classinit=info", "-Xverify:all", "-Xmx64m", "BadMap50");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:classinit=info",
|
||||
"-Xverify:all",
|
||||
"-Xmx64m",
|
||||
"BadMap50");
|
||||
OutputAnalyzer out = new OutputAnalyzer(pb.start());
|
||||
out.shouldContain("Start class verification for:");
|
||||
out.shouldContain("End class verification for:");
|
||||
|
@ -50,16 +53,29 @@ public class ClassInitializationTest {
|
|||
|
||||
// (2)
|
||||
if (Platform.isDebugBuild()) {
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:classinit=info", "-Xverify:all", "-XX:+EagerInitialization", "-Xmx64m", "-version");
|
||||
out = new OutputAnalyzer(pb.start());
|
||||
out.shouldContain("[Initialized").shouldContain("without side effects]");
|
||||
out.shouldHaveExitValue(0);
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:classinit=info",
|
||||
"-Xverify:all",
|
||||
"-XX:+EagerInitialization",
|
||||
"-Xmx64m",
|
||||
InnerClass.class.getName());
|
||||
out = new OutputAnalyzer(pb.start());
|
||||
out.shouldContain("[Initialized").shouldContain("without side effects]");
|
||||
out.shouldHaveExitValue(0);
|
||||
}
|
||||
// (3) Ensure that VerboseVerification still triggers appropriate messages.
|
||||
pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:+VerboseVerification", "-Xverify:all", "-Xmx64m", "BadMap50");
|
||||
pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
|
||||
"-XX:+VerboseVerification",
|
||||
"-Xverify:all",
|
||||
"-Xmx64m",
|
||||
"BadMap50");
|
||||
out = new OutputAnalyzer(pb.start());
|
||||
out.shouldContain("End class verification for:");
|
||||
out.shouldContain("Verification for BadMap50 failed");
|
||||
out.shouldContain("Fail over class verification to old verifier for: BadMap50");
|
||||
}
|
||||
public static class InnerClass {
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("Inner Class");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,26 +58,28 @@ public class ClassResolutionTest {
|
|||
public static void main(String... args) throws Exception {
|
||||
|
||||
// (1) classresolve should turn on.
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:classresolve=info", ClassResolutionTestMain.class.getName());
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:classresolve=info",
|
||||
ClassResolutionTestMain.class.getName());
|
||||
OutputAnalyzer o = new OutputAnalyzer(pb.start());
|
||||
o.shouldContain("[classresolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1");
|
||||
|
||||
// (2) classresolve should turn off.
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog", "-Xlog:classresolve=off", ClassResolutionTestMain.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog",
|
||||
"-Xlog:classresolve=off",
|
||||
ClassResolutionTestMain.class.getName());
|
||||
o = new OutputAnalyzer(pb.start());
|
||||
o.shouldNotContain("[classresolve]");
|
||||
|
||||
// (3) TraceClassResolution should turn on.
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+TraceClassResolution", ClassResolutionTestMain.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceClassResolution",
|
||||
ClassResolutionTestMain.class.getName());
|
||||
o = new OutputAnalyzer(pb.start());
|
||||
o.shouldContain("[classresolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1");
|
||||
|
||||
// (4) TraceClassResolution should turn off.
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog", "-XX:-TraceClassResolution", ClassResolutionTestMain.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog",
|
||||
"-XX:-TraceClassResolution",
|
||||
ClassResolutionTestMain.class.getName());
|
||||
o = new OutputAnalyzer(pb.start());
|
||||
o.shouldNotContain("[classresolve]");
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
|
@ -26,7 +26,6 @@
|
|||
* @bug 8139564
|
||||
* @summary defaultmethods=debug should have logging from each of the statements in the code
|
||||
* @library /testlibrary
|
||||
* @ignore 8146435
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
|
||||
|
@ -38,8 +37,8 @@ import jdk.test.lib.ProcessTools;
|
|||
|
||||
public class DefaultMethodsTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:defaultmethods=debug", "-version");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:defaultmethods=debug",
|
||||
InnerClass.class.getName());
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Slots that need filling:");
|
||||
output.shouldContain("requires default method processing");
|
||||
|
@ -51,5 +50,11 @@ public class DefaultMethodsTest {
|
|||
output.shouldContain("default methods");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
public static class InnerClass {
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("Inner Class");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,28 +52,28 @@ public class ExceptionsTest {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:exceptions=info", "-Xcomp",
|
||||
"-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe",
|
||||
InternalClass.class.getName());
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:exceptions=info",
|
||||
"-Xcomp",
|
||||
"-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe",
|
||||
InternalClass.class.getName());
|
||||
analyzeOutputOn(pb);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+TraceExceptions", "-Xcomp",
|
||||
"-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe",
|
||||
InternalClass.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceExceptions",
|
||||
"-Xcomp",
|
||||
"-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe",
|
||||
InternalClass.class.getName());
|
||||
analyzeOutputOn(pb);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:exceptions=off", "-Xcomp",
|
||||
"-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe",
|
||||
InternalClass.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:exceptions=off",
|
||||
"-Xcomp",
|
||||
"-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe",
|
||||
InternalClass.class.getName());
|
||||
analyzeOutputOff(pb);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:-TraceExceptions", "-Xcomp",
|
||||
"-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe",
|
||||
InternalClass.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceExceptions",
|
||||
"-Xcomp",
|
||||
"-XX:CompileCommand=compileonly,ExceptionsTest$InternalClass::compileMe",
|
||||
InternalClass.class.getName());
|
||||
analyzeOutputOff(pb);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
|
@ -27,8 +27,8 @@
|
|||
* @summary itables=trace should have logging from each of the statements
|
||||
* in the code
|
||||
* @library /testlibrary
|
||||
* @ignore 8146435
|
||||
* @compile ClassB.java
|
||||
* ItablesVtableTest.java
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @run driver ItablesTest
|
||||
|
@ -39,12 +39,10 @@ import jdk.test.lib.*;
|
|||
public class ItablesTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (Platform.isDebugBuild()) {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:itables=trace", "ClassB");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ClassB");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain(": Initializing itables for ClassB");
|
||||
output.shouldContain(": Initializing itable indices for interface ");
|
||||
output.shouldContain("vtable index ");
|
||||
output.shouldContain("itable index ");
|
||||
output.shouldContain("target: ClassB.Method1()V, method_holder: ClassB target_method flags: public");
|
||||
output.shouldContain("invokeinterface resolved method: caller-class");
|
||||
|
@ -53,6 +51,11 @@ public class ItablesTest {
|
|||
output.shouldContain("invokeinterface selected method: receiver-class");
|
||||
output.shouldContain("Resolving: klass: ");
|
||||
output.shouldHaveExitValue(0);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ItablesVtableTest");
|
||||
output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("vtable index ");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
42
hotspot/test/runtime/logging/ItablesVtableTest.java
Normal file
42
hotspot/test/runtime/logging/ItablesVtableTest.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
interface Interface1 {
|
||||
public void foo();
|
||||
public int hashCode();
|
||||
}
|
||||
|
||||
public class ItablesVtableTest implements Interface1 {
|
||||
public void foo() {
|
||||
System.out.println("ItablesVtableTest foo");
|
||||
}
|
||||
public int hashCode() {
|
||||
return 55;
|
||||
}
|
||||
|
||||
public static void main(String[] unused) {
|
||||
ItablesVtableTest c = new ItablesVtableTest();
|
||||
c.foo();
|
||||
System.out.println("Interface1 hashCode " + c.hashCode());
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
|
@ -51,20 +51,20 @@ public class MonitorInflationTest {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:monitorinflation=debug", InnerClass.class.getName());
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:monitorinflation=debug",
|
||||
InnerClass.class.getName());
|
||||
analyzeOutputOn(pb);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+TraceMonitorInflation", InnerClass.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceMonitorInflation",
|
||||
InnerClass.class.getName());
|
||||
analyzeOutputOn(pb);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:monitorinflation=off", InnerClass.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-Xlog:monitorinflation=off",
|
||||
InnerClass.class.getName());
|
||||
analyzeOutputOff(pb);
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:-TraceMonitorInflation", InnerClass.class.getName());
|
||||
pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceMonitorInflation",
|
||||
InnerClass.class.getName());
|
||||
analyzeOutputOff(pb);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
|
@ -38,8 +38,8 @@ import jdk.test.lib.ProcessTools;
|
|||
|
||||
public class SafepointTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:safepoint=trace", InnerClass.class.getName());
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint=trace",
|
||||
InnerClass.class.getName());
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Safepoint synchronization initiated. (");
|
||||
output.shouldContain("Entering safepoint region: ");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016, 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
|
||||
|
@ -38,9 +38,10 @@ import jdk.test.lib.ProcessTools;
|
|||
|
||||
public class VMOperationTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:vmoperation=debug", "-Xmx64m", "-Xms64m",
|
||||
InternalClass.class.getName());
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:vmoperation=debug",
|
||||
"-Xmx64m",
|
||||
"-Xms64m",
|
||||
InternalClass.class.getName());
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("VM_Operation (");
|
||||
output.shouldHaveExitValue(0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
|
@ -41,8 +41,7 @@ import jdk.test.lib.*;
|
|||
public class VtablesTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (Platform.isDebugBuild()) {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:vtables=trace", "ClassB");
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:vtables=trace", "ClassB");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("copy vtable from ClassA to ClassB");
|
||||
output.shouldContain("Initializing: ClassB");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue