Use wait_for_function instead of just guessing that 20s will be long
enough for dbench to start. Wait for up to 6min in 5 second
intervals. This also ensures that dbench will run for a little while
after it starts.
Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: Ic9c61b487c4013cccd620491d617c10e2206fd62
Reviewed-on: http://review.whamcloud.com/7914
Tested-by: Hudson
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
# Test 2b - Replicate files changed by dbench.
test_2b() {
+ local child_pid
init_src
init_changelog
# Run dbench
sh rundbench -C -D $DIR/$tdir 2 -t $DBENCH_TIME &
- sleep 20
+ # wait for dbench to start
+ wait_for_function 'child_pid=$(pgrep dbench)' 360
+ # let dbench run for a bit
+ sleep 10
- local child_pid=$(pgrep dbench)
echo PIDs: $child_pid
echo Stopping dbench
$KILL -SIGSTOP $child_pid