From 8e1b59fef535d767e57e1953973df3ce20e62233 Mon Sep 17 00:00:00 2001 From: Jason Larabie Date: Tue, 21 Apr 2026 14:48:01 -0700 Subject: [PATCH 1/2] Update Unreal SDK tests to work on Mac --- .../TestClient/Private/Tests/TestHandler.cpp | 10 ++++++ sdks/unreal/tests/sdk_unreal_harness.rs | 36 +++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/sdks/unreal/tests/TestClient/Source/TestClient/Private/Tests/TestHandler.cpp b/sdks/unreal/tests/TestClient/Source/TestClient/Private/Tests/TestHandler.cpp index a44863b5003..553f722e566 100644 --- a/sdks/unreal/tests/TestClient/Source/TestClient/Private/Tests/TestHandler.cpp +++ b/sdks/unreal/tests/TestClient/Source/TestClient/Private/Tests/TestHandler.cpp @@ -4,6 +4,12 @@ #include "Tests/TestCounter.h" #include "Tests/CommonTestFunctions.h" +#ifdef Nil +#define SPACETIMEDB_NIL_MACRO_SAVED +#pragma push_macro("Nil") +#undef Nil +#endif + /* Implementation for every primitive ---------------------------------- */ #define DEFINE_UFUNC(Suffix, Expected, RowStructType) \ void UInsertPrimitiveHandler::OnInsertOne##Suffix(const FEventContext& Context, const RowStructType& Value) \ @@ -1712,3 +1718,7 @@ void UUuidActionsHandler::OnInsertCallUuidV7(const FEventContext& Context, const Counter->MarkFailure(TEXT("InsertCallUuidV7"), ErrorMessage); } } +#ifdef SPACETIMEDB_NIL_MACRO_SAVED +#pragma pop_macro("Nil") +#undef SPACETIMEDB_NIL_MACRO_SAVED +#endif diff --git a/sdks/unreal/tests/sdk_unreal_harness.rs b/sdks/unreal/tests/sdk_unreal_harness.rs index b4da4dd43e5..7a3888cc4b3 100644 --- a/sdks/unreal/tests/sdk_unreal_harness.rs +++ b/sdks/unreal/tests/sdk_unreal_harness.rs @@ -23,11 +23,34 @@ fn normalize_path(path: PathBuf) -> String { path.display().to_string().replace('\\', "/") } +fn env_override_path(var: &str) -> Option { + env::var(var) + .ok() + .filter(|value| !value.trim().is_empty()) + .map(|value| value.replace('\\', "/")) +} + +fn host_unreal_platform() -> &'static str { + if cfg!(target_os = "windows") { + "Win64" + } else if cfg!(target_os = "macos") { + "Mac" + } else { + "Linux" + } +} + /// Returns full path to Unreal Editor executable fn ue_editor_exe() -> String { + if let Some(path) = env_override_path("UE_EDITOR_PATH") { + return path; + } + let root = ue_root(); let path = if cfg!(target_os = "windows") { root.join("Engine/Binaries/Win64/UnrealEditor.exe") + } else if cfg!(target_os = "macos") { + root.join("Engine/Binaries/Mac/UnrealEditor.app/Contents/MacOS/UnrealEditor") } else { root.join("Engine/Binaries/Linux/UnrealEditor") }; @@ -36,9 +59,15 @@ fn ue_editor_exe() -> String { /// Returns full path to Unreal Build script (Build.bat or Build.sh) fn ue_build_script() -> String { + if let Some(path) = env_override_path("UE_BUILD_SCRIPT_PATH") { + return path; + } + let root = ue_root(); let path = if cfg!(target_os = "windows") { root.join("Engine/Build/BatchFiles/Build.bat") + } else if cfg!(target_os = "macos") { + root.join("Engine/Build/BatchFiles/Mac/Build.sh") } else { root.join("Engine/Build/BatchFiles/Linux/Build.sh") }; @@ -78,8 +107,11 @@ pub fn make_test_with_suite(suite: &TestSuite, test_name: &str) -> Test { ) } else { format!( - "\"{}\" {}Editor Linux Development \"{}\" -skipbuildengine", - build_script, suite.unreal_module, uproject_path + "\"{}\" {}Editor {} Development \"{}\" -skipbuildengine", + build_script, + suite.unreal_module, + host_unreal_platform(), + uproject_path ) }; From a35d68e28d10596ee0eabdf6710d9533b79081e8 Mon Sep 17 00:00:00 2001 From: Jason Larabie Date: Wed, 22 Apr 2026 13:30:45 -0700 Subject: [PATCH 2/2] Small change to add stability to tests for Unreal --- sdks/unreal/tests/sdk_unreal_harness.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdks/unreal/tests/sdk_unreal_harness.rs b/sdks/unreal/tests/sdk_unreal_harness.rs index 7a3888cc4b3..d70c0373671 100644 --- a/sdks/unreal/tests/sdk_unreal_harness.rs +++ b/sdks/unreal/tests/sdk_unreal_harness.rs @@ -102,12 +102,12 @@ pub fn make_test_with_suite(suite: &TestSuite, test_name: &str) -> Test { // Headless compile (no cook) let compile_command = if cfg!(target_os = "windows") { format!( - "\"{}\" {}Editor Win64 Development \"{}\" -waitmutex -skipbuildengine", + "\"{}\" {}Editor Win64 Development -Project=\"{}\" -waitmutex -skipbuildengine", build_script, suite.unreal_module, uproject_path ) } else { format!( - "\"{}\" {}Editor {} Development \"{}\" -skipbuildengine", + "\"{}\" {}Editor {} Development -Project=\"{}\" -skipbuildengine", build_script, suite.unreal_module, host_unreal_platform(),