aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Luis Duran <jlduran@FreeBSD.org>2026-01-05 20:33:27 +0000
committerJose Luis Duran <jlduran@FreeBSD.org>2026-01-05 20:33:27 +0000
commit96efda9cd55689ef3fa067281d8b0a42a7122536 (patch)
tree140e30ab2b326d82b193475141cb7a5d6f73f531
parent0a6deb87c2802a47709c58d09b5f9122ed40c157 (diff)
-rw-r--r--usr.sbin/makefs/tests/makefs_cd9660_tests.sh24
-rw-r--r--usr.sbin/makefs/tests/makefs_ffs_tests.sh24
-rw-r--r--usr.sbin/makefs/tests/makefs_tests_common.sh8
3 files changed, 34 insertions, 22 deletions
diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
index 5b1a53443290..21382684a96c 100644
--- a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
@@ -61,21 +61,23 @@ check_base_iso9660_image_contents()
atf_test_case D_flag
D_flag_body()
{
- atf_skip "makefs crashes with SIGBUS with dupe mtree entries; see FreeBSD bug # 192839"
-
create_test_inputs
- atf_check -o save:$TEST_SPEC_FILE mtree -cp $TEST_INPUTS_DIR
- atf_check -o not-empty \
- $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+ create_manifest_file
+
+ # Check that it works
+ atf_check $MAKEFS -M 1m $TEST_IMAGE $TEST_SPEC_FILE
- atf_check cp $TEST_SPEC_FILE spec2.mtree
- atf_check -o save:${TEST_SPEC_FILE}_dupe cat $TEST_SPEC_FILE spec2.mtree
+ # Duplicate entries in the manifest file
+ cp $TEST_SPEC_FILE spec2.mtree
+ cat $TEST_SPEC_FILE spec2.mtree | sort > "${TEST_SPEC_FILE}_dupe"
- atf_check -o not-empty -s not-exit:0 \
- $MAKEFS -F ${TEST_SPEC_FILE}_dupe -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
- atf_check -o not-empty \
- $MAKEFS -D -F ${TEST_SPEC_FILE}_dupe -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+ # Check that it errors
+ atf_check -e not-empty -s not-exit:0 \
+ $MAKEFS -M 1m $TEST_IMAGE ${TEST_SPEC_FILE}_dupe
+ # Check that it warns
+ atf_check -e not-empty \
+ $MAKEFS -D -M 1m $TEST_IMAGE ${TEST_SPEC_FILE}_dupe
}
atf_test_case F_flag cleanup
diff --git a/usr.sbin/makefs/tests/makefs_ffs_tests.sh b/usr.sbin/makefs/tests/makefs_ffs_tests.sh
index 6b8fb4afd707..e1db5fa1b997 100644
--- a/usr.sbin/makefs/tests/makefs_ffs_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_ffs_tests.sh
@@ -74,21 +74,23 @@ autocalculate_image_size_cleanup()
atf_test_case D_flag
D_flag_body()
{
- atf_skip "makefs crashes with SIGBUS with dupe mtree entries; see FreeBSD bug # 192839"
-
create_test_inputs
- atf_check -o save:$TEST_SPEC_FILE mtree -cp $TEST_INPUTS_DIR
- atf_check -o not-empty \
- $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+ create_manifest_file
- atf_check cp $TEST_SPEC_FILE spec2.mtree
- atf_check -o save:${TEST_SPEC_FILE}_dupe cat $TEST_SPEC_FILE spec2.mtree
+ # Check that it works
+ atf_check -o not-empty $MAKEFS -M 1m $TEST_IMAGE $TEST_SPEC_FILE
- atf_check -o not-empty -s not-exit:0 \
- $MAKEFS -F ${TEST_SPEC_FILE}_dupe -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
- atf_check -o not-empty \
- $MAKEFS -D -F ${TEST_SPEC_FILE}_dupe -M 1m $TEST_IMAGE $TEST_INPUTS_DIR
+ # Duplicate entries in the manifest file
+ cp $TEST_SPEC_FILE spec2.mtree
+ cat $TEST_SPEC_FILE spec2.mtree | sort > "${TEST_SPEC_FILE}_dupe"
+
+ # Check that it errors
+ atf_check -e not-empty -s not-exit:0 \
+ $MAKEFS -M 1m $TEST_IMAGE ${TEST_SPEC_FILE}_dupe
+ # Check that it warns
+ atf_check -e not-empty -o not-empty \
+ $MAKEFS -D -M 1m $TEST_IMAGE ${TEST_SPEC_FILE}_dupe
}
atf_test_case F_flag cleanup
diff --git a/usr.sbin/makefs/tests/makefs_tests_common.sh b/usr.sbin/makefs/tests/makefs_tests_common.sh
index fa2cbaff9521..44b02557925a 100644
--- a/usr.sbin/makefs/tests/makefs_tests_common.sh
+++ b/usr.sbin/makefs/tests/makefs_tests_common.sh
@@ -79,6 +79,14 @@ check_image_contents()
-p $TEST_MOUNT_DIR $mtree_excludes_arg
}
+create_manifest_file()
+{
+ # Prefer a specification format that is easier to parse (-C)
+ mtree -k "$DEFAULT_MTREE_KEYWORDS" -cp "$TEST_INPUTS_DIR" | \
+ mtree -C > "$TEST_SPEC_FILE"
+ sed -i "" "s|^\.|.${TEST_INPUTS_DIR##$TMPDIR}|g" "$TEST_SPEC_FILE"
+}
+
create_test_dirs()
{
atf_check mkdir -m 0777 -p $TEST_MOUNT_DIR