From 3eba2011b9223b3946fb8a2ef06fb240af8bd208 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin <alexander.alekhin@itseez.com> Date: Sun, 6 Oct 2013 21:34:44 +0400 Subject: [PATCH] test: run.py: return valid errorCode in case of the single test run --- modules/ts/misc/run.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/ts/misc/run.py b/modules/ts/misc/run.py index a64127f0d..b09abb617 100755 --- a/modules/ts/misc/run.py +++ b/modules/ts/misc/run.py @@ -7,6 +7,8 @@ from subprocess import Popen, PIPE hostos = os.name # 'nt', 'posix' hostmachine = platform.machine() # 'x86', 'AMD64', 'x86_64' +errorCode = 0 + SIMD_DETECTION_PROGRAM=""" #if __SSE5__ # error SSE5 @@ -641,6 +643,8 @@ class TestSuite(object): return True def runTest(self, path, workingDir, _stdout, _stderr, args = []): + global errorCode + if self.error: return args = args[:] @@ -759,9 +763,9 @@ class TestSuite(object): print >> _stderr, "Run command:", " ".join(cmd) try: - Popen(cmd, stdout=_stdout, stderr=_stderr, cwd = self.java_test_binary_dir + "/.build").wait() - except OSError: - pass + errorCode = Popen(cmd, stdout=_stdout, stderr=_stderr, cwd = self.java_test_binary_dir + "/.build").wait() + except: + print "Unexpected error:", sys.exc_info()[0] return None else: @@ -777,9 +781,9 @@ class TestSuite(object): print >> _stderr, "Run command:", " ".join(cmd) try: - Popen(cmd, stdout=_stdout, stderr=_stderr, cwd = workingDir).wait() - except OSError: - pass + errorCode = Popen(cmd, stdout=_stdout, stderr=_stderr, cwd = workingDir).wait() + except: + print "Unexpected error:", sys.exc_info()[0] # clean temporary files if orig_temp_path: @@ -891,3 +895,7 @@ if __name__ == "__main__": if logs: print >> sys.stderr, "Collected: ", " ".join(logs) + + if errorCode != 0: + print "Error code: ", errorCode, (" (0x%x)" % (errorCode & 0xffffffff)) + exit(errorCode)