From: Arnaud Giersch Date: Wed, 30 Mar 2022 19:31:19 +0000 (+0200) Subject: [MBI] Less duplication of constant strings (sonar). X-Git-Tag: v3.32~342 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/49239f700bcaa55429c3c196db664569f85972bc?ds=sidebyside [MBI] Less duplication of constant strings (sonar). --- diff --git a/teshsuite/smpi/MBI/CollMatchingGenerator.py b/teshsuite/smpi/MBI/CollMatchingGenerator.py index 952f85f7ad..206baff677 100755 --- a/teshsuite/smpi/MBI/CollMatchingGenerator.py +++ b/teshsuite/smpi/MBI/CollMatchingGenerator.py @@ -105,18 +105,19 @@ for c1 in gen.coll + gen.icoll + gen.ibarrier: patterns['operation2a'] = gen.operation[c2]("2") patterns['operation2b'] = gen.operation[c2]("2") patterns['change_cond'] = 'rank % 2' + shortdesc = ' collective ordering' if c1 == c2: # Generate the correct code using the same collective twice replace = patterns.copy() - replace['shortdesc'] = 'Correct collective ordering' + replace['shortdesc'] = 'Correct' + shortdesc replace['longdesc'] = f'All ranks call {c1} twice' replace['outcome'] = 'OK' replace['errormsg'] = '' gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace) # Generate the correct code using the collective once replace = patterns.copy() - replace['shortdesc'] = 'Correct collective ordering' + replace['shortdesc'] = 'Correct' + shortdesc replace['longdesc'] = f'All ranks call {c1} once' replace['outcome'] = 'OK' replace['errormsg'] = '' @@ -130,14 +131,14 @@ for c1 in gen.coll + gen.icoll + gen.ibarrier: else: # Generate the correct ordering with two different collectives replace = patterns.copy() - replace['shortdesc'] = 'Correct collective ordering' + replace['shortdesc'] = 'Correct' + shortdesc replace['longdesc'] = f'All ranks call {c1} and then {c2}' replace['outcome'] = 'OK' replace['errormsg'] = '' gen.make_file(template, f'CallOrdering_{c1}_{c2}_ok.c', replace) # Generate the incorrect ordering with two different collectives replace = patterns.copy() - replace['shortdesc'] = 'Incorrect collective ordering' + replace['shortdesc'] = 'Incorrect' + shortdesc 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}@.' @@ -154,7 +155,7 @@ for c1 in gen.coll + gen.icoll + gen.ibarrier: # Generate the incorrect ordering with one collective replace = patterns.copy() - replace['shortdesc'] = 'Incorrect collective ordering' + replace['shortdesc'] = 'Incorrect' + shortdesc replace['longdesc'] = f'Odd ranks call {c1} while even ranks do not call any collective' replace['outcome'] = 'ERROR: CallMatching' replace['errormsg'] = 'Collective mistmatch. @{c1}@ at @{filename}@:@{line:MBIERROR1}@ is not matched.' @@ -170,7 +171,7 @@ for c1 in gen.coll + gen.icoll + gen.ibarrier: gen.make_file(template, f'CallOrdering_{c1}_none_nok.c', replace) # Generate a correct ordering with a conditional not depending on ranks replace = patterns.copy() - replace['shortdesc'] = 'Correct collective ordering' + replace['shortdesc'] = 'Correct' + shortdesc replace['longdesc'] = f'All ranks call {c1}' replace['outcome'] = 'OK' replace['errormsg'] = '' diff --git a/teshsuite/smpi/MBI/P2PLocalConcurrencyGenerator.py b/teshsuite/smpi/MBI/P2PLocalConcurrencyGenerator.py index 1316cc0d85..0f1812783b 100755 --- a/teshsuite/smpi/MBI/P2PLocalConcurrencyGenerator.py +++ b/teshsuite/smpi/MBI/P2PLocalConcurrencyGenerator.py @@ -101,25 +101,26 @@ for s in gen.send + gen.isend + gen.psend: patterns['write2'] = gen.write[r]("2") patterns['free1'] = gen.free[s]("1") patterns['free2'] = gen.free[r]("2") + shortdesc = ' Local Concurrency with a P2P' - # Generate a message race + # Gtenerate a message race if s in gen.send and r in gen.irecv + gen.precv: replace = patterns.copy() - replace['shortdesc'] = ' Local Concurrency with a P2P' + replace['shortdesc'] = shortdesc 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.' 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.copy() - replace['shortdesc'] = ' Local Concurrency with a P2P' + replace['shortdesc'] = shortdesc 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.' 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.copy() - replace['shortdesc'] = ' Local Concurrency with a P2P' + replace['shortdesc'] = shortdesc 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.' diff --git a/teshsuite/smpi/MBI/RMALocalLocalConcurrencyGenerator.py b/teshsuite/smpi/MBI/RMALocalLocalConcurrencyGenerator.py index 458fe211f8..a34c0ea41e 100755 --- a/teshsuite/smpi/MBI/RMALocalLocalConcurrencyGenerator.py +++ b/teshsuite/smpi/MBI/RMALocalLocalConcurrencyGenerator.py @@ -91,6 +91,7 @@ for e in gen.epoch: patterns['init1'] = gen.init[p1]("1") patterns['operation1'] = gen.operation[p1]("1") patterns['operation2'] = gen.operation[p2]("1") + shortdesc_rma = 'Correct code using RMA operations' # Generate a data race (Get + Get/load/store/Put) replace = patterns.copy() @@ -102,8 +103,8 @@ for e in gen.epoch: # Generate a correct code by switching operation1 and operation2 if p2 in gen.store + gen.load + gen.loadstore: replace = patterns.copy() - replace['shortdesc'] = 'Correct code using RMA operations' - replace['longdesc'] = 'Correct code using RMA operations' + replace['shortdesc'] = shortdesc_rma + replace['longdesc'] = shortdesc_rma replace['outcome'] = 'OK' replace['errormsg'] = 'OK' replace['operation1'] = gen.operation[p2]("1") @@ -111,8 +112,8 @@ for e in gen.epoch: gen.make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p2}_{p1}_ok.c', replace) # Generate a correct code by removing operation2 replace = patterns.copy() - replace['shortdesc'] = 'Correct code using RMA operations' - replace['longdesc'] = 'Correct code using RMA operations' + replace['shortdesc'] = shortdesc_rma + replace['longdesc'] = shortdesc_rma replace['outcome'] = 'OK' replace['errormsg'] = 'OK' replace['operation1'] = gen.operation[p1]("1") @@ -145,8 +146,8 @@ for e in gen.epoch: gen.make_file(template, f'LocalConcurrency_lloutwindow_{e}_{p1}_{p2}_nok.c', replace) # Generate a correct code by switching operation1 and operation2 replace = patterns.copy() - replace['shortdesc'] = 'Correct code using RMA operations' - replace['longdesc'] = 'Correct code using RMA operations' + replace['shortdesc'] = shortdesc_rma + replace['longdesc'] = shortdesc_rma replace['outcome'] = 'OK' replace['errormsg'] = 'OK' replace['operation1'] = gen.operation[p2]("1") @@ -155,8 +156,8 @@ for e in gen.epoch: # Generate a correct code by removing operation2 replace = patterns.copy() - replace['shortdesc'] = 'Correct code using RMA operations' - replace['longdesc'] = 'Correct code using RMA operations' + replace['shortdesc'] = shortdesc_rma + replace['longdesc'] = shortdesc_rma replace['outcome'] = 'OK' replace['errormsg'] = 'OK' replace['operation1'] = gen.operation[p1]("1")