# Generate an incorrect root matching (root mismatch)
replace = patterns
replace['shortdesc'] = 'Collective @{c}@ with a root mismatch'
- replace['longdesc'] = f'Odd ranks use 0 as a root while even ranks use 1 as a root'
+ replace['longdesc'] = 'Odd ranks use 0 as a root while even ranks use 1 as a root'
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 */'
# Generate the incorrect matching (datatype Mmismatch)
replace = patterns
replace['shortdesc'] = 'Collective @{c}@ with a datatype mismatch'
- replace['longdesc'] = f'Odd ranks use MPI_INT as the datatype while even ranks use MPI_FLOAT'
+ replace['longdesc'] = 'Odd ranks use MPI_INT as the datatype while even ranks use MPI_FLOAT'
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 */'
# Generate the incorrect matching (op mismatch)
replace = patterns
replace['shortdesc'] = 'Collective @{c}@ with an operator mismatch'
- replace['longdesc'] = f'Odd ranks use MPI_SUM as the operator while even ranks use MPI_MAX'
+ replace['longdesc'] = 'Odd ranks use MPI_SUM as the operator while even ranks use MPI_MAX'
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 */'
# Generate the incorrect communicator matching
replace = patterns
replace['shortdesc'] = 'Collective @{c}@ with a communicator mismatch'
- replace['longdesc'] = f'Odd ranks call the collective on newcom while even ranks call the collective on MPI_COMM_WORLD'
+ replace['longdesc'] = 'Odd ranks call the collective on newcom while even ranks call the collective on MPI_COMM_WORLD'
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 */'
replace['errormsg'] = 'Invalid Argument. MPI_Cart_create has invalid dimensions.'
replace['change_com'] = ""
replace['change_dims'] = 'dims[0] = -2; dims[1] = -1; /* MBIERROR1 */'
- gen.make_file(template, f'InvalidParam_Dim_MPI_Cart_create_nok.c', replace)
+ gen.make_file(template, 'InvalidParam_Dim_MPI_Cart_create_nok.c', replace)
state = 2
else:
raise ValueError(f"Unexpected end of MBI_TESTS header at line {line_num}: \n{line}")
- if state == 1 and re.match("\s+\$ ?.*", line):
- m = re.match('\s+\$ ?(.*)', line)
+ if state == 1 and re.match(r'\s+\$ ?.*', line):
+ m = re.match(r'\s+\$ ?(.*)', line)
cmd = m.group(1)
nextline = next(input_file)
detail = 'OK'
if outcome == 'timeout':
res_category = 'timeout'
if elapsed is None:
- diagnostic = f'hard timeout'
+ diagnostic = 'hard timeout'
else:
diagnostic = f'timeout after {elapsed} sec'
elif outcome == 'failure' or outcome == 'segfault':
res_category = 'failure'
- diagnostic = f'tool error, or test not run'
+ diagnostic = 'tool error, or test not run'
elif outcome == 'UNIMPLEMENTED':
res_category = 'unimplemented'
- diagnostic = f'coverage issue'
+ diagnostic = 'coverage issue'
elif outcome == 'other':
res_category = 'other'
- diagnostic = f'inconclusive run'
+ diagnostic = 'inconclusive run'
elif expected == 'OK':
if outcome == 'OK':
res_category = 'TRUE_NEG'
- diagnostic = f'correctly reported no error'
+ diagnostic = 'correctly reported no error'
else:
res_category = 'FALSE_POS'
- diagnostic = f'reported an error in a correct code'
+ diagnostic = 'reported an error in a correct code'
elif expected == 'ERROR':
if outcome == 'OK':
res_category = 'FALSE_NEG'
- diagnostic = f'failed to detect an error'
+ diagnostic = 'failed to detect an error'
else:
res_category = 'TRUE_POS'
- diagnostic = f'correctly detected an error'
+ diagnostic = 'correctly detected an error'
else:
raise ValueError(f"Unexpected expectation: {expected} (must be OK or ERROR)")
# Generate the correct code
replace = patterns
replace['shortdesc'] = 'Correct matching'
- replace['longdesc'] = f'No error'
+ replace['longdesc'] = 'No error'
replace['outcome'] = 'OK'
replace['errormsg'] = 'OK'
gen.make_file(template, f'ReqLifecycle_{s}_{r}_ok.c', replace)
# Generate the incorrect matching
replace = patterns
replace['shortdesc'] = 'The message ordering is non-deterministic.'
- replace['longdesc'] = f'The code assumes a fixed order in the reception of messages while the message ordering is non-deterministic.'
+ replace['longdesc'] = '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.'
gen.make_file(template, f'MessageRace_{r}_{s}_nok.c', replace)
### COLL:tools
-init['MPI_Comm_split'] = lambda n: f'MPI_Comm com[size]; int color = rank % 2; int key = 1;'
+init['MPI_Comm_split'] = lambda n: 'MPI_Comm com[size]; int color = rank % 2; int key = 1;'
start['MPI_Comm_split'] = lambda n: ""
operation['MPI_Comm_split'] = lambda n: 'MPI_Comm_split(MPI_COMM_WORLD,color,key, &com[j]);'
error['MPI_Comm_split'] = 'CommunicatorLeak'
init['MPI_Cart_get'] = lambda n: ""
start['MPI_Cart_get'] = lambda n: ""
-operation['MPI_Cart_get'] = lambda n: f'MPI_Cart_get(newcom, 2, dims, periods, coords);'
+operation['MPI_Cart_get'] = lambda n: 'MPI_Cart_get(newcom, 2, dims, periods, coords);'
write['MPI_Cart_get'] = lambda n: ""
fini['MPI_Cart_get'] = lambda n: ""
free['MPI_Cart_get'] = lambda n: ""
fini['MPI_Comm_create'] = lambda n: "MPI_Comm_free(&com[j]);"
free['MPI_Comm_create'] = lambda n: ""
-init['MPI_Comm_dup'] = lambda n: f'MPI_Comm com[size];'
+init['MPI_Comm_dup'] = lambda n: 'MPI_Comm com[size];'
operation['MPI_Comm_dup'] = lambda n: 'MPI_Comm_dup(MPI_COMM_WORLD, &com[j]);'
error['MPI_Comm_dup'] = 'CommunicatorLeak'
fini['MPI_Comm_dup'] = lambda n: "MPI_Comm_free(&com[j]);"
init['MPI_Probe'] = lambda n: ""
start['MPI_Probe'] = lambda n: ""
-operation['MPI_Probe'] = lambda n: f'MPI_Probe(src, 0, newcom, &sta);'
+operation['MPI_Probe'] = lambda n: 'MPI_Probe(src, 0, newcom, &sta);'
fini['MPI_Probe'] = lambda n: ""
free['MPI_Probe'] = lambda n: ""
write['MPI_Probe'] = lambda n: ""
operation['store'] = lambda n: f'localbuf{n}[0] = 8;'
init['rstore'] = lambda n: ""
-operation['rstore'] = lambda n: f'winbuf[20] = 12346;'
+operation['rstore'] = lambda n: 'winbuf[20] = 12346;'
init['load'] = lambda n: f'int localbuf{n}[N] = {{0}};'
operation['load'] = lambda n: f'int load = localbuf{n}[0];'
filename = filename.replace("_MPI_", "_")
replace['filename'] = filename
# Replace all variables that don't have a ':' in their name
- while re.search("@\{[^@:]*\}@", output):
- m = re.search("@\{([^@:]*)\}@", output)
+ while re.search(r'@\{[^@:]*\}@', output):
+ m = re.search(r'@\{([^@:]*)\}@', output)
target = m.group(1)
#print(f"Replace @{{{target}}}@")
if target in replace.keys():
- output = re.sub(f'@\{{{target}\}}@', replace[target], output)
+ output = re.sub(fr'@\{{{target}\}}@', replace[target], output)
#print(f"Replace {target} -> {replace[target]}")
else:
raise ValueError(f"Variable {target} used in template, but not defined.")
# Now replace all variables with a ':' in their name: line targets are like that, and we don't want to resolve them before the others change the lines
- while re.search("@\{([^:@]*):([^@]*)\}@", output):
- m = re.search("@\{([^:@]*):([^@]*)\}@", output)
+ while re.search(r'@\{([^:@]*):([^@]*)\}@', output):
+ m = re.search(r'@\{([^:@]*):([^@]*)\}@', output)
(kind, target) = (m.group(1), m.group(2))
if kind == 'line':
replace = f'{find_line(output, target, filename)}'
#print(f"Replace @{{line:{target}}}@ with '{replace}'")
- output = re.sub(f'@\{{line:{target}\}}@', replace, output)
+ output = re.sub(fr'@\{{line:{target}\}}@', replace, output)
else:
raise ValueError(f"Unknown variable kind: {kind}:{target}")
with open(f'{cachefile}.txt' if os.path.exists(f'{cachefile}.txt') else f'logs/simgrid/{cachefile}.txt', 'r') as infile:
output = infile.read()
- if re.search('Compilation of .*? raised an error \(retcode: ', output):
+ if re.search(r'Compilation of .*? raised an error \(retcode: ', output):
return 'UNIMPLEMENTED'
if re.search('MBI_MSG_RACE', output):