Skip to content
Permalink
Browse files

8244141: use @requires and SkippedException in some hotspot/runtime t…

…ests

Reviewed-by: minqi, gziemski
  • Loading branch information
iignatev committed May 2, 2020
1 parent 2731d62 commit 47c30dbc166e2d5e4331e4bff53ae9ebfb51d03f
@@ -24,6 +24,7 @@
/**
* @test
* @requires vm.cds
* @requires vm.bits == 64
* @bug 8003424
* @summary Testing UseCompressedClassPointers with CDS
* @library /test/lib
@@ -35,31 +36,30 @@
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jtreg.SkippedException;

public class CDSCompressedKPtrs {
public static void main(String[] args) throws Exception {
ProcessBuilder pb;
if (Platform.is64bit()) {
pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UseCompressedClassPointers", "-XX:+UseCompressedOops",
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CDSCompressedKPtrs.jsa", "-Xshare:dump", "-Xlog:cds");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
try {
output.shouldContain("Loading classes to share");
output.shouldHaveExitValue(0);

pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UseCompressedClassPointers", "-XX:+UseCompressedOops",
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CDSCompressedKPtrs.jsa", "-Xshare:dump", "-Xlog:cds");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
try {
output.shouldContain("Loading classes to share");
output.shouldHaveExitValue(0);

pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UseCompressedClassPointers", "-XX:+UseCompressedOops",
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CDSCompressedKPtrs.jsa", "-Xshare:on", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldContain("sharing");
output.shouldHaveExitValue(0);
"-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CDSCompressedKPtrs.jsa", "-Xshare:on", "-version");
output = new OutputAnalyzer(pb.start());
output.shouldContain("sharing");
output.shouldHaveExitValue(0);

} catch (RuntimeException e) {
// Report 'passed' if CDS was turned off.
output.shouldContain("Unable to use shared archive");
output.shouldHaveExitValue(1);
}
} catch (RuntimeException e) {
output.shouldContain("Unable to use shared archive");
output.shouldHaveExitValue(1);
throw new SkippedException("CDS was turned off");
}
}
}
@@ -28,7 +28,6 @@
import java.util.regex.Pattern;

import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;

/*
@@ -37,19 +36,15 @@
* @summary SafeFetch32 and SafeFetchN do not work in error handling
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @requires vm.debug
* @requires vm.flavor != "zero"
* @author Thomas Stuefe (SAP)
* @run driver SafeFetchInErrorHandlingTest
*/

public class SafeFetchInErrorHandlingTest {


public static void main(String[] args) throws Exception {

if (!Platform.isDebugBuild() || Platform.isZero()) {
return;
}

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-Xmx100M",
@@ -27,6 +27,8 @@
* @bug 8065896
* @summary Synchronous signals during error reporting may terminate or hang VM process
* @library /test/lib
* @requires vm.debug
* @requires os.family != "windows"
* @author Thomas Stuefe (SAP)
* @modules java.base/jdk.internal.misc
* java.management
@@ -40,23 +42,12 @@
import java.util.regex.Pattern;

import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;

public class SecondaryErrorTest {


public static void main(String[] args) throws Exception {

// Do not execute for windows, nor for non-debug builds
if (Platform.isWindows()) {
return;
}

if (!Platform.isDebugBuild()) {
return;
}

ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-Xmx100M",
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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,25 +27,23 @@
* @bug 8163014
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @requires vm.bits == 64
* @compile LocalLongHelper.java
* @run driver LocalLongTest
*/

import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;

public class LocalLongTest {
public static void main(String... args) throws Exception {
if (Platform.is64bit()) {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xint",
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang.invoke=ALL-UNNAMED",
"LocalLongHelper");
OutputAnalyzer o = new OutputAnalyzer(pb.start());
o.shouldHaveExitValue(0);
}
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xint",
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang.invoke=ALL-UNNAMED",
"LocalLongHelper");
OutputAnalyzer o = new OutputAnalyzer(pb.start());
o.shouldHaveExitValue(0);
};
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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,6 +26,7 @@
* @bug 8141564
* @summary vtables=trace should have logging from each of the statements in the code
* @library /test/lib
* @requires vm.debug
* @compile ClassB.java
* p1/A.java
* p2/B.jcod
@@ -42,23 +43,21 @@

public class VtablesTest {
public static void main(String[] args) throws Exception {
if (Platform.isDebugBuild()) {
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");
output.shouldContain("adding ClassB.Method1()V");
output.shouldContain("] overriding with ClassB.Method2()V");
output.shouldContain("invokevirtual resolved method: caller-class:ClassB");
output.shouldContain("invokevirtual selected method: receiver-class:ClassB");
output.shouldContain("NOT overriding with p2.D.nooverride()V");
output.shouldHaveExitValue(0);
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");
output.shouldContain("adding ClassB.Method1()V");
output.shouldContain("] overriding with ClassB.Method2()V");
output.shouldContain("invokevirtual resolved method: caller-class:ClassB");
output.shouldContain("invokevirtual selected method: receiver-class:ClassB");
output.shouldContain("NOT overriding with p2.D.nooverride()V");
output.shouldHaveExitValue(0);

pb = ProcessTools.createJavaProcessBuilder("-Xlog:vtables=trace", "p1/C");
output = new OutputAnalyzer(pb.start());
output.shouldContain("transitive overriding superclass ");
output.shouldHaveExitValue(0);
}
pb = ProcessTools.createJavaProcessBuilder("-Xlog:vtables=trace", "p1/C");
output = new OutputAnalyzer(pb.start());
output.shouldContain("transitive overriding superclass ");
output.shouldHaveExitValue(0);
}
}

0 comments on commit 47c30db

Please sign in to comment.