X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=bin%2FrunTests.py;h=31f662576f2c546da86da1d08b8cc7e2b8743e78;hb=8764993ca8f4c49e9115a82431facec577aba8a5;hp=0013129ea3e6144a331aeebdcd8257a5df042e6e;hpb=49768d63ac3882a4d35d56bc0f8826f2cd3bd762;p=modules%2Fkernel.git diff --git a/bin/runTests.py b/bin/runTests.py index 0013129ea..31f662576 100644 --- a/bin/runTests.py +++ b/bin/runTests.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 @@ -65,7 +65,7 @@ For complete description of available options, pleaser refer to ctest documentat return [] if args[0] in ["-h", "--help"]: - print usage + epilog + print(usage + epilog) sys.exit(0) return args @@ -74,37 +74,6 @@ For complete description of available options, pleaser refer to ctest documentat # tests must be in ${ABSOLUTE_APPLI_PATH}/${__testSubDir}/ __testSubDir = "bin/salome/test" -# Both display process stdout&stderr to console and capture them to variables -def __runTest(command, workdir): - p = subprocess.Popen(command, cwd=workdir, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) - stdout = [] - stderr = [] - - while True: - reads = [p.stdout.fileno(), p.stderr.fileno()] - ret = select.select(reads, [], [], 0) - - for fd in ret[0]: - if fd == p.stdout.fileno(): - read = p.stdout.readline() - sys.stdout.write(read) - stdout.append(read) - pass - if fd == p.stderr.fileno(): - read = p.stderr.readline() - sys.stderr.write(read) - stderr.append(read) - pass - pass - - returncode = p.poll() - if not returncode is None: - break - pass - - return p.returncode, "".join(stdout), "".join(stderr) -# - def runTests(args, exe=None): args = __configureTests(args, exe) @@ -115,7 +84,7 @@ def runTests(args, exe=None): testPath = os.path.join(appliPath, __testSubDir) command = ["ctest"] + args - res, out, err = __runTest(command, testPath) - - sys.exit(res) + p = subprocess.Popen(command, cwd=testPath) + p.communicate() + return p.returncode #