From 08855df46a33ada6ce2abc124c32a5f4c231b680 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 30 Apr 2018 18:10:24 -0700 Subject: [PATCH] 8199643: [TESTBUG] Open source common VM testbase code Reviewed-by: vlivanov, erikj, mseledtsov, gthornbr --- make/test/JtregNativeHotspot.gmk | 15 + test/hotspot/jtreg/vmTestbase/ExecDriver.java | 170 + .../vmTestbase/PropertyResolvingWrapper.java | 138 + test/hotspot/jtreg/vmTestbase/README.md | 10 + .../nsk/share/AbstractGoldChecker.java | 164 + .../vmTestbase/nsk/share/ArgumentParser.java | 507 ++ .../vmTestbase/nsk/share/ClassFileFinder.java | 52 + .../vmTestbase/nsk/share/ClassUnloader.java | 352 ++ .../jtreg/vmTestbase/nsk/share/Consts.java | 47 + .../nsk/share/CustomClassLoader.java | 150 + .../jtreg/vmTestbase/nsk/share/Debug.java | 45 + .../vmTestbase/nsk/share/Denotation.java | 139 + .../nsk/share/DummyClassLoader.java | 51 + .../jtreg/vmTestbase/nsk/share/Failure.java | 46 + .../jtreg/vmTestbase/nsk/share/FileUtils.java | 71 + .../vmTestbase/nsk/share/Finalizable.java | 43 + .../nsk/share/FinalizableObject.java | 50 + .../jtreg/vmTestbase/nsk/share/Finalizer.java | 133 + .../vmTestbase/nsk/share/GoldChecker.java | 71 + .../jtreg/vmTestbase/nsk/share/Grep.java | 103 + .../jtreg/vmTestbase/nsk/share/Harakiri.java | 175 + .../vmTestbase/nsk/share/IORedirector.java | 142 + .../jtreg/vmTestbase/nsk/share/JVMDITools.c | 173 + .../jtreg/vmTestbase/nsk/share/JVMDITools.h | 33 + .../jtreg/vmTestbase/nsk/share/JVMTIagent.c | 1276 +++++ .../vmTestbase/nsk/share/LocalProcess.java | 177 + .../jtreg/vmTestbase/nsk/share/Log.java | 736 +++ .../vmTestbase/nsk/share/NativeUtils.java | 31 + .../nsk/share/ObjectInstancesManager.java | 232 + .../jtreg/vmTestbase/nsk/share/Oddity.java | 36 + .../jtreg/vmTestbase/nsk/share/Pair.java | 42 + .../jtreg/vmTestbase/nsk/share/Paragrep.java | 176 + .../vmTestbase/nsk/share/PrintProperties.java | 54 + .../jtreg/vmTestbase/nsk/share/RASagent.java | 376 ++ .../hotspot/jtreg/vmTestbase/nsk/share/README | 128 + .../vmTestbase/nsk/share/ReferringObject.java | 265 + .../nsk/share/ReferringObjectSet.java | 77 + .../nsk/share/StringGoldChecker.java | 37 + .../jtreg/vmTestbase/nsk/share/TestBug.java | 46 + .../vmTestbase/nsk/share/TestFailure.java | 41 + .../vmTestbase/nsk/share/TestJNIError.java | 32 + .../vmTestbase/nsk/share/TimeoutHandler.java | 60 + .../nsk/share/TreeNodesDenotation.java | 175 + .../jtreg/vmTestbase/nsk/share/Wicket.java | 229 + .../nsk/share/aod/AODRunnerArgParser.java | 127 + .../nsk/share/aod/AODTargetArgParser.java | 83 + .../nsk/share/aod/AODTestRunner.java | 186 + .../nsk/share/aod/AbstractJarAgent.java | 257 + .../nsk/share/aod/AgentInformation.java | 68 + .../nsk/share/aod/AgentsAttacher.java | 137 + .../nsk/share/aod/DummyTargetApplication.java | 73 + .../nsk/share/aod/ProcessExecutor.java | 251 + .../aod/TargetApplicationWaitingAgents.java | 400 ++ .../jtreg/vmTestbase/nsk/share/aod/Utils.java | 95 + .../jtreg/vmTestbase/nsk/share/aod/aod.c | 288 + .../jtreg/vmTestbase/nsk/share/aod/aod.h | 83 + .../ClassPathNonDelegatingClassLoader.java | 80 + .../classload/GeneratingClassLoader.java | 185 + .../nsk/share/classload/TemplateClass.java | 27 + .../vmTestbase/nsk/share/gc/Algorithms.java | 206 + .../vmTestbase/nsk/share/gc/AllDiag.java | 53 + .../nsk/share/gc/AllMemoryObject.java | 56 + .../nsk/share/gc/ArgumentHandler.java | 363 ++ .../jtreg/vmTestbase/nsk/share/gc/Cell.java | 43 + .../nsk/share/gc/CircularLinkedList.java | 74 + .../vmTestbase/nsk/share/gc/ClassChain.java | 5035 +++++++++++++++++ .../vmTestbase/nsk/share/gc/FinDiag.java | 53 + .../nsk/share/gc/FinMemoryObject.java | 70 + .../nsk/share/gc/FinMemoryObject1.java | 60 + .../jtreg/vmTestbase/nsk/share/gc/GC.java | 116 + .../vmTestbase/nsk/share/gc/GCParams.java | 103 + .../nsk/share/gc/GCParamsAware.java | 31 + .../vmTestbase/nsk/share/gc/GCTestBase.java | 41 + .../vmTestbase/nsk/share/gc/IndexPair.java | 61 + .../nsk/share/gc/LinkedMemoryObject.java | 69 + .../jtreg/vmTestbase/nsk/share/gc/Matrix.java | 68 + .../jtreg/vmTestbase/nsk/share/gc/Memory.java | 513 ++ .../vmTestbase/nsk/share/gc/MemoryObject.java | 50 + .../nsk/share/gc/NonbranchyTree.java | 206 + .../vmTestbase/nsk/share/gc/OOMStress.java | 30 + .../nsk/share/gc/ThreadedGCTest.java | 76 + .../nsk/share/gc/TwoFieldsObject.java | 51 + .../nsk/share/gc/classes/Classes.java | 5024 ++++++++++++++++ .../nsk/share/gc/gp/DerivedProducer.java | 52 + .../share/gc/gp/DerivedStrategyProducer.java | 43 + .../nsk/share/gc/gp/GarbageProducer.java | 45 + .../share/gc/gp/GarbageProducer1Aware.java | 31 + .../nsk/share/gc/gp/GarbageProducerAware.java | 31 + .../nsk/share/gc/gp/GarbageProducers.java | 90 + .../nsk/share/gc/gp/GarbageUtils.java | 398 ++ .../nsk/share/gc/gp/MemoryStrategy.java | 134 + .../nsk/share/gc/gp/MemoryStrategyAware.java | 31 + .../nsk/share/gc/gp/RandomProducer.java | 46 + .../share/gc/gp/array/ArrayOfProducer.java | 63 + .../nsk/share/gc/gp/array/ArrayProducer.java | 57 + .../gc/gp/array/BooleanArrayProducer.java | 44 + .../share/gc/gp/array/ByteArrayProducer.java | 44 + .../share/gc/gp/array/CharArrayProducer.java | 44 + .../gc/gp/array/DoubleArrayProducer.java | 43 + .../share/gc/gp/array/FloatArrayProducer.java | 43 + .../share/gc/gp/array/IntArrayProducer.java | 44 + .../share/gc/gp/array/LongArrayProducer.java | 44 + .../gc/gp/array/ObjectArrayProducer.java | 40 + .../share/gc/gp/array/ShortArrayProducer.java | 44 + .../gp/classload/GeneratedClassProducer.java | 83 + .../gc/gp/list/CircularListProducer.java | 52 + .../share/gc/gp/list/LinearListProducer.java | 52 + .../gc/gp/misc/HashedGarbageProducer.java | 65 + .../nsk/share/gc/gp/misc/TraceProducer.java | 49 + .../gc/gp/misc/TwoFieldsObjectProducer.java | 47 + .../gc/gp/obj/AllMemoryObjectProducer.java | 36 + .../gc/gp/obj/FinMemoryObject1Producer.java | 36 + .../gc/gp/obj/FinMemoryObjectProducer.java | 36 + .../share/gc/gp/obj/MemoryObjectProducer.java | 36 + .../gc/gp/string/InternedStringProducer.java | 47 + .../gc/gp/string/RandomStringProducer.java | 62 + .../gc/gp/string/SimpleStringProducer.java | 46 + .../gc/gp/tree/NonbranchyTreeProducer.java | 59 + .../share/gc/lock/CriticalSectionLocker.java | 127 + .../gc/lock/CriticalSectionObjectLocker.java | 41 + .../gc/lock/CriticalSectionTimedLocker.java | 65 + .../vmTestbase/nsk/share/gc/lock/Locker.java | 63 + .../nsk/share/gc/lock/LockerUtils.java | 62 + .../vmTestbase/nsk/share/gc/lock/Lockers.java | 30 + .../nsk/share/gc/lock/LockersAware.java | 31 + .../nsk/share/gc/lock/MultiLocker.java | 66 + .../gc/lock/jni/BooleanArrayCriticalLocker.c | 80 + .../lock/jni/BooleanArrayCriticalLocker.java | 53 + .../gc/lock/jni/ByteArrayCriticalLocker.c | 79 + .../gc/lock/jni/ByteArrayCriticalLocker.java | 53 + .../gc/lock/jni/CharArrayCriticalLocker.c | 80 + .../gc/lock/jni/CharArrayCriticalLocker.java | 53 + .../gc/lock/jni/DoubleArrayCriticalLocker.c | 80 + .../lock/jni/DoubleArrayCriticalLocker.java | 53 + .../gc/lock/jni/FloatArrayCriticalLocker.c | 80 + .../gc/lock/jni/FloatArrayCriticalLocker.java | 53 + .../gc/lock/jni/IntArrayCriticalLocker.c | 80 + .../gc/lock/jni/IntArrayCriticalLocker.java | 53 + .../nsk/share/gc/lock/jni/JNILockers.java | 52 + .../gc/lock/jni/LongArrayCriticalLocker.c | 80 + .../gc/lock/jni/LongArrayCriticalLocker.java | 53 + .../gc/lock/jni/ShortArrayCriticalLocker.c | 80 + .../gc/lock/jni/ShortArrayCriticalLocker.java | 53 + .../share/gc/lock/jni/StringCriticalLocker.c | 80 + .../gc/lock/jni/StringCriticalLocker.java | 56 + .../share/gc/lock/jniref/JNIGlobalRefLocker.c | 70 + .../gc/lock/jniref/JNIGlobalRefLocker.java | 46 + .../gc/lock/jniref/JNIGlobalRefLockers.java | 34 + .../share/gc/lock/jniref/JNILocalRefLocker.c | 70 + .../gc/lock/jniref/JNILocalRefLocker.java | 46 + .../gc/lock/jniref/JNILocalRefLockers.java | 34 + .../nsk/share/gc/lock/jniref/JNIRefLocker.c | 74 + .../share/gc/lock/jniref/JNIRefLocker.java | 47 + .../share/gc/lock/jniref/JNIRefLockers.java | 34 + .../gc/lock/jniref/JNIWeakGlobalRefLocker.c | 70 + .../lock/jniref/JNIWeakGlobalRefLocker.java | 46 + .../lock/jniref/JNIWeakGlobalRefLockers.java | 34 + .../share/gc/lock/jvmti/JVMTIAllocLocker.c | 64 + .../share/gc/lock/jvmti/JVMTIAllocLocker.java | 58 + .../gc/lock/jvmti/JVMTIAllocLockers.java | 33 + .../nsk/share/gc/lock/malloc/MallocLocker.c | 47 + .../share/gc/lock/malloc/MallocLocker.java | 57 + .../share/gc/lock/malloc/MallocLockers.java | 34 + .../vmTestbase/nsk/share/gc/tree/Tree.java | 59 + .../nsk/share/gc/tree/TreeNode.java | 210 + .../nsk/share/jdi/AbstractJDIDebuggee.java | 42 + .../nsk/share/jdi/ArgumentHandler.java | 653 +++ .../vmTestbase/nsk/share/jdi/Binder.java | 1273 +++++ .../nsk/share/jdi/ConnectorTest.java | 238 + .../vmTestbase/nsk/share/jdi/Debugee.java | 648 +++ .../nsk/share/jdi/DebuggeeEventData.java | 93 + .../nsk/share/jdi/DebuggerEventData.java | 148 + .../nsk/share/jdi/EventFilters.java | 342 ++ .../nsk/share/jdi/EventHandler.java | 569 ++ .../nsk/share/jdi/EventTestTemplates.java | 457 ++ .../share/jdi/ForceEarlyReturnDebugger.java | 81 + .../nsk/share/jdi/HeapwalkingDebuggee.java | 231 + .../nsk/share/jdi/HeapwalkingDebugger.java | 196 + .../nsk/share/jdi/JDIEventsDebuggee.java | 250 + .../nsk/share/jdi/JDIEventsDebugger.java | 909 +++ .../nsk/share/jdi/MockReferenceType.java | 297 + .../nsk/share/jdi/MonitorEnterExecutor.c | 118 + .../nsk/share/jdi/MonitorEventsDebuggee.java | 523 ++ .../nsk/share/jdi/OwnedMonitorsDebuggee.java | 246 + .../nsk/share/jdi/OwnedMonitorsDebugger.java | 234 + .../nsk/share/jdi/PlugConnectors.java | 596 ++ .../nsk/share/jdi/PlugTransportService.java | 250 + .../share/jdi/SerialExecutionDebuggee.java | 138 + .../share/jdi/SerialExecutionDebugger.java | 337 ++ .../vmTestbase/nsk/share/jdi/TestClass1.java | 29 + .../vmTestbase/nsk/share/jdi/TestClass2.java | 30 + .../nsk/share/jdi/TestDebuggerType1.java | 276 + .../nsk/share/jdi/TestDebuggerType2.java | 363 ++ .../share/jdi/TestInterfaceImplementer1.java | 51 + .../vmTestbase/nsk/share/jdi/ThreadState.java | 105 + .../share/jdi/ValueConversionDebugger.java | 264 + .../nsk/share/jdi/sde/InstallSDE.java | 350 ++ .../nsk/share/jdi/sde/SDEDebuggee.java | 93 + .../nsk/share/jdi/sde/SDEDebugger.java | 1123 ++++ .../nsk/share/jdi/sde/SmapGenerator.java | 191 + .../nsk/share/jdi/sde/SmapStratum.java | 285 + .../nsk/share/jdi/sde/TestClass1.java | 62 + .../vmTestbase/nsk/share/jni/JNIreferences.c | 218 + .../jtreg/vmTestbase/nsk/share/jni/README | 61 + .../vmTestbase/nsk/share/jni/jni_tools.c | 204 + .../vmTestbase/nsk/share/jni/jni_tools.h | 174 + .../nsk/share/jpda/AbstractDebuggeeTest.java | 374 ++ .../vmTestbase/nsk/share/jpda/BindServer.java | 1888 ++++++ .../nsk/share/jpda/ConversionUtils.java | 353 ++ .../share/jpda/DebugeeArgumentHandler.java | 828 +++ .../nsk/share/jpda/DebugeeBinder.java | 758 +++ .../nsk/share/jpda/DebugeeProcess.java | 427 ++ .../jpda/ForceEarlyReturnTestThread.java | 1038 ++++ .../vmTestbase/nsk/share/jpda/IOPipe.java | 98 + .../nsk/share/jpda/SocketConnection.java | 680 +++ .../nsk/share/jpda/SocketIOPipe.java | 298 + .../nsk/share/jpda/StateTestThread.java | 161 + .../nsk/share/locks/DeadlockLocker.java | 86 + .../nsk/share/locks/DeadlockMaker.java | 161 + .../nsk/share/locks/DeadlockedThread.java | 67 + .../nsk/share/locks/JNIMonitorLocker.c | 127 + .../nsk/share/locks/JNIMonitorLocker.java | 51 + .../vmTestbase/nsk/share/locks/LockType.java | 34 + .../nsk/share/locks/LockingThread.c | 77 + .../nsk/share/locks/LockingThread.java | 637 +++ .../nsk/share/locks/MonitorLockingThread.java | 117 + .../nsk/share/locks/ReentrantLockLocker.java | 54 + .../share/locks/SynchronizedBlockLocker.java | 50 + .../share/locks/SynchronizedMethodLocker.java | 47 + .../jtreg/vmTestbase/nsk/share/log/Log.java | 111 + .../vmTestbase/nsk/share/log/LogAware.java | 37 + .../vmTestbase/nsk/share/log/LogSupport.java | 144 + .../jtreg/vmTestbase/nsk/share/native/README | 186 + .../nsk/share/native/native_thread.c | 211 + .../nsk/share/native/native_thread.h | 82 + .../nsk/share/native/native_utils.c | 47 + .../vmTestbase/nsk/share/native/nsk_list.c | 135 + .../vmTestbase/nsk/share/native/nsk_list.h | 67 + .../vmTestbase/nsk/share/native/nsk_mutex.c | 89 + .../vmTestbase/nsk/share/native/nsk_mutex.h | 61 + .../vmTestbase/nsk/share/native/nsk_tools.c | 310 + .../vmTestbase/nsk/share/native/nsk_tools.h | 211 + .../nsk/share/runner/FinRunner.java | 34 + .../vmTestbase/nsk/share/runner/GCRunner.java | 33 + .../vmTestbase/nsk/share/runner/MemDiag.java | 51 + .../nsk/share/runner/MultiRunner.java | 73 + .../nsk/share/runner/MultiRunnerAware.java | 31 + .../nsk/share/runner/RunParams.java | 268 + .../nsk/share/runner/RunParamsAware.java | 31 + .../nsk/share/runner/ThreadsRunner.java | 297 + .../nsk/share/sysdict/ClassLoadersBTree.java | 141 + .../nsk/share/sysdict/ClassLoadersChain.java | 94 + .../vmTestbase/nsk/share/test/Dumpable.java | 30 + .../nsk/share/test/ExecutionController.java | 31 + .../nsk/share/test/Initializable.java | 31 + .../nsk/share/test/LazyFormatString.java | 39 + .../nsk/share/test/LazyIntArrayToString.java | 40 + .../share/test/LazyObjectArrayToString.java | 40 + .../nsk/share/test/LocalRandom.java | 316 ++ .../nsk/share/test/StressOptions.java | 276 + .../vmTestbase/nsk/share/test/Stresser.java | 353 ++ .../jtreg/vmTestbase/nsk/share/test/Test.java | 30 + .../vmTestbase/nsk/share/test/TestBase.java | 67 + .../nsk/share/test/TestExitCode.java | 31 + .../vmTestbase/nsk/share/test/TestUtils.java | 149 + .../vmTestbase/nsk/share/test/Tests.java | 104 + .../test/timeoutwatchdog/TimeoutHandler.java | 36 + .../test/timeoutwatchdog/TimeoutWatchdog.java | 73 + .../vm/share/CommentedFileReader.java | 119 + .../jtreg/vmTestbase/vm/share/FileUtils.java | 81 + .../vm/share/InMemoryJavaCompiler.java | 125 + .../jtreg/vmTestbase/vm/share/ProcessUtils.c | 258 + .../vmTestbase/vm/share/ProcessUtils.java | 112 + .../jtreg/vmTestbase/vm/share/RandomEx.java | 89 + .../vmTestbase/vm/share/StringUtils.java | 89 + .../vmTestbase/vm/share/UnsafeAccess.java | 42 + .../vm/share/VMRuntimeEnvUtils.java | 108 + .../gc/TriggerUnloadingByFillingHeap.java | 69 + .../TriggerUnloadingByFillingMetaspace.java | 91 + .../vm/share/gc/TriggerUnloadingHelper.java | 31 + .../gc/TriggerUnloadingWithWhiteBox.java | 38 + .../vmTestbase/vm/share/libProcessUtils.c | 27 + .../vm/share/monitoring/MemoryPoolFinder.java | 66 + .../monitoring/data/MemoryManagerData.java | 61 + .../share/monitoring/data/MemoryPoolData.java | 59 + .../monitoring/data/MemoryUsageData.java | 82 + .../vm/share/options/BasicObjectFactory.java | 141 + .../options/BasicOptionObjectFactory.java | 141 + .../vmTestbase/vm/share/options/FClass.java | 49 + .../vmTestbase/vm/share/options/Factory.java | 69 + .../IgnoreUnknownArgumentsHandler.java | 30 + .../vm/share/options/ObjectFactory.java | 74 + .../vmTestbase/vm/share/options/Option.java | 69 + .../vm/share/options/OptionDefinition.java | 120 + .../vm/share/options/OptionError.java | 35 + .../vm/share/options/OptionHandler.java | 50 + .../vm/share/options/OptionObjectFactory.java | 74 + .../vm/share/options/OptionSupport.java | 76 + .../vmTestbase/vm/share/options/Options.java | 44 + .../vm/share/options/OptionsMap.java | 38 + .../vm/share/options/OptionsSetup.java | 327 ++ .../vm/share/options/ParserException.java | 42 + .../vm/share/options/PrimitiveParser.java | 297 + .../vm/share/options/package-info.java | 258 + .../test/BasicObjectFactoryUsageExample.java | 57 + .../test/ExampleWithNonprimitiveOptions.java | 67 + .../vm/share/options/test/SimpleExample.java | 62 + .../SimpleExampleWithOptionsAnnotation.java | 79 + .../share/options/test/SubClassExample.java | 66 + .../vm/share/options/test/package-info.java | 30 + .../vm/share/process/CmdExecutor.java | 63 + .../vm/share/process/MessageInput.java | 37 + .../vm/share/process/MessageOutput.java | 29 + .../vm/share/process/ProcessExecutor.java | 296 + .../vm/share/process/ProcessHandler.java | 102 + .../vm/share/process/StreamListener.java | 36 + .../vm/share/process/StreamLogger.java | 55 + .../vm/share/process/StreamMessageInput.java | 187 + .../vm/share/process/StreamMessageOutput.java | 56 + .../vm/share/process/StreamReader.java | 150 + .../vmTestbase/vm/share/stack/StackUtils.java | 132 + .../AbstractClassFileTransformer.java | 44 + .../share/transform/AnnotationAppender.java | 62 + .../transform/TransformingClassLoader.java | 61 + .../vm/share/vmcrasher/Crasher.java | 29 + .../vm/share/vmcrasher/CrasherFactory.java | 35 + .../vm/share/vmcrasher/SignalCrasher.java | 35 + .../vm/share/vmcrasher/UnsafeGCCrasher.java | 51 + .../vm/share/vmcrasher/UnsafeJavaCrasher.java | 47 + .../vmstresser/CompileAndDeoptimize.java | 79 + .../share/vmstresser/MetaspaceStresser.java | 260 + 331 files changed, 58155 insertions(+) create mode 100644 test/hotspot/jtreg/vmTestbase/ExecDriver.java create mode 100644 test/hotspot/jtreg/vmTestbase/PropertyResolvingWrapper.java create mode 100644 test/hotspot/jtreg/vmTestbase/README.md create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/AbstractGoldChecker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/ArgumentParser.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/ClassFileFinder.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Consts.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/CustomClassLoader.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Debug.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Denotation.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/DummyClassLoader.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Failure.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/FileUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Finalizable.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/FinalizableObject.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Finalizer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/GoldChecker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Grep.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Harakiri.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/IORedirector.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/JVMDITools.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/JVMDITools.h create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/LocalProcess.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Log.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/NativeUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/ObjectInstancesManager.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Oddity.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Pair.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Paragrep.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/PrintProperties.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/RASagent.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/README create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/ReferringObject.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/ReferringObjectSet.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/StringGoldChecker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/TestBug.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/TestFailure.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/TestJNIError.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/TimeoutHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/TreeNodesDenotation.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/Wicket.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/AODRunnerArgParser.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/AODTargetArgParser.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/AODTestRunner.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/AbstractJarAgent.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/AgentInformation.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/AgentsAttacher.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/DummyTargetApplication.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/ProcessExecutor.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/TargetApplicationWaitingAgents.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/Utils.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/classload/ClassPathNonDelegatingClassLoader.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/classload/GeneratingClassLoader.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/classload/TemplateClass.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/Algorithms.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/AllDiag.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/AllMemoryObject.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/ArgumentHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/Cell.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/CircularLinkedList.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/ClassChain.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/FinDiag.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/FinMemoryObject.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/FinMemoryObject1.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/GC.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/GCParams.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/GCParamsAware.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/GCTestBase.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/IndexPair.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/LinkedMemoryObject.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/Matrix.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/Memory.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/MemoryObject.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/NonbranchyTree.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/OOMStress.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/ThreadedGCTest.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/TwoFieldsObject.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/classes/Classes.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/DerivedProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/DerivedStrategyProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageProducer1Aware.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageProducerAware.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageProducers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/MemoryStrategy.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/MemoryStrategyAware.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/RandomProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/ArrayOfProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/ArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/BooleanArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/ByteArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/CharArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/DoubleArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/FloatArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/IntArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/LongArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/ObjectArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/array/ShortArrayProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/classload/GeneratedClassProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/list/CircularListProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/list/LinearListProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/misc/HashedGarbageProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/misc/TraceProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/misc/TwoFieldsObjectProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/obj/AllMemoryObjectProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/obj/FinMemoryObject1Producer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/obj/FinMemoryObjectProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/obj/MemoryObjectProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/string/InternedStringProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/string/RandomStringProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/string/SimpleStringProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/tree/NonbranchyTreeProducer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/CriticalSectionLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/CriticalSectionObjectLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/CriticalSectionTimedLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/Locker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/LockerUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/Lockers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/LockersAware.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/MultiLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/JNILockers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLockers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLockers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLockers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLockers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLockers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/malloc/MallocLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/malloc/MallocLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/malloc/MallocLockers.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/tree/Tree.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/gc/tree/TreeNode.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/AbstractJDIDebuggee.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ArgumentHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Binder.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ConnectorTest.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/DebuggeeEventData.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/DebuggerEventData.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/EventFilters.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/EventHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/EventTestTemplates.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ForceEarlyReturnDebugger.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/HeapwalkingDebuggee.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/HeapwalkingDebugger.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/JDIEventsDebuggee.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/JDIEventsDebugger.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MockReferenceType.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEventsDebuggee.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/OwnedMonitorsDebuggee.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/OwnedMonitorsDebugger.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/PlugConnectors.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/PlugTransportService.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/SerialExecutionDebuggee.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/SerialExecutionDebugger.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/TestClass1.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/TestClass2.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/TestDebuggerType1.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/TestDebuggerType2.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/TestInterfaceImplementer1.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ThreadState.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ValueConversionDebugger.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/InstallSDE.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/SDEDebuggee.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/SDEDebugger.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/SmapGenerator.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/SmapStratum.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jdi/sde/TestClass1.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jni/README create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/AbstractDebuggeeTest.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/ConversionUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/ForceEarlyReturnTestThread.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/SocketConnection.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/SocketIOPipe.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/jpda/StateTestThread.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/DeadlockLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/DeadlockMaker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/DeadlockedThread.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockType.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/MonitorLockingThread.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/ReentrantLockLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/SynchronizedBlockLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/locks/SynchronizedMethodLocker.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/log/Log.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/log/LogAware.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/log/LogSupport.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/README create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.h create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/native_utils.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.h create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.h create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.c create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/runner/FinRunner.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/runner/GCRunner.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/runner/MemDiag.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/runner/MultiRunner.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/runner/MultiRunnerAware.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/runner/RunParams.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/runner/RunParamsAware.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/runner/ThreadsRunner.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/sysdict/ClassLoadersBTree.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/sysdict/ClassLoadersChain.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/Dumpable.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/ExecutionController.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/Initializable.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/LazyFormatString.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/LazyIntArrayToString.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/LazyObjectArrayToString.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/LocalRandom.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/StressOptions.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/Stresser.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/Test.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/TestBase.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/TestExitCode.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/TestUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/Tests.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutWatchdog.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/CommentedFileReader.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/FileUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/InMemoryJavaCompiler.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.c create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/RandomEx.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/StringUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/UnsafeAccess.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/VMRuntimeEnvUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingHeap.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingHelper.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingWithWhiteBox.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/libProcessUtils.c create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/monitoring/MemoryPoolFinder.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryManagerData.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryPoolData.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryUsageData.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/BasicObjectFactory.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/BasicOptionObjectFactory.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/FClass.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/Factory.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/IgnoreUnknownArgumentsHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/ObjectFactory.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/Option.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/OptionDefinition.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/OptionError.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/OptionHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/OptionObjectFactory.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/OptionSupport.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/Options.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/OptionsMap.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/OptionsSetup.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/ParserException.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/PrimitiveParser.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/package-info.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/test/BasicObjectFactoryUsageExample.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/test/ExampleWithNonprimitiveOptions.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/test/SimpleExample.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/test/SimpleExampleWithOptionsAnnotation.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/test/SubClassExample.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/options/test/package-info.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/CmdExecutor.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/MessageInput.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/MessageOutput.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/ProcessExecutor.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/ProcessHandler.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/StreamListener.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/StreamLogger.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/StreamMessageInput.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/StreamMessageOutput.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/process/StreamReader.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/stack/StackUtils.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/transform/AbstractClassFileTransformer.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/transform/AnnotationAppender.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/transform/TransformingClassLoader.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/vmcrasher/Crasher.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/vmcrasher/CrasherFactory.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/vmcrasher/SignalCrasher.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/vmcrasher/UnsafeGCCrasher.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/vmcrasher/UnsafeJavaCrasher.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/vmstresser/CompileAndDeoptimize.java create mode 100644 test/hotspot/jtreg/vmTestbase/vm/share/vmstresser/MetaspaceStresser.java diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk index 1e5fc8b4a49..9b32fc2935d 100644 --- a/make/test/JtregNativeHotspot.gmk +++ b/make/test/JtregNativeHotspot.gmk @@ -48,6 +48,21 @@ BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/hotspot/jtreg/native BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg +################################################################################ +# Former VM TestBase tests. +################################################################################ + +VM_TESTBASE_DIR := $(TOPDIR)/test/hotspot/jtreg/vmTestbase + +VM_SHARE_INCLUDES := \ + -I$(VM_TESTBASE_DIR)/vm/share \ + -I$(VM_TESTBASE_DIR)/nsk/share/native \ + -I$(VM_TESTBASE_DIR)/nsk/share/jni + +BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libProcessUtils := $(VM_SHARE_INCLUDES) + +################################################################################ + # Platform specific setup ifneq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc) BUILD_HOTSPOT_JTREG_EXCLUDE += liboverflow.c exeThreadSignalMask.c diff --git a/test/hotspot/jtreg/vmTestbase/ExecDriver.java b/test/hotspot/jtreg/vmTestbase/ExecDriver.java new file mode 100644 index 00000000000..46da6be51b6 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/ExecDriver.java @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +import jdk.test.lib.Platform; +import jdk.test.lib.Utils; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; + +/** + * Starts a new process to execute a command. + *

Usage: --java|--cmd|--launcher + + *

If {@code --cmd} flag is specified, the arguments are treated as + * a program to run and its arguments. Non-zero exit code of the created process + * will be reported as an {@link AssertionError}. + *

If {@code --java} flag is specified, the arguments are passed to {@code java} + * from JDK under test. If exit code doesn't equal to 0 or 95, {@link AssertionError} + * will be thrown. + *

If {@code --launcher} flag is specified, the arguments treated similar as + * for {@code --cmd}, but the started process will have the directory which + * contains {@code jvm.so} in dynamic library path, and {@code test.class.path} + * as CLASSPATH environment variable. Exit codes are checked as in + * {@code --java}, i.e. 0 or 95 means pass. + */ +public class ExecDriver { + public static void main(String[] args) throws IOException, InterruptedException { + boolean java = false; + boolean launcher = false; + + String type = args[0]; + switch (type) { + case "--java": + String[] oldArgs = args; + int count; + String libraryPath = System.getProperty("test.nativepath"); + if (libraryPath != null && !libraryPath.isEmpty()) { + count = 4; + args = new String[args.length + 3]; + args[3] = "-Djava.library.path=" + libraryPath; + } else { + count = 3; + args = new String[args.length + 2]; + } + args[0] = javaBin(); + args[1] = "-cp"; + args[2] = Utils.TEST_CLASS_PATH; + System.arraycopy(oldArgs, 1, args, count, oldArgs.length - 1); + java = true; + break; + case "--launcher": + java = true; + launcher = true; + case "--cmd": + args = Arrays.copyOfRange(args, 1, args.length); + break; + default: + throw new Error("unknown type: " + type); + } + // adding 'test.vm.opts' and 'test.java.opts' + if (java) { + String[] oldArgs = args; + String[] testJavaOpts = Utils.getTestJavaOpts(); + if (testJavaOpts.length > 0) { + args = new String[args.length + testJavaOpts.length]; + // bin/java goes before options + args[0] = oldArgs[0]; + // then external java options + System.arraycopy(testJavaOpts, 0, args, 1, testJavaOpts.length); + // and then options and args from a test + System.arraycopy(oldArgs, 1, args, 1 + testJavaOpts.length, oldArgs.length - 1); + } + } + String command = Arrays.toString(args); + System.out.println("exec " + command); + + ProcessBuilder pb = new ProcessBuilder(args); + // adding jvm.so to library path + if (launcher) { + Path dir = Paths.get(Utils.TEST_JDK); + String name; + if (Platform.isWindows()) { + dir = dir.resolve("bin") + .resolve(variant()) + .toAbsolutePath(); + name = "PATH"; + } else { + dir = dir.resolve("lib") + .resolve(variant()) + .toAbsolutePath(); + name = Platform.isOSX() ? "DYLD_LIBRARY_PATH" : "LD_LIBRARY_PATH"; + } + + System.out.println(" with " + name + " = " + + pb.environment() + .merge(name, dir.toString(), (x, y) -> y + File.pathSeparator + x)); + System.out.println(" with CLASSPATH = " + + pb.environment() + .put("CLASSPATH", Utils.TEST_CLASS_PATH)); + } + Process p = pb.start(); + // inheritIO does not work as expected for @run driver + new Thread(() -> copy(p.getInputStream(), System.out)).start(); + new Thread(() -> copy(p.getErrorStream(), System.out)).start(); + int exitCode = p.waitFor(); + + if (exitCode != 0 && (!java || exitCode != 95)) { + throw new AssertionError(command + " exit code is " + exitCode); + } + } + + private static String variant() { + if (Platform.isServer()) { + return "server"; + } else if (Platform.isClient()) { + return "client"; + } else if (Platform.isMinimal()) { + return "minimal"; + } else { + throw new Error("TESTBUG: unsuppported vm variant"); + } + } + + + private static void copy(InputStream is, OutputStream os) { + byte[] buffer = new byte[1024]; + int n; + try (InputStream close = is) { + while ((n = is.read(buffer)) != -1) { + os.write(buffer, 0, n); + } + os.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static String javaBin() { + return Paths.get(Utils.TEST_JDK) + .resolve("bin") + .resolve("java") + .toAbsolutePath() + .toString(); + } +} + diff --git a/test/hotspot/jtreg/vmTestbase/PropertyResolvingWrapper.java b/test/hotspot/jtreg/vmTestbase/PropertyResolvingWrapper.java new file mode 100644 index 00000000000..52ed1c1122b --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/PropertyResolvingWrapper.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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. + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.InvocationTargetException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +/** + * Replaces all {@code ${}} with value of corresponding property({@code X}), + * resulting string is handled similarly to {@code @run main} in jtreg. + * In other words, {@code main} of first token will be executed with the rest + * tokens as arguments. + * + * If one of properties can't be resolved, {@link Error} will be thrown. + */ +public class PropertyResolvingWrapper { + private static final Properties properties; + static { + Properties p = System.getProperties(); + String name = p.getProperty("os.name"); + String arch = p.getProperty("os.arch"); + String family; + String simple_arch; + + // copy from jtreg/src/share/classes/com/sun/javatest/regtest/config/OS.java + if (name.startsWith("AIX")) + family = "aix"; + else if (name.startsWith("Linux")) + family = "linux"; + else if (name.startsWith("Mac") || name.startsWith("Darwin")) + family = "mac"; + else if (name.startsWith("OS400") || name.startsWith("OS/400") ) + family = "os400"; + else if (name.startsWith("SunOS") || name.startsWith("Solaris")) + family = "solaris"; + else if (name.startsWith("Windows")) + family = "windows"; + else + family = name.replaceFirst("^([^ ]+).*", "$1"); // use first word of name + + if (arch.contains("64") + && !arch.equals("ia64") + && !arch.equals("ppc64") + && !arch.equals("ppc64le") + && !arch.equals("zArch_64") + && !arch.equals("aarch64")) + simple_arch = "x64"; + else if (arch.contains("86")) + simple_arch = "i586"; + else if (arch.equals("ppc") || arch.equals("powerpc")) + simple_arch = "ppc"; + else if (arch.equals("s390x") || arch.equals("zArch_64")) + simple_arch = "s390x"; + else + simple_arch = arch; + + p.setProperty("os.family", family); + p.setProperty("os.simpleArch", simple_arch); + properties = p; + } + + public static void main(String[] args) throws Throwable { + List command = new ArrayList<>(args.length); + for (int i = 0; i < args.length; ++i) { + StringBuilder arg = new StringBuilder(args[i]); + while (i < args.length - 1 + && (arg.chars() + .filter(c -> c == '"') + .count() % 2) != 0) { + arg.append(" ") + .append(args[++i]); + } + command.add(eval(arg.toString())); + } + System.out.println("run " + command); + try { + Class.forName(command.remove(0)) + .getMethod("main", String[].class) + .invoke(null, new Object[]{command.toArray(new String[0])}); + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + t = t != null ? t : e; + throw t; + } + } + + private static String eval(String string) { + int index; + int current = 0; + StringBuilder result = new StringBuilder(); + while (current < string.length() && (index = string.indexOf("${", current)) >= 0) { + result.append(string.substring(current, index)); + int endName = string.indexOf('}', index); + current = endName + 1; + String name = string.substring(index + 2, endName); + String value = properties.getProperty(name); + if (value == null) { + throw new Error("can't find property " + name); + } + result.append(value); + } + if (current < string.length()) { + result.append(string.substring(current)); + } + int length = result.length(); + + if (length > 1 && result.charAt(0) == '"' && result.charAt(length - 1) == '"') { + result.deleteCharAt(length - 1); + result.deleteCharAt(0); + } + return result.toString(); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/README.md b/test/hotspot/jtreg/vmTestbase/README.md new file mode 100644 index 00000000000..86f51382138 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/README.md @@ -0,0 +1,10 @@ +# VM Testbase landing + +This directory serves as a _temporary_ landing place for tests converted from so-called VM testbase. +Most of these tests have been written a long time ago, don't meet modern coding +standards, guidelines and are in need of reworking. +Eventually, all the tests located here should be reworked and moved accordingly to +regular JTReg test suite directory layout convention, i.e. following the same +layout as product code as close as possible. + +New tests must **not** be added into this directory. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/AbstractGoldChecker.java b/test/hotspot/jtreg/vmTestbase/nsk/share/AbstractGoldChecker.java new file mode 100644 index 00000000000..a348346fe91 --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/AbstractGoldChecker.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * 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 nsk.share; +import java.io.UnsupportedEncodingException; + +public abstract class AbstractGoldChecker { + + private final StringBuffer sb = new StringBuffer(); + + protected abstract String getGoldenString(); + + public void print(boolean b) { + sb.append(String.valueOf(b)); + } + + public void print(byte b) { + sb.append(String.valueOf(b)); + } + + public void print(char c) { + sb.append(String.valueOf(c)); + } + + public void print(int i) { + sb.append(String.valueOf(i)); + } + + public void print(long l) { + sb.append(String.valueOf(l)); + } + + public void print(float f) { + sb.append(String.valueOf(f)); + } + + public void print(double d) { + sb.append(String.valueOf(d)); + } + + public void print(String s) { + sb.append(s); + } + + public void println() { + sb.append('\n'); + } + + public void println(boolean b) { + sb.append(String.valueOf(b)); + sb.append('\n'); + } + + public void println(byte b) { + sb.append(String.valueOf(b)); + sb.append('\n'); + } + + public void println(char c) { + sb.append(String.valueOf(c)); + sb.append('\n'); + } + + public void println(int i) { + sb.append(String.valueOf(i)); + sb.append('\n'); + } + + public void println(long l) { + sb.append(String.valueOf(l)); + sb.append('\n'); + } + + public void println(float f) { + sb.append(String.valueOf(f)); + sb.append('\n'); + } + + public void println(double d) { + sb.append(String.valueOf(d)); + sb.append('\n'); + } + + public void println(String s) { + sb.append(s); + sb.append('\n'); + } + + public void check() { + String testOutput; + try { + testOutput = new String(sb.toString().getBytes("US-ASCII"), "US-ASCII"); + } catch (UnsupportedEncodingException e) { + throw new TestFailure(e); + } + + String goldOutput = getGoldenString(); + if (!compare(testOutput, goldOutput)) { + throw new TestFailure( + "Gold comparison failed\n" + + "\n" + + "Test output:\n" + + "============\n" + + "\n" + + testOutput + + "\n" + + "------------\n" + + "\n" + + "Gold output:\n" + + "============\n" + + "\n" + + goldOutput + + "\n" + + "------------\n" + + "\n" + ); + } + } + + public boolean compare(String src, String dst) { + int i1 = 0; + int i2 = 0; + + int src_len = src.length(); + int dst_len = dst.length(); + + while ((i1 < src_len) && (i2 < dst_len)) { + + char c1 = src.charAt(i1++); + if ((c1 == '\r') && (i1 < src_len)) { + c1 = src.charAt(i1++); + } + + char c2 = dst.charAt(i2++); + if ((c2 == '\r') && (i2 < dst_len)) { + c2 = dst.charAt(i2++); + } + + if (c1 != c2) { + return false; + } + } + return (i1 == src_len) && (i2 == dst_len); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/ArgumentParser.java b/test/hotspot/jtreg/vmTestbase/nsk/share/ArgumentParser.java new file mode 100644 index 00000000000..fe63159577d --- /dev/null +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/ArgumentParser.java @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2001, 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 nsk.share; + +import java.util.*; + +import nsk.share.test.StressOptions; +import nsk.share.test.Stresser; + +/** + * Parser for JDI test's command-line arguments. + *

+ * Test's command line may contain two kind of arguments, namely: + *

+ *

+ * We call raw arguments the args[] array + * passed to the test's method main(String args[]). + * ArgumentParser instance initialized with raw arguments serves to parse + * these two kinds of arguments. Use ArgumentParser(args[]) + * constructor, or setRawArguments(args[]) method + * to initialize a ArgumentParser instance with particular raw arguments. + *

+ * Arguments, started with ``-'' symbol are called options. + * They are recognized by ArgumentParser and are used by support classes + * (such as Log, Binder, etc.). + * These options should be specified in the following general form: + *

+ * or + * + * List of the recognized options with their values may be obtained by + * invoking method getOptions() that returnes + * a Properties object with options values. + * It is not recommended to get options value directly. An appropriate methods + * such as verbose(), getArch(), etc. should be used + * instead. + * Options may appear in the test command line in any order. + *

+ * All the other arguments of command line are called test arguments + * (or simply arguments). These arguments should be handled by test itself. + * Full list of the test arguments in the same order as they appears in the command line + * may be obtained by invoking method getArguments(). + *

+ * Following is the list of basic options accepted by AgrumentParser: + *

+ * Also AgrumentParser supports following stress options (see nsk.share.test.StressOptions for details): + * + *

+ * Note, that the tests from the particular subsuites have its own argument handlers + * wich accepts additional options. See jpda.DebugeeArgumentHandler, + * jdi.ArgumentHandler, jdwp.ArgumentHandler. + * + * @see #setRawArguments(String[]) + * @see #getRawArguments() + * @see #getArguments() + * @see #getOptions() + * + * @see nsk.share.jpda.DebugeeArgumentHandler + * @see nsk.share.jdwp.ArgumentHandler + * @see nsk.share.jdi.ArgumentHandler + * @see nsk.share.jvmti.ArgumentHandler + * @see nsk.share.monitoring.ArgumentHandler + */ +public class ArgumentParser { + + /** + * Raw array of command-line arguments. + * + * @see #setRawArguments(String[]) + * @see #getRawArguments() + */ + protected String rawArguments[] = null; + + /** + * Refined arguments -- raw arguments but options. + * + * @see #options + * @see #getArguments() + */ + protected String arguments[] = null; + + /** + * Recognized options for ArgumentParser class. + * + * @see #arguments + * @see #getOptions() + */ + protected Properties options = new Properties(); + + /** + * Make new ArgumentParser object with default values of otions. + * This constructor is used only to obtain default values of options. + * + * @see #setRawArguments(String[]) + */ + protected ArgumentParser() { + String[] args = new String[0]; + setRawArguments(args); + } + + /** + * Keep a copy of raw command-line arguments and parse them; + * but throw an exception on parsing error. + * + * @param args Array of the raw command-line arguments. + * + * @throws BadOption If option values are invalid. + * + * @see #setRawArguments(String[]) + * @see BadOption + */ + public ArgumentParser(String args[]) { + setRawArguments(args); + } + + /** + * Return a copy of the raw command-line arguments kept by + * this ArgumentParser instance. + * + * @throws NullPointerException If raw arguments were not + * set for this instance. + * + * @see #setRawArguments(String[]) + */ + public String[] getRawArguments() { + return (String[]) rawArguments.clone(); + } + + /** + * Return given raw command-line argument. + * + * @param index index of argument + * @return value of raw argument + */ + public String getRawArgument(int index) { + return rawArguments[index]; + } + + /** + * Return refined array of test arguments (only those of the raw + * arguments which are not recognized as options for ArgumentParser). + * + *

Note, that sintax of test arguments was not checked; + * while syntax of arguments describing ArgumentParser's options + * was checked while raw arguments were set to this ArgumentParser + * instance. + * + * @throws NullPointerException If raw arguments were not + * set for this instance. + * + * @see #setRawArguments(String[]) + * @see #getOptions() + */ + public String[] getArguments() { + return (String[]) arguments.clone(); + } + + /** + * Return list of recognized otions with their values in the form of + * Properties object. + * If no options has been recognized, this list will be empty. + * + * @see #setRawArguments(String[]) + * @see #getArguments() + */ + public Properties getOptions() { + return (Properties) options.clone(); + } + + /** + * Join specified arguments into one line using given quoting + * and separator symbols. + * + * @param args Array of the command-line arguments + * @param quote Symbol used to quote each argument + * @param separator Symbol used as separator between argumnets + * @return Single line with arguments + */ + static public String joinArguments(String args[], String quote, String separator) { + if (args.length <= 0) { + return ""; + } + String line = quote + args[0] + quote; + for (int i = 1; i < args.length; i++) { + line += separator + quote + args[i] + quote; + } + return line; + } + + /** + * Join specified arguments into one line using given quoting symbol + * and space as a separator symbol. + * + * @param args Array of the command-line arguments + * @param quote Symbol used to quote each argument + * @return Single line with arguments + */ + static public String joinArguments(String args[], String quote) { + return joinArguments(args, quote, " "); + } + + /** + * Keep a copy of command-line arguments and parse them; + * but throw an exception on parsing error. + * + * @param args Array of the raw command-line arguments. + * + * @throws BadOption If an option has invalid value. + * + * @see #getRawArguments() + * @see #getArguments() + */ + public void setRawArguments(String args[]) { + this.rawArguments = (String[]) args.clone(); + parseArguments(); + } + + /** + * Add or replace given option value in options list and in raw arguments list. + * Use specified rawPrefix while adding to raw arguments list. + * + * @see #getRawArguments() + * @see #getOptions() + */ + public void setOption(String rawPrefix, String name, String value) { + String prefix = rawPrefix + name + "="; + String arg = prefix + value; + + options.setProperty(name, value); + + int length = rawArguments.length; + boolean found = false; + for (int i = 0; i < length; i++) { + if (rawArguments[i].startsWith(prefix)) { + found = true; + rawArguments[i] = arg; + break; + } + } + + if (!found) { + String[] newRawArguments = new String[length + 1]; + for (int i = 0; i < length; i++) { + newRawArguments[i] = rawArguments[i]; + } + newRawArguments[length] = arg; + rawArguments = newRawArguments; + } + } + + /** + * Return current architecture name from ArgumentParser's + * options. + * + *

Note that null string is returning if test argument + * -arch has not been set. + * + * @see #setRawArguments(String[]) + */ + public String getArch() { + return options.getProperty("arch"); + } + + /** + * Timeout (in minutes) for test's critical section like: + * (a) awaiting for an event, or conversly (b) making sure + * that there is no unexpected event. + * + *

By default, 2 minutes is returned if option + * -waittime is not set with command line. + * + * @see TimeoutHandler + */ + public int getWaitTime() { + String val = options.getProperty("waittime", "2"); + int minutes; + try { + minutes = Integer.parseInt(val); + } catch (NumberFormatException e) { + throw new TestBug("Not integer value of \"waittime\" argument: " + val); + } + return minutes; + } + + /** + * Return boolean value of current Log mode: + *