summaryrefslogtreecommitdiffstats
path: root/Tests/Server
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-30 13:36:57 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-30 13:36:57 (GMT)
commitd56f9237d7205cbc2db24fa5fbdc27000454291f (patch)
treee4903550e553478d0905137ea9e65a675bc95a25 /Tests/Server
parent8491a539cf316f14abaf70d7be04f8929119e501 (diff)
downloadCMake-d56f9237d7205cbc2db24fa5fbdc27000454291f.zip
CMake-d56f9237d7205cbc2db24fa5fbdc27000454291f.tar.gz
CMake-d56f9237d7205cbc2db24fa5fbdc27000454291f.tar.bz2
Tests: Teach Server test to wait for server exit
We expect the server to exit when its communication pipes are closed. Close them and wait for the server to exit. If supported by the current version of python, kill the server if it does not exit after a few seconds.
Diffstat (limited to 'Tests/Server')
-rw-r--r--Tests/Server/server-test.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/Server/server-test.py b/Tests/Server/server-test.py
index 72f82ba..14767f4 100644
--- a/Tests/Server/server-test.py
+++ b/Tests/Server/server-test.py
@@ -102,4 +102,18 @@ for obj in testData:
print("Completed")
+# Tell the server to exit.
+proc.stdin.close()
+proc.stdout.close()
+
+# Wait for the server to exit.
+# If this version of python supports it, terminate the server after a timeout.
+try:
+ proc.wait(timeout=5)
+except TypeError:
+ proc.wait()
+except:
+ proc.terminate()
+ raise
+
sys.exit(0)