changeset 18368:cb3c93857cbb

made compilation replay testing less strict by default
author Doug Simon <doug.simon@oracle.com>
date Thu, 13 Nov 2014 17:25:08 +0100
parents 23526af9360d
children 966034c24f0e
files graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu Nov 13 16:53:30 2014 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu Nov 13 17:25:08 2014 +0100
@@ -676,15 +676,18 @@
     }
 
     /**
-     * Determines if every compilation should also be attempted in a replay {@link Context}.
-     *
-     * <pre>
-     * -Dgraal.testReplay=true
-     * </pre>
+     * Determines if {@linkplain #compile(ResolvedJavaMethod, StructuredGraph) compilation} should
+     * also be attempted in a replay {@link Context} where possible.
      */
     private static final boolean TEST_REPLAY = Boolean.getBoolean("graal.testReplay");
 
     /**
+     * Determines if a {@link #checkCompilationResultsEqual mismatching} replay compilation result
+     * results in a diagnostic message or a test error.
+     */
+    private static final boolean TEST_REPLAY_MISMATCH_IS_FAILURE = Boolean.getBoolean("graal.testReplay.strict");
+
+    /**
      * Directory into which tests can dump content useful in debugging test failures.
      */
     private static final File OUTPUT_DIR = new File(System.getProperty("graal.test.output"), "testOutput");
@@ -710,7 +713,7 @@
         }
     }
 
-    protected void assertCompilationResultsEqual(Context c, String prefix, CompilationResult original, CompilationResult derived, ResolvedJavaMethod installedCodeOwner) {
+    protected void checkCompilationResultsEqual(Context c, String prefix, CompilationResult original, CompilationResult derived, ResolvedJavaMethod installedCodeOwner) {
         if (!derived.equals(original)) {
             Mode mode = c.getMode();
             // Temporarily force capturing mode as dumping/printing/disassembling
@@ -723,7 +726,11 @@
                 if (originalDisFile != null && derivedDisFile != null) {
                     message += String.format(" [diff %s %s]", originalDisFile, derivedDisFile);
                 }
-                Assert.fail(message);
+                if (TEST_REPLAY_MISMATCH_IS_FAILURE) {
+                    Assert.fail(message);
+                } else {
+                    System.out.println(message);
+                }
             } finally {
                 c.setMode(mode);
             }
@@ -740,7 +747,7 @@
             Request<CompilationResult> request = c.get(new GraalCompiler.Request<>(graphToCompile, null, cc, installedCodeOwner, getProviders(), getBackend(), getCodeCache().getTarget(), null,
                             getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graphToCompile), getSpeculationLog(), getSuites(), new CompilationResult(),
                             CompilationResultBuilderFactory.Default));
-            assertCompilationResultsEqual(c, mode.name(), originalResultInContext, GraalCompiler.compile(request), installedCodeOwner);
+            checkCompilationResultsEqual(c, mode.name(), originalResultInContext, GraalCompiler.compile(request), installedCodeOwner);
         } catch (Throwable e) {
             throw Debug.handle(e);
         }