Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MBI: display the expected diagnostic on error
[simgrid.git] / teshsuite / smpi / MBI / RMAArgGenerator.py
index e8a8ca3..04cef56 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 ////////////////////////
@@ -44,7 +44,7 @@ int main(int argc, char **argv) {
   MPI_Comm_size(MPI_COMM_WORLD, &numProcs);
   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 
-  int *winbuf = malloc(N * sizeof(int));
+  int *winbuf = (int *)malloc(N * sizeof(int));
 
   MPI_Win win;
   MPI_Win_create(&winbuf, N * sizeof(int), 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win);
@@ -75,8 +75,8 @@ int main(int argc, char **argv) {
 """
 
 
-for e in epoch:
-    for p in rma:
+for e in gen.epoch:
+    for p in gen.rma:
         patterns = {}
         patterns = {'e': e, 'p': p}
         patterns['origin'] = "MBI"
@@ -84,27 +84,26 @@ for e in epoch:
         patterns['rmafeature'] = 'Yes'
         patterns['p'] = p
         patterns['e'] = e
-        patterns['epoch'] = epoch[e]("1")
-        patterns['finEpoch'] = finEpoch[e]("1")
-        patterns['init'] = init[p]("1")
-        patterns['operation'] = operation[p]("1")
+        patterns['epoch'] = gen.epoch[e]("1")
+        patterns['finEpoch'] = gen.finEpoch[e]("1")
+        patterns['init'] = gen.init[p]("1")
+        patterns['operation'] = gen.operation[p]("1")
         patterns['change_arg'] = ""
 
         # Generate a code with a null type
-        replace = patterns
+        replace = patterns.copy()
         replace['shortdesc'] = 'Invalid argument in one-sided operation.'
         replace['longdesc'] = 'A one-sided operation has MPI_DATATYPE_NULL as a type.'
         replace['outcome'] = 'ERROR: InvalidDatatype'
         replace['change_arg'] = 'type = MPI_DATATYPE_NULL;'
         replace['errormsg'] = '@{p}@ at @{filename}@:@{line:MBIERROR}@ has MPI_DATATYPE_NULL as a type'
-        make_file(template, f'InvalidParam_BufferNullCond_{e}_{p}_nok.c', replace)
+        gen.make_file(template, f'InvalidParam_BufferNullCond_{e}_{p}_nok.c', replace)
 
         # Generate a code with an invalid type
-        replace = patterns
+        replace = patterns.copy()
         replace['shortdesc'] = 'Invalid argument in one-sided operation.'
         replace['longdesc'] = 'Use of an invalid datatype in one-sided operation.'
         replace['outcome'] = 'ERROR: InvalidDatatype'
         replace['change_arg'] = 'MPI_Type_contiguous (2, MPI_INT, &type); MPI_Type_commit(&type);MPI_Type_free(&type); /* MBIERROR2 */'
         replace['errormsg'] = 'Invalid Datatype in @{p}@ at @{filename}@:@{line:MBIERROR}@'
-        make_file(template, f'InvalidParam_DatatypeCond_{e}_{p}_nok.c', replace)
-
+        gen.make_file(template, f'InvalidParam_DatatypeCond_{e}_{p}_nok.c', replace)