< prev index next >

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

Print this page

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         Process[] pr = new Process[200];
64         for (int i = 0; i < 200; i++) {
65             int initialCodeCacheSizeInKb = 800 + rand.nextInt(400);
66             int reservedCodeCacheSizeInKb = initialCodeCacheSizeInKb + rand.nextInt(200);
67             pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=" + initialCodeCacheSizeInKb + "K", "-XX:ReservedCodeCacheSize=" + reservedCodeCacheSizeInKb + "k", "-version");
68             pr[i] = pb.start();
69         }
70         for (int i = 0; i < 200; i++) {
71             out = new OutputAnalyzer(pr[i]);
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             exitCode = out.getExitValue();
75             if (exitCode != 1 && exitCode != 0) {
76                 throw new Exception("VM crashed with exit code " + exitCode);
77             }
78         }
79     }
80 }

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         Process[] pr = new Process[200];
64         for (int i = 0; i < 200; i++) {
65             int initialCodeCacheSizeInKb = 2000 + rand.nextInt(400);
66             int reservedCodeCacheSizeInKb = initialCodeCacheSizeInKb + rand.nextInt(200);
67             pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=" + initialCodeCacheSizeInKb + "K", "-XX:ReservedCodeCacheSize=" + reservedCodeCacheSizeInKb + "k", "-version");
68             pr[i] = pb.start();
69         }
70         for (int i = 0; i < 200; i++) {
71             out = new OutputAnalyzer(pr[i]);
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             exitCode = out.getExitValue();
75             if (exitCode != 1 && exitCode != 0) {
76                 throw new Exception("VM crashed with exit code " + exitCode);
77             }
78         }
79     }
80 }
< prev index next >