diff options
Diffstat (limited to 'zenserver-test/zenserver-test.cpp')
| -rw-r--r-- | zenserver-test/zenserver-test.cpp | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp index 0dc0c13dd..2266e5305 100644 --- a/zenserver-test/zenserver-test.cpp +++ b/zenserver-test/zenserver-test.cpp @@ -57,6 +57,8 @@ ZEN_THIRD_PARTY_INCLUDES_END #include <asio.hpp> +#define ZEN_USE_EXEC 0 // Note: this should really be a global define to match the zenserver definition + ////////////////////////////////////////////////////////////////////////// #include "projectclient.h" @@ -75,13 +77,13 @@ using namespace std::literals; #if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC struct Concurrency { - template <typename... T> + template<typename... T> static void parallel_invoke(T&&... t) { - constexpr size_t NumTs = sizeof...(t); - std::thread Threads[NumTs] = { - std::thread(std::forward<T>(t))..., - }; + constexpr size_t NumTs = sizeof...(t); + std::thread Threads[NumTs] = { + std::thread(std::forward<T>(t))..., + }; for (std::thread& Thread : Threads) { @@ -354,7 +356,7 @@ HttpConnectionPool::GetConnection() asio::ip::tcp::resolver Resolver{m_Context}; asio::error_code ErrCode; - auto it = Resolver.resolve(m_HostName, Service, ErrCode); + auto it = Resolver.resolve(m_HostName, Service, ErrCode); auto itEnd = asio::ip::tcp::resolver::iterator(); if (ErrCode) @@ -980,9 +982,9 @@ TEST_CASE("project.basic") zen::StringBuilder<64> BaseUri; BaseUri << "http://localhost:{}/prj/test"_format(PortNumber); - std::filesystem::path BinPath = zen::GetRunningExecutablePath(); + std::filesystem::path BinPath = zen::GetRunningExecutablePath(); std::filesystem::path RootPath = BinPath.parent_path().parent_path(); - BinPath = BinPath.lexically_relative(RootPath); + BinPath = BinPath.lexically_relative(RootPath); SUBCASE("build store init") { @@ -991,8 +993,7 @@ TEST_CASE("project.basic") zen::CbObjectWriter Body; Body << "id" << "test"; - Body << "root" - << RootPath.c_str(); + Body << "root" << RootPath.c_str(); Body << "project" << "/zooom"; Body << "engine" @@ -1057,7 +1058,8 @@ TEST_CASE("project.basic") OpWriter.BeginArray("files"); OpWriter.BeginObject(); OpWriter << "id" << FileOid; - OpWriter << "clientpath" << "/{engine}/client/side/path"; + OpWriter << "clientpath" + << "/{engine}/client/side/path"; OpWriter << "serverpath" << BinPath.c_str(); OpWriter.EndObject(); OpWriter.EndArray(); @@ -2161,9 +2163,9 @@ TEST_CASE("zcache.rpc") { const CacheKey& ExpectedKey = Keys[Index++]; - CbObjectView RecordObj = RecordView.AsObjectView(); - CbObjectView KeyObj = RecordObj["CacheKey"sv].AsObjectView(); - const CacheKey Key = CacheKey::Create(KeyObj["Bucket"sv].AsString(), KeyObj["Hash"].AsHash()); + CbObjectView RecordObj = RecordView.AsObjectView(); + CbObjectView KeyObj = RecordObj["CacheKey"sv].AsObjectView(); + const CacheKey Key = CacheKey::Create(KeyObj["Bucket"sv].AsString(), KeyObj["Hash"].AsHash()); CHECK(Key == ExpectedKey); } @@ -2223,6 +2225,8 @@ TEST_CASE("zcache.rpc") } } +# if ZEN_USE_EXEC + struct RemoteExecutionRequest { RemoteExecutionRequest(std::string_view Host, int Port, std::filesystem::path& TreePath) @@ -2359,7 +2363,7 @@ private: TEST_CASE("exec.basic") { -#if ZEN_WITH_COMPUTE_SERVICES +# if ZEN_WITH_COMPUTE_SERVICES using namespace std::literals; std::filesystem::path TestDir = TestEnv.CreateNewTestDir(); @@ -2379,7 +2383,7 @@ TEST_CASE("exec.basic") RemoteRequest.Prep(); zen::CbObject Result = RemoteRequest.Exec(); - CHECK(Result["exitcode"].AsInt32(-1) == 0); + CHECK(Result["exitcode"sv].AsInt32(-1) == 0); } { @@ -2388,15 +2392,15 @@ TEST_CASE("exec.basic") RemoteRequest.Prep(); zen::CbObject Result = RemoteRequest.Exec(); - CHECK(Result["exitcode"].AsInt32(-1) == 1); + CHECK(Result["exitcode"sv].AsInt32(-1) == 1); } -#endif // ZEN_WITH_COMPUTE_SERVICES +# endif // ZEN_WITH_COMPUTE_SERVICES } TEST_CASE("mesh.basic") { // --mesh option only available with ZEN_ENABLE_MESH -# if ZEN_ENABLE_MESH +# if ZEN_ENABLE_MESH using namespace std::literals; const int kInstanceCount = 4; @@ -2421,9 +2425,11 @@ TEST_CASE("mesh.basic") Instance->WaitUntilReady(); } -# endif +# endif } +# endif + class ZenServerTestHelper { public: |