mirror of
https://github.com/troglobit/finit.git
synced 2026-12-05 22:08:20 +00:00
test: Fix distcheck
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
This commit is contained in:
1 parent
70773105ac
commit
05901a90aa
9 files changed
+55
-24
No files matched your search
+16
-5
@@ -1,6 +1,17 @@
|
|||||||
AM_TESTS_ENVIRONMENT = make -C test_root/;
|
EXTRA_DIST = lib.sh testenv_exec.sh testenv_start.sh
|
||||||
TESTS = checkself.sh
|
EXTRA_DIST += test_root/Makefile test_root/busybox-x86_64.md5
|
||||||
TESTS += test_start_stop_service/test.sh
|
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:
|
AM_TESTS_ENVIRONMENT = TESTS_ROOT='$(builddir)/test_root/';
|
||||||
make -C test_root/ clean
|
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
|
#!/bin/sh
|
||||||
|
|
||||||
set -eux
|
set -eu
|
||||||
|
|
||||||
|
testdir="${srcdir:-$(dirname "$0")}"
|
||||||
|
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
shellcheck $(find ./ -name '*.sh')
|
shellcheck $(find "$testdir" -name '*.sh')
|
||||||
+5
-3
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
texec() {
|
texec() {
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
"$TEST_DIR/testenv_exec.sh" "$finit_pid" "$@"
|
TESTS_ROOT=. "$TEST_DIR/testenv_exec.sh" "$finit_pid" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
pause() {
|
pause() {
|
||||||
@@ -75,14 +75,16 @@ teardown() {
|
|||||||
else
|
else
|
||||||
log "$fg_red" 'TEST FAIL' ''
|
log "$fg_red" 'TEST FAIL' ''
|
||||||
fi
|
fi
|
||||||
texec kill -SIGUSR2 1
|
if [ -n "${finit_pid+x}" ]; then
|
||||||
|
texec kill -SIGUSR2 1
|
||||||
|
fi
|
||||||
|
|
||||||
wait
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
trap teardown EXIT
|
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
|
export FINIT_CONF
|
||||||
FINIT_CONF_DIR="$(dirname "$FINIT_CONF")"/finit.d
|
FINIT_CONF_DIR="$(dirname "$FINIT_CONF")"/finit.d
|
||||||
export FINIT_CONF_DIR
|
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
|
ARCH ?= x86_64
|
||||||
|
|
||||||
FINITBIN ?= ../../src/finit
|
FINITBIN ?= ./sbin/finit
|
||||||
INITCTLBIN ?= ../../src/initctl
|
INITCTLBIN ?= ./sbin/initctl
|
||||||
|
|
||||||
BBVER ?= 1.31.0
|
BBVER ?= 1.31.0
|
||||||
BBBIN = busybox-$(ARCH)
|
BBBIN = busybox-$(ARCH)
|
||||||
@@ -40,7 +40,7 @@ dirs = ./dev \
|
|||||||
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
|
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
|
||||||
libs = $(foreach path,$(_libs_src),.$(path))
|
libs = $(foreach path,$(_libs_src),.$(path))
|
||||||
|
|
||||||
all: $(binaries) $(dirs) ./sbin/finit ./bin/initctl
|
all: $(binaries) $(dirs) $(libs)
|
||||||
|
|
||||||
$(dirs):
|
$(dirs):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
@@ -55,19 +55,12 @@ $(binaries): ./bin/$(BBBIN)
|
|||||||
rm -f $(notdir $@); \
|
rm -f $(notdir $@); \
|
||||||
ln -s $(BBBIN) $(notdir $@)
|
ln -s $(BBBIN) $(notdir $@)
|
||||||
|
|
||||||
./sbin/finit: $(FINITBIN) $(libs)
|
|
||||||
cp $< $@
|
|
||||||
|
|
||||||
./bin/initctl: $(INITCTLBIN) $(libs)
|
|
||||||
cp $< $@
|
|
||||||
|
|
||||||
$(libs):
|
$(libs):
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
cp /$@ $@
|
cp /$@ $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f ./bin/$(BBBIN)
|
rm -f ./bin/$(BBBIN)
|
||||||
rm -f ./bin/initctl
|
|
||||||
rm -rf $(binaries)
|
rm -rf $(binaries)
|
||||||
rm -rf ./dev
|
rm -rf ./dev
|
||||||
rm -rf ./etc
|
rm -rf ./etc
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ assert_num_children() {
|
|||||||
|
|
||||||
# Test
|
# Test
|
||||||
say 'Set up a service'
|
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"
|
texec sh -c "echo 'service [2345] kill:20 log /test_assets/service.sh' > $FINIT_CONF"
|
||||||
|
|
||||||
say 'Reload Finit'
|
say 'Reload Finit'
|
||||||
@@ -29,4 +29,4 @@ texec kill -SIGHUP 1
|
|||||||
retry 'assert_num_children 0 service.sh'
|
retry 'assert_num_children 0 service.sh'
|
||||||
|
|
||||||
# Teardown
|
# Teardown
|
||||||
rm -f test_root/bin/service.sh
|
rm -f "$TESTS_ROOT"/bin/service.sh
|
||||||
@@ -11,7 +11,7 @@ target="$1"
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
TEST_DIR=$(dirname "$0")
|
TEST_DIR=$(dirname "$0")
|
||||||
TESTS_ROOT="$(pwd)/${TEST_DIR}/test_root"
|
TESTS_ROOT="${TESTS_ROOT:-$(pwd)/${TEST_DIR}/test_root}"
|
||||||
|
|
||||||
nsenter=$(command -v nsenter)
|
nsenter=$(command -v nsenter)
|
||||||
chroot=$(command -v chroot)
|
chroot=$(command -v chroot)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
TEST_DIR=$(dirname "$0")
|
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"
|
>&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