However, options must be followed by "--".
This also fixes:
* a bug where specifying tests caused local daemons to be used; and
* an incorrect comment.
Signed-off-by: Martin Schwenke <martin@meltin.net>
test_dir=$(dirname "$0")
+# Allow options to be passed to this script. However, if any options
+# are passed there must be a "--" between the options and the tests.
+# This makes it easy to handle options that take arguments.
+opts=""
+case "$1" in
+ -*)
+ while [ -n "$1" ] ; do
+ case "$1" in
+ --) shift ; break ;;
+ *) opts="$opts $1" ; shift ;;
+ esac
+ done
+esac
+
if [ -n "$1" ] ; then
- "${test_dir}/scripts/run_tests" -l -s "$@" || exit 1
+ "${test_dir}/scripts/run_tests" -s $opts "$@" || exit 1
else
cd "$test_dir"
- # By default, run all unit tests and the tests against local
- # daemons
+ # By default, don't bother with unit tests
dirs="simple complex"
- ./scripts/run_tests -s $dirs || exit 1
+ ./scripts/run_tests -s $opts $dirs || exit 1
fi
echo "All OK"