< prev index next >

test/compiler/compilercontrol/share/actions/BaseAction.java

Print this page
rev 9429 : imported patch StressJCMD
rev 9149 : 8066153: JEP-JDK-8046155: Test task: cover existing
Summary: Tests for CompilerCommand and CompilerControl's directives
Reviewed-by: kvn

@@ -53,15 +53,28 @@
         METHODS_NAMES = METHODS.stream().collect(Collectors.toMap(
                 pair -> pair.first.toGenericString(),
                 pair -> pair.first));
     }
 
+    /*
+     * args[0] is a port to connect
+     * args[1] is an optional parameter that shows that the state map should be
+     *         passed
+     */
     public static void main(String[] args) {
         if (args.length < 1) {
             throw new Error("TESTBUG: requires port as parameter: "
                     + Arrays.toString(args));
         }
+        boolean getStates = false;
+        if (args.length == 2) {
+            if ("states".equals(args[1])) {
+                getStates = true;
+            } else {
+                throw new Error("TESTBUG: incorrect argument: "+ args[1]);
+            }
+        }
         int pid;
         try {
             pid = ProcessTools.getProcessId();
         } catch (Exception e) {
             throw new Error("Could not determine own pid", e);

@@ -76,15 +89,19 @@
                 PrintWriter out = new PrintWriter(
                         new OutputStreamWriter(socket.getOutputStream()))) {
             // send own pid to execute jcmd if needed
             out.println(String.valueOf(pid));
             out.flush();
+            if (getStates) {
             lines = in.lines().collect(Collectors.toList());
+                check(decodeMap(lines));
+            } else {
+                in.readLine();
+            }
         } catch (IOException e) {
             throw new Error("Error on performing network operation", e);
         }
-        check(decodeMap(lines));
     }
 
     private static Map<Executable, State> decodeMap(List<String> lines) {
         if (lines == null || lines.size() == 0) {
             throw new Error("TESTBUG: unexpected lines list");
< prev index next >