test(oak-render): make frame-path and worker-bin tests platform-neutral

Windows CI exposed two assertions that assumed POSIX paths:
frame_filename was checked with ends_with("/450") (separator is '\\'
there) and the OAK_WORKER_BIN override used /bin/sh, which never exists
on Windows so the sibling probe legitimately won. Compare the last path
component and point the override at the test executable instead.
This commit is contained in:
2026-09-24 16:11:13 +08:00
parent c50d489dc0
commit d0a8fcd2a5
2 changed files with 19 additions and 4 deletions
+14 -2
View File
@@ -1147,7 +1147,13 @@ mod tests {
let mut with_tb = tb_cache();
with_tb.validate(TimeRange::new(Rational::new(0, 1), Rational::new(16, 1)));
let name = with_tb.frame_filename(Rational::new(15, 1)).expect("cached");
assert!(name.ends_with("/450"), "{name}");
assert_eq!(
std::path::Path::new(&name)
.file_name()
.and_then(|n| n.to_str()),
Some("450"),
"{name}"
);
let path = PlaybackCache::frame_cache_path(
"/cache",
@@ -1180,7 +1186,13 @@ mod tests {
c.set_saving_enabled(false);
c.validate(TimeRange::new(Rational::new(0, 1), Rational::new(4, 1)));
let name = c.frame_filename(Rational::new(1, 2)).expect("cached");
assert!(name.ends_with("/1"), "{name}");
assert_eq!(
std::path::Path::new(&name)
.file_name()
.and_then(|n| n.to_str()),
Some("1"),
"{name}"
);
assert!(name.contains(c.uuid()), "{name}");
}
+5 -2
View File
@@ -4737,10 +4737,13 @@ mod tests {
#[test]
fn find_real_worker_honors_existing_env_override() {
let _lock = pool_test_lock();
let _env = EnvRestore::set("OAK_WORKER_BIN", "/bin/sh");
// The override must name a file that exists on every platform
// (`/bin/sh` never does on Windows): the test's own executable.
let worker = std::env::current_exe().expect("test executable");
let _env = EnvRestore::set("OAK_WORKER_BIN", worker.to_string_lossy().as_ref());
assert_eq!(
find_real_worker().as_deref(),
Some(std::path::Path::new("/bin/sh")),
Some(worker.as_path()),
"an existing OAK_WORKER_BIN wins over the sibling probe"
);
}