8208655: use JTreg skipped status in hotspot tests

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
This commit is contained in:
Andrew John Hughes 2023-11-28 03:17:41 +00:00
parent 0464401cc5
commit 3b9c787e3c
35 changed files with 273 additions and 167 deletions

View File

@ -43,7 +43,6 @@
runtime/SharedArchiveFile/SharedBaseAddress.java 8044600 solaris-sparc runtime/SharedArchiveFile/SharedBaseAddress.java 8044600 solaris-sparc
runtime/6929067/Test6929067.sh 8028740 generic-all runtime/6929067/Test6929067.sh 8028740 generic-all
runtime/CDSCompressedKPtrs/XShareAuto.java 8026154 generic-all runtime/CDSCompressedKPtrs/XShareAuto.java 8026154 generic-all
runtime/XCheckJniJsig/XCheckJSig.java 8023735 generic-all
runtime/6626217/Test6626217.sh 8028733 generic-all runtime/6626217/Test6626217.sh 8028733 generic-all
runtime/jsig/Test8017498.sh 8028806 generic-all runtime/jsig/Test8017498.sh 8028806 generic-all
runtime/LoadClass/LoadClassNegative.java 8028095 generic-all runtime/LoadClass/LoadClassNegative.java 8028095 generic-all

View File

@ -36,7 +36,11 @@ groups=TEST.groups [closed/TEST.groups]
requires.extraPropDefns = ../../test/jtreg-ext/requires/VMProps.java requires.extraPropDefns = ../../test/jtreg-ext/requires/VMProps.java
requires.properties=sun.arch.data.model \ requires.properties=sun.arch.data.model \
vm.flavor \ 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 # Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them # does not need ../../ notation to reach them

View File

@ -107,7 +107,8 @@ public class TestAnonymousClassUnloading {
*/ */
static public void main(String[] args) throws Exception { static public void main(String[] args) throws Exception {
// (1) Load an anonymous version of this class using the corresponding Unsafe method // (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(); URLConnection connection = classUrl.openConnection();
int length = connection.getContentLength(); int length = connection.getContentLength();

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,12 +21,14 @@
* questions. * questions.
*/ */
import jtreg.SkippedException;
import java.lang.reflect.Executable; import java.lang.reflect.Executable;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
/** /**
* @test ConstantGettersTransitionsTest * @test ConstantGettersTransitionsTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox * @library /testlibrary /testlibrary/whitebox /compiler/whitebox /test/lib
* @build TransitionsTestExecutor ConstantGettersTransitionsTest * @build TransitionsTestExecutor ConstantGettersTransitionsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
@ -37,7 +39,9 @@ import java.util.concurrent.Callable;
*/ */
public class ConstantGettersTransitionsTest extends LevelTransitionTest { public class ConstantGettersTransitionsTest extends LevelTransitionTest {
public static void main(String[] args) { 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 // run test cases
for (TestCase testCase : ConstantGettersTestCase.values()) { for (TestCase testCase : ConstantGettersTestCase.values()) {

View File

@ -21,6 +21,8 @@
* questions. * questions.
*/ */
import jtreg.SkippedException;
import java.lang.reflect.Executable; import java.lang.reflect.Executable;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Objects; import java.util.Objects;
@ -28,7 +30,7 @@ import java.util.concurrent.Callable;
/** /**
* @test LevelTransitionTest * @test LevelTransitionTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox * @library /testlibrary /testlibrary/whitebox /compiler/whitebox /test/lib
* @build TransitionsTestExecutor LevelTransitionTest * @build TransitionsTestExecutor LevelTransitionTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
@ -44,7 +46,9 @@ public class LevelTransitionTest extends TieredLevelsTest {
private int transitionCount; private int transitionCount;
public static void main(String[] args) throws Throwable { 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); CompilerWhiteBoxTest.main(LevelTransitionTest::new, args);
// run extended test cases // run extended test cases

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,11 @@
*/ */
import java.util.function.IntPredicate; import java.util.function.IntPredicate;
import jtreg.SkippedException;
/** /**
* @test NonTieredLevelsTest * @test NonTieredLevelsTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox * @library /testlibrary /testlibrary/whitebox /compiler/whitebox /test/lib
* @build NonTieredLevelsTest * @build NonTieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation * @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation
@ -54,7 +55,7 @@ public class NonTieredLevelsTest extends CompLevelsTest {
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
if (CompilerWhiteBoxTest.skipOnTieredCompilation(true)) { if (CompilerWhiteBoxTest.skipOnTieredCompilation(true)) {
return; throw new SkippedException("Test isn't applicable for tiered mode");
} }
CompilerWhiteBoxTest.main(NonTieredLevelsTest::new, args); CompilerWhiteBoxTest.main(NonTieredLevelsTest::new, args);
} }

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/** /**
* @test TieredLevelsTest * @test TieredLevelsTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox * @library /testlibrary /testlibrary/whitebox /compiler/whitebox /test/lib
* @build TieredLevelsTest * @build TieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
@ -33,10 +33,13 @@
* @summary Verify that all levels < 'TieredStopAtLevel' can be used * @summary Verify that all levels < 'TieredStopAtLevel' can be used
* @author igor.ignatyev@oracle.com * @author igor.ignatyev@oracle.com
*/ */
import jtreg.SkippedException;
public class TieredLevelsTest extends CompLevelsTest { public class TieredLevelsTest extends CompLevelsTest {
public static void main(String[] args) throws Exception, Throwable { public static void main(String[] args) throws Exception, Throwable {
if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) { if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
return; throw new SkippedException("Test isn't applicable for non-tiered mode");
} }
CompilerWhiteBoxTest.main(TieredLevelsTest::new, args); CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
} }

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @key gc * @key gc
* @bug 8179084 * @bug 8179084
* @summary Test argument processing for -XX:+AggressiveHeap. * @summary Test argument processing for -XX:+AggressiveHeap.
* @library /testlibrary * @library /testlibrary /test/lib
* @run driver TestAggressiveHeap * @run driver TestAggressiveHeap
*/ */
@ -36,6 +36,7 @@ import javax.management.ObjectName;
import com.oracle.java.testlibrary.OutputAnalyzer; import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.ProcessTools; import com.oracle.java.testlibrary.ProcessTools;
import jtreg.SkippedException;
public class TestAggressiveHeap { public class TestAggressiveHeap {
@ -86,9 +87,7 @@ public class TestAggressiveHeap {
private static boolean canUseAggressiveHeapOption() throws Exception { private static boolean canUseAggressiveHeapOption() throws Exception {
if (!haveRequiredMemory()) { if (!haveRequiredMemory()) {
System.out.println( throw new SkippedException("Skipping test of " + option + " : insufficient memory");
"Skipping test of " + option + " : insufficient memory");
return false;
} }
return true; return true;
} }

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
* @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.gc=="G1" | vm.gc=="null"
* @summary Verify that heap shrinks after GC in the presence of fragmentation * @summary Verify that heap shrinks after GC in the presence of fragmentation
* due to humongous objects * due to humongous objects
* @library /testlibrary * @library /testlibrary /test/lib
* @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10 * @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10
* -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc * -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc
* TestHumongousShrinkHeap * TestHumongousShrinkHeap
@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import sun.management.ManagementFactoryHelper; import sun.management.ManagementFactoryHelper;
import static com.oracle.java.testlibrary.Asserts.*; import static com.oracle.java.testlibrary.Asserts.*;
import jtreg.SkippedException;
public class TestHumongousShrinkHeap { public class TestHumongousShrinkHeap {
@ -57,13 +58,11 @@ public class TestHumongousShrinkHeap {
public static void main(String[] args) { public static void main(String[] args) {
if (HUMON_COUNT == 0) { if (HUMON_COUNT == 0) {
System.out.println("Skipped. Heap is too small"); throw new SkippedException("Heap is too small");
return;
} }
if (TOTAL_MEMORY + REGION_SIZE * HUMON_COUNT > MAX_MEMORY) { if (TOTAL_MEMORY + REGION_SIZE * HUMON_COUNT > MAX_MEMORY) {
System.out.println("Skipped. Initial heap size is to close to max heap size."); throw new SkippedException("Initial heap size is to close to max heap size.");
return;
} }
System.out.format("Running with %s initial heap size of %s maximum heap size. " System.out.format("Running with %s initial heap size of %s maximum heap size. "

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
* @test TestLargePageUseForAuxMemory.java * @test TestLargePageUseForAuxMemory.java
* @bug 8058354 * @bug 8058354
* @key gc * @key gc
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary /testlibrary/whitebox /test/lib
* @requires (vm.gc=="G1" | vm.gc=="null") * @requires (vm.gc=="G1" | vm.gc=="null") & vm.debug
* @build TestLargePageUseForAuxMemory * @build TestLargePageUseForAuxMemory
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission * sun.hotspot.WhiteBox$WhiteBoxPermission
@ -35,6 +35,7 @@
*/ */
import com.oracle.java.testlibrary.*; import com.oracle.java.testlibrary.*;
import jtreg.SkippedException;
import sun.hotspot.WhiteBox; import sun.hotspot.WhiteBox;
public class TestLargePageUseForAuxMemory { public class TestLargePageUseForAuxMemory {
@ -88,18 +89,12 @@ public class TestLargePageUseForAuxMemory {
} }
public static void main(String[] args) throws Exception { 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(); WhiteBox wb = WhiteBox.getWhiteBox();
smallPageSize = wb.getVMPageSize(); smallPageSize = wb.getVMPageSize();
largePageSize = wb.getVMLargePageSize(); largePageSize = wb.getVMLargePageSize();
if (largePageSize == 0) { if (largePageSize == 0) {
System.out.println("Skip tests because large page support does not seem to be available on this platform."); throw new SkippedException("Large page support does not seem to be available on this platform.");
return;
} }
// To get large pages for the card table etc. we need at least a 1G heap (with 4k page size). // To get large pages for the card table etc. we need at least a 1G heap (with 4k page size).

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,8 @@ import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.Platform; import com.oracle.java.testlibrary.Platform;
import com.oracle.java.testlibrary.ProcessTools; import com.oracle.java.testlibrary.ProcessTools;
import com.oracle.java.testlibrary.Utils; import com.oracle.java.testlibrary.Utils;
import jtreg.SkippedException;
import java.io.IOException; import java.io.IOException;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage; import java.lang.management.MemoryUsage;
@ -67,10 +69,9 @@ public class TestShrinkAuxiliaryData {
int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize())); int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize()));
if (maxCacheSize < hotCardTableSize) { if (maxCacheSize < hotCardTableSize) {
System.out.format("Skiping test for %d cache size due max cache size %d", throw new SkippedException(String.format(
hotCardTableSize, maxCacheSize "Skiping test for %d cache size due max cache size %d",
); hotCardTableSize, maxCacheSize));
return;
} }
printTestInfo(maxCacheSize); printTestInfo(maxCacheSize);

View File

@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different * @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null" * @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 com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* TestShrinkAuxiliaryData TestShrinkAuxiliaryData00 * TestShrinkAuxiliaryData TestShrinkAuxiliaryData00
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different * @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null" * @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 com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* TestShrinkAuxiliaryData TestShrinkAuxiliaryData05 * TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different * @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null" * @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 com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10 * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different * @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null" * @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 com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15 * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different * @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null" * @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 com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20 * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different * @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null" * @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 com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25 * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -27,7 +27,7 @@
* @summary Checks that decommitment occurs for JVM with different * @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @requires vm.gc=="G1" | vm.gc=="null" * @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 com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30 * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30
* @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox

View File

@ -25,6 +25,7 @@
* @test CompressedClassSpaceSizeInJmapHeap * @test CompressedClassSpaceSizeInJmapHeap
* @bug 8004924 * @bug 8004924
* @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize * @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize
* @requires vm.bits == 64
* @library /testlibrary * @library /testlibrary
* @run main/othervm -XX:CompressedClassSpaceSize=50m CompressedClassSpaceSizeInJmapHeap * @run main/othervm -XX:CompressedClassSpaceSize=50m CompressedClassSpaceSizeInJmapHeap
*/ */

View File

@ -30,6 +30,7 @@ import static com.oracle.java.testlibrary.Asserts.*;
* @bug 8000754 * @bug 8000754
* @summary Tests that a MemoryPoolMXBeans is created for metaspace and that a * @summary Tests that a MemoryPoolMXBeans is created for metaspace and that a
* MemoryManagerMXBean is created. * MemoryManagerMXBean is created.
* @requires vm.bits == 64
* @library /testlibrary * @library /testlibrary
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops TestMetaspaceMemoryPool * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops TestMetaspaceMemoryPool
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:MaxMetaspaceSize=60m TestMetaspaceMemoryPool * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:MaxMetaspaceSize=60m TestMetaspaceMemoryPool

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2009, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,11 +24,13 @@
/* /*
* @test TestBootNativeLibraryPath.java * @test TestBootNativeLibraryPath.java
* @bug 6819213 * @bug 6819213
* @compile -XDignore.symbol.file TestBootNativeLibraryPath.java
* @summary verify sun.boot.native.library.path is expandable on 32 bit systems * @summary verify sun.boot.native.library.path is expandable on 32 bit systems
* @run main TestBootNativeLibraryPath
* @author ksrini * @author ksrini
*/ * @library /test/lib
* @requires vm.bits == 32
* @compile -XDignore.symbol.file TestBootNativeLibraryPath.java
* @run main TestBootNativeLibraryPath
*/
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
@ -107,10 +109,6 @@ public class TestBootNativeLibraryPath {
public static void main(String[] args) { public static void main(String[] args) {
try { 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"); String osname = System.getProperty("os.name");
if (osname.startsWith("Windows")) { if (osname.startsWith("Windows")) {
osname = "Windows"; osname = "Windows";

View File

@ -25,10 +25,13 @@
* @test * @test
* @bug 8024927 * @bug 8024927
* @summary Testing address of compressed class pointer space as best as possible. * @summary Testing address of compressed class pointer space as best as possible.
* @library /testlibrary * @requires vm.bits == 64
* @library /testlibrary /test/lib
* @run main CompressedClassPointers
*/ */
import com.oracle.java.testlibrary.*; import com.oracle.java.testlibrary.*;
import jtreg.SkippedException;
public class CompressedClassPointers { public class CompressedClassPointers {
@ -114,17 +117,10 @@ public class CompressedClassPointers {
} }
public static void main(String[] args) throws Exception { 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()) { if (Platform.isSolaris()) {
String name = System.getProperty("os.version"); String name = System.getProperty("os.version");
if (name.equals("5.10")) { if (name.equals("5.10")) {
System.out.println("Skipping test on Solaris 10"); throw new SkippedException("Solaris 10 can't mmap compressed oops space without a base");
return;
} }
} }
smallHeapTest(); smallHeapTest();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,8 @@
* @key regression * @key regression
* @summary NPG: UseCompressedClassPointers asserts with ObjectAlignmentInBytes=32 * @summary NPG: UseCompressedClassPointers asserts with ObjectAlignmentInBytes=32
* @library /testlibrary * @library /testlibrary
* @requires vm.bits == 64
* @run main CompressedKlassPointerAndOops
*/ */
import com.oracle.java.testlibrary.*; import com.oracle.java.testlibrary.*;
@ -34,13 +36,6 @@ import com.oracle.java.testlibrary.*;
public class CompressedKlassPointerAndOops { public class CompressedKlassPointerAndOops {
public static void main(String[] args) throws Exception { 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(16);
runWithAlignment(32); runWithAlignment(32);
runWithAlignment(64); runWithAlignment(64);

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,11 +23,12 @@
/* /*
* @test TestOnError * @test TestOnError
* @bug 8078470
* @summary Test using -XX:OnError=<cmd> * @summary Test using -XX:OnError=<cmd>
* @library /testlibrary * @library /testlibrary
* @requires vm.debug
* @build TestOnError com.oracle.java.testlibrary.* * @build TestOnError com.oracle.java.testlibrary.*
* @run main TestOnError * @run main TestOnError
* @bug 8078470
*/ */
import com.oracle.java.testlibrary.*; import com.oracle.java.testlibrary.*;
@ -35,11 +36,6 @@ import com.oracle.java.testlibrary.*;
public class TestOnError { public class TestOnError {
public static void main(String[] args) throws Exception { 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"; String msg = "Test Succeeded";
// Execute the VM so that a // Execute the VM so that a

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,14 +21,19 @@
* questions. * questions.
*/ */
// ClassFileInstaller is needed to place test.Empty into well-known place
/** /**
* @test * @test
* @library /runtime/testlibrary * @library /test/lib classes
* @library classes * @build test.Empty
* @build test.Empty ClassUnloadCommon * @run driver ClassFileInstaller test.Empty
* @run main/othervm/timeout=200 FragmentMetaspaceSimple * @run main/othervm/timeout=200 FragmentMetaspaceSimple
*/ */
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
@ -47,8 +52,14 @@ public class FragmentMetaspaceSimple {
private static void runSimple(long time) { private static void runSimple(long time) {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
ArrayList<ClassLoader> cls = new ArrayList<>(); ArrayList<ClassLoader> cls = new ArrayList<>();
for (int i = 0; System.currentTimeMillis() < startTime + time; ++i) { char sep = File.separatorChar;
ClassLoader ldr = ClassUnloadCommon.newClassLoader(); String fileName = "test" + sep + "Empty.class";
File file = new File(fileName);
byte buff[] = read(file);
int i = 0;
for (i = 0; System.currentTimeMillis() < startTime + time; ++i) {
ClassLoader ldr = new MyClassLoader(buff);
if (i % 1000 == 0) { if (i % 1000 == 0) {
cls.clear(); cls.clear();
} }
@ -59,11 +70,43 @@ public class FragmentMetaspaceSimple {
Class<?> c = null; Class<?> c = null;
try { try {
c = ldr.loadClass("test.Empty"); c = ldr.loadClass("test.Empty");
c.getClass().getClassLoader(); // make sure we have a valid class.
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
System.out.println("i=" + i + ", len" + buff.length);
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
c = null; c = null;
} }
cls = null; cls = null;
System.out.println("Finished " + i + " iterations in " +
(System.currentTimeMillis() - startTime) + " ms");
}
private static byte[] read(File file) {
byte buff[] = new byte[(int)(file.length())];
try {
DataInputStream din = new DataInputStream(new FileInputStream(file));
din.readFully(buff);
din.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
return buff;
}
static class MyClassLoader extends ClassLoader {
byte buff[];
MyClassLoader(byte buff[]) {
this.buff = buff;
}
public Class<?> loadClass() throws ClassNotFoundException {
String name = "test.Empty";
try {
return defineClass(name, buff, 0, buff.length);
} catch (Throwable e) {
throw new ClassNotFoundException(name, e);
}
}
} }
} }

View File

@ -26,7 +26,7 @@ import com.oracle.java.testlibrary.OutputAnalyzer;
/* /*
* @test MaxMetaspaceSizeTest * @test MaxMetaspaceSizeTest
* @requires vm.bits == "64" * @requires vm.bits == 64
* @bug 8087291 * @bug 8087291
* @library /testlibrary * @library /testlibrary
* @run main/othervm MaxMetaspaceSizeTest * @run main/othervm MaxMetaspaceSizeTest

View File

@ -28,26 +28,20 @@
* This is a negative test; using object alignment for loading that * This is a negative test; using object alignment for loading that
* is different from object alignment for creating a CDS file * is different from object alignment for creating a CDS file
* should fail when loading. * should fail when loading.
* @requires vm.bits == 64
* @library /testlibrary * @library /testlibrary
* @bug 8025642 * @bug 8025642
* @run main CdsDifferentObjectAlignment
*/ */
import com.oracle.java.testlibrary.*; import com.oracle.java.testlibrary.*;
public class CdsDifferentObjectAlignment { 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 // Parameters are object alignment expressed in bytes
private static void private static void

View File

@ -25,25 +25,19 @@
* @test CdsSameObjectAlignment * @test CdsSameObjectAlignment
* @summary Testing CDS (class data sharing) using varying object alignment. * @summary Testing CDS (class data sharing) using varying object alignment.
* Using same object alignment for each dump/load pair * Using same object alignment for each dump/load pair
* @requires vm.bits == 64
* @library /testlibrary * @library /testlibrary
* @run main CdsSameObjectAlignment
*/ */
import com.oracle.java.testlibrary.*; import com.oracle.java.testlibrary.*;
public class CdsSameObjectAlignment { public class CdsSameObjectAlignment {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String nativeWordSize = System.getProperty("sun.arch.data.model"); dumpAndLoadSharedArchive(8);
if (!Platform.is64bit()) { dumpAndLoadSharedArchive(16);
System.out.println("ObjectAlignmentInBytes for CDS is only " + dumpAndLoadSharedArchive(32);
"supported on 64bit platforms; this plaform is " + dumpAndLoadSharedArchive(64);
nativeWordSize);
System.out.println("Skipping the test");
} else {
dumpAndLoadSharedArchive(8);
dumpAndLoadSharedArchive(16);
dumpAndLoadSharedArchive(32);
dumpAndLoadSharedArchive(64);
}
} }
private static void private static void

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,54 +25,55 @@
* @test * @test
* @bug 7051189 8023393 * @bug 7051189 8023393
* @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
* @library /testlibrary * @library /testlibrary /test/lib
* @requires os.family == "solaris" | os.family == "linux" | os.family == "mac"
* @run main XCheckJSig * @run main XCheckJSig
*/ */
import java.util.*; import java.io.File;
import java.util.Map;
import com.oracle.java.testlibrary.*; import com.oracle.java.testlibrary.*;
import jtreg.SkippedException;
public class XCheckJSig { public class XCheckJSig {
public static void main(String args[]) throws Throwable { public static void main(String args[]) throws Throwable {
System.out.println("Regression test for bugs 7051189 and 8023393"); 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 jdk_path = System.getProperty("test.jdk");
String os_arch = Platform.getOsArch(); String os_arch = Platform.getOsArch();
String libjsig; String libjsig;
String env_var; String env_var;
if (Platform.isOSX()) { if (Platform.isOSX()) {
libjsig = jdk_path + "/jre/lib/server/libjsig.dylib";
env_var = "DYLD_INSERT_LIBRARIES"; env_var = "DYLD_INSERT_LIBRARIES";
libjsig = jdk_path + "/jre/lib/libjsig.dylib"; // jdk location
if (!(new File(libjsig).exists())) {
libjsig = jdk_path + "/lib/libjsig.dylib"; // jre location
}
} else { } else {
libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so";
env_var = "LD_PRELOAD"; env_var = "LD_PRELOAD";
} libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so"; // jdk location
String java_program; if (!(new File(libjsig).exists())) {
if (Platform.isSolaris()) { libjsig = jdk_path + "/lib/" + os_arch + "/libjsig.so"; // jre location
// On Solaris, need to call the 64-bit Java directly in order for }
// LD_PRELOAD to work because libjsig.so is 64-bit.
java_program = jdk_path + "/jre/bin/" + os_arch + "/java";
} else {
java_program = JDKToolFinder.getJDKTool("java");
} }
// If this test fails, these might be useful to know. // If this test fails, these might be useful to know.
System.out.println("libjsig: " + libjsig); System.out.println("libjsig: " + libjsig);
System.out.println("osArch: " + os_arch); System.out.println("osArch: " + os_arch);
System.out.println("java_program: " + java_program);
ProcessBuilder pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-version"); // Make sure the libjsig file exists.
if (!(new File(libjsig).exists())) {
throw new jtreg.SkippedException("File " + libjsig + " not found");
}
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version");
Map<String, String> env = pb.environment(); Map<String, String> env = pb.environment();
env.put(env_var, libjsig); env.put(env_var, libjsig);
OutputAnalyzer output = new OutputAnalyzer(pb.start()); OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("libjsig is activated"); output.shouldNotContain("libjsig is activated");
output.shouldHaveExitValue(0); output.shouldHaveExitValue(0);
pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-verbose:jni", "-version"); pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-verbose:jni", "-version");
env = pb.environment(); env = pb.environment();
env.put(env_var, libjsig); env.put(env_var, libjsig);
output = new OutputAnalyzer(pb.start()); output = new OutputAnalyzer(pb.start());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,7 @@
/* @test TestLargePagesFlags /* @test TestLargePagesFlags
* @summary Tests how large pages are choosen depending on the given large pages flag combinations. * @summary Tests how large pages are choosen depending on the given large pages flag combinations.
* @requires os.family == "linux"
* @library /testlibrary * @library /testlibrary
* @run main TestLargePagesFlags * @run main TestLargePagesFlags
*/ */
@ -30,16 +31,12 @@
import com.oracle.java.testlibrary.OutputAnalyzer; import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.Platform; import com.oracle.java.testlibrary.Platform;
import com.oracle.java.testlibrary.ProcessTools; import com.oracle.java.testlibrary.ProcessTools;
import java.util.ArrayList; import java.util.ArrayList;
public class TestLargePagesFlags { public class TestLargePagesFlags {
public static void main(String [] args) throws Exception { public static void main(String [] args) throws Exception {
if (!Platform.isLinux()) {
System.out.println("Skipping. TestLargePagesFlags has only been implemented for Linux.");
return;
}
testUseTransparentHugePages(); testUseTransparentHugePages();
testUseHugeTLBFS(); testUseHugeTLBFS();
testUseSHM(); testUseSHM();

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -20,20 +20,24 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
import java.io.File;
import com.oracle.java.testlibrary.ProcessTools;
import com.oracle.java.testlibrary.OutputAnalyzer;
import java.util.ArrayList;
/* /*
* @test * @test
* @bug 6515172 * @bug 6515172
* @summary Check that availableProcessors reports the correct value when running in a cpuset on linux * @summary Check that availableProcessors reports the correct value when running in a cpuset on linux
* @requires os.family == "linux" * @requires os.family == "linux"
* @library /testlibrary * @library /testlibrary /test/lib
* @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.*
* @run driver AvailableProcessors * @run driver AvailableProcessors
*/ */
import com.oracle.java.testlibrary.ProcessTools;
import com.oracle.java.testlibrary.OutputAnalyzer;
import jtreg.SkippedException;
import java.util.ArrayList;
import java.io.File;
public class AvailableProcessors { public class AvailableProcessors {
static final String SUCCESS_STRING = "Found expected processors: "; static final String SUCCESS_STRING = "Found expected processors: ";
@ -47,20 +51,18 @@ public class AvailableProcessors {
String taskset; String taskset;
final String taskset1 = "/bin/taskset"; final String taskset1 = "/bin/taskset";
final String taskset2 = "/usr/bin/taskset"; final String taskset2 = "/usr/bin/taskset";
if (new File(taskset1).exists()) if (new File(taskset1).exists()) {
taskset = taskset1; taskset = taskset1;
else if (new File(taskset2).exists()) } else if (new File(taskset2).exists()) {
taskset = taskset2; taskset = taskset2;
else { } else {
System.out.println("Skipping test: could not find taskset command"); throw new SkippedException("Could not find taskset command");
return;
} }
int available = Runtime.getRuntime().availableProcessors(); int available = Runtime.getRuntime().availableProcessors();
if (available == 1) { if (available == 1) {
System.out.println("Skipping test: only one processor available"); throw new SkippedException("only one processor available");
return;
} }
// Get the java command we want to execute // Get the java command we want to execute

View File

@ -25,8 +25,10 @@ import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.stream.Stream;
public class ClassUnloadCommon { public class ClassUnloadCommon {
public static class TestFailure extends RuntimeException { public static class TestFailure extends RuntimeException {
@ -55,14 +57,45 @@ public class ClassUnloadCommon {
System.gc(); System.gc();
} }
/**
* Creates a class loader that loads classes from {@code ${test.class.path}}
* before delegating to the system class loader.
*/
public static ClassLoader newClassLoader() { public static ClassLoader newClassLoader() {
try { String cp = System.getProperty("test.class.path", ".");
return new URLClassLoader(new URL[] { URL[] urls = Stream.of(cp.split(File.pathSeparator))
Paths.get(System.getProperty("test.classes",".") + File.separatorChar + "classes").toUri().toURL(), .map(Paths::get)
}, null); .map(ClassUnloadCommon::toURL)
} catch (MalformedURLException e){ .toArray(URL[]::new);
throw new RuntimeException("Unexpected URL conversion failure", e); return new URLClassLoader(urls) {
} @Override
public Class<?> loadClass(String cn, boolean resolve)
throws ClassNotFoundException
{
synchronized (getClassLoadingLock(cn)) {
Class<?> c = findLoadedClass(cn);
if (c == null) {
try {
c = findClass(cn);
} catch (ClassNotFoundException e) {
c = getParent().loadClass(cn);
}
}
if (resolve) {
resolveClass(c);
}
return c;
}
}
};
} }
static URL toURL(Path path) {
try {
return path.toUri().toURL();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
} }

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -20,27 +20,27 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
import java.io.PrintWriter;
import com.oracle.java.testlibrary.*;
/* /*
* Test to verify GetObjectSize does not overflow on a 600M element int[] * Test to verify GetObjectSize does not overflow on a 600M element int[]
* *
* @test * @test
* @bug 8027230 * @bug 8027230
* @library /testlibrary * @library /testlibrary /test/lib
* @requires vm.bits == 64
* @build ClassFileInstaller com.oracle.java.testlibrary.* GetObjectSizeOverflowAgent * @build ClassFileInstaller com.oracle.java.testlibrary.* GetObjectSizeOverflowAgent
* @run main ClassFileInstaller GetObjectSizeOverflowAgent * @run main ClassFileInstaller GetObjectSizeOverflowAgent
* @run main GetObjectSizeOverflow * @run main GetObjectSizeOverflow
*/ */
import java.io.PrintWriter;
import com.oracle.java.testlibrary.*;
import jtreg.SkippedException;
public class GetObjectSizeOverflow { public class GetObjectSizeOverflow {
public static void main(String[] args) throws Exception { 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"); PrintWriter pw = new PrintWriter("MANIFEST.MF");
pw.println("Premain-Class: GetObjectSizeOverflowAgent"); pw.println("Premain-Class: GetObjectSizeOverflowAgent");
pw.close(); pw.close();
@ -55,8 +55,7 @@ public class GetObjectSizeOverflow {
if (output.getStdout().contains("Could not reserve enough space") || output.getStderr().contains("java.lang.OutOfMemoryError")) { if (output.getStdout().contains("Could not reserve enough space") || output.getStderr().contains("java.lang.OutOfMemoryError")) {
System.out.println("stdout: " + output.getStdout()); System.out.println("stdout: " + output.getStdout());
System.out.println("stderr: " + output.getStderr()); System.out.println("stderr: " + output.getStderr());
System.out.println("Test could not reserve or allocate enough space, skipping"); throw new SkippedException("Test could not reserve or allocate enough space");
return;
} }
output.stdoutShouldContain("GetObjectSizeOverflow passed"); output.stdoutShouldContain("GetObjectSizeOverflow passed");

View File

@ -52,6 +52,7 @@ public class VMProps implements Callable<Map<String, String>> {
map.put("vm.flavor", vmFlavor()); map.put("vm.flavor", vmFlavor());
map.put("vm.compMode", vmCompMode()); map.put("vm.compMode", vmCompMode());
map.put("vm.bits", vmBits()); map.put("vm.bits", vmBits());
map.put("vm.debug", vmDebug());
dump(map); dump(map);
return map; return map;
} }
@ -103,6 +104,13 @@ public class VMProps implements Callable<Map<String, String>> {
return System.getProperty("sun.arch.data.model"); return System.getProperty("sun.arch.data.model");
} }
/**
* @return debug level value extracted from the "java.vm.version" property.
*/
protected String vmDebug() {
return "" + System.getProperty("java.vm.version").toLowerCase().contains("debug");
}
/** /**
* Dumps the map to the file if the file name is given as the property. * Dumps the map to the file if the file name is given as the property.
* This functionality could be helpful to know context in the real * This functionality could be helpful to know context in the real

View File

@ -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);
}
}