Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[MBI] Make a real copy of 'patterns' into 'replace'.
[simgrid.git] / teshsuite / smpi / MBI / CollLocalConcurrencyGenerator.py
index c4dbfe3..2ff3357 100755 (executable)
@@ -1,7 +1,7 @@
 #! /usr/bin/python3
 import os
 import sys
-from generator_utils import *
+import generator_utils as gen
 
 template = """// @{generatedby}@
 /* ///////////////////////// The MPI Bugs Initiative ////////////////////////
@@ -11,17 +11,17 @@ template = """// @{generatedby}@
   Description: @{shortdesc}@
     @{longdesc}@
 
-        Version of MPI: Conforms to MPI 3, requires MPI 3 implementation
+   Version of MPI: Conforms to MPI 3, requires MPI 3 implementation
 
 BEGIN_MPI_FEATURES
-       P2P!basic: Lacking 
-       P2P!nonblocking: Lacking
-       P2P!persistent: Lacking
-       COLL!basic: Lacking
-       COLL!nonblocking: @{icollfeature}@
-       COLL!persistent: @{pcollfeature}@
-       COLL!tools: Lacking
-       RMA: Lacking
+  P2P!basic: Lacking
+  P2P!nonblocking: Lacking
+  P2P!persistent: Lacking
+  COLL!basic: Lacking
+  COLL!nonblocking: @{icollfeature}@
+  COLL!persistent: @{pcollfeature}@
+  COLL!tools: Lacking
+  RMA: Lacking
 END_MPI_FEATURES
 
 BEGIN_MBI_TESTS
@@ -40,7 +40,7 @@ END_MBI_TESTS
 int main(int argc, char **argv) {
   int nprocs = -1;
   int rank = -1;
-       int root = 0;
+  int root = 0;
 
   MPI_Init(&argc, &argv);
   MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
@@ -52,15 +52,15 @@ int main(int argc, char **argv) {
 
   int dbs = sizeof(int)*nprocs; /* Size of the dynamic buffers for alltoall and friends */
   MPI_Op op = MPI_SUM;
-       MPI_Comm newcom = MPI_COMM_WORLD;
-       MPI_Datatype type = MPI_INT;
+  MPI_Comm newcom = MPI_COMM_WORLD;
+  MPI_Datatype type = MPI_INT;
 
   @{init}@
   @{start}@
-       @{operation}@ 
-       @{write}@ /* MBIERROR */ 
-       @{fini}@
-       @{free}@
+   @{operation}@
+  @{write}@ /* MBIERROR */
+  @{fini}@
+  @{free}@
 
   MPI_Finalize();
   printf("Rank %d finished normally\\n", rank);
@@ -68,23 +68,23 @@ int main(int argc, char **argv) {
 }
 """
 
-for c in icoll + pcoll:
+for c in gen.icoll + gen.pcoll:
     patterns = {}
-    patterns = {'c': c} 
+    patterns = {'c': c}
     patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
-    patterns['icollfeature'] = 'Yes' if c in icoll else 'Lacking'
-    patterns['pcollfeature'] = 'Yes' if c in pcoll else 'Lacking'
+    patterns['icollfeature'] = 'Yes' if c in gen.icoll else 'Lacking'
+    patterns['pcollfeature'] = 'Yes' if c in gen.pcoll else 'Lacking'
     patterns['c'] = c
-    patterns['init'] = init[c]("1")
-    patterns['start'] = start[c]("1")
-    patterns['fini'] = fini[c]("1")
-    patterns['operation'] = operation[c]("1")
-    patterns['write'] = write[c]("1")
-    patterns['free'] = free[c]("1")
-
-    replace = patterns 
+    patterns['init'] = gen.init[c]("1")
+    patterns['start'] = gen.start[c]("1")
+    patterns['fini'] = gen.fini[c]("1")
+    patterns['operation'] = gen.operation[c]("1")
+    patterns['write'] = gen.write[c]("1")
+    patterns['free'] = gen.free[c]("1")
+
+    replace = patterns.copy()
     replace['shortdesc'] = 'Local concurrency with a collective'
     replace['longdesc'] = f'The buffer in {c} is modified before the call has been completed.'
-    replace['outcome'] = 'ERROR: LocalConcurrency' 
+    replace['outcome'] = 'ERROR: LocalConcurrency'
     replace['errormsg'] = 'Local Concurrency with a collective. The buffer in @{c}@ is modified at @{filename}@:@{line:MBIERROR}@ whereas there is no guarantee the call has been completed.'
-    make_file(template, f'LocalConcurrency_{c}_nok.c', replace)
+    gen.make_file(template, f'LocalConcurrency_{c}_nok.c', replace)