equal
deleted
inserted
replaced
24 |
24 |
25 import nsk.share.*; |
25 import nsk.share.*; |
26 import nsk.share.jpda.*; |
26 import nsk.share.jpda.*; |
27 import nsk.share.jdi.*; |
27 import nsk.share.jdi.*; |
28 |
28 |
|
29 import java.nio.file.FileSystems; |
|
30 import java.nio.file.Path; |
|
31 |
29 /** |
32 /** |
30 * Launches a new Java process that uses a communication pipe to interact |
33 * Launches a new Java process that uses a communication pipe to interact |
31 * with the test. |
34 * with the test. |
32 */ |
35 */ |
33 |
36 |
34 public class TestProcessLauncher { |
37 public class TestProcessLauncher { |
35 |
38 |
36 private final String className; |
39 protected static final Path USER_DIR = FileSystems.getDefault().getPath(System.getProperty("user.dir", ".")); |
|
40 protected static final Path TEST_CLASSES_DIR = FileSystems.getDefault().getPath(System.getProperty("test.classes")); |
|
41 |
|
42 protected final String className; |
37 private final ArgumentHandler argHandler; |
43 private final ArgumentHandler argHandler; |
38 |
44 |
39 private IOPipe pipe; |
45 private IOPipe pipe; |
40 |
46 |
41 public TestProcessLauncher(String className, ArgumentHandler argHandler) { |
47 public TestProcessLauncher(String className, ArgumentHandler argHandler) { |
53 |
59 |
54 Log log = new Log(System.out, argHandler); |
60 Log log = new Log(System.out, argHandler); |
55 Binder binder = new Binder(argHandler, log); |
61 Binder binder = new Binder(argHandler, log); |
56 binder.prepareForPipeConnection(argHandler); |
62 binder.prepareForPipeConnection(argHandler); |
57 |
63 |
58 String cmd = java + " " + className + " -pipe.port=" + argHandler.getPipePort(); |
64 String cmd = prepareLaunch(java, argHandler.getPipePort()); |
59 |
65 |
60 Debugee debuggee = binder.startLocalDebugee(cmd); |
66 Debugee debuggee = binder.startLocalDebugee(cmd); |
61 debuggee.redirectOutput(log); |
67 debuggee.redirectOutput(log); |
62 |
68 |
63 pipe = new IOPipe(debuggee); |
69 pipe = new IOPipe(debuggee); |
73 if (pipe != null) { |
79 if (pipe != null) { |
74 pipe.println("quit"); |
80 pipe.println("quit"); |
75 } |
81 } |
76 } |
82 } |
77 |
83 |
|
84 protected String prepareLaunch(String javaExec, String pipePort) { |
|
85 return javaExec + " " + className + " -pipe.port=" + pipePort; |
|
86 } |
|
87 |
78 } |
88 } |