Merge branch 'tb/test-shell-lint'
authorJunio C Hamano <gitster@pobox.com>
Thu, 10 Jan 2013 21:47:04 +0000 (13:47 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Jan 2013 21:47:04 +0000 (13:47 -0800)
Check for common mistakes in the test scripts, based on simple
pattern-matching.

* tb/test-shell-lint:
test: Add check-non-portable-shell.pl

1  2 
t/Makefile
diff --combined t/Makefile
index 5c6de8169bfc02fc280d2dcb8cf34a912f0b0f6a,a43becba9d154874ae6000e5be645367ab7ab6f1..1923cc104bc71e5a696676232d6f42b47a19de25
@@@ -13,10 -13,10 +13,11 @@@ TAR ?= $(TAR
  RM ?= rm -f
  PROVE ?= prove
  DEFAULT_TEST_TARGET ?= test
 +TEST_LINT ?= test-lint-duplicates test-lint-executable
  
  # Shell quote;
  SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
  
  T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
  TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
@@@ -44,7 -44,7 +45,7 @@@ clean-except-prove-cache
  clean: clean-except-prove-cache
        $(RM) .prove
  
- test-lint: test-lint-duplicates test-lint-executable
+ test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
  
  test-lint-duplicates:
        @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
@@@ -56,6 -56,9 +57,9 @@@ test-lint-executable
                test -z "$$bad" || { \
                echo >&2 "non-executable tests:" $$bad; exit 1; }
  
+ test-lint-shell-syntax:
+       @'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T)
  aggregate-results-and-cleanup: $(T)
        $(MAKE) aggregate-results
        $(MAKE) clean
@@@ -88,7 -91,7 +92,7 @@@ test-results
        mkdir -p test-results
  
  test-results/git-smoke.tar.gz: test-results
-       $(PERL_PATH) ./harness \
+       '$(PERL_PATH_SQ)' ./harness \
                --archive="test-results/git-smoke.tar.gz" \
                $(T)