mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 22:13:01 +07:00
test: Fix distcheck
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
This commit is contained in:
+16
-5
@@ -1,6 +1,17 @@
|
||||
AM_TESTS_ENVIRONMENT = make -C test_root/;
|
||||
TESTS = checkself.sh
|
||||
TESTS += test_start_stop_service/test.sh
|
||||
EXTRA_DIST = lib.sh testenv_exec.sh testenv_start.sh
|
||||
EXTRA_DIST += test_root/Makefile test_root/busybox-x86_64.md5
|
||||
EXTRA_DIST += test_root/bin/chrootsetup.sh
|
||||
EXTRA_DIST += checkself.sh
|
||||
EXTRA_DIST += setup_root.sh
|
||||
EXTRA_DIST += teardown_root.sh
|
||||
EXTRA_DIST += test_start_stop_service/test.sh
|
||||
EXTRA_DIST += test_start_stop_service/service.sh
|
||||
|
||||
clean-local:
|
||||
make -C test_root/ clean
|
||||
AM_TESTS_ENVIRONMENT = TESTS_ROOT='$(builddir)/test_root/';
|
||||
AM_TESTS_ENVIRONMENT += export TESTS_ROOT;
|
||||
AM_TESTS_ENVIRONMENT += export LD_LIBRARY_PATH;
|
||||
|
||||
TESTS = checkself.sh
|
||||
TESTS += setup_root.sh
|
||||
TESTS += test_start_stop_service/test.sh
|
||||
TESTS += teardown_root.sh
|
||||
|
||||
+4
-2
@@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
set -eu
|
||||
|
||||
testdir="${srcdir:-$(dirname "$0")}"
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
shellcheck $(find ./ -name '*.sh')
|
||||
shellcheck $(find "$testdir" -name '*.sh')
|
||||
|
||||
+5
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
texec() {
|
||||
# shellcheck disable=SC2154
|
||||
"$TEST_DIR/testenv_exec.sh" "$finit_pid" "$@"
|
||||
TESTS_ROOT=. "$TEST_DIR/testenv_exec.sh" "$finit_pid" "$@"
|
||||
}
|
||||
|
||||
pause() {
|
||||
@@ -75,14 +75,16 @@ teardown() {
|
||||
else
|
||||
log "$fg_red" 'TEST FAIL' ''
|
||||
fi
|
||||
texec kill -SIGUSR2 1
|
||||
if [ -n "${finit_pid+x}" ]; then
|
||||
texec kill -SIGUSR2 1
|
||||
fi
|
||||
|
||||
wait
|
||||
}
|
||||
|
||||
trap teardown EXIT
|
||||
|
||||
FINIT_CONF=$(grep FINIT_CONF "$TEST_DIR/../config.h" | cut -d' ' -f3 | cut -d'"' -f2)
|
||||
FINIT_CONF=$(grep FINIT_CONF "$TESTS_ROOT/../config.h" | cut -d' ' -f3 | cut -d'"' -f2)
|
||||
export FINIT_CONF
|
||||
FINIT_CONF_DIR="$(dirname "$FINIT_CONF")"/finit.d
|
||||
export FINIT_CONF_DIR
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
"$srcdir"/../configure --prefix=/
|
||||
make
|
||||
make DESTDIR="$(pwd)/test_root/" install
|
||||
|
||||
mkdir -p test_root/bin
|
||||
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/
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
if [ -d test_root/var/lock ]; then
|
||||
chmod +r test_root/var/lock
|
||||
fi
|
||||
make -C test_root/ clean
|
||||
+3
-10
@@ -2,8 +2,8 @@
|
||||
|
||||
ARCH ?= x86_64
|
||||
|
||||
FINITBIN ?= ../../src/finit
|
||||
INITCTLBIN ?= ../../src/initctl
|
||||
FINITBIN ?= ./sbin/finit
|
||||
INITCTLBIN ?= ./sbin/initctl
|
||||
|
||||
BBVER ?= 1.31.0
|
||||
BBBIN = busybox-$(ARCH)
|
||||
@@ -40,7 +40,7 @@ dirs = ./dev \
|
||||
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
|
||||
libs = $(foreach path,$(_libs_src),.$(path))
|
||||
|
||||
all: $(binaries) $(dirs) ./sbin/finit ./bin/initctl
|
||||
all: $(binaries) $(dirs) $(libs)
|
||||
|
||||
$(dirs):
|
||||
mkdir -p $@
|
||||
@@ -55,19 +55,12 @@ $(binaries): ./bin/$(BBBIN)
|
||||
rm -f $(notdir $@); \
|
||||
ln -s $(BBBIN) $(notdir $@)
|
||||
|
||||
./sbin/finit: $(FINITBIN) $(libs)
|
||||
cp $< $@
|
||||
|
||||
./bin/initctl: $(INITCTLBIN) $(libs)
|
||||
cp $< $@
|
||||
|
||||
$(libs):
|
||||
mkdir -p $(dir $@)
|
||||
cp /$@ $@
|
||||
|
||||
clean:
|
||||
rm -f ./bin/$(BBBIN)
|
||||
rm -f ./bin/initctl
|
||||
rm -rf $(binaries)
|
||||
rm -rf ./dev
|
||||
rm -rf ./etc
|
||||
|
||||
@@ -12,7 +12,7 @@ assert_num_children() {
|
||||
|
||||
# Test
|
||||
say 'Set up a service'
|
||||
cp "$TEST_DIR"/test_start_stop_service/service.sh "$TEST_DIR"/test_root/test_assets/
|
||||
cp "$TEST_DIR"/test_start_stop_service/service.sh "$TESTS_ROOT"/test_assets/
|
||||
texec sh -c "echo 'service [2345] kill:20 log /test_assets/service.sh' > $FINIT_CONF"
|
||||
|
||||
say 'Reload Finit'
|
||||
@@ -29,4 +29,4 @@ texec kill -SIGHUP 1
|
||||
retry 'assert_num_children 0 service.sh'
|
||||
|
||||
# Teardown
|
||||
rm -f test_root/bin/service.sh
|
||||
rm -f "$TESTS_ROOT"/bin/service.sh
|
||||
|
||||
@@ -11,7 +11,7 @@ target="$1"
|
||||
shift
|
||||
|
||||
TEST_DIR=$(dirname "$0")
|
||||
TESTS_ROOT="$(pwd)/${TEST_DIR}/test_root"
|
||||
TESTS_ROOT="${TESTS_ROOT:-$(pwd)/${TEST_DIR}/test_root}"
|
||||
|
||||
nsenter=$(command -v nsenter)
|
||||
chroot=$(command -v chroot)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
set -eu
|
||||
|
||||
TEST_DIR=$(dirname "$0")
|
||||
TESTS_ROOT="$(pwd)/${TEST_DIR}/test_root"
|
||||
TESTS_ROOT="${TESTS_ROOT:-$(pwd)/${TEST_DIR}/test_root}"
|
||||
|
||||
>&2 echo "Hint: Execute '${TEST_DIR}/testenv_exec.sh \$(pgrep -P $$) /bin/sh; reset' to enter the test namespace"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user