summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/ts/misc/flock7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/ts/misc/flock b/tests/ts/misc/flock
index cf3ca5357..6a43fea40 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"