aboutsummaryrefslogtreecommitdiff
path: root/src/zenmaster-test/zenmaster-test.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-08-26 13:45:54 +0200
committerStefan Boberg <[email protected]>2025-08-26 13:45:54 +0200
commitf4c029e6accbf8df3496e28ba9e07eed4cbde851 (patch)
treeee3329f981e3c0b9609c90cfef4b610ffd2c4223 /src/zenmaster-test/zenmaster-test.cpp
parentMerge pull request #139 from ue-foundation/de/zen-service-command (diff)
downloadzen-f4c029e6accbf8df3496e28ba9e07eed4cbde851.tar.xz
zen-f4c029e6accbf8df3496e28ba9e07eed4cbde851.zip
zenmaster + zenmaster-test skeletons
Diffstat (limited to 'src/zenmaster-test/zenmaster-test.cpp')
-rw-r--r--src/zenmaster-test/zenmaster-test.cpp96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/zenmaster-test/zenmaster-test.cpp b/src/zenmaster-test/zenmaster-test.cpp
new file mode 100644
index 000000000..7511d6b4a
--- /dev/null
+++ b/src/zenmaster-test/zenmaster-test.cpp
@@ -0,0 +1,96 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
+
+#include <zenbase/refcount.h>
+#include <zencore/compactbinary.h>
+#include <zencore/compactbinarybuilder.h>
+#include <zencore/compactbinarypackage.h>
+#include <zencore/compress.h>
+#include <zencore/except.h>
+#include <zencore/fmtutils.h>
+#include <zencore/logging.h>
+#include <zencore/memoryview.h>
+#include <zencore/scopeguard.h>
+#include <zencore/stream.h>
+#include <zencore/string.h>
+#include <zencore/testutils.h>
+#include <zencore/timer.h>
+#include <zencore/xxhash.h>
+#include <zenutil/logging/testformatter.h>
+#include <zenutil/zenserverprocess.h>
+
+#include <atomic>
+#include <filesystem>
+#include <map>
+#include <random>
+#include <span>
+#include <thread>
+#include <typeindex>
+#include <unordered_map>
+
+#include <zencore/memory/newdelete.h>
+
+//////////////////////////////////////////////////////////////////////////
+
+#if ZEN_WITH_TESTS
+# define ZEN_TEST_WITH_RUNNER 1
+# include <zencore/testing.h>
+#endif
+
+using namespace std::literals;
+
+#if !ZEN_WITH_TESTS
+int
+main()
+{
+}
+#else
+zen::ZenServerEnvironment TestEnv;
+
+int
+main(int argc, char** argv)
+{
+ using namespace std::literals;
+ using namespace zen;
+
+# if ZEN_PLATFORM_LINUX
+ IgnoreChildSignals();
+# endif
+
+ zen::TraceInit("zenmaster-test");
+ zen::logging::InitializeLogging();
+
+ zen::logging::SetLogLevel(zen::logging::level::Debug);
+ spdlog::set_formatter(std::make_unique<zen::logging::full_test_formatter>("test", std::chrono::system_clock::now()));
+
+ std::filesystem::path ProgramBaseDir = GetRunningExecutablePath().parent_path();
+ std::filesystem::path TestBaseDir = std::filesystem::current_path() / ".test";
+
+ // This is pretty janky because we're passing most of the options through to the test
+ // framework, so we can't just use cxxopts (I think). This should ideally be cleaned up
+ // somehow in the future
+
+ std::string ServerClass;
+
+ for (int i = 1; i < argc; ++i)
+ {
+ if (argv[i] == "--http"sv)
+ {
+ if ((i + 1) < argc)
+ {
+ ServerClass = argv[++i];
+ }
+ }
+ }
+
+ TestEnv.InitializeForTest(ProgramBaseDir, TestBaseDir, ServerClass);
+
+ ZEN_INFO("Running tests...(base dir: '{}')", TestBaseDir);
+
+ zen::testing::TestRunner Runner;
+ Runner.ApplyCommandLine(argc, argv);
+
+ return Runner.Run();
+}
+#endif