Skip to content

Commit

Permalink
8208655: use JTreg skipped status in hotspot tests
Browse files Browse the repository at this point in the history
8023735: [TESTBUG][macosx] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
8208701: Fix for JDK-8208655 causes test failures in CI tier1
8208706: compiler/tiered/ConstantGettersTransitionsTest.java fails to compile
8186095: upgrade to jtreg 4.2 b08
8183503: Update hotspot tests to allow for unique test classes directory
8213410: UseCompressedOops requirement check fails fails on 32-bit system

Reviewed-by: stuefe, sgehwolf
Backport-of: 17b730d7edf7be91ee841180ea6a59b26c0c567a
  • Loading branch information
gnu-andrew committed Nov 28, 2023
1 parent 0464401 commit 3b9c787
Show file tree
Hide file tree
Showing 35 changed files with 271 additions and 165 deletions.
1 change: 0 additions & 1 deletion hotspot/test/ProblemList.txt
Expand Up @@ -43,7 +43,6 @@
runtime/SharedArchiveFile/SharedBaseAddress.java 8044600 solaris-sparc
runtime/6929067/Test6929067.sh 8028740 generic-all
runtime/CDSCompressedKPtrs/XShareAuto.java 8026154 generic-all
runtime/XCheckJniJsig/XCheckJSig.java 8023735 generic-all
runtime/6626217/Test6626217.sh 8028733 generic-all
runtime/jsig/Test8017498.sh 8028806 generic-all
runtime/LoadClass/LoadClassNegative.java 8028095 generic-all
Expand Down
6 changes: 5 additions & 1 deletion hotspot/test/TEST.ROOT
Expand Up @@ -36,7 +36,11 @@ groups=TEST.groups [closed/TEST.groups]
requires.extraPropDefns = ../../test/jtreg-ext/requires/VMProps.java
requires.properties=sun.arch.data.model \
vm.flavor \
vm.bits
vm.bits \
vm.debug

# Minimum jtreg version
requiredVersion=4.2 b13

# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
Expand Down
Expand Up @@ -107,7 +107,8 @@ static private void makeSureIsCompiled(Method m) {
*/
static public void main(String[] args) throws Exception {
// (1) Load an anonymous version of this class using the corresponding Unsafe method
URL classUrl = TestAnonymousClassUnloading.class.getResource("TestAnonymousClassUnloading.class");
String rn = TestAnonymousClassUnloading.class.getSimpleName() + ".class";
URL classUrl = TestAnonymousClassUnloading.class.getResource(rn);
URLConnection connection = classUrl.openConnection();

int length = connection.getContentLength();
Expand Down
10 changes: 7 additions & 3 deletions hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 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
Expand All @@ -21,12 +21,14 @@
* questions.
*/

import jtreg.SkippedException;

import java.lang.reflect.Executable;
import java.util.concurrent.Callable;

/**
* @test ConstantGettersTransitionsTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox /test/lib
* @build TransitionsTestExecutor ConstantGettersTransitionsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
Expand All @@ -37,7 +39,9 @@
*/
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()) {
Expand Down
8 changes: 6 additions & 2 deletions hotspot/test/compiler/tiered/LevelTransitionTest.java
Expand Up @@ -21,14 +21,16 @@
* questions.
*/

import jtreg.SkippedException;

import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.util.Objects;
import java.util.concurrent.Callable;

/**
* @test LevelTransitionTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox /test/lib
* @build TransitionsTestExecutor LevelTransitionTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
Expand All @@ -44,7 +46,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
Expand Down
7 changes: 4 additions & 3 deletions hotspot/test/compiler/tiered/NonTieredLevelsTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, 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
Expand All @@ -22,10 +22,11 @@
*/

import java.util.function.IntPredicate;
import jtreg.SkippedException;

/**
* @test NonTieredLevelsTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox /test/lib
* @build NonTieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation
Expand Down Expand Up @@ -54,7 +55,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);
}
Expand Down
9 changes: 6 additions & 3 deletions hotspot/test/compiler/tiered/TieredLevelsTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, 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
Expand All @@ -23,7 +23,7 @@

/**
* @test TieredLevelsTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox /test/lib
* @build TieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
Expand All @@ -33,10 +33,13 @@
* @summary Verify that all levels < 'TieredStopAtLevel' can be used
* @author igor.ignatyev@oracle.com
*/

import jtreg.SkippedException;

public class TieredLevelsTest extends CompLevelsTest {
public static void main(String[] args) throws Exception, Throwable {
if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
return;
throw new SkippedException("Test isn't applicable for non-tiered mode");
}
CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
}
Expand Down
9 changes: 4 additions & 5 deletions hotspot/test/gc/arguments/TestAggressiveHeap.java
@@ -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
Expand All @@ -26,7 +26,7 @@
* @key gc
* @bug 8179084
* @summary Test argument processing for -XX:+AggressiveHeap.
* @library /testlibrary
* @library /testlibrary /test/lib
* @run driver TestAggressiveHeap
*/

Expand All @@ -36,6 +36,7 @@

import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.ProcessTools;
import jtreg.SkippedException;

public class TestAggressiveHeap {

Expand Down Expand Up @@ -86,9 +87,7 @@ private static boolean haveRequiredMemory() throws Exception {

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;
}
Expand Down
11 changes: 5 additions & 6 deletions hotspot/test/gc/g1/TestHumongousShrinkHeap.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 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
Expand Down Expand Up @@ -27,7 +27,7 @@
* @requires vm.gc=="G1" | vm.gc=="null"
* @summary Verify that heap shrinks after GC in the presence of fragmentation
* due to humongous objects
* @library /testlibrary
* @library /testlibrary /test/lib
* @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10
* -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc
* TestHumongousShrinkHeap
Expand All @@ -39,6 +39,7 @@
import java.util.List;
import sun.management.ManagementFactoryHelper;
import static com.oracle.java.testlibrary.Asserts.*;
import jtreg.SkippedException;

public class TestHumongousShrinkHeap {

Expand All @@ -57,13 +58,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. "
Expand Down
15 changes: 5 additions & 10 deletions hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 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
Expand All @@ -25,8 +25,8 @@
* @test TestLargePageUseForAuxMemory.java
* @bug 8058354
* @key gc
* @library /testlibrary /testlibrary/whitebox
* @requires (vm.gc=="G1" | vm.gc=="null")
* @library /testlibrary /testlibrary/whitebox /test/lib
* @requires (vm.gc=="G1" | vm.gc=="null") & vm.debug
* @build TestLargePageUseForAuxMemory
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
Expand All @@ -35,6 +35,7 @@
*/

import com.oracle.java.testlibrary.*;
import jtreg.SkippedException;
import sun.hotspot.WhiteBox;

public class TestLargePageUseForAuxMemory {
Expand Down Expand Up @@ -88,18 +89,12 @@ static void testVM(long heapsize, boolean cardsShouldUseLargePages, boolean bitm
}

public static void main(String[] args) throws Exception {
if (!Platform.isDebugBuild()) {
System.out.println("Skip tests on non-debug builds because the required option TracePageSizes is a debug-only option.");
return;
}

WhiteBox wb = WhiteBox.getWhiteBox();
smallPageSize = wb.getVMPageSize();
largePageSize = wb.getVMLargePageSize();

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.");
}

// To get large pages for the card table etc. we need at least a 1G heap (with 4k page size).
Expand Down
11 changes: 6 additions & 5 deletions hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, 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
Expand All @@ -26,6 +26,8 @@
import com.oracle.java.testlibrary.Platform;
import com.oracle.java.testlibrary.ProcessTools;
import com.oracle.java.testlibrary.Utils;
import jtreg.SkippedException;

import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
Expand Down Expand Up @@ -67,10 +69,9 @@ protected void test() throws Exception {

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);
Expand Down
2 changes: 1 addition & 1 deletion hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java
Expand Up @@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @library /testlibrary /testlibrary/whitebox /test/lib
* @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* TestShrinkAuxiliaryData TestShrinkAuxiliaryData00
* @run main ClassFileInstaller sun.hotspot.WhiteBox
Expand Down
2 changes: 1 addition & 1 deletion hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
Expand Up @@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @library /testlibrary /testlibrary/whitebox /test/lib
* @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
* @run main ClassFileInstaller sun.hotspot.WhiteBox
Expand Down
2 changes: 1 addition & 1 deletion hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
Expand Up @@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @library /testlibrary /testlibrary/whitebox /test/lib
* @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10
* @run main ClassFileInstaller sun.hotspot.WhiteBox
Expand Down
2 changes: 1 addition & 1 deletion hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
Expand Up @@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @library /testlibrary /testlibrary/whitebox /test/lib
* @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15
* @run main ClassFileInstaller sun.hotspot.WhiteBox
Expand Down
2 changes: 1 addition & 1 deletion hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
Expand Up @@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @library /testlibrary /testlibrary/whitebox /test/lib
* @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20
* @run main ClassFileInstaller sun.hotspot.WhiteBox
Expand Down
2 changes: 1 addition & 1 deletion hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
Expand Up @@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @library /testlibrary /testlibrary/whitebox /test/lib
* @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25
* @run main ClassFileInstaller sun.hotspot.WhiteBox
Expand Down
2 changes: 1 addition & 1 deletion hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
Expand Up @@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null"
* @library /testlibrary /testlibrary/whitebox
* @library /testlibrary /testlibrary/whitebox /test/lib
* @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30
* @run main ClassFileInstaller sun.hotspot.WhiteBox
Expand Down
Expand Up @@ -25,6 +25,7 @@
* @test CompressedClassSpaceSizeInJmapHeap
* @bug 8004924
* @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize
* @requires vm.bits == 64
* @library /testlibrary
* @run main/othervm -XX:CompressedClassSpaceSize=50m CompressedClassSpaceSizeInJmapHeap
*/
Expand Down
1 change: 1 addition & 0 deletions hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java
Expand Up @@ -30,6 +30,7 @@
* @bug 8000754
* @summary Tests that a MemoryPoolMXBeans is created for metaspace and that a
* MemoryManagerMXBean is created.
* @requires vm.bits == 64
* @library /testlibrary
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops TestMetaspaceMemoryPool
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:MaxMetaspaceSize=60m TestMetaspaceMemoryPool
Expand Down

1 comment on commit 3b9c787

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.