summaryrefslogtreecommitdiffstats
path: root/Tests/Server/cmakelib.py
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-09-27 19:29:20 (GMT)
committerTobias Hunger <tobias.hunger@qt.io>2016-09-28 18:10:59 (GMT)
commit71a505870c1f5a4fc89a8ad4e4dc3bb008a35118 (patch)
treecbef01144873d1a80bd96344d20c52d48dbcb654 /Tests/Server/cmakelib.py
parent7b1e60f26e284e223be8638744ba3a3b0efdee63 (diff)
downloadCMake-71a505870c1f5a4fc89a8ad4e4dc3bb008a35118.zip
CMake-71a505870c1f5a4fc89a8ad4e4dc3bb008a35118.tar.gz
CMake-71a505870c1f5a4fc89a8ad4e4dc3bb008a35118.tar.bz2
server-mode: Add project data for unit tests
Do some basic unit tests for "codemodel", "cmakeInputs" and "cache" commands of the cmake server. This just calls the commands right now and makes sure the server thinks it can reply to the request. The data itself is currently not validated.
Diffstat (limited to 'Tests/Server/cmakelib.py')
-rw-r--r--Tests/Server/cmakelib.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py
index 8beaeef..94384eb 100644
--- a/Tests/Server/cmakelib.py
+++ b/Tests/Server/cmakelib.py
@@ -102,10 +102,20 @@ def waitForMessage(cmakeCommand, expected):
sys.exit(-1)
return packet
-def waitForReply(cmakeCommand, originalType, cookie):
- packet = waitForRawMessage(cmakeCommand)
- if packet['cookie'] != cookie or packet['type'] != 'reply' or packet['inReplyTo'] != originalType:
+def waitForReply(cmakeCommand, originalType, cookie, skipProgress):
+ gotResult = False
+ while True:
+ packet = waitForRawMessage(cmakeCommand)
+ t = packet['type']
+ if packet['cookie'] != cookie or packet['inReplyTo'] != originalType:
+ sys.exit(1)
+ if t == 'message' or t == 'progress':
+ if skipProgress:
+ continue
+ if t == 'reply':
+ break
sys.exit(1)
+
return packet
def waitForError(cmakeCommand, originalType, cookie, message):
@@ -126,10 +136,10 @@ def handshake(cmakeCommand, major, minor, source, build, generator, extraGenerat
writePayload(cmakeCommand, { 'type': 'handshake', 'protocolVersion': version,
'cookie': 'TEST_HANDSHAKE', 'sourceDirectory': source, 'buildDirectory': build,
'generator': generator, 'extraGenerator': extraGenerator })
- waitForReply(cmakeCommand, 'handshake', 'TEST_HANDSHAKE')
+ waitForReply(cmakeCommand, 'handshake', 'TEST_HANDSHAKE', False)
def validateGlobalSettings(cmakeCommand, cmakeCommandPath, data):
- packet = waitForReply(cmakeCommand, 'globalSettings', '')
+ packet = waitForReply(cmakeCommand, 'globalSettings', '', False)
capabilities = packet['capabilities']