changeset 912:01fe6ebab29e

runners: fail all forks if at least one fork had failed.
author shade
date Thu, 17 Jul 2014 19:39:30 +0400
parents 5070b7fd46e7
children 3a2a1b06219b
files jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java	Thu Jul 17 16:10:18 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java	Thu Jul 17 19:39:30 2014 +0400
@@ -587,6 +587,11 @@
 
         } catch (IOException e) {
             throw new IllegalStateException(e);
+        } catch (BenchmarkException e) {
+            if (options.shouldFailOnError().orElse(Defaults.FAIL_ON_ERROR)) {
+                out.println("Benchmark had encountered error, and fail on error was requested");
+                throw e;
+            }
         } finally {
             if (server != null) {
                 server.terminate();
@@ -644,11 +649,8 @@
                 out.println("</stderr>");
 
                 out.println("");
-                if (options.shouldFailOnError().orElse(Defaults.FAIL_ON_ERROR)) {
-                    throw new BenchmarkException(
-                        new IllegalStateException("Forked VM failed with exit code " + ecode)
-                    );
-                }
+
+                throw new BenchmarkException(new IllegalStateException("Forked VM failed with exit code " + ecode));
             }
 
         } catch (IOException ex) {