commit: 219aa0e42605a13d0eed818d7b311db018c3c99a
parent 4b2cccbd8ab9a6fefd4d905365c744a039897ffe
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 3 Jun 2023 03:14:16 +0200
test-cmd/touch: Fix for NetBSD
Diffstat:
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/test-cmd/stat_atime b/test-cmd/stat_atime
@@ -1,7 +1,8 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2023 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
-case "$(uname -o)" in
- FreeBSD|NetBSD) stat -f%Sa -t'%F %T%z' "$@" ;;
+case "$(uname -s)" in
+ FreeBSD) stat -f%Sa -t'%F %T%z' "$@" ;;
+ *BSD) stat -f%Sa -t'%F %T.%f%z' "$@" ;;
*) stat -c%x "$@" ;;
esac
diff --git a/test-cmd/stat_mtime b/test-cmd/stat_mtime
@@ -1,7 +1,8 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2023 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
-case "$(uname -o)" in
- FreeBSD|NetBSD) stat -f%Sm -t'%F %T%z' "$@" ;;
+case "$(uname -s)" in
+ FreeBSD) stat -f%Sm -t'%F %T%z' "$@" ;;
+ *BSD) stat -f%Sm -t'%F %T.%f%z' "$@" ;;
*) stat -c%y "$@" ;;
esac
diff --git a/test-cmd/touch b/test-cmd/touch
@@ -173,8 +173,8 @@ atf_init_test_cases() {
atf_add_test_case optd
- # No support for displaying fractional seconds on BSD stat(1)
- if uname -o | grep -iq BSD; then
+ # No support for displaying fractional seconds on FreeBSD stat(1)
+ if uname -s | grep -iq FreeBSD; then
maybe_sleep() { sleep 1; }
else
atf_add_test_case optd_frac