8208655: use JTreg skipped status in hotspot tests

Reviewed-by: kvn, hseigel, iklam
This commit is contained in:
Igor Ignatyev 2018-08-02 14:40:55 -07:00
parent 43e1256928
commit 17891770c1
38 changed files with 297 additions and 281 deletions

@ -65,7 +65,7 @@ requires.properties= \
docker.support
# Minimum jtreg version
requiredVersion=4.2 b12
requiredVersion=4.2 b13
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../../ notation to reach them

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -44,6 +44,7 @@ import jdk.test.lib.Asserts;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jtreg.SkippedException;
import java.io.IOException;
import java.lang.reflect.Executable;
@ -119,12 +120,11 @@ public class SegmentedCodeCacheDtraceTest {
}
public static void main(String args[]) {
if (!DtraceRunner.dtraceAvailable()) {
throw new SkippedException("There is no dtrace avaiable.");
}
int iterations
= Integer.getInteger("jdk.test.lib.iterations", 1);
if (!DtraceRunner.dtraceAvailable()) {
System.out.println("INFO: There is no dtrace avaiable. Skipping.");
return;
}
int[] availableLevels = CompilerUtils.getAvailableCompilationLevels();
// adding one more entry(zero) for interpeter
availableLevels

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -96,6 +96,7 @@ import jdk.vm.ci.code.stack.InspectedFrame;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jtreg.SkippedException;
import sun.hotspot.WhiteBox;
import java.lang.reflect.Method;
@ -143,11 +144,10 @@ public class MaterializeVirtualObjectTest {
int levels[] = CompilerUtils.getAvailableCompilationLevels();
// we need compilation level 4 to use EscapeAnalysis
if (levels.length < 1 || levels[levels.length - 1] != 4) {
System.out.println("INFO: Test needs compilation level 4 to"
+ " be available. Skipping.");
} else {
new MaterializeVirtualObjectTest().test();
throw new SkippedException("Test needs compilation level 4");
}
new MaterializeVirtualObjectTest().test();
}
private static String getName() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -46,7 +46,9 @@ import java.util.concurrent.Callable;
public class ConstantGettersTransitionsTest extends LevelTransitionTest {
public static void main(String[] args) {
assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
throw new SkippedException("Test isn't applicable for non-tiered mode");
}
// run test cases
for (TestCase testCase : ConstantGettersTestCase.values()) {

@ -43,6 +43,7 @@ package compiler.tiered;
import compiler.whitebox.CompilerWhiteBoxTest;
import compiler.whitebox.SimpleTestCase;
import jtreg.SkippedException;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
@ -57,7 +58,9 @@ public class LevelTransitionTest extends TieredLevelsTest {
private int transitionCount;
public static void main(String[] args) throws Throwable {
assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
throw new SkippedException("Test isn't applicable for non-tiered mode");
}
CompilerWhiteBoxTest.main(LevelTransitionTest::new, args);
// run extended test cases

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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
@ -42,6 +42,7 @@ package compiler.tiered;
import java.util.function.IntPredicate;
import compiler.whitebox.CompilerWhiteBoxTest;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
public class NonTieredLevelsTest extends CompLevelsTest {
private static final int AVAILABLE_COMP_LEVEL;
@ -60,7 +61,7 @@ public class NonTieredLevelsTest extends CompLevelsTest {
}
public static void main(String[] args) throws Exception {
if (CompilerWhiteBoxTest.skipOnTieredCompilation(true)) {
return;
throw new SkippedException("Test isn't applicable for tiered mode");
}
CompilerWhiteBoxTest.main(NonTieredLevelsTest::new, args);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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,11 +40,12 @@
package compiler.tiered;
import compiler.whitebox.CompilerWhiteBoxTest;
import jtreg.SkippedException;
public class TieredLevelsTest extends CompLevelsTest {
public static void main(String[] args) throws Throwable {
if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
return;
throw new SkippedException("Test isn't applicable for non-tiered mode");
}
CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018, 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,6 +38,7 @@ import javax.management.ObjectName;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
public class TestAggressiveHeap {
@ -88,9 +89,7 @@ public class TestAggressiveHeap {
private static boolean canUseAggressiveHeapOption() throws Exception {
if (!haveRequiredMemory()) {
System.out.println(
"Skipping test of " + option + " : insufficient memory");
return false;
throw new SkippedException("Skipping test of " + option + " : insufficient memory");
}
return true;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -43,6 +43,7 @@ import java.util.List;
import java.text.NumberFormat;
import gc.testlibrary.Helpers;
import static jdk.test.lib.Asserts.*;
import jtreg.SkippedException;
public class TestHumongousShrinkHeap {
@ -61,13 +62,11 @@ public class TestHumongousShrinkHeap {
public static void main(String[] args) {
if (HUMON_COUNT == 0) {
System.out.println("Skipped. Heap is too small");
return;
throw new SkippedException("Heap is too small");
}
if (TOTAL_MEMORY + REGION_SIZE * HUMON_COUNT > MAX_MEMORY) {
System.out.println("Skipped. Initial heap size is to close to max heap size.");
return;
throw new SkippedException("Initial heap size is to close to max heap size.");
}
System.out.format("Running with %s initial heap size of %s maximum heap size. "

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -43,6 +43,7 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
import sun.hotspot.WhiteBox;
public class TestLargePageUseForAuxMemory {
@ -134,13 +135,11 @@ public class TestLargePageUseForAuxMemory {
final long heapAlignment = lcm(cardSize * smallPageSize, largePageSize);
if (largePageSize == 0) {
System.out.println("Skip tests because large page support does not seem to be available on this platform.");
return;
throw new SkippedException("Large page support does not seem to be available on this platform.");
}
if (largePageSize == smallPageSize) {
System.out.println("Skip tests because large page support does not seem to be available on this platform." +
"Small and large page size are the same.");
return;
throw new SkippedException("Large page support does not seem to be available on this platform."
+ "Small and large page size are the same.");
}
// To get large pages for the card table etc. we need at least a 1G heap (with 4k page size).

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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,8 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jtreg.SkippedException;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
@ -69,10 +71,9 @@ public class TestShrinkAuxiliaryData {
int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize()));
if (maxCacheSize < hotCardTableSize) {
System.out.format("Skiping test for %d cache size due max cache size %d",
hotCardTableSize, maxCacheSize
);
return;
throw new SkippedException(String.format(
"Skiping test for %d cache size due max cache size %d",
hotCardTableSize, maxCacheSize));
}
printTestInfo(maxCacheSize);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2018, 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
@ -24,12 +24,14 @@
/*
* @test TestBootNativeLibraryPath.java
* @bug 6819213
* @modules java.compiler
* @compile -XDignore.symbol.file TestBootNativeLibraryPath.java
* @summary verify sun.boot.native.library.path is expandable on 32 bit systems
* @run main TestBootNativeLibraryPath
* @author ksrini
*/
* @modules java.compiler
* @library /test/lib
* @requiers vm.bits == 32
* @compile -XDignore.symbol.file TestBootNativeLibraryPath.java
* @run main TestBootNativeLibraryPath
*/
import java.io.BufferedReader;
import java.io.File;
@ -108,10 +110,6 @@ public class TestBootNativeLibraryPath {
public static void main(String[] args) {
try {
if (!System.getProperty("sun.arch.data.model").equals("32")) {
System.out.println("Warning: test skipped for 64-bit systems\n");
return;
}
String osname = System.getProperty("os.name");
if (osname.startsWith("Windows")) {
osname = "Windows";

@ -26,14 +26,17 @@
* @bug 8024927
* @summary Testing address of compressed class pointer space as best as possible.
* @requires vm.opt.final.UseCompressedOops
* @requires vm.bits == 64
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @run main CompressedClassPointers
*/
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jtreg.SkippedException;
public class CompressedClassPointers {
@ -139,17 +142,10 @@ public class CompressedClassPointers {
}
public static void main(String[] args) throws Exception {
if (!Platform.is64bit()) {
// Can't test this on 32 bit, just pass
System.out.println("Skipping test on 32bit");
return;
}
// Solaris 10 can't mmap compressed oops space without a base
if (Platform.isSolaris()) {
String name = System.getProperty("os.version");
if (name.equals("5.10")) {
System.out.println("Skipping test on Solaris 10");
return;
throw new SkippedException("Solaris 10 can't mmap compressed oops space without a base");
}
}
smallHeapTest();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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
@ -29,6 +29,8 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @requiers vm.bits == 64
* @run main CompressedKlassPointerAndOops
*/
import jdk.test.lib.Platform;
@ -38,13 +40,6 @@ import jdk.test.lib.process.OutputAnalyzer;
public class CompressedKlassPointerAndOops {
public static void main(String[] args) throws Exception {
if (!Platform.is64bit()) {
// Can't test this on 32 bit, just pass
System.out.println("Skipping test on 32bit");
return;
}
runWithAlignment(16);
runWithAlignment(32);
runWithAlignment(64);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -23,11 +23,12 @@
/*
* @test TestOnError
* @bug 8078470
* @summary Test using -XX:OnError=<cmd>
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @requires vm.debug
* @run main TestOnError
* @bug 8078470
*/
import jdk.test.lib.process.ProcessTools;
@ -37,11 +38,6 @@ import jdk.test.lib.Platform;
public class TestOnError {
public static void main(String[] args) throws Exception {
if (!Platform.isDebugBuild()) {
System.out.println("Test requires a non-product build - skipping");
return;
}
String msg = "Test Succeeded";
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(

@ -29,10 +29,12 @@
* is different from object alignment for creating a CDS file
* should fail when loading.
* @requires vm.cds
* @requires vm.bits == 64
* @library /test/lib
* @bug 8025642
* @modules java.base/jdk.internal.misc
* java.management
* @run main CdsDifferentObjectAlignment
*/
import jdk.test.lib.cds.CDSTestUtils;
@ -40,19 +42,11 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
public class CdsDifferentObjectAlignment {
public static void main(String[] args) throws Exception {
String nativeWordSize = System.getProperty("sun.arch.data.model");
if (!Platform.is64bit()) {
System.out.println("ObjectAlignmentInBytes for CDS is only " +
"supported on 64bit platforms; this plaform is " +
nativeWordSize);
System.out.println("Skipping the test");
} else {
createAndLoadSharedArchive(16, 64);
createAndLoadSharedArchive(64, 32);
}
}
public static void main(String[] args) throws Exception {
createAndLoadSharedArchive(16, 64);
createAndLoadSharedArchive(64, 32);
}
// Parameters are object alignment expressed in bytes
private static void

@ -26,29 +26,24 @@
* @summary Testing CDS (class data sharing) using varying object alignment.
* Using same object alignment for each dump/load pair
* @requires vm.cds
* @requires vm.bits == 64
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @run main CdsSameObjectAlignment
*/
import jdk.test.lib.Platform;
import jdk.test.lib.cds.CDSTestUtils;
import jdk.test.lib.process.OutputAnalyzer;
import jtreg.SkippedException;
public class CdsSameObjectAlignment {
public static void main(String[] args) throws Exception {
String nativeWordSize = System.getProperty("sun.arch.data.model");
if (!Platform.is64bit()) {
System.out.println("ObjectAlignmentInBytes for CDS is only " +
"supported on 64bit platforms; this plaform is " +
nativeWordSize);
System.out.println("Skipping the test");
} else {
dumpAndLoadSharedArchive(8);
dumpAndLoadSharedArchive(16);
dumpAndLoadSharedArchive(32);
dumpAndLoadSharedArchive(64);
}
dumpAndLoadSharedArchive(8);
dumpAndLoadSharedArchive(16);
dumpAndLoadSharedArchive(32);
dumpAndLoadSharedArchive(64);
}
private static void

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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
@ -28,6 +28,7 @@
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @requires vm.family == "solaris" | vm.family == "linux" | vm.family == "mac"
* @run main XCheckJSig
*/
@ -36,15 +37,12 @@ import java.util.Map;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
public class XCheckJSig {
public static void main(String args[]) throws Throwable {
System.out.println("Regression test for bugs 7051189 and 8023393");
if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) {
System.out.println("Test only applicable on Solaris, Linux, and Mac OSX, skipping");
return;
}
String jdk_path = System.getProperty("test.jdk");
String os_arch = Platform.getOsArch();
@ -69,8 +67,7 @@ public class XCheckJSig {
// Make sure the libjsig file exists.
if (!(new File(libjsig).exists())) {
System.out.println("File " + libjsig + " not found, skipping");
return;
throw new jtreg.SkippedException("File " + libjsig + " not found");
}
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version");

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -21,7 +21,6 @@
* questions.
*/
/*
* @test Testlibadimalloc.java
* @bug 8141445
@ -37,6 +36,7 @@ import java.io.*;
import java.nio.file.*;
import java.util.*;
import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
public class Testlibadimalloc {
@ -50,8 +50,7 @@ public class Testlibadimalloc {
// If the libadimalloc.so file does not exist, pass the test
if (!(Files.isRegularFile(path) || Files.isSymbolicLink(path))) {
System.out.println("Test skipped; libadimalloc.so does not exist");
return;
throw new SkippedException("libadimalloc.so does not exist");
}
// Get the JDK, library and class path properties

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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
@ -24,6 +24,7 @@
/* @test TestLargePagesFlags
* @summary Tests how large pages are choosen depending on the given large pages flag combinations.
* @requires vm.gc != "Z"
* @requires vm.family == "linux"
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
@ -33,16 +34,12 @@
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import java.util.ArrayList;
public class TestLargePagesFlags {
public static void main(String [] args) throws Exception {
if (!Platform.isLinux()) {
System.out.println("Skipping. TestLargePagesFlags has only been implemented for Linux.");
return;
}
testUseTransparentHugePages();
testUseHugeTLBFS();
testUseSHM();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -20,10 +20,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.io.File;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import java.util.ArrayList;
/*
* @test
@ -34,6 +30,14 @@ import java.util.ArrayList;
* @library /test/lib
* @run driver AvailableProcessors
*/
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jtreg.SkippedException;
import java.util.ArrayList;
import java.io.File;
public class AvailableProcessors {
static final String SUCCESS_STRING = "Found expected processors: ";
@ -47,20 +51,18 @@ public class AvailableProcessors {
String taskset;
final String taskset1 = "/bin/taskset";
final String taskset2 = "/usr/bin/taskset";
if (new File(taskset1).exists())
if (new File(taskset1).exists()) {
taskset = taskset1;
else if (new File(taskset2).exists())
} else if (new File(taskset2).exists()) {
taskset = taskset2;
else {
System.out.println("Skipping test: could not find taskset command");
return;
} else {
throw new SkippedException("Could not find taskset command");
}
int available = Runtime.getRuntime().availableProcessors();
if (available == 1) {
System.out.println("Skipping test: only one processor available");
return;
throw new SkippedException("only one processor available");
}
// Get the java command we want to execute

@ -25,6 +25,7 @@ import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
import java.io.File;
import java.nio.file.Path;
@ -40,8 +41,7 @@ public class SigTestDriver {
public static void main(String[] args) {
// No signal tests on Windows yet; so setting to no-op
if (Platform.isWindows()) {
System.out.println("SKIPPED: no signal tests on Windows, ignore.");
return;
throw new SkippedException("no signal tests on Windows");
}
// At least one argument should be specified
@ -54,16 +54,13 @@ public class SigTestDriver {
case "SIGWAITING":
case "SIGKILL":
case "SIGSTOP": {
System.out.println("SKIPPED: signals SIGWAITING, SIGKILL and SIGSTOP can't be tested, ignore.");
return;
throw new SkippedException("signals SIGWAITING, SIGKILL and SIGSTOP can't be tested");
}
case "SIGUSR2": {
if (Platform.isLinux()) {
System.out.println("SKIPPED: SIGUSR2 can't be tested on Linux, ignore.");
return;
throw new SkippedException("SIGUSR2 can't be tested on Linux");
} else if (Platform.isOSX()) {
System.out.println("SKIPPED: SIGUSR2 can't be tested on OS X, ignore.");
return;
throw new SkippedException("SIGUSR2 can't be tested on OS X");
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -20,11 +20,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.io.PrintWriter;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
/*
* Test to verify GetObjectSize does not overflow on a 600M element int[]
@ -37,18 +32,23 @@ import jdk.test.lib.process.ProcessTools;
* java.instrument
* java.management
* jdk.internal.jvmstat/sun.jvmstat.monitor
* @requires vm.bits == 64
* @build GetObjectSizeOverflowAgent
* @run driver ClassFileInstaller GetObjectSizeOverflowAgent
* @run main GetObjectSizeOverflow
*/
import java.io.PrintWriter;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
public class GetObjectSizeOverflow {
public static void main(String[] args) throws Exception {
if (!Platform.is64bit()) {
System.out.println("Test needs a 4GB heap and can only be run as a 64bit process, skipping.");
return;
}
PrintWriter pw = new PrintWriter("MANIFEST.MF");
pw.println("Premain-Class: GetObjectSizeOverflowAgent");
pw.close();
@ -63,8 +63,7 @@ public class GetObjectSizeOverflow {
if (output.getStdout().contains("Could not reserve enough space") || output.getStderr().contains("java.lang.OutOfMemoryError")) {
System.out.println("stdout: " + output.getStdout());
System.out.println("stderr: " + output.getStderr());
System.out.println("Test could not reserve or allocate enough space, skipping");
return;
throw new SkippedException("Test could not reserve or allocate enough space");
}
output.stdoutShouldContain("GetObjectSizeOverflow passed");

@ -24,10 +24,13 @@
/**
* @test
* @summary Verifies NotifyFramePop request is cleared if JVMTI_EVENT_FRAME_POP is disabled
* @library /test/lib
* @compile NotifyFramePopTest.java
* @run main/othervm/native -agentlib:NotifyFramePopTest NotifyFramePopTest
*/
import jtreg.SkippedException;
public class NotifyFramePopTest {
static {
try {
@ -42,8 +45,7 @@ public class NotifyFramePopTest {
public static void main(String args[]) {
if (!canGenerateFramePopEvents()) {
log("FramePop event is not supported - skipping the test");
return;
throw new SkippedException("FramePop event is not supported");
}
// Sanity testing that FRAME_POP works.

@ -54,6 +54,7 @@ import java.util.regex.Pattern;
import java.util.regex.Matcher;
import jdk.internal.misc.Unsafe;
import java.util.Scanner;
import jtreg.SkippedException;
class CrashApp {
public static void main(String[] args) {
@ -121,7 +122,7 @@ public class ClhsdbCDSCore {
"Core files might not be generated. Please reset /proc/sys/kernel/core_pattern\n" +
"to enable core generation. Skipping this test.");
cleanup();
return;
throw new SkippedException("This system uses a crash report tool");
}
}
}
@ -144,16 +145,14 @@ public class ClhsdbCDSCore {
if (useSharedSpacesOutput == null) {
// Output could be null due to attach permission issues.
System.out.println("Could not determine the UseSharedSpaces value - test skipped.");
cleanup();
return;
throw new SkippedException("Could not determine the UseSharedSpaces value");
}
if (!useSharedSpacesOutput.contains("true")) {
// CDS archive is not mapped. Skip the rest of the test.
System.out.println("The CDS archive is not mapped - test skipped.");
cleanup();
return;
throw new SkippedException("The CDS archive is not mapped");
}
cmds = List.of("printmdo -a", "printall");
@ -183,6 +182,8 @@ public class ClhsdbCDSCore {
"Failure occurred at bci",
"No suitable match for type of address"));
test.runOnCore(TEST_CDS_CORE_FILE_NAME, cmds, expStrMap, unExpStrMap);
} catch (SkippedException e) {
throw e;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
}

@ -37,6 +37,7 @@ import java.util.HashMap;
import jdk.test.lib.cds.CDSTestUtils;
import jdk.test.lib.cds.CDSOptions;
import jdk.test.lib.apps.LingeredApp;
import jtreg.SkippedException;
public class ClhsdbCDSJstackPrintAll {
@ -64,17 +65,15 @@ public class ClhsdbCDSJstackPrintAll {
null, null);
if (useSharedSpacesOutput == null) {
// Attach permission issues.
System.out.println("Could not determine the UseSharedSpaces value - test skipped.");
LingeredApp.stopApp(theApp);
return;
// Attach permission issues.
throw new SkippedException("Could not determine the UseSharedSpaces value");
}
if (!useSharedSpacesOutput.contains("true")) {
// CDS archive is not mapped. Skip the rest of the test.
System.out.println("The CDS archive is not mapped - test skipped.");
LingeredApp.stopApp(theApp);
return;
throw new SkippedException("The CDS archive is not mapped");
}
cmds = List.of("jstack -v", "printall", "where -a");
@ -113,6 +112,8 @@ public class ClhsdbCDSJstackPrintAll {
"illegal code",
"Failure occurred at bci"));
test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
} catch (SkippedException e) {
throw e;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {

@ -21,12 +21,6 @@
* questions.
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
/**
* @test
* @bug 8192985
@ -36,6 +30,13 @@ import jdk.test.lib.apps.LingeredApp;
* @run main/othervm ClhsdbInspect
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
import jtreg.SkippedException;
public class ClhsdbInspect {
public static void main(String[] args) throws Exception {
@ -60,7 +61,7 @@ public class ClhsdbInspect {
// Output could be null due to attach permission issues
// and if we are skipping this.
LingeredApp.stopApp(theApp);
return;
throw new SkippedException("attach permission issues");
}
Map<String, String> tokensMap = new HashMap<>();
@ -100,6 +101,8 @@ public class ClhsdbInspect {
expStrMap.put(cmd, List.of(tokensMap.get(key)));
test.run(theApp.getPid(), cmds, expStrMap, null);
}
} catch (SkippedException e) {
throw e;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {

@ -21,13 +21,6 @@
* questions.
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
/**
* @test
* @bug 8193124
@ -37,6 +30,14 @@ import jdk.test.lib.apps.LingeredApp;
* @run main/othervm ClhsdbJdis
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
import jtreg.SkippedException;
public class ClhsdbJdis {
public static void main(String[] args) throws Exception {
@ -58,33 +59,36 @@ public class ClhsdbJdis {
// Output could be null if the test was skipped due to
// attach permission issues.
if (output != null) {
String cmdStr = null;
String[] parts = output.split("LingeredApp.main");
String[] tokens = parts[1].split(" ");
for (String token : tokens) {
if (token.contains("Method")) {
String[] address = token.split("=");
// address[1] represents the address of the Method
cmdStr = "jdis " + address[1];
cmds.add(cmdStr);
break;
}
}
Map<String, List<String>> expStrMap = new HashMap<>();
expStrMap.put(cmdStr, List.of(
"public static void main(java.lang.String[])",
"Holder Class",
"public class jdk.test.lib.apps.LingeredApp @",
"Bytecode",
"line bci bytecode",
"Exception Table",
"start bci end bci handler bci catch type",
"Constant Pool of [public class jdk.test.lib.apps.LingeredApp @"));
test.run(theApp.getPid(), cmds, expStrMap, null);
if (output == null) {
throw new SkippedException("attach permission issues");
}
String cmdStr = null;
String[] parts = output.split("LingeredApp.main");
String[] tokens = parts[1].split(" ");
for (String token : tokens) {
if (token.contains("Method")) {
String[] address = token.split("=");
// address[1] represents the address of the Method
cmdStr = "jdis " + address[1];
cmds.add(cmdStr);
break;
}
}
Map<String, List<String>> expStrMap = new HashMap<>();
expStrMap.put(cmdStr, List.of(
"public static void main(java.lang.String[])",
"Holder Class",
"public class jdk.test.lib.apps.LingeredApp @",
"Bytecode",
"line bci bytecode",
"Exception Table",
"start bci end bci handler bci catch type",
"Constant Pool of [public class jdk.test.lib.apps.LingeredApp @"));
test.run(theApp.getPid(), cmds, expStrMap, null);
} catch (SkippedException e) {
throw e;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {

@ -21,13 +21,6 @@
* questions.
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
/**
* @test
* @bug 8190198
@ -37,6 +30,14 @@ import jdk.test.lib.Platform;
* @run main/othervm ClhsdbLongConstant
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
public class ClhsdbLongConstant {
public static void main(String[] args) throws Exception {
@ -75,11 +76,11 @@ public class ClhsdbLongConstant {
String longConstantOutput = test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
if (longConstantOutput == null) {
// Output could be null due to attach permission issues
// and if we are skipping this.
return;
throw new SkippedException("attach permission issues");
}
checkForTruncation(longConstantOutput);
} catch (SkippedException e) {
throw e;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {

@ -21,12 +21,6 @@
* questions.
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
/**
* @test
* @bug 8192985
@ -36,6 +30,13 @@ import jdk.test.lib.apps.LingeredApp;
* @run main/othervm ClhsdbPrintAs
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
import jtreg.SkippedException;
public class ClhsdbPrintAs {
public static void main(String[] args) throws Exception {
@ -55,10 +56,8 @@ public class ClhsdbPrintAs {
String jstackOutput = test.run(theApp.getPid(), cmds, null, null);
if (jstackOutput == null) {
// Output could be null due to attach permission issues
// and if we are skipping this.
LingeredApp.stopApp(theApp);
return;
throw new SkippedException("attach permission issues");
}
String[] snippets = jstackOutput.split("LingeredApp.main");
@ -118,6 +117,8 @@ public class ClhsdbPrintAs {
expStrMap.put(cmd, List.of
("ConstantPoolCache", "_pool_holder", "InstanceKlass*"));
test.run(theApp.getPid(), cmds, expStrMap, null);
} catch (SkippedException e) {
throw e;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {

@ -21,12 +21,6 @@
* questions.
*/
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
/**
* @test
* @bug 8175312
@ -36,6 +30,13 @@ import jdk.test.lib.apps.LingeredApp;
* @run main/othervm/timeout=2400 ClhsdbRegionDetailsScanOopsForG1
*/
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jtreg.SkippedException;
public class ClhsdbRegionDetailsScanOopsForG1 {
public static void main(String[] args) throws Exception {
@ -70,10 +71,8 @@ public class ClhsdbRegionDetailsScanOopsForG1 {
String regionDetailsOutput = test.run(theApp.getPid(), cmds,
expStrMap, unExpStrMap);
if (regionDetailsOutput == null) {
// Output could be null due to attach permission issues
// and if we are skipping this.
LingeredApp.stopApp(theApp);
return;
throw new SkippedException("attach permission issues");
}
// Test the output of 'scanoops' -- get the start and end addresses
@ -87,6 +86,8 @@ public class ClhsdbRegionDetailsScanOopsForG1 {
expStrMap = new HashMap<>();
expStrMap.put(cmd, List.of("[Ljava/lang/String"));
test.run(theApp.getPid(), List.of(cmd), expStrMap, null);
} catch (SkippedException e) {
throw e;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {

@ -21,13 +21,6 @@
* questions.
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.Utils;
import jdk.test.lib.apps.LingeredApp;
/**
* @test
* @bug 8192985
@ -37,6 +30,14 @@ import jdk.test.lib.apps.LingeredApp;
* @run main/othervm/timeout=1200 ClhsdbScanOops
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import jdk.test.lib.Utils;
import jdk.test.lib.apps.LingeredApp;
import jtreg.SkippedException;
public class ClhsdbScanOops {
private static void testWithGcType(String gc) throws Exception {
@ -58,10 +59,8 @@ public class ClhsdbScanOops {
String universeOutput = test.run(theApp.getPid(), cmds, null, null);
if (universeOutput == null) {
// Output could be null due to attach permission issues
// and if we are skipping this.
LingeredApp.stopApp(theApp);
return;
throw new SkippedException("attach permission issues");
}
cmds = new ArrayList<String>();
@ -97,6 +96,8 @@ public class ClhsdbScanOops {
unExpStrMap.put(cmd, List.of("java/lang/Thread"));
test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
} catch (SkippedException e) {
throw e;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
@ -106,12 +107,8 @@ public class ClhsdbScanOops {
public static void main(String[] args) throws Exception {
System.out.println("Starting the ClhsdbScanOops test");
try {
testWithGcType("-XX:+UseParallelGC");
testWithGcType("-XX:+UseSerialGC");
} catch (Exception e) {
throw new Error("Test failed with " + e);
}
testWithGcType("-XX:+UseParallelGC");
testWithGcType("-XX:+UseSerialGC");
System.out.println("Test PASSED");
}
}

@ -21,11 +21,21 @@
* questions.
*/
/**
* @test
* @summary Test deadlock detection
* @requires vm.hasSAandCanAttach
* @requires os.family != "mac"
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.management
* @run main DeadlockDetectionTest
*/
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.apps.LingeredAppWithDeadlock;
@ -35,15 +45,7 @@ import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
/**
* @test
* @summary Test deadlock detection
* @requires vm.hasSAandCanAttach
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.management
* @run main DeadlockDetectionTest
*/
import jtreg.SkippedException;
public class DeadlockDetectionTest {
@ -70,13 +72,6 @@ public class DeadlockDetectionTest {
public static void main(String[] args) throws Exception {
System.out.println("Starting DeadlockDetectionTest");
if (Platform.isOSX()) {
// Coredump stackwalking is not implemented for Darwin
System.out.println("This test is not expected to work on OS X. Skipping");
return;
}
if (!LingeredApp.isLastModifiedWorking()) {
// Exact behaviour of the test depends on operating system and the test nature,
// so just print the warning and continue
@ -94,9 +89,8 @@ public class DeadlockDetectionTest {
System.out.println(output.getOutput());
if (output.getExitValue() == 3) {
System.out.println("Test can't run for some reason. Skipping");
}
else {
throw new SkippedException("Test can't run for some reason");
} else {
output.shouldHaveExitValue(0);
output.shouldContain("Found a total of 1 deadlock.");
}

@ -37,6 +37,7 @@ import jdk.test.lib.classloader.GeneratingClassLoader;
import jdk.test.lib.hprof.HprofParser;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jtreg.SkippedException;
import java.io.File;
@ -103,8 +104,7 @@ public class TestJmapCore {
String pid = output.firstMatch("^(\\d+)" + pidSeparator, 1);
core = new File("cores/core." + pid);
if (!core.exists()) {
System.out.println("Has not been able to find coredump. Test skipped.");
return;
throw new SkippedException("Has not been able to find coredump");
}
} else {
Asserts.assertTrue(cores.length == 1,

@ -20,6 +20,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package gc.g1.unloading;
import java.lang.Thread.UncaughtExceptionHandler;
@ -33,12 +34,13 @@ import gc.g1.unloading.check.Assertion;
import gc.g1.unloading.check.AssertionContainer;
import gc.g1.unloading.check.ClassAssertion;
import gc.g1.unloading.configuration.*;
import gc.g1.unloading.loading.*;
import nsk.share.gc.GCTestBase;
import nsk.share.test.ExecutionController;
import nsk.share.test.Stresser;
import nsk.share.test.Tests;
import gc.g1.unloading.loading.*;
import jtreg.SkippedException;
/**
* This class contains main method. It's entry point for all configurations.
@ -165,8 +167,7 @@ public class UnloadingTest extends GCTestBase {
private void checkIfG1Used() {
for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
if (!bean.getName().contains("G1")) {
System.err.println("This test was created to cover G1 class unloading feature. It should be ran with -XX:+UseG1GC. Skipping silently.");
System.exit(0);
throw new SkippedException("This test was created to cover G1 class unloading feature. It should be ran with -XX:+UseG1GC");
}
}
}

@ -25,6 +25,7 @@ package nsk.jdi.AttachingConnector.attach.attach004;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.Utils;
import jtreg.SkippedException;
import nsk.share.jdi.ArgumentHandler;
import java.io.BufferedReader;
@ -63,23 +64,23 @@ public class TestDriver {
"-arch=" + arch
};
if (isTransportSupported(jdiArgs)) {
System.out.println("Transport is supported on this platform, execute test");
String suspend = args[2];
Process debuggee = startDebuggee(jdiArgs, transport, suspend);
Process debugger = startDebugger(jdiArgs, Arrays.copyOfRange(args, 3, args.length), debuggee.pid());
if (!isTransportSupported(jdiArgs)) {
throw new SkippedException("Transport isn't supported on this platform");
}
int debuggerExit = debugger.waitFor();
if (debuggerExit != 95) {
throw new Error("debugger exit code is " + debuggerExit);
}
System.out.println("Transport is supported on this platform, execute test");
String suspend = args[2];
Process debuggee = startDebuggee(jdiArgs, transport, suspend);
Process debugger = startDebugger(jdiArgs, Arrays.copyOfRange(args, 3, args.length), debuggee.pid());
int debuggeeExit = debuggee.waitFor();
if (debuggeeExit != 95) {
throw new Error("debuggee exit code is " + debuggeeExit);
}
} else {
System.out.println("SKIPPED: Transport isn't supported on this platform, treat test as passed");
int debuggerExit = debugger.waitFor();
if (debuggerExit != 95) {
throw new Error("debugger exit code is " + debuggerExit);
}
int debuggeeExit = debuggee.waitFor();
if (debuggeeExit != 95) {
throw new Error("debuggee exit code is " + debuggeeExit);
}
}

@ -106,8 +106,9 @@ public class strace001 {
printStackTrace(snapshot);
testFailed = true;
}
} else
} else {
log.display("Thread " + j + " is dead, skipping it.");
}
}
// Let all threads to complete their job

@ -0,0 +1,38 @@
/*
* Copyright (c) 2018, 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.
*/
package jtreg;
/**
* {@code SkippedException} is an exception treaded by jtreg as an indication
* of skipped status.
*/
public final class SkippedException extends RuntimeException {
public SkippedException(String s, Throwable t) {
super(s, t);
}
public SkippedException(String s) {
super(s);
}
}