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..d70c0373671 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") }; @@ -73,13 +102,16 @@ 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 Linux Development \"{}\" -skipbuildengine", - build_script, suite.unreal_module, uproject_path + "\"{}\" {}Editor {} Development -Project=\"{}\" -skipbuildengine", + build_script, + suite.unreal_module, + host_unreal_platform(), + uproject_path ) };