From: Frederick Dilger Date: Sat, 30 Nov 2024 23:12:55 +0000 (-0700) Subject: LU-18501 tests: sanity.sh test_56oe fix time range X-Git-Tag: 2.16.53~132 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F57201%2F3;p=fs%2Flustre-release.git LU-18501 tests: sanity.sh test_56oe fix time range test_56oe was likely failing due to the test running slow, resulting in all of the files escaping the time range before they are found with 'lfs find -ctime -Tupper -ctime +Tlower' so the bounds are now calculated after all files have been created meaning that even if there are large gaps between the creation of each file they will still be within the new bounds. Just in case the test is really extra slow, this test will be skipped to avoid having to retest for the 0.01% of the time that it happens. Test-Parameters: trivial testlist=sanity env=ONLY=56oe,ONLY_REPEAT=100 Signed-off-by: Frederick Dilger Change-Id: If3f737146f1a1d110873c5dd3a6ece60604e54ac Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57201 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 133458c..a0818c3 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7349,12 +7349,21 @@ test_56oe() { for ((val = 1; val <= 10; val++)); do touch $dir/$tfile-a.$val $dir/$tfile-m.$val touch $dir/$tfile-c.$val + echo -n "$tfile-c.$val @ctime (Epoch):" + stat -c "%Z" $dir/$tfile-c.$val touch --date="$val $unit ago" -a $dir/$tfile-a.$val touch --date="$val $unit ago" -m $dir/$tfile-m.$val (( val % 5 != 2 )) || sleep 10 done - cmd="$LFS find $dir -ctime -19s -ctime +9s" + local now=$(date +%s) + local lower_bound=$(( now - $(stat -c "%Z" $dir/$tfile-c.8) + 2 )) + local upper_bound=$(( now - $(stat -c "%Z" $dir/$tfile-c.2) - 2 )) + + (( now == $(date +%s))) || + skip "System is too slow for accurate results" + + cmd="$LFS find $dir -ctime -${upper_bound}s -ctime +${lower_bound}s" nums=$($cmd | grep -c c.*) (( nums == expected )) ||