From 993951b85e016475f4cd5079ae21bd5ce1f2830c Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Thu, 12 Oct 2023 23:32:37 +0000 Subject: [PATCH] 8316464: 3 sun/tools tests ignore VM flags Reviewed-by: sspitsyn, cjplummer --- test/jdk/sun/tools/jcmd/TestProcessHelper.java | 3 ++- test/jdk/sun/tools/jinfo/JInfoTest.java | 12 +++++------- test/jdk/sun/tools/jstat/JStatInterval.java | 7 +++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/test/jdk/sun/tools/jcmd/TestProcessHelper.java b/test/jdk/sun/tools/jcmd/TestProcessHelper.java index 121591fce21..139f21e2d9d 100644 --- a/test/jdk/sun/tools/jcmd/TestProcessHelper.java +++ b/test/jdk/sun/tools/jcmd/TestProcessHelper.java @@ -50,8 +50,9 @@ import jdk.test.lib.util.ModuleInfoWriter; * @test * @bug 8205654 * @summary Unit test for sun.tools.ProcessHelper class. The test launches Java processes with different Java options - * and checks that sun.tools.ProcessHelper.getMainClass(pid) method returns a correct main class. return a . + * and checks that sun.tools.ProcessHelper.getMainClass(pid) method returns a correct main class. * + * @requires vm.flagless * @requires os.family == "linux" * @modules jdk.jcmd/sun.tools.common:+open * java.base/jdk.internal.classfile diff --git a/test/jdk/sun/tools/jinfo/JInfoTest.java b/test/jdk/sun/tools/jinfo/JInfoTest.java index bea0e4b796c..79512ddf0df 100644 --- a/test/jdk/sun/tools/jinfo/JInfoTest.java +++ b/test/jdk/sun/tools/jinfo/JInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2020, 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 @@ -60,9 +60,8 @@ public class JInfoTest { LingeredApp app1 = new JInfoTestLingeredApp(); LingeredApp app2 = new JInfoTestLingeredApp(); try { - String[] params = new String[0];; - LingeredApp.startAppExactJvmOpts(app1, params); - LingeredApp.startAppExactJvmOpts(app2, params); + LingeredApp.startApp(app1); + LingeredApp.startApp(app2); OutputAnalyzer output = jinfo("-flag", "MinHeapFreeRatio=1", "JInfoTestLingeredApp"); output.shouldHaveExitValue(0); output = jinfo("-flag", "MinHeapFreeRatio", "JInfoTestLingeredApp"); @@ -89,9 +88,8 @@ public class JInfoTest { LingeredApp app1 = new JInfoTestLingeredApp(); LingeredApp app2 = new JInfoTestLingeredApp(); try { - String[] params = new String[0]; - LingeredApp.startAppExactJvmOpts(app1, params); - LingeredApp.startAppExactJvmOpts(app2, params); + LingeredApp.startApp(app1); + LingeredApp.startApp(app2); OutputAnalyzer output = jinfo("JInfoTestLingeredApp"); output.shouldHaveExitValue(0); // "Runtime Environment" written once per proc diff --git a/test/jdk/sun/tools/jstat/JStatInterval.java b/test/jdk/sun/tools/jstat/JStatInterval.java index c3ff9404745..1dfa1f9187b 100644 --- a/test/jdk/sun/tools/jstat/JStatInterval.java +++ b/test/jdk/sun/tools/jstat/JStatInterval.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 @@ -24,6 +24,7 @@ /** * @test * @bug 8035668 + * @requires vm.flagless * @library /test/lib * @summary Test checks case when target application finishes execution and jstat didn't complete work. jstat is started with interval = 100 (jstat -compiler 100) and monitored application finishes @@ -60,9 +61,7 @@ public class JStatInterval { } } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-cp", - System.getProperty("test.class.path"), + ProcessBuilder pb = ProcessTools.createTestJvm( "-XX:+UsePerfData", Application.class.getName() );