< prev index next >

test/java/lang/management/MemoryMXBean/LowMemoryTest.java

Print this page




  83         traceTest(classMain + ", -XX:+UseG1GC", nmFlag, lpFlag, "-XX:+UseG1GC", g1Flag);
  84         traceTest(classMain + ", -XX:+UseConcMarkSweepGC", nmFlag, lpFlag, "-XX:+UseConcMarkSweepGC");
  85     }
  86 
  87     /*
  88      * Creating command-line for running subprocess JVM:
  89      *
  90      * JVM command line is like:
  91      * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
  92      *
  93      * {defaultopts} are the default java options set by the framework.
  94      *
  95      * @param testOpts java options specified by the test.
  96      */
  97     private static List<String> buildCommandLine(String... testOpts) {
  98         List<String> opts = new ArrayList<>();
  99         opts.add(JDKToolFinder.getJDKTool("java"));
 100         opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
 101         opts.add("-cp");
 102         opts.add(System.getProperty("test.class.path", "test.class.path"));
 103         opts.add("-XX:+PrintGCDetails");
 104         opts.addAll(Arrays.asList(testOpts));
 105         opts.add(classMain);
 106 
 107         return opts;
 108     }
 109 
 110     /**
 111      * Runs LowMemoryTest$TestMain with the passed options and redirects subprocess
 112      * standard I/O to the current (parent) process. This provides a trace of what
 113      * happens in the subprocess while it is runnning (and before it terminates).
 114      *
 115      * @param prefixName the prefix string for redirected outputs
 116      * @param testOpts java options specified by the test.
 117      */
 118     private static void traceTest(String prefixName,
 119                                   String... testOpts)
 120                 throws Throwable {
 121 
 122         // Building command-line
 123         List<String> opts = buildCommandLine(testOpts);




  83         traceTest(classMain + ", -XX:+UseG1GC", nmFlag, lpFlag, "-XX:+UseG1GC", g1Flag);
  84         traceTest(classMain + ", -XX:+UseConcMarkSweepGC", nmFlag, lpFlag, "-XX:+UseConcMarkSweepGC");
  85     }
  86 
  87     /*
  88      * Creating command-line for running subprocess JVM:
  89      *
  90      * JVM command line is like:
  91      * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
  92      *
  93      * {defaultopts} are the default java options set by the framework.
  94      *
  95      * @param testOpts java options specified by the test.
  96      */
  97     private static List<String> buildCommandLine(String... testOpts) {
  98         List<String> opts = new ArrayList<>();
  99         opts.add(JDKToolFinder.getJDKTool("java"));
 100         opts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
 101         opts.add("-cp");
 102         opts.add(System.getProperty("test.class.path", "test.class.path"));
 103         opts.add("-Xlog:gc*=debug");
 104         opts.addAll(Arrays.asList(testOpts));
 105         opts.add(classMain);
 106 
 107         return opts;
 108     }
 109 
 110     /**
 111      * Runs LowMemoryTest$TestMain with the passed options and redirects subprocess
 112      * standard I/O to the current (parent) process. This provides a trace of what
 113      * happens in the subprocess while it is runnning (and before it terminates).
 114      *
 115      * @param prefixName the prefix string for redirected outputs
 116      * @param testOpts java options specified by the test.
 117      */
 118     private static void traceTest(String prefixName,
 119                                   String... testOpts)
 120                 throws Throwable {
 121 
 122         // Building command-line
 123         List<String> opts = buildCommandLine(testOpts);


< prev index next >