summaryrefslogtreecommitdiff
path: root/t/Makefile
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2021-12-13 06:30:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-13 22:15:28 (GMT)
commitf30c1d5eb1ceeec460ea4cd2089ece63156f5eb0 (patch)
tree976239e9658fd8d25f96640bb8db649890b2c8d2 /t/Makefile
parent0cca54c706128338ee79efb55e9c0ddb6be723dc (diff)
downloadgit-f30c1d5eb1ceeec460ea4cd2089ece63156f5eb0.zip
git-f30c1d5eb1ceeec460ea4cd2089ece63156f5eb0.tar.gz
git-f30c1d5eb1ceeec460ea4cd2089ece63156f5eb0.tar.bz2
t/Makefile: optimize chainlint self-test
Rather than running `chainlint` and `diff` once per self-test -- which may become expensive as more tests are added -- instead run `chainlint` a single time over all tests bodies collectively and compare the result to the collective "expected" output. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/Makefile')
-rw-r--r--t/Makefile10
1 files changed, 4 insertions, 6 deletions
diff --git a/t/Makefile b/t/Makefile
index 882d26e..f4ae40b 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -71,12 +71,10 @@ clean-chainlint:
check-chainlint:
@mkdir -p '$(CHAINLINTTMP_SQ)' && \
- err=0 && \
- for i in $(CHAINLINTTESTS); do \
- $(CHAINLINT) <chainlint/$$i.test | \
- sed -e '/^# LINT: /d' >'$(CHAINLINTTMP_SQ)'/$$i.actual && \
- diff -u chainlint/$$i.expect '$(CHAINLINTTMP_SQ)'/$$i.actual || err=1; \
- done && exit $$err
+ sed -e '/^# LINT: /d' $(patsubst %,chainlint/%.test,$(CHAINLINTTESTS)) >'$(CHAINLINTTMP_SQ)'/tests && \
+ cat $(patsubst %,chainlint/%.expect,$(CHAINLINTTESTS)) >'$(CHAINLINTTMP_SQ)'/expect && \
+ $(CHAINLINT) '$(CHAINLINTTMP_SQ)'/tests >'$(CHAINLINTTMP_SQ)'/actual && \
+ diff -u '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual
test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
test-lint-filenames