diff --git a/test/Makefile.am b/test/Makefile.am index d8cf90c7..23c6de37 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -14,6 +14,10 @@ AM_TESTS_ENVIRONMENT += export TESTS_ROOT; AM_TESTS_ENVIRONMENT += export LD_LIBRARY_PATH; AM_TESTS_ENVIRONMENT += PREFIX=$(prefix); AM_TESTS_ENVIRONMENT += export PREFIX; +AM_TESTS_ENVIRONMENT += top_srcdir=$(top_srcdir); +AM_TESTS_ENVIRONMENT += export top_srcdir; +AM_TESTS_ENVIRONMENT += top_builddir=$(top_builddir); +AM_TESTS_ENVIRONMENT += export top_builddir; TESTS = checkself.sh TESTS += setup-root.sh diff --git a/test/setup-root.sh b/test/setup-root.sh index bc88fe0d..e7c99427 100755 --- a/test/setup-root.sh +++ b/test/setup-root.sh @@ -2,25 +2,19 @@ set -eu -# shellcheck disable=SC2154 -if [ ! -f "$srcdir"/../config.status ]; then - "$srcdir"/../configure --prefix=/ - make - make DESTDIR="$(pwd)/test-root/" install - +if [ ! -d test-root ]; then mkdir -p test-root/bin + # shellcheck disable=SC2154 cp "${srcdir}/test-root/bin/chrootsetup.sh" test-root/bin cp "${srcdir}/test-root/busybox-x86_64.md5" test-root/ cp "${srcdir}/test-root/Makefile" test-root/ - make -C test-root/ - config_h='./config.h' - echo "export TESTENV_PATH=/bin:/sbin" > test.env -else - make -C ../ DESTDIR="$(pwd)/test-root/" install - FINITBIN=../../src/finit make -C test-root/ - config_h='../config.h' - echo "export TESTENV_PATH=/bin:/sbin:$PREFIX/sbin:$PREFIX/bin" > test.env fi -echo "export FINIT_CONF=$(grep FINIT_CONF $config_h | cut -d' ' -f3 | cut -d'"' -f2)" >> test.env -echo "export FINIT_RCSD=$(grep FINIT_RCSD $config_h | cut -d' ' -f3 | cut -d'"' -f2)" >> test.env +# shellcheck disable=SC2154 +make -C "$top_builddir" DESTDIR="$(pwd)/test-root/" install +FINITBIN="$(pwd)/$top_builddir/src/finit" make -C test-root/ # DESTDIR="$(pwd)/test-root/" +config_h="$top_builddir/config.h" +echo "export TESTENV_PATH=/bin:/sbin:$PREFIX/sbin:$PREFIX/bin" > test.env + +echo "export FINIT_CONF=$(grep FINIT_CONF "$config_h" | cut -d' ' -f3 | cut -d'"' -f2)" >> test.env +echo "export FINIT_RCSD=$(grep FINIT_RCSD "$config_h" | cut -d' ' -f3 | cut -d'"' -f2)" >> test.env