Tag ^/base/vendor/NetBSD/tests/09.30.2014_20.45 from

^/base/vendor/NetBSD/tests/dist

Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
ngie 2014-10-01 04:12:38 +00:00
parent 5eef524861
commit e1f2d32c0e
2059 changed files with 200391 additions and 0 deletions

45
09.30.2014_20.45/Makefile Normal file
View File

@ -0,0 +1,45 @@
# $NetBSD: Makefile,v 1.44 2013/02/25 00:33:19 jmmv Exp $
.include <bsd.own.mk>
.if ${MKATF} != "no"
TESTSDIR= ${TESTSBASE}
TESTS_SUBDIRS= bin dev games include kernel lib libexec net
TESTS_SUBDIRS+= sbin sys usr.bin usr.sbin
. if (${MKRUMP} != "no")
TESTS_SUBDIRS+= fs rump
. if ${MKKMOD} != "no"
TESTS_SUBDIRS+= modules
. endif
. endif
. if ${MKCRYPTO} != "no"
TESTS_SUBDIRS+= crypto
. endif
. if ${MKIPFILTER} != "no"
TESTS_SUBDIRS+= ipf
. endif
. if ${MKSHARE} != "no"
TESTS_SUBDIRS+= share
. endif
. if ${MKATF} != "no"
ATFFILE_EXTRA_SUBDIRS+= atf
. endif
. if ${MKKYUA} != "no"
ATFFILE_EXTRA_SUBDIRS+= kyua-atf-compat kyua-cli kyua-testers
. endif
.include <bsd.test.mk>
.else
.include <bsd.subdir.mk>
.endif

View File

@ -0,0 +1,3 @@
# $NetBSD: Makefile.inc,v 1.2 2011/09/16 16:30:18 joerg Exp $
WARNS ?= 4
CWARNFLAGS+= -Wno-missing-noreturn

20
09.30.2014_20.45/README Normal file
View File

@ -0,0 +1,20 @@
$NetBSD: README,v 1.4 2012/05/18 15:36:21 jruoho Exp $
When adding new tests, please try to follow the following conventions.
1. For library routines, including system calls, the directory structure of
the tests should follow the directory structure of the real source tree.
For instance, interfaces available via the C library should follow:
src/lib/libc/gen -> src/tests/lib/libc/gen
src/lib/libc/sys -> src/tests/lib/libc/sys
...
2. Equivalently, all tests for userland utilities should try to follow their
location in the source tree. If this can not be satisfied, the tests for
a utility should be located under the directory to which the utility is
installed. Thus, a test for env(1) should go to src/tests/usr.bin/env.
Likewise, a test for tcpdump(8) should be in src/tests/usr.sbin/tcpdump,
even though the source code for the program is located under src/external.
3. Otherwise use your own discretion.

View File

@ -0,0 +1,9 @@
# $NetBSD: Makefile,v 1.3 2012/03/30 15:49:24 njoly Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin
TESTS_SUBDIRS= cat cp dd df expr pax ps sh sleep tar
.include <bsd.test.mk>

View File

@ -0,0 +1,12 @@
# $NetBSD: Makefile,v 1.1 2012/03/27 08:16:33 jruoho Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/cat
TESTS_SH= t_cat
FILESDIR= ${TESTSDIR}
FILES+= d_align.in
FILES+= d_align.out
.include <bsd.test.mk>

View File

@ -0,0 +1,3 @@
a b c
1 2 3
x y z

View File

@ -0,0 +1,3 @@
1 a b c$
2 1 2 3$
3 x y z$

View File

@ -0,0 +1,59 @@
# $NetBSD: t_cat.sh,v 1.2 2012/03/27 17:57:02 jruoho Exp $
#
# Copyright (c) 2012 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Jukka Ruohonen.
#
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
atf_test_case align
align_head() {
atf_set "descr" "Test that cat(1) aligns the output " \
"right with options '-be' (PR bin/4841)"
}
align_body() {
atf_check -s ignore -o file:$(atf_get_srcdir)/d_align.out \
-x "cat -be $(atf_get_srcdir)/d_align.in"
}
atf_test_case nonexistent
nonexistent_head() {
atf_set "descr" "Test that cat(1) doesn't return zero exit " \
"status for a nonexistent file (PR bin/3538)"
}
nonexistent_body() {
atf_check -s not-exit:0 -o empty -e not-empty \
-x "cat /some/name/that/does/not/exist"
}
atf_init_test_cases()
{
atf_add_test_case align
atf_add_test_case nonexistent
}

View File

@ -0,0 +1,8 @@
# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:10 jruoho Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/cp
TESTS_SH= t_cp
.include <bsd.test.mk>

294
09.30.2014_20.45/bin/cp/t_cp.sh Executable file
View File

@ -0,0 +1,294 @@
# $NetBSD: t_cp.sh,v 1.1 2012/03/17 16:33:10 jruoho Exp $
#
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
FILES="file file2 file3 link dir dir2 dirlink target"
cleanup() {
rm -fr ${FILES}
}
cp_compare() {
echo "Ensuring that $2 and $3 are identical"
cmp -s $2 $3 || atf_fail "$2 and $3 are different"
}
reset() {
cleanup
echo "I'm a file" > file
echo "I'm a file, 2" > file2
echo "I'm a file, 3" > file3
ln -s file link
mkdir dir
ln -s dir dirlink
}
atf_test_case file_to_file
file_to_file_head() {
atf_set "descr" "Checks the copy of a file to a file"
}
file_to_file_body() {
reset
file_to_file_simple
file_to_file_preserve
file_to_file_noflags
}
file_to_file_simple() {
rm -f file2
umask 022
chmod 777 file
atf_check -s eq:0 -o empty -e empty cp file file2
cp_compare file_to_file_simple file file2
if [ `stat -f "%Lp" file2` != "755" ]; then
atf_fail "new file not created with umask"
fi
chmod 644 file
chmod 777 file2
cp_compare file_to_file_simple file file2
if [ `stat -f "%Lp" file2` != "777" ]; then
atf_fail "existing files permissions not retained"
fi
}
file_to_file_preserve() {
rm file3
chmod 644 file
chflags nodump file
atf_check -s eq:0 -o empty -e empty cp -p file file3
finfo=`stat -f "%p%u%g%m%z%f" file`
f3info=`stat -f "%p%u%g%m%z%f" file3`
if [ $finfo != $f3info ]; then
atf_fail "attributes not preserved"
fi
}
file_to_file_noflags() {
rm file3
chmod 644 file
chflags nodump file
atf_check -s eq:0 -o empty -e empty cp -p -N file file3
finfo=`stat -f "%f" file`
f3info=`stat -f "%f" file3`
if [ $finfo = $f3info ]; then
atf_fail "-p -N preserved file flags"
fi
}
atf_test_case file_to_link
file_to_link_head() {
atf_set "descr" "Checks the copy of a file to a symbolic link"
}
file_to_link_body() {
reset
atf_check -s eq:0 -o empty -e empty cp file2 link
cp_compare file_to_link file file2
}
atf_test_case link_to_file
link_to_file_head() {
atf_set "descr" "Checks the copy of a symbolic link to a file"
}
link_to_file_body() {
reset
# file and link are identical (not copied).
atf_check -s eq:1 -o empty -e ignore cp link file
atf_check -s eq:0 -o empty -e empty cp link file2
cp_compare link_to_file file file2
}
atf_test_case file_over_link
file_over_link_head() {
atf_set "descr" "Checks the copy of a file to a symbolic link" \
"without following it"
}
file_over_link_body() {
reset
atf_check -s eq:0 -o empty -e empty cp -P file link
cp_compare file_over_link file link
}
atf_test_case link_over_file
link_over_file_head() {
atf_set "descr" "Checks the copy of a symbolic link to a file" \
"without following the former"
}
link_over_file_body() {
reset
atf_check -s eq:0 -o empty -e empty cp -P link file
if [ `readlink link` != `readlink file` ]; then
atf_fail "readlink link != readlink file"
fi
}
atf_test_case files_to_dir
files_to_dir_head() {
atf_set "descr" "Checks the copy of multiple files into a directory"
}
files_to_dir_body() {
reset
# can't copy multiple files to a file
atf_check -s eq:1 -o empty -e ignore cp file file2 file3
atf_check -s eq:0 -o empty -e empty cp file file2 link dir
cp_compare files_to_dir file "dir/file"
}
atf_test_case dir_to_file
dir_to_file_head() {
atf_set "descr" "Checks the copy of a directory onto a file, which" \
"should not work"
}
dir_to_file_body() {
reset
# can't copy a dir onto a file
atf_check -s eq:1 -o empty -e ignore cp dir file
atf_check -s eq:1 -o empty -e ignore cp -R dir file
}
atf_test_case file_to_linkdir
file_to_linkdir_head() {
atf_set "descr" "Checks the copy of a file to a symbolic link that" \
"points to a directory"
}
file_to_linkdir_body() {
reset
atf_check -s eq:0 -o empty -e empty cp file dirlink
cp_compare file_to_linkdir file "dir/file"
# overwrite the link
atf_check -s eq:0 -o empty -e empty cp -P file dirlink
atf_check -s eq:1 -o empty -e empty readlink dirlink
cp_compare file_to_linkdir file dirlink
}
atf_test_case linkdir_to_file
linkdir_to_file_head() {
atf_set "descr" "Checks the copy of a symbolic link that points to" \
"a directory onto a file"
}
linkdir_to_file_body() {
reset
# cannot copy a dir onto a file
atf_check -s eq:1 -o empty -e ignore cp dirlink file
# overwrite the link
atf_check -s eq:0 -o empty -e empty cp -P dirlink file
if [ `readlink file` != `readlink dirlink` ]; then
atf_fail "readlink link != readlink file"
fi
}
dir_to_dne_no_R() {
atf_check -s eq:1 -o empty -e ignore cp dir dir2
}
dir_to_dne() {
atf_check -s eq:0 -o empty -e empty cp -R dir dir2
cp_compare dir_to_dne "dir/file" "dir2/file"
readlink dir2/link >/dev/null
if [ $? -gt 0 ]; then
atf_fail "-R didn't copy a link as a link"
fi
}
dir_to_dir_H() {
dir_to_dir_setup
atf_check -s eq:0 -o empty -e empty cp -R dir dir2
chmod 777 dir
# copy a dir into a dir, only command-line links are followed
atf_check -s eq:0 -o empty -e empty cp -R -H dirlink dir2
cp_compare dir_to_dir_H "dir/file" "dir2/dirlink/file"
readlink dir2/dirlink/link >/dev/null
if [ $? -gt 0 ]; then
atf_fail "didn't copy a link as a link"
fi
# Created directories have the same mode as the corresponding
# source directory, unmodified by the process's umask.
if [ `stat -f "%Lp" dir2/dirlink` != "777" ]; then
atf_fail "-R modified dir perms with umask"
fi
}
dir_to_dir_L() {
dir_to_dir_setup
atf_check -s eq:0 -o empty -e empty cp -R dir dir2
atf_check -s eq:0 -o empty -e empty cp -R -H dirlink dir2
# copy a dir into a dir, following all links
atf_check -s eq:0 -o empty -e empty cp -R -H -L dirlink dir2/dirlink
cp_compare dir_to_dir_L "dir/file" "dir2/dirlink/dirlink/file"
# fail if -R -L copied a link as a link
atf_check -s eq:1 -o ignore -e empty readlink dir2/dirlink/dirlink/link
}
dir_to_dir_subdir_exists() {
# recursively copy a dir into another dir, with some subdirs already
# existing
cleanup
mkdir -p dir/1 dir/2 dir/3 target/2
echo "file" > dir/2/file
atf_check -s eq:0 -o empty -e empty cp -R dir/* target
cp_compare dir_to_dir_subdir_exists "dir/2/file" "target/2/file"
}
dir_to_dir_setup() {
reset
umask 077
cp -P file file2 file3 link dir
}
atf_test_case dir_to_dir
dir_to_dir_head() {
atf_set "descr" "Checks the copy of a directory onto another directory"
}
dir_to_dir_body() {
dir_to_dir_setup
dir_to_dne_no_R
dir_to_dne
dir_to_dir_H
dir_to_dir_L
dir_to_dir_subdir_exists
}
atf_init_test_cases()
{
atf_add_test_case file_to_file
atf_add_test_case file_to_link
atf_add_test_case link_to_file
atf_add_test_case file_over_link
atf_add_test_case link_over_file
atf_add_test_case files_to_dir
atf_add_test_case file_to_linkdir
atf_add_test_case linkdir_to_file
atf_add_test_case dir_to_file
atf_add_test_case dir_to_dir
}

View File

@ -0,0 +1,8 @@
# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:11 jruoho Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/dd
TESTS_SH= t_dd
.include <bsd.test.mk>

130
09.30.2014_20.45/bin/dd/t_dd.sh Executable file
View File

@ -0,0 +1,130 @@
# $NetBSD: t_dd.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
test_dd_length() {
result=$1
cmd=$2
set -- x `eval $cmd | wc -c`
res=$2
if [ x"$res" != x"$result" ]; then
atf_fail "Expected $result bytes of output, got $res: $cmd"
fi
}
atf_test_case length
length_head() {
# XXX The PR should be stored in a tag.
atf_set "descr" "Test for result messages accidentally pumped into" \
"the output file if the standard IO descriptors are" \
"closed. The last of the three following tests is" \
"the one expected to fail. (NetBSD PR bin/8521)"
}
length_body() {
test_dd_length 512 \
"dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >/dev/null 2>/dev/null"
test_dd_length 512 \
"dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >&- 2>/dev/null"
test_dd_length 512 \
"dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >&- 2>&-"
}
test_dd_io() {
res="`echo -n "$2" | eval $1`"
if [ x"$res" != x"$3" ]; then
atf_fail "Expected \"$3\", got \"$res\": $1"
fi
}
allbits1="\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377"
ebcdicbits1="\000\001\002\003\067\055\056\057\026\005\045\013\014\015\016\017\020\021\022\023\074\075\062\046\030\031\077\047\034\035\036\037\100\132\177\173\133\154\120\175\115\135\134\116\153\140\113\141\360\361\362\363\364\365\366\367\370\371\172\136\114\176\156\157\174\301\302\303\304\305\306\307\310\311\321\322\323\324\325\326\327\330\331\342\343\344\345\346\347\350\351\255\340\275\232\155\171\201\202\203\204\205\206\207\210\211\221\222\223\224\225\226\227\230\231\242\243\244\245\246\247\250\251\300\117\320\137\007\040\041\042\043\044\025\006\027\050\051\052\053\054\011\012\033\060\061\032\063\064\065\066\010\070\071\072\073\004\024\076\341\101\102\103\104\105\106\107\110\111\121\122\123\124\125\126\127\130\131\142\143\144\145\146\147\150\151\160\161\162\163\164\165\166\167\170\200\212\213\214\215\216\217\220\152\233\234\235\236\237\240\252\253\254\112\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\241\276\277\312\313\314\315\316\317\332\333\334\335\336\337\352\353\354\355\356\357\372\373\374\375\376\377"
allvisbits=`echo -n "$allbits1" | unvis | vis`
ebcdicvisbits=`echo -n "$ebcdicbits1" | unvis | vis`
atf_test_case io
io_head() {
atf_set "descr" "This checks the combination of bs= with" \
"conv=ebcdic. Prior to revision 1.24 of dd's" \
"args.c, the conv option would be ignored."
}
io_body() {
test_dd_io "unvis | dd 2>/dev/null | vis" \
"$allvisbits" "$allvisbits"
test_dd_io "unvis | dd ibs=1 2>/dev/null | vis" \
"$allvisbits" "$allvisbits"
test_dd_io "unvis | dd obs=1 2>/dev/null | vis" \
"$allvisbits" "$allvisbits"
test_dd_io "unvis | dd bs=1 2>/dev/null | vis" \
"$allvisbits" "$allvisbits"
test_dd_io "unvis | dd conv=ebcdic 2>/dev/null | vis" \
"$allvisbits" "$ebcdicvisbits"
test_dd_io "unvis | dd conv=ebcdic ibs=512 2>/dev/null | vis" \
"$allvisbits" "$ebcdicvisbits"
test_dd_io "unvis | dd conv=ebcdic obs=512 2>/dev/null | vis" \
"$allvisbits" "$ebcdicvisbits"
test_dd_io "unvis | dd conv=ebcdic bs=512 2>/dev/null | vis" \
"$allvisbits" "$ebcdicvisbits"
test_dd_io "unvis | dd conv=ebcdic 2>/dev/null | vis" \
"$allvisbits" "$ebcdicvisbits"
test_dd_io "unvis | dd conv=ebcdic ibs=1 2>/dev/null | vis" \
"$allvisbits" "$ebcdicvisbits"
test_dd_io "unvis | dd conv=ebcdic obs=1 2>/dev/null | vis" \
"$allvisbits" "$ebcdicvisbits"
test_dd_io "unvis | dd conv=ebcdic bs=1 2>/dev/null | vis" \
"$allvisbits" "$ebcdicvisbits"
}
atf_test_case seek
seek_head() {
atf_set "descr" "Tests output file seeking"
}
seek_body() {
echo TEST1234 > testfile
atf_check -s exit:0 -e ignore \
dd if=/dev/zero of=testfile seek=1 bs=8k count=1
atf_check -s exit:0 -e ignore -o match:'^TEST1234$' dd if=testfile
eval $(stat -s testfile)
atf_check_equal $st_size $((2*8192))
echo -n TEST1234 > tf2
atf_check -s exit:0 -e ignore -x \
'dd bs=4 if=/dev/zero count=1 | tr \\0 \\n | dd of=tf2 bs=4 seek=1'
atf_check -s exit:0 -e ignore -o match:'^TEST$' dd if=tf2
eval $(stat -s tf2)
atf_check_equal $st_size 8
}
atf_init_test_cases()
{
atf_add_test_case length
atf_add_test_case io
atf_add_test_case seek
}

View File

@ -0,0 +1,27 @@
# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:11 jruoho Exp $
NOMAN= # defined
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/df
TESTS_SH= t_df
BINDIR= ${TESTSDIR}
PROG= h_df
.PATH: ${NETBSDSRCDIR}/bin/df
SRCS= df.c getmntinfo.c
LDADD+= -lutil
DPADD+= ${LIBUTIL}
# Pass -DINTREE to make to test using humanize_number.c in source tree
# directly instead of the one in libc.
.if defined(INTREE)
.PATH: ${NETBSDSRCDIR}/lib/libc/gen
CPPFLAGS+= -I${NETBSDSRCDIR}/lib/libc/include
SRCS+= humanize_number.c
.endif
.include <bsd.test.mk>

View File

@ -0,0 +1,218 @@
/* $NetBSD: getmntinfo.c,v 1.1 2012/03/17 16:33:11 jruoho Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#include <err.h>
#include <stdlib.h>
#include <string.h>
#define KB * 1024
#define MB * 1024 KB
#define GB * 1024 MB
static struct statvfs *getnewstatvfs(void);
static void other_variants(const struct statvfs *, const int *, int,
const int *, int);
static void setup_filer(void);
static void setup_ld0g(void);
static void setup_strpct(void);
static struct statvfs *allstatvfs;
static int sftotal, sfused;
struct statvfs *
getnewstatvfs(void)
{
if (sftotal == sfused) {
sftotal = sftotal ? sftotal * 2 : 1;
allstatvfs = realloc(allstatvfs,
sftotal * sizeof(struct statvfs));
if (allstatvfs == NULL)
err(EXIT_FAILURE, "realloc");
}
return (&allstatvfs[sfused++]);
}
void
other_variants(const struct statvfs *tmpl, const int *minfree, int minfreecnt,
const int *consumed, int consumedcnt)
{
int64_t total, used;
struct statvfs *sf;
int i, j;
for (i = 0; i < minfreecnt; i++)
for (j = 0; j < consumedcnt; j++) {
sf = getnewstatvfs();
*sf = *tmpl;
total = (int64_t)(u_long)sf->f_blocks * sf->f_bsize;
used = total * consumed[j] / 100;
sf->f_bfree = (total - used) / sf->f_bsize;
sf->f_bavail = (total * (100 - minfree[i]) / 100 -
used) / (int)sf->f_bsize;
sf->f_bresvd = sf->f_bfree - sf->f_bavail;
}
}
/*
* Parameter taken from:
* http://mail-index.NetBSD.org/tech-userlevel/2004/03/24/0001.html
*/
void
setup_filer(void)
{
static const struct statvfs tmpl = {
#define BSIZE 512
#define TOTAL 1147ULL GB
#define USED 132ULL MB
.f_bsize = BSIZE,
.f_frsize = BSIZE,
.f_blocks = TOTAL / BSIZE,
.f_bfree = (TOTAL - USED) / BSIZE,
.f_bavail = (TOTAL - USED) / BSIZE,
.f_bresvd = 0,
.f_mntfromname = "filer:/",
.f_mntonname = "/filer",
#undef USED
#undef TOTAL
#undef BSIZE
};
static const int minfree[] = { 0, 5, 10, 15, };
static const int consumed[] = { 0, 20, 60, 95, 100 };
*getnewstatvfs() = tmpl;
other_variants(&tmpl, minfree, sizeof(minfree) / sizeof(minfree[0]),
consumed, sizeof(consumed) / sizeof(consumed[0]));
}
/*
* Parameter taken from:
* http://mail-index.NetBSD.org/current-users/2004/03/01/0038.html
*/
void
setup_ld0g(void)
{
static const struct statvfs tmpl = {
#define BSIZE 4096 /* Guess */
#define TOTAL 1308726116ULL KB
#define USED 17901268ULL KB
#define AVAIL 1225388540ULL KB
.f_bsize = BSIZE,
.f_frsize = BSIZE,
.f_blocks = TOTAL / BSIZE,
.f_bfree = (TOTAL - USED) / BSIZE,
.f_bavail = AVAIL / BSIZE,
.f_bresvd = (TOTAL - USED) / BSIZE - AVAIL / BSIZE,
.f_mntfromname = "/dev/ld0g",
.f_mntonname = "/anon-root",
#undef AVAIL
#undef USED
#undef TOTAL
#undef BSIZE
};
static const int minfree[] = { 0, 5, 10, 15, };
static const int consumed[] = { 0, 20, 60, 95, 100 };
*getnewstatvfs() = tmpl;
other_variants(&tmpl, minfree, sizeof(minfree) / sizeof(minfree[0]),
consumed, sizeof(consumed) / sizeof(consumed[0]));
}
/*
* Test of strpct() with huge number.
*/
void
setup_strpct(void)
{
static const struct statvfs tmpl = {
#define BSIZE 4096 /* Guess */
#define TOTAL 0x4ffffffffULL KB
#define USED (TOTAL / 2)
#define AVAIL (TOTAL / 2)
.f_bsize = BSIZE,
.f_frsize = BSIZE,
.f_blocks = TOTAL / BSIZE,
.f_bfree = (TOTAL - USED) / BSIZE,
.f_bavail = AVAIL / BSIZE,
.f_bresvd = (TOTAL - USED) / BSIZE - AVAIL / BSIZE,
.f_mntfromname = "/dev/strpct",
.f_mntonname = "/strpct",
#undef AVAIL
#undef USED
#undef TOTAL
#undef BSIZE
};
*getnewstatvfs() = tmpl;
}
/*
* Parameter taken from:
* http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=23600
*/
static void
setup_pr23600(void)
{
static const struct statvfs tmpl = {
#define BSIZE 512
#define TOTAL 20971376ULL
#define USED 5719864ULL
#define AVAIL 15251512ULL
.f_bsize = BSIZE,
.f_frsize = BSIZE,
.f_blocks = TOTAL,
.f_bfree = TOTAL - USED,
.f_bavail = AVAIL,
.f_bresvd = TOTAL - USED - AVAIL,
.f_mntfromname = "/dev/wd0e",
.f_mntonname = "/mount/windows/C",
#undef AVAIL
#undef USED
#undef TOTAL
#undef BSIZE
};
*getnewstatvfs() = tmpl;
}
int
getmntinfo(struct statvfs **mntbuf, int flags)
{
setup_filer();
setup_ld0g();
setup_strpct();
setup_pr23600();
*mntbuf = allstatvfs;
return (sfused);
}

148
09.30.2014_20.45/bin/df/t_df.sh Executable file
View File

@ -0,0 +1,148 @@
# $NetBSD: t_df.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
#
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
atf_test_case normal
normal_head() {
atf_set "descr" "Checks that the output of df without flags is" \
"correct according to some already-known, sane" \
"output"
}
normal_body() {
cat >expout <<EOF
Filesystem 1K-blocks Used Avail %Cap Mounted on
filer:/ 1202716672 135168 1202581504 0% /filer
filer:/ 1202716672 0 1202716672 0% /filer
filer:/ 1202716672 240543334 962173337 20% /filer
filer:/ 1202716672 721630003 481086668 60% /filer
filer:/ 1202716672 1142580838 60135833 95% /filer
filer:/ 1202716672 1202716672 0 100% /filer
filer:/ 1202716672 0 1142580838 0% /filer
filer:/ 1202716672 240543334 902037504 21% /filer
filer:/ 1202716672 721630003 420950835 63% /filer
filer:/ 1202716672 1142580838 0 100% /filer
filer:/ 1202716672 1202716672 -60135833 105% /filer
filer:/ 1202716672 0 1082445004 0% /filer
filer:/ 1202716672 240543334 841901670 22% /filer
filer:/ 1202716672 721630003 360815001 66% /filer
filer:/ 1202716672 1142580838 -60135833 105% /filer
filer:/ 1202716672 1202716672 -120271667 111% /filer
filer:/ 1202716672 0 1022309171 0% /filer
filer:/ 1202716672 240543334 781765836 23% /filer
filer:/ 1202716672 721630003 300679168 70% /filer
filer:/ 1202716672 1142580838 -120271667 111% /filer
filer:/ 1202716672 1202716672 -180407500 117% /filer
/dev/ld0g 1308726116 17901268 1225388540 1% /anon-root
/dev/ld0g 1308726116 0 1308726116 0% /anon-root
/dev/ld0g 1308726116 261745224 1046980892 20% /anon-root
/dev/ld0g 1308726116 785235672 523490444 60% /anon-root
/dev/ld0g 1308726116 1243289812 65436304 95% /anon-root
/dev/ld0g 1308726116 1308726116 0 100% /anon-root
/dev/ld0g 1308726116 0 1243289808 0% /anon-root
/dev/ld0g 1308726116 261745224 981544584 21% /anon-root
/dev/ld0g 1308726116 785235672 458054140 63% /anon-root
/dev/ld0g 1308726116 1243289812 0 100% /anon-root
/dev/ld0g 1308726116 1308726116 -65436304 105% /anon-root
/dev/ld0g 1308726116 0 1177853504 0% /anon-root
/dev/ld0g 1308726116 261745224 916108280 22% /anon-root
/dev/ld0g 1308726116 785235672 392617832 66% /anon-root
/dev/ld0g 1308726116 1243289812 -65436304 105% /anon-root
/dev/ld0g 1308726116 1308726116 -130872608 111% /anon-root
/dev/ld0g 1308726116 0 1112417196 0% /anon-root
/dev/ld0g 1308726116 261745224 850671972 23% /anon-root
/dev/ld0g 1308726116 785235672 327181528 70% /anon-root
/dev/ld0g 1308726116 1243289812 -130872608 111% /anon-root
/dev/ld0g 1308726116 1308726116 -196308916 117% /anon-root
/dev/strpct 21474836476 10737418240 10737418236 50% /strpct
/dev/wd0e 10485688 2859932 7625756 27% /mount/windows/C
EOF
atf_check -s eq:0 -o file:expout -e empty \
-x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -n"
}
atf_test_case hflag
hflag_head() {
atf_set "descr" "Checks that the output of df is correct according" \
"to some already-known, sane output when using the" \
"human readable format"
}
hflag_body() {
cat >expout <<EOF
Filesystem Size Used Avail %Cap Mounted on
filer:/ 1.1T 132M 1.1T 0% /filer
filer:/ 1.1T 0B 1.1T 0% /filer
filer:/ 1.1T 229G 918G 20% /filer
filer:/ 1.1T 688G 459G 60% /filer
filer:/ 1.1T 1.1T 57G 95% /filer
filer:/ 1.1T 1.1T 0B 100% /filer
filer:/ 1.1T 0B 1.1T 0% /filer
filer:/ 1.1T 229G 860G 21% /filer
filer:/ 1.1T 688G 401G 63% /filer
filer:/ 1.1T 1.1T 0B 100% /filer
filer:/ 1.1T 1.1T -57G 105% /filer
filer:/ 1.1T 0B 1.0T 0% /filer
filer:/ 1.1T 229G 803G 22% /filer
filer:/ 1.1T 688G 344G 66% /filer
filer:/ 1.1T 1.1T -57G 105% /filer
filer:/ 1.1T 1.1T -115G 111% /filer
filer:/ 1.1T 0B 975G 0% /filer
filer:/ 1.1T 229G 746G 23% /filer
filer:/ 1.1T 688G 287G 70% /filer
filer:/ 1.1T 1.1T -115G 111% /filer
filer:/ 1.1T 1.1T -172G 117% /filer
/dev/ld0g 1.2T 17G 1.1T 1% /anon-root
/dev/ld0g 1.2T 0B 1.2T 0% /anon-root
/dev/ld0g 1.2T 250G 998G 20% /anon-root
/dev/ld0g 1.2T 749G 499G 60% /anon-root
/dev/ld0g 1.2T 1.2T 62G 95% /anon-root
/dev/ld0g 1.2T 1.2T 0B 100% /anon-root
/dev/ld0g 1.2T 0B 1.2T 0% /anon-root
/dev/ld0g 1.2T 250G 936G 21% /anon-root
/dev/ld0g 1.2T 749G 437G 63% /anon-root
/dev/ld0g 1.2T 1.2T 0B 100% /anon-root
/dev/ld0g 1.2T 1.2T -62G 105% /anon-root
/dev/ld0g 1.2T 0B 1.1T 0% /anon-root
/dev/ld0g 1.2T 250G 874G 22% /anon-root
/dev/ld0g 1.2T 749G 374G 66% /anon-root
/dev/ld0g 1.2T 1.2T -62G 105% /anon-root
/dev/ld0g 1.2T 1.2T -125G 111% /anon-root
/dev/ld0g 1.2T 0B 1.0T 0% /anon-root
/dev/ld0g 1.2T 250G 811G 23% /anon-root
/dev/ld0g 1.2T 749G 312G 70% /anon-root
/dev/ld0g 1.2T 1.2T -125G 111% /anon-root
/dev/ld0g 1.2T 1.2T -187G 117% /anon-root
/dev/strpct 20T 10T 10T 50% /strpct
/dev/wd0e 10G 2.7G 7.3G 27% /mount/windows/C
EOF
atf_check -s eq:0 -o file:expout -e empty \
-x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -hn"
}
atf_init_test_cases()
{
atf_add_test_case normal
atf_add_test_case hflag
}

View File

@ -0,0 +1,8 @@
# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:11 jruoho Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/expr
TESTS_SH= t_expr
.include <bsd.test.mk>

View File

@ -0,0 +1,228 @@
# $NetBSD: t_expr.sh,v 1.3 2012/03/27 07:23:06 jruoho Exp $
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
# The first arg will get eval'd so escape any meta characters
# The 2nd arg is an expected string/response from expr for that op.
test_expr() {
echo "Expression '${1}', expecting '${2}'"
res=`eval expr $1 2>&1`
if [ "$res" != "$2" ]; then
atf_fail "Expected $2, got $res from expression: " \
"`eval echo $1`"
fi
}
atf_test_case lang
lang_ops_head() {
atf_set "descr" "Test that expr(1) works with non-C LANG (PR bin/2486)"
}
lang_body() {
export LANG=nonexistent
atf_check -s exit:0 -o inline:"21\n" -e empty -x "expr 10 + 11"
export LANG=ru_RU.KOI8-R
atf_check -s exit:0 -o inline:"21\n" -e empty -x "expr 10 + 11"
}
atf_test_case overflow
overflow_head() {
atf_set "descr" "Test overflow cases"
}
overflow_body() {
test_expr '4611686018427387904 + 4611686018427387903' \
'9223372036854775807'
test_expr '4611686018427387904 + 4611686018427387904' \
"expr: integer overflow or underflow occurred for operation '4611686018427387904 + 4611686018427387904'"
test_expr '4611686018427387904 - -4611686018427387904' \
"expr: integer overflow or underflow occurred for operation '4611686018427387904 - -4611686018427387904'"
test_expr '-4611686018427387904 - 4611686018427387903' \
'-9223372036854775807'
test_expr '-4611686018427387904 - 4611686018427387905' \
"expr: integer overflow or underflow occurred for operation '-4611686018427387904 - 4611686018427387905'"
test_expr '-4611686018427387904 \* 1' '-4611686018427387904'
test_expr '-4611686018427387904 \* -1' '4611686018427387904'
test_expr '-4611686018427387904 \* 2' '-9223372036854775808'
test_expr '-4611686018427387904 \* 3' \
"expr: integer overflow or underflow occurred for operation '-4611686018427387904 * 3'"
test_expr '-4611686018427387904 \* -2' \
"expr: integer overflow or underflow occurred for operation '-4611686018427387904 * -2'"
test_expr '4611686018427387904 \* 1' '4611686018427387904'
test_expr '4611686018427387904 \* 2' \
"expr: integer overflow or underflow occurred for operation '4611686018427387904 * 2'"
test_expr '4611686018427387904 \* 3' \
"expr: integer overflow or underflow occurred for operation '4611686018427387904 * 3'"
}
atf_test_case gtkmm
gtkmm_head() {
atf_set "descr" "Test from gtk-- configure that cause problems on old expr"
}
gtkmm_body() {
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 5' '1'
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 6' '0'
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 3 \& 5 \>= 5' '0'
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 2 \& 4 = 4 \& 5 \>= 5' '0'
test_expr '3 \> 2 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 6' '1'
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 3 \| 3 = 3 \& 4 = 4 \& 5 \>= 5' '1'
}
atf_test_case colon_vs_math
colon_vs_math_head() {
atf_set "descr" "Basic precendence test with the : operator vs. math"
}
colon_vs_math_body() {
test_expr '2 : 4 / 2' '0'
test_expr '4 : 4 % 3' '1'
}
atf_test_case arithmetic_ops
arithmetic_ops_head() {
atf_set "descr" "Dangling arithemtic operator"
}
arithmetic_ops_body() {
test_expr '.java_wrapper : /' '0'
test_expr '4 : \*' '0'
test_expr '4 : +' '0'
test_expr '4 : -' '0'
test_expr '4 : /' '0'
test_expr '4 : %' '0'
}
atf_test_case basic_math
basic_math_head() {
atf_set "descr" "Basic math test"
}
basic_math_body() {
test_expr '2 + 4 \* 5' '22'
}
atf_test_case basic_functional
basic_functional_head() {
atf_set "descr" "Basic functional tests"
}
basic_functional_body() {
test_expr '2' '2'
test_expr '-4' '-4'
test_expr 'hello' 'hello'
}
atf_test_case compare_ops_precedence
compare_ops_precedence_head() {
atf_set "descr" "Compare operator precendence test"
}
compare_ops_precedence_body() {
test_expr '2 \> 1 \* 17' '0'
}
atf_test_case compare_ops
compare_ops_head() {
atf_set "descr" "Compare operator tests"
}
compare_ops_body() {
test_expr '2 \!= 5' '1'
test_expr '2 \!= 2' '0'
test_expr '2 \<= 3' '1'
test_expr '2 \<= 2' '1'
test_expr '2 \<= 1' '0'
test_expr '2 \< 3' '1'
test_expr '2 \< 2' '0'
test_expr '2 = 2' '1'
test_expr '2 = 4' '0'
test_expr '2 \>= 1' '1'
test_expr '2 \>= 2' '1'
test_expr '2 \>= 3' '0'
test_expr '2 \> 1' '1'
test_expr '2 \> 2' '0'
}
atf_test_case multiply
multiply_head() {
atf_set "descr" "Test the multiply operator (PR bin/12838)"
}
multiply_body() {
test_expr '1 \* -1' '-1'
test_expr '2 \> 1 \* 17' '0'
}
atf_test_case negative
negative_head() {
atf_set "descr" "Test the additive inverse"
}
negative_body() {
test_expr '-1 + 5' '4'
test_expr '- 1 + 5' 'expr: syntax error'
test_expr '5 + -1' '4'
test_expr '5 + - 1' 'expr: syntax error'
test_expr '1 - -5' '6'
}
atf_test_case math_precedence
math_precedence_head() {
atf_set "descr" "More complex math test for precedence"
}
math_precedence_body() {
test_expr '-3 + -1 \* 4 + 3 / -6' '-7'
}
atf_test_case precedence
precedence_head() {
atf_set "descr" "Test precedence"
}
precedence_body() {
# This is messy but the shell escapes cause that
test_expr 'X1/2/3 : X\\\(.\*[^/]\\\)//\*[^/][^/]\*/\*$ \| . : \\\(.\\\)' '1/2'
}
atf_test_case regex
regex_head() {
atf_set "descr" "Test proper () returning \1 from a regex"
}
regex_body() {
# This is messy but the shell escapes cause that
test_expr '1/2 : .\*/\\\(.\*\\\)' '2'
}
atf_init_test_cases()
{
atf_add_test_case lang
atf_add_test_case overflow
atf_add_test_case gtkmm
atf_add_test_case colon_vs_math
atf_add_test_case arithmetic_ops
atf_add_test_case basic_math
atf_add_test_case basic_functional
atf_add_test_case compare_ops_precedence
atf_add_test_case compare_ops
atf_add_test_case multiply
atf_add_test_case negative
atf_add_test_case math_precedence
atf_add_test_case precedence
atf_add_test_case regex
}

View File

@ -0,0 +1,8 @@
# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:11 jruoho Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/pax
TESTS_SH= t_pax
.include <bsd.test.mk>

View File

@ -0,0 +1,54 @@
# $NetBSD: t_pax.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
#
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
atf_test_case append
append_head() {
atf_set "descr" "Ensure that appending a file to an archive" \
"produces the same results as if the file" \
"had been there during the archive's creation"
}
append_body() {
touch foo bar
# store both foo and bar into file1.tar
atf_check -s eq:0 -o empty -e empty \
pax -w -b 512 -x ustar -f file1.tar foo bar
# store foo into file2.tar, then append bar to file2.tar
atf_check -s eq:0 -o empty -e empty \
pax -w -b 512 -x ustar -f file2.tar foo
atf_check -s eq:0 -o empty -e empty \
pax -w -b 512 -x ustar -f file2.tar -a bar
# ensure that file1.tar and file2.tar are equal
atf_check -s eq:0 -o empty -e empty cmp file1.tar file2.tar
}
atf_init_test_cases()
{
atf_add_test_case append
}

View File

@ -0,0 +1,12 @@
# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:11 jruoho Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/bin/ps
TESTS_SH= t_ps
FILESDIR= ${TESTSDIR}
FILES= keywords
.include <bsd.test.mk>

View File

@ -0,0 +1,123 @@
# $NetBSD: keywords,v 1.2 2014/01/16 04:16:32 mlelstv Exp $
#
# Table of keywords for use with ps "-o" option.
#
# The first column (keyword) is the name of a keyword.
#
# The second column (header) is the default column header associated
# with the keyword, except if the keyword is an alias, in which case the
# second column is the name of another keyword.
#
# The third column (flag) may be blank, "LJUST", or "ALIAS". "ALIAS"
# means that the keyword is an alias. "LJUST" means that the keyword
# should be displayed in a left-justified column. The default is that
# the keyword should be displayed in a right-justified column.
#
# keyword header flag
#
ktracep KTRACEP
nwchan WCHAN
p_ru P_RU
paddr PADDR
rlink RLINK
%cpu %CPU
%mem %MEM
acflag ACFLG
acflg acflag ALIAS
args command ALIAS
blocked sigmask ALIAS
caught sigcatch ALIAS
comm COMMAND LJUST
command COMMAND LJUST
cpu CPU
cputime time ALIAS
ctime CTIME
egid EGID
egroup EGROUP LJUST
etime ELAPSED
euid EUID
euser EUSER LJUST
f F
flags f ALIAS
gid GID
group GROUP LJUST
groupnames GROUPNAMES LJUST
groups GROUPS LJUST
holdcnt HOLDCNT
ignored sigignore ALIAS
inblk INBLK
inblock inblk ALIAS
jobc JOBC
ktrace KTRACE
laddr LADDR
lid LID
lim LIM
login LOGIN LJUST
logname login ALIAS
lstart STARTED LJUST
lstate STAT LJUST
ltime LTIME
majflt MAJFLT
minflt MINFLT
msgrcv MSGRCV
msgsnd MSGSND
ni nice ALIAS
nice NI
nivcsw NIVCSW
nlwp NLWP
nsignals nsigs ALIAS
nsigs NSIGS
nswap NSWAP
nvcsw NVCSW
oublk OUBLK
oublock oublk ALIAS
pagein PAGEIN
pcpu %cpu ALIAS
pending sig ALIAS
pgid PGID
pid PID
pmem %mem ALIAS
ppid PPID
pri PRI
re RE
rgid RGID
rgroup RGROUP LJUST
rlwp RLWP
rss RSS
rssize rsz ALIAS
rsz RSZ
ruid RUID
ruser RUSER LJUST
sess SESS
sid SID
sig PENDING
sigcatch CAUGHT
sigignore IGNORED
sigmask BLOCKED
sl SL
start STARTED
stat state ALIAS
state STAT LJUST
stime STIME
svgid SVGID
svgroup SVGROUP LJUST
svuid SVUID
svuser SVUSER LJUST
tdev TDEV
time TIME
tpgid TPGID
tsess TSESS
tsiz TSIZ
tt TTY LJUST
tty TTY LJUST
uaddr UADDR
ucomm UCOMM LJUST
uid UID
upr UPR
user USER LJUST
usrpri upr ALIAS
utime UTIME
vsize vsz ALIAS
vsz VSZ
wchan WCHAN LJUST
xstat XSTAT

404
09.30.2014_20.45/bin/ps/t_ps.sh Executable file
View File

@ -0,0 +1,404 @@
# $NetBSD: t_ps.sh,v 1.2 2014/01/16 04:16:32 mlelstv Exp $
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
#
# the implementation of "ps" to test
: ${TEST_PS:="ps"}
# tab and newline characters
tab="$(printf '\t')"
# nl="$(printf '\n')" doesn't work
nl='
'
#
# Parse the "keywords" file into a load of shell variables
#
setup_keywords()
{
# Set variables representing the header text
# for all normal keywords (except aliases), and
# for regular expressions to match the text in left- or
# right-justified columns.
# For example, head_text_p_cpu="%CPU" head_regexp_p_cpu=" *%CPU".
while read keyword heading flag
do
case "$keyword" in
''|\#*) continue
;;
esac
[ x"$flag" = x"ALIAS" ] && continue
kvar="${keyword}"
case "${keyword}" in
%*) kvar="p_${keyword#%}"
;;
esac
eval head_text_${kvar}=\'"${heading}"\'
case "${flag}" in
'') # right justified
eval head_regexp_${kvar}=\'" *${heading}"\'
;;
LJUST) # left justified
eval head_regexp_${kvar}=\'"${heading} *"\'
;;
*) atf_fail "unknown flag in keywords"
;;
esac
done <"$(atf_get_srcdir)/keywords"
# Now do the aliases.
while read keyword heading flag
do
case "$keyword" in
''|\#*) continue
;;
esac
[ x"$flag" != x"ALIAS" ] && continue
kvar="${keyword}"
avar="${heading}"
case "${keyword}" in
%*) kvar="p_${keyword#%}"
;;
esac
case "${heading}" in
%*) avar="p_${heading#%}"
;;
esac
eval head_text_${kvar}=\"\$head_text_${avar}\"
eval head_regexp_${kvar}=\"\$head_regexp_${avar}\"
done <"$(atf_get_srcdir)/keywords"
# default sets of keywords
default_keywords='pid tty stat time command'
j_keywords='user pid ppid pgid sess jobc state tt time command'
l_keywords='uid pid ppid cpu pri nice vsz rss wchan state tt time command'
s_keywords='uid pid ppid cpu lid nlwp pri nice vsz rss wchan lstate tt ltime command'
u_keywords='user pid %cpu %mem vsz rss tt state start time command'
v_keywords='pid state time sl re pagein vsz rss lim tsiz %cpu %mem command'
}
# Convert a list of keywords like "pid comm" to a regexp
# like " *PID COMMAND *"
heading_keywords_to_regexp()
{
local keywords="$1"
local regexp
regexp="$(echo "$keywords" | \
sed -E -e 's/\%/p_/g' -e 's/(^| )/\1\$head_regexp_/g')"
eval regexp=\""${regexp}"\"
regexp="^${regexp}\$"
echo "$regexp"
}
#
# Check that a string matches a regexp; use the specified id
# in error or success messages.
#
check_regexp() {
local id="$1" string="$2" regexp="$3"
if ! expr "$string" : "$regexp" >/dev/null
then
atf_fail "${id}: expected [${regexp}], got [${string}]"
false
fi
}
#
# Run "ps $args -p $$"; check that only one line is printed,
# without a preceding header line.
#
check_no_heading_line()
{
local args="$1"
local output="$(eval "${TEST_PS} $args -p $$")"
case "$output" in
*"$nl"*)
local firstline="${output%%${nl}*}"
atf_fail "check_no_heading_line [$args] got [$firstline]"
;;
*)
;;
esac
}
#
# Run "ps $args"; check that the heading matches the expected regexp.
#
check_heading_regexp()
{
args="$1"
regexp="$2"
actual="$( eval "${TEST_PS} $args" | sed -e 1q )"
check_regexp "heading [$args]" "${actual}" "${regexp}"
}
#
# Run "ps $args"; check that the heading matches a regexp constructed
# from the specified keywords.
#
check_heading_keywords()
{
args="$1"
keywords="$2"
check_heading_regexp "$args" "$(heading_keywords_to_regexp "$keywords")"
}
#
# Try several variations on "ps $flag", "ps -$flag", etc.,
# and check that the heading always has the correct keywords.
#
check_heading_variations()
{
flag="$1"
keywords="$2"
for args in "$flag" "-$flag" "-$flag$flag -$flag"; do
check_heading_keywords "$args" "$keywords"
done
}
atf_test_case default_columns
default_columns_head()
{
atf_set "descr" "Checks that the default set of columns is correct" \
"and also check that the columns printed by the -j," \
"-l, -s, -u and -v flags alone are correct"
}
default_columns_body()
{
setup_keywords
check_heading_keywords '' "$default_keywords"
check_heading_variations 'j' "$j_keywords"
check_heading_variations 'l' "$l_keywords"
check_heading_variations 's' "$s_keywords"
check_heading_variations 'u' "$u_keywords"
check_heading_variations 'v' "$v_keywords"
}
atf_test_case minus_O
minus_O_head()
{
atf_set "descr" "Checks that 'ps -O foo' inserts columns just after" \
"the pid column"
}
minus_O_body()
{
setup_keywords
check_heading_keywords '-O %cpu,%mem' \
"$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
check_heading_keywords '-O %cpu -O %mem' \
"$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
check_heading_keywords '-O%cpu -O%mem' \
"$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
}
atf_test_case minus_o
minus_o_head()
{
atf_set "descr" "Checks simple cases of 'ps -o foo' to control which" \
"columns are printed; this does not test header" \
"overriding via 'ps -o foo=BAR'"
}
minus_o_body()
{
setup_keywords
# Keywords for "-o name" override the default display
check_heading_keywords '-o pid,%cpu,%mem' \
"pid %cpu %mem"
check_heading_keywords '-o pid -o %cpu,%mem' \
"pid %cpu %mem"
check_heading_keywords '-opid -o %cpu,%mem' \
"pid %cpu %mem"
# Space works like comma
check_heading_keywords '-opid -o "%cpu %mem"' \
"pid %cpu %mem"
# Check missing pid
check_heading_keywords '-o comm' \
"comm"
# Check pid present but not first
check_heading_keywords '-o comm,pid' \
"comm pid"
}
atf_test_case override_heading_simple
override_heading_simple_head()
{
atf_set "descr" "Tests simple uses of header overriding via" \
"'ps -o foo=BAR'. This does not test columns " \
"with null headings, or headings with embedded" \
"space, ',' or '='."
}
override_heading_simple_body()
{
setup_keywords
check_heading_regexp '-o pid=PPP -o comm' \
'^ *PPP '"${head_text_comm}"'$' # no trailing space
check_heading_regexp '-o pid=PPP -o comm=CCC' \
'^ *PPP CCC$'
check_heading_regexp '-o pid,comm=CCC' \
'^'"${head_regexp_pid}"' CCC$'
check_heading_regexp '-o pid -o comm=CCC' \
'^'"${head_regexp_pid}"' CCC$'
# Check missing pid
check_heading_regexp '-o comm=CCC' \
'^CCC$'
# Check pid present but not first
check_heading_regexp '-o comm=CCC -o pid=PPP' \
'^CCC *PPP$'
check_heading_regexp '-o comm,pid=PPP' \
'^'"${head_regexp_comm}"' *PPP$'
}
atf_test_case override_heading_embedded_specials
override_heading_embedded_specials_head()
{
atf_set "descr" "Tests header overriding with embedded space," \
"',' or '='. Everything after the first '='" \
"is part of the heading."
}
override_heading_embedded_specials_body()
{
setup_keywords
# Check embedded "," or "=" in override header.
check_heading_regexp '-o comm,pid==' \
'^'"${head_regexp_comm}"' *=$'
check_heading_regexp '-o comm,pid=,' \
'^'"${head_regexp_comm}"' *,$'
check_heading_regexp '-o pid=PPP,comm' \
'^ *PPP,comm$' # not like '-o pid=PPP -o comm'
check_heading_regexp '-o pid=PPP,comm=CCC' \
'^ *PPP,comm=CCC$' # not like '-o pid=PPP -o comm=CCC'
check_heading_regexp '-o comm,pid=PPP,QQQ' \
'^'"${head_regexp_comm}"' *PPP,QQQ$'
check_heading_regexp '-o comm,pid=ppid,tty=state' \
'^'"${head_regexp_comm}"' *ppid,tty=state$'
# Check embedded space or tab in override header.
check_heading_regexp '-o comm,pid="PPP QQQ"' \
'^'"${head_regexp_comm}"' *PPP QQQ$'
check_heading_regexp '-o comm,pid="PPP${tab}QQQ"' \
'^'"${head_regexp_comm}"' *PPP'"${tab}"'QQQ$'
}
atf_test_case override_heading_some_null
override_heading_some_null_head()
{
atf_set "descr" "Tests simple uses of null column headings" \
"overriding via 'ps -o foo=BAR -o baz='. This" \
"does not test the case where all columns have" \
"null headings."
}
override_heading_some_null_body()
{
setup_keywords
check_heading_regexp '-o pid=PPP -o comm=' \
'^ *PPP *$'
check_heading_regexp '-o pid= -o comm=CCC' \
'^ * CCC$'
check_heading_regexp '-o pid -o comm=' \
'^'"${head_regexp_pid}"' *$'
# Check missing pid
check_heading_regexp '-o ppid= -o comm=CCC' \
'^ * CCC$'
check_heading_regexp '-o ppid=PPP -o comm=' \
'^ *PPP *$'
# Check pid present but not first
check_heading_regexp '-o comm= -o pid=PPP' \
'^ * PPP$'
check_heading_regexp '-o comm,pid=' \
'^'"${head_regexp_comm}"' *$'
# A field with a null custom heading retains a minimum width
# derived from the default heading. This does not apply
# to a field with a very short (non-null) custom heading.
#
# We choose "holdcnt" as a column whose width is likely to be
# determined entirely by the header width, because the values
# are likely to be very small.
check_heading_regexp '-o holdcnt -o holdcnt -o holdcnt' \
'^HOLDCNT HOLDCNT HOLDCNT$'
check_heading_regexp '-o holdcnt -o holdcnt= -o holdcnt' \
'^HOLDCNT HOLDCNT$'
check_heading_regexp '-o holdcnt -o holdcnt=HH -o holdcnt' \
'^HOLDCNT HH HOLDCNT$'
}
atf_test_case override_heading_all_null
override_heading_all_null_head()
{
atf_set "descr" "Tests the use of 'ps -o foo= -o bar=' (with a" \
"null heading for every column). The heading" \
"should not be printed at all in this case."
}
override_heading_all_null_body()
{
setup_keywords
# A heading with a space is not a null heading,
# so should not be suppressed
check_heading_regexp '-o comm=" "' \
'^ *$'
# Null headings should be suppressed
check_no_heading_line '-o pid= -o comm='
check_no_heading_line '-o pid= -o comm='
# Check missing pid
check_no_heading_line '-o ppid='
check_no_heading_line '-o comm='
check_no_heading_line '-o command='
check_no_heading_line '-o ppid= -o comm='
check_no_heading_line '-o comm= -o ppid='
# Check pid present but not first
check_no_heading_line '-o comm= -o pid='
check_no_heading_line '-o ppid= -o pid= -o command='
}
atf_test_case duplicate_column
duplicate_column_head()
{
atf_set "descr" "Tests the use of -o options to display the" \
"same column more than once"
}
duplicate_column_body()
{
setup_keywords
# two custom headers
check_heading_regexp '-o pid=PPP -o pid=QQQ' \
'^ *PPP *QQQ$'
# one custom header, before and after default header
check_heading_regexp '-o pid=PPP -o pid' \
'^ *PPP '"${head_regexp_pid}"'$'
check_heading_regexp '-o pid -o pid=QQQ' \
'^'"${head_regexp_pid}"' *QQQ$'
# custom headers both before and after default header
check_heading_regexp '-o pid=PPP -o pid -o pid=QQQ' \
'^ *PPP '"${head_regexp_pid}"' *QQQ$'
}
atf_init_test_cases() {
atf_add_test_case default_columns
atf_add_test_case minus_O
atf_add_test_case minus_o
atf_add_test_case override_heading_simple
atf_add_test_case override_heading_embedded_specials
atf_add_test_case override_heading_some_null
atf_add_test_case override_heading_all_null
atf_add_test_case duplicate_column
}

View File

@ -0,0 +1,21 @@
# $NetBSD: Makefile,v 1.4 2014/09/11 18:25:30 dholland Exp $
#
.include <bsd.own.mk>
TESTSDIR = ${TESTSBASE}/bin/sh
TESTS_SUBDIRS += dotcmd
TESTS_SH= t_compexit
TESTS_SH+= t_exit
TESTS_SH+= t_expand
TESTS_SH+= t_evaltested
TESTS_SH+= t_fsplit
TESTS_SH+= t_here
TESTS_SH+= t_set_e
TESTS_SH+= t_ulimit
TESTS_SH+= t_varquote
TESTS_SH+= t_wait
.include <bsd.test.mk>

View File

@ -0,0 +1,40 @@
# $NetBSD: Makefile,v 1.2 2014/07/27 14:24:17 apb Exp $
#
.include <bsd.own.mk>
TESTSDIR = ${TESTSBASE}/bin/sh/dotcmd
TESTS_SH = t_dotcmd
FILESDIR = ${TESTSDIR}/out
# Testing scripts: dotcmd in various scopes includes a file with
# return / break / continue in various scopes.
#
.for cmd_scope in case compound file for func subshell until while
. for cmd in return break continue
FILES += ${cmd}_${cmd_scope}
FILESDIR_${cmd}_${cmd_scope} = ${TESTSDIR}
FILESBUILD_${cmd}_${cmd_scope} = yes
${cmd}_${cmd_scope}: scoped_command
${HOST_SH} ${.CURDIR}/scoped_command '${cmd_scope}' '${cmd}' '${cmd}' \
>'${.TARGET}'
. for dot_scope in case compound file for func subshell until while
FILES += \
${dot_scope}_${cmd}_${cmd_scope} \
out/${dot_scope}_${cmd}_${cmd_scope}.out
FILESDIR_${dot_scope}_${cmd}_${cmd_scope} = ${TESTSDIR}
FILESBUILD_${dot_scope}_${cmd}_${cmd_scope} = yes
FILESMODE_${dot_scope}_${cmd}_${cmd_scope} = ${BINMODE}
${dot_scope}_${cmd}_${cmd_scope}: scoped_command
${HOST_SH} ${.CURDIR}/scoped_command '${dot_scope}' \
'. "${cmd}_${cmd_scope}"' 'dotcmd' 'dotcmd' >'${.TARGET}'
. endfor
. endfor
.endfor
.include <bsd.test.mk>

View File

@ -0,0 +1,8 @@
before case
before dotcmd
before case
before break
after break, return value: 0
after case
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
compound start
before break
after break, return value: 0
compound end
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,6 @@
before case
before dotcmd
before break
after break, return value: 0
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,7 @@
before case
before dotcmd
before for
before break
after for
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
before function
before break
after break
after function
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
subshell start
before break
after break, return value: 0
subshell end
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,7 @@
before case
before dotcmd
before until
before break
after until
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,7 @@
before case
before dotcmd
before while
before break
after while
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
before case
before continue
after continue, return value: 0
after case
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
compound start
before continue
after continue, return value: 0
compound end
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,6 @@
before case
before dotcmd
before continue
after continue, return value: 0
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
before for
before continue
before continue
after for
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
before function
before continue
after continue
after function
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
subshell start
before continue
after continue, return value: 0
subshell end
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
before until
before continue
before continue
after until
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
before case
before dotcmd
before while
before continue
before continue
after while
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,6 @@
before case
before dotcmd
before case
before return
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,6 @@
before case
before dotcmd
compound start
before return
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,5 @@
before case
before dotcmd
before return
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,6 @@
before case
before dotcmd
before for
before return
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,7 @@
before case
before dotcmd
before function
before return
after function
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,6 @@
before case
before dotcmd
subshell start
before return
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,6 @@
before case
before dotcmd
before until
before return
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,6 @@
before case
before dotcmd
before while
before return
after dotcmd, return value: 0
after case

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
before case
before break
after break, return value: 0
after case
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
compound start
before break
after break, return value: 0
compound end
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
compound start
before dotcmd
before break
after break, return value: 0
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,7 @@
compound start
before dotcmd
before for
before break
after for
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
before function
before break
after break
after function
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
subshell start
before break
after break, return value: 0
subshell end
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,7 @@
compound start
before dotcmd
before until
before break
after until
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,7 @@
compound start
before dotcmd
before while
before break
after while
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
before case
before continue
after continue, return value: 0
after case
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
compound start
before continue
after continue, return value: 0
compound end
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
compound start
before dotcmd
before continue
after continue, return value: 0
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
before for
before continue
before continue
after for
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
before function
before continue
after continue
after function
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
subshell start
before continue
after continue, return value: 0
subshell end
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
before until
before continue
before continue
after until
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,8 @@
compound start
before dotcmd
before while
before continue
before continue
after while
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
compound start
before dotcmd
before case
before return
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
compound start
before dotcmd
compound start
before return
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,5 @@
compound start
before dotcmd
before return
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
compound start
before dotcmd
before for
before return
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,7 @@
compound start
before dotcmd
before function
before return
after function
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
compound start
before dotcmd
subshell start
before return
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
compound start
before dotcmd
before until
before return
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
compound start
before dotcmd
before while
before return
after dotcmd, return value: 0
compound end

View File

@ -0,0 +1,6 @@
before dotcmd
before case
before break
after break, return value: 0
after case
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
compound start
before break
after break, return value: 0
compound end
after dotcmd, return value: 0

View File

@ -0,0 +1,4 @@
before dotcmd
before break
after break, return value: 0
after dotcmd, return value: 0

View File

@ -0,0 +1,5 @@
before dotcmd
before for
before break
after for
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
before function
before break
after break
after function
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
subshell start
before break
after break, return value: 0
subshell end
after dotcmd, return value: 0

View File

@ -0,0 +1,5 @@
before dotcmd
before until
before break
after until
after dotcmd, return value: 0

View File

@ -0,0 +1,5 @@
before dotcmd
before while
before break
after while
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
before case
before continue
after continue, return value: 0
after case
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
compound start
before continue
after continue, return value: 0
compound end
after dotcmd, return value: 0

View File

@ -0,0 +1,4 @@
before dotcmd
before continue
after continue, return value: 0
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
before for
before continue
before continue
after for
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
before function
before continue
after continue
after function
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
subshell start
before continue
after continue, return value: 0
subshell end
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
before until
before continue
before continue
after until
after dotcmd, return value: 0

View File

@ -0,0 +1,6 @@
before dotcmd
before while
before continue
before continue
after while
after dotcmd, return value: 0

View File

@ -0,0 +1,4 @@
before dotcmd
before case
before return
after dotcmd, return value: 0

View File

@ -0,0 +1,4 @@
before dotcmd
compound start
before return
after dotcmd, return value: 0

View File

@ -0,0 +1,3 @@
before dotcmd
before return
after dotcmd, return value: 0

View File

@ -0,0 +1,4 @@
before dotcmd
before for
before return
after dotcmd, return value: 0

View File

@ -0,0 +1,5 @@
before dotcmd
before function
before return
after function
after dotcmd, return value: 0

View File

@ -0,0 +1,4 @@
before dotcmd
subshell start
before return
after dotcmd, return value: 0

View File

@ -0,0 +1,4 @@
before dotcmd
before until
before return
after dotcmd, return value: 0

View File

@ -0,0 +1,4 @@
before dotcmd
before while
before return
after dotcmd, return value: 0

View File

@ -0,0 +1,5 @@
before for
before dotcmd
before case
before break
after for

View File

@ -0,0 +1,5 @@
before for
before dotcmd
compound start
before break
after for

View File

@ -0,0 +1,4 @@
before for
before dotcmd
before break
after for

View File

@ -0,0 +1,12 @@
before for
before dotcmd
before for
before break
after for
after dotcmd, return value: 0
before dotcmd
before for
before break
after for
after dotcmd, return value: 0
after for

Some files were not shown because too many files have changed in this diff Show More