makefs(8): add test case for PR 229929

Fix two failing makefs test cases by adding "-M 1m", which was already used
for every other FFS test case.  Add a new test case for the underlying
issue: with no -M, -m, or -s options, makefs can underestimate image size.

PR:		229929
Reported by:	Jenkins
MFC after:	2 weeks
This commit is contained in:
asomers 2018-07-21 17:24:14 +00:00
parent adc2e8d736
commit d9f7479868

View File

@ -53,6 +53,29 @@ check_ffs_image_contents()
check_image_contents "$@"
}
# With no -M, -m, or -s options, makefs should autocalculate the image size
atf_test_case autocalculate_image_size cleanup
autocalculate_image_size_body()
{
atf_expect_fail "PR 229929 makefs(8) can underestimate image size"
create_test_inputs
atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
cd $TEST_INPUTS_DIR
atf_check -e empty -o not-empty -s exit:0 \
$MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
cd -
mount_image
check_ffs_image_contents
}
autocalculate_image_size_cleanup()
{
common_cleanup
}
atf_test_case D_flag cleanup
D_flag_body()
{
@ -109,7 +132,7 @@ from_mtree_spec_file_body()
cd $TEST_INPUTS_DIR
atf_check -e empty -o not-empty -s exit:0 \
$MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
$MAKEFS -M 1m $TEST_IMAGE $TEST_SPEC_FILE
cd -
mount_image
@ -132,7 +155,7 @@ from_multiple_dirs_body()
touch $test_inputs_dir2/multiple_dirs_test_file
atf_check -e empty -o not-empty -s exit:0 \
$MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2
$MAKEFS -M 1m $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2
mount_image
check_image_contents -d $test_inputs_dir2
@ -225,6 +248,8 @@ o_flag_version_2_cleanup()
atf_init_test_cases()
{
atf_add_test_case autocalculate_image_size
atf_add_test_case D_flag
atf_add_test_case F_flag