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 $ # $NetBSD: Makefile,v 1.1 2002/03/01 11:21:58 ad Exp $
# $FreeBSD$ # $FreeBSD$
.include <bsd.own.mk>
PROG= pkill PROG= pkill
DPADD= ${LIBKVM} DPADD= ${LIBKVM}
@ -17,4 +19,8 @@ MLINKS= pkill.1 pgrep.1
SYMLINKS= ${BINDIR}/pkill /usr/bin/pkill SYMLINKS= ${BINDIR}/pkill /usr/bin/pkill
SYMLINKS+= ${BINDIR}/pgrep /usr/bin/pgrep SYMLINKS+= ${BINDIR}/pgrep /usr/bin/pgrep
.if ${MK_TESTS} != "no"
SUBDIR+= tests
.endif
.include <bsd.prog.mk> .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" echo "1..1"
name="pgrep -F <pidfile>" name="pgrep -F <pidfile>"
pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 pidfile=$(pwd)/pidfile.txt
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2" echo "1..2"
name="pgrep -LF <pidfile>" name="pgrep -LF <pidfile>"
pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 pidfile=$(pwd)/pidfile.txt
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
daemon -p $pidfile $sleep 5 daemon -p $pidfile $sleep 5
sleep 0.3 sleep 0.3

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -g <pgrp>" name="pgrep -g <pgrp>"
pgrp=`ps -o tpgid -p $$ | tail -1` pgrp=`ps -o tpgid -p $$ | tail -1`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3
@ -22,7 +22,7 @@ kill $chpid
rm -f $sleep rm -f $sleep
name="pgrep -g 0" name="pgrep -g 0"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1" echo "1..1"
name="pgrep -i" name="pgrep -i"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
usleep="${sleep}XXX" usleep="${sleep}XXX"
touch $usleep touch $usleep
lsleep="${sleep}xxx" lsleep="${sleep}xxx"

View File

@ -7,7 +7,7 @@ echo "1..3"
name="pgrep -j <jid>" name="pgrep -j <jid>"
if [ `id -u` -eq 0 ]; then if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
jail / $base-1 127.0.0.1 $sleep 5 & jail / $base-1 127.0.0.1 $sleep 5 &
chpid=$! chpid=$!
@ -31,7 +31,7 @@ fi
name="pgrep -j any" name="pgrep -j any"
if [ `id -u` -eq 0 ]; then if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
jail / $base-1 127.0.0.1 $sleep 5 & jail / $base-1 127.0.0.1 $sleep 5 &
chpid=$! chpid=$!
@ -55,7 +55,7 @@ fi
name="pgrep -j none" name="pgrep -j none"
if [ `id -u` -eq 0 ]; then if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
chpid=$! chpid=$!

View File

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

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1" echo "1..1"
name="pgrep -n" name="pgrep -n"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
oldpid=$! oldpid=$!

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1" echo "1..1"
name="pgrep -o" name="pgrep -o"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
oldpid=$! oldpid=$!

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..4" echo "1..4"
name="pgrep -q" name="pgrep -q"
sleep0=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep0=$(pwd)/sleep0.txt
sleep1=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep1=$(pwd)/sleep1.txt
ln -sf /bin/sleep $sleep0 ln -sf /bin/sleep $sleep0
$sleep0 5 & $sleep0 5 &
sleep 0.3 sleep 0.3

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pgrep -s <sid>" name="pgrep -s <sid>"
sid=`ps -o tsid -p $$ | tail -1` sid=`ps -o tsid -p $$ | tail -1`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3
@ -22,7 +22,7 @@ kill $chpid
rm -f $sleep rm -f $sleep
name="pgrep -s 0" name="pgrep -s 0"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2" echo "1..2"
name="pgrep -t <tty>" name="pgrep -t <tty>"
tty=`ps -o tty -p $$ | tail -1` tty=`ps -x -o tty -p $$ | tail -1`
if [ "$tty" = "??" ]; then if [ "$tty" = "??" -o "$tty" = "-" ]; then
tty="-" tty="-"
ttyshort="-" ttyshort="-"
else else
@ -16,7 +16,7 @@ else
*) ttyshort=`echo $tty | cut -c 4-` ;; *) ttyshort=`echo $tty | cut -c 4-` ;;
esac esac
fi fi
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..2" echo "1..2"
name="pgrep -v" name="pgrep -v"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..4" echo "1..4"
name="pgrep -x" name="pgrep -x"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..1" echo "1..1"
name="pkill -F <pidfile>" name="pkill -F <pidfile>"
pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 pidfile=$(pwd)/pidfile.txt
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2" echo "1..2"
name="pkill -LF <pidfile>" name="pkill -LF <pidfile>"
pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 pidfile=$(pwd)/pidfile.txt
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
daemon -p $pidfile $sleep 5 daemon -p $pidfile $sleep 5
sleep 0.3 sleep 0.3

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -g <pgrp>" name="pkill -g <pgrp>"
pgrp=`ps -o tpgid -p $$ | tail -1` pgrp=`ps -o tpgid -p $$ | tail -1`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3
@ -24,7 +24,7 @@ esac
rm -f $sleep rm -f $sleep
name="pkill -g 0" name="pkill -g 0"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..1" echo "1..1"
name="pkill -i" name="pkill -i"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
usleep="${sleep}XXX" usleep="${sleep}XXX"
touch $usleep touch $usleep
lsleep="${sleep}xxx" lsleep="${sleep}xxx"

View File

@ -7,7 +7,7 @@ echo "1..3"
name="pkill -j <jid>" name="pkill -j <jid>"
if [ `id -u` -eq 0 ]; then if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
jail / $base-1 127.0.0.1 $sleep 5 & jail / $base-1 127.0.0.1 $sleep 5 &
chpid=$! chpid=$!
@ -30,7 +30,7 @@ fi
name="pkill -j any" name="pkill -j any"
if [ `id -u` -eq 0 ]; then if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
jail / $base-1 127.0.0.1 $sleep 5 & jail / $base-1 127.0.0.1 $sleep 5 &
chpid=$! chpid=$!
@ -52,7 +52,7 @@ fi
name="pkill -j none" name="pkill -j none"
if [ `id -u` -eq 0 ]; then if [ `id -u` -eq 0 ]; then
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
chpid=$! chpid=$!

View File

@ -7,7 +7,7 @@ echo "1..2"
name="pkill -s <sid>" name="pkill -s <sid>"
sid=`ps -o tsid -p $$ | tail -1` sid=`ps -o tsid -p $$ | tail -1`
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3
@ -24,7 +24,7 @@ esac
rm -f $sleep rm -f $sleep
name="pkill -s 0" name="pkill -s 0"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,8 +6,8 @@ base=`basename $0`
echo "1..2" echo "1..2"
name="pkill -t <tty>" name="pkill -t <tty>"
tty=`ps -o tty -p $$ | tail -1` tty=`ps -x -o tty -p $$ | tail -1`
if [ "$tty" = "??" ]; then if [ "$tty" = "??" -o "$tty" = "-" ]; then
tty="-" tty="-"
ttyshort="-" ttyshort="-"
else else
@ -16,7 +16,7 @@ else
*) ttyshort=`echo $tty | cut -c 4-` ;; *) ttyshort=`echo $tty | cut -c 4-` ;;
esac esac
fi fi
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

@ -6,7 +6,7 @@ base=`basename $0`
echo "1..4" echo "1..4"
name="pkill -x" name="pkill -x"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3
@ -25,7 +25,7 @@ fi
rm -f $sleep rm -f $sleep
name="pkill -x -f" name="pkill -x -f"
sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep ln -sf /bin/sleep $sleep
$sleep 5 & $sleep 5 &
sleep 0.3 sleep 0.3

View File

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