Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[MBI] Import generator_utils as gen.
[simgrid.git] / teshsuite / smpi / MBI / CollTopoGenerator.py
index 4bafe00..ab54e52 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 ////////////////////////
@@ -76,15 +76,15 @@ int main(int argc, char **argv) {
 }
 """
 
-for c in tcoll4topo:
+for c in gen.tcoll4topo:
     patterns = {}
     patterns = {'c': c}
     patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
-    patterns['toolfeature'] = 'Yes' if c in tcoll4topo else 'Lacking'
+    patterns['toolfeature'] = 'Yes' if c in gen.tcoll4topo else 'Lacking'
     patterns['c'] = c
-    patterns['init'] = init[c]("1")
-    patterns['fini'] = fini[c]("1")
-    patterns['operation'] = operation[c]("1")
+    patterns['init'] = gen.init[c]("1")
+    patterns['fini'] = gen.fini[c]("1")
+    patterns['operation'] = gen.operation[c]("1")
 
     # Generate the correct code
     replace = patterns
@@ -94,7 +94,7 @@ for c in tcoll4topo:
     replace['errormsg'] = ''
     replace['change_com'] = '/* No error injected here */'
     replace['change_dims'] = '/* No error injected here */'
-    make_file(template, f'InvalidParam_{c}_ok.c', replace)
+    gen.make_file(template, f'InvalidParam_{c}_ok.c', replace)
 
     # Generate the incorrect code
     replace = patterns
@@ -103,7 +103,7 @@ for c in tcoll4topo:
     replace['outcome'] = 'ERROR: InvalidCommunicator'
     replace['errormsg'] = 'Invalid Communicator in a collective. @{c}@ at @{filename}@:@{line:MBIERROR2}@ tries to get cartesian information of MPI_COMM_WORLD.'
     replace['change_com'] = 'newcom = MPI_COMM_WORLD; /* MBIERROR1 */'
-    make_file(template, f'InvalidParam_Com_{c}_nok.c', replace)
+    gen.make_file(template, f'InvalidParam_Com_{c}_nok.c', replace)
 
     # Generate the code with newcom=MPI_COMM_NULL
     replace = patterns
@@ -112,7 +112,7 @@ for c in tcoll4topo:
     replace['outcome'] = 'ERROR: InvalidCommunicator'
     replace['errormsg'] = 'Invalid communicator. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has MPI_COMM_NULL as a communicator.'
     replace['change_com'] = 'newcom = MPI_COMM_NULL; /* MBIERROR1 */'
-    make_file(template, f'InvalidParam_ComNull_{c}_nok.c', replace)
+    gen.make_file(template, f'InvalidParam_ComNull_{c}_nok.c', replace)
 
     # Generate the code with invalid dimension
     replace = patterns
@@ -122,4 +122,4 @@ for c in tcoll4topo:
     replace['errormsg'] = 'Invalid Argument. MPI_Cart_create has invalid dimensions.'
     replace['change_com'] = ""
     replace['change_dims'] = 'dims[0] = -2; dims[1] = -1; /* MBIERROR1 */'
-    make_file(template, f'InvalidParam_Dim_MPI_Cart_create_nok.c', replace)
+    gen.make_file(template, f'InvalidParam_Dim_MPI_Cart_create_nok.c', replace)