The branch main has been updated by lwhsu:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2cd31bd8fa687922d2a571ae53456ecd2e9ba095

commit 2cd31bd8fa687922d2a571ae53456ecd2e9ba095
Author:     Siva Mahadevan <[email protected]>
AuthorDate: 2025-07-24 12:13:56 +0000
Commit:     Li-Wen Hsu <[email protected]>
CommitDate: 2025-12-16 17:13:47 +0000

    makefs/tests: Use require.kmods property instead of ad-hoc checks
    
    Signed-off-by: Siva Mahadevan <[email protected]>
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1870
---
 usr.sbin/makefs/tests/Makefile               |  2 ++
 usr.sbin/makefs/tests/makefs_cd9660_tests.sh | 19 -------------------
 usr.sbin/makefs/tests/makefs_msdos_tests.sh  |  8 --------
 3 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/usr.sbin/makefs/tests/Makefile b/usr.sbin/makefs/tests/Makefile
index 748bafa06211..5c9ba983acdc 100644
--- a/usr.sbin/makefs/tests/Makefile
+++ b/usr.sbin/makefs/tests/Makefile
@@ -2,9 +2,11 @@
 
 ATF_TESTS_SH+= makefs_cd9660_tests
 TEST_METADATA.makefs_cd9660_tests+=    required_files="/sbin/mount_cd9660"
+TEST_METADATA.makefs_cd9660_tests+=    required_kmods="cd9660"
 ATF_TESTS_SH+= makefs_ffs_tests
 ATF_TESTS_SH+= makefs_msdos_tests
 TEST_METADATA.makefs_msdos_tests+=     required_files="/sbin/mount_msdosfs"
+TEST_METADATA.makefs_msdos_tests+=     required_kmods="msdosfs"
 .if ${MK_ZFS} != "no"
 ATF_TESTS_SH+= makefs_zfs_tests
 .endif
diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh 
b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
index e058dfc57b7b..b36753de3393 100644
--- a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
@@ -58,11 +58,6 @@ check_base_iso9660_image_contents()
        atf_check -e empty -o empty -s exit:0 test -f $TEST_MOUNT_DIR/c
 }
 
-check_cd9660_support() {
-       kldstat -m cd9660 || \
-               atf_skip "Requires cd9660 filesystem support to be present in 
the kernel"
-}
-
 atf_test_case D_flag cleanup
 D_flag_body()
 {
@@ -101,7 +96,6 @@ F_flag_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents
 }
@@ -122,7 +116,6 @@ from_mtree_spec_file_body()
            $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
        cd -
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents
 }
@@ -145,7 +138,6 @@ from_multiple_dirs_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents -d $test_inputs_dir2
 }
@@ -162,7 +154,6 @@ from_single_dir_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents
 }
@@ -183,7 +174,6 @@ o_flag_allow_deep_trees_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -o allow-deep-trees $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents
 }
@@ -207,7 +197,6 @@ o_flag_allow_max_name_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -o allow-max-name $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents
 }
@@ -226,7 +215,6 @@ o_flag_isolevel_1_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -o isolevel=1 $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents
 }
@@ -243,7 +231,6 @@ o_flag_isolevel_2_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -o isolevel=2 $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents
 }
@@ -265,7 +252,6 @@ o_flag_isolevel_3_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_base_iso9660_image_contents
        fi
@@ -333,7 +319,6 @@ o_flag_rockridge_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_image_contents -X .rr_moved
 
@@ -365,7 +350,6 @@ o_flag_rockridge_dev_nodes_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR
 
-       check_cd9660_support
        mount_image
        check_image_contents
 }
@@ -378,7 +362,6 @@ atf_test_case T_flag_dir cleanup
 T_flag_dir_body()
 {
        timestamp=1742574909
-       check_cd9660_support
        create_test_dirs
 
        mkdir -p $TEST_INPUTS_DIR/dir1
@@ -436,7 +419,6 @@ T_flag_mtree_body()
        atf_check -e empty -o empty -s exit:0 \
            $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_SPEC_FILE
 
-       check_cd9660_support
        mount_image
        eval $(stat -s  $TEST_MOUNT_DIR/dir1)
        atf_check_equal $st_atime $timestamp
@@ -456,7 +438,6 @@ duplicate_names_head()
 }
 duplicate_names_body()
 {
-       check_cd9660_support
        create_test_dirs
 
        # Create three directories which are identical in the first 31 
characters.
diff --git a/usr.sbin/makefs/tests/makefs_msdos_tests.sh 
b/usr.sbin/makefs/tests/makefs_msdos_tests.sh
index fb94429b477b..ce246f3d268c 100644
--- a/usr.sbin/makefs/tests/makefs_msdos_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_msdos_tests.sh
@@ -43,12 +43,6 @@ common_cleanup()
        mdconfig -d -u $test_md_device || :
 }
 
-check_msdosfs_support()
-{
-       kldstat -m msdosfs || \
-               atf_skip "Requires msdosfs filesystem support to be present in 
the kernel"
-}
-
 atf_test_case T_flag_dir cleanup
 T_flag_dir_body()
 {
@@ -56,7 +50,6 @@ T_flag_dir_body()
            "The msdos backend saves the wrong timestamp value" \
            "(possibly due to the 2s resolution for FAT timestamp)"
        timestamp=1742574909
-       check_msdosfs_support
 
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1
@@ -106,7 +99,6 @@ atf_test_case T_flag_mtree cleanup
 T_flag_mtree_body()
 {
        timestamp=1742574908 # Even value, timestamp precision is 2s.
-       check_msdosfs_support
 
        create_test_dirs
        mkdir -p $TEST_INPUTS_DIR/dir1

Reply via email to