X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4e03f78d2ffac18f4e8ffa7016a3cec61bbad03a..3c7c64745aa5e60415bb85af482c7b0d0fca2b2b:/teshsuite/smpi/MBI/RMAInvalidArgGenerator.py diff --git a/teshsuite/smpi/MBI/RMAInvalidArgGenerator.py b/teshsuite/smpi/MBI/RMAInvalidArgGenerator.py index 8160671e55..2ba7cf9add 100755 --- a/teshsuite/smpi/MBI/RMAInvalidArgGenerator.py +++ b/teshsuite/smpi/MBI/RMAInvalidArgGenerator.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 //////////////////////// @@ -40,7 +40,7 @@ END_MBI_TESTS int main(int argc, char **argv) { int nprocs = -1 , rank = -1; MPI_Win win; - int *winbuf = @{malloc}@ // Window buffer + int *winbuf = (int *)@{malloc}@ // Window buffer MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); @@ -73,8 +73,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" @@ -82,52 +82,53 @@ 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'] = "" patterns['malloc'] = "malloc(N * sizeof(int));" # 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_DatatypeNull_{e}_{p}_nok.c', replace) + gen.make_file(template, f'InvalidParam_DatatypeNull_{e}_{p}_nok.c', replace) # Generate a code with a null buffer (move to RMAWinBufferGenerator) - # replace = patterns + # replace = patterns.copy() # replace['origin'] = 'MPI-Corrbench' # replace['shortdesc'] = 'nullptr is invalid in one-sided operation.' # replace['longdesc'] = 'A one-sided operation has an invalid buffer.' # replace['outcome'] = 'ERROR: InvalidBuffer' - # replace['init'] = 'int * localbuf1 = malloc(sizeof(int));' + # replace['init'] = 'int * localbuf1 = (int *)malloc(sizeof(int));' # replace['change_arg'] = 'localbuf1 = NULL;' - # replace['operation'] = operation[p]("1").replace('&localbuf1', 'localbuf1') + # replace['operation'] = gen.operation[p]("1").replace('&localbuf1', 'localbuf1') # replace['errormsg'] = '@{p}@ at @{filename}@:@{line:MBIERROR}@ has an invalid buffer' - # make_file(template, f'InvalidParam_BufferNull_{e}_{p}_nok.c', replace) + # gen.make_file(template, f'InvalidParam_BufferNull_{e}_{p}_nok.c', replace) # Generate a code with an invalid type - replace = patterns + replace = patterns.copy() replace['origin'] = 'MBI' 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_Datatype_{e}_{p}_nok.c', replace) + gen.make_file(template, f'InvalidParam_Datatype_{e}_{p}_nok.c', replace) # Generate a code with invalid buffer - replace = patterns + replace = patterns.copy() patterns['origin'] = "MPI-Corrbench" replace['shortdesc'] = 'Invalid invalid buffer (buffer must be allocated)' replace['longdesc'] = 'Use of an invalid buffer in MPI_Win_create.' replace['outcome'] = 'ERROR: InvalidBuffer' - patterns['malloc'] = "NULL; /* MBIERROR2 */" - patterns['operation'] = "" + replace['malloc'] = "NULL; /* MBIERROR2 */" + replace['init'] = "" + replace['operation'] = "" replace['change_arg'] = "" replace['errormsg'] = 'Invalid buffer in Win_create at @{filename}@:@{line:MBIERROR2}@' - make_file(template, f'InvalidParam_InvalidBufferWinCreate_{e}_{p}_nok.c', replace) + gen.make_file(template, f'InvalidParam_InvalidBufferWinCreate_{e}_{p}_nok.c', replace)