Skip to content

Commit

Permalink
8314834: serviceability/jdwp/AllModulesCommandTest.java ignores VM flags
Browse files Browse the repository at this point in the history
Reviewed-by: sspitsyn
  • Loading branch information
lmesnik committed Aug 30, 2023
1 parent 1ea6463 commit 8e4cda0
Showing 1 changed file with 5 additions and 28 deletions.
33 changes: 5 additions & 28 deletions test/hotspot/jtreg/serviceability/jdwp/DebuggeeLauncher.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -25,6 +25,7 @@
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.JDWP;
import static jdk.test.lib.Asserts.assertFalse;
import jdk.test.lib.process.ProcessTools;

/**
* Launches the debuggee with the necessary JDWP options and handles the output
Expand Down Expand Up @@ -54,8 +55,9 @@ public interface Listener {
}

private int jdwpPort = -1;
private static final String CLS_DIR = System.getProperty("test.classes", "").trim();
private static final String DEBUGGEE = "AllModulesCommandTestDebuggee";
private static final String JDWP_OPT = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0";

private Process p;
private final Listener listener;
private StreamHandler inputHandler;
Expand All @@ -76,30 +78,14 @@ public DebuggeeLauncher(Listener listener) {
*/
public void launchDebuggee() throws Throwable {

ProcessBuilder pb = new ProcessBuilder(getCommand());
ProcessBuilder pb = ProcessTools.createTestJvm(JDWP_OPT, DEBUGGEE);
p = pb.start();
inputHandler = new StreamHandler(p.getInputStream(), this);
errorHandler = new StreamHandler(p.getErrorStream(), this);
inputHandler.start();
errorHandler.start();
}

/**
* Command to start the debuggee with the JDWP options and using the JDK
* under test
*
* @return the command
*/
private String[] getCommand() {
return new String[]{
JDKToolFinder.getTestJDKTool("java"),
getJdwpOptions(),
"-cp",
CLS_DIR,
DEBUGGEE
};
}

/**
* Terminates the debuggee
*/
Expand All @@ -109,15 +95,6 @@ public void terminateDebuggee() {
}
}

/**
* Debuggee JDWP options
*
* @return the JDWP options to start the debuggee with
*/
private static String getJdwpOptions() {
return "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0";
}

/**
* Gets JDWP port debuggee is listening on.
*
Expand Down

1 comment on commit 8e4cda0

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.