47 import org.testng.annotations.Test; |
47 import org.testng.annotations.Test; |
48 import org.testng.TestNG; |
48 import org.testng.TestNG; |
49 |
49 |
50 /* |
50 /* |
51 * @test |
51 * @test |
52 * @bug 8077350 8081566 8081567 8098852 |
52 * @bug 8077350 8081566 8081567 8098852 8136597 |
53 * @build jdk.testlibrary.* |
53 * @build jdk.testlibrary.* |
54 * @library /lib/testlibrary |
54 * @library /lib/testlibrary |
55 * @summary Functions of ProcessHandle.Info |
55 * @summary Functions of ProcessHandle.Info |
56 * @author Roger Riggs |
56 * @author Roger Riggs |
57 * @key intermittent |
57 * @key intermittent |
208 List<String> allArgs = p1.getArgs(); |
208 List<String> allArgs = p1.getArgs(); |
209 for (int i = 1; i < allArgs.size(); i++) { |
209 for (int i = 1; i < allArgs.size(); i++) { |
210 Assert.assertTrue(commandLine.contains(allArgs.get(i)), |
210 Assert.assertTrue(commandLine.contains(allArgs.get(i)), |
211 "commandLine() must contain argument: " + allArgs.get(i)); |
211 "commandLine() must contain argument: " + allArgs.get(i)); |
212 } |
212 } |
213 } else if (info.commandLine().isPresent()) { |
213 } else if (info.commandLine().isPresent() && |
|
214 command.isPresent() && |
|
215 command.get().length() < info.commandLine().get().length()) { |
214 // If we only have the commandLine() we can only do some basic checks... |
216 // If we only have the commandLine() we can only do some basic checks... |
215 String commandLine = info.commandLine().get(); |
217 String commandLine = info.commandLine().get(); |
216 String javaExe = "java" + (Platform.isWindows() ? ".exe": ""); |
218 String javaExe = "java" + (Platform.isWindows() ? ".exe" : ""); |
217 int pos = commandLine.indexOf(javaExe); |
219 int pos = commandLine.indexOf(javaExe); |
218 Assert.assertTrue(pos > 0, "commandLine() should at least contain 'java'"); |
220 Assert.assertTrue(pos > 0, "commandLine() should at least contain 'java'"); |
219 |
221 |
220 pos += javaExe.length() + 1; // +1 for the space after the command |
222 pos += javaExe.length() + 1; // +1 for the space after the command |
221 List<String> allArgs = p1.getArgs(); |
223 List<String> allArgs = p1.getArgs(); |