changeset 12284:5e50e2411d2e

8085813: The targeted processes in sun/tools tests should be launched with -XX:+UsePerfData flag in order to work on embedded platforms Reviewed-by: sspitsyn
author ykantser
date Tue, 09 Jun 2015 10:11:11 +0200
parents 1fbff7c179ee
children 8c733ec95660
files test/com/sun/tools/attach/BasicTests.java test/com/sun/tools/attach/RunnerUtil.java test/sun/tools/jmap/heapconfig/TmtoolTestScenario.java test/sun/tools/jps/JpsHelper.java
diffstat 4 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/test/com/sun/tools/attach/BasicTests.java	Tue Jun 09 16:48:54 2015 +0200
+++ b/test/com/sun/tools/attach/BasicTests.java	Tue Jun 09 10:11:11 2015 +0200
@@ -21,17 +21,21 @@
  * questions.
  */
 
-import com.sun.tools.attach.*;
+import java.io.File;
+import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.Socket;
-import java.io.IOException;
+import java.util.List;
 import java.util.Properties;
-import java.util.List;
-import java.io.File;
+
 import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.ProcessThread;
 import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.ProcessThread;
+
+import com.sun.tools.attach.AgentInitializationException;
+import com.sun.tools.attach.AgentLoadException;
+import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.VirtualMachineDescriptor;
 
 /*
  * @test
--- a/test/com/sun/tools/attach/RunnerUtil.java	Tue Jun 09 16:48:54 2015 +0200
+++ b/test/com/sun/tools/attach/RunnerUtil.java	Tue Jun 09 10:11:11 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, 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
@@ -48,7 +48,7 @@
      */
     public static ProcessThread startApplication(String... additionalOpts) throws Throwable {
         String classpath = System.getProperty("test.class.path", ".");
-        String[] myArgs = concat(additionalOpts, new String [] { "-Dattach.test=true", "-classpath", classpath, "Application" });
+        String[] myArgs = concat(additionalOpts, new String [] { "-XX:+UsePerfData", "-Dattach.test=true", "-classpath", classpath, "Application" });
         String[] args = Utils.addTestJavaOpts(myArgs);
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
         ProcessThread pt = new ProcessThread("runApplication", (line) -> line.equals(Application.READY_MSG), pb);
--- a/test/sun/tools/jmap/heapconfig/TmtoolTestScenario.java	Tue Jun 09 16:48:54 2015 +0200
+++ b/test/sun/tools/jmap/heapconfig/TmtoolTestScenario.java	Tue Jun 09 10:11:11 2015 +0200
@@ -38,7 +38,7 @@
 
 public class TmtoolTestScenario {
 
-    private final ArrayList<String> toolOutput = new ArrayList();
+    private final ArrayList<String> toolOutput = new ArrayList<String>();
     private LingeredApp theApp = null;
     private final String toolName;
     private final String[] toolArgs;
@@ -72,7 +72,7 @@
      */
     public Map<String, String>  parseFlagsFinal() {
         List<String> astr = theApp.getAppOutput();
-        Map<String, String> vmMap = new HashMap();
+        Map<String, String> vmMap = new HashMap<String, String>();
 
         for (String line : astr) {
             String[] lv = line.trim().split("\\s+");
@@ -94,7 +94,10 @@
         System.out.println("Starting LingeredApp");
         try {
             try {
-                theApp = LingeredApp.startApp(vmArgs);
+                List<String> vmArgsExtended = new ArrayList<String>();
+                vmArgsExtended.add("-XX:+UsePerfData");
+                vmArgsExtended.addAll(vmArgs);
+                theApp = LingeredApp.startApp(vmArgsExtended);
 
                 System.out.println("Starting " + toolName + " against " + theApp.getPid());
                 JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
--- a/test/sun/tools/jps/JpsHelper.java	Tue Jun 09 16:48:54 2015 +0200
+++ b/test/sun/tools/jps/JpsHelper.java	Tue Jun 09 10:11:11 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -94,9 +94,10 @@
     }
 
     /**
-     * VM arguments to start test application with
+     * VM arguments to start test application with.
+     * -XX:+UsePerfData is required for running the tests on embedded platforms.
      */
-    public static final String[] VM_ARGS = {"-Xmx512m", "-XX:+PrintGCDetails"};
+    public static final String[] VM_ARGS = {"-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails"};
     /**
      * VM flag to start test application with
      */