logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: 086906e21eab6f3445e5b7715bc85a262f5ed416
parent 8670c0f98af61c9d71db04ccf31bf158ac5a70bd
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 19 Sep 2024 09:29:32 +0200

test-cmd/touch: remove last usage of sleep

Diffstat:

Mtest-cmd/Kyuafile2+-
Mtest-cmd/touch36+++++++++---------------------------
2 files changed, 10 insertions(+), 28 deletions(-)

diff --git a/test-cmd/Kyuafile b/test-cmd/Kyuafile @@ -8,7 +8,7 @@ basedir = fs.dirname(fs.dirname(current_kyuafile())) -- 9,$|LC_ALL=C.UTF-8 sort atf_test_program{name="df", required_files=basedir.."/cmd/df", timeout=1} -atf_test_program{name="touch", required_files=basedir.."/cmd/touch", timeout=3} +atf_test_program{name="touch", required_files=basedir.."/cmd/touch", timeout=1} tap_test_program{name="arch.sh", required_files=basedir.."/cmd/arch", timeout=1} tap_test_program{name="base64.sh", required_files=basedir.."/cmd/base64", timeout=1} tap_test_program{name="basename.sh", required_files=basedir.."/cmd/basename", timeout=1} diff --git a/test-cmd/touch b/test-cmd/touch @@ -4,8 +4,7 @@ atf_test_case noargs noargs_body() { - atf_check touch -a -d 2007-11-12T10:15:30Z ./foo - atf_check touch -m -d 2007-11-12T10:15:30Z ./foo + atf_check touch -d 2007-11-12T10:15:30Z ./foo atime="$(./stat_atime ./foo)" mtime="$(./stat_mtime ./foo)" @@ -16,8 +15,7 @@ noargs_body() { atf_test_case ref_noargs ref_noargs_body() { - atf_check touch -a -d 2007-11-12T10:15:30Z ./foo - atf_check touch -m -d 2007-11-12T10:15:30Z ./foo + atf_check touch -d 2007-11-12T10:15:30Z ./foo atime="$(./stat_atime ./foo)" mtime="$(./stat_mtime ./foo)" @@ -30,8 +28,7 @@ ref_noargs_body() { atf_test_case mtime mtime_body() { - atf_check touch -a -d 2007-11-12T10:15:30Z ./foo - atf_check touch -m -d 2007-11-12T10:15:30Z ./foo + atf_check touch -d 2007-11-12T10:15:30Z ./foo atime="$(./stat_atime ./foo)" mtime="$(./stat_mtime ./foo)" @@ -42,8 +39,7 @@ mtime_body() { atf_test_case ref_mtime ref_mtime_body() { - atf_check touch -a -d 2007-11-12T10:15:30Z ./foo - atf_check touch -m -d 2007-11-12T10:15:30Z ./foo + atf_check touch -d 2007-11-12T10:15:30Z ./foo atime="$(./stat_atime ./foo)" mtime="$(./stat_mtime ./foo)" @@ -56,8 +52,7 @@ ref_mtime_body() { atf_test_case atime atime_body() { - atf_check touch -a -d 2007-11-12T10:15:30Z ./foo - atf_check touch -m -d 2007-11-12T10:15:30Z ./foo + atf_check touch -d 2007-11-12T10:15:30Z ./foo atime="$(./stat_atime ./foo)" mtime="$(./stat_mtime ./foo)" @@ -68,8 +63,7 @@ atime_body() { atf_test_case ref_atime ref_atime_body() { - atf_check touch -a -d 2007-11-12T10:15:30Z ./foo - atf_check touch -m -d 2007-11-12T10:15:30Z ./foo + atf_check touch -d 2007-11-12T10:15:30Z ./foo atime="$(./stat_atime ./foo)" mtime="$(./stat_mtime ./foo)" @@ -82,8 +76,7 @@ ref_atime_body() { atf_test_case amtime amtime_body() { - atf_check touch -a -d 2007-11-12T10:15:30Z ./foo - atf_check touch -m -d 2007-11-12T10:15:30Z ./foo + atf_check touch -d 2007-11-12T10:15:30Z ./foo atime="$(./stat_atime ./foo)" mtime="$(./stat_mtime ./foo)" @@ -94,8 +87,7 @@ amtime_body() { atf_test_case ref_amtime ref_amtime_body() { - atf_check touch -a -d 2007-11-12T10:15:30Z ./foo - atf_check touch -m -d 2007-11-12T10:15:30Z ./foo + atf_check touch -d 2007-11-12T10:15:30Z ./foo atime="$(./stat_atime ./foo)" mtime="$(./stat_mtime ./foo)" @@ -109,10 +101,10 @@ ref_amtime_body() { atf_test_case dir dir_body() { mkdir -p ./foo.d + touch -d 2007-11-12T10:15:30Z ./foo.d atime="$(./stat_atime ./foo.d)" mtime="$(./stat_mtime ./foo.d)" - maybe_sleep atf_check ../cmd/touch ./foo.d atf_check -o "not-inline:${atime}\n" ./stat_atime ./foo.d atf_check -o "not-inline:${mtime}\n" ./stat_mtime ./foo.d @@ -197,14 +189,4 @@ atf_init_test_cases() { atf_add_test_case optt atf_add_test_case empty_str - - # No support for displaying fractional seconds on FreeBSD stat(1) - if uname -s | grep -iq FreeBSD; then - # shellcheck disable=SC2317 - maybe_sleep() { sleep 1; } - else - atf_add_test_case optd_frac - # shellcheck disable=SC2317 - maybe_sleep() { sleep .1; } - fi }