From adc9c40fe13344139c136e1d4f98c7257bd2ada8 Mon Sep 17 00:00:00 2001 From: Magnus Malm Date: Mon, 22 Feb 2021 16:44:20 +0100 Subject: [PATCH 1/2] test: Include initctl in test run env Signed-off-by: Magnus Malm --- test/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/Makefile b/test/Makefile index f1a03975..09d6bcd9 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,6 +3,7 @@ ARCH ?= x86_64 FINITBIN ?= ../src/finit +INITCTLBIN ?= ../src/initctl BBVER ?= 1.31.0 BBBIN = busybox-$(ARCH) @@ -68,11 +69,14 @@ $(testroot_bin)/chrootsetup.sh: chrootsetup.sh $(testroot)/sbin/finit: $(FINITBIN) $(libs) cp $< $@ +$(testroot)/bin/initctl: $(INITCTLBIN) $(libs) + cp $< $@ + $(libs): mkdir -p $(dir $@) cp $(shell echo $@ | sed s/^$(testroot)//) $@ -check: $(binaries) $(testroot_bin)/chrootsetup.sh $(dirs) $(testroot)/sbin/finit +check: $(binaries) $(testroot_bin)/chrootsetup.sh $(dirs) $(testroot)/sbin/finit $(testroot)/bin/initctl ./runtest.sh test_start_stop_service/test.sh test-check: From cd2fcac4cf6d243be7b2787bf66f8ef801e1bbe7 Mon Sep 17 00:00:00 2001 From: Magnus Malm Date: Mon, 22 Feb 2021 16:46:25 +0100 Subject: [PATCH 2/2] test: Handle finit's default conf dirs/files better in test env Signed-off-by: Magnus Malm --- test/chrootsetup.sh | 2 ++ test/runtest.sh | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/chrootsetup.sh b/test/chrootsetup.sh index 97d42161..fe4e0e4c 100755 --- a/test/chrootsetup.sh +++ b/test/chrootsetup.sh @@ -22,6 +22,8 @@ mount -t tmpfs none /etc # mkdir -p /dev/pts # mount -t devpts none /dev/pts +mkdir -p "$FINIT_CONF_DIR" + tty=/dev/$(cat /sys/class/tty/console/active) mkfifo "$tty" diff --git a/test/runtest.sh b/test/runtest.sh index 6b57f3e4..203d27e7 100755 --- a/test/runtest.sh +++ b/test/runtest.sh @@ -85,7 +85,8 @@ shift trap teardown EXIT -FINIT_CONF=$(grep FINIT_CONF "$(dirname "$0")/../config.h" | cut -d' ' -f3 | cut -d'"' -f2) +export FINIT_CONF=$(grep FINIT_CONF "$(dirname "$0")/../config.h" | cut -d' ' -f3 | cut -d'"' -f2) +export FINIT_CONF_DIR="$(dirname "$FINIT_CONF")"/finit.d log "$color_reset" 'Test start' '' log "$color_reset" '--' '' @@ -97,7 +98,8 @@ log "$color_reset" '--' '' >&2 echo Filesystem: >&2 ./testenv_start.sh find / -path /sys -prune -o -print -path /proc -prune -o -print >&2 echo -- ->&2 echo "FINIT_CONF='$FINIT_CONF" +>&2 echo "FINIT_CONF='$FINIT_CONF'" +>&2 echo "FINIT_CONF_DIR='$FINIT_CONF_DIR/'" # Setup ./testenv_start.sh finit &