From 0cebfc8ddb509fbf5f865bb660b73e96680b3f65 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 20 Feb 2012 22:03:14 +0600 Subject: [PATCH] tests: kill process group on failure Test suite is often leaving `stray` processes on failure. They are harmless, but may cause future test runs fail because those `stray` processes are occupying `common.PORT` or due to some other reasons. Killing whole process group on test suite failure should help in such cases. --- tools/test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/test.py b/tools/test.py index b0cd9abcd2..eed3c65a98 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1437,4 +1437,10 @@ def Main(): if __name__ == '__main__': - sys.exit(Main()) + ret = 0 + try: + ret = Main() + sys.exit(ret) + finally: + if ret and not utils.IsWindows(): + os.killpg(0, signal.SIGKILL)