-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
47 lines (34 loc) · 1.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# To run a single test: `make test/1.test`
# To run all tests: `make test`
MAKEFLAGS += -k # keep running on failure
MAKEFLAGS += -j1 # explicitly run on a single thread,
# more would cause problems on coverage report merging
SHELL := /bin/sh
COV_COM:='kcov --include-pattern=pont.sh --exclude-pattern=coverage coverage'
all_tests := $(basename $(wildcard test/*.test.sh))
all_lint_formats := $(addsuffix .lint, sh dash bash ksh)
.PHONY: test all %.test lint %.lint clean
list_tests:
@echo $(all_tests)
%.test: %.test.sh
@IFS=' ' COVERAGE=$(COV_COM) $(SHELL) [email protected] && \
{ echo "Test [email protected] successful!"; test/cleanup.sh; exit 0; } || \
{ echo "Test [email protected] failed!"; test/cleanup.sh; exit 1; }
test_all: $(all_tests)
test: test_all
@echo "Success, all tests passed."
list_all_lint_formats:
@echo $(all_lint_formats)
%.lint:
@git ls-tree -r master --name-only | \
grep -e '\.sh$$' -e '\.bash$$' -e '\.ksh$$' -e '\.bashrc$$' -e \
'\.bash_profile$$' -e '\.bash_login$$' -e '\.bash_logout$$' | \
xargs shellcheck && \
echo "Lint $(basename $@) successful" || \
echo "Lint $@ failed"
lint_all: $(all_lint_formats)
lint: lint_all
@echo "Success, all lints passed."
clean:
@echo "Clean"
rm -f .tarhash