diff options
author | Justin Berger <j.david.berger@gmail.com> | 2017-09-04 01:56:01 (GMT) |
---|---|---|
committer | Justin Berger <j.david.berger@gmail.com> | 2017-11-01 17:30:35 (GMT) |
commit | d46b4ba83532d8954e473a26112288cd8e693775 (patch) | |
tree | 98307f21709b493f29afe5240893a37de3243bcb /Tests/Server/server-test.py | |
parent | 08dca58358c95a41615150513a006379c4ee7825 (diff) | |
download | CMake-d46b4ba83532d8954e473a26112288cd8e693775.zip CMake-d46b4ba83532d8954e473a26112288cd8e693775.tar.gz CMake-d46b4ba83532d8954e473a26112288cd8e693775.tar.bz2 |
server: Updated server tests to try various communication channels
Diffstat (limited to 'Tests/Server/server-test.py')
-rw-r--r-- | Tests/Server/server-test.py | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/Tests/Server/server-test.py b/Tests/Server/server-test.py index f3c3fc2..701c6e9 100644 --- a/Tests/Server/server-test.py +++ b/Tests/Server/server-test.py @@ -19,87 +19,87 @@ if os.path.exists(buildDir): cmakelib.filterBase = sourceDir -proc = cmakelib.initServerProc(cmakeCommand) - with open(testFile) as f: testData = json.loads(f.read()) -for obj in testData: - if cmakelib.handleBasicMessage(proc, obj, debug): - pass - elif 'reply' in obj: - data = obj['reply'] - if debug: print("Waiting for reply:", json.dumps(data)) - originalType = "" - cookie = "" - skipProgress = False; - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'skipProgress' in data: skipProgress = data['skipProgress'] - cmakelib.waitForReply(proc, originalType, cookie, skipProgress) - elif 'error' in obj: - data = obj['error'] - if debug: print("Waiting for error:", json.dumps(data)) - originalType = "" - cookie = "" - message = "" - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'message' in data: message = data['message'] - cmakelib.waitForError(proc, originalType, cookie, message) - elif 'progress' in obj: - data = obj['progress'] - if debug: print("Waiting for progress:", json.dumps(data)) - originalType = '' - cookie = "" - current = 0 - message = "" - if 'cookie' in data: cookie = data['cookie'] - if 'type' in data: originalType = data['type'] - if 'current' in data: current = data['current'] - if 'message' in data: message = data['message'] - cmakelib.waitForProgress(proc, originalType, cookie, current, message) - elif 'handshake' in obj: - data = obj['handshake'] - if debug: print("Doing handshake:", json.dumps(data)) - major = -1 - minor = -1 - generator = cmakeGenerator - extraGenerator = '' - sourceDirectory = sourceDir - buildDirectory = buildDir - if 'major' in data: major = data['major'] - if 'minor' in data: minor = data['minor'] - if 'buildDirectory' in data: buildDirectory = data['buildDirectory'] - if 'sourceDirectory' in data: sourceDirectory = data['sourceDirectory'] - if 'generator' in data: generator = data['generator'] - if 'extraGenerator' in data: extraGenerator = data['extraGenerator'] - if not os.path.isabs(buildDirectory): - buildDirectory = buildDir + "/" + buildDirectory - if sourceDirectory != '' and not os.path.isabs(sourceDirectory): - sourceDirectory = sourceDir + "/" + sourceDirectory - cmakelib.handshake(proc, major, minor, sourceDirectory, buildDirectory, - generator, extraGenerator) - elif 'validateGlobalSettings' in obj: - data = obj['validateGlobalSettings'] - if not 'buildDirectory' in data: data['buildDirectory'] = buildDir - if not 'sourceDirectory' in data: data['sourceDirectory'] = sourceDir - if not 'generator' in data: data['generator'] = cmakeGenerator - if not 'extraGenerator' in data: data['extraGenerator'] = '' - cmakelib.validateGlobalSettings(proc, cmakeCommand, data) - elif 'validateCache' in obj: - data = obj['validateCache'] - if not 'isEmpty' in data: data['isEmpty'] = false - cmakelib.validateCache(proc, data) - elif 'message' in obj: - print("MESSAGE:", obj["message"]) - elif 'reconnect' in obj: - cmakelib.exitProc(proc) - proc = cmakelib.initServerProc(cmakeCommand) - else: - print("Unknown command:", json.dumps(obj)) - sys.exit(2) +for communicationMethod in cmakelib.communicationMethods: + proc = cmakelib.initServerProc(cmakeCommand, communicationMethod) + if proc is None: + continue - print("Completed") + for obj in testData: + if cmakelib.handleBasicMessage(proc, obj, debug): + pass + elif 'reply' in obj: + data = obj['reply'] + if debug: print("Waiting for reply:", json.dumps(data)) + originalType = "" + cookie = "" + skipProgress = False; + if 'cookie' in data: cookie = data['cookie'] + if 'type' in data: originalType = data['type'] + if 'skipProgress' in data: skipProgress = data['skipProgress'] + cmakelib.waitForReply(proc, originalType, cookie, skipProgress) + elif 'error' in obj: + data = obj['error'] + if debug: print("Waiting for error:", json.dumps(data)) + originalType = "" + cookie = "" + message = "" + if 'cookie' in data: cookie = data['cookie'] + if 'type' in data: originalType = data['type'] + if 'message' in data: message = data['message'] + cmakelib.waitForError(proc, originalType, cookie, message) + elif 'progress' in obj: + data = obj['progress'] + if debug: print("Waiting for progress:", json.dumps(data)) + originalType = '' + cookie = "" + current = 0 + message = "" + if 'cookie' in data: cookie = data['cookie'] + if 'type' in data: originalType = data['type'] + if 'current' in data: current = data['current'] + if 'message' in data: message = data['message'] + cmakelib.waitForProgress(proc, originalType, cookie, current, message) + elif 'handshake' in obj: + data = obj['handshake'] + if debug: print("Doing handshake:", json.dumps(data)) + major = -1 + minor = -1 + generator = cmakeGenerator + extraGenerator = '' + sourceDirectory = sourceDir + buildDirectory = buildDir + if 'major' in data: major = data['major'] + if 'minor' in data: minor = data['minor'] + if 'buildDirectory' in data: buildDirectory = data['buildDirectory'] + if 'sourceDirectory' in data: sourceDirectory = data['sourceDirectory'] + if 'generator' in data: generator = data['generator'] + if 'extraGenerator' in data: extraGenerator = data['extraGenerator'] -cmakelib.shutdownProc(proc) + if not os.path.isabs(buildDirectory): + buildDirectory = buildDir + "/" + buildDirectory + if sourceDirectory != '' and not os.path.isabs(sourceDirectory): + sourceDirectory = sourceDir + "/" + sourceDirectory + cmakelib.handshake(proc, major, minor, sourceDirectory, buildDirectory, + generator, extraGenerator) + elif 'validateGlobalSettings' in obj: + data = obj['validateGlobalSettings'] + if not 'buildDirectory' in data: data['buildDirectory'] = buildDir + if not 'sourceDirectory' in data: data['sourceDirectory'] = sourceDir + if not 'generator' in data: data['generator'] = cmakeGenerator + if not 'extraGenerator' in data: data['extraGenerator'] = '' + cmakelib.validateGlobalSettings(proc, cmakeCommand, data) + elif 'validateCache' in obj: + data = obj['validateCache'] + if not 'isEmpty' in data: data['isEmpty'] = false + cmakelib.validateCache(proc, data) + elif 'reconnect' in obj: + cmakelib.exitProc(proc) + proc = cmakelib.initServerProc(cmakeCommand, communicationMethod) + else: + print("Unknown command:", json.dumps(obj)) + sys.exit(2) + cmakelib.shutdownProc(proc) + print("Completed") |