From d52a995f35de26c2cc4074297a75141e4a363e1b Mon Sep 17 00:00:00 2001 From: Leo Korinth Date: Fri, 27 Oct 2023 08:47:26 +0000 Subject: [PATCH] 8315097: Rename createJavaProcessBuilder Reviewed-by: lmesnik, dholmes, rriggs, stefank --- .../applications/jcstress/JcstressRunner.java | 2 +- .../applications/jcstress/TestGenerator.java | 2 +- .../jtreg/applications/scimark/Scimark.java | 2 +- .../arguments/CheckCICompilerCount.java | 4 +- .../CheckCompileThresholdScaling.java | 4 +- .../arguments/TestCodeEntryAlignment.java | 4 +- .../arguments/TestOptoLoopAlignment.java | 4 +- .../TestPrintOptoAssemblyLineNumbers.java | 4 +- .../arraycopy/stress/TestStressArrayCopy.java | 2 +- ...BlackholeExistingIntrinsicWarningTest.java | 4 +- .../BlackholeExperimentalUnlockTest.java | 4 +- .../blackhole/BlackholeIntrinsicTest.java | 2 +- .../BlackholeNonEmptyWarningTest.java | 4 +- .../BlackholeNonStaticWarningTest.java | 4 +- .../BlackholeNonVoidWarningTest.java | 4 +- .../compiler/c1/TestRangeCheckEliminated.java | 8 +- test/hotspot/jtreg/compiler/c2/TestBit.java | 4 +- .../compiler/c2/aarch64/TestFarJump.java | 2 +- .../compiler/c2/aarch64/TestSVEWithJNI.java | 48 +++++----- .../compiler/c2/aarch64/TestTrampoline.java | 2 +- .../compiler/c2/aarch64/TestVolatiles.java | 4 +- .../jtreg/compiler/ciReplay/CiReplayBase.java | 8 +- .../compiler/ciReplay/DumpReplayBase.java | 4 +- .../jtreg/compiler/ciReplay/SABase.java | 4 +- .../ciReplay/TestInvalidReplayFile.java | 2 +- .../codecache/CheckCodeCacheInfo.java | 6 +- .../compiler/codecache/CheckLargePages.java | 2 +- ...kReservedInitialCodeCacheSizeArgOrder.java | 6 +- .../codecache/CheckSegmentedCodeCache.java | 88 +++++++++--------- .../compiler/codecache/CheckUpperLimit.java | 4 +- .../codecache/CodeCacheFullCountTest.java | 2 +- .../TestConflictInlineCommands.java | 4 +- .../jtreg/compiler/cpuflags/RestoreMXCSR.java | 4 +- .../debug/TestGenerateStressSeed.java | 4 +- .../jtreg/compiler/debug/TestStressCM.java | 4 +- .../compiler/debug/TestStressIGVNAndCCP.java | 4 +- .../compiler/debug/VerifyAdapterSharing.java | 4 +- .../escapeAnalysis/TestIterativeEA.java | 4 +- .../compiler/inlining/InlineAccessors.java | 4 +- .../compiler/inlining/PrintInlining.java | 4 +- .../compiler/inlining/ResolvedClassTest.java | 8 +- .../intrinsics/chacha/TestChaCha20.java | 4 +- .../ContinuousCallSiteTargetChange.java | 2 +- .../jtreg/compiler/jsr292/MHInlineTest.java | 4 +- .../compiler/jsr292/PollutedTrapCounts.java | 4 +- .../jvmci/TestEnableJVMCIProduct.java | 2 +- .../jvmci/TestInvalidJVMCIOption.java | 4 +- .../jvmci/TestJVMCIPrintProperties.java | 4 +- .../jvmci/TestJVMCISavedProperties.java | 2 +- .../TestUncaughtErrorInCompileMethod.java | 2 +- .../jvmci/compilerToVM/GetFlagValueTest.java | 4 +- .../hotspot/test/TestHotSpotJVMCIRuntime.java | 2 +- .../ir_framework/driver/TestVMProcess.java | 4 +- .../TestLinkageErrorInGenerateOopMap.java | 4 +- .../CheckLoopStripMiningIterShortLoop.java | 2 +- .../TestNoWarningLoopStripMiningIterSet.java | 2 +- .../compiler/onSpinWait/TestOnSpinWait.java | 4 +- .../onSpinWait/TestOnSpinWaitAArch64.java | 2 +- .../TestOnSpinWaitAArch64DefaultFlags.java | 4 +- .../compiler/onSpinWait/TestOnSpinWaitC1.java | 4 +- .../onSpinWait/TestOnSpinWaitNoneAArch64.java | 2 +- .../onSpinWait/TestOnSpinWaitRISCV64.java | 2 +- .../oracle/CheckCompileCommandOption.java | 6 +- .../compiler/oracle/TestCompileCommand.java | 4 +- .../oracle/TestInvalidCompileCommand.java | 2 +- .../TestRangeCheckHoistingScaledIV.java | 2 +- .../runtime/cr8015436/Driver8015436.java | 4 +- .../sharedstubs/SharedStubToInterpTest.java | 2 +- .../sharedstubs/SharedTrampolineTest.java | 2 +- .../startup/NumCompilerThreadsCheck.java | 4 +- .../startup/SmallCodeCacheStartup.java | 10 +- .../jtreg/compiler/startup/StartupOutput.java | 6 +- .../compiler/testlibrary/rtm/RTMTestBase.java | 6 +- .../compiler/types/correctness/OffTest.java | 4 +- .../TestBufferVectorization.java | 12 +-- .../jtreg/containers/cgroup/PlainRead.java | 4 +- test/hotspot/jtreg/gc/TestAgeOutput.java | 4 +- test/hotspot/jtreg/gc/TestAllocateHeapAt.java | 4 +- .../jtreg/gc/TestAllocateHeapAtError.java | 4 +- .../jtreg/gc/TestAllocateHeapAtMultiple.java | 4 +- .../jtreg/gc/TestCardTablePageCommits.java | 4 +- .../hotspot/jtreg/gc/TestNumWorkerOutput.java | 4 +- .../jtreg/gc/TestPLABAdaptToMinTLABSize.java | 4 +- test/hotspot/jtreg/gc/TestSmallHeap.java | 4 +- .../jtreg/gc/TestVerifyDuringStartup.java | 4 +- test/hotspot/jtreg/gc/TestVerifySilently.java | 4 +- test/hotspot/jtreg/gc/TestVerifySubSet.java | 2 +- .../jtreg/gc/arguments/GCArguments.java | 18 ++-- .../gc/arguments/TestAggressiveHeap.java | 2 +- .../arguments/TestCompressedClassFlags.java | 2 +- .../gc/arguments/TestDisableDefaultGC.java | 14 +-- .../TestG1ConcMarkStepDurationMillis.java | 2 +- .../TestG1ConcRefinementThreads.java | 2 +- .../gc/arguments/TestG1HeapRegionSize.java | 2 +- .../gc/arguments/TestG1PercentageOptions.java | 2 +- .../jtreg/gc/arguments/TestG1RemSetFlags.java | 2 +- .../jtreg/gc/arguments/TestHeapFreeRatio.java | 2 +- .../TestInitialTenuringThreshold.java | 4 +- .../gc/arguments/TestMaxHeapSizeTools.java | 6 +- .../TestMaxMinHeapFreeRatioFlags.java | 6 +- .../jtreg/gc/arguments/TestMaxNewSize.java | 2 +- .../jtreg/gc/arguments/TestMaxRAMFlags.java | 6 +- .../TestMinAndInitialSurvivorRatioFlags.java | 4 +- .../jtreg/gc/arguments/TestNewRatioFlag.java | 4 +- .../jtreg/gc/arguments/TestNewSizeFlags.java | 4 +- .../arguments/TestNewSizeThreadIncrease.java | 16 ++-- .../gc/arguments/TestObjectTenuringFlags.java | 4 +- .../gc/arguments/TestParallelGCThreads.java | 8 +- .../gc/arguments/TestParallelRefProc.java | 4 +- .../gc/arguments/TestSelectDefaultGC.java | 4 +- ...tSmallInitialHeapWithLargePageAndNUMA.java | 4 +- .../gc/arguments/TestSurvivorRatioFlag.java | 4 +- .../TestTargetSurvivorRatioFlag.java | 6 +- .../TestUnrecognizedVMOptionsHandling.java | 8 +- .../TestUseCompressedOopsErgoTools.java | 6 +- .../TestUseCompressedOopsFlagsWithUlimit.java | 4 +- .../gc/arguments/TestUseNUMAInterleaving.java | 4 +- .../TestVerifyBeforeAndAfterGCFlags.java | 4 +- .../TestG1ClassUnloadingHWM.java | 4 +- .../jtreg/gc/epsilon/TestDieDefault.java | 4 +- .../jtreg/gc/epsilon/TestDieWithHeapDump.java | 4 +- .../jtreg/gc/epsilon/TestDieWithOnError.java | 4 +- .../TestDynamicNumberOfGCThreads.java | 6 +- .../TestInitialGCThreadLogging.java | 4 +- test/hotspot/jtreg/gc/g1/Test2GbHeap.java | 4 +- .../g1/TestEagerReclaimHumongousRegions.java | 4 +- ...rReclaimHumongousRegionsClearMarkBits.java | 2 +- .../TestEagerReclaimHumongousRegionsLog.java | 4 +- ...tEagerReclaimHumongousRegionsWithRefs.java | 4 +- .../jtreg/gc/g1/TestEvacuationFailure.java | 20 ++-- .../jtreg/gc/g1/TestG1SkipCompaction.java | 2 +- ...stG1TraceEagerReclaimHumongousObjects.java | 18 ++-- .../jtreg/gc/g1/TestGCLogMessages.java | 92 +++++++++---------- .../g1/TestHumongousAllocConcurrentStart.java | 4 +- .../TestHumongousAllocNearlyFullRegion.java | 4 +- .../gc/g1/TestHumongousCodeCacheRoots.java | 4 +- .../g1/TestHumongousConcurrentStartUndo.java | 4 +- .../gc/g1/TestLargePageUseForAuxMemory.java | 6 +- .../jtreg/gc/g1/TestLargePageUseForHeap.java | 26 +++--- .../jtreg/gc/g1/TestMarkStackSizes.java | 4 +- .../jtreg/gc/g1/TestMixedGCLiveThreshold.java | 4 +- .../jtreg/gc/g1/TestOneEdenRegionAfterGC.java | 4 +- test/hotspot/jtreg/gc/g1/TestPLABOutput.java | 4 +- .../jtreg/gc/g1/TestPLABSizeBounds.java | 4 +- .../jtreg/gc/g1/TestPeriodicLogMessages.java | 22 ++--- .../g1/TestPrintRegionRememberedSetInfo.java | 4 +- .../jtreg/gc/g1/TestRemsetLoggingThreads.java | 14 +-- .../jtreg/gc/g1/TestRemsetLoggingTools.java | 4 +- .../gc/g1/TestSharedArchiveWithPreTouch.java | 6 +- .../jtreg/gc/g1/TestShrinkAuxiliaryData.java | 4 +- .../gc/g1/TestShrinkDefragmentedHeap.java | 4 +- .../gc/g1/TestSkipRebuildRemsetPhase.java | 22 ++--- .../hotspot/jtreg/gc/g1/TestVerifyGCType.java | 4 +- .../jtreg/gc/g1/mixedgc/TestLogging.java | 4 +- .../gc/g1/numa/TestG1NUMATouchRegions.java | 4 +- .../gc/logging/TestDeprecatedPrintFlags.java | 10 +- test/hotspot/jtreg/gc/logging/TestGCId.java | 4 +- .../jtreg/gc/logging/TestMetaSpaceLog.java | 4 +- .../jtreg/gc/logging/TestPrintReferences.java | 24 ++--- .../gc/metaspace/TestMetaspaceSizeFlags.java | 4 +- .../gc/metaspace/TestSizeTransitions.java | 4 +- .../jtreg/gc/serial/HeapChangeLogging.java | 4 +- .../jtreg/gc/shenandoah/TestEvilSyncBug.java | 2 +- .../gc/shenandoah/TestObjItrWithHeapDump.java | 2 +- .../jtreg/gc/shenandoah/TestPeriodicGC.java | 2 +- .../gc/shenandoah/oom/TestAllocLargeObj.java | 4 +- .../oom/TestAllocLargerThanHeap.java | 4 +- .../gc/shenandoah/oom/TestAllocSmallObj.java | 4 +- .../shenandoah/oom/TestClassLoaderLeak.java | 2 +- .../gc/shenandoah/oom/TestThreadFailure.java | 2 +- .../options/TestArgumentRanges.java | 14 +-- .../options/TestClassUnloadingArguments.java | 2 +- .../gc/shenandoah/options/TestExplicitGC.java | 10 +- .../options/TestExplicitGCNoConcurrent.java | 2 +- .../options/TestHeuristicsUnlock.java | 6 +- .../options/TestHumongousThresholdArgs.java | 6 +- .../options/TestLoopMiningArguments.java | 2 +- .../gc/shenandoah/options/TestModeUnlock.java | 6 +- .../options/TestRegionSizeArgs.java | 32 +++---- .../options/TestSelectiveBarrierFlags.java | 2 +- .../options/TestSoftMaxHeapSize.java | 6 +- .../shenandoah/options/TestThreadCounts.java | 2 +- .../options/TestThreadCountsOverride.java | 4 +- .../options/TestWrongBarrierDisable.java | 4 +- .../options/TestWrongBarrierEnable.java | 4 +- .../stress/TestReclaimStringsLeaksMemory.java | 4 +- .../gc/stress/TestStressG1Humongous.java | 4 +- .../jtreg/gc/stress/TestStressG1Uncommit.java | 4 +- .../TestStringDeduplicationTools.java | 2 +- test/hotspot/jtreg/gc/whitebox/TestWBGC.java | 4 +- .../jtreg/gc/x/TestAllocateHeapAt.java | 4 +- .../jtreg/gc/x/TestPageCacheFlush.java | 4 +- test/hotspot/jtreg/gc/x/TestSmallHeap.java | 4 +- .../jtreg/gc/z/TestAllocateHeapAt.java | 2 +- .../jtreg/gc/z/TestPageCacheFlush.java | 2 +- test/hotspot/jtreg/gc/z/TestSmallHeap.java | 2 +- ...stZForceDiscontiguousHeapReservations.java | 2 +- test/hotspot/jtreg/gc/z/TestZNMT.java | 2 +- .../jvmti/GetObjectSizeOverflow.java | 4 +- .../7162488/TestUnrecognizedVmOption.java | 4 +- .../jtreg/runtime/8176717/TestInheritFD.java | 8 +- .../BadObjectClass/BootstrapRedefine.java | 4 +- .../BootClassPathAppend.java | 4 +- .../BootstrapMethod/BSMCalledTwice.java | 4 +- .../TestLambdaExceptionInInitializer.java | 2 +- .../CDSCompressedKPtrs.java | 6 +- .../CDSCompressedKPtrs/XShareAuto.java | 6 +- .../runtime/ClassFile/FormatCheckingTest.java | 4 +- .../jtreg/runtime/ClassFile/JsrRewriting.java | 4 +- .../ClassFile/OomWhileParsingRepeatedJsr.java | 4 +- .../runtime/ClassFile/PreviewVersion.java | 8 +- .../ClassFile/TestCheckedExceptions.java | 4 +- .../UnsupportedClassFileVersion.java | 4 +- .../BooleanFlagWithInvalidValue.java | 4 +- .../CompilerConfigFileWarning.java | 4 +- .../CommandLine/ConfigFileParsing.java | 2 +- .../CommandLine/ConfigFileWarning.java | 4 +- .../DoubleFlagWithIntegerValue.java | 2 +- .../CommandLine/FlagWithInvalidValue.java | 2 +- .../IgnoreUnrecognizedVMOptions.java | 2 +- ...onBooleanFlagWithInvalidBooleanPrefix.java | 4 +- .../CommandLine/ObsoleteFlagErrorMessage.java | 4 +- .../OptionsValidation/TestJcmdOutput.java | 2 +- .../common/optionsvalidation/JVMOption.java | 4 +- .../optionsvalidation/JVMOptionsUtils.java | 4 +- .../runtime/CommandLine/TestHexArguments.java | 4 +- .../TestLongUnrecognizedVMOption.java | 2 +- .../CommandLine/TestNullTerminatedFlags.java | 2 +- .../runtime/CommandLine/TestVMOptions.java | 6 +- .../CommandLine/TraceExceptionsTest.java | 2 +- .../CommandLine/UnrecognizedVMOption.java | 2 +- .../CommandLine/VMDeprecatedOptions.java | 4 +- .../runtime/CommandLine/VMOptionWarning.java | 8 +- .../VMOptionsFile/TestVMOptionsFile.java | 2 +- .../CompressedClassPointers.java | 30 +++--- .../CompressedClassSpaceSize.java | 36 ++++---- .../CompressedKlassPointerAndOops.java | 4 +- .../CompressedOops/ObjectAlignment.java | 6 +- .../CompressedOops/UseCompressedOops.java | 4 +- .../Dictionary/CleanProtectionDomain.java | 4 +- .../Dictionary/ProtectionDomainCacheTest.java | 4 +- .../EnclosingMethodAttr/EnclMethodAttr.java | 4 +- .../BadNativeStackInErrorHandlingTest.java | 2 +- .../ErrorHandling/ClassPathEnvVar.java | 8 +- .../ErrorHandling/CreateCoredumpOnCrash.java | 4 +- .../ErrorHandling/ErrorFileOverwriteTest.java | 4 +- .../ErrorHandling/ErrorFileRedirectTest.java | 2 +- .../MachCodeFramesInErrorFile.java | 2 +- ...dThreadsListHandleInErrorHandlingTest.java | 2 +- .../ErrorHandling/ProblematicFrameTest.java | 2 +- .../ErrorHandling/ReattemptErrorTest.java | 2 +- .../ErrorHandling/ResourceMarkTest.java | 2 +- .../SafeFetchInErrorHandlingTest.java | 2 +- .../ErrorHandling/SecondaryErrorTest.java | 2 +- .../ShowRegistersOnAssertTest.java | 2 +- .../ErrorHandling/StackWalkNativeToJava.java | 4 +- .../ErrorHandling/TestAbortVmOnException.java | 4 +- .../TestCrashOnOutOfMemoryError.java | 2 +- .../runtime/ErrorHandling/TestDwarf.java | 2 +- .../TestExitOnOutOfMemoryError.java | 2 +- ...TestGZippedHeapDumpOnOutOfMemoryError.java | 2 +- .../TestHeapDumpOnOutOfMemoryError.java | 2 +- .../ErrorHandling/TestHeapDumpPath.java | 2 +- .../runtime/ErrorHandling/TestOnError.java | 2 +- .../ErrorHandling/TestOnOutOfMemoryError.java | 4 +- .../ErrorHandling/TestSigInfoInHsErrFile.java | 2 +- .../ThreadsListHandleInErrorHandlingTest.java | 2 +- .../TimeoutInErrorHandlingTest.java | 2 +- .../ErrorHandling/VeryEarlyAssertTest.java | 2 +- .../TestGenerateOopMapCrash.java | 4 +- .../InvocationTests/invocationC1Tests.java | 4 +- .../invocationOldCHATests.java | 4 +- .../InvocationTests/invokeinterfaceTests.java | 4 +- .../InvocationTests/invokespecialTests.java | 4 +- .../InvocationTests/invokevirtualTests.java | 4 +- .../runtime/LoadClass/LoadClassNegative.java | 4 +- .../jtreg/runtime/LoadClass/LongBCP.java | 14 +-- .../jtreg/runtime/LoadClass/TestResize.java | 10 +- .../runtime/LocalLong/LocalLongTest.java | 12 +-- .../runtime/LocalVariableTable/TestLVT.java | 8 +- .../runtime/MemberName/MemberNameLeak.java | 4 +- .../Metaspace/MaxMetaspaceSizeEnvVarTest.java | 8 +- .../Metaspace/MaxMetaspaceSizeTest.java | 4 +- test/hotspot/jtreg/runtime/MinimalVM/CDS.java | 8 +- .../jtreg/runtime/MinimalVM/CheckJNI.java | 4 +- .../runtime/MinimalVM/Instrumentation.java | 4 +- test/hotspot/jtreg/runtime/MinimalVM/JMX.java | 6 +- .../jtreg/runtime/MinimalVM/JVMTI.java | 4 +- test/hotspot/jtreg/runtime/MinimalVM/NMT.java | 8 +- .../Monitor/DeflationIntervalsTest.java | 2 +- .../MonitorUsedDeflationThresholdTest.java | 4 +- .../Monitor/SyncOnValueBasedClassTest.java | 8 +- .../NMT/CheckForProperDetailStackTrace.java | 2 +- .../jtreg/runtime/NMT/CommandLineDetail.java | 2 +- .../runtime/NMT/CommandLineEmptyArgument.java | 2 +- .../NMT/CommandLineInvalidArgument.java | 2 +- .../jtreg/runtime/NMT/CommandLineSummary.java | 2 +- .../runtime/NMT/CommandLineTurnOffNMT.java | 2 +- .../runtime/NMT/JcmdWithNMTDisabled.java | 4 +- .../jtreg/runtime/NMT/MallocLimitTest.java | 2 +- .../runtime/NMT/NMTInitializationTest.java | 2 +- .../jtreg/runtime/NMT/NMTJavaHeapTest.java | 2 +- .../hotspot/jtreg/runtime/NMT/NMTWithCDS.java | 4 +- .../jtreg/runtime/NMT/PrintNMTStatistics.java | 4 +- .../PrintNMTStatisticsWithNMTDisabled.java | 2 +- .../PerfMemDestroy/PerfMemDestroy.java | 4 +- .../PrintStringTableStatsTest.java | 4 +- .../ReservedStack/ReservedStackTest.java | 4 +- .../TestAbortOnVMOperationTimeout.java | 2 +- .../TestAbortVMOnSafepointTimeout.java | 6 +- .../runtime/StackTrace/LargeClassTest.java | 4 +- .../Thread/TestAlwaysPreTouchStacks.java | 4 +- .../Thread/TestBreakSignalThreadDump.java | 4 +- .../runtime/Thread/TooSmallStackSize.java | 6 +- .../runtime/Throwable/StackTraceLogging.java | 12 +-- .../Throwable/TestCatchThrowableOOM.java | 8 +- .../Throwable/TestMaxJavaStackTraceDepth.java | 12 +-- .../jtreg/runtime/Unsafe/RangeCheck.java | 4 +- .../runtime/XCheckJniJsig/XCheckJSig.java | 6 +- .../jtreg/runtime/cds/MaxMetaspaceSize.java | 4 +- .../jtreg/runtime/cds/SharedStrings.java | 6 +- .../jtreg/runtime/cds/TestCDSVMCrash.java | 2 +- .../cds/appcds/CommandLineFlagCombo.java | 2 +- .../cds/appcds/FillerObjectLoadTest.java | 4 +- .../jtreg/runtime/cds/appcds/TestCommon.java | 6 +- .../cds/appcds/TestDumpClassListSource.java | 14 +-- .../cds/appcds/VerifyWithDefaultArchive.java | 2 +- .../DynamicArchiveTestBase.java | 4 +- .../dynamicArchive/LambdasInTwoArchives.java | 2 +- .../cds/appcds/jcmd/JCmdTestDynamicDump.java | 4 +- .../ResolvedReferencesNotNullTest.java | 16 ++-- .../classFileParserBug/Bad_NCDFE_Msg.java | 4 +- .../ClassFileParserBug.java | 4 +- .../TestBadPackageWithInterface.java | 4 +- .../TestEmptyBootstrapMethodsAttr.java | 6 +- .../jtreg/runtime/condy/BadBSMUseTest.java | 6 +- .../jtreg/runtime/condy/CondyLDCTest.java | 14 +-- .../condy/CondyNewInvokeSpecialTest.java | 6 +- .../condy/escapeAnalysis/TestEscapeCondy.java | 4 +- .../condy/staticInit/TestInitException.java | 4 +- .../jtreg/runtime/contended/Options.java | 24 ++--- .../duplAttributes/DuplAttributesTest.java | 4 +- .../runtime/execstack/Testexecstack.java | 8 +- .../GetPackageXbootclasspath.java | 4 +- .../runtime/getSysPackage/GetSysPkgTest.java | 4 +- .../handshake/HandshakeTimeoutTest.java | 4 +- .../handshake/HandshakeTransitionTest.java | 4 +- .../SystemMembarHandshakeTransitionTest.java | 4 +- .../TestCheckedReleaseArrayElements.java | 8 +- ...estPrimitiveArrayCriticalWithBadParam.java | 2 +- test/hotspot/jtreg/runtime/jsig/Testjsig.java | 4 +- .../logging/ClassInitializationTest.java | 18 ++-- .../runtime/logging/ClassLoadUnloadTest.java | 4 +- .../runtime/logging/ClassResolutionTest.java | 12 +-- .../runtime/logging/CompressedOopsTest.java | 20 ++-- .../jtreg/runtime/logging/CondyIndyTest.java | 22 ++--- .../runtime/logging/DefaultMethodsTest.java | 6 +- .../jtreg/runtime/logging/ExceptionsTest.java | 20 ++-- .../runtime/logging/FoldMultilinesTest.java | 8 +- .../jtreg/runtime/logging/ItablesTest.java | 6 +- .../logging/LoaderConstraintsTest.java | 4 +- .../jtreg/runtime/logging/ModulesTest.java | 4 +- .../runtime/logging/MonitorInflationTest.java | 10 +- .../runtime/logging/MonitorMismatchTest.java | 18 ++-- .../jtreg/runtime/logging/MutexRankTest.java | 4 +- .../runtime/logging/OsCpuLoggingTest.java | 8 +- .../ProtectionDomainVerificationTest.java | 26 +++--- .../runtime/logging/SafepointCleanupTest.java | 10 +- .../jtreg/runtime/logging/SafepointTest.java | 6 +- .../jtreg/runtime/logging/StackWalkTest.java | 10 +- .../runtime/logging/StartupTimeTest.java | 10 +- .../runtime/logging/ThreadLoggingTest.java | 6 +- .../runtime/logging/VMOperationTest.java | 10 +- .../runtime/logging/VerificationTest.java | 14 +-- .../jtreg/runtime/logging/VtablesTest.java | 6 +- .../loadLibraryTest/LoadLibraryTest.java | 4 +- .../LargePages/TestLargePagesFlags.java | 4 +- .../runtime/memory/ReadFromNoaccessArea.java | 4 +- .../jtreg/runtime/memory/ReserveMemory.java | 4 +- .../ClassLoaderNoUnnamedModuleTest.java | 4 +- .../modules/IgnoreModulePropertiesTest.java | 6 +- .../runtime/modules/ModuleOptionsTest.java | 6 +- .../runtime/modules/ModuleOptionsWarn.java | 24 ++--- .../ModuleStress/ExportModuleStressTest.java | 4 +- .../modules/ModuleStress/ModuleStress.java | 10 +- .../modules/ModuleStress/ModuleStressGC.java | 4 +- .../modules/PatchModule/PatchModule2Dirs.java | 4 +- .../modules/PatchModule/PatchModuleCDS.java | 10 +- .../PatchModule/PatchModuleClassList.java | 8 +- .../PatchModule/PatchModuleDupJavaBase.java | 4 +- .../PatchModule/PatchModuleDupModule.java | 4 +- .../PatchModule/PatchModuleJavaBase.java | 4 +- .../modules/PatchModule/PatchModuleTest.java | 4 +- .../PatchModule/PatchModuleTestJar.java | 4 +- .../PatchModule/PatchModuleTestJarDir.java | 16 ++-- .../PatchModule/PatchModuleTraceCL.java | 6 +- .../Visibility/PatchModuleVisibility.java | 4 +- .../Visibility/XbootcpNoVisibility.java | 4 +- .../modules/Visibility/XbootcpVisibility.java | 4 +- .../jtreg/runtime/os/AvailableProcessors.java | 6 +- .../os/THPsInThreadStackPreventionTest.java | 4 +- .../runtime/os/TestHugePageDetection.java | 2 +- .../jtreg/runtime/os/TestTimerSlack.java | 8 +- .../jtreg/runtime/os/TestTrimNative.java | 2 +- .../jtreg/runtime/os/TestUseCpuAllocPath.java | 10 +- .../jtreg/runtime/posixSig/TestPosixSig.java | 4 +- .../jtreg/runtime/records/RedefineRecord.java | 4 +- .../RedefinePermittedSubclass.java | 4 +- .../sealedClasses/RedefineSealedClass.java | 4 +- .../stringtable/StringTableVerifyTest.java | 4 +- .../symboltable/ShortLivedSymbolCleanup.java | 12 +-- .../jtreg/runtime/verifier/OverriderMsg.java | 4 +- .../jtreg/runtime/verifier/TestANewArray.java | 8 +- .../runtime/verifier/TestMultiANewArray.java | 4 +- .../runtime/verifier/TestTableSwitch.java | 4 +- .../jtreg/runtime/verifier/TraceClassRes.java | 4 +- .../whitebox/TestWBDeflateIdleMonitors.java | 4 +- .../attach/AttachSetGetFlag.java | 2 +- .../attach/AttachWithStalePidFile.java | 4 +- .../serviceability/attach/ShMemLongName.java | 2 +- .../dcmd/gc/RunFinalizationTest.java | 4 +- .../dtrace/DTraceOptionsTest.java | 2 +- .../serviceability/jdwp/DebuggeeLauncher.java | 2 +- .../CanGenerateAllClassHook.java | 4 +- .../jvmti/GetObjectSizeClass.java | 4 +- .../jvmti/RedefineClasses/RedefineLeak.java | 4 +- .../RedefinePreviousVersions.java | 4 +- .../RedefineSharedClassJFR.java | 4 +- .../RetransformClassesZeroLength.java | 4 +- .../TransformerDeadlockTest.java | 4 +- .../vthread/premain/AgentWithVThreadTest.java | 2 +- .../logging/TestBasicLogOutput.java | 4 +- .../logging/TestDefaultLogOutput.java | 4 +- .../serviceability/logging/TestFullNames.java | 8 +- .../logging/TestLogRotation.java | 4 +- .../logging/TestMultipleXlogArgs.java | 16 ++-- .../logging/TestQuotedLogOutputs.java | 14 +-- .../serviceability/sa/ClhsdbCDSCore.java | 4 +- .../serviceability/sa/TestClassDump.java | 6 +- .../sa/TestCpoolForInvokeDynamic.java | 4 +- .../serviceability/sa/TestDefaultMethods.java | 4 +- .../serviceability/sa/TestG1HeapRegion.java | 4 +- .../sa/TestInstanceKlassSize.java | 4 +- .../sa/TestInstanceKlassSizeForInterface.java | 4 +- .../jtreg/serviceability/sa/TestJmapCore.java | 4 +- .../sa/TestObjectAlignment.java | 4 +- .../sa/TestObjectMonitorIterate.java | 2 +- .../sa/TestRevPtrsForInvokeDynamic.java | 4 +- .../serviceability/sa/UniqueVtableTest.java | 2 +- .../sa/jmap-hprof/JMapHProfLargeHeapTest.java | 2 +- .../src/sun/hotspot/tools/ctw/CtwRunner.java | 2 +- .../lib/jittester/jtreg/JitTesterDriver.java | 4 +- .../jtreg/testlibrary_tests/ctw/CtwTest.java | 4 +- .../ir_framework/tests/TestDScenarios.java | 4 +- .../tests/TestDTestAndExclude.java | 4 +- .../largeheap/MemOptions/MemOptionsTest.java | 6 +- .../TestMaxMetaspaceSize.java | 6 +- .../nsk/jvmti/Allocate/alloc001/alloc001.java | 4 +- .../retransform003/TestDriver.java | 4 +- .../SetNativeMethodPrefix002/TestDriver.java | 4 +- .../vm/compiler/CodeCacheInfo/Test.java | 6 +- .../CodeCacheInfoOnCompilation/Test.java | 4 +- test/jdk/com/sun/jdi/JITDebug.java | 4 +- test/jdk/com/sun/jdi/NoLaunchOptionTest.java | 4 +- .../jdk/com/sun/jdi/PrivateTransportTest.java | 4 +- test/jdk/com/sun/jdi/ProcessAttachTest.java | 2 +- test/jdk/com/sun/jdi/RunToExit.java | 4 +- test/jdk/com/sun/jdi/cds/CDSJDITest.java | 6 +- test/jdk/com/sun/jdi/lib/jdb/Debuggee.java | 2 +- .../HotSpotDiagnosticMXBean/CheckOrigin.java | 2 +- test/jdk/com/sun/tools/attach/RunnerUtil.java | 4 +- .../java/awt/MenuBar/TestNoScreenMenuBar.java | 4 +- .../java/awt/Robot/NonEmptyErrorStream.java | 4 +- .../ScreenInsetsDPIVariation.java | 4 +- .../MainKeyWindowTest/TestMainKeyWindow.java | 4 +- .../MinimumSizeDPIVariation.java | 4 +- .../MTTransformReplacedProfile.java | 4 +- .../font/JNICheck/FreeTypeScalerJNICheck.java | 4 +- test/jdk/java/foreign/UpcallTestHelper.java | 2 +- test/jdk/java/io/Console/RedirectTest.java | 2 +- test/jdk/java/io/File/MacPath.java | 4 +- .../class/NonSerializableTest.java | 4 +- .../RenamePackage/RenamePackageTest.java | 6 +- .../lang/ClassLoader/GetSystemPackage.java | 4 +- .../Object/InvalidFinalizationOption.java | 4 +- .../lang/ProcessBuilder/InheritIOTest.java | 4 +- .../ProcessBuilder/JspawnhelperProtocol.java | 24 ++--- .../lang/ProcessBuilder/ReaderWriterTest.java | 12 +-- .../shutdown/ShutdownInterruptedMain.java | 6 +- .../modules/CustomSecurityManagerTest.java | 4 +- .../java/lang/StackWalker/CallerFromMain.java | 4 +- .../java/lang/System/FileEncodingTest.java | 4 +- .../System/MacEncoding/MacJNUEncoding.java | 4 +- test/jdk/java/lang/System/i18nEnvArg.java | 4 +- .../lang/Thread/UncaughtExceptionsTest.java | 2 +- .../lang/Thread/virtual/ShutdownHook.java | 4 +- .../java/lang/annotation/LoaderLeakTest.java | 4 +- .../TestDaemonThreadLauncher.java | 4 +- .../lang/instrument/NegativeAgentRunner.java | 4 +- .../PremainClass/PremainClassTest.java | 4 +- .../condy/CondyNestedResolutionTest.java | 4 +- .../channels/Selector/LotsOfUpdatesTest.java | 4 +- .../charset/Charset/DefaultCharsetTest.java | 4 +- test/jdk/java/nio/file/Path/MacPathTest.java | 6 +- .../SignedJarWithCustomClassLoader.java | 6 +- .../util/Formatter/BasicTestLauncher.java | 4 +- .../Properties/StoreReproducibilityTest.java | 16 ++-- .../util/TimeZone/CustomTzIDCheckDST.java | 4 +- .../connection/DefaultAgentFilterTest.java | 2 +- .../security/HashedPasswordFileTest.java | 4 +- .../net/ssl/TLSCommon/interop/ProcUtils.java | 6 +- .../UnninstallUIMemoryLeaks.java | 4 +- .../javax/swing/text/html/CSS/bug8234913.java | 4 +- .../jdk/incubator/vector/LoadJsvmlTest.java | 4 +- .../internal/misc/VM/RuntimeArguments.java | 2 +- .../api/consumer/streaming/Application.java | 4 +- .../streaming/TestCrossProcessStreaming.java | 4 +- .../api/consumer/streaming/TestProcess.java | 4 +- ...onConfigurationEventWithMinAndMaxSize.java | 4 +- .../os/TestInitialEnvironmentVariable.java | 4 +- .../jdk/jfr/event/runtime/TestDumpReason.java | 4 +- .../jfr/event/runtime/TestShutdownEvent.java | 2 +- test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java | 2 +- test/jdk/jdk/jfr/jvm/TestEventWriterLog.java | 2 +- .../jfr/startupargs/TestBadOptionValues.java | 4 +- .../jdk/jfr/startupargs/TestDumpOnExit.java | 4 +- .../jdk/jfr/startupargs/TestJFCWarnings.java | 4 +- .../jfr/startupargs/TestMemoryOptions.java | 24 ++--- .../TestMultipleStartupRecordings.java | 10 +- .../startupargs/TestOptionsWithLocale.java | 2 +- .../startupargs/TestPreserveRepository.java | 2 +- .../startupargs/TestRetransformUsingLog.java | 4 +- .../jfr/startupargs/TestStartDuration.java | 6 +- .../jdk/jfr/startupargs/TestStartName.java | 4 +- .../jfr/startupargs/TestStartupMessage.java | 4 +- .../JavaDotSecurity/MakeJavaSecurityTest.java | 4 +- .../MonitoredVm/MonitorVmStartTerminate.java | 2 +- .../sun/management/jdp/DynamicLauncher.java | 2 +- .../bootstrap/AbstractFilePermissionTest.java | 2 +- .../bootstrap/CustomLauncherTest.java | 2 +- .../bootstrap/JMXInterfaceBindingTest.java | 2 +- .../bootstrap/LocalManagementTest.java | 4 +- .../bootstrap/RmiRegistrySslTest.java | 2 +- .../jmxremote/startstop/JMXStartStopTest.java | 2 +- .../startstop/JMXStatusPerfCountersTest.java | 2 +- .../jmxremote/startstop/JMXStatusTest.java | 2 +- test/jdk/sun/net/spi/SystemProxyDriver.java | 2 +- .../sun/security/krb5/auto/ModuleName.java | 4 +- .../security/provider/KeyStore/DKSTest.java | 2 +- .../ssl/SSLEngineImpl/SSLEngineKeyLimit.java | 2 +- .../ResumptionUpdateBoundValues.java | 4 +- .../ssl/SSLSocketImpl/SSLSocketKeyLimit.java | 2 +- test/jdk/sun/tools/jstat/JStatInterval.java | 2 +- test/jdk/tools/jimage/JImageToolTest.java | 4 +- .../launcher/modules/basic/BasicTest.java | 4 +- .../lib/process/ProcessToolsLastLineTest.java | 2 +- test/lib/jdk/test/lib/cds/CDSTestUtils.java | 4 +- .../test/lib/cli/CommandLineOptionTest.java | 8 +- .../jdk/test/lib/jfr/AppExecutorHelper.java | 4 +- .../jdk/test/lib/process/ProcessTools.java | 64 ++++++++++--- 560 files changed, 1564 insertions(+), 1530 deletions(-) diff --git a/test/hotspot/jtreg/applications/jcstress/JcstressRunner.java b/test/hotspot/jtreg/applications/jcstress/JcstressRunner.java index 37ce9e7df70..d92dbdfe82d 100644 --- a/test/hotspot/jtreg/applications/jcstress/JcstressRunner.java +++ b/test/hotspot/jtreg/applications/jcstress/JcstressRunner.java @@ -69,7 +69,7 @@ public class JcstressRunner { } Path out = Paths.get("jcstress.out").toAbsolutePath(); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(getCmd(args)) + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(getCmd(args)) .redirectErrorStream(true) .redirectOutput(out.toFile()); OutputAnalyzer oa = ProcessTools.executeProcess(pb); diff --git a/test/hotspot/jtreg/applications/jcstress/TestGenerator.java b/test/hotspot/jtreg/applications/jcstress/TestGenerator.java index c497d2aeb59..1b8ff81c48a 100644 --- a/test/hotspot/jtreg/applications/jcstress/TestGenerator.java +++ b/test/hotspot/jtreg/applications/jcstress/TestGenerator.java @@ -109,7 +109,7 @@ public class TestGenerator { Path output; try { output = Files.createTempFile("jcstress", ".out"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-jar", path.toAbsolutePath().toString(), "-l"); diff --git a/test/hotspot/jtreg/applications/scimark/Scimark.java b/test/hotspot/jtreg/applications/scimark/Scimark.java index 8aab97aa2bc..ee4f6f7cef9 100644 --- a/test/hotspot/jtreg/applications/scimark/Scimark.java +++ b/test/hotspot/jtreg/applications/scimark/Scimark.java @@ -48,7 +48,7 @@ public class Scimark { System.setProperty("test.noclasspath", "true"); - OutputAnalyzer output = new OutputAnalyzer(ProcessTools.createTestJvm( + OutputAnalyzer output = new OutputAnalyzer(ProcessTools.createTestJavaProcessBuilder( "-cp", artifacts.get("gov.nist.math.scimark-2.0").toString(), "jnt.scimark2.commandline", "-large") .start()); diff --git a/test/hotspot/jtreg/compiler/arguments/CheckCICompilerCount.java b/test/hotspot/jtreg/compiler/arguments/CheckCICompilerCount.java index da007dd0da9..6f137e20261 100644 --- a/test/hotspot/jtreg/compiler/arguments/CheckCICompilerCount.java +++ b/test/hotspot/jtreg/compiler/arguments/CheckCICompilerCount.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -190,7 +190,7 @@ public class CheckCICompilerCount { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder(arguments); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); out = new OutputAnalyzer(pb.start()); try { diff --git a/test/hotspot/jtreg/compiler/arguments/CheckCompileThresholdScaling.java b/test/hotspot/jtreg/compiler/arguments/CheckCompileThresholdScaling.java index fb9fe26179f..d03aced702e 100644 --- a/test/hotspot/jtreg/compiler/arguments/CheckCompileThresholdScaling.java +++ b/test/hotspot/jtreg/compiler/arguments/CheckCompileThresholdScaling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -338,7 +338,7 @@ public class CheckCompileThresholdScaling { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder(arguments); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); out = new OutputAnalyzer(pb.start()); try { diff --git a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java index 15a60382245..465999eac7f 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java +++ b/test/hotspot/jtreg/compiler/arguments/TestCodeEntryAlignment.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2022, Red Hat, Inc. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -61,7 +61,7 @@ public class TestCodeEntryAlignment { } public static void shouldPass(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/compiler/arguments/TestOptoLoopAlignment.java b/test/hotspot/jtreg/compiler/arguments/TestOptoLoopAlignment.java index 15f9bebc229..3993c679441 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestOptoLoopAlignment.java +++ b/test/hotspot/jtreg/compiler/arguments/TestOptoLoopAlignment.java @@ -62,14 +62,14 @@ public class TestOptoLoopAlignment { } public static void shouldFail(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotHaveExitValue(0); output.shouldContain(MSG); } public static void shouldPass(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldNotContain(MSG); diff --git a/test/hotspot/jtreg/compiler/arguments/TestPrintOptoAssemblyLineNumbers.java b/test/hotspot/jtreg/compiler/arguments/TestPrintOptoAssemblyLineNumbers.java index 1d029aabc0f..1fddeeb50e8 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestPrintOptoAssemblyLineNumbers.java +++ b/test/hotspot/jtreg/compiler/arguments/TestPrintOptoAssemblyLineNumbers.java @@ -1,6 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -51,7 +51,7 @@ public class TestPrintOptoAssemblyLineNumbers { CheckC2OptoAssembly.class.getName() }; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/compiler/arraycopy/stress/TestStressArrayCopy.java b/test/hotspot/jtreg/compiler/arraycopy/stress/TestStressArrayCopy.java index 5153f85c9d7..55dfb0460a2 100644 --- a/test/hotspot/jtreg/compiler/arraycopy/stress/TestStressArrayCopy.java +++ b/test/hotspot/jtreg/compiler/arraycopy/stress/TestStressArrayCopy.java @@ -173,7 +173,7 @@ public class TestStressArrayCopy { for (String className : classNames) { // Start a new job { - ProcessBuilder pb = ProcessTools.createTestJvm(mix(c, "-Xmx256m", className)); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(mix(c, "-Xmx256m", className)); Process p = pb.start(); OutputAnalyzer oa = new OutputAnalyzer(p); forks.add(new Fork(p, oa)); diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeExistingIntrinsicWarningTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeExistingIntrinsicWarningTest.java index 8d43b1e85a3..104e7661e7e 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeExistingIntrinsicWarningTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeExistingIntrinsicWarningTest.java @@ -65,14 +65,14 @@ public class BlackholeExistingIntrinsicWarningTest { } public static void shouldFail(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain(MSG); } public static void shouldPass(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldNotContain(MSG); diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeExperimentalUnlockTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeExperimentalUnlockTest.java index 226c28251f2..6597b2186f2 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeExperimentalUnlockTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeExperimentalUnlockTest.java @@ -65,14 +65,14 @@ public class BlackholeExperimentalUnlockTest { } public static void shouldFail(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain(MSG); } public static void shouldPass(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldNotContain(MSG); diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeIntrinsicTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeIntrinsicTest.java index a7a72a56ff1..8c8cbc5e88d 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeIntrinsicTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeIntrinsicTest.java @@ -134,7 +134,7 @@ public class BlackholeIntrinsicTest { cmdline.add("compiler.blackhole.BlackholeIntrinsicTest"); cmdline.add(test); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.stderrShouldBeEmpty(); diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonEmptyWarningTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonEmptyWarningTest.java index 43cbdfd773b..c07754b37ea 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonEmptyWarningTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonEmptyWarningTest.java @@ -64,14 +64,14 @@ public class BlackholeNonEmptyWarningTest { } public static void shouldFail(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain(MSG); } public static void shouldPass(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldNotContain(MSG); diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonStaticWarningTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonStaticWarningTest.java index f9e12ba3f9d..ff84070b4e1 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonStaticWarningTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonStaticWarningTest.java @@ -64,14 +64,14 @@ public class BlackholeNonStaticWarningTest { } public static void shouldFail(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain(MSG); } public static void shouldPass(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldNotContain(MSG); diff --git a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarningTest.java b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarningTest.java index 555f6779124..c3a780576fe 100644 --- a/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarningTest.java +++ b/test/hotspot/jtreg/compiler/blackhole/BlackholeNonVoidWarningTest.java @@ -64,14 +64,14 @@ public class BlackholeNonVoidWarningTest { } public static void shouldFail(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain(MSG); } public static void shouldPass(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmdline(args)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmdline(args)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldNotContain(MSG); diff --git a/test/hotspot/jtreg/compiler/c1/TestRangeCheckEliminated.java b/test/hotspot/jtreg/compiler/c1/TestRangeCheckEliminated.java index 7d4dd350e03..9da8a5390da 100644 --- a/test/hotspot/jtreg/compiler/c1/TestRangeCheckEliminated.java +++ b/test/hotspot/jtreg/compiler/c1/TestRangeCheckEliminated.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -54,7 +54,7 @@ public class TestRangeCheckEliminated { test_constant_array.class.getName() }; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); String output = new OutputAnalyzer(pb.start()).getOutput(); // should have 2 "can be fully eliminated" System.out.println(output); @@ -74,7 +74,7 @@ public class TestRangeCheckEliminated { test_multi_constant_array.class.getName() }; - pb = ProcessTools.createJavaProcessBuilder(procArgs); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); output = new OutputAnalyzer(pb.start()).getOutput(); // should have 1 "can be fully eliminated" System.out.println(output); @@ -94,7 +94,7 @@ public class TestRangeCheckEliminated { test_multi_new_array.class.getName() }; - pb = ProcessTools.createJavaProcessBuilder(procArgs); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); output = new OutputAnalyzer(pb.start()).getOutput(); // should have 2 "can be fully eliminated" System.out.println(output); diff --git a/test/hotspot/jtreg/compiler/c2/TestBit.java b/test/hotspot/jtreg/compiler/c2/TestBit.java index 02596b7ee55..a3c9421a3f9 100644 --- a/test/hotspot/jtreg/compiler/c2/TestBit.java +++ b/test/hotspot/jtreg/compiler/c2/TestBit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -49,7 +49,7 @@ public class TestBit { "-XX:CompileCommand=compileonly," + className + "::tst*", className, testName}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); String expectedTestBitInstruction = diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestFarJump.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestFarJump.java index f47331a6d80..d461d56d8a3 100644 --- a/test/hotspot/jtreg/compiler/c2/aarch64/TestFarJump.java +++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestFarJump.java @@ -95,7 +95,7 @@ public class TestFarJump { "-XX:+PrintAssembly", className}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); List lines = output.asLines(); diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestSVEWithJNI.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestSVEWithJNI.java index eeb10e99547..81abcd27959 100644 --- a/test/hotspot/jtreg/compiler/c2/aarch64/TestSVEWithJNI.java +++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestSVEWithJNI.java @@ -1,27 +1,27 @@ /* -* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. -* Copyright (c) 2020, Arm Limited. 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. -* -*/ + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, Arm Limited. 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. + * + */ /** * @test @@ -79,7 +79,7 @@ public class TestSVEWithJNI { Collections.addAll(vmopts, "-Dtest.jdk=" + testjdkPath); Collections.addAll(vmopts, args); Collections.addAll(vmopts, TestSVEWithJNI.class.getName(), mode); - return ProcessTools.createJavaProcessBuilder(vmopts.toArray(new String[vmopts.size()])); + return ProcessTools.createLimitedTestJavaProcessBuilder(vmopts.toArray(new String[vmopts.size()])); } public static void main(String [] args) throws Exception { diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestTrampoline.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestTrampoline.java index cf763555ebc..114f7f9bfab 100644 --- a/test/hotspot/jtreg/compiler/c2/aarch64/TestTrampoline.java +++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestTrampoline.java @@ -57,7 +57,7 @@ public class TestTrampoline { command.add("-XX:ReservedCodeCacheSize=130M"); command.add("-XX:+SegmentedCodeCache"); command.add(testClassName); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(command); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(command); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); analyzer.shouldHaveExitValue(0); System.out.println(analyzer.getOutput()); diff --git a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatiles.java b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatiles.java index 055d54ccb4f..10bc237f2be 100644 --- a/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatiles.java +++ b/test/hotspot/jtreg/compiler/c2/aarch64/TestVolatiles.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved. - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -132,7 +132,7 @@ public class TestVolatiles { public void runtest(String classname, String testType, boolean useCompressedOops, String[] procArgs) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.stderrShouldBeEmptyIgnoreVMWarnings(); diff --git a/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java b/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java index a025962081c..6ad45edd26b 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java +++ b/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -177,11 +177,11 @@ public abstract class CiReplayBase { options.add("'" + getTestClass() + "'"); crashOut = ProcessTools.executeProcess( CoreUtils.addCoreUlimitCommand( - ProcessTools.createTestJvm(options.toArray(new String[0])))); + ProcessTools.createTestJavaProcessBuilder(options.toArray(new String[0])))); } else { options.add("-XX:CompileOnly=" + getTestClass() + "::" + getTestMethod()); options.add(getTestClass()); - crashOut = ProcessTools.executeProcess(ProcessTools.createTestJvm(options)); + crashOut = ProcessTools.executeProcess(ProcessTools.createTestJavaProcessBuilder(options)); } crashOutputString = crashOut.getOutput(); Asserts.assertNotEquals(crashOut.getExitValue(), 0, "Crash JVM exits gracefully"); @@ -288,7 +288,7 @@ public abstract class CiReplayBase { private String[] getTestJvmCommandlineWithPrefix(String prefix, String... args) { try { - String cmd = ProcessTools.getCommandLine(ProcessTools.createTestJvm(args)); + String cmd = ProcessTools.getCommandLine(ProcessTools.createTestJavaProcessBuilder(args)); return new String[]{"sh", "-c", prefix + (Platform.isWindows() ? cmd.replace('\\', '/').replace(";", "\\;").replace("|", "\\|") : cmd)}; } catch(Throwable t) { diff --git a/test/hotspot/jtreg/compiler/ciReplay/DumpReplayBase.java b/test/hotspot/jtreg/compiler/ciReplay/DumpReplayBase.java index 4d783993578..3597c0729a1 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/DumpReplayBase.java +++ b/test/hotspot/jtreg/compiler/ciReplay/DumpReplayBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -79,7 +79,7 @@ public abstract class DumpReplayBase extends CiReplayBase { options.add("-XX:CompileCommand=compileonly," + getTestClass() + "::" + getTestMethod()); options.add("-Xbatch"); options.add(getTestClass()); - oa = ProcessTools.executeProcess(ProcessTools.createTestJvm(options)); + oa = ProcessTools.executeProcess(ProcessTools.createTestJavaProcessBuilder(options)); Asserts.assertEquals(oa.getExitValue(), 0, "Crash JVM exits gracefully"); replayFiles = Files.list(Paths.get(".")) .map(Path::toFile) diff --git a/test/hotspot/jtreg/compiler/ciReplay/SABase.java b/test/hotspot/jtreg/compiler/ciReplay/SABase.java index db576d73631..66f2eb1106f 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/SABase.java +++ b/test/hotspot/jtreg/compiler/ciReplay/SABase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -71,7 +71,7 @@ public class SABase extends CiReplayBase { } ProcessBuilder pb; try { - pb = ProcessTools.createTestJvm("--add-modules", "jdk.hotspot.agent", + pb = ProcessTools.createTestJavaProcessBuilder("--add-modules", "jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "sun.jvm.hotspot.CLHSDB", JDKToolFinder.getTestJDKTool("java"), TEST_CORE_FILE_NAME); diff --git a/test/hotspot/jtreg/compiler/ciReplay/TestInvalidReplayFile.java b/test/hotspot/jtreg/compiler/ciReplay/TestInvalidReplayFile.java index 8112a7a43f6..45a2e647c80 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/TestInvalidReplayFile.java +++ b/test/hotspot/jtreg/compiler/ciReplay/TestInvalidReplayFile.java @@ -54,7 +54,7 @@ public class TestInvalidReplayFile { w.flush(); w.close(); - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:+ReplayCompiles", "-XX:ReplayDataFile=./bogus-replay-file.txt"); diff --git a/test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java b/test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java index 53d555ee139..f6a2536515e 100644 --- a/test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java +++ b/test/hotspot/jtreg/compiler/codecache/CheckCodeCacheInfo.java @@ -66,9 +66,9 @@ public class CheckCodeCacheInfo { public static void main(String[] args) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createTestJvm("-XX:+PrintCodeCache", - "-XX:+Verbose", - "-version"); + pb = ProcessTools.createTestJavaProcessBuilder("-XX:+PrintCodeCache", + "-XX:+Verbose", + "-version"); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); out.stdoutShouldMatch(VERBOSE_REGEXP); diff --git a/test/hotspot/jtreg/compiler/codecache/CheckLargePages.java b/test/hotspot/jtreg/compiler/codecache/CheckLargePages.java index 8e2db5067d8..5e05a0fae57 100644 --- a/test/hotspot/jtreg/compiler/codecache/CheckLargePages.java +++ b/test/hotspot/jtreg/compiler/codecache/CheckLargePages.java @@ -50,7 +50,7 @@ public class CheckLargePages { final boolean largePages = WHITE_BOX.getBooleanVMFlag("UseLargePages"); final long largePageSize = WHITE_BOX.getVMLargePageSize(); if (largePages && (largePageSize == 1024 * 1024 * 1024)) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseLargePages", "-XX:+SegmentedCodeCache", "-XX:InitialCodeCacheSize=2g", diff --git a/test/hotspot/jtreg/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java b/test/hotspot/jtreg/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java index 63e7f83a303..f4a1cc3f0e7 100644 --- a/test/hotspot/jtreg/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java +++ b/test/hotspot/jtreg/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,8 +42,8 @@ public class CheckReservedInitialCodeCacheSizeArgOrder { ProcessBuilder pb1, pb2; OutputAnalyzer out1, out2; - pb1 = ProcessTools.createJavaProcessBuilder("-XX:InitialCodeCacheSize=4m", "-XX:ReservedCodeCacheSize=8m", "-version"); - pb2 = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=8m", "-XX:InitialCodeCacheSize=4m", "-version"); + pb1 = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=4m", "-XX:ReservedCodeCacheSize=8m", "-version"); + pb2 = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ReservedCodeCacheSize=8m", "-XX:InitialCodeCacheSize=4m", "-version"); out1 = new OutputAnalyzer(pb1.start()); out2 = new OutputAnalyzer(pb2.start()); diff --git a/test/hotspot/jtreg/compiler/codecache/CheckSegmentedCodeCache.java b/test/hotspot/jtreg/compiler/codecache/CheckSegmentedCodeCache.java index ae884a1fa8c..f79d7da7695 100644 --- a/test/hotspot/jtreg/compiler/codecache/CheckSegmentedCodeCache.java +++ b/test/hotspot/jtreg/compiler/codecache/CheckSegmentedCodeCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -89,80 +89,80 @@ public class CheckSegmentedCodeCache { ProcessBuilder pb; // Disabled with ReservedCodeCacheSize < 240MB - pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=239m", - "-XX:+PrintCodeCache", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ReservedCodeCacheSize=239m", + "-XX:+PrintCodeCache", + "-version"); verifySegmentedCodeCache(pb, false); // Disabled without TieredCompilation - pb = ProcessTools.createJavaProcessBuilder("-XX:-TieredCompilation", - "-XX:+PrintCodeCache", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:-TieredCompilation", + "-XX:+PrintCodeCache", + "-version"); verifySegmentedCodeCache(pb, false); // Enabled with TieredCompilation and ReservedCodeCacheSize >= 240MB - pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation", - "-XX:ReservedCodeCacheSize=240m", - "-XX:+PrintCodeCache", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+TieredCompilation", + "-XX:ReservedCodeCacheSize=240m", + "-XX:+PrintCodeCache", + "-version"); verifySegmentedCodeCache(pb, true); - pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation", - "-XX:ReservedCodeCacheSize=400m", - "-XX:+PrintCodeCache", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+TieredCompilation", + "-XX:ReservedCodeCacheSize=400m", + "-XX:+PrintCodeCache", + "-version"); verifySegmentedCodeCache(pb, true); // Always enabled if SegmentedCodeCache is set - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:-TieredCompilation", - "-XX:ReservedCodeCacheSize=239m", - "-XX:+PrintCodeCache", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:-TieredCompilation", + "-XX:ReservedCodeCacheSize=239m", + "-XX:+PrintCodeCache", + "-version"); verifySegmentedCodeCache(pb, true); // The profiled and non-profiled code heaps should not be available in // interpreter-only mode - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-Xint", - "-XX:+PrintCodeCache", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-Xint", + "-XX:+PrintCodeCache", + "-version"); verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED); // If we stop compilation at CompLevel_none or CompLevel_simple we // don't need a profiled code heap. - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:TieredStopAtLevel=0", - "-XX:+PrintCodeCache", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:TieredStopAtLevel=0", + "-XX:+PrintCodeCache", + "-version"); verifyCodeHeapNotExists(pb, PROFILED); - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:TieredStopAtLevel=1", - "-XX:+PrintCodeCache", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:TieredStopAtLevel=1", + "-XX:+PrintCodeCache", + "-version"); verifyCodeHeapNotExists(pb, PROFILED); // Fails with too small non-nmethod code heap size - pb = ProcessTools.createJavaProcessBuilder("-XX:NonNMethodCodeHeapSize=100K", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:NonNMethodCodeHeapSize=100K", + "-version"); failsWith(pb, "Invalid NonNMethodCodeHeapSize"); // Fails if code heap sizes do not add up - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:ReservedCodeCacheSize=10M", - "-XX:NonNMethodCodeHeapSize=5M", - "-XX:ProfiledCodeHeapSize=5M", - "-XX:NonProfiledCodeHeapSize=5M", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:ReservedCodeCacheSize=10M", + "-XX:NonNMethodCodeHeapSize=5M", + "-XX:ProfiledCodeHeapSize=5M", + "-XX:NonProfiledCodeHeapSize=5M", + "-version"); failsWith(pb, "Invalid code heap sizes"); // Fails if not enough space for VM internal code long minUseSpace = WHITE_BOX.getUintxVMFlag("CodeCacheMinimumUseSpace"); // minimum size: CodeCacheMinimumUseSpace DEBUG_ONLY(* 3) long minSize = (Platform.isDebugBuild() ? 3 : 1) * minUseSpace; - pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", - "-XX:ReservedCodeCacheSize=" + minSize, - "-XX:InitialCodeCacheSize=100K", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+SegmentedCodeCache", + "-XX:ReservedCodeCacheSize=" + minSize, + "-XX:InitialCodeCacheSize=100K", + "-version"); failsWith(pb, "Not enough space in non-nmethod code heap to run VM"); } } diff --git a/test/hotspot/jtreg/compiler/codecache/CheckUpperLimit.java b/test/hotspot/jtreg/compiler/codecache/CheckUpperLimit.java index 9509da6cf32..7ec5e744dd6 100644 --- a/test/hotspot/jtreg/compiler/codecache/CheckUpperLimit.java +++ b/test/hotspot/jtreg/compiler/codecache/CheckUpperLimit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -41,7 +41,7 @@ public class CheckUpperLimit { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version"); out = new OutputAnalyzer(pb.start()); out.shouldContain("Invalid ReservedCodeCacheSize="); out.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java b/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java index 577cb03a939..f3233bdaeca 100644 --- a/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java +++ b/test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java @@ -63,7 +63,7 @@ public class CodeCacheFullCountTest { } public static void runTest() throws Throwable { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:ReservedCodeCacheSize=2496k", "-XX:-UseCodeCacheFlushing", "-XX:-MethodFlushing", "CodeCacheFullCountTest", "WasteCodeCache"); OutputAnalyzer oa = ProcessTools.executeProcess(pb); // Ignore adapter creation failures diff --git a/test/hotspot/jtreg/compiler/compilercontrol/TestConflictInlineCommands.java b/test/hotspot/jtreg/compiler/compilercontrol/TestConflictInlineCommands.java index 2b33cbb5cef..bd4bde90b7f 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/TestConflictInlineCommands.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/TestConflictInlineCommands.java @@ -39,7 +39,7 @@ import jdk.test.lib.process.ProcessTools; public class TestConflictInlineCommands { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:CompileCommand=inline,*TestConflictInlineCommands::caller", "-XX:CompileCommand=dontinline,*TestConflictInlineCommands::caller", "-XX:CompileCommand=quiet", "-XX:CompileCommand=compileonly,*Launcher::main", @@ -51,7 +51,7 @@ public class TestConflictInlineCommands { analyzer.shouldContain("disallowed by CompileCommand"); analyzer.shouldNotContain("force inline by CompileCommand"); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbatch", "-XX:CompileCommand=dontinline,*TestConflictInlineCommands::*caller", "-XX:CompileCommand=inline,*TestConflictInlineCommands::caller", diff --git a/test/hotspot/jtreg/compiler/cpuflags/RestoreMXCSR.java b/test/hotspot/jtreg/compiler/cpuflags/RestoreMXCSR.java index 176d23409af..fa748cb21ac 100644 --- a/test/hotspot/jtreg/compiler/cpuflags/RestoreMXCSR.java +++ b/test/hotspot/jtreg/compiler/cpuflags/RestoreMXCSR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -41,7 +41,7 @@ public class RestoreMXCSR { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-XX:+RestoreMXCSROnJNICalls", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+RestoreMXCSROnJNICalls", "-version"); out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/compiler/debug/TestGenerateStressSeed.java b/test/hotspot/jtreg/compiler/debug/TestGenerateStressSeed.java index 3020bf1df34..f03667a55ce 100644 --- a/test/hotspot/jtreg/compiler/debug/TestGenerateStressSeed.java +++ b/test/hotspot/jtreg/compiler/debug/TestGenerateStressSeed.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -58,7 +58,7 @@ public class TestGenerateStressSeed { "-Xcomp", "-XX:-TieredCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:CompileOnly=" + className + "::sum", "-XX:+" + stressOpt, "-XX:+LogCompilation", "-XX:LogFile=" + log, className, "10"}; - new OutputAnalyzer(ProcessTools.createJavaProcessBuilder(procArgs).start()) + new OutputAnalyzer(ProcessTools.createLimitedTestJavaProcessBuilder(procArgs).start()) .shouldHaveExitValue(0); new OutputAnalyzer(Paths.get(log)) .shouldContain("stress_test seed"); diff --git a/test/hotspot/jtreg/compiler/debug/TestStressCM.java b/test/hotspot/jtreg/compiler/debug/TestStressCM.java index 4b3bd786595..0fb624bc16f 100644 --- a/test/hotspot/jtreg/compiler/debug/TestStressCM.java +++ b/test/hotspot/jtreg/compiler/debug/TestStressCM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -48,7 +48,7 @@ public class TestStressCM { "-XX:CompileOnly=" + className + "::sum", "-XX:+TraceOptoPipelining", "-XX:+" + stressOpt, "-XX:StressSeed=" + stressSeed, className, "10"}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); // Extract the trace of our method (the last one after those of all diff --git a/test/hotspot/jtreg/compiler/debug/TestStressIGVNAndCCP.java b/test/hotspot/jtreg/compiler/debug/TestStressIGVNAndCCP.java index 242c6f69fb1..3ec49daa0ea 100644 --- a/test/hotspot/jtreg/compiler/debug/TestStressIGVNAndCCP.java +++ b/test/hotspot/jtreg/compiler/debug/TestStressIGVNAndCCP.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -48,7 +48,7 @@ public class TestStressIGVNAndCCP { "-XX:CompileOnly=" + className + "::sum", "-XX:+" + traceOption, "-XX:+" + stressOption, "-XX:StressSeed=" + stressSeed, className, "10"}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); return out.getStdout(); diff --git a/test/hotspot/jtreg/compiler/debug/VerifyAdapterSharing.java b/test/hotspot/jtreg/compiler/debug/VerifyAdapterSharing.java index 00ec0291131..89da61a5763 100644 --- a/test/hotspot/jtreg/compiler/debug/VerifyAdapterSharing.java +++ b/test/hotspot/jtreg/compiler/debug/VerifyAdapterSharing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class VerifyAdapterSharing { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-Xcomp", "-XX:+IgnoreUnrecognizedVMOptions", + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xcomp", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:+VerifyAdapterSharing", "-version"); out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/compiler/escapeAnalysis/TestIterativeEA.java b/test/hotspot/jtreg/compiler/escapeAnalysis/TestIterativeEA.java index ef4db463516..f0524368d70 100644 --- a/test/hotspot/jtreg/compiler/escapeAnalysis/TestIterativeEA.java +++ b/test/hotspot/jtreg/compiler/escapeAnalysis/TestIterativeEA.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -39,7 +39,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestIterativeEA { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-server", "-XX:-TieredCompilation", "-Xbatch", "-XX:+PrintEliminateAllocations", Launcher.class.getName()); diff --git a/test/hotspot/jtreg/compiler/inlining/InlineAccessors.java b/test/hotspot/jtreg/compiler/inlining/InlineAccessors.java index 0d4da50cfc5..934a13c97aa 100644 --- a/test/hotspot/jtreg/compiler/inlining/InlineAccessors.java +++ b/test/hotspot/jtreg/compiler/inlining/InlineAccessors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import jdk.test.lib.process.ProcessTools; public class InlineAccessors { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-server", "-XX:-TieredCompilation", "-Xbatch", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", diff --git a/test/hotspot/jtreg/compiler/inlining/PrintInlining.java b/test/hotspot/jtreg/compiler/inlining/PrintInlining.java index a0975dee673..768fa90965d 100644 --- a/test/hotspot/jtreg/compiler/inlining/PrintInlining.java +++ b/test/hotspot/jtreg/compiler/inlining/PrintInlining.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ import jdk.test.lib.process.ProcessTools; public class PrintInlining { static void test(String option) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-server", "-XX:-TieredCompilation", "-Xbatch", "-XX:-UseOnStackReplacement", "-XX:CompileCommand=dontinline,*::bar", diff --git a/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java b/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java index 65394d5a38b..c0f39f12e4a 100644 --- a/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java +++ b/test/hotspot/jtreg/compiler/inlining/ResolvedClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import java.io.IOException; public class ResolvedClassTest { /* ======================================================================== */ static void testStatic() throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", "-Xbatch", "-XX:CompileCommand=quiet", "-XX:CompileCommand=compileonly," + TestStatic.class.getName() + "::test", @@ -78,7 +78,7 @@ public class ResolvedClassTest { /* ======================================================================== */ static void testStaticInit() throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", "-Xbatch", "-XX:CompileCommand=quiet", "-XX:CompileCommand=compileonly," + TestStaticInit.class.getName() + "::test", @@ -115,7 +115,7 @@ public class ResolvedClassTest { /* ======================================================================== */ static void testIndy() throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", "-Xbatch", "-XX:CompileCommand=quiet", "-XX:CompileCommand=compileonly," + TestIndy.class.getName() + "::test", diff --git a/test/hotspot/jtreg/compiler/intrinsics/chacha/TestChaCha20.java b/test/hotspot/jtreg/compiler/intrinsics/chacha/TestChaCha20.java index a3b708fab81..c2275f6563e 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/chacha/TestChaCha20.java +++ b/test/hotspot/jtreg/compiler/intrinsics/chacha/TestChaCha20.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, Red Hat, Inc. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -127,7 +127,7 @@ public class TestChaCha20 { for (String className : classNames) { // Start a new job { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( mix(c, "-Xmx256m", className)); Process p = pb.start(); OutputAnalyzer oa = new OutputAnalyzer(p); diff --git a/test/hotspot/jtreg/compiler/jsr292/ContinuousCallSiteTargetChange.java b/test/hotspot/jtreg/compiler/jsr292/ContinuousCallSiteTargetChange.java index e8e6551e453..2b501064b76 100644 --- a/test/hotspot/jtreg/compiler/jsr292/ContinuousCallSiteTargetChange.java +++ b/test/hotspot/jtreg/compiler/jsr292/ContinuousCallSiteTargetChange.java @@ -61,7 +61,7 @@ public class ContinuousCallSiteTargetChange { argsList.add(test.getName()); argsList.add(Integer.toString(ITERATIONS)); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(argsList); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(argsList); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/compiler/jsr292/MHInlineTest.java b/test/hotspot/jtreg/compiler/jsr292/MHInlineTest.java index a2358cb6edc..a8e76f5797d 100644 --- a/test/hotspot/jtreg/compiler/jsr292/MHInlineTest.java +++ b/test/hotspot/jtreg/compiler/jsr292/MHInlineTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -47,7 +47,7 @@ import static jdk.test.lib.Asserts.assertEquals; public class MHInlineTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-XX:-TieredCompilation", "-Xbatch", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining", diff --git a/test/hotspot/jtreg/compiler/jsr292/PollutedTrapCounts.java b/test/hotspot/jtreg/compiler/jsr292/PollutedTrapCounts.java index 6e060c5a375..b43a6f33a1e 100644 --- a/test/hotspot/jtreg/compiler/jsr292/PollutedTrapCounts.java +++ b/test/hotspot/jtreg/compiler/jsr292/PollutedTrapCounts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ import java.lang.invoke.MethodType; public class PollutedTrapCounts { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-TieredCompilation", "-Xbatch", "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10", diff --git a/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java b/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java index d299f4f6ac7..1c36ab78ac6 100644 --- a/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java +++ b/test/hotspot/jtreg/compiler/jvmci/TestEnableJVMCIProduct.java @@ -84,7 +84,7 @@ public class TestEnableJVMCIProduct { String[] flags = {"-XX:+EnableJVMCIProduct", "-XX:+UseGraalJIT"}; String cwd = System.getProperty("user.dir"); for (String flag : flags) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", flag, "-XX:-UnlockExperimentalVMOptions", explicitFlag, "-XX:+PrintFlagsFinal", diff --git a/test/hotspot/jtreg/compiler/jvmci/TestInvalidJVMCIOption.java b/test/hotspot/jtreg/compiler/jvmci/TestInvalidJVMCIOption.java index 0cffca55dc4..1fec1eeb278 100644 --- a/test/hotspot/jtreg/compiler/jvmci/TestInvalidJVMCIOption.java +++ b/test/hotspot/jtreg/compiler/jvmci/TestInvalidJVMCIOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestInvalidJVMCIOption { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerJVMCI", "-XX:+UseJVMCICompiler", diff --git a/test/hotspot/jtreg/compiler/jvmci/TestJVMCIPrintProperties.java b/test/hotspot/jtreg/compiler/jvmci/TestJVMCIPrintProperties.java index 16eb6dfb8f9..4e4a013db40 100644 --- a/test/hotspot/jtreg/compiler/jvmci/TestJVMCIPrintProperties.java +++ b/test/hotspot/jtreg/compiler/jvmci/TestJVMCIPrintProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class TestJVMCIPrintProperties { } static void test(String enableFlag) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", enableFlag, "-Djvmci.Compiler=null", "-XX:+JVMCIPrintProperties"); diff --git a/test/hotspot/jtreg/compiler/jvmci/TestJVMCISavedProperties.java b/test/hotspot/jtreg/compiler/jvmci/TestJVMCISavedProperties.java index 423a575b6ea..31e592ef906 100644 --- a/test/hotspot/jtreg/compiler/jvmci/TestJVMCISavedProperties.java +++ b/test/hotspot/jtreg/compiler/jvmci/TestJVMCISavedProperties.java @@ -45,7 +45,7 @@ public class TestJVMCISavedProperties { System.out.println("DONE IN MAIN"); return; } - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", "-XX:+EagerJVMCI", "-XX:+UseJVMCICompiler", diff --git a/test/hotspot/jtreg/compiler/jvmci/TestUncaughtErrorInCompileMethod.java b/test/hotspot/jtreg/compiler/jvmci/TestUncaughtErrorInCompileMethod.java index d0c90bcd6da..511e0c4b98c 100644 --- a/test/hotspot/jtreg/compiler/jvmci/TestUncaughtErrorInCompileMethod.java +++ b/test/hotspot/jtreg/compiler/jvmci/TestUncaughtErrorInCompileMethod.java @@ -83,7 +83,7 @@ public class TestUncaughtErrorInCompileMethod extends JVMCIServiceLocator { } static void testSubprocess(boolean fatalError) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", "-XX:+UseJVMCICompiler", "-Djvmci.Compiler=ErrorCompiler", "-XX:-TieredCompilation", diff --git a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetFlagValueTest.java b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetFlagValueTest.java index dba434d6d84..aa9252d4665 100644 --- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetFlagValueTest.java +++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetFlagValueTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -63,7 +63,7 @@ public class GetFlagValueTest { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", "-XX:+EnableJVMCI", "-XX:+PrintFlagsFinal", diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotJVMCIRuntime.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotJVMCIRuntime.java index 21a9575b28b..e5d1da81309 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotJVMCIRuntime.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/TestHotSpotJVMCIRuntime.java @@ -167,7 +167,7 @@ public class TestHotSpotJVMCIRuntime { } String[] names = {"translate", "attachCurrentThread", "registerNativeMethods"}; for (String name : names) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", "-XX:+EnableJVMCI", "-XX:-UseJVMCICompiler", diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java index d8e10e76315..2c63bbe9589 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -146,7 +146,7 @@ public class TestVMProcess { } private void start() { - ProcessBuilder process = ProcessTools.createJavaProcessBuilder(cmds); + ProcessBuilder process = ProcessTools.createLimitedTestJavaProcessBuilder(cmds); try { // Calls 'main' of TestVM to run all specified tests with commands 'cmds'. // Use executeProcess instead of executeTestJvm as we have already added the JTreg VM and diff --git a/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java b/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java index d61fc44dad4..ad02dd617a7 100644 --- a/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java +++ b/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -41,7 +41,7 @@ public class TestLinkageErrorInGenerateOopMap { public static void main(String args[]) throws Exception { if (args.length == 0) { // Spawn new VM instance to execute test - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:-BytecodeVerificationRemote", "-XX:-BytecodeVerificationLocal", diff --git a/test/hotspot/jtreg/compiler/loopstripmining/CheckLoopStripMiningIterShortLoop.java b/test/hotspot/jtreg/compiler/loopstripmining/CheckLoopStripMiningIterShortLoop.java index ecceaa4c4b7..80c046e7a36 100644 --- a/test/hotspot/jtreg/compiler/loopstripmining/CheckLoopStripMiningIterShortLoop.java +++ b/test/hotspot/jtreg/compiler/loopstripmining/CheckLoopStripMiningIterShortLoop.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.ProcessTools; public class CheckLoopStripMiningIterShortLoop { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", "-XX:+PrintFlagsFinal", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", "-XX:+PrintFlagsFinal", "-version"); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/compiler/loopstripmining/TestNoWarningLoopStripMiningIterSet.java b/test/hotspot/jtreg/compiler/loopstripmining/TestNoWarningLoopStripMiningIterSet.java index 6bb7ca445c5..c356e4495c2 100644 --- a/test/hotspot/jtreg/compiler/loopstripmining/TestNoWarningLoopStripMiningIterSet.java +++ b/test/hotspot/jtreg/compiler/loopstripmining/TestNoWarningLoopStripMiningIterSet.java @@ -94,7 +94,7 @@ public class TestNoWarningLoopStripMiningIterSet { System.arraycopy(args, 0, cmds, 1, args.length); cmds[args.length + 1] = "-XX:+PrintFlagsFinal"; cmds[args.length + 2] = "-version"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmds); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWait.java b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWait.java index 66cf04fd62f..d5318a7bba4 100644 --- a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWait.java +++ b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWait.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Azul Systems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -43,7 +43,7 @@ public class TestOnSpinWait { public static void main(String[] args) throws Exception { // Test C2 compiler - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-XX:-TieredCompilation", "-Xbatch", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java index 86f2d55e19f..76953bfb124 100644 --- a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java +++ b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java @@ -71,7 +71,7 @@ public class TestOnSpinWaitAArch64 { command.add("-XX:CompileCommand=compileonly," + Launcher.class.getName() + "::" + "test"); command.add(Launcher.class.getName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(command); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(command); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64DefaultFlags.java b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64DefaultFlags.java index 1a6d5cb3dc7..f7ed6096080 100644 --- a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64DefaultFlags.java +++ b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64DefaultFlags.java @@ -87,9 +87,9 @@ public class TestOnSpinWaitAArch64DefaultFlags { final String cpuModel = cpuFeatures.get(0); if (isCPUModelNeoverseN1(cpuModel)) { - checkFinalFlagsEqualTo(ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintFlagsFinal", "-version"), + checkFinalFlagsEqualTo(ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintFlagsFinal", "-version"), "isb", "1"); - checkFinalFlagsEqualTo(ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:OnSpinWaitInstCount=2", "-XX:+PrintFlagsFinal", "-version"), + checkFinalFlagsEqualTo(ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:OnSpinWaitInstCount=2", "-XX:+PrintFlagsFinal", "-version"), "isb", "2"); } else { System.out.println("Skip because no defaults for CPU model: " + cpuModel); diff --git a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitC1.java b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitC1.java index fde38cf858e..380a8185084 100644 --- a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitC1.java +++ b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitC1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Azul Systems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -45,7 +45,7 @@ public class TestOnSpinWaitC1 { public static void main(String[] args) throws Exception { // Test C1 compiler - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch", "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitNoneAArch64.java b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitNoneAArch64.java index 7569d9d07a6..51746b4c245 100644 --- a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitNoneAArch64.java +++ b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitNoneAArch64.java @@ -54,7 +54,7 @@ public class TestOnSpinWaitNoneAArch64 { command.add(Launcher.class.getName()); // Test C2 compiler - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(command); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(command); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitRISCV64.java b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitRISCV64.java index 78189e3c0a3..ad524065f46 100644 --- a/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitRISCV64.java +++ b/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitRISCV64.java @@ -64,7 +64,7 @@ public class TestOnSpinWaitRISCV64 { command.add("-Xbatch"); command.add(Launcher.class.getName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(command); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(command); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/compiler/oracle/CheckCompileCommandOption.java b/test/hotspot/jtreg/compiler/oracle/CheckCompileCommandOption.java index 96279f9412f..d6d989d500d 100644 --- a/test/hotspot/jtreg/compiler/oracle/CheckCompileCommandOption.java +++ b/test/hotspot/jtreg/compiler/oracle/CheckCompileCommandOption.java @@ -251,7 +251,7 @@ public class CheckCompileCommandOption { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder(arguments); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); out = new OutputAnalyzer(pb.start()); for (String expected_output : expected_outputs) { @@ -266,7 +266,7 @@ public class CheckCompileCommandOption { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder(arguments); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); out = new OutputAnalyzer(pb.start()); out.shouldContain("CompileCommand: An error occurred during parsing"); @@ -277,7 +277,7 @@ public class CheckCompileCommandOption { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder(arguments); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); out = new OutputAnalyzer(pb.start()); for (String expected_output : expected_outputs) { diff --git a/test/hotspot/jtreg/compiler/oracle/TestCompileCommand.java b/test/hotspot/jtreg/compiler/oracle/TestCompileCommand.java index 0279843b590..6cb80d0a0e3 100644 --- a/test/hotspot/jtreg/compiler/oracle/TestCompileCommand.java +++ b/test/hotspot/jtreg/compiler/oracle/TestCompileCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -56,7 +56,7 @@ public class TestCompileCommand { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder(arguments); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); out = new OutputAnalyzer(pb.start()); for (String expected_output : expected_outputs) { diff --git a/test/hotspot/jtreg/compiler/oracle/TestInvalidCompileCommand.java b/test/hotspot/jtreg/compiler/oracle/TestInvalidCompileCommand.java index bd3495d6db8..6e23aa5d6e0 100644 --- a/test/hotspot/jtreg/compiler/oracle/TestInvalidCompileCommand.java +++ b/test/hotspot/jtreg/compiler/oracle/TestInvalidCompileCommand.java @@ -83,7 +83,7 @@ public class TestInvalidCompileCommand { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder(arguments); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); out = new OutputAnalyzer(pb.start()); for (String expected_output : expected_outputs) { diff --git a/test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckHoistingScaledIV.java b/test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckHoistingScaledIV.java index 88e6fcdcf9a..e342adf595c 100644 --- a/test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckHoistingScaledIV.java +++ b/test/hotspot/jtreg/compiler/rangechecks/TestRangeCheckHoistingScaledIV.java @@ -81,7 +81,7 @@ public class TestRangeCheckHoistingScaledIV { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "--add-modules", "jdk.incubator.vector", "-Xbatch", "-XX:+TraceLoopPredicate", Launcher.class.getName()); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/compiler/runtime/cr8015436/Driver8015436.java b/test/hotspot/jtreg/compiler/runtime/cr8015436/Driver8015436.java index 36f4266c7d5..bdf221b84c6 100644 --- a/test/hotspot/jtreg/compiler/runtime/cr8015436/Driver8015436.java +++ b/test/hotspot/jtreg/compiler/runtime/cr8015436/Driver8015436.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -30,7 +30,7 @@ public class Driver8015436 { public static void main(String args[]) { OutputAnalyzer oa; try { - oa = ProcessTools.executeProcess(ProcessTools.createTestJvm( + oa = ProcessTools.executeProcess(ProcessTools.createTestJavaProcessBuilder( Test8015436.class.getName())); } catch (Exception ex) { throw new Error("TESTBUG: exception while running child process: " + ex, ex); diff --git a/test/hotspot/jtreg/compiler/sharedstubs/SharedStubToInterpTest.java b/test/hotspot/jtreg/compiler/sharedstubs/SharedStubToInterpTest.java index 3e578225e53..5dd938442cc 100644 --- a/test/hotspot/jtreg/compiler/sharedstubs/SharedStubToInterpTest.java +++ b/test/hotspot/jtreg/compiler/sharedstubs/SharedStubToInterpTest.java @@ -67,7 +67,7 @@ public class SharedStubToInterpTest { command.add("-XX:CompileCommand=dontinline," + testClassName + "::" + "log02"); command.add(testClassName); - ProcessBuilder pb = ProcessTools.createTestJvm(command); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(command); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/compiler/sharedstubs/SharedTrampolineTest.java b/test/hotspot/jtreg/compiler/sharedstubs/SharedTrampolineTest.java index 1cfa210e3d8..f1e4d18b93a 100644 --- a/test/hotspot/jtreg/compiler/sharedstubs/SharedTrampolineTest.java +++ b/test/hotspot/jtreg/compiler/sharedstubs/SharedTrampolineTest.java @@ -60,7 +60,7 @@ public class SharedTrampolineTest { command.add(testClassName); command.add("a"); - ProcessBuilder pb = ProcessTools.createTestJvm(command); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(command); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/compiler/startup/NumCompilerThreadsCheck.java b/test/hotspot/jtreg/compiler/startup/NumCompilerThreadsCheck.java index 9761002c051..679f7ff8d0b 100644 --- a/test/hotspot/jtreg/compiler/startup/NumCompilerThreadsCheck.java +++ b/test/hotspot/jtreg/compiler/startup/NumCompilerThreadsCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import jdk.test.lib.process.ProcessTools; public class NumCompilerThreadsCheck { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:CICompilerCount=-1"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:CICompilerCount=-1"); OutputAnalyzer out = new OutputAnalyzer(pb.start()); String expectedOutput = "outside the allowed range"; diff --git a/test/hotspot/jtreg/compiler/startup/SmallCodeCacheStartup.java b/test/hotspot/jtreg/compiler/startup/SmallCodeCacheStartup.java index b32c4d48f8a..b3b92afa0d1 100644 --- a/test/hotspot/jtreg/compiler/startup/SmallCodeCacheStartup.java +++ b/test/hotspot/jtreg/compiler/startup/SmallCodeCacheStartup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,10 +44,10 @@ import static jdk.test.lib.Asserts.assertTrue; public class SmallCodeCacheStartup { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m", - "-XX:CICompilerCount=64", - "-Xcomp", - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m", + "-XX:CICompilerCount=64", + "-Xcomp", + "-version"); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); try { analyzer.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/compiler/startup/StartupOutput.java b/test/hotspot/jtreg/compiler/startup/StartupOutput.java index 0f9ab3b1f96..d97bcd0019a 100644 --- a/test/hotspot/jtreg/compiler/startup/StartupOutput.java +++ b/test/hotspot/jtreg/compiler/startup/StartupOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,12 +43,12 @@ public class StartupOutput { ProcessBuilder pb; OutputAnalyzer out; - pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version"); out = new OutputAnalyzer(pb.start()); out.shouldNotContain("no space to run compilers"); out.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:ReservedCodeCacheSize=1770K", "-XX:InitialCodeCacheSize=4K", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:ReservedCodeCacheSize=1770K", "-XX:InitialCodeCacheSize=4K", "-version"); out = new OutputAnalyzer(pb.start()); // The VM should not crash but may return an error message because we don't have enough space for adapters int exitCode = out.getExitValue(); diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java index 40369000036..b6535e65428 100644 --- a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java +++ b/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -63,7 +63,7 @@ public class RTMTestBase { public static OutputAnalyzer executeRTMTest(CompilableTest test, String... options) throws Exception { ProcessBuilder processBuilder - = ProcessTools.createJavaProcessBuilder( + = ProcessTools.createLimitedTestJavaProcessBuilder( RTMTestBase.prepareTestOptions(test, options)); OutputAnalyzer outputAnalyzer = new OutputAnalyzer(processBuilder.start()); @@ -83,7 +83,7 @@ public class RTMTestBase { public static OutputAnalyzer executeRTMTest(String logFileName, CompilableTest test, String... options) throws Exception { ProcessBuilder processBuilder - = ProcessTools.createJavaProcessBuilder( + = ProcessTools.createLimitedTestJavaProcessBuilder( RTMTestBase.prepareTestOptions(logFileName, test, options)); OutputAnalyzer outputAnalyzer = new OutputAnalyzer(processBuilder.start()); diff --git a/test/hotspot/jtreg/compiler/types/correctness/OffTest.java b/test/hotspot/jtreg/compiler/types/correctness/OffTest.java index 73574447eaf..6f2354cf895 100644 --- a/test/hotspot/jtreg/compiler/types/correctness/OffTest.java +++ b/test/hotspot/jtreg/compiler/types/correctness/OffTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -86,7 +86,7 @@ public class OffTest { OPTIONS[TYPE_PROFILE_INDEX] = typeProfileLevel; OPTIONS[USE_TYPE_SPECULATION_INDEX] = useTypeSpeculation; OPTIONS[PROFILING_TYPE_INDEX] = type.name(); - ProcessBuilder processBuilder = ProcessTools.createTestJvm(OPTIONS); + ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder(OPTIONS); OutputAnalyzer outputAnalyzer = new OutputAnalyzer(processBuilder.start()); outputAnalyzer.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/compiler/vectorization/TestBufferVectorization.java b/test/hotspot/jtreg/compiler/vectorization/TestBufferVectorization.java index bb2bb994bc9..95970256c48 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestBufferVectorization.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestBufferVectorization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -224,11 +224,11 @@ public class TestBufferVectorization { ProcessBuilder pb; OutputAnalyzer out; try { - pb = ProcessTools.createJavaProcessBuilder("-XX:-BackgroundCompilation", - "-XX:+TraceNewVectors", - "compiler.vectorization.TestBufferVectorization", - testName, - "run"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:-BackgroundCompilation", + "-XX:+TraceNewVectors", + "compiler.vectorization.TestBufferVectorization", + testName, + "run"); out = new OutputAnalyzer(pb.start()); } catch (Exception e) { throw new RuntimeException(" Exception launching Java process: " + e); diff --git a/test/hotspot/jtreg/containers/cgroup/PlainRead.java b/test/hotspot/jtreg/containers/cgroup/PlainRead.java index 5e092e663c0..21eccd79835 100644 --- a/test/hotspot/jtreg/containers/cgroup/PlainRead.java +++ b/test/hotspot/jtreg/containers/cgroup/PlainRead.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -67,7 +67,7 @@ public class PlainRead { public static void main(String[] args) throws Exception { WhiteBox wb = WhiteBox.getWhiteBox(); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+container=trace", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os+container=trace", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); if (wb.isContainerized()) { diff --git a/test/hotspot/jtreg/gc/TestAgeOutput.java b/test/hotspot/jtreg/gc/TestAgeOutput.java index a9262431611..fa4445e34bb 100644 --- a/test/hotspot/jtreg/gc/TestAgeOutput.java +++ b/test/hotspot/jtreg/gc/TestAgeOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -66,7 +66,7 @@ public class TestAgeOutput { } public static void runTest(String gcArg) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockExperimentalVMOptions", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/gc/TestAllocateHeapAt.java b/test/hotspot/jtreg/gc/TestAllocateHeapAt.java index 0c80e14635d..8daf0bbcdc7 100644 --- a/test/hotspot/jtreg/gc/TestAllocateHeapAt.java +++ b/test/hotspot/jtreg/gc/TestAllocateHeapAt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -36,7 +36,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestAllocateHeapAt { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:AllocateHeapAt=" + System.getProperty("test.dir", "."), "-Xlog:gc+heap=info", "-Xmx32m", diff --git a/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java b/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java index 748ddd2f1f9..372437b8898 100644 --- a/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java +++ b/test/hotspot/jtreg/gc/TestAllocateHeapAtError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -45,7 +45,7 @@ public class TestAllocateHeapAtError { f = new File(test_dir, UUID.randomUUID().toString()); } while(f.exists()); - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:AllocateHeapAt=" + f.getName(), "-Xlog:gc+heap=info", "-Xmx32m", diff --git a/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java b/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java index ddb2d9568e2..b2d2f1e429d 100644 --- a/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java +++ b/test/hotspot/jtreg/gc/TestAllocateHeapAtMultiple.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -60,7 +60,7 @@ public class TestAllocateHeapAtMultiple { "-Xlog:gc+heap=info", "-version"}); - ProcessBuilder pb = ProcessTools.createTestJvm(flags); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(flags); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("Output:\n" + output.getOutput()); diff --git a/test/hotspot/jtreg/gc/TestCardTablePageCommits.java b/test/hotspot/jtreg/gc/TestCardTablePageCommits.java index ca14cfd71be..c468a771076 100644 --- a/test/hotspot/jtreg/gc/TestCardTablePageCommits.java +++ b/test/hotspot/jtreg/gc/TestCardTablePageCommits.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class TestCardTablePageCommits { // because of 8kB pages, assume 4 KB pages for all other CPUs. String Xmx = "-Xmx4m"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( Xmx, "-XX:NativeMemoryTracking=detail", "-XX:+UseParallelGC", diff --git a/test/hotspot/jtreg/gc/TestNumWorkerOutput.java b/test/hotspot/jtreg/gc/TestNumWorkerOutput.java index 9de36ef9968..fd48c5a85d0 100644 --- a/test/hotspot/jtreg/gc/TestNumWorkerOutput.java +++ b/test/hotspot/jtreg/gc/TestNumWorkerOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -58,7 +58,7 @@ public class TestNumWorkerOutput { } public static void runTest(String gcArg) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockExperimentalVMOptions", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java b/test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java index 81d8529f6e9..c5c4854946d 100644 --- a/test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java +++ b/test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -48,7 +48,7 @@ public class TestPLABAdaptToMinTLABSize { Collections.addAll(testArguments, extraArgs); testArguments.add("-version"); - ProcessBuilder pb = ProcessTools.createTestJvm(testArguments); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(testArguments); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/gc/TestSmallHeap.java b/test/hotspot/jtreg/gc/TestSmallHeap.java index f4d44862ed6..a9b32eb81c8 100644 --- a/test/hotspot/jtreg/gc/TestSmallHeap.java +++ b/test/hotspot/jtreg/gc/TestSmallHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,7 +96,7 @@ public class TestSmallHeap { private static void verifySmallHeapSize(String gc, long expectedMaxHeap) throws Exception { long minMaxHeap = 4 * 1024 * 1024; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( gc, "-Xmx" + minMaxHeap, "-XX:+PrintFlagsFinal", diff --git a/test/hotspot/jtreg/gc/TestVerifyDuringStartup.java b/test/hotspot/jtreg/gc/TestVerifyDuringStartup.java index e2134798722..4ad9f9675d9 100644 --- a/test/hotspot/jtreg/gc/TestVerifyDuringStartup.java +++ b/test/hotspot/jtreg/gc/TestVerifyDuringStartup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestVerifyDuringStartup { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:-UseTLAB", "-XX:+UnlockDiagnosticVMOptions", "-XX:+VerifyDuringStartup", diff --git a/test/hotspot/jtreg/gc/TestVerifySilently.java b/test/hotspot/jtreg/gc/TestVerifySilently.java index c4dd4dd779b..b7b07a1eb8e 100644 --- a/test/hotspot/jtreg/gc/TestVerifySilently.java +++ b/test/hotspot/jtreg/gc/TestVerifySilently.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -57,7 +57,7 @@ public class TestVerifySilently { "-XX:+VerifyAfterGC", (verifySilently ? "-Xlog:gc":"-Xlog:gc+verify=debug"), TestVerifySilentlyRunSystemGC.class.getName()}); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(vmOpts); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("Output:\n" + output.getOutput()); diff --git a/test/hotspot/jtreg/gc/TestVerifySubSet.java b/test/hotspot/jtreg/gc/TestVerifySubSet.java index b326dd7fe7f..5aa8cc3eb13 100644 --- a/test/hotspot/jtreg/gc/TestVerifySubSet.java +++ b/test/hotspot/jtreg/gc/TestVerifySubSet.java @@ -59,7 +59,7 @@ public class TestVerifySubSet { "-Xlog:gc+verify=debug", "-XX:VerifySubSet="+subset, TestVerifySubSetRunSystemGC.class.getName()}); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(vmOpts); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("Output:\n" + output.getOutput()); diff --git a/test/hotspot/jtreg/gc/arguments/GCArguments.java b/test/hotspot/jtreg/gc/arguments/GCArguments.java index b2610da0c4e..c59a14954bf 100644 --- a/test/hotspot/jtreg/gc/arguments/GCArguments.java +++ b/test/hotspot/jtreg/gc/arguments/GCArguments.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -66,19 +66,19 @@ public final class GCArguments { return augmented.toArray(new String[augmented.size()]); } - static public ProcessBuilder createJavaProcessBuilder(List arguments) { - return createJavaProcessBuilder(arguments.toArray(String[]::new)); + static public ProcessBuilder createLimitedTestJavaProcessBuilder(List arguments) { + return createLimitedTestJavaProcessBuilder(arguments.toArray(String[]::new)); } - static public ProcessBuilder createJavaProcessBuilder(String... arguments) { - return ProcessTools.createJavaProcessBuilder(withDefaults(arguments)); + static public ProcessBuilder createLimitedTestJavaProcessBuilder(String... arguments) { + return ProcessTools.createLimitedTestJavaProcessBuilder(withDefaults(arguments)); } - static public ProcessBuilder createTestJvm(List arguments) { - return createTestJvm(arguments.toArray(String[]::new)); + static public ProcessBuilder createTestJavaProcessBuilder(List arguments) { + return createTestJavaProcessBuilder(arguments.toArray(String[]::new)); } - static public ProcessBuilder createTestJvm(String... arguments) { - return ProcessTools.createTestJvm(withDefaults(arguments)); + static public ProcessBuilder createTestJavaProcessBuilder(String... arguments) { + return ProcessTools.createTestJavaProcessBuilder(withDefaults(arguments)); } } diff --git a/test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java b/test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java index 4070c36f8d7..d01773fd711 100644 --- a/test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java +++ b/test/hotspot/jtreg/gc/arguments/TestAggressiveHeap.java @@ -65,7 +65,7 @@ public class TestAggressiveHeap { " *bool +UseParallelGC *= *true +\\{product\\} *\\{command line\\}"; private static void testFlag() throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm( + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder( option, heapSizeOption, "-XX:+PrintFlagsFinal", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/gc/arguments/TestCompressedClassFlags.java b/test/hotspot/jtreg/gc/arguments/TestCompressedClassFlags.java index f33554c46e6..0b6dce0fc0e 100644 --- a/test/hotspot/jtreg/gc/arguments/TestCompressedClassFlags.java +++ b/test/hotspot/jtreg/gc/arguments/TestCompressedClassFlags.java @@ -51,7 +51,7 @@ public class TestCompressedClassFlags { } private static OutputAnalyzer runJava(String ... args) throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm(args); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(args); return new OutputAnalyzer(pb.start()); } } diff --git a/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java b/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java index c282a784203..e8e4552da01 100644 --- a/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java +++ b/test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java @@ -40,13 +40,13 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestDisableDefaultGC { public static void main(String[] args) throws Exception { // Start VM, disabling all possible default GCs - ProcessBuilder pb = GCArguments.createTestJvm("-XX:-UseSerialGC", - "-XX:-UseParallelGC", - "-XX:-UseG1GC", - "-XX:-UseZGC", - "-XX:+UnlockExperimentalVMOptions", - "-XX:-UseShenandoahGC", - "-version"); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder("-XX:-UseSerialGC", + "-XX:-UseParallelGC", + "-XX:-UseG1GC", + "-XX:-UseZGC", + "-XX:+UnlockExperimentalVMOptions", + "-XX:-UseShenandoahGC", + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldMatch("Garbage collector not selected"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/gc/arguments/TestG1ConcMarkStepDurationMillis.java b/test/hotspot/jtreg/gc/arguments/TestG1ConcMarkStepDurationMillis.java index 53afba28a1a..21a4eddb410 100644 --- a/test/hotspot/jtreg/gc/arguments/TestG1ConcMarkStepDurationMillis.java +++ b/test/hotspot/jtreg/gc/arguments/TestG1ConcMarkStepDurationMillis.java @@ -78,7 +78,7 @@ public class TestG1ConcMarkStepDurationMillis { Collections.addAll(vmOpts, "-XX:+UseG1GC", "-XX:G1ConcMarkStepDurationMillis="+expectedValue, "-XX:+PrintFlagsFinal", "-version"); - ProcessBuilder pb = GCArguments.createTestJvm(vmOpts); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(vmOpts); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(expectedResult == PASS ? 0 : 1); diff --git a/test/hotspot/jtreg/gc/arguments/TestG1ConcRefinementThreads.java b/test/hotspot/jtreg/gc/arguments/TestG1ConcRefinementThreads.java index 8a2ec1ab5f6..91be97782f5 100644 --- a/test/hotspot/jtreg/gc/arguments/TestG1ConcRefinementThreads.java +++ b/test/hotspot/jtreg/gc/arguments/TestG1ConcRefinementThreads.java @@ -69,7 +69,7 @@ public class TestG1ConcRefinementThreads { } Collections.addAll(vmOpts, "-XX:+UseG1GC", "-XX:+PrintFlagsFinal", "-version"); - ProcessBuilder pb = GCArguments.createTestJvm(vmOpts); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(vmOpts); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/arguments/TestG1HeapRegionSize.java b/test/hotspot/jtreg/gc/arguments/TestG1HeapRegionSize.java index ededd10f0c3..0d63dec0c26 100644 --- a/test/hotspot/jtreg/gc/arguments/TestG1HeapRegionSize.java +++ b/test/hotspot/jtreg/gc/arguments/TestG1HeapRegionSize.java @@ -53,7 +53,7 @@ public class TestG1HeapRegionSize { flagList.add("-XX:+PrintFlagsFinal"); flagList.add("-version"); - ProcessBuilder pb = GCArguments.createTestJvm(flagList); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(flagList); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(exitValue); diff --git a/test/hotspot/jtreg/gc/arguments/TestG1PercentageOptions.java b/test/hotspot/jtreg/gc/arguments/TestG1PercentageOptions.java index abf7926f966..875e995374a 100644 --- a/test/hotspot/jtreg/gc/arguments/TestG1PercentageOptions.java +++ b/test/hotspot/jtreg/gc/arguments/TestG1PercentageOptions.java @@ -63,7 +63,7 @@ public class TestG1PercentageOptions { }; private static void check(String flag, boolean is_valid) throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm("-XX:+UseG1GC", flag, "-version"); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder("-XX:+UseG1GC", flag, "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); if (is_valid) { output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/arguments/TestG1RemSetFlags.java b/test/hotspot/jtreg/gc/arguments/TestG1RemSetFlags.java index be18156df41..84483f39272 100644 --- a/test/hotspot/jtreg/gc/arguments/TestG1RemSetFlags.java +++ b/test/hotspot/jtreg/gc/arguments/TestG1RemSetFlags.java @@ -48,7 +48,7 @@ public class TestG1RemSetFlags { flagList.add("-XX:+PrintFlagsFinal"); flagList.add("-version"); - ProcessBuilder pb = GCArguments.createTestJvm(flagList); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(flagList); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(exitValue); } diff --git a/test/hotspot/jtreg/gc/arguments/TestHeapFreeRatio.java b/test/hotspot/jtreg/gc/arguments/TestHeapFreeRatio.java index 24528c923ed..19ecb181418 100644 --- a/test/hotspot/jtreg/gc/arguments/TestHeapFreeRatio.java +++ b/test/hotspot/jtreg/gc/arguments/TestHeapFreeRatio.java @@ -48,7 +48,7 @@ public class TestHeapFreeRatio { } private static void testMinMaxFreeRatio(String min, String max, Validation type) throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm( + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder( "-Xminf" + min, "-Xmaxf" + max, "-version"); diff --git a/test/hotspot/jtreg/gc/arguments/TestInitialTenuringThreshold.java b/test/hotspot/jtreg/gc/arguments/TestInitialTenuringThreshold.java index 5006dec7128..7bf78a001bf 100644 --- a/test/hotspot/jtreg/gc/arguments/TestInitialTenuringThreshold.java +++ b/test/hotspot/jtreg/gc/arguments/TestInitialTenuringThreshold.java @@ -41,7 +41,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestInitialTenuringThreshold { public static void runWithThresholds(int initial, int max, boolean shouldfail) throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm( + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder( "-XX:+UseParallelGC", "-XX:InitialTenuringThreshold=" + String.valueOf(initial), "-XX:MaxTenuringThreshold=" + String.valueOf(max), @@ -58,7 +58,7 @@ public class TestInitialTenuringThreshold { public static void main(String args[]) throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm( + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder( // some value below the default value of InitialTenuringThreshold of 7 "-XX:+UseParallelGC", "-XX:MaxTenuringThreshold=1", diff --git a/test/hotspot/jtreg/gc/arguments/TestMaxHeapSizeTools.java b/test/hotspot/jtreg/gc/arguments/TestMaxHeapSizeTools.java index 2480f882f00..3a5d472f9f8 100644 --- a/test/hotspot/jtreg/gc/arguments/TestMaxHeapSizeTools.java +++ b/test/hotspot/jtreg/gc/arguments/TestMaxHeapSizeTools.java @@ -115,7 +115,7 @@ class TestMaxHeapSizeTools { } private static void getNewOldSize(String gcflag, long[] values) throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm(gcflag, + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(gcflag, "-XX:+PrintFlagsFinal", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); @@ -208,7 +208,7 @@ class TestMaxHeapSizeTools { finalargs.add(classname); finalargs.addAll(Arrays.asList(arguments)); - ProcessBuilder pb = GCArguments.createTestJvm(finalargs.toArray(String[]::new)); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(finalargs.toArray(String[]::new)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); @@ -308,7 +308,7 @@ class TestMaxHeapSizeTools { } private static void expect(String[] flags, boolean hasWarning, boolean hasError, int errorcode) throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm(flags); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(flags); OutputAnalyzer output = new OutputAnalyzer(pb.start()); shouldContainOrNot(output, hasWarning, "Warning"); shouldContainOrNot(output, hasError, "Error"); diff --git a/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java b/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java index 3cf0034f1a7..7e91fe60cfb 100644 --- a/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java +++ b/test/hotspot/jtreg/gc/arguments/TestMaxMinHeapFreeRatioFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -98,7 +98,7 @@ public class TestMaxMinHeapFreeRatioFlags { Boolean.toString(shrinkHeapInSteps) ); - ProcessBuilder procBuilder = GCArguments.createJavaProcessBuilder(vmOptions); + ProcessBuilder procBuilder = GCArguments.createLimitedTestJavaProcessBuilder(vmOptions); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); analyzer.shouldHaveExitValue(0); } @@ -123,7 +123,7 @@ public class TestMaxMinHeapFreeRatioFlags { "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-version" ); - ProcessBuilder procBuilder = GCArguments.createJavaProcessBuilder(vmOptions); + ProcessBuilder procBuilder = GCArguments.createLimitedTestJavaProcessBuilder(vmOptions); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); analyzer.shouldHaveExitValue(1); analyzer.shouldContain("Error: Could not create the Java Virtual Machine."); diff --git a/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java b/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java index 6abcc9f84fe..f2214b8b0cf 100644 --- a/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java +++ b/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java @@ -95,7 +95,7 @@ public class TestMaxNewSize { finalargs.add("-XX:+PrintFlagsFinal"); finalargs.add("-version"); - ProcessBuilder pb = GCArguments.createTestJvm(finalargs); + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder(finalargs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); String stdout = output.getStdout(); diff --git a/test/hotspot/jtreg/gc/arguments/TestMaxRAMFlags.java b/test/hotspot/jtreg/gc/arguments/TestMaxRAMFlags.java index c2802d18a8a..4c66afd5cf5 100644 --- a/test/hotspot/jtreg/gc/arguments/TestMaxRAMFlags.java +++ b/test/hotspot/jtreg/gc/arguments/TestMaxRAMFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -61,7 +61,7 @@ public class TestMaxRAMFlags { args.add("-XX:+PrintFlagsFinal"); args.add("-version"); - ProcessBuilder pb = GCArguments.createJavaProcessBuilder(args); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); String stdout = output.getStdout(); @@ -84,7 +84,7 @@ public class TestMaxRAMFlags { args.add("-XX:+PrintFlagsFinal"); args.add("-version"); - ProcessBuilder pb = GCArguments.createJavaProcessBuilder(args); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); String stdout = output.getStdout(); diff --git a/test/hotspot/jtreg/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java b/test/hotspot/jtreg/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java index 4e18a4c60b6..83f564b98a5 100644 --- a/test/hotspot/jtreg/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java +++ b/test/hotspot/jtreg/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -102,7 +102,7 @@ public class TestMinAndInitialSurvivorRatioFlags { Boolean.toString(useAdaptiveSizePolicy) ); vmOptions.removeIf((String p) -> p.isEmpty()); - ProcessBuilder procBuilder = GCArguments.createJavaProcessBuilder(vmOptions); + ProcessBuilder procBuilder = GCArguments.createLimitedTestJavaProcessBuilder(vmOptions); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); analyzer.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java b/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java index 49ce08e5b0e..9076005fa86 100644 --- a/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java +++ b/test/hotspot/jtreg/gc/arguments/TestNewRatioFlag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -82,7 +82,7 @@ public class TestNewRatioFlag { Integer.toString(ratio) ); - ProcessBuilder procBuilder = GCArguments.createJavaProcessBuilder(vmOptions); + ProcessBuilder procBuilder = GCArguments.createLimitedTestJavaProcessBuilder(vmOptions); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); analyzer.shouldHaveExitValue(0); System.out.println(analyzer.getOutput()); diff --git a/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java b/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java index 70a124e6f14..3c3aff980dd 100644 --- a/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java +++ b/test/hotspot/jtreg/gc/arguments/TestNewSizeFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -166,7 +166,7 @@ public class TestNewSizeFlags { Long.toString(maxHeapSize) ); vmOptions.removeIf(String::isEmpty); - ProcessBuilder procBuilder = GCArguments.createJavaProcessBuilder(vmOptions); + ProcessBuilder procBuilder = GCArguments.createLimitedTestJavaProcessBuilder(vmOptions); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); return analyzer; } diff --git a/test/hotspot/jtreg/gc/arguments/TestNewSizeThreadIncrease.java b/test/hotspot/jtreg/gc/arguments/TestNewSizeThreadIncrease.java index be69ff2c79b..82e98429100 100644 --- a/test/hotspot/jtreg/gc/arguments/TestNewSizeThreadIncrease.java +++ b/test/hotspot/jtreg/gc/arguments/TestNewSizeThreadIncrease.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -65,13 +65,13 @@ public class TestNewSizeThreadIncrease { } static void runNewSizeThreadIncreaseTest(String expectedValue, boolean isNewsizeChanged) throws Exception { - ProcessBuilder pb = GCArguments.createJavaProcessBuilder("-XX:+UseSerialGC", - "-Xms96M", - "-Xmx128M", - "-XX:NewRatio=2", - "-Xlog:gc+heap+ergo=debug", - "-XX:NewSizeThreadIncrease="+expectedValue, - GCTest.class.getName()); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder("-XX:+UseSerialGC", + "-Xms96M", + "-Xmx128M", + "-XX:NewRatio=2", + "-Xlog:gc+heap+ergo=debug", + "-XX:NewSizeThreadIncrease="+expectedValue, + GCTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/arguments/TestObjectTenuringFlags.java b/test/hotspot/jtreg/gc/arguments/TestObjectTenuringFlags.java index 0a2c8c146da..ca45def0b2b 100644 --- a/test/hotspot/jtreg/gc/arguments/TestObjectTenuringFlags.java +++ b/test/hotspot/jtreg/gc/arguments/TestObjectTenuringFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -161,7 +161,7 @@ public class TestObjectTenuringFlags { } Collections.addAll(vmOpts, "-XX:+UseParallelGC", "-XX:+PrintFlagsFinal", "-version"); - ProcessBuilder pb = GCArguments.createJavaProcessBuilder(vmOpts); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder(vmOpts); OutputAnalyzer output = new OutputAnalyzer(pb.start()); if (shouldFail) { diff --git a/test/hotspot/jtreg/gc/arguments/TestParallelGCThreads.java b/test/hotspot/jtreg/gc/arguments/TestParallelGCThreads.java index 6e447f455cf..1055f4fee13 100644 --- a/test/hotspot/jtreg/gc/arguments/TestParallelGCThreads.java +++ b/test/hotspot/jtreg/gc/arguments/TestParallelGCThreads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -56,7 +56,7 @@ public class TestParallelGCThreads { private static final String printFlagsFinalPattern = " *uint *" + flagName + " *:?= *(\\d+) *\\{product\\} *"; public static void testDefaultValue() throws Exception { - ProcessBuilder pb = GCArguments.createJavaProcessBuilder( + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", "-XX:+PrintFlagsFinal", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -94,7 +94,7 @@ public class TestParallelGCThreads { for (String gc : supportedGC) { // Make sure the VM does not allow ParallelGCThreads set to 0 - ProcessBuilder pb = GCArguments.createJavaProcessBuilder( + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder( "-XX:+Use" + gc + "GC", "-XX:ParallelGCThreads=0", "-XX:+PrintFlagsFinal", @@ -124,7 +124,7 @@ public class TestParallelGCThreads { } public static long getParallelGCThreadCount(String... flags) throws Exception { - ProcessBuilder pb = GCArguments.createJavaProcessBuilder(flags); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder(flags); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); String stdout = output.getStdout(); diff --git a/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java b/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java index b936e87c370..d47d277e30b 100644 --- a/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java +++ b/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -77,7 +77,7 @@ public class TestParallelRefProc { result.addAll(Arrays.asList(args)); result.add("-XX:+PrintFlagsFinal"); result.add("-version"); - ProcessBuilder pb = GCArguments.createJavaProcessBuilder(result); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder(result); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java b/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java index dfa3bbfb364..a48f21c957b 100644 --- a/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java +++ b/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ public class TestSelectDefaultGC { public static void testDefaultGC(boolean actAsServer) throws Exception { // Start VM without specifying GC - ProcessBuilder pb = GCArguments.createJavaProcessBuilder( + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder( "-XX:" + (actAsServer ? "+" : "-") + "AlwaysActAsServerClassMachine", "-XX:" + (actAsServer ? "-" : "+") + "NeverActAsServerClassMachine", "-XX:+PrintFlagsFinal", diff --git a/test/hotspot/jtreg/gc/arguments/TestSmallInitialHeapWithLargePageAndNUMA.java b/test/hotspot/jtreg/gc/arguments/TestSmallInitialHeapWithLargePageAndNUMA.java index 2cf0763fe20..779a5d8b537 100644 --- a/test/hotspot/jtreg/gc/arguments/TestSmallInitialHeapWithLargePageAndNUMA.java +++ b/test/hotspot/jtreg/gc/arguments/TestSmallInitialHeapWithLargePageAndNUMA.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -60,7 +60,7 @@ public class TestSmallInitialHeapWithLargePageAndNUMA { long initHeap = heapAlignment; long maxHeap = heapAlignment * 2; - ProcessBuilder pb_enabled = GCArguments.createJavaProcessBuilder( + ProcessBuilder pb_enabled = GCArguments.createLimitedTestJavaProcessBuilder( "-XX:+UseParallelGC", "-Xms" + String.valueOf(initHeap), "-Xmx" + String.valueOf(maxHeap), diff --git a/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java b/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java index 1a2246b1581..8567615220a 100644 --- a/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java +++ b/test/hotspot/jtreg/gc/arguments/TestSurvivorRatioFlag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -87,7 +87,7 @@ public class TestSurvivorRatioFlag { Integer.toString(ratio) ); - ProcessBuilder procBuilder = GCArguments.createJavaProcessBuilder(vmOptions); + ProcessBuilder procBuilder = GCArguments.createLimitedTestJavaProcessBuilder(vmOptions); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); analyzer.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java b/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java index f530bf35996..8f8b4aa1087 100644 --- a/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java +++ b/test/hotspot/jtreg/gc/arguments/TestTargetSurvivorRatioFlag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -116,7 +116,7 @@ public class TestTargetSurvivorRatioFlag { vmOptions.add("-XX:TargetSurvivorRatio=" + ratio); vmOptions.add("-version"); - ProcessBuilder procBuilder = GCArguments.createJavaProcessBuilder(vmOptions); + ProcessBuilder procBuilder = GCArguments.createLimitedTestJavaProcessBuilder(vmOptions); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); analyzer.shouldHaveExitValue(1); @@ -151,7 +151,7 @@ public class TestTargetSurvivorRatioFlag { Integer.toString(ratio) ); - ProcessBuilder procBuilder = GCArguments.createJavaProcessBuilder(vmOptions); + ProcessBuilder procBuilder = GCArguments.createLimitedTestJavaProcessBuilder(vmOptions); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); analyzer.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/arguments/TestUnrecognizedVMOptionsHandling.java b/test/hotspot/jtreg/gc/arguments/TestUnrecognizedVMOptionsHandling.java index 8d1ee6ebb6e..24da380298b 100644 --- a/test/hotspot/jtreg/gc/arguments/TestUnrecognizedVMOptionsHandling.java +++ b/test/hotspot/jtreg/gc/arguments/TestUnrecognizedVMOptionsHandling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ public class TestUnrecognizedVMOptionsHandling { public static void main(String args[]) throws Exception { // The first two JAVA processes are expected to fail, but with a correct VM option suggestion - ProcessBuilder pb = GCArguments.createJavaProcessBuilder( + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder( "-XX:+UseDynamicNumberOfGcThreads", "-version" ); @@ -50,7 +50,7 @@ public class TestUnrecognizedVMOptionsHandling { throw new RuntimeException("Not expected to get exit value 0"); } - pb = GCArguments.createJavaProcessBuilder( + pb = GCArguments.createLimitedTestJavaProcessBuilder( "-XX:MaxiumHeapSize=500m", "-version" ); @@ -61,7 +61,7 @@ public class TestUnrecognizedVMOptionsHandling { } // The last JAVA process should run successfully for the purpose of sanity check - pb = GCArguments.createJavaProcessBuilder( + pb = GCArguments.createLimitedTestJavaProcessBuilder( "-XX:+UseDynamicNumberOfGCThreads", "-version" ); diff --git a/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgoTools.java b/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgoTools.java index 8979b92eaf6..19ebdea3c0e 100644 --- a/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgoTools.java +++ b/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgoTools.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -93,7 +93,7 @@ class TestUseCompressedOopsErgoTools { finalargs.add(classname); finalargs.addAll(Arrays.asList(arguments)); - ProcessBuilder pb = GCArguments.createJavaProcessBuilder(finalargs); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder(finalargs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); return output; @@ -157,7 +157,7 @@ class TestUseCompressedOopsErgoTools { } private static String expect(String[] flags, boolean hasWarning, boolean hasError, int errorcode) throws Exception { - ProcessBuilder pb = GCArguments.createJavaProcessBuilder(flags); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder(flags); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(errorcode); return output.getStdout(); diff --git a/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java b/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java index ada10a210f1..07cf4126970 100644 --- a/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java +++ b/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -59,7 +59,7 @@ public class TestUseCompressedOopsFlagsWithUlimit { // Convert bytes to kbytes for ulimit -v var ulimit_prefix = "ulimit -v " + (ulimit / 1024); - String cmd = ProcessTools.getCommandLine(ProcessTools.createTestJvm(args.toArray(String[]::new))); + String cmd = ProcessTools.getCommandLine(ProcessTools.createTestJavaProcessBuilder(args.toArray(String[]::new))); ProcessBuilder pb = new ProcessBuilder("sh", "-c", ulimit_prefix + ";" + cmd); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/arguments/TestUseNUMAInterleaving.java b/test/hotspot/jtreg/gc/arguments/TestUseNUMAInterleaving.java index 7f3857594b6..4a7fb7108c3 100644 --- a/test/hotspot/jtreg/gc/arguments/TestUseNUMAInterleaving.java +++ b/test/hotspot/jtreg/gc/arguments/TestUseNUMAInterleaving.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -39,7 +39,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestUseNUMAInterleaving { public static void main(String[] args) throws Exception { - ProcessBuilder pb = GCArguments.createTestJvm( + ProcessBuilder pb = GCArguments.createTestJavaProcessBuilder( "-XX:+UseNUMA", "-XX:+PrintFlagsFinal", "-version"); diff --git a/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java b/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java index 4b46d00c16d..a3d6d5a7440 100644 --- a/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java +++ b/test/hotspot/jtreg/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -99,7 +99,7 @@ public class TestVerifyBeforeAndAfterGCFlags { : "-XX:-VerifyAfterGC"), GarbageProducer.class.getName(), doFullGC ? "t" : "f" }); - ProcessBuilder pb = GCArguments.createJavaProcessBuilder(vmOpts); + ProcessBuilder pb = GCArguments.createLimitedTestJavaProcessBuilder(vmOpts); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); analyzer.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java b/test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java index b94ceebaad5..238e747fb1e 100644 --- a/test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java +++ b/test/hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -45,7 +45,7 @@ public class TestG1ClassUnloadingHWM { private static long YoungGenSize = 32 * 1024 * 1024; private static OutputAnalyzer run(boolean enableUnloading) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", diff --git a/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java b/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java index a883eb9f27c..c978f149fca 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java +++ b/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java @@ -37,14 +37,14 @@ import jdk.test.lib.process.ProcessTools; public class TestDieDefault { public static void passWith(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldNotContain("OutOfMemoryError"); out.shouldHaveExitValue(0); } public static void failWith(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldContain("OutOfMemoryError"); if (out.getExitValue() == 0) { diff --git a/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java b/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java index c717b493330..2e19141d286 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java +++ b/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java @@ -38,14 +38,14 @@ import jdk.test.lib.process.ProcessTools; public class TestDieWithHeapDump { public static void passWith(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldNotContain("OutOfMemoryError"); out.shouldHaveExitValue(0); } public static void failWith(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); Process p = pb.start(); OutputAnalyzer out = new OutputAnalyzer(p); out.shouldContain("OutOfMemoryError"); diff --git a/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java b/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java index 2cac3843b0e..a6593fecdff 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java +++ b/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java @@ -39,7 +39,7 @@ public class TestDieWithOnError { static String ON_ERR_MSG = "Epsilon error handler message"; public static void passWith(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldNotContain("OutOfMemoryError"); out.stdoutShouldNotMatch("^" + ON_ERR_MSG); @@ -47,7 +47,7 @@ public class TestDieWithOnError { } public static void failWith(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldContain("OutOfMemoryError"); if (out.getExitValue() == 0) { diff --git a/test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java b/test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java index 80f1828c0dd..3e7293a5a92 100644 --- a/test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java +++ b/test/hotspot/jtreg/gc/ergonomics/TestDynamicNumberOfGCThreads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -73,7 +73,7 @@ public class TestDynamicNumberOfGCThreads { String[] baseArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xmx10M", "-XX:+UseDynamicNumberOfGCThreads", "-Xlog:gc+task=trace", GCTest.class.getName()}; // Base test with gc and +UseDynamicNumberOfGCThreads: - ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder(baseArgs); + ProcessBuilder pb_enabled = ProcessTools.createLimitedTestJavaProcessBuilder(baseArgs); verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start())); // Turn on parallel reference processing @@ -81,7 +81,7 @@ public class TestDynamicNumberOfGCThreads { String[] parRefArgs = new String[baseArgs.length + parRefProcArg.length]; System.arraycopy(parRefProcArg, 0, parRefArgs, 0, parRefProcArg.length); System.arraycopy(baseArgs, 0, parRefArgs, parRefProcArg.length, baseArgs.length); - pb_enabled = ProcessTools.createJavaProcessBuilder(parRefArgs); + pb_enabled = ProcessTools.createLimitedTestJavaProcessBuilder(parRefArgs); verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start())); } diff --git a/test/hotspot/jtreg/gc/ergonomics/TestInitialGCThreadLogging.java b/test/hotspot/jtreg/gc/ergonomics/TestInitialGCThreadLogging.java index a20721a9e56..dc1b83cd2c1 100644 --- a/test/hotspot/jtreg/gc/ergonomics/TestInitialGCThreadLogging.java +++ b/test/hotspot/jtreg/gc/ergonomics/TestInitialGCThreadLogging.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -70,7 +70,7 @@ public class TestInitialGCThreadLogging { private static void testInitialGCThreadLogging(String gcFlag, String threadName) throws Exception { // Base test with gc and +UseDynamicNumberOfGCThreads: - ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb_enabled = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xmx10M", diff --git a/test/hotspot/jtreg/gc/g1/Test2GbHeap.java b/test/hotspot/jtreg/gc/g1/Test2GbHeap.java index 125ea34a901..8e06ac3ee2c 100644 --- a/test/hotspot/jtreg/gc/g1/Test2GbHeap.java +++ b/test/hotspot/jtreg/gc/g1/Test2GbHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -49,7 +49,7 @@ public class Test2GbHeap { testArguments.add("-Xmx2g"); testArguments.add("-version"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testArguments); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(testArguments); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegions.java b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegions.java index a459c1131ad..a334783eca6 100644 --- a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegions.java +++ b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -80,7 +80,7 @@ class TestEagerReclaimHumongousRegionsReclaimRegionFast { public class TestEagerReclaimHumongousRegions { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseG1GC", "-Xms128M", "-Xmx128M", diff --git a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java index 774929c4799..56de136fe59 100644 --- a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java +++ b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java @@ -119,7 +119,7 @@ class TestEagerReclaimHumongousRegionsClearMarkBitsReclaimRegionFast { public class TestEagerReclaimHumongousRegionsClearMarkBits { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseG1GC", "-Xms128M", "-Xmx128M", diff --git a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsLog.java b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsLog.java index b372d99b0ee..03af9c2b4bb 100644 --- a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsLog.java +++ b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -54,7 +54,7 @@ public class TestEagerReclaimHumongousRegionsLog { } public static void runTest() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockExperimentalVMOptions", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java index 9c6b011fff2..335567a9c36 100644 --- a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java +++ b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -92,7 +92,7 @@ class TestEagerReclaimHumongousRegionsWithRefsReclaimRegionFast { public class TestEagerReclaimHumongousRegionsWithRefs { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseG1GC", "-Xms128M", "-Xmx128M", diff --git a/test/hotspot/jtreg/gc/g1/TestEvacuationFailure.java b/test/hotspot/jtreg/gc/g1/TestEvacuationFailure.java index 31bf77672cc..bbd7fee0467 100644 --- a/test/hotspot/jtreg/gc/g1/TestEvacuationFailure.java +++ b/test/hotspot/jtreg/gc/g1/TestEvacuationFailure.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,15 +43,15 @@ import jdk.test.lib.process.ProcessTools; public class TestEvacuationFailure { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx32M", - "-Xmn16M", - "-XX:+G1EvacuationFailureALot", - "-XX:G1EvacuationFailureALotCount=100", - "-XX:G1EvacuationFailureALotInterval=1", - "-XX:+UnlockDiagnosticVMOptions", - "-Xlog:gc", - GCTestWithEvacuationFailure.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx32M", + "-Xmn16M", + "-XX:+G1EvacuationFailureALot", + "-XX:G1EvacuationFailureALotCount=100", + "-XX:G1EvacuationFailureALotInterval=1", + "-XX:+UnlockDiagnosticVMOptions", + "-Xlog:gc", + GCTestWithEvacuationFailure.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println(output.getStdout()); diff --git a/test/hotspot/jtreg/gc/g1/TestG1SkipCompaction.java b/test/hotspot/jtreg/gc/g1/TestG1SkipCompaction.java index 9b9e748e8a6..8455e03b18f 100644 --- a/test/hotspot/jtreg/gc/g1/TestG1SkipCompaction.java +++ b/test/hotspot/jtreg/gc/g1/TestG1SkipCompaction.java @@ -54,7 +54,7 @@ public class TestG1SkipCompaction { "-XX:G1HeapRegionSize=1m", GCTest.class.getName() }; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(arguments); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println(output.getStdout()); diff --git a/test/hotspot/jtreg/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java b/test/hotspot/jtreg/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java index 3eafc348a4b..4dedac0a61b 100644 --- a/test/hotspot/jtreg/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java +++ b/test/hotspot/jtreg/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -41,14 +41,14 @@ import java.util.LinkedList; public class TestG1TraceEagerReclaimHumongousObjects { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xms128M", - "-Xmx128M", - "-Xmn16M", - "-XX:G1HeapRegionSize=1M", - "-Xlog:gc+phases=trace,gc+humongous=trace", - "-XX:+UnlockExperimentalVMOptions", - GCWithHumongousObjectTest.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xms128M", + "-Xmx128M", + "-Xmn16M", + "-XX:G1HeapRegionSize=1M", + "-Xlog:gc+phases=trace,gc+humongous=trace", + "-XX:+UnlockExperimentalVMOptions", + GCWithHumongousObjectTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java index 1d5c164b907..6b249d69ab9 100644 --- a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java +++ b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -218,26 +218,26 @@ public class TestGCLogMessages { private void testNormalLogs() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - GCTest.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx10M", + GCTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); checkMessagesAtLevel(output, allLogMessages, Level.OFF); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - "-Xlog:gc+phases=debug", - GCTest.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx10M", + "-Xlog:gc+phases=debug", + GCTest.class.getName()); output = new OutputAnalyzer(pb.start()); checkMessagesAtLevel(output, allLogMessages, Level.DEBUG); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - "-Xlog:gc+phases=trace", - GCTest.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx10M", + "-Xlog:gc+phases=trace", + GCTest.class.getName()); output = new OutputAnalyzer(pb.start()); checkMessagesAtLevel(output, allLogMessages, Level.TRACE); @@ -253,10 +253,10 @@ public class TestGCLogMessages { }; private void testConcurrentRefinementLogs() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - "-Xlog:gc+refine+stats=debug", - GCTest.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx10M", + "-Xlog:gc+refine+stats=debug", + GCTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); checkMessagesAtLevel(output, concRefineMessages, Level.DEBUG); } @@ -271,27 +271,27 @@ public class TestGCLogMessages { }; private void testWithEvacuationFailureLogs() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx32M", - "-Xmn16M", - "-XX:+G1EvacuationFailureALot", - "-XX:G1EvacuationFailureALotCount=100", - "-XX:G1EvacuationFailureALotInterval=1", - "-XX:+UnlockDiagnosticVMOptions", - "-Xlog:gc+phases=debug", - GCTestWithEvacuationFailure.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx32M", + "-Xmn16M", + "-XX:+G1EvacuationFailureALot", + "-XX:G1EvacuationFailureALotCount=100", + "-XX:G1EvacuationFailureALotInterval=1", + "-XX:+UnlockDiagnosticVMOptions", + "-Xlog:gc+phases=debug", + GCTestWithEvacuationFailure.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); checkMessagesAtLevel(output, exhFailureMessages, Level.DEBUG); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx32M", - "-Xmn16M", - "-Xms32M", - "-XX:+UnlockDiagnosticVMOptions", - "-Xlog:gc+phases=trace", - GCTestWithEvacuationFailure.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx32M", + "-Xmn16M", + "-Xms32M", + "-XX:+UnlockDiagnosticVMOptions", + "-Xlog:gc+phases=trace", + GCTestWithEvacuationFailure.class.getName()); output = new OutputAnalyzer(pb.start()); checkMessagesAtLevel(output, exhFailureMessages, Level.TRACE); @@ -304,13 +304,13 @@ public class TestGCLogMessages { }; private void testWithConcurrentStart() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - "-Xbootclasspath/a:.", - "-Xlog:gc*=debug", - "-XX:+UnlockDiagnosticVMOptions", - "-XX:+WhiteBoxAPI", - GCTestWithConcurrentStart.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx10M", + "-Xbootclasspath/a:.", + "-Xlog:gc*=debug", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+WhiteBoxAPI", + GCTestWithConcurrentStart.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); checkMessagesAtLevel(output, concurrentStartMessages, Level.TRACE); @@ -318,13 +318,13 @@ public class TestGCLogMessages { } private void testExpandHeap() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - "-Xbootclasspath/a:.", - "-Xlog:gc+ergo+heap=debug", - "-XX:+UnlockDiagnosticVMOptions", - "-XX:+WhiteBoxAPI", - GCTest.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx10M", + "-Xbootclasspath/a:.", + "-Xlog:gc+ergo+heap=debug", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+WhiteBoxAPI", + GCTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Expand the heap. requested expansion amount: "); diff --git a/test/hotspot/jtreg/gc/g1/TestHumongousAllocConcurrentStart.java b/test/hotspot/jtreg/gc/g1/TestHumongousAllocConcurrentStart.java index f2276c3904e..b3a754f74c5 100644 --- a/test/hotspot/jtreg/gc/g1/TestHumongousAllocConcurrentStart.java +++ b/test/hotspot/jtreg/gc/g1/TestHumongousAllocConcurrentStart.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023, 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 @@ -45,7 +45,7 @@ public class TestHumongousAllocConcurrentStart { private static final int initiatingHeapOccupancyPercent = 50; // % public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseG1GC", "-Xms" + heapSize + "m", "-Xmx" + heapSize + "m", diff --git a/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java b/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java index d1803674120..fb33e9cc7c5 100644 --- a/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java +++ b/test/hotspot/jtreg/gc/g1/TestHumongousAllocNearlyFullRegion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023, 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 @@ -47,7 +47,7 @@ public class TestHumongousAllocNearlyFullRegion { private static final int heapRegionSize = 1; // MB public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseG1GC", "-Xms" + heapSize + "m", "-Xmx" + heapSize + "m", diff --git a/test/hotspot/jtreg/gc/g1/TestHumongousCodeCacheRoots.java b/test/hotspot/jtreg/gc/g1/TestHumongousCodeCacheRoots.java index 77f76b30b67..2e669f6dfe1 100644 --- a/test/hotspot/jtreg/gc/g1/TestHumongousCodeCacheRoots.java +++ b/test/hotspot/jtreg/gc/g1/TestHumongousCodeCacheRoots.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -106,7 +106,7 @@ public class TestHumongousCodeCacheRoots { finalargs.add(classname); finalargs.addAll(Arrays.asList(arguments)); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(finalargs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(finalargs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); return output; diff --git a/test/hotspot/jtreg/gc/g1/TestHumongousConcurrentStartUndo.java b/test/hotspot/jtreg/gc/g1/TestHumongousConcurrentStartUndo.java index 92bad43d798..d30d9240103 100644 --- a/test/hotspot/jtreg/gc/g1/TestHumongousConcurrentStartUndo.java +++ b/test/hotspot/jtreg/gc/g1/TestHumongousConcurrentStartUndo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -56,7 +56,7 @@ public class TestHumongousConcurrentStartUndo { private static final int YoungSize = HeapSize / 8; public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UseG1GC", "-Xms" + HeapSize + "m", diff --git a/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java b/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java index 0afd362c65a..777391845a4 100644 --- a/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java +++ b/test/hotspot/jtreg/gc/g1/TestLargePageUseForAuxMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -123,7 +123,7 @@ public class TestLargePageUseForAuxMemory { ProcessBuilder pb; // Test with large page enabled. - pb = ProcessTools.createJavaProcessBuilder(getOpts(heapsize, true)); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(getOpts(heapsize, true)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -138,7 +138,7 @@ public class TestLargePageUseForAuxMemory { output.shouldHaveExitValue(0); // Test with large page disabled. - pb = ProcessTools.createJavaProcessBuilder(getOpts(heapsize, false)); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(getOpts(heapsize, false)); output = new OutputAnalyzer(pb.start()); checkSmallTables(output, smallPageSize); diff --git a/test/hotspot/jtreg/gc/g1/TestLargePageUseForHeap.java b/test/hotspot/jtreg/gc/g1/TestLargePageUseForHeap.java index cfd59eadd3a..72afde512bc 100644 --- a/test/hotspot/jtreg/gc/g1/TestLargePageUseForHeap.java +++ b/test/hotspot/jtreg/gc/g1/TestLargePageUseForHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -87,12 +87,12 @@ public class TestLargePageUseForHeap { static void testVM(long regionSize) throws Exception { ProcessBuilder pb; // Test with large page enabled. - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-XX:G1HeapRegionSize=" + regionSize, - "-Xmx128m", - "-Xlog:gc+init,pagesize,gc+heap+coops=debug", - "-XX:+UseLargePages", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-XX:G1HeapRegionSize=" + regionSize, + "-Xmx128m", + "-Xlog:gc+init,pagesize,gc+heap+coops=debug", + "-XX:+UseLargePages", + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); boolean largePageEnabled = checkLargePageEnabled(output); @@ -100,12 +100,12 @@ public class TestLargePageUseForHeap { output.shouldHaveExitValue(0); // Test with large page disabled. - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-XX:G1HeapRegionSize=" + regionSize, - "-Xmx128m", - "-Xlog:gc+init,pagesize,gc+heap+coops=debug", - "-XX:-UseLargePages", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-XX:G1HeapRegionSize=" + regionSize, + "-Xmx128m", + "-Xlog:gc+init,pagesize,gc+heap+coops=debug", + "-XX:-UseLargePages", + "-version"); output = new OutputAnalyzer(pb.start()); checkHeap(output, smallPageSize); diff --git a/test/hotspot/jtreg/gc/g1/TestMarkStackSizes.java b/test/hotspot/jtreg/gc/g1/TestMarkStackSizes.java index 23f014d05cb..d056a5ef747 100644 --- a/test/hotspot/jtreg/gc/g1/TestMarkStackSizes.java +++ b/test/hotspot/jtreg/gc/g1/TestMarkStackSizes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -50,7 +50,7 @@ public class TestMarkStackSizes { Collections.addAll(testArguments, extraArgs); testArguments.add("-version"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testArguments); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(testArguments); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/gc/g1/TestMixedGCLiveThreshold.java b/test/hotspot/jtreg/gc/g1/TestMixedGCLiveThreshold.java index 26ba0da396a..035a6b89679 100644 --- a/test/hotspot/jtreg/gc/g1/TestMixedGCLiveThreshold.java +++ b/test/hotspot/jtreg/gc/g1/TestMixedGCLiveThreshold.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -109,7 +109,7 @@ public class TestMixedGCLiveThreshold { basicOpts.add(GCTest.class.getName()); - ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(basicOpts); + ProcessBuilder procBuilder = ProcessTools.createLimitedTestJavaProcessBuilder(basicOpts); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); return analyzer; } diff --git a/test/hotspot/jtreg/gc/g1/TestOneEdenRegionAfterGC.java b/test/hotspot/jtreg/gc/g1/TestOneEdenRegionAfterGC.java index f6bf6fd452d..36c3c04c629 100644 --- a/test/hotspot/jtreg/gc/g1/TestOneEdenRegionAfterGC.java +++ b/test/hotspot/jtreg/gc/g1/TestOneEdenRegionAfterGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ public class TestOneEdenRegionAfterGC { private static long YoungGenSize = 32 * 1024 * 1024; private static OutputAnalyzer run() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-Xmn" + YoungGenSize, "-Xmx512M", diff --git a/test/hotspot/jtreg/gc/g1/TestPLABOutput.java b/test/hotspot/jtreg/gc/g1/TestPLABOutput.java index 6cb3110b20d..e6342a1911c 100644 --- a/test/hotspot/jtreg/gc/g1/TestPLABOutput.java +++ b/test/hotspot/jtreg/gc/g1/TestPLABOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -59,7 +59,7 @@ public class TestPLABOutput { GCTest.class.getName() }; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(arguments); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/g1/TestPLABSizeBounds.java b/test/hotspot/jtreg/gc/g1/TestPLABSizeBounds.java index fcd0057d4c9..ade281a4a92 100644 --- a/test/hotspot/jtreg/gc/g1/TestPLABSizeBounds.java +++ b/test/hotspot/jtreg/gc/g1/TestPLABSizeBounds.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -62,7 +62,7 @@ public class TestPLABSizeBounds { testArguments.add("-XX:OldPLABSize=" + plabSize); testArguments.add(GCTest.class.getName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testArguments); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(testArguments); OutputAnalyzer output = new OutputAnalyzer(pb.start()); if (shouldSucceed) { diff --git a/test/hotspot/jtreg/gc/g1/TestPeriodicLogMessages.java b/test/hotspot/jtreg/gc/g1/TestPeriodicLogMessages.java index 1babf4f483c..de79be020b4 100644 --- a/test/hotspot/jtreg/gc/g1/TestPeriodicLogMessages.java +++ b/test/hotspot/jtreg/gc/g1/TestPeriodicLogMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,22 +40,22 @@ import jdk.test.lib.process.ProcessTools; public class TestPeriodicLogMessages { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-XX:G1PeriodicGCInterval=0", - "-Xlog:gc+init,gc+periodic=debug", - "-Xmx10M", - GCTest.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-XX:G1PeriodicGCInterval=0", + "-Xlog:gc+init,gc+periodic=debug", + "-Xmx10M", + GCTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Periodic GC: Disabled"); output.shouldNotContain("Checking for periodic GC"); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-XX:G1PeriodicGCInterval=100", - "-Xlog:gc+init,gc+periodic=debug", - "-Xmx10M", - GCTest.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-XX:G1PeriodicGCInterval=100", + "-Xlog:gc+init,gc+periodic=debug", + "-Xmx10M", + GCTest.class.getName()); output = new OutputAnalyzer(pb.start()); output.shouldContain("Periodic GC: Enabled"); diff --git a/test/hotspot/jtreg/gc/g1/TestPrintRegionRememberedSetInfo.java b/test/hotspot/jtreg/gc/g1/TestPrintRegionRememberedSetInfo.java index 3c848d5ce01..ea718c7f6ed 100644 --- a/test/hotspot/jtreg/gc/g1/TestPrintRegionRememberedSetInfo.java +++ b/test/hotspot/jtreg/gc/g1/TestPrintRegionRememberedSetInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -69,7 +69,7 @@ public class TestPrintRegionRememberedSetInfo { finalargs.add(RunAndWaitForMarking.class.getName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(finalargs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(finalargs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java index 8d8f77db81a..5d4b4d958f8 100644 --- a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java +++ b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,12 +44,12 @@ import jdk.test.lib.process.ProcessTools; public class TestRemsetLoggingThreads { private static void runTest(int refinementThreads, int workerThreads) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-XX:+UnlockDiagnosticVMOptions", - "-Xlog:gc+remset+exit=trace", - "-XX:G1ConcRefinementThreads=" + refinementThreads, - "-XX:ParallelGCThreads=" + workerThreads, - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseG1GC", + "-XX:+UnlockDiagnosticVMOptions", + "-Xlog:gc+remset+exit=trace", + "-XX:G1ConcRefinementThreads=" + refinementThreads, + "-XX:ParallelGCThreads=" + workerThreads, + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingTools.java b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingTools.java index 8a0b4ead475..69f34e07146 100644 --- a/test/hotspot/jtreg/gc/g1/TestRemsetLoggingTools.java +++ b/test/hotspot/jtreg/gc/g1/TestRemsetLoggingTools.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -77,7 +77,7 @@ public class TestRemsetLoggingTools { finalargs.add(VerifySummaryOutput.class.getName()); finalargs.add(String.valueOf(numGCs)); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(finalargs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(finalargs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java b/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java index 841ed393392..d894c58d737 100644 --- a/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java +++ b/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -59,7 +59,7 @@ public class TestSharedArchiveWithPreTouch { } dump_args.addAll(Arrays.asList(new String[] { "-Xshare:dump", "-Xlog:cds" })); - pb = ProcessTools.createJavaProcessBuilder(dump_args); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(dump_args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); try { output.shouldContain("Loading classes to share"); @@ -72,7 +72,7 @@ public class TestSharedArchiveWithPreTouch { } load_args.addAll(Arrays.asList(new String[] { "-Xshare:on", "-version" })); - pb = ProcessTools.createJavaProcessBuilder(load_args.toArray(new String[0])); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(load_args.toArray(new String[0])); output = new OutputAnalyzer(pb.start()); output.shouldContain("sharing"); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java b/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java index 851115d8fee..645e545443d 100644 --- a/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java +++ b/test/hotspot/jtreg/gc/g1/TestShrinkAuxiliaryData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -88,7 +88,7 @@ public class TestShrinkAuxiliaryData { } private void performTest(List opts) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm(opts); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(opts); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println(output.getStdout()); diff --git a/test/hotspot/jtreg/gc/g1/TestShrinkDefragmentedHeap.java b/test/hotspot/jtreg/gc/g1/TestShrinkDefragmentedHeap.java index 3f41a8f45f8..acdce6b6417 100644 --- a/test/hotspot/jtreg/gc/g1/TestShrinkDefragmentedHeap.java +++ b/test/hotspot/jtreg/gc/g1/TestShrinkDefragmentedHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -61,7 +61,7 @@ public class TestShrinkDefragmentedHeap { private static final int REGION_SIZE = 1 * 1024 * 1024; public static void main(String[] args) throws Exception, Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:InitialHeapSize=" + INITIAL_HEAP_SIZE, "-Xmn" + MINIMAL_YOUNG_SIZE, "-Xmx" + MAXIMUM_HEAP_SIZE, diff --git a/test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java b/test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java index 8666c3c3c4a..4c7190ada02 100644 --- a/test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java +++ b/test/hotspot/jtreg/gc/g1/TestSkipRebuildRemsetPhase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,16 +40,16 @@ import jdk.test.whitebox.WhiteBox; public class TestSkipRebuildRemsetPhase { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/a:.", - "-XX:+UseG1GC", - "-XX:+UnlockExperimentalVMOptions", - "-XX:+UnlockDiagnosticVMOptions", - "-XX:+WhiteBoxAPI", - "-XX:G1MixedGCLiveThresholdPercent=20", - "-Xlog:gc+marking=debug,gc+phases=debug,gc+remset+tracking=trace", - "-Xms10M", - "-Xmx10M", - GCTest.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xbootclasspath/a:.", + "-XX:+UseG1GC", + "-XX:+UnlockExperimentalVMOptions", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+WhiteBoxAPI", + "-XX:G1MixedGCLiveThresholdPercent=20", + "-Xlog:gc+marking=debug,gc+phases=debug,gc+remset+tracking=trace", + "-Xms10M", + "-Xmx10M", + GCTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Skipping Remembered Set Rebuild."); output.shouldContain("No Remembered Sets to update after rebuild"); diff --git a/test/hotspot/jtreg/gc/g1/TestVerifyGCType.java b/test/hotspot/jtreg/gc/g1/TestVerifyGCType.java index 36c6fd6ce60..02ee74bed8b 100644 --- a/test/hotspot/jtreg/gc/g1/TestVerifyGCType.java +++ b/test/hotspot/jtreg/gc/g1/TestVerifyGCType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -178,7 +178,7 @@ public class TestVerifyGCType { basicOpts.add(TriggerGCs.class.getName()); - ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(basicOpts); + ProcessBuilder procBuilder = ProcessTools.createLimitedTestJavaProcessBuilder(basicOpts); OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start()); return analyzer; diff --git a/test/hotspot/jtreg/gc/g1/mixedgc/TestLogging.java b/test/hotspot/jtreg/gc/g1/mixedgc/TestLogging.java index 73fd4e82106..0c8d4896c4e 100644 --- a/test/hotspot/jtreg/gc/g1/mixedgc/TestLogging.java +++ b/test/hotspot/jtreg/gc/g1/mixedgc/TestLogging.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -90,7 +90,7 @@ public class TestLogging { Collections.addAll(testOpts, extraFlags); testOpts.add(RunMixedGC.class.getName()); System.out.println(testOpts); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testOpts); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(testOpts); return new OutputAnalyzer(pb.start()); } } diff --git a/test/hotspot/jtreg/gc/g1/numa/TestG1NUMATouchRegions.java b/test/hotspot/jtreg/gc/g1/numa/TestG1NUMATouchRegions.java index dbc0fd370ac..4f972e10f31 100644 --- a/test/hotspot/jtreg/gc/g1/numa/TestG1NUMATouchRegions.java +++ b/test/hotspot/jtreg/gc/g1/numa/TestG1NUMATouchRegions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -181,7 +181,7 @@ public class TestG1NUMATouchRegions { return; } - ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb_enabled = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-Xlog:pagesize,gc+heap+region=trace", "-XX:+UseG1GC", diff --git a/test/hotspot/jtreg/gc/logging/TestDeprecatedPrintFlags.java b/test/hotspot/jtreg/gc/logging/TestDeprecatedPrintFlags.java index cedb42c2e2f..04607502a22 100644 --- a/test/hotspot/jtreg/gc/logging/TestDeprecatedPrintFlags.java +++ b/test/hotspot/jtreg/gc/logging/TestDeprecatedPrintFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import java.util.stream.Collectors; public class TestDeprecatedPrintFlags { public static void testPrintGC() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGC", DoGC.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+PrintGC", DoGC.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("-XX:+PrintGC is deprecated. Will use -Xlog:gc instead."); output.shouldNotContain("PrintGCDetails"); @@ -52,7 +52,7 @@ public class TestDeprecatedPrintFlags { } public static void testPrintGCDetails() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGCDetails", DoGC.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+PrintGCDetails", DoGC.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead."); output.shouldNotContain("PrintGC is deprecated"); @@ -63,7 +63,7 @@ public class TestDeprecatedPrintFlags { public static void testXloggc() throws Exception { String fileName = "gc-test.log"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xloggc:" + fileName, DoGC.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xloggc:" + fileName, DoGC.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("-Xloggc is deprecated. Will use -Xlog:gc:gc-test.log instead."); output.shouldNotContain("PrintGCDetails"); @@ -80,7 +80,7 @@ public class TestDeprecatedPrintFlags { public static void testXloggcWithPrintGCDetails() throws Exception { String fileName = "gc-test.log"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGCDetails", "-Xloggc:" + fileName, DoGC.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+PrintGCDetails", "-Xloggc:" + fileName, DoGC.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead."); output.shouldContain("-Xloggc is deprecated. Will use -Xlog:gc:gc-test.log instead."); diff --git a/test/hotspot/jtreg/gc/logging/TestGCId.java b/test/hotspot/jtreg/gc/logging/TestGCId.java index f720bfac7ab..dca1681e0e8 100644 --- a/test/hotspot/jtreg/gc/logging/TestGCId.java +++ b/test/hotspot/jtreg/gc/logging/TestGCId.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -74,7 +74,7 @@ public class TestGCId { private static void testGCId(String gcFlag) throws Exception { ProcessBuilder pb_default = - ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xlog:gc", "-Xmx10M", GCTest.class.getName()); + ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+" + gcFlag, "-Xlog:gc", "-Xmx10M", GCTest.class.getName()); verifyContainsGCIDs(new OutputAnalyzer(pb_default.start())); } diff --git a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java index 4a2ad34b3db..b67063091fb 100644 --- a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java +++ b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -94,7 +94,7 @@ public class TestMetaSpaceLog { private static void testMetaSpaceUpdate() throws Exception { ProcessBuilder pb = - ProcessTools.createTestJvm( + ProcessTools.createTestJavaProcessBuilder( "-Xlog:gc*", "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java index 6272f08e994..99932bc68a6 100644 --- a/test/hotspot/jtreg/gc/logging/TestPrintReferences.java +++ b/test/hotspot/jtreg/gc/logging/TestPrintReferences.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -67,10 +67,10 @@ public class TestPrintReferences { } public static void testRefs() throws Exception { - ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder("-Xlog:gc+ref+phases=debug", - "-XX:+UseG1GC", - "-Xmx32M", - GCTest.class.getName()); + ProcessBuilder pb_enabled = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:gc+ref+phases=debug", + "-XX:+UseG1GC", + "-Xmx32M", + GCTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start()); checkRefsLogFormat(output); @@ -95,13 +95,13 @@ public class TestPrintReferences { } public static void testPhases(boolean parallelRefProcEnabled) throws Exception { - ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder("-Xlog:gc+phases+ref=debug", - "-XX:+UseG1GC", - "-Xmx32M", - "-XX:" + (parallelRefProcEnabled ? "+" : "-") + "ParallelRefProcEnabled", - "-XX:-UseDynamicNumberOfGCThreads", - "-XX:ParallelGCThreads=2", - GCTest.class.getName()); + ProcessBuilder pb_enabled = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:gc+phases+ref=debug", + "-XX:+UseG1GC", + "-Xmx32M", + "-XX:" + (parallelRefProcEnabled ? "+" : "-") + "ParallelRefProcEnabled", + "-XX:-UseDynamicNumberOfGCThreads", + "-XX:ParallelGCThreads=2", + GCTest.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start()); checkLogFormat(output, parallelRefProcEnabled); diff --git a/test/hotspot/jtreg/gc/metaspace/TestMetaspaceSizeFlags.java b/test/hotspot/jtreg/gc/metaspace/TestMetaspaceSizeFlags.java index d717315b93f..eda71fa9c4b 100644 --- a/test/hotspot/jtreg/gc/metaspace/TestMetaspaceSizeFlags.java +++ b/test/hotspot/jtreg/gc/metaspace/TestMetaspaceSizeFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -84,7 +84,7 @@ public class TestMetaspaceSizeFlags { } private static OutputAnalyzer run(long maxMetaspaceSize, long metaspaceSize) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:MaxMetaspaceSize=" + maxMetaspaceSize, "-XX:MetaspaceSize=" + metaspaceSize, "-XX:-UseLargePages", // Prevent us from using 2GB large pages on solaris + sparc. diff --git a/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java b/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java index 5ecacc7be70..a87ed22e15b 100644 --- a/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java +++ b/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, Twitter, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -119,7 +119,7 @@ public class TestSizeTransitions { System.out.println(" " + a); } - final ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(jvmArgs); + final ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(jvmArgs); final OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println(output.getStdout()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/serial/HeapChangeLogging.java b/test/hotspot/jtreg/gc/serial/HeapChangeLogging.java index 9d7d8961527..8480d046dfb 100644 --- a/test/hotspot/jtreg/gc/serial/HeapChangeLogging.java +++ b/test/hotspot/jtreg/gc/serial/HeapChangeLogging.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -41,7 +41,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class HeapChangeLogging { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128m", "-Xmn100m", "-XX:+UseSerialGC", "-Xlog:gc", HeapFiller.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128m", "-Xmn100m", "-XX:+UseSerialGC", "-Xlog:gc", HeapFiller.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); String stdout = output.getStdout(); System.out.println(stdout); diff --git a/test/hotspot/jtreg/gc/shenandoah/TestEvilSyncBug.java b/test/hotspot/jtreg/gc/shenandoah/TestEvilSyncBug.java index e58e8d6db5c..67690d8cad5 100644 --- a/test/hotspot/jtreg/gc/shenandoah/TestEvilSyncBug.java +++ b/test/hotspot/jtreg/gc/shenandoah/TestEvilSyncBug.java @@ -56,7 +56,7 @@ public class TestEvilSyncBug { for (int c = 0; c < NUM_RUNS; c++) { Callable task = () -> { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xms128m", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xms128m", "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/gc/shenandoah/TestObjItrWithHeapDump.java b/test/hotspot/jtreg/gc/shenandoah/TestObjItrWithHeapDump.java index 41943d4befd..c0161b7a238 100644 --- a/test/hotspot/jtreg/gc/shenandoah/TestObjItrWithHeapDump.java +++ b/test/hotspot/jtreg/gc/shenandoah/TestObjItrWithHeapDump.java @@ -41,7 +41,7 @@ public class TestObjItrWithHeapDump { String[] cmds = Arrays.copyOf(args, args.length + 2); cmds[args.length] = TestObjItrWithHeapDump.class.getName(); cmds[args.length + 1] = "test"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmds); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/shenandoah/TestPeriodicGC.java b/test/hotspot/jtreg/gc/shenandoah/TestPeriodicGC.java index 84795fa4042..b65aa0cd0b4 100644 --- a/test/hotspot/jtreg/gc/shenandoah/TestPeriodicGC.java +++ b/test/hotspot/jtreg/gc/shenandoah/TestPeriodicGC.java @@ -42,7 +42,7 @@ public class TestPeriodicGC { String[] cmds = Arrays.copyOf(args, args.length + 2); cmds[args.length] = TestPeriodicGC.class.getName(); cmds[args.length + 1] = "test"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmds); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocLargeObj.java b/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocLargeObj.java index 3996c19a98d..1057eb4a977 100644 --- a/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocLargeObj.java +++ b/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocLargeObj.java @@ -55,7 +55,7 @@ public class TestAllocLargeObj { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx16m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -68,7 +68,7 @@ public class TestAllocLargeObj { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx1g", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", diff --git a/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocLargerThanHeap.java b/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocLargerThanHeap.java index c996bfd714e..1567e3d05da 100644 --- a/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocLargerThanHeap.java +++ b/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocLargerThanHeap.java @@ -50,7 +50,7 @@ public class TestAllocLargerThanHeap { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx16m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -63,7 +63,7 @@ public class TestAllocLargerThanHeap { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx1g", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", diff --git a/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocSmallObj.java b/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocSmallObj.java index 0820237ab94..bc32c1f0aa0 100644 --- a/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocSmallObj.java +++ b/test/hotspot/jtreg/gc/shenandoah/oom/TestAllocSmallObj.java @@ -54,7 +54,7 @@ public class TestAllocSmallObj { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx16m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -67,7 +67,7 @@ public class TestAllocSmallObj { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx1g", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", diff --git a/test/hotspot/jtreg/gc/shenandoah/oom/TestClassLoaderLeak.java b/test/hotspot/jtreg/gc/shenandoah/oom/TestClassLoaderLeak.java index 21962b2182d..080842c37f9 100644 --- a/test/hotspot/jtreg/gc/shenandoah/oom/TestClassLoaderLeak.java +++ b/test/hotspot/jtreg/gc/shenandoah/oom/TestClassLoaderLeak.java @@ -99,7 +99,7 @@ public class TestClassLoaderLeak { pbArgs.add(TestClassLoaderLeak.class.getName()); pbArgs.add("test"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(pbArgs.toArray(new String[0])); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(pbArgs.toArray(new String[0])); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/gc/shenandoah/oom/TestThreadFailure.java b/test/hotspot/jtreg/gc/shenandoah/oom/TestThreadFailure.java index a342b416010..75cb2d5c31a 100644 --- a/test/hotspot/jtreg/gc/shenandoah/oom/TestThreadFailure.java +++ b/test/hotspot/jtreg/gc/shenandoah/oom/TestThreadFailure.java @@ -62,7 +62,7 @@ public class TestThreadFailure { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx32m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestArgumentRanges.java b/test/hotspot/jtreg/gc/shenandoah/options/TestArgumentRanges.java index bcda88b553f..2cc2c2c2197 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestArgumentRanges.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestArgumentRanges.java @@ -46,7 +46,7 @@ public class TestArgumentRanges { private static void testHeuristics() throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -57,7 +57,7 @@ public class TestArgumentRanges { output.shouldHaveExitValue(0); } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -68,7 +68,7 @@ public class TestArgumentRanges { output.shouldHaveExitValue(0); } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -83,7 +83,7 @@ public class TestArgumentRanges { private static void testRange(String option, int min, int max) throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -94,7 +94,7 @@ public class TestArgumentRanges { output.shouldHaveExitValue(1); } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -105,7 +105,7 @@ public class TestArgumentRanges { output.shouldHaveExitValue(0); } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -116,7 +116,7 @@ public class TestArgumentRanges { output.shouldHaveExitValue(1); } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestClassUnloadingArguments.java b/test/hotspot/jtreg/gc/shenandoah/options/TestClassUnloadingArguments.java index 4ebdcc33d14..c575b51084c 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestClassUnloadingArguments.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestClassUnloadingArguments.java @@ -43,7 +43,7 @@ public class TestClassUnloadingArguments { cmds[args.length] = "-Xmx128m"; cmds[args.length + 1] = "-XX:+PrintFlagsFinal"; cmds[args.length + 2] = "-version"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmds); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain("ClassUnloading"); diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestExplicitGC.java b/test/hotspot/jtreg/gc/shenandoah/options/TestExplicitGC.java index 4e8d699ddee..49e7c417130 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestExplicitGC.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestExplicitGC.java @@ -60,7 +60,7 @@ public class TestExplicitGC { }; { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -77,7 +77,7 @@ public class TestExplicitGC { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -95,7 +95,7 @@ public class TestExplicitGC { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -113,7 +113,7 @@ public class TestExplicitGC { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -131,7 +131,7 @@ public class TestExplicitGC { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestExplicitGCNoConcurrent.java b/test/hotspot/jtreg/gc/shenandoah/options/TestExplicitGCNoConcurrent.java index 70724658eb8..6499457b667 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestExplicitGCNoConcurrent.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestExplicitGCNoConcurrent.java @@ -60,7 +60,7 @@ public class TestExplicitGCNoConcurrent { }; for (String opt : opts) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestHeuristicsUnlock.java b/test/hotspot/jtreg/gc/shenandoah/options/TestHeuristicsUnlock.java index f122cc55fcd..c9f1c75b4e1 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestHeuristicsUnlock.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestHeuristicsUnlock.java @@ -52,7 +52,7 @@ public class TestHeuristicsUnlock { private static void testWith(String h, Mode mode) throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:-UnlockDiagnosticVMOptions", "-XX:-UnlockExperimentalVMOptions", @@ -73,7 +73,7 @@ public class TestHeuristicsUnlock { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:-UnlockExperimentalVMOptions", @@ -94,7 +94,7 @@ public class TestHeuristicsUnlock { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:-UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java b/test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java index 9c7ca182210..523f434dbbd 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java @@ -38,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestHumongousThresholdArgs { public static void main(String[] args) throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -51,7 +51,7 @@ public class TestHumongousThresholdArgs { int[] invalid = new int[] {-100, -1, 0, 101, 1000}; for (int v : valid) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", @@ -62,7 +62,7 @@ public class TestHumongousThresholdArgs { } for (int v : invalid) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestLoopMiningArguments.java b/test/hotspot/jtreg/gc/shenandoah/options/TestLoopMiningArguments.java index f84e576f2f0..79452b6cbc5 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestLoopMiningArguments.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestLoopMiningArguments.java @@ -44,7 +44,7 @@ public class TestLoopMiningArguments { cmds[args.length] = "-Xmx128m"; cmds[args.length + 1] = "-XX:+PrintFlagsFinal"; cmds[args.length + 2] = "-version"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmds); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmds); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain("UseCountedLoopSafepoints"); diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestModeUnlock.java b/test/hotspot/jtreg/gc/shenandoah/options/TestModeUnlock.java index 6c03281c3ca..0c8fea7f993 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestModeUnlock.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestModeUnlock.java @@ -51,7 +51,7 @@ public class TestModeUnlock { private static void testWith(String h, Mode mode) throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:-UnlockDiagnosticVMOptions", "-XX:-UnlockExperimentalVMOptions", @@ -72,7 +72,7 @@ public class TestModeUnlock { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:-UnlockExperimentalVMOptions", @@ -93,7 +93,7 @@ public class TestModeUnlock { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:-UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestRegionSizeArgs.java b/test/hotspot/jtreg/gc/shenandoah/options/TestRegionSizeArgs.java index 17c8b1ed6e3..79d0b517e89 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestRegionSizeArgs.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestRegionSizeArgs.java @@ -45,7 +45,7 @@ public class TestRegionSizeArgs { private static void testInvalidRegionSizes() throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms4m", "-Xmx1g", @@ -55,7 +55,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms8m", "-Xmx1g", @@ -65,7 +65,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -77,7 +77,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -88,7 +88,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -100,7 +100,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -111,7 +111,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms1g", "-Xmx1g", @@ -122,7 +122,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms1g", "-Xmx1g", @@ -134,7 +134,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms1g", "-Xmx1g", @@ -145,7 +145,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms1g", "-Xmx1g", @@ -160,7 +160,7 @@ public class TestRegionSizeArgs { private static void testMinRegionSize() throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -172,7 +172,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -184,7 +184,7 @@ public class TestRegionSizeArgs { output.shouldHaveExitValue(1); } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -196,7 +196,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -211,7 +211,7 @@ public class TestRegionSizeArgs { private static void testMaxRegionSize() throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", @@ -223,7 +223,7 @@ public class TestRegionSizeArgs { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms100m", "-Xmx1g", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestSelectiveBarrierFlags.java b/test/hotspot/jtreg/gc/shenandoah/options/TestSelectiveBarrierFlags.java index a6f76f867ef..1e1627d0fe5 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestSelectiveBarrierFlags.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestSelectiveBarrierFlags.java @@ -90,7 +90,7 @@ public class TestSelectiveBarrierFlags { pool.submit(() -> { try { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(conf.toArray(new String[0])); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(conf.toArray(new String[0])); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); } catch (Exception e) { diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestSoftMaxHeapSize.java b/test/hotspot/jtreg/gc/shenandoah/options/TestSoftMaxHeapSize.java index cd1e3591fe0..78bbf75189c 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestSoftMaxHeapSize.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestSoftMaxHeapSize.java @@ -38,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestSoftMaxHeapSize { public static void main(String[] args) throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms4m", "-Xmx128m", @@ -49,7 +49,7 @@ public class TestSoftMaxHeapSize { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms4m", "-Xmx128m", @@ -60,7 +60,7 @@ public class TestSoftMaxHeapSize { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-Xms4m", "-Xmx128m", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestThreadCounts.java b/test/hotspot/jtreg/gc/shenandoah/options/TestThreadCounts.java index 8100ff57c05..f7f9ee56b59 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestThreadCounts.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestThreadCounts.java @@ -45,7 +45,7 @@ public class TestThreadCounts { } private static void testWith(int conc, int par) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestThreadCountsOverride.java b/test/hotspot/jtreg/gc/shenandoah/options/TestThreadCountsOverride.java index c8c876c23e5..5e63595e726 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestThreadCountsOverride.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestThreadCountsOverride.java @@ -38,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestThreadCountsOverride { public static void main(String[] args) throws Exception { { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -53,7 +53,7 @@ public class TestThreadCountsOverride { } { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestWrongBarrierDisable.java b/test/hotspot/jtreg/gc/shenandoah/options/TestWrongBarrierDisable.java index 4c2ece2bafd..0e913375534 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestWrongBarrierDisable.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestWrongBarrierDisable.java @@ -63,7 +63,7 @@ public class TestWrongBarrierDisable { private static void shouldFailAll(String h, String[] barriers) throws Exception { for (String b : barriers) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -81,7 +81,7 @@ public class TestWrongBarrierDisable { private static void shouldPassAll(String h, String[] barriers) throws Exception { for (String b : barriers) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", diff --git a/test/hotspot/jtreg/gc/shenandoah/options/TestWrongBarrierEnable.java b/test/hotspot/jtreg/gc/shenandoah/options/TestWrongBarrierEnable.java index bf37e8db1b3..84645621eb4 100644 --- a/test/hotspot/jtreg/gc/shenandoah/options/TestWrongBarrierEnable.java +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestWrongBarrierEnable.java @@ -55,7 +55,7 @@ public class TestWrongBarrierEnable { private static void shouldFailAll(String h, String[] barriers) throws Exception { for (String b : barriers) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", @@ -73,7 +73,7 @@ public class TestWrongBarrierEnable { private static void shouldPassAll(String h, String[] barriers) throws Exception { for (String b : barriers) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", diff --git a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java index 87ae12d6bbd..83f211ad5fa 100644 --- a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java +++ b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -61,7 +61,7 @@ public class TestReclaimStringsLeaksMemory { "-XX:+PrintNMTStatistics" )); baseargs.addAll(Arrays.asList(args)); baseargs.add(GCTest.class.getName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(baseargs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(baseargs); verifySymbolMemoryUsageNotTooHigh(new OutputAnalyzer(pb.start())); } diff --git a/test/hotspot/jtreg/gc/stress/TestStressG1Humongous.java b/test/hotspot/jtreg/gc/stress/TestStressG1Humongous.java index 983b9f6c33f..2a02039c60e 100644 --- a/test/hotspot/jtreg/gc/stress/TestStressG1Humongous.java +++ b/test/hotspot/jtreg/gc/stress/TestStressG1Humongous.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -101,7 +101,7 @@ public class TestStressG1Humongous{ "-Dregionsize=" + regionSize, TestStressG1HumongousImpl.class.getName() ); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(options); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(options); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java b/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java index e256ea405c2..2f61c166cb8 100644 --- a/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java +++ b/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -59,7 +59,7 @@ public class TestStressG1Uncommit { "-XX:+UseG1GC", StressUncommit.class.getName() ); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(options); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(options); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldMatch("Uncommit regions"); diff --git a/test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationTools.java b/test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationTools.java index 4230399f4bd..31c11b66dfc 100644 --- a/test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationTools.java +++ b/test/hotspot/jtreg/gc/stringdedup/TestStringDeduplicationTools.java @@ -299,7 +299,7 @@ class TestStringDeduplicationTools { args.addAll(Arrays.asList(defaultArgs)); args.addAll(Arrays.asList(extraArgs)); - ProcessBuilder pb = ProcessTools.createTestJvm(args); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.err.println(output.getStderr()); System.out.println(output.getStdout()); diff --git a/test/hotspot/jtreg/gc/whitebox/TestWBGC.java b/test/hotspot/jtreg/gc/whitebox/TestWBGC.java index c2cb35d4f9d..c2fe2633e4e 100644 --- a/test/hotspot/jtreg/gc/whitebox/TestWBGC.java +++ b/test/hotspot/jtreg/gc/whitebox/TestWBGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ import jdk.test.whitebox.WhiteBox; public class TestWBGC { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", diff --git a/test/hotspot/jtreg/gc/x/TestAllocateHeapAt.java b/test/hotspot/jtreg/gc/x/TestAllocateHeapAt.java index 30cd1984c5c..de3d1f585a7 100644 --- a/test/hotspot/jtreg/gc/x/TestAllocateHeapAt.java +++ b/test/hotspot/jtreg/gc/x/TestAllocateHeapAt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -41,7 +41,7 @@ public class TestAllocateHeapAt { final String heapBackingFile = "Heap Backing File: " + directory; final String failedToCreateFile = "Failed to create file " + directory; - ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder( + ProcessTools.executeProcess(ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseZGC", "-XX:-ZGenerational", "-Xlog:gc*", diff --git a/test/hotspot/jtreg/gc/x/TestPageCacheFlush.java b/test/hotspot/jtreg/gc/x/TestPageCacheFlush.java index 17b463b0cd9..5a20ee8322a 100644 --- a/test/hotspot/jtreg/gc/x/TestPageCacheFlush.java +++ b/test/hotspot/jtreg/gc/x/TestPageCacheFlush.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -68,7 +68,7 @@ public class TestPageCacheFlush { } public static void main(String[] args) throws Exception { - ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder( + ProcessTools.executeProcess(ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseZGC", "-XX:-ZGenerational", "-Xms128M", diff --git a/test/hotspot/jtreg/gc/x/TestSmallHeap.java b/test/hotspot/jtreg/gc/x/TestSmallHeap.java index 6710838c815..0fc6477b59b 100644 --- a/test/hotspot/jtreg/gc/x/TestSmallHeap.java +++ b/test/hotspot/jtreg/gc/x/TestSmallHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -53,7 +53,7 @@ public class TestSmallHeap { public static void main(String[] args) throws Exception { for (var maxCapacity: args) { - ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder( + ProcessTools.executeProcess(ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseZGC", "-XX:-ZGenerational", "-Xlog:gc,gc+init,gc+reloc,gc+heap", diff --git a/test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java b/test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java index 5a39792aade..f5a6113f6ff 100644 --- a/test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java +++ b/test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java @@ -41,7 +41,7 @@ public class TestAllocateHeapAt { final String heapBackingFile = "Heap Backing File: " + directory; final String failedToCreateFile = "Failed to create file " + directory; - ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder( + ProcessTools.executeProcess(ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseZGC", "-XX:+ZGenerational", "-Xlog:gc*", diff --git a/test/hotspot/jtreg/gc/z/TestPageCacheFlush.java b/test/hotspot/jtreg/gc/z/TestPageCacheFlush.java index ca39c35518e..629edccd496 100644 --- a/test/hotspot/jtreg/gc/z/TestPageCacheFlush.java +++ b/test/hotspot/jtreg/gc/z/TestPageCacheFlush.java @@ -68,7 +68,7 @@ public class TestPageCacheFlush { } public static void main(String[] args) throws Exception { - ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder( + ProcessTools.executeProcess(ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseZGC", "-XX:+ZGenerational", "-Xms128M", diff --git a/test/hotspot/jtreg/gc/z/TestSmallHeap.java b/test/hotspot/jtreg/gc/z/TestSmallHeap.java index 1b73d5735a7..bfe1c0310ca 100644 --- a/test/hotspot/jtreg/gc/z/TestSmallHeap.java +++ b/test/hotspot/jtreg/gc/z/TestSmallHeap.java @@ -53,7 +53,7 @@ public class TestSmallHeap { public static void main(String[] args) throws Exception { for (var maxCapacity: args) { - ProcessTools.executeProcess(ProcessTools.createJavaProcessBuilder( + ProcessTools.executeProcess(ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseZGC", "-XX:+ZGenerational", "-Xlog:gc,gc+init,gc+reloc,gc+heap", diff --git a/test/hotspot/jtreg/gc/z/TestZForceDiscontiguousHeapReservations.java b/test/hotspot/jtreg/gc/z/TestZForceDiscontiguousHeapReservations.java index 18b37c21442..2993038faa5 100644 --- a/test/hotspot/jtreg/gc/z/TestZForceDiscontiguousHeapReservations.java +++ b/test/hotspot/jtreg/gc/z/TestZForceDiscontiguousHeapReservations.java @@ -45,7 +45,7 @@ public class TestZForceDiscontiguousHeapReservations { */ final int XmxInM = 2000; final int XmsInM = Math.min(16 * XmxInM / (n + 1), XmxInM); - OutputAnalyzer oa = ProcessTools.executeProcess(ProcessTools.createTestJvm( + OutputAnalyzer oa = ProcessTools.executeProcess(ProcessTools.createTestJavaProcessBuilder( "-XX:+UseZGC", "-XX:+ZGenerational", "-Xms" + XmsInM + "M", diff --git a/test/hotspot/jtreg/gc/z/TestZNMT.java b/test/hotspot/jtreg/gc/z/TestZNMT.java index 87a8643fcd5..066ebd063f6 100644 --- a/test/hotspot/jtreg/gc/z/TestZNMT.java +++ b/test/hotspot/jtreg/gc/z/TestZNMT.java @@ -68,7 +68,7 @@ public class TestZNMT { * reservations. */ final int XmsInM = Math.min(16 * XmxInM / (zForceDiscontiguousHeapReservations + 1), XmxInM); - OutputAnalyzer oa = ProcessTools.executeProcess(ProcessTools.createTestJvm( + OutputAnalyzer oa = ProcessTools.executeProcess(ProcessTools.createTestJavaProcessBuilder( "-XX:+UseZGC", "-XX:+ZGenerational", "-Xms" + XmsInM + "M", diff --git a/test/hotspot/jtreg/resourcehogs/serviceability/jvmti/GetObjectSizeOverflow.java b/test/hotspot/jtreg/resourcehogs/serviceability/jvmti/GetObjectSizeOverflow.java index b423453ce77..236d2eb9486 100644 --- a/test/hotspot/jtreg/resourcehogs/serviceability/jvmti/GetObjectSizeOverflow.java +++ b/test/hotspot/jtreg/resourcehogs/serviceability/jvmti/GetObjectSizeOverflow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -56,7 +56,7 @@ public class GetObjectSizeOverflow { var jar = new ProcessBuilder(JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", "agent.jar", "GetObjectSizeOverflowAgent.class"); new OutputAnalyzer(jar.start()).shouldHaveExitValue(0); - ProcessBuilder pt = ProcessTools.createTestJvm("-Xmx4000m", "-javaagent:agent.jar", "GetObjectSizeOverflowAgent"); + ProcessBuilder pt = ProcessTools.createTestJavaProcessBuilder("-Xmx4000m", "-javaagent:agent.jar", "GetObjectSizeOverflowAgent"); OutputAnalyzer output = new OutputAnalyzer(pt.start()); output.stdoutShouldContain("GetObjectSizeOverflow passed"); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/7162488/TestUnrecognizedVmOption.java b/test/hotspot/jtreg/runtime/7162488/TestUnrecognizedVmOption.java index 7de7245d862..db7cfebfd90 100644 --- a/test/hotspot/jtreg/runtime/7162488/TestUnrecognizedVmOption.java +++ b/test/hotspot/jtreg/runtime/7162488/TestUnrecognizedVmOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -35,7 +35,7 @@ public class TestUnrecognizedVmOption { static final String OPTION="this_is_not_an_option"; public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-showversion", "-XX:" + OPTION); new OutputAnalyzer(pb.start()) .shouldNotHaveExitValue(0) diff --git a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java index c84bc7e0159..ebbae35e4e0 100644 --- a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java +++ b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ import static java.nio.file.Files.readAllBytes; import static java.util.Arrays.stream; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; -import static jdk.test.lib.process.ProcessTools.createJavaProcessBuilder; +import static jdk.test.lib.process.ProcessTools.createLimitedTestJavaProcessBuilder; import static jdk.test.lib.Platform.isWindows; import jdk.test.lib.Utils; import jdk.test.lib.Platform; @@ -229,7 +229,7 @@ public class TestInheritFD { throw new SkippedException("Could not find lsof like command"); } - ProcessBuilder pb = createJavaProcessBuilder( + ProcessBuilder pb = createLimitedTestJavaProcessBuilder( "-Xlog:gc:\"" + logPath + "\"", "-Dtest.jdk=" + getProperty("test.jdk"), VMStartedWithLogging.class.getName(), @@ -250,7 +250,7 @@ public class TestInheritFD { // second VM public static void main(String[] args) throws IOException, InterruptedException { System.out.println(SECOND_VM_PID_PREFIX + ProcessHandle.current().pid()); - ProcessBuilder pb = createJavaProcessBuilder( + ProcessBuilder pb = createLimitedTestJavaProcessBuilder( "-Dtest.jdk=" + getProperty("test.jdk"), VMShouldNotInheritFileDescriptors.class.getName(), args[0], diff --git a/test/hotspot/jtreg/runtime/BadObjectClass/BootstrapRedefine.java b/test/hotspot/jtreg/runtime/BadObjectClass/BootstrapRedefine.java index c4dd815cc4a..d94dd1fb927 100644 --- a/test/hotspot/jtreg/runtime/BadObjectClass/BootstrapRedefine.java +++ b/test/hotspot/jtreg/runtime/BadObjectClass/BootstrapRedefine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -51,7 +51,7 @@ public class BootstrapRedefine { "--patch-module=java.base"), "mods/java.base"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.base=mods/java.base", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("--patch-module=java.base=mods/java.base", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("Incompatible definition of java.lang.Object") .shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/BootClassAppendProp/BootClassPathAppend.java b/test/hotspot/jtreg/runtime/BootClassAppendProp/BootClassPathAppend.java index 8d6f0fddacd..67c6ca493df 100644 --- a/test/hotspot/jtreg/runtime/BootClassAppendProp/BootClassPathAppend.java +++ b/test/hotspot/jtreg/runtime/BootClassAppendProp/BootClassPathAppend.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class BootClassPathAppend { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintCompilation", "-Xcomp", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/BootstrapMethod/BSMCalledTwice.java b/test/hotspot/jtreg/runtime/BootstrapMethod/BSMCalledTwice.java index a8a8aa060bf..fb00abb3d18 100644 --- a/test/hotspot/jtreg/runtime/BootstrapMethod/BSMCalledTwice.java +++ b/test/hotspot/jtreg/runtime/BootstrapMethod/BSMCalledTwice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -107,7 +107,7 @@ public class BSMCalledTwice implements Opcodes { }; cl.loadClass(classTestCName); - ProcessBuilder pb = ProcessTools.createTestJvm("-cp", ".", classTestCName); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-cp", ".", classTestCName); OutputAnalyzer output = new OutputAnalyzer(pb.start()); String test_output = output.getOutput(); if (test_output == null) { diff --git a/test/hotspot/jtreg/runtime/BootstrapMethod/TestLambdaExceptionInInitializer.java b/test/hotspot/jtreg/runtime/BootstrapMethod/TestLambdaExceptionInInitializer.java index 77c367a0c23..008165314f4 100644 --- a/test/hotspot/jtreg/runtime/BootstrapMethod/TestLambdaExceptionInInitializer.java +++ b/test/hotspot/jtreg/runtime/BootstrapMethod/TestLambdaExceptionInInitializer.java @@ -37,7 +37,7 @@ public class TestLambdaExceptionInInitializer { public static void main(String args[]) throws Throwable { // Run Lamba class - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("TestPkg.Lambda"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("TestPkg.Lambda"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldMatch("Exception in thread \".+\" java.lang.ExceptionInInitializerError"); diff --git a/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java b/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java index be97d1cf056..51b0469ce46 100644 --- a/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java +++ b/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import jtreg.SkippedException; public class CDSCompressedKPtrs { public static void main(String[] args) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseCompressedClassPointers", "-XX:+UseCompressedOops", "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CDSCompressedKPtrs.jsa", "-Xshare:dump", "-Xlog:cds"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -50,7 +50,7 @@ public class CDSCompressedKPtrs { output.shouldContain("Loading classes to share"); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseCompressedClassPointers", "-XX:+UseCompressedOops", "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CDSCompressedKPtrs.jsa", "-Xshare:on", "-version"); output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/XShareAuto.java b/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/XShareAuto.java index 19c4128f460..e53758a671a 100644 --- a/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/XShareAuto.java +++ b/test/hotspot/jtreg/runtime/CDSCompressedKPtrs/XShareAuto.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -39,7 +39,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class XShareAuto { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-server", "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./XShareAuto.jsa", "-Xshare:dump", "-Xlog:cds"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -55,7 +55,7 @@ public class XShareAuto { }; for (String x : cases) { - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./XShareAuto.jsa", "-Xlog:cds", diff --git a/test/hotspot/jtreg/runtime/ClassFile/FormatCheckingTest.java b/test/hotspot/jtreg/runtime/ClassFile/FormatCheckingTest.java index 0ff1f0a65be..8ab2d2252a8 100644 --- a/test/hotspot/jtreg/runtime/ClassFile/FormatCheckingTest.java +++ b/test/hotspot/jtreg/runtime/ClassFile/FormatCheckingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import jdk.test.lib.process.ProcessTools; public class FormatCheckingTest { public static void main(String args[]) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("BadHelloWorld"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("BadHelloWorld"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("java.lang.ClassFormatError: Illegal class name"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/ClassFile/JsrRewriting.java b/test/hotspot/jtreg/runtime/ClassFile/JsrRewriting.java index 4d2c74360c7..8563c79b19c 100644 --- a/test/hotspot/jtreg/runtime/ClassFile/JsrRewriting.java +++ b/test/hotspot/jtreg/runtime/ClassFile/JsrRewriting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2023, 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 @@ -70,7 +70,7 @@ public class JsrRewriting { // ======= execute the test // We run the test with MallocLimit set to 768m in oom mode, // in order to trigger and observe a fake os::malloc oom. This needs NMT. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-cp", ".", "-XX:+UnlockDiagnosticVMOptions", "-XX:NativeMemoryTracking=summary", diff --git a/test/hotspot/jtreg/runtime/ClassFile/OomWhileParsingRepeatedJsr.java b/test/hotspot/jtreg/runtime/ClassFile/OomWhileParsingRepeatedJsr.java index b82f03786ec..9ea18f5e2fc 100644 --- a/test/hotspot/jtreg/runtime/ClassFile/OomWhileParsingRepeatedJsr.java +++ b/test/hotspot/jtreg/runtime/ClassFile/OomWhileParsingRepeatedJsr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2023, 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 @@ -64,7 +64,7 @@ public class OomWhileParsingRepeatedJsr { // ======= execute the test // We run the test with MallocLimit set to 768m in oom mode, // in order to trigger and observe a fake os::malloc oom. This needs NMT. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-cp", ".", "-XX:+UnlockDiagnosticVMOptions", "-XX:NativeMemoryTracking=summary", diff --git a/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java b/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java index 160d0559fbe..9e3ae8de832 100644 --- a/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java +++ b/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -54,21 +54,21 @@ public class PreviewVersion { // Run the test. This should fail because --enable-preview is not specified. ClassFileInstaller.writeClassToDisk("PVTest", klassbuf, System.getProperty("test.classes")); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-cp", "." + File.pathSeparator + System.getProperty("test.classes"), "PVTest"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldContain("Preview features are not enabled"); oa.shouldHaveExitValue(1); // This should be successful because --enable-preview is specified. - pb = ProcessTools.createJavaProcessBuilder("--enable-preview", + pb = ProcessTools.createLimitedTestJavaProcessBuilder("--enable-preview", "-cp", "." + File.pathSeparator + System.getProperty("test.classes"), "PVTest"); oa = new OutputAnalyzer(pb.start()); oa.shouldContain("Hi!"); oa.shouldHaveExitValue(0); // Test -Xlog:class+preview - pb = ProcessTools.createJavaProcessBuilder("--enable-preview", "-Xlog:class+preview", + pb = ProcessTools.createLimitedTestJavaProcessBuilder("--enable-preview", "-Xlog:class+preview", "-cp", "." + File.pathSeparator + System.getProperty("test.classes"), "PVTest"); oa = new OutputAnalyzer(pb.start()); oa.shouldContain("[info][class,preview] Loading class PVTest that depends on preview features"); diff --git a/test/hotspot/jtreg/runtime/ClassFile/TestCheckedExceptions.java b/test/hotspot/jtreg/runtime/ClassFile/TestCheckedExceptions.java index a6f64e96bb6..3c041ed2536 100644 --- a/test/hotspot/jtreg/runtime/ClassFile/TestCheckedExceptions.java +++ b/test/hotspot/jtreg/runtime/ClassFile/TestCheckedExceptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class TestCheckedExceptions { public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xlog:exceptions=warning", "CheckedExceptions"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/ClassFile/UnsupportedClassFileVersion.java b/test/hotspot/jtreg/runtime/ClassFile/UnsupportedClassFileVersion.java index 3ac53335ea4..c61f46c3ecd 100644 --- a/test/hotspot/jtreg/runtime/ClassFile/UnsupportedClassFileVersion.java +++ b/test/hotspot/jtreg/runtime/ClassFile/UnsupportedClassFileVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -41,7 +41,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class UnsupportedClassFileVersion implements Opcodes { public static void main(String... args) throws Exception { writeClassFile(); - ProcessBuilder pb = ProcessTools.createTestJvm("-cp", ".", "ClassFile"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-cp", ".", "ClassFile"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("ClassFile has been compiled by a more recent version of the " + "Java Runtime (class file version 99.0), this version of " + diff --git a/test/hotspot/jtreg/runtime/CommandLine/BooleanFlagWithInvalidValue.java b/test/hotspot/jtreg/runtime/CommandLine/BooleanFlagWithInvalidValue.java index 55278a67bc2..1ca819497fa 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/BooleanFlagWithInvalidValue.java +++ b/test/hotspot/jtreg/runtime/CommandLine/BooleanFlagWithInvalidValue.java @@ -37,14 +37,14 @@ import jdk.test.lib.process.OutputAnalyzer; public class BooleanFlagWithInvalidValue { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings=8", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Improperly specified VM option 'PrintWarnings=8'"); output.shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-PrintWarnings=8", "-version"); output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/CommandLine/CompilerConfigFileWarning.java b/test/hotspot/jtreg/runtime/CommandLine/CompilerConfigFileWarning.java index c1807e4b3ec..ca0038a2226 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/CompilerConfigFileWarning.java +++ b/test/hotspot/jtreg/runtime/CommandLine/CompilerConfigFileWarning.java @@ -47,7 +47,7 @@ public class CompilerConfigFileWarning { pw.println("aaa, aaa"); pw.close(); - pb = ProcessTools.createJavaProcessBuilder("-XX:CompileCommandFile=hs_comp.txt", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:CompileCommandFile=hs_comp.txt", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(1); output.shouldContain("An error occurred during parsing"); @@ -60,7 +60,7 @@ public class CompilerConfigFileWarning { pw.println("aa"); pw.close(); - pb = ProcessTools.createJavaProcessBuilder("-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-version"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain("warning: .hotspot_compiler file is present but has been ignored. Run with -XX:CompileCommandFile=.hotspot_compiler to load the file."); diff --git a/test/hotspot/jtreg/runtime/CommandLine/ConfigFileParsing.java b/test/hotspot/jtreg/runtime/CommandLine/ConfigFileParsing.java index 471c71a0046..4f31b210da1 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/ConfigFileParsing.java +++ b/test/hotspot/jtreg/runtime/CommandLine/ConfigFileParsing.java @@ -51,7 +51,7 @@ public class ConfigFileParsing { pw.close(); // start VM - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-XX:Flags=.hotspotrc", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/CommandLine/ConfigFileWarning.java b/test/hotspot/jtreg/runtime/CommandLine/ConfigFileWarning.java index 62aef23b580..d9e72fa300a 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/ConfigFileWarning.java +++ b/test/hotspot/jtreg/runtime/CommandLine/ConfigFileWarning.java @@ -47,7 +47,7 @@ public class ConfigFileWarning { pw.println("aaa"); pw.close(); - pb = ProcessTools.createJavaProcessBuilder("-XX:Flags=hs_flags.txt","-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:Flags=hs_flags.txt","-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Unrecognized VM option 'aaa'"); output.shouldHaveExitValue(1); @@ -58,7 +58,7 @@ public class ConfigFileWarning { pw.println("aa"); pw.close(); - pb = ProcessTools.createJavaProcessBuilder("-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-version"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.shouldContain("warning: .hotspotrc file is present but has been ignored. Run with -XX:Flags=.hotspotrc to load the file."); diff --git a/test/hotspot/jtreg/runtime/CommandLine/DoubleFlagWithIntegerValue.java b/test/hotspot/jtreg/runtime/CommandLine/DoubleFlagWithIntegerValue.java index e24fd8f9ae0..65b1533542d 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/DoubleFlagWithIntegerValue.java +++ b/test/hotspot/jtreg/runtime/CommandLine/DoubleFlagWithIntegerValue.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class DoubleFlagWithIntegerValue { public static void testDoubleFlagWithValue(String flag, String value) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flag + "=" + value, "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(flag + "=" + value, "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("Improperly specified VM option"); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/CommandLine/FlagWithInvalidValue.java b/test/hotspot/jtreg/runtime/CommandLine/FlagWithInvalidValue.java index 5cfc3497a94..c16a05a79a8 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/FlagWithInvalidValue.java +++ b/test/hotspot/jtreg/runtime/CommandLine/FlagWithInvalidValue.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class FlagWithInvalidValue { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:MaxRAMPercentage=v", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java b/test/hotspot/jtreg/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java index 36f58fb3a97..4a5a4f7127b 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java +++ b/test/hotspot/jtreg/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java @@ -38,7 +38,7 @@ import jdk.test.lib.Platform; public class IgnoreUnrecognizedVMOptions { private static void runJavaAndCheckExitValue(boolean shouldSucceed, String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); if (shouldSucceed) { output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java b/test/hotspot/jtreg/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java index 0aead709245..5ea305431b0 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java +++ b/test/hotspot/jtreg/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java @@ -37,14 +37,14 @@ import jdk.test.lib.process.OutputAnalyzer; public class NonBooleanFlagWithInvalidBooleanPrefix { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-MaxRAMPercentage=1", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMPercentage=1'"); output.shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+MaxRAMPercentage=1", "-version"); output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java index 8de8292611b..1dc1cd9976b 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java +++ b/test/hotspot/jtreg/runtime/CommandLine/ObsoleteFlagErrorMessage.java @@ -41,7 +41,7 @@ public class ObsoleteFlagErrorMessage { String flag = "DummyObsoleteTestFlag"; // Case 1: Newly obsolete flags with extra junk appended should not be treated as newly obsolete (8060449) - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:" + flag + "PlusJunk", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -49,7 +49,7 @@ public class ObsoleteFlagErrorMessage { output.shouldHaveExitValue(1); // Case 2: Newly obsolete flags should be recognized as newly obsolete (8073989) - ProcessBuilder pb2 = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb2 = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+" + flag, "-version"); OutputAnalyzer output2 = new OutputAnalyzer(pb2.start()); diff --git a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java index b56cc376788..b5b15f6d75f 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java +++ b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java @@ -51,7 +51,7 @@ public class TestJcmdOutput { OutputAnalyzer output; System.out.println("Verify jcmd error message and that jcmd does not write errors to the target process output"); - output = new OutputAnalyzer((ProcessTools.createJavaProcessBuilder( + output = new OutputAnalyzer((ProcessTools.createLimitedTestJavaProcessBuilder( "-Dtest.jdk=" + System.getProperty("test.jdk"), "-XX:MinHeapFreeRatio=20", "-XX:MaxHeapFreeRatio=80", runJcmd.class.getName())).start()); diff --git a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java index ed37cc65601..78a508343d6 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java +++ b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -417,7 +417,7 @@ public abstract class JVMOption { runJava.add(optionValue); runJava.add(JVMStartup.class.getName()); - out = new OutputAnalyzer(ProcessTools.createJavaProcessBuilder(runJava).start()); + out = new OutputAnalyzer(ProcessTools.createLimitedTestJavaProcessBuilder(runJava).start()); exitCode = out.getExitValue(); String exitCodeString = null; diff --git a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java index ba0b2f7d61f..031d30bf2bd 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java +++ b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -469,7 +469,7 @@ public class JVMOptionsUtils { runJava.add(PRINT_FLAGS_RANGES); runJava.add("-version"); - p = ProcessTools.createJavaProcessBuilder(runJava).start(); + p = ProcessTools.createLimitedTestJavaProcessBuilder(runJava).start(); result = getJVMOptions(new InputStreamReader(p.getInputStream()), withRanges, acceptOrigin); diff --git a/test/hotspot/jtreg/runtime/CommandLine/TestHexArguments.java b/test/hotspot/jtreg/runtime/CommandLine/TestHexArguments.java index 3d0dab15ce1..7f646edfdcc 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/TestHexArguments.java +++ b/test/hotspot/jtreg/runtime/CommandLine/TestHexArguments.java @@ -39,13 +39,13 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestHexArguments { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:SharedBaseAddress=0x1D000000", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("Could not create the Java Virtual Machine"); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:SharedBaseAddress=1D000000", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldNotHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/CommandLine/TestLongUnrecognizedVMOption.java b/test/hotspot/jtreg/runtime/CommandLine/TestLongUnrecognizedVMOption.java index bae2aaf5ceb..04bdd25714f 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/TestLongUnrecognizedVMOption.java +++ b/test/hotspot/jtreg/runtime/CommandLine/TestLongUnrecognizedVMOption.java @@ -43,7 +43,7 @@ public class TestLongUnrecognizedVMOption { public static void main(String[] args) throws Exception { OutputAnalyzer output; - output = new OutputAnalyzer(ProcessTools.createJavaProcessBuilder("-XX:" + VERY_LONG_OPTION, "-version").start()); + output = new OutputAnalyzer(ProcessTools.createLimitedTestJavaProcessBuilder("-XX:" + VERY_LONG_OPTION, "-version").start()); output.shouldHaveExitValue(1); output.shouldContain(String.format("Unrecognized VM option '%s'", VERY_LONG_OPTION)); } diff --git a/test/hotspot/jtreg/runtime/CommandLine/TestNullTerminatedFlags.java b/test/hotspot/jtreg/runtime/CommandLine/TestNullTerminatedFlags.java index 20a6f73ad1e..e31a7e2cd17 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/TestNullTerminatedFlags.java +++ b/test/hotspot/jtreg/runtime/CommandLine/TestNullTerminatedFlags.java @@ -58,7 +58,7 @@ public class TestNullTerminatedFlags { for (String option : options) { String testOption = option + "junk"; ProcessBuilder pb = - ProcessTools.createJavaProcessBuilder(testOption, "-version"); + ProcessTools.createLimitedTestJavaProcessBuilder(testOption, "-version"); new OutputAnalyzer(pb.start()) .shouldContain("Unrecognized option: " + testOption) .shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/CommandLine/TestVMOptions.java b/test/hotspot/jtreg/runtime/CommandLine/TestVMOptions.java index 58a7307cafa..4ebeb9b7025 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/TestVMOptions.java +++ b/test/hotspot/jtreg/runtime/CommandLine/TestVMOptions.java @@ -38,7 +38,7 @@ import java.io.File; public class TestVMOptions { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:bogus", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:+PrintFlagsInitial"); @@ -46,7 +46,7 @@ public class TestVMOptions { output.shouldHaveExitValue(0); output.shouldContain("bool UseSerialGC"); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-PrintVMOptions", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); @@ -55,7 +55,7 @@ public class TestVMOptions { File dir = new File(System.getProperty("test.src", ".")); File file = new File(dir, "flagfile.txt"); String s = file.getAbsolutePath(); - pb = ProcessTools.createJavaProcessBuilder("-XX:Flags="+s); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:Flags="+s); output = new OutputAnalyzer(pb.start()); output.shouldNotHaveExitValue(0); output.shouldContain("VM option '-IgnoreUnrecognizedVMOptions'"); diff --git a/test/hotspot/jtreg/runtime/CommandLine/TraceExceptionsTest.java b/test/hotspot/jtreg/runtime/CommandLine/TraceExceptionsTest.java index 3f719849f08..09b51712c05 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/TraceExceptionsTest.java +++ b/test/hotspot/jtreg/runtime/CommandLine/TraceExceptionsTest.java @@ -38,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TraceExceptionsTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xlog:exceptions=info", "NoClassFound"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain(""); diff --git a/test/hotspot/jtreg/runtime/CommandLine/UnrecognizedVMOption.java b/test/hotspot/jtreg/runtime/CommandLine/UnrecognizedVMOption.java index 388b4e9fa5f..dfbb08d2f68 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/UnrecognizedVMOption.java +++ b/test/hotspot/jtreg/runtime/CommandLine/UnrecognizedVMOption.java @@ -44,7 +44,7 @@ public class UnrecognizedVMOption { "bogus_option", }; for (String option : badOptions) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:" + option, "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java index 6d847088f0d..95dd88c7223 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java +++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java @@ -101,7 +101,7 @@ public class VMDeprecatedOptions { // command line by -XX:+UnlockDiagnosticVMOptions. static void testDeprecatedDiagnostic(String option, String value) throws Throwable { String XXoption = CommandLineOptionTest.prepareFlag(option, value); - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS, XXoption, "-version"); OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); // check for option deprecation message: @@ -114,7 +114,7 @@ public class VMDeprecatedOptions { // command line by -XX:+UnlockExperimentalVMOption. static void testDeprecatedExperimental(String option, String value) throws Throwable { String XXoption = CommandLineOptionTest.prepareFlag(option, value); - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS, XXoption, "-version"); OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); // check for option deprecation message: diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMOptionWarning.java b/test/hotspot/jtreg/runtime/CommandLine/VMOptionWarning.java index 32f9bab43c6..e4740a3bcb7 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/VMOptionWarning.java +++ b/test/hotspot/jtreg/runtime/CommandLine/VMOptionWarning.java @@ -38,7 +38,7 @@ import jdk.test.lib.Platform; public class VMOptionWarning { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+AlwaysSafeConstructors", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+AlwaysSafeConstructors", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotHaveExitValue(0); output.shouldContain("Error: VM option 'AlwaysSafeConstructors' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions."); @@ -48,17 +48,17 @@ public class VMOptionWarning { return; } - pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintInlining", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+PrintInlining", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldNotHaveExitValue(0); output.shouldContain("Error: VM option 'PrintInlining' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions."); - pb = ProcessTools.createJavaProcessBuilder("-XX:+VerifyStack", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+VerifyStack", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldNotHaveExitValue(0); output.shouldContain("Error: VM option 'VerifyStack' is develop and is available only in debug version of VM."); - pb = ProcessTools.createJavaProcessBuilder("-XX:+CheckCompressedOops", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+CheckCompressedOops", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldNotHaveExitValue(0); output.shouldContain("Error: VM option 'CheckCompressedOops' is notproduct and is available only in debug version of VM."); diff --git a/test/hotspot/jtreg/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java b/test/hotspot/jtreg/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java index e9daf2575f7..675e688fa35 100644 --- a/test/hotspot/jtreg/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java +++ b/test/hotspot/jtreg/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java @@ -248,7 +248,7 @@ public class TestVMOptionsFile { runJava.add(PrintPropertyAndOptions.class.getName()); runJava.addAll(appParams); - pb = ProcessTools.createJavaProcessBuilder(runJava); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(runJava); VMParams.clear(); appParams.clear(); diff --git a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java index 6b41a7461d1..4feadfb5565 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java @@ -69,7 +69,7 @@ public class CompressedClassPointers { // CDS off, small heap, ccs size default (1G) // A small heap should allow us to place the ccs within the lower 32G and thus allow zero based encoding. public static void smallHeapTest() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedBaseAddress=8g", "-Xmx128m", @@ -86,7 +86,7 @@ public class CompressedClassPointers { // CDS off, small heap, ccs size explicitely set to 1G // A small heap should allow us to place the ccs within the lower 32G and thus allow zero based encoding. public static void smallHeapTestWith1G() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:CompressedClassSpaceSize=1g", "-Xmx128m", @@ -104,7 +104,7 @@ public class CompressedClassPointers { // We expect the ccs to be mapped somewhere far beyond the heap, such that it is not possible // to use zero based encoding. public static void largeHeapTest() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", "-Xmx30g", @@ -129,7 +129,7 @@ public class CompressedClassPointers { // for compressed oops. // We expect a zerobased ccs. public static void largeHeapAbove32GTest() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockExperimentalVMOptions", "-Xmx31g", @@ -150,7 +150,7 @@ public class CompressedClassPointers { // Using large paged heap, metaspace uses small pages. public static void largePagesForHeapTest() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx128m", "-XX:+UseLargePages", @@ -164,7 +164,7 @@ public class CompressedClassPointers { } public static void heapBaseMinAddressTest() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:HeapBaseMinAddress=1m", "-Xlog:gc+heap+coops=debug", "-version"); @@ -175,7 +175,7 @@ public class CompressedClassPointers { public static void sharingTest() throws Exception { // Test small heaps - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CompressedClassPointers.jsa", "-Xmx128m", @@ -191,7 +191,7 @@ public class CompressedClassPointers { output.shouldContain("Loading classes to share"); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./CompressedClassPointers.jsa", "-Xmx128m", @@ -210,7 +210,7 @@ public class CompressedClassPointers { } public static void smallHeapTestNoCoop() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions", @@ -228,7 +228,7 @@ public class CompressedClassPointers { } public static void smallHeapTestWith1GNoCoop() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions", @@ -250,7 +250,7 @@ public class CompressedClassPointers { } public static void largeHeapTestNoCoop() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions", @@ -272,7 +272,7 @@ public class CompressedClassPointers { } public static void largePagesTestNoCoop() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions", @@ -286,7 +286,7 @@ public class CompressedClassPointers { } public static void heapBaseMinAddressTestNoCoop() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:HeapBaseMinAddress=1m", @@ -299,7 +299,7 @@ public class CompressedClassPointers { public static void sharingTestNoCoop() throws Exception { // Test small heaps - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions", @@ -317,7 +317,7 @@ public class CompressedClassPointers { output.shouldContain("Loading classes to share"); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-UseCompressedOops", "-XX:+UseCompressedClassPointers", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassSpaceSize.java b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassSpaceSize.java index 5eaced668f0..e0ec1271346 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassSpaceSize.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedClassSpaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,23 +42,23 @@ public class CompressedClassSpaceSize { ProcessBuilder pb; OutputAnalyzer output; // Minimum size is 1MB - pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=0", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:CompressedClassSpaceSize=0", + "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("outside the allowed range") .shouldHaveExitValue(1); // Invalid size of -1 should be handled correctly - pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=-1", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:CompressedClassSpaceSize=-1", + "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Improperly specified VM option 'CompressedClassSpaceSize=-1'") .shouldHaveExitValue(1); // Maximum size is 3GB - pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=4g", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:CompressedClassSpaceSize=4g", + "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("outside the allowed range") .shouldHaveExitValue(1); @@ -67,28 +67,28 @@ public class CompressedClassSpaceSize { // Make sure the minimum size is set correctly and printed // (Note: ccs size are rounded up to the next larger root chunk boundary (16m). // Note that this is **reserved** size and does not affect rss. - pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", - "-XX:CompressedClassSpaceSize=1m", - "-Xlog:gc+metaspace=trace", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", + "-XX:CompressedClassSpaceSize=1m", + "-Xlog:gc+metaspace=trace", + "-version"); output = new OutputAnalyzer(pb.start()); output.shouldMatch("Compressed class space.*16777216") .shouldHaveExitValue(0); // Make sure the maximum size is set correctly and printed - pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", - "-XX:CompressedClassSpaceSize=3g", - "-Xlog:gc+metaspace=trace", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", + "-XX:CompressedClassSpaceSize=3g", + "-Xlog:gc+metaspace=trace", + "-version"); output = new OutputAnalyzer(pb.start()); output.shouldMatch("Compressed class space.*3221225472") .shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedClassPointers", - "-XX:CompressedClassSpaceSize=1m", - "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:-UseCompressedClassPointers", + "-XX:CompressedClassSpaceSize=1m", + "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used") .shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/CompressedOops/CompressedKlassPointerAndOops.java b/test/hotspot/jtreg/runtime/CompressedOops/CompressedKlassPointerAndOops.java index 28c517bbca9..403654d1cc8 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/CompressedKlassPointerAndOops.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/CompressedKlassPointerAndOops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -50,7 +50,7 @@ public class CompressedKlassPointerAndOops { ProcessBuilder pb; OutputAnalyzer output; - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UseCompressedClassPointers", "-XX:+UseCompressedOops", "-XX:ObjectAlignmentInBytes=" + alignment, diff --git a/test/hotspot/jtreg/runtime/CompressedOops/ObjectAlignment.java b/test/hotspot/jtreg/runtime/CompressedOops/ObjectAlignment.java index f9c6d6921aa..0cf4a72f519 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/ObjectAlignment.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/ObjectAlignment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -74,8 +74,8 @@ public class ObjectAlignment { } private static OutputAnalyzer testObjectAlignment(int alignment) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ObjectAlignmentInBytes=" + alignment, - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ObjectAlignmentInBytes=" + alignment, + "-version"); return new OutputAnalyzer(pb.start()); } } diff --git a/test/hotspot/jtreg/runtime/CompressedOops/UseCompressedOops.java b/test/hotspot/jtreg/runtime/CompressedOops/UseCompressedOops.java index bf4d58232a8..3d118bf73b1 100644 --- a/test/hotspot/jtreg/runtime/CompressedOops/UseCompressedOops.java +++ b/test/hotspot/jtreg/runtime/CompressedOops/UseCompressedOops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -189,7 +189,7 @@ public class UseCompressedOops { args.add("-version"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); return new OutputAnalyzer(pb.start()); } } diff --git a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java index 493f02f3036..4e4a9329f5d 100644 --- a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java +++ b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ import jdk.test.whitebox.WhiteBox; public class CleanProtectionDomain { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xlog:protectiondomain+table=debug", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java b/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java index 756bff98ffb..423fba7d221 100644 --- a/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java +++ b/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -98,7 +98,7 @@ public class ProtectionDomainCacheTest { } public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Djava.security.policy==" + System.getProperty("test.src") + File.separator + "test.policy", "-Dtest.classes=" + System.getProperty("test.classes", "."), "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/runtime/EnclosingMethodAttr/EnclMethodAttr.java b/test/hotspot/jtreg/runtime/EnclosingMethodAttr/EnclMethodAttr.java index db6b924078b..9b9acdce023 100644 --- a/test/hotspot/jtreg/runtime/EnclosingMethodAttr/EnclMethodAttr.java +++ b/test/hotspot/jtreg/runtime/EnclosingMethodAttr/EnclMethodAttr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class EnclMethodAttr { public static void main(String args[]) throws Throwable { System.out.println("Regression test for bug 8044738"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("EnclMethTest"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("EnclMethTest"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotHaveExitValue(0); output.shouldContain("java.lang.ClassFormatError: Wrong EnclosingMethod"); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/BadNativeStackInErrorHandlingTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/BadNativeStackInErrorHandlingTest.java index af4553f0022..435deeb696d 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/BadNativeStackInErrorHandlingTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/BadNativeStackInErrorHandlingTest.java @@ -45,7 +45,7 @@ import jdk.test.lib.process.ProcessTools; // This test was adapted from SafeFetchInErrorHandlingTest.java. public class BadNativeStackInErrorHandlingTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:ErrorHandlerTest=14", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ClassPathEnvVar.java b/test/hotspot/jtreg/runtime/ErrorHandling/ClassPathEnvVar.java index 68fbf40e441..4b4e41944de 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ClassPathEnvVar.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ClassPathEnvVar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -51,9 +51,9 @@ public class ClassPathEnvVar { } private static OutputAnalyzer runCrasher() throws Exception { ProcessBuilder pb = - ProcessTools.createJavaProcessBuilder("-XX:-CreateCoredumpOnCrash", - "-XX:ErrorHandlerTest=14", - "-XX:+ErrorFileToStdout"); + ProcessTools.createLimitedTestJavaProcessBuilder("-XX:-CreateCoredumpOnCrash", + "-XX:ErrorHandlerTest=14", + "-XX:+ErrorFileToStdout"); // Obtain the CLASSPATH setting and expand it to more than 2000 chars. Map envMap = pb.environment(); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java index 36502046570..73efc0e5e46 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -59,7 +59,7 @@ public class CreateCoredumpOnCrash { } public static OutputAnalyzer runTest(String option) throws Exception { return new OutputAnalyzer( - ProcessTools.createJavaProcessBuilder( + ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", option, Crasher.class.getName()) .start()); } diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ErrorFileOverwriteTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ErrorFileOverwriteTest.java index ea8e944aebb..5fcb4ec5f9e 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ErrorFileOverwriteTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ErrorFileOverwriteTest.java @@ -97,7 +97,7 @@ public class ErrorFileOverwriteTest { System.out.println("First crash..."); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx64M", "-XX:-CreateCoredumpOnCrash", "-XX:ErrorHandlerTest=1", @@ -123,7 +123,7 @@ public class ErrorFileOverwriteTest { System.out.println("Second crash..."); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx64M", "-XX:-CreateCoredumpOnCrash", "-XX:ErrorHandlerTest=2", // << now 2 diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ErrorFileRedirectTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ErrorFileRedirectTest.java index 3c32c6f8141..0e03317d640 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ErrorFileRedirectTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ErrorFileRedirectTest.java @@ -48,7 +48,7 @@ public class ErrorFileRedirectTest { public static void do_test(boolean redirectStdout, boolean redirectStderr) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx64M", "-XX:-CreateCoredumpOnCrash", "-XX:ErrorHandlerTest=14", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java b/test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java index 8dced9a3a9c..5717a576e65 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java @@ -115,7 +115,7 @@ public class MachCodeFramesInErrorFile { * expected to have a min number of MachCode sections. */ private static void run(boolean crashInJava) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx64m", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:-CreateCoredumpOnCrash", "-Xcomp", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java index d57a2bf29c2..b53dadfc41e 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java @@ -53,7 +53,7 @@ public class NestedThreadsListHandleInErrorHandlingTest { // Need to disable ShowRegistersOnAssert: that flag causes registers to be shown, which calls os::print_location, // which - as part of its checks - will iterate the threads list under a ThreadListHandle, changing the max nesting // counters and confusing this test. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+EnableThreadSMRStatistics", "-Xmx100M", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ProblematicFrameTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ProblematicFrameTest.java index dc54b09156c..e3d9c90408d 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ProblematicFrameTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ProblematicFrameTest.java @@ -47,7 +47,7 @@ public class ProblematicFrameTest { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx64m", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:-CreateCoredumpOnCrash", Crasher.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("Exception in thread"); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ReattemptErrorTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ReattemptErrorTest.java index 279b07ffff7..92327d96dfb 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ReattemptErrorTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ReattemptErrorTest.java @@ -57,7 +57,7 @@ public class ReattemptErrorTest { // * Third a step will use almost all stack space and then fault with SIGSEGV. After this the // proceeding reattempt steps will be skipped because of low stack headroom. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:-CreateCoredumpOnCrash", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ResourceMarkTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ResourceMarkTest.java index 77f8be01887..5bbc4cfac00 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ResourceMarkTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ResourceMarkTest.java @@ -48,7 +48,7 @@ public class ResourceMarkTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:-CreateCoredumpOnCrash", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java index 01c5c5e7953..a08d673115c 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java @@ -47,7 +47,7 @@ import jdk.test.lib.process.ProcessTools; public class SafeFetchInErrorHandlingTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:ErrorHandlerTest=14", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java index 9f689380c70..012d5a5c16d 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java @@ -80,7 +80,7 @@ public class SecondaryErrorTest { // We also check, optionally, that +ErrorLogSecondaryErrorDetails produces callstacks for // the secondary error. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:-CreateCoredumpOnCrash", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java index f2214204f4e..b861e44532d 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ShowRegistersOnAssertTest.java @@ -55,7 +55,7 @@ public class ShowRegistersOnAssertTest { { System.out.println("Testing " + (do_assert ? "assert" : "guarantee") + " with " + (show_registers_on_assert ? "-XX:+ShowRegistersOnAssert" : "-XX:-ShowRegistersOnAssert") + "..."); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:-CreateCoredumpOnCrash", "-XX:ErrorHandlerTest=" + (do_assert ? "1" : "2"), (show_registers_on_assert ? "-XX:+ShowRegistersOnAssert" : "-XX:-ShowRegistersOnAssert"), diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java b/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java index 0c9c846c8b6..7d7deffdb6e 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java @@ -65,7 +65,7 @@ public class StackWalkNativeToJava { commands.addAll(Arrays.asList(extraFlags)); commands.add("StackWalkNativeToJava$TestNativeToJavaNative"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(commands); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(commands); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("java.lang.RuntimeException: Reached statement after obj.wait()"); output.shouldNotContain("[error occurred during error reporting (printing native stack"); @@ -99,7 +99,7 @@ public class StackWalkNativeToJava { commands.addAll(Arrays.asList(extraFlags)); commands.add("StackWalkNativeToJava$TestNativeToJava"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(commands); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(commands); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("java.lang.RuntimeException: Reached statement after synchronized"); output.shouldNotContain("[error occurred during error reporting (printing native stack"); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestAbortVmOnException.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestAbortVmOnException.java index f71bc0ef8af..cafa23fd672 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestAbortVmOnException.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestAbortVmOnException.java @@ -60,12 +60,12 @@ public class TestAbortVmOnException { private static Process runProcess(String exceptionName, boolean withMessage, String exceptionMessage) throws IOException { if (exceptionMessage == null) { - return ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", + return ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:AbortVMOnException=" + exceptionName, "-Xcomp", "-XX:TieredStopAtLevel=3", "-XX:-CreateCoredumpOnCrash", "-XX:CompileCommand=compileonly,TestAbortVmOnException::*", TestAbortVmOnException.class.getName(), withMessage ? "throwExceptionWithMessage" : "throwException").start(); } else { - return ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", + return ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:AbortVMOnException=" + exceptionName, "-XX:AbortVMOnExceptionMessage=" + exceptionMessage, "-Xcomp", "-XX:TieredStopAtLevel=3", "-XX:-CreateCoredumpOnCrash", "-XX:CompileCommand=compileonly,TestAbortVmOnException::*", TestAbortVmOnException.class.getName(),withMessage ? "throwExceptionWithMessage" : "throwException").start(); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java index da46cd9e811..0be39d22ebe 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java @@ -54,7 +54,7 @@ public class TestCrashOnOutOfMemoryError { } } // else this is the main test - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+CrashOnOutOfMemoryError", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+CrashOnOutOfMemoryError", "-XX:-CreateCoredumpOnCrash", "-Xmx128m", TestCrashOnOutOfMemoryError.class.getName(),"throwOOME"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); int exitValue = output.getExitValue(); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java index effcd8b3216..2ae46a36229 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java @@ -137,7 +137,7 @@ public class TestDwarf { private static void runAndCheck(Flags flags, DwarfConstraint... constraints) throws Exception { OutputAnalyzer crashOut; - crashOut = ProcessTools.executeProcess(ProcessTools.createTestJvm(flags.getFlags())); + crashOut = ProcessTools.executeProcess(ProcessTools.createTestJavaProcessBuilder(flags.getFlags())); String crashOutputString = crashOut.getOutput(); Asserts.assertNotEquals(crashOut.getExitValue(), 0, "Crash JVM should not exit gracefully"); System.out.println(crashOutputString); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java index e56ed4a1b03..145dd4aadc9 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java @@ -49,7 +49,7 @@ public class TestExitOnOutOfMemoryError { } // else this is the main test - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+ExitOnOutOfMemoryError", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+ExitOnOutOfMemoryError", "-Xmx128m", TestExitOnOutOfMemoryError.class.getName(), "throwOOME"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestGZippedHeapDumpOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestGZippedHeapDumpOnOutOfMemoryError.java index a2a0154f0b3..5f4c1dd9b1a 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestGZippedHeapDumpOnOutOfMemoryError.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestGZippedHeapDumpOnOutOfMemoryError.java @@ -63,7 +63,7 @@ public class TestGZippedHeapDumpOnOutOfMemoryError { } static void test(int level) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpGzipLevel=" + level, "-Xmx128M", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java index 9324adbb2e0..fb098bd27fe 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java @@ -75,7 +75,7 @@ public class TestHeapDumpOnOutOfMemoryError { static void test(String type) throws Exception { String heapdumpFilename = type + ".hprof"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=" + heapdumpFilename, // Note: When trying to provoke a metaspace OOM we may generate a lot of classes. In debug VMs this // can cause considerable wait times since: diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpPath.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpPath.java index 0cc6dbc765f..167b94e1fe1 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpPath.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpPath.java @@ -54,7 +54,7 @@ public class TestHeapDumpPath { String heapdumpPath = "dumps"; File dumpDirectory = new File(heapdumpPath); dumpDirectory.mkdir(); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError", "-Xmx64m", "-XX:HeapDumpPath=" + heapdumpPath, TestHeapDumpPath.class.getName(), "OOME"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java index 00475f8bdd7..53410c5379c 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestOnError.java @@ -41,7 +41,7 @@ public class TestOnError { public static void main(String[] args) throws Exception { String msg = "Test Succeeded"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-CreateCoredumpOnCrash", "-XX:ErrorHandlerTest=14", // trigger potential SEGV "-XX:OnError=echo " + msg, diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestOnOutOfMemoryError.java index fe3c5c34f80..f498caa2bff 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestOnOutOfMemoryError.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestOnOutOfMemoryError.java @@ -47,12 +47,12 @@ public class TestOnOutOfMemoryError { // else this is the main test String msg1 = "Test1 Succeeded"; String msg2 = "Test2 Succeeded"; - ProcessBuilder pb_single = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb_single = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:OnOutOfMemoryError=echo " + msg1, TestOnOutOfMemoryError.class.getName(), "throwOOME"); - ProcessBuilder pb_multiple = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb_multiple = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:OnOutOfMemoryError=echo " + msg1, "-XX:OnOutOfMemoryError=echo " + msg2, TestOnOutOfMemoryError.class.getName(), diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestSigInfoInHsErrFile.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestSigInfoInHsErrFile.java index a33a2b38ca1..e53757a29f3 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestSigInfoInHsErrFile.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestSigInfoInHsErrFile.java @@ -46,7 +46,7 @@ public class TestSigInfoInHsErrFile { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:-CreateCoredumpOnCrash", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ThreadsListHandleInErrorHandlingTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ThreadsListHandleInErrorHandlingTest.java index f2930e5c5bd..0b5cc88819f 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ThreadsListHandleInErrorHandlingTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ThreadsListHandleInErrorHandlingTest.java @@ -53,7 +53,7 @@ public class ThreadsListHandleInErrorHandlingTest { // Need to disable ShowRegistersOnAssert: that flag causes registers to be shown, which calls os::print_location, // which - as part of its checks - will iterate the threads list under a ThreadListHandle, changing the max nesting // counters and confusing this test. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+EnableThreadSMRStatistics", "-Xmx100M", diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TimeoutInErrorHandlingTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/TimeoutInErrorHandlingTest.java index 0ff835a8c0d..68613f8fd71 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TimeoutInErrorHandlingTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TimeoutInErrorHandlingTest.java @@ -108,7 +108,7 @@ public class TimeoutInErrorHandlingTest { arguments.add("-XX:OnError=echo hi"); } arguments.add("-version"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(arguments); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); OutputAnalyzer output_detail = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/VeryEarlyAssertTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/VeryEarlyAssertTest.java index 348ce77c4dc..2d26079fa0e 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/VeryEarlyAssertTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/VeryEarlyAssertTest.java @@ -50,7 +50,7 @@ public class VeryEarlyAssertTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-version"); Map env = pb.environment(); env.put("HOTSPOT_FATAL_ERROR_DURING_DYNAMIC_INITIALIZATION", "1"); diff --git a/test/hotspot/jtreg/runtime/GenerateOopMap/TestGenerateOopMapCrash.java b/test/hotspot/jtreg/runtime/GenerateOopMap/TestGenerateOopMapCrash.java index b556e0d0211..559c6145cb6 100644 --- a/test/hotspot/jtreg/runtime/GenerateOopMap/TestGenerateOopMapCrash.java +++ b/test/hotspot/jtreg/runtime/GenerateOopMap/TestGenerateOopMapCrash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ public class TestGenerateOopMapCrash { public static void main(String args[]) throws Exception { if (args.length == 0) { // Spawn new VM instance to execute test - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:-TieredCompilation", "-XX:CompileCommand=dontinline,if_icmpleIsLastOpcode.m*", "-Xmx64m", diff --git a/test/hotspot/jtreg/runtime/InvocationTests/invocationC1Tests.java b/test/hotspot/jtreg/runtime/InvocationTests/invocationC1Tests.java index a5fe4b2a148..57df6306276 100644 --- a/test/hotspot/jtreg/runtime/InvocationTests/invocationC1Tests.java +++ b/test/hotspot/jtreg/runtime/InvocationTests/invocationC1Tests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -70,7 +70,7 @@ public class invocationC1Tests { public static void runTest(String whichTests, String classFileVersion) throws Throwable { System.out.println("\nC1 invocation tests, Tests: " + whichTests + ", class file version: " + classFileVersion); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128M", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128M", "-Xcomp", "-XX:TieredStopAtLevel=1", "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", whichTests, "--classfile_version=" + classFileVersion); diff --git a/test/hotspot/jtreg/runtime/InvocationTests/invocationOldCHATests.java b/test/hotspot/jtreg/runtime/InvocationTests/invocationOldCHATests.java index 2d4c2a38b21..415cd105ee9 100644 --- a/test/hotspot/jtreg/runtime/InvocationTests/invocationOldCHATests.java +++ b/test/hotspot/jtreg/runtime/InvocationTests/invocationOldCHATests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -67,7 +67,7 @@ public class invocationOldCHATests { public static void runTest(String whichTests, String classFileVersion) throws Throwable { System.out.println("\nOld CHA invocation tests, Tests: " + whichTests + ", class file version: " + classFileVersion); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128M", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128M", "-Xcomp", "-XX:+UnlockDiagnosticVMOptions", "-XX:-UseVtableBasedCHA", "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", whichTests, "--classfile_version=" + classFileVersion); diff --git a/test/hotspot/jtreg/runtime/InvocationTests/invokeinterfaceTests.java b/test/hotspot/jtreg/runtime/InvocationTests/invokeinterfaceTests.java index 9d8a164637e..9b72899d138 100644 --- a/test/hotspot/jtreg/runtime/InvocationTests/invokeinterfaceTests.java +++ b/test/hotspot/jtreg/runtime/InvocationTests/invokeinterfaceTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -73,7 +73,7 @@ public class invokeinterfaceTests { public static void runTest(String classFileVersion, String option) throws Throwable { System.out.println("\ninvokeinterface invocation tests, option: " + option + ", class file version: " + classFileVersion); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128M", option, + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128M", option, "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "invokeinterface.Generator", "--classfile_version=" + classFileVersion); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/InvocationTests/invokespecialTests.java b/test/hotspot/jtreg/runtime/InvocationTests/invokespecialTests.java index 564f83d822e..817e5da9616 100644 --- a/test/hotspot/jtreg/runtime/InvocationTests/invokespecialTests.java +++ b/test/hotspot/jtreg/runtime/InvocationTests/invokespecialTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -70,7 +70,7 @@ public class invokespecialTests { public static void runTest(String classFileVersion, String option) throws Throwable { System.out.println("\ninvokespecial invocation tests, option: " + option + ", class file version: " + classFileVersion); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128M", option, + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128M", option, "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "invokespecial.Generator", "--classfile_version=" + classFileVersion); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/InvocationTests/invokevirtualTests.java b/test/hotspot/jtreg/runtime/InvocationTests/invokevirtualTests.java index 9cc19b6081c..5f998a6029e 100644 --- a/test/hotspot/jtreg/runtime/InvocationTests/invokevirtualTests.java +++ b/test/hotspot/jtreg/runtime/InvocationTests/invokevirtualTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -70,7 +70,7 @@ public class invokevirtualTests { public static void runTest(String classFileVersion, String option) throws Throwable { System.out.println("\ninvokevirtual invocation tests, option: " + option + ", class file version: " + classFileVersion); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128M", option, + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128M", option, "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "invokevirtual.Generator", "--classfile_version=" + classFileVersion); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/LoadClass/LoadClassNegative.java b/test/hotspot/jtreg/runtime/LoadClass/LoadClassNegative.java index 45360a251d6..94c2bde6e76 100644 --- a/test/hotspot/jtreg/runtime/LoadClass/LoadClassNegative.java +++ b/test/hotspot/jtreg/runtime/LoadClass/LoadClassNegative.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class LoadClassNegative { public static void main(String args[]) throws Exception { String bootCP = "-Xbootclasspath/a:" + System.getProperty("test.src") + File.separator + "dummy.jar"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( bootCP, "TestForName"); diff --git a/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java b/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java index e14cb45df87..aa4c559ff64 100644 --- a/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java +++ b/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -70,7 +70,7 @@ public class LongBCP { CompilerUtils.compile(sourceDir, destDir); String bootCP = "-Xbootclasspath/a:" + destDir.toString(); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( bootCP, "Hello"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -82,7 +82,7 @@ public class LongBCP { CompilerUtils.compile(sourceDir, destDir); bootCP = "-Xbootclasspath/a:" + destDir.toString(); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( bootCP, "Hello"); output = new OutputAnalyzer(pb.start()); @@ -97,7 +97,7 @@ public class LongBCP { // run with long bootclasspath to hello.jar bootCP = "-Xbootclasspath/a:" + helloJar; - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( bootCP, "Hello"); output = new OutputAnalyzer(pb.start()); @@ -122,7 +122,7 @@ public class LongBCP { CompilerUtils.compile(sourceDir, destDir); bootCP = "-Xbootclasspath/a:" + destDir.toString(); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( bootCP, "Hello"); output = new OutputAnalyzer(pb.start()); @@ -139,7 +139,7 @@ public class LongBCP { Path jarPath = jarDir.resolve("hello.jar"); Files.copy(Paths.get(helloJar), jarPath); bootCP = "-Xbootclasspath/a:" + jarPath.toString(); - pb = ProcessTools.createJavaProcessBuilder(bootCP, "Hello"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(bootCP, "Hello"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Hello World") @@ -151,7 +151,7 @@ public class LongBCP { CompilerUtils.compile(sourceDir, destDir); bootCP = "-Xbootclasspath/a:" + destDir.toString(); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( bootCP, "Hello"); output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/LoadClass/TestResize.java b/test/hotspot/jtreg/runtime/LoadClass/TestResize.java index 56ae7e9b78d..9177ede52da 100644 --- a/test/hotspot/jtreg/runtime/LoadClass/TestResize.java +++ b/test/hotspot/jtreg/runtime/LoadClass/TestResize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -131,10 +131,10 @@ public class TestResize { // that will allow us to calculate the table's load factor. // -Xlog:safepoint+cleanup will print out cleanup details at safepoint // that will allow us to detect if the system dictionary resized. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintClassLoaderDataGraphAtExit", - "-Xlog:safepoint+cleanup,class+loader+data", - "TriggerResize", - String.valueOf(CLASSES_TO_LOAD)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+PrintClassLoaderDataGraphAtExit", + "-Xlog:safepoint+cleanup,class+loader+data", + "TriggerResize", + String.valueOf(CLASSES_TO_LOAD)); analyzeOutputOn(pb); } } diff --git a/test/hotspot/jtreg/runtime/LocalLong/LocalLongTest.java b/test/hotspot/jtreg/runtime/LocalLong/LocalLongTest.java index 6a9adec6c0c..f48eddc5180 100644 --- a/test/hotspot/jtreg/runtime/LocalLong/LocalLongTest.java +++ b/test/hotspot/jtreg/runtime/LocalLong/LocalLongTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -37,11 +37,11 @@ import jdk.test.lib.process.OutputAnalyzer; public class LocalLongTest { public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xint", - "--add-opens", "java.base/java.lang=ALL-UNNAMED", - "--add-opens", "java.base/java.lang.invoke=ALL-UNNAMED", - "--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED", - "LocalLongHelper"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", + "--add-opens", "java.base/java.lang=ALL-UNNAMED", + "--add-opens", "java.base/java.lang.invoke=ALL-UNNAMED", + "--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED", + "LocalLongHelper"); OutputAnalyzer o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); }; diff --git a/test/hotspot/jtreg/runtime/LocalVariableTable/TestLVT.java b/test/hotspot/jtreg/runtime/LocalVariableTable/TestLVT.java index b1ed991b931..c84fef5c126 100644 --- a/test/hotspot/jtreg/runtime/LocalVariableTable/TestLVT.java +++ b/test/hotspot/jtreg/runtime/LocalVariableTable/TestLVT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -41,17 +41,17 @@ public class TestLVT { public static void main(String[] args) throws Exception { test(); // Test good LVT in this test - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("DuplicateLVT"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("DuplicateLVT"); new OutputAnalyzer(pb.start()) .shouldContain("Duplicated LocalVariableTable attribute entry for 'by' in class file DuplicateLVT") .shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("DuplicateLVTT"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("DuplicateLVTT"); new OutputAnalyzer(pb.start()) .shouldContain("Duplicated LocalVariableTypeTable attribute entry for 'list' in class file DuplicateLVTT") .shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("NotFoundLVTT"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("NotFoundLVTT"); new OutputAnalyzer(pb.start()) .shouldContain("LVTT entry for 'list' in class file NotFoundLVTT does not match any LVT entry") .shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java index ee1b10903a9..d2d000f7c7d 100644 --- a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java +++ b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -126,7 +126,7 @@ public class MemberNameLeak { Path gcLogPath = createGcLogPath("gc." + gc + "." + doConcurrent); System.err.println("test(" + gc + ", " + doConcurrent + ")" + " " + dateFormat.format(new Date())); // Run this Leak class with logging - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xlog:membername+table=trace,gc+verify=debug,gc:" + gcLogPath + ":time,utctime,uptime,pid,level,tags", "-XX:+UnlockExperimentalVMOptions", "-XX:+UnlockDiagnosticVMOptions", diff --git a/test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java b/test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java index eb8698295f9..867257cba12 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java +++ b/test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeEnvVarTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -81,7 +81,7 @@ public class MaxMetaspaceSizeEnvVarTest { test++; report("Test " + test + ": normal command-line flag"); - pb = ProcessTools.createJavaProcessBuilder(flag, main, max); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(flag, main, max); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.reportDiagnosticSummary(); @@ -96,7 +96,7 @@ public class MaxMetaspaceSizeEnvVarTest { for (String envVar : envVars) { report("Test " + test + ": " + envVar + " env-var"); - pb = ProcessTools.createJavaProcessBuilder(main, max); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(main, max); pb.environment().put(envVar, flag); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); @@ -112,7 +112,7 @@ public class MaxMetaspaceSizeEnvVarTest { PrintWriter pw = new PrintWriter(rcFile); pw.println(flagRaw); pw.close(); - pb = ProcessTools.createJavaProcessBuilder(rcFileFlag, main, max); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(rcFileFlag, main, max); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); output.reportDiagnosticSummary(); diff --git a/test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeTest.java b/test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeTest.java index 32aaa34db50..76c24eb1d25 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeTest.java +++ b/test/hotspot/jtreg/runtime/Metaspace/MaxMetaspaceSizeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -35,7 +35,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class MaxMetaspaceSizeTest { public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx1g", "-XX:MaxMetaspaceSize=4K", "-XX:+UseCompressedClassPointers", diff --git a/test/hotspot/jtreg/runtime/MinimalVM/CDS.java b/test/hotspot/jtreg/runtime/MinimalVM/CDS.java index a86504c451a..84e0f47e9b8 100644 --- a/test/hotspot/jtreg/runtime/MinimalVM/CDS.java +++ b/test/hotspot/jtreg/runtime/MinimalVM/CDS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,17 +38,17 @@ public class CDS { public static void main(String args[]) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:dump"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-Xshare:dump"); new OutputAnalyzer(pb.start()) .shouldContain("Shared spaces are not supported in this VM") .shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:on"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-Xshare:on"); new OutputAnalyzer(pb.start()) .shouldContain("Shared spaces are not supported in this VM") .shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:auto", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-Xshare:auto", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("Shared spaces are not supported in this VM") .shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/MinimalVM/CheckJNI.java b/test/hotspot/jtreg/runtime/MinimalVM/CheckJNI.java index 01c436c7086..5a1ee499c60 100644 --- a/test/hotspot/jtreg/runtime/MinimalVM/CheckJNI.java +++ b/test/hotspot/jtreg/runtime/MinimalVM/CheckJNI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -36,7 +36,7 @@ import jdk.test.lib.process.ProcessTools; public class CheckJNI { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xcheck:jni", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-Xcheck:jni", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("Minimal VM warning: JNI CHECKING is not supported in this VM") .shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/MinimalVM/Instrumentation.java b/test/hotspot/jtreg/runtime/MinimalVM/Instrumentation.java index 29fa15e607b..c2b30fdd6a2 100644 --- a/test/hotspot/jtreg/runtime/MinimalVM/Instrumentation.java +++ b/test/hotspot/jtreg/runtime/MinimalVM/Instrumentation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -37,7 +37,7 @@ import jdk.test.lib.process.ProcessTools; public class Instrumentation { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-minimal", "-javaagent:redefineagent.jar", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("Instrumentation agents are not supported in this VM") diff --git a/test/hotspot/jtreg/runtime/MinimalVM/JMX.java b/test/hotspot/jtreg/runtime/MinimalVM/JMX.java index b7afcb6a81d..53ef41902ed 100644 --- a/test/hotspot/jtreg/runtime/MinimalVM/JMX.java +++ b/test/hotspot/jtreg/runtime/MinimalVM/JMX.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,12 +38,12 @@ public class JMX { public static void main(String args[]) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:+ManagementServer", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-XX:+ManagementServer", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("ManagementServer is not supported in this VM.") .shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Dcom.sun.management ", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-Dcom.sun.management ", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("-Dcom.sun.management is not supported in this VM.") .shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/MinimalVM/JVMTI.java b/test/hotspot/jtreg/runtime/MinimalVM/JVMTI.java index 9a96e1bc481..1914aafcfd6 100644 --- a/test/hotspot/jtreg/runtime/MinimalVM/JVMTI.java +++ b/test/hotspot/jtreg/runtime/MinimalVM/JVMTI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -36,7 +36,7 @@ import jdk.test.lib.process.ProcessTools; public class JVMTI { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-minimal", "-agentlib:jdwp=server=y,transport=dt_socket,address=5000,suspend=n", "-version"); diff --git a/test/hotspot/jtreg/runtime/MinimalVM/NMT.java b/test/hotspot/jtreg/runtime/MinimalVM/NMT.java index 740912be231..958ccc1758d 100644 --- a/test/hotspot/jtreg/runtime/MinimalVM/NMT.java +++ b/test/hotspot/jtreg/runtime/MinimalVM/NMT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,17 +38,17 @@ public class NMT { public static void main(String args[]) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=detail", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=detail", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("Native Memory Tracking is not supported in this VM") .shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=summary", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=summary", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("Native Memory Tracking is not supported in this VM") .shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=off", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=off", "-version"); new OutputAnalyzer(pb.start()) .shouldContain("Native Memory Tracking is not supported in this VM") .shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/Monitor/DeflationIntervalsTest.java b/test/hotspot/jtreg/runtime/Monitor/DeflationIntervalsTest.java index 8663989fd9e..eb394235196 100644 --- a/test/hotspot/jtreg/runtime/Monitor/DeflationIntervalsTest.java +++ b/test/hotspot/jtreg/runtime/Monitor/DeflationIntervalsTest.java @@ -272,7 +272,7 @@ public class DeflationIntervalsTest { opts.addAll(Arrays.asList(args)); opts.add("DeflationIntervalsTest$Test"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(opts); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(opts); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/Monitor/MonitorUsedDeflationThresholdTest.java b/test/hotspot/jtreg/runtime/Monitor/MonitorUsedDeflationThresholdTest.java index 5dd01e4262b..41b86e0e19e 100644 --- a/test/hotspot/jtreg/runtime/Monitor/MonitorUsedDeflationThresholdTest.java +++ b/test/hotspot/jtreg/runtime/Monitor/MonitorUsedDeflationThresholdTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -73,7 +73,7 @@ public class MonitorUsedDeflationThresholdTest { public static void main(String[] args) throws Exception { if (args.length == 0) { // Without args we invoke the test in a java sub-process: - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( // Test doesn't need much Java heap: "-Xmx100M", // AvgMonitorsPerThreadEstimate == 1 means we'll start with diff --git a/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java b/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java index 28bfd0f2bd4..3de4e89e3a0 100644 --- a/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java +++ b/test/hotspot/jtreg/runtime/Monitor/SyncOnValueBasedClassTest.java @@ -84,14 +84,14 @@ public class SyncOnValueBasedClassTest { public static void main(String[] args) throws Exception { generateTests(); for (int i = 0; i < fatalTests.length; i++) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(fatalTests[i]); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(fatalTests[i]); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldContain("fatal error: Synchronizing on object"); output.shouldNotContain("synchronization on value based class did not fail"); output.shouldNotHaveExitValue(0); } for (int i = 0; i < logTests.length; i++) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(logTests[i]); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(logTests[i]); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); checkOutput(output); @@ -171,7 +171,7 @@ public class SyncOnValueBasedClassTest { "", "SyncOnValueBasedClassTest$VTTest" }; // Fatal test vtTest[2] = "-XX:DiagnoseSyncOnValueBasedClasses=1"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vtTest); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(vtTest); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldContain("fatal error: Synchronizing on object"); output.shouldNotContain("synchronization on value based class did not fail"); @@ -179,7 +179,7 @@ public class SyncOnValueBasedClassTest { // Log test vtTest[2] = "-XX:DiagnoseSyncOnValueBasedClasses=2"; - pb = ProcessTools.createJavaProcessBuilder(vtTest); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(vtTest); output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); output.shouldContain("Synchronizing on object"); diff --git a/test/hotspot/jtreg/runtime/NMT/CheckForProperDetailStackTrace.java b/test/hotspot/jtreg/runtime/NMT/CheckForProperDetailStackTrace.java index 71fdfd8aea5..411676b1b63 100644 --- a/test/hotspot/jtreg/runtime/NMT/CheckForProperDetailStackTrace.java +++ b/test/hotspot/jtreg/runtime/NMT/CheckForProperDetailStackTrace.java @@ -91,7 +91,7 @@ public class CheckForProperDetailStackTrace { // If modules in the system image have been archived in CDS, they will not be // created again at run time. Explicitly use an external module to make sure // we have a runtime-defined ModuleEntry - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:NativeMemoryTracking=detail", "-XX:+PrintNMTStatistics", diff --git a/test/hotspot/jtreg/runtime/NMT/CommandLineDetail.java b/test/hotspot/jtreg/runtime/NMT/CommandLineDetail.java index 074a9b194eb..57f2302db30 100644 --- a/test/hotspot/jtreg/runtime/NMT/CommandLineDetail.java +++ b/test/hotspot/jtreg/runtime/NMT/CommandLineDetail.java @@ -37,7 +37,7 @@ public class CommandLineDetail { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:NativeMemoryTracking=detail", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/NMT/CommandLineEmptyArgument.java b/test/hotspot/jtreg/runtime/NMT/CommandLineEmptyArgument.java index 3d2ac8baf29..2a0620b7bad 100644 --- a/test/hotspot/jtreg/runtime/NMT/CommandLineEmptyArgument.java +++ b/test/hotspot/jtreg/runtime/NMT/CommandLineEmptyArgument.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class CommandLineEmptyArgument { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:NativeMemoryTracking="); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:NativeMemoryTracking="); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/NMT/CommandLineInvalidArgument.java b/test/hotspot/jtreg/runtime/NMT/CommandLineInvalidArgument.java index d82df08b8cc..655fa140d35 100644 --- a/test/hotspot/jtreg/runtime/NMT/CommandLineInvalidArgument.java +++ b/test/hotspot/jtreg/runtime/NMT/CommandLineInvalidArgument.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class CommandLineInvalidArgument { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:NativeMemoryTracking=apa"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:NativeMemoryTracking=apa"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/NMT/CommandLineSummary.java b/test/hotspot/jtreg/runtime/NMT/CommandLineSummary.java index c44be999d5f..02b37a40ef4 100644 --- a/test/hotspot/jtreg/runtime/NMT/CommandLineSummary.java +++ b/test/hotspot/jtreg/runtime/NMT/CommandLineSummary.java @@ -37,7 +37,7 @@ public class CommandLineSummary { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:NativeMemoryTracking=summary", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/NMT/CommandLineTurnOffNMT.java b/test/hotspot/jtreg/runtime/NMT/CommandLineTurnOffNMT.java index 710902a53cb..199a2957f61 100644 --- a/test/hotspot/jtreg/runtime/NMT/CommandLineTurnOffNMT.java +++ b/test/hotspot/jtreg/runtime/NMT/CommandLineTurnOffNMT.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class CommandLineTurnOffNMT { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:NativeMemoryTracking=off", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/NMT/JcmdWithNMTDisabled.java b/test/hotspot/jtreg/runtime/NMT/JcmdWithNMTDisabled.java index 079d8d99052..3b61a0be383 100644 --- a/test/hotspot/jtreg/runtime/NMT/JcmdWithNMTDisabled.java +++ b/test/hotspot/jtreg/runtime/NMT/JcmdWithNMTDisabled.java @@ -51,13 +51,13 @@ public class JcmdWithNMTDisabled { // First run without enabling NMT (not in debug, where NMT is by default on) if (!Platform.isDebugBuild()) { - pb = ProcessTools.createJavaProcessBuilder("-Dtest.jdk=" + testjdkPath, "JcmdWithNMTDisabled"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Dtest.jdk=" + testjdkPath, "JcmdWithNMTDisabled"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); } // Then run with explicitly disabling NMT, should not be any difference - pb = ProcessTools.createJavaProcessBuilder("-Dtest.jdk=" + testjdkPath, "-XX:NativeMemoryTracking=off", "JcmdWithNMTDisabled"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Dtest.jdk=" + testjdkPath, "-XX:NativeMemoryTracking=off", "JcmdWithNMTDisabled"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/NMT/MallocLimitTest.java b/test/hotspot/jtreg/runtime/NMT/MallocLimitTest.java index ba53d4d06a1..a58ff861a29 100644 --- a/test/hotspot/jtreg/runtime/NMT/MallocLimitTest.java +++ b/test/hotspot/jtreg/runtime/NMT/MallocLimitTest.java @@ -98,7 +98,7 @@ public class MallocLimitTest { args.add("-XX:NativeMemoryTracking=summary"); args.addAll(Arrays.asList(extraSettings)); args.add("-version"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); return pb; } diff --git a/test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java b/test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java index ef1e5cd8346..8cbacfb5701 100644 --- a/test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java +++ b/test/hotspot/jtreg/runtime/NMT/NMTInitializationTest.java @@ -156,7 +156,7 @@ public class NMTInitializationTest { } vmArgs.add("-version"); - ProcessBuilder pb = ProcessTools.createTestJvm(vmArgs); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(vmArgs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); if (debug) { output.reportDiagnosticSummary(); diff --git a/test/hotspot/jtreg/runtime/NMT/NMTJavaHeapTest.java b/test/hotspot/jtreg/runtime/NMT/NMTJavaHeapTest.java index 603760379de..f2abd3ac0ad 100644 --- a/test/hotspot/jtreg/runtime/NMT/NMTJavaHeapTest.java +++ b/test/hotspot/jtreg/runtime/NMT/NMTJavaHeapTest.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class NMTJavaHeapTest { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintNMTStatistics", "-XX:NativeMemoryTracking=summary", diff --git a/test/hotspot/jtreg/runtime/NMT/NMTWithCDS.java b/test/hotspot/jtreg/runtime/NMT/NMTWithCDS.java index 994705e1e77..226626acb34 100644 --- a/test/hotspot/jtreg/runtime/NMT/NMTWithCDS.java +++ b/test/hotspot/jtreg/runtime/NMT/NMTWithCDS.java @@ -38,14 +38,14 @@ public class NMTWithCDS { public static void main(String[] args) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createTestJvm( + pb = ProcessTools.createTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:dump", "-Xlog:cds"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); try { output.shouldContain("Loading classes to share"); output.shouldHaveExitValue(0); - pb = ProcessTools.createTestJvm( + pb = ProcessTools.createTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:NativeMemoryTracking=detail", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:on", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("sharing"); diff --git a/test/hotspot/jtreg/runtime/NMT/PrintNMTStatistics.java b/test/hotspot/jtreg/runtime/NMT/PrintNMTStatistics.java index 3263cc40233..389e6a25de5 100644 --- a/test/hotspot/jtreg/runtime/NMT/PrintNMTStatistics.java +++ b/test/hotspot/jtreg/runtime/NMT/PrintNMTStatistics.java @@ -37,7 +37,7 @@ public class PrintNMTStatistics { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintNMTStatistics", "-XX:NativeMemoryTracking=detail", @@ -55,7 +55,7 @@ public class PrintNMTStatistics { // Make sure memory reserved for Module processing is recorded. output_detail.shouldContain(" Module (reserved="); - ProcessBuilder pb1 = ProcessTools.createTestJvm( + ProcessBuilder pb1 = ProcessTools.createTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintNMTStatistics", "-XX:NativeMemoryTracking=summary", diff --git a/test/hotspot/jtreg/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java b/test/hotspot/jtreg/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java index 70222701b06..897893c47ea 100644 --- a/test/hotspot/jtreg/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java +++ b/test/hotspot/jtreg/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class PrintNMTStatisticsWithNMTDisabled { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintNMTStatistics", "-XX:NativeMemoryTracking=off", "-version"); diff --git a/test/hotspot/jtreg/runtime/PerfMemDestroy/PerfMemDestroy.java b/test/hotspot/jtreg/runtime/PerfMemDestroy/PerfMemDestroy.java index 2040c755576..1ee2f604df6 100644 --- a/test/hotspot/jtreg/runtime/PerfMemDestroy/PerfMemDestroy.java +++ b/test/hotspot/jtreg/runtime/PerfMemDestroy/PerfMemDestroy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -39,7 +39,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class PerfMemDestroy { public static void main(String args[]) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PerfAllowAtExitRegistration", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+PerfAllowAtExitRegistration", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/PrintStringTableStats/PrintStringTableStatsTest.java b/test/hotspot/jtreg/runtime/PrintStringTableStats/PrintStringTableStatsTest.java index 1425e3e6eb1..4dfde2f1d0b 100644 --- a/test/hotspot/jtreg/runtime/PrintStringTableStats/PrintStringTableStatsTest.java +++ b/test/hotspot/jtreg/runtime/PrintStringTableStats/PrintStringTableStatsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -34,7 +34,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class PrintStringTableStatsTest { public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintStringTableStatistics", "--version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java b/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java index 36f74d01b54..e75e6643809 100644 --- a/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java +++ b/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -254,7 +254,7 @@ public class ReservedStackTest { // In order to dynamicaly determine if the platform supports the reserved // stack area, run with -XX:StackReservedPages=1 and see if we get the // expected warning message for platforms that don't support it. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:StackReservedPages=1", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:StackReservedPages=1", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("StackReservedPages=1 log: [" + output.getOutput() + "]"); if (output.getExitValue() != 0) { diff --git a/test/hotspot/jtreg/runtime/Safepoint/TestAbortOnVMOperationTimeout.java b/test/hotspot/jtreg/runtime/Safepoint/TestAbortOnVMOperationTimeout.java index 33de13f6c45..a2c3f944db8 100644 --- a/test/hotspot/jtreg/runtime/Safepoint/TestAbortOnVMOperationTimeout.java +++ b/test/hotspot/jtreg/runtime/Safepoint/TestAbortOnVMOperationTimeout.java @@ -63,7 +63,7 @@ public class TestAbortOnVMOperationTimeout { } public static void testWith(int delay, boolean shouldPass) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+AbortVMOnVMOperationTimeout", "-XX:AbortVMOnVMOperationTimeoutDelay=" + delay, diff --git a/test/hotspot/jtreg/runtime/Safepoint/TestAbortVMOnSafepointTimeout.java b/test/hotspot/jtreg/runtime/Safepoint/TestAbortVMOnSafepointTimeout.java index 55f1e30d5ef..c85dd657338 100644 --- a/test/hotspot/jtreg/runtime/Safepoint/TestAbortVMOnSafepointTimeout.java +++ b/test/hotspot/jtreg/runtime/Safepoint/TestAbortVMOnSafepointTimeout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -41,7 +41,7 @@ import jdk.test.whitebox.WhiteBox; public class TestAbortVMOnSafepointTimeout { public static void testThreadKilledOnSafepointTimeout() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", @@ -61,7 +61,7 @@ public class TestAbortVMOnSafepointTimeout { } public static void testGracePeriodAppliedBeforeVmAbort() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", diff --git a/test/hotspot/jtreg/runtime/StackTrace/LargeClassTest.java b/test/hotspot/jtreg/runtime/StackTrace/LargeClassTest.java index 5ef84f9ca95..d82b4b1f195 100644 --- a/test/hotspot/jtreg/runtime/StackTrace/LargeClassTest.java +++ b/test/hotspot/jtreg/runtime/StackTrace/LargeClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -45,7 +45,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class LargeClassTest implements Opcodes { public static void main(String... args) throws Exception { writeClassFile(); - ProcessBuilder pb = ProcessTools.createTestJvm("-cp", ".", "Large"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-cp", ".", "Large"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java b/test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java index b4e5e6b514b..a10f4193234 100644 --- a/test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java +++ b/test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -90,7 +90,7 @@ public class TestAlwaysPreTouchStacks { } else { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-Xmx100M", "-XX:+AlwaysPreTouchStacks", diff --git a/test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java b/test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java index 1ad74dbec0f..aecf3fdb5a6 100644 --- a/test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java +++ b/test/hotspot/jtreg/runtime/Thread/TestBreakSignalThreadDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2022, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -67,7 +67,7 @@ public class TestBreakSignalThreadDump { public static void main(String[] argv) throws Exception { String main = "TestBreakSignalThreadDump$TestProcess"; - ProcessBuilder pb = ProcessTools.createTestJvm("-Djava.library.path=" + Utils.TEST_NATIVE_PATH, main); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-Djava.library.path=" + Utils.TEST_NATIVE_PATH, main); if (argv.length > 0 && argv[0].equals("load_libjsig")) { prepend_jsig_lib(pb.environment()); diff --git a/test/hotspot/jtreg/runtime/Thread/TooSmallStackSize.java b/test/hotspot/jtreg/runtime/Thread/TooSmallStackSize.java index 88099b44ab2..09db906b151 100644 --- a/test/hotspot/jtreg/runtime/Thread/TooSmallStackSize.java +++ b/test/hotspot/jtreg/runtime/Thread/TooSmallStackSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -94,14 +94,14 @@ public class TooSmallStackSize { static ProcessBuilder createProcessWithOptions(String stackOption, String stackSize) throws Exception { if (testShadowSize == null) { - return ProcessTools.createJavaProcessBuilder( + return ProcessTools.createLimitedTestJavaProcessBuilder( stackOption + stackSize, // Uncomment the following to get log output // that shows actual thread creation sizes. // "-Xlog:os+thread", "-version"); } else { - return ProcessTools.createJavaProcessBuilder( + return ProcessTools.createLimitedTestJavaProcessBuilder( stackOption + stackSize, // Uncomment the following to get log output // that shows actual thread creation sizes. diff --git a/test/hotspot/jtreg/runtime/Throwable/StackTraceLogging.java b/test/hotspot/jtreg/runtime/Throwable/StackTraceLogging.java index 1482037b28f..ef63dc942f1 100644 --- a/test/hotspot/jtreg/runtime/Throwable/StackTraceLogging.java +++ b/test/hotspot/jtreg/runtime/Throwable/StackTraceLogging.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -51,11 +51,11 @@ public class StackTraceLogging { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:stacktrace=info", - "-XX:MaxJavaStackTraceDepth=1024", - "--add-opens", - "java.base/java.lang=ALL-UNNAMED", - "TestThrowable"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:stacktrace=info", + "-XX:MaxJavaStackTraceDepth=1024", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + "TestThrowable"); analyzeOutputOn(pb); } } diff --git a/test/hotspot/jtreg/runtime/Throwable/TestCatchThrowableOOM.java b/test/hotspot/jtreg/runtime/Throwable/TestCatchThrowableOOM.java index 36fedc0bd2d..b7c261afbd0 100644 --- a/test/hotspot/jtreg/runtime/Throwable/TestCatchThrowableOOM.java +++ b/test/hotspot/jtreg/runtime/Throwable/TestCatchThrowableOOM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,10 +43,10 @@ public class TestCatchThrowableOOM { }; public static void main(String[] args) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx64m", - "-Xlog:exceptions=trace", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx64m", + "-Xlog:exceptions=trace", - "TestCatchThrowableOOM$OOM"); + "TestCatchThrowableOOM$OOM"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); for (String msg : expected) { diff --git a/test/hotspot/jtreg/runtime/Throwable/TestMaxJavaStackTraceDepth.java b/test/hotspot/jtreg/runtime/Throwable/TestMaxJavaStackTraceDepth.java index 92e57718608..95f29ee2eb6 100644 --- a/test/hotspot/jtreg/runtime/Throwable/TestMaxJavaStackTraceDepth.java +++ b/test/hotspot/jtreg/runtime/Throwable/TestMaxJavaStackTraceDepth.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -79,11 +79,11 @@ public class TestMaxJavaStackTraceDepth { int[] depths = {0, 20, 1024}; for (int d : depths) { System.out.println("running test with -XX:MaxJavaStackTraceDepth=" + d); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:stacktrace=info", - "-XX:MaxJavaStackTraceDepth=" + d, - "--add-opens", - "java.base/java.lang=ALL-UNNAMED", - "TestMaxJavaStackTraceDepth"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:stacktrace=info", + "-XX:MaxJavaStackTraceDepth=" + d, + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + "TestMaxJavaStackTraceDepth"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); if (d == 0) { // Should get all the elements in stack trace diff --git a/test/hotspot/jtreg/runtime/Unsafe/RangeCheck.java b/test/hotspot/jtreg/runtime/Unsafe/RangeCheck.java index 2f9ae3fddff..788b96fb22e 100644 --- a/test/hotspot/jtreg/runtime/Unsafe/RangeCheck.java +++ b/test/hotspot/jtreg/runtime/Unsafe/RangeCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ import jdk.internal.misc.Unsafe; public class RangeCheck { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-Xmx128m", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:-CreateCoredumpOnCrash", diff --git a/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java b/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java index 03d5d885e45..aae401df963 100644 --- a/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java +++ b/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -61,14 +61,14 @@ public class XCheckJSig { throw new RuntimeException("File libjsig not found, path: " + libjsig); } - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xcheck:jni", "-version"); Map env = pb.environment(); env.put(env_var, libjsig); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("libjsig is activated"); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-verbose:jni", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xcheck:jni", "-verbose:jni", "-version"); env = pb.environment(); env.put(env_var, libjsig); output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java b/test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java index b1aab5d3371..08665415764 100644 --- a/test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java +++ b/test/hotspot/jtreg/runtime/cds/MaxMetaspaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -52,7 +52,7 @@ public class MaxMetaspaceSize { } String msg = "OutOfMemoryError: ((Metaspace)|(Compressed class space))"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(processArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(processArgs); CDSTestUtils.executeAndLog(pb, "dump").shouldMatch(msg).shouldHaveExitValue(1); } } diff --git a/test/hotspot/jtreg/runtime/cds/SharedStrings.java b/test/hotspot/jtreg/runtime/cds/SharedStrings.java index bda830401f0..33a041bb298 100644 --- a/test/hotspot/jtreg/runtime/cds/SharedStrings.java +++ b/test/hotspot/jtreg/runtime/cds/SharedStrings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ public class SharedStrings { // This also serves as a reference on how to use this feature, // hence the command lines are spelled out instead of using the // test utils methods. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SharedStrings.jsa", "-Xlog:cds,cds+hashtables", @@ -56,7 +56,7 @@ public class SharedStrings { CDSTestUtils.checkDump(out, "Shared string table stats"); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SharedStrings.jsa", // needed for access to white box test API diff --git a/test/hotspot/jtreg/runtime/cds/TestCDSVMCrash.java b/test/hotspot/jtreg/runtime/cds/TestCDSVMCrash.java index 1a13e30f33a..183b1c3afcf 100644 --- a/test/hotspot/jtreg/runtime/cds/TestCDSVMCrash.java +++ b/test/hotspot/jtreg/runtime/cds/TestCDSVMCrash.java @@ -49,7 +49,7 @@ } } // else this is the main test - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+CrashOnOutOfMemoryError", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+CrashOnOutOfMemoryError", "-XX:-CreateCoredumpOnCrash", "-Xmx128m", "-Xshare:on", TestCDSVMCrash.class.getName(),"throwOOME"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); // executeAndLog should throw an exception in the VM crashed diff --git a/test/hotspot/jtreg/runtime/cds/appcds/CommandLineFlagCombo.java b/test/hotspot/jtreg/runtime/cds/appcds/CommandLineFlagCombo.java index 7b4a03850b8..8e33bf0bb0c 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/CommandLineFlagCombo.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/CommandLineFlagCombo.java @@ -163,7 +163,7 @@ public class CommandLineFlagCombo { } String[] args = new String[] { "-cp", jarFile, "-XX:ArchiveClassesAtExit=" + dynName, "-XX:DumpLoadedClassList=" + dumpedListName, "Hello"}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer output = TestCommon.executeAndLog(pb, "combo"); output.shouldHaveExitValue(0) .shouldContain(HELLO_WORLD); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/FillerObjectLoadTest.java b/test/hotspot/jtreg/runtime/cds/appcds/FillerObjectLoadTest.java index 97511db815f..d53120fc1b1 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/FillerObjectLoadTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/FillerObjectLoadTest.java @@ -35,14 +35,14 @@ import jdk.test.lib.process.ProcessTools; public class FillerObjectLoadTest { public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UseCompressedClassPointers", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseEpsilonGC", "-Xshare:dump", "-XX:SharedArchiveFile=" + TestCommon.getNewArchiveName()); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); analyzer.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+IgnoreUnrecognizedVMOptions", "-XX:-UseCompressedClassPointers", "-XX:TLABSize=2048", "-Xshare:dump", "-XX:SharedArchiveFile=" + TestCommon.getNewArchiveName()); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java index 317d6767046..007d9fb4c2c 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -300,7 +300,7 @@ public class TestCommon extends CDSTestUtils { } } - ProcessBuilder pb = ProcessTools.createTestJvm(cmd); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmd); if (opts.appJarDir != null) { pb.directory(new File(opts.appJarDir)); } @@ -447,7 +447,7 @@ public class TestCommon extends CDSTestUtils { } } - ProcessBuilder pb = ProcessTools.createTestJvm(cmd); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmd); if (opts.appJarDir != null) { pb.directory(new File(opts.appJarDir)); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/TestDumpClassListSource.java b/test/hotspot/jtreg/runtime/cds/appcds/TestDumpClassListSource.java index 647e44bc455..17634e9a31e 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/TestDumpClassListSource.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/TestDumpClassListSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -112,7 +112,7 @@ public class TestDumpClassListSource { "-cp", jarFile, mainInvokeClass}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(launchArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); OutputAnalyzer output = TestCommon.executeAndLog(pb, "invoke-class"); checkFileExistence("Archive", fileArchive); @@ -137,7 +137,7 @@ public class TestDumpClassListSource { jarFile, mainCutomClass, "1"}; - pb = ProcessTools.createJavaProcessBuilder(launchArgs); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); output = TestCommon.executeAndLog(pb, "custom-nosource"); checkFileExistence("Archive", fileArchive); @@ -163,7 +163,7 @@ public class TestDumpClassListSource { jarFile, mainCutomClass, "2"}; - pb = ProcessTools.createJavaProcessBuilder(launchArgs); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); output = TestCommon.executeAndLog(pb, "custom-nosource"); checkFileExistence("Archive", fileArchive); @@ -184,7 +184,7 @@ public class TestDumpClassListSource { jarFile, mainCutomClass, "3"}; - pb = ProcessTools.createJavaProcessBuilder(launchArgs); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); output = TestCommon.executeAndLog(pb, "custom-dump-classlist"); checkFileExistence("ClassList", fileList); @@ -205,7 +205,7 @@ public class TestDumpClassListSource { jarFile, mainCutomClass, "3"}; - pb = ProcessTools.createJavaProcessBuilder(launchArgs); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); output = TestCommon.executeAndLog(pb, "custom-dump"); checkFileExistence("Archive", archiveFile); @@ -225,7 +225,7 @@ public class TestDumpClassListSource { jarFile, mainCutomClass, "3"}; - pb = ProcessTools.createJavaProcessBuilder(launchArgs); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); output = TestCommon.executeAndLog(pb, "custom-share"); checkFileExistence("ClassList", newFile); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/VerifyWithDefaultArchive.java b/test/hotspot/jtreg/runtime/cds/appcds/VerifyWithDefaultArchive.java index aa65bb38b1c..6835adf33f3 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/VerifyWithDefaultArchive.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/VerifyWithDefaultArchive.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class VerifyWithDefaultArchive { public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:cds", "-XX:+VerifySharedSpaces", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:cds", "-XX:+VerifySharedSpaces", "-version"); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldNotContain("relocation bitmap CRC error"); out.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicArchiveTestBase.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicArchiveTestBase.java index f35ffbf5d00..108002246db 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicArchiveTestBase.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicArchiveTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -261,7 +261,7 @@ class DynamicArchiveTestBase { if (!executedIn_run) { throw new Exception("Test error: dynamic archive tests must be executed via DynamicArchiveTestBase.run()"); } - ProcessBuilder pb = ProcessTools.createTestJvm(cmdLine); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmdLine); if (jarDir != null) { pb.directory(new File(jarDir)); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdasInTwoArchives.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdasInTwoArchives.java index 8c66225b95f..0c9c2514e40 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdasInTwoArchives.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdasInTwoArchives.java @@ -93,7 +93,7 @@ public class LambdasInTwoArchives extends DynamicArchiveTestBase { "-Xlog:cds", "-Xlog:cds+lambda", "-cp", appJar, mainClass}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(launchArgs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(launchArgs); OutputAnalyzer oa = TestCommon.executeAndLog(pb, "lambda-classes"); oa.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTestDynamicDump.java b/test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTestDynamicDump.java index 65e8b090dda..228948f3ebd 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTestDynamicDump.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jcmd/JCmdTestDynamicDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -133,7 +133,7 @@ public class JCmdTestDynamicDump extends JCmdTestDumpBase { private static void dumpStaticArchive(String archiveFile) throws Exception { String javapath = JDKToolFinder.getJDKTool("java"); String cmd[] = {javapath, "-Xshare:dump", "-XX:SharedArchiveFile=" + archiveFile}; - // Do not use ProcessTools.createTestJvm(cmd) here, it copies jtreg env. + // Do not use ProcessTools.createTestJavaProcessBuilder(cmd) here, it copies jtreg env. ProcessBuilder pb = new ProcessBuilder(cmd); CDSTestUtils.executeAndLog(pb, "dump") .shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/ResolvedReferencesNotNullTest.java b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/ResolvedReferencesNotNullTest.java index 005a1f78e0b..bdd5ad9ec7e 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/ResolvedReferencesNotNullTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/ResolvedReferencesNotNullTest.java @@ -42,14 +42,14 @@ public class ResolvedReferencesNotNullTest { String appJar = TestCommon.getTestJar(SharedStringsUtils.TEST_JAR_NAME_FULL); String whiteboxParam = SharedStringsUtils.getWbParam(); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-cp", - appJar, - whiteboxParam, - "-XX:+UnlockDiagnosticVMOptions", - "-XX:+WhiteBoxAPI", - "ResolvedReferencesWb", - "false" // ResolvedReferencesTestApp is not archived - ); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-cp", + appJar, + whiteboxParam, + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+WhiteBoxAPI", + "ResolvedReferencesWb", + "false" // ResolvedReferencesTestApp is not archived + ); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java b/test/hotspot/jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java index 215887f7bb3..1baf5bdc8a8 100644 --- a/test/hotspot/jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java +++ b/test/hotspot/jtreg/runtime/classFileParserBug/Bad_NCDFE_Msg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -39,7 +39,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class Bad_NCDFE_Msg { public static void main(String args[]) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-cp", System.getProperty("test.classes") + File.separator + "pkg", "C"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("java.lang.NoClassDefFoundError: C (wrong name: pkg/C"); diff --git a/test/hotspot/jtreg/runtime/classFileParserBug/ClassFileParserBug.java b/test/hotspot/jtreg/runtime/classFileParserBug/ClassFileParserBug.java index 31dde4d3adf..bac36378d2e 100644 --- a/test/hotspot/jtreg/runtime/classFileParserBug/ClassFileParserBug.java +++ b/test/hotspot/jtreg/runtime/classFileParserBug/ClassFileParserBug.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -41,7 +41,7 @@ public class ClassFileParserBug { public static void main(String args[]) throws Throwable { System.out.println("Regression test for bug 8040018"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("LambdaMath"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("LambdaMath"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("java.lang.ClassFormatError: Bad length on BootstrapMethods"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/classFileParserBug/TestBadPackageWithInterface.java b/test/hotspot/jtreg/runtime/classFileParserBug/TestBadPackageWithInterface.java index f7028990b05..35abee5ce3e 100644 --- a/test/hotspot/jtreg/runtime/classFileParserBug/TestBadPackageWithInterface.java +++ b/test/hotspot/jtreg/runtime/classFileParserBug/TestBadPackageWithInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import jdk.test.lib.process.ProcessTools; public class TestBadPackageWithInterface { public static void main(String args[]) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-cp", System.getProperty("test.classes"), "-XX:+UnlockDiagnosticVMOptions", "-XX:+VerifyBeforeExit", MyLoader.class.getName()); diff --git a/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java b/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java index ea91f54da83..53c85d53c44 100644 --- a/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java +++ b/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -50,7 +50,7 @@ public class TestEmptyBootstrapMethodsAttr { // ======= execute test case #1 // Expect a lack of main method, this implies that the class loaded correctly // with an empty bootstrap_methods and did not generate a ClassFormatError. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Duser.language=en", "-Duser.country=US", className); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("java.lang.ClassFormatError"); @@ -65,7 +65,7 @@ public class TestEmptyBootstrapMethodsAttr { // ======= execute test case #2 // Expect a lack of main method, this implies that the class loaded correctly // with an empty bootstrap_methods and did not generate ClassFormatError. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Duser.language=en", "-Duser.country=US", className); output = new OutputAnalyzer(pb.start()); output.shouldNotContain("java.lang.ClassFormatError"); diff --git a/test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java b/test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java index 4ae0eaa0df3..a07c98caa66 100644 --- a/test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java +++ b/test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class BadBSMUseTest { public static void main(String args[]) throws Throwable { // 1. Test a CONSTANT_Dynamic_info's bootstrap_method_attr_index points // at a BSM meant for a CONSTANT_InvokeDynamic_info - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("CondyUsesIndyBSM"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("CondyUsesIndyBSM"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldContain("In Indybsm target CallSite method foo"); oa.shouldContain("BootstrapMethodError: bootstrap method initialization exception"); @@ -50,7 +50,7 @@ public class BadBSMUseTest { // 2. Test a CONSTANT_InvokeDynamic_info's bootstrap_method_attr_index points // at a BSM meant for a CONSTANT_Dynamic_info - pb = ProcessTools.createJavaProcessBuilder("IndyUsesCondyBSM"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("IndyUsesCondyBSM"); oa = new OutputAnalyzer(pb.start()); oa.shouldContain("In Condybsm"); oa.shouldContain("BootstrapMethodError: bootstrap method initialization exception"); diff --git a/test/hotspot/jtreg/runtime/condy/CondyLDCTest.java b/test/hotspot/jtreg/runtime/condy/CondyLDCTest.java index ef26a6bf674..22cfb727eb8 100644 --- a/test/hotspot/jtreg/runtime/condy/CondyLDCTest.java +++ b/test/hotspot/jtreg/runtime/condy/CondyLDCTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,16 +42,16 @@ public class CondyLDCTest { public static void main(String args[]) throws Throwable { // 1. Test a ldc_w instruction can be used with condy's which generate // loadable constants of the following types: byte, char, short, float, integer, boolean. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xverify:all", - "CondyUseLDC_W"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xverify:all", + "CondyUseLDC_W"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldNotContain("VerifyError"); oa.shouldHaveExitValue(0); // 2. Test ldc2_w of a condy which returns a dynamically generated // float constant, generates a VerifyError. - pb = ProcessTools.createJavaProcessBuilder("-Xverify:all", - "CondyBadLDC2_W"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xverify:all", + "CondyBadLDC2_W"); oa = new OutputAnalyzer(pb.start()); oa.shouldContain("java.lang.VerifyError: Illegal type at constant pool entry"); oa.shouldContain("CondyBadLDC2_W.F()F @0: ldc2_w"); @@ -59,8 +59,8 @@ public class CondyLDCTest { // 3. Test a ldc of a condy which returns a dynamically generated // double constant, generates a VerifyError. - pb = ProcessTools.createJavaProcessBuilder("-Xverify:all", - "CondyBadLDC"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xverify:all", + "CondyBadLDC"); oa = new OutputAnalyzer(pb.start()); oa.shouldContain("java.lang.VerifyError: Illegal type at constant pool entry"); oa.shouldContain("CondyBadLDC.D()D @0: ldc"); diff --git a/test/hotspot/jtreg/runtime/condy/CondyNewInvokeSpecialTest.java b/test/hotspot/jtreg/runtime/condy/CondyNewInvokeSpecialTest.java index 2de9e728666..6e810d0d3b8 100644 --- a/test/hotspot/jtreg/runtime/condy/CondyNewInvokeSpecialTest.java +++ b/test/hotspot/jtreg/runtime/condy/CondyNewInvokeSpecialTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ import jdk.test.lib.compiler.InMemoryJavaCompiler; public class CondyNewInvokeSpecialTest { public static void main(String args[]) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xverify:all", - "CondyNewInvokeSpecial"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xverify:all", + "CondyNewInvokeSpecial"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldContain("In CondyNewInvokeSpecial method"); oa.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java index cb4b6960cf9..877a805c445 100644 --- a/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java +++ b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ public class TestEscapeCondy { public static void main(String args[]) throws Throwable { // 1. Test escape analysis of a method that contains // a ldc instruction of a condy whose return type is an array of boolean - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:CompileCommand=dontinline,runtime.condy.TestEscapeThroughInvokeWithCondy::create", "runtime.condy.TestEscapeThroughInvokeWithCondy"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java b/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java index c8b8aeba22e..2b572edb66f 100644 --- a/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java +++ b/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestInitException { public static void main(java.lang.String[] unused) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("Example"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("Example"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); // First call stack trace // shouldMatch is used to workaround CODETOOLS-7902686 diff --git a/test/hotspot/jtreg/runtime/contended/Options.java b/test/hotspot/jtreg/runtime/contended/Options.java index ea7261c229a..f646b152921 100644 --- a/test/hotspot/jtreg/runtime/contended/Options.java +++ b/test/hotspot/jtreg/runtime/contended/Options.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,59 +40,59 @@ public class Options { ProcessBuilder pb; OutputAnalyzer output; - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-128", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=-128", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("ContendedPaddingWidth"); output.shouldContain("outside the allowed range"); output.shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-8", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=-8", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("ContendedPaddingWidth"); output.shouldContain("outside the allowed range"); output.shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-1", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=-1", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("ContendedPaddingWidth"); output.shouldContain("outside the allowed range"); output.shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=0", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=0", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=1", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=1", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("ContendedPaddingWidth"); output.shouldContain("must be a multiple of 8"); output.shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=8", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8184", "-version"); // 8192-8 = 8184 + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=8184", "-version"); // 8192-8 = 8184 output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8191", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=8191", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("ContendedPaddingWidth"); output.shouldContain("must be a multiple of 8"); output.shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8192", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=8192", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8193", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=8193", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("ContendedPaddingWidth"); output.shouldContain("outside the allowed range"); output.shouldHaveExitValue(1); - pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8200", "-version"); // 8192+8 = 8200 + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:ContendedPaddingWidth=8200", "-version"); // 8192+8 = 8200 output = new OutputAnalyzer(pb.start()); output.shouldContain("ContendedPaddingWidth"); output.shouldContain("outside the allowed range"); diff --git a/test/hotspot/jtreg/runtime/duplAttributes/DuplAttributesTest.java b/test/hotspot/jtreg/runtime/duplAttributes/DuplAttributesTest.java index aebc9d0a899..4116c91705f 100644 --- a/test/hotspot/jtreg/runtime/duplAttributes/DuplAttributesTest.java +++ b/test/hotspot/jtreg/runtime/duplAttributes/DuplAttributesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -41,7 +41,7 @@ public class DuplAttributesTest { static final String testsrc = System.getProperty("test.src"); public static void runTest(String test, String result) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(test); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(test); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("java.lang.ClassFormatError: Multiple " + result); output.shouldNotHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/execstack/Testexecstack.java b/test/hotspot/jtreg/runtime/execstack/Testexecstack.java index 7af23d7a41e..3c690d54a23 100644 --- a/test/hotspot/jtreg/runtime/execstack/Testexecstack.java +++ b/test/hotspot/jtreg/runtime/execstack/Testexecstack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -47,7 +47,7 @@ public class Testexecstack { // Create a new java process for the Test Java/JNI test without // an executeable stack - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Djava.library.path=" + libpath + ":.", "Test", "test-rw"); // Start the process and check the output @@ -56,7 +56,7 @@ public class Testexecstack { // Create a new java process for the Test Java/JNI test with an // executable stack - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Djava.library.path=" + libpath + ":.", "Test", "test-rwx"); // Start the process and check the output @@ -65,7 +65,7 @@ public class Testexecstack { // Create a new java process for the TestMT Java/JNI test with an // executable stack - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Djava.library.path=" + libpath + ":.", "TestMT", "test-rwx"); // Start the process and check the output diff --git a/test/hotspot/jtreg/runtime/getSysPackage/GetPackageXbootclasspath.java b/test/hotspot/jtreg/runtime/getSysPackage/GetPackageXbootclasspath.java index db4d26f801b..ae1f86cc7c1 100644 --- a/test/hotspot/jtreg/runtime/getSysPackage/GetPackageXbootclasspath.java +++ b/test/hotspot/jtreg/runtime/getSysPackage/GetPackageXbootclasspath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -54,7 +54,7 @@ public class GetPackageXbootclasspath { ClassFileInstaller.writeClassToDisk("P/Test", InMemoryJavaCompiler.compile("P.Test", Test_src), test_classes); - new OutputAnalyzer(ProcessTools.createJavaProcessBuilder( + new OutputAnalyzer(ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:" + test_classes, "P.Test") .start()).shouldContain("Test Passed") .shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/getSysPackage/GetSysPkgTest.java b/test/hotspot/jtreg/runtime/getSysPackage/GetSysPkgTest.java index a6e5d40db3d..0cd3e371d8b 100644 --- a/test/hotspot/jtreg/runtime/getSysPackage/GetSysPkgTest.java +++ b/test/hotspot/jtreg/runtime/getSysPackage/GetSysPkgTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -101,7 +101,7 @@ public class GetSysPkgTest { InMemoryJavaCompiler.compile("GetSysPkg_package.GetSysClass", source); ClassFileInstaller.writeClassToDisk("GetSysPkg_package/GetSysClass", klassbuf); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/a:bl_dir", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xbootclasspath/a:bl_dir", "--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED", "-cp", "." + File.pathSeparator + System.getProperty("test.classes"), "GetSysPkgTest", "do_tests"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/handshake/HandshakeTimeoutTest.java b/test/hotspot/jtreg/runtime/handshake/HandshakeTimeoutTest.java index b92ff56da9a..a1a5ff68c31 100644 --- a/test/hotspot/jtreg/runtime/handshake/HandshakeTimeoutTest.java +++ b/test/hotspot/jtreg/runtime/handshake/HandshakeTimeoutTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import jdk.test.whitebox.WhiteBox; public class HandshakeTimeoutTest { public static void main(String[] args) throws Exception { ProcessBuilder pb = - ProcessTools.createTestJvm( + ProcessTools.createTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", diff --git a/test/hotspot/jtreg/runtime/handshake/HandshakeTransitionTest.java b/test/hotspot/jtreg/runtime/handshake/HandshakeTransitionTest.java index b8e03763e2b..5480b495a2d 100644 --- a/test/hotspot/jtreg/runtime/handshake/HandshakeTransitionTest.java +++ b/test/hotspot/jtreg/runtime/handshake/HandshakeTransitionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -52,7 +52,7 @@ public class HandshakeTransitionTest { commands.add("-XX:CICompilerCount=2"); commands.addAll(Arrays.asList(args)); commands.add("HandshakeTransitionTest$Test"); - ProcessBuilder pb = ProcessTools.createTestJvm(commands); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(commands); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.reportDiagnosticSummary(); diff --git a/test/hotspot/jtreg/runtime/handshake/SystemMembarHandshakeTransitionTest.java b/test/hotspot/jtreg/runtime/handshake/SystemMembarHandshakeTransitionTest.java index 0c02c40eae5..0f0e5b90e85 100644 --- a/test/hotspot/jtreg/runtime/handshake/SystemMembarHandshakeTransitionTest.java +++ b/test/hotspot/jtreg/runtime/handshake/SystemMembarHandshakeTransitionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -54,7 +54,7 @@ public class SystemMembarHandshakeTransitionTest { commands.add("-XX:+UseSystemMemoryBarrier"); commands.addAll(Arrays.asList(args)); commands.add("HandshakeTransitionTest$Test"); - ProcessBuilder pb = ProcessTools.createTestJvm(commands); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(commands); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.reportDiagnosticSummary(); diff --git a/test/hotspot/jtreg/runtime/jni/checked/TestCheckedReleaseArrayElements.java b/test/hotspot/jtreg/runtime/jni/checked/TestCheckedReleaseArrayElements.java index 038136b74be..6395e3b9f0b 100644 --- a/test/hotspot/jtreg/runtime/jni/checked/TestCheckedReleaseArrayElements.java +++ b/test/hotspot/jtreg/runtime/jni/checked/TestCheckedReleaseArrayElements.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -48,9 +48,9 @@ public class TestCheckedReleaseArrayElements { // Uses executeProcess() instead of executeTestJvm() to avoid passing options // that might generate output on stderr (which should be empty for this test). ProcessBuilder pb = - ProcessTools.createJavaProcessBuilder("-Xcheck:jni", - "-Djava.library.path=" + Utils.TEST_NATIVE_PATH, - "TestCheckedReleaseArrayElements"); + ProcessTools.createLimitedTestJavaProcessBuilder("-Xcheck:jni", + "-Djava.library.path=" + Utils.TEST_NATIVE_PATH, + "TestCheckedReleaseArrayElements"); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); output.stderrShouldBeEmpty(); diff --git a/test/hotspot/jtreg/runtime/jni/checked/TestPrimitiveArrayCriticalWithBadParam.java b/test/hotspot/jtreg/runtime/jni/checked/TestPrimitiveArrayCriticalWithBadParam.java index ed5d6b052b2..53cba9d9e47 100644 --- a/test/hotspot/jtreg/runtime/jni/checked/TestPrimitiveArrayCriticalWithBadParam.java +++ b/test/hotspot/jtreg/runtime/jni/checked/TestPrimitiveArrayCriticalWithBadParam.java @@ -65,7 +65,7 @@ public class TestPrimitiveArrayCriticalWithBadParam { pbArgs.add(TestPrimitiveArrayCriticalWithBadParam.class.getName()); pbArgs.add(useVThread ? "vtest" : "test"); try { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(pbArgs.toArray(new String[0])); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(pbArgs.toArray(new String[0])); OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); // -Xcheck:jni should warn the bad parameter diff --git a/test/hotspot/jtreg/runtime/jsig/Testjsig.java b/test/hotspot/jtreg/runtime/jsig/Testjsig.java index 315ec3d1500..6e287a6cdc1 100644 --- a/test/hotspot/jtreg/runtime/jsig/Testjsig.java +++ b/test/hotspot/jtreg/runtime/jsig/Testjsig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ public class Testjsig { String libpath = System.getProperty("java.library.path"); // Create a new java process for the TestJNI Java/JNI test - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Djava.library.path=" + libpath + ":.", "TestJNI", "100"); diff --git a/test/hotspot/jtreg/runtime/logging/ClassInitializationTest.java b/test/hotspot/jtreg/runtime/logging/ClassInitializationTest.java index a2e1f0c94f5..34249e5fec8 100644 --- a/test/hotspot/jtreg/runtime/logging/ClassInitializationTest.java +++ b/test/hotspot/jtreg/runtime/logging/ClassInitializationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -41,10 +41,10 @@ public class ClassInitializationTest { public static void main(String... args) throws Exception { // (1) - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=info", - "-Xverify:all", - "-Xmx128m", - "BadMap50"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:class+init=info", + "-Xverify:all", + "-Xmx128m", + "BadMap50"); OutputAnalyzer out = new OutputAnalyzer(pb.start()); out.shouldNotHaveExitValue(0); out.shouldContain("Start class verification for:"); @@ -54,10 +54,10 @@ public class ClassInitializationTest { out.shouldContain("Fail over class verification to old verifier for: BadMap50"); // (2) class+init should turn off. - pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=off", - "-Xverify:all", - "-Xmx128m", - "BadMap50"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:class+init=off", + "-Xverify:all", + "-Xmx128m", + "BadMap50"); out = new OutputAnalyzer(pb.start()); out.shouldNotHaveExitValue(0); out.shouldNotContain("[class,init]"); diff --git a/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java b/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java index 3a9e03c05e1..4d59cfa89ab 100644 --- a/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java +++ b/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -74,7 +74,7 @@ public class ClassLoadUnloadTest { Collections.addAll(argsList, args); Collections.addAll(argsList, "-Xmn8m", "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-XX:+ClassUnloading", ClassUnloadTestMain.class.getName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(argsList); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(argsList); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); return output; diff --git a/test/hotspot/jtreg/runtime/logging/ClassResolutionTest.java b/test/hotspot/jtreg/runtime/logging/ClassResolutionTest.java index 05155e5108f..129d34bd2db 100644 --- a/test/hotspot/jtreg/runtime/logging/ClassResolutionTest.java +++ b/test/hotspot/jtreg/runtime/logging/ClassResolutionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -60,17 +60,17 @@ public class ClassResolutionTest { public static void main(String... args) throws Exception { // (1) class+resolve should turn on. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+resolve=debug", - ClassResolutionTestMain.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:class+resolve=debug", + ClassResolutionTestMain.class.getName()); OutputAnalyzer o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); o.shouldContain("[class,resolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1"); o.shouldContain("[class,resolve] resolve JVM_CONSTANT_MethodHandle"); // (2) class+resolve should turn off. - pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+resolve=debug", - "-Xlog:class+resolve=off", - ClassResolutionTestMain.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:class+resolve=debug", + "-Xlog:class+resolve=off", + ClassResolutionTestMain.class.getName()); o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); o.shouldNotContain("[class,resolve]"); diff --git a/test/hotspot/jtreg/runtime/logging/CompressedOopsTest.java b/test/hotspot/jtreg/runtime/logging/CompressedOopsTest.java index ee1a4997900..79167f581e7 100644 --- a/test/hotspot/jtreg/runtime/logging/CompressedOopsTest.java +++ b/test/hotspot/jtreg/runtime/logging/CompressedOopsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -51,20 +51,20 @@ public class CompressedOopsTest { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseCompressedOops", - "-Xlog:gc+heap+coops=debug", - InnerClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseCompressedOops", + "-Xlog:gc+heap+coops=debug", + InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseCompressedOops", - "-Xlog:gc+heap+coops", - InnerClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseCompressedOops", + "-Xlog:gc+heap+coops", + InnerClass.class.getName()); // No coops logging on info level. analyzeOutputOff(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseCompressedOops", - "-Xlog:gc+heap+coops=off", - InnerClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UseCompressedOops", + "-Xlog:gc+heap+coops=off", + InnerClass.class.getName()); analyzeOutputOff(pb); } diff --git a/test/hotspot/jtreg/runtime/logging/CondyIndyTest.java b/test/hotspot/jtreg/runtime/logging/CondyIndyTest.java index f94f5e5cb20..c62402c918b 100644 --- a/test/hotspot/jtreg/runtime/logging/CondyIndyTest.java +++ b/test/hotspot/jtreg/runtime/logging/CondyIndyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,8 +40,8 @@ public class CondyIndyTest { public static void main(String... args) throws Exception { // (1) methodhandles should turn on, no indy, no condy - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:methodhandles", - "CondyIndy"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:methodhandles", + "CondyIndy"); OutputAnalyzer o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); o.shouldContain("[info][methodhandles"); @@ -49,8 +49,8 @@ public class CondyIndyTest { o.shouldNotContain("[debug][methodhandles,condy"); // (2) methodhandles+condy=debug only - pb = ProcessTools.createJavaProcessBuilder("-Xlog:methodhandles+condy=debug", - "CondyIndy"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:methodhandles+condy=debug", + "CondyIndy"); o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); o.shouldNotContain("[info ][methodhandles"); @@ -58,8 +58,8 @@ public class CondyIndyTest { o.shouldContain("[debug][methodhandles,condy"); // (3) methodhandles+indy=debug only - pb = ProcessTools.createJavaProcessBuilder("-Xlog:methodhandles+indy=debug", - "CondyIndy"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:methodhandles+indy=debug", + "CondyIndy"); o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); o.shouldNotContain("[info ][methodhandles"); @@ -67,10 +67,10 @@ public class CondyIndyTest { o.shouldNotContain("[debug][methodhandles,condy"); // (4) methodhandles, condy, indy all on - pb = ProcessTools.createJavaProcessBuilder("-Xlog:methodhandles=info", - "-Xlog:methodhandles+condy=debug", - "-Xlog:methodhandles+indy=debug", - "CondyIndy"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:methodhandles=info", + "-Xlog:methodhandles+condy=debug", + "-Xlog:methodhandles+indy=debug", + "CondyIndy"); o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); o.shouldContain("[info ][methodhandles"); diff --git a/test/hotspot/jtreg/runtime/logging/DefaultMethodsTest.java b/test/hotspot/jtreg/runtime/logging/DefaultMethodsTest.java index 2ea7e6bb07a..d41d6685c23 100644 --- a/test/hotspot/jtreg/runtime/logging/DefaultMethodsTest.java +++ b/test/hotspot/jtreg/runtime/logging/DefaultMethodsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -37,8 +37,8 @@ import jdk.test.lib.process.ProcessTools; public class DefaultMethodsTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:defaultmethods=debug", - InnerClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:defaultmethods=debug", + InnerClass.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Slots that need filling:"); output.shouldContain("requires default method processing"); diff --git a/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java b/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java index 976478253ee..327b1cc0f24 100644 --- a/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java +++ b/test/hotspot/jtreg/runtime/logging/ExceptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -57,25 +57,25 @@ public class ExceptionsTest { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:exceptions=info", - InternalClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:exceptions=info", + InternalClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:exceptions=off", - InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:exceptions=off", + InternalClass.class.getName()); analyzeOutputOff(pb); - pb = ProcessTools.createJavaProcessBuilder(InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(InternalClass.class.getName()); updateEnvironment(pb, "_JAVA_OPTIONS", "-Xlog:exceptions=info"); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder(InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(InternalClass.class.getName()); updateEnvironment(pb, "JAVA_TOOL_OPTIONS", "-Xlog:exceptions=info -Xlog:exceptions=off"); analyzeOutputOff(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:VMOptionsFile=" + System.getProperty("test.src", ".") - + File.separator + "ExceptionsTest_options_file", - InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:VMOptionsFile=" + System.getProperty("test.src", ".") + + File.separator + "ExceptionsTest_options_file", + InternalClass.class.getName()); analyzeOutputOn(pb); } diff --git a/test/hotspot/jtreg/runtime/logging/FoldMultilinesTest.java b/test/hotspot/jtreg/runtime/logging/FoldMultilinesTest.java index 1ae9f2c21d0..8df835245c8 100644 --- a/test/hotspot/jtreg/runtime/logging/FoldMultilinesTest.java +++ b/test/hotspot/jtreg/runtime/logging/FoldMultilinesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021 NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -79,15 +79,15 @@ public class FoldMultilinesTest { ProcessBuilder pb; Xlog = XLOG_BASE + out + "::foldmultilines=true"; - pb = ProcessTools.createJavaProcessBuilder(Xlog, InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(Xlog, InternalClass.class.getName()); analyzeFoldMultilinesOn(pb, out); Xlog = XLOG_BASE + out + "::foldmultilines=false"; - pb = ProcessTools.createJavaProcessBuilder(Xlog, InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(Xlog, InternalClass.class.getName()); analyzeFoldMultilinesOff(pb, out); Xlog = XLOG_BASE + out + "::foldmultilines=invalid"; - pb = ProcessTools.createJavaProcessBuilder(Xlog, InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(Xlog, InternalClass.class.getName()); analyzeFoldMultilinesInvalid(pb); } diff --git a/test/hotspot/jtreg/runtime/logging/ItablesTest.java b/test/hotspot/jtreg/runtime/logging/ItablesTest.java index 009986285a4..6869e5b2917 100644 --- a/test/hotspot/jtreg/runtime/logging/ItablesTest.java +++ b/test/hotspot/jtreg/runtime/logging/ItablesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -41,7 +41,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class ItablesTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ClassB"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:itables=trace", "ClassB"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain(": Initializing itables for ClassB"); output.shouldContain(": Initializing itable indices for interface "); @@ -53,7 +53,7 @@ public class ItablesTest { output.shouldContain("invokeinterface selected method: receiver-class"); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:itables=trace", "ItablesVtableTest"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:itables=trace", "ItablesVtableTest"); output = new OutputAnalyzer(pb.start()); output.shouldContain("vtable index "); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java b/test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java index 0661ae81446..39ad3b872a2 100644 --- a/test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java +++ b/test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -66,7 +66,7 @@ public class LoaderConstraintsTest { Collections.addAll(argsList, "-XX:+UnlockDiagnosticVMOptions"); Collections.addAll(argsList, "-XX:+WhiteBoxAPI"); Collections.addAll(argsList, ClassUnloadTestMain.class.getName()); - return ProcessTools.createJavaProcessBuilder(argsList); + return ProcessTools.createLimitedTestJavaProcessBuilder(argsList); } public static void main(String... args) throws Exception { diff --git a/test/hotspot/jtreg/runtime/logging/ModulesTest.java b/test/hotspot/jtreg/runtime/logging/ModulesTest.java index 5d30fa3a6a4..96292b1d5d2 100644 --- a/test/hotspot/jtreg/runtime/logging/ModulesTest.java +++ b/test/hotspot/jtreg/runtime/logging/ModulesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -75,7 +75,7 @@ public class ModulesTest { } static OutputAnalyzer run(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); return new OutputAnalyzer(pb.start()); } } diff --git a/test/hotspot/jtreg/runtime/logging/MonitorInflationTest.java b/test/hotspot/jtreg/runtime/logging/MonitorInflationTest.java index 85f025469b4..737c64621e8 100644 --- a/test/hotspot/jtreg/runtime/logging/MonitorInflationTest.java +++ b/test/hotspot/jtreg/runtime/logging/MonitorInflationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -51,12 +51,12 @@ public class MonitorInflationTest { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:monitorinflation=trace", - InnerClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:monitorinflation=trace", + InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:monitorinflation=off", - InnerClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:monitorinflation=off", + InnerClass.class.getName()); analyzeOutputOff(pb); } diff --git a/test/hotspot/jtreg/runtime/logging/MonitorMismatchTest.java b/test/hotspot/jtreg/runtime/logging/MonitorMismatchTest.java index ac54ab8c2ca..c3b9198b398 100644 --- a/test/hotspot/jtreg/runtime/logging/MonitorMismatchTest.java +++ b/test/hotspot/jtreg/runtime/logging/MonitorMismatchTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,19 +40,19 @@ public class MonitorMismatchTest { public static void main(String... args) throws Exception { // monitormismatch should turn on. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcomp", - "-XX:+TieredCompilation", - "-Xlog:monitormismatch=info", - "MonitorMismatchHelper"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xcomp", + "-XX:+TieredCompilation", + "-Xlog:monitormismatch=info", + "MonitorMismatchHelper"); OutputAnalyzer o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); o.shouldContain("[monitormismatch] Monitor mismatch in method"); // monitormismatch should turn off. - pb = ProcessTools.createJavaProcessBuilder("-Xcomp", - "-XX:+TieredCompilation", - "-Xlog:monitormismatch=off", - "MonitorMismatchHelper"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xcomp", + "-XX:+TieredCompilation", + "-Xlog:monitormismatch=off", + "MonitorMismatchHelper"); o = new OutputAnalyzer(pb.start()); o.shouldHaveExitValue(0); o.shouldNotContain("[monitormismatch]"); diff --git a/test/hotspot/jtreg/runtime/logging/MutexRankTest.java b/test/hotspot/jtreg/runtime/logging/MutexRankTest.java index d1d459ac002..9bf2459a651 100644 --- a/test/hotspot/jtreg/runtime/logging/MutexRankTest.java +++ b/test/hotspot/jtreg/runtime/logging/MutexRankTest.java @@ -36,8 +36,8 @@ import jdk.test.lib.Platform; public class MutexRankTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:vmmutex", - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:vmmutex", + "-version"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldContain("VM Mutex/Monitor ranks:"); if (Platform.isDebugBuild()) { diff --git a/test/hotspot/jtreg/runtime/logging/OsCpuLoggingTest.java b/test/hotspot/jtreg/runtime/logging/OsCpuLoggingTest.java index bf6e3faed59..a1141964f38 100644 --- a/test/hotspot/jtreg/runtime/logging/OsCpuLoggingTest.java +++ b/test/hotspot/jtreg/runtime/logging/OsCpuLoggingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -52,14 +52,14 @@ public class OsCpuLoggingTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+cpu", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os+cpu", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); analyzeOutputForOsCpuLog(output); // PPC64 only uses polling pages when UseSIGTRAP is off. pb = (Platform.isPPC() && Platform.is64bit()) - ? ProcessTools.createJavaProcessBuilder("-Xlog:os", "-XX:-UseSIGTRAP", "-version") - : ProcessTools.createJavaProcessBuilder("-Xlog:os", "-version"); + ? ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os", "-XX:-UseSIGTRAP", "-version") + : ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os", "-version"); output = new OutputAnalyzer(pb.start()); analyzeOutputForOsLog(output); } diff --git a/test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java b/test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java index 9d89de8b67b..c99429519e0 100644 --- a/test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java +++ b/test/hotspot/jtreg/runtime/logging/ProtectionDomainVerificationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -39,30 +39,30 @@ public class ProtectionDomainVerificationTest { public static void main(String... args) throws Exception { // -Xlog:protectiondomain=trace - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace", - "-Xmx128m", - "-Djava.security.manager=allow", - Hello.class.getName(), "security_manager"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:protectiondomain=trace", + "-Xmx128m", + "-Djava.security.manager=allow", + Hello.class.getName(), "security_manager"); new OutputAnalyzer(pb.start()) .shouldHaveExitValue(0) .shouldContain("[protectiondomain] Checking package access") .shouldContain("[protectiondomain] adding protection domain for class"); // -Xlog:protectiondomain=debug - pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug", - "-Xmx128m", - "-Djava.security.manager=allow", - Hello.class.getName(), "security_manager"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:protectiondomain=debug", + "-Xmx128m", + "-Djava.security.manager=allow", + Hello.class.getName(), "security_manager"); new OutputAnalyzer(pb.start()) .shouldHaveExitValue(0) .shouldContain("[protectiondomain] Checking package access") .shouldNotContain("[protectiondomain] adding protection domain for class"); // -Xlog:protectiondomain=debug - pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace", - "-Xmx128m", - "-Djava.security.manager=disallow", - Hello.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:protectiondomain=trace", + "-Xmx128m", + "-Djava.security.manager=disallow", + Hello.class.getName()); new OutputAnalyzer(pb.start()) .shouldHaveExitValue(0) .shouldNotContain("[protectiondomain] Checking package access") diff --git a/test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java b/test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java index 82859b38f15..d4ec877f19b 100644 --- a/test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java +++ b/test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -51,12 +51,12 @@ public class SafepointCleanupTest { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=info", - InnerClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:safepoint+cleanup=info", + InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=off", - InnerClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:safepoint+cleanup=off", + InnerClass.class.getName()); analyzeOutputOff(pb); } diff --git a/test/hotspot/jtreg/runtime/logging/SafepointTest.java b/test/hotspot/jtreg/runtime/logging/SafepointTest.java index b79a46ca686..58d02b64660 100644 --- a/test/hotspot/jtreg/runtime/logging/SafepointTest.java +++ b/test/hotspot/jtreg/runtime/logging/SafepointTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ import jdk.test.lib.process.ProcessTools; public class SafepointTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint=trace", - InnerClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:safepoint=trace", + InnerClass.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Safepoint synchronization initiated"); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/logging/StackWalkTest.java b/test/hotspot/jtreg/runtime/logging/StackWalkTest.java index b72358842d9..226dac6f466 100644 --- a/test/hotspot/jtreg/runtime/logging/StackWalkTest.java +++ b/test/hotspot/jtreg/runtime/logging/StackWalkTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -49,12 +49,12 @@ public class StackWalkTest { } public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:stackwalk=debug", - InnerClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:stackwalk=debug", + InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:stackwalk=off", - InnerClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:stackwalk=off", + InnerClass.class.getName()); analyzeOutputOff(pb); } diff --git a/test/hotspot/jtreg/runtime/logging/StartupTimeTest.java b/test/hotspot/jtreg/runtime/logging/StartupTimeTest.java index 2066331cb77..88ec76efd12 100644 --- a/test/hotspot/jtreg/runtime/logging/StartupTimeTest.java +++ b/test/hotspot/jtreg/runtime/logging/StartupTimeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -52,12 +52,12 @@ public class StartupTimeTest { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime", - InnerClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:startuptime", + InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime=off", - InnerClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:startuptime=off", + InnerClass.class.getName()); analyzeOutputOff(pb); } diff --git a/test/hotspot/jtreg/runtime/logging/ThreadLoggingTest.java b/test/hotspot/jtreg/runtime/logging/ThreadLoggingTest.java index d98fc455319..2e62240aeb1 100644 --- a/test/hotspot/jtreg/runtime/logging/ThreadLoggingTest.java +++ b/test/hotspot/jtreg/runtime/logging/ThreadLoggingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -61,11 +61,11 @@ public class ThreadLoggingTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os+thread", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); analyzeOutputForInfoLevel(output); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread=debug", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os+thread=debug", "-version"); output = new OutputAnalyzer(pb.start()); analyzeOutputForDebugLevel(output); output.reportDiagnosticSummary(); diff --git a/test/hotspot/jtreg/runtime/logging/VMOperationTest.java b/test/hotspot/jtreg/runtime/logging/VMOperationTest.java index 873ed6e6792..014db904235 100644 --- a/test/hotspot/jtreg/runtime/logging/VMOperationTest.java +++ b/test/hotspot/jtreg/runtime/logging/VMOperationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,10 +38,10 @@ import jdk.test.lib.process.ProcessTools; public class VMOperationTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:vmoperation=debug", - "-Xmx128m", - "-Xms128m", - InternalClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:vmoperation=debug", + "-Xmx128m", + "-Xms128m", + InternalClass.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("VM_Operation ("); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/logging/VerificationTest.java b/test/hotspot/jtreg/runtime/logging/VerificationTest.java index 0a7f01f86b7..a6a0ee66acc 100644 --- a/test/hotspot/jtreg/runtime/logging/VerificationTest.java +++ b/test/hotspot/jtreg/runtime/logging/VerificationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -63,17 +63,17 @@ public class VerificationTest { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:verification=info", - InternalClass.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:verification=info", + InternalClass.class.getName()); analyzeOutputOn(pb, true); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:verification=off", - InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:verification=off", + InternalClass.class.getName()); analyzeOutputOff(pb); // logging level 'debug' should output stackmaps and bytecode data. - pb = ProcessTools.createJavaProcessBuilder("-Xlog:verification=debug", - InternalClass.class.getName()); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:verification=debug", + InternalClass.class.getName()); analyzeOutputOn(pb, false); } diff --git a/test/hotspot/jtreg/runtime/logging/VtablesTest.java b/test/hotspot/jtreg/runtime/logging/VtablesTest.java index bc525cf2534..a07fe895173 100644 --- a/test/hotspot/jtreg/runtime/logging/VtablesTest.java +++ b/test/hotspot/jtreg/runtime/logging/VtablesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class VtablesTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:vtables=trace", "ClassB"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:vtables=trace", "ClassB"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("copy vtable from ClassA to ClassB"); output.shouldContain("Initializing: ClassB"); @@ -55,7 +55,7 @@ public class VtablesTest { output.shouldContain("NOT overriding with p2.D.nooverride()V"); output.shouldHaveExitValue(0); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:vtables=trace", "p1/C"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:vtables=trace", "p1/C"); output = new OutputAnalyzer(pb.start()); output.shouldContain("transitive overriding superclass "); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java b/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java index 29dd7b2fbc0..f43f3cf760e 100644 --- a/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java +++ b/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -118,7 +118,7 @@ public class LoadLibraryTest { public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-Xmn8m", "-Xlog:library=info", "-Djava.library.path=" + System.getProperty("java.library.path"), diff --git a/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java b/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java index d0292d37dd8..7719c8a2db4 100644 --- a/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java +++ b/test/hotspot/jtreg/runtime/memory/LargePages/TestLargePagesFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -136,7 +136,7 @@ public class TestLargePagesFlags { args.add("-Xlog:pagesize"); args.add("-version"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/memory/ReadFromNoaccessArea.java b/test/hotspot/jtreg/runtime/memory/ReadFromNoaccessArea.java index 889e35577f0..ede62416633 100644 --- a/test/hotspot/jtreg/runtime/memory/ReadFromNoaccessArea.java +++ b/test/hotspot/jtreg/runtime/memory/ReadFromNoaccessArea.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ public class ReadFromNoaccessArea { public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", diff --git a/test/hotspot/jtreg/runtime/memory/ReserveMemory.java b/test/hotspot/jtreg/runtime/memory/ReserveMemory.java index 7cd0e1a0e78..6341a031c13 100644 --- a/test/hotspot/jtreg/runtime/memory/ReserveMemory.java +++ b/test/hotspot/jtreg/runtime/memory/ReserveMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -48,7 +48,7 @@ public class ReserveMemory { // expected to crash WhiteBox.getWhiteBox().readReservedMemory(); } else { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", diff --git a/test/hotspot/jtreg/runtime/modules/ClassLoaderNoUnnamedModuleTest.java b/test/hotspot/jtreg/runtime/modules/ClassLoaderNoUnnamedModuleTest.java index 91017b30702..765f9dcee7d 100644 --- a/test/hotspot/jtreg/runtime/modules/ClassLoaderNoUnnamedModuleTest.java +++ b/test/hotspot/jtreg/runtime/modules/ClassLoaderNoUnnamedModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -37,7 +37,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class ClassLoaderNoUnnamedModuleTest { public static void main(String args[]) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=java.base", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:-CreateCoredumpOnCrash", diff --git a/test/hotspot/jtreg/runtime/modules/IgnoreModulePropertiesTest.java b/test/hotspot/jtreg/runtime/modules/IgnoreModulePropertiesTest.java index a3c9c8ac6ee..6bd2b299a55 100644 --- a/test/hotspot/jtreg/runtime/modules/IgnoreModulePropertiesTest.java +++ b/test/hotspot/jtreg/runtime/modules/IgnoreModulePropertiesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ public class IgnoreModulePropertiesTest { // bogus for that property. But, since the property is ignored no exception is // thrown. public static void testProperty(String prop, String value) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-D" + prop + "=" + value, "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain(" version "); @@ -62,7 +62,7 @@ public class IgnoreModulePropertiesTest { public static void testOption(boolean shouldVMFail, String option, String value, String prop, String result) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( option + "=" + value, "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); if (shouldVMFail) { diff --git a/test/hotspot/jtreg/runtime/modules/ModuleOptionsTest.java b/test/hotspot/jtreg/runtime/modules/ModuleOptionsTest.java index 140b9103910..137e482ffb2 100644 --- a/test/hotspot/jtreg/runtime/modules/ModuleOptionsTest.java +++ b/test/hotspot/jtreg/runtime/modules/ModuleOptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class ModuleOptionsTest { // Test that multiple --add-modules options are cumulative, not last one wins. // An exception should be thrown because module i_dont_exist doesn't exist. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=i_dont_exist", "--add-modules=java.base", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("FindException"); @@ -51,7 +51,7 @@ public class ModuleOptionsTest { // Test that the last --limit-modules is the only one recognized. No exception // should be thrown. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "--limit-modules=i_dont_exist", "--limit-modules=java.base", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/modules/ModuleOptionsWarn.java b/test/hotspot/jtreg/runtime/modules/ModuleOptionsWarn.java index 5e6b526b5a3..73870e029ad 100644 --- a/test/hotspot/jtreg/runtime/modules/ModuleOptionsWarn.java +++ b/test/hotspot/jtreg/runtime/modules/ModuleOptionsWarn.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -41,77 +41,77 @@ public class ModuleOptionsWarn { public static void main(String[] args) throws Exception { // Test that a warning is not issued for extraneous jdk.module properties. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.ignored", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is issued for a reserved jdk.module property. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.addmods", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is issued for a reserved jdk.module property ending in '.'. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.limitmods.", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is issued for a reserved jdk.module property ending in '='. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.addexports=", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is issued for a reserved jdk.module property ending in ".stuff" - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.addreads.stuff", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is issued for a reserved jdk.module property ending in "=stuff" - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.path=stuff", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is issued for a reserved jdk.module property ending in ".=" - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.upgrade.path.=xx", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is issued for a reserved jdk.module property ending in "." - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.patch.3=xx", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning can be suppressed for module related properties that get ignored. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Djdk.module.addmods", "-XX:-PrintWarnings", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldNotContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is not issued for properties of the form "jdk.module.main" - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+PrintWarnings", "-Djdk.module.main.ignored", "-version"); output = new OutputAnalyzer(pb.start()); output.shouldNotContain("Ignoring system property option"); output.shouldHaveExitValue(0); // Test that a warning is issued for module related properties specified using _JAVA_OPTIONS. - pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintWarnings", "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+PrintWarnings", "-version"); Map env = pb.environment(); env.put("_JAVA_OPTIONS", "-Djdk.module.addreads"); output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/modules/ModuleStress/ExportModuleStressTest.java b/test/hotspot/jtreg/runtime/modules/ModuleStress/ExportModuleStressTest.java index ce9246e83c6..1de5f4ae0f8 100644 --- a/test/hotspot/jtreg/runtime/modules/ModuleStress/ExportModuleStressTest.java +++ b/test/hotspot/jtreg/runtime/modules/ModuleStress/ExportModuleStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -71,7 +71,7 @@ public class ExportModuleStressTest { // Sanity check that the test, jdk.test/test/Main.java // runs without error. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-p", MODS_DIR.toString(), "-m", "jdk.test/test.Main"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/modules/ModuleStress/ModuleStress.java b/test/hotspot/jtreg/runtime/modules/ModuleStress/ModuleStress.java index bc23a0383ab..7232e213410 100644 --- a/test/hotspot/jtreg/runtime/modules/ModuleStress/ModuleStress.java +++ b/test/hotspot/jtreg/runtime/modules/ModuleStress/ModuleStress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -50,7 +50,7 @@ public class ModuleStress { // loaders (boot, application, platform). Thus there is // not a need to walk those lists at a GC safepoint since // those loaders never die. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-Xlog:module=trace", "-version"); @@ -85,7 +85,7 @@ public class ModuleStress { // m1x's module readability list and package p2's exportability should // not be walked at a GC safepoint since both modules are defined to // the same loader and thus have the exact same life cycle. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-Xlog:module=trace", "ModuleSameCLMain"); @@ -99,7 +99,7 @@ public class ModuleStress { // m1x's module readability list and package p2's exportability list must // be walked at a GC safepoint since both modules are defined to non-builtin // class loaders which could die and thus be unloaded. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-Xlog:module=trace", "ModuleNonBuiltinCLMain"); @@ -116,7 +116,7 @@ public class ModuleStress { // m3x is defined to the system class loader, m2x's module readability // list does not have to be walked at a GC safepoint, but package p2's // exportability list does. - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Djava.system.class.loader=CustomSystemClassLoader", "-Xbootclasspath/a:.", "-Xlog:module=trace", diff --git a/test/hotspot/jtreg/runtime/modules/ModuleStress/ModuleStressGC.java b/test/hotspot/jtreg/runtime/modules/ModuleStress/ModuleStressGC.java index 05b9cf7c2ef..44bbe4ed5c2 100644 --- a/test/hotspot/jtreg/runtime/modules/ModuleStress/ModuleStressGC.java +++ b/test/hotspot/jtreg/runtime/modules/ModuleStress/ModuleStressGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -72,7 +72,7 @@ public class ModuleStressGC { // Check that jdk.test/test.MainGC walks module jdk.test's // reads list and walks the exports list for package test, // defined in module jdk.test, during a GC. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmx128m", "-Xlog:module=trace", "-p", MODS_DIR.toString(), diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModule2Dirs.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModule2Dirs.java index b582314411d..cd0670cfb72 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModule2Dirs.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModule2Dirs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -60,7 +60,7 @@ public class PatchModule2Dirs { InMemoryJavaCompiler.compile("java.beans.Encoder", source2, "--patch-module=java.desktop"), "mods2/java.desktop"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "--patch-module=java.naming=mods/java.naming", "--patch-module=java.desktop=mods2/java.desktop", "PatchModule2DirsMain", "javax.naming.spi.NamingManager", "java.beans.Encoder"); diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleCDS.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleCDS.java index 109f6cf2616..e7bf5dabf21 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleCDS.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleCDS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ public class PatchModuleCDS { // Case 1: Test that --patch-module and -Xshare:dump are compatible String filename = "patch_module.jsa"; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + filename, "-Xshare:dump", @@ -69,7 +69,7 @@ public class PatchModuleCDS { InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "--patch-module=java.naming"), System.getProperty("test.classes")); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + filename, "-Xshare:dump", @@ -84,7 +84,7 @@ public class PatchModuleCDS { // Case 3a: Test CDS dumping with jar file in --patch-module BasicJarBuilder.build("javanaming", "javax/naming/spi/NamingManager"); String moduleJar = BasicJarBuilder.getTestJar("javanaming.jar"); - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + filename, "-Xshare:dump", @@ -98,7 +98,7 @@ public class PatchModuleCDS { .shouldContain("Cannot use the following option when dumping the shared archive: --patch-module"); // Case 3b: Test CDS run with jar file in --patch-module - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + filename, "-Xshare:auto", diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleClassList.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleClassList.java index a4a03935f03..35ec86f841d 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleClassList.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleClassList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -64,7 +64,7 @@ public class PatchModuleClassList { String moduleJar = BasicJarBuilder.getTestJar("javanaming.jar"); String classList = "javanaming.list"; - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:DumpLoadedClassList=" + classList, "--patch-module=java.naming=" + moduleJar, "PatchModuleMain", BOOT_CLASS.replace('/', '.')); @@ -98,7 +98,7 @@ public class PatchModuleClassList { moduleJar = BasicJarBuilder.getTestJar("javasql.jar"); classList = "javasql.list"; - pb = ProcessTools.createTestJvm( + pb = ProcessTools.createTestJavaProcessBuilder( "-XX:DumpLoadedClassList=" + classList, "--patch-module=java.sql=" + moduleJar, "PatchModuleMain", PLATFORM_CLASS.replace('/', '.')); @@ -130,7 +130,7 @@ public class PatchModuleClassList { moduleJar = BasicJarBuilder.getTestJar("hello.jar"); classList = "hello.list"; - pb = ProcessTools.createTestJvm( + pb = ProcessTools.createTestJavaProcessBuilder( "-XX:DumpLoadedClassList=" + classList, "-Xbootclasspath/a:" + moduleJar, "Hello"); diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupJavaBase.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupJavaBase.java index a256a1f6c85..d9d00a1573e 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupJavaBase.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupJavaBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -37,7 +37,7 @@ public class PatchModuleDupJavaBase { // The VM should exit initialization if java.base is specified // more than once to --patch-module. public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "--patch-module=java.base=javabase_dir", "--patch-module=java.base=javabase_dir", "-version"); diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupModule.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupModule.java index a454dcb1527..464a15f78bd 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupModule.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -39,7 +39,7 @@ public class PatchModuleDupModule { // if --patch-module is specified with the same module more than once. public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "--patch-module=module_one=module_one_dir", "--patch-module=module_one=module_one_dir", "-version"); diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleJavaBase.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleJavaBase.java index 58aef0fb877..75fcf26f633 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleJavaBase.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleJavaBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -51,7 +51,7 @@ public class PatchModuleJavaBase { InMemoryJavaCompiler.compile("java.lang.NewClass", source, "--patch-module=java.base"), "mods/java.base"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.base=mods/java.base", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("--patch-module=java.base=mods/java.base", "PatchModuleMain", "java.lang.NewClass"); new OutputAnalyzer(pb.start()) diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTest.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTest.java index 045f156c9d8..ed9f9019033 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTest.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -51,7 +51,7 @@ public class PatchModuleTest { InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "--patch-module=java.naming"), "mods/java.naming"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=mods/java.naming", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("--patch-module=java.naming=mods/java.naming", "PatchModuleMain", "javax.naming.spi.NamingManager"); new OutputAnalyzer(pb.start()) diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTestJar.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTestJar.java index ed9e2b0ea8b..617d144d186 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTestJar.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTestJar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -76,7 +76,7 @@ public class PatchModuleTestJar { System.getProperty("test.classes")); // Supply --patch-module with the name of the jar file for the module java.naming. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=" + moduleJar, + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("--patch-module=java.naming=" + moduleJar, "PatchModuleMain", "javax.naming.spi.NamingManager"); new OutputAnalyzer(pb.start()) diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTestJarDir.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTestJarDir.java index 2b2952b1e23..1be1f2f0e22 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTestJarDir.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTestJarDir.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -92,13 +92,13 @@ public class PatchModuleTestJarDir { // Supply --patch-module with the name of the jar file for the module java.naming. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=" + - moduleJar + - File.pathSeparator + - System.getProperty("test.classes") + "/mods/java.naming", - "PatchModule2DirsMain", - "javax.naming.spi.NamingManager1", - "javax.naming.spi.NamingManager2"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("--patch-module=java.naming=" + + moduleJar + + File.pathSeparator + + System.getProperty("test.classes") + "/mods/java.naming", + "PatchModule2DirsMain", + "javax.naming.spi.NamingManager1", + "javax.naming.spi.NamingManager2"); new OutputAnalyzer(pb.start()) .shouldContain("I pass one!") diff --git a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTraceCL.java b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTraceCL.java index f98f85cce9a..dd8b33402ac 100644 --- a/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTraceCL.java +++ b/test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleTraceCL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -53,7 +53,7 @@ public class PatchModuleTraceCL { InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "--patch-module=java.naming"), "mods/java.naming"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=mods/java.naming", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("--patch-module=java.naming=mods/java.naming", "-Xlog:class+load=info", "PatchModuleMain", "javax.naming.spi.NamingManager"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -77,7 +77,7 @@ public class PatchModuleTraceCL { InMemoryJavaCompiler.compile("PatchModuleTraceCL_pkg.ItIsI", source), "xbcp"); - pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/a:xbcp", + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xbootclasspath/a:xbcp", "-Xlog:class+load=info", "PatchModuleMain", "PatchModuleTraceCL_pkg.ItIsI"); output = new OutputAnalyzer(pb.start()); // -Xbootclasspath/a case. diff --git a/test/hotspot/jtreg/runtime/modules/Visibility/PatchModuleVisibility.java b/test/hotspot/jtreg/runtime/modules/Visibility/PatchModuleVisibility.java index f11d52b46f0..96982593dbb 100644 --- a/test/hotspot/jtreg/runtime/modules/Visibility/PatchModuleVisibility.java +++ b/test/hotspot/jtreg/runtime/modules/Visibility/PatchModuleVisibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -86,7 +86,7 @@ public class PatchModuleVisibility { Files.delete(Paths.get(System.getProperty("test.classes") + File.separator + "p2" + File.separator + "Vis2_B.class")); - new OutputAnalyzer(ProcessTools.createJavaProcessBuilder( + new OutputAnalyzer(ProcessTools.createLimitedTestJavaProcessBuilder( "--patch-module=java.base=mods2/java.base", "--add-exports=java.base/p2=ALL-UNNAMED", "Vis2_A") diff --git a/test/hotspot/jtreg/runtime/modules/Visibility/XbootcpNoVisibility.java b/test/hotspot/jtreg/runtime/modules/Visibility/XbootcpNoVisibility.java index 9d10fe6488c..90df4c10f27 100644 --- a/test/hotspot/jtreg/runtime/modules/Visibility/XbootcpNoVisibility.java +++ b/test/hotspot/jtreg/runtime/modules/Visibility/XbootcpNoVisibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -73,7 +73,7 @@ public class XbootcpNoVisibility { ClassFileInstaller.writeClassToDisk("Vis3_A", InMemoryJavaCompiler.compile("Vis3_A", Vis3_A_src), System.getProperty("test.classes")); - new OutputAnalyzer(ProcessTools.createJavaProcessBuilder( + new OutputAnalyzer(ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:.", "Vis3_A") .start()) diff --git a/test/hotspot/jtreg/runtime/modules/Visibility/XbootcpVisibility.java b/test/hotspot/jtreg/runtime/modules/Visibility/XbootcpVisibility.java index df20c356c92..5d1605b74fe 100644 --- a/test/hotspot/jtreg/runtime/modules/Visibility/XbootcpVisibility.java +++ b/test/hotspot/jtreg/runtime/modules/Visibility/XbootcpVisibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -104,7 +104,7 @@ public class XbootcpVisibility { Files.delete(Paths.get(System.getProperty("test.classes") + File.separator + "p2" + File.separator + "Vis1_C.class")); - new OutputAnalyzer(ProcessTools.createJavaProcessBuilder( + new OutputAnalyzer(ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:nonexistent.jar", "-Xbootclasspath/a:mods1", "Vis1_A") diff --git a/test/hotspot/jtreg/runtime/os/AvailableProcessors.java b/test/hotspot/jtreg/runtime/os/AvailableProcessors.java index 97491d241b9..18201d99127 100644 --- a/test/hotspot/jtreg/runtime/os/AvailableProcessors.java +++ b/test/hotspot/jtreg/runtime/os/AvailableProcessors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -69,8 +69,8 @@ public class AvailableProcessors { // Get the java command we want to execute // Enable logging for easier failure diagnosis ProcessBuilder master = - ProcessTools.createJavaProcessBuilder("-Xlog:os=trace", - "AvailableProcessors"); + ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os=trace", + "AvailableProcessors"); int[] expected = new int[] { 1, available/2, available-1, available }; diff --git a/test/hotspot/jtreg/runtime/os/THPsInThreadStackPreventionTest.java b/test/hotspot/jtreg/runtime/os/THPsInThreadStackPreventionTest.java index 261ec205d39..519bcc94b01 100644 --- a/test/hotspot/jtreg/runtime/os/THPsInThreadStackPreventionTest.java +++ b/test/hotspot/jtreg/runtime/os/THPsInThreadStackPreventionTest.java @@ -179,7 +179,7 @@ public class THPsInThreadStackPreventionTest { switch (args[0]) { case "PATCH-ENABLED": { finalargs.add(TestMain.class.getName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(finalargs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(finalargs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); @@ -216,7 +216,7 @@ public class THPsInThreadStackPreventionTest { finalargs.add("-XX:-THPStackMitigation"); finalargs.add(TestMain.class.getName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(finalargs); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(finalargs); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/os/TestHugePageDetection.java b/test/hotspot/jtreg/runtime/os/TestHugePageDetection.java index 80d7df080d0..2e2d9092c74 100644 --- a/test/hotspot/jtreg/runtime/os/TestHugePageDetection.java +++ b/test/hotspot/jtreg/runtime/os/TestHugePageDetection.java @@ -48,7 +48,7 @@ public class TestHugePageDetection { finalargs.addAll(Arrays.asList(defaultArgs)); finalargs.add("-version"); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( new String[] {"-Xlog:pagesize", "-Xmx64M", "-version"}); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/os/TestTimerSlack.java b/test/hotspot/jtreg/runtime/os/TestTimerSlack.java index 86aece992b5..b703625dfd0 100644 --- a/test/hotspot/jtreg/runtime/os/TestTimerSlack.java +++ b/test/hotspot/jtreg/runtime/os/TestTimerSlack.java @@ -42,7 +42,7 @@ public class TestTimerSlack { // Check the timer slack value is not printed by default { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os+thread", "TestTimerSlack$TestMain"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); @@ -52,7 +52,7 @@ public class TestTimerSlack { // Check the timer slack value is not printed when explicitly disabled { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os+thread", "-XX:+UnlockExperimentalVMOptions", "-XX:TimerSlack=-1", "TestTimerSlack$TestMain"); @@ -64,7 +64,7 @@ public class TestTimerSlack { // Check the timer slack value is good when system-wide default is requested { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os+thread", "-XX:+UnlockExperimentalVMOptions", "-XX:TimerSlack=0", "TestTimerSlack$TestMain"); @@ -82,7 +82,7 @@ public class TestTimerSlack { // Check the timer slack value is accepted by all threads for (int slack : new int[] {1, 10, 100, 1000, 10000, 100000, 1000000}) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os+thread", "-XX:+UnlockExperimentalVMOptions", "-XX:TimerSlack=" + slack, "TestTimerSlack$TestMain"); diff --git a/test/hotspot/jtreg/runtime/os/TestTrimNative.java b/test/hotspot/jtreg/runtime/os/TestTrimNative.java index cdc49bd4216..84d8d41de1b 100644 --- a/test/hotspot/jtreg/runtime/os/TestTrimNative.java +++ b/test/hotspot/jtreg/runtime/os/TestTrimNative.java @@ -167,7 +167,7 @@ public class TestTrimNative { } private static OutputAnalyzer runTestWithOptions(String[] extraOptions, String[] programOptions) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(prepareOptions(extraOptions, programOptions)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(prepareOptions(extraOptions, programOptions)); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); return output; diff --git a/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java b/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java index 0146256f7dd..6b98f8fd2d9 100644 --- a/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java +++ b/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,10 +42,10 @@ public class TestUseCpuAllocPath { public static void main(String[] args) throws Exception { ProcessBuilder pb = - ProcessTools.createJavaProcessBuilder("-Xlog:os=trace", - "-XX:+UnlockDiagnosticVMOptions", - "-XX:+UseCpuAllocPath", - "-version"); + ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:os=trace", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+UseCpuAllocPath", + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/posixSig/TestPosixSig.java b/test/hotspot/jtreg/runtime/posixSig/TestPosixSig.java index 52402ebe83f..1a9a283f740 100644 --- a/test/hotspot/jtreg/runtime/posixSig/TestPosixSig.java +++ b/test/hotspot/jtreg/runtime/posixSig/TestPosixSig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ public class TestPosixSig { if (args.length == 0) { // Create a new java process for the TestPsig Java/JNI test. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+CheckJNICalls", "-Djava.library.path=" + libpath + ":.", "TestPosixSig", "dummy"); diff --git a/test/hotspot/jtreg/runtime/records/RedefineRecord.java b/test/hotspot/jtreg/runtime/records/RedefineRecord.java index bad4542885e..1019a4c3e7b 100644 --- a/test/hotspot/jtreg/runtime/records/RedefineRecord.java +++ b/test/hotspot/jtreg/runtime/records/RedefineRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -102,7 +102,7 @@ public class RedefineRecord { return; } if (argv.length == 1 && argv[0].equals("runtest")) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:MetaspaceSize=12m", "-XX:MaxMetaspaceSize=12m", "-javaagent:redefineagent.jar", diff --git a/test/hotspot/jtreg/runtime/sealedClasses/RedefinePermittedSubclass.java b/test/hotspot/jtreg/runtime/sealedClasses/RedefinePermittedSubclass.java index 1832d295cc5..29ce452cc2c 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/RedefinePermittedSubclass.java +++ b/test/hotspot/jtreg/runtime/sealedClasses/RedefinePermittedSubclass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -126,7 +126,7 @@ public class RedefinePermittedSubclass { if (argv.length == 1 && argv[0].equals("runtest")) { String[] javaArgs1 = { "-XX:MetaspaceSize=12m", "-XX:MaxMetaspaceSize=12m", "-javaagent:redefineagent.jar", "RedefinePermittedSubclass"}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(javaArgs1); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(javaArgs1); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("processing of -javaagent failed"); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/sealedClasses/RedefineSealedClass.java b/test/hotspot/jtreg/runtime/sealedClasses/RedefineSealedClass.java index 515dfa9f5e0..84a1b6bfac7 100644 --- a/test/hotspot/jtreg/runtime/sealedClasses/RedefineSealedClass.java +++ b/test/hotspot/jtreg/runtime/sealedClasses/RedefineSealedClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -108,7 +108,7 @@ public class RedefineSealedClass { if (argv.length == 1 && argv[0].equals("runtest")) { String[] javaArgs1 = { "-XX:MetaspaceSize=12m", "-XX:MaxMetaspaceSize=12m", "-javaagent:redefineagent.jar", "RedefineSealedClass"}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(javaArgs1); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(javaArgs1); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("processing of -javaagent failed"); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/runtime/stringtable/StringTableVerifyTest.java b/test/hotspot/jtreg/runtime/stringtable/StringTableVerifyTest.java index 6f6b0a6ef73..f0513de13a4 100644 --- a/test/hotspot/jtreg/runtime/stringtable/StringTableVerifyTest.java +++ b/test/hotspot/jtreg/runtime/stringtable/StringTableVerifyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -36,7 +36,7 @@ import jdk.test.lib.process.ProcessTools; public class StringTableVerifyTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:+VerifyStringTableAtExit", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", "-XX:+VerifyStringTableAtExit", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); } diff --git a/test/hotspot/jtreg/runtime/symboltable/ShortLivedSymbolCleanup.java b/test/hotspot/jtreg/runtime/symboltable/ShortLivedSymbolCleanup.java index 6e5db46bd5c..ee7fa8f40d7 100644 --- a/test/hotspot/jtreg/runtime/symboltable/ShortLivedSymbolCleanup.java +++ b/test/hotspot/jtreg/runtime/symboltable/ShortLivedSymbolCleanup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -89,13 +89,13 @@ public class ShortLivedSymbolCleanup { } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:symboltable=trace", - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:symboltable=trace", + "-version"); int size = getSymbolTableSize(pb); - pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintSymbolTableSizeHistogram", - LotsOfTempSymbols.class.getName(), - Integer.toString(size)); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+PrintSymbolTableSizeHistogram", + LotsOfTempSymbols.class.getName(), + Integer.toString(size)); analyzeOutputOn(size, pb); } diff --git a/test/hotspot/jtreg/runtime/verifier/OverriderMsg.java b/test/hotspot/jtreg/runtime/verifier/OverriderMsg.java index 38a8595d25d..5b24caacd3e 100644 --- a/test/hotspot/jtreg/runtime/verifier/OverriderMsg.java +++ b/test/hotspot/jtreg/runtime/verifier/OverriderMsg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -125,7 +125,7 @@ public class OverriderMsg { public static void main(String... args) throws Exception { dump_HasFinal(); dump_Overrider(); - ProcessBuilder pb = ProcessTools.createTestJvm("-cp", ".", "Overrider"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-cp", ".", "Overrider"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain( "java.lang.IncompatibleClassChangeError: class Overrider overrides final method HasFinal.m(Ljava/lang/String;)V"); diff --git a/test/hotspot/jtreg/runtime/verifier/TestANewArray.java b/test/hotspot/jtreg/runtime/verifier/TestANewArray.java index 99333da56dd..011749133da 100644 --- a/test/hotspot/jtreg/runtime/verifier/TestANewArray.java +++ b/test/hotspot/jtreg/runtime/verifier/TestANewArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -69,7 +69,7 @@ public class TestANewArray { byte[] classFile_254 = dumpClassFile(cfv, test_Dimension_254, array_Dimension_254); writeClassFileFromByteArray(classFile_254); System.err.println("Running with cfv: " + cfv + ", test_Dimension_254"); - ProcessBuilder pb = ProcessTools.createTestJvm("-verify", "-cp", ".", classCName); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-verify", "-cp", ".", classCName); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldNotContain("java.lang.VerifyError"); output.shouldHaveExitValue(0); @@ -78,7 +78,7 @@ public class TestANewArray { byte[] classFile_255 = dumpClassFile(cfv, test_Dimension_255, array_Dimension_255); writeClassFileFromByteArray(classFile_255); System.err.println("Running with cfv: " + cfv + ", test_Dimension_255"); - pb = ProcessTools.createTestJvm("-verify", "-cp", ".", classCName); + pb = ProcessTools.createTestJavaProcessBuilder("-verify", "-cp", ".", classCName); output = new OutputAnalyzer(pb.start()); // If anewarray has an operand with 255 array dimensions then VerifyError should // be thrown because the resulting array would have 256 dimensions. @@ -95,7 +95,7 @@ public class TestANewArray { byte[] classFile_264 = dumpClassFile(cfv, test_Dimension_264, array_Dimension_264); writeClassFileFromByteArray(classFile_264); System.err.println("Running with cfv: " + cfv + ", test_Dimension_264"); - pb = ProcessTools.createTestJvm("-verify", "-cp", ".", classCName); + pb = ProcessTools.createTestJavaProcessBuilder("-verify", "-cp", ".", classCName); output = new OutputAnalyzer(pb.start()); output.shouldContain("java.lang.ClassFormatError"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/verifier/TestMultiANewArray.java b/test/hotspot/jtreg/runtime/verifier/TestMultiANewArray.java index 07f2f33110d..6f04278c4cd 100644 --- a/test/hotspot/jtreg/runtime/verifier/TestMultiANewArray.java +++ b/test/hotspot/jtreg/runtime/verifier/TestMultiANewArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -48,7 +48,7 @@ public class TestMultiANewArray { int cfv = Integer.parseInt(args[0]); writeClassFile(cfv); System.err.println("Running with cfv: " + cfv); - ProcessBuilder pb = ProcessTools.createTestJvm("-cp", ".", "ClassFile"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-cp", ".", "ClassFile"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("VerifyError"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/verifier/TestTableSwitch.java b/test/hotspot/jtreg/runtime/verifier/TestTableSwitch.java index 2daffb162f8..0225b0ea753 100644 --- a/test/hotspot/jtreg/runtime/verifier/TestTableSwitch.java +++ b/test/hotspot/jtreg/runtime/verifier/TestTableSwitch.java @@ -42,12 +42,12 @@ public class TestTableSwitch { LookupSwitchp1.runLookup(); } } else { - ProcessBuilder pb = ProcessTools.createTestJvm("TestTableSwitch", "runTable"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("TestTableSwitch", "runTable"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("java.lang.VerifyError: Bad instruction"); output.shouldHaveExitValue(1); - pb = ProcessTools.createTestJvm("TestTableSwitch", "runLookup"); + pb = ProcessTools.createTestJavaProcessBuilder("TestTableSwitch", "runLookup"); output = new OutputAnalyzer(pb.start()); output.shouldContain("java.lang.VerifyError: Bad instruction"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/runtime/verifier/TraceClassRes.java b/test/hotspot/jtreg/runtime/verifier/TraceClassRes.java index c4e420a1613..ddb5e68e1d3 100644 --- a/test/hotspot/jtreg/runtime/verifier/TraceClassRes.java +++ b/test/hotspot/jtreg/runtime/verifier/TraceClassRes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TraceClassRes { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xlog:class+resolve=debug", "-verify", "-Xshare:off", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java b/test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java index e5e22e58239..e88bc025e8c 100644 --- a/test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java +++ b/test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ public class TestWBDeflateIdleMonitors { static final int N_TRIES = 5; // number of times to try deflation public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", diff --git a/test/hotspot/jtreg/serviceability/attach/AttachSetGetFlag.java b/test/hotspot/jtreg/serviceability/attach/AttachSetGetFlag.java index d6b21a5a327..dcc5bdce830 100644 --- a/test/hotspot/jtreg/serviceability/attach/AttachSetGetFlag.java +++ b/test/hotspot/jtreg/serviceability/attach/AttachSetGetFlag.java @@ -66,7 +66,7 @@ public class AttachSetGetFlag { } public static ProcessBuilder runTarget(String flagName, String flagValue) throws Exception { - return ProcessTools.createJavaProcessBuilder( + return ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockExperimentalVMOptions", "-XX:" + flagName + "=" + flagValue, "AttachSetGetFlag$Target"); diff --git a/test/hotspot/jtreg/serviceability/attach/AttachWithStalePidFile.java b/test/hotspot/jtreg/serviceability/attach/AttachWithStalePidFile.java index f5905396782..aceaa82d668 100644 --- a/test/hotspot/jtreg/serviceability/attach/AttachWithStalePidFile.java +++ b/test/hotspot/jtreg/serviceability/attach/AttachWithStalePidFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -59,7 +59,7 @@ public class AttachWithStalePidFile { } public static boolean runTest() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:+PauseAtStartup", "AttachWithStalePidFileTarget"); Process target = pb.start(); Path pidFile = null; diff --git a/test/hotspot/jtreg/serviceability/attach/ShMemLongName.java b/test/hotspot/jtreg/serviceability/attach/ShMemLongName.java index bf90dd9a08c..3618a4cfa09 100644 --- a/test/hotspot/jtreg/serviceability/attach/ShMemLongName.java +++ b/test/hotspot/jtreg/serviceability/attach/ShMemLongName.java @@ -94,7 +94,7 @@ public class ShMemLongName { // creates target process builder for the specified shmem transport name private static ProcessBuilder getTarget(String shmemName) throws IOException { log("starting target with shmem name: '" + shmemName + "'..."); - return ProcessTools.createJavaProcessBuilder( + return ProcessTools.createLimitedTestJavaProcessBuilder( "-Xrunjdwp:transport=" + transport + ",server=y,suspend=n,address=" + shmemName, "ShMemLongName$Target"); } diff --git a/test/hotspot/jtreg/serviceability/dcmd/gc/RunFinalizationTest.java b/test/hotspot/jtreg/serviceability/dcmd/gc/RunFinalizationTest.java index bf8605ee320..da47616d6e4 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/gc/RunFinalizationTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/gc/RunFinalizationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -47,7 +47,7 @@ public class RunFinalizationTest { javaArgs.add("-cp"); javaArgs.add(System.getProperty("test.class.path")); javaArgs.add(TEST_APP_NAME); - ProcessBuilder testAppPb = ProcessTools.createJavaProcessBuilder(javaArgs); + ProcessBuilder testAppPb = ProcessTools.createLimitedTestJavaProcessBuilder(javaArgs); final AtomicBoolean failed = new AtomicBoolean(); final AtomicBoolean passed = new AtomicBoolean(); diff --git a/test/hotspot/jtreg/serviceability/dtrace/DTraceOptionsTest.java b/test/hotspot/jtreg/serviceability/dtrace/DTraceOptionsTest.java index f0bd1e1fdfb..66476712514 100644 --- a/test/hotspot/jtreg/serviceability/dtrace/DTraceOptionsTest.java +++ b/test/hotspot/jtreg/serviceability/dtrace/DTraceOptionsTest.java @@ -62,7 +62,7 @@ public class DTraceOptionsTest { }; for (String opt : options) { - var pb = ProcessTools.createJavaProcessBuilder("-XX:+" + opt, "-version"); + var pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:+" + opt, "-version"); var oa = new OutputAnalyzer(pb.start()); if (dtraceEnabled) { oa.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/serviceability/jdwp/DebuggeeLauncher.java b/test/hotspot/jtreg/serviceability/jdwp/DebuggeeLauncher.java index 2d03d2f418f..f7467affdf8 100644 --- a/test/hotspot/jtreg/serviceability/jdwp/DebuggeeLauncher.java +++ b/test/hotspot/jtreg/serviceability/jdwp/DebuggeeLauncher.java @@ -69,7 +69,7 @@ public class DebuggeeLauncher implements StreamHandler.Listener { */ public void launchDebuggee() throws Throwable { - ProcessBuilder pb = ProcessTools.createTestJvm(JDWP_OPT, DEBUGGEE); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(JDWP_OPT, DEBUGGEE); p = pb.start(); StreamHandler inputHandler = new StreamHandler(p.getInputStream(), this); StreamHandler errorHandler = new StreamHandler(p.getErrorStream(), l -> System.out.println("[stderr]: " + l)); diff --git a/test/hotspot/jtreg/serviceability/jvmti/CanGenerateAllClassHook/CanGenerateAllClassHook.java b/test/hotspot/jtreg/serviceability/jvmti/CanGenerateAllClassHook/CanGenerateAllClassHook.java index 759967c5c96..b3c8ed66a0b 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/CanGenerateAllClassHook/CanGenerateAllClassHook.java +++ b/test/hotspot/jtreg/serviceability/jvmti/CanGenerateAllClassHook/CanGenerateAllClassHook.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -125,7 +125,7 @@ public class CanGenerateAllClassHook { } private static OutputAnalyzer execJava(String... args) throws IOException { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetObjectSizeClass.java b/test/hotspot/jtreg/serviceability/jvmti/GetObjectSizeClass.java index 126f3333cae..b5ab4eeb997 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetObjectSizeClass.java +++ b/test/hotspot/jtreg/serviceability/jvmti/GetObjectSizeClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -51,7 +51,7 @@ public class GetObjectSizeClass { pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", "agent.jar", "GetObjectSizeClassAgent.class"}); pb.start().waitFor(); - ProcessBuilder pt = ProcessTools.createTestJvm("-javaagent:agent.jar", "GetObjectSizeClassAgent"); + ProcessBuilder pt = ProcessTools.createTestJavaProcessBuilder("-javaagent:agent.jar", "GetObjectSizeClassAgent"); OutputAnalyzer output = new OutputAnalyzer(pt.start()); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeak.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeak.java index bd14f8ec3c7..b369f4abb85 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeak.java +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeak.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -105,7 +105,7 @@ public class RedefineLeak { } if (argv.length == 1 && argv[0].equals("runtest")) { // run outside of jtreg to not OOM on jtreg classes that are loaded after metaspace is full - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-XX:MetaspaceSize=12m", "-XX:MaxMetaspaceSize=12m", "-javaagent:redefineagent.jar", diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefinePreviousVersions.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefinePreviousVersions.java index 80933a7beb0..9fe9f43b8a9 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefinePreviousVersions.java +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefinePreviousVersions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -84,7 +84,7 @@ public class RedefinePreviousVersions { if (args.length > 0) { // java -javaagent:redefineagent.jar -Xlog:stuff RedefinePreviousVersions - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-javaagent:redefineagent.jar", + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-javaagent:redefineagent.jar", "-Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace", "RedefinePreviousVersions"); new OutputAnalyzer(pb.start()) diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.java index 6ee54be7831..bf6216ae85a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.java +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.java @@ -75,7 +75,7 @@ public class RedefineSharedClassJFR { List offCommand = new ArrayList<>(); offCommand.add("-Xshare:off"); offCommand.addAll(baseCommand); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(offCommand); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(offCommand); new OutputAnalyzer(pb.start()) // We can't expect any of the transformed classes to be in use // so the only thing we can verify is that no scratch classes @@ -89,7 +89,7 @@ public class RedefineSharedClassJFR { List onCommand = new ArrayList<>(); onCommand.add("-Xshare:on"); onCommand.addAll(baseCommand); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(onCommand); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(onCommand); new OutputAnalyzer(pb.start()) .shouldContain(SHOULD_CLEAN_FALSE) .shouldNotContain(SHOULD_CLEAN_TRUE) diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RetransformClassesZeroLength.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RetransformClassesZeroLength.java index 13ac65a2eb7..7f7ec792941 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RetransformClassesZeroLength.java +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RetransformClassesZeroLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -56,7 +56,7 @@ public class RetransformClassesZeroLength { public static void main(String args[]) throws Throwable { String agentJar = buildAgent(); ProcessTools.executeProcess( - ProcessTools.createJavaProcessBuilder( + ProcessTools.createLimitedTestJavaProcessBuilder( "-javaagent:" + agentJar, "-version") ).shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TransformerDeadlockTest.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TransformerDeadlockTest.java index f51ff4c58a5..99c7a49263c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TransformerDeadlockTest.java +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/TransformerDeadlockTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -57,7 +57,7 @@ public class TransformerDeadlockTest { public static void main(String args[]) throws Throwable { String agentJar = buildAgent(); ProcessTools.executeProcess( - ProcessTools.createJavaProcessBuilder( + ProcessTools.createLimitedTestJavaProcessBuilder( "-javaagent:" + agentJar, TransformerDeadlockTest.Agent.class.getName()) ).shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/premain/AgentWithVThreadTest.java b/test/hotspot/jtreg/serviceability/jvmti/vthread/premain/AgentWithVThreadTest.java index 4e0db40d1b9..ab04520f4ae 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/premain/AgentWithVThreadTest.java +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/premain/AgentWithVThreadTest.java @@ -37,7 +37,7 @@ import jdk.test.lib.process.ProcessTools; public class AgentWithVThreadTest { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm("-javaagent:agent.jar", "-version"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-javaagent:agent.jar", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.stdoutShouldContain("passed"); } diff --git a/test/hotspot/jtreg/serviceability/logging/TestBasicLogOutput.java b/test/hotspot/jtreg/serviceability/logging/TestBasicLogOutput.java index 07aafabf995..895e5504feb 100644 --- a/test/hotspot/jtreg/serviceability/logging/TestBasicLogOutput.java +++ b/test/hotspot/jtreg/serviceability/logging/TestBasicLogOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -36,7 +36,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestBasicLogOutput { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:all=trace", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:all=trace", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldMatch("\\[logging *\\]"); // expected tag(s) output.shouldContain("Log configuration fully initialized."); // expected message diff --git a/test/hotspot/jtreg/serviceability/logging/TestDefaultLogOutput.java b/test/hotspot/jtreg/serviceability/logging/TestDefaultLogOutput.java index 3a7fde88894..a1f70fdeb13 100644 --- a/test/hotspot/jtreg/serviceability/logging/TestDefaultLogOutput.java +++ b/test/hotspot/jtreg/serviceability/logging/TestDefaultLogOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -36,7 +36,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestDefaultLogOutput { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:badTag"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:badTag"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.stdoutShouldMatch("\\[error *\\]\\[logging *\\]"); output.shouldHaveExitValue(1); diff --git a/test/hotspot/jtreg/serviceability/logging/TestFullNames.java b/test/hotspot/jtreg/serviceability/logging/TestFullNames.java index dceb2e32f63..0a3bc855d8f 100644 --- a/test/hotspot/jtreg/serviceability/logging/TestFullNames.java +++ b/test/hotspot/jtreg/serviceability/logging/TestFullNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -63,9 +63,9 @@ public class TestFullNames { for (String logOutput : validOutputs) { Asserts.assertFalse(file.exists()); // Run with logging=trace on stdout so that we can verify the log configuration afterwards. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:logging=trace", - "-Xlog:all=trace:" + logOutput, - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:logging=trace", + "-Xlog:all=trace:" + logOutput, + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); Asserts.assertTrue(file.exists()); diff --git a/test/hotspot/jtreg/serviceability/logging/TestLogRotation.java b/test/hotspot/jtreg/serviceability/logging/TestLogRotation.java index 608c656c580..585e8bda47d 100644 --- a/test/hotspot/jtreg/serviceability/logging/TestLogRotation.java +++ b/test/hotspot/jtreg/serviceability/logging/TestLogRotation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023, 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 @@ -71,7 +71,7 @@ public class TestLogRotation { } public static void runTest(int numberOfFiles) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-cp", System.getProperty("java.class.path"), "-Xlog:gc=debug:" + logFileName + "::filesize=" + logFileSizeK + "k" diff --git a/test/hotspot/jtreg/serviceability/logging/TestMultipleXlogArgs.java b/test/hotspot/jtreg/serviceability/logging/TestMultipleXlogArgs.java index 8570eec7360..13560eeb68a 100644 --- a/test/hotspot/jtreg/serviceability/logging/TestMultipleXlogArgs.java +++ b/test/hotspot/jtreg/serviceability/logging/TestMultipleXlogArgs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -36,13 +36,13 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestMultipleXlogArgs { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:logging=debug", - "-Xlog:logging=trace", - "-Xlog:defaultmethods=trace", - "-Xlog:defaultmethods=warning", - "-Xlog:safepoint=info", - "-Xlog:safepoint=info", - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:logging=debug", + "-Xlog:logging=trace", + "-Xlog:defaultmethods=trace", + "-Xlog:defaultmethods=warning", + "-Xlog:safepoint=info", + "-Xlog:safepoint=info", + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); // -Xlog:logging=trace means that the log configuration will be printed. String stdoutConfigLine = "\\[logging *\\] #0: stdout .*"; diff --git a/test/hotspot/jtreg/serviceability/logging/TestQuotedLogOutputs.java b/test/hotspot/jtreg/serviceability/logging/TestQuotedLogOutputs.java index dff973f61da..dea656130ab 100644 --- a/test/hotspot/jtreg/serviceability/logging/TestQuotedLogOutputs.java +++ b/test/hotspot/jtreg/serviceability/logging/TestQuotedLogOutputs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -73,9 +73,9 @@ public class TestQuotedLogOutputs { }; for (String logOutput : validOutputs) { // Run with logging=trace on stdout so that we can verify the log configuration afterwards. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:logging=trace", - "-Xlog:all=trace:" + logOutput, - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:logging=trace", + "-Xlog:all=trace:" + logOutput, + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(0); Asserts.assertTrue(file.exists()); @@ -98,9 +98,9 @@ public class TestQuotedLogOutputs { "A" + quote + quote + "B" }; for (String logOutput : invalidOutputs) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:logging=trace", - "-Xlog:all=trace:" + logOutput, - "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:logging=trace", + "-Xlog:all=trace:" + logOutput, + "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldHaveExitValue(1); // Ensure error message was logged diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java index 3655a8c8847..53370fc09d6 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -90,7 +90,7 @@ public class ClhsdbCDSCore { try { List options = new ArrayList<>(); options.addAll(Arrays.asList(jArgs)); - ProcessBuilder pb = ProcessTools.createTestJvm(options); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(options); // Add "ulimit -c unlimited" if we can since we are generating a core file. pb = CoreUtils.addCoreUlimitCommand(pb); crashOutput = ProcessTools.executeProcess(pb); diff --git a/test/hotspot/jtreg/serviceability/sa/TestClassDump.java b/test/hotspot/jtreg/serviceability/sa/TestClassDump.java index 18f3c47e5d1..04d225287b8 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestClassDump.java +++ b/test/hotspot/jtreg/serviceability/sa/TestClassDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -49,7 +49,7 @@ public class TestClassDump { ProcessBuilder pb; OutputAnalyzer output; - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Dsun.jvm.hotspot.tools.jcore.outputDir=jtreg_classes", "-m", "jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump", String.valueOf(lingeredAppPid)); SATestUtils.addPrivilegesIfNeeded(pb); @@ -68,7 +68,7 @@ public class TestClassDump { throw new RuntimeException("jtreg_classes/sun/net/util/URLUtil.class not found"); } - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Dsun.jvm.hotspot.tools.jcore.outputDir=jtreg_classes2", "-Dsun.jvm.hotspot.tools.jcore.PackageNameFilter.pkgList=jdk,sun", "-m", "jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore.ClassDump", String.valueOf(lingeredAppPid)); diff --git a/test/hotspot/jtreg/serviceability/sa/TestCpoolForInvokeDynamic.java b/test/hotspot/jtreg/serviceability/sa/TestCpoolForInvokeDynamic.java index 4753c924f1e..ca5c99d00b8 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestCpoolForInvokeDynamic.java +++ b/test/hotspot/jtreg/serviceability/sa/TestCpoolForInvokeDynamic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -91,7 +91,7 @@ public class TestCpoolForInvokeDynamic { String[] instanceKlassNames, long lingeredAppPid) throws Exception { // Start a new process to attach to the lingered app - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/TestDefaultMethods.java b/test/hotspot/jtreg/serviceability/sa/TestDefaultMethods.java index f674008e2f8..094c7525048 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestDefaultMethods.java +++ b/test/hotspot/jtreg/serviceability/sa/TestDefaultMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -98,7 +98,7 @@ public class TestDefaultMethods { String[] instanceKlassNames, long lingeredAppPid) throws Exception { // Start a new process to attach to the lingered app - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/TestG1HeapRegion.java b/test/hotspot/jtreg/serviceability/sa/TestG1HeapRegion.java index 70b9f066257..5c344b408dc 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestG1HeapRegion.java +++ b/test/hotspot/jtreg/serviceability/sa/TestG1HeapRegion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -72,7 +72,7 @@ public class TestG1HeapRegion { private static void createAnotherToAttach(long lingeredAppPid) throws Exception { // Start a new process to attach to the lingered app - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.gc.g1=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java b/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java index a2190d48487..ebe55b75061 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java +++ b/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -82,7 +82,7 @@ public class TestInstanceKlassSize { } try { // Run this app with the LingeredApp PID to get SA output from the LingeredApp - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSizeForInterface.java b/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSizeForInterface.java index f2310dfe561..e0f7cbecd2f 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSizeForInterface.java +++ b/test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSizeForInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -103,7 +103,7 @@ public class TestInstanceKlassSizeForInterface { String[] instanceKlassNames, int lingeredAppPid) throws Exception { // Start a new process to attach to the LingeredApp process to get SA info - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java index 36772043668..9119ac45cc3 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -71,7 +71,7 @@ public class TestJmapCore { } static void test(String type) throws Throwable { - ProcessBuilder pb = ProcessTools.createTestJvm("-XX:+CreateCoredumpOnCrash", + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-XX:+CreateCoredumpOnCrash", "-Xmx512m", "-XX:MaxMetaspaceSize=64m", "-XX:+CrashOnOutOfMemoryError", // The test loads lots of small classes to exhaust Metaspace, skip method // dependency verification to improve performance in debug builds. diff --git a/test/hotspot/jtreg/serviceability/sa/TestObjectAlignment.java b/test/hotspot/jtreg/serviceability/sa/TestObjectAlignment.java index 236dee6c39d..84744c70cdf 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestObjectAlignment.java +++ b/test/hotspot/jtreg/serviceability/sa/TestObjectAlignment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -64,7 +64,7 @@ public class TestObjectAlignment { private static void createAnotherToAttach(long lingeredAppPid, int expectedAlign) throws Exception { // Start a new process to attach to the lingered app - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java b/test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java index 666fa169363..5ab95277526 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java +++ b/test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java @@ -73,7 +73,7 @@ public class TestObjectMonitorIterate { private static void createAnotherToAttach(long lingeredAppPid) throws Exception { // Start a new process to attach to the lingered app - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/TestRevPtrsForInvokeDynamic.java b/test/hotspot/jtreg/serviceability/sa/TestRevPtrsForInvokeDynamic.java index da7334503db..315c931d49e 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestRevPtrsForInvokeDynamic.java +++ b/test/hotspot/jtreg/serviceability/sa/TestRevPtrsForInvokeDynamic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -66,7 +66,7 @@ public class TestRevPtrsForInvokeDynamic { private static void createAnotherToAttach(long lingeredAppPid) throws Exception { // Start a new process to attach to the lingered app - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java b/test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java index 533ef82b4f3..932974d2dce 100644 --- a/test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java +++ b/test/hotspot/jtreg/serviceability/sa/UniqueVtableTest.java @@ -146,7 +146,7 @@ public class UniqueVtableTest { private static void createAnotherToAttach(long lingeredAppPid) throws Throwable { // Start a new process to attach to the lingered app - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( "--add-modules=jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED", diff --git a/test/hotspot/jtreg/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java b/test/hotspot/jtreg/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java index ef31f325481..9d923f7b710 100644 --- a/test/hotspot/jtreg/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java +++ b/test/hotspot/jtreg/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java @@ -77,7 +77,7 @@ public class JMapHProfLargeHeapTest { private static void testHProfFileFormat(String vmArgs, long heapSize, String expectedFormat) throws Exception, IOException, InterruptedException, FileNotFoundException { - ProcessBuilder procBuilder = ProcessTools.createTestJvm( + ProcessBuilder procBuilder = ProcessTools.createTestJavaProcessBuilder( "--add-exports=java.management/sun.management=ALL-UNNAMED", vmArgs, "JMapHProfLargeHeapProc", String.valueOf(heapSize)); procBuilder.redirectError(ProcessBuilder.Redirect.INHERIT); Process largeHeapProc = procBuilder.start(); diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java index c23561b6d52..478b74c2741 100644 --- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java +++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java @@ -183,7 +183,7 @@ public class CtwRunner { while (!done) { String[] cmd = cmd(classStart, classStop); try { - ProcessBuilder pb = ProcessTools.createTestJvm(cmd); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmd); String commandLine = pb.command() .stream() .collect(Collectors.joining(" ")); diff --git a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java index e350d5cf121..1f824c5109f 100644 --- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java +++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -47,7 +47,7 @@ public class JitTesterDriver { } OutputAnalyzer oa; try { - ProcessBuilder pb = ProcessTools.createTestJvm(args); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(args); oa = new OutputAnalyzer(pb.start()); } catch (Exception e) { throw new Error("Unexpected exception on test jvm start :" + e, e); diff --git a/test/hotspot/jtreg/testlibrary_tests/ctw/CtwTest.java b/test/hotspot/jtreg/testlibrary_tests/ctw/CtwTest.java index ec22510bf8d..2aa2e2a207b 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ctw/CtwTest.java +++ b/test/hotspot/jtreg/testlibrary_tests/ctw/CtwTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -103,7 +103,7 @@ public abstract class CtwTest { } } } - ProcessBuilder pb = ProcessTools.createTestJvm(cmd); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmd); OutputAnalyzer output = new OutputAnalyzer(pb.start()); dump(output, "compile"); output.shouldHaveExitValue(0); diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestDScenarios.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestDScenarios.java index 10a49f9a3c7..e5476afc1f6 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestDScenarios.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestDScenarios.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -73,7 +73,7 @@ public class TestDScenarios { } else { // Test invalid -DScenario flag. OutputAnalyzer oa; - ProcessBuilder process = ProcessTools.createJavaProcessBuilder( + ProcessBuilder process = ProcessTools.createLimitedTestJavaProcessBuilder( "-Dtest.jdk=" + Utils.TEST_JDK, "-DScenarios=a,1,b,10", "ir_framework.tests.TestDScenarios", " test3"); oa = ProcessTools.executeProcess(process); diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestDTestAndExclude.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestDTestAndExclude.java index b74012fd54a..22d52f692a3 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestDTestAndExclude.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestDTestAndExclude.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -97,7 +97,7 @@ public class TestDTestAndExclude { protected static void run(String dTest, String dExclude, String arg) throws Exception { System.out.println("Run -DTest=" + dTest + " -DExclude=" + dExclude + " arg=" + arg); OutputAnalyzer oa; - ProcessBuilder process = ProcessTools.createJavaProcessBuilder( + ProcessBuilder process = ProcessTools.createLimitedTestJavaProcessBuilder( "-Dtest.class.path=" + Utils.TEST_CLASS_PATH, "-Dtest.jdk=" + Utils.TEST_JDK, "-Dtest.vm.opts=-DTest=" + dTest + " -DExclude=" + dExclude, "ir_framework.tests.TestDTestAndExclude", arg); diff --git a/test/hotspot/jtreg/vmTestbase/gc/huge/quicklook/largeheap/MemOptions/MemOptionsTest.java b/test/hotspot/jtreg/vmTestbase/gc/huge/quicklook/largeheap/MemOptions/MemOptionsTest.java index 8eea44148ed..67e629fddcd 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/huge/quicklook/largeheap/MemOptions/MemOptionsTest.java +++ b/test/hotspot/jtreg/vmTestbase/gc/huge/quicklook/largeheap/MemOptions/MemOptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -93,7 +93,7 @@ public class MemOptionsTest { var cmd = new ArrayList(); Collections.addAll(cmd, opts); cmd.add(MemStat.class.getName()); - var pb = ProcessTools.createTestJvm(cmd); + var pb = ProcessTools.createTestJavaProcessBuilder(cmd); var output = new OutputAnalyzer(pb.start()); if (output.getExitValue() != 0) { output.reportDiagnosticSummary(); @@ -106,7 +106,7 @@ public class MemOptionsTest { var cmd = new ArrayList(); Collections.addAll(cmd, opts); cmd.add(MemStat.class.getName()); - var pb = ProcessTools.createTestJvm(cmd); + var pb = ProcessTools.createTestJavaProcessBuilder(cmd); var output = new OutputAnalyzer(pb.start()); if (output.getExitValue() == 0) { output.reportDiagnosticSummary(); diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/flags/maxMetaspaceSize/TestMaxMetaspaceSize.java b/test/hotspot/jtreg/vmTestbase/metaspace/flags/maxMetaspaceSize/TestMaxMetaspaceSize.java index 5df4b8aea8f..728c6baed6e 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/flags/maxMetaspaceSize/TestMaxMetaspaceSize.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/flags/maxMetaspaceSize/TestMaxMetaspaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,8 +40,8 @@ import jdk.test.lib.process.ProcessTools; public class TestMaxMetaspaceSize { public static void main(String[] args) throws Exception { ProcessBuilder pb = - ProcessTools.createTestJvm("-XX:MaxMetaspaceSize=100m", - maxMetaspaceSize.class.getName()); + ProcessTools.createTestJavaProcessBuilder("-XX:MaxMetaspaceSize=100m", + maxMetaspaceSize.class.getName()); OutputAnalyzer out = new OutputAnalyzer(pb.start()); if (out.getExitValue() == 0) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.java index 25ceeeecfbc..f81acedbaec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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 @@ -80,7 +80,7 @@ public class alloc001 { private static final int STATUS_NO_OOM = 3 + STATUS_BASE; public static void main(String[] args) throws Throwable { - String cmd = ProcessTools.getCommandLine(ProcessTools.createTestJvm( + String cmd = ProcessTools.getCommandLine(ProcessTools.createTestJavaProcessBuilder( "-XX:MaxHeapSize=" + (Platform.is32bit() ? "256m" : "512m"), "-Djava.library.path=" + Utils.TEST_NATIVE_PATH, "-agentpath:" + Utils.TEST_NATIVE_PATH + File.separator + System.mapLibraryName("alloc001"), diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/TestDriver.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/TestDriver.java index 57afb3a0e46..be48854648f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/TestDriver.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/TestDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -68,7 +68,7 @@ import java.util.Arrays; public class TestDriver { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-agentlib:retransform003-01=id=1 can_retransform_classes=1", "-agentlib:retransform003-02=id=2 can_retransform_classes=0", "-agentlib:retransform003-03=id=3 can_retransform_classes=1", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/TestDriver.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/TestDriver.java index b1057f9893e..898e7671332 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/TestDriver.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/TestDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -57,7 +57,7 @@ import java.util.Arrays; public class TestDriver { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-agentlib:SetNativeMethodPrefix001=trace=all", "-agentlib:SetNativeMethodPrefix002-01=trace=all prefix=wa_", "-agentlib:SetNativeMethodPrefix002-02=trace=all prefix=wb_", diff --git a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java b/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java index 118d6c8f821..f63eb21a893 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -69,7 +69,7 @@ public class Test { public static void main(String[] args) throws Exception { { System.out.println("SegmentedCodeCache is enabled"); - var pb = ProcessTools.createTestJvm( + var pb = ProcessTools.createTestJavaProcessBuilder( "-XX:+SegmentedCodeCache", "-XX:+PrintCodeCache", "-version"); @@ -79,7 +79,7 @@ public class Test { } { System.out.println("SegmentedCodeCache is disabled"); - var pb = ProcessTools.createTestJvm( + var pb = ProcessTools.createTestJavaProcessBuilder( "-XX:-SegmentedCodeCache", "-XX:+PrintCodeCache", "-version"); diff --git a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfoOnCompilation/Test.java b/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfoOnCompilation/Test.java index 4580e7f0ec8..145072487ec 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfoOnCompilation/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfoOnCompilation/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ public class Test { private static String REGEXP = "^(CodeCache|(CodeHeap.*)): size=\\d+Kb used=\\d+Kb max_used=\\d+Kb free=\\d+Kb"; public static void main(String[] args) throws Exception { - var pb = ProcessTools.createTestJvm( + var pb = ProcessTools.createTestJavaProcessBuilder( "-XX:-PrintCodeCache", "-XX:+PrintCodeCacheOnCompilation", "-XX:-Inline", diff --git a/test/jdk/com/sun/jdi/JITDebug.java b/test/jdk/com/sun/jdi/JITDebug.java index e7a5647fdd4..45ec0f2ea79 100644 --- a/test/jdk/com/sun/jdi/JITDebug.java +++ b/test/jdk/com/sun/jdi/JITDebug.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2023, 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 @@ -104,7 +104,7 @@ public class JITDebug { } void testLaunch() { - ProcessBuilder pb = ProcessTools.createTestJvm(); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(); List largs = pb.command(); largs.add("-classpath"); largs.add(Utils.TEST_CLASSES); diff --git a/test/jdk/com/sun/jdi/NoLaunchOptionTest.java b/test/jdk/com/sun/jdi/NoLaunchOptionTest.java index 275b130bf96..fca9d59196f 100644 --- a/test/jdk/com/sun/jdi/NoLaunchOptionTest.java +++ b/test/jdk/com/sun/jdi/NoLaunchOptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, 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 @@ -45,7 +45,7 @@ public class NoLaunchOptionTest extends Object { "onthrow=java.lang.ClassNotFoundException,suspend=n", "NotAClass" }); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(cmd); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(cmd); OutputAnalyzer output = ProcessTools.executeProcess(pb); System.out.println(output.getOutput()); diff --git a/test/jdk/com/sun/jdi/PrivateTransportTest.java b/test/jdk/com/sun/jdi/PrivateTransportTest.java index c12db8b90be..a023b8a752c 100644 --- a/test/jdk/com/sun/jdi/PrivateTransportTest.java +++ b/test/jdk/com/sun/jdi/PrivateTransportTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2023, 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 @@ -82,7 +82,7 @@ public class PrivateTransportTest { String libName = transportLib.getFileName().toString().replace("dt_socket", "private_dt_socket"); Files.copy(transportLib, Paths.get(Utils.TEST_CLASSES).resolve(libName)); - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-agentlib:jdwp=transport=private_dt_socket,server=y,suspend=n", "-classpath", Utils.TEST_CLASSES, "HelloWorld"); diff --git a/test/jdk/com/sun/jdi/ProcessAttachTest.java b/test/jdk/com/sun/jdi/ProcessAttachTest.java index 04cc8320570..746b5d047fe 100644 --- a/test/jdk/com/sun/jdi/ProcessAttachTest.java +++ b/test/jdk/com/sun/jdi/ProcessAttachTest.java @@ -69,7 +69,7 @@ public class ProcessAttachTest { } private static void runTest(String jdwpArg) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( jdwpArg, "ProcessAttachTestTarg"); Process p = null; diff --git a/test/jdk/com/sun/jdi/RunToExit.java b/test/jdk/com/sun/jdi/RunToExit.java index d5fd5d2b6f7..a7c7058b7aa 100644 --- a/test/jdk/com/sun/jdi/RunToExit.java +++ b/test/jdk/com/sun/jdi/RunToExit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, 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 @@ -79,7 +79,7 @@ public class RunToExit { }; args = VMConnection.insertDebuggeeVMOptions(args); - ProcessBuilder launcher = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder launcher = ProcessTools.createLimitedTestJavaProcessBuilder(args); System.out.println(launcher.command().stream().collect(Collectors.joining(" ", "Starting: ", ""))); diff --git a/test/jdk/com/sun/jdi/cds/CDSJDITest.java b/test/jdk/com/sun/jdi/cds/CDSJDITest.java index 22abd30163f..0ec201d7035 100644 --- a/test/jdk/com/sun/jdi/cds/CDSJDITest.java +++ b/test/jdk/com/sun/jdi/cds/CDSJDITest.java @@ -39,7 +39,7 @@ public class CDSJDITest { File jarClasslistFile = makeClassList(jarClasses); String appJar = buildJar(testname, jarClasses); - // These are the arguments passed to createJavaProcessBuilder() to launch + // These are the arguments passed to createLimitedTestJavaProcessBuilder() to launch // the JDI test. String[] testArgs = { // JVM Args: @@ -67,7 +67,7 @@ public class CDSJDITest { }; // Dump the archive - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xbootclasspath/a:" + appJar, "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", "-XX:ExtraSharedClassListFile=" + jarClasslistFile.getPath(), @@ -80,7 +80,7 @@ public class CDSJDITest { outputDump.shouldHaveExitValue(0); // Run the test specified JDI test - pb = ProcessTools.createTestJvm(testArgs); + pb = ProcessTools.createTestJavaProcessBuilder(testArgs); OutputAnalyzer outputRun = executeAndLog(pb, "exec"); try { outputRun.shouldContain("sharing"); diff --git a/test/jdk/com/sun/jdi/lib/jdb/Debuggee.java b/test/jdk/com/sun/jdi/lib/jdb/Debuggee.java index 8d6f840254d..709e5f0912a 100644 --- a/test/jdk/com/sun/jdi/lib/jdb/Debuggee.java +++ b/test/jdk/com/sun/jdi/lib/jdb/Debuggee.java @@ -123,7 +123,7 @@ public class Debuggee implements Closeable { + onthrowArgs); debuggeeArgs.addAll(options); debuggeeArgs.add(mainClass); - return ProcessTools.createTestJvm(debuggeeArgs); + return ProcessTools.createTestJavaProcessBuilder(debuggeeArgs); } public Debuggee launch(String name) { diff --git a/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java b/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java index 133ca19be74..d0557e630f0 100644 --- a/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java +++ b/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java @@ -60,7 +60,7 @@ public class CheckOrigin { } ProcessBuilder pb = ProcessTools. - createJavaProcessBuilder( + createLimitedTestJavaProcessBuilder( "--add-exports", "jdk.attach/sun.tools.attach=ALL-UNNAMED", "-XX:+UseG1GC", // this will cause MaxNewSize to be FLAG_SET_ERGO "-XX:+UseCodeCacheFlushing", diff --git a/test/jdk/com/sun/tools/attach/RunnerUtil.java b/test/jdk/com/sun/tools/attach/RunnerUtil.java index 92f1a951d07..120736de21b 100644 --- a/test/jdk/com/sun/tools/attach/RunnerUtil.java +++ b/test/jdk/com/sun/tools/attach/RunnerUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -53,7 +53,7 @@ public class RunnerUtil { "-Dattach.test=true", "-classpath", classpath, "Application" }); String[] args = Utils.addTestJavaOpts(myArgs); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); ProcessThread pt = new ProcessThread("runApplication", (line) -> line.equals(Application.READY_MSG), pb); pt.start(); return pt; diff --git a/test/jdk/java/awt/MenuBar/TestNoScreenMenuBar.java b/test/jdk/java/awt/MenuBar/TestNoScreenMenuBar.java index fb545ca8480..a903b31c5c4 100644 --- a/test/jdk/java/awt/MenuBar/TestNoScreenMenuBar.java +++ b/test/jdk/java/awt/MenuBar/TestNoScreenMenuBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -148,7 +148,7 @@ public class TestNoScreenMenuBar private Process execute() { try { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( TestNoScreenMenuBar.class.getSimpleName(), "mark"); return ProcessTools.startProcess("Other frame", pb); } catch (IOException ex) { diff --git a/test/jdk/java/awt/Robot/NonEmptyErrorStream.java b/test/jdk/java/awt/Robot/NonEmptyErrorStream.java index 87137ac74ed..5bdada8aa5f 100644 --- a/test/jdk/java/awt/Robot/NonEmptyErrorStream.java +++ b/test/jdk/java/awt/Robot/NonEmptyErrorStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public final class NonEmptyErrorStream { public static void main(String[] args) throws Exception { if (args.length == 0) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( NonEmptyErrorStream.class.getSimpleName(),"run"); Process p = pb.start(); OutputAnalyzer output = new OutputAnalyzer(p); diff --git a/test/jdk/java/awt/Toolkit/ScreenInsetsDPIVariation/ScreenInsetsDPIVariation.java b/test/jdk/java/awt/Toolkit/ScreenInsetsDPIVariation/ScreenInsetsDPIVariation.java index e089ef26ca9..244f8bb6bd7 100644 --- a/test/jdk/java/awt/Toolkit/ScreenInsetsDPIVariation/ScreenInsetsDPIVariation.java +++ b/test/jdk/java/awt/Toolkit/ScreenInsetsDPIVariation/ScreenInsetsDPIVariation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -102,7 +102,7 @@ public final class ScreenInsetsDPIVariation { private static void runProcess(String dpi, int screen, Insets insets) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Dsun.java2d.uiScale=" + dpi, ScreenInsetsDPIVariation.class.getSimpleName(), String.valueOf(screen), String.valueOf(insets.left), diff --git a/test/jdk/java/awt/Window/MainKeyWindowTest/TestMainKeyWindow.java b/test/jdk/java/awt/Window/MainKeyWindowTest/TestMainKeyWindow.java index 1b052f953a9..51ce7721ef7 100644 --- a/test/jdk/java/awt/Window/MainKeyWindowTest/TestMainKeyWindow.java +++ b/test/jdk/java/awt/Window/MainKeyWindowTest/TestMainKeyWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -149,7 +149,7 @@ public class TestMainKeyWindow private Process execute() { try { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( TestMainKeyWindow.class.getSimpleName(), "mark"); return ProcessTools.startProcess("Other frame", pb); } catch (IOException ex) { diff --git a/test/jdk/java/awt/Window/MinimumSizeDPIVariation/MinimumSizeDPIVariation.java b/test/jdk/java/awt/Window/MinimumSizeDPIVariation/MinimumSizeDPIVariation.java index f00564ff934..534f25c4cbb 100644 --- a/test/jdk/java/awt/Window/MinimumSizeDPIVariation/MinimumSizeDPIVariation.java +++ b/test/jdk/java/awt/Window/MinimumSizeDPIVariation/MinimumSizeDPIVariation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -110,7 +110,7 @@ public final class MinimumSizeDPIVariation { private static void runProcess(String dpi, String comp, int w, int h) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Dsun.java2d.uiScale=" + dpi, MinimumSizeDPIVariation.class.getSimpleName(), comp, String.valueOf(w), String.valueOf(h), dpi); diff --git a/test/jdk/java/awt/color/ICC_ColorSpace/MTTransformReplacedProfile.java b/test/jdk/java/awt/color/ICC_ColorSpace/MTTransformReplacedProfile.java index 9694554ed4f..9a82c3c85c9 100644 --- a/test/jdk/java/awt/color/ICC_ColorSpace/MTTransformReplacedProfile.java +++ b/test/jdk/java/awt/color/ICC_ColorSpace/MTTransformReplacedProfile.java @@ -1,6 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -49,7 +49,7 @@ public final class MTTransformReplacedProfile { public static void main(String[] args) throws Exception { if (args.length > 0 && args[0].equals("checkJNI")) { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-Xcheck:jni", MTTransformReplacedProfile.class.getName()); OutputAnalyzer oa = ProcessTools.executeProcess(pb); oa.stderrShouldBeEmpty(); diff --git a/test/jdk/java/awt/font/JNICheck/FreeTypeScalerJNICheck.java b/test/jdk/java/awt/font/JNICheck/FreeTypeScalerJNICheck.java index a71918c2297..73c2770fba5 100644 --- a/test/jdk/java/awt/font/JNICheck/FreeTypeScalerJNICheck.java +++ b/test/jdk/java/awt/font/JNICheck/FreeTypeScalerJNICheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, JetBrains s.r.o.. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -43,7 +43,7 @@ public class FreeTypeScalerJNICheck { if (args.length > 0 && args[0].equals("runtest")) { runTest(); } else { - ProcessBuilder pb = ProcessTools.createTestJvm("-Xcheck:jni", FreeTypeScalerJNICheck.class.getName(), "runtest"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-Xcheck:jni", FreeTypeScalerJNICheck.class.getName(), "runtest"); OutputAnalyzer oa = ProcessTools.executeProcess(pb); oa.shouldContain("Done").shouldNotContain("WARNING").shouldHaveExitValue(0); } diff --git a/test/jdk/java/foreign/UpcallTestHelper.java b/test/jdk/java/foreign/UpcallTestHelper.java index 1c2ca8aee80..2939c4bfd37 100644 --- a/test/jdk/java/foreign/UpcallTestHelper.java +++ b/test/jdk/java/foreign/UpcallTestHelper.java @@ -63,7 +63,7 @@ public class UpcallTestHelper extends NativeTestHelper { )); command.addAll(Arrays.asList(programArgs)); - Process process = ProcessTools.createTestJvm(command).start(); + Process process = ProcessTools.createTestJavaProcessBuilder(command).start(); int result = process.waitFor(); assertNotEquals(result, 0); diff --git a/test/jdk/java/io/Console/RedirectTest.java b/test/jdk/java/io/Console/RedirectTest.java index d7aa6c64468..644ece9c3a2 100644 --- a/test/jdk/java/io/Console/RedirectTest.java +++ b/test/jdk/java/io/Console/RedirectTest.java @@ -40,7 +40,7 @@ public class RedirectTest { public static void main(String... args) throws Throwable { if (args.length == 0) { // no arg will launch the child process that actually perform tests - var pb = ProcessTools.createTestJvm( + var pb = ProcessTools.createTestJavaProcessBuilder( "-D" + SYSPROP + "=" + System.getProperty(SYSPROP, ""), "RedirectTest", "dummy"); var input = new File(System.getProperty("test.src", "."), "input.txt"); diff --git a/test/jdk/java/io/File/MacPath.java b/test/jdk/java/io/File/MacPath.java index a9d91018783..751113b7fd8 100644 --- a/test/jdk/java/io/File/MacPath.java +++ b/test/jdk/java/io/File/MacPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import jdk.test.lib.process.ProcessTools; public class MacPath { public static void main(String args[]) throws Exception { final ProcessBuilder pb = - ProcessTools.createTestJvm(MacPathTest.class.getName()); + ProcessTools.createTestJavaProcessBuilder(MacPathTest.class.getName()); final Map env = pb.environment(); env.put("LC_ALL", "en_US.UTF-8"); Process p = ProcessTools.startProcess("Mac Path Test", pb); diff --git a/test/jdk/java/io/Serializable/class/NonSerializableTest.java b/test/jdk/java/io/Serializable/class/NonSerializableTest.java index b2ac4e933cb..fa81b3e3ce7 100644 --- a/test/jdk/java/io/Serializable/class/NonSerializableTest.java +++ b/test/jdk/java/io/Serializable/class/NonSerializableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -102,7 +102,7 @@ public class NonSerializableTest { Paths.get(System.getProperty("user.dir"))); assertTrue(b, "Compilation failed"); String params[] = Arrays.copyOfRange(args, 1, args.length); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(params); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(params); Process p = ProcessTools.startProcess("Serializable Test", pb); int exitValue = p.waitFor(); assertEquals(exitValue, 0, "Test failed"); diff --git a/test/jdk/java/io/Serializable/evolution/RenamePackage/RenamePackageTest.java b/test/jdk/java/io/Serializable/evolution/RenamePackage/RenamePackageTest.java index faccc09bb4b..bf51dc66c54 100644 --- a/test/jdk/java/io/Serializable/evolution/RenamePackage/RenamePackageTest.java +++ b/test/jdk/java/io/Serializable/evolution/RenamePackage/RenamePackageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -81,7 +81,7 @@ public class RenamePackageTest { } private static void runTestSerialDriver() throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-classpath", SHARE.toString() + File.pathSeparator @@ -93,7 +93,7 @@ public class RenamePackageTest { } private static void runInstallSerialDriver() throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-classpath", SHARE.toString() + File.pathSeparator diff --git a/test/jdk/java/lang/ClassLoader/GetSystemPackage.java b/test/jdk/java/lang/ClassLoader/GetSystemPackage.java index 25967bca620..2af81f3c416 100644 --- a/test/jdk/java/lang/ClassLoader/GetSystemPackage.java +++ b/test/jdk/java/lang/ClassLoader/GetSystemPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -118,7 +118,7 @@ public class GetSystemPackage { private static void runSubProcess(String messageOnError, String ... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); int res = pb.directory(tmpFolder).inheritIO().start().waitFor(); if (res != 0) { throw new RuntimeException(messageOnError); diff --git a/test/jdk/java/lang/Object/InvalidFinalizationOption.java b/test/jdk/java/lang/Object/InvalidFinalizationOption.java index c5cca549ead..f87ecfe9045 100644 --- a/test/jdk/java/lang/Object/InvalidFinalizationOption.java +++ b/test/jdk/java/lang/Object/InvalidFinalizationOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ public class InvalidFinalizationOption { }; for (var data : testData) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(data.arg); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(data.arg); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain(data.expected); output.shouldHaveExitValue(1); diff --git a/test/jdk/java/lang/ProcessBuilder/InheritIOTest.java b/test/jdk/java/lang/ProcessBuilder/InheritIOTest.java index 340507cb37b..f1c1940f538 100644 --- a/test/jdk/java/lang/ProcessBuilder/InheritIOTest.java +++ b/test/jdk/java/lang/ProcessBuilder/InheritIOTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -54,7 +54,7 @@ public class InheritIOTest { @Test(dataProvider = "testCases") public void testInheritWithoutRedirect(List arguments) throws Throwable { - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(arguments); + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder(arguments); OutputAnalyzer outputAnalyzer = ProcessTools.executeCommand(processBuilder); outputAnalyzer.shouldHaveExitValue(0); assertEquals(outputAnalyzer.getStdout(), EXPECTED_RESULT_STDOUT); diff --git a/test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java b/test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java index d82a317148e..00543b09947 100644 --- a/test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java +++ b/test/jdk/java/lang/ProcessBuilder/JspawnhelperProtocol.java @@ -78,9 +78,9 @@ public class JspawnhelperProtocol { private static void normalExec() throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder("-Djdk.lang.Process.launchMechanism=posix_spawn", - "JspawnhelperProtocol", - "normalExec"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Djdk.lang.Process.launchMechanism=posix_spawn", + "JspawnhelperProtocol", + "normalExec"); pb.inheritIO(); Process p = pb.start(); if (!p.waitFor(TIMEOUT, TimeUnit.SECONDS)) { @@ -93,9 +93,9 @@ public class JspawnhelperProtocol { private static void simulateCrashInChild(int stage) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder("-Djdk.lang.Process.launchMechanism=posix_spawn", - "JspawnhelperProtocol", - "simulateCrashInChild" + stage); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Djdk.lang.Process.launchMechanism=posix_spawn", + "JspawnhelperProtocol", + "simulateCrashInChild" + stage); pb.environment().put(ENV_KEY, Integer.toString(stage)); Process p = pb.start(); @@ -126,9 +126,9 @@ public class JspawnhelperProtocol { private static void simulateCrashInParent(int stage) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder("-Djdk.lang.Process.launchMechanism=posix_spawn", - "JspawnhelperProtocol", - "simulateCrashInParent" + stage); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Djdk.lang.Process.launchMechanism=posix_spawn", + "JspawnhelperProtocol", + "simulateCrashInParent" + stage); pb.environment().put(ENV_KEY, Integer.toString(stage)); Process p = pb.start(); @@ -172,9 +172,9 @@ public class JspawnhelperProtocol { private static void simulateTruncatedWriteInParent(int stage) throws Exception { ProcessBuilder pb; - pb = ProcessTools.createJavaProcessBuilder("-Djdk.lang.Process.launchMechanism=posix_spawn", - "JspawnhelperProtocol", - "simulateTruncatedWriteInParent" + stage); + pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Djdk.lang.Process.launchMechanism=posix_spawn", + "JspawnhelperProtocol", + "simulateTruncatedWriteInParent" + stage); pb.environment().put(ENV_KEY, Integer.toString(stage)); Process p = pb.start(); diff --git a/test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java b/test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java index efe4f842c7f..3768b34ea53 100644 --- a/test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java +++ b/test/jdk/java/lang/ProcessBuilder/ReaderWriterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -82,7 +82,7 @@ public class ReaderWriterTest { Charset cs = Charset.forName(nativeEncoding); System.out.println("Native.encoding Charset: " + cs); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("ReaderWriterTest$ChildWithCharset"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("ReaderWriterTest$ChildWithCharset"); Process p = pb.start(); writeTestChars(p.outputWriter()); checkReader(p.inputReader(), cs, "Out"); @@ -121,7 +121,7 @@ public class ReaderWriterTest { // 2: redirectErrorStream(true); no redirect of errorOutput // 3: redirectErrorStream(true); redirect of errorOutput to a file - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("ReaderWriterTest$ChildWithCharset"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("ReaderWriterTest$ChildWithCharset"); pb.redirectInput(inPath.toFile()); pb.redirectOutput(outPath.toFile()); if (errType == 1 || errType == 3) { @@ -191,7 +191,7 @@ public class ReaderWriterTest { } String cleanCSName = cleanCharsetName(cs); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Dsun.stdout.encoding=" + cleanCSName, // Encode in the child using the charset "-Dsun.stderr.encoding=" + cleanCSName, "ReaderWriterTest$ChildWithCharset"); @@ -217,7 +217,7 @@ public class ReaderWriterTest { @Test void testNullCharsets() throws IOException { // Launch a child; its behavior is not interesting and is ignored - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "ReaderWriterTest$ChildWithCharset"); Process p = pb.start(); @@ -263,7 +263,7 @@ public class ReaderWriterTest { : StandardCharsets.UTF_8; // Launch a child; its behavior is not interesting and is ignored - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "ReaderWriterTest$ChildWithCharset"); Process p = pb.start(); diff --git a/test/jdk/java/lang/RuntimeTests/shutdown/ShutdownInterruptedMain.java b/test/jdk/java/lang/RuntimeTests/shutdown/ShutdownInterruptedMain.java index e141fc35212..85040e9548e 100644 --- a/test/jdk/java/lang/RuntimeTests/shutdown/ShutdownInterruptedMain.java +++ b/test/jdk/java/lang/RuntimeTests/shutdown/ShutdownInterruptedMain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -31,14 +31,14 @@ */ import jdk.test.lib.process.OutputAnalyzer; -import static jdk.test.lib.process.ProcessTools.createTestJvm; +import static jdk.test.lib.process.ProcessTools.createTestJavaProcessBuilder; import static jdk.test.lib.process.ProcessTools.executeProcess; public class ShutdownInterruptedMain { public static void main(String[] args) throws Exception { if (args.length > 0) { - ProcessBuilder pb = createTestJvm("ShutdownInterruptedMain"); + ProcessBuilder pb = createTestJavaProcessBuilder("ShutdownInterruptedMain"); OutputAnalyzer output = executeProcess(pb); output.shouldContain("Shutdown Hook"); output.shouldHaveExitValue(0); diff --git a/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManagerTest.java b/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManagerTest.java index bb346f04b2a..92b9e44f892 100644 --- a/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManagerTest.java +++ b/test/jdk/java/lang/SecurityManager/modules/CustomSecurityManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -64,7 +64,7 @@ public class CustomSecurityManagerTest { @Test(dataProvider = "testCases") public void testProvider(List args) throws Throwable { - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder(args); OutputAnalyzer outputAnalyzer = ProcessTools.executeCommand(processBuilder); outputAnalyzer.shouldHaveExitValue(0); } diff --git a/test/jdk/java/lang/StackWalker/CallerFromMain.java b/test/jdk/java/lang/StackWalker/CallerFromMain.java index 3cb599c6859..86e7cfb7043 100644 --- a/test/jdk/java/lang/StackWalker/CallerFromMain.java +++ b/test/jdk/java/lang/StackWalker/CallerFromMain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -37,7 +37,7 @@ public class CallerFromMain { private static final StackWalker sw = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); public static void main(String[] args) throws Exception { if (args.length > 0) { - ProcessBuilder pb = ProcessTools.createTestJvm("CallerFromMain"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("CallerFromMain"); OutputAnalyzer output = ProcessTools.executeProcess(pb); System.out.println(output.getOutput()); output.shouldHaveExitValue(0); diff --git a/test/jdk/java/lang/System/FileEncodingTest.java b/test/jdk/java/lang/System/FileEncodingTest.java index 6bff90ccb8b..1e41194a29b 100644 --- a/test/jdk/java/lang/System/FileEncodingTest.java +++ b/test/jdk/java/lang/System/FileEncodingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -73,7 +73,7 @@ public class FileEncodingTest { var cmds = fileEncoding.isEmpty() ? List.of(FileEncodingTest.class.getName(), expected) : List.of("-Dfile.encoding=" + fileEncoding, FileEncodingTest.class.getName(), expected); - var pb = ProcessTools.createTestJvm(cmds); + var pb = ProcessTools.createTestJavaProcessBuilder(cmds); var env = pb.environment(); env.put("LANG", "C"); env.put("LC_ALL", "C"); diff --git a/test/jdk/java/lang/System/MacEncoding/MacJNUEncoding.java b/test/jdk/java/lang/System/MacEncoding/MacJNUEncoding.java index a962bbb7002..a58686871d5 100644 --- a/test/jdk/java/lang/System/MacEncoding/MacJNUEncoding.java +++ b/test/jdk/java/lang/System/MacEncoding/MacJNUEncoding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -55,7 +55,7 @@ public class MacJNUEncoding { var cmds = (args.length == 4) ? List.of("-Dfile.encoding=" + args[3], ExpectedEncoding.class.getName(), args[0], args[1]) : List.of(ExpectedEncoding.class.getName(), args[0], args[1]); - ProcessBuilder pb = ProcessTools.createTestJvm(cmds); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmds); Map env = pb.environment(); env.put("LANG", locale); env.put("LC_ALL", locale); diff --git a/test/jdk/java/lang/System/i18nEnvArg.java b/test/jdk/java/lang/System/i18nEnvArg.java index 776ea19f653..ba9d31cb373 100644 --- a/test/jdk/java/lang/System/i18nEnvArg.java +++ b/test/jdk/java/lang/System/i18nEnvArg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -80,7 +80,7 @@ public class i18nEnvArg { "i18nEnvArg$Verify", EUC_JP_TEXT)); } - pb = ProcessTools.createTestJvm(cmds); + pb = ProcessTools.createTestJavaProcessBuilder(cmds); Map environ = pb.environment(); environ.clear(); environ.put("LANG", "ja_JP.eucjp"); diff --git a/test/jdk/java/lang/Thread/UncaughtExceptionsTest.java b/test/jdk/java/lang/Thread/UncaughtExceptionsTest.java index e53c370e7f7..42d85593088 100644 --- a/test/jdk/java/lang/Thread/UncaughtExceptionsTest.java +++ b/test/jdk/java/lang/Thread/UncaughtExceptionsTest.java @@ -85,7 +85,7 @@ class UncaughtExceptionsTest { @MethodSource("testCases") void test(String className, int exitValue, String stdOutMatch, String stdErrMatch) throws Throwable { String cmd = "UncaughtExitSimulator$" + className; - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd); + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder(cmd); OutputAnalyzer outputAnalyzer = ProcessTools.executeCommand(processBuilder); outputAnalyzer.shouldHaveExitValue(exitValue); outputAnalyzer.stderrShouldMatch(stdErrMatch); diff --git a/test/jdk/java/lang/Thread/virtual/ShutdownHook.java b/test/jdk/java/lang/Thread/virtual/ShutdownHook.java index 84c59dcc82f..a30d3d295dd 100644 --- a/test/jdk/java/lang/Thread/virtual/ShutdownHook.java +++ b/test/jdk/java/lang/Thread/virtual/ShutdownHook.java @@ -29,14 +29,14 @@ */ import jdk.test.lib.process.OutputAnalyzer; -import static jdk.test.lib.process.ProcessTools.createTestJvm; +import static jdk.test.lib.process.ProcessTools.createTestJavaProcessBuilder; import static jdk.test.lib.process.ProcessTools.executeProcess; public class ShutdownHook { public static void main(String[] args) throws Exception { if (args.length > 0) { - ProcessBuilder pb = createTestJvm("ShutdownHook"); + ProcessBuilder pb = createTestJavaProcessBuilder("ShutdownHook"); OutputAnalyzer output = executeProcess(pb); output.shouldContain("Shutdown Hook"); output.shouldHaveExitValue(0); diff --git a/test/jdk/java/lang/annotation/LoaderLeakTest.java b/test/jdk/java/lang/annotation/LoaderLeakTest.java index e5e0a8d61c4..ed230d8df0e 100644 --- a/test/jdk/java/lang/annotation/LoaderLeakTest.java +++ b/test/jdk/java/lang/annotation/LoaderLeakTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, 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 @@ -55,7 +55,7 @@ public class LoaderLeakTest { } private void runJavaProcessExpectSuccessExitCode(String ... command) throws Throwable { - var processBuilder = ProcessTools.createJavaProcessBuilder(command) + var processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder(command) .directory(Paths.get(Utils.TEST_CLASSES).toFile()); ProcessTools.executeCommand(processBuilder).shouldHaveExitValue(0); } diff --git a/test/jdk/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java b/test/jdk/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java index 728fc5d17ab..697ca7366a0 100644 --- a/test/jdk/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java +++ b/test/jdk/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java @@ -1,6 +1,6 @@ /* * Copyright 2014 Goldman Sachs. - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ import jdk.test.lib.process.ProcessTools; public class TestDaemonThreadLauncher { public static void main(String args[]) throws Exception { for(int i=0; i<50; i++) { - ProcessBuilder pb = ProcessTools.createTestJvm("-javaagent:DummyAgent.jar", "TestDaemonThread", "."); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-javaagent:DummyAgent.jar", "TestDaemonThread", "."); OutputAnalyzer analyzer = ProcessTools.executeProcess(pb); analyzer.shouldNotContain("ASSERTION FAILED"); analyzer.shouldHaveExitValue(0); diff --git a/test/jdk/java/lang/instrument/NegativeAgentRunner.java b/test/jdk/java/lang/instrument/NegativeAgentRunner.java index 1b7ff2f7335..9689c323114 100644 --- a/test/jdk/java/lang/instrument/NegativeAgentRunner.java +++ b/test/jdk/java/lang/instrument/NegativeAgentRunner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -35,7 +35,7 @@ public class NegativeAgentRunner { } String agentClassName = argv[0]; String excepClassName = argv[1]; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-javaagent:" + agentClassName + ".jar", "-Xmx128m", "-XX:-CreateCoredumpOnCrash", agentClassName); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff --git a/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java b/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java index b59b69d3c75..ecd284fe6e0 100644 --- a/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java +++ b/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ public class PremainClassTest { System.getProperty("test.src"), System.getProperty("test.classes", ".")); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( Utils.addTestJavaOpts(testArgs.split("\\s+"))); System.out.println("testjvm.cmd:" + Utils.getCommandLine(pb)); diff --git a/test/jdk/java/lang/invoke/condy/CondyNestedResolutionTest.java b/test/jdk/java/lang/invoke/condy/CondyNestedResolutionTest.java index b5dd8befa48..914e90650da 100644 --- a/test/jdk/java/lang/invoke/condy/CondyNestedResolutionTest.java +++ b/test/jdk/java/lang/invoke/condy/CondyNestedResolutionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ import jdk.test.lib.compiler.InMemoryJavaCompiler; */ public class CondyNestedResolutionTest { public static void main(String args[]) throws Throwable { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("CondyNestedResolution"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("CondyNestedResolution"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldContain("StackOverflowError"); oa.shouldContain("bsm1arg"); diff --git a/test/jdk/java/nio/channels/Selector/LotsOfUpdatesTest.java b/test/jdk/java/nio/channels/Selector/LotsOfUpdatesTest.java index ef2c389ef39..86c3c828f70 100644 --- a/test/jdk/java/nio/channels/Selector/LotsOfUpdatesTest.java +++ b/test/jdk/java/nio/channels/Selector/LotsOfUpdatesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ public class LotsOfUpdatesTest { private static final String ULIMIT_SET_CMD = "ulimit -n 2048"; private static final String JAVA_CMD = ProcessTools.getCommandLine( - ProcessTools.createJavaProcessBuilder(LotsOfUpdates.class.getName())); + ProcessTools.createLimitedTestJavaProcessBuilder(LotsOfUpdates.class.getName())); public static void main(String[] args) throws Throwable { ProcessTools.executeCommand("sh", "-c", ULIMIT_SET_CMD + " && " + JAVA_CMD) diff --git a/test/jdk/java/nio/charset/Charset/DefaultCharsetTest.java b/test/jdk/java/nio/charset/Charset/DefaultCharsetTest.java index 9ea2902fb0d..be33ecb70f2 100644 --- a/test/jdk/java/nio/charset/Charset/DefaultCharsetTest.java +++ b/test/jdk/java/nio/charset/Charset/DefaultCharsetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -54,7 +54,7 @@ import static org.testng.Assert.assertTrue; public class DefaultCharsetTest { private static final ProcessBuilder pb - = ProcessTools.createTestJvm(Default.class.getName()); + = ProcessTools.createTestJavaProcessBuilder(Default.class.getName()); private static final Map env = pb.environment(); private static String UNSUPPORTED = null; diff --git a/test/jdk/java/nio/file/Path/MacPathTest.java b/test/jdk/java/nio/file/Path/MacPathTest.java index d3b37aa978d..7563e30338c 100644 --- a/test/jdk/java/nio/file/Path/MacPathTest.java +++ b/test/jdk/java/nio/file/Path/MacPathTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -49,9 +49,9 @@ public class MacPathTest { ProcessBuilder pb; if (NORMALIZE_FILE_PATHS) { String option = "-D" + PROPERTY_NORMALIZE_FILE_PATHS + "=true"; - pb = ProcessTools.createTestJvm(option, MacPath.class.getName()); + pb = ProcessTools.createTestJavaProcessBuilder(option, MacPath.class.getName()); } else { - pb = ProcessTools.createTestJvm(MacPath.class.getName()); + pb = ProcessTools.createTestJavaProcessBuilder(MacPath.class.getName()); } pb.environment().put("LC_ALL", "en_US.UTF-8"); ProcessTools.executeProcess(pb) diff --git a/test/jdk/java/security/SignedJar/SignedJarWithCustomClassLoader.java b/test/jdk/java/security/SignedJar/SignedJarWithCustomClassLoader.java index 1f335c87f14..540990bc82a 100644 --- a/test/jdk/java/security/SignedJar/SignedJarWithCustomClassLoader.java +++ b/test/jdk/java/security/SignedJar/SignedJarWithCustomClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -72,7 +72,7 @@ public class SignedJarWithCustomClassLoader { .shouldHaveExitValue(0); // run app with system class loader set to custom classloader - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-cp", "signed.jar", "-Djava.system.class.loader=CustomClassLoader", "Main"); ProcessTools.executeProcess(pb) @@ -85,7 +85,7 @@ public class SignedJarWithCustomClassLoader { .shouldHaveExitValue(0); // run app again, should still succeed even though SHA-1 is disabled - pb = ProcessTools.createJavaProcessBuilder( + pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-cp", "signed.jar", "-Djava.system.class.loader=CustomClassLoader", "Main"); ProcessTools.executeProcess(pb) diff --git a/test/jdk/java/util/Formatter/BasicTestLauncher.java b/test/jdk/java/util/Formatter/BasicTestLauncher.java index 0b37acfd944..4dfc0e36743 100644 --- a/test/jdk/java/util/Formatter/BasicTestLauncher.java +++ b/test/jdk/java/util/Formatter/BasicTestLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -82,7 +82,7 @@ public class BasicTestLauncher { */ private static OutputAnalyzer RunTest(String timeZone) throws IOException{ // Build and run Basic class with correct configuration - ProcessBuilder pb = ProcessTools.createTestJvm(JAVA_OPTS, TEST_CLASS); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(JAVA_OPTS, TEST_CLASS); pb.environment().put("TZ", timeZone); Process process = pb.start(); return new OutputAnalyzer(process); diff --git a/test/jdk/java/util/Properties/StoreReproducibilityTest.java b/test/jdk/java/util/Properties/StoreReproducibilityTest.java index c19657923be..b77f3262a4a 100644 --- a/test/jdk/java/util/Properties/StoreReproducibilityTest.java +++ b/test/jdk/java/util/Properties/StoreReproducibilityTest.java @@ -92,7 +92,7 @@ public class StoreReproducibilityTest { for (int i = 0; i < 5; i++) { final Path tmpFile = Files.createTempFile("8231640", ".props"); storedFiles.add(tmpFile); - final ProcessBuilder processBuilder = ProcessTools.createTestJvm( + final ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder( "-D" + SYS_PROP_JAVA_PROPERTIES_DATE + "=" + sysPropVal, StoreTest.class.getName(), tmpFile.toString(), @@ -134,7 +134,7 @@ public class StoreReproducibilityTest { for (int i = 0; i < 5; i++) { final Path tmpFile = Files.createTempFile("8231640", ".props"); storedFiles.add(tmpFile); - final ProcessBuilder processBuilder = ProcessTools.createTestJvm( + final ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder( "-D" + SYS_PROP_JAVA_PROPERTIES_DATE + "=" + sysPropVal, "-Djava.security.manager", "-Djava.security.policy=" + policyFile, @@ -178,7 +178,7 @@ public class StoreReproducibilityTest { for (int i = 0; i < 5; i++) { final Path tmpFile = Files.createTempFile("8231640", ".props"); storedFiles.add(tmpFile); - final ProcessBuilder processBuilder = ProcessTools.createTestJvm( + final ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder( "-D" + SYS_PROP_JAVA_PROPERTIES_DATE + "=" + sysPropVal, "-Djava.security.manager", "-Djava.security.policy=" + policyFile, @@ -208,7 +208,7 @@ public class StoreReproducibilityTest { for (int i = 0; i < 2; i++) { final Path tmpFile = Files.createTempFile("8231640", ".props"); storedFiles.add(tmpFile); - final ProcessBuilder processBuilder = ProcessTools.createTestJvm( + final ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder( "-D" + SYS_PROP_JAVA_PROPERTIES_DATE + "=" + sysPropVal, StoreTest.class.getName(), tmpFile.toString(), @@ -240,7 +240,7 @@ public class StoreReproducibilityTest { private static void testEmptySysPropValue() throws Exception { for (int i = 0; i < 2; i++) { final Path tmpFile = Files.createTempFile("8231640", ".props"); - final ProcessBuilder processBuilder = ProcessTools.createTestJvm( + final ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder( "-D" + SYS_PROP_JAVA_PROPERTIES_DATE + "=", "-Duser.timezone=UTC", StoreTest.class.getName(), @@ -272,7 +272,7 @@ public class StoreReproducibilityTest { for (int i = 0; i < 2; i++) { final Path tmpFile = Files.createTempFile("8231640", ".props"); storedFiles.add(tmpFile); - final ProcessBuilder processBuilder = ProcessTools.createTestJvm( + final ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder( "-D" + SYS_PROP_JAVA_PROPERTIES_DATE + "=" + sysPropVal, StoreTest.class.getName(), tmpFile.toString(), @@ -301,7 +301,7 @@ public class StoreReproducibilityTest { for (int i = 0; i < 2; i++) { final Path tmpFile = Files.createTempFile("8231640", ".props"); storedFiles.add(tmpFile); - final ProcessBuilder processBuilder = ProcessTools.createTestJvm( + final ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder( "-D" + SYS_PROP_JAVA_PROPERTIES_DATE + "=" + sysPropVal, StoreTest.class.getName(), tmpFile.toString(), @@ -343,7 +343,7 @@ public class StoreReproducibilityTest { for (int i = 0; i < 2; i++) { final Path tmpFile = Files.createTempFile("8231640", ".props"); storedFiles.add(tmpFile); - final ProcessBuilder processBuilder = ProcessTools.createTestJvm( + final ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder( "-D" + SYS_PROP_JAVA_PROPERTIES_DATE + "=" + sysPropVal, StoreTest.class.getName(), tmpFile.toString(), diff --git a/test/jdk/java/util/TimeZone/CustomTzIDCheckDST.java b/test/jdk/java/util/TimeZone/CustomTzIDCheckDST.java index 28afa8f49e1..ece90a9d7cd 100644 --- a/test/jdk/java/util/TimeZone/CustomTzIDCheckDST.java +++ b/test/jdk/java/util/TimeZone/CustomTzIDCheckDST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ public class CustomTzIDCheckDST { private static String CUSTOM_TZ2 = "MEZ-1MESZ,M10.5.0,M3.5.0/3"; public static void main(String args[]) throws Throwable { if (args.length == 0) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(List.of("CustomTzIDCheckDST", "runTZTest")); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(List.of("CustomTzIDCheckDST", "runTZTest")); pb.environment().put("TZ", CUSTOM_TZ); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); diff --git a/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java index 603e2890a0e..8645e6ff86a 100644 --- a/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java +++ b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java @@ -280,7 +280,7 @@ public class DefaultAgentFilterTest { } pbArgs.add(TEST_APP_NAME); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( pbArgs.toArray(new String[pbArgs.size()]) ); diff --git a/test/jdk/javax/management/security/HashedPasswordFileTest.java b/test/jdk/javax/management/security/HashedPasswordFileTest.java index e2d5bd7deb6..7a3f02bc7c8 100644 --- a/test/jdk/javax/management/security/HashedPasswordFileTest.java +++ b/test/jdk/javax/management/security/HashedPasswordFileTest.java @@ -439,7 +439,7 @@ public class HashedPasswordFileTest { pbArgs.add("jdk.management.agent/jdk.internal.agent=ALL-UNNAMED"); pbArgs.add(TestApp.class.getSimpleName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( pbArgs.toArray(new String[0])); Process process = ProcessTools.startProcess( TestApp.class.getSimpleName(), @@ -481,7 +481,7 @@ public class HashedPasswordFileTest { pbArgs.add("jdk.management.agent/jdk.internal.agent=ALL-UNNAMED"); pbArgs.add(TestApp.class.getSimpleName()); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( pbArgs.toArray(new String[0])); Process process = ProcessTools.startProcess( TestApp.class.getSimpleName(), diff --git a/test/jdk/javax/net/ssl/TLSCommon/interop/ProcUtils.java b/test/jdk/javax/net/ssl/TLSCommon/interop/ProcUtils.java index 10cb3d68856..de27f538f70 100644 --- a/test/jdk/javax/net/ssl/TLSCommon/interop/ProcUtils.java +++ b/test/jdk/javax/net/ssl/TLSCommon/interop/ProcUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ public class ProcUtils { */ public static OutputAnalyzer java(Path javaPath, Class clazz, Map props) { - ProcessBuilder pb = createJavaProcessBuilder(javaPath, clazz, props); + ProcessBuilder pb = createLimitedTestJavaProcessBuilder(javaPath, clazz, props); try { return ProcessTools.executeCommand(pb); } catch (Throwable e) { @@ -50,7 +50,7 @@ public class ProcUtils { } } - private static ProcessBuilder createJavaProcessBuilder(Path javaPath, + private static ProcessBuilder createLimitedTestJavaProcessBuilder(Path javaPath, Class clazz, Map props) { List cmds = new ArrayList<>(); cmds.add(javaPath.toString()); diff --git a/test/jdk/javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java b/test/jdk/javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java index c2d413cff25..c3bb610bb87 100644 --- a/test/jdk/javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java +++ b/test/jdk/javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -224,7 +224,7 @@ public final class UnninstallUIMemoryLeaks { } private static Process runProcess(LookAndFeelInfo laf) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Dswing.defaultlaf=" + laf.getClassName(), "-mx9m", "-XX:+HeapDumpOnOutOfMemoryError", UnninstallUIMemoryLeaks.class.getSimpleName(), "mark"); diff --git a/test/jdk/javax/swing/text/html/CSS/bug8234913.java b/test/jdk/javax/swing/text/html/CSS/bug8234913.java index cf4c43d7531..bd74fbaeb93 100644 --- a/test/jdk/javax/swing/text/html/CSS/bug8234913.java +++ b/test/jdk/javax/swing/text/html/CSS/bug8234913.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -52,7 +52,7 @@ public class bug8234913 { Collections.addAll(argsList, "-Xmn8m"); Collections.addAll(argsList, "-Dtest.class.path=" + System.getProperty("test.class.path", ".")); Collections.addAll(argsList, FontSizePercentTest.class.getName()); - return ProcessTools.createJavaProcessBuilder(argsList.toArray(new String[argsList.size()])); + return ProcessTools.createLimitedTestJavaProcessBuilder(argsList.toArray(new String[argsList.size()])); } static void checkFor(String... outputStrings) throws Exception { diff --git a/test/jdk/jdk/incubator/vector/LoadJsvmlTest.java b/test/jdk/jdk/incubator/vector/LoadJsvmlTest.java index 355201bfbf3..e6e613bbc90 100644 --- a/test/jdk/jdk/incubator/vector/LoadJsvmlTest.java +++ b/test/jdk/jdk/incubator/vector/LoadJsvmlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -60,7 +60,7 @@ public class LoadJsvmlTest { } public static void main(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( "-Xmn8m", "-Xlog:library=info", "--add-modules=jdk.incubator.vector", VectorTest.class.getName()); diff --git a/test/jdk/jdk/internal/misc/VM/RuntimeArguments.java b/test/jdk/jdk/internal/misc/VM/RuntimeArguments.java index 90d3be1f7df..c48de900ec3 100644 --- a/test/jdk/jdk/internal/misc/VM/RuntimeArguments.java +++ b/test/jdk/jdk/internal/misc/VM/RuntimeArguments.java @@ -117,7 +117,7 @@ public class RuntimeArguments { Stream options = Stream.concat(args.stream(), Stream.of("-classpath", TEST_CLASSES, "RuntimeArguments")); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( // The runtime image may be created with jlink --add-options // The initial VM options will be included in the result // returned by VM.getRuntimeArguments() diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/Application.java b/test/jdk/jdk/jfr/api/consumer/streaming/Application.java index 6cc7876a7cb..fea8347ceaf 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/Application.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/Application.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -102,7 +102,7 @@ public class Application { args[2] = Application.class.getName(); args[3] = lockFile.toString(); args[4] = message; - ProcessBuilder pb = ProcessTools.createTestJvm(args); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(args); touch(lockFile); process = pb.start(); // For debugging diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java index 75885d50876..313b5f026e1 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestCrossProcessStreaming.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -127,7 +127,7 @@ public class TestCrossProcessStreaming { static Process start() throws Exception { String[] args = {"-XX:StartFlightRecording", EventProducer.class.getName()}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); return ProcessTools.startProcess("Event-Producer", pb, line -> line.contains(MAIN_STARTED), 0, TimeUnit.SECONDS); diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java index 8643ec35bc2..dbbdbe9c67d 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestProcess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -66,7 +66,7 @@ public final class TestProcess implements AutoCloseable { "-XX:" + (createCore ? "+" : "-") + "CreateCoredumpOnCrash", TestProcess.class.getName(), path.toString() }; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); process = ProcessTools.startProcess(name, pb); } diff --git a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java index 67962399569..d347378b606 100644 --- a/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java +++ b/test/jdk/jdk/jfr/event/gc/configuration/TestGCYoungGenerationConfigurationEventWithMinAndMaxSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ public class TestGCYoungGenerationConfigurationEventWithMinAndMaxSize { "-Xms32m", "-Xmx64m", Tester.class.getName()}; - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(jvm_args); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(jvm_args); OutputAnalyzer analyzer = ProcessTools.executeProcess(pb); analyzer.shouldHaveExitValue(0); } diff --git a/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java b/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java index aa8cdbbf662..d8fd9a6e673 100644 --- a/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java +++ b/test/jdk/jdk/jfr/event/os/TestInitialEnvironmentVariable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -48,7 +48,7 @@ public class TestInitialEnvironmentVariable { private final static String EVENT_NAME = EventNames.InitialEnvironmentVariable; public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(Test.class.getName()); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(Test.class.getName()); setEnv(pb.environment()); (new OutputAnalyzer(pb.start())).shouldHaveExitValue(0); } diff --git a/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java b/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java index 4282c1afffb..83af0de239d 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java +++ b/test/jdk/jdk/jfr/event/runtime/TestDumpReason.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -89,7 +89,7 @@ public class TestDumpReason { private static long runProcess(Class crasher) throws Exception { System.out.println("Test case for " + crasher.getName()); - Process p = ProcessTools.createTestJvm( + Process p = ProcessTools.createTestJavaProcessBuilder( "-Xmx64m", "-XX:-CreateCoredumpOnCrash", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", diff --git a/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java b/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java index 26d72578170..d680dde023d 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java +++ b/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java @@ -89,7 +89,7 @@ public class TestShutdownEvent { } private static void runSubtest(int subTestIndex) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-Xlog:jfr=debug", "-XX:-CreateCoredumpOnCrash", "-XX:-TieredCompilation", diff --git a/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java b/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java index 374e23ecb48..29e21ddd89d 100644 --- a/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java +++ b/test/jdk/jdk/jfr/jvm/TestDumpOnCrash.java @@ -131,7 +131,7 @@ public class TestDumpOnCrash { } options.add(crasher.getName()); options.add(signal); - Process p = ProcessTools.createTestJvm(options).start(); + Process p = ProcessTools.createTestJavaProcessBuilder(options).start(); OutputAnalyzer output = new OutputAnalyzer(p); System.out.println("========== Crasher process output:"); diff --git a/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java b/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java index e152b00acae..9e68d0501df 100644 --- a/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java +++ b/test/jdk/jdk/jfr/jvm/TestEventWriterLog.java @@ -35,7 +35,7 @@ import jdk.test.lib.process.OutputAnalyzer; public class TestEventWriterLog { public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:jfr+system+bytecode=trace", "-XX:StartFlightRecording", "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xlog:jfr+system+bytecode=trace", "-XX:StartFlightRecording", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("superclass: jdk/jfr/events/AbstractJDKEvent"); } diff --git a/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java b/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java index 9156ffb6b66..50514e02024 100644 --- a/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java +++ b/test/jdk/jdk/jfr/startupargs/TestBadOptionValues.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -54,7 +54,7 @@ public class TestBadOptionValues { Asserts.assertGreaterThan(options.length, 0); for (String option : options) { - pb = ProcessTools.createJavaProcessBuilder(prepend + option, "-version"); + pb = ProcessTools.createLimitedTestJavaProcessBuilder(prepend + option, "-version"); output = new OutputAnalyzer(pb.start()); output.shouldContain(expectedOutput); } diff --git a/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java b/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java index 454bbb631ad..eaf325a779d 100644 --- a/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java +++ b/test/jdk/jdk/jfr/startupargs/TestDumpOnExit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -92,7 +92,7 @@ public class TestDumpOnExit { } private static void testDumponExit(Supplier p,String... args) throws Exception, IOException { - ProcessBuilder pb = ProcessTools.createTestJvm(args); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(args); OutputAnalyzer output = ProcessTools.executeProcess(pb); System.out.println(output.getOutput()); output.shouldHaveExitValue(0); diff --git a/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java b/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java index 139ab8385d7..cf0cb021216 100644 --- a/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java +++ b/test/jdk/jdk/jfr/startupargs/TestJFCWarnings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -70,7 +70,7 @@ public class TestJFCWarnings { } private static void launch(String commandLine, String expectedOutput) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(commandLine, "-version"); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(commandLine, "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain(expectedOutput); } diff --git a/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java b/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java index baa56bbddc9..9c90d04691a 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java +++ b/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -483,19 +483,19 @@ public class TestMemoryOptions { final String flightRecorderOptions = tc.getTestString(); ProcessBuilder pb; if (flightRecorderOptions != null) { - pb = ProcessTools.createTestJvm("--add-exports=jdk.jfr/jdk.jfr.internal=ALL-UNNAMED", - "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", - flightRecorderOptions, - "-XX:StartFlightRecording", - SUT.class.getName(), - tc.getTestName()); + pb = ProcessTools.createTestJavaProcessBuilder("--add-exports=jdk.jfr/jdk.jfr.internal=ALL-UNNAMED", + "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", + flightRecorderOptions, + "-XX:StartFlightRecording", + SUT.class.getName(), + tc.getTestName()); } else { // default, no FlightRecorderOptions passed - pb = ProcessTools.createTestJvm("--add-exports=jdk.jfr/jdk.jfr.internal=ALL-UNNAMED", - "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", - "-XX:StartFlightRecording", - SUT.class.getName(), - tc.getTestName()); + pb = ProcessTools.createTestJavaProcessBuilder("--add-exports=jdk.jfr/jdk.jfr.internal=ALL-UNNAMED", + "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", + "-XX:StartFlightRecording", + SUT.class.getName(), + tc.getTestName()); } System.out.println("Driver launching SUT with string: " + flightRecorderOptions != null ? flightRecorderOptions : "default"); diff --git a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java index e8cbff2dfd3..24be874a87f 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java +++ b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -55,14 +55,14 @@ public class TestMultipleStartupRecordings { private static void launchUnary(String options) throws Exception { String recording1 = START_FLIGHT_RECORDING + (options != null ? options : ""); - ProcessBuilder pb = ProcessTools.createTestJvm(recording1, MainClass.class.getName()); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(recording1, MainClass.class.getName()); test(pb, "Started recording 1"); } private static void launchBinary(String options1, String options2) throws Exception { String recording1 = START_FLIGHT_RECORDING + (options1 != null ? options1 : ""); String recording2 = START_FLIGHT_RECORDING + (options2 != null ? options2 : ""); - ProcessBuilder pb = ProcessTools.createTestJvm(recording1, recording2, MainClass.class.getName()); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(recording1, recording2, MainClass.class.getName()); test(pb, "Started recording 1", "Started recording 2"); } @@ -70,7 +70,7 @@ public class TestMultipleStartupRecordings { String recording1 = START_FLIGHT_RECORDING + (options1 != null ? options1 : ""); String recording2 = START_FLIGHT_RECORDING + (options2 != null ? options2 : ""); String recording3 = START_FLIGHT_RECORDING + (options3 != null ? options3 : ""); - ProcessBuilder pb = ProcessTools.createTestJvm(recording1, recording2, recording3, MainClass.class.getName()); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(recording1, recording2, recording3, MainClass.class.getName()); test(pb, "Started recording 1", "Started recording 2", "Started recording 3"); } @@ -94,7 +94,7 @@ public class TestMultipleStartupRecordings { String flightRecorderOptions = FLIGHT_RECORDER_OPTIONS + "=maxchunksize=8m"; String recording1 = START_FLIGHT_RECORDING + "=filename=recording1.jfr"; String recording2 = START_FLIGHT_RECORDING + "=name=myrecording,filename=recording2.jfr"; - ProcessBuilder pb = ProcessTools.createTestJvm(flightRecorderOptions, recording1, recording2, MainClass.class.getName()); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(flightRecorderOptions, recording1, recording2, MainClass.class.getName()); test(pb, "Started recording 1", "Started recording 2"); } diff --git a/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java b/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java index 1942b3d3f63..3a4d3f20732 100644 --- a/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java +++ b/test/jdk/jdk/jfr/startupargs/TestOptionsWithLocale.java @@ -36,7 +36,7 @@ public class TestOptionsWithLocale { return; } - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-Duser.country=DE", "-Duser.language=de", "-XX:FlightRecorderOptions:stackdepth=128", diff --git a/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java b/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java index 335681bfc0c..4f4ee195e1f 100644 --- a/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java +++ b/test/jdk/jdk/jfr/startupargs/TestPreserveRepository.java @@ -46,7 +46,7 @@ public class TestPreserveRepository { "-XX:FlightRecorderOptions:repository=" + path + ",preserve-repository=true", "-version" }; - ProcessBuilder pb = ProcessTools.createTestJvm(arguments); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(arguments); OutputAnalyzer output = ProcessTools.executeProcess(pb); output.shouldHaveExitValue(0); Optional p = Files.find(path, 99, (a,b) -> a.getFileName().toString().endsWith(".jfr")).findAny(); diff --git a/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java b/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java index a427cfc1af4..8c8703dc9e6 100644 --- a/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java +++ b/test/jdk/jdk/jfr/startupargs/TestRetransformUsingLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -104,7 +104,7 @@ public class TestRetransformUsingLog { } System.out.println(); System.out.println(); - ProcessBuilder pb = ProcessTools.createTestJvm(args); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(args); OutputAnalyzer out = ProcessTools.executeProcess(pb); System.out.println(out.getOutput()); verifier.accept(out); diff --git a/test/jdk/jdk/jfr/startupargs/TestStartDuration.java b/test/jdk/jdk/jfr/startupargs/TestStartDuration.java index b610907bf84..df27c054dd8 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartDuration.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartDuration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2023, 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 @@ -69,7 +69,7 @@ public class TestStartDuration { } private static void testDurationInRange(String durationText, Duration duration, String action) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:StartFlightRecording:name=" + RECORDING_NAME + ",duration=" + durationText, TestValues.class.getName(), action, @@ -81,7 +81,7 @@ public class TestStartDuration { private static void testDurationJavaVersion(String duration, boolean inRange) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:StartFlightRecording:name=TestStartDuration,duration=" + duration, "-version"); OutputAnalyzer out = ProcessTools.executeProcess(pb); diff --git a/test/jdk/jdk/jfr/startupargs/TestStartName.java b/test/jdk/jdk/jfr/startupargs/TestStartName.java index ddcff1eecd5..7ab4a7d0f7e 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartName.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -45,7 +45,7 @@ public class TestStartName { } private static void testName(String recordingName, boolean validName) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:StartFlightRecording:name=" + recordingName, TestName.class.getName(), recordingName); OutputAnalyzer out = ProcessTools.executeProcess(pb); diff --git a/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java b/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java index c0bd66a7ecb..b919f80e9da 100644 --- a/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java +++ b/test/jdk/jdk/jfr/startupargs/TestStartupMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -73,7 +73,7 @@ public class TestStartupMessage { List commands = new ArrayList<>(Arrays.asList(args)); commands.add("-XX:StartFlightRecording"); commands.add(TestMessage.class.getName()); - ProcessBuilder pb = ProcessTools.createTestJvm(commands); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(commands); OutputAnalyzer out = ProcessTools.executeProcess(pb); out.shouldHaveExitValue(0); return out; diff --git a/test/jdk/jdk/security/JavaDotSecurity/MakeJavaSecurityTest.java b/test/jdk/jdk/security/JavaDotSecurity/MakeJavaSecurityTest.java index c4ea0538c9d..451e4054ae1 100644 --- a/test/jdk/jdk/security/JavaDotSecurity/MakeJavaSecurityTest.java +++ b/test/jdk/jdk/security/JavaDotSecurity/MakeJavaSecurityTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -47,7 +47,7 @@ public class MakeJavaSecurityTest { public static void main(String[] args) throws Exception { Path toolPath = getMakeJavaSecPath(); - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( toolPath.toString(), TEST_SRC + "/raw_java_security", "outfile", diff --git a/test/jdk/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java b/test/jdk/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java index 7e129c15e23..1a59b0df118 100644 --- a/test/jdk/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java +++ b/test/jdk/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java @@ -323,7 +323,7 @@ public final class MonitorVmStartTerminate { private void executeJava() throws Throwable { String className = JavaProcess.class.getName(); - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-Dtest.timeout.factor=" + System.getProperty("test.timeout.factor", "1.0"), className, mainArgsIdentifier); OutputAnalyzer ob = ProcessTools.executeProcess(pb); diff --git a/test/jdk/sun/management/jdp/DynamicLauncher.java b/test/jdk/sun/management/jdp/DynamicLauncher.java index a36dfdbc7ae..9102fe32a94 100644 --- a/test/jdk/sun/management/jdp/DynamicLauncher.java +++ b/test/jdk/sun/management/jdp/DynamicLauncher.java @@ -67,7 +67,7 @@ public abstract class DynamicLauncher { protected OutputAnalyzer runVM() throws Exception { String[] options = this.options(); - ProcessBuilder pb = ProcessTools.createTestJvm(options); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(options); OutputAnalyzer out = ProcessTools.executeProcess(pb); System.out.println(out.getStdout()); System.err.println(out.getStderr()); diff --git a/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java b/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java index 02ae638ff18..727ca33a6bd 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java @@ -173,7 +173,7 @@ public abstract class AbstractFilePermissionTest { command.add(className); - ProcessBuilder processBuilder = ProcessTools.createTestJvm(command); + ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder(command); System.out.println("test cmdline: " + Arrays.toString(processBuilder.command().toArray()).replace(",", "")); OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); diff --git a/test/jdk/sun/management/jmxremote/bootstrap/CustomLauncherTest.java b/test/jdk/sun/management/jmxremote/bootstrap/CustomLauncherTest.java index 1ad154ac8a9..2880b00cf08 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/CustomLauncherTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/CustomLauncherTest.java @@ -95,7 +95,7 @@ public class CustomLauncherTest { System.out.println(" PID : " + serverPrc.pid()); System.out.println(" shutdown port : " + port.get()); - ProcessBuilder client = ProcessTools.createTestJvm( + ProcessBuilder client = ProcessTools.createTestJavaProcessBuilder( "--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED", "TestManager", String.valueOf(serverPrc.pid()), diff --git a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java index 4cec7142495..c062f7c75b8 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java @@ -218,7 +218,7 @@ public class JMXInterfaceBindingTest { args.add(Boolean.toString(useSSL)); try { - ProcessBuilder builder = ProcessTools.createTestJvm(args.toArray(new String[]{})); + ProcessBuilder builder = ProcessTools.createTestJavaProcessBuilder(args.toArray(new String[]{})); System.out.println(ProcessTools.getCommandLine(builder)); Process process = builder.start(); output = new OutputAnalyzer(process); diff --git a/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java b/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java index e03d6766522..0a7c735e2e0 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java @@ -107,7 +107,7 @@ public class LocalManagementTest { args.add(arg); } args.add("TestApplication"); - ProcessBuilder server = ProcessTools.createTestJvm( + ProcessBuilder server = ProcessTools.createTestJavaProcessBuilder( args.toArray(new String[args.size()]) ); @@ -133,7 +133,7 @@ public class LocalManagementTest { System.out.println(" PID : " + serverPrc.pid()); System.out.println(" shutdown port : " + port.get()); - ProcessBuilder client = ProcessTools.createTestJvm( + ProcessBuilder client = ProcessTools.createTestJavaProcessBuilder( "-cp", TEST_CLASSPATH, "--add-exports", "jdk.management.agent/jdk.internal.agent=ALL-UNNAMED", diff --git a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java index 525f2db5b59..40bb525d1b0 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java @@ -188,7 +188,7 @@ public class RmiRegistrySslTest { command.add(TEST_CLASS_PATH); command.add(className); - ProcessBuilder processBuilder = ProcessTools.createTestJvm(command); + ProcessBuilder processBuilder = ProcessTools.createTestJavaProcessBuilder(command); OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); diff --git a/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java index 3210b921f2c..13a4f7bea73 100644 --- a/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -398,7 +398,7 @@ public class JMXStartStopTest { pbArgs.addAll(Arrays.asList(args)); pbArgs.add(TEST_APP_NAME); - ProcessBuilder pb = ProcessTools.createTestJvm(pbArgs); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(pbArgs); TestAppRun s = new TestAppRun(pb, name); s.start(); return s; diff --git a/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java b/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java index 1b33edaedff..fc7a0de2d06 100644 --- a/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java +++ b/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java @@ -59,7 +59,7 @@ public class JMXStatusPerfCountersTest { @BeforeClass public static void setupClass() throws Exception { - testAppPb = ProcessTools.createTestJvm( + testAppPb = ProcessTools.createTestJavaProcessBuilder( "-XX:+UsePerfData", TEST_APP_NAME ); diff --git a/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java b/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java index f198a887e5e..1e6259ef0d7 100644 --- a/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java +++ b/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java @@ -87,7 +87,7 @@ abstract public class JMXStatusTest { args.add("-XX:+UsePerfData"); args.addAll(getCustomVmArgs()); args.add(TEST_APP_NAME); - testAppPb = ProcessTools.createTestJvm(args); + testAppPb = ProcessTools.createTestJavaProcessBuilder(args); jcmd = new ManagementAgentJcmd(TEST_APP_NAME, false); } diff --git a/test/jdk/sun/net/spi/SystemProxyDriver.java b/test/jdk/sun/net/spi/SystemProxyDriver.java index f99b2acbaf8..a05cc051dff 100644 --- a/test/jdk/sun/net/spi/SystemProxyDriver.java +++ b/test/jdk/sun/net/spi/SystemProxyDriver.java @@ -44,7 +44,7 @@ public class SystemProxyDriver { "-Djava.net.useSystemProxies=true", "SystemProxyTest" }; - final ProcessBuilder pb = ProcessTools.createTestJvm(commandArgs); + final ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(commandArgs); pb.inheritIO(); pb.environment().put("http_proxy", "foo://"); // intentionally use a value without host/port final Process p = pb.start(); diff --git a/test/jdk/sun/security/krb5/auto/ModuleName.java b/test/jdk/sun/security/krb5/auto/ModuleName.java index 02b712f26fa..8058326bc61 100644 --- a/test/jdk/sun/security/krb5/auto/ModuleName.java +++ b/test/jdk/sun/security/krb5/auto/ModuleName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -53,7 +53,7 @@ public class ModuleName { test("jdk.security.jgss"); // With limited modules - List cmd = ProcessTools.createJavaProcessBuilder().command(); + List cmd = ProcessTools.createLimitedTestJavaProcessBuilder().command(); Stream.of(jdk.internal.misc.VM.getRuntimeArguments()) .filter(arg -> arg.startsWith("--add-exports=") || arg.startsWith("--add-opens=")) diff --git a/test/jdk/sun/security/provider/KeyStore/DKSTest.java b/test/jdk/sun/security/provider/KeyStore/DKSTest.java index 76c66f492d1..1d1943ec729 100644 --- a/test/jdk/sun/security/provider/KeyStore/DKSTest.java +++ b/test/jdk/sun/security/provider/KeyStore/DKSTest.java @@ -80,7 +80,7 @@ public class DKSTest { public static void main(String[] args) throws Exception { if (args.length == 0) { // Environment variable and system properties referred in domains.cfg used by this Test. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(List.of( + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(List.of( "-Dtest.src=" + TEST_SRC , "-Duser.dir=" + USER_DIR, "DKSTest", "run")); pb.environment().putAll(System.getenv()); pb.environment().put("KEYSTORE_PWD", "test12"); diff --git a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java index c0d3bbfda31..d6ec20c93d2 100644 --- a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java @@ -118,7 +118,7 @@ public class SSLEngineKeyLimit extends SSLContextTemplate { System.out.println("test.java.opts: " + System.getProperty("test.java.opts")); - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( Utils.addTestJavaOpts("SSLEngineKeyLimit", "p", args[1], args[2])); diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java index f7796e1a49d..4778cc217ba 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -188,7 +188,7 @@ public class ResumptionUpdateBoundValues extends SSLContextTemplate { System.out.println("test.java.opts: " + System.getProperty("test.java.opts")); - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( Utils.addTestJavaOpts("ResumptionUpdateBoundValues", "p")); OutputAnalyzer output = ProcessTools.executeProcess(pb); diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java index 8b19d39af7e..f0519a94249 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java @@ -134,7 +134,7 @@ public class SSLSocketKeyLimit { System.out.println("test.java.opts: " + System.getProperty("test.java.opts")); - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( Utils.addTestJavaOpts("SSLSocketKeyLimit", "p", args[1], args[2])); diff --git a/test/jdk/sun/tools/jstat/JStatInterval.java b/test/jdk/sun/tools/jstat/JStatInterval.java index 1dfa1f9187b..0719e1d11b6 100644 --- a/test/jdk/sun/tools/jstat/JStatInterval.java +++ b/test/jdk/sun/tools/jstat/JStatInterval.java @@ -61,7 +61,7 @@ public class JStatInterval { } } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createTestJvm( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:+UsePerfData", Application.class.getName() ); diff --git a/test/jdk/tools/jimage/JImageToolTest.java b/test/jdk/tools/jimage/JImageToolTest.java index fce9a0ac347..feb6a56a968 100644 --- a/test/jdk/tools/jimage/JImageToolTest.java +++ b/test/jdk/tools/jimage/JImageToolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ public class JImageToolTest { args.add("jdk.tools.jimage.Main"); args.addAll(Arrays.asList(jimageArgs)); - ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(args.toArray(new String[args.size()])); + ProcessBuilder builder = ProcessTools.createLimitedTestJavaProcessBuilder(args.toArray(new String[args.size()])); int res = builder.inheritIO().start().waitFor(); if (res != 0) { diff --git a/test/jdk/tools/launcher/modules/basic/BasicTest.java b/test/jdk/tools/launcher/modules/basic/BasicTest.java index 6a91cdc6d7c..ac831119988 100644 --- a/test/jdk/tools/launcher/modules/basic/BasicTest.java +++ b/test/jdk/tools/launcher/modules/basic/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -270,7 +270,7 @@ public class BasicTest { * while setting the _JAVA_LAUNCHER_DEBUG environment variable. */ private ProcessBuilder createProcessWithLauncherDebugging(String... cmds) { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(Utils.addTestJavaOpts(cmds)); + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(Utils.addTestJavaOpts(cmds)); pb.environment().put("_JAVA_LAUNCHER_DEBUG", "true"); return pb; diff --git a/test/lib-test/jdk/test/lib/process/ProcessToolsLastLineTest.java b/test/lib-test/jdk/test/lib/process/ProcessToolsLastLineTest.java index 696f76f0f1e..54b5a3bc220 100644 --- a/test/lib-test/jdk/test/lib/process/ProcessToolsLastLineTest.java +++ b/test/lib-test/jdk/test/lib/process/ProcessToolsLastLineTest.java @@ -37,7 +37,7 @@ public class ProcessToolsLastLineTest { static void test(String output) throws Exception { final StringBuffer sb = new StringBuffer(); Process p = ProcessTools.startProcess("process", - ProcessTools.createJavaProcessBuilder(ProcessToolsLastLineTest.class.getName(), output), + ProcessTools.createLimitedTestJavaProcessBuilder(ProcessToolsLastLineTest.class.getName(), output), line -> { sb.append(line);}); p.waitFor(); String expectedOutput = output.replace("\n", ""); diff --git a/test/lib/jdk/test/lib/cds/CDSTestUtils.java b/test/lib/jdk/test/lib/cds/CDSTestUtils.java index 629cf682384..7115912380a 100644 --- a/test/lib/jdk/test/lib/cds/CDSTestUtils.java +++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java @@ -266,7 +266,7 @@ public class CDSTestUtils { for (String s : opts.suffix) cmd.add(s); String[] cmdLine = cmd.toArray(new String[cmd.size()]); - ProcessBuilder pb = ProcessTools.createTestJvm(cmdLine); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmdLine); return executeAndLog(pb, "dump"); } @@ -444,7 +444,7 @@ public class CDSTestUtils { for (String s : opts.suffix) cmd.add(s); String[] cmdLine = cmd.toArray(new String[cmd.size()]); - ProcessBuilder pb = ProcessTools.createTestJvm(cmdLine); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmdLine); return executeAndLog(pb, "exec"); } diff --git a/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java b/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java index b3b1b8a7e2c..31cff4b8c25 100644 --- a/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java +++ b/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2023, 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 @@ -113,7 +113,7 @@ public abstract class CommandLineOptionTest { finalOptions.add("-version"); ProcessBuilder processBuilder - = ProcessTools.createJavaProcessBuilder(finalOptions.toArray( + = ProcessTools.createLimitedTestJavaProcessBuilder(finalOptions.toArray( new String[finalOptions.size()])); OutputAnalyzer outputAnalyzer = new OutputAnalyzer(processBuilder.start()); @@ -263,7 +263,7 @@ public abstract class CommandLineOptionTest { Collections.addAll(vmOpts, additionalVMOpts); Collections.addAll(vmOpts, "-XX:+PrintFlagsFinal", "-version"); - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( vmOpts.toArray(new String[vmOpts.size()])); OutputAnalyzer outputAnalyzer @@ -333,7 +333,7 @@ public abstract class CommandLineOptionTest { Collections.addAll(vmOpts, additionalVMOpts); Collections.addAll(vmOpts, "-version"); - ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder( + ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder( vmOpts.toArray(new String[vmOpts.size()])); return new OutputAnalyzer(processBuilder.start()); diff --git a/test/lib/jdk/test/lib/jfr/AppExecutorHelper.java b/test/lib/jdk/test/lib/jfr/AppExecutorHelper.java index df8d39e32b8..90621c2ed99 100644 --- a/test/lib/jdk/test/lib/jfr/AppExecutorHelper.java +++ b/test/lib/jdk/test/lib/jfr/AppExecutorHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -72,7 +72,7 @@ public class AppExecutorHelper { Collections.addAll(arguments, classArguments); } - ProcessBuilder pb = ProcessTools.createTestJvm(arguments); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(arguments); return ProcessTools.executeProcess(pb); } } diff --git a/test/lib/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java index b97d93bb476..89ef5256729 100644 --- a/test/lib/jdk/test/lib/process/ProcessTools.java +++ b/test/lib/jdk/test/lib/process/ProcessTools.java @@ -376,16 +376,6 @@ public final class ProcessTools { return ProcessHandle.current().pid(); } - /** - * Create ProcessBuilder using the java launcher from the jdk to be tested. - * - * @param command Arguments to pass to the java command. - * @return The ProcessBuilder instance representing the java command. - */ - public static ProcessBuilder createJavaProcessBuilder(List command) { - return createJavaProcessBuilder(command.toArray(String[]::new)); - } - /* Convert arguments for tests running with virtual threads test thread factory. When test is executed with test thread factory the line is changed from @@ -457,7 +447,7 @@ public final class ProcessTools { * @param command Arguments to pass to the java command. * @return The ProcessBuilder instance representing the java command. */ - public static ProcessBuilder createJavaProcessBuilder(String... command) { + private static ProcessBuilder createJavaProcessBuilder(String... command) { String javapath = JDKToolFinder.getJDKTool("java"); ArrayList args = new ArrayList<>(); @@ -512,8 +502,8 @@ public final class ProcessTools { * @param command Arguments to pass to the java command. * @return The ProcessBuilder instance representing the java command. */ - public static ProcessBuilder createTestJvm(List command) { - return createTestJvm(command.toArray(String[]::new)); + public static ProcessBuilder createTestJavaProcessBuilder(List command) { + return createTestJavaProcessBuilder(command.toArray(String[]::new)); } /** @@ -527,10 +517,54 @@ public final class ProcessTools { * @param command Arguments to pass to the java command. * @return The ProcessBuilder instance representing the java command. */ - public static ProcessBuilder createTestJvm(String... command) { + public static ProcessBuilder createTestJavaProcessBuilder(String... command) { return createJavaProcessBuilder(Utils.prependTestJavaOpts(command)); } + /** + * Create ProcessBuilder using the java launcher from the jdk to + * be tested. + * + *

Please observe that you likely should use + * createTestJavaProcessBuilder() instead of this method because + * createTestJavaProcessBuilder() will add JVM options from + * "test.vm.opts" and "test.java.opts" and this method will + * not do that. + * + *

If you still chose to use + * createLimitedTestJavaProcessBuilder() you should probably use + * it in combination with @requires vm.flagless JTREG + * anotation as to not waste energy and test resources. + * + * @param command Arguments to pass to the java command. + * @return The ProcessBuilder instance representing the java command. + */ + public static ProcessBuilder createLimitedTestJavaProcessBuilder(List command) { + return createLimitedTestJavaProcessBuilder(command.toArray(String[]::new)); + } + + /** + * Create ProcessBuilder using the java launcher from the jdk to + * be tested. + * + *

Please observe that you likely should use + * createTestJavaProcessBuilder() instead of this method because + * createTestJavaProcessBuilder() will add JVM options from + * "test.vm.opts" and "test.java.opts" and this method will + * not do that. + * + *

If you still chose to use + * createLimitedTestJavaProcessBuilder() you should probably use + * it in combination with @requires vm.flagless JTREG + * anotation as to not waste energy and test resources. + * + * @param command Arguments to pass to the java command. + * @return The ProcessBuilder instance representing the java command. + */ + public static ProcessBuilder createLimitedTestJavaProcessBuilder(String... command) { + return createJavaProcessBuilder(command); + } + /** * Executes a test jvm process, waits for it to finish and returns the process output. * The default jvm options from jtreg, test.vm.opts and test.java.opts, are added. @@ -562,7 +596,7 @@ public final class ProcessTools { * @return The output from the process. */ public static OutputAnalyzer executeTestJvm(String... cmds) throws Exception { - ProcessBuilder pb = createTestJvm(cmds); + ProcessBuilder pb = createTestJavaProcessBuilder(cmds); return executeProcess(pb); }