summaryrefslogtreecommitdiffstats
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-10-22 07:22:05 +0000
committerngie <ngie@FreeBSD.org>2015-10-22 07:22:05 +0000
commite76b6b65c98cb07b80bf222c1d0b9751f8be8579 (patch)
tree4f008b55b0f448457f325fe7d5ee75fbd93d9db0 /usr.sbin/makefs
parent0ce91a608bfee744e6646e3e44a8dfdebd27ed6a (diff)
downloadFreeBSD-src-e76b6b65c98cb07b80bf222c1d0b9751f8be8579.zip
FreeBSD-src-e76b6b65c98cb07b80bf222c1d0b9751f8be8579.tar.gz
Revise "create_test_inputs" to simplify the file structure as
these testcases don't need to be nested as much as bin/ls/ls_tests.sh do when verifying ls -a, ls -A, etc. This allows the tests to make all paths relative to the top of the temporary directory instead of always tacking on $ATF_TMPDIR, thus complicating things unnecessarily Create non-empty files in create_test_inputs as well now, similar to create_test_inputs2 in bin/ls/ls_tests.sh Compare the input files to the output file contents using diff where possible: - Skip over the fifo comparison for now because it always fails - Skip over the symlink comparison on cd9660 because it always fails today Sponsored by: EMC / Isilon Storage Division MFC after: 2 weeks X-MFC with: r289739
Diffstat (limited to 'usr.sbin/makefs')
-rwxr-xr-xusr.sbin/makefs/tests/makefs_cd9660_tests.sh12
-rwxr-xr-xusr.sbin/makefs/tests/makefs_ffs_tests.sh6
-rwxr-xr-xusr.sbin/makefs/tests/makefs_tests_common.sh35
3 files changed, 30 insertions, 23 deletions
diff --git a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
index 55465bd..e79e0d5 100755
--- a/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_cd9660_tests.sh
@@ -30,7 +30,6 @@
. "$(dirname "$0")/makefs_tests_common.sh"
MAKEFS="makefs -t cd9660"
-TEST_IMAGE="test.iso"
atf_test_case basic_cd9660 cleanup
basic_cd9660_body()
@@ -43,12 +42,17 @@ basic_cd9660_body()
mdconfig -a -f $TEST_IMAGE
atf_check -e empty -o empty -s exit:0 \
mount_cd9660 /dev/$(cat $TEST_MD_DEVICE_FILE) $TEST_MOUNT_DIR
- atf_check -e empty -o not-empty -s exit:0 ls $TEST_MOUNT_DIR
+ # diffutils doesn't feature --no-dereference until v3.3, so
+ # $TEST_INPUTS_DIR/c will mismatch with $TEST_MOUNT_DIR/c (the
+ # former will look like a directory; the latter like a file).
+ #
+ # XXX: the latter behavior seems suspect; seems like it should be a
+ # symlink; need to verify this with mkisofs, etc
+ atf_check -e empty -o empty -s exit:0 \
+ diff --exclude c -Naur $TEST_INPUTS_DIR $TEST_MOUNT_DIR
}
basic_cd9660_cleanup()
{
- ls -a
-
test_md_device=$(cat $TEST_MD_DEVICE_FILE) || return
umount -f /dev/$test_md_device
diff --git a/usr.sbin/makefs/tests/makefs_ffs_tests.sh b/usr.sbin/makefs/tests/makefs_ffs_tests.sh
index ff86c74..ee5827d 100755
--- a/usr.sbin/makefs/tests/makefs_ffs_tests.sh
+++ b/usr.sbin/makefs/tests/makefs_ffs_tests.sh
@@ -30,7 +30,6 @@
. "$(dirname "$0")/makefs_tests_common.sh"
MAKEFS="makefs -t ffs"
-TEST_IMAGE="test.img"
atf_test_case basic_ffs cleanup
basic_ffs_body()
@@ -45,12 +44,11 @@ basic_ffs_body()
tunefs -p /dev/$(cat $TEST_MD_DEVICE_FILE)
atf_check -e empty -o empty -s exit:0 \
mount /dev/$(cat $TEST_MD_DEVICE_FILE) $TEST_MOUNT_DIR
- atf_check -e empty -o not-empty -s exit:0 ls $TEST_MOUNT_DIR
+ atf_check -e empty -o empty -s exit:0 \
+ diff -Naur $TEST_INPUTS_DIR $TEST_MOUNT_DIR
}
basic_ffs_cleanup()
{
- ls -a
-
test_md_device=$(cat $TEST_MD_DEVICE_FILE) || return
umount -f /dev/$test_md_device
diff --git a/usr.sbin/makefs/tests/makefs_tests_common.sh b/usr.sbin/makefs/tests/makefs_tests_common.sh
index c90557a..a3d6e50 100755
--- a/usr.sbin/makefs/tests/makefs_tests_common.sh
+++ b/usr.sbin/makefs/tests/makefs_tests_common.sh
@@ -27,30 +27,23 @@
# $FreeBSD$
#
+KB=1024
+TEST_IMAGE="test.img"
+TEST_INPUTS_DIR="inputs"
TEST_MD_DEVICE_FILE="md.output"
TEST_MOUNT_DIR="mnt"
-create_test_dir()
+create_test_dirs()
{
- [ -z "$ATF_TMPDIR" ] || return 0
-
- export ATF_TMPDIR=$(pwd)
-
- TEST_MD_DEVICE_FILE="${ATF_TMPDIR}/${TEST_MD_DEVICE_FILE}"
- TEST_MOUNT_DIR="${ATF_TMPDIR}/${TEST_MOUNT_DIR}"
-
- # XXX: need to nest this because of how kyua creates $TMPDIR; otherwise
- # it will run into EPERM issues later
- TEST_INPUTS_DIR="${ATF_TMPDIR}/test/inputs"
-
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
- cd $TEST_INPUTS_DIR
}
create_test_inputs()
{
- create_test_dir
+ create_test_dirs
+
+ 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
@@ -58,7 +51,9 @@ create_test_inputs()
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 -e empty -s exit:0 mkfifo h
+ # 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
@@ -78,4 +73,14 @@ create_test_inputs()
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
+
+ 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
+ files="${files} ${filesize}.file"
+ done
+
+ cd -
}
OpenPOWER on IntegriCloud