sh: Add some simplistic tests for the wait builtin.

This commit is contained in:
Jilles Tjoelker 2010-05-23 22:10:20 +00:00
parent dd85b12982
commit f7b46e74b3
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# $FreeBSD$
failures=
failure() {
echo "Error at line $1" >&2
failures=x$failures
}
exit 4 & p4=$!
exit 8 & p8=$!
wait $p4
[ $? = 4 ] || failure $LINENO
wait $p8
[ $? = 8 ] || failure $LINENO
exit 3 & p3=$!
exit 7 & p7=$!
wait $p7
[ $? = 7 ] || failure $LINENO
wait $p3
[ $? = 3 ] || failure $LINENO
test -z "$failures"

View File

@ -0,0 +1,15 @@
# $FreeBSD$
failures=
failure() {
echo "Error at line $1" >&2
failures=x$failures
}
for i in 1 2 3 4 5 6 7 8 9 10; do
exit $i &
done
wait || failure $LINENO
wait || failure $LINENO
test -z "$failures"