7 test "$(id -u)" -eq 0 || {
8 echo "Skipping vwait-test; it requires root rights" >&2
13 ! $builddir/src/vserver-info $XID RUNNING || {
14 echo "Skipping vwait-test because context '$XID' is already used" >&2
18 tmpdir=$(mktemp -d /tmp/vwaittest.XXXXXX)
19 trap "rm -rf $tmpdir" EXIT
21 : ${VWAIT:=$builddir/src/vwait}
22 : ${CHCONTEXT:=$builddir/src/chcontext-compat}
27 $CHCONTEXT --disconnect --silent --xid $XID /bin/bash -c "sleep 2"
28 status=$($VWAIT --status-fd 1 -- $XID)
33 (*) echo "vwait exited with bad status '$status'/$rc" >&2
41 $CHCONTEXT --disconnect --silent --xid $XID /bin/bash -c "sleep 5"
42 status=$($VWAIT --status-fd 1 --timeout 1 -- $XID)
47 (*) echo "vwait exited with bad status '$status'/$rc" >&2
54 $CHCONTEXT --disconnect --silent --xid $XID /bin/bash -c "sleep 5"
55 status=$($VWAIT --terminate --status-fd 1 --timeout 1 -- $XID)
60 (*) echo "vwait exited with bad status '$status'/$rc" >&2