changeset 1462:71f636042ac4

7902171: CompilerControlExcludeActualTest fails intermittently
author shade
date Tue, 22 Jan 2019 16:22:42 +0100
parents 8885c463d99e
children 5984e353dca7
files jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlDontInlineActualTest.java jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlExcludeActualTest.java jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlInlineActualTest.java jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlUtils.java
diffstat 4 files changed, 36 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlDontInlineActualTest.java	Thu Jan 17 19:04:43 2019 +0100
+++ b/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlDontInlineActualTest.java	Tue Jan 22 16:22:42 2019 +0100
@@ -37,6 +37,8 @@
 import org.openjdk.jmh.runner.options.OptionsBuilder;
 import org.openjdk.jmh.runner.options.TimeValue;
 
+import java.util.Collection;
+
 public class CompilerControlDontInlineActualTest {
 
     @CompilerControl(CompilerControl.Mode.DONT_INLINE)
@@ -64,18 +66,21 @@
                     .mode(mode)
                     .shouldFailOnError(true)
                     .addProfiler(LogConsumeProfiler.class)
-                    .measurementIterations(mode == Mode.SingleShotTime ? 10000 : 1)
+                    .measurementIterations(mode == Mode.SingleShotTime ? 200000 : 1)
                     .measurementTime(TimeValue.seconds(5))
                     .warmupIterations(0)
                     .forks(1)
+                    .jvmArgsPrepend("-XX:CICompilerCount=2") // need to serialize the output properly
                     .build();
             RunResult runResult = new Runner(opts).runSingle();
 
-            if (CompilerControlUtils.check(runResult, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
+            Collection<String> log = CompilerControlUtils.getLog(runResult);
+
+            if (CompilerControlUtils.check(log, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
                 Assert.assertTrue("Failed with " + mode,
-                        CompilerControlUtils.check(runResult, this.getClass().getName() + "::compilerControlSpecimen", "disallowed by"));
+                        CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "disallowed by"));
                 Assert.assertTrue("Failed with " + mode,
-                        CompilerControlUtils.check(runResult, this.getClass().getName() + "::strawMethod", "disallowed by"));
+                        CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "disallowed by"));
             }
         }
     }
--- a/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlExcludeActualTest.java	Thu Jan 17 19:04:43 2019 +0100
+++ b/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlExcludeActualTest.java	Tue Jan 22 16:22:42 2019 +0100
@@ -37,6 +37,8 @@
 import org.openjdk.jmh.runner.options.OptionsBuilder;
 import org.openjdk.jmh.runner.options.TimeValue;
 
+import java.util.Collection;
+
 public class CompilerControlExcludeActualTest {
 
     @CompilerControl(CompilerControl.Mode.EXCLUDE)
@@ -64,23 +66,26 @@
                     .mode(mode)
                     .shouldFailOnError(true)
                     .addProfiler(LogConsumeProfiler.class)
-                    .measurementIterations(mode == Mode.SingleShotTime ? 10000 : 1)
+                    .measurementIterations(mode == Mode.SingleShotTime ? 200000 : 1)
                     .measurementTime(TimeValue.seconds(5))
                     .warmupIterations(0)
                     .forks(1)
+                    .jvmArgsPrepend("-XX:CICompilerCount=2") // need to serialize the output properly
                     .build();
             RunResult runResult = new Runner(opts).runSingle();
 
-            if (CompilerControlUtils.check(runResult, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
+            Collection<String> log = CompilerControlUtils.getLog(runResult);
+
+            if (CompilerControlUtils.check(log, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
                 Assert.assertTrue("Failed with " + mode,
-                         CompilerControlUtils.check(runResult, this.getClass().getName() + "::compilerControlSpecimen", "excluded by") ||
-                         CompilerControlUtils.check(runResult, this.getClass().getName() + "::compilerControlSpecimen", "not compilable") ||
-                         CompilerControlUtils.check(runResult, this.getClass().getName() + "::compilerControlSpecimen", "disallowed by CompileCommand")
+                         CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "excluded by") ||
+                         CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "not compilable") ||
+                         CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "disallowed by CompileCommand")
                 );
                 Assert.assertTrue("Failed with " + mode,
-                        CompilerControlUtils.check(runResult, this.getClass().getName() + "::strawMethod", "excluded by") ||
-                        CompilerControlUtils.check(runResult, this.getClass().getName() + "::strawMethod", "not compilable") ||
-                        CompilerControlUtils.check(runResult, this.getClass().getName() + "::strawMethod", "disallowed by CompileCommand")
+                        CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "excluded by") ||
+                        CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "not compilable") ||
+                        CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "disallowed by CompileCommand")
                 );
             }
         }
--- a/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlInlineActualTest.java	Thu Jan 17 19:04:43 2019 +0100
+++ b/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlInlineActualTest.java	Tue Jan 22 16:22:42 2019 +0100
@@ -37,6 +37,8 @@
 import org.openjdk.jmh.runner.options.OptionsBuilder;
 import org.openjdk.jmh.runner.options.TimeValue;
 
+import java.util.Collection;
+
 public class CompilerControlInlineActualTest {
 
     @CompilerControl(CompilerControl.Mode.INLINE)
@@ -64,18 +66,21 @@
                     .mode(mode)
                     .shouldFailOnError(true)
                     .addProfiler(LogConsumeProfiler.class)
-                    .measurementIterations(mode == Mode.SingleShotTime ? 10000 : 1)
+                    .measurementIterations(mode == Mode.SingleShotTime ? 200000 : 1)
                     .measurementTime(TimeValue.seconds(5))
                     .warmupIterations(0)
                     .forks(1)
+                    .jvmArgsPrepend("-XX:CICompilerCount=2") // need to serialize the output properly
                     .build();
             RunResult runResult = new Runner(opts).runSingle();
 
-            if (CompilerControlUtils.check(runResult, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
+            Collection<String> log = CompilerControlUtils.getLog(runResult);
+
+            if (CompilerControlUtils.check(log, "@", "callee")) { // Poor man's check -XX:+PrintInlining works
                 Assert.assertTrue("Failed with " + mode,
-                        CompilerControlUtils.check(runResult, this.getClass().getName() + "::compilerControlSpecimen", "force inline by"));
+                        CompilerControlUtils.check(log, this.getClass().getName() + "::compilerControlSpecimen", "force inline by"));
                 Assert.assertTrue("Failed with " + mode,
-                        CompilerControlUtils.check(runResult, this.getClass().getName() + "::strawMethod", "force inline by"));
+                        CompilerControlUtils.check(log, this.getClass().getName() + "::strawMethod", "force inline by"));
             }
         }
     }
--- a/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlUtils.java	Thu Jan 17 19:04:43 2019 +0100
+++ b/jmh-core-it/src/test/java/org/openjdk/jmh/it/ccontrol/CompilerControlUtils.java	Tue Jan 22 16:22:42 2019 +0100
@@ -31,11 +31,13 @@
 
 public class CompilerControlUtils {
 
-    public static boolean check(RunResult runResult, String... checkFor) {
+    public static Collection<String> getLog(RunResult runResult) {
         LogConsumeProfiler.LogConsumeResult r = (LogConsumeProfiler.LogConsumeResult) runResult.getSecondaryResults().get("logout");
-        Collection<String> lines = r.getLines();
+        return r.getLines();
+    }
 
-        line: for (String line : lines) {
+    public static boolean check(Collection<String> log, String... checkFor) {
+        line: for (String line : log) {
             System.out.println(line);
             for (String m : checkFor) {
                 if (!line.contains(m)) continue line;