Fix pkill tests so that they run cleanly with prove.

This fixes a pgrep test that assumed that PID 2 was named g_event.  This
does not seem to be the case any longer (and I don't know if it ever was
in all possible setups).

Change this test to use the idle loop instead and determine its expected
PID using ps without assuming any specific ID.
This commit is contained in:
Julio Merino 2014-03-09 22:14:20 +00:00
parent 385cd39138
commit fb3e85e1dc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=262961

View File

@ -5,15 +5,17 @@ base=`basename $0`
echo "1..2"
exp_pid="$(ps ax | grep '\[idle\]' | awk '{print $1}')"
name="pgrep -S"
pid=`pgrep -Sx g_event`
if [ "$pid" = "2" ]; then
pid=`pgrep -Sx idle`
if [ "$pid" = "$exp_pid" ]; then
echo "ok 1 - $name"
else
echo "not ok 1 - $name"
fi
pid=`pgrep -x g_event`
if [ "$pid" != "2" ]; then
pid=`pgrep -x idle`
if [ "$pid" != "$exp_pid" ]; then
echo "ok 2 - $name"
else
echo "not ok 2 - $name"