46 public static void main(String[] args) throws Exception {
47 ProcessBuilder pb;
48 OutputAnalyzer out;
49 Random rand = Utils.getRandomInstance();
50
51 pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
52 out = new OutputAnalyzer(pb.start());
53 out.shouldNotContain("no space to run compilers");
54 out.shouldHaveExitValue(0);
55
56 pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:ReservedCodeCacheSize=1770K", "-XX:InitialCodeCacheSize=4K", "-version");
57 out = new OutputAnalyzer(pb.start());
58 // The VM should not crash but may return an error message because we don't have enough space for adapters
59 int exitCode = out.getExitValue();
60 if (exitCode != 1 && exitCode != 0) {
61 throw new Exception("VM crashed with exit code " + exitCode);
62 }
63
64 // On s390x, generated code is ~6x larger in fastdebug and ~1.4x in release builds vs. other archs,
65 // hence we require slightly more minimum space.
66 int minInitialSize = 800 + (Platform.isS390x() ? 800 : 0);
67 for (int i = 0; i < 200; i++) {
68 int initialCodeCacheSizeInKb = minInitialSize + rand.nextInt(400);
69 int reservedCodeCacheSizeInKb = initialCodeCacheSizeInKb + rand.nextInt(200);
70 pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=" + initialCodeCacheSizeInKb + "K", "-XX:ReservedCodeCacheSize=" + reservedCodeCacheSizeInKb + "k", "-version");
71 out = new OutputAnalyzer(pb.start());
72 exitCode = out.getExitValue();
73 if (exitCode != 1 && exitCode != 0) {
74 throw new Exception("VM crashed with exit code " + exitCode);
75 }
76 // The VM should not crash but will probably fail with a "CodeCache is full. Compiler has been disabled." message
77 out.stdoutShouldNotContain("# A fatal error");
78 }
79 }
80 }
|
46 public static void main(String[] args) throws Exception {
47 ProcessBuilder pb;
48 OutputAnalyzer out;
49 Random rand = Utils.getRandomInstance();
50
51 pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
52 out = new OutputAnalyzer(pb.start());
53 out.shouldNotContain("no space to run compilers");
54 out.shouldHaveExitValue(0);
55
56 pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xint", "-XX:ReservedCodeCacheSize=1770K", "-XX:InitialCodeCacheSize=4K", "-version");
57 out = new OutputAnalyzer(pb.start());
58 // The VM should not crash but may return an error message because we don't have enough space for adapters
59 int exitCode = out.getExitValue();
60 if (exitCode != 1 && exitCode != 0) {
61 throw new Exception("VM crashed with exit code " + exitCode);
62 }
63
64 // On s390x, generated code is ~6x larger in fastdebug and ~1.4x in release builds vs. other archs,
65 // hence we require slightly more minimum space.
66 int minInitialSize = 2000 + (Platform.isS390x() ? 800 : 0);
67 for (int i = 0; i < 200; i++) {
68 int initialCodeCacheSizeInKb = minInitialSize + rand.nextInt(400);
69 int reservedCodeCacheSizeInKb = initialCodeCacheSizeInKb + rand.nextInt(200);
70 pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=" + initialCodeCacheSizeInKb + "K", "-XX:ReservedCodeCacheSize=" + reservedCodeCacheSizeInKb + "k", "-version");
71 out = new OutputAnalyzer(pb.start());
72 exitCode = out.getExitValue();
73 if (exitCode != 1 && exitCode != 0) {
74 throw new Exception("VM crashed with exit code " + exitCode);
75 }
76 // The VM should not crash but will probably fail with a "CodeCache is full. Compiler has been disabled." message
77 out.stdoutShouldNotContain("# A fatal error");
78 }
79 }
80 }
|