mirror of
https://github.com/troglobit/finit.git
synced 2026-10-22 11:36:07 +00:00
test: Clean up Automake integration of tests
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
This commit is contained in:
1 parent
e44d348f09
commit
11841ceb5d
12 files changed
+123
-98
No files matched your search
+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
|
||||
File renamed without changes.
@@ -0,0 +1 @@
|
||||
ea7e2353af0067a926d3e021e504290e bin/busybox-x86_64
|
||||
Reference in new issue
Block a user