test: Unify setup-root.sh for make check and make distcheck

Signed-off-by: Jacques de Laval <jacques@de-laval.se>
This commit is contained in:
Jacques de Laval
2021-02-25 11:18:12 +01:00
parent 3c32cbfd9e
commit cde580ffce
2 changed files with 14 additions and 16 deletions
+4
View File
@@ -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
+10 -16
View File
@@ -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