// Copyright Epic Games, Inc. All Rights Reserved. #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ////////////////////////////////////////////////////////////////////////// #if ZEN_WITH_TESTS # define ZEN_TEST_WITH_RUNNER 1 # include #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("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