xref: /freebsd/bin/pkill/tests/pgrep-g_test.sh (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1#!/bin/sh
2# $FreeBSD$
3
4base=`basename $0`
5
6echo "1..2"
7
8name="pgrep -g <pgrp>"
9pgrp=`ps -o tpgid -p $$ | tail -1`
10sleep=$(pwd)/sleep.txt
11ln -sf /bin/sleep $sleep
12$sleep 5 &
13sleep 0.3
14chpid=$!
15pid=`pgrep -f -g $pgrp $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 -g 0"
25sleep=$(pwd)/sleep.txt
26ln -sf /bin/sleep $sleep
27$sleep 5 &
28sleep 0.3
29chpid=$!
30pid=`pgrep -f -g 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