summaryrefslogtreecommitdiffstats
path: root/tests/posix/atime.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-07-23 15:19:17 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-07-23 15:22:02 -0400
commit972dcc2973b160cdaad2c4ce0df3616a9f234759 (patch)
treee33713ed22a3e37f0bd3fda2a4808dc152173674 /tests/posix/atime.sh
parent4649cf3132217fe9f975f7e16f47928e5d7680bf (diff)
downloadbfs-972dcc2973b160cdaad2c4ce0df3616a9f234759.tar.xz
tests: Make more tests POSIX-compliant
Diffstat (limited to 'tests/posix/atime.sh')
-rw-r--r--tests/posix/atime.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/posix/atime.sh b/tests/posix/atime.sh
new file mode 100644
index 0000000..25dfd7e
--- /dev/null
+++ b/tests/posix/atime.sh
@@ -0,0 +1,15 @@
+cd "$TEST"
+
+now=$(epoch_time)
+
+"$XTOUCH" -at "@$((now - 60 * 60 * 24 * 7))" last_week
+"$XTOUCH" -at "@$((now - 60 * 60 * 49))" two_days_ago
+"$XTOUCH" -at "@$((now - 60 * 60 * 25))" yesterday
+"$XTOUCH" -at "@$((now - 60 * 60))" one_hour_ago
+"$XTOUCH" -at "@$((now))" now
+"$XTOUCH" -at "@$((now + 60 * 60 * 24))" tomorrow
+
+bfs_diff . \! -name . \
+ \( -atime -1 -exec printf -- '-atime -1: %s\n' {} \; -o -prune \) \
+ \( -atime 1 -exec printf -- '-atime 1: %s\n' {} \; -o -prune \) \
+ \( -atime +1 -exec printf -- '-atime +1: %s\n' {} \; -o -prune \)