xref: /freebsd/bin/pkill/tests/pgrep-g_test.sh (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1*65c3cfc1SJulio Merino#!/bin/sh
2*65c3cfc1SJulio Merino
3*65c3cfc1SJulio Merinobase=`basename $0`
4*65c3cfc1SJulio Merino
5*65c3cfc1SJulio Merinoecho "1..2"
6*65c3cfc1SJulio Merino
7*65c3cfc1SJulio Merinoname="pgrep -g <pgrp>"
8*65c3cfc1SJulio Merinopgrp=`ps -o tpgid -p $$ | tail -1`
9*65c3cfc1SJulio Merinosleep=$(pwd)/sleep.txt
10*65c3cfc1SJulio Merinoln -sf /bin/sleep $sleep
11*65c3cfc1SJulio Merino$sleep 5 &
12*65c3cfc1SJulio Merinosleep 0.3
13*65c3cfc1SJulio Merinochpid=$!
14*65c3cfc1SJulio Merinopid=`pgrep -f -g $pgrp $sleep`
15*65c3cfc1SJulio Merinoif [ "$pid" = "$chpid" ]; then
16*65c3cfc1SJulio Merino	echo "ok 1 - $name"
17*65c3cfc1SJulio Merinoelse
18*65c3cfc1SJulio Merino	echo "not ok 1 - $name"
19*65c3cfc1SJulio Merinofi
20*65c3cfc1SJulio Merinokill $chpid
21*65c3cfc1SJulio Merinorm -f $sleep
22*65c3cfc1SJulio Merino
23*65c3cfc1SJulio Merinoname="pgrep -g 0"
24*65c3cfc1SJulio Merinosleep=$(pwd)/sleep.txt
25*65c3cfc1SJulio Merinoln -sf /bin/sleep $sleep
26*65c3cfc1SJulio Merino$sleep 5 &
27*65c3cfc1SJulio Merinosleep 0.3
28*65c3cfc1SJulio Merinochpid=$!
29*65c3cfc1SJulio Merinopid=`pgrep -f -g 0 $sleep`
30*65c3cfc1SJulio Merinoif [ "$pid" = "$chpid" ]; then
31*65c3cfc1SJulio Merino	echo "ok 2 - $name"
32*65c3cfc1SJulio Merinoelse
33*65c3cfc1SJulio Merino	echo "not ok 2 - $name"
34*65c3cfc1SJulio Merinofi
35*65c3cfc1SJulio Merinokill $chpid
36*65c3cfc1SJulio Merinorm -f $sleep
37