mirror of
https://github.com/troglobit/finit.git
synced 2026-10-11 17:02:42 +07:00
test: Clean up Automake integration of tests
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
This commit is contained in:
+3
-2
@@ -52,6 +52,8 @@ script:
|
||||
- cat config.log
|
||||
- make clean
|
||||
- make V=1 -j5
|
||||
- LD_LIBRARY_PATH=/tmp/lib make check
|
||||
- cat ./test/test-suite.log
|
||||
- make install-strip
|
||||
- tree /tmp
|
||||
- ldd /tmp/sbin/finit
|
||||
@@ -63,5 +65,4 @@ script:
|
||||
- nsenter -V
|
||||
- chroot --version
|
||||
- LD_LIBRARY_PATH=/tmp/lib make check
|
||||
- cat ./test-suite.log
|
||||
- make -C test/ clean
|
||||
- cat ./test/test-suite.log
|
||||
|
||||
+1
-4
@@ -1,5 +1,5 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = plugins src
|
||||
SUBDIRS = plugins src test
|
||||
doc_DATA = README.md LICENSE contrib/finit.conf
|
||||
EXTRA_DIST = README.md LICENSE ChangeLog.md contrib/finit.conf
|
||||
|
||||
@@ -10,9 +10,6 @@ if DOC
|
||||
SUBDIRS += doc
|
||||
endif
|
||||
|
||||
AM_TESTS_ENVIRONMENT = make -C $(srcdir)/test test_root;
|
||||
TESTS = test/test_start_stop_service/test.sh
|
||||
|
||||
# Compat hook
|
||||
install-dev:
|
||||
@make -C src install-pkgincludeHEADERS
|
||||
|
||||
+2
-1
@@ -11,7 +11,8 @@ AC_CONFIG_FILES([Makefile
|
||||
contrib/void/Makefile contrib/void/finit.d/Makefile contrib/void/finit.d/available/Makefile
|
||||
doc/Makefile
|
||||
plugins/Makefile
|
||||
src/Makefile])
|
||||
src/Makefile
|
||||
test/Makefile])
|
||||
|
||||
# Older versions of autoconf (<2.58) do not have AC_CONFIG_MACRO_DIR()
|
||||
#m4_include([m4/plugin.m4])
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
busybox-x86_64
|
||||
# GNU configure and build system
|
||||
*.log
|
||||
*.trs
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
.PHONY: clean check test-check
|
||||
|
||||
ARCH ?= x86_64
|
||||
|
||||
FINITBIN ?= ../src/finit
|
||||
INITCTLBIN ?= ../src/initctl
|
||||
|
||||
BBVER ?= 1.31.0
|
||||
BBBIN = busybox-$(ARCH)
|
||||
BBURL ?= https://www.busybox.net/downloads/binaries/$(BBVER)-defconfig-multiarch-musl/$(BBBIN)
|
||||
|
||||
testroot = test_root
|
||||
testroot_bin = $(testroot)/bin
|
||||
binaries = $(testroot_bin)/cat \
|
||||
$(testroot_bin)/cp \
|
||||
$(testroot_bin)/date \
|
||||
$(testroot_bin)/echo \
|
||||
$(testroot_bin)/env \
|
||||
$(testroot_bin)/find \
|
||||
$(testroot_bin)/kill \
|
||||
$(testroot_bin)/ls \
|
||||
$(testroot_bin)/mkdir \
|
||||
$(testroot_bin)/mkfifo \
|
||||
$(testroot_bin)/mknod \
|
||||
$(testroot_bin)/mount \
|
||||
$(testroot_bin)/printf \
|
||||
$(testroot_bin)/pgrep \
|
||||
$(testroot_bin)/ps \
|
||||
$(testroot_bin)/rm \
|
||||
$(testroot_bin)/sh \
|
||||
$(testroot_bin)/sleep \
|
||||
$(testroot_bin)/top \
|
||||
$(testroot_bin)/touch
|
||||
dirs = $(testroot)/bin \
|
||||
$(testroot)/dev \
|
||||
$(testroot)/etc \
|
||||
$(testroot)/proc \
|
||||
$(testroot)/sbin \
|
||||
$(testroot)/sys \
|
||||
$(testroot)/tmp
|
||||
|
||||
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
|
||||
libs = $(foreach path,$(_libs_src),$(testroot)$(path))
|
||||
|
||||
all: check
|
||||
|
||||
$(dirs):
|
||||
mkdir -p $@
|
||||
|
||||
$(BBBIN):
|
||||
wget -O $@ $(BBURL)
|
||||
md5sum -c $@.md5
|
||||
|
||||
$(testroot): $(binaries) $(testroot_bin)/chrootsetup.sh $(dirs) $(testroot)/sbin/finit $(testroot)/bin/initctl test-check
|
||||
|
||||
$(testroot_bin)/$(BBBIN): $(BBBIN)
|
||||
mkdir -p $(testroot_bin)
|
||||
cp $(BBBIN) $(testroot_bin)/
|
||||
chmod +x $(testroot_bin)/$(BBBIN)
|
||||
|
||||
$(binaries): $(testroot_bin)/$(BBBIN)
|
||||
cd $(testroot_bin); \
|
||||
ln -s $(BBBIN) $(notdir $@)
|
||||
|
||||
$(testroot_bin)/chrootsetup.sh: chrootsetup.sh
|
||||
cp $< $@
|
||||
|
||||
$(testroot)/sbin/finit: $(FINITBIN) $(libs)
|
||||
cp $< $@
|
||||
|
||||
$(testroot)/bin/initctl: $(INITCTLBIN) $(libs)
|
||||
cp $< $@
|
||||
|
||||
$(libs):
|
||||
mkdir -p $(dir $@)
|
||||
cp $(shell echo $@ | sed s/^$(testroot)//) $@
|
||||
|
||||
check: $(testroot)
|
||||
./test_start_stop_service/test.sh
|
||||
|
||||
test-check:
|
||||
shellcheck $(shell find . -name '*.sh')
|
||||
|
||||
clean:
|
||||
rm -rf $(testroot)/*
|
||||
rm -f $(BBBIN)
|
||||
rm -f ./test_start_stop_service/*.log
|
||||
rm -f ./test_start_stop_service/*.trs
|
||||
@@ -0,0 +1,6 @@
|
||||
AM_TESTS_ENVIRONMENT = make -C test_root/;
|
||||
TESTS = checkself.sh
|
||||
TESTS += test_start_stop_service/test.sh
|
||||
|
||||
clean-local:
|
||||
make -C test_root/ clean
|
||||
@@ -1 +0,0 @@
|
||||
ea7e2353af0067a926d3e021e504290e busybox-x86_64
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
shellcheck $(find ./ -name '*.sh')
|
||||
@@ -1,4 +1,25 @@
|
||||
/bin
|
||||
/bin/busybox-x86_64
|
||||
/bin/cat
|
||||
/bin/cp
|
||||
/bin/date
|
||||
/bin/echo
|
||||
/bin/env
|
||||
/bin/find
|
||||
/bin/initctl
|
||||
/bin/kill
|
||||
/bin/ls
|
||||
/bin/mkdir
|
||||
/bin/mkfifo
|
||||
/bin/mknod
|
||||
/bin/mount
|
||||
/bin/pgrep
|
||||
/bin/printf
|
||||
/bin/ps
|
||||
/bin/rm
|
||||
/bin/sh
|
||||
/bin/sleep
|
||||
/bin/top
|
||||
/bin/touch
|
||||
/dev
|
||||
/etc
|
||||
/lib64
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
.PHONY: clean check
|
||||
|
||||
ARCH ?= x86_64
|
||||
|
||||
FINITBIN ?= ../../src/finit
|
||||
INITCTLBIN ?= ../../src/initctl
|
||||
|
||||
BBVER ?= 1.31.0
|
||||
BBBIN = busybox-$(ARCH)
|
||||
BBURL ?= https://www.busybox.net/downloads/binaries/$(BBVER)-defconfig-multiarch-musl/$(BBBIN)
|
||||
|
||||
binaries = ./bin/cat \
|
||||
./bin/cp \
|
||||
./bin/date \
|
||||
./bin/echo \
|
||||
./bin/env \
|
||||
./bin/find \
|
||||
./bin/kill \
|
||||
./bin/ls \
|
||||
./bin/mkdir \
|
||||
./bin/mkfifo \
|
||||
./bin/mknod \
|
||||
./bin/mount \
|
||||
./bin/printf \
|
||||
./bin/pgrep \
|
||||
./bin/ps \
|
||||
./bin/rm \
|
||||
./bin/sh \
|
||||
./bin/sleep \
|
||||
./bin/top \
|
||||
./bin/touch
|
||||
dirs = ./dev \
|
||||
./etc \
|
||||
./proc \
|
||||
./sbin \
|
||||
./sys \
|
||||
./tmp
|
||||
|
||||
_libs_src = $(shell ldd $(FINITBIN) | grep -Eo '/[^ ]+')
|
||||
libs = $(foreach path,$(_libs_src),.$(path))
|
||||
|
||||
all: $(binaries) $(dirs) ./sbin/finit ./bin/initctl
|
||||
|
||||
$(dirs):
|
||||
mkdir -p $@
|
||||
|
||||
./bin/$(BBBIN):
|
||||
wget -O $@ $(BBURL)
|
||||
chmod +x ./bin/$(BBBIN)
|
||||
md5sum -c $(BBBIN).md5
|
||||
|
||||
$(binaries): ./bin/$(BBBIN)
|
||||
cd ./bin; \
|
||||
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
|
||||
rm -rf ./lib64
|
||||
rm -rf ./proc
|
||||
rm -rf ./sbin
|
||||
rm -rf ./sys
|
||||
rm -rf ./tmp
|
||||
rm -rf ./usr
|
||||
rm -rf ./var
|
||||
@@ -0,0 +1 @@
|
||||
ea7e2353af0067a926d3e021e504290e bin/busybox-x86_64
|
||||
Reference in New Issue
Block a user