Index: stable/11/etc/mtree/BSD.tests.dist =================================================================== --- stable/11/etc/mtree/BSD.tests.dist (revision 326779) +++ stable/11/etc/mtree/BSD.tests.dist (revision 326780) @@ -1,736 +1,738 @@ # $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 .. chflags .. chmod .. date .. dd .. echo .. expr .. ln .. ls .. mkdir .. mv .. pax .. pkill .. pwait .. rcp .. rmdir .. 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 .. .. .. zfsd .. .. .. 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 .. .. iconv .. inet .. locale .. net getaddrinfo data .. .. .. nss .. regex data .. .. resolv .. rpc .. ssp .. setjmp .. stdio .. stdlib .. string .. sys .. time .. tls dso .. .. termios .. ttyio .. .. libcam .. libcasper services cap_dns .. cap_grp .. cap_pwd .. cap_sysctl .. .. .. libcrypt .. libdevdctl .. libkvm .. libmp .. libnv .. libpam .. libproc .. librt .. libsbuf .. 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 .. tap .. .. .. zoneinfo .. .. sys acl .. aio .. fifo .. file .. fs tmpfs .. .. geom class concat .. eli .. gate .. gpt .. mirror .. nop .. raid3 .. shsec .. stripe .. uzip etalon .. .. .. .. kern acct .. execve .. pipe .. .. kqueue libkqueue .. .. mac bsdextended .. portacl .. .. mqueue .. netinet .. opencrypto .. pjdfstest chflags .. chmod .. chown .. ftruncate .. granular .. link .. mkdir .. mkfifo .. mknod .. open .. rename .. rmdir .. symlink .. truncate .. unlink .. .. posixshm .. sys .. 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 .. .. .. bsdcat .. calendar .. cmp .. compress .. cpio .. col .. comm .. cut .. dirname .. du .. file2c .. getconf .. grep .. gzip .. + head + .. ident .. join .. jot .. lastcomm .. limits .. m4 .. mkimg .. ncal .. opensm .. pr .. printf .. procstat .. sdiff .. sed regress.multitest.out .. .. soelim .. stat .. tail .. tar .. timeout .. tr .. truncate .. units .. uudecode .. uuencode .. uniq .. xargs .. xinstall .. xo .. yacc yacc .. .. .. usr.sbin chown .. etcupdate .. extattr .. fstyp .. makefs .. newsyslog .. nmtree .. pw .. rpcbind .. sa .. .. .. # vim: set expandtab ts=4 sw=4: Index: stable/11/usr.bin/head/Makefile =================================================================== --- stable/11/usr.bin/head/Makefile (revision 326779) +++ stable/11/usr.bin/head/Makefile (revision 326780) @@ -1,6 +1,11 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= head + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Index: stable/11/usr.bin/head/tests/Makefile =================================================================== --- stable/11/usr.bin/head/tests/Makefile (nonexistent) +++ stable/11/usr.bin/head/tests/Makefile (revision 326780) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +PACKAGE= tests + +ATF_TESTS_SH= head_test + +.include Property changes on: stable/11/usr.bin/head/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: stable/11/usr.bin/head/tests/head_test.sh =================================================================== --- stable/11/usr.bin/head/tests/head_test.sh (nonexistent) +++ stable/11/usr.bin/head/tests/head_test.sh (revision 326780) @@ -0,0 +1,132 @@ +# Copyright (c) 2017 Fred Schlechter +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. 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 AUTHOR 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 AUTHOR 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$ + +atf_test_case empty_file +empty_file_head() { + atf_set "descr" "Test head(1)'s handling of an empty file" +} +empty_file_body() { + touch infile expectfile + head infile > outfile + head < infile > outpipe + atf_check cmp expectfile outfile + atf_check cmp expectfile outpipe +} + +atf_test_case default_no_options +default_no_options_head() { + atf_set "descr" "Test head(1)'s default mode" +} +default_no_options_body() { + #head(1) is supposed to default to 10 lines of output. Verify that it does that. + jot -b test 10 > expectfile + jot -b test 100 > infile + head infile > outfile + atf_check -e empty cmp expectfile outfile +} + +atf_test_case line_count +line_count_head() { + atf_set "descr" "Test head(1)'s -n option" +} +line_count_body() { + jot -b test 100 > outfile + head -n 50 outfile > expectfile + atf_check -o inline:" 50 expectfile\n" wc -l expectfile +} + +atf_test_case byte_count +byte_count_head() { + atf_set "descr" "Test head(1)'s -c option" +} +byte_count_body() { + jot -b test 100 > outfile + head -c 50 outfile > expectfile + atf_check -o inline:" 50 expectfile\n" wc -c expectfile +} + +atf_test_case sparse_file_text_at_beginning +sparse_file_text_at_beginning_head() { + atf_set "descr" "Test head(1)'s handling of a sparse file with text at the beginning of the file" +} +sparse_file_text_at_beginning_body () { + jot -b test 10 > outfile + truncate -s +1K outfile + head -c 512 outfile > expectfile + atf_check -o inline:" 512 expectfile\n" wc -c expectfile +} + +atf_test_case sparse_file_text_at_end +sparse_file_text_at_end_head() { + atf_set "descr" "Test head(1)'s handling of a sparse file with text at the end of the file" +} +sparse_file_text_at_end_body () { + truncate -s +1K infile + echo test >> infile + head -c 4096 < infile > outpipe + atf_check cmp infile outpipe +} + +atf_test_case missing_line_count +missing_line_count_head() { + atf_set "descr" "Test head(1)'s handling of a missing line count arg" +} +missing_line_count_body () { + jot -b test 100 > outfile + atf_check -s not-exit:0 -e not-empty head -n outfile +} + +atf_test_case invalid_line_count +invalid_line_count_head() { + atf_set "descr" "Test head(1)'s handling of an invalid line count arg" +} +invalid_line_count_body () { + jot -b test 100 > outfile + atf_check -s not-exit:0 -e not-empty head -n -10 outfile +} + +atf_test_case read_from_stdin +read_from_stdin_head() { + atf_set "descr" "Test head(1)'s reading of stdin" +} +read_from_stdin_body() { + #head(1) defaults to head -n 10 if no args are given. + jot -b test 10 > outfile + jot -b test 20 | head > expectfile + atf_check cmp outfile expectfile +} + +atf_init_test_cases() { + atf_add_test_case empty_file + atf_add_test_case default_no_options + atf_add_test_case line_count + atf_add_test_case byte_count + atf_add_test_case sparse_file_text_at_beginning + atf_add_test_case sparse_file_text_at_end + atf_add_test_case missing_line_count + atf_add_test_case invalid_line_count + atf_add_test_case read_from_stdin +} Property changes on: stable/11/usr.bin/head/tests/head_test.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: stable/11 =================================================================== --- stable/11 (revision 326779) +++ stable/11 (revision 326780) Property changes on: stable/11 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r326039