diff options
author | pjd <pjd@FreeBSD.org> | 2010-02-12 18:52:24 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2010-02-12 18:52:24 +0000 |
commit | b7ae6c55592057f4c5666982f689bf29094fe780 (patch) | |
tree | 2db3e83a83838cfe63cb466ccc99bc561510f5b1 /tools/regression | |
parent | 31c6160ef9b4c453564cf7797a45f4a8bd210c77 (diff) | |
download | FreeBSD-src-b7ae6c55592057f4c5666982f689bf29094fe780.zip FreeBSD-src-b7ae6c55592057f4c5666982f689bf29094fe780.tar.gz |
- Implement -q option for pgrep(1).
- Add regression test to test -q option.
Diffstat (limited to 'tools/regression')
-rw-r--r-- | tools/regression/usr.bin/pkill/pgrep-q.t | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/regression/usr.bin/pkill/pgrep-q.t b/tools/regression/usr.bin/pkill/pgrep-q.t new file mode 100644 index 0000000..02a89fc --- /dev/null +++ b/tools/regression/usr.bin/pkill/pgrep-q.t @@ -0,0 +1,38 @@ +#!/bin/sh +# $FreeBSD$ + +base=`basename $0` + +echo "1..4" + +name="pgrep -q" +sleep0=`mktemp /tmp/$base.XXXXXX` || exit 1 +sleep1=`mktemp /tmp/$base.XXXXXX` || exit 1 +ln -sf /bin/sleep $sleep0 +$sleep0 5 & +sleep 0.3 +pid=$! +out="`pgrep -q -f $sleep0 2>&1`" +if [ $? -eq 0 ]; then + echo "ok 1 - $name" +else + echo "not ok 1 - $name" +fi +if [ -z "${out}" ]; then + echo "ok 2 - $name" +else + echo "not ok 2 - $name" +fi +out="`pgrep -q -f $sleep1 2>&1`" +if [ $? -ne 0 ]; then + echo "ok 3 - $name" +else + echo "not ok 3 - $name" +fi +if [ -z "${out}" ]; then + echo "ok 4 - $name" +else + echo "not ok 4 - $name" +fi +kill $pid +rm -f $sleep0 $sleep1 |