dumb-init/tests/test-help-message
2015-08-06 14:31:49 -07:00

19 lines
508 B
Bash
Executable file

#!/bin/sh -u
# dumb-init should say something useful when called with no arguments, and exit
# nonzero.
status=$(dumb-init > /dev/null 2>&1; echo $?)
if [ "$status" -ne 0 ]; then
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
else
echo "Error: Expected dumb-init with no arguments to return nonzero, but it returned ${status}."
exit 1
fi