6fe07c0961
test failure would not be reflected by the exit code of 'make'. Setting a shell parameter in the left-hand side of a pipe is not visible to commands after the pipe, because the left-hand side forks. (That's true both in 'sh' used by 'make' and in 'zsh' that runs tests/test-highlighting.zsh, at least on my system.) Therefore, move the colorizing hook to where it doesn't interfere with setting the $something_failed (in tests/test-highlighting.zsh) and $result (in Makefile) parameters.
44 lines
1000 B
Makefile
44 lines
1000 B
Makefile
NAME=zsh-syntax-highlighting
|
|
|
|
INSTALL?=install -c
|
|
PREFIX?=/usr/local
|
|
SHARE_DIR=$(DESTDIR)$(PREFIX)/share/$(NAME)
|
|
ZSH?=zsh # zsh binary to run tests with
|
|
|
|
# Have the default target do nothing.
|
|
all:
|
|
@ :
|
|
|
|
install:
|
|
$(INSTALL) -d $(SHARE_DIR)
|
|
cp -r .version zsh-syntax-highlighting.zsh highlighters $(SHARE_DIR)
|
|
if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \
|
|
git rev-parse HEAD; \
|
|
else \
|
|
cat .revision-hash; \
|
|
fi > $(SHARE_DIR)/.revision-hash
|
|
|
|
test:
|
|
@result=0; \
|
|
for test in highlighters/*; do \
|
|
if [ -d $$test/test-data ]; then \
|
|
echo "Running test $${test##*/}"; \
|
|
$(ZSH) -f tests/test-highlighting.zsh "$${test##*/}"; \
|
|
: $$(( result |= $$? )); \
|
|
fi \
|
|
done; \
|
|
exit $$result
|
|
|
|
perf:
|
|
@result=0; \
|
|
for test in highlighters/*; do \
|
|
if [ -d $$test/test-data ]; then \
|
|
echo "Running test $${test##*/}"; \
|
|
$(ZSH) -f tests/test-perfs.zsh "$${test##*/}"; \
|
|
: $$(( result |= $$? )); \
|
|
fi \
|
|
done; \
|
|
exit $$result
|
|
|
|
.PHONY: all install test
|