# Run test
def runTest(command):
print "Running:", " ".join(command)
- p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- out, err = p.communicate()
- res = p.returncode
+ p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+ while True:
+ try:
+ out = p.stdout.readline()
+ sys.stdout.write(out)
+ except: # raised IOError or OSError if output is empty
+ pass
+
+ returncode = p.poll()
+ if not returncode is None:
+ sys.stdout.flush()
+ break
+ pass
+
# About res value:
# A negative value -N indicates that the child was terminated by signal N (Unix only).
# On Unix, the value 11 generally corresponds to a segmentation fault.
- return res, out, err
-#
-
-# Display output and errors
-def processResult(res, out, err):
- if out:
- print out
- pass
- if err:
- print " ** Detected error **"
- print "Error code: ", res
- print err,
- print " ** end of message **"
- pass
- return res
+ #return res, out, err
+ return p.returncode
#
# Timeout management
try:
salome_instance = SalomeInstance.start(shutdown_servers=True)
port = salome_instance.get_port()
- res, out, err = runTest(test_and_args)
- res = processResult(res, out, err)
+ res = runTest(test_and_args)
except TimeoutException:
print "FAILED : timeout(%s) is reached"%timeout_delay
except: