7 jls -j "$check_name" -s | tr ' ' '\n' | grep jid= | sed -e 's/.*=//g'
12 if [ `id -u` -ne 0 ]; then
13 echo "1..0 # skip Test needs uid 0."
19 sleep=$(pwd)/sleep.txt
20 ln -sf /bin/sleep $sleep
24 jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
25 command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount &
27 jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
28 command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount &
31 for i in `seq 1 10`; do
32 jid1=$(jail_name_to_jid ${base}_1_1)
33 jid2=$(jail_name_to_jid ${base}_1_2)
44 pid1="$(pgrep -f -x -j "$jid" "$sleep $sleep_amount" | sort)"
45 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \
46 $(cat ${PWD}/${base}_1_2.pid) | sort)
47 if [ "$pid1" = "$pid2" ]; then
50 echo "not ok 1 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'"
52 [ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
53 [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
58 jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
59 command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount &
61 jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
62 command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount &
65 pid1="$(pgrep -f -x -j any "$sleep $sleep_amount" | sort)"
66 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \
67 $(cat ${PWD}/${base}_2_2.pid) | sort)
68 if [ "$pid1" = "$pid2" ]; then
71 echo "not ok 2 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'"
73 [ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
74 [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
79 daemon -p ${PWD}/${base}_3_1.pid $sleep $sleep_amount &
80 jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \
81 command=daemon -p ${PWD}/${base}_3_2.pid $sleep $sleep_amount &
83 pid="$(pgrep -f -x -j none "$sleep $sleep_amount")"
84 if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then
87 echo "not ok 3 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'"
89 [ -f ${PWD}/${base}_3_1.pid ] && kill $(cat $PWD/${base}_3_1.pid)
90 [ -f ${PWD}/${base}_3_2.pid ] && kill $(cat $PWD/${base}_3_2.pid)
93 # test 4 is like test 1 except with jname instead of jid.
94 name="pgrep -j <jname>"
96 jail -c path=/ name=${base}_4_1 ip4.addr=127.0.0.1 \
97 command=daemon -p ${PWD}/${base}_4_1.pid $sleep $sleep_amount &
99 jail -c path=/ name=${base}_4_2 ip4.addr=127.0.0.1 \
100 command=daemon -p ${PWD}/${base}_4_2.pid $sleep $sleep_amount &
104 jname="${base}_4_1,${base}_4_2"
105 pid1="$(pgrep -f -x -j "$jname" "$sleep $sleep_amount" | sort)"
106 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_4_1.pid)" \
107 $(cat ${PWD}/${base}_4_2.pid) | sort)
108 if [ "$pid1" = "$pid2" ]; then
111 echo "not ok 4 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'"
113 [ -f ${PWD}/${base}_4_1.pid ] && kill $(cat ${PWD}/${base}_4_1.pid)
114 [ -f ${PWD}/${base}_4_2.pid ] && kill $(cat ${PWD}/${base}_4_2.pid)