From: Ruediger Meier Date: Mon, 17 Apr 2017 21:45:30 +0000 (+0200) Subject: tests: use pgrep instead of ps --ppid ... X-Git-Tag: v2.32-rc2~27^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7eb1320bf73c10533237344287f96a4f8ad61573;p=thirdparty%2Futil-linux.git tests: use pgrep instead of ps --ppid ... The usage looks a bit cleaner, and I guess that pgrep(1) is available on the same machines where "ps --ppid" would work (procps-ng). Signed-off-by: Ruediger Meier --- diff --git a/tests/ts/misc/flock b/tests/ts/misc/flock index cf3ca53578..6a43fea40d 100755 --- a/tests/ts/misc/flock +++ b/tests/ts/misc/flock @@ -19,12 +19,9 @@ TS_DESC="flock" ts_init "$*" ts_check_test_command "$TS_CMD_FLOCK" -ts_check_prog "ps" +ts_check_prog "pgrep" ts_check_prog "timeout" -if ! ps --ppid $$ &>/dev/null; then - ts_skip "no ps --ppid" -fi function do_lock { local opts="$1" @@ -58,7 +55,7 @@ if [ "$pid" -le "0" ] || ! kill -s 0 "$pid" &>/dev/null; then ts_die "unable to run flock" fi # the lock should be established when flock has a child -timeout 1s bash -c "while [ \$(ps --ppid $pid |wc -l) -lt 2 ]; do sleep 0.1 ;done" \ +timeout 1s bash -c "while ! pgrep -P $pid >/dev/null; do sleep 0.1 ;done" \ || ts_die "timeout waiting for flock child" ts_init_subtest "non-block"