mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 21:00:07 +01:00
tests: fix "tools/run-nm-test.sh" to build test first
./tools/run-nm-test.sh -m src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh makes the test before running it. However, that failed if the test didn't exist already. Reorder the code so that we always try to make the test before trying to run it.
This commit is contained in:
parent
045de51888
commit
61f7dd7284
1 changed files with 8 additions and 8 deletions
|
|
@ -138,6 +138,14 @@ else
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if _is_true "$NMTST_MAKE_FIRST" 0; then
|
||||||
|
git_dir="$(readlink -f "$(git rev-parse --show-toplevel)")"
|
||||||
|
rel_path="$(realpath --relative-to="$git_dir" -m "$TEST" 2>/dev/null)" || die "cannot resolve test-name \"$TEST\". Did you call the script properly?"
|
||||||
|
cd "$git_dir"
|
||||||
|
make -j5 "$rel_path" || die "make of $TEST failed ($git_dir / $rel_path)"
|
||||||
|
cd - 1>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
[ -x "$TEST" ] || die "Test \"$TEST\" does not exist"
|
[ -x "$TEST" ] || die "Test \"$TEST\" does not exist"
|
||||||
TEST_PATH="$(readlink -f "$(dirname "$TEST")")"
|
TEST_PATH="$(readlink -f "$(dirname "$TEST")")"
|
||||||
TEST_NAME="${TEST##*/}"
|
TEST_NAME="${TEST##*/}"
|
||||||
|
|
@ -151,14 +159,6 @@ if [ -z "${NMTST_LAUNCH_DBUS}" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if _is_true "$NMTST_MAKE_FIRST" 0; then
|
|
||||||
git_dir="$(readlink -f "$(git rev-parse --show-toplevel)")"
|
|
||||||
rel_path="${TEST_PATH/#$(printf '%s/' "$git_dir")}/$TEST_NAME"
|
|
||||||
cd "$git_dir"
|
|
||||||
make -j5 "$rel_path" || die "make of $TEST failed ($git_dir / $rel_path)"
|
|
||||||
cd - 1>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if the user wishes, change first into the directory of the test
|
# if the user wishes, change first into the directory of the test
|
||||||
if _is_true "$NMTST_CHANGE_DIRECTORY" 0; then
|
if _is_true "$NMTST_CHANGE_DIRECTORY" 0; then
|
||||||
cd "$TEST_PATH"
|
cd "$TEST_PATH"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue