changeset 6:13ead0bffb25

Unique names for seqcst/volatile tests.
author shade
date Mon, 08 Jul 2013 19:20:21 +0400
parents b064dcacc1f0
children 094e00503f13
files generator/src/main/java/org/openjdk/jcstress/tracer/TraceGen.java
diffstat 1 files changed, 29 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/generator/src/main/java/org/openjdk/jcstress/tracer/TraceGen.java	Mon Jul 08 18:23:29 2013 +0400
+++ b/generator/src/main/java/org/openjdk/jcstress/tracer/TraceGen.java	Mon Jul 08 19:20:21 2013 +0400
@@ -124,15 +124,13 @@
         resourceWriter.close();
     }
 
-    private int klassId = 0;
-
     private void emit(MultiTrace mt, List<String> results) {
 
         final String pkg = "org.openjdk.jcstress.tests.seqconsistency.volatiles";
 
         String pathname = Utils.ensureDir(srcDir + "/" + pkg.replaceAll("\\.", "/"));
 
-        String klass = "Auto" + klassId++;
+        String klass = mt.id() + "Test";
 
         resourceWriter.println("    <test name=\"" + pkg + "." + klass + "\">\n" +
                 "        <contributed-by>Aleksey Shipilev (aleksey.shipilev@oracle.com)</contributed-by>\n" +
@@ -352,6 +350,25 @@
             }
             return count;
         }
+
+        public String id() {
+            StringBuilder sb = new StringBuilder();
+            for (Op op : ops) {
+                switch (op.getType()) {
+                    case LOAD:
+                        sb.append("L");
+                        break;
+                    case STORE:
+                        sb.append("S");
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+                sb.append(op.getVarId() + 1);
+                sb.append("_");
+            }
+            return sb.toString();
+        }
     }
 
     public class MultiTrace {
@@ -406,6 +423,15 @@
         public String toString() {
             return "{" + traces + '}';
         }
+
+        public String id() {
+            StringBuilder sb = new StringBuilder();
+            for (Trace trace : traces) {
+                sb.append(trace.id());
+                sb.append("_");
+            }
+            return sb.toString();
+        }
     }
 
 }