From: Christophe Bourcier Date: Fri, 8 Sep 2023 16:06:53 +0000 (+0200) Subject: Allow to detect SIGSEGV in test.hdfs X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d42c2dd7ae261441b5de194e03e72db672383bdc;p=modules%2Fshaper.git Allow to detect SIGSEGV in test.hdfs We test if test ends OK, since returncode is still 0, and SIGSEGV can occur on regular SALOME exit --- diff --git a/test.hdfs/testme.py b/test.hdfs/testme.py index ccff03b44..b12a94846 100644 --- a/test.hdfs/testme.py +++ b/test.hdfs/testme.py @@ -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: