Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
teshsuite: smpi: MBI: Merge change form MBI.
[simgrid.git] / teshsuite / smpi / MBI / RMAWinBufferGenerator.py
index db49af8..8ad4a4f 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 ////////////////////////
@@ -39,7 +39,7 @@ END_MBI_TESTS
 
 int * buffer;
 
-void get_win(MPI_Win *win) {
+static void get_win(MPI_Win *win) {
   @{bufferalloc}@
 
   MPI_Win_create(@{buffer}@, N * sizeof(int), 1, MPI_INFO_NULL, MPI_COMM_WORLD, win);
@@ -83,14 +83,14 @@ int main(int argc, char *argv[]) {
 """
 
 
-for b in ['stack', 'missing', 'null',  'malloc', 'bufferSize']:
+for b in ['missing', 'null',  'malloc', 'bufferSize']:
     patterns = {}
     patterns = {'b': b}
     patterns['origin'] = "MPI-CorrBench"
     patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.'
     patterns['rmafeature'] = 'Yes'
 
-    replace = patterns
+    replace = patterns.copy()
     replace['shortdesc'] = 'Invalid buffer in window creation.'
     replace['longdesc'] = 'Invalid buffer in window creation.'
     replace['outcome'] = 'ERROR: InvalidBuffer'
@@ -100,26 +100,22 @@ for b in ['stack', 'missing', 'null',  'malloc', 'bufferSize']:
     ok = 'nok'
     replace['buffer'] = 'buffer'
 
-    if b == 'stack':
-        replace['bufferalloc'] = 'int buffer[N]; /* MBIERROR1 */'
-        replace['buffer'] = '&buffer'
-        replace['longdesc'] = 'Use a stack oriented buffer in window creation, buffer on temporary stack memory.'
-    elif b == 'missing':
+    if b == 'missing':
         replace['bufferalloc'] = '/* MBIERROR1 */'
         replace['longdesc'] = 'Uninitialized buffer in window creation.'
     elif b == 'null':
         replace['bufferalloc'] = 'buffer = NULL; /* MBIERROR1 */'
         replace['longdesc'] = 'Use NULL buffer in window creation.'
     elif b == 'bufferSize':
-        replace['bufferalloc'] = 'buffer = malloc((N/2) * sizeof(int)); /* MBIERROR1 */'
+        replace['bufferalloc'] = 'buffer = (int *)malloc((N/2) * sizeof(int)); /* MBIERROR1 */'
         replace['bufferfree'] = 'free(buffer);'
         replace['longdesc'] = 'Unmatched size of buffer in window creation.'
     else:
-        replace['bufferalloc'] = 'buffer = malloc(N * sizeof(int));'
+        replace['bufferalloc'] = 'buffer = (int *)malloc(N * sizeof(int));'
         replace['bufferfree'] = 'free(buffer);'
         replace['longdesc'] = 'Correct initialized buffer in window creation.'
         replace['outcome'] = 'OK'
         replace['errormsg'] = ''
         ok = 'ok'
 
-    make_file(template, f'InvalidParam_WinBuffer_{b}_{ok}.c', replace)
+    gen.make_file(template, f'InvalidParam_WinBuffer_{b}_{ok}.c', replace)