aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver-test/zenserver-test.cpp
diff options
context:
space:
mode:
authorLiam Mitchell <[email protected]>2026-03-09 19:06:36 -0700
committerLiam Mitchell <[email protected]>2026-03-09 19:06:36 -0700
commitd1abc50ee9d4fb72efc646e17decafea741caa34 (patch)
treee4288e00f2f7ca0391b83d986efcb69d3ba66a83 /src/zenserver-test/zenserver-test.cpp
parentAllow requests with invalid content-types unless specified in command line or... (diff)
parentupdated chunk–block analyser (#818) (diff)
downloadzen-d1abc50ee9d4fb72efc646e17decafea741caa34.tar.xz
zen-d1abc50ee9d4fb72efc646e17decafea741caa34.zip
Merge branch 'main' into lm/restrict-content-type
Diffstat (limited to 'src/zenserver-test/zenserver-test.cpp')
-rw-r--r--src/zenserver-test/zenserver-test.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/zenserver-test/zenserver-test.cpp b/src/zenserver-test/zenserver-test.cpp
index 9a42bb73d..8d5400294 100644
--- a/src/zenserver-test/zenserver-test.cpp
+++ b/src/zenserver-test/zenserver-test.cpp
@@ -4,12 +4,12 @@
#if ZEN_WITH_TESTS
-# define ZEN_TEST_WITH_RUNNER 1
# include "zenserver-test.h"
# include <zencore/except.h>
# include <zencore/fmtutils.h>
# include <zencore/logging.h>
+# include <zencore/logging/registry.h>
# include <zencore/stream.h>
# include <zencore/string.h>
# include <zencore/testutils.h>
@@ -17,8 +17,8 @@
# include <zencore/timer.h>
# include <zenhttp/httpclient.h>
# include <zenhttp/packageformat.h>
-# include <zenutil/commandlineoptions.h>
-# include <zenutil/logging/testformatter.h>
+# include <zenutil/config/commandlineoptions.h>
+# include <zenutil/logging/fullformatter.h>
# include <zenutil/zenserverprocess.h>
# include <atomic>
@@ -86,8 +86,9 @@ main(int argc, char** argv)
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()));
+ zen::logging::SetLogLevel(zen::logging::Debug);
+ zen::logging::Registry::Instance().SetFormatter(
+ std::make_unique<zen::logging::FullFormatter>("test", std::chrono::system_clock::now()));
std::filesystem::path ProgramBaseDir = GetRunningExecutablePath().parent_path();
std::filesystem::path TestBaseDir = std::filesystem::current_path() / ".test";
@@ -97,6 +98,7 @@ main(int argc, char** argv)
// somehow in the future
std::string ServerClass;
+ bool Verbose = false;
for (int i = 1; i < argc; ++i)
{
@@ -107,13 +109,23 @@ main(int argc, char** argv)
ServerClass = argv[++i];
}
}
+ else if (argv[i] == "--verbose"sv)
+ {
+ Verbose = true;
+ }
}
zen::tests::TestEnv.InitializeForTest(ProgramBaseDir, TestBaseDir, ServerClass);
+ if (Verbose)
+ {
+ zen::tests::TestEnv.SetPassthroughOutput(true);
+ }
+
ZEN_INFO("Running tests...(base dir: '{}')", TestBaseDir);
zen::testing::TestRunner Runner;
+ Runner.SetDefaultSuiteFilter("server.*");
Runner.ApplyCommandLine(argc, argv);
return Runner.Run();
@@ -121,6 +133,8 @@ main(int argc, char** argv)
namespace zen::tests {
+TEST_SUITE_BEGIN("server.zenserver");
+
TEST_CASE("default.single")
{
std::filesystem::path TestDir = TestEnv.CreateNewTestDir();
@@ -327,6 +341,8 @@ TEST_CASE("http.package")
CHECK_EQ(ResponsePackage, TestPackage);
}
+TEST_SUITE_END();
+
# if 0
TEST_CASE("lifetime.owner")
{