@@ -18,23 +18,28 @@ TEST_LINT ?= test-lint
18
18
19
19
ifdef TEST_OUTPUT_DIRECTORY
20
20
TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY ) /test-results
21
+ CHAINLINTTMP = $(TEST_OUTPUT_DIRECTORY ) /chainlinttmp
21
22
else
22
23
TEST_RESULTS_DIRECTORY = test-results
24
+ CHAINLINTTMP = chainlinttmp
23
25
endif
24
26
25
27
# Shell quote;
26
28
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH ) )
27
29
TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH ) )
28
30
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH ) )
29
31
TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY ) )
32
+ CHAINLINTTMP_SQ = $(subst ','\'',$(CHAINLINTTMP ) )
30
33
31
34
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-* .sh) )
32
35
TGITWEB = $(sort $(wildcard t95[0-9][0-9]-* .sh) )
33
36
THELPERS = $(sort $(filter-out $(T ) ,$(wildcard * .sh) ) )
37
+ CHAINLINTTESTS = $(sort $(patsubst chainlint/% .test,% ,$(wildcard chainlint/* .test) ) )
38
+ CHAINLINT = sed -f chainlint.sed
34
39
35
40
all : $(DEFAULT_TEST_TARGET )
36
41
37
- test : pre-clean $(TEST_LINT )
42
+ test : pre-clean check-chainlint $(TEST_LINT )
38
43
$(MAKE ) aggregate-results-and-cleanup
39
44
40
45
failed :
@@ -43,7 +48,7 @@ failed:
43
48
sed -n ' s/\.counts$$/.sh/p' ) && \
44
49
test -z " $$ failed" || $(MAKE ) $$ failed
45
50
46
- prove : pre-clean $(TEST_LINT )
51
+ prove : pre-clean check-chainlint $(TEST_LINT )
47
52
@echo " *** prove ***" ; $(PROVE ) --exec ' $(TEST_SHELL_PATH_SQ)' $(GIT_PROVE_OPTS ) $(T ) :: $(GIT_TEST_OPTS )
48
53
$(MAKE ) clean-except-prove-cache
49
54
@@ -53,13 +58,25 @@ $(T):
53
58
pre-clean :
54
59
$(RM ) -r ' $(TEST_RESULTS_DIRECTORY_SQ)'
55
60
56
- clean-except-prove-cache :
61
+ clean-except-prove-cache : clean-chainlint
57
62
$(RM ) -r ' trash directory' .* ' $(TEST_RESULTS_DIRECTORY_SQ)'
58
63
$(RM ) -r valgrind/bin
59
64
60
65
clean : clean-except-prove-cache
61
66
$(RM ) .prove
62
67
68
+ clean-chainlint :
69
+ $(RM ) -r ' $(CHAINLINTTMP_SQ)'
70
+
71
+ check-chainlint :
72
+ @mkdir -p ' $(CHAINLINTTMP_SQ)' && \
73
+ err=0 && \
74
+ for i in $( CHAINLINTTESTS) ; do \
75
+ $(CHAINLINT ) < chainlint/$$ i.test | \
76
+ sed -e ' /^# LINT: /d' > ' $(CHAINLINTTMP_SQ)' /$$ i.actual && \
77
+ diff -u chainlint/$$ i.expect ' $(CHAINLINTTMP_SQ)' /$$ i.actual || err=1; \
78
+ done && exit $$ err
79
+
63
80
test-lint : test-lint-duplicates test-lint-executable test-lint-shell-syntax \
64
81
test-lint-filenames
65
82
@@ -102,4 +119,4 @@ valgrind:
102
119
perf :
103
120
$(MAKE ) -C perf/ all
104
121
105
- .PHONY : pre-clean $(T ) aggregate-results clean valgrind perf
122
+ .PHONY : pre-clean $(T ) aggregate-results clean valgrind perf check-chainlint clean-chainlint
0 commit comments