From cc309f0bc25802386a5f6d8bf2cfc487139ca1e3 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 29 Mar 2022 15:24:01 +0200 Subject: [PATCH] [MBI] Import generator_utils as gen. --- teshsuite/smpi/MBI/CollArgGenerator.py | 80 +++++++++---------- teshsuite/smpi/MBI/CollComGenerator.py | 24 +++--- .../smpi/MBI/CollLocalConcurrencyGenerator.py | 22 ++--- teshsuite/smpi/MBI/CollMatchingGenerator.py | 62 +++++++------- .../smpi/MBI/CollP2PMatchingGenerator.py | 42 +++++----- .../smpi/MBI/CollP2PMessageRaceGenerator.py | 48 +++++------ teshsuite/smpi/MBI/CollTopoGenerator.py | 20 ++--- .../smpi/MBI/MissingWaitandStartGenerator.py | 72 ++++++++--------- teshsuite/smpi/MBI/P2PArgGenerator.py | 74 ++++++++--------- teshsuite/smpi/MBI/P2PComGenerator.py | 42 +++++----- teshsuite/smpi/MBI/P2PInvalidComGenerator.py | 36 ++++----- .../smpi/MBI/P2PLocalConcurrencyGenerator.py | 48 +++++------ .../smpi/MBI/P2PMatchingANYSRCGenerator.py | 24 +++--- teshsuite/smpi/MBI/P2PMatchingGenerator.py | 54 ++++++------- teshsuite/smpi/MBI/P2PProbeGenerator.py | 68 ++++++++-------- teshsuite/smpi/MBI/RMAArgGenerator.py | 18 ++--- teshsuite/smpi/MBI/RMAInvalidArgGenerator.py | 24 +++--- .../MBI/RMALocalLocalConcurrencyGenerator.py | 60 +++++++------- .../MBI/RMAP2PGlobalConcurrencyGenerator.py | 30 +++---- .../MBI/RMARemoteLocalConcurrencyGenerator.py | 44 +++++----- .../RMARemoteRemoteConcurrencyGenerator.py | 16 ++-- .../smpi/MBI/RMAReqLifecycleGenerator.py | 46 +++++------ teshsuite/smpi/MBI/RMAWinBufferGenerator.py | 4 +- teshsuite/smpi/MBI/ResleakGenerator.py | 24 +++--- 24 files changed, 491 insertions(+), 491 deletions(-) diff --git a/teshsuite/smpi/MBI/CollArgGenerator.py b/teshsuite/smpi/MBI/CollArgGenerator.py index af52da347d..7641aaeeb2 100755 --- a/teshsuite/smpi/MBI/CollArgGenerator.py +++ b/teshsuite/smpi/MBI/CollArgGenerator.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 //////////////////////// @@ -75,19 +75,19 @@ int main(int argc, char **argv) { # Generate code with color mismatch in MPI_Comm_split ##################################################### -for c in tcoll4color: +for c in gen.tcoll4color: patterns = {} patterns = {'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' patterns['collfeature'] = 'Lacking' patterns['icollfeature'] = 'Lacking' - patterns['toolfeature'] = 'Yes' if c in tcoll4color else 'Lacking' + patterns['toolfeature'] = 'Yes' if c in gen.tcoll4color else 'Lacking' patterns['c'] = c - patterns['init'] = init[c]("1") - patterns['start'] = start[c]("1") - patterns['operation'] = operation[c]("1") - patterns['fini'] = fini[c]("1") - patterns['free'] = free[c]("1") + patterns['init'] = gen.init[c]("1") + patterns['start'] = gen.start[c]("1") + patterns['operation'] = gen.operation[c]("1") + patterns['fini'] = gen.fini[c]("1") + patterns['free'] = gen.free[c]("1") patterns['change_arg'] = '' # Generate the code with invalid color @@ -97,26 +97,26 @@ for c in tcoll4color: replace['outcome'] = 'ERROR: InvalidOtherArg' replace['errormsg'] = 'Invalid Argument in collective. @{c}@ at line @{line:MBIERROR2}@ has an invalid color' replace['change_arg'] = 'color=-10; /* MBIERROR1*/' - make_file(template, f'InvalidParam_OtherArg_{c}_nok.c', replace) + gen.make_file(template, f'InvalidParam_OtherArg_{c}_nok.c', replace) ################################## # Generate code with root mismatch ################################## -for c in coll4root + icoll4root: +for c in gen.coll4root + gen.icoll4root: patterns = {} patterns = {'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['collfeature'] = 'Yes' if c in coll4root else 'Lacking' - patterns['icollfeature'] = 'Yes' if c in icoll4root else 'Lacking' + patterns['collfeature'] = 'Yes' if c in gen.coll4root else 'Lacking' + patterns['icollfeature'] = 'Yes' if c in gen.icoll4root else 'Lacking' patterns['toolfeature'] = 'Lacking' patterns['c'] = c - patterns['init'] = init[c]("1") - patterns['start'] = start[c]("1") - patterns['fini'] = fini[c]("1") - patterns['free'] = free[c]("1") - patterns['operation'] = operation[c]("1") + patterns['init'] = gen.init[c]("1") + patterns['start'] = gen.start[c]("1") + patterns['fini'] = gen.fini[c]("1") + patterns['free'] = gen.free[c]("1") + patterns['operation'] = gen.operation[c]("1") patterns['change_arg'] = '' # Generate an incorrect root matching (root mismatch) @@ -126,7 +126,7 @@ for c in coll4root + icoll4root: replace['outcome'] = 'ERROR: RootMatching' replace['errormsg'] = 'Collective root mistmatch. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has 0 or 1 as a root.' replace['change_arg'] = 'if (rank % 2)\n root = 1; /* MBIERROR1 */' - make_file(template, f'ParamMatching_Root_{c}_nok.c', replace) + gen.make_file(template, f'ParamMatching_Root_{c}_nok.c', replace) # Generate the call with root=-1 (invalid root) replace = patterns @@ -135,7 +135,7 @@ for c in coll4root + icoll4root: replace['outcome'] = 'ERROR: InvalidRoot' replace['errormsg'] = 'Invalid collective root. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has -1 as a root while communicator MPI_COMM_WORLD requires ranks in range 0 to 1.' replace['change_arg'] = 'root = -1; /* MBIERROR1 */' - make_file(template, f'InvalidParam_RootNeg_{c}_nok.c', replace) + gen.make_file(template, f'InvalidParam_RootNeg_{c}_nok.c', replace) # Generate the call with root=2 (root not in communicator) replace = patterns @@ -144,27 +144,27 @@ for c in coll4root + icoll4root: replace['outcome'] = 'ERROR: InvalidRoot' replace['errormsg'] = 'Invalid collective root. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has 2 as a root while communicator MPI_COMM_WORLD requires ranks in range 0 to 1.' replace['change_arg'] = 'root = nprocs; /* MBIERROR1 */' - make_file(template, f'InvalidParam_RootTooLarge_{c}_nok.c', replace) + gen.make_file(template, f'InvalidParam_RootTooLarge_{c}_nok.c', replace) ################################## # Generate code with type mismatch ################################## -for c in coll + icoll: +for c in gen.coll + gen.icoll: if c != 'MPI_Barrier': # Barrier has no Data to mismatch or to nullify patterns = {} patterns = {'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['collfeature'] = 'Yes' if c in coll else 'Lacking' - patterns['icollfeature'] = 'Yes' if c in icoll + ibarrier else 'Lacking' + patterns['collfeature'] = 'Yes' if c in gen.coll else 'Lacking' + patterns['icollfeature'] = 'Yes' if c in gen.icoll + gen.ibarrier else 'Lacking' patterns['toolfeature'] = 'Lacking' patterns['c'] = c - patterns['init'] = init[c]("1") - patterns['start'] = start[c]("1") - patterns['fini'] = fini[c]("1") - patterns['operation'] = operation[c]("1") - patterns['free'] = free[c]("1") + patterns['init'] = gen.init[c]("1") + patterns['start'] = gen.start[c]("1") + patterns['fini'] = gen.fini[c]("1") + patterns['operation'] = gen.operation[c]("1") + patterns['free'] = gen.free[c]("1") patterns['change_arg'] = '' # Generate the incorrect matching (datatype Mmismatch) @@ -174,7 +174,7 @@ for c in coll + icoll: replace['outcome'] = 'ERROR: DatatypeMatching' replace['errormsg'] = 'Collective datatype mistmatch. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has MPI_INT or MPI_FLOAT as a datatype.' replace['change_arg'] = 'if (rank % 2)\n type = MPI_FLOAT; /* MBIERROR1 */' - make_file(template, f'ParamMatching_Data_{c}_nok.c', replace) + gen.make_file(template, f'ParamMatching_Data_{c}_nok.c', replace) # Generate the call with null type (invalid datatype) replace = patterns @@ -183,26 +183,26 @@ for c in coll + icoll: replace['outcome'] = 'ERROR: InvalidDatatype' replace['errormsg'] = 'Invalid Datatype. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has an invalid datatype.' replace['change_arg'] = 'type=MPI_DATATYPE_NULL; /* MBIERROR1 */' - make_file(template, f'InvalidParam_DataNull_{c}_nok.c', replace) + gen.make_file(template, f'InvalidParam_DataNull_{c}_nok.c', replace) ################################## # Generate code with Op mismatch ################################## -for c in coll4op + icoll4op: +for c in gen.coll4op + gen.icoll4op: patterns = {} patterns = {'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['collfeature'] = 'Yes' if c in coll4op else 'Lacking' - patterns['icollfeature'] = 'Yes' if c in icoll4op else 'Lacking' + patterns['collfeature'] = 'Yes' if c in gen.coll4op else 'Lacking' + patterns['icollfeature'] = 'Yes' if c in gen.icoll4op else 'Lacking' patterns['toolfeature'] = 'Lacking' patterns['c'] = c - patterns['init'] = init[c]("1") - patterns['start'] = start[c]("1") - patterns['fini'] = fini[c]("1") - patterns['operation'] = operation[c]("1") - patterns['free'] = free[c]("1") + patterns['init'] = gen.init[c]("1") + patterns['start'] = gen.start[c]("1") + patterns['fini'] = gen.fini[c]("1") + patterns['operation'] = gen.operation[c]("1") + patterns['free'] = gen.free[c]("1") patterns['change_arg'] = '' # Generate the incorrect matching (op mismatch) @@ -212,7 +212,7 @@ for c in coll4op + icoll4op: replace['outcome'] = 'ERROR: OperatorMatching' replace['errormsg'] = 'Collective operator mistmatch. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has MPI_MAX or MPI_SUM as an operator.' replace['change_arg'] = 'if (rank % 2)\n op = MPI_MAX; /* MBIERROR1 */' - make_file(template, f'ParamMatching_Op_{c}_nok.c', replace) + gen.make_file(template, f'ParamMatching_Op_{c}_nok.c', replace) # Generate the call with Op=MPI_OP_NULL (invalid op) replace = patterns @@ -221,4 +221,4 @@ for c in coll4op + icoll4op: replace['outcome'] = 'ERROR: InvalidOperator' replace['errormsg'] = 'Invalid Operator. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has MPI_OP_NULL as an operator.' replace['change_arg'] = 'op = MPI_OP_NULL; /* MBIERROR1 */' - make_file(template, f'InvalidParam_OpNull_{c}_nok.c', replace) + gen.make_file(template, f'InvalidParam_OpNull_{c}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/CollComGenerator.py b/teshsuite/smpi/MBI/CollComGenerator.py index a01dbe5bad..707e9f3122 100755 --- a/teshsuite/smpi/MBI/CollComGenerator.py +++ b/teshsuite/smpi/MBI/CollComGenerator.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 //////////////////////// @@ -75,18 +75,18 @@ int main(int argc, char **argv) { # Generate code with one collective -for c in coll + icoll + ibarrier: +for c in gen.coll + gen.icoll + gen.ibarrier: patterns = {} patterns = {'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['collfeature'] = 'Yes' if c in coll else 'Lacking' - patterns['icollfeature'] = 'Yes' if c in icoll + ibarrier else 'Lacking' + patterns['collfeature'] = 'Yes' if c in gen.coll else 'Lacking' + patterns['icollfeature'] = 'Yes' if c in gen.icoll + gen.ibarrier else 'Lacking' patterns['c'] = c - patterns['init'] = init[c]("1") - patterns['start'] = start[c]("1") - patterns['fini'] = fini[c]("1") - patterns['free'] = free[c]("1") - patterns['operation'] = operation[c]("1") + patterns['init'] = gen.init[c]("1") + patterns['start'] = gen.start[c]("1") + patterns['fini'] = gen.fini[c]("1") + patterns['free'] = gen.free[c]("1") + patterns['operation'] = gen.operation[c]("1") # Generate the correct code => to remove? replace = patterns @@ -95,7 +95,7 @@ for c in coll + icoll + ibarrier: replace['outcome'] = 'OK' replace['errormsg'] = '' replace['change_com'] = '/* No error injected here */' - make_file(template, f'ParamMatching_Com_{c}_ok.c', replace) + gen.make_file(template, f'ParamMatching_Com_{c}_ok.c', replace) # Generate the incorrect communicator matching replace = patterns @@ -104,7 +104,7 @@ for c in coll + icoll + ibarrier: replace['outcome'] = 'ERROR: CommunicatorMatching' replace['errormsg'] = 'Communicator mistmatch in collectives. @{c}@ at @{filename}@:@{line:MBIERROR}@ has newcom or MPI_COMM_WORLD as a communicator.' replace['change_com'] = 'if (rank % 2)\n newcom = MPI_COMM_WORLD; /* MBIERROR */' - make_file(template, f'ParamMatching_Com_{c}_nok.c', replace) + gen.make_file(template, f'ParamMatching_Com_{c}_nok.c', replace) # Generate the coll with newcom=MPI_COMM_NULL replace = patterns @@ -113,4 +113,4 @@ for c in coll + icoll + ibarrier: replace['outcome'] = 'ERROR: InvalidCommunicator' replace['errormsg'] = 'Invalid communicator. @{c}@ at @{filename}@:@{line:MBIERROR}@ has MPI_COMM_NULL as a communicator.' replace['change_com'] = 'newcom = MPI_COMM_NULL; /* MBIERROR */' - make_file(template, f'InvalidParam_ComNull_{c}_nok.c', replace) + gen.make_file(template, f'InvalidParam_ComNull_{c}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/CollLocalConcurrencyGenerator.py b/teshsuite/smpi/MBI/CollLocalConcurrencyGenerator.py index 4eccf015c0..0043f48ca3 100755 --- a/teshsuite/smpi/MBI/CollLocalConcurrencyGenerator.py +++ b/teshsuite/smpi/MBI/CollLocalConcurrencyGenerator.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 //////////////////////// @@ -68,23 +68,23 @@ int main(int argc, char **argv) { } """ -for c in icoll + pcoll: +for c in gen.icoll + gen.pcoll: patterns = {} patterns = {'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['icollfeature'] = 'Yes' if c in icoll else 'Lacking' - patterns['pcollfeature'] = 'Yes' if c in pcoll else 'Lacking' + patterns['icollfeature'] = 'Yes' if c in gen.icoll else 'Lacking' + patterns['pcollfeature'] = 'Yes' if c in gen.pcoll else 'Lacking' patterns['c'] = c - patterns['init'] = init[c]("1") - patterns['start'] = start[c]("1") - patterns['fini'] = fini[c]("1") - patterns['operation'] = operation[c]("1") - patterns['write'] = write[c]("1") - patterns['free'] = free[c]("1") + patterns['init'] = gen.init[c]("1") + patterns['start'] = gen.start[c]("1") + patterns['fini'] = gen.fini[c]("1") + patterns['operation'] = gen.operation[c]("1") + patterns['write'] = gen.write[c]("1") + patterns['free'] = gen.free[c]("1") replace = patterns replace['shortdesc'] = 'Local concurrency with a collective' replace['longdesc'] = f'The buffer in {c} is modified before the call has been completed.' replace['outcome'] = 'ERROR: LocalConcurrency' replace['errormsg'] = 'Local Concurrency with a collective. The buffer in @{c}@ is modified at @{filename}@:@{line:MBIERROR}@ whereas there is no guarantee the call has been completed.' - make_file(template, f'LocalConcurrency_{c}_nok.c', replace) + gen.make_file(template, f'LocalConcurrency_{c}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/CollMatchingGenerator.py b/teshsuite/smpi/MBI/CollMatchingGenerator.py index cf4c5bff45..f6575db473 100755 --- a/teshsuite/smpi/MBI/CollMatchingGenerator.py +++ b/teshsuite/smpi/MBI/CollMatchingGenerator.py @@ -5,7 +5,7 @@ import os import sys -from generator_utils import * +import generator_utils as gen template = """// @{generatedby}@ /* ///////////////////////// The MPI Bugs Initiative //////////////////////// @@ -83,27 +83,27 @@ int main(int argc, char **argv) { } """ -for c1 in coll + icoll + ibarrier: - for c2 in coll + icoll + ibarrier: +for c1 in gen.coll + gen.icoll + gen.ibarrier: + for c2 in gen.coll + gen.icoll + gen.ibarrier: patterns = {} patterns = {'c1': c1, 'c2': c2} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['collfeature'] = 'Yes' if c1 in coll or c2 in coll else 'Lacking' - patterns['icollfeature'] = 'Yes' if c1 in icoll + ibarrier or c2 in icoll + ibarrier else 'Lacking' + patterns['collfeature'] = 'Yes' if c1 in gen.coll or c2 in gen.coll else 'Lacking' + patterns['icollfeature'] = 'Yes' if c1 in gen.icoll + gen.ibarrier or c2 in gen.icoll + gen.ibarrier else 'Lacking' patterns['c1'] = c1 patterns['c2'] = c2 - patterns['init1'] = init[c1]("1") - patterns['init2'] = init[c2]("2") - patterns['fini1a'] = fini[c1]("1") - patterns['fini2a'] = fini[c2]("2") - patterns['fini1b'] = fini[c1]("1") - patterns['fini2b'] = fini[c2]("2") - patterns['free1'] = free[c1]("1") - patterns['free2'] = free[c2]("2") - patterns['operation1a'] = operation[c1]("1") - patterns['operation1b'] = operation[c1]("1") - patterns['operation2a'] = operation[c2]("2") - patterns['operation2b'] = operation[c2]("2") + patterns['init1'] = gen.init[c1]("1") + patterns['init2'] = gen.init[c2]("2") + patterns['fini1a'] = gen.fini[c1]("1") + patterns['fini2a'] = gen.fini[c2]("2") + patterns['fini1b'] = gen.fini[c1]("1") + patterns['fini2b'] = gen.fini[c2]("2") + patterns['free1'] = gen.free[c1]("1") + patterns['free2'] = gen.free[c2]("2") + patterns['operation1a'] = gen.operation[c1]("1") + patterns['operation1b'] = gen.operation[c1]("1") + patterns['operation2a'] = gen.operation[c2]("2") + patterns['operation2b'] = gen.operation[c2]("2") patterns['change_cond'] = 'rank % 2' if c1 == c2: @@ -113,7 +113,7 @@ for c1 in coll + icoll + ibarrier: replace['longdesc'] = f'All ranks call {c1} twice' replace['outcome'] = 'OK' replace['errormsg'] = '' - make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace) + gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace) # Generate the correct code using the collective once replace = patterns replace['shortdesc'] = 'Correct collective ordering' @@ -126,7 +126,7 @@ for c1 in coll + icoll + ibarrier: replace['fini2a'] = '' replace['fini2b'] = '' replace['free2'] = '' - make_file(template, f'CallOrdering_{c1}_ok.c', replace) + gen.make_file(template, f'CallOrdering_{c1}_ok.c', replace) else: # Generate the correct ordering with two different collectives replace = patterns @@ -134,23 +134,23 @@ for c1 in coll + icoll + ibarrier: replace['longdesc'] = f'All ranks call {c1} and then {c2}' replace['outcome'] = 'OK' replace['errormsg'] = '' - make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace) + gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace) # Generate the incorrect ordering with two different collectives replace = patterns replace['shortdesc'] = 'Incorrect collective ordering' replace['longdesc'] = f'Odd ranks call {c1} and then {c2} while even ranks call these collectives in the other order' replace['outcome'] = 'ERROR: CallMatching' replace['errormsg'] = 'Collective mistmatch. @{c1}@ at @{filename}@:@{line:MBIERROR1}@ is matched with @{c2}@ line @{filename}@:@{line:MBIERROR2}@.' - replace['operation1b'] = operation[c2]("2") # Inversion - replace['operation2b'] = operation[c1]("1") - replace['fini1a'] = fini[c1]("1") # Inversion - replace['fini2a'] = fini[c2]("2") - replace['fini1b'] = fini[c2]("2") # Inversion - replace['fini2b'] = fini[c1]("1") - replace['free1'] = free[c2]("2") - replace['free2'] = free[c1]("1") + replace['operation1b'] = gen.operation[c2]("2") # Inversion + replace['operation2b'] = gen.operation[c1]("1") + replace['fini1a'] = gen.fini[c1]("1") # Inversion + replace['fini2a'] = gen.fini[c2]("2") + replace['fini1b'] = gen.fini[c2]("2") # Inversion + replace['fini2b'] = gen.fini[c1]("1") + replace['free1'] = gen.free[c2]("2") + replace['free2'] = gen.free[c1]("1") - make_file(template, f'CallOrdering_{c1}_{c2}_nok.c', replace) + gen.make_file(template, f'CallOrdering_{c1}_{c2}_nok.c', replace) # Generate the incorrect ordering with one collective replace = patterns @@ -164,7 +164,7 @@ for c1 in coll + icoll + ibarrier: replace['fini1b'] = '' replace['fini2a'] = '' replace['fini2b'] = '' - make_file(template, f'CallOrdering_{c1}_none_nok.c', replace) + gen.make_file(template, f'CallOrdering_{c1}_none_nok.c', replace) # Generate a correct ordering with a conditional not depending on ranks replace = patterns replace['shortdesc'] = 'Correct collective ordering' @@ -176,4 +176,4 @@ for c1 in coll + icoll + ibarrier: replace['operation2a'] = '' replace['fini2b'] = '' replace['free2a'] = '' - make_file(template, f'CallOrdering_{c1}_none_ok.c', replace) + gen.make_file(template, f'CallOrdering_{c1}_none_ok.c', replace) diff --git a/teshsuite/smpi/MBI/CollP2PMatchingGenerator.py b/teshsuite/smpi/MBI/CollP2PMatchingGenerator.py index 9fc7c4c2d6..598667b849 100755 --- a/teshsuite/smpi/MBI/CollP2PMatchingGenerator.py +++ b/teshsuite/smpi/MBI/CollP2PMatchingGenerator.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 //////////////////////// @@ -85,30 +85,30 @@ int main(int argc, char **argv) { """ -for s in send + isend: - for r in recv + irecv: - for c in coll: +for s in gen.send + gen.isend: + for r in gen.recv + gen.irecv: + for c in gen.coll: patterns = {} patterns = {'s': s, 'r': r, 'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking' - patterns['collfeature'] = 'Yes' if c in coll else 'Lacking' + patterns['p2pfeature'] = 'Yes' if s in gen.send or r in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if s in gen.isend or r in gen.irecv else 'Lacking' + patterns['collfeature'] = 'Yes' if c in gen.coll else 'Lacking' patterns['s'] = s patterns['r'] = r patterns['c'] = c - patterns['init1'] = init[s]("1") - patterns['init2'] = init[r]("2") - patterns['init3'] = init[c]("3") - patterns['fini1'] = fini[s]("1") - patterns['fini2'] = fini[r]("2") - patterns['fini3'] = fini[c]("3") - patterns['free1'] = free[s]("1") - patterns['free2'] = free[r]("2") - patterns['free3'] = free[c]("3") - patterns['operation1'] = operation[s]("1") - patterns['operation2'] = operation[r]("2") - patterns['operation3'] = operation[c]("3") + patterns['init1'] = gen.init[s]("1") + patterns['init2'] = gen.init[r]("2") + patterns['init3'] = gen.init[c]("3") + patterns['fini1'] = gen.fini[s]("1") + patterns['fini2'] = gen.fini[r]("2") + patterns['fini3'] = gen.fini[c]("3") + patterns['free1'] = gen.free[s]("1") + patterns['free2'] = gen.free[r]("2") + patterns['free3'] = gen.free[c]("3") + patterns['operation1'] = gen.operation[s]("1") + patterns['operation2'] = gen.operation[r]("2") + patterns['operation3'] = gen.operation[c]("3") # Generate the incorrect matching because of the conditional replace = patterns @@ -116,7 +116,7 @@ for s in send + isend: replace['longdesc'] = 'The @{s}@ corresponding to the @{r}@ is after @{c}@, while @{r}@ is before @{c}@. This is a deadlock.' replace['outcome'] = 'ERROR: CallMatching' replace['errormsg'] = 'P2P & Collective mistmatch. @{r}@ at @{filename}@:@{line:MBIERROR2}@ is matched with @{c}@ at @{filename}@:@{line:MBIERROR1}@ wich causes a deadlock.' - make_file(template, f'CallOrdering_{r}_{s}_{c}_nok.c', replace) + gen.make_file(template, f'CallOrdering_{r}_{s}_{c}_nok.c', replace) # Generate the incorrect code depending on buffering # replace = patterns @@ -130,4 +130,4 @@ for s in send + isend: # replace['operation2'] = operation[s]("1") # replace['fini1'] = fini[r]("2") # replace['fini2'] = fini[s]("1") - # make_file(template, f'CollP2PBuffering_{r}_{s}_{c}_nok.c', replace) + # gen.make_file(template, f'CollP2PBuffering_{r}_{s}_{c}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py b/teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py index c817f96d88..8709da593f 100755 --- a/teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.py +++ b/teshsuite/smpi/MBI/CollP2PMessageRaceGenerator.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 //////////////////////// @@ -102,34 +102,34 @@ int main(int argc, char **argv) { """ -for s in send + isend: - for r in irecv: - for c in coll: +for s in gen.send + gen.isend: + for r in gen.irecv: + for c in gen.coll: patterns = {} patterns = {'s': s, 'r': r, 'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking' - patterns['collfeature'] = 'Yes' if c in coll else 'Lacking' + patterns['p2pfeature'] = 'Yes' if s in gen.send or r in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if s in gen.isend or r in gen.irecv else 'Lacking' + patterns['collfeature'] = 'Yes' if c in gen.coll else 'Lacking' patterns['s'] = s patterns['r'] = r patterns['c'] = c - patterns['init1'] = init[c]("1") - patterns['init2'] = init[s]("2") - patterns['init3'] = init[r]("3") - patterns['init4'] = init[r]("4") - patterns['fini1'] = fini[c]("1") - patterns['fini2'] = fini[s]("2") - patterns['fini3'] = fini[r]("3") - patterns['fini4'] = fini[r]("4") - patterns['free1'] = free[c]("1") - patterns['free2'] = free[s]("2") - patterns['free3'] = free[r]("3") - patterns['free4'] = free[r]("4") - patterns['operation1'] = operation[c]("1") - patterns['operation2'] = operation[s]("2") - patterns['operation3'] = operation[r]("3") - patterns['operation4'] = operation[r]("4") + patterns['init1'] = gen.init[c]("1") + patterns['init2'] = gen.init[s]("2") + patterns['init3'] = gen.init[r]("3") + patterns['init4'] = gen.init[r]("4") + patterns['fini1'] = gen.fini[c]("1") + patterns['fini2'] = gen.fini[s]("2") + patterns['fini3'] = gen.fini[r]("3") + patterns['fini4'] = gen.fini[r]("4") + patterns['free1'] = gen.free[c]("1") + patterns['free2'] = gen.free[s]("2") + patterns['free3'] = gen.free[r]("3") + patterns['free4'] = gen.free[r]("4") + patterns['operation1'] = gen.operation[c]("1") + patterns['operation2'] = gen.operation[s]("2") + patterns['operation3'] = gen.operation[r]("3") + patterns['operation4'] = gen.operation[r]("4") # Generate the incorrect matching because of the conditional replace = patterns @@ -137,4 +137,4 @@ for s in send + isend: replace['longdesc'] = 'Message race in @{r}@ with @{c}@.' replace['outcome'] = 'ERROR: MessageRace' replace['errormsg'] = 'Message race. The use of wildcard receive calls (@{r}@ at @{filename}@:@{line:MBIERROR1}@ and @{r}@ at @{filename}@:@{line:MBIERROR2}@) leads to nondeterministic matching.' - make_file(template, f'MessageRace_{c}_{s}_{r}_nok.c', replace) + gen.make_file(template, f'MessageRace_{c}_{s}_{r}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/CollTopoGenerator.py b/teshsuite/smpi/MBI/CollTopoGenerator.py index 4bafe00e1a..ab54e52158 100755 --- a/teshsuite/smpi/MBI/CollTopoGenerator.py +++ b/teshsuite/smpi/MBI/CollTopoGenerator.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 //////////////////////// @@ -76,15 +76,15 @@ int main(int argc, char **argv) { } """ -for c in tcoll4topo: +for c in gen.tcoll4topo: patterns = {} patterns = {'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['toolfeature'] = 'Yes' if c in tcoll4topo else 'Lacking' + patterns['toolfeature'] = 'Yes' if c in gen.tcoll4topo else 'Lacking' patterns['c'] = c - patterns['init'] = init[c]("1") - patterns['fini'] = fini[c]("1") - patterns['operation'] = operation[c]("1") + patterns['init'] = gen.init[c]("1") + patterns['fini'] = gen.fini[c]("1") + patterns['operation'] = gen.operation[c]("1") # Generate the correct code replace = patterns @@ -94,7 +94,7 @@ for c in tcoll4topo: replace['errormsg'] = '' replace['change_com'] = '/* No error injected here */' replace['change_dims'] = '/* No error injected here */' - make_file(template, f'InvalidParam_{c}_ok.c', replace) + gen.make_file(template, f'InvalidParam_{c}_ok.c', replace) # Generate the incorrect code replace = patterns @@ -103,7 +103,7 @@ for c in tcoll4topo: replace['outcome'] = 'ERROR: InvalidCommunicator' replace['errormsg'] = 'Invalid Communicator in a collective. @{c}@ at @{filename}@:@{line:MBIERROR2}@ tries to get cartesian information of MPI_COMM_WORLD.' replace['change_com'] = 'newcom = MPI_COMM_WORLD; /* MBIERROR1 */' - make_file(template, f'InvalidParam_Com_{c}_nok.c', replace) + gen.make_file(template, f'InvalidParam_Com_{c}_nok.c', replace) # Generate the code with newcom=MPI_COMM_NULL replace = patterns @@ -112,7 +112,7 @@ for c in tcoll4topo: replace['outcome'] = 'ERROR: InvalidCommunicator' replace['errormsg'] = 'Invalid communicator. @{c}@ at @{filename}@:@{line:MBIERROR2}@ has MPI_COMM_NULL as a communicator.' replace['change_com'] = 'newcom = MPI_COMM_NULL; /* MBIERROR1 */' - make_file(template, f'InvalidParam_ComNull_{c}_nok.c', replace) + gen.make_file(template, f'InvalidParam_ComNull_{c}_nok.c', replace) # Generate the code with invalid dimension replace = patterns @@ -122,4 +122,4 @@ for c in tcoll4topo: replace['errormsg'] = 'Invalid Argument. MPI_Cart_create has invalid dimensions.' replace['change_com'] = "" replace['change_dims'] = 'dims[0] = -2; dims[1] = -1; /* MBIERROR1 */' - make_file(template, f'InvalidParam_Dim_MPI_Cart_create_nok.c', replace) + gen.make_file(template, f'InvalidParam_Dim_MPI_Cart_create_nok.c', replace) diff --git a/teshsuite/smpi/MBI/MissingWaitandStartGenerator.py b/teshsuite/smpi/MBI/MissingWaitandStartGenerator.py index c08698d566..16919726b2 100755 --- a/teshsuite/smpi/MBI/MissingWaitandStartGenerator.py +++ b/teshsuite/smpi/MBI/MissingWaitandStartGenerator.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 //////////////////////// @@ -81,30 +81,30 @@ int main(int argc, char **argv) { """ -for s in isend + psend: - for r in irecv + precv: +for s in gen.isend + gen.psend: + for r in gen.irecv + gen.precv: patterns = {} patterns = {'s': s, 'r': r} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['persfeature'] = 'Yes' if s in psend or r in precv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking' + patterns['persfeature'] = 'Yes' if s in gen.psend or r in gen.precv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if s in gen.isend or r in gen.irecv else 'Lacking' patterns['icollfeature'] = 'Lacking' patterns['cpersfeature'] = 'Lacking' patterns['s'] = s patterns['r'] = r - patterns['init1'] = init[s]("1") - patterns['init2'] = init[r]("2") - patterns['start1'] = start[s]("1") + patterns['init1'] = gen.init[s]("1") + patterns['init2'] = gen.init[r]("2") + patterns['start1'] = gen.start[s]("1") startPers = patterns['start1'] - patterns['start2'] = start[r]("2") - patterns['operation1'] = operation[s]("1") - patterns['operation2'] = operation[r]("2") - patterns['fini1'] = fini[s]("1") + patterns['start2'] = gen.start[r]("2") + patterns['operation1'] = gen.operation[s]("1") + patterns['operation2'] = gen.operation[r]("2") + patterns['fini1'] = gen.fini[s]("1") wait = patterns['fini1'] - patterns['fini2'] = fini[r]("2") - patterns['free1'] = free[s]("1") + patterns['fini2'] = gen.fini[r]("2") + patterns['free1'] = gen.free[s]("1") Reqfree = patterns['free1'] - patterns['free2'] = free[r]("2") + patterns['free2'] = gen.free[r]("2") # Generate the correct code replace = patterns @@ -112,7 +112,7 @@ for s in isend + psend: replace['longdesc'] = f'No error' replace['outcome'] = 'OK' replace['errormsg'] = 'OK' - make_file(template, f'ReqLifecycle_{s}_{r}_ok.c', replace) + gen.make_file(template, f'ReqLifecycle_{s}_{r}_ok.c', replace) # Generate the code with a missing wait replace = patterns @@ -121,44 +121,44 @@ for s in isend + psend: replace['outcome'] = 'ERROR: MissingWait' replace['errormsg'] = 'ERROR: MissingWait' replace['fini1'] = ' /* MBIERROR MISSING: ' + wait + ' */' - make_file(template, f'ReqLifecycle_MissingWait_{s}_{r}_nok.c', replace) + gen.make_file(template, f'ReqLifecycle_MissingWait_{s}_{r}_nok.c', replace) - if s in psend: + if s in gen.psend: # Generate the code with a missing start - persistent only replace = patterns replace['shortdesc'] = 'Missing start' replace['longdesc'] = 'Missing start. @{s}@ at @{filename}@:@{line:MBIERROR}@ has no start' replace['outcome'] = 'ERROR: MissingStart' replace['errormsg'] = 'ERROR: MissingStart' - replace['fini1'] = fini[s]("1") + replace['fini1'] = gen.fini[s]("1") replace['start1'] = ' /* MBIERROR MISSING: ' + startPers + ' */' - make_file(template, f'ReqLifecycle_MissingStart_{s}_{r}_nok.c', replace) + gen.make_file(template, f'ReqLifecycle_MissingStart_{s}_{r}_nok.c', replace) # Generate the code with a missing free - persistent only replace = patterns replace['shortdesc'] = 'Missing free' replace['longdesc'] = 'Missing free. @{s}@ at @{filename}@:@{line:MBIERROR}@ has no free' replace['outcome'] = 'ERROR: RequestLeak' replace['errormsg'] = 'ERROR: RequestLeak' - replace['start1'] = start[s]("1") + replace['start1'] = gen.start[s]("1") replace['free1'] = ' /* MBIERROR MISSING: ' + Reqfree + ' */' - make_file(template, f'ResLeak_nofree_{s}_{r}_nok.c', replace) + gen.make_file(template, f'ResLeak_nofree_{s}_{r}_nok.c', replace) # Collectives only -for c in pcoll + icoll + ibarrier: +for c in gen.pcoll + gen.icoll + gen.ibarrier: patterns = {} patterns = {'c': c} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' patterns['persfeature'] = 'Lacking' patterns['ip2pfeature'] = 'Lacking' - patterns['cpersfeature'] = 'Yes' if c in pcoll else 'Lacking' - patterns['icollfeature'] = 'Yes' if c in icoll + ibarrier else 'Lacking' + patterns['cpersfeature'] = 'Yes' if c in gen.pcoll else 'Lacking' + patterns['icollfeature'] = 'Yes' if c in gen.icoll + gen.ibarrier else 'Lacking' patterns['c'] = c - patterns['init1'] = init[c]("1") - patterns['operation1'] = operation[c]("1") - patterns['start1'] = start[c]("1") - patterns['fini1'] = fini[c]("1") - patterns['free1'] = free[c]("1") + patterns['init1'] = gen.init[c]("1") + patterns['operation1'] = gen.operation[c]("1") + patterns['start1'] = gen.start[c]("1") + patterns['fini1'] = gen.fini[c]("1") + patterns['free1'] = gen.free[c]("1") opstart = patterns['start1'] opwait = patterns['fini1'] opfree = patterns['free1'] @@ -176,18 +176,18 @@ for c in pcoll + icoll + ibarrier: replace['errormsg'] = 'ERROR: MissingWait' replace['fini1'] = ' /* MBIERROR MISSING: ' + opwait + ' */' replace['free1'] = ' /* MISSING: ' + replace['free1'] + ' (to not free the buffer before an internal wait */' - make_file(template, f'ReqLifecycle_MissingWait_{c}_nok.c', replace) + gen.make_file(template, f'ReqLifecycle_MissingWait_{c}_nok.c', replace) - if c in pcoll: + if c in gen.pcoll: # Generate the code with a missing start - persistent only replace = patterns replace['shortdesc'] = 'Missing start functio' replace['longdesc'] = 'Missing Start. @{c}@ at @{filename}@:@{line:MBIERROR}@ has no start' replace['outcome'] = 'ERROR: MissingStart' replace['errormsg'] = 'ERROR: MissingStart' - replace['fini1'] = fini[c]("1") + replace['fini1'] = gen.fini[c]("1") replace['start1'] = ' /* MBIERROR MISSING: ' + opstart + ' */' - make_file(template, f'ReqLifecycle_MissingStart_{c}_nok.c', replace) + gen.make_file(template, f'ReqLifecycle_MissingStart_{c}_nok.c', replace) # Generate the code with a resleak (no free) - persistent only replace = patterns @@ -195,6 +195,6 @@ for c in pcoll + icoll + ibarrier: replace['longdesc'] = 'Missing free. @{c}@ at @{filename}@:@{line:MBIERROR}@ has no free' replace['outcome'] = 'ERROR: RequestLeak' replace['errormsg'] = 'ERROR: RequestLeak' - replace['start1'] = start[c]("1") + replace['start1'] = gen.start[c]("1") replace['free1'] = ' /* MBIERROR MISSING: ' + opfree + ' */' - make_file(template, f'ResLeak_nofree_{c}_nok.c', replace) + gen.make_file(template, f'ResLeak_nofree_{c}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/P2PArgGenerator.py b/teshsuite/smpi/MBI/P2PArgGenerator.py index ca790d51bd..84b13dcd95 100755 --- a/teshsuite/smpi/MBI/P2PArgGenerator.py +++ b/teshsuite/smpi/MBI/P2PArgGenerator.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 //////////////////////// @@ -80,26 +80,26 @@ int main(int argc, char **argv) { # Generate code with type mismatch ################################## -for p1 in allsend: - for p2 in allrecv: +for p1 in gen.allsend: + for p2 in gen.allrecv: patterns = {} patterns = {'p1': p1, 'p2': p2} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if p1 in send + ssend + bsend or p2 in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if p1 in isend or p2 in irecv else 'Lacking' - patterns['persfeature'] = 'Yes' if p1 in psend or p2 in precv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if p1 in gen.send + gen.ssend + gen.bsend or p2 in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if p1 in gen.isend or p2 in gen.irecv else 'Lacking' + patterns['persfeature'] = 'Yes' if p1 in gen.psend or p2 in gen.precv else 'Lacking' patterns['p1'] = p1 patterns['p2'] = p2 - patterns['init1'] = init[p1]("1") - patterns['init2'] = init[p2]("2") - patterns['start1'] = start[p1]("1") - patterns['start2'] = start[p2]("2") - patterns['fini1'] = fini[p1]("1") - patterns['fini2'] = fini[p2]("2") - patterns['operation1'] = operation[p1]("1") #send - patterns['operation2'] = operation[p2]("2") #recv - patterns['free1'] = free[p1]("1") - patterns['free2'] = free[p2]("2") + patterns['init1'] = gen.init[p1]("1") + patterns['init2'] = gen.init[p2]("2") + patterns['start1'] = gen.start[p1]("1") + patterns['start2'] = gen.start[p2]("2") + patterns['fini1'] = gen.fini[p1]("1") + patterns['fini2'] = gen.fini[p2]("2") + patterns['operation1'] = gen.operation[p1]("1") #send + patterns['operation2'] = gen.operation[p2]("2") #recv + patterns['free1'] = gen.free[p1]("1") + patterns['free2'] = gen.free[p2]("2") # Generate the incorrect matching replace = patterns @@ -108,7 +108,7 @@ for p1 in allsend: replace['outcome'] = 'ERROR: DatatypeMatching' replace['errormsg'] = 'P2P Datatype mismatch. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ and @{p2}@ at @{filename}@:@{line:MBIERROR2}@ have MPI_INT and MPI_FLOAT as a datatype' replace['change_arg'] = 'if (rank == 0)\n type = MPI_FLOAT; /* MBIERROR3 */' - make_file(template, f'ParamMatching_Data_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'ParamMatching_Data_{p1}_{p2}_nok.c', replace) # Generate code with a null type replace = patterns @@ -117,7 +117,7 @@ for p1 in allsend: replace['outcome'] = 'ERROR: InvalidDatatype' replace['errormsg'] = 'Invalid datatype in P2P. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ and @{p2}@ at @{filename}@:@{line:MBIERROR2}@ have MPI_DATATYPE_NULL as a type' replace['change_arg'] = 'type = MPI_DATATYPE_NULL; /* MBIERROR3 */' - make_file(template, f'InvalidParam_DatatypeNull_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'InvalidParam_DatatypeNull_{p1}_{p2}_nok.c', replace) # Generate code with an invalid datatype replace = patterns @@ -126,32 +126,32 @@ for p1 in allsend: replace['outcome'] = 'ERROR: InvalidDatatype' replace['errormsg'] = 'Invalid datatype in P2P. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ and @{p2}@ at @{filename}@:@{line:MBIERROR2}@ have an invalid datatype' replace['change_arg'] = 'MPI_Type_contiguous (2, MPI_INT, &type); MPI_Type_commit(&type);MPI_Type_free(&type); /* MBIERROR3 */' - make_file(template, f'InvalidParam_Datatype_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'InvalidParam_Datatype_{p1}_{p2}_nok.c', replace) ################################# # Generate code with tag mismatch ################################# -for p1 in allsend: - for p2 in allrecv: +for p1 in gen.allsend: + for p2 in gen.allrecv: patterns = {} patterns = {'p1': p1, 'p2': p2} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if p1 in send + ssend + bsend or p2 in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if p1 in isend or p2 in irecv else 'Lacking' - patterns['persfeature'] = 'Yes' if p1 in psend or p2 in precv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if p1 in gen.send + gen.ssend + gen.bsend or p2 in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if p1 in gen.isend or p2 in gen.irecv else 'Lacking' + patterns['persfeature'] = 'Yes' if p1 in gen.psend or p2 in gen.precv else 'Lacking' patterns['p1'] = p1 patterns['p2'] = p2 - patterns['init1'] = init[p1]("1") - patterns['init2'] = init[p2]("2") - patterns['start1'] = start[p1]("1") - patterns['start2'] = start[p2]("2") - patterns['fini1'] = fini[p1]("1") - patterns['fini2'] = fini[p2]("2") - patterns['operation1'] = operation[p1]("1") #send - patterns['operation2'] = operation[p2]("2") #recv - patterns['free1'] = free[p1]("1") - patterns['free2'] = free[p2]("2") + patterns['init1'] = gen.init[p1]("1") + patterns['init2'] = gen.init[p2]("2") + patterns['start1'] = gen.start[p1]("1") + patterns['start2'] = gen.start[p2]("2") + patterns['fini1'] = gen.fini[p1]("1") + patterns['fini2'] = gen.fini[p2]("2") + patterns['operation1'] = gen.operation[p1]("1") #send + patterns['operation2'] = gen.operation[p2]("2") #recv + patterns['free1'] = gen.free[p1]("1") + patterns['free2'] = gen.free[p2]("2") patterns['change_arg'] = "" # Generate the incorrect tag matching @@ -161,7 +161,7 @@ for p1 in allsend: replace['outcome'] = 'ERROR: TagMatching' replace['errormsg'] = 'P2P tag mismatch. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ and @{p2}@ at @{filename}@:@{line:MBIERROR2}@ use different tag.' replace['change_arg'] = 'stag=0; rtag=1;/* MBIERROR */' - make_file(template, f'ParamMatching_Tag_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'ParamMatching_Tag_{p1}_{p2}_nok.c', replace) # Generate the code with an invalid tag replace = patterns @@ -170,7 +170,7 @@ for p1 in allsend: replace['outcome'] = 'ERROR: InvalidTag' replace['errormsg'] = 'Invalid Tag. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ and @{p2}@ at @{filename}@:@{line:MBIERROR2}@ use an invalid tag.' replace['change_arg'] = 'stag=-1; rtag=-2;/* MBIERROR */' - make_file(template, f'InvalidParam_Tag_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'InvalidParam_Tag_{p1}_{p2}_nok.c', replace) # Generate a correct code using MPI_ANY_TAG replace = patterns @@ -179,4 +179,4 @@ for p1 in allsend: replace['outcome'] = 'OK' replace['errormsg'] = 'OK' replace['change_arg'] = 'rtag=MPI_ANY_TAG;' - make_file(template, f'ParamMatching_Tag_{p1}_{p2}_ok.c', replace) + gen.make_file(template, f'ParamMatching_Tag_{p1}_{p2}_ok.c', replace) diff --git a/teshsuite/smpi/MBI/P2PComGenerator.py b/teshsuite/smpi/MBI/P2PComGenerator.py index 1179650c8f..e15c74dd45 100755 --- a/teshsuite/smpi/MBI/P2PComGenerator.py +++ b/teshsuite/smpi/MBI/P2PComGenerator.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 //////////////////////// @@ -81,27 +81,27 @@ int main(int argc, char **argv) { """ -for p1 in send + isend + psend: - for p2 in recv + irecv + precv: +for p1 in gen.send + gen.isend + gen.psend: + for p2 in gen.recv + gen.irecv + gen.precv: patterns = {} patterns = {'p1': p1, 'p2': p2} patterns['origin'] = "MBI" patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if p1 in send or p2 in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if p1 in isend or p2 in irecv else 'Lacking' - patterns['persfeature'] = 'Yes' if p1 in psend or p2 in precv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if p1 in gen.send or p2 in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if p1 in gen.isend or p2 in gen.irecv else 'Lacking' + patterns['persfeature'] = 'Yes' if p1 in gen.psend or p2 in gen.precv else 'Lacking' patterns['p1'] = p1 patterns['p2'] = p2 - patterns['init1'] = init[p1]("1") - patterns['init2'] = init[p2]("2") - patterns['start1'] = start[p1]("1") - patterns['start2'] = start[p2]("2") - patterns['fini1'] = fini[p1]("1") - patterns['fini2'] = fini[p2]("2") - patterns['operation1'] = operation[p1]("1") #send - patterns['operation2'] = operation[p2]("2") #recv - patterns['free1'] = free[p1]("1") - patterns['free2'] = free[p2]("2") + patterns['init1'] = gen.init[p1]("1") + patterns['init2'] = gen.init[p2]("2") + patterns['start1'] = gen.start[p1]("1") + patterns['start2'] = gen.start[p2]("2") + patterns['fini1'] = gen.fini[p1]("1") + patterns['fini2'] = gen.fini[p2]("2") + patterns['operation1'] = gen.operation[p1]("1") #send + patterns['operation2'] = gen.operation[p2]("2") #recv + patterns['free1'] = gen.free[p1]("1") + patterns['free2'] = gen.free[p2]("2") patterns['change_srcdest'] = "" # Generate the incorrect matching @@ -111,7 +111,7 @@ for p1 in send + isend + psend: replace['outcome'] = 'ERROR: CommunicatorMatching' replace['errormsg'] = 'P2P Communicator mismatch. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ and @{p2}@ at @{filename}@:@{line:MBIERROR2}@ have newcom or MPI_COMM_WORLD as a communicator.' replace['change_com'] = 'if (rank==0)\n newcom = MPI_COMM_WORLD; /* MBIERROR */' - make_file(template, f'ParamMatching_Com_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'ParamMatching_Com_{p1}_{p2}_nok.c', replace) # Generate the code with an invalid communicator replace = patterns @@ -120,7 +120,7 @@ for p1 in send + isend + psend: replace['outcome'] = 'ERROR: InvalidCommunicator' replace['errormsg'] = 'Invalid Communicator. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ and @{p2}@ at @{filename}@:@{line:MBIERROR2}@ use a communicator that is freed line @{line:MBIERROR}@.' replace['change_com'] = 'MPI_Comm_free(&newcom); /* MBIERROR */' - make_file(template, f'InvalidParam_Com_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'InvalidParam_Com_{p1}_{p2}_nok.c', replace) # Generate the code with an invalid communicator ==> TO CHECK #replace = patterns @@ -130,7 +130,7 @@ for p1 in send + isend + psend: # replace['errormsg'] = 'Invalid Communicator. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ and @{p2}@ at @{filename}@:@{line:MBIERROR2}@ use different communicators' # replace['origin'] = "MPI-Corrbench" # replace['change_com'] = "" - # make_file(template, f'InvalidParam_Com_{p1}_{p2}_nok.c', replace) + # gen.make_file(template, f'InvalidParam_Com_{p1}_{p2}_nok.c', replace) # Generate the code with an invalid dest replace = patterns @@ -141,7 +141,7 @@ for p1 in send + isend + psend: replace['errormsg'] = 'InvalidSrcDest. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ performs a send with a dest not in communicator (dest is changed line @{line:MBIERROR}@).' replace['change_com'] = "" replace['change_srcdest'] = 'dest=4; /* MBIERROR */' - make_file(template, f'InvalidParam_Dest_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'InvalidParam_Dest_{p1}_{p2}_nok.c', replace) # Generate the code with an invalid src replace = patterns @@ -150,4 +150,4 @@ for p1 in send + isend + psend: replace['outcome'] = 'ERROR: InvalidSrcDest' replace['errormsg'] = 'InvalidSrcDest. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ performs a recv with a negative integer as source (src is changed line @{line:MBIERROR}@).' replace['change_srcdest'] = 'src=-1; /* MBIERROR */' - make_file(template, f'InvalidParam_Src_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'InvalidParam_Src_{p1}_{p2}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/P2PInvalidComGenerator.py b/teshsuite/smpi/MBI/P2PInvalidComGenerator.py index 87deaa15e9..fc9e67341a 100755 --- a/teshsuite/smpi/MBI/P2PInvalidComGenerator.py +++ b/teshsuite/smpi/MBI/P2PInvalidComGenerator.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 //////////////////////// @@ -77,27 +77,27 @@ int main(int argc, char **argv) { """ -for p1 in send + isend + psend: - for p2 in recv + irecv + precv: +for p1 in gen.send + gen.isend + gen.psend: + for p2 in gen.recv + gen.irecv + gen.precv: patterns = {} patterns = {'p1': p1, 'p2': p2} patterns['origin'] = "MBI" patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if p1 in send or p2 in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if p1 in isend or p2 in irecv else 'Lacking' - patterns['persfeature'] = 'Yes' if p1 in psend or p2 in precv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if p1 in gen.send or p2 in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if p1 in gen.isend or p2 in gen.irecv else 'Lacking' + patterns['persfeature'] = 'Yes' if p1 in gen.psend or p2 in gen.precv else 'Lacking' patterns['p1'] = p1 patterns['p2'] = p2 - patterns['init1'] = init[p1]("1") - patterns['init2'] = init[p2]("2") - patterns['start1'] = start[p1]("1") - patterns['start2'] = start[p2]("2") - patterns['fini1'] = fini[p1]("1") - patterns['fini2'] = fini[p2]("2") - patterns['operation1'] = operation[p1]("1") #send - patterns['operation2'] = operation[p2]("2") #recv - patterns['free1'] = free[p1]("1") - patterns['free2'] = free[p2]("2") + patterns['init1'] = gen.init[p1]("1") + patterns['init2'] = gen.init[p2]("2") + patterns['start1'] = gen.start[p1]("1") + patterns['start2'] = gen.start[p2]("2") + patterns['fini1'] = gen.fini[p1]("1") + patterns['fini2'] = gen.fini[p2]("2") + patterns['operation1'] = gen.operation[p1]("1") #send + patterns['operation2'] = gen.operation[p2]("2") #recv + patterns['free1'] = gen.free[p1]("1") + patterns['free2'] = gen.free[p2]("2") patterns['change_com1'] = "" patterns['change_com2'] = "" @@ -108,7 +108,7 @@ for p1 in send + isend + psend: replace['outcome'] = 'ERROR: InvalidCommunicator' replace['errormsg'] = 'Invalid Communicator. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ uses a null communicator.' replace['change_com2'] = 'newcom = MPI_COMM_NULL;' - make_file(template, f'InvalidParam_ComNull_{p2}_{p1}nok.c', replace) + gen.make_file(template, f'InvalidParam_ComNull_{p2}_{p1}nok.c', replace) replace = patterns replace['shortdesc'] = 'Point to point @{p2}@ has an invalid communicator' @@ -117,4 +117,4 @@ for p1 in send + isend + psend: replace['errormsg'] = 'Invalid Communicator. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ uses a null communicator.' replace['change_com1'] = 'newcom = MPI_COMM_NULL;' replace['change_com2'] = "" - make_file(template, f'InvalidParam_ComNull_{p1}_{p2}nok.c', replace) + gen.make_file(template, f'InvalidParam_ComNull_{p1}_{p2}nok.c', replace) diff --git a/teshsuite/smpi/MBI/P2PLocalConcurrencyGenerator.py b/teshsuite/smpi/MBI/P2PLocalConcurrencyGenerator.py index 460a65fa89..29bbe8f196 100755 --- a/teshsuite/smpi/MBI/P2PLocalConcurrencyGenerator.py +++ b/teshsuite/smpi/MBI/P2PLocalConcurrencyGenerator.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 //////////////////////// @@ -79,48 +79,48 @@ int main(int argc, char **argv) { """ -for s in send + isend + psend: - for r in irecv + precv + recv: +for s in gen.send + gen.isend + gen.psend: + for r in gen.irecv + gen.precv + gen.recv: patterns = {} patterns = {'s': s, 'r': r} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if s in send else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if r in irecv else 'Lacking' - patterns['persfeature'] = 'Yes' if r in precv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if s in gen.send else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if r in gen.irecv else 'Lacking' + patterns['persfeature'] = 'Yes' if r in gen.precv else 'Lacking' patterns['s'] = s patterns['r'] = r - patterns['init1'] = init[s]("1") - patterns['init2'] = init[r]("2") - patterns['fini1'] = fini[s]("1") - patterns['fini2'] = fini[r]("2") - patterns['start1'] = start[s]("1") - patterns['start2'] = start[r]("2") - patterns['operation1'] = operation[s]("1") - patterns['operation2'] = operation[r]("2") - patterns['write1'] = write[s]("1") - patterns['write2'] = write[r]("2") - patterns['free1'] = free[s]("1") - patterns['free2'] = free[r]("2") + patterns['init1'] = gen.init[s]("1") + patterns['init2'] = gen.init[r]("2") + patterns['fini1'] = gen.fini[s]("1") + patterns['fini2'] = gen.fini[r]("2") + patterns['start1'] = gen.start[s]("1") + patterns['start2'] = gen.start[r]("2") + patterns['operation1'] = gen.operation[s]("1") + patterns['operation2'] = gen.operation[r]("2") + patterns['write1'] = gen.write[s]("1") + patterns['write2'] = gen.write[r]("2") + patterns['free1'] = gen.free[s]("1") + patterns['free2'] = gen.free[r]("2") # Generate a message race - if s in send and r in irecv + precv: + if s in gen.send and r in gen.irecv + gen.precv: replace = patterns replace['shortdesc'] = ' Local Concurrency with a P2P' replace['longdesc'] = f'The message buffer in {r} is modified before the call has been completed.' replace['outcome'] = 'ERROR: LocalConcurrency' replace['errormsg'] = 'Local Concurrency with a P2P. The receive buffer in @{r}@ is modified at @{filename}@:@{line:MBIERROR2}@ whereas there is no guarantee the message has been received.' - make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace) - if s in isend + psend and r in recv: + gen.make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace) + if s in gen.isend + gen.psend and r in gen.recv: replace = patterns replace['shortdesc'] = ' Local Concurrency with a P2P' replace['longdesc'] = f'The message buffer in {s} is modified before the call has been completed.' replace['outcome'] = 'ERROR: LocalConcurrency' replace['errormsg'] = 'Local Concurrency with a P2P. The send buffer in @{s}@ is modified at @{filename}@:@{line:MBIERROR1}@ whereas there is no guarantee the message has been sent.' - make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace) - if s in isend + psend and r in irecv + precv: + gen.make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace) + if s in gen.isend + gen.psend and r in gen.irecv + gen.precv: replace = patterns replace['shortdesc'] = ' Local Concurrency with a P2P' replace['longdesc'] = f'The message buffer in {s} and {r} are modified before the calls have completed.' replace['outcome'] = 'ERROR: LocalConcurrency' replace['errormsg'] = 'Local Concurrency with a P2P. The message buffers in @{s}@ and @{r}@ are modified at @{filename}@:@{line:MBIERROR1}@ and @{filename}@:@{line:MBIERROR2}@ whereas there is no guarantee the calls have been completed.' - make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace) + gen.make_file(template, f'LocalConcurrency_{r}_{s}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/P2PMatchingANYSRCGenerator.py b/teshsuite/smpi/MBI/P2PMatchingANYSRCGenerator.py index 7e9baf2093..0c32f7c573 100755 --- a/teshsuite/smpi/MBI/P2PMatchingANYSRCGenerator.py +++ b/teshsuite/smpi/MBI/P2PMatchingANYSRCGenerator.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 //////////////////////// @@ -82,22 +82,22 @@ int main(int argc, char **argv) { """ -for s in send + isend: - for r in recv + irecv: +for s in gen.send + gen.isend: + for r in gen.recv + gen.irecv: patterns = {} patterns = {'s': s, 'r': r} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if s in gen.send or r in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if s in gen.isend or r in gen.irecv else 'Lacking' patterns['s'] = s patterns['r'] = r patterns['cond'] = 'buf1' - patterns['init2'] = init[s]("2") - patterns['init1'] = init[r]("1") - patterns['fini2'] = fini[s]("2") - patterns['fini1'] = fini[r]("1") - patterns['operation2'] = operation[s]("2") - patterns['operation1'] = operation[r]("1") + patterns['init2'] = gen.init[s]("2") + patterns['init1'] = gen.init[r]("1") + patterns['fini2'] = gen.fini[s]("2") + patterns['fini1'] = gen.fini[r]("1") + patterns['operation2'] = gen.operation[s]("2") + patterns['operation1'] = gen.operation[r]("1") # Generate the incorrect matching replace = patterns @@ -105,4 +105,4 @@ for s in send + isend: replace['longdesc'] = f'The code assumes a fixed order in the reception of messages while the message ordering is non-deterministic.' replace['outcome'] = 'ERROR: MessageRace' replace['errormsg'] = 'P2P message race which can cause a deadlock. @{r}@ at @{filename}@:@{line:MBIERROR}@ is called with ANY_SRC.' - make_file(template, f'MessageRace_{r}_{s}_nok.c', replace) + gen.make_file(template, f'MessageRace_{r}_{s}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/P2PMatchingGenerator.py b/teshsuite/smpi/MBI/P2PMatchingGenerator.py index 2602fdcbe4..b7e7f66669 100755 --- a/teshsuite/smpi/MBI/P2PMatchingGenerator.py +++ b/teshsuite/smpi/MBI/P2PMatchingGenerator.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 //////////////////////// @@ -72,21 +72,21 @@ int main(int argc, char **argv) { """ -for p in send + ssend + bsend + recv + irecv + isend: +for p in gen.send + gen.ssend + gen.bsend + gen.recv + gen.irecv + gen.isend: patterns = {} patterns = {'p': p} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if p in send + bsend + ssend + recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if p in isend + irecv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if p in gen.send + gen.bsend + gen.ssend + gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if p in gen.isend + gen.irecv else 'Lacking' patterns['persfeature'] = 'Lacking' #patterns['persfeature'] = 'Yes' if p in psend + precv else 'Lacking' patterns['p'] = p - patterns['init1'] = init[p]("1") - patterns['init2'] = '' #init[p2]("2") - patterns['fini1'] = fini[p]("1") - patterns['fini2'] = '' #fini[p2]("2") - patterns['operation1'] = operation[p]("1") - patterns['operation2'] = '' #operation[p2]("2") + patterns['init1'] = gen.init[p]("1") + patterns['init2'] = '' #gen.init[p2]("2") + patterns['fini1'] = gen.fini[p]("1") + patterns['fini2'] = '' #gen.fini[p2]("2") + patterns['operation1'] = gen.operation[p]("1") + patterns['operation2'] = '' #gen.operation[p2]("2") patterns['change_cond'] = 'rank == 1' # Generate the incorrect matching with one call @@ -95,7 +95,7 @@ for p in send + ssend + bsend + recv + irecv + isend: replace['longdesc'] = 'Process 0 calls @{p}@ and is not matched' replace['outcome'] = 'ERROR: CallMatching' replace['errormsg'] = 'P2P mistmatch. @{p}@ at @{filename}@:@{line:MBIERROR1}@ is not matched.' - make_file(template, f'CallOrdering_{p}_nok.c', replace) + gen.make_file(template, f'CallOrdering_{p}_nok.c', replace) # Generate the incorrect matching with two calls replace = patterns @@ -103,25 +103,25 @@ for p in send + ssend + bsend + recv + irecv + isend: replace['longdesc'] = 'Processes 0 and 1 both call @{p}@ which are not matched' replace['outcome'] = 'ERROR: CallMatching' replace['errormsg'] = 'P2P mismatch. @{p}@ at @{filename}@:@{line:MBIERROR1}@ and @{p}@ at @{filename}@:@{line:MBIERROR2}@ are not matched.' - replace['operation2'] = operation[p]("1") - replace['fini2'] = fini[p]("1") - make_file(template, f'CallOrdering_{p}_{p}_nok.c', replace) + replace['operation2'] = gen.operation[p]("1") + replace['fini2'] = gen.fini[p]("1") + gen.make_file(template, f'CallOrdering_{p}_{p}_nok.c', replace) -for s in send + isend + ssend + bsend: - for r in recv + irecv: +for s in gen.send + gen.isend + gen.ssend + gen.bsend: + for r in gen.recv + gen.irecv: patterns = {} patterns = {'s': s, 'r': r} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if s in gen.send or r in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if s in gen.isend or r in gen.irecv else 'Lacking' patterns['s'] = s patterns['r'] = r - patterns['init1'] = init[s]("1") - patterns['init2'] = init[r]("2") - patterns['fini1'] = fini[s]("1") - patterns['fini2'] = fini[r]("2") - patterns['operation1'] = operation[s]("1") - patterns['operation2'] = operation[r]("2") + patterns['init1'] = gen.init[s]("1") + patterns['init2'] = gen.init[r]("2") + patterns['fini1'] = gen.fini[s]("1") + patterns['fini2'] = gen.fini[r]("2") + patterns['operation1'] = gen.operation[s]("1") + patterns['operation2'] = gen.operation[r]("2") patterns['change_cond'] = '(rank == 1) && (its_raining)' # Generate the incorrect matching because of the conditional @@ -130,6 +130,6 @@ for s in send + isend + ssend + bsend: replace['longdesc'] = 'Point to point @{r}@ is never executed. Process 1 calls MPI_Finalize and causes a deadlock.' replace['outcome'] = 'ERROR: CallMatching' replace['errormsg'] = 'P2P mistmatch. @{r}@ at @{filename}@:@{line:MBIERROR2}@ is never called because of the conditional (@{change_cond}@).' - replace['operation1'] = operation[s]("1") - replace['operation2'] = operation[r]("2") - make_file(template, f'CallOrdering_{r}_{s}_nok.c', replace) + replace['operation1'] = gen.operation[s]("1") + replace['operation2'] = gen.operation[r]("2") + gen.make_file(template, f'CallOrdering_{r}_{s}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/P2PProbeGenerator.py b/teshsuite/smpi/MBI/P2PProbeGenerator.py index a5bc12f9ae..4504493191 100755 --- a/teshsuite/smpi/MBI/P2PProbeGenerator.py +++ b/teshsuite/smpi/MBI/P2PProbeGenerator.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 //////////////////////// @@ -93,41 +93,41 @@ int main(int argc, char **argv) { """ -for p in probe: - for s in send + isend: - for r in recv + irecv: +for p in gen.probe: + for s in gen.send + gen.isend: + for r in gen.recv + gen.irecv: patterns = {} patterns = {'p':p, 's': s, 'r': r} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' - patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if s in gen.send or r in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if s in gen.isend or r in gen.irecv else 'Lacking' patterns['s'] = s patterns['r'] = r patterns['p'] = p - patterns['init1a'] = init[p]("1") - patterns['init1b'] = init[s]("1") - patterns['init1c'] = init[r]("2") - patterns['init2a'] = init[p]("1") - patterns['init2b'] = init[r]("3") - patterns['init2c'] = init[s]("4") - patterns['fini1a'] = fini[p]("1") - patterns['fini1b'] = fini[s]("1") - patterns['fini1c'] = fini[r]("2") - patterns['fini2a'] = fini[p]("1") - patterns['fini2b'] = fini[r]("3") - patterns['fini2c'] = fini[s]("4") - patterns['free1a'] = free[p]("1") - patterns['free1b'] = free[s]("1") - patterns['free1c'] = free[r]("2") - patterns['free2a'] = free[p]("1") - patterns['free2b'] = free[r]("3") - patterns['free2c'] = free[s]("4") - patterns['operation1a'] = operation[p]("1") - patterns['operation1b'] = operation[s]("1") - patterns['operation1c'] = operation[r]("2") - patterns['operation2a'] = operation[p]("1") - patterns['operation2b'] = operation[r]("3") - patterns['operation2c'] = operation[s]("4") + patterns['init1a'] = gen.init[p]("1") + patterns['init1b'] = gen.init[s]("1") + patterns['init1c'] = gen.init[r]("2") + patterns['init2a'] = gen.init[p]("1") + patterns['init2b'] = gen.init[r]("3") + patterns['init2c'] = gen.init[s]("4") + patterns['fini1a'] = gen.fini[p]("1") + patterns['fini1b'] = gen.fini[s]("1") + patterns['fini1c'] = gen.fini[r]("2") + patterns['fini2a'] = gen.fini[p]("1") + patterns['fini2b'] = gen.fini[r]("3") + patterns['fini2c'] = gen.fini[s]("4") + patterns['free1a'] = gen.free[p]("1") + patterns['free1b'] = gen.free[s]("1") + patterns['free1c'] = gen.free[r]("2") + patterns['free2a'] = gen.free[p]("1") + patterns['free2b'] = gen.free[r]("3") + patterns['free2c'] = gen.free[s]("4") + patterns['operation1a'] = gen.operation[p]("1") + patterns['operation1b'] = gen.operation[s]("1") + patterns['operation1c'] = gen.operation[r]("2") + patterns['operation2a'] = gen.operation[p]("1") + patterns['operation2b'] = gen.operation[r]("3") + patterns['operation2c'] = gen.operation[s]("4") # Generate the incorrect matching replace = patterns @@ -135,7 +135,7 @@ for p in probe: replace['longdesc'] = 'MPI_Probe is a blocking call that returns only after a matching message has been found. By calling MPI_Probe before MPI_Recv, a deadlock is created.' replace['outcome'] = 'ERROR: CallMatching' replace['errormsg'] = 'P2P mistmatch. @{p}@ at @{filename}@:@{line:MBIERROR1}@ and @{filename}@:@{line:MBIERROR2}@ are called before @{r}@.' - make_file(template, f'CallOrdering_{p}_{r}_{s}_nok.c', replace) + gen.make_file(template, f'CallOrdering_{p}_{r}_{s}_nok.c', replace) # Generate a correct matching replace = patterns @@ -143,6 +143,6 @@ for p in probe: replace['longdesc'] = 'Correct use of MPI_Probe.' replace['outcome'] = 'OK' replace['errormsg'] = 'OK' - replace['operation1a'] = operation[s]("1") - replace['operation1b'] = operation[p]("1") - make_file(template, f'CallOrdering_{p}_{r}_{s}_ok.c', replace) + replace['operation1a'] = gen.operation[s]("1") + replace['operation1b'] = gen.operation[p]("1") + gen.make_file(template, f'CallOrdering_{p}_{r}_{s}_ok.c', replace) diff --git a/teshsuite/smpi/MBI/RMAArgGenerator.py b/teshsuite/smpi/MBI/RMAArgGenerator.py index c459dfa7fc..5e4279440d 100755 --- a/teshsuite/smpi/MBI/RMAArgGenerator.py +++ b/teshsuite/smpi/MBI/RMAArgGenerator.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 //////////////////////// @@ -75,8 +75,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" @@ -84,10 +84,10 @@ 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'] = "" # Generate a code with a null type @@ -97,7 +97,7 @@ for e in epoch: 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 @@ -106,4 +106,4 @@ for e in epoch: 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) diff --git a/teshsuite/smpi/MBI/RMAInvalidArgGenerator.py b/teshsuite/smpi/MBI/RMAInvalidArgGenerator.py index 8160671e55..6a5e40a623 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 //////////////////////// @@ -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,10 +82,10 @@ 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));" @@ -96,7 +96,7 @@ for e in epoch: 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 @@ -106,9 +106,9 @@ for e in epoch: # replace['outcome'] = 'ERROR: InvalidBuffer' # replace['init'] = 'int * localbuf1 = 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 @@ -118,7 +118,7 @@ for e in epoch: 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 @@ -130,4 +130,4 @@ for e in epoch: patterns['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) diff --git a/teshsuite/smpi/MBI/RMALocalLocalConcurrencyGenerator.py b/teshsuite/smpi/MBI/RMALocalLocalConcurrencyGenerator.py index faefb85430..00777e3bc7 100755 --- a/teshsuite/smpi/MBI/RMALocalLocalConcurrencyGenerator.py +++ b/teshsuite/smpi/MBI/RMALocalLocalConcurrencyGenerator.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 //////////////////////// @@ -76,9 +76,9 @@ int main(int argc, char **argv) { """ -for e in epoch: - for p1 in get: - for p2 in put + store + load + get + loadstore: +for e in gen.epoch: + for p1 in gen.get: + for p2 in gen.put + gen.store + gen.load + gen.get + gen.loadstore: patterns = {} patterns = {'e': e, 'p1': p1, 'p2': p2} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' @@ -86,11 +86,11 @@ for e in epoch: patterns['p1'] = p1 patterns['p2'] = p2 patterns['e'] = e - patterns['epoch'] = epoch[e]("1") - patterns['finEpoch'] = finEpoch[e]("1") - patterns['init1'] = init[p1]("1") - patterns['operation1'] = operation[p1]("1") - patterns['operation2'] = operation[p2]("1") + patterns['epoch'] = gen.epoch[e]("1") + patterns['finEpoch'] = gen.finEpoch[e]("1") + patterns['init1'] = gen.init[p1]("1") + patterns['operation1'] = gen.operation[p1]("1") + patterns['operation2'] = gen.operation[p2]("1") # Generate a data race (Get + Get/load/store/Put) replace = patterns @@ -98,31 +98,31 @@ for e in epoch: replace['longdesc'] = 'Local Concurrency error. @{p2}@ conflicts with @{p1}@' replace['outcome'] = 'ERROR: LocalConcurrency' replace['errormsg'] = 'Local Concurrency error. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ conflicts with @{p1}@ line @{line:MBIERROR1}@' - make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p1}_{p2}_nok.c', replace) # Generate a correct code by switching operation1 and operation2 - if p2 in store + load + loadstore: + if p2 in gen.store + gen.load + gen.loadstore: replace = patterns replace['shortdesc'] = 'Correct code using RMA operations' replace['longdesc'] = 'Correct code using RMA operations' replace['outcome'] = 'OK' replace['errormsg'] = 'OK' - replace['operation1'] = operation[p2]("1") - replace['operation2'] = operation[p1]("1") - make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p2}_{p1}_ok.c', replace) + replace['operation1'] = gen.operation[p2]("1") + replace['operation2'] = gen.operation[p1]("1") + gen.make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p2}_{p1}_ok.c', replace) # Generate a correct code by removing operation2 replace = patterns replace['shortdesc'] = 'Correct code using RMA operations' replace['longdesc'] = 'Correct code using RMA operations' replace['outcome'] = 'OK' replace['errormsg'] = 'OK' - replace['operation1'] = operation[p1]("1") + replace['operation1'] = gen.operation[p1]("1") replace['operation2'] = '' - make_file(template, f'LocalConcurrency_{e}_{p1}_ok.c', replace) + gen.make_file(template, f'LocalConcurrency_{e}_{p1}_ok.c', replace) -for e in epoch: - for p1 in put: - for p2 in store: +for e in gen.epoch: + for p1 in gen.put: + for p2 in gen.store: patterns = {} patterns = {'e': e, 'p1': p1, 'p2': p2} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' @@ -130,11 +130,11 @@ for e in epoch: patterns['p1'] = p1 patterns['p2'] = p2 patterns['e'] = e - patterns['epoch'] = epoch[e]("1") - patterns['finEpoch'] = finEpoch[e]("1") - patterns['init1'] = init[p1]("1") - patterns['operation1'] = operation[p1]("1") - patterns['operation2'] = operation[p2]("1") + patterns['epoch'] = gen.epoch[e]("1") + patterns['finEpoch'] = gen.finEpoch[e]("1") + patterns['init1'] = gen.init[p1]("1") + patterns['operation1'] = gen.operation[p1]("1") + patterns['operation2'] = gen.operation[p2]("1") # Generate a data race (Put + store) replace = patterns @@ -142,16 +142,16 @@ for e in epoch: replace['longdesc'] = 'Local Concurrency error. @{p2}@ conflicts with @{p1}@' replace['outcome'] = 'ERROR: LocalConcurrency' replace['errormsg'] = 'Local Concurrency error. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ conflicts with @{p1}@ line @{line:MBIERROR1}@' - make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p1}_{p2}_nok.c', replace) # Generate a correct code by switching operation1 and operation2 replace = patterns replace['shortdesc'] = 'Correct code using RMA operations' replace['longdesc'] = 'Correct code using RMA operations' replace['outcome'] = 'OK' replace['errormsg'] = 'OK' - replace['operation1'] = operation[p2]("1") - replace['operation2'] = operation[p1]("1") - make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p2}_{p1}_ok.c', replace) + replace['operation1'] = gen.operation[p2]("1") + replace['operation2'] = gen.operation[p1]("1") + gen.make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p2}_{p1}_ok.c', replace) # Generate a correct code by removing operation2 replace = patterns @@ -159,6 +159,6 @@ for e in epoch: replace['longdesc'] = 'Correct code using RMA operations' replace['outcome'] = 'OK' replace['errormsg'] = 'OK' - replace['operation1'] = operation[p1]("1") + replace['operation1'] = gen.operation[p1]("1") replace['operation2'] = '' - make_file(template, f'LocalConcurrency_{e}_{p1}_ok.c', replace) + gen.make_file(template, f'LocalConcurrency_{e}_{p1}_ok.c', replace) diff --git a/teshsuite/smpi/MBI/RMAP2PGlobalConcurrencyGenerator.py b/teshsuite/smpi/MBI/RMAP2PGlobalConcurrencyGenerator.py index 95a63f4b8c..f6a239f977 100755 --- a/teshsuite/smpi/MBI/RMAP2PGlobalConcurrencyGenerator.py +++ b/teshsuite/smpi/MBI/RMAP2PGlobalConcurrencyGenerator.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 //////////////////////// @@ -92,30 +92,30 @@ int main(int argc, char **argv) { """ -for p in put + get: - for s in send + isend: - for r in recv + irecv: +for p in gen.put + gen.get: + for s in gen.send + gen.isend: + for r in gen.recv + gen.irecv: patterns = {} patterns = {'p': p, 's': s, 'r': r} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' patterns['rmafeature'] = 'Yes' - patterns['p2pfeature'] = 'Yes' if s in send or r in recv else 'Lacking' - patterns['ip2pfeature'] = 'Yes' if s in isend or r in irecv else 'Lacking' + patterns['p2pfeature'] = 'Yes' if s in gen.send or r in gen.recv else 'Lacking' + patterns['ip2pfeature'] = 'Yes' if s in gen.isend or r in gen.irecv else 'Lacking' patterns['p'] = p patterns['s'] = s patterns['r'] = r - patterns['init1'] = init[p]("1") - patterns['init2'] = init[s]("2") - patterns['init3'] = init[r]("3") - patterns['fini2'] = fini[s]("2") - patterns['fini3'] = fini[r]("3") - patterns['operation1'] = operation[p]("1") #put or get - patterns['operation2'] = operation[s]("2") #send - patterns['operation3'] = operation[r]("3") #recv + patterns['init1'] = gen.init[p]("1") + patterns['init2'] = gen.init[s]("2") + patterns['init3'] = gen.init[r]("3") + patterns['fini2'] = gen.fini[s]("2") + patterns['fini3'] = gen.fini[r]("3") + patterns['operation1'] = gen.operation[p]("1") #put or get + patterns['operation2'] = gen.operation[s]("2") #send + patterns['operation3'] = gen.operation[r]("3") #recv replace = patterns replace['shortdesc'] = 'Global Concurrency error.' replace['longdesc'] = 'Global Concurrency error. Concurrent access of variable winbuf by @{p}@ and @{r}@' replace['outcome'] = 'ERROR: GlobalConcurrency' replace['errormsg'] = 'Global Concurrency error. @{p}@ at @{filename}@:@{line:MBIERROR1}@ accesses the window of process 1. Process 1 receives data from process 2 and uses variable winbuf. winbuf in process 1 is then nondeterministic.' - make_file(template, f'GlobalConcurrency_{p}_{s}_{r}_nok.c', replace) + gen.make_file(template, f'GlobalConcurrency_{p}_{s}_{r}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/RMARemoteLocalConcurrencyGenerator.py b/teshsuite/smpi/MBI/RMARemoteLocalConcurrencyGenerator.py index 8cdb7410e4..9a28409f95 100755 --- a/teshsuite/smpi/MBI/RMARemoteLocalConcurrencyGenerator.py +++ b/teshsuite/smpi/MBI/RMARemoteLocalConcurrencyGenerator.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 //////////////////////// @@ -78,9 +78,9 @@ int main(int argc, char **argv) { """ -for e in epoch: - for p1 in get: - for p2 in put + rstore + rload + get: +for e in gen.epoch: + for p1 in gen.get: + for p2 in gen.put + gen.rstore + gen.rload + gen.get: patterns = {} patterns = {'e': e, 'p1': p1, 'p2': p2} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' @@ -88,11 +88,11 @@ for e in epoch: patterns['p1'] = p1 patterns['p2'] = p2 patterns['e'] = e - patterns['epoch'] = epoch[e]("1") - patterns['finEpoch'] = finEpoch[e]("1") - patterns['init1'] = init[p1]("1") - patterns['operation1'] = operation[p1]("1") - patterns['operation2'] = operation[p2]("1") + patterns['epoch'] = gen.epoch[e]("1") + patterns['finEpoch'] = gen.finEpoch[e]("1") + patterns['init1'] = gen.init[p1]("1") + patterns['operation1'] = gen.operation[p1]("1") + patterns['operation2'] = gen.operation[p2]("1") # Generate a data race (Get + Get/load/store/Put) replace = patterns @@ -102,17 +102,17 @@ for e in epoch: replace['errormsg'] = 'Global Concurrency error. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ conflicts with @{p1}@ line @{line:MBIERROR1}@' # Replace Put and Get first argument - if p2 in put: + if p2 in gen.put: replace['operation2'] = 'MPI_Put(&winbuf[20], N, MPI_INT, target, 0, N, type, win);' - if p2 in get: + if p2 in gen.get: replace['operation2'] = 'MPI_Get(&winbuf[20], N, MPI_INT, target, 0, N, type, win);' - make_file(template, f'GlobalConcurrency_rl_{e}_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'GlobalConcurrency_rl_{e}_{p1}_{p2}_nok.c', replace) -for e in epoch: - for p1 in put: - for p2 in rstore + rload + put: +for e in gen.epoch: + for p1 in gen.put: + for p2 in gen.rstore + gen.rload + gen.put: patterns = {} patterns = {'e': e, 'p1': p1, 'p2': p2} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' @@ -120,11 +120,11 @@ for e in epoch: patterns['p1'] = p1 patterns['p2'] = p2 patterns['e'] = e - patterns['epoch'] = epoch[e]("1") - patterns['finEpoch'] = finEpoch[e]("1") - patterns['init1'] = init[p1]("1") - patterns['operation1'] = operation[p1]("1") - patterns['operation2'] = operation[p2]("1") + patterns['epoch'] = gen.epoch[e]("1") + patterns['finEpoch'] = gen.finEpoch[e]("1") + patterns['init1'] = gen.init[p1]("1") + patterns['operation1'] = gen.operation[p1]("1") + patterns['operation2'] = gen.operation[p2]("1") # Generate a data race (Put + store) replace = patterns @@ -134,7 +134,7 @@ for e in epoch: replace['errormsg'] = 'Global Concurrency error. @{p2}@ at @{filename}@:@{line:MBIERROR2}@ conflicts with @{p1}@ line @{line:MBIERROR1}@' # Replace Put first argument - if p2 in put: + if p2 in gen.put: replace['operation2'] = 'MPI_Put(&winbuf[20], N, MPI_INT, target, 0, N, type, win);' - make_file(template, f'GlobalConcurrency_rl_{e}_{p1}_{p2}_nok.c', replace) + gen.make_file(template, f'GlobalConcurrency_rl_{e}_{p1}_{p2}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/RMARemoteRemoteConcurrencyGenerator.py b/teshsuite/smpi/MBI/RMARemoteRemoteConcurrencyGenerator.py index 74f65497c9..78116e805f 100755 --- a/teshsuite/smpi/MBI/RMARemoteRemoteConcurrencyGenerator.py +++ b/teshsuite/smpi/MBI/RMARemoteRemoteConcurrencyGenerator.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 //////////////////////// @@ -74,18 +74,18 @@ int main(int argc, char **argv) { """ -for e in epoch: - for p1 in get + put: +for e in gen.epoch: + for p1 in gen.get + gen.put: patterns = {} patterns = {'e': e, 'p1': p1} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' patterns['rmafeature'] = 'Yes' patterns['p1'] = p1 patterns['e'] = e - patterns['epoch'] = epoch[e]("1") - patterns['finEpoch'] = finEpoch[e]("1") - patterns['init1'] = init[p1]("1") - patterns['operation1'] = operation[p1]("1") + patterns['epoch'] = gen.epoch[e]("1") + patterns['finEpoch'] = gen.finEpoch[e]("1") + patterns['init1'] = gen.init[p1]("1") + patterns['operation1'] = gen.operation[p1]("1") # Generate a data race (Get + Get/load/store/Put) replace = patterns @@ -93,4 +93,4 @@ for e in epoch: replace['longdesc'] = 'Global Concurrency error. Both processes 0 and 2 access the window in process 1 with @{p1}@' replace['outcome'] = 'ERROR: GlobalConcurrency' replace['errormsg'] = 'Global Concurrency error. @{p1}@ at @{filename}@:@{line:MBIERROR1}@ conflicts in process 1' - make_file(template, f'GlobalConcurrency_rr_{e}_{p1}_nok.c', replace) + gen.make_file(template, f'GlobalConcurrency_rr_{e}_{p1}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/RMAReqLifecycleGenerator.py b/teshsuite/smpi/MBI/RMAReqLifecycleGenerator.py index 5044792cd0..5ca2f65f84 100755 --- a/teshsuite/smpi/MBI/RMAReqLifecycleGenerator.py +++ b/teshsuite/smpi/MBI/RMAReqLifecycleGenerator.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 //////////////////////// @@ -80,8 +80,8 @@ int main(int argc, char **argv) { """ -for e1 in epoch: - for p in rma: +for e1 in gen.epoch: + for p in gen.rma: patterns = {} patterns = {'e1': e1, 'p': p} patterns['origin'] = "MPI-Corrbench" @@ -89,12 +89,12 @@ for e1 in epoch: patterns['rmafeature'] = 'Yes' patterns['p'] = p patterns['e1'] = e1 - patterns['epoch'] = epoch[e1]("1") - patterns['finEpoch'] = finEpoch[e1]("1") + patterns['epoch'] = gen.epoch[e1]("1") + patterns['finEpoch'] = gen.finEpoch[e1]("1") patterns['epoch2'] = "" patterns['finEpoch2'] = "" - patterns['init'] = init[p]("1") - patterns['operation'] = operation[p]("1") + patterns['init'] = gen.init[p]("1") + patterns['operation'] = gen.operation[p]("1") # Generate a code correct replace = patterns @@ -102,7 +102,7 @@ for e1 in epoch: replace['longdesc'] = 'Correct code' replace['outcome'] = 'OK' replace['errormsg'] = 'OK' - make_file(template, f'ReqLifecycle_RMA_{e1}_{p}_ok.c', replace) + gen.make_file(template, f'ReqLifecycle_RMA_{e1}_{p}_ok.c', replace) # Generate a code with missing open epoch replace = patterns @@ -110,8 +110,8 @@ for e1 in epoch: replace['longdesc'] = f"Request lifecycle, missing open {e1} epoch" replace['outcome'] = 'ERROR: MissingStart' replace['errormsg'] = '@{e1}@ at @{filename}@:@{line:MBIERROR}@ has missing' - replace['epoch'] = f"/* MBIERROR MISSING: {epoch[e1]('1')} */" - make_file(template, f'ReqLifecycle_RMA_MissingOpen_{e1}_{p}_nok.c', replace) + replace['epoch'] = f"/* MBIERROR MISSING: {gen.epoch[e1]('1')} */" + gen.make_file(template, f'ReqLifecycle_RMA_MissingOpen_{e1}_{p}_nok.c', replace) # Generate a code with missing close epoch replace = patterns @@ -119,13 +119,13 @@ for e1 in epoch: replace['longdesc'] = f"Request lifecycle, missing close {e1} epoch" replace['outcome'] = 'ERROR: MissingWait' replace['errormsg'] = '@{e1}@ at @{filename}@:@{line:MBIERROR}@ has missing' - replace['epoch'] = epoch[e1]("1") - replace['finEpoch'] = f"/* MBIERROR MISSING: {finEpoch[e1]('1')} */" - make_file(template, f'ReqLifecycle_RMA_MissingClose_{e1}_{p}_nok.c', replace) + replace['epoch'] = gen.epoch[e1]("1") + replace['finEpoch'] = f"/* MBIERROR MISSING: {gen.finEpoch[e1]('1')} */" + gen.make_file(template, f'ReqLifecycle_RMA_MissingClose_{e1}_{p}_nok.c', replace) -for e1 in epoch: - for e2 in epoch: - for p in rma: +for e1 in gen.epoch: + for e2 in gen.epoch: + for p in gen.rma: patterns = {} patterns = {'e1': e1, 'e2': e2, 'p': p} patterns['origin'] = "MPI-Corrbench" @@ -134,12 +134,12 @@ for e1 in epoch: patterns['p'] = p patterns['e1'] = e1 patterns['e2'] = e2 - patterns['epoch'] = epoch[e1]("1") - patterns['finEpoch'] = finEpoch[e1]("1") - patterns['epoch2'] = epoch[e2]("1") + " /* MBIERROR */" - patterns['finEpoch2'] = finEpoch[e2]("1") + " /* MBIERROR */" - patterns['init'] = init[p]("1") - patterns['operation'] = operation[p]("1") + patterns['epoch'] = gen.epoch[e1]("1") + patterns['finEpoch'] = gen.finEpoch[e1]("1") + patterns['epoch2'] = gen.epoch[e2]("1") + " /* MBIERROR */" + patterns['finEpoch2'] = gen.finEpoch[e2]("1") + " /* MBIERROR */" + patterns['init'] = gen.init[p]("1") + patterns['operation'] = gen.operation[p]("1") # Generate a code with epoch into an epoch replace = patterns @@ -147,4 +147,4 @@ for e1 in epoch: replace['longdesc'] = f"Request lifecycle, {e2} epoch into {e1} epoch" replace['outcome'] = 'ERROR: MissingWait' #FIXME: New type of error replace['errormsg'] = '@{e2}@ at @{filename}@:@{line:MBIERROR}@ has in an other epoch' - make_file(template, f'ReqLifecycle_RMA_TwoEpoch_{e1}_{e2}_{p}_nok.c', replace) + gen.make_file(template, f'ReqLifecycle_RMA_TwoEpoch_{e1}_{e2}_{p}_nok.c', replace) diff --git a/teshsuite/smpi/MBI/RMAWinBufferGenerator.py b/teshsuite/smpi/MBI/RMAWinBufferGenerator.py index 8c6faa1408..8987f28dc5 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 //////////////////////// @@ -118,4 +118,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) diff --git a/teshsuite/smpi/MBI/ResleakGenerator.py b/teshsuite/smpi/MBI/ResleakGenerator.py index b2556e4f60..d1d84eaf6f 100755 --- a/teshsuite/smpi/MBI/ResleakGenerator.py +++ b/teshsuite/smpi/MBI/ResleakGenerator.py @@ -5,7 +5,7 @@ import os import sys -from generator_utils import * +import generator_utils as gen template = """// @{generatedby}@ /* ///////////////////////// The MPI Bugs Initiative //////////////////////// @@ -78,16 +78,16 @@ int main(int argc, char **argv) { """ # Generate code with one collective -for call in tcoll: +for call in gen.tcoll: patterns = {} patterns = {'call': call} patterns['generatedby'] = f'DO NOT EDIT: this file was generated by {os.path.basename(sys.argv[0])}. DO NOT EDIT.' patterns['toolfeature'] = 'Yes' patterns['call'] = call - patterns['operation'] = operation[call]("1") - patterns['init'] = init[call]("1") - patterns['fini'] = fini[call]("1") - patterns['free'] = free[call]("1") + patterns['operation'] = gen.operation[call]("1") + patterns['init'] = gen.init[call]("1") + patterns['fini'] = gen.fini[call]("1") + patterns['free'] = gen.free[call]("1") missing = patterns['fini'] patterns['loop'] = '' patterns['cond'] = '' @@ -100,26 +100,26 @@ for call in tcoll: replace['longdesc'] = f'{call} correctly used' replace['outcome'] = 'OK' replace['errormsg'] = '' - make_file(template, f'ResLeak_{call}_ok.c', replace) + gen.make_file(template, f'ResLeak_{call}_ok.c', replace) # Generate the resleak replace = patterns replace['shortdesc'] = '@{call}@ has no free' replace['longdesc'] = '@{call}@ has no free' - replace['outcome'] = f'ERROR: {error[call]}' + replace['outcome'] = f'ERROR: {gen.error[call]}' replace['errormsg'] = 'Resleak. @{call}@ at @{filename}@:@{line:MBIERROR}@ has no free.' replace['fini'] = ' /* MBIERROR MISSING: ' + missing + ' */' - make_file(template, f'ResLeak_{call}_nok.c', replace) + gen.make_file(template, f'ResLeak_{call}_nok.c', replace) # Generate multiple resleak replace = patterns replace['shortdesc'] = '@{call}@ lacks several free' replace['longdesc'] = '@{call}@ lacks several free' - replace['outcome'] = f'ERROR: {error[call]}' + replace['outcome'] = f'ERROR: {gen.error[call]}' replace['errormsg'] = 'Resleak. @{call}@ at @{filename}@:@{line:MBIERROR}@ lacks several free.' replace['change_size'] = 'size=PARAM_PER_ITERATION;' replace['loop'] = 'for (i = 0; i < ITERATIONS; i++) {\n for (j = 0; j < PARAM_PER_ITERATION; j++) {' replace['cond'] = ' if (j < PARAM_PER_ITERATION - PARAM_LOST_PER_ITERATION) {' - replace['fini'] = fini[call]("1") + ' /* MBIERROR */' + replace['fini'] = gen.fini[call]("1") + ' /* MBIERROR */' replace['end'] = ' }\n }\n }' - make_file(template, f'ResLeak_multiple_{call}_nok.c', replace) + gen.make_file(template, f'ResLeak_multiple_{call}_nok.c', replace) -- 2.30.2