diff options
author | ngie <ngie@FreeBSD.org> | 2015-02-12 21:10:32 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-02-12 21:10:32 +0000 |
commit | 78357458c3d34eed371bf22b226ca615efd0b0f4 (patch) | |
tree | f4eb48d11b9a1725d5f5604dcd06a666d49b369d /bin/pkill | |
parent | 54c59fd68969bf0a48e1a95ee272a74ea14fecab (diff) | |
download | FreeBSD-src-78357458c3d34eed371bf22b226ca615efd0b0f4.zip FreeBSD-src-78357458c3d34eed371bf22b226ca615efd0b0f4.tar.gz |
Parameterize out the amount of sleep done in each test
Set the value in each test to a different amount to avoid potential
side-effects with other instances of the test (or lingering processes) still
being present on the system
Diffstat (limited to 'bin/pkill')
-rw-r--r-- | bin/pkill/tests/pgrep-j_test.sh | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/bin/pkill/tests/pgrep-j_test.sh b/bin/pkill/tests/pgrep-j_test.sh index 57c86a8..4afe28a 100644 --- a/bin/pkill/tests/pgrep-j_test.sh +++ b/bin/pkill/tests/pgrep-j_test.sh @@ -30,16 +30,17 @@ sleep=$(pwd)/sleep.txt ln -sf /bin/sleep $sleep name="pgrep -j <jid>" +sleep_amount=5 jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_1_1.pid $sleep 5 & + command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_1_2.pid $sleep 5 & + command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & jid1=$(jail_name_to_jid ${base}_1_1) jid2=$(jail_name_to_jid ${base}_1_2) jid="${jid1},${jid2}" -pid1="$(pgrep -f -x -j $jid "$sleep 5" | sort)" +pid1="$(pgrep -f -x -j $jid "$sleep $sleep_amount" | sort)" pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \ $(cat ${PWD}/${base}_1_2.pid) | sort) if [ "$pid1" = "$pid2" ]; then @@ -51,14 +52,15 @@ fi [ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid) name="pgrep -j any" +sleep_amount=6 jail -c path=/ name=${base}_2_1 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_2_1.pid $sleep 5 & + command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount & jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_2_2.pid $sleep 5 & + command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount & sleep 2 -pid1="$(pgrep -f -x -j any "$sleep 5" | sort)" +pid1="$(pgrep -f -x -j any "$sleep $sleep_amount" | sort)" pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \ $(cat ${PWD}/${base}_2_2.pid) | sort) if [ "$pid1" = "$pid2" ]; then @@ -70,11 +72,12 @@ fi [ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid) name="pgrep -j none" -daemon -p ${PWD}/${base}_3_1.pid $sleep 5 & +sleep_amount=7 +daemon -p ${PWD}/${base}_3_1.pid $sleep $sleep_amount & jail -c path=/ name=${base}_3_2 ip4.addr=127.0.0.1 \ - command=daemon -p ${PWD}/${base}_3_2.pid $sleep 5 & + command=daemon -p ${PWD}/${base}_3_2.pid $sleep $sleep_amount & sleep 2 -pid="$(pgrep -f -x -j none "$sleep 5")" +pid="$(pgrep -f -x -j none "$sleep $sleep_amount")" if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then echo "ok 3 - $name" else |