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