Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'dev-cpuimpl-used' into 'master'
[simgrid.git] / teshsuite / smpi / MBI / RMAWinBufferGenerator.py
index 5ed8b28..bae8efa 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);
@@ -65,7 +65,8 @@ int main(int argc, char *argv[]) {
   MPI_Win_fence(0, win);
 
   if (rank == 0) {
-    int localbuf[N] = {12345};
+    int localbuf[N] = {0};
+    localbuf[0] = 12345;
     MPI_Put(&localbuf, N, MPI_INT, 1, 0, N, MPI_INT, win);
   }
 
@@ -83,14 +84,14 @@ int main(int argc, char *argv[]) {
 """
 
 
-for b in ['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'
@@ -118,4 +119,4 @@ for b in ['missing', 'null',  'malloc', 'bufferSize']:
         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)