< prev index next >

test/sun/tools/jps/JpsHelper.java

Print this page
rev 12066 : 8085813: The targeted processes in sun/tools tests should be launched with -XX:+UsePerfData flag in order to work on embedded platforms
   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  77                 }
  78                 combinations.add(combination);
  79             }
  80             return combinations;
  81         }
  82 
  83         /**
  84          *  Return combination of {@link JpsArg} as a String array
  85          */
  86         public static String[] asCmdArray(List<JpsArg> jpsArgs) {
  87             List<String> list = new ArrayList<>();
  88             for (JpsArg jpsArg : jpsArgs) {
  89                 list.add("-" + jpsArg.toString());
  90             }
  91             return list.toArray(new String[list.size()]);
  92         }
  93 
  94     }
  95 
  96     /**
  97      * VM arguments to start test application with

  98      */
  99     public static final String[] VM_ARGS = {"-Xmx512m", "-XX:+PrintGCDetails"};
 100     /**
 101      * VM flag to start test application with
 102      */
 103     public static final String VM_FLAG = "+DisableExplicitGC";
 104 
 105     private static File vmFlagsFile = null;
 106     private static List<String> testVmArgs = null;
 107     private static File manifestFile = null;
 108 
 109     /**
 110      * Create a file containing VM_FLAG in the working directory
 111      */
 112     public static File getVmFlagsFile() throws IOException {
 113         if (vmFlagsFile == null) {
 114             vmFlagsFile = new File("vmflags");
 115             try (BufferedWriter output = new BufferedWriter(new FileWriter(vmFlagsFile))) {
 116                 output.write(VM_FLAG);
 117             }
 118             vmFlagsFile.deleteOnExit();
 119         }


   1 /*
   2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  77                 }
  78                 combinations.add(combination);
  79             }
  80             return combinations;
  81         }
  82 
  83         /**
  84          *  Return combination of {@link JpsArg} as a String array
  85          */
  86         public static String[] asCmdArray(List<JpsArg> jpsArgs) {
  87             List<String> list = new ArrayList<>();
  88             for (JpsArg jpsArg : jpsArgs) {
  89                 list.add("-" + jpsArg.toString());
  90             }
  91             return list.toArray(new String[list.size()]);
  92         }
  93 
  94     }
  95 
  96     /**
  97      * VM arguments to start test application with.
  98      * -XX:+UsePerfData is required for running the tests on embedded platforms.
  99      */
 100     public static final String[] VM_ARGS = {"-XX:+UsePerfData", "-Xmx512m", "-XX:+PrintGCDetails"};
 101     /**
 102      * VM flag to start test application with
 103      */
 104     public static final String VM_FLAG = "+DisableExplicitGC";
 105 
 106     private static File vmFlagsFile = null;
 107     private static List<String> testVmArgs = null;
 108     private static File manifestFile = null;
 109 
 110     /**
 111      * Create a file containing VM_FLAG in the working directory
 112      */
 113     public static File getVmFlagsFile() throws IOException {
 114         if (vmFlagsFile == null) {
 115             vmFlagsFile = new File("vmflags");
 116             try (BufferedWriter output = new BufferedWriter(new FileWriter(vmFlagsFile))) {
 117                 output.write(VM_FLAG);
 118             }
 119             vmFlagsFile.deleteOnExit();
 120         }


< prev index next >