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
This commit is contained in:
parent
7bdfc3b75e
commit
66845bf5c5
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 -
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user