From 658751a5e4158149ee63cf8a9dc882212eae0d0c Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sat, 8 Apr 2017 16:50:29 +0200 Subject: [PATCH] Adding Makefile for running tests via 'make test' This can be used for local development and even for running at travis-ci. --- Makefile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dc20422 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +# Makefile + +all: test + +test: + # Checking for syntax errors + set -e; for SCRIPT in *.sh; \ + do \ + sh -n $$SCRIPT; \ + done + + # Checking for bashisms (currently not failing, but only listing) + SCRIPT="$$(which checkbashisms)"; if [ -n "$$SCRIPT" ] && [ -x "$$SCRIPT" ]; \ + then \ + $$SCRIPT *.sh || true; \ + else \ + echo "WARNING: skipping bashism test - you need to install checkbashism."; \ + fi + + SCRIPT="$$(which shellcheck)"; if [ -n "$$SCRIPT" ] && [ -x "$$SCRIPT" ]; \ + then \ + $$SCRIPT *.sh || true; \ + else \ + echo "WARNING: skipping shellcheck test - you need to install shellcheck."; \ + fi