t3701-add-interactive: tighten the check of trace output
[gitweb.git] / t / Makefile
index 18e2b28b263682a9eb6902b62535c228be1f36af..96317a35f4df9944cd3b9f64db0db3132d69da6e 100644 (file)
@@ -8,6 +8,7 @@
 
 #GIT_TEST_OPTS = --verbose --debug
 SHELL_PATH ?= $(SHELL)
+TEST_SHELL_PATH ?= $(SHELL_PATH)
 PERL_PATH ?= /usr/bin/perl
 TAR ?= $(TAR)
 RM ?= rm -f
@@ -23,6 +24,7 @@ endif
 
 # Shell quote;
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
 TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY))
 
@@ -35,12 +37,18 @@ all: $(DEFAULT_TEST_TARGET)
 test: pre-clean $(TEST_LINT)
        $(MAKE) aggregate-results-and-cleanup
 
+failed:
+       @failed=$$(cd '$(TEST_RESULTS_DIRECTORY_SQ)' && \
+               grep -l '^failed [1-9]' *.counts | \
+               sed -n 's/\.counts$$/.sh/p') && \
+       test -z "$$failed" || $(MAKE) $$failed
+
 prove: pre-clean $(TEST_LINT)
-       @echo "*** prove ***"; $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
+       @echo "*** prove ***"; $(PROVE) --exec '$(TEST_SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS)
        $(MAKE) clean-except-prove-cache
 
 $(T):
-       @echo "*** $@ ***"; '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
+       @echo "*** $@ ***"; '$(TEST_SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
 
 pre-clean:
        $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
@@ -52,7 +60,8 @@ clean-except-prove-cache:
 clean: clean-except-prove-cache
        $(RM) .prove
 
-test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
+test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
+       test-lint-filenames
 
 test-lint-duplicates:
        @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
@@ -67,6 +76,14 @@ test-lint-executable:
 test-lint-shell-syntax:
        @'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T) $(THELPERS)
 
+test-lint-filenames:
+       @# We do *not* pass a glob to ls-files but use grep instead, to catch
+       @# non-ASCII characters (which are quoted within double-quotes)
+       @bad="$$(git -c core.quotepath=true ls-files 2>/dev/null | \
+                       grep '["*:<>?\\|]')"; \
+               test -z "$$bad" || { \
+               echo >&2 "non-portable file name(s): $$bad"; exit 1; }
+
 aggregate-results-and-cleanup: $(T)
        $(MAKE) aggregate-results
        $(MAKE) clean