Merge branch 'nd/test-helpers' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 8 Aug 2016 21:21:43 +0000 (14:21 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 Aug 2016 21:21:43 +0000 (14:21 -0700)
Build clean-up.

* nd/test-helpers:
t/test-lib.sh: fix running tests with --valgrind
Makefile: use VCSSVN_LIB to refer to svn library
Makefile: drop extra dependencies for test helpers

1  2 
Makefile
t/test-lib.sh
diff --combined Makefile
index de5a0302565899a90482631e2267f3c413f347d4,cc90c62bcd10e13599bd1ff6db3f1f382c938002..4579eab43bafc2221c6a2ee8fb4d05140ee57e18
+++ b/Makefile
@@@ -355,6 -355,9 +355,6 @@@ all:
  #
  # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC in librt.
  #
 -# Define NO_HMAC_CTX_CLEANUP if your OpenSSL is version 0.9.6b or earlier to
 -# cleanup the HMAC context with the older HMAC_cleanup function.
 -#
  # Define USE_PARENS_AROUND_GETTEXT_N to "yes" if your compiler happily
  # compiles the following initialization:
  #
@@@ -375,7 -378,13 +375,7 @@@ GIT-VERSION-FILE: FORC
  # CFLAGS and LDFLAGS are for the users to override from the command line.
  
  CFLAGS = -g -O2 -Wall
 -LDFLAGS =
 -ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 -ALL_LDFLAGS = $(LDFLAGS)
 -STRIP ?= strip
 -
 -ifdef DEVELOPER
 -CFLAGS += -Werror \
 +DEVELOPER_CFLAGS = -Werror \
        -Wdeclaration-after-statement \
        -Wno-format-zero-length \
        -Wold-style-definition \
        -Wstrict-prototypes \
        -Wunused \
        -Wvla
 -endif
 +LDFLAGS =
 +ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 +ALL_LDFLAGS = $(LDFLAGS)
 +STRIP ?= strip
  
  # Create as necessary, replace existing, make ranlib unneeded.
  ARFLAGS = rcs
@@@ -437,6 -443,7 +437,6 @@@ DIFF = dif
  TAR = tar
  FIND = find
  INSTALL = install
 -RPMBUILD = rpmbuild
  TCL_PATH = tclsh
  TCLTK_PATH = wish
  XGETTEXT = xgettext
@@@ -948,10 -955,6 +948,10 @@@ include config.mak.unam
  -include config.mak.autogen
  -include config.mak
  
 +ifdef DEVELOPER
 +CFLAGS += $(DEVELOPER_CFLAGS)
 +endif
 +
  ifndef sysconfdir
  ifeq ($(prefix),/usr)
  sysconfdir = /etc
@@@ -1135,6 -1138,9 +1135,6 @@@ ifndef NO_OPENSS
        ifdef NEEDS_CRYPTO_WITH_SSL
                OPENSSL_LIBSSL += -lcrypto
        endif
 -      ifdef NO_HMAC_CTX_CLEANUP
 -              BASIC_CFLAGS += -DNO_HMAC_CTX_CLEANUP
 -      endif
  else
        BASIC_CFLAGS += -DNO_OPENSSL
        BLK_SHA1 = 1
@@@ -2063,7 -2069,7 +2063,7 @@@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) -
        --keyword=gettextln --keyword=eval_gettextln
  XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
  LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
 -LOCALIZED_SH = $(SCRIPT_SH)
 +LOCALIZED_SH = $(SCRIPT_SH) git-parse-remote.sh
  LOCALIZED_PERL = $(SCRIPT_PERL)
  
  ifdef XGETTEXT_INCLUDE_TESTS
@@@ -2225,17 -2231,9 +2225,9 @@@ perf: al
  
  .PHONY: test perf
  
- t/helper/test-ctype$X: ctype.o
+ t/helper/test-line-buffer$X: $(VCSSVN_LIB)
  
- t/helper/test-date$X: date.o ctype.o
- t/helper/test-delta$X: diff-delta.o patch-delta.o
- t/helper/test-line-buffer$X: vcs-svn/lib.a
- t/helper/test-parse-options$X: parse-options.o parse-options-cb.o
- t/helper/test-svn-fe$X: vcs-svn/lib.a
+ t/helper/test-svn-fe$X: $(VCSSVN_LIB)
  
  .PRECIOUS: $(TEST_OBJS)
  
@@@ -2390,25 -2388,31 +2382,25 @@@ quick-install-html
  
  ### Maintainer's dist rules
  
 -git.spec: git.spec.in GIT-VERSION-FILE
 -      sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
 -      mv $@+ $@
 -
  GIT_TARNAME = git-$(GIT_VERSION)
 -dist: git.spec git-archive$(X) configure
 +dist: git-archive$(X) configure
        ./git-archive --format=tar \
                --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
        @mkdir -p $(GIT_TARNAME)
 -      @cp git.spec configure $(GIT_TARNAME)
 +      @cp configure $(GIT_TARNAME)
        @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
        @$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
        $(TAR) rf $(GIT_TARNAME).tar \
 -              $(GIT_TARNAME)/git.spec \
                $(GIT_TARNAME)/configure \
                $(GIT_TARNAME)/version \
                $(GIT_TARNAME)/git-gui/version
        @$(RM) -r $(GIT_TARNAME)
        gzip -f -9 $(GIT_TARNAME).tar
  
 -rpm: dist
 -      $(RPMBUILD) \
 -              --define "_source_filedigest_algorithm md5" \
 -              --define "_binary_filedigest_algorithm md5" \
 -              -ta $(GIT_TARNAME).tar.gz
 +rpm::
 +      @echo >&2 "Use distro packaged sources to run rpmbuild"
 +      @false
 +.PHONY: rpm
  
  htmldocs = git-htmldocs-$(GIT_VERSION)
  manpages = git-manpages-$(GIT_VERSION)
@@@ -2484,7 -2488,6 +2476,7 @@@ ALL_COMMANDS += git-gui git-citoo
  
  .PHONY: check-docs
  check-docs::
 +      $(MAKE) -C Documentation lint-docs
        @(for v in $(ALL_COMMANDS); \
        do \
                case "$$v" in \
diff --combined t/test-lib.sh
index 2e5afd696a21b005bca1915c2eb89d222c72c227,0c966f3eaa09e7b523b77240ea35b5b06ec4b316..d731d66e3673f0e9d990007dd690c14d84eae783
@@@ -162,9 -162,6 +162,9 @@@ _x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x
  # Zero SHA-1
  _z40=0000000000000000000000000000000000000000
  
 +EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
 +EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
 +
  # Line feed
  LF='
  '
  # when case-folding filenames
  u200c=$(printf '\342\200\214')
  
 -export _x05 _x40 _z40 LF u200c
 +export _x05 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB
  
  # Each test should start with something like this, after copyright notices:
  #
                }
                run_list=$1; shift ;;
        --run=*)
 -              run_list=$(expr "z$1" : 'z[^=]*=\(.*\)'); shift ;;
 +              run_list=${1#--*=}; shift ;;
        -h|--h|--he|--hel|--help)
                help=t; shift ;;
        -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
                verbose=t; shift ;;
        --verbose-only=*)
 -              verbose_only=$(expr "z$1" : 'z[^=]*=\(.*\)')
 +              verbose_only=${1#--*=}
                shift ;;
        -q|--q|--qu|--qui|--quie|--quiet)
                # Ignore --quiet under a TAP::Harness. Saying how many tests
                valgrind=memcheck
                shift ;;
        --valgrind=*)
 -              valgrind=$(expr "z$1" : 'z[^=]*=\(.*\)')
 +              valgrind=${1#--*=}
                shift ;;
        --valgrind-only=*)
 -              valgrind_only=$(expr "z$1" : 'z[^=]*=\(.*\)')
 +              valgrind_only=${1#--*=}
                shift ;;
        --tee)
                shift ;; # was handled already
        --root=*)
 -              root=$(expr "z$1" : 'z[^=]*=\(.*\)')
 +              root=${1#--*=}
                shift ;;
        --chain-lint)
                GIT_TEST_CHAIN_LINT=1
@@@ -325,19 -322,6 +325,19 @@@ els
        exec 4>/dev/null 3>/dev/null
  fi
  
 +# Send any "-x" output directly to stderr to avoid polluting tests
 +# which capture stderr. We can do this unconditionally since it
 +# has no effect if tracing isn't turned on.
 +#
 +# Note that this sets up the trace fd as soon as we assign the variable, so it
 +# must come after the creation of descriptor 4 above. Likewise, we must never
 +# unset this, as it has the side effect of closing descriptor 4, which we
 +# use to show verbose tests to the user.
 +#
 +# Note also that we don't need or want to export it. The tracing is local to
 +# this shell, and we would not want to influence any shells we exec.
 +BASH_XTRACEFD=4
 +
  test_failure=0
  test_count=0
  test_fixed=0
@@@ -801,7 -785,7 +801,7 @@@ the
        # override all git executables in TEST_DIRECTORY/..
        GIT_VALGRIND=$TEST_DIRECTORY/valgrind
        mkdir -p "$GIT_VALGRIND"/bin
-       for file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/test-*
+       for file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/t/helper/test-*
        do
                make_valgrind_symlink $file
        done
@@@ -1114,12 -1098,3 +1114,12 @@@ run_with_limited_cmdline () 
  }
  
  test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
 +
 +build_option () {
 +      git version --build-options |
 +      sed -ne "s/^$1: //p"
 +}
 +
 +test_lazy_prereq LONG_IS_64BIT '
 +      test 8 -le "$(build_option sizeof-long)"
 +'