]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Allow to detect SIGSEGV in test.hdfs
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Fri, 8 Sep 2023 16:06:53 +0000 (18:06 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Fri, 8 Sep 2023 16:06:53 +0000 (18:06 +0200)
We test if test ends OK, since returncode is still 0, and SIGSEGV can occur on regular SALOME exit

test.hdfs/testme.py

index ccff03b4499634e08cd41a06e9f35d233878bc82..b12a9484658b07d28223496d96c4532f478aadd9 100644 (file)
@@ -25,6 +25,7 @@ if __name__ == '__main__':
   from time import sleep
   import sys, os
   import tempfile
+  import psutil
 
   testTimeout = 600
   if len(sys.argv) > 3:
@@ -43,20 +44,26 @@ if __name__ == '__main__':
   isOk = True
   error = ""
 
-  proc = subprocess.Popen(["runSalome.py", "--modules", "SHAPER,GEOM,SHAPERSTUDY", "--gui", "--splash", "0", "test_hdf.py", "args:" + hdffile + "," + testdatafile + "," + testlogfile], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+  proc = subprocess.Popen(["runSalome.py", "--modules", "SHAPER,GEOM,SHAPERSTUDY", "--gui", "--splash", "0", "test_hdf.py", "args:" + hdffile + "," + testdatafile + "," + testlogfile])
   try:
     proc.communicate(timeout = testTimeout)
-  except TimeoutExpired:
+  except subprocess.TimeoutExpired:
     isOk = False
     proc.kill()
-    out, err = proc.communicate()
     error = "Killed by CPU limit."
-    print(err)
+
+  assert isOk, "Test failed. {}".format(error)
 
   with open(testlogfile, 'r') as inputFile:
     s = inputFile.read()
-    print(s)
-    isOk = isOk and s.find("FAIL") < 0
+    #print("logfile: ", s)
+    if s.find("FAIL") > 0:
+      isOk = False
+      error = s
+    elif s.find("OK") < 0:
+      isOk = False
+      error = "Test not ended until OK. Maybe a SIGSEGV."
+
   try:
     os.remove(testlogfile)
   except: