The branch main has been updated by jlduran:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=93b15dbc1fbc3c33c9bd53091b28c3b629d0abe1

commit 93b15dbc1fbc3c33c9bd53091b28c3b629d0abe1
Author:     Jose Luis Duran <[email protected]>
AuthorDate: 2026-01-05 20:34:03 +0000
Commit:     Jose Luis Duran <[email protected]>
CommitDate: 2026-01-05 20:34:03 +0000

    makefs: tests: Fix timestamp-related tests
    
    Use a variable for mtree that includes the DEFAULT_MTREE_KEYWORDS, in
    order to avoid missing the important "time" keyword or passing an
    unimplemented "nlink" keyword.
    
    Unskip the "failing" tests, and comment out the specific failing checks,
    these will be addressed (or at least discussed) in a different revision.
    
    For MS-DOS tests, use an even value timestamp, as precision is 2s.
    
    For ZFS tests, use import_image instead of mount_image consistently.
    
    Reviewed by:    bnovkov, markj
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D54429
---
 usr.sbin/makefs/tests/makefs_cd9660_tests.sh | 12 +++++-------
 usr.sbin/makefs/tests/makefs_ffs_tests.sh    | 15 ++++++---------
 usr.sbin/makefs/tests/makefs_msdos_tests.sh  | 19 ++++++++-----------
 usr.sbin/makefs/tests/makefs_tests_common.sh |  1 +
 usr.sbin/makefs/tests/makefs_zfs_tests.sh    | 12 +++++-------
 5 files changed, 25 insertions(+), 34 deletions(-)

diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh 
b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
index 21382684a96c..719c2045305f 100644
--- a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
@@ -85,7 +85,7 @@ F_flag_body()
 {
        create_test_inputs
 
-       atf_check -o save:$TEST_SPEC_FILE mtree -cp $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
 
        atf_check $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
 
@@ -102,8 +102,7 @@ from_mtree_spec_file_body()
 {
        create_test_inputs
 
-       atf_check -o save:$TEST_SPEC_FILE \
-           mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        cd $TEST_INPUTS_DIR
        atf_check $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
        cd -
@@ -358,13 +357,12 @@ T_flag_dir_cleanup()
 atf_test_case T_flag_F_flag cleanup
 T_flag_F_flag_body()
 {
-       atf_expect_fail "-F doesn't take precedence over -T"
        timestamp_F=1742574909
        timestamp_T=1742574910
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
 
-       atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type,time" -p 
$TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F
        atf_check \
            $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -o rockridge $TEST_IMAGE 
$TEST_INPUTS_DIR
@@ -373,7 +371,7 @@ T_flag_F_flag_body()
        eval $(stat -s  $TEST_MOUNT_DIR/dir1)
        atf_check_equal $st_atime $timestamp_F
        atf_check_equal $st_mtime $timestamp_F
-       atf_check_equal $st_ctime $timestamp_F
+       # atf_check_equal $st_ctime $timestamp_F
 }
 
 T_flag_F_flag_cleanup()
@@ -388,7 +386,7 @@ T_flag_mtree_body()
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
 
-       atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        atf_check $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_SPEC_FILE
 
        mount_image
diff --git a/usr.sbin/makefs/tests/makefs_ffs_tests.sh 
b/usr.sbin/makefs/tests/makefs_ffs_tests.sh
index e1db5fa1b997..ac078394bf03 100644
--- a/usr.sbin/makefs/tests/makefs_ffs_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_ffs_tests.sh
@@ -56,8 +56,7 @@ autocalculate_image_size_body()
 {
        create_test_inputs
 
-       atf_check -o save:$TEST_SPEC_FILE \
-           mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
 
        cd $TEST_INPUTS_DIR
        atf_check -o not-empty $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
@@ -98,7 +97,7 @@ F_flag_body()
 {
        create_test_inputs
 
-       atf_check -o save:$TEST_SPEC_FILE mtree -cp $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
 
        atf_check -o not-empty \
            $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
@@ -116,8 +115,7 @@ from_mtree_spec_file_body()
 {
        create_test_inputs
 
-       atf_check -o save:$TEST_SPEC_FILE \
-           mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
 
        cd $TEST_INPUTS_DIR
        atf_check -o not-empty $MAKEFS -M 1m $TEST_IMAGE $TEST_SPEC_FILE
@@ -257,13 +255,12 @@ T_flag_dir_cleanup()
 atf_test_case T_flag_F_flag cleanup
 T_flag_F_flag_body()
 {
-       atf_expect_fail "-F doesn't take precedence over -T"
        timestamp_F=1742574909
        timestamp_T=1742574910
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
 
-       atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type,time" -p 
$TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F
        atf_check -o not-empty \
            $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -M 1m $TEST_IMAGE 
$TEST_INPUTS_DIR
@@ -272,7 +269,7 @@ T_flag_F_flag_body()
        eval $(stat -s  $TEST_MOUNT_DIR/dir1)
        atf_check_equal $st_atime $timestamp_F
        atf_check_equal $st_mtime $timestamp_F
-       atf_check_equal $st_ctime $timestamp_F
+       # atf_check_equal $st_ctime $timestamp_F
 }
 
 T_flag_F_flag_cleanup()
@@ -287,7 +284,7 @@ T_flag_mtree_body()
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
 
-       atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        atf_check -o not-empty \
            $MAKEFS -M 1m -T $timestamp $TEST_IMAGE $TEST_SPEC_FILE
 
diff --git a/usr.sbin/makefs/tests/makefs_msdos_tests.sh 
b/usr.sbin/makefs/tests/makefs_msdos_tests.sh
index 00ab1509ef55..f800bbcd6925 100644
--- a/usr.sbin/makefs/tests/makefs_msdos_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_msdos_tests.sh
@@ -47,10 +47,7 @@ common_cleanup()
 atf_test_case T_flag_dir cleanup
 T_flag_dir_body()
 {
-       atf_expect_fail \
-           "The msdos backend saves the wrong timestamp value" \
-           "(possibly due to the 2s resolution for FAT timestamp)"
-       timestamp=1742574909
+       timestamp=1742574908 # Even value, timestamp precision is 2s.
 
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
@@ -59,7 +56,8 @@ T_flag_dir_body()
 
        mount_image
        eval $(stat -s  $TEST_MOUNT_DIR/dir1)
-       atf_check_equal $st_atime $timestamp
+       # FAT directory entries don't have an access time, just a date.
+       #atf_check_equal $st_atime $timestamp
        atf_check_equal $st_mtime $timestamp
        atf_check_equal $st_ctime $timestamp
 }
@@ -72,21 +70,20 @@ T_flag_dir_cleanup()
 atf_test_case T_flag_F_flag cleanup
 T_flag_F_flag_body()
 {
-       atf_expect_fail "-F doesn't take precedence over -T"
-       timestamp_F=1742574909
+       timestamp_F=1742574908 # Even value, timestamp precision is 2s.
        timestamp_T=1742574910
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
 
-       atf_check -o save:$TEST_SPEC_FILE \
-           mtree -c -k "type,time" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F
        atf_check -o not-empty \
            $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -s 1m $TEST_IMAGE 
$TEST_INPUTS_DIR
 
        mount_image
        eval $(stat -s  $TEST_MOUNT_DIR/dir1)
-       atf_check_equal $st_atime $timestamp_F
+       # FAT directory entries don't have an access time, just a date.
+       #atf_check_equal $st_atime $timestamp
        atf_check_equal $st_mtime $timestamp_F
        atf_check_equal $st_ctime $timestamp_F
 }
@@ -103,7 +100,7 @@ T_flag_mtree_body()
 
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
-       atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        atf_check -o not-empty \
            $MAKEFS -T $timestamp -s 1m  $TEST_IMAGE $TEST_SPEC_FILE
 
diff --git a/usr.sbin/makefs/tests/makefs_tests_common.sh 
b/usr.sbin/makefs/tests/makefs_tests_common.sh
index 44b02557925a..27ab89ae26ec 100644
--- a/usr.sbin/makefs/tests/makefs_tests_common.sh
+++ b/usr.sbin/makefs/tests/makefs_tests_common.sh
@@ -27,6 +27,7 @@
 KB=1024
 : ${TMPDIR=/tmp}
 DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time"
+MTREE="mtree -k $DEFAULT_MTREE_KEYWORDS"
 TEST_IMAGE="$TMPDIR/test.img"
 TEST_INPUTS_DIR="$TMPDIR/inputs"
 TEST_MD_DEVICE_FILE="$TMPDIR/md.output"
diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh 
b/usr.sbin/makefs/tests/makefs_zfs_tests.sh
index 7dd6005e49ec..9d5ce300843e 100644
--- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh
@@ -979,24 +979,22 @@ T_flag_dir_cleanup()
 atf_test_case T_flag_F_flag cleanup
 T_flag_F_flag_body()
 {
-       atf_expect_fail "-F doesn't take precedence over -T"
        timestamp_F=1742574909
        timestamp_T=1742574910
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
 
-       atf_check -o save:$TEST_SPEC_FILE \
-           mtree -c -k "type,time" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F
-       atf_check -o not-empty \
+       atf_check \
            $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -s 10g -o rootpath=/ \
            -o poolname=$ZFS_POOL_NAME $TEST_IMAGE $TEST_INPUTS_DIR
 
-       mount_image
+       import_image
        eval $(stat -s  $TEST_MOUNT_DIR/dir1)
        atf_check_equal $st_atime $timestamp_F
        atf_check_equal $st_mtime $timestamp_F
-       atf_check_equal $st_ctime $timestamp_F
+       # atf_check_equal $st_ctime $timestamp_F
 }
 
 T_flag_F_flag_cleanup()
@@ -1011,7 +1009,7 @@ T_flag_mtree_body()
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
 
-       atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type" -p $TEST_INPUTS_DIR
+       atf_check -o save:$TEST_SPEC_FILE $MTREE -c -p $TEST_INPUTS_DIR
        atf_check $MAKEFS -T $timestamp -s 10g -o rootpath=/ -o 
poolname=$ZFS_POOL_NAME \
            $TEST_IMAGE $TEST_SPEC_FILE
 

Reply via email to