Skip to content

Commit

Permalink
8316451: 6 java/lang/instrument/PremainClass tests ignore VM flags
Browse files Browse the repository at this point in the history
Backport-of: 9029bf644e238a504e1f114a73edf5760d19980b
  • Loading branch information
GoeLin committed Apr 8, 2024
1 parent d5c170a commit 2a56bfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/jdk/java/lang/instrument/NegativeAgentRunner.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* 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 Down Expand Up @@ -35,7 +35,7 @@ public static void main(String argv[]) throws Exception {
}
String agentClassName = argv[0];
String excepClassName = argv[1];
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-javaagent:" + agentClassName + ".jar", "-Xmx128m", "-XX:-CreateCoredumpOnCrash",
agentClassName);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
Expand Down
12 changes: 4 additions & 8 deletions test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* 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 Down Expand Up @@ -39,14 +39,10 @@ public class PremainClassTest {
// a non ascii character.
// Verify that the premain() function is executed correctly.
public static void main(String[] a) throws Exception {
String testArgs = String.format(
"-javaagent:%s/Agent.jar -classpath %s DummyMain",
System.getProperty("test.src"),
System.getProperty("test.classes", "."));
String testArgs = String.format("-javaagent:%s/Agent.jar",
System.getProperty("test.src"));

ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
Utils.addTestJavaOpts(testArgs.split("\\s+")));
System.out.println("testjvm.cmd:" + Utils.getCommandLine(pb));
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(testArgs, "DummyMain");

OutputAnalyzer output = ProcessTools.executeProcess(pb);
System.out.println("testjvm.stdout:" + output.getStdout());
Expand Down

1 comment on commit 2a56bfb

@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.