mirror of
https://github.com/troglobit/finit.git
synced 2026-10-17 10:49:34 +00:00
test: refuse to run against a stale sysroot binary
'make check' refreshes the sysroot through the setup-chroot rule, but running a test script by hand does not, so the test exercises whichever finit was installed last and reports on code that is no longer there. Both a passing and a failing run are then meaningless, and nothing says so. Compare the built binary against the installed one at startup and fail with the command that fixes it. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 file changed
+12
@@ -314,6 +314,18 @@ trap teardown EXIT
|
|||||||
SYSROOT="${SYSROOT:-$(pwd)/${TEST_DIR}/sysroot}"
|
SYSROOT="${SYSROOT:-$(pwd)/${TEST_DIR}/sysroot}"
|
||||||
export SYSROOT
|
export SYSROOT
|
||||||
|
|
||||||
|
# 'make check' refreshes the sysroot through the setup-chroot rule, but
|
||||||
|
# running a test script by hand does not, and then the test silently
|
||||||
|
# exercises whatever finit was installed last. Compare and refuse.
|
||||||
|
top_builddir="${top_builddir:-$TEST_DIR/..}"
|
||||||
|
sysroot_finit="$SYSROOT/sbin/finit"
|
||||||
|
built_finit="$top_builddir/src/finit"
|
||||||
|
[ -x "$top_builddir/src/.libs/finit" ] && built_finit="$top_builddir/src/.libs/finit"
|
||||||
|
|
||||||
|
if [ -x "$built_finit" ] && [ -e "$sysroot_finit" ] && ! cmp -s "$built_finit" "$sysroot_finit"; then
|
||||||
|
fail "Stale $sysroot_finit, run 'make -C test setup-chroot' or use 'make check'"
|
||||||
|
fi
|
||||||
|
|
||||||
TEST_TIMEOUT=300
|
TEST_TIMEOUT=300
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
|
|||||||
Reference in new issue
Block a user