tools: add option to test runner to build test before running it

./tools/run-nm-test.sh -m src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
This commit is contained in:
Thomas Haller 2016-11-01 16:49:57 +01:00
parent dbafd2ce50
commit d35a6fe524

View file

@ -21,6 +21,8 @@ if [[ -z "${NMTST_USE_VALGRIND+x}" ]]; then
fi
[[ "${NMTST_USE_VALGRIND}" != 1 ]] && NMTST_USE_VALGRIND=0
DO_MAKE=0
if [ "$1" == "--called-from-make" ]; then
shift
NMTST_LIBTOOL=($1 --mode=execute); shift
@ -64,6 +66,10 @@ else
NMTST_LIBTOOL=()
shift
;;
--make|-m)
DO_MAKE=1
shift
;;
"--valgrind"|-v)
NMTST_USE_VALGRIND=1
shift;
@ -102,8 +108,11 @@ if [ -n "${NMTST_LAUNCH_DBUS:-x}" ]; then
fi
fi
# some tests require you to cd into the base directory.
# do that.
if [[ "$DO_MAKE" == 1 ]]; then
make -j5 "$TEST" || die "make of $TEST failed"
fi
# if the user wishes, chnage first into the directory of the test
if [ "$NMTST_CHANGE_DIRECTORY" != "" ]; then
cd "$TEST_PATH"
TEST="./$(basename "$TEST")"