diff --git a/tools/regression/usr.bin/pkill/pgrep-F.t b/tools/regression/usr.bin/pkill/pgrep-F.t new file mode 100644 index 000000000000..a4c1c6cd9056 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-F.t @@ -0,0 +1,24 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pgrep -F " +pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +echo $chpid > $pidfile +pid=`pgrep -f -F $pidfile $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok - $name" +else + echo "not ok - $name" +fi +kill $chpid +rm -f $pidfile +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-G.t b/tools/regression/usr.bin/pkill/pgrep-G.t new file mode 100644 index 000000000000..b07b6089b69e --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-G.t @@ -0,0 +1,38 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -G " +rgid=`id -gr` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -G $rgid $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +kill $chpid +rm -f $sleep + +name="pgrep -G " +rgid=`id -grn` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -G $rgid $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +kill $chpid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-P.t b/tools/regression/usr.bin/pkill/pgrep-P.t new file mode 100644 index 000000000000..d139edbb078e --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-P.t @@ -0,0 +1,22 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pgrep -P " +ppid=$$ +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -P $ppid $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok - $name" +else + echo "not ok - $name" +fi +kill $chpid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-S.t b/tools/regression/usr.bin/pkill/pgrep-S.t new file mode 100644 index 000000000000..5ce98e6fa8bc --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-S.t @@ -0,0 +1,20 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -S" +pid=`pgrep -Sx g_event` +if [ "$pid" = "2" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +pid=`pgrep -x g_event` +if [ "$pid" != "2" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi diff --git a/tools/regression/usr.bin/pkill/pgrep-U.t b/tools/regression/usr.bin/pkill/pgrep-U.t new file mode 100644 index 000000000000..7cc865ab5f38 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-U.t @@ -0,0 +1,38 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -U " +ruid=`id -ur` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -U $ruid $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +kill $chpid +rm -f $sleep + +name="pgrep -U " +ruid=`id -urn` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -U $ruid $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +kill $chpid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-g.t b/tools/regression/usr.bin/pkill/pgrep-g.t new file mode 100644 index 000000000000..19bd7748b3e3 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-g.t @@ -0,0 +1,37 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -g " +pgrp=`ps -o tpgid -p $$ | tail -1` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -g $pgrp $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +kill $chpid +rm -f $sleep + +name="pgrep -g 0" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -g 0 $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +kill $chpid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-i.t b/tools/regression/usr.bin/pkill/pgrep-i.t new file mode 100644 index 000000000000..cbf36ff4dac7 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-i.t @@ -0,0 +1,24 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pgrep -i" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +usleep="${sleep}XXX" +touch $usleep +lsleep="${sleep}xxx" +ln -sf /bin/sleep $usleep +$usleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -i $lsleep` +if [ "$pid" = "$chpid" ]; then + echo "ok - $name" +else + echo "not ok - $name" +fi +kill $chpid +rm -f $sleep $usleep diff --git a/tools/regression/usr.bin/pkill/pgrep-j.t b/tools/regression/usr.bin/pkill/pgrep-j.t new file mode 100644 index 000000000000..37c1e73f7e18 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-j.t @@ -0,0 +1,45 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -j " +if [ `id -u` -eq 0 ]; then + sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + ln -sf /bin/sleep $sleep + jail / temp 127.0.0.1 $sleep 5 & + sleep 0.3 + chpid=$! + jid=`jls | egrep '127\.0\.0\.1.*temp.*\/' | awk '{print $1}'` + pid=`pgrep -f -j $jid $sleep` + if [ "$pid" = "$chpid" ]; then + echo "ok 1 - $name" + else + echo "not ok 1 - $name" + fi + kill $chpid + rm -f $sleep +else + echo "ok 1 - $name # skip Test needs uid 0." +fi + +name="pgrep -j 0" +if [ `id -u` -eq 0 ]; then + sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + ln -sf /bin/sleep $sleep + jail / temp 127.0.0.1 $sleep 5 & + sleep 0.3 + chpid=$! + pid=`pgrep -f -j 0 $sleep` + if [ "$pid" = "$chpid" ]; then + echo "ok 2 - $name" + else + echo "not ok 2 - $name" + fi + kill $chpid + rm -f $sleep +else + echo "ok 2 - $name # skip Test needs uid 0." +fi diff --git a/tools/regression/usr.bin/pkill/pgrep-l.t b/tools/regression/usr.bin/pkill/pgrep-l.t new file mode 100644 index 000000000000..3be3402e65cd --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-l.t @@ -0,0 +1,20 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pgrep -l" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pid=$! +if [ "$pid $sleep 5" = "`pgrep -f -l $sleep`" ]; then + echo "ok - $name" +else + echo "not ok - $name" +fi +kill $pid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-n.t b/tools/regression/usr.bin/pkill/pgrep-n.t new file mode 100644 index 000000000000..cde95fb5c057 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-n.t @@ -0,0 +1,24 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pgrep -n" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +oldpid=$! +$sleep 5 & +sleep 0.3 +newpid=$! +pid=`pgrep -f -n $sleep` +if [ "$pid" = "$newpid" ]; then + echo "ok - $name" +else + echo "not ok - $name" +fi +kill $oldpid +kill $newpid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-o.t b/tools/regression/usr.bin/pkill/pgrep-o.t new file mode 100644 index 000000000000..2b1cf5167239 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-o.t @@ -0,0 +1,24 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pgrep -o" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +oldpid=$! +$sleep 5 & +sleep 0.3 +newpid=$! +pid=`pgrep -f -o $sleep` +if [ "$pid" = "$oldpid" ]; then + echo "ok - $name" +else + echo "not ok - $name" +fi +kill $oldpid +kill $newpid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-s.t b/tools/regression/usr.bin/pkill/pgrep-s.t new file mode 100644 index 000000000000..b9d39698ed51 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-s.t @@ -0,0 +1,37 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -s " +sid=`ps -o tsid -p $$ | tail -1` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -s $sid $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +kill $chpid +rm -f $sleep + +name="pgrep -s 0" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -s 0 $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +kill $chpid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-t.t b/tools/regression/usr.bin/pkill/pgrep-t.t new file mode 100644 index 000000000000..7fb580d2213f --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-t.t @@ -0,0 +1,25 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pgrep -t " +tty=`ps -o tty -p $$ | tail -1` +if [ "$tty" = "??" ]; then + tty="-" +fi +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +chpid=$! +pid=`pgrep -f -t $tty $sleep` +if [ "$pid" = "$chpid" ]; then + echo "ok - $name" +else + echo "not ok - $name" +fi +kill $chpid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-v.t b/tools/regression/usr.bin/pkill/pgrep-v.t new file mode 100644 index 000000000000..11a2be27c4ba --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-v.t @@ -0,0 +1,25 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pgrep -v" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pid=$! +if [ -z "`pgrep -f -v $sleep | egrep '^'"$pid"'$'`" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +if [ ! -z "`pgrep -f -v -x x | egrep '^'"$pid"'$'`" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +kill $pid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pgrep-x.t b/tools/regression/usr.bin/pkill/pgrep-x.t new file mode 100644 index 000000000000..890666496280 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-x.t @@ -0,0 +1,36 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..4" + +name="pgrep -x" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pid=$! +if [ ! -z "`pgrep -x sleep | egrep '^'"$pid"'$'`" ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +if [ -z "`pgrep -x slee | egrep '^'"$pid"'$'`" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +name="pgrep -x -f" +if [ ! -z "`pgrep -x -f ''"$sleep"' 5' | egrep '^'"$pid"'$'`" ]; then + echo "ok 3 - $name" +else + echo "not ok 3 - $name" +fi +if [ -z "`pgrep -x -f ''"$sleep"' ' | egrep '^'"$pid"'$'`" ]; then + echo "ok 4 - $name" +else + echo "not ok 4 - $name" +fi +kill $pid +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pkill-F.t b/tools/regression/usr.bin/pkill/pkill-F.t new file mode 100644 index 000000000000..732d80757bbb --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-F.t @@ -0,0 +1,27 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pkill -F " +pidfile=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +echo $! > $pidfile +pkill -f -F $pidfile $sleep +ec=$? +case $ec in +0) + echo "ok - $name" + ;; +*) + echo "not ok - $name" + ;; +esac + +rm -f $pidfile +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pkill-G.t b/tools/regression/usr.bin/pkill/pkill-G.t new file mode 100644 index 000000000000..0717cea792c3 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-G.t @@ -0,0 +1,42 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pkill -G " +rgid=`id -gr` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -G $rgid $sleep +ec=$? +case $ec in +0) + echo "ok 1 - $name" + ;; +*) + echo "not ok 1 - $name" + ;; +esac +rm -f $sleep + +name="pkill -G " +rgid=`id -grn` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -G $rgid $sleep +ec=$? +case $ec in +0) + echo "ok 2 - $name" + ;; +*) + echo "not ok 2 - $name" + ;; +esac +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pkill-P.t b/tools/regression/usr.bin/pkill/pkill-P.t new file mode 100644 index 000000000000..4b8ddb559e5b --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-P.t @@ -0,0 +1,25 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pkill -P " +ppid=$$ +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -P $ppid $sleep +ec=$? +case $ec in +0) + echo "ok - $name" + ;; +*) + echo "not ok - $name" + ;; +esac + +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pkill-U.t b/tools/regression/usr.bin/pkill/pkill-U.t new file mode 100644 index 000000000000..16313f82836a --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-U.t @@ -0,0 +1,42 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pkill -U " +ruid=`id -ur` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -U $ruid $sleep +ec=$? +case $ec in +0) + echo "ok 1 - $name" + ;; +*) + echo "not ok 1 - $name" + ;; +esac +rm -f $sleep + +name="pkill -U " +ruid=`id -urn` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -U $ruid $sleep +ec=$? +case $ec in +0) + echo "ok 2 - $name" + ;; +*) + echo "not ok 2 - $name" + ;; +esac +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pkill-g.t b/tools/regression/usr.bin/pkill/pkill-g.t new file mode 100644 index 000000000000..d00adacb27fb --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-g.t @@ -0,0 +1,41 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pkill -g " +pgrp=`ps -o tpgid -p $$ | tail -1` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -g $pgrp $sleep +ec=$? +case $ec in +0) + echo "ok 1 - $name" + ;; +*) + echo "not ok 1 - $name" + ;; +esac +rm -f $sleep + +name="pkill -g 0" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -g 0 $sleep +ec=$? +case $ec in +0) + echo "ok 2 - $name" + ;; +*) + echo "not ok 2 - $name" + ;; +esac +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pkill-i.t b/tools/regression/usr.bin/pkill/pkill-i.t new file mode 100644 index 000000000000..6574cbd5d25d --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-i.t @@ -0,0 +1,26 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pkill -i" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +usleep="${sleep}XXX" +touch $usleep +lsleep="${sleep}xxx" +ln -sf /bin/sleep $usleep +$usleep 5 & +sleep 0.3 +pkill -f -i $lsleep +ec=$? +case $ec in +0) + echo "ok - $name" + ;; +*) + echo "not ok - $name" + ;; +esac +rm -f $sleep $usleep diff --git a/tools/regression/usr.bin/pkill/pkill-j.t b/tools/regression/usr.bin/pkill/pkill-j.t new file mode 100644 index 000000000000..00393f1ab86c --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-j.t @@ -0,0 +1,49 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pkill -j " +if [ `id -u` -eq 0 ]; then + sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + ln -sf /bin/sleep $sleep + jail / temp 127.0.0.1 $sleep 5 & + sleep 0.3 + jid=`jls | egrep '127\.0\.0\.1.*temp.*\/' | awk '{print $1}'` + pkill -f -j $jid $sleep + ec=$? + case $ec in + 0) + echo "ok 1 - $name" + ;; + *) + echo "not ok 1 - $name" + ;; + esac + rm -f $sleep +else + echo "ok 1 - $name # skip Test needs uid 0." +fi + +name="pkill -j 0" +if [ `id -u` -eq 0 ]; then + sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 + ln -sf /bin/sleep $sleep + jail / temp 127.0.0.1 $sleep 5 & + sleep 0.3 + pkill -f -j 0 $sleep + ec=$? + case $ec in + 0) + echo "ok 2 - $name" + ;; + *) + echo "not ok 2 - $name" + ;; + esac + rm -f $sleep +else + echo "ok 1 - $name # skip Test needs uid 0." +fi diff --git a/tools/regression/usr.bin/pkill/pkill-s.t b/tools/regression/usr.bin/pkill/pkill-s.t new file mode 100644 index 000000000000..5fc4dc6f2f94 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-s.t @@ -0,0 +1,41 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..2" + +name="pkill -s " +sid=`ps -o tsid -p $$ | tail -1` +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -s $sid $sleep +ec=$? +case $ec in +0) + echo "ok 1 - $name" + ;; +*) + echo "not ok 1 - $name" + ;; +esac +rm -f $sleep + +name="pkill -s 0" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -s 0 $sleep +ec=$? +case $ec in +0) + echo "ok 2 - $name" + ;; +*) + echo "not ok 2 - $name" + ;; +esac +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pkill-t.t b/tools/regression/usr.bin/pkill/pkill-t.t new file mode 100644 index 000000000000..73458f56eeb1 --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-t.t @@ -0,0 +1,27 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..1" + +name="pkill -t " +tty=`ps -o tty -p $$ | tail -1` +if [ "$tty" = "??" ]; then + tty="-" +fi +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -f -t $tty $sleep +ec=$? +case $ec in +0) + echo "ok - $name" + ;; +*) + echo "not ok - $name" + ;; +esac +rm -f $sleep diff --git a/tools/regression/usr.bin/pkill/pkill-x.t b/tools/regression/usr.bin/pkill/pkill-x.t new file mode 100644 index 000000000000..61d5d5b5425f --- /dev/null +++ b/tools/regression/usr.bin/pkill/pkill-x.t @@ -0,0 +1,44 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..4" + +name="pkill -x" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -x slee -P $$ +if [ $? -ne 0 ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +pkill -x sleep -P $$ +if [ $? -eq 0 ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +rm -f $sleep + +name="pkill -x -f" +sleep=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep +$sleep 5 & +sleep 0.3 +pkill -x -f "$sleep " -P $$ +if [ $? -ne 0 ]; then + echo "ok 3 - $name" +else + echo "not ok 3 - $name" +fi +pkill -x -f "$sleep 5" -P $$ +if [ $? -eq 0 ]; then + echo "ok 4 - $name" +else + echo "not ok 4 - $name" +fi +rm -f $sleep