diff options
Diffstat (limited to 'Tests/Server')
-rw-r--r-- | Tests/Server/CMakeLists.txt | 28 | ||||
-rw-r--r-- | Tests/Server/buildsystem1/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/Server/buildsystem1/foo.cpp | 5 | ||||
-rw-r--r-- | Tests/Server/buildsystem1/main.cpp | 5 | ||||
-rw-r--r-- | Tests/Server/buildsystem1/subdir/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/Server/buildsystem1/subdir/empty.cpp | 5 | ||||
-rw-r--r-- | Tests/Server/cmakelib.py | 380 | ||||
-rw-r--r-- | Tests/Server/empty.cpp | 5 | ||||
-rw-r--r-- | Tests/Server/server-test.py | 105 | ||||
-rw-r--r-- | Tests/Server/tc_buildsystem1.json | 27 | ||||
-rw-r--r-- | Tests/Server/tc_cache.json | 24 | ||||
-rw-r--r-- | Tests/Server/tc_globalSettings.json | 140 | ||||
-rw-r--r-- | Tests/Server/tc_handshake.json | 75 |
13 files changed, 0 insertions, 826 deletions
diff --git a/Tests/Server/CMakeLists.txt b/Tests/Server/CMakeLists.txt deleted file mode 100644 index 8321edb..0000000 --- a/Tests/Server/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(Server CXX) - -find_package(Python REQUIRED) - -macro(do_test bsname file type) - execute_process(COMMAND ${Python_EXECUTABLE} - -B # no .pyc files - "${CMAKE_SOURCE_DIR}/${type}-test.py" - "${CMAKE_COMMAND}" - "${CMAKE_SOURCE_DIR}/${file}" - "${CMAKE_SOURCE_DIR}" - "${CMAKE_BINARY_DIR}" - "${CMAKE_GENERATOR}" - RESULT_VARIABLE test_result - ) - - if (NOT test_result EQUAL 0) - message(SEND_ERROR "TEST FAILED: ${test_result}") - endif() -endmacro() - -do_test("test_cache" "tc_cache.json" "server") -do_test("test_handshake" "tc_handshake.json" "server") -do_test("test_globalSettings" "tc_globalSettings.json" "server") -do_test("test_buildsystem1" "tc_buildsystem1.json" "server") - -add_executable(Server empty.cpp) diff --git a/Tests/Server/buildsystem1/CMakeLists.txt b/Tests/Server/buildsystem1/CMakeLists.txt deleted file mode 100644 index d690472..0000000 --- a/Tests/Server/buildsystem1/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 3.4) - -project(buildsystem2) - -set(var1 123) - -set(var2 345) - -add_executable(main main.cpp) - -add_executable(m_other main.cpp) - -add_library(foo foo.cpp) - -function(f1) -endfunction() - -set(var3 345) - -add_library(someImportedLib UNKNOWN IMPORTED) - -add_subdirectory(subdir) diff --git a/Tests/Server/buildsystem1/foo.cpp b/Tests/Server/buildsystem1/foo.cpp deleted file mode 100644 index 7f39d71..0000000 --- a/Tests/Server/buildsystem1/foo.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int foo() -{ - return 0; -} diff --git a/Tests/Server/buildsystem1/main.cpp b/Tests/Server/buildsystem1/main.cpp deleted file mode 100644 index 766b775..0000000 --- a/Tests/Server/buildsystem1/main.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/Server/buildsystem1/subdir/CMakeLists.txt b/Tests/Server/buildsystem1/subdir/CMakeLists.txt deleted file mode 100644 index 9157312..0000000 --- a/Tests/Server/buildsystem1/subdir/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(bar4 something) - -set(bar5 more) - -add_executable(ooo empty.cpp) diff --git a/Tests/Server/buildsystem1/subdir/empty.cpp b/Tests/Server/buildsystem1/subdir/empty.cpp deleted file mode 100644 index 7f39d71..0000000 --- a/Tests/Server/buildsystem1/subdir/empty.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int foo() -{ - return 0; -} diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py deleted file mode 100644 index 546ae4c..0000000 --- a/Tests/Server/cmakelib.py +++ /dev/null @@ -1,380 +0,0 @@ -from __future__ import print_function -import sys, subprocess, json, os, select, shutil, time, socket - -termwidth = 150 - -print_communication = True - -def ordered(obj): - if isinstance(obj, dict): - return sorted((k, ordered(v)) for k, v in obj.items()) - if isinstance(obj, list): - return sorted(ordered(x) for x in obj) - else: - return obj - -def col_print(title, array): - print() - print() - print(title) - - indentwidth = 4 - indent = " " * indentwidth - - if not array: - print(indent + "<None>") - return - - padwidth = 2 - - maxitemwidth = len(max(array, key=len)) - - numCols = max(1, int((termwidth - indentwidth + padwidth) / (maxitemwidth + padwidth))) - - numRows = len(array) // numCols + 1 - - pad = " " * padwidth - - for index in range(numRows): - print(indent + pad.join(item.ljust(maxitemwidth) for item in array[index::numRows])) - -filterPacket = lambda x: x - -STDIN = 0 -PIPE = 1 - -communicationMethods = [STDIN] - -if hasattr(socket, 'AF_UNIX'): - communicationMethods.append(PIPE) - -def defaultExitWithError(proc): - data = "" - try: - while select.select([proc.outPipe], [], [], 3.)[0]: - data = data + proc.outPipe.read(1) - if len(data): - print("Rest of raw buffer from server:") - printServer(data) - except: - pass - proc.outPipe.close() - proc.inPipe.close() - proc.kill() - sys.exit(1) - -exitWithError = lambda proc: defaultExitWithError(proc) - -serverTag = "SERVER" - -def printServer(*args): - print(serverTag + ">", *args) - print() - sys.stdout.flush() - -def printClient(*args): - print("CLIENT>", *args) - print() - sys.stdout.flush() - -def waitForRawMessage(cmakeCommand): - stdoutdata = "" - payload = "" - while not cmakeCommand.poll(): - stdoutdataLine = cmakeCommand.outPipe.readline() - if stdoutdataLine: - stdoutdata += stdoutdataLine.decode('utf-8') - else: - break - begin = stdoutdata.find('[== "CMake Server" ==[\n') - end = stdoutdata.find(']== "CMake Server" ==]') - - if begin != -1 and end != -1: - begin += len('[== "CMake Server" ==[\n') - payload = stdoutdata[begin:end] - jsonPayload = json.loads(payload) - filteredPayload = filterPacket(jsonPayload) - if print_communication and filteredPayload: - printServer(filteredPayload) - if filteredPayload is not None or jsonPayload is None: - return jsonPayload - stdoutdata = stdoutdata[(end+len(']== "CMake Server" ==]')):] - -# Python2 has no problem writing the output of encodes directly, -# but Python3 returns only 'int's for encode and so must be turned -# into bytes. We use the existence of 'to_bytes' on an int to -# determine which behavior is appropriate. It might be more clear -# to do this in the code which uses the flag, but introducing -# this lookup cost at every byte sent isn't ideal. -has_to_bytes = "to_bytes" in dir(10) - -def writeRawData(cmakeCommand, content): - writeRawData.counter += 1 - payload = """ -[== "CMake Server" ==[ -%s -]== "CMake Server" ==] -""" % content - - rn = ( writeRawData.counter % 2 ) == 0 - - if rn: - payload = payload.replace('\n', '\r\n') - - if print_communication: - printClient(content, "(Use \\r\\n:", rn, ")") - - # To stress test how cmake deals with fragmentation in the - # communication channel, we send only one byte at a time. - # Certain communication methods / platforms might still buffer - # it all into one message since its so close together, but in - # general this will catch places where we assume full buffers - # come in all at once. - encoded_payload = payload.encode('utf-8') - - # Python version 3+ can't write ints directly; but 'to_bytes' - # for int was only added in python 3.2. If this is a 3+ version - # of python without that conversion function; just write the whole - # thing out at once. - if sys.version_info[0] > 2 and not has_to_bytes: - cmakeCommand.write(encoded_payload) - else: - for c in encoded_payload: - if has_to_bytes: - c = c.to_bytes(1, byteorder='big') - cmakeCommand.write(c) - -writeRawData.counter = 0 - -def writePayload(cmakeCommand, obj): - writeRawData(cmakeCommand, json.dumps(obj)) - -def getPipeName(): - return "/tmp/server-test-socket" - -def attachPipe(cmakeCommand, pipeName): - time.sleep(1) - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - sock.connect(pipeName) - global serverTag - serverTag = "SERVER(PIPE)" - cmakeCommand.outPipe = sock.makefile() - cmakeCommand.inPipe = sock - cmakeCommand.write = cmakeCommand.inPipe.sendall - -def writeAndFlush(pipe, val): - pipe.write(val) - pipe.flush() - -def initServerProc(cmakeCommand, comm): - if comm == PIPE: - pipeName = getPipeName() - cmakeCommand = subprocess.Popen([cmakeCommand, "-E", "server", "--experimental", "--pipe=" + pipeName]) - attachPipe(cmakeCommand, pipeName) - else: - cmakeCommand = subprocess.Popen([cmakeCommand, "-E", "server", "--experimental", "--debug"], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - cmakeCommand.outPipe = cmakeCommand.stdout - cmakeCommand.inPipe = cmakeCommand.stdin - cmakeCommand.write = lambda val: writeAndFlush(cmakeCommand.inPipe, val) - - packet = waitForRawMessage(cmakeCommand) - if packet == None: - print("Not in server mode") - sys.exit(2) - - if packet['type'] != 'hello': - print("No hello message") - sys.exit(3) - - 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)) - - if packet != data: - print ("Received unexpected message; test failed") - exitWithError(cmakeCommand) - return packet - -def waitForReply(cmakeCommand, originalType, cookie, skipProgress): - gotResult = False - while True: - packet = waitForRawMessage(cmakeCommand) - t = packet['type'] - if packet['cookie'] != cookie or packet['inReplyTo'] != originalType: - print("cookie or inReplyTo mismatch") - sys.exit(4) - if t == 'message' or t == 'progress': - if skipProgress: - continue - if t == 'reply': - break - print("Unrecognized message", packet) - sys.exit(5) - - return packet - -def waitForError(cmakeCommand, originalType, cookie, message): - packet = waitForRawMessage(cmakeCommand) - if packet['cookie'] != cookie or packet['type'] != 'error' or packet['inReplyTo'] != originalType or packet['errorMessage'] != message: - sys.exit(6) - -def waitForProgress(cmakeCommand, originalType, cookie, current, message): - packet = waitForRawMessage(cmakeCommand) - if packet['cookie'] != cookie or packet['type'] != 'progress' or packet['inReplyTo'] != originalType or packet['progressCurrent'] != current or packet['progressMessage'] != message: - sys.exit(7) - -def handshake(cmakeCommand, major, minor, source, build, generator, extraGenerator): - version = { 'major': major } - if minor >= 0: - version['minor'] = minor - - writePayload(cmakeCommand, { 'type': 'handshake', 'protocolVersion': version, - 'cookie': 'TEST_HANDSHAKE', 'sourceDirectory': source, 'buildDirectory': build, - 'generator': generator, 'extraGenerator': extraGenerator }) - waitForReply(cmakeCommand, 'handshake', 'TEST_HANDSHAKE', False) - -def validateGlobalSettings(cmakeCommand, cmakeCommandPath, data): - packet = waitForReply(cmakeCommand, 'globalSettings', '', False) - - capabilities = packet['capabilities'] - - # validate version: - cmakeoutput = subprocess.check_output([ cmakeCommandPath, "--version" ], universal_newlines=True) - cmakeVersion = cmakeoutput.splitlines()[0][14:] - - version = capabilities['version'] - versionString = version['string'] - vs = str(version['major']) + '.' + str(version['minor']) + '.' + str(version['patch']) - if (versionString != vs and not versionString.startswith(vs + '-')): - sys.exit(8) - if (versionString != cmakeVersion): - sys.exit(9) - - # validate generators: - generatorObjects = capabilities['generators'] - - cmakeoutput = subprocess.check_output([ cmakeCommandPath, "--help" ], universal_newlines=True) - index = cmakeoutput.index('\nGenerators\n\n') - cmakeGenerators = [] - for line in cmakeoutput[index + 12:].splitlines(): - if not line: - continue - if line[0] == '*': # default generator marker - line = ' ' + line[1:] - if not line.startswith(' '): - continue - if line.startswith(' '): - continue - equalPos = line.find('=') - tmp = '' - if (equalPos > 0): - tmp = line[2:equalPos].strip() - else: - tmp = line.strip() - if tmp.endswith(" [arch]"): - tmp = tmp[0:len(tmp) - 7] - if (len(tmp) > 0) and (" - " not in tmp): - cmakeGenerators.append(tmp) - - generators = [] - for genObj in generatorObjects: - generators.append(genObj['name']) - - generators.sort() - cmakeGenerators.sort() - - for gen in cmakeGenerators: - if (not gen in generators): - sys.exit(10) - - gen = packet['generator'] - if (gen != '' and not (gen in generators)): - sys.exit(11) - - for i in data: - print("Validating", i) - if (packet[i] != data[i]): - sys.exit(12) - -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) - -def handleBasicMessage(proc, obj, debug): - if 'sendRaw' in obj: - data = obj['sendRaw'] - if debug: print("Sending raw:", data) - writeRawData(proc, data) - return True - elif 'send' in obj: - data = obj['send'] - if debug: print("Sending:", json.dumps(data)) - writePayload(proc, data) - return True - elif 'recv' in obj: - data = obj['recv'] - if debug: print("Waiting for:", json.dumps(data)) - waitForMessage(proc, data) - return True - elif 'message' in obj: - print("MESSAGE:", obj["message"]) - sys.stdout.flush() - return True - return False - -def shutdownProc(proc): - # Tell the server to exit. - proc.inPipe.close() - proc.outPipe.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 - - print('cmake-server exited: %d' % proc.returncode) - sys.exit(proc.returncode) diff --git a/Tests/Server/empty.cpp b/Tests/Server/empty.cpp deleted file mode 100644 index 766b775..0000000 --- a/Tests/Server/empty.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/Server/server-test.py b/Tests/Server/server-test.py deleted file mode 100644 index 701c6e9..0000000 --- a/Tests/Server/server-test.py +++ /dev/null @@ -1,105 +0,0 @@ -from __future__ import print_function -import sys, cmakelib, json, os, shutil - -debug = True - -cmakeCommand = sys.argv[1] -testFile = sys.argv[2] -sourceDir = sys.argv[3] -buildDir = sys.argv[4] + "/" + os.path.splitext(os.path.basename(testFile))[0] -cmakeGenerator = sys.argv[5] - -print("Server Test:", testFile, - "\n-- SourceDir:", sourceDir, - "\n-- BuildDir:", buildDir, - "\n-- Generator:", cmakeGenerator) - -if os.path.exists(buildDir): - shutil.rmtree(buildDir) - -cmakelib.filterBase = sourceDir - -with open(testFile) as f: - testData = json.loads(f.read()) - -for communicationMethod in cmakelib.communicationMethods: - proc = cmakelib.initServerProc(cmakeCommand, communicationMethod) - if proc is None: - continue - - 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 '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") diff --git a/Tests/Server/tc_buildsystem1.json b/Tests/Server/tc_buildsystem1.json deleted file mode 100644 index 08831b7..0000000 --- a/Tests/Server/tc_buildsystem1.json +++ /dev/null @@ -1,27 +0,0 @@ -[ -{ "message": "Testing globalSettings" }, - -{ "handshake": {"major": 1, "sourceDirectory":"buildsystem1","buildDirectory":"buildsystem1"} }, - -{ "message": "Configure:" }, -{ "send": { "type": "configure", "cookie":"CONFIG" } }, -{ "reply": { "type": "configure", "cookie":"CONFIG", "skipProgress":true } }, - -{ "message": "Compute:" }, -{ "send": { "type": "compute", "cookie":"COMPUTE" } }, -{ "reply": { "type": "compute", "cookie":"COMPUTE", "skipProgress":true } }, - -{ "message": "Codemodel:" }, -{ "send": { "type": "codemodel", "cookie":"CODEMODEL" } }, -{ "reply": { "type": "codemodel", "cookie":"CODEMODEL" } }, - -{ "message": "CMake Inputs:"}, -{ "send": { "type": "cmakeInputs", "cookie":"INPUTS" } }, -{ "reply": { "type": "cmakeInputs", "cookie":"INPUTS" } }, - -{ "message": "Cache:"}, -{ "send": { "type": "cache", "cookie":"CACHE" } }, -{ "reply": { "type": "cache", "cookie":"CACHE" } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_cache.json b/Tests/Server/tc_cache.json deleted file mode 100644 index 74af6d9..0000000 --- a/Tests/Server/tc_cache.json +++ /dev/null @@ -1,24 +0,0 @@ -[ -{ "message": "Testing cache" }, - -{ "message": "Cache after first handshake is empty:" }, -{ "handshake": {"major": 1, "sourceDirectory": "buildsystem1", "buildDirectory": "buildsystem1"} }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": true } }, - -{ "message": "Cache after configure is populated:" }, -{ "send": { "type": "configure" } }, -{ "reply": { "type": "configure", "skipProgress":true } }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": false } }, - -{ "message": "Handshake for existing cache requires buildDirectory only:" }, -{ "reconnect": {} }, -{ "handshake": {"major": 1, "sourceDirectory": "", "buildDirectory": "buildsystem1"} }, - -{ "message": "Cache after reconnect is again populated:" }, -{ "send": { "type": "cache" } }, -{ "validateCache": { "isEmpty": false } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_globalSettings.json b/Tests/Server/tc_globalSettings.json deleted file mode 100644 index d72fb41..0000000 --- a/Tests/Server/tc_globalSettings.json +++ /dev/null @@ -1,140 +0,0 @@ -[ -{ "message": "Testing globalSettings" }, - -{ "handshake": {"major": 1} }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - - - -{ "message": "Change settings:" }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": true, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": true, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "traceExpand": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": true, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "traceExpand": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - - - -{ "send": { "type": "setGlobalSettings", "trace": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": true, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "trace": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnusedCli": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": false, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnusedCli": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "checkSystemVars": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": true } }, - -{ "send": { "type": "setGlobalSettings", "checkSystemVars": false } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": false, "debugOutput": false, "warnUninitialized": false, "traceExpand": false, "trace": false, "warnUnusedCli": true, "checkSystemVars": false } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Ignore unknown/readonly" }, - -{ "send": { "type": "setGlobalSettings", "unknownKey": "unknownValue", "extraGenerator": "XXX", "generator": "YYY", "sourceDirectory": "/tmp/source", "buildDirectory": "/tmp/build" } }, -{ "reply": { "type": "setGlobalSettings" } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Error paths:" }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true, "warnUnused": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUnused\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"debugOutput\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUninitialized": 1, "warnUnused": true, "debugOutput": true } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUninitialized\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "traceExpand": 1 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"traceExpand\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "debugOutput": true, "trace": 1, "warnUnused": true } }, -{ "error": { "type": "setGlobalSettings", "message": "\"trace\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "warnUnusedCli": 1.0 } }, -{ "error": { "type": "setGlobalSettings", "message": "\"warnUnusedCli\" must be unset or a bool value." } }, - -{ "send": { "type": "setGlobalSettings", "warnUnused": true, "debugOutput": true, "checkSystemVars": "some string" } }, -{ "error": { "type": "setGlobalSettings", "message": "\"checkSystemVars\" must be unset or a bool value." } }, - -{ "send": { "type": "globalSettings"} }, -{ "validateGlobalSettings": { "warnUnused": true, "debugOutput": true, "warnUninitialized": true, "traceExpand": true, "trace": true, "warnUnusedCli": false, "checkSystemVars": true } }, - -{ "message": "Everything ok." } -] diff --git a/Tests/Server/tc_handshake.json b/Tests/Server/tc_handshake.json deleted file mode 100644 index 4bb7fa7..0000000 --- a/Tests/Server/tc_handshake.json +++ /dev/null @@ -1,75 +0,0 @@ -[ -{ "message": "Testing basic message handling:" }, - -{ "sendRaw": "Sometext"}, -{ "recv": {"cookie":"","errorMessage":"Failed to parse JSON input.","inReplyTo":"","type":"error"} }, - -{ "message": "Testing invalid json input"}, -{ "send": { "test": "sometext" } }, -{ "recv": {"cookie":"","errorMessage":"No type given in request.","inReplyTo":"","type":"error"} }, - -{ "send": {"test": "sometext","cookie":"monster"} }, -{ "recv": {"cookie":"monster","errorMessage":"No type given in request.","inReplyTo":"","type":"error"} }, - -{ "message": "Testing commands before handshake" }, -{ "send": {"type": "cache","cookie":"monster"} }, -{ "recv": {"cookie":"monster","errorMessage":"Waiting for type \"handshake\".","inReplyTo":"cache","type":"error"} }, - -{ "message": "Testing handshake" }, -{ "send": {"type": "sometype","cookie":"monster2"} }, -{ "recv": {"cookie":"monster2","errorMessage":"Waiting for type \"handshake\".","inReplyTo":"sometype","type":"error"} }, - -{ "send": {"type": "handshake"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" is required for \"handshake\".","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","foo":"bar"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" is required for \"handshake\".","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":"bar"} }, -{ "recv": {"cookie":"","errorMessage":"\"protocolVersion\" must be a JSON object.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be set and an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":"foo"}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be set and an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":1, "minor":"foo"}} }, -{ "recv": {"cookie":"","errorMessage":"\"minor\" must be unset or an integer.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":-1, "minor":-1}} }, -{ "recv": {"cookie":"","errorMessage":"\"major\" must be >= 0.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":10, "minor":-1}} }, -{ "recv": {"cookie":"","errorMessage":"\"minor\" must be >= 0 when set.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":10000}} }, -{ "recv": {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"type": "handshake","protocolVersion":{"major":1, "minor":10000}} }, -{ "recv": {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1}} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"buildDirectory\" is missing."} }, - -{ "message": "Testing protocol version specific options (1.0):" }, -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":"/tmp/src"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"buildDirectory\" is missing."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":"/tmp/src","buildDirectory":"/tmp/build"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"sourceDirectory\" is not a directory."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: \"generator\" is unset but required."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"XXXX","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: Generator \"XXXX\" not supported."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"Ninja","extraGenerator":"XXXX"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"error","errorMessage":"Failed to activate protocol version: The combination of generator \"Ninja\" and extra generator \"XXXX\" is not supported."} }, - -{ "send": {"cookie":"zimtstern","type": "handshake","protocolVersion":{"major":1},"sourceDirectory":".","buildDirectory":"/tmp/build","generator":"Ninja","extraGenerator":"CodeBlocks"} }, -{ "recv": {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} }, - -{ "message": "Everything ok." } -] |