diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh --- a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh +++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh @@ -58,31 +58,24 @@ atf_check -e empty -o empty -s exit:0 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 + mtree -cp $TEST_INPUTS_DIR > $TEST_SPEC_FILE atf_check -e empty -o not-empty -s exit:0 \ $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 + cp $TEST_SPEC_FILE spec2.mtree + cat $TEST_SPEC_FILE spec2.mtree > ${TEST_SPEC_FILE}_dupe atf_check -e empty -o not-empty -s not-exit:0 \ - $MAKEFS -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR + $MAKEFS -F ${TEST_SPEC_FILE}_dupe -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 + $MAKEFS -D -F ${TEST_SPEC_FILE}_dupe -M 1m $TEST_IMAGE $TEST_INPUTS_DIR } atf_test_case F_flag cleanup @@ -90,8 +83,7 @@ { create_test_inputs - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -cp $TEST_INPUTS_DIR + mtree -cp $TEST_INPUTS_DIR > $TEST_SPEC_FILE atf_check -e empty -o empty -s exit:0 \ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR @@ -109,8 +101,7 @@ { 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 + mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE cd $TEST_INPUTS_DIR atf_check -e empty -o empty -s exit:0 \ $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE @@ -131,9 +122,8 @@ 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 + mkdir -p $test_inputs_dir2 + 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 @@ -168,8 +158,7 @@ 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 + 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 @@ -185,14 +174,14 @@ 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 + touch $long_path atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o allow-max-name $TEST_IMAGE $TEST_INPUTS_DIR @@ -208,7 +197,7 @@ 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 @@ -242,19 +231,19 @@ atf_test_case o_flag_isolevel_3 cleanup o_flag_isolevel_3_body() { + # XXX: isolevel=3 isn't implemented yet. See FreeBSD bug # 203645 + 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 + + atf_skip "-o isolevel=3 is not implemented" + 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 \ $MAKEFS -o isolevel=3 $TEST_IMAGE $TEST_INPUTS_DIR mount_image check_base_iso9660_image_contents - fi } o_flag_isolevel_3_cleanup() { @@ -273,7 +262,7 @@ 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 + 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 \ @@ -292,7 +281,7 @@ 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 + 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 \ @@ -305,16 +294,15 @@ 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 + 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" + mkdir -p "$(dirname $long_path)" + touch "$long_path" atf_check -e empty -o empty -s exit:0 \ $MAKEFS -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR @@ -342,7 +330,7 @@ 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" + 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 @@ -389,8 +377,7 @@ 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 + mtree -c -k "type,time" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F atf_check -e empty -o not-empty -s exit:0 \ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -o rockridge $TEST_IMAGE $TEST_INPUTS_DIR @@ -414,8 +401,7 @@ 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 + mtree -c -k "type" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE atf_check -e empty -o empty -s exit:0 \ $MAKEFS -T $timestamp -o rockridge $TEST_IMAGE $TEST_SPEC_FILE diff --git a/usr.sbin/makefs/tests/makefs_ffs_tests.sh b/usr.sbin/makefs/tests/makefs_ffs_tests.sh --- a/usr.sbin/makefs/tests/makefs_ffs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_ffs_tests.sh @@ -56,8 +56,7 @@ { 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 + mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE cd $TEST_INPUTS_DIR atf_check -e empty -o not-empty -s exit:0 \ @@ -72,31 +71,24 @@ 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 + mtree -cp $TEST_INPUTS_DIR > $TEST_SPEC_FILE atf_check -e empty -o not-empty -s exit:0 \ $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 + cp $TEST_SPEC_FILE spec2.mtree + cat $TEST_SPEC_FILE spec2.mtree > ${TEST_SPEC_FILE}_dupe atf_check -e empty -o not-empty -s not-exit:0 \ - $MAKEFS -F dupe_$TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR + $MAKEFS -F ${TEST_SPEC_FILE}_dupe -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 + $MAKEFS -D -F ${TEST_SPEC_FILE}_dupe -M 1m $TEST_IMAGE $TEST_INPUTS_DIR } atf_test_case F_flag cleanup @@ -104,8 +96,7 @@ { create_test_inputs - atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \ - mtree -cp $TEST_INPUTS_DIR + mtree -cp $TEST_INPUTS_DIR > $TEST_SPEC_FILE atf_check -e empty -o not-empty -s exit:0 \ $MAKEFS -F $TEST_SPEC_FILE -M 1m $TEST_IMAGE $TEST_INPUTS_DIR @@ -123,8 +114,7 @@ { 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 + mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE cd $TEST_INPUTS_DIR atf_check -e empty -o not-empty -s exit:0 \ @@ -146,9 +136,8 @@ 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 + mkdir -p $test_inputs_dir2 + touch $test_inputs_dir2/multiple_dirs_test_file atf_check -e empty -o not-empty -s exit:0 \ $MAKEFS -M 1m $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2 @@ -273,8 +262,7 @@ 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 + mtree -c -k "type,time" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F atf_check -e empty -o not-empty -s exit:0 \ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -M 1m $TEST_IMAGE $TEST_INPUTS_DIR @@ -298,8 +286,7 @@ 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 + mtree -c -k "type" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE atf_check -e empty -o not-empty -s exit:0 \ $MAKEFS -M 1m -T $timestamp $TEST_IMAGE $TEST_SPEC_FILE @@ -317,7 +304,6 @@ 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 --- a/usr.sbin/makefs/tests/makefs_msdos_tests.sh +++ b/usr.sbin/makefs/tests/makefs_msdos_tests.sh @@ -77,8 +77,7 @@ 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 + mtree -c -k "type,time" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F atf_check -e empty -o not-empty -s exit:0 \ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -s 1m $TEST_IMAGE $TEST_INPUTS_DIR @@ -102,14 +101,13 @@ 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 + mtree -c -k "type" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE atf_check -e empty -o not-empty -s exit:0 \ $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 --- a/usr.sbin/makefs/tests/makefs_tests_common.sh +++ b/usr.sbin/makefs/tests/makefs_tests_common.sh @@ -55,7 +55,8 @@ ;; *) echo "usage: check_image_contents [-d directory ...] [-f mtree-file] [-m mtree-keywords] [-X exclude]" - atf_fail "unhandled option: $flag" + echo "unhandled option: $flag" >&2 + exit 1 ;; esac done @@ -75,16 +76,15 @@ 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 + 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 + mkdir -m 0777 -p $TEST_MOUNT_DIR + mkdir -m 0777 -p $TEST_INPUTS_DIR } create_test_inputs() @@ -93,40 +93,39 @@ 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 + mkdir -m 0755 -p a/b/1 + ln -s a/b c + touch d + ln d e + touch .f + 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 + #mkfifo h + dd if=/dev/zero of=i count=1000 bs=1 2>/dev/null + touch klmn + touch opqr + touch stuv + install -m 0755 /dev/null wxyz + touch 0b00000001 + touch 0b00000010 + touch 0b00000011 + touch 0b00000100 + touch 0b00000101 + touch 0b00000110 + touch 0b00000111 + touch 0b00001000 + touch 0b00001001 + touch 0b00001010 + touch 0b00001011 + touch 0b00001100 + touch 0b00001101 + 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 + dd if=/dev/zero of=${filesize}.file bs=1 \ + count=${filesize} conv=sparse 2>/dev/null files="${files} ${filesize}.file" done @@ -135,10 +134,8 @@ 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 + mdconfig -a -f $TEST_IMAGE > $TEST_MD_DEVICE_FILE + $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 --- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh @@ -997,8 +997,7 @@ 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 + mtree -c -k "type,time" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE change_mtree_timestamp $TEST_SPEC_FILE $timestamp_F atf_check -e empty -o not-empty -s exit:0 \ $MAKEFS -F $TEST_SPEC_FILE -T $timestamp_T -s 10g -o rootpath=/ \ @@ -1023,8 +1022,7 @@ 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 + mtree -c -k "type" -p $TEST_INPUTS_DIR > $TEST_SPEC_FILE atf_check $MAKEFS -T $timestamp -s 10g -o rootpath=/ -o poolname=$ZFS_POOL_NAME \ $TEST_IMAGE $TEST_SPEC_FILE