Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[MBI] Fix string types.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 29 Mar 2022 19:46:26 +0000 (21:46 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 29 Mar 2022 21:13:09 +0000 (23:13 +0200)
teshsuite/smpi/MBI/CollArgGenerator.py
teshsuite/smpi/MBI/CollComGenerator.py
teshsuite/smpi/MBI/CollTopoGenerator.py
teshsuite/smpi/MBI/MBIutils.py
teshsuite/smpi/MBI/MissingWaitandStartGenerator.py
teshsuite/smpi/MBI/P2PMatchingANYSRCGenerator.py
teshsuite/smpi/MBI/generator_utils.py
teshsuite/smpi/MBI/simgrid.py

index 238394a..456deb7 100755 (executable)
@@ -123,7 +123,7 @@ for c in gen.coll4root + gen.icoll4root:
     # 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 */'
@@ -171,7 +171,7 @@ for c in gen.coll + gen.icoll:
         # 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 */'
@@ -209,7 +209,7 @@ for c in gen.coll4op + gen.icoll4op:
     # 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 */'
index 707e9f3..7ecfd2a 100755 (executable)
@@ -100,7 +100,7 @@ for c in gen.coll + gen.icoll + gen.ibarrier:
     # 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 */'
index ab54e52..6c7d267 100755 (executable)
@@ -122,4 +122,4 @@ for c in gen.tcoll4topo:
     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)
index 0ae264d..d7d4f34 100644 (file)
@@ -119,8 +119,8 @@ def parse_one_code(filename):
                     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'
@@ -166,32 +166,32 @@ def categorize(tool, toolname, test_id, expected):
     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)")
 
index 1691972..7c6a5ed 100755 (executable)
@@ -109,7 +109,7 @@ for s in gen.isend + gen.psend:
         # 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)
index 0c32f7c..5bdbe6c 100755 (executable)
@@ -102,7 +102,7 @@ for s in gen.send + gen.isend:
         # 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)
index 75e8673..086dfe5 100644 (file)
@@ -255,7 +255,7 @@ write['MPI_Ialltoallv'] = lambda n: f"rbuf{n}[0]++;"
 
 ### 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'
@@ -265,7 +265,7 @@ free['MPI_Comm_split'] = lambda n: ""
 
 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: ""
@@ -295,7 +295,7 @@ error['MPI_Comm_create'] = 'CommunicatorLeak'
 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]);"
@@ -346,7 +346,7 @@ write['MPI_Recv'] = lambda n: ""
 
 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: ""
@@ -404,7 +404,7 @@ init['store'] = lambda n: f'int localbuf{n}[N] = {{0}};'
 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];'
@@ -433,23 +433,23 @@ def make_file(template, filename, replace):
     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}")
 
index 947bcce..b7b0216 100644 (file)
@@ -76,7 +76,7 @@ class Tool(mbi.AbstractTool):
         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):