8 line="$(jls -n 2> /dev/null | grep name=$check_name )"
11 if [ "${name}" = "jid" ]; then
25 if [ `id -u` -eq 0 ]; then
26 sleep=$(pwd)/sleep.txt
27 ln -sf /bin/sleep $sleep
28 jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \
29 command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 &
31 jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \
32 command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 &
34 jid1=$(jail_name_to_jid ${base}_1_1)
35 jid2=$(jail_name_to_jid ${base}_1_2)
37 pid1="$(pgrep -f -x -j $jid "$sleep 5" | sort)"
38 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \
39 $(cat ${PWD}/${base}_1_2.pid) | sort)
40 if [ "$pid1" = "$pid2" ]; then
43 echo "not ok 1 - $name"
45 [ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid)
46 [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid)
49 echo "ok 1 - $name # skip Test needs uid 0."
53 if [ `id -u` -eq 0 ]; then
54 sleep=$(pwd)/sleep.txt
55 ln -sf /bin/sleep $sleep
56 jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \
57 command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 &
59 jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \
60 command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 &
63 pid1="$(pgrep -f -x -j any "$sleep 5" | sort)"
64 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \
65 $(cat ${PWD}/${base}_2_2.pid) | sort)
66 if [ "$pid1" = "$pid2" ]; then
69 echo "not ok 2 - $name"
71 [ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid)
72 [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid)
75 echo "ok 2 - $name # skip Test needs uid 0."
79 if [ `id -u` -eq 0 ]; then
80 sleep=$(pwd)/sleep.txt
81 ln -sf /bin/sleep $sleep
82 daemon -p ${PWD}/${base}_3_1.pid $sleep 5 &
83 jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \
84 command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 &
86 pid="$(pgrep -f -x -j none "$sleep 5")"
87 if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then
90 echo "not ok 3 - $name"
93 [ -f ${PWD}/${base}_3_1.pid ] && kill $(cat $PWD/${base}_3_1.pid)
94 [ -f ${PWD}/${base}_3_2.pid ] && kill $(cat $PWD/${base}_3_2.pid)
96 echo "ok 3 - $name # skip Test needs uid 0."