Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jan 2026 15:52:20 +0000
From:      Aymeric Wibo <obiwac@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 578b4ec8f1a4 - main - touch: Test for -a flag
Message-ID:  <697b8234.39668.b814e12@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by obiwac:

URL: https://cgit.FreeBSD.org/src/commit/?id=578b4ec8f1a4134027e66a156e6cf801284aab14

commit 578b4ec8f1a4134027e66a156e6cf801284aab14
Author:     Aymeric Wibo <obiwac@FreeBSD.org>
AuthorDate: 2026-01-23 22:57:58 +0000
Commit:     Aymeric Wibo <obiwac@FreeBSD.org>
CommitDate: 2026-01-29 15:50:26 +0000

    touch: Test for -a flag
    
    Reviewed by:    kevans
    Approved by:    kevans
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D54852
---
 usr.bin/touch/tests/touch_test.sh | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/usr.bin/touch/tests/touch_test.sh b/usr.bin/touch/tests/touch_test.sh
index 619f81e0e7c3..cd9dc4623612 100644
--- a/usr.bin/touch/tests/touch_test.sh
+++ b/usr.bin/touch/tests/touch_test.sh
@@ -12,6 +12,12 @@ atf_check_mtime()
 	atf_check -o inline:"$((mtime))\n" stat -f%m "$filename"
 }
 
+atf_check_atime()
+{
+	local atime=$1 filename=$2
+	atf_check -o inline:"$((atime))\n" stat -f%a "$filename"
+}
+
 atf_test_case touch_none
 touch_none_head()
 {
@@ -173,6 +179,19 @@ touch_symlink_no_h_flag_body()
 	atf_check_mtime $orig_mtime symlink
 }
 
+atf_test_case touch_just_atime
+touch_just_atime_head()
+{
+	atf_set descr "Update just access time of file (-a)"
+}
+touch_just_atime_body()
+{
+	atf_check touch -t 200406151337 file
+	atf_check touch -at 197209071337 file
+	atf_check_mtime 1087306620 file
+	atf_check_atime 84721020 file
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case touch_none
@@ -184,5 +203,6 @@ atf_init_test_cases()
 	atf_add_test_case touch_nocreate
 	atf_add_test_case touch_symlink_h_flag
 	atf_add_test_case touch_symlink_no_h_flag
-	# TODO: add test cases for -a, -m
+	atf_add_test_case touch_just_atime
+	# TODO: add test cases for -m
 }


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?697b8234.39668.b814e12>