The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=0a6deb87c2802a47709c58d09b5f9122ed40c157
commit 0a6deb87c2802a47709c58d09b5f9122ed40c157 Author: Jose Luis Duran <[email protected]> AuthorDate: 2026-01-05 20:32:46 +0000 Commit: Jose Luis Duran <[email protected]> CommitDate: 2026-01-05 20:32:46 +0000 makefs: tests: Cleanup and remove default flags Cleanup and remove default atf_check flags for clarity. The following two lines are equivalent: atf_check $cmd atf_check -s exit:0 -e empty -o empty $cmd Update the links to the reference documents. Remove the D_flag_cleanup function, as common_cleanup() for these particular set of tests does two things: 1. Unmount the md(4) device. 2. Destroy the md(4) device. Essentially, one should only call common_cleanup() if the test body invokes mount_image(). This is not the case for D_flag_body(). No functional changes intended. Reviewed by: ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54427 --- usr.sbin/makefs/tests/makefs_cd9660_tests.sh | 147 +++++++++++---------------- usr.sbin/makefs/tests/makefs_ffs_tests.sh | 69 +++++-------- usr.sbin/makefs/tests/makefs_msdos_tests.sh | 14 +-- usr.sbin/makefs/tests/makefs_tests_common.sh | 73 +++++++------ usr.sbin/makefs/tests/makefs_zfs_tests.sh | 69 +++++-------- 5 files changed, 154 insertions(+), 218 deletions(-) diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh index b36753de3393..5b1a53443290 100644 --- a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh +++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh @@ -26,11 +26,11 @@ # A note on specs: # - A copy of the ISO-9660 spec can be found here: -# https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-119.pdf +# https://ecma-international.org/wp-content/uploads/ECMA-119_5th_edition_december_2024.pdf # - Any references to `rockridge` are referring to the `Rock Ridge` extensions # of the ISO-9660 spec. A copy of the draft `IEEE-P1282` spec can be found # here: -# http://www.ymi.com/ymi/sites/default/files/pdf/Rockridge.pdf +# https://people.freebsd.org/~emaste/rrip112.pdf MAKEFS="makefs -t cd9660" MOUNT="mount_cd9660" @@ -54,35 +54,28 @@ check_base_iso9660_image_contents() # specified, and directories cannot contain a '.'. check_image_contents "$@" -X c -X .g -X _g - atf_check -e empty -o empty -s exit:0 test -L $TEST_INPUTS_DIR/c - atf_check -e empty -o empty -s exit:0 test -f $TEST_MOUNT_DIR/c + atf_check test -L $TEST_INPUTS_DIR/c + atf_check test -f $TEST_MOUNT_DIR/c } -atf_test_case D_flag 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 -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -cp $TEST_INPUTS_DIR - atf_check -e empty -o not-empty -s exit:0 \ + 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 - atf_check -e empty -o empty -s exit:0 \ - cp $TEST_SPEC_FILE spec2.mtree - atf_check -e empty -o save:dupe_$TEST_SPEC_FILE -s exit:0 \ - cat $TEST_SPEC_FILE spec2.mtree + atf_check cp $TEST_SPEC_FILE spec2.mtree + atf_check -o save:${TEST_SPEC_FILE}_dupe cat $TEST_SPEC_FILE spec2.mtree - atf_check -e empty -o not-empty -s not-exit:0 \ - $MAKEFS -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR - atf_check -e empty -o not-empty -s exit:0 \ - $MAKEFS -D -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR -} -D_flag_cleanup() -{ - common_cleanup + 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 } atf_test_case F_flag cleanup @@ -90,11 +83,9 @@ F_flag_body() { create_test_inputs - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -cp $TEST_INPUTS_DIR + atf_check -o save:$TEST_SPEC_FILE mtree -cp $TEST_INPUTS_DIR - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_base_iso9660_image_contents @@ -109,11 +100,10 @@ from_mtree_spec_file_body() { create_test_inputs - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ + atf_check -o save:$TEST_SPEC_FILE \ mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR cd $TEST_INPUTS_DIR - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE + atf_check $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE cd - mount_image @@ -131,12 +121,10 @@ from_multiple_dirs_body() create_test_inputs - atf_check -e empty -o empty -s exit:0 mkdir -p $test_inputs_dir2 - atf_check -e empty -o empty -s exit:0 \ - touch $test_inputs_dir2/multiple_dirs_test_file + atf_check mkdir -p $test_inputs_dir2 + atf_check touch $test_inputs_dir2/multiple_dirs_test_file - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2 + atf_check $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2 mount_image check_base_iso9660_image_contents -d $test_inputs_dir2 @@ -151,8 +139,7 @@ from_single_dir_body() { create_test_inputs - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_base_iso9660_image_contents @@ -168,11 +155,9 @@ o_flag_allow_deep_trees_body() create_test_inputs # Make sure the "more than 8 levels deep" requirement is met. - atf_check -e empty -o empty -s exit:0 \ - mkdir -p $TEST_INPUTS_DIR/a/b/c/d/e/f/g/h/i/j + atf_check mkdir -p $TEST_INPUTS_DIR/a/b/c/d/e/f/g/h/i/j - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o allow-deep-trees $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -o allow-deep-trees $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_base_iso9660_image_contents @@ -185,17 +170,16 @@ o_flag_allow_deep_trees_cleanup() atf_test_case o_flag_allow_max_name cleanup o_flag_allow_max_name_body() { - atf_expect_fail "-o allow-max-name doesn't appear to be implemented on FreeBSD's copy of makefs [yet]" + atf_skip "-o allow-max-name is not implemented" create_test_inputs long_path=$TEST_INPUTS_DIR/$(jot -s '' -b 0 37) # Make sure the "37 char name" limit requirement is met. - atf_check -e empty -o empty -s exit:0 touch $long_path + atf_check touch $long_path - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o allow-max-name $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -o allow-max-name $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_base_iso9660_image_contents @@ -208,12 +192,11 @@ o_flag_allow_max_name_cleanup() atf_test_case o_flag_isolevel_1 cleanup o_flag_isolevel_1_body() { - atf_expect_fail "this testcase needs work; the filenames generated seem incorrect/corrupt" + atf_skip "-o isolevel=1 is failing" create_test_inputs - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o isolevel=1 $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -o isolevel=1 $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_base_iso9660_image_contents @@ -228,8 +211,7 @@ o_flag_isolevel_2_body() { create_test_inputs - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o isolevel=2 $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -o isolevel=2 $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_base_iso9660_image_contents @@ -242,19 +224,19 @@ o_flag_isolevel_2_cleanup() atf_test_case o_flag_isolevel_3 cleanup o_flag_isolevel_3_body() { - create_test_inputs - # XXX: isolevel=3 isn't implemented yet. See FreeBSD bug # 203645 - if true; then - atf_check -e match:'makefs: ISO Level 3 is greater than 2\.' -o empty -s not-exit:0 \ - $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR - else - atf_check -e empty -o empty -s exit:0 \ + atf_check -e match:'makefs: ISO Level 3 is greater than 2\.' \ + -s not-exit:0 \ $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR + atf_skip "-o isolevel=3 is not implemented" + + create_test_inputs + + atf_check $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR + mount_image check_base_iso9660_image_contents - fi } o_flag_isolevel_3_cleanup() { @@ -273,11 +255,9 @@ o_flag_preparer_body() preparer='My Very First ISO' preparer_uppercase="$(echo $preparer | tr '[[:lower:]]' '[[:upper:]]')" - atf_check -e empty -o empty -s exit:0 touch $TEST_INPUTS_DIR/dummy_file - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o preparer="$preparer" $TEST_IMAGE $TEST_INPUTS_DIR - atf_check -e empty -o match:"$preparer_uppercase" -s exit:0 \ - strings $TEST_IMAGE + atf_check touch $TEST_INPUTS_DIR/dummy_file + atf_check $MAKEFS -o preparer="$preparer" $TEST_IMAGE $TEST_INPUTS_DIR + atf_check -o match:"$preparer_uppercase" strings $TEST_IMAGE } atf_test_case o_flag_publisher @@ -292,11 +272,9 @@ o_flag_publisher_body() publisher='My Super Awesome Publishing Company LTD' publisher_uppercase="$(echo $publisher | tr '[[:lower:]]' '[[:upper:]]')" - atf_check -e empty -o empty -s exit:0 touch $TEST_INPUTS_DIR/dummy_file - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o publisher="$publisher" $TEST_IMAGE $TEST_INPUTS_DIR - atf_check -e empty -o match:"$publisher_uppercase" -s exit:0 \ - strings $TEST_IMAGE + atf_check touch $TEST_INPUTS_DIR/dummy_file + atf_check $MAKEFS -o publisher="$publisher" $TEST_IMAGE $TEST_INPUTS_DIR + atf_check -o match:"$publisher_uppercase" strings $TEST_IMAGE } atf_test_case o_flag_rockridge cleanup @@ -305,27 +283,24 @@ o_flag_rockridge_body() create_test_dirs # Make sure the "more than 8 levels deep" requirement is met. - atf_check -e empty -o empty -s exit:0 \ - mkdir -p $TEST_INPUTS_DIR/a/b/c/d/e/f/g/h/i/j + atf_check mkdir -p $TEST_INPUTS_DIR/a/b/c/d/e/f/g/h/i/j # Make sure the "pathname larger than 255 chars" requirement is met. # # $long_path's needs to be nested in a directory, as creating it # outright as a 256 char filename via touch will fail with ENAMETOOLONG long_path=$TEST_INPUTS_DIR/$(jot -s '/' -b "$(jot -s '' -b 0 64)" 4) - atf_check -e empty -o empty -s exit:0 mkdir -p "$(dirname $long_path)" - atf_check -e empty -o empty -s exit:0 touch "$long_path" + atf_check mkdir -p "$(dirname $long_path)" + atf_check touch "$long_path" - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_image_contents -X .rr_moved # .rr_moved is a special directory created when you have deep directory # trees with rock ridge extensions on - atf_check -e empty -o empty -s exit:0 \ - test -d $TEST_MOUNT_DIR/.rr_moved + atf_check test -d $TEST_MOUNT_DIR/.rr_moved } o_flag_rockridge_cleanup() { @@ -342,13 +317,12 @@ o_flag_rockridge_dev_nodes_body() create_test_dirs (tar -cvf - -C /dev null && touch .tar_ok) | \ - atf_check -e not-empty -o empty -s exit:0 tar -xvf - -C "$TEST_INPUTS_DIR" + atf_check -e not-empty tar -xvf - -C "$TEST_INPUTS_DIR" - atf_check -e empty -o empty -s exit:0 test -c $TEST_INPUTS_DIR/null - atf_check -e empty -o empty -s exit:0 test -f .tar_ok + atf_check test -c $TEST_INPUTS_DIR/null + atf_check test -f .tar_ok - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_image_contents @@ -365,8 +339,7 @@ T_flag_dir_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR mount_image eval $(stat -s $TEST_MOUNT_DIR/dir1) @@ -389,10 +362,9 @@ T_flag_F_flag_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -c -k "type,time" -p $TEST_INPUTS_DIR + atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type,time" -p $TEST_INPUTS_DIR change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F - atf_check -e empty -o not-empty -s exit:0 \ + atf_check \ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR mount_image @@ -414,10 +386,8 @@ T_flag_mtree_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -c -k "type" -p $TEST_INPUTS_DIR - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_SPEC_FILE + atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type" -p $TEST_INPUTS_DIR + atf_check $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_SPEC_FILE mount_image eval $(stat -s $TEST_MOUNT_DIR/dir1) @@ -446,8 +416,7 @@ duplicate_names_body() mkdir -p $TEST_INPUTS_DIR/${dir_prefix}2 mkdir -p $TEST_INPUTS_DIR/${dir_prefix}3 - atf_check -e empty -o empty -s exit:0 \ - $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR + atf_check $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR # Disable Rock Ridge extensions to read the plain ISO Level 2 names. mount_image -r diff --git a/usr.sbin/makefs/tests/makefs_ffs_tests.sh b/usr.sbin/makefs/tests/makefs_ffs_tests.sh index f828f632b06e..6b8fb4afd707 100644 --- a/usr.sbin/makefs/tests/makefs_ffs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_ffs_tests.sh @@ -44,7 +44,7 @@ common_cleanup() check_ffs_image_contents() { - atf_check -e save:$TEST_TUNEFS_OUTPUT -o empty -s exit:0 \ + atf_check -e save:$TEST_TUNEFS_OUTPUT \ tunefs -p /dev/$(cat $TEST_MD_DEVICE_FILE) check_image_contents "$@" @@ -56,12 +56,11 @@ autocalculate_image_size_body() { create_test_inputs - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ + atf_check -o save:$TEST_SPEC_FILE \ 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 + atf_check -o not-empty $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE cd - mount_image @@ -72,31 +71,24 @@ autocalculate_image_size_cleanup() common_cleanup } -atf_test_case D_flag 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 -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -cp $TEST_INPUTS_DIR - atf_check -e empty -o not-empty -s exit:0 \ + 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 - atf_check -e empty -o empty -s exit:0 \ - cp $TEST_SPEC_FILE spec2.mtree - atf_check -e empty -o save:dupe_$TEST_SPEC_FILE -s exit:0 \ - cat $TEST_SPEC_FILE spec2.mtree + atf_check cp $TEST_SPEC_FILE spec2.mtree + atf_check -o save:${TEST_SPEC_FILE}_dupe cat $TEST_SPEC_FILE spec2.mtree - atf_check -e empty -o not-empty -s not-exit:0 \ - $MAKEFS -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR - atf_check -e empty -o not-empty -s exit:0 \ - $MAKEFS -D -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR -} -D_flag_cleanup() -{ - common_cleanup + 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 } atf_test_case F_flag cleanup @@ -104,10 +96,9 @@ F_flag_body() { create_test_inputs - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -cp $TEST_INPUTS_DIR + atf_check -o save:$TEST_SPEC_FILE mtree -cp $TEST_INPUTS_DIR - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR mount_image @@ -123,12 +114,11 @@ from_mtree_spec_file_body() { create_test_inputs - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ + atf_check -o save:$TEST_SPEC_FILE \ 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 -M 1m $TEST_IMAGE $TEST_SPEC_FILE + atf_check -o not-empty $MAKEFS -M 1m $TEST_IMAGE $TEST_SPEC_FILE cd - mount_image @@ -146,11 +136,10 @@ from_multiple_dirs_body() create_test_inputs - atf_check -e empty -o empty -s exit:0 mkdir -p $test_inputs_dir2 - atf_check -e empty -o empty -s exit:0 \ - touch $test_inputs_dir2/multiple_dirs_test_file + atf_check mkdir -p $test_inputs_dir2 + atf_check touch $test_inputs_dir2/multiple_dirs_test_file - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -M 1m $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2 mount_image @@ -166,8 +155,7 @@ from_single_dir_body() { create_test_inputs - atf_check -e empty -o not-empty -s exit:0 \ - $MAKEFS -M 1m $TEST_IMAGE $TEST_INPUTS_DIR + atf_check -o not-empty $MAKEFS -M 1m $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_ffs_image_contents @@ -197,7 +185,7 @@ o_flag_version_1_body() create_test_inputs - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -M 1m -o version=$ffs_version $TEST_IMAGE $TEST_INPUTS_DIR mount_image @@ -229,7 +217,7 @@ o_flag_version_2_body() create_test_inputs - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -M 1m -o version=$ffs_version $TEST_IMAGE $TEST_INPUTS_DIR mount_image @@ -249,7 +237,7 @@ T_flag_dir_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -M 1m -T $timestamp $TEST_IMAGE $TEST_INPUTS_DIR mount_image @@ -273,10 +261,9 @@ T_flag_F_flag_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -c -k "type,time" -p $TEST_INPUTS_DIR + atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type,time" -p $TEST_INPUTS_DIR change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -M 1m $TEST_IMAGE $TEST_INPUTS_DIR mount_image @@ -298,9 +285,8 @@ T_flag_mtree_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -c -k "type" -p $TEST_INPUTS_DIR - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type" -p $TEST_INPUTS_DIR + atf_check -o not-empty \ $MAKEFS -M 1m -T $timestamp $TEST_IMAGE $TEST_SPEC_FILE mount_image @@ -317,7 +303,6 @@ T_flag_mtree_cleanup() atf_init_test_cases() { - atf_add_test_case autocalculate_image_size atf_add_test_case D_flag diff --git a/usr.sbin/makefs/tests/makefs_msdos_tests.sh b/usr.sbin/makefs/tests/makefs_msdos_tests.sh index ce246f3d268c..00ab1509ef55 100644 --- a/usr.sbin/makefs/tests/makefs_msdos_tests.sh +++ b/usr.sbin/makefs/tests/makefs_msdos_tests.sh @@ -30,6 +30,7 @@ MAKEFS="makefs -t msdos" MOUNT="mount_msdosfs" + . "$(dirname "$0")/makefs_tests_common.sh" common_cleanup() @@ -53,7 +54,7 @@ T_flag_dir_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -T $timestamp -s 1m $TEST_IMAGE $TEST_INPUTS_DIR mount_image @@ -77,10 +78,10 @@ T_flag_F_flag_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ + atf_check -o save:$TEST_SPEC_FILE \ mtree -c -k "type,time" -p $TEST_INPUTS_DIR change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -s 1m $TEST_IMAGE $TEST_INPUTS_DIR mount_image @@ -102,14 +103,13 @@ T_flag_mtree_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -c -k "type" -p $TEST_INPUTS_DIR - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type" -p $TEST_INPUTS_DIR + atf_check -o not-empty \ $MAKEFS -T $timestamp -s 1m $TEST_IMAGE $TEST_SPEC_FILE mount_image eval $(stat -s $TEST_MOUNT_DIR/dir1) - # FAT directory entries don't have an access time, just a date. + # 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 diff --git a/usr.sbin/makefs/tests/makefs_tests_common.sh b/usr.sbin/makefs/tests/makefs_tests_common.sh index edb79bc811e1..fa2cbaff9521 100644 --- a/usr.sbin/makefs/tests/makefs_tests_common.sh +++ b/usr.sbin/makefs/tests/makefs_tests_common.sh @@ -75,16 +75,14 @@ check_image_contents() echo "<---- Input spec BEGIN ---->" cat $mtree_file echo "<---- Input spec END ---->" - atf_check -e empty -o empty -s exit:0 \ - mtree -UW -f $mtree_file \ - -p $TEST_MOUNT_DIR \ - $mtree_excludes_arg + atf_check mtree -UW -f $mtree_file \ + -p $TEST_MOUNT_DIR $mtree_excludes_arg } create_test_dirs() { - atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_MOUNT_DIR - atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_INPUTS_DIR + atf_check mkdir -m 0777 -p $TEST_MOUNT_DIR + atf_check mkdir -m 0777 -p $TEST_INPUTS_DIR } create_test_inputs() @@ -93,40 +91,39 @@ create_test_inputs() cd $TEST_INPUTS_DIR - atf_check -e empty -s exit:0 mkdir -m 0755 -p a/b/1 - atf_check -e empty -s exit:0 ln -s a/b c - atf_check -e empty -s exit:0 touch d - atf_check -e empty -s exit:0 ln d e - atf_check -e empty -s exit:0 touch .f - atf_check -e empty -s exit:0 mkdir .g + atf_check mkdir -m 0755 -p a/b/1 + atf_check ln -s a/b c + atf_check touch d + atf_check ln d e + atf_check touch .f + atf_check mkdir .g # XXX: fifos on the filesystem don't match fifos created by makefs for # some odd reason. - #atf_check -e empty -s exit:0 mkfifo h - atf_check -e ignore -s exit:0 dd if=/dev/zero of=i count=1000 bs=1 - atf_check -e empty -s exit:0 touch klmn - atf_check -e empty -s exit:0 touch opqr - atf_check -e empty -s exit:0 touch stuv - atf_check -e empty -s exit:0 install -m 0755 /dev/null wxyz - atf_check -e empty -s exit:0 touch 0b00000001 - atf_check -e empty -s exit:0 touch 0b00000010 - atf_check -e empty -s exit:0 touch 0b00000011 - atf_check -e empty -s exit:0 touch 0b00000100 - atf_check -e empty -s exit:0 touch 0b00000101 - atf_check -e empty -s exit:0 touch 0b00000110 - atf_check -e empty -s exit:0 touch 0b00000111 - atf_check -e empty -s exit:0 touch 0b00001000 - atf_check -e empty -s exit:0 touch 0b00001001 - atf_check -e empty -s exit:0 touch 0b00001010 - atf_check -e empty -s exit:0 touch 0b00001011 - atf_check -e empty -s exit:0 touch 0b00001100 - atf_check -e empty -s exit:0 touch 0b00001101 - atf_check -e empty -s exit:0 touch 0b00001110 + #atf_check mkfifo h + atf_check -e ignore dd if=/dev/zero of=i count=1000 bs=1 + atf_check touch klmn + atf_check touch opqr + atf_check touch stuv + atf_check install -m 0755 /dev/null wxyz + atf_check touch 0b00000001 + atf_check touch 0b00000010 + atf_check touch 0b00000011 + atf_check touch 0b00000100 + atf_check touch 0b00000101 + atf_check touch 0b00000110 + atf_check touch 0b00000111 + atf_check touch 0b00001000 + atf_check touch 0b00001001 + atf_check touch 0b00001010 + atf_check touch 0b00001011 + atf_check touch 0b00001100 + atf_check touch 0b00001101 + atf_check touch 0b00001110 for filesize in 1 512 $(( 2 * $KB )) $(( 10 * $KB )) $(( 512 * $KB )); \ do - atf_check -e ignore -o empty -s exit:0 \ - dd if=/dev/zero of=${filesize}.file bs=1 \ - count=1 oseek=${filesize} conv=sparse + atf_check -e ignore dd if=/dev/zero of=${filesize}.file bs=1 \ + count=${filesize} conv=sparse files="${files} ${filesize}.file" done @@ -135,10 +132,8 @@ create_test_inputs() mount_image() { - atf_check -e empty -o save:$TEST_MD_DEVICE_FILE -s exit:0 \ - mdconfig -a -f $TEST_IMAGE - atf_check -e empty -o empty -s exit:0 \ - $MOUNT ${1} /dev/$(cat $TEST_MD_DEVICE_FILE) $TEST_MOUNT_DIR + atf_check -o save:$TEST_MD_DEVICE_FILE mdconfig -a -f $TEST_IMAGE + atf_check $MOUNT ${1} /dev/$(cat $TEST_MD_DEVICE_FILE) $TEST_MOUNT_DIR } change_mtree_timestamp() diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh b/usr.sbin/makefs/tests/makefs_zfs_tests.sh index 1694fa05683b..7dd6005e49ec 100644 --- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh @@ -58,9 +58,8 @@ common_cleanup() import_image() { - atf_check -e empty -o save:$TEST_MD_DEVICE_FILE -s exit:0 \ - mdconfig -a -f $TEST_IMAGE - atf_check -o ignore -e empty -s exit:0 \ + atf_check -o save:$TEST_MD_DEVICE_FILE mdconfig -a -f $TEST_IMAGE + atf_check -o ignore \ zdb -e -p /dev/$(cat $TEST_MD_DEVICE_FILE) -mmm -ddddd $ZFS_POOL_NAME atf_check zpool import -R $TEST_MOUNT_DIR $ZFS_POOL_NAME echo "$ZFS_POOL_NAME" > $TEST_ZFS_POOL_NAME @@ -167,11 +166,11 @@ compression_body() fi # The "dir" dataset's compression algorithm should be # inherited from the root dataset. - atf_check -o inline:$alg\\n -e empty -s exit:0 \ + atf_check -o inline:$alg\\n \ zfs get -H -o value compression ${ZFS_POOL_NAME} - atf_check -o inline:$alg\\n -e empty -s exit:0 \ + atf_check -o inline:$alg\\n \ zfs get -H -o value compression ${ZFS_POOL_NAME}/dir - atf_check -o inline:off\\n -e empty -s exit:0 \ + atf_check -o inline:off\\n \ zfs get -H -o value compression ${ZFS_POOL_NAME}/dir2 atf_check -e ignore dd if=/dev/random \ @@ -184,7 +183,7 @@ compression_body() # Export and reimport to ensure that everything is # flushed to disk. atf_check zpool export ${ZFS_POOL_NAME} - atf_check -o ignore -e empty -s exit:0 \ + atf_check -o ignore \ zdb -e -p /dev/$(cat $TEST_MD_DEVICE_FILE) -mmm -ddddd \ $ZFS_POOL_NAME atf_check zpool import -R $TEST_MOUNT_DIR $ZFS_POOL_NAME @@ -413,20 +412,16 @@ hard_links_body() stat -f '%i' ${TEST_MOUNT_DIR}/1 > ./ino stat -f '%l' ${TEST_MOUNT_DIR}/1 > ./nlink for f in 1 2 dir/1; do - atf_check -o file:./nlink -e empty -s exit:0 \ - stat -f '%l' ${TEST_MOUNT_DIR}/${f} - atf_check -o file:./ino -e empty -s exit:0 \ - stat -f '%i' ${TEST_MOUNT_DIR}/${f} + atf_check -o file:./nlink stat -f '%l' ${TEST_MOUNT_DIR}/${f} + atf_check -o file:./ino stat -f '%i' ${TEST_MOUNT_DIR}/${f} atf_check cmp -s ${TEST_INPUTS_DIR}/1 ${TEST_MOUNT_DIR}/${f} done stat -f '%i' ${TEST_MOUNT_DIR}/dir/a > ./ino stat -f '%l' ${TEST_MOUNT_DIR}/dir/a > ./nlink for f in dir/a dir/b a; do - atf_check -o file:./nlink -e empty -s exit:0 \ - stat -f '%l' ${TEST_MOUNT_DIR}/${f} - atf_check -o file:./ino -e empty -s exit:0 \ - stat -f '%i' ${TEST_MOUNT_DIR}/${f} + atf_check -o file:./nlink stat -f '%l' ${TEST_MOUNT_DIR}/${f} + atf_check -o file:./ino stat -f '%i' ${TEST_MOUNT_DIR}/${f} atf_check cmp -s ${TEST_INPUTS_DIR}/dir/a ${TEST_MOUNT_DIR}/${f} done } @@ -535,19 +530,19 @@ multi_dataset_1_body() check_image_contents # Make sure that we have three datasets with the expected mount points. - atf_check -o inline:${ZFS_POOL_NAME}\\n -e empty -s exit:0 \ + atf_check -o inline:${ZFS_POOL_NAME}\\n \ zfs list -H -o name ${ZFS_POOL_NAME} - atf_check -o inline:${TEST_MOUNT_DIR}\\n -e empty -s exit:0 \ + atf_check -o inline:${TEST_MOUNT_DIR}\\n \ zfs list -H -o mountpoint ${ZFS_POOL_NAME} - atf_check -o inline:${ZFS_POOL_NAME}/dir1\\n -e empty -s exit:0 \ + atf_check -o inline:${ZFS_POOL_NAME}/dir1\\n \ zfs list -H -o name ${ZFS_POOL_NAME}/dir1 - atf_check -o inline:${TEST_MOUNT_DIR}/dir1\\n -e empty -s exit:0 \ + atf_check -o inline:${TEST_MOUNT_DIR}/dir1\\n \ zfs list -H -o mountpoint ${ZFS_POOL_NAME}/dir1 - atf_check -o inline:${ZFS_POOL_NAME}/dir2\\n -e empty -s exit:0 \ + atf_check -o inline:${ZFS_POOL_NAME}/dir2\\n \ zfs list -H -o name ${ZFS_POOL_NAME}/dir2 - atf_check -o inline:${TEST_MOUNT_DIR}/dir2\\n -e empty -s exit:0 \ + atf_check -o inline:${TEST_MOUNT_DIR}/dir2\\n \ zfs list -H -o mountpoint ${ZFS_POOL_NAME}/dir2 } multi_dataset_1_cleanup() @@ -607,7 +602,7 @@ multi_dataset_3_body() import_image - atf_check -o inline:${TEST_MOUNT_DIR}/dir2\\n -e empty -s exit:0 \ + atf_check -o inline:${TEST_MOUNT_DIR}/dir2\\n \ zfs list -H -o mountpoint ${ZFS_POOL_NAME}/dir2 # Mounting dir2 should have created a directory called dir2. Go @@ -641,14 +636,14 @@ multi_dataset_4_body() import_image - atf_check -o inline:none\\n -e empty -s exit:0 \ + atf_check -o inline:none\\n \ zfs list -H -o mountpoint ${ZFS_POOL_NAME}/dir1 check_image_contents atf_check zfs set mountpoint=/dir1 ${ZFS_POOL_NAME}/dir1 atf_check zfs mount ${ZFS_POOL_NAME}/dir1 - atf_check -o inline:${TEST_MOUNT_DIR}/dir1\\n -e empty -s exit:0 \ + atf_check -o inline:${TEST_MOUNT_DIR}/dir1\\n \ zfs list -H -o mountpoint ${ZFS_POOL_NAME}/dir1 # dir1/a should be part of the root dataset, not dir1. @@ -838,14 +833,10 @@ root_props_body() check_image_contents - atf_check -o inline:off\\n -e empty -s exit:0 \ - zfs get -H -o value atime $ZFS_POOL_NAME - atf_check -o inline:local\\n -e empty -s exit:0 \ - zfs get -H -o source atime $ZFS_POOL_NAME - atf_check -o inline:off\\n -e empty -s exit:0 \ - zfs get -H -o value setuid $ZFS_POOL_NAME - atf_check -o inline:local\\n -e empty -s exit:0 \ - zfs get -H -o source setuid $ZFS_POOL_NAME + atf_check -o inline:off\\n zfs get -H -o value atime $ZFS_POOL_NAME + atf_check -o inline:local\\n zfs get -H -o source atime $ZFS_POOL_NAME + atf_check -o inline:off\\n zfs get -H -o value setuid $ZFS_POOL_NAME + atf_check -o inline:local\\n zfs get -H -o source setuid $ZFS_POOL_NAME } root_props_cleanup() { @@ -898,8 +889,7 @@ used_space_props_body() usedchild=$(zfs list -o usedchild -Hp ${ZFS_POOL_NAME}) atf_check test $usedchild -gt $(($childmb * 1024 * 1024)) -a \ $usedchild -le $(($childmb * 1024 * 1024 + $fudge)) - atf_check -o inline:'0\n' \ - zfs list -Hp -o usedchild ${ZFS_POOL_NAME}/dir + atf_check -o inline:'0\n' zfs list -Hp -o usedchild ${ZFS_POOL_NAME}/dir # Make sure that the used property value makes sense: the parent's # value is the sum of the two sizes, and the child's value is the @@ -908,8 +898,7 @@ used_space_props_body() atf_check test $used -gt $(($totalmb * 1024 * 1024)) -a \ $used -le $(($totalmb * 1024 * 1024 + 2 * $fudge)) used=$(zfs list -o used -Hp ${ZFS_POOL_NAME}/dir) - atf_check -o inline:$used'\n' \ - zfs list -Hp -o usedds ${ZFS_POOL_NAME}/dir + atf_check -o inline:$used'\n' zfs list -Hp -o usedds ${ZFS_POOL_NAME}/dir # Both datasets do not have snapshots. atf_check -o inline:'0\n' zfs list -Hp -o usedsnap ${ZFS_POOL_NAME} @@ -956,7 +945,6 @@ perms_body() su -m tests -c ${TEST_INPUTS_DIR}/$mode fi done - } perms_cleanup() { @@ -997,10 +985,10 @@ T_flag_F_flag_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ + atf_check -o save:$TEST_SPEC_FILE \ mtree -c -k "type,time" -p $TEST_INPUTS_DIR change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F - atf_check -e empty -o not-empty -s exit:0 \ + atf_check -o not-empty \ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -s 10g -o rootpath=/ \ -o poolname=$ZFS_POOL_NAME $TEST_IMAGE $TEST_INPUTS_DIR @@ -1023,8 +1011,7 @@ T_flag_mtree_body() create_test_dirs mkdir -p $TEST_INPUTS_DIR/dir1 - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -c -k "type" -p $TEST_INPUTS_DIR + atf_check -o save:$TEST_SPEC_FILE mtree -c -k "type" -p $TEST_INPUTS_DIR atf_check $MAKEFS -T $timestamp -s 10g -o rootpath=/ -o poolname=$ZFS_POOL_NAME \ $TEST_IMAGE $TEST_SPEC_FILE
