From owner-svn-src-all@freebsd.org Thu Oct 22 07:22:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99CE1A1CED1; Thu, 22 Oct 2015 07:22:06 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5ABA21FEC; Thu, 22 Oct 2015 07:22:06 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9M7M50p090814; Thu, 22 Oct 2015 07:22:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9M7M5EN090811; Thu, 22 Oct 2015 07:22:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201510220722.t9M7M5EN090811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 22 Oct 2015 07:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289743 - head/usr.sbin/makefs/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Oct 2015 07:22:06 -0000 Author: ngie Date: Thu Oct 22 07:22:05 2015 New Revision: 289743 URL: https://svnweb.freebsd.org/changeset/base/289743 Log: 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 Modified: head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh head/usr.sbin/makefs/tests/makefs_ffs_tests.sh head/usr.sbin/makefs/tests/makefs_tests_common.sh Modified: head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh ============================================================================== --- head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Thu Oct 22 07:01:01 2015 (r289742) +++ head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh Thu Oct 22 07:22:05 2015 (r289743) @@ -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 Modified: head/usr.sbin/makefs/tests/makefs_ffs_tests.sh ============================================================================== --- head/usr.sbin/makefs/tests/makefs_ffs_tests.sh Thu Oct 22 07:01:01 2015 (r289742) +++ head/usr.sbin/makefs/tests/makefs_ffs_tests.sh Thu Oct 22 07:22:05 2015 (r289743) @@ -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 Modified: head/usr.sbin/makefs/tests/makefs_tests_common.sh ============================================================================== --- head/usr.sbin/makefs/tests/makefs_tests_common.sh Thu Oct 22 07:01:01 2015 (r289742) +++ head/usr.sbin/makefs/tests/makefs_tests_common.sh Thu Oct 22 07:22:05 2015 (r289743) @@ -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 - }