Date: Thu, 12 Feb 2015 21:10:33 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278636 - head/bin/pkill/tests Message-ID: <201502122110.t1CLAX0g004554@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Thu Feb 12 21:10:32 2015 New Revision: 278636 URL: https://svnweb.freebsd.org/changeset/base/278636 Log: 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 Modified: head/bin/pkill/tests/pgrep-j_test.sh Modified: head/bin/pkill/tests/pgrep-j_test.sh ============================================================================== --- head/bin/pkill/tests/pgrep-j_test.sh Thu Feb 12 21:10:24 2015 (r278635) +++ head/bin/pkill/tests/pgrep-j_test.sh Thu Feb 12 21:10:32 2015 (r278636) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502122110.t1CLAX0g004554>