From: Cédric Aguerre Date: Tue, 24 May 2016 14:16:23 +0000 (+0200) Subject: Homogeneize test process call X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3b1867c023be891bb15ede04e79f5d81e319c9b3;p=modules%2Fkernel.git Homogeneize test process call --- diff --git a/bin/appliskel/salome_tester/salome_test_driver.py b/bin/appliskel/salome_tester/salome_test_driver.py index 068bf89a0..71f1629bd 100644 --- a/bin/appliskel/salome_tester/salome_test_driver.py +++ b/bin/appliskel/salome_tester/salome_test_driver.py @@ -29,27 +29,26 @@ import signal # 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 @@ -96,8 +95,7 @@ if __name__ == "__main__": 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: