aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-10-10 15:14:00 +0200
committerStefan Boberg <[email protected]>2025-10-10 15:14:00 +0200
commit4b2bff25f779e38ce8f85344a6560cd32045b890 (patch)
tree0cfd3635db731b05ffcc08438673403436e91480
parentadded subcommand structure (diff)
parentmade server count dynamic via `--count` argument (diff)
downloadzen-4b2bff25f779e38ce8f85344a6560cd32045b890.tar.xz
zen-4b2bff25f779e38ce8f85344a6560cd32045b890.zip
Merge branch 'sb/zen-master' of ssh://arn-wd-l1704:2222/ue-foundation/zen into sb/zen-master
-rw-r--r--src/zenmaster/hostinterface.cpp2
-rw-r--r--src/zenmaster/sandboxwin.cpp19
-rw-r--r--src/zenmaster/zenmaster.cpp41
3 files changed, 34 insertions, 28 deletions
diff --git a/src/zenmaster/hostinterface.cpp b/src/zenmaster/hostinterface.cpp
index e1bb6cb54..39e7a51cc 100644
--- a/src/zenmaster/hostinterface.cpp
+++ b/src/zenmaster/hostinterface.cpp
@@ -34,7 +34,7 @@ ZenServerHost::SpawnOne(std::string_view Id)
std::filesystem::path ProgramBaseDir = GetRunningExecutablePath().parent_path();
Proc->Env.Initialize(ProgramBaseDir);
- Proc->Server = std::move(std::make_unique<ZenServerInstance>(Proc->Env));
+ Proc->Server = std::make_unique<ZenServerInstance>(Proc->Env);
Proc->Server->SpawnServerAndWait();
m_LiveProcessesByProjectId.insert({std::string{Id}, std::move(Proc)});
diff --git a/src/zenmaster/sandboxwin.cpp b/src/zenmaster/sandboxwin.cpp
index 6377fda0b..185db513c 100644
--- a/src/zenmaster/sandboxwin.cpp
+++ b/src/zenmaster/sandboxwin.cpp
@@ -1,14 +1,16 @@
// Copyright Epic Games, Inc. All Rights Reserved.
-// AppContainerLaunch.cpp
-#include <Aclapi.h>
-#include <sddl.h>
-#include <stdio.h>
-#include <userenv.h>
-#include <windows.h>
+#include <zencore/windows.h>
-#pragma comment(lib, "userenv.lib")
-#pragma comment(lib, "Advapi32.lib")
+#if ZEN_PLATFORM_WINDOWS
+
+# include <Aclapi.h>
+# include <sddl.h>
+# include <stdio.h>
+# include <userenv.h>
+
+# pragma comment(lib, "userenv.lib")
+# pragma comment(lib, "Advapi32.lib")
// Helper: add (or merge) an ACE for a SID on a directory
DWORD
@@ -161,3 +163,4 @@ zwmain()
FreeSid(appContainerSid);
return ok ? 0 : 1;
}
+#endif
diff --git a/src/zenmaster/zenmaster.cpp b/src/zenmaster/zenmaster.cpp
index 353b0da6a..02c01fc50 100644
--- a/src/zenmaster/zenmaster.cpp
+++ b/src/zenmaster/zenmaster.cpp
@@ -200,6 +200,9 @@ main(int argc, char** argv)
Options.add_options()("malloc", "Configure memory allocator subsystem", cxxopts::value(MemoryOptions)->default_value("mimalloc"));
Options.add_options()("help", "Show command line help");
+ int ServerSpawnCount = 100;
+ Options.add_options()("count", "Number of servers to spawn", cxxopts::value<int>(ServerSpawnCount));
+
#if ZEN_WITH_TRACE
// We only have this in options for command line help purposes - we parse these argument separately earlier using
// GetTraceOptionsFromCommandline()
@@ -345,37 +348,37 @@ main(int argc, char** argv)
ZEN_INFO("END {}, took {}", Tag, NiceTimeSpanMs(t.GetElapsedTimeMs()));
};
- int SpawnCount = 100;
-
std::vector<std::unique_ptr<ZenServerInstance>> Instances;
- TimedBlock("Spawning instances", [&] {
- for (int i = 0; i < SpawnCount; ++i)
- {
- auto& Instance = Instances.emplace_back(std::make_unique<ZenServerInstance>(TestEnv));
+ TimedBlock(fmt::format("Spawning {} instances", ServerSpawnCount), [&] {
+ TimedBlock("Spawning instances", [&] {
+ for (int i = 0; i < ServerSpawnCount; ++i)
+ {
+ auto& Instance = Instances.emplace_back(std::make_unique<ZenServerInstance>(TestEnv));
- std::filesystem::path TestDir1 = TestEnv.CreateNewTestDir();
- Instance->SetTestDir(TestDir1);
- Instance->SpawnServer();
- }
- });
+ std::filesystem::path TestDir1 = TestEnv.CreateNewTestDir();
+ Instance->SetTestDir(TestDir1);
+ Instance->SpawnServer("--malloc=ansi");
+ }
+ });
- TimedBlock("Waiting for instances", [&] {
- for (int i = 0; i < SpawnCount; ++i)
- {
- auto& Instance = Instances[i];
+ TimedBlock("Waiting for instances", [&] {
+ for (int i = 0; i < ServerSpawnCount; ++i)
+ {
+ auto& Instance = Instances[i];
- const uint16_t PortNum = Instance->WaitUntilReady();
+ const uint16_t PortNum = Instance->WaitUntilReady();
- ZEN_INFO("Instance #{} UP - port {}", i, PortNum);
- }
+ ZEN_INFO("Instance #{} UP - port {}", i, PortNum);
+ }
+ });
});
ZEN_INFO("press any key to tear instances down");
zen::getch();
TimedBlock("Shutting down instances", [&] {
- for (int i = 0; i < SpawnCount; ++i)
+ for (int i = 0; i < ServerSpawnCount; ++i)
{
auto& Instance = Instances[i];