From 60aa9f17276409257ad612fccefba13c26ed0d74 Mon Sep 17 00:00:00 2001 From: Vishva Natarajan Date: Sun, 22 Jun 2025 01:36:07 +0530 Subject: [PATCH] tests: increase sleep duration for sort file metadata tests on Windows AArch64 Use `cfg!` to assign a 1000ms delay only on Windows Aarch64 targets. This was done because it has been observed to be necessary on this platform. The conditional logic is used because 1s is quite long to wait on every other more sensible platform. Closes #3071, Closes #3072 --- tests/misc.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/misc.rs b/tests/misc.rs index f1091b92..8d9a93a6 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -1092,16 +1092,22 @@ rgtest!(type_list, |_: Dir, mut cmd: TestCommand| { // This order is important when sorting them by system time-stamps. fn sort_setup(dir: Dir) { use std::{thread::sleep, time::Duration}; - + // As reported in https://github.com/BurntSushi/ripgrep/issues/3071 + // this test fails if sufficient delay is not given on Windows/Aarch64. + let delay = if cfg!(all(windows, target_arch = "aarch64")) { + Duration::from_millis(1000) + } else { + Duration::from_millis(100) + }; let sub_dir = dir.path().join("dir"); dir.create("a", "test"); - sleep(Duration::from_millis(100)); + sleep(delay); dir.create_dir(&sub_dir); - sleep(Duration::from_millis(100)); + sleep(delay); dir.create(sub_dir.join("c"), "test"); - sleep(Duration::from_millis(100)); + sleep(delay); dir.create("b", "test"); - sleep(Duration::from_millis(100)); + sleep(delay); dir.create(sub_dir.join("d"), "test"); }