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