8210732: remove jdk.testlibrary.Utils

Reviewed-by: alanb, jcbeyler
This commit is contained in:
Igor Ignatyev 2018-09-14 14:02:57 -07:00
parent a6d0d07957
commit 8b28ad6efe
95 changed files with 159 additions and 475 deletions

View File

@ -27,7 +27,8 @@
* @summary Call Class.forName() on the system classloader from a class loaded * @summary Call Class.forName() on the system classloader from a class loaded
* from a custom classloader, using the current class's protection domain. * from a custom classloader, using the current class's protection domain.
* @library /test/jdk/lib/testlibrary * @library /test/jdk/lib/testlibrary
* @build jdk.testlibrary.Utils JarUtils * @library /test/lib
* @build jdk.test.lib.Utils JarUtils
* @build ClassForName ProtectionDomainCacheTest * @build ClassForName ProtectionDomainCacheTest
* @run main/othervm/policy=test.policy -XX:+UnlockDiagnosticVMOptions -XX:VerifySubSet=dictionary -XX:+VerifyAfterGC -Xlog:gc+verify=debug,protectiondomain=trace,class+unload:gc.log -Djava.security.manager ProtectionDomainCacheTest * @run main/othervm/policy=test.policy -XX:+UnlockDiagnosticVMOptions -XX:VerifySubSet=dictionary -XX:+VerifyAfterGC -Xlog:gc+verify=debug,protectiondomain=trace,class+unload:gc.log -Djava.security.manager ProtectionDomainCacheTest
*/ */
@ -39,7 +40,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.List; import java.util.List;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* Create .jar, load ClassForName from .jar using a URLClassLoader * Create .jar, load ClassForName from .jar using a URLClassLoader

View File

@ -36,18 +36,17 @@ import java.util.Iterator;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
/* @test /* @test
* @bug 6306165 6432567 * @bug 6306165 6432567
* @summary Check that a bad handshake doesn't cause a debuggee to abort * @summary Check that a bad handshake doesn't cause a debuggee to abort
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* *
* @modules java.management * @modules java.management
* jdk.jdi * jdk.jdi
* @build jdk.testlibrary.* VMConnection BadHandshakeTest Exit0 * @build VMConnection BadHandshakeTest Exit0
* @run driver BadHandshakeTest * @run driver BadHandshakeTest
*/ */
public class BadHandshakeTest { public class BadHandshakeTest {

View File

@ -24,7 +24,6 @@
/* /*
* @test * @test
* @summary Smoke test for JDWP hardening * @summary Smoke test for JDWP hardening
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @run driver BasicJDWPConnectionTest * @run driver BasicJDWPConnectionTest
*/ */
@ -37,7 +36,7 @@ import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.apps.LingeredApp;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -23,16 +23,14 @@
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* @test /* @test
* @bug 6354345 * @bug 6354345
* @summary Check that multiple -agentlib statements in command line fails * @summary Check that multiple -agentlib statements in command line fails
* *
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @modules java.management * @modules java.management
* @build jdk.testlibrary.*
* @build DoubleAgentTest Exit0 * @build DoubleAgentTest Exit0
* @run driver DoubleAgentTest * @run driver DoubleAgentTest
*/ */

View File

@ -25,12 +25,11 @@
* @bug 4531526 * @bug 4531526
* @summary Test that more than one debuggee cannot bind to same port * @summary Test that more than one debuggee cannot bind to same port
* at the same time. * at the same time.
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* *
* @modules java.management * @modules java.management
* jdk.jdi * jdk.jdi
* @build jdk.testlibrary.* VMConnection ExclusiveBind HelloWorld * @build VMConnection ExclusiveBind HelloWorld
* @run driver ExclusiveBind * @run driver ExclusiveBind
*/ */
import java.net.ServerSocket; import java.net.ServerSocket;
@ -46,7 +45,7 @@ import java.util.Iterator;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class ExclusiveBind { public class ExclusiveBind {
/* /*

View File

@ -28,7 +28,7 @@ import java.util.Arrays;
import jdk.test.lib.thread.ProcessThread; import jdk.test.lib.thread.ProcessThread;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* Utility functions for test runners. * Utility functions for test runners.

View File

@ -34,19 +34,18 @@ import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXConnectorFactory;
import jdk.test.lib.thread.ProcessThread; import jdk.test.lib.thread.ProcessThread;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* @test * @test
* @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent * @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
* *
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @modules java.management * @modules java.management
* jdk.attach * jdk.attach
* jdk.jartool/sun.tools.jar * jdk.jartool/sun.tools.jar
* *
* @run build jdk.testlibrary.* Application SimpleProvider jdk.testlibrary.* * @run build Application SimpleProvider
* @run main/timeout=300 StartManagementAgent * @run main/timeout=300 StartManagementAgent
*/ */

View File

@ -27,12 +27,12 @@
@bug 8071668 @bug 8071668
@summary Check whether clipboard see changes from external process after taking ownership @summary Check whether clipboard see changes from external process after taking ownership
@author Anton Nashatyrev: area=datatransfer @author Anton Nashatyrev: area=datatransfer
@library /lib/testlibrary @library /test/lib
@build jdk.testlibrary.Utils @build jdk.test.lib.Utils
@run main ClipboardInterVMTest @run main ClipboardInterVMTest
*/ */
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import java.awt.*; import java.awt.*;
import java.awt.datatransfer.*; import java.awt.datatransfer.*;

View File

@ -27,7 +27,8 @@
* @summary Call Class.forName() on the system classloader from a class loaded * @summary Call Class.forName() on the system classloader from a class loaded
* from a custom classloader. * from a custom classloader.
* @library /lib/testlibrary * @library /lib/testlibrary
* @build jdk.testlibrary.Utils JarUtils * @library /test/lib
* @build jdk.test.lib.Utils JarUtils
* @build ClassForName ClassForNameLeak * @build ClassForName ClassForNameLeak
* @run main/othervm/policy=test.policy -Djava.security.manager ClassForNameLeak * @run main/othervm/policy=test.policy -Djava.security.manager ClassForNameLeak
*/ */
@ -48,7 +49,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* Create .jar, load ClassForName from .jar using a URLClassLoader * Create .jar, load ClassForName from .jar using a URLClassLoader

View File

@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.LockSupport;
import jdk.test.lib.LockFreeLogger; import jdk.test.lib.LockFreeLogger;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/** /**
* ThreadStateController allows a thread to request this thread to transition * ThreadStateController allows a thread to request this thread to transition

View File

@ -23,17 +23,16 @@
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* @test * @test
* @bug 6289149 * @bug 6289149
* @summary test when the agent's class is missing the premain() function. * @summary test when the agent's class is missing the premain() function.
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @modules java.management * @modules java.management
* java.instrument * java.instrument
* @run build jdk.testlibrary.* DummyMain * @run build DummyMain
* @run shell ../MakeJAR3.sh NoPremainAgent * @run shell ../MakeJAR3.sh NoPremainAgent
* @run main/othervm -XX:-CreateCoredumpOnCrash NoPremainAgentTest * @run main/othervm -XX:-CreateCoredumpOnCrash NoPremainAgentTest
*/ */

View File

@ -23,16 +23,15 @@
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* @test * @test
* @bug 5055293 * @bug 5055293
* @summary Test non ascii characters in the Premain-Class attribute. * @summary Test non ascii characters in the Premain-Class attribute.
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @modules java.management * @modules java.management
* @run build jdk.testlibrary.* DummyMain * @run build DummyMain
* @run main PremainClassTest * @run main PremainClassTest
*/ */
public class PremainClassTest { public class PremainClassTest {

View File

@ -23,17 +23,16 @@
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* @test * @test
* @bug 6289149 * @bug 6289149
* @summary test when the agent's class has a zero arg premain() function. * @summary test when the agent's class has a zero arg premain() function.
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @modules java.management * @modules java.management
* java.instrument * java.instrument
* @run build jdk.testlibrary.* DummyMain * @run build DummyMain
* @run shell ../MakeJAR3.sh ZeroArgPremainAgent * @run shell ../MakeJAR3.sh ZeroArgPremainAgent
* @run main/othervm -XX:-CreateCoredumpOnCrash ZeroArgPremainAgentTest * @run main/othervm -XX:-CreateCoredumpOnCrash ZeroArgPremainAgentTest
*/ */

View File

@ -22,7 +22,7 @@
*/ */
import jdk.test.lib.TimeLimitedRunner; import jdk.test.lib.TimeLimitedRunner;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
import test.java.lang.invoke.lib.Helper; import test.java.lang.invoke.lib.Helper;

View File

@ -25,7 +25,7 @@ package test.java.lang.invoke.MethodHandles;
import jdk.test.lib.TimeLimitedRunner; import jdk.test.lib.TimeLimitedRunner;
import jdk.testlibrary.Asserts; import jdk.testlibrary.Asserts;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import test.java.lang.invoke.lib.CodeCacheOverflowProcessor; import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
import test.java.lang.invoke.lib.Helper; import test.java.lang.invoke.lib.Helper;

View File

@ -23,7 +23,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodHandles * @summary unit tests for java.lang.invoke.MethodHandles
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @compile MethodHandlesTest.java MethodHandlesAsCollectorTest.java remote/RemoteExample.java * @compile MethodHandlesTest.java MethodHandlesAsCollectorTest.java remote/RemoteExample.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
* -XX:-VerifyDependencies * -XX:-VerifyDependencies

View File

@ -23,7 +23,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodHandles * @summary unit tests for java.lang.invoke.MethodHandles
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @compile MethodHandlesTest.java MethodHandlesCastFailureTest.java remote/RemoteExample.java * @compile MethodHandlesTest.java MethodHandlesCastFailureTest.java remote/RemoteExample.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
* -XX:-VerifyDependencies * -XX:-VerifyDependencies

View File

@ -23,7 +23,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodHandles * @summary unit tests for java.lang.invoke.MethodHandles
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @compile MethodHandlesTest.java MethodHandlesGeneralTest.java remote/RemoteExample.java * @compile MethodHandlesTest.java MethodHandlesGeneralTest.java remote/RemoteExample.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
* -XX:-VerifyDependencies * -XX:-VerifyDependencies

View File

@ -23,7 +23,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodHandles * @summary unit tests for java.lang.invoke.MethodHandles
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @compile MethodHandlesTest.java MethodHandlesInsertArgumentsTest.java remote/RemoteExample.java * @compile MethodHandlesTest.java MethodHandlesInsertArgumentsTest.java remote/RemoteExample.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
* -XX:-VerifyDependencies * -XX:-VerifyDependencies

View File

@ -23,7 +23,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodHandles * @summary unit tests for java.lang.invoke.MethodHandles
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @compile MethodHandlesTest.java MethodHandlesInvokersTest.java remote/RemoteExample.java * @compile MethodHandlesTest.java MethodHandlesInvokersTest.java remote/RemoteExample.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
* -XX:-VerifyDependencies * -XX:-VerifyDependencies

View File

@ -23,7 +23,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodHandles * @summary unit tests for java.lang.invoke.MethodHandles
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @compile MethodHandlesTest.java MethodHandlesPermuteArgumentsTest.java remote/RemoteExample.java * @compile MethodHandlesTest.java MethodHandlesPermuteArgumentsTest.java remote/RemoteExample.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
* -XX:-VerifyDependencies * -XX:-VerifyDependencies

View File

@ -23,7 +23,7 @@
/* @test /* @test
* @summary unit tests for java.lang.invoke.MethodHandles * @summary unit tests for java.lang.invoke.MethodHandles
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @compile MethodHandlesTest.java MethodHandlesSpreadArgumentsTest.java remote/RemoteExample.java * @compile MethodHandlesTest.java MethodHandlesSpreadArgumentsTest.java remote/RemoteExample.java
* @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
* -XX:-VerifyDependencies * -XX:-VerifyDependencies

View File

@ -23,7 +23,7 @@
/* @test /* @test
* @summary unit tests for method handles which permute their arguments * @summary unit tests for method handles which permute their arguments
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest
*/ */

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 8019184 * @bug 8019184
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @summary MethodHandles.catchException() fails when methods have 8 args + varargs * @summary MethodHandles.catchException() fails when methods have 8 args + varargs
* @run main TestCatchExceptionWithVarargs * @run main TestCatchExceptionWithVarargs
*/ */

View File

@ -34,7 +34,7 @@ import java.util.Collections;
* @summary unit tests for varargs array methods: MethodHandleInfo.varargsArray(int), * @summary unit tests for varargs array methods: MethodHandleInfo.varargsArray(int),
* MethodHandleInfo.varargsArray(Class,int) & MethodHandleInfo.varargsList(int) * MethodHandleInfo.varargsArray(Class,int) & MethodHandleInfo.varargsList(int)
* @modules java.base/sun.invoke.util * @modules java.base/sun.invoke.util
* @library /lib/testlibrary /java/lang/invoke/common * @library /test/lib /java/lang/invoke/common
* @compile/module=java.base java/lang/invoke/MethodHandleHelper.java * @compile/module=java.base java/lang/invoke/MethodHandleHelper.java
* @run main/bootclasspath VarargsArrayTest * @run main/bootclasspath VarargsArrayTest
* @run main/bootclasspath/othervm -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.START_ARITY=250 * @run main/bootclasspath/othervm -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.START_ARITY=250

View File

@ -23,7 +23,7 @@
package test.java.lang.invoke.lib; package test.java.lang.invoke.lib;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/** /**
* Helper class used to catch and process VirtualMachineError with message "Out * Helper class used to catch and process VirtualMachineError with message "Out
@ -36,7 +36,7 @@ public class CodeCacheOverflowProcessor {
/** /**
* Checks if an instance of Throwable is caused by VirtualMachineError with * Checks if an instance of Throwable is caused by VirtualMachineError with
* message "Out of space in CodeCache". May be used as filter in method * message "Out of space in CodeCache". May be used as filter in method
* {@code jdk.testlibrary.Utils.filterException}. * {@code jdk.test.lib.Utils.filterException}.
* *
* @param t - Throwable to check. * @param t - Throwable to check.
* @return true if Throwable is caused by VME, false otherwise. * @return true if Throwable is caused by VME, false otherwise.

View File

@ -32,9 +32,9 @@
* @requires vm.gc == "null" * @requires vm.gc == "null"
* @requires vm.opt.ExplicitGCInvokesConcurrent != "true" * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
* @requires vm.opt.DisableExplicitGC != "true" * @requires vm.opt.DisableExplicitGC != "true"
* @library /lib/testlibrary/ /test/lib * @library /test/lib
* *
* @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil * @build LowMemoryTest MemoryUtil RunUtil
* @build sun.hotspot.WhiteBox * @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LowMemoryTest * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LowMemoryTest
@ -47,7 +47,7 @@ import javax.management.*;
import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeData;
import jdk.test.lib.JDKToolFinder; import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import sun.hotspot.code.Compiler; import sun.hotspot.code.Compiler;

View File

@ -31,7 +31,7 @@ import java.util.Arrays;
import jdk.test.lib.JDKToolFinder; import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class RunUtil { public class RunUtil {

View File

@ -25,9 +25,7 @@
* @test * @test
* @bug 8072466 * @bug 8072466
* @summary Deadlock when initializing MulticastSocket and DatagramSocket * @summary Deadlock when initializing MulticastSocket and DatagramSocket
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @build jdk.testlibrary.*
* @run main/othervm MultiDead * @run main/othervm MultiDead
*/ */
@ -38,7 +36,7 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.JDKToolLauncher;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class MultiDead { public class MultiDead {
private static final int THREAD_PAIR_COUNT = 4; private static final int THREAD_PAIR_COUNT = 4;

View File

@ -25,10 +25,11 @@
* @test * @test
* @bug 8087112 * @bug 8087112
* @library /lib/testlibrary/ * @library /lib/testlibrary/
* @library /test/lib
* @modules java.net.http * @modules java.net.http
* java.logging * java.logging
* jdk.httpserver * jdk.httpserver
* @build jdk.testlibrary.SimpleSSLContext jdk.testlibrary.Utils * @build jdk.testlibrary.SimpleSSLContext jdk.test.lib.Utils
* @compile ../../../../com/sun/net/httpserver/LogFilter.java * @compile ../../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../../com/sun/net/httpserver/FileServerHandler.java * @compile ../../../../com/sun/net/httpserver/FileServerHandler.java
* @compile ../ProxyServer.java * @compile ../ProxyServer.java
@ -55,7 +56,7 @@ import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/** /**
* Driver for tests * Driver for tests

View File

@ -25,8 +25,8 @@
* @test * @test
* @bug 8137121 8137230 * @bug 8137121 8137230
* @summary (fc) Infinite loop FileChannel.truncate * @summary (fc) Infinite loop FileChannel.truncate
* @library /lib/testlibrary * @library /test/lib
* @build jdk.testlibrary.Utils * @build jdk.test.lib.Utils
* @run main/othervm/timeout=300 LoopingTruncate * @run main/othervm/timeout=300 LoopingTruncate
*/ */
@ -37,7 +37,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import static java.nio.file.StandardOpenOption.*; import static java.nio.file.StandardOpenOption.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static jdk.testlibrary.Utils.adjustTimeout; import static jdk.test.lib.Utils.adjustTimeout;
public class LoopingTruncate { public class LoopingTruncate {

View File

@ -24,7 +24,7 @@
/* @test /* @test
* @bug 6405995 * @bug 6405995
* @summary Unit test for selector wakeup and interruption * @summary Unit test for selector wakeup and interruption
* @library .. /lib/testlibrary/ * @library .. /test/lib
*/ */
import java.io.*; import java.io.*;
@ -44,7 +44,7 @@ public class Wakeup {
} }
static class Sleeper extends TestThread { static class Sleeper extends TestThread {
private static final long TIMEOUT = jdk.testlibrary.Utils.adjustTimeout(20_000); private static final long TIMEOUT = jdk.test.lib.Utils.adjustTimeout(20_000);
// barrier is used to synchronize sleeper thread and checking // barrier is used to synchronize sleeper thread and checking
// thread which is the main thread: when go() get to the end, // thread which is the main thread: when go() get to the end,

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 * @bug 4486658
* @summary Checks for responsiveness of blocking queues to cancellation. * @summary Checks for responsiveness of blocking queues to cancellation.
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -56,7 +56,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class CancelledProducerConsumerLoops { public class CancelledProducerConsumerLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -26,7 +26,7 @@
* @bug 6384064 * @bug 6384064
* @summary Check proper handling of interrupts * @summary Check proper handling of interrupts
* @author Martin Buchholz * @author Martin Buchholz
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -41,7 +41,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class Interrupt { public class Interrupt {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 * @bug 4486658
* @summary multiple producers and single consumer using blocking queues * @summary multiple producers and single consumer using blocking queues
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -52,7 +52,7 @@ import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class MultipleProducersSingleConsumerLoops { public class MultipleProducersSingleConsumerLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 * @bug 4486658
* @summary multiple producers and consumers using blocking queues * @summary multiple producers and consumers using blocking queues
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -52,7 +52,7 @@ import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class ProducerConsumerLoops { public class ProducerConsumerLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 * @bug 4486658
* @summary check ordering for blocking queues with 1 producer and multiple consumers * @summary check ordering for blocking queues with 1 producer and multiple consumers
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -51,7 +51,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class SingleProducerMultipleConsumerLoops { public class SingleProducerMultipleConsumerLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 8005696 * @bug 8005696
* @summary Basic tests for CompletableFuture * @summary Basic tests for CompletableFuture
* @library /lib/testlibrary/ * @library /test/lib
* @run main Basic * @run main Basic
* @run main/othervm -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 Basic * @run main/othervm -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 Basic
* @author Chris Hegarty * @author Chris Hegarty
@ -56,7 +56,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class Basic { public class Basic {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -41,7 +41,7 @@
* inserts it, and if present, with probability premove it removes * inserts it, and if present, with probability premove it removes
* it. (pinsert and premove are expressed as percentages to simplify * it. (pinsert and premove are expressed as percentages to simplify
* parsing from command line.) * parsing from command line.)
* @library /lib/testlibrary/ * @library /test/lib
* @run main/timeout=1600 MapLoops * @run main/timeout=1600 MapLoops
*/ */
@ -54,7 +54,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CyclicBarrier; import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class MapLoops { public class MapLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 6785442 * @bug 4486658 6785442
* @summary Checks that a set of threads can repeatedly get and modify items * @summary Checks that a set of threads can repeatedly get and modify items
* @library /lib/testlibrary/ * @library /test/lib
* @run main ConcurrentQueueLoops 8 123456 * @run main ConcurrentQueueLoops 8 123456
*/ */
@ -58,7 +58,7 @@ import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class ConcurrentQueueLoops { public class ConcurrentQueueLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -25,7 +25,7 @@
* @test * @test
* @bug 6253848 6366811 * @bug 6253848 6366811
* @summary Basic tests for CyclicBarrier * @summary Basic tests for CyclicBarrier
* @library /lib/testlibrary/ * @library /test/lib
* @author Martin Buchholz, David Holmes * @author Martin Buchholz, David Holmes
*/ */
@ -39,7 +39,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier; import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class Basic { public class Basic {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 * @bug 4486658
* @summary checks to make sure a pipeline of exchangers passes data. * @summary checks to make sure a pipeline of exchangers passes data.
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -44,7 +44,7 @@ import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.Exchanger; import java.util.concurrent.Exchanger;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class ExchangeLoops { public class ExchangeLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4965960 * @bug 4965960
* @summary Exercise ExecutorCompletionService * @summary Exercise ExecutorCompletionService
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -44,7 +44,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class ExecutorCompletionServiceLoops { public class ExecutorCompletionServiceLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -25,7 +25,7 @@
* @test * @test
* @bug 6399443 * @bug 6399443
* @summary Check for auto-shutdown and gc of singleThreadExecutors * @summary Check for auto-shutdown and gc of singleThreadExecutors
* @library /lib/testlibrary/ * @library /test/lib
* @run main/othervm/timeout=1000 AutoShutdown * @run main/othervm/timeout=1000 AutoShutdown
* @author Martin Buchholz * @author Martin Buchholz
*/ */
@ -41,7 +41,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class AutoShutdown { public class AutoShutdown {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -26,7 +26,7 @@
* @bug 6431315 * @bug 6431315
* @summary ExecutorService.invokeAll might hang * @summary ExecutorService.invokeAll might hang
* @author Martin Buchholz * @author Martin Buchholz
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -37,7 +37,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/** /**
* Adapted from Doug Lea, which was... * Adapted from Doug Lea, which was...

View File

@ -37,7 +37,7 @@
* @summary Checks for responsiveness of futures to cancellation. * @summary Checks for responsiveness of futures to cancellation.
* Runs under the assumption that ITERS computations require more than * Runs under the assumption that ITERS computations require more than
* TIMEOUT msecs to complete. * TIMEOUT msecs to complete.
* @library /lib/testlibrary/ * @library /test/lib
* @run main/timeout=2000 CancelledFutureLoops * @run main/timeout=2000 CancelledFutureLoops
*/ */
@ -52,7 +52,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public final class CancelledFutureLoops { public final class CancelledFutureLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -36,7 +36,7 @@
* @bug 8073704 * @bug 8073704
* @summary Checks that once isDone() returns true, * @summary Checks that once isDone() returns true,
* get() never throws InterruptedException or TimeoutException * get() never throws InterruptedException or TimeoutException
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -52,7 +52,7 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class DoneMeansDone { public class DoneMeansDone {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 6725789 * @bug 6725789
* @summary Check for long overflow in task time comparison. * @summary Check for long overflow in task time comparison.
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.DAYS; import static java.util.concurrent.TimeUnit.DAYS;
@ -45,7 +45,7 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class DelayOverflow { public class DelayOverflow {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -26,14 +26,14 @@
* @bug 7091003 * @bug 7091003
* @summary ScheduledExecutorService never executes Runnable * @summary ScheduledExecutorService never executes Runnable
* with corePoolSize of zero * with corePoolSize of zero
* @library /lib/testlibrary/ * @library /test/lib
* @author Chris Hegarty * @author Chris Hegarty
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/** /**
* Verify that tasks can be run even with a core pool size of 0. * Verify that tasks can be run even with a core pool size of 0.

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 8022642 8065320 8129861 * @bug 8022642 8065320 8129861
* @summary Ensure relative sanity when zero core threads * @summary Ensure relative sanity when zero core threads
* @library /lib/testlibrary/ * @library /test/lib
* @modules java.base/java.util.concurrent:open * @modules java.base/java.util.concurrent:open
*/ */
@ -48,7 +48,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.function.BooleanSupplier; import java.util.function.BooleanSupplier;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class ZeroCoreThreads { public class ZeroCoreThreads {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -25,7 +25,7 @@
* @test * @test
* @bug 6233235 6268386 * @bug 6233235 6268386
* @summary Test allowsCoreThreadTimeOut * @summary Test allowsCoreThreadTimeOut
* @library /lib/testlibrary/ * @library /test/lib
* @author Martin Buchholz * @author Martin Buchholz
*/ */
@ -37,7 +37,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class CoreThreadTimeOut { public class CoreThreadTimeOut {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -25,7 +25,7 @@
* @test * @test
* @bug 6277663 * @bug 6277663
* @summary Test TPE extensibility framework * @summary Test TPE extensibility framework
* @library /lib/testlibrary/ * @library /test/lib
* @author Martin Buchholz * @author Martin Buchholz
*/ */
@ -41,7 +41,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BooleanSupplier; import java.util.function.BooleanSupplier;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class Custom { public class Custom {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
/* /*
* @test * @test
* @summary Should be able to shutdown a pool when worker creation failed. * @summary Should be able to shutdown a pool when worker creation failed.
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -44,7 +44,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class FlakyThreadFactory { public class FlakyThreadFactory {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -25,7 +25,7 @@
* @test * @test
* @bug 6576792 * @bug 6576792
* @summary non-idle worker threads should not be interrupted * @summary non-idle worker threads should not be interrupted
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -34,7 +34,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class SelfInterrupt { public class SelfInterrupt {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -36,7 +36,7 @@
* @test * @test
* @summary Only one thread should be created when a thread needs to * @summary Only one thread should be created when a thread needs to
* be kept alive to service a delayed task waiting in the queue. * be kept alive to service a delayed task waiting in the queue.
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -44,7 +44,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class ThreadRestarts { public class ThreadRestarts {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -25,7 +25,7 @@
* @test * @test
* @bug 6458662 * @bug 6458662
* @summary poolSize might shrink below corePoolSize after timeout * @summary poolSize might shrink below corePoolSize after timeout
* @library /lib/testlibrary/ * @library /test/lib
* @author Martin Buchholz * @author Martin Buchholz
*/ */
@ -34,7 +34,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
import java.util.concurrent.CyclicBarrier; import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class TimeOutShrink { public class TimeOutShrink {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -23,13 +23,13 @@
import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* @test * @test
* @bug 8078490 * @bug 8078490
* @summary Test submission and execution of task without joining * @summary Test submission and execution of task without joining
* @library /lib/testlibrary/ * @library /test/lib
*/ */
public class SubmissionTest { public class SubmissionTest {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 * @bug 4486658
* @summary basic safety and liveness of ReentrantLocks, and other locks based on them * @summary basic safety and liveness of ReentrantLocks, and other locks based on them
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -48,7 +48,7 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public final class CheckedLockLoops { public final class CheckedLockLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -25,7 +25,7 @@
* @test * @test
* @bug 6460501 6236036 6500694 6490770 * @bug 6460501 6236036 6500694 6490770
* @summary Repeated failed timed waits shouldn't leak memory * @summary Repeated failed timed waits shouldn't leak memory
* @library /lib/testlibrary/ * @library /test/lib
* @author Martin Buchholz * @author Martin Buchholz
*/ */
@ -56,7 +56,7 @@ import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class TimedAcquireLeak { public class TimedAcquireLeak {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 * @bug 4486658
* @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread * @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -45,7 +45,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public final class LockOncePerThreadLoops { public final class LockOncePerThreadLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 * @bug 4486658
* @summary multiple threads using a single lock * @summary multiple threads using a single lock
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -45,7 +45,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public final class SimpleReentrantLockLoops { public final class SimpleReentrantLockLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 4486658 5031862 8140471 * @bug 4486658 5031862 8140471
* @summary Checks for responsiveness of locks to timeouts. * @summary Checks for responsiveness of locks to timeouts.
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -46,7 +46,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public final class TimeoutLockLoops { public final class TimeoutLockLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -25,7 +25,7 @@
* @test * @test
* @bug 6207928 6328220 6378321 6625723 * @bug 6207928 6328220 6378321 6625723
* @summary Recursive lock invariant sanity checks * @summary Recursive lock invariant sanity checks
* @library /lib/testlibrary/ * @library /test/lib
* @author Martin Buchholz * @author Martin Buchholz
*/ */
@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
// I am the Cownt, and I lahve to cownt. // I am the Cownt, and I lahve to cownt.
public class Count { public class Count {

View File

@ -41,7 +41,7 @@
* inserts it, and if present, with probability premove it removes * inserts it, and if present, with probability premove it removes
* it. (pinsert and premove are expressed as percentages to simplify * it. (pinsert and premove are expressed as percentages to simplify
* parsing from command line.) * parsing from command line.)
* @library /lib/testlibrary/ * @library /test/lib
*/ */
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;
@ -51,7 +51,7 @@ import java.util.SplittableRandom;
import java.util.concurrent.CyclicBarrier; import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class MapLoops { public class MapLoops {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -35,7 +35,7 @@
* @test * @test
* @bug 8005697 * @bug 8005697
* @summary Basic tests for StampedLock * @summary Basic tests for StampedLock
* @library /lib/testlibrary/ * @library /test/lib
* @author Chris Hegarty * @author Chris Hegarty
*/ */
@ -50,7 +50,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.StampedLock; import java.util.concurrent.locks.StampedLock;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class Basic { public class Basic {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);

View File

@ -28,7 +28,7 @@
* or notif delivered. * or notif delivered.
* @author Eamonn McManus * @author Eamonn McManus
* *
* @library /lib/testlibrary * @library /test/lib
* *
* @run clean GaugeMonitorDeadlockTest * @run clean GaugeMonitorDeadlockTest
* @run build GaugeMonitorDeadlockTest * @run build GaugeMonitorDeadlockTest
@ -50,7 +50,7 @@ import javax.management.ObjectName;
import javax.management.monitor.GaugeMonitor; import javax.management.monitor.GaugeMonitor;
import javax.management.monitor.GaugeMonitorMBean; import javax.management.monitor.GaugeMonitorMBean;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class GaugeMonitorDeadlockTest { public class GaugeMonitorDeadlockTest {
private static enum When {IN_GET_ATTRIBUTE, IN_NOTIFY}; private static enum When {IN_GET_ATTRIBUTE, IN_NOTIFY};

View File

@ -28,9 +28,8 @@
* monitors are started and stopped in a loop. * monitors are started and stopped in a loop.
* @author Luis-Miguel Alventosa * @author Luis-Miguel Alventosa
* *
* @library /lib/testlibrary * @library /test/lib
* *
* @build jdk.testlibrary.*
* @run clean StartStopTest * @run clean StartStopTest
* @run build StartStopTest * @run build StartStopTest
* @run main/othervm/timeout=300 StartStopTest 1 * @run main/othervm/timeout=300 StartStopTest 1
@ -56,7 +55,7 @@ import javax.management.monitor.Monitor;
import javax.management.monitor.MonitorNotification; import javax.management.monitor.MonitorNotification;
import javax.management.monitor.StringMonitor; import javax.management.monitor.StringMonitor;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class StartStopTest { public class StartStopTest {
static int maxPoolSize; static int maxPoolSize;

View File

@ -28,7 +28,6 @@
* All the communication should be done via Open Types * All the communication should be done via Open Types
* @author Olivier Lagneau * @author Olivier Lagneau
* @modules java.management.rmi * @modules java.management.rmi
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @compile Basic.java * @compile Basic.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest * @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest
@ -121,7 +120,7 @@ public class MXBeanWeirdParamTest {
private List<String> buildCommandLine() { private List<String> buildCommandLine() {
List<String> opts = new ArrayList<>(); List<String> opts = new ArrayList<>();
opts.add(JDKToolFinder.getJDKTool("java")); opts.add(JDKToolFinder.getJDKTool("java"));
opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts())); opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts()));
// We need to set WEIRD_PARAM propertty on the client-side // We need to set WEIRD_PARAM propertty on the client-side
opts.add("-DWEIRD_PARAM"); opts.add("-DWEIRD_PARAM");
opts.add("-cp"); opts.add("-cp");

View File

@ -24,12 +24,11 @@
/* /*
* @test * @test
* @bug 8159377 * @bug 8159377
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @summary Tests ObjectFilter on default agent * @summary Tests ObjectFilter on default agent
* @author Harsha Wardhana B * @author Harsha Wardhana B
* @modules java.management * @modules java.management
* @build jdk.testlibrary.* DefaultAgentFilterTest * @build DefaultAgentFilterTest
* @run main/othervm/timeout=600 -XX:+UsePerfData DefaultAgentFilterTest * @run main/othervm/timeout=600 -XX:+UsePerfData DefaultAgentFilterTest
*/ */
import java.io.EOFException; import java.io.EOFException;
@ -56,7 +55,7 @@ import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL; import javax.management.remote.JMXServiceURL;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class DefaultAgentFilterTest { public class DefaultAgentFilterTest {

View File

@ -27,7 +27,7 @@
* @summary Tests client default class loader used before JSR 160 loader * @summary Tests client default class loader used before JSR 160 loader
* @author Eamonn McManus * @author Eamonn McManus
* *
* @library /lib/testlibrary * @library /test/lib
* *
* @run clean MethodResultTest * @run clean MethodResultTest
* @run build MethodResultTest * @run build MethodResultTest
@ -40,7 +40,7 @@ import java.net.*;
import java.util.*; import java.util.*;
import javax.management.*; import javax.management.*;
import javax.management.remote.*; import javax.management.remote.*;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
This test checks that the class loader that is used to deserialize This test checks that the class loader that is used to deserialize

View File

@ -27,7 +27,6 @@
* @summary Checks various authentication behavior from remote jmx client * @summary Checks various authentication behavior from remote jmx client
* @author Olivier Lagneau * @author Olivier Lagneau
* @modules java.management.rmi * @modules java.management.rmi
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @compile Simple.java * @compile Simple.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials
@ -177,7 +176,7 @@ public class AuthorizationTest {
private List<String> buildCommandLine(String args[]) { private List<String> buildCommandLine(String args[]) {
List<String> opts = new ArrayList<>(); List<String> opts = new ArrayList<>();
opts.add(JDKToolFinder.getJDKTool("java")); opts.add(JDKToolFinder.getJDKTool("java"));
opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts())); opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts()));
String usernameValue = System.getProperty(USERNAME_PROPERTY); String usernameValue = System.getProperty(USERNAME_PROPERTY);
if (usernameValue != null) { if (usernameValue != null) {

View File

@ -27,7 +27,6 @@
* @summary Checks various secure ways of connecting from remote jmx client * @summary Checks various secure ways of connecting from remote jmx client
* @author Olivier Lagneau * @author Olivier Lagneau
* @modules java.management.rmi * @modules java.management.rmi
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @compile MBS_Light.java ServerDelegate.java TestSampleLoginModule.java * @compile MBS_Light.java ServerDelegate.java TestSampleLoginModule.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=SQE_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=SQE_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials
@ -398,7 +397,7 @@ public class SecurityTest {
List<String> opts = new ArrayList<>(); List<String> opts = new ArrayList<>();
opts.add(JDKToolFinder.getJDKTool("java")); opts.add(JDKToolFinder.getJDKTool("java"));
opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts())); opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts()));
// We need to forward some properties to the client side // We need to forward some properties to the client side
opts.add("-Dtest.src=" + System.getProperty("test.src")); opts.add("-Dtest.src=" + System.getProperty("test.src"));

View File

@ -1,295 +0,0 @@
/*
* 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
* 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 jdk.testlibrary;
import static jdk.testlibrary.Asserts.assertTrue;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.concurrent.TimeUnit;
import java.util.function.BooleanSupplier;
import java.util.function.Function;
/**
* Common library for various test helper functions.
*
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/jdk/test/lib}
*/
@Deprecated
public final class Utils {
/**
* Returns the sequence used by operating system to separate lines.
*/
public static final String NEW_LINE = System.getProperty("line.separator");
/**
* Returns the value of 'test.vm.opts'system property.
*/
public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "").trim();
/**
* Returns the value of 'test.java.opts'system property.
*/
public static final String JAVA_OPTIONS = System.getProperty("test.java.opts", "").trim();
/**
* Returns the value of 'test.timeout.factor' system property
* converted to {@code double}.
*/
public static final double TIMEOUT_FACTOR;
static {
String toFactor = System.getProperty("test.timeout.factor", "1.0");
TIMEOUT_FACTOR = Double.parseDouble(toFactor);
}
/**
* Returns the value of JTREG default test timeout in milliseconds
* converted to {@code long}.
*/
public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120);
private Utils() {
// Private constructor to prevent class instantiation
}
/**
* Returns the list of VM options.
*
* @return List of VM options
*/
public static List<String> getVmOptions() {
return Arrays.asList(safeSplitString(VM_OPTIONS));
}
/**
* Returns the list of VM options with -J prefix.
*
* @return The list of VM options with -J prefix
*/
public static List<String> getForwardVmOptions() {
String[] opts = safeSplitString(VM_OPTIONS);
for (int i = 0; i < opts.length; i++) {
opts[i] = "-J" + opts[i];
}
return Arrays.asList(opts);
}
/**
* Returns the default JTReg arguments for a jvm running a test.
* This is the combination of JTReg arguments test.vm.opts and test.java.opts.
* @return An array of options, or an empty array if no opptions.
*/
public static String[] getTestJavaOpts() {
List<String> opts = new ArrayList<String>();
Collections.addAll(opts, safeSplitString(VM_OPTIONS));
Collections.addAll(opts, safeSplitString(JAVA_OPTIONS));
return opts.toArray(new String[0]);
}
/**
* Combines given arguments with default JTReg arguments for a jvm running a test.
* This is the combination of JTReg arguments test.vm.opts and test.java.opts
* @return The combination of JTReg test java options and user args.
*/
public static String[] addTestJavaOpts(String... userArgs) {
List<String> opts = new ArrayList<String>();
Collections.addAll(opts, getTestJavaOpts());
Collections.addAll(opts, userArgs);
return opts.toArray(new String[0]);
}
/**
* Removes any options specifying which GC to use, for example "-XX:+UseG1GC".
* Removes any options matching: -XX:(+/-)Use*GC
* Used when a test need to set its own GC version. Then any
* GC specified by the framework must first be removed.
* @return A copy of given opts with all GC options removed.
*/
private static final Pattern useGcPattern = Pattern.compile(
"(?:\\-XX\\:[\\+\\-]Use.+GC)"
+ "|(?:\\-Xconcgc)");
public static List<String> removeGcOpts(List<String> opts) {
List<String> optsWithoutGC = new ArrayList<String>();
for (String opt : opts) {
if (useGcPattern.matcher(opt).matches()) {
System.out.println("removeGcOpts: removed " + opt);
} else {
optsWithoutGC.add(opt);
}
}
return optsWithoutGC;
}
/**
* Splits a string by white space.
* Works like String.split(), but returns an empty array
* if the string is null or empty.
*/
private static String[] safeSplitString(String s) {
if (s == null || s.trim().isEmpty()) {
return new String[] {};
}
return s.trim().split("\\s+");
}
/**
* @return The full command line for the ProcessBuilder.
*/
public static String getCommandLine(ProcessBuilder pb) {
StringBuilder cmd = new StringBuilder();
for (String s : pb.command()) {
cmd.append(s).append(" ");
}
return cmd.toString();
}
/**
* Returns the free port on the local host.
*
* @return The port number
* @throws IOException if an I/O error occurs when opening the socket
*/
public static int getFreePort() throws IOException {
try (ServerSocket serverSocket =
new ServerSocket(0, 5, InetAddress.getLoopbackAddress());) {
return serverSocket.getLocalPort();
}
}
/**
* Returns the name of the local host.
*
* @return The host name
* @throws UnknownHostException if IP address of a host could not be determined
*/
public static String getHostname() throws UnknownHostException {
InetAddress inetAddress = InetAddress.getLocalHost();
String hostName = inetAddress.getHostName();
assertTrue((hostName != null && !hostName.isEmpty()),
"Cannot get hostname");
return hostName;
}
/**
* Adjusts the provided timeout value for the TIMEOUT_FACTOR
* @param tOut the timeout value to be adjusted
* @return The timeout value adjusted for the value of "test.timeout.factor"
* system property
*/
public static long adjustTimeout(long tOut) {
return Math.round(tOut * Utils.TIMEOUT_FACTOR);
}
/**
* Wait for condition to be true
*
* @param condition, a condition to wait for
*/
public static final void waitForCondition(BooleanSupplier condition) {
waitForCondition(condition, -1L, 100L);
}
/**
* Wait until timeout for condition to be true
*
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true
* specifying -1 will wait forever
* @return condition value, to determine if wait was successfull
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout) {
return waitForCondition(condition, timeout, 100L);
}
/**
* Wait until timeout for condition to be true for specified time
*
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true,
* specifying -1 will wait forever
* @param sleepTime a time to sleep value in milliseconds
* @return condition value, to determine if wait was successfull
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout, long sleepTime) {
long startTime = System.currentTimeMillis();
while (!(condition.getAsBoolean() || (timeout != -1L
&& ((System.currentTimeMillis() - startTime) > timeout)))) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new Error(e);
}
}
return condition.getAsBoolean();
}
/**
* Interface same as java.lang.Runnable but with
* method {@code run()} able to throw any Throwable.
*/
public static interface ThrowingRunnable {
void run() throws Throwable;
}
/**
* Filters out an exception that may be thrown by the given
* test according to the given filter.
*
* @param test - method that is invoked and checked for exception.
* @param filter - function that checks if the thrown exception matches
* criteria given in the filter's implementation.
* @return - exception that matches the filter if it has been thrown or
* {@code null} otherwise.
* @throws Throwable - if test has thrown an exception that does not
* match the filter.
*/
public static Throwable filterException(ThrowingRunnable test,
Function<Throwable, Boolean> filter) throws Throwable {
try {
test.run();
} catch (Throwable t) {
if (filter.apply(t)) {
return t;
} else {
throw t;
}
}
return null;
}
}

View File

@ -27,7 +27,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import jdk.testlibrary.Asserts; import jdk.testlibrary.Asserts;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.apps.LingeredApp;
import sun.jvmstat.monitor.MonitorException; import sun.jvmstat.monitor.MonitorException;
import sun.jvmstat.monitor.MonitoredHost; import sun.jvmstat.monitor.MonitoredHost;

View File

@ -24,7 +24,7 @@
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import java.util.UUID; import java.util.UUID;

View File

@ -23,7 +23,7 @@
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import java.io.IOException; import java.io.IOException;
import java.net.ServerSocket; import java.net.ServerSocket;

View File

@ -161,10 +161,10 @@ public abstract class AbstractFilePermissionTest {
private int doTest() throws Exception { private int doTest() throws Exception {
for (int i = 0; i < MAX_GET_FREE_PORT_TRIES; ++i) { for (int i = 0; i < MAX_GET_FREE_PORT_TRIES; ++i) {
final String pp = "-Dcom.sun.management.jmxremote.port=" + jdk.testlibrary.Utils.getFreePort(); final String pp = "-Dcom.sun.management.jmxremote.port=" + jdk.test.lib.Utils.getFreePort();
List<String> command = new ArrayList<>(); List<String> command = new ArrayList<>();
command.addAll(jdk.testlibrary.Utils.getVmOptions()); command.addAll(jdk.test.lib.Utils.getVmOptions());
command.add(mp); command.add(mp);
command.add(pp); command.add(pp);
command.add("-cp"); command.add("-cp");

View File

@ -28,7 +28,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/** /**
* @test * @test
@ -38,13 +38,12 @@ import jdk.testlibrary.Utils;
* TestManager will attempt a connection to the address obtained from * TestManager will attempt a connection to the address obtained from
* both agent properties and jvmstat buffer. * both agent properties and jvmstat buffer.
* *
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @modules java.management * @modules java.management
* jdk.attach * jdk.attach
* jdk.management.agent/jdk.internal.agent * jdk.management.agent/jdk.internal.agent
* *
* @build jdk.testlibrary.* TestManager TestApplication * @build TestManager TestApplication
* @run main/othervm/timeout=300 LocalManagementTest * @run main/othervm/timeout=300 LocalManagementTest
*/ */
public class LocalManagementTest { public class LocalManagementTest {

View File

@ -635,7 +635,7 @@ public class RmiBootstrapTest {
for (int i = 0; i < MAX_GET_FREE_PORT_TRIES; i++) { for (int i = 0; i < MAX_GET_FREE_PORT_TRIES; i++) {
try { try {
int port = jdk.testlibrary.Utils.getFreePort(); int port = jdk.test.lib.Utils.getFreePort();
final String path; final String path;
try { try {
path=(file==null)?null:file.getCanonicalPath(); path=(file==null)?null:file.getCanonicalPath();

View File

@ -27,9 +27,9 @@
# @key intermittent # @key intermittent
# @summary Test RMI Bootstrap # @summary Test RMI Bootstrap
# #
# @library /lib/testlibrary # @library /test/lib
# #
# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest # @build TestLogger Utils RmiBootstrapTest
# @run shell/timeout=300 RmiBootstrapTest.sh # @run shell/timeout=300 RmiBootstrapTest.sh
# Define the Java class test name # Define the Java class test name

View File

@ -23,7 +23,7 @@
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -43,10 +43,9 @@ import java.util.regex.Pattern;
* @summary Test that RMI registry uses SSL. * @summary Test that RMI registry uses SSL.
* @author Luis-Miguel Alventosa, Taras Ledkov * @author Luis-Miguel Alventosa, Taras Ledkov
* *
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* *
* @build jdk.testlibrary.* RmiRegistrySslTestApp * @build RmiRegistrySslTestApp
* @run main/timeout=300 RmiRegistrySslTest * @run main/timeout=300 RmiRegistrySslTest
*/ */
public class RmiRegistrySslTest { public class RmiRegistrySslTest {

View File

@ -24,7 +24,7 @@
import java.rmi.registry.LocateRegistry; import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry; import java.rmi.registry.Registry;
import javax.rmi.ssl.SslRMIClientSocketFactory; import javax.rmi.ssl.SslRMIClientSocketFactory;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class RmiRegistrySslTestApp { public class RmiRegistrySslTestApp {

View File

@ -26,9 +26,9 @@
# @bug 6528083 # @bug 6528083
# @summary Test RMI Bootstrap with SSL # @summary Test RMI Bootstrap with SSL
# #
# @library /lib/testlibrary # @library /test/lib
# #
# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest # @build TestLogger Utils RmiBootstrapTest
# @run shell/timeout=300 RmiSslBootstrapTest.sh # @run shell/timeout=300 RmiSslBootstrapTest.sh
# Define the Java class test name # Define the Java class test name

View File

@ -45,7 +45,7 @@ import javax.management.remote.*;
import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLHandshakeException;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import jdk.internal.agent.Agent; import jdk.internal.agent.Agent;
import jdk.internal.agent.AgentConfigurationError; import jdk.internal.agent.AgentConfigurationError;
import jdk.internal.agent.ConnectorAddressLink; import jdk.internal.agent.ConnectorAddressLink;
@ -57,13 +57,12 @@ import jdk.internal.agent.ConnectorAddressLink;
* @summary Makes sure that enabling/disabling the management agent through JCMD * @summary Makes sure that enabling/disabling the management agent through JCMD
* achieves the desired results * achieves the desired results
* *
* @library /lib/testlibrary
* @library /test/lib * @library /test/lib
* @modules java.management * @modules java.management
* java.rmi * java.rmi
* jdk.management.agent/jdk.internal.agent * jdk.management.agent/jdk.internal.agent
* *
* @build jdk.testlibrary.* JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd * @build JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd
* @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest * @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest
*/ */
public class JMXStartStopTest { public class JMXStartStopTest {

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 8164879 * @bug 8164879
* @library /lib/testlibrary ../../ * @library ../../
* @library /test/lib * @library /test/lib
* @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
* start a new handshake sequence to renegotiate the symmetric key with an * start a new handshake sequence to renegotiate the symmetric key with an
@ -56,7 +56,7 @@ import java.util.Arrays;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class SSLEngineKeyLimit { public class SSLEngineKeyLimit {

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 8164879 * @bug 8164879
* @library /lib/testlibrary ../../ * @library ../../
* @library /test/lib * @library /test/lib
* @modules java.base/sun.security.util * @modules java.base/sun.security.util
* @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
@ -58,7 +58,7 @@ import java.util.Arrays;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import sun.security.util.HexDumpEncoder; import sun.security.util.HexDumpEncoder;
public class SSLSocketKeyLimit { public class SSLSocketKeyLimit {

View File

@ -30,7 +30,7 @@ import java.nio.file.Paths;
import java.util.List; import java.util.List;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* @test * @test

View File

@ -32,7 +32,7 @@ import java.util.List;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/* /*
* @test * @test

View File

@ -25,9 +25,7 @@
* @test * @test
* @summary Basic test for jhsdb launcher * @summary Basic test for jhsdb launcher
* @library /test/lib * @library /test/lib
* @library /lib/testlibrary
* @requires vm.hasSAandCanAttach * @requires vm.hasSAandCanAttach
* @build jdk.testlibrary.*
* @build jdk.test.lib.apps.* * @build jdk.test.lib.apps.*
* @run main BasicLauncherTest * @run main BasicLauncherTest
*/ */
@ -45,7 +43,7 @@ import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform; import jdk.test.lib.Platform;
import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.JDKToolLauncher;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class BasicLauncherTest { public class BasicLauncherTest {

View File

@ -29,7 +29,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.apps.LingeredApp;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import jdk.test.lib.Platform; import jdk.test.lib.Platform;
/** /**
@ -39,7 +39,6 @@ import jdk.test.lib.Platform;
* *
* @requires vm.hasSAandCanAttach * @requires vm.hasSAandCanAttach
* @library /test/lib * @library /test/lib
* @library /lib/testlibrary
* @modules java.management * @modules java.management
* jdk.hotspot.agent/sun.jvm.hotspot * jdk.hotspot.agent/sun.jvm.hotspot
* *

View File

@ -34,7 +34,7 @@ import java.util.logging.Logger;
import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.JDKToolLauncher;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
public class TmtoolTestScenario { public class TmtoolTestScenario {

View File

@ -39,7 +39,7 @@ import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Asserts; import jdk.testlibrary.Asserts;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
/** /**
* The helper class for running jps utility and verifying output from it * The helper class for running jps utility and verifying output from it

View File

@ -31,7 +31,7 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.JDKToolLauncher;
/** /**
@ -39,8 +39,6 @@ import jdk.test.lib.JDKToolLauncher;
* @summary Test deadlock detection * @summary Test deadlock detection
* @requires vm.hasSAandCanAttach * @requires vm.hasSAandCanAttach
* @library /test/lib * @library /test/lib
* @library /lib/testlibrary
* @build jdk.testlibrary.*
* @build jdk.test.lib.apps.* jdk.test.lib.Platform * @build jdk.test.lib.apps.* jdk.test.lib.Platform
* @build DeadlockDetectionTest * @build DeadlockDetectionTest
* @run main DeadlockDetectionTest * @run main DeadlockDetectionTest

View File

@ -23,7 +23,7 @@
import java.util.Arrays; import java.util.Arrays;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import static jdk.testlibrary.Asserts.*; import static jdk.testlibrary.Asserts.*;
import java.text.NumberFormat; import java.text.NumberFormat;

View File

@ -30,7 +30,7 @@ import java.util.Arrays;
import jdk.test.lib.thread.ProcessThread; import jdk.test.lib.thread.ProcessThread;
import static jdk.testlibrary.Asserts.*; import static jdk.testlibrary.Asserts.*;
import jdk.testlibrary.Utils; import jdk.test.lib.Utils;
import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.ProcessTools;