From 39edf5279228657340c9eb23af0479c5f6bc4bbb Mon Sep 17 00:00:00 2001 From: Jacques de Laval Date: Thu, 18 Feb 2021 14:39:55 +0100 Subject: [PATCH] test: Add shellcheck Signed-off-by: Jacques de Laval --- test/Makefile | 6 +++++- test/runtest.sh | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/test/Makefile b/test/Makefile index 8000ccbf..65a3646d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -66,7 +66,11 @@ $(testroot)/usr/local/lib/libuev.so.2: .PHONY: test test: $(binaries) $(testroot_bin)/chrootsetup.sh $(dirs) $(testroot)/sbin/finit - ./runtest.sh ./test_start_stop_service/test.sh + ./runtest.sh test_start_stop_service/test.sh + +.PHONY: lint +lint: + shellcheck $(shell find . -name '*.sh') .PHONY: clean clean: diff --git a/test/runtest.sh b/test/runtest.sh index 75ad2c16..5c95a696 100755 --- a/test/runtest.sh +++ b/test/runtest.sh @@ -3,14 +3,14 @@ set -eu texec() { - ./testenv_exec.sh $(pgrep -P $finit_ppid) "$@" + ./testenv_exec.sh "$(pgrep -P "$finit_ppid")" "$@" } fg_red='31' fg_green='32' fg_yellow='33' log() { - printf "< TEST > \e[1;%dm%s\e[0m %s\n" "$1" "$2" "$3" + printf "< $TEST_DIR > \e[1;%dm%s\e[0m %s\n" "$1" "$2" "$3" } assert() { @@ -40,13 +40,13 @@ trap teardown EXIT finit_ppid=$! for i in $(seq 1 50); do sleep 0.1 - finit_pid=$(pgrep -P "$finit_ppid") || continue + pgrep -P "$finit_ppid" > /dev/null || continue break done texec cat /dev/tty0 & sleep 1 -TEST_DIR=$(dirname $1) +TEST_DIR=$(dirname "$1") -source "$1" +. "$1"