xref: /freebsd/bin/pkill/tests/pgrep-s_test.sh (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1#!/bin/sh
2# $FreeBSD$
3
4base=`basename $0`
5
6echo "1..2"
7
8name="pgrep -s <sid>"
9sid=`ps -o tsid -p $$ | tail -1`
10sleep=$(pwd)/sleep.txt
11ln -sf /bin/sleep $sleep
12$sleep 5 &
13sleep 0.3
14chpid=$!
15pid=`pgrep -f -s $sid $sleep`
16if [ "$pid" = "$chpid" ]; then
17	echo "ok 1 - $name"
18else
19	echo "not ok 1 - $name"
20fi
21kill $chpid
22rm -f $sleep
23
24name="pgrep -s 0"
25sleep=$(pwd)/sleep.txt
26ln -sf /bin/sleep $sleep
27$sleep 5 &
28sleep 0.3
29chpid=$!
30pid=`pgrep -f -s 0 $sleep`
31if [ "$pid" = "$chpid" ]; then
32	echo "ok 2 - $name"
33else
34	echo "not ok 2 - $name"
35fi
36kill $chpid
37rm -f $sleep
38