2015-08-12 00:31:08 +03:00
|
|
|
#!/bin/bash -eux
|
2015-08-07 00:24:27 +03:00
|
|
|
# dumb-init should say something useful when called with no arguments, and exit
|
|
|
|
# nonzero.
|
|
|
|
|
2015-08-08 01:53:35 +03:00
|
|
|
dumb_init="$1"
|
|
|
|
|
|
|
|
status=$($dumb_init > /dev/null 2>&1; echo $?)
|
2015-08-07 00:24:27 +03:00
|
|
|
|
2015-08-29 04:21:51 +03:00
|
|
|
if [ "$status" -eq 0 ]; then
|
2015-08-10 19:32:56 +03:00
|
|
|
echo "Error: Expected dumb-init with no arguments to return nonzero, but it returned ${status}."
|
|
|
|
exit 1
|
2015-08-07 00:24:27 +03:00
|
|
|
fi
|
2015-08-29 04:21:51 +03:00
|
|
|
|
|
|
|
msg=$($dumb_init 2>&1 || true)
|
|
|
|
msg_len=${#msg}
|
|
|
|
|
|
|
|
if [ "$msg_len" -le 50 ]; then
|
|
|
|
echo "Error: Expected dumb-init with no arguments to print a useful message, but it was only ${msg_len} chars long."
|
|
|
|
exit 1
|
|
|
|
fi
|