From: Zdenek Kabelac Date: Fri, 28 Jan 2011 16:10:21 +0000 (+0000) Subject: Add command to wait for udevadm settle X-Git-Tag: v2_02_91~1146 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=6bd4a36dde9df1334d8860647911df81b913a60b;p=lvm2.git Add command to wait for udevadm settle --- diff --git a/test/lib/aux.sh b/test/lib/aux.sh index 04367eaf1..d4d2f261d 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -1,3 +1,4 @@ +#!/bin/bash # Copyright (C) 2011 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing to use, @@ -71,6 +72,7 @@ teardown_devs() { } + udev_wait # NOTE: SCSI_DEBUG_DEV test must come before the LOOP test because # prepare_scsi_debug_dev() also sets LOOP to short-circuit prepare_loop() if test -f SCSI_DEBUG_DEV; then @@ -367,6 +369,15 @@ api() { $abs_top_builddir/test/api/wrapper "$@" } +udev_wait() { + pgrep udev >/dev/null || return + if test -n "$1" ; then + udevadm settle --exit-if-exists=$1 + else + udevadm settle --timeout=5 + fi +} + test -f DEVICES && devs=$(cat DEVICES) test -f LOOP && LOOP=$(cat LOOP)