from time import sleep
import sys, os
import tempfile
+ import psutil
testTimeout = 600
if len(sys.argv) > 3:
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: