changeset 255:99385f86b4f6

Runners: incorrect fork counts is recorded.
author shade
date Fri, 13 May 2016 22:26:42 +0300
parents f1bedd45376f
children 21cd08a886cd
files jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java
diffstat 1 files changed, 33 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java	Fri May 13 20:53:28 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/grading/ConsoleReportPrinter.java	Fri May 13 22:26:42 2016 +0300
@@ -51,13 +51,13 @@
     private final PrintWriter output;
     private final long expectedTests;
     private final long expectedIterations;
-    private final long expectedConfigs;
+    private final long expectedForks;
 
     private long observedIterations;
     private long observedCount;
 
     private final Set<String> observedTests = Collections.newSetFromMap(new HashMap<>());
-    private final Set<TestConfig> observedConfigs = Collections.newSetFromMap(new HashMap<>());
+    private final Set<ConfigFork> observedForks = Collections.newSetFromMap(new HashMap<>());
 
     private long firstTest;
     private int progressLen;
@@ -67,12 +67,12 @@
     private long softErrors;
     private long hardErrors;
 
-    public ConsoleReportPrinter(Options opts, PrintWriter pw, int expectedTests, int expectedConfigs) throws FileNotFoundException {
+    public ConsoleReportPrinter(Options opts, PrintWriter pw, int expectedTests, int expectedForks) throws FileNotFoundException {
         this.opts = opts;
         this.output = pw;
         this.expectedTests = expectedTests;
-        this.expectedConfigs = expectedConfigs;
-        this.expectedIterations = expectedConfigs * opts.getIterations() * (opts.getForks() > 0 ? opts.getForks() : 1);
+        this.expectedForks = expectedForks;
+        this.expectedIterations = expectedForks * opts.getIterations();
         verbose = opts.isVerbose();
         progressLen = 1;
     }
@@ -84,7 +84,7 @@
         }
 
         observedTests.add(r.getName());
-        observedConfigs.add(r.getConfig());
+        observedForks.add(new ConfigFork(r.getConfig()));
         observedIterations++;
         observedCount += r.getTotalCount();
 
@@ -238,7 +238,7 @@
                 computeETA(),
                 computeSpeed(),
                 observedTests.size(), expectedTests,
-                observedConfigs.size(), expectedConfigs,
+                observedForks.size(), expectedForks,
                 observedIterations, expectedIterations, passed, failed, softErrors, hardErrors
         );
         progressLen = line.length();
@@ -281,4 +281,30 @@
         }
     }
 
+    static class ConfigFork {
+        private TestConfig config;
+
+        public ConfigFork(TestConfig config) {
+            this.config = config;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            ConfigFork that = (ConfigFork) o;
+
+            if (config.forkId != that.config.forkId) return false;
+            return config.equals(that.config);
+        }
+
+        @Override
+        public int hashCode() {
+            int result = config.hashCode();
+            result = 31 * result + config.forkId;
+            return result;
+        }
+    }
+
 }