aboutsummaryrefslogtreecommitdiff
path: root/zenserver-test/zenserver-test.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-04-24 15:53:30 +0200
committerStefan Boberg <[email protected]>2023-04-24 15:53:30 +0200
commit9ee1a686c29b7ab18207c2963497337532f441cb (patch)
tree17d2681767e92603b7199d88235a775e5ca354ab /zenserver-test/zenserver-test.cpp
parentadded changelog comment (diff)
parentfixed dashboard file serving bug (#255) (diff)
downloadzen-9ee1a686c29b7ab18207c2963497337532f441cb.tar.xz
zen-9ee1a686c29b7ab18207c2963497337532f441cb.zip
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zenserver-test/zenserver-test.cpp')
-rw-r--r--zenserver-test/zenserver-test.cpp42
1 files changed, 31 insertions, 11 deletions
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp
index 1f320f2f6..3195181d1 100644
--- a/zenserver-test/zenserver-test.cpp
+++ b/zenserver-test/zenserver-test.cpp
@@ -300,7 +300,7 @@ main()
return 0;
}
#elif 0
-//#include <restinio/all.hpp>
+// #include <restinio/all.hpp>
int
main()
@@ -317,6 +317,8 @@ zen::ZenServerEnvironment TestEnv;
int
main(int argc, char** argv)
{
+ using namespace std::literals;
+
# if ZEN_USE_MIMALLOC
mi_version();
# endif
@@ -333,11 +335,31 @@ main(int argc, char** argv)
std::filesystem::path ProgramBaseDir = std::filesystem::path(argv[0]).parent_path();
std::filesystem::path TestBaseDir = ProgramBaseDir.parent_path().parent_path() / ".test";
- TestEnv.InitializeForTest(ProgramBaseDir, TestBaseDir);
+ // 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);
- return ZEN_RUN_TESTS(argc, argv);
+ zen::testing::TestRunner Runner;
+ Runner.ApplyCommandLine(argc, argv);
+
+ return Runner.Run();
}
namespace zen::tests {
@@ -454,7 +476,7 @@ TEST_CASE("project.basic")
ZenServerInstance Instance1(TestEnv);
Instance1.SetTestDir(TestDir);
- Instance1.SpawnServer(PortNumber, "--http asio");
+ Instance1.SpawnServer(PortNumber);
Instance1.WaitUntilReady();
std::atomic<uint64_t> RequestCount{0};
@@ -1711,19 +1733,17 @@ TEST_CASE("zcache.failing.upstream")
using namespace std::literals;
using namespace utils;
- const uint16_t Upstream1PortNumber = 13338;
- ZenConfig Upstream1Cfg = ZenConfig::New(Upstream1PortNumber);
- Upstream1Cfg.Args += (" --http asio");
+ const uint16_t Upstream1PortNumber = 13338;
+ ZenConfig Upstream1Cfg = ZenConfig::New(Upstream1PortNumber);
ZenServerInstance Upstream1Server(TestEnv);
- const uint16_t Upstream2PortNumber = 13339;
- ZenConfig Upstream2Cfg = ZenConfig::New(Upstream2PortNumber);
- Upstream2Cfg.Args += (" --http asio");
+ const uint16_t Upstream2PortNumber = 13339;
+ ZenConfig Upstream2Cfg = ZenConfig::New(Upstream2PortNumber);
ZenServerInstance Upstream2Server(TestEnv);
std::vector<std::uint16_t> UpstreamPorts = {Upstream1PortNumber, Upstream2PortNumber};
ZenConfig LocalCfg = ZenConfig::NewWithThreadedUpstreams(UpstreamPorts, false);
- LocalCfg.Args += (" --http asio --upstream-thread-count 2");
+ LocalCfg.Args += (" --upstream-thread-count 2");
ZenServerInstance LocalServer(TestEnv);
const uint16_t LocalPortNumber = 13337;
const auto LocalUri = fmt::format("http://localhost:{}/z$", LocalPortNumber);