summaryrefslogtreecommitdiffstats
path: root/Tests/Server/cmakelib.py
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2017-06-21 19:26:09 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2017-08-13 21:20:11 (GMT)
commit9b3c5ccf1200e237c0bad3336235b9dde289f016 (patch)
tree190dd7de4056207246c0d8d1192b1117dc8d4f23 /Tests/Server/cmakelib.py
parent1df3875871af9aa3f144ab065479b98e255aca5a (diff)
downloadCMake-9b3c5ccf1200e237c0bad3336235b9dde289f016.zip
CMake-9b3c5ccf1200e237c0bad3336235b9dde289f016.tar.gz
CMake-9b3c5ccf1200e237c0bad3336235b9dde289f016.tar.bz2
Server: test cache after reconnect
Diffstat (limited to 'Tests/Server/cmakelib.py')
-rw-r--r--Tests/Server/cmakelib.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py
index 78450d5..2218e02 100644
--- a/Tests/Server/cmakelib.py
+++ b/Tests/Server/cmakelib.py
@@ -95,6 +95,21 @@ def initProc(cmakeCommand):
return cmakeCommand
+def exitProc(cmakeCommand):
+ # Tell the server to exit.
+ cmakeCommand.stdin.close()
+ cmakeCommand.stdout.close()
+
+ # Wait for the server to exit.
+ # If this version of python supports it, terminate the server after a timeout.
+ try:
+ cmakeCommand.wait(timeout=5)
+ except TypeError:
+ cmakeCommand.wait()
+ except:
+ cmakeCommand.terminate()
+ raise
+
def waitForMessage(cmakeCommand, expected):
data = ordered(expected)
packet = ordered(waitForRawMessage(cmakeCommand))
@@ -197,3 +212,27 @@ def validateGlobalSettings(cmakeCommand, cmakeCommandPath, data):
print("Validating", i)
if (packet[i] != data[i]):
sys.exit(1)
+
+def validateCache(cmakeCommand, data):
+ packet = waitForReply(cmakeCommand, 'cache', '', False)
+
+ cache = packet['cache']
+
+ if (data['isEmpty']):
+ if (cache != []):
+ print('Expected empty cache, but got data.\n')
+ sys.exit(1)
+ return;
+
+ if (cache == []):
+ print('Expected cache contents, but got none.\n')
+ sys.exit(1)
+
+ hadHomeDir = False
+ for value in cache:
+ if (value['key'] == 'CMAKE_HOME_DIRECTORY'):
+ hadHomeDir = True
+
+ if (not hadHomeDir):
+ print('No CMAKE_HOME_DIRECTORY found in cache.')
+ sys.exit(1)