mirror of
https://github.com/zhom/banderole.git
synced 2026-06-06 06:23:53 +02:00
test: increase delay on windows
This commit is contained in:
+8
-6
@@ -700,8 +700,11 @@ impl BundlerTestHelper {
|
||||
// Build command to run the executable.
|
||||
#[cfg(windows)]
|
||||
let (exec_to_run, work_dir, _run_guard) = {
|
||||
// Create a unique temp directory per invocation to avoid filename races
|
||||
let run_dir = TempDir::new().context("Failed to create temp dir for run copy")?;
|
||||
// Copy to a unique name in the same directory as the original to avoid policy issues with %TEMP%
|
||||
let parent = executable_path.parent().ok_or_else(|| {
|
||||
anyhow::anyhow!("Executable has no parent: {}", executable_path.display())
|
||||
})?;
|
||||
let run_dir = TempDir::new_in(parent).unwrap_or_else(|_| TempDir::new().unwrap());
|
||||
let mut base = executable_path
|
||||
.file_name()
|
||||
.map(|s| s.to_os_string())
|
||||
@@ -712,20 +715,19 @@ impl BundlerTestHelper {
|
||||
let candidate = run_dir.path().join(&base);
|
||||
std::fs::copy(executable_path, &candidate).with_context(|| {
|
||||
format!(
|
||||
"Failed to copy executable to temp dir: {} -> {}",
|
||||
"Failed to copy executable to run dir: {} -> {}",
|
||||
executable_path.display(),
|
||||
candidate.display()
|
||||
)
|
||||
})?;
|
||||
// Small delay to allow AV/file indexing to settle
|
||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||
if !candidate.exists() {
|
||||
anyhow::bail!(
|
||||
"Temp executable not found after copy: {}",
|
||||
"Run executable not found after copy: {}",
|
||||
candidate.display()
|
||||
);
|
||||
}
|
||||
(candidate, run_dir.path().to_path_buf(), run_dir)
|
||||
(candidate, parent.to_path_buf(), run_dir)
|
||||
};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
|
||||
@@ -59,7 +59,7 @@ async fn test_concurrent_first_launch() -> Result<()> {
|
||||
|
||||
// Give the filesystem a moment to settle on Windows
|
||||
if cfg!(windows) {
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
std::thread::sleep(std::time::Duration::from_millis(250));
|
||||
}
|
||||
|
||||
// Clear any existing cache to ensure we test first launch
|
||||
@@ -85,7 +85,7 @@ async fn test_concurrent_first_launch() -> Result<()> {
|
||||
barrier.wait();
|
||||
|
||||
// Add a small staggered delay to reduce race conditions on Windows
|
||||
std::thread::sleep(std::time::Duration::from_millis(i as u64 * 10));
|
||||
std::thread::sleep(std::time::Duration::from_millis(50 + i as u64 * 20));
|
||||
|
||||
let thread_start = Instant::now();
|
||||
|
||||
@@ -304,7 +304,7 @@ async fn test_cached_concurrent_execution() -> Result<()> {
|
||||
barrier.wait();
|
||||
|
||||
// Add a small staggered delay to reduce race conditions on Windows
|
||||
std::thread::sleep(std::time::Duration::from_millis(i as u64 * 10));
|
||||
std::thread::sleep(std::time::Duration::from_millis(50 + i as u64 * 20));
|
||||
|
||||
let thread_start = Instant::now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user