diff options
author | Brad King <brad.king@kitware.com> | 2020-10-14 16:46:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-10-14 20:41:50 (GMT) |
commit | 9952ee063a1a2b31c784733b0cf676b4a6efc36e (patch) | |
tree | f019b22a20973bd61f944c002148b8312f64d0bc /Tests/CMakeServerLib/testServerBuffering.cpp | |
parent | c5559597177eabd5620766e9dbc6f02a3b827ddb (diff) | |
download | CMake-9952ee063a1a2b31c784733b0cf676b4a6efc36e.zip CMake-9952ee063a1a2b31c784733b0cf676b4a6efc36e.tar.gz CMake-9952ee063a1a2b31c784733b0cf676b4a6efc36e.tar.bz2 |
server: remove deprecated 'cmake -E server' mode
The server mode has been deprecated since commit 996e1885c4 (server:
deprecate in favor of the file-api, 2019-04-19, v3.15.0-rc1~198^2).
Clients should now be using the file-api. Remove the server mode.
Diffstat (limited to 'Tests/CMakeServerLib/testServerBuffering.cpp')
-rw-r--r-- | Tests/CMakeServerLib/testServerBuffering.cpp | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/Tests/CMakeServerLib/testServerBuffering.cpp b/Tests/CMakeServerLib/testServerBuffering.cpp deleted file mode 100644 index 6f22940..0000000 --- a/Tests/CMakeServerLib/testServerBuffering.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include <iostream> -#include <memory> -#include <string> -#include <vector> - -#include "cmConnection.h" -#include "cmServerConnection.h" - -void print_error(const std::vector<std::string>& input, - const std::vector<std::string>& output) -{ - std::cerr << "Responses don't equal input messages input." << std::endl; - std::cerr << "Responses: " << std::endl; - - for (auto& msg : output) { - std::cerr << "'" << msg << "'" << std::endl; - } - - std::cerr << "Input messages" << std::endl; - for (auto& msg : input) { - std::cerr << "'" << msg << "'" << std::endl; - } -} - -std::string trim_newline(const std::string& _buffer) -{ - auto buffer = _buffer; - while (!buffer.empty() && (buffer.back() == '\n' || buffer.back() == '\r')) { - buffer.pop_back(); - } - return buffer; -} - -int testServerBuffering(int, char** const) -{ - std::vector<std::string> messages = { - "{ \"test\": 10}", "{ \"test\": { \"test2\": false} }", - "{ \"test\": [1, 2, 3] }", - "{ \"a\": { \"1\": {}, \n\n\n \"2\":[] \t\t\t\t}}" - }; - - std::string fullMessage; - for (auto& msg : messages) { - fullMessage += "[== \"CMake Server\" ==[\n"; - fullMessage += msg; - fullMessage += "\n]== \"CMake Server\" ==]\n"; - } - - // The buffering strategy should cope with any fragmentation, including - // just getting the characters one at a time. - auto bufferingStrategy = - std::unique_ptr<cmConnectionBufferStrategy>(new cmServerBufferStrategy); - std::vector<std::string> response; - std::string rawBuffer; - for (auto& messageChar : fullMessage) { - rawBuffer += messageChar; - std::string packet = bufferingStrategy->BufferMessage(rawBuffer); - do { - if (!packet.empty() && packet != "\r\n") { - response.push_back(trim_newline(packet)); - } - packet = bufferingStrategy->BufferMessage(rawBuffer); - } while (!packet.empty()); - } - - if (response != messages) { - print_error(messages, response); - return 1; - } - - // We should also be able to deal with getting a bunch at once - response.clear(); - std::string packet = bufferingStrategy->BufferMessage(fullMessage); - do { - if (!packet.empty() && packet != "\r\n") { - response.push_back(trim_newline(packet)); - } - packet = bufferingStrategy->BufferMessage(fullMessage); - } while (!packet.empty()); - - if (response != messages) { - print_error(messages, response); - return 1; - } - - return 0; -} |