changeset 57:69bc1543d446

Absorb the check test failures into the log.
author shade
date Thu, 03 Oct 2013 15:09:47 +0400
parents 49d5be2f6189
children b508dbc99189
files harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor1_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Arbiter1_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor3_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor4_Runner.java harness/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java
diffstat 6 files changed, 130 insertions(+), 119 deletions(-) [+]
line wrap: on
line diff
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor1_Runner.java	Thu Oct 03 15:00:30 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor1_Runner.java	Thu Oct 03 15:09:47 2013 +0400
@@ -66,11 +66,29 @@
     public void run() throws ExecutionException, InterruptedException {
         testLog.println("Running " + test.getClass().getName());
 
-        Status status = checkRun();
-        if (status != Status.NORMAL) {
+        try {
+            R res1 = test.newResult();
+            S state = test.newState();
+            test.actor1(state, res1);
+        } catch (NoClassDefFoundError e) {
             testLog.println("Test sanity check failed, skipping");
             testLog.println();
-            dumpFailure(test, status);
+            dumpFailure(test, Status.API_MISMATCH, e);
+            return;
+        } catch (NoSuchFieldError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH, e);
+            return;
+        } catch (NoSuchMethodError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH, e);
+            return;
+        } catch (Throwable e) {
+            testLog.println("Check test failed");
+            testLog.println();
+            dumpFailure(test, Status.CHECK_TEST_ERROR, e);
             return;
         }
 
@@ -97,24 +115,6 @@
     }
 
 
-    private Status checkRun() {
-        try {
-            R res1 = test.newResult();
-            S state = test.newState();
-            test.actor1(state, res1);
-            return Status.NORMAL;
-        } catch (NoClassDefFoundError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchFieldError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchMethodError e) {
-            return Status.API_MISMATCH;
-        } catch (Throwable e) {
-            e.printStackTrace();
-            return Status.CHECK_TEST_ERROR;
-        }
-    }
-
     private Counter<R> run(int time) throws InterruptedException, ExecutionException {
 
         @SuppressWarnings("unchecked")
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Arbiter1_Runner.java	Thu Oct 03 15:00:30 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Arbiter1_Runner.java	Thu Oct 03 15:09:47 2013 +0400
@@ -58,11 +58,31 @@
     public void run() throws InterruptedException, ExecutionException {
         testLog.println("Running " + test.getClass().getName());
 
-        Status status = checkRun();
-        if (status != Status.NORMAL) {
+        try {
+            R res = test.newResult();
+            S state = test.newState();
+            test.actor1(state, res);
+            test.actor2(state, res);
+            test.arbiter1(state, res);
+        } catch (NoClassDefFoundError e) {
             testLog.println("Test sanity check failed, skipping");
             testLog.println();
-            dumpFailure(test, status);
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (NoSuchFieldError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (NoSuchMethodError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (Throwable e) {
+            testLog.println("Check test failed");
+            testLog.println();
+            dumpFailure(test, Status.CHECK_TEST_ERROR);
             return;
         }
 
@@ -89,26 +109,6 @@
         return 3;
     }
 
-    private Status checkRun() {
-        try {
-            R res = test.newResult();
-            S state = test.newState();
-            test.actor1(state, res);
-            test.actor2(state, res);
-            test.arbiter1(state, res);
-            return Status.NORMAL;
-        } catch (NoClassDefFoundError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchFieldError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchMethodError e) {
-            return Status.API_MISMATCH;
-        } catch (Throwable e) {
-            e.printStackTrace();
-            return Status.CHECK_TEST_ERROR;
-        }
-    }
-
     public Counter<R> run(int time) throws InterruptedException, ExecutionException {
         @SuppressWarnings("unchecked")
         final S[] poison = (S[]) new Object[0];
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Runner.java	Thu Oct 03 15:00:30 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor2_Runner.java	Thu Oct 03 15:09:47 2013 +0400
@@ -66,11 +66,31 @@
     public void run() throws ExecutionException, InterruptedException {
         testLog.println("Running " + test.getClass().getName());
 
-        Status status = checkRun();
-        if (status != Status.NORMAL) {
+        try {
+            R res1 = test.newResult();
+            R res2 = test.newResult();
+            S state = test.newState();
+            test.actor1(state, res1);
+            test.actor2(state, res2);
+        } catch (NoClassDefFoundError e) {
             testLog.println("Test sanity check failed, skipping");
             testLog.println();
-            dumpFailure(test, status);
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (NoSuchFieldError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (NoSuchMethodError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (Throwable e) {
+            testLog.println("Check test failed");
+            testLog.println();
+            dumpFailure(test, Status.CHECK_TEST_ERROR);
             return;
         }
 
@@ -96,26 +116,6 @@
         return 2;
     }
 
-    private Status checkRun() {
-        try {
-            R res1 = test.newResult();
-            R res2 = test.newResult();
-            S state = test.newState();
-            test.actor1(state, res1);
-            test.actor2(state, res2);
-            return Status.NORMAL;
-        } catch (NoClassDefFoundError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchFieldError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchMethodError e) {
-            return Status.API_MISMATCH;
-        } catch (Throwable e) {
-            e.printStackTrace();
-            return Status.CHECK_TEST_ERROR;
-        }
-    }
-
     private Counter<R> run(int time) throws InterruptedException, ExecutionException {
 
         @SuppressWarnings("unchecked")
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor3_Runner.java	Thu Oct 03 15:00:30 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor3_Runner.java	Thu Oct 03 15:09:47 2013 +0400
@@ -66,11 +66,33 @@
     public void run() throws ExecutionException, InterruptedException {
         testLog.println("Running " + test.getClass().getName());
 
-        Status status = checkRun();
-        if (status != Status.NORMAL) {
+        try {
+            R res1 = test.newResult();
+            R res2 = test.newResult();
+            R res3 = test.newResult();
+            S state = test.newState();
+            test.actor1(state, res1);
+            test.actor2(state, res2);
+            test.actor3(state, res3);
+        } catch (NoClassDefFoundError e) {
             testLog.println("Test sanity check failed, skipping");
             testLog.println();
-            dumpFailure(test, status);
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (NoSuchFieldError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (NoSuchMethodError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (Throwable e) {
+            testLog.println("Check test failed");
+            testLog.println();
+            dumpFailure(test, Status.CHECK_TEST_ERROR);
             return;
         }
 
@@ -96,28 +118,6 @@
         return 3;
     }
 
-    private Status checkRun() {
-        try {
-            R res1 = test.newResult();
-            R res2 = test.newResult();
-            R res3 = test.newResult();
-            S state = test.newState();
-            test.actor1(state, res1);
-            test.actor2(state, res2);
-            test.actor3(state, res3);
-            return Status.NORMAL;
-        } catch (NoClassDefFoundError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchFieldError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchMethodError e) {
-            return Status.API_MISMATCH;
-        } catch (Throwable e) {
-            e.printStackTrace();
-            return Status.CHECK_TEST_ERROR;
-        }
-    }
-
     private Counter<R> run(int time) throws InterruptedException, ExecutionException {
 
         @SuppressWarnings("unchecked")
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor4_Runner.java	Thu Oct 03 15:00:30 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Actor4_Runner.java	Thu Oct 03 15:09:47 2013 +0400
@@ -66,11 +66,35 @@
     public void run() throws ExecutionException, InterruptedException {
         testLog.println("Running " + test.getClass().getName());
 
-        Status status = checkRun();
-        if (status != Status.NORMAL) {
+        try {
+            R res1 = test.newResult();
+            R res2 = test.newResult();
+            R res3 = test.newResult();
+            R res4 = test.newResult();
+            S state = test.newState();
+            test.actor1(state, res1);
+            test.actor2(state, res2);
+            test.actor3(state, res3);
+            test.actor4(state, res4);
+        } catch (NoClassDefFoundError e) {
             testLog.println("Test sanity check failed, skipping");
             testLog.println();
-            dumpFailure(test, status);
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (NoSuchFieldError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (NoSuchMethodError e) {
+            testLog.println("Test sanity check failed, skipping");
+            testLog.println();
+            dumpFailure(test, Status.API_MISMATCH);
+            return;
+        } catch (Throwable e) {
+            testLog.println("Check test failed");
+            testLog.println();
+            dumpFailure(test, Status.CHECK_TEST_ERROR);
             return;
         }
 
@@ -96,30 +120,6 @@
         return 4;
     }
 
-    private Status checkRun() {
-        try {
-            R res1 = test.newResult();
-            R res2 = test.newResult();
-            R res3 = test.newResult();
-            R res4 = test.newResult();
-            S state = test.newState();
-            test.actor1(state, res1);
-            test.actor2(state, res2);
-            test.actor3(state, res3);
-            test.actor4(state, res4);
-            return Status.NORMAL;
-        } catch (NoClassDefFoundError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchFieldError e) {
-            return Status.API_MISMATCH;
-        } catch (NoSuchMethodError e) {
-            return Status.API_MISMATCH;
-        } catch (Throwable e) {
-            e.printStackTrace();
-            return Status.CHECK_TEST_ERROR;
-        }
-    }
-
     private Counter<R> run(int time) throws InterruptedException, ExecutionException {
 
         @SuppressWarnings("unchecked")
--- a/harness/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java	Thu Oct 03 15:00:30 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java	Thu Oct 03 15:09:47 2013 +0400
@@ -35,6 +35,7 @@
 import javax.xml.bind.JAXBException;
 import java.io.FileNotFoundException;
 import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.Collection;
 import java.util.Random;
 import java.util.concurrent.ExecutionException;
@@ -110,6 +111,16 @@
         collector.add(result);
     }
 
+    protected void dumpFailure(ConcurrencyTest test, Status status, Throwable aux) {
+        TestResult result = new TestResult(test.getClass().getName(), status);
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        aux.printStackTrace(pw);
+        pw.close();
+        result.addAuxData(sw.toString());
+        collector.add(result);
+    }
+
     protected <R> void dump(ConcurrencyTest test, Counter<R> results) {
         TestResult result = new TestResult(test.getClass().getName(), Status.NORMAL);