X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=bin%2Fappliskel%2Fsalome_tester%2Fsalome_test_driver.py;h=7b119d1765804d61475874548adc55737d26d484;hb=08ede0f3e66fb972c8f3373e204c47ac21f84e56;hp=f2a1fc5509f1ff3a65b02b769a98a61b8dc2a60c;hpb=b5c9bffce4d11ef32530fc81f5794b3ff14f4929;p=modules%2Fkernel.git diff --git a/bin/appliskel/salome_tester/salome_test_driver.py b/bin/appliskel/salome_tester/salome_test_driver.py index f2a1fc550..7b119d176 100644 --- a/bin/appliskel/salome_tester/salome_test_driver.py +++ b/bin/appliskel/salome_tester/salome_test_driver.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2015-2017 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -29,52 +29,12 @@ 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() + p = subprocess.Popen(command) + p.communicate() res = p.returncode # 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 -# - -def processResultSpecialParavis(res, out, err): - # :TRICKY: Special case of returncode=127 - # When using paraview in SALOME environment, the following error - # systematically appears when exiting paraview (it's also true when using - # PARAVIS and exiting SALOME): - # Inconsistency detected by ld.so: dl-close.c: 738: _dl_close: Assertion `map->l_init_called' failed! - # For PARAVIS tests purpose, paraview functionalities are accessed in each - # test; these tests are run in the above subprocess call. - # The assertion error implies a subprocess return code of 127, and the test - # status is considered as "failed". - # The tricky part here is to discard such return codes, waiting for a fix - # maybe in paraview... - if res == 127 and err.startswith("Inconsistency detected by ld.so: dl-close.c"): - print " ** THE FOLLOWING MESSAGE IS DISCARDED WHEN ANALYZING TEST SUCCESSFULNESS **" - print err, - print " ** end of message **" - res = 0 - elif err: - print " ** Detected error **" - print "Error code: ", res - print err, - print " ** end of message **" - pass - - if out: - print out - return res -# - -# Display output and errors -def processResult(res, out, err): - if out: - print out - pass - if err: - print err - print "Status code: ", res return res # @@ -94,7 +54,7 @@ if __name__ == "__main__": # first argument if not args: print "Invalid arguments for salome_test_driver.py. No command defined." - exit(1) + sys.exit(1) _, ext = os.path.splitext(args[0]) if ext == ".py": test_and_args = [sys.executable] + args @@ -112,7 +72,7 @@ if __name__ == "__main__": from threading import Timer timer = Timer(timeout_sec, timeoutHandler) timer.start() - else: + else: signal.alarm(timeout_sec) signal.signal(signal.SIGALRM, timeoutHandler) @@ -122,19 +82,19 @@ 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 = processResultSpecialParavis(res, out, err) + res = runTest(test_and_args) except TimeoutException: print "FAILED : timeout(%s) is reached"%timeout_delay except: import traceback traceback.print_exc() pass - - salome_instance.stop() + try: + salome_instance.stop() + except: + pass if sys.platform == 'win32': timer.cancel() print "Exit test with status code:", res - exit(res) + sys.exit(res) #