X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4e03f78d2ffac18f4e8ffa7016a3cec61bbad03a..244ffce80a9e2390e24b9788114de037e4ccc0ae:/teshsuite/smpi/MBI/RMAWinBufferGenerator.py diff --git a/teshsuite/smpi/MBI/RMAWinBufferGenerator.py b/teshsuite/smpi/MBI/RMAWinBufferGenerator.py index a737150842..8ad4a4f501 100755 --- a/teshsuite/smpi/MBI/RMAWinBufferGenerator.py +++ b/teshsuite/smpi/MBI/RMAWinBufferGenerator.py @@ -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); @@ -55,10 +55,22 @@ int main(int argc, char *argv[]) { MPI_Comm_rank(MPI_COMM_WORLD, &rank); printf("Hello from rank %d \\n", rank); + if (numProcs < 2) + printf("MBI ERROR: This test needs at least 2 processes to produce a bug!\\n"); + MPI_Win win; get_win(&win); + MPI_Win_fence(0, win); + + if (rank == 0) { + int localbuf[N] = {12345}; + MPI_Put(&localbuf, N, MPI_INT, 1, 0, N, MPI_INT, win); + } + + MPI_Win_fence(0, win); + MPI_Win_free(&win); @{bufferfree}@ @@ -71,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' @@ -88,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)