8316464: 3 sun/tools tests ignore VM flags

Reviewed-by: sspitsyn, cjplummer
This commit is contained in:
Leonid Mesnik 2023-10-12 23:32:37 +00:00
parent 17535c34bc
commit 993951b85e
3 changed files with 10 additions and 12 deletions

View File

@ -50,8 +50,9 @@ import jdk.test.lib.util.ModuleInfoWriter;
* @test * @test
* @bug 8205654 * @bug 8205654
* @summary Unit test for sun.tools.ProcessHelper class. The test launches Java processes with different Java options * @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" * @requires os.family == "linux"
* @modules jdk.jcmd/sun.tools.common:+open * @modules jdk.jcmd/sun.tools.common:+open
* java.base/jdk.internal.classfile * java.base/jdk.internal.classfile

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -60,9 +60,8 @@ public class JInfoTest {
LingeredApp app1 = new JInfoTestLingeredApp(); LingeredApp app1 = new JInfoTestLingeredApp();
LingeredApp app2 = new JInfoTestLingeredApp(); LingeredApp app2 = new JInfoTestLingeredApp();
try { try {
String[] params = new String[0];; LingeredApp.startApp(app1);
LingeredApp.startAppExactJvmOpts(app1, params); LingeredApp.startApp(app2);
LingeredApp.startAppExactJvmOpts(app2, params);
OutputAnalyzer output = jinfo("-flag", "MinHeapFreeRatio=1", "JInfoTestLingeredApp"); OutputAnalyzer output = jinfo("-flag", "MinHeapFreeRatio=1", "JInfoTestLingeredApp");
output.shouldHaveExitValue(0); output.shouldHaveExitValue(0);
output = jinfo("-flag", "MinHeapFreeRatio", "JInfoTestLingeredApp"); output = jinfo("-flag", "MinHeapFreeRatio", "JInfoTestLingeredApp");
@ -89,9 +88,8 @@ public class JInfoTest {
LingeredApp app1 = new JInfoTestLingeredApp(); LingeredApp app1 = new JInfoTestLingeredApp();
LingeredApp app2 = new JInfoTestLingeredApp(); LingeredApp app2 = new JInfoTestLingeredApp();
try { try {
String[] params = new String[0]; LingeredApp.startApp(app1);
LingeredApp.startAppExactJvmOpts(app1, params); LingeredApp.startApp(app2);
LingeredApp.startAppExactJvmOpts(app2, params);
OutputAnalyzer output = jinfo("JInfoTestLingeredApp"); OutputAnalyzer output = jinfo("JInfoTestLingeredApp");
output.shouldHaveExitValue(0); output.shouldHaveExitValue(0);
// "Runtime Environment" written once per proc // "Runtime Environment" written once per proc

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/** /**
* @test * @test
* @bug 8035668 * @bug 8035668
* @requires vm.flagless
* @library /test/lib * @library /test/lib
* @summary Test checks case when target application finishes execution and jstat didn't complete work. * @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 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 { public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( ProcessBuilder pb = ProcessTools.createTestJvm(
"-cp",
System.getProperty("test.class.path"),
"-XX:+UsePerfData", "-XX:+UsePerfData",
Application.class.getName() Application.class.getName()
); );