Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MBI: display the expected diagnostic on error
[simgrid.git] / teshsuite / smpi / MBI / MBI.py
index 953e616..e04fc4e 100755 (executable)
@@ -1,6 +1,6 @@
 #! /usr/bin/env python3
 
-# Copyright 2021-2022. The SimGrid Team. All rights reserved. 
+# Copyright 2021-2022. The SimGrid Team. All rights reserved.
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
@@ -10,8 +10,8 @@
 import sys
 import os
 
-from MBIutils import *
-import simgrid
+import MBIutils as mbi
+import simgrid as sg
 
 if len(sys.argv) != 4:
     print(f"Usage: MBI.py binary source (received: {sys.argv})")
@@ -26,23 +26,22 @@ if not os.path.exists("cluster.xml"):
         outfile.write('</platform>\n')
 
 
-simgrid = simgrid.Tool()
+simgrid = sg.Tool()
 
 (name, path, binary, filename) = sys.argv
-for test in parse_one_code(filename):
-    execcmd = test['cmd'].replace("mpirun", f"{path}/smpi_script/bin/smpirun -wrapper '{path}/bin/simgrid-mc --log=mc_safety.t:info' -platform ./cluster.xml -analyze --cfg=smpi/finalization-barrier:on --cfg=smpi/list-leaks:10 --cfg=model-check/max-depth:10000 --cfg=smpi/pedantic:true")
+for test in mbi.parse_one_code(filename):
+    execcmd = test['cmd'].replace("mpirun", f"{path}/smpi_script/bin/smpirun -wrapper '{path}/bin/simgrid-mc --log=mc_safety.t:info' -platform ./cluster.xml -analyze --cfg=smpi/barrier-finalization:on --cfg=smpi/list-leaks:10 --cfg=model-check/max-depth:10000")
     execcmd = execcmd.replace('${EXE}', binary)
     execcmd = execcmd.replace('$zero_buffer', "--cfg=smpi/buffering:zero")
     execcmd = execcmd.replace('$infty_buffer', "--cfg=smpi/buffering:infty")
 
     if os.path.exists(f'{filename}.txt'):
         os.remove(f'{filename}.txt')
-    run_cmd(buildcmd="", execcmd=execcmd, cachefile=filename, filename=filename, binary=binary, timeout=300, batchinfo="", read_line_lambda=None)
-    outcome = simgrid.parse(filename)
+    mbi.run_cmd(buildcmd="", execcmd=execcmd, cachefile=filename, filename=filename, binary=binary, timeout=300, batchinfo="", read_line_lambda=None)
 
-    (res_category, elapsed, diagnostic, outcome) = categorize(simgrid, "simgrid", filename, test['expect'])
+    (res_category, elapsed, diagnostic, outcome) = mbi.categorize(simgrid, "simgrid", filename, test['expect'])
 
     if res_category != "TRUE_NEG" and res_category != "TRUE_POS":
         print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n")
-        print(f"SimGrid gave the wrong result ({outcome} instead of {test['expect']}).")
+        print(f"SimGrid gave the wrong result on {binary} ({outcome} instead of {test['detail']}).\nExpected diagnostic: {test['diagnostic']}")
         sys.exit(1)