#! /usr/bin/python3
import os
import sys
-from generator_utils import *
+import generator_utils as gen
template = """// @{generatedby}@
/* ///////////////////////// The MPI Bugs Initiative ////////////////////////
}
"""
-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
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
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
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
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)