From 972dcc2973b160cdaad2c4ce0df3616a9f234759 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 23 Jul 2024 15:19:17 -0400 Subject: tests: Make more tests POSIX-compliant --- tests/common/atime.out | 6 ------ tests/common/atime.sh | 15 --------------- tests/common/mtime.out | 6 ------ tests/common/mtime.sh | 15 --------------- tests/common/name_slash.out | 1 - tests/common/name_slash.sh | 1 - tests/common/name_slashes.out | 1 - tests/common/name_slashes.sh | 1 - tests/posix/atime.out | 6 ++++++ tests/posix/atime.sh | 15 +++++++++++++++ tests/posix/mtime.out | 6 ++++++ tests/posix/mtime.sh | 15 +++++++++++++++ tests/posix/name_slash.out | 1 + tests/posix/name_slash.sh | 1 + tests/posix/name_slashes.out | 1 + tests/posix/name_slashes.sh | 1 + 16 files changed, 46 insertions(+), 46 deletions(-) delete mode 100644 tests/common/atime.out delete mode 100644 tests/common/atime.sh delete mode 100644 tests/common/mtime.out delete mode 100644 tests/common/mtime.sh delete mode 100644 tests/common/name_slash.out delete mode 100644 tests/common/name_slash.sh delete mode 100644 tests/common/name_slashes.out delete mode 100644 tests/common/name_slashes.sh create mode 100644 tests/posix/atime.out create mode 100644 tests/posix/atime.sh create mode 100644 tests/posix/mtime.out create mode 100644 tests/posix/mtime.sh create mode 100644 tests/posix/name_slash.out create mode 100644 tests/posix/name_slash.sh create mode 100644 tests/posix/name_slashes.out create mode 100644 tests/posix/name_slashes.sh (limited to 'tests') diff --git a/tests/common/atime.out b/tests/common/atime.out deleted file mode 100644 index 5ed206b..0000000 --- a/tests/common/atime.out +++ /dev/null @@ -1,6 +0,0 @@ --atime 1: ./yesterday --atime +1: ./last_week --atime +1: ./two_days_ago --atime -1: ./now --atime -1: ./one_hour_ago --atime -1: ./tomorrow diff --git a/tests/common/atime.sh b/tests/common/atime.sh deleted file mode 100644 index 4f2299d..0000000 --- a/tests/common/atime.sh +++ /dev/null @@ -1,15 +0,0 @@ -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 \) diff --git a/tests/common/mtime.out b/tests/common/mtime.out deleted file mode 100644 index 91f0114..0000000 --- a/tests/common/mtime.out +++ /dev/null @@ -1,6 +0,0 @@ --mtime 1: ./yesterday --mtime +1: ./last_week --mtime +1: ./two_days_ago --mtime -1: ./now --mtime -1: ./one_hour_ago --mtime -1: ./tomorrow diff --git a/tests/common/mtime.sh b/tests/common/mtime.sh deleted file mode 100644 index 910f64d..0000000 --- a/tests/common/mtime.sh +++ /dev/null @@ -1,15 +0,0 @@ -cd "$TEST" - -now=$(epoch_time) - -"$XTOUCH" -mt "@$((now - 60 * 60 * 24 * 7))" last_week -"$XTOUCH" -mt "@$((now - 60 * 60 * 49))" two_days_ago -"$XTOUCH" -mt "@$((now - 60 * 60 * 25))" yesterday -"$XTOUCH" -mt "@$((now - 60 * 60))" one_hour_ago -"$XTOUCH" -mt "@$((now))" now -"$XTOUCH" -mt "@$((now + 60 * 60 * 24))" tomorrow - -bfs_diff . -mindepth 1 \ - \( -mtime -1 -exec printf -- '-mtime -1: %s\n' {} \; -o -true \) \ - \( -mtime 1 -exec printf -- '-mtime 1: %s\n' {} \; -o -true \) \ - \( -mtime +1 -exec printf -- '-mtime +1: %s\n' {} \; -o -true \) diff --git a/tests/common/name_slash.out b/tests/common/name_slash.out deleted file mode 100644 index b498fd4..0000000 --- a/tests/common/name_slash.out +++ /dev/null @@ -1 +0,0 @@ -/ diff --git a/tests/common/name_slash.sh b/tests/common/name_slash.sh deleted file mode 100644 index 8d89623..0000000 --- a/tests/common/name_slash.sh +++ /dev/null @@ -1 +0,0 @@ -bfs_diff / -maxdepth 0 -name / diff --git a/tests/common/name_slashes.out b/tests/common/name_slashes.out deleted file mode 100644 index 187b81f..0000000 --- a/tests/common/name_slashes.out +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/tests/common/name_slashes.sh b/tests/common/name_slashes.sh deleted file mode 100644 index 78d0a84..0000000 --- a/tests/common/name_slashes.sh +++ /dev/null @@ -1 +0,0 @@ -bfs_diff /// -maxdepth 0 -name / diff --git a/tests/posix/atime.out b/tests/posix/atime.out new file mode 100644 index 0000000..5ed206b --- /dev/null +++ b/tests/posix/atime.out @@ -0,0 +1,6 @@ +-atime 1: ./yesterday +-atime +1: ./last_week +-atime +1: ./two_days_ago +-atime -1: ./now +-atime -1: ./one_hour_ago +-atime -1: ./tomorrow 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 \) diff --git a/tests/posix/mtime.out b/tests/posix/mtime.out new file mode 100644 index 0000000..91f0114 --- /dev/null +++ b/tests/posix/mtime.out @@ -0,0 +1,6 @@ +-mtime 1: ./yesterday +-mtime +1: ./last_week +-mtime +1: ./two_days_ago +-mtime -1: ./now +-mtime -1: ./one_hour_ago +-mtime -1: ./tomorrow diff --git a/tests/posix/mtime.sh b/tests/posix/mtime.sh new file mode 100644 index 0000000..8367631 --- /dev/null +++ b/tests/posix/mtime.sh @@ -0,0 +1,15 @@ +cd "$TEST" + +now=$(epoch_time) + +"$XTOUCH" -mt "@$((now - 60 * 60 * 24 * 7))" last_week +"$XTOUCH" -mt "@$((now - 60 * 60 * 49))" two_days_ago +"$XTOUCH" -mt "@$((now - 60 * 60 * 25))" yesterday +"$XTOUCH" -mt "@$((now - 60 * 60))" one_hour_ago +"$XTOUCH" -mt "@$((now))" now +"$XTOUCH" -mt "@$((now + 60 * 60 * 24))" tomorrow + +bfs_diff . \! -name . \ + \( -mtime -1 -exec printf -- '-mtime -1: %s\n' {} \; -o -prune \) \ + \( -mtime 1 -exec printf -- '-mtime 1: %s\n' {} \; -o -prune \) \ + \( -mtime +1 -exec printf -- '-mtime +1: %s\n' {} \; -o -prune \) diff --git a/tests/posix/name_slash.out b/tests/posix/name_slash.out new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/tests/posix/name_slash.out @@ -0,0 +1 @@ +/ diff --git a/tests/posix/name_slash.sh b/tests/posix/name_slash.sh new file mode 100644 index 0000000..b42b145 --- /dev/null +++ b/tests/posix/name_slash.sh @@ -0,0 +1 @@ +bfs_diff / -prune -name / diff --git a/tests/posix/name_slashes.out b/tests/posix/name_slashes.out new file mode 100644 index 0000000..187b81f --- /dev/null +++ b/tests/posix/name_slashes.out @@ -0,0 +1 @@ +/// diff --git a/tests/posix/name_slashes.sh b/tests/posix/name_slashes.sh new file mode 100644 index 0000000..45a39d3 --- /dev/null +++ b/tests/posix/name_slashes.sh @@ -0,0 +1 @@ +bfs_diff /// -prune -name / -- cgit v1.2.3