Index: head/etc/mtree/BSD.tests.dist =================================================================== --- head/etc/mtree/BSD.tests.dist (revision 289738) +++ head/etc/mtree/BSD.tests.dist (revision 289739) @@ -1,610 +1,612 @@ # $FreeBSD$ # # Please see the file src/etc/mtree/README before making changes to this file. # /set type=dir uname=root gname=wheel mode=0755 . bin cat .. chown .. date .. dd .. expr .. ls .. mv .. pax .. pkill .. sh builtins .. errors .. execution .. expansion .. parameters .. parser .. set-e .. .. sleep .. test .. .. cddl lib .. sbin .. usr.bin .. usr.sbin dtrace common aggs .. arithmetic .. arrays .. assocs .. begin .. bitfields .. buffering .. builtinvar .. cg .. clauses .. cpc .. decls .. drops .. dtraceUtil .. end .. enum .. error .. exit .. fbtprovider .. funcs .. grammar .. include .. inline .. io .. ip .. java_api .. json .. lexer .. llquantize .. mdb .. mib .. misc .. multiaggs .. offsetof .. operators .. pid .. plockstat .. pointers .. pragma .. predicates .. preprocessor .. print .. printa .. printf .. privs .. probes .. proc .. profile-n .. providers .. raise .. rates .. safety .. scalars .. sched .. scripting .. sdt .. sizeof .. speculation .. stability .. stack .. stackdepth .. stop .. strlen .. strtoll .. struct .. syscall .. sysevent .. tick-n .. trace .. tracemem .. translators .. typedef .. types .. uctf .. union .. usdt .. ustack .. vars .. version .. .. .. .. .. etc rc.d .. .. games .. gnu lib .. usr.bin diff .. .. .. lib atf libatf-c detail .. .. libatf-c++ detail .. .. test-programs .. .. libarchive .. libc c063 .. db .. gen execve .. posix_spawn .. .. hash data .. .. inet .. locale .. net getaddrinfo data .. .. .. regex data .. .. ssp .. stdio .. stdlib .. string .. sys .. time .. tls dso .. .. termios .. ttyio .. .. libcrypt .. libmp .. libnv .. libpam .. libproc .. librt .. libthr dlopen .. .. libutil .. libxo .. msun .. .. libexec atf atf-check .. atf-sh .. .. rtld-elf .. .. sbin dhclient .. devd .. growfs .. ifconfig .. mdconfig .. .. secure lib .. libexec .. usr.bin .. usr.sbin .. .. share examples tests atf .. plain .. .. .. .. sys acl .. aio .. fifo .. file .. kern execve .. .. kqueue .. mqueue .. netinet .. opencrypto .. pjdfstest chflags .. chmod .. chown .. ftruncate .. granular .. link .. mkdir .. mkfifo .. mknod .. open .. rename .. rmdir .. symlink .. truncate .. unlink .. .. posixshm .. vfs .. vm .. .. usr.bin apply .. basename .. bmake archives fmt_44bsd .. fmt_44bsd_mod .. fmt_oldbsd .. .. basic t0 .. t1 .. t2 .. t3 .. .. execution ellipsis .. empty .. joberr .. plus .. .. shell builtin .. meta .. path .. path_select .. replace .. select .. .. suffixes basic .. src_wild1 .. src_wild2 .. .. syntax directive-t0 .. enl .. funny-targets .. semi .. .. sysmk t0 2 1 .. .. mk .. .. t1 2 1 .. .. mk .. .. t2 2 1 .. .. mk .. .. .. variables modifier_M .. modifier_t .. opt_V .. t0 .. .. .. calendar .. cmp .. cpio .. col .. comm .. cut .. dirname .. file2c .. grep .. gzip .. ident .. join .. jot .. lastcomm .. m4 .. mkimg .. ncal .. opensm .. printf .. sed regress.multitest.out .. .. soelim .. tar .. timeout .. tr .. truncate .. units .. uudecode .. uuencode .. xargs .. xo .. yacc yacc .. .. .. usr.sbin etcupdate .. fstyp .. + makefs + .. newsyslog .. nmtree .. pw .. sa .. .. .. # vim: set expandtab ts=4 sw=4: Index: head/usr.sbin/makefs/Makefile =================================================================== --- head/usr.sbin/makefs/Makefile (revision 289738) +++ head/usr.sbin/makefs/Makefile (revision 289739) @@ -1,35 +1,41 @@ # $FreeBSD$ +.include + PROG= makefs CFLAGS+=-I${.CURDIR} SRCS= cd9660.c ffs.c \ makefs.c \ mtree.c \ walk.c MAN= makefs.8 WARNS?= 2 .include "${.CURDIR}/cd9660/Makefile.inc" .include "${.CURDIR}/ffs/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1 .PATH: ${.CURDIR}/../../contrib/mtree CFLAGS+=-I${.CURDIR}/../../contrib/mtree SRCS+= getid.c misc.c spec.c .PATH: ${.CURDIR}/../../contrib/mknod CFLAGS+=-I${.CURDIR}/../../contrib/mknod SRCS+= pack_dev.c .PATH: ${.CURDIR}/../../sys/ufs/ffs SRCS+= ffs_tables.c CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd LIBADD= netbsd util sbuf + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .include Index: head/usr.sbin/makefs/tests/Makefile =================================================================== --- head/usr.sbin/makefs/tests/Makefile (nonexistent) +++ head/usr.sbin/makefs/tests/Makefile (revision 289739) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +ATF_TESTS_SH+= makefs_cd9660_tests +ATF_TESTS_SH+= makefs_ffs_tests + +BINDIR= ${TESTSDIR} + +SCRIPTS+= makefs_tests_common.sh +SCRIPTSNAME_makefs_tests_common.sh= makefs_tests_common.sh + +.for t in ${ATF_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + +.include Property changes on: head/usr.sbin/makefs/tests/Makefile ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh =================================================================== --- head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh (nonexistent) +++ head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh (revision 289739) @@ -0,0 +1,62 @@ +# +# Copyright 2015 EMC Corp. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ +# + +. "$(dirname "$0")/makefs_tests_common.sh" + +MAKEFS="makefs -t cd9660" +TEST_IMAGE="test.iso" + +atf_test_case basic_cd9660 cleanup +basic_cd9660_body() +{ + create_test_inputs + + atf_check -e empty -o empty -s exit:0 \ + $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR + 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_cd9660 /dev/$(cat $TEST_MD_DEVICE_FILE) $TEST_MOUNT_DIR + atf_check -e empty -o not-empty -s exit:0 ls $TEST_MOUNT_DIR +} +basic_cd9660_cleanup() +{ + ls -a + + test_md_device=$(cat $TEST_MD_DEVICE_FILE) || return + + umount -f /dev/$test_md_device + mdconfig -d -u $test_md_device +} + +atf_init_test_cases() +{ + + atf_add_test_case basic_cd9660 +} Property changes on: head/usr.sbin/makefs/tests/makefs_cd9660_tests.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/usr.sbin/makefs/tests/makefs_ffs_tests.sh =================================================================== --- head/usr.sbin/makefs/tests/makefs_ffs_tests.sh (nonexistent) +++ head/usr.sbin/makefs/tests/makefs_ffs_tests.sh (revision 289739) @@ -0,0 +1,64 @@ +# +# Copyright 2015 EMC Corp. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ +# + +. "$(dirname "$0")/makefs_tests_common.sh" + +MAKEFS="makefs -t ffs" +TEST_IMAGE="test.img" + +atf_test_case basic_ffs cleanup +basic_ffs_body() +{ + create_test_inputs + + atf_check -e empty -o not-empty -s exit:0 \ + $MAKEFS -M 1m $TEST_IMAGE $TEST_INPUTS_DIR + atf_check -e empty -o save:$TEST_MD_DEVICE_FILE -s exit:0 \ + mdconfig -a -f $TEST_IMAGE + atf_check -e save:$ATF_TMPDIR/tunefs.output -o empty -s exit:0 \ + 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 +} +basic_ffs_cleanup() +{ + ls -a + + test_md_device=$(cat $TEST_MD_DEVICE_FILE) || return + + umount -f /dev/$test_md_device + mdconfig -d -u $test_md_device +} + +atf_init_test_cases() +{ + + atf_add_test_case basic_ffs +} Property changes on: head/usr.sbin/makefs/tests/makefs_ffs_tests.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/usr.sbin/makefs/tests/makefs_tests_common.sh =================================================================== --- head/usr.sbin/makefs/tests/makefs_tests_common.sh (nonexistent) +++ head/usr.sbin/makefs/tests/makefs_tests_common.sh (revision 289739) @@ -0,0 +1,81 @@ +# +# Copyright 2015 EMC Corp. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ +# + +TEST_MD_DEVICE_FILE="md.output" +TEST_MOUNT_DIR="mnt" + +create_test_dir() +{ + [ -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 + + 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 -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 +} Property changes on: head/usr.sbin/makefs/tests/makefs_tests_common.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property