< prev index next >

test/hotspot/jtreg/compiler/startup/StartupOutput.java

Print this page

44 public class StartupOutput {
45     public static void main(String[] args) throws Exception {
46         ProcessBuilder pb;
47         OutputAnalyzer out;
48         Random rand = Utils.getRandomInstance();
49 
50         pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
51         out = new OutputAnalyzer(pb.start());
52         out.shouldNotContain("no space to run compilers");
53         out.shouldHaveExitValue(0);
54 
55         pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:ReservedCodeCacheSize=1770K", "-XX:InitialCodeCacheSize=4K", "-version");
56         out = new OutputAnalyzer(pb.start());
57         // The VM should not crash but may return an error message because we don't have enough space for adapters
58         int exitCode = out.getExitValue();
59         if (exitCode != 1 && exitCode != 0) {
60             throw new Exception("VM crashed with exit code " + exitCode);
61         }
62 
63         for (int i = 0; i < 200; i++) {
64             int initialCodeCacheSizeInKb = 800 + rand.nextInt(400);
65             int reservedCodeCacheSizeInKb = initialCodeCacheSizeInKb + rand.nextInt(200);
66             pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=" + initialCodeCacheSizeInKb + "K", "-XX:ReservedCodeCacheSize=" + reservedCodeCacheSizeInKb + "k", "-version");
67             out = new OutputAnalyzer(pb.start());
68             exitCode = out.getExitValue();
69             if (exitCode != 1 && exitCode != 0) {
70                 throw new Exception("VM crashed with exit code " + exitCode);
71             }
72             // The VM should not crash but will probably fail with a "CodeCache is full. Compiler has been disabled." message
73             out.stdoutShouldNotContain("# A fatal error");
74         }
75     }
76 }

44 public class StartupOutput {
45     public static void main(String[] args) throws Exception {
46         ProcessBuilder pb;
47         OutputAnalyzer out;
48         Random rand = Utils.getRandomInstance();
49 
50         pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
51         out = new OutputAnalyzer(pb.start());
52         out.shouldNotContain("no space to run compilers");
53         out.shouldHaveExitValue(0);
54 
55         pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:ReservedCodeCacheSize=1770K", "-XX:InitialCodeCacheSize=4K", "-version");
56         out = new OutputAnalyzer(pb.start());
57         // The VM should not crash but may return an error message because we don't have enough space for adapters
58         int exitCode = out.getExitValue();
59         if (exitCode != 1 && exitCode != 0) {
60             throw new Exception("VM crashed with exit code " + exitCode);
61         }
62 
63         for (int i = 0; i < 200; i++) {
64             int initialCodeCacheSizeInKb = 2000 + rand.nextInt(400);
65             int reservedCodeCacheSizeInKb = initialCodeCacheSizeInKb + rand.nextInt(200);
66             pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=" + initialCodeCacheSizeInKb + "K", "-XX:ReservedCodeCacheSize=" + reservedCodeCacheSizeInKb + "k", "-version");
67             out = new OutputAnalyzer(pb.start());
68             exitCode = out.getExitValue();
69             if (exitCode != 1 && exitCode != 0) {
70                 throw new Exception("VM crashed with exit code " + exitCode);
71             }
72             // The VM should not crash but will probably fail with a "CodeCache is full. Compiler has been disabled." message
73             out.stdoutShouldNotContain("# A fatal error");
74         }
75     }
76 }
< prev index next >