OSDN Git Service

Print to System.err in test 909 to avoid output races.
authorVladimir Marko <vmarko@google.com>
Mon, 30 Jan 2017 18:31:53 +0000 (18:31 +0000)
committerVladimir Marko <vmarko@google.com>
Mon, 30 Jan 2017 18:31:53 +0000 (18:31 +0000)
Throwable.printStackTrace() prints to System.err, so print
all other output to System.err as well to avoid races like

    #################### info
    # Tests jvmti plugin attaching during live phase.
    #################### diffs
    --- expected.txt 2017-01-13 18:22:13.897224469 +0000
    +++ output.txt 2017-01-30 17:51:21.091550290 +0000
    @@ -6,6 +6,6 @@
     Goodbye!
     Hello, world!
     java.io.IOException: Process is not debuggable.
    +Goodbye!
      at dalvik.system.VMDebug.attachAgent(Native Method)
      at Main.main(Main.java:27)
    -Goodbye!
    ####################

Test: m test-art-host-run-test-909-attach-agent
Change-Id: I956bd24db056154b938568c156df80d4ff56ba11

test/909-attach-agent/src/Main.java

index 8a8a087..569b89a 100644 (file)
@@ -19,7 +19,7 @@ import java.io.IOException;
 
 public class Main {
   public static void main(String[] args) {
-    System.out.println("Hello, world!");
+    System.err.println("Hello, world!");
     for(String a : args) {
       if(a.startsWith("agent:")) {
         String agent = a.substring(6);
@@ -30,6 +30,6 @@ public class Main {
         }
       }
     }
-    System.out.println("Goodbye!");
+    System.err.println("Goodbye!");
   }
 }