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.
This commit is contained in:
Julio Merino 2014-03-19 12:46:04 +00:00
parent 3198603edd
commit 65c3cfc1aa
31 changed files with 95 additions and 49 deletions

View File

@ -1,6 +1,8 @@
# $NetBSD: Makefile,v 1.1 2002/03/01 11:21:58 ad Exp $
# $FreeBSD$
.include <bsd.own.mk>
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 <bsd.prog.mk>

38
bin/pkill/tests/Makefile Normal file
View File

@ -0,0 +1,38 @@
# $FreeBSD$
.include <bsd.own.mk>
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 <bsd.test.mk>

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..1"
name="pgrep -F <pidfile>"
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

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2"
name="pgrep -LF <pidfile>"
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

View File

@ -7,7 +7,7 @@ echo "1..1"
name="pgrep -P <ppid>"
ppid=$$
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -U <uid>"
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 <user>"
ruid=`id -urn`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -G <gid>"
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 <group>"
rgid=`id -grn`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -g <pgrp>"
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

View File

@ -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"

View File

@ -7,7 +7,7 @@ echo "1..3"
name="pgrep -j <jid>"
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=$!

View File

@ -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

View File

@ -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=$!

View File

@ -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=$!

View File

@ -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

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -s <sid>"
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

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2"
name="pgrep -t <tty>"
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

View File

@ -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

View File

@ -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

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..1"
name="pkill -F <pidfile>"
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

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2"
name="pkill -LF <pidfile>"
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

View File

@ -7,7 +7,7 @@ echo "1..1"
name="pkill -P <ppid>"
ppid=$$
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -U <uid>"
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 <user>"
ruid=`id -urn`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -G <gid>"
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 <group>"
rgid=`id -grn`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1
sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -g <pgrp>"
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

View File

@ -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"

View File

@ -7,7 +7,7 @@ echo "1..3"
name="pkill -j <jid>"
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=$!

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -s <sid>"
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

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2"
name="pkill -t <tty>"
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

View File

@ -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

View File

@ -27,6 +27,8 @@
..
pax
..
pkill
..
sh
builtins
..