summaryrefslogtreecommitdiffstats
path: root/tests/common/atime.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-06-04 13:54:16 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-06-04 13:54:16 -0400
commitd6c2c94896c4e9f49e187f6c7b0f0d376a2d02ac (patch)
tree78c3259aa45898c490cb67c68ce8bdfdfbbe986e /tests/common/atime.sh
parentc6bb003b8882e9a16941f5803d072ec1cb728318 (diff)
downloadbfs-d6c2c94896c4e9f49e187f6c7b0f0d376a2d02ac.tar.xz
tests/common: Add tests for -[am]{min,time}
Diffstat (limited to 'tests/common/atime.sh')
-rw-r--r--tests/common/atime.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/common/atime.sh b/tests/common/atime.sh
new file mode 100644
index 0000000..c2e4031
--- /dev/null
+++ b/tests/common/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 -mindepth 1 \
+ \( -atime -1 -exec printf -- '-atime -1: %s\n' {} \; -o -true \) \
+ \( -atime 1 -exec printf -- '-atime 1: %s\n' {} \; -o -true \) \
+ \( -atime +1 -exec printf -- '-atime +1: %s\n' {} \; -o -true \)