From 65c3cfc1aad4e0570ac0f3f65ff5d7904c3ea3a5 Mon Sep 17 00:00:00 2001 From: Julio Merino Date: Wed, 19 Mar 2014 12:46:04 +0000 Subject: [PATCH] Migrate tools/regression/usr.bin/pkill to the new tests layout. Interestingly, the pkill tool lives in bin, not usr.bin. Haven't bothered to check if this is because the tool moved or because the tests were originally added in the wrong place. --- bin/pkill/Makefile | 6 +++ bin/pkill/tests/Makefile | 38 +++++++++++++++++++ .../pkill/tests/pgrep-F_test.sh | 4 +- .../pkill/tests/pgrep-LF_test.sh | 4 +- .../pkill/tests/pgrep-P_test.sh | 2 +- .../pkill/tests/pgrep-U_test.sh | 4 +- .../pkill/tests/pgrep-_g_test.sh | 4 +- .../pkill/tests/pgrep-_s_test.sh | 0 .../pkill/tests/pgrep-g_test.sh | 4 +- .../pkill/tests/pgrep-i_test.sh | 2 +- .../pkill/tests/pgrep-j_test.sh | 6 +-- .../pkill/tests/pgrep-l_test.sh | 2 +- .../pkill/tests/pgrep-n_test.sh | 2 +- .../pkill/tests/pgrep-o_test.sh | 2 +- .../pkill/tests/pgrep-q_test.sh | 4 +- .../pkill/tests/pgrep-s_test.sh | 4 +- .../pkill/tests/pgrep-t_test.sh | 6 +-- .../pkill/tests/pgrep-v_test.sh | 2 +- .../pkill/tests/pgrep-x_test.sh | 2 +- .../pkill/tests/pkill-F_test.sh | 4 +- .../pkill/tests/pkill-LF_test.sh | 4 +- .../pkill/tests/pkill-P_test.sh | 2 +- .../pkill/tests/pkill-U_test.sh | 4 +- .../pkill/tests/pkill-_g_test.sh | 4 +- .../pkill/tests/pkill-g_test.sh | 4 +- .../pkill/tests/pkill-i_test.sh | 2 +- .../pkill/tests/pkill-j_test.sh | 6 +-- .../pkill/tests/pkill-s_test.sh | 4 +- .../pkill/tests/pkill-t_test.sh | 6 +-- .../pkill/tests/pkill-x_test.sh | 4 +- etc/mtree/BSD.tests.dist | 2 + 31 files changed, 95 insertions(+), 49 deletions(-) create mode 100644 bin/pkill/tests/Makefile rename tools/regression/usr.bin/pkill/pgrep-F.t => bin/pkill/tests/pgrep-F_test.sh (78%) rename tools/regression/usr.bin/pkill/pgrep-LF.t => bin/pkill/tests/pgrep-LF_test.sh (86%) rename tools/regression/usr.bin/pkill/pgrep-P.t => bin/pkill/tests/pgrep-P_test.sh (86%) rename tools/regression/usr.bin/pkill/pgrep-U.t => bin/pkill/tests/pgrep-U_test.sh (85%) rename tools/regression/usr.bin/pkill/pgrep-_g.t => bin/pkill/tests/pgrep-_g_test.sh (85%) rename tools/regression/usr.bin/pkill/pgrep-_s.t => bin/pkill/tests/pgrep-_s_test.sh (100%) rename tools/regression/usr.bin/pkill/pgrep-g.t => bin/pkill/tests/pgrep-g_test.sh (85%) rename tools/regression/usr.bin/pkill/pgrep-i.t => bin/pkill/tests/pgrep-i_test.sh (88%) rename tools/regression/usr.bin/pkill/pgrep-j.t => bin/pkill/tests/pgrep-j_test.sh (91%) rename tools/regression/usr.bin/pkill/pgrep-l.t => bin/pkill/tests/pgrep-l_test.sh (85%) rename tools/regression/usr.bin/pkill/pgrep-n.t => bin/pkill/tests/pgrep-n_test.sh (87%) rename tools/regression/usr.bin/pkill/pgrep-o.t => bin/pkill/tests/pgrep-o_test.sh (87%) rename tools/regression/usr.bin/pkill/pgrep-q.t => bin/pkill/tests/pgrep-q_test.sh (85%) rename tools/regression/usr.bin/pkill/pgrep-s.t => bin/pkill/tests/pgrep-s_test.sh (85%) rename tools/regression/usr.bin/pkill/pgrep-t.t => bin/pkill/tests/pgrep-t_test.sh (83%) rename tools/regression/usr.bin/pkill/pgrep-v.t => bin/pkill/tests/pgrep-v_test.sh (89%) rename tools/regression/usr.bin/pkill/pgrep-x.t => bin/pkill/tests/pgrep-x_test.sh (93%) rename tools/regression/usr.bin/pkill/pkill-F.t => bin/pkill/tests/pkill-F_test.sh (76%) rename tools/regression/usr.bin/pkill/pkill-LF.t => bin/pkill/tests/pkill-LF_test.sh (86%) rename tools/regression/usr.bin/pkill/pkill-P.t => bin/pkill/tests/pkill-P_test.sh (85%) rename tools/regression/usr.bin/pkill/pkill-U.t => bin/pkill/tests/pkill-U_test.sh (84%) rename tools/regression/usr.bin/pkill/pkill-_g.t => bin/pkill/tests/pkill-_g_test.sh (84%) rename tools/regression/usr.bin/pkill/pkill-g.t => bin/pkill/tests/pkill-g_test.sh (84%) rename tools/regression/usr.bin/pkill/pkill-i.t => bin/pkill/tests/pkill-i_test.sh (87%) rename tools/regression/usr.bin/pkill/pkill-j.t => bin/pkill/tests/pkill-j_test.sh (91%) rename tools/regression/usr.bin/pkill/pkill-s.t => bin/pkill/tests/pkill-s_test.sh (84%) rename tools/regression/usr.bin/pkill/pkill-t.t => bin/pkill/tests/pkill-t_test.sh (83%) rename tools/regression/usr.bin/pkill/pkill-x.t => bin/pkill/tests/pkill-x_test.sh (87%) diff --git a/bin/pkill/Makefile b/bin/pkill/Makefile index e98ed2c4e522..bb4d865b7ae2 100644 --- a/bin/pkill/Makefile +++ b/bin/pkill/Makefile @@ -1,6 +1,8 @@ # $NetBSD: Makefile,v 1.1 2002/03/01 11:21:58 ad Exp $ # $FreeBSD$ +.include + PROG= pkill DPADD= ${LIBKVM} @@ -17,4 +19,8 @@ MLINKS= pkill.1 pgrep.1 SYMLINKS= ${BINDIR}/pkill /usr/bin/pkill SYMLINKS+= ${BINDIR}/pgrep /usr/bin/pgrep +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include diff --git a/bin/pkill/tests/Makefile b/bin/pkill/tests/Makefile new file mode 100644 index 000000000000..b131d5925667 --- /dev/null +++ b/bin/pkill/tests/Makefile @@ -0,0 +1,38 @@ +# $FreeBSD$ + +.include + +TESTSDIR= ${TESTSBASE}/bin/pkill + +TAP_TESTS_SH= pgrep-F_test +TAP_TESTS_SH+= pgrep-LF_test +TAP_TESTS_SH+= pgrep-P_test +TAP_TESTS_SH+= pgrep-U_test +TAP_TESTS_SH+= pgrep-_g_test +TAP_TESTS_SH+= pgrep-_s_test +TAP_TESTS_SH+= pgrep-g_test +TAP_TESTS_SH+= pgrep-i_test +TAP_TESTS_SH+= pgrep-j_test +TEST_METADATA.pgrep-j_test+= required_user="root" +TAP_TESTS_SH+= pgrep-l_test +TAP_TESTS_SH+= pgrep-n_test +TAP_TESTS_SH+= pgrep-o_test +TAP_TESTS_SH+= pgrep-q_test +TAP_TESTS_SH+= pgrep-s_test +TAP_TESTS_SH+= pgrep-t_test +TAP_TESTS_SH+= pgrep-v_test +TAP_TESTS_SH+= pgrep-x_test +TAP_TESTS_SH+= pkill-F_test +TAP_TESTS_SH+= pkill-LF_test +TAP_TESTS_SH+= pkill-P_test +TAP_TESTS_SH+= pkill-U_test +TAP_TESTS_SH+= pkill-_g_test +TAP_TESTS_SH+= pkill-g_test +TAP_TESTS_SH+= pkill-i_test +TAP_TESTS_SH+= pkill-j_test +TEST_METADATA.pkill-j_test+= required_user="root" +TAP_TESTS_SH+= pkill-s_test +TAP_TESTS_SH+= pkill-t_test +TAP_TESTS_SH+= pkill-x_test + +.include diff --git a/tools/regression/usr.bin/pkill/pgrep-F.t b/bin/pkill/tests/pgrep-F_test.sh similarity index 78% rename from tools/regression/usr.bin/pkill/pgrep-F.t rename to bin/pkill/tests/pgrep-F_test.sh index fd76e6451de3..4d8feaa34eb2 100644 --- a/tools/regression/usr.bin/pkill/pgrep-F.t +++ b/bin/pkill/tests/pgrep-F_test.sh @@ -6,8 +6,8 @@ base=`basename $0` echo "1..1" name="pgrep -F " -pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +pidfile=$(pwd)/pidfile.txt +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-LF.t b/bin/pkill/tests/pgrep-LF_test.sh similarity index 86% rename from tools/regression/usr.bin/pkill/pgrep-LF.t rename to bin/pkill/tests/pgrep-LF_test.sh index d981175fb956..4818869d8d6e 100644 --- a/tools/regression/usr.bin/pkill/pgrep-LF.t +++ b/bin/pkill/tests/pgrep-LF_test.sh @@ -6,8 +6,8 @@ base=`basename $0` echo "1..2" name="pgrep -LF " -pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +pidfile=$(pwd)/pidfile.txt +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep daemon -p $pidfile $sleep 5 sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-P.t b/bin/pkill/tests/pgrep-P_test.sh similarity index 86% rename from tools/regression/usr.bin/pkill/pgrep-P.t rename to bin/pkill/tests/pgrep-P_test.sh index d139edbb078e..5a5cdcf8e97c 100644 --- a/tools/regression/usr.bin/pkill/pgrep-P.t +++ b/bin/pkill/tests/pgrep-P_test.sh @@ -7,7 +7,7 @@ echo "1..1" name="pgrep -P " ppid=$$ -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-U.t b/bin/pkill/tests/pgrep-U_test.sh similarity index 85% rename from tools/regression/usr.bin/pkill/pgrep-U.t rename to bin/pkill/tests/pgrep-U_test.sh index 7cc865ab5f38..2e7f24d94659 100644 --- a/tools/regression/usr.bin/pkill/pgrep-U.t +++ b/bin/pkill/tests/pgrep-U_test.sh @@ -7,7 +7,7 @@ echo "1..2" name="pgrep -U " ruid=`id -ur` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -23,7 +23,7 @@ rm -f $sleep name="pgrep -U " ruid=`id -urn` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-_g.t b/bin/pkill/tests/pgrep-_g_test.sh similarity index 85% rename from tools/regression/usr.bin/pkill/pgrep-_g.t rename to bin/pkill/tests/pgrep-_g_test.sh index b07b6089b69e..fbe7b08161a0 100644 --- a/tools/regression/usr.bin/pkill/pgrep-_g.t +++ b/bin/pkill/tests/pgrep-_g_test.sh @@ -7,7 +7,7 @@ echo "1..2" name="pgrep -G " rgid=`id -gr` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -23,7 +23,7 @@ rm -f $sleep name="pgrep -G " rgid=`id -grn` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-_s.t b/bin/pkill/tests/pgrep-_s_test.sh similarity index 100% rename from tools/regression/usr.bin/pkill/pgrep-_s.t rename to bin/pkill/tests/pgrep-_s_test.sh diff --git a/tools/regression/usr.bin/pkill/pgrep-g.t b/bin/pkill/tests/pgrep-g_test.sh similarity index 85% rename from tools/regression/usr.bin/pkill/pgrep-g.t rename to bin/pkill/tests/pgrep-g_test.sh index 19bd7748b3e3..14149082338f 100644 --- a/tools/regression/usr.bin/pkill/pgrep-g.t +++ b/bin/pkill/tests/pgrep-g_test.sh @@ -7,7 +7,7 @@ echo "1..2" name="pgrep -g " pgrp=`ps -o tpgid -p $$ | tail -1` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -22,7 +22,7 @@ kill $chpid rm -f $sleep name="pgrep -g 0" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-i.t b/bin/pkill/tests/pgrep-i_test.sh similarity index 88% rename from tools/regression/usr.bin/pkill/pgrep-i.t rename to bin/pkill/tests/pgrep-i_test.sh index cbf36ff4dac7..b9ecfbc1511d 100644 --- a/tools/regression/usr.bin/pkill/pgrep-i.t +++ b/bin/pkill/tests/pgrep-i_test.sh @@ -6,7 +6,7 @@ base=`basename $0` echo "1..1" name="pgrep -i" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt usleep="${sleep}XXX" touch $usleep lsleep="${sleep}xxx" diff --git a/tools/regression/usr.bin/pkill/pgrep-j.t b/bin/pkill/tests/pgrep-j_test.sh similarity index 91% rename from tools/regression/usr.bin/pkill/pgrep-j.t rename to bin/pkill/tests/pgrep-j_test.sh index 861d5751cc8d..6656a9bd789f 100644 --- a/tools/regression/usr.bin/pkill/pgrep-j.t +++ b/bin/pkill/tests/pgrep-j_test.sh @@ -7,7 +7,7 @@ echo "1..3" name="pgrep -j " if [ `id -u` -eq 0 ]; then - sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep jail / $base-1 127.0.0.1 $sleep 5 & chpid=$! @@ -31,7 +31,7 @@ fi name="pgrep -j any" if [ `id -u` -eq 0 ]; then - sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep jail / $base-1 127.0.0.1 $sleep 5 & chpid=$! @@ -55,7 +55,7 @@ fi name="pgrep -j none" if [ `id -u` -eq 0 ]; then - sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & chpid=$! diff --git a/tools/regression/usr.bin/pkill/pgrep-l.t b/bin/pkill/tests/pgrep-l_test.sh similarity index 85% rename from tools/regression/usr.bin/pkill/pgrep-l.t rename to bin/pkill/tests/pgrep-l_test.sh index 3be3402e65cd..49273b315b6c 100644 --- a/tools/regression/usr.bin/pkill/pgrep-l.t +++ b/bin/pkill/tests/pgrep-l_test.sh @@ -6,7 +6,7 @@ base=`basename $0` echo "1..1" name="pgrep -l" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-n.t b/bin/pkill/tests/pgrep-n_test.sh similarity index 87% rename from tools/regression/usr.bin/pkill/pgrep-n.t rename to bin/pkill/tests/pgrep-n_test.sh index cde95fb5c057..1b6fe8302867 100644 --- a/tools/regression/usr.bin/pkill/pgrep-n.t +++ b/bin/pkill/tests/pgrep-n_test.sh @@ -6,7 +6,7 @@ base=`basename $0` echo "1..1" name="pgrep -n" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & oldpid=$! diff --git a/tools/regression/usr.bin/pkill/pgrep-o.t b/bin/pkill/tests/pgrep-o_test.sh similarity index 87% rename from tools/regression/usr.bin/pkill/pgrep-o.t rename to bin/pkill/tests/pgrep-o_test.sh index 2b1cf5167239..250f230ec84f 100644 --- a/tools/regression/usr.bin/pkill/pgrep-o.t +++ b/bin/pkill/tests/pgrep-o_test.sh @@ -6,7 +6,7 @@ base=`basename $0` echo "1..1" name="pgrep -o" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & oldpid=$! diff --git a/tools/regression/usr.bin/pkill/pgrep-q.t b/bin/pkill/tests/pgrep-q_test.sh similarity index 85% rename from tools/regression/usr.bin/pkill/pgrep-q.t rename to bin/pkill/tests/pgrep-q_test.sh index 02a89fc1295b..2626a5e6bbac 100644 --- a/tools/regression/usr.bin/pkill/pgrep-q.t +++ b/bin/pkill/tests/pgrep-q_test.sh @@ -6,8 +6,8 @@ base=`basename $0` echo "1..4" name="pgrep -q" -sleep0=`mktemp /tmp/$base.XXXXXX` || exit 1 -sleep1=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep0=$(pwd)/sleep0.txt +sleep1=$(pwd)/sleep1.txt ln -sf /bin/sleep $sleep0 $sleep0 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-s.t b/bin/pkill/tests/pgrep-s_test.sh similarity index 85% rename from tools/regression/usr.bin/pkill/pgrep-s.t rename to bin/pkill/tests/pgrep-s_test.sh index b9d39698ed51..82c1ef98ddb1 100644 --- a/tools/regression/usr.bin/pkill/pgrep-s.t +++ b/bin/pkill/tests/pgrep-s_test.sh @@ -7,7 +7,7 @@ echo "1..2" name="pgrep -s " sid=`ps -o tsid -p $$ | tail -1` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -22,7 +22,7 @@ kill $chpid rm -f $sleep name="pgrep -s 0" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-t.t b/bin/pkill/tests/pgrep-t_test.sh similarity index 83% rename from tools/regression/usr.bin/pkill/pgrep-t.t rename to bin/pkill/tests/pgrep-t_test.sh index c1d0c2a4861d..a8527d5be611 100644 --- a/tools/regression/usr.bin/pkill/pgrep-t.t +++ b/bin/pkill/tests/pgrep-t_test.sh @@ -6,8 +6,8 @@ base=`basename $0` echo "1..2" name="pgrep -t " -tty=`ps -o tty -p $$ | tail -1` -if [ "$tty" = "??" ]; then +tty=`ps -x -o tty -p $$ | tail -1` +if [ "$tty" = "??" -o "$tty" = "-" ]; then tty="-" ttyshort="-" else @@ -16,7 +16,7 @@ else *) ttyshort=`echo $tty | cut -c 4-` ;; esac fi -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-v.t b/bin/pkill/tests/pgrep-v_test.sh similarity index 89% rename from tools/regression/usr.bin/pkill/pgrep-v.t rename to bin/pkill/tests/pgrep-v_test.sh index 11a2be27c4ba..b9835bc29f0e 100644 --- a/tools/regression/usr.bin/pkill/pgrep-v.t +++ b/bin/pkill/tests/pgrep-v_test.sh @@ -6,7 +6,7 @@ base=`basename $0` echo "1..2" name="pgrep -v" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pgrep-x.t b/bin/pkill/tests/pgrep-x_test.sh similarity index 93% rename from tools/regression/usr.bin/pkill/pgrep-x.t rename to bin/pkill/tests/pgrep-x_test.sh index 890666496280..1defde23d962 100644 --- a/tools/regression/usr.bin/pkill/pgrep-x.t +++ b/bin/pkill/tests/pgrep-x_test.sh @@ -6,7 +6,7 @@ base=`basename $0` echo "1..4" name="pgrep -x" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-F.t b/bin/pkill/tests/pkill-F_test.sh similarity index 76% rename from tools/regression/usr.bin/pkill/pkill-F.t rename to bin/pkill/tests/pkill-F_test.sh index 732d80757bbb..48ad47456839 100644 --- a/tools/regression/usr.bin/pkill/pkill-F.t +++ b/bin/pkill/tests/pkill-F_test.sh @@ -6,8 +6,8 @@ base=`basename $0` echo "1..1" name="pkill -F " -pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +pidfile=$(pwd)/pidfile.txt +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-LF.t b/bin/pkill/tests/pkill-LF_test.sh similarity index 86% rename from tools/regression/usr.bin/pkill/pkill-LF.t rename to bin/pkill/tests/pkill-LF_test.sh index adb6ba9d4f97..fcafd0a1ee2a 100644 --- a/tools/regression/usr.bin/pkill/pkill-LF.t +++ b/bin/pkill/tests/pkill-LF_test.sh @@ -6,8 +6,8 @@ base=`basename $0` echo "1..2" name="pkill -LF " -pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +pidfile=$(pwd)/pidfile.txt +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep daemon -p $pidfile $sleep 5 sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-P.t b/bin/pkill/tests/pkill-P_test.sh similarity index 85% rename from tools/regression/usr.bin/pkill/pkill-P.t rename to bin/pkill/tests/pkill-P_test.sh index 4b8ddb559e5b..2030710af659 100644 --- a/tools/regression/usr.bin/pkill/pkill-P.t +++ b/bin/pkill/tests/pkill-P_test.sh @@ -7,7 +7,7 @@ echo "1..1" name="pkill -P " ppid=$$ -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-U.t b/bin/pkill/tests/pkill-U_test.sh similarity index 84% rename from tools/regression/usr.bin/pkill/pkill-U.t rename to bin/pkill/tests/pkill-U_test.sh index 16313f82836a..04395e559387 100644 --- a/tools/regression/usr.bin/pkill/pkill-U.t +++ b/bin/pkill/tests/pkill-U_test.sh @@ -7,7 +7,7 @@ echo "1..2" name="pkill -U " ruid=`id -ur` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -25,7 +25,7 @@ rm -f $sleep name="pkill -U " ruid=`id -urn` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-_g.t b/bin/pkill/tests/pkill-_g_test.sh similarity index 84% rename from tools/regression/usr.bin/pkill/pkill-_g.t rename to bin/pkill/tests/pkill-_g_test.sh index 0717cea792c3..1739ac88efa3 100644 --- a/tools/regression/usr.bin/pkill/pkill-_g.t +++ b/bin/pkill/tests/pkill-_g_test.sh @@ -7,7 +7,7 @@ echo "1..2" name="pkill -G " rgid=`id -gr` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -25,7 +25,7 @@ rm -f $sleep name="pkill -G " rgid=`id -grn` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-g.t b/bin/pkill/tests/pkill-g_test.sh similarity index 84% rename from tools/regression/usr.bin/pkill/pkill-g.t rename to bin/pkill/tests/pkill-g_test.sh index d00adacb27fb..29d6ab77b6ab 100644 --- a/tools/regression/usr.bin/pkill/pkill-g.t +++ b/bin/pkill/tests/pkill-g_test.sh @@ -7,7 +7,7 @@ echo "1..2" name="pkill -g " pgrp=`ps -o tpgid -p $$ | tail -1` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -24,7 +24,7 @@ esac rm -f $sleep name="pkill -g 0" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-i.t b/bin/pkill/tests/pkill-i_test.sh similarity index 87% rename from tools/regression/usr.bin/pkill/pkill-i.t rename to bin/pkill/tests/pkill-i_test.sh index 6574cbd5d25d..b9b8df8be459 100644 --- a/tools/regression/usr.bin/pkill/pkill-i.t +++ b/bin/pkill/tests/pkill-i_test.sh @@ -6,7 +6,7 @@ base=`basename $0` echo "1..1" name="pkill -i" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt usleep="${sleep}XXX" touch $usleep lsleep="${sleep}xxx" diff --git a/tools/regression/usr.bin/pkill/pkill-j.t b/bin/pkill/tests/pkill-j_test.sh similarity index 91% rename from tools/regression/usr.bin/pkill/pkill-j.t rename to bin/pkill/tests/pkill-j_test.sh index 5cb0311582bf..48e7c721bbec 100644 --- a/tools/regression/usr.bin/pkill/pkill-j.t +++ b/bin/pkill/tests/pkill-j_test.sh @@ -7,7 +7,7 @@ echo "1..3" name="pkill -j " if [ `id -u` -eq 0 ]; then - sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep jail / $base-1 127.0.0.1 $sleep 5 & chpid=$! @@ -30,7 +30,7 @@ fi name="pkill -j any" if [ `id -u` -eq 0 ]; then - sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep jail / $base-1 127.0.0.1 $sleep 5 & chpid=$! @@ -52,7 +52,7 @@ fi name="pkill -j none" if [ `id -u` -eq 0 ]; then - sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & chpid=$! diff --git a/tools/regression/usr.bin/pkill/pkill-s.t b/bin/pkill/tests/pkill-s_test.sh similarity index 84% rename from tools/regression/usr.bin/pkill/pkill-s.t rename to bin/pkill/tests/pkill-s_test.sh index 5fc4dc6f2f94..0a9587ba6f16 100644 --- a/tools/regression/usr.bin/pkill/pkill-s.t +++ b/bin/pkill/tests/pkill-s_test.sh @@ -7,7 +7,7 @@ echo "1..2" name="pkill -s " sid=`ps -o tsid -p $$ | tail -1` -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -24,7 +24,7 @@ esac rm -f $sleep name="pkill -s 0" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-t.t b/bin/pkill/tests/pkill-t_test.sh similarity index 83% rename from tools/regression/usr.bin/pkill/pkill-t.t rename to bin/pkill/tests/pkill-t_test.sh index 84a66c30088a..07f511bd1ad7 100644 --- a/tools/regression/usr.bin/pkill/pkill-t.t +++ b/bin/pkill/tests/pkill-t_test.sh @@ -6,8 +6,8 @@ base=`basename $0` echo "1..2" name="pkill -t " -tty=`ps -o tty -p $$ | tail -1` -if [ "$tty" = "??" ]; then +tty=`ps -x -o tty -p $$ | tail -1` +if [ "$tty" = "??" -o "$tty" = "-" ]; then tty="-" ttyshort="-" else @@ -16,7 +16,7 @@ else *) ttyshort=`echo $tty | cut -c 4-` ;; esac fi -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/tools/regression/usr.bin/pkill/pkill-x.t b/bin/pkill/tests/pkill-x_test.sh similarity index 87% rename from tools/regression/usr.bin/pkill/pkill-x.t rename to bin/pkill/tests/pkill-x_test.sh index 61d5d5b5425f..5ff0d680a83a 100644 --- a/tools/regression/usr.bin/pkill/pkill-x.t +++ b/bin/pkill/tests/pkill-x_test.sh @@ -6,7 +6,7 @@ base=`basename $0` echo "1..4" name="pkill -x" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 @@ -25,7 +25,7 @@ fi rm -f $sleep name="pkill -x -f" -sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep $sleep 5 & sleep 0.3 diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 5c0570514abf..72e3a9842183 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -27,6 +27,8 @@ .. pax .. + pkill + .. sh builtins ..