LOG_DETAILS=
}
-# supress stderr messages from subcommands
-exec 2> /dev/null
-
-USAGE_MESSAGE="usage: $0 pipe|logger|pipe_quick|logger_quick"
+USAGE_MESSAGE="usage: $0 [--verbose] [--quick] pipe|logger"
-if [ "$#" -ne 1 ]; then
+OPTS=$(getopt --shell sh --options "" --long verbose,quick --quiet -- "$@")
+if [ "$?" -eq 1 ]; then
echo "$USAGE_MESSAGE"
exit 1
fi
+eval set -- "$OPTS"
+verbose=0
+quick=0
+while true; do
+ case "$1" in
+ --verbose)
+ verbose=1
+ ;;
+ --quick)
+ quick=1
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ echo "This should never happen :)"
+ exit 1
+ ;;
+ esac
+ shift
+done
if [ "$1" = "pipe" ]; then
type="pipe"
- quick=0
elif [ "$1" = "logger" ]; then
type="logger"
- quick=0
+# We still accept the legacy {pipe,logger}_quick syntax because there's no reason not to.
elif [ "$1" = "pipe_quick" ]; then
type="pipe"
quick=1
exit 1
fi
+# supress stderr messages from subcommands
+if [ "$verbose" -eq 0 ]; then
+ exec 2> /dev/null
+fi
+
NEEDS_TO_QUIT=0
capsh --print | grep Current | grep cap_syslog > /dev/null || { echo "*** ERROR: cap_syslog missing"; NEEDS_TO_QUIT=1; }
mount | grep ' / ' | grep rw > /dev/null || { echo "*** ERROR: root not mounted read-write"; NEEDS_TO_QUIT=1; }
if [ "$quick" -eq 1 ]; then
echo "WARNING: quick mode!"
echo "About 20% slowest running tests are disabled. Some functionality might be untested."
- echo "Rerun with '$type' instead of '${type}_quick' to run all tests."
+ echo "Rerun without '--quick' to run all tests."
fi
[ "$FAILS" -eq 0 ]