aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-10-20 14:56:48 +0200
committerStefan Boberg <[email protected]>2023-10-20 14:56:48 +0200
commit898def406030da984ebe77538b7837b1eeb3b39e (patch)
tree778b9df4bf94a8c6a37cb36f51594ef011ac0b39 /src/zenutil/include
parentimprove error handling when parsing http requests (#489) (diff)
downloadzen-898def406030da984ebe77538b7837b1eeb3b39e.tar.xz
zen-898def406030da984ebe77538b7837b1eeb3b39e.zip
more cleanup from sb/proto
Diffstat (limited to 'src/zenutil/include')
-rw-r--r--src/zenutil/include/zenutil/zenserverprocess.h36
-rw-r--r--src/zenutil/include/zenutil/zenutil.h3
2 files changed, 23 insertions, 16 deletions
diff --git a/src/zenutil/include/zenutil/zenserverprocess.h b/src/zenutil/include/zenutil/zenserverprocess.h
index 7b78261bc..12dd36df0 100644
--- a/src/zenutil/include/zenutil/zenserverprocess.h
+++ b/src/zenutil/include/zenutil/zenserverprocess.h
@@ -13,10 +13,15 @@
namespace zen {
-/** Class which can be used to manage a Zen server execution environment
+/** Zen Server Environment configuration
+
+ This class allows a user to configure where a spawned server should place any
+ files, and also controls whether it runs as part of a test.
+
+ Especially suited for automated testing scenarios.
+
+ */
- Especially suited for automated testing purposes.
- */
class ZenServerEnvironment
{
public:
@@ -41,13 +46,15 @@ private:
std::string m_ServerClass;
};
-/** Helper class to start, stop and generally manage the lifecycle of
- a Zen server instance
+/** Zen Server Instance management
+
+ This class can be used to launch/attach to and manage a running
+ Zen server instance
Especially useful for automated testing but can also be used for
management tools.
- */
+ */
struct ZenServerInstance
{
ZenServerInstance(ZenServerEnvironment& TestEnvironment);
@@ -63,12 +70,7 @@ struct ZenServerInstance
inline int GetPid() { return m_Process.Pid(); }
inline void SetOwnerPid(int Pid) { m_OwnerPid = Pid; }
- void SetTestDir(std::filesystem::path TestDir)
- {
- ZEN_ASSERT(!m_Process.IsValid());
- m_TestDir = TestDir;
- }
-
+ void SetTestDir(std::filesystem::path TestDir);
inline void SpawnServer(int BasePort = 0, std::string_view AdditionalServerArgs = std::string_view())
{
SpawnServer(BasePort, AdditionalServerArgs, /* WaitTimeoutMs */ 0);
@@ -97,11 +99,11 @@ private:
void SpawnServer(int BasePort, std::string_view AdditionalServerArgs, int WaitTimeoutMs);
};
-/** Shared Zen system state
+/** Shared system state
- Used as a kind of whiteboard to identify running instances etc
+ Used as a scratchpad to identify running instances etc
- The state lives in a memory-mapped file backed by the swapfile
+ On Windows, the state lives in a memory-mapped file backed by the swapfile
*/
class ZenServerState
@@ -123,7 +125,9 @@ public:
uint8_t SessionId[12];
std::atomic<uint32_t> SponsorPids[8];
std::atomic<uint16_t> EffectiveListenPort;
- uint8_t Padding[10];
+ // If you need to add more state, do it here vvvvvvvvvvv
+ uint8_t Padding[10];
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
enum class FlagsEnum : uint16_t
{
diff --git a/src/zenutil/include/zenutil/zenutil.h b/src/zenutil/include/zenutil/zenutil.h
new file mode 100644
index 000000000..14d21ea0d
--- /dev/null
+++ b/src/zenutil/include/zenutil/zenutil.h
@@ -0,0 +1,3 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once