X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bfd69c3ceb98d85f6aff577197153233f4d085d6..c4c82977e0a105cdf7b04010ddd21bbf15dced4d:/teshsuite/smpi/MBI/RMAArgGenerator.py diff --git a/teshsuite/smpi/MBI/RMAArgGenerator.py b/teshsuite/smpi/MBI/RMAArgGenerator.py index deefa081ad..04cef56feb 100755 --- a/teshsuite/smpi/MBI/RMAArgGenerator.py +++ b/teshsuite/smpi/MBI/RMAArgGenerator.py @@ -1,26 +1,26 @@ #! /usr/bin/python3 import os import sys -from generator_utils import * +import generator_utils as gen template = """// @{generatedby}@ /* ///////////////////////// The MPI Bugs Initiative //////////////////////// - Origin: @{origin}@ + Origin: @{origin}@ Description: @{shortdesc}@ @{longdesc}@ BEGIN_MPI_FEATURES - P2P!basic: Lacking - P2P!nonblocking: Lacking - P2P!persistent: Lacking - COLL!basic: Lacking - COLL!nonblocking: Lacking - COLL!persistent: Lacking - COLL!tools: Lacking - RMA: @{rmafeature}@ + P2P!basic: Lacking + P2P!nonblocking: Lacking + P2P!persistent: Lacking + COLL!basic: Lacking + COLL!nonblocking: Lacking + COLL!persistent: Lacking + COLL!tools: Lacking + RMA: @{rmafeature}@ END_MPI_FEATURES BEGIN_MBI_TESTS @@ -44,30 +44,30 @@ 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 win; MPI_Win_create(&winbuf, N * sizeof(int), 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win); - MPI_Datatype type = MPI_INT; - int target = (rank + 1) % numProcs; + MPI_Datatype type = MPI_INT; + int target = (rank + 1) % numProcs; - if(rank == 0){ - @{epoch}@ - @{change_arg}@ - @{init}@ - @{operation}@ /* MBIERROR2 */ + if(rank == 0){ + @{epoch}@ + @{change_arg}@ + @{init}@ + @{operation}@ /* MBIERROR2 */ - @{finEpoch}@ - } else { - @{epoch}@ + @{finEpoch}@ + } else { + @{epoch}@ - @{finEpoch}@ - } + @{finEpoch}@ + } MPI_Win_free(&win); - free(winbuf); + free(winbuf); MPI_Finalize(); return 0; @@ -75,35 +75,35 @@ 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" - patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' + patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' 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['p'] = p + patterns['e'] = e + 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['shortdesc'] = 'Invalid argument in one-sided operation.' + # Generate a code with a null type + 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['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['shortdesc'] = 'Invalid argument in one-sided operation.' + # Generate a code with an invalid type + 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['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)