makefs/tests: Use require.kmods property instead of ad-hoc checks

Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1870
This commit is contained in:
Siva Mahadevan
2025-07-24 08:13:56 -04:00
committed by Li-Wen Hsu
parent 681e9d3e39
commit 2cd31bd8fa
3 changed files with 2 additions and 27 deletions
+2
View File
@@ -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
@@ -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.
@@ -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