From: Junio C Hamano Date: Wed, 11 Apr 2018 04:09:56 +0000 (+0900) Subject: Merge branch 'nd/combined-test-helper' X-Git-Tag: v2.18.0-rc0~142 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/27f25845cf5ebcfd214c16b9d9b53200980dfef8?ds=inline;hp=-c Merge branch 'nd/combined-test-helper' Small test-helper programs have been consolidated into a single binary. * nd/combined-test-helper: (36 commits) t/helper: merge test-write-cache into test-tool t/helper: merge test-wildmatch into test-tool t/helper: merge test-urlmatch-normalization into test-tool t/helper: merge test-subprocess into test-tool t/helper: merge test-submodule-config into test-tool t/helper: merge test-string-list into test-tool t/helper: merge test-strcmp-offset into test-tool t/helper: merge test-sigchain into test-tool t/helper: merge test-sha1-array into test-tool t/helper: merge test-scrap-cache-tree into test-tool t/helper: merge test-run-command into test-tool t/helper: merge test-revision-walking into test-tool t/helper: merge test-regex into test-tool t/helper: merge test-ref-store into test-tool t/helper: merge test-read-cache into test-tool t/helper: merge test-prio-queue into test-tool t/helper: merge test-path-utils into test-tool t/helper: merge test-online-cpus into test-tool t/helper: merge test-mktemp into test-tool t/helper: merge (unused) test-mergesort into test-tool ... --- 27f25845cf5ebcfd214c16b9d9b53200980dfef8 diff --combined Makefile index 96f6138f63,8ad9a2a1a9..f181687250 --- a/Makefile +++ b/Makefile @@@ -29,10 -29,10 +29,10 @@@ all: # Perl-compatible regular expressions instead of standard or extended # POSIX regular expressions. # -# Currently USE_LIBPCRE is a synonym for USE_LIBPCRE1, define -# USE_LIBPCRE2 instead if you'd like to use version 2 of the PCRE -# library. The USE_LIBPCRE flag will likely be changed to mean v2 by -# default in future releases. +# USE_LIBPCRE is a synonym for USE_LIBPCRE2, define USE_LIBPCRE1 +# instead if you'd like to use the legacy version 1 of the PCRE +# library. Support for version 1 will likely be removed in some future +# release of Git, as upstream has all but abandoned it. # # When using USE_LIBPCRE1, define NO_LIBPCRE1_JIT if the PCRE v1 # library is compiled without --enable-jit. We will auto-detect @@@ -335,13 -335,6 +335,13 @@@ # when hardlinking a file to another name and unlinking the original file right # away (some NTFS drivers seem to zero the contents in that scenario). # +# Define INSTALL_SYMLINKS if you prefer to have everything that can be +# symlinked between bin/ and libexec/ to use relative symlinks between +# the two. This option overrides NO_CROSS_DIRECTORY_HARDLINKS and +# NO_INSTALL_HARDLINKS which will also use symlinking by indirection +# within the same directory in some cases, INSTALL_SYMLINKS will +# always symlink to the final target directly. +# # Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed # programs as a tar, where bin/ and libexec/ might be on different file systems. # @@@ -481,7 -474,8 +481,7 @@@ ARFLAGS = rc # This can help installing the suite in a relocatable way. prefix = $(HOME) -bindir_relative = bin -bindir = $(prefix)/$(bindir_relative) +bindir = $(prefix)/bin mandir = $(prefix)/share/man infodir = $(prefix)/share/info gitexecdir = libexec/git-core @@@ -498,10 -492,8 +498,10 @@@ lib = li # DESTDIR = pathsep = : +bindir_relative = $(patsubst $(prefix)/%,%,$(bindir)) mandir_relative = $(patsubst $(prefix)/%,%,$(mandir)) infodir_relative = $(patsubst $(prefix)/%,%,$(infodir)) +gitexecdir_relative = $(patsubst $(prefix)/%,%,$(gitexecdir)) htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir)) export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir @@@ -554,6 -546,7 +554,7 @@@ SCRIPT_PERL SCRIPT_PYTHON = SCRIPT_SH = SCRIPT_LIB = + TEST_BUILTINS_OBJS = TEST_PROGRAMS_NEED_X = # Having this variable in your environment would break pipelines because @@@ -659,47 -652,49 +660,49 @@@ X PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS)) - TEST_PROGRAMS_NEED_X += test-chmtime - TEST_PROGRAMS_NEED_X += test-ctype - TEST_PROGRAMS_NEED_X += test-config - TEST_PROGRAMS_NEED_X += test-date - TEST_PROGRAMS_NEED_X += test-delta - TEST_PROGRAMS_NEED_X += test-drop-caches - TEST_PROGRAMS_NEED_X += test-dump-cache-tree + TEST_BUILTINS_OBJS += test-chmtime.o + TEST_BUILTINS_OBJS += test-config.o + TEST_BUILTINS_OBJS += test-ctype.o + TEST_BUILTINS_OBJS += test-date.o + TEST_BUILTINS_OBJS += test-delta.o + TEST_BUILTINS_OBJS += test-drop-caches.o + TEST_BUILTINS_OBJS += test-dump-cache-tree.o + TEST_BUILTINS_OBJS += test-dump-split-index.o + TEST_BUILTINS_OBJS += test-example-decorate.o + TEST_BUILTINS_OBJS += test-genrandom.o + TEST_BUILTINS_OBJS += test-hashmap.o + TEST_BUILTINS_OBJS += test-index-version.o + TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o + TEST_BUILTINS_OBJS += test-match-trees.o + TEST_BUILTINS_OBJS += test-mergesort.o + TEST_BUILTINS_OBJS += test-mktemp.o + TEST_BUILTINS_OBJS += test-online-cpus.o + TEST_BUILTINS_OBJS += test-path-utils.o + TEST_BUILTINS_OBJS += test-prio-queue.o + TEST_BUILTINS_OBJS += test-read-cache.o + TEST_BUILTINS_OBJS += test-ref-store.o + TEST_BUILTINS_OBJS += test-regex.o + TEST_BUILTINS_OBJS += test-revision-walking.o + TEST_BUILTINS_OBJS += test-run-command.o + TEST_BUILTINS_OBJS += test-scrap-cache-tree.o + TEST_BUILTINS_OBJS += test-sha1-array.o + TEST_BUILTINS_OBJS += test-sha1.o + TEST_BUILTINS_OBJS += test-sigchain.o + TEST_BUILTINS_OBJS += test-strcmp-offset.o + TEST_BUILTINS_OBJS += test-string-list.o + TEST_BUILTINS_OBJS += test-submodule-config.o + TEST_BUILTINS_OBJS += test-subprocess.o + TEST_BUILTINS_OBJS += test-urlmatch-normalization.o + TEST_BUILTINS_OBJS += test-wildmatch.o + TEST_BUILTINS_OBJS += test-write-cache.o + TEST_PROGRAMS_NEED_X += test-dump-fsmonitor - TEST_PROGRAMS_NEED_X += test-dump-split-index TEST_PROGRAMS_NEED_X += test-dump-untracked-cache - TEST_PROGRAMS_NEED_X += test-example-decorate TEST_PROGRAMS_NEED_X += test-fake-ssh - TEST_PROGRAMS_NEED_X += test-genrandom - TEST_PROGRAMS_NEED_X += test-hashmap - TEST_PROGRAMS_NEED_X += test-index-version - TEST_PROGRAMS_NEED_X += test-lazy-init-name-hash TEST_PROGRAMS_NEED_X += test-line-buffer - TEST_PROGRAMS_NEED_X += test-match-trees - TEST_PROGRAMS_NEED_X += test-mergesort - TEST_PROGRAMS_NEED_X += test-mktemp - TEST_PROGRAMS_NEED_X += test-online-cpus TEST_PROGRAMS_NEED_X += test-parse-options - TEST_PROGRAMS_NEED_X += test-path-utils - TEST_PROGRAMS_NEED_X += test-prio-queue - TEST_PROGRAMS_NEED_X += test-read-cache - TEST_PROGRAMS_NEED_X += test-write-cache - TEST_PROGRAMS_NEED_X += test-ref-store - TEST_PROGRAMS_NEED_X += test-regex - TEST_PROGRAMS_NEED_X += test-revision-walking - TEST_PROGRAMS_NEED_X += test-run-command - TEST_PROGRAMS_NEED_X += test-scrap-cache-tree - TEST_PROGRAMS_NEED_X += test-sha1 - TEST_PROGRAMS_NEED_X += test-sha1-array - TEST_PROGRAMS_NEED_X += test-sigchain - TEST_PROGRAMS_NEED_X += test-strcmp-offset - TEST_PROGRAMS_NEED_X += test-string-list - TEST_PROGRAMS_NEED_X += test-submodule-config - TEST_PROGRAMS_NEED_X += test-subprocess TEST_PROGRAMS_NEED_X += test-svn-fe - TEST_PROGRAMS_NEED_X += test-urlmatch-normalization - TEST_PROGRAMS_NEED_X += test-wildmatch + TEST_PROGRAMS_NEED_X += test-tool TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X)) @@@ -1178,18 -1173,13 +1181,18 @@@ ifdef NO_LIBGEN_ COMPAT_OBJS += compat/basename.o endif -USE_LIBPCRE1 ?= $(USE_LIBPCRE) +USE_LIBPCRE2 ?= $(USE_LIBPCRE) -ifneq (,$(USE_LIBPCRE1)) - ifdef USE_LIBPCRE2 -$(error Only set USE_LIBPCRE1 (or its alias USE_LIBPCRE) or USE_LIBPCRE2, not both!) +ifneq (,$(USE_LIBPCRE2)) + ifdef USE_LIBPCRE1 +$(error Only set USE_LIBPCRE2 (or its alias USE_LIBPCRE) or USE_LIBPCRE1, not both!) endif + BASIC_CFLAGS += -DUSE_LIBPCRE2 + EXTLIBS += -lpcre2-8 +endif + +ifdef USE_LIBPCRE1 BASIC_CFLAGS += -DUSE_LIBPCRE1 EXTLIBS += -lpcre @@@ -1198,6 -1188,11 +1201,6 @@@ ifdef NO_LIBPCRE1_JI endif endif -ifdef USE_LIBPCRE2 - BASIC_CFLAGS += -DUSE_LIBPCRE2 - EXTLIBS += -lpcre2-8 -endif - ifdef LIBPCREDIR BASIC_CFLAGS += -I$(LIBPCREDIR)/include EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib) @@@ -1749,7 -1744,6 +1752,7 @@@ infodir_relative_SQ = $(subst ','\'',$( perllibdir_SQ = $(subst ','\'',$(perllibdir)) localedir_SQ = $(subst ','\'',$(localedir)) gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) +gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative)) template_dir_SQ = $(subst ','\'',$(template_dir)) htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative)) prefix_SQ = $(subst ','\'',$(prefix)) @@@ -2092,7 -2086,7 +2095,7 @@@ VCSSVN_OBJS += vcs-svn/fast_export. VCSSVN_OBJS += vcs-svn/svndiff.o VCSSVN_OBJS += vcs-svn/svndump.o - TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) + TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS)) OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \ $(XDIFF_OBJS) \ $(VCSSVN_OBJS) \ @@@ -2503,10 -2497,12 +2506,12 @@@ t/helper/test-svn-fe$X: $(VCSSVN_LIB .PRECIOUS: $(TEST_OBJS) + t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS)) + t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS) - check-sha1:: t/helper/test-sha1$X + check-sha1:: t/helper/test-tool$X t/helper/test-sha1.sh SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ)) @@@ -2615,44 -2611,35 +2620,44 @@@ endi bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \ execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \ + destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \ { test "$$bindir/" = "$$execdir/" || \ for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \ $(RM) "$$execdir/$$p" && \ - test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \ - ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \ - cp "$$bindir/$$p" "$$execdir/$$p" || exit; \ + test -n "$(INSTALL_SYMLINKS)" && \ + ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \ + { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \ + ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \ + cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \ done; \ } && \ for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \ $(RM) "$$bindir/$$p" && \ - test -z "$(NO_INSTALL_HARDLINKS)" && \ - ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \ - ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \ - cp "$$bindir/git$X" "$$bindir/$$p" || exit; \ + test -n "$(INSTALL_SYMLINKS)" && \ + ln -s "git$X" "$$bindir/$$p" || \ + { test -z "$(NO_INSTALL_HARDLINKS)" && \ + ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \ + ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \ + cp "$$bindir/git$X" "$$bindir/$$p" || exit; } \ done && \ for p in $(BUILT_INS); do \ $(RM) "$$execdir/$$p" && \ - test -z "$(NO_INSTALL_HARDLINKS)" && \ - ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \ - ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \ - cp "$$execdir/git$X" "$$execdir/$$p" || exit; \ + test -n "$(INSTALL_SYMLINKS)" && \ + ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \ + { test -z "$(NO_INSTALL_HARDLINKS)" && \ + ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \ + ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \ + cp "$$execdir/git$X" "$$execdir/$$p" || exit; } \ done && \ remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \ for p in $$remote_curl_aliases; do \ $(RM) "$$execdir/$$p" && \ - test -z "$(NO_INSTALL_HARDLINKS)" && \ - ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ - ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ - cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \ + test -n "$(INSTALL_SYMLINKS)" && \ + ln -s "git-remote-http$X" "$$execdir/$$p" || \ + { test -z "$(NO_INSTALL_HARDLINKS)" && \ + ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ + ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ + cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \ done && \ ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X" diff --combined t/helper/test-ref-store.c index 7314b5943e,cdefb66a87..7c4f43746e --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@@ -1,7 -1,7 +1,8 @@@ + #include "test-tool.h" #include "cache.h" #include "refs.h" #include "worktree.h" +#include "object-store.h" static const char *notnull(const char *arg, const char *name) { @@@ -275,7 -275,7 +276,7 @@@ static struct command commands[] = { NULL, NULL } }; - int cmd_main(int argc, const char **argv) + int cmd__ref_store(int argc, const char **argv) { struct ref_store *refs; const char *func; diff --combined t/t1300-repo-config.sh index dc7e6c2e77,8780934478..e95b1e67da --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@@ -914,7 -914,7 +914,7 @@@ test_expect_success 'get --expiry-date invalid1 = "abc" EOF cat >expect <<-EOF && - $(test-date timestamp $rel) + $(test-tool date timestamp $rel) 1275666415 1510441871 1510348087 @@@ -1587,10 -1587,10 +1587,10 @@@ test_expect_success '--show-origin stdi ' test_expect_success !MINGW '--show-origin blob' ' - cat >expect <<-\EOF && - blob:a9d9f9e555b5c6f07cbe09d3f06fe3df11e09c08 user.custom=true - EOF blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") && + cat >expect <<-EOF && + blob:$blob user.custom=true + EOF git config --blob=$blob --show-origin --list >output && test_cmp expect output ' diff --combined t/t1405-main-ref-store.sh index a1e243a05c,a30a080b20..a74c38b5fb --- a/t/t1405-main-ref-store.sh +++ b/t/t1405-main-ref-store.sh @@@ -4,7 -4,7 +4,7 @@@ test_description='test main ref store a . ./test-lib.sh - RUN="test-ref-store main" + RUN="test-tool ref-store main" test_expect_success 'pack_refs(PACK_REFS_ALL | PACK_REFS_PRUNE)' ' test_commit one && @@@ -45,7 -45,7 +45,7 @@@ test_expect_success 'rename_refs(master ' test_expect_success 'for_each_ref(refs/heads/)' ' - $RUN for-each-ref refs/heads/ | cut -c 42- >actual && + $RUN for-each-ref refs/heads/ | cut -d" " -f 2- >actual && cat >expected <<-\EOF && master 0x0 new-master 0x0 @@@ -71,7 -71,7 +71,7 @@@ test_expect_success 'verify_ref(new-mas ' test_expect_success 'for_each_reflog()' ' - $RUN for-each-reflog | sort | cut -c 42- >actual && + $RUN for-each-reflog | sort -k2 | cut -c 42- >actual && cat >expected <<-\EOF && HEAD 0x1 refs/heads/master 0x0 diff --combined t/t3404-rebase-interactive.sh index c59d0384fd,961ac9d6b8..756de26c19 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@@ -711,13 -711,13 +711,13 @@@ test_expect_success 'rebase -i continu test_expect_success 'avoid unnecessary reset' ' git checkout master && git reset --hard && - test-chmtime =123456789 file3 && + test-tool chmtime =123456789 file3 && git update-index --refresh && HEAD=$(git rev-parse HEAD) && set_fake_editor && git rebase -i HEAD~4 && test $HEAD = $(git rev-parse HEAD) && - MTIME=$(test-chmtime -v +0 file3 | sed 's/[^0-9].*$//') && + MTIME=$(test-tool chmtime -v +0 file3 | sed 's/[^0-9].*$//') && test 123456789 = $MTIME ' @@@ -927,8 -927,10 +927,8 @@@ test_expect_success 'rebase --exec work test_expect_success 'rebase -i --exec without ' ' git reset --hard execute && set_fake_editor && - test_must_fail git rebase -i --exec 2>tmp && - sed -e "1d" tmp >actual && - test_must_fail git rebase -h >expected && - test_cmp expected actual && + test_must_fail git rebase -i --exec 2>actual && + test_i18ngrep "requires a value" actual && git checkout master ' diff --combined t/t3501-revert-cherry-pick.sh index 0d89f6d0f6,ccbc118514..c9a1f783f5 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@@ -86,7 -86,7 +86,7 @@@ test_expect_success 'cherry-pick on sta ( cd copy && git checkout initial && - test-chmtime +40 oops && + test-tool chmtime +40 oops && git cherry-pick added ) ' @@@ -141,7 -141,7 +141,7 @@@ test_expect_success 'cherry-pick "-" wo test_cmp expect actual ' -test_expect_failure 'cherry-pick works with dirty renamed file' ' +test_expect_success 'cherry-pick works with dirty renamed file' ' test_commit to-rename && git checkout -b unrelated && test_commit unrelated &&