mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-06 07:26:43 -04:00
Update Unreal SDK tests to work on Mac (#4861)
# Description of Changes - Updated the Unreal SDK test harness to allow Unreal Editor to work with MacOS - Updated the Unreal SDK test handler to work with Nil as it's a special case # API and ABI breaking changes N/A # Expected complexity level and risk 1 - Small changes to the Unreal SDK tests # Testing - [x] Ran full suite of tests on Mac for Unreal SDK - [x] Ran full suite of tests on Windows + Linux for Unreal SDK to confirm no regression --------- Co-authored-by: Jason Larabie <jasonlarabie@Mac.lan>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -23,11 +23,34 @@ fn normalize_path(path: PathBuf) -> String {
|
||||
path.display().to_string().replace('\\', "/")
|
||||
}
|
||||
|
||||
fn env_override_path(var: &str) -> Option<String> {
|
||||
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")
|
||||
};
|
||||
@@ -71,17 +100,13 @@ pub fn make_test_with_suite(suite: &TestSuite, test_name: &str) -> Test {
|
||||
assert_existing_file("uproject", &uproject_path);
|
||||
|
||||
// Headless compile (no cook)
|
||||
let compile_command = if cfg!(target_os = "windows") {
|
||||
format!(
|
||||
"\"{}\" {}Editor Win64 Development \"{}\" -waitmutex -skipbuildengine",
|
||||
build_script, suite.unreal_module, uproject_path
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"\"{}\" {}Editor Linux Development \"{}\" -skipbuildengine",
|
||||
build_script, suite.unreal_module, uproject_path
|
||||
)
|
||||
};
|
||||
let compile_command = format!(
|
||||
"\"{}\" {}Editor {} Development -Project=\"{}\" -waitmutex -skipbuildengine",
|
||||
build_script,
|
||||
suite.unreal_module,
|
||||
host_unreal_platform(),
|
||||
uproject_path
|
||||
);
|
||||
|
||||
// Run automation test
|
||||
let run_command = format!(
|
||||
|
||||
Reference in New Issue
Block a user