xref: /freebsd/bin/pkill/tests/pkill-x_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..4"
7*65c3cfc1SJulio Merino
8*65c3cfc1SJulio Merinoname="pkill -x"
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 Merinopkill -x slee -P $$
14*65c3cfc1SJulio Merinoif [ $? -ne 0 ]; then
15*65c3cfc1SJulio Merino	echo "ok 1 - $name"
16*65c3cfc1SJulio Merinoelse
17*65c3cfc1SJulio Merino	echo "not ok 1 - $name"
18*65c3cfc1SJulio Merinofi
19*65c3cfc1SJulio Merinopkill -x sleep -P $$
20*65c3cfc1SJulio Merinoif [ $? -eq 0 ]; then
21*65c3cfc1SJulio Merino	echo "ok 2 - $name"
22*65c3cfc1SJulio Merinoelse
23*65c3cfc1SJulio Merino	echo "not ok 2 - $name"
24*65c3cfc1SJulio Merinofi
25*65c3cfc1SJulio Merinorm -f $sleep
26*65c3cfc1SJulio Merino
27*65c3cfc1SJulio Merinoname="pkill -x -f"
28*65c3cfc1SJulio Merinosleep=$(pwd)/sleep.txt
29*65c3cfc1SJulio Merinoln -sf /bin/sleep $sleep
30*65c3cfc1SJulio Merino$sleep 5 &
31*65c3cfc1SJulio Merinosleep 0.3
32*65c3cfc1SJulio Merinopkill -x -f "$sleep " -P $$
33*65c3cfc1SJulio Merinoif [ $? -ne 0 ]; then
34*65c3cfc1SJulio Merino	echo "ok 3 - $name"
35*65c3cfc1SJulio Merinoelse
36*65c3cfc1SJulio Merino	echo "not ok 3 - $name"
37*65c3cfc1SJulio Merinofi
38*65c3cfc1SJulio Merinopkill -x -f "$sleep 5" -P $$
39*65c3cfc1SJulio Merinoif [ $? -eq 0 ]; then
40*65c3cfc1SJulio Merino	echo "ok 4 - $name"
41*65c3cfc1SJulio Merinoelse
42*65c3cfc1SJulio Merino	echo "not ok 4 - $name"
43*65c3cfc1SJulio Merinofi
44*65c3cfc1SJulio Merinorm -f $sleep
45