Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[MBI] Make a real copy of 'patterns' into 'replace'.
[simgrid.git] / teshsuite / smpi / MBI / CollTopoGenerator.py
index 4bafe00..7a137bd 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,50 +76,51 @@ 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")
+    patterns['change_dims'] = '/* No error injected here */'
 
     # Generate the correct code
-    replace = patterns
+    replace = patterns.copy()
     replace['shortdesc'] = 'Function @{c}@ with correct arguments'
     replace['longdesc'] = f'All ranks in comm call {c} with correct arguments'
     replace['outcome'] = 'OK'
     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
+    replace = patterns.copy()
     replace['shortdesc'] = 'The code tries to get cartesian information of MPI_COMM_WORLD.'
     replace['longdesc'] = 'The code creates a cartesian communicator, and tries to get cartesian information of MPI_COMM_WORLD.'
     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
+    replace = patterns.copy()
     replace['shortdesc'] = 'Function @{c}@ called with comm=MPI_COMM_NULL'
     replace['longdesc'] = 'Function @{c}@ called with comm=MPI_COMM_NULL'
     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
+    replace = patterns.copy()
     replace['shortdesc'] = 'Creates a cartesian communicator with a negative entry in the dims attribute'
     replace['longdesc'] = 'Creates a cartesian communicator with a negative entry in the dims attribute, which is a usage error'
     replace['outcome'] = 'ERROR: InvalidOtherArg'
     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, 'InvalidParam_Dim_MPI_Cart_create_nok.c', replace)