Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[MBI] Import generator_utils as gen.
[simgrid.git] / teshsuite / smpi / MBI / P2PMatchingGenerator.py
index 2602fdc..b7e7f66 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 ////////////////////////
@@ -72,21 +72,21 @@ int main(int argc, char **argv) {
 """
 
 
-for p in send + ssend + bsend + recv + irecv + isend:
+for p in gen.send + gen.ssend + gen.bsend + gen.recv + gen.irecv + gen.isend:
     patterns = {}
     patterns = {'p': p}
     patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
-    patterns['p2pfeature'] = 'Yes' if p in send + bsend + ssend + recv else 'Lacking'
-    patterns['ip2pfeature'] = 'Yes' if p in isend + irecv else 'Lacking'
+    patterns['p2pfeature'] = 'Yes' if p in gen.send + gen.bsend + gen.ssend + gen.recv else 'Lacking'
+    patterns['ip2pfeature'] = 'Yes' if p in gen.isend + gen.irecv else 'Lacking'
     patterns['persfeature'] = 'Lacking'
     #patterns['persfeature'] = 'Yes' if p in psend + precv else 'Lacking'
     patterns['p'] = p
-    patterns['init1'] = init[p]("1")
-    patterns['init2'] = '' #init[p2]("2")
-    patterns['fini1'] = fini[p]("1")
-    patterns['fini2'] = '' #fini[p2]("2")
-    patterns['operation1'] = operation[p]("1")
-    patterns['operation2'] = '' #operation[p2]("2")
+    patterns['init1'] = gen.init[p]("1")
+    patterns['init2'] = '' #gen.init[p2]("2")
+    patterns['fini1'] = gen.fini[p]("1")
+    patterns['fini2'] = '' #gen.fini[p2]("2")
+    patterns['operation1'] = gen.operation[p]("1")
+    patterns['operation2'] = '' #gen.operation[p2]("2")
     patterns['change_cond'] = 'rank == 1'
 
     # Generate the incorrect matching with one call
@@ -95,7 +95,7 @@ for p in send + ssend + bsend + recv + irecv + isend:
     replace['longdesc'] = 'Process 0 calls @{p}@ and is not matched'
     replace['outcome'] = 'ERROR: CallMatching'
     replace['errormsg'] = 'P2P mistmatch. @{p}@ at @{filename}@:@{line:MBIERROR1}@ is not matched.'
-    make_file(template, f'CallOrdering_{p}_nok.c', replace)
+    gen.make_file(template, f'CallOrdering_{p}_nok.c', replace)
 
     # Generate the incorrect matching with two calls
     replace = patterns
@@ -103,25 +103,25 @@ for p in send + ssend + bsend + recv + irecv + isend:
     replace['longdesc'] = 'Processes 0 and 1 both call @{p}@ which are not matched'
     replace['outcome'] = 'ERROR: CallMatching'
     replace['errormsg'] = 'P2P mismatch. @{p}@ at @{filename}@:@{line:MBIERROR1}@ and @{p}@ at @{filename}@:@{line:MBIERROR2}@ are not matched.'
-    replace['operation2'] = operation[p]("1")
-    replace['fini2'] = fini[p]("1")
-    make_file(template, f'CallOrdering_{p}_{p}_nok.c', replace)
+    replace['operation2'] = gen.operation[p]("1")
+    replace['fini2'] = gen.fini[p]("1")
+    gen.make_file(template, f'CallOrdering_{p}_{p}_nok.c', replace)
 
-for s in send + isend + ssend + bsend:
-    for r in recv + irecv:
+for s in gen.send + gen.isend + gen.ssend + gen.bsend:
+    for r in gen.recv + gen.irecv:
         patterns = {}
         patterns = {'s': s, 'r': r}
         patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
-        patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking'
-        patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking'
+        patterns['p2pfeature'] = 'Yes' if s in gen.send or r in gen.recv else 'Lacking'
+        patterns['ip2pfeature'] = 'Yes' if s in gen.isend or r in gen.irecv else 'Lacking'
         patterns['s'] = s
         patterns['r'] = r
-        patterns['init1'] = init[s]("1")
-        patterns['init2'] = init[r]("2")
-        patterns['fini1'] = fini[s]("1")
-        patterns['fini2'] = fini[r]("2")
-        patterns['operation1'] = operation[s]("1")
-        patterns['operation2'] = operation[r]("2")
+        patterns['init1'] = gen.init[s]("1")
+        patterns['init2'] = gen.init[r]("2")
+        patterns['fini1'] = gen.fini[s]("1")
+        patterns['fini2'] = gen.fini[r]("2")
+        patterns['operation1'] = gen.operation[s]("1")
+        patterns['operation2'] = gen.operation[r]("2")
         patterns['change_cond'] = '(rank == 1) && (its_raining)'
 
         # Generate the incorrect matching because of the conditional
@@ -130,6 +130,6 @@ for s in send + isend + ssend + bsend:
         replace['longdesc'] = 'Point to point @{r}@ is never executed. Process 1 calls MPI_Finalize and causes a deadlock.'
         replace['outcome'] = 'ERROR: CallMatching'
         replace['errormsg'] = 'P2P mistmatch. @{r}@ at @{filename}@:@{line:MBIERROR2}@ is never called because of the conditional (@{change_cond}@).'
-        replace['operation1'] = operation[s]("1")
-        replace['operation2'] = operation[r]("2")
-        make_file(template, f'CallOrdering_{r}_{s}_nok.c', replace)
+        replace['operation1'] = gen.operation[s]("1")
+        replace['operation2'] = gen.operation[r]("2")
+        gen.make_file(template, f'CallOrdering_{r}_{s}_nok.c', replace)