git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 00/36] Combine t/helper binaries into a single one
@ 2018-03-17  7:53 Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
                   ` (37 more replies)
  0 siblings, 38 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

The number of t/helper binaries is growing, which slows down build
process due to increasing link time and also consumes more disk space.
This series combines most of them into a new binary called test-tool.

Going forward, new test helper programs should be part of this
test-tool (with few exceptions).

Interesting numbers and exceptions are in 01/36. The four most
interesting patches are at the top. The rest is boring mechanical
search and replace.

Nguyễn Thái Ngọc Duy (36):
  t/helper: add an empty test-tool program
  t/helper: merge test-chmtime into test-tool
  t/helper: merge test-sha1 into test-tool
  t/helper: merge test-lazy-init-name-hash into test-tool
  t/helper: merge test-config into test-tool
  t/helper: merge test-ctype into test-tool
  t/helper: merge test-date into test-tool
  t/helper: merge (unused) test-delta into test-tool
  t/helper: merge test-drop-caches into test-tool
  t/helper: merge test-dump-cache-tree into test-tool
  t/helper: merge test-dump-split-index into test-tool
  t/helper: merge test-example-decorate into test-tool
  t/helper: merge test-genrandom into test-tool
  t/helper: merge test-hashmap into test-tool
  t/helper: merge test-index-version into test-tool
  t/helper: merge (unused) test-match-trees into test-tool
  t/helper: merge (unused) test-mergesort into test-tool
  t/helper: merge test-mktemp into test-tool
  t/helper: merge test-online-cpus into test-tool
  t/helper: merge test-path-utils into test-tool
  t/helper: merge test-prio-queue into test-tool
  t/helepr: merge test-read-cache into test-tool
  t/helper: merge test-ref-store into test-tool
  t/helper: merge test-regex into test-tool
  t/helper: merge test-revision-walking into test-tool
  t/helper: merge test-run-command into test-tool
  t/helper: merge test-scrap-cache-tree into test-tool
  t/helper: merge test-sha1-array into test-tool
  t/helper: merge test-sigchain into test-tool
  t/helper: merge test-strcmp-offset into test-tool
  t/helper: merge test-string-list into test-tool
  t/helper: merge test-submodule-config into test-tool
  t/helper: merge test-subprocess into test-tool
  t/helper: merge test-urlmatch-.. into test-tool
  t/helper: merge test-wildmatch into test-tool
  t/helper: merge test-write-cache into test-tool

 .../howto/recover-corrupted-object-harder.txt |   2 +-
 Makefile                                      |  79 +++---
 cache.h                                       |   2 +-
 name-hash.c                                   |   2 +-
 t/helper/test-chmtime.c                       |  15 +-
 t/helper/test-config.c                        |   5 +-
 t/helper/test-ctype.c                         |   3 +-
 t/helper/test-date.c                          |  17 +-
 t/helper/test-delta.c                         |   5 +-
 t/helper/test-drop-caches.c                   |   3 +-
 t/helper/test-dump-cache-tree.c               |   3 +-
 t/helper/test-dump-split-index.c              |   3 +-
 t/helper/test-example-decorate.c              |   3 +-
 t/helper/test-genrandom.c                     |   3 +-
 t/helper/test-hashmap.c                       |   5 +-
 t/helper/test-index-version.c                 |   3 +-
 t/helper/test-lazy-init-name-hash.c           |  26 +-
 t/helper/test-match-trees.c                   |   3 +-
 t/helper/test-mergesort.c                     |   3 +-
 t/helper/test-mktemp.c                        |   3 +-
 t/helper/test-online-cpus.c                   |   3 +-
 t/helper/test-path-utils.c                    |   3 +-
 t/helper/test-prio-queue.c                    |   3 +-
 t/helper/test-read-cache.c                    |   3 +-
 t/helper/test-ref-store.c                     |   3 +-
 t/helper/test-regex.c                         |   7 +-
 t/helper/test-revision-walking.c              |   3 +-
 t/helper/test-run-command.c                   |   3 +-
 t/helper/test-scrap-cache-tree.c              |   3 +-
 t/helper/test-sha1-array.c                    |   3 +-
 t/helper/test-sha1.c                          |   3 +-
 t/helper/test-sha1.sh                         |   4 +-
 t/helper/test-sigchain.c                      |   3 +-
 t/helper/test-strcmp-offset.c                 |   3 +-
 t/helper/test-string-list.c                   |   3 +-
 t/helper/test-submodule-config.c              |   3 +-
 t/helper/test-subprocess.c                    |   3 +-
 t/helper/test-tool.c                          |  62 ++++
 t/helper/test-tool.h                          |  40 +++
 t/helper/test-urlmatch-normalization.c        |   5 +-
 t/helper/test-wildmatch.c                     |   3 +-
 t/helper/test-write-cache.c                   |   3 +-
 t/lib-git-p4.sh                               |   2 +-
 t/lib-git-svn.sh                              |   2 +-
 t/lib-pack.sh                                 |   2 +-
 t/perf/p0002-read-cache.sh                    |   2 +-
 t/perf/p0004-lazy-init-name-hash.sh           |   8 +-
 t/perf/p0007-write-cache.sh                   |   2 +-
 t/perf/p0071-sort.sh                          |   2 +-
 t/perf/p7519-fsmonitor.sh                     |  12 +-
 t/t0005-signals.sh                            |   6 +-
 t/t0006-date.sh                               |   8 +-
 t/t0009-prio-queue.sh                         |   6 +-
 t/t0011-hashmap.sh                            |   4 +-
 t/t0013-sha1dc.sh                             |   2 +-
 t/t0021-conversion.sh                         |   4 +-
 t/t0060-path-utils.sh                         |  60 ++--
 t/t0061-run-command.sh                        |  24 +-
 t/t0062-revision-walking.sh                   |   2 +-
 t/t0063-string-list.sh                        |  48 ++--
 t/t0064-sha1-array.sh                         |  16 +-
 t/t0065-strcmp-offset.sh                      |   2 +-
 t/t0070-fundamental.sh                        |   8 +-
 t/t0090-cache-tree.sh                         |  18 +-
 t/t0110-urlmatch-normalization.sh             | 266 +++++++++---------
 t/t1006-cat-file.sh                           |   2 +-
 t/t1050-large.sh                              |   6 +-
 t/t1300-repo-config.sh                        |   2 +-
 t/t1305-config-include.sh                     |   2 +-
 t/t1308-config-set.sh                         |  22 +-
 t/t1309-early-config.sh                       |  12 +-
 t/t1405-main-ref-store.sh                     |   2 +-
 t/t1406-submodule-ref-store.sh                |   2 +-
 t/t1407-worktree-ref-store.sh                 |   4 +-
 t/t1501-work-tree.sh                          |  10 +-
 t/t1600-index.sh                              |   2 +-
 t/t1700-split-index.sh                        |  64 ++---
 t/t2022-checkout-paths.sh                     |   4 +-
 t/t2104-update-index-skip-worktree.sh         |   6 +-
 t/t3008-ls-files-lazy-init-name-hash.sh       |   4 +-
 t/t3070-wildmatch.sh                          |  14 +-
 t/t3306-notes-prune.sh                        |   2 +-
 t/t3404-rebase-interactive.sh                 |   4 +-
 t/t3418-rebase-continue.sh                    |   4 +-
 t/t3501-revert-cherry-pick.sh                 |   2 +-
 t/t3510-cherry-pick-sequence.sh               |   4 +-
 t/t3600-rm.sh                                 |   2 +-
 t/t3700-add.sh                                |   2 +-
 t/t4011-diff-symlink.sh                       |   2 +-
 t/t4013-diff-various.sh                       |   2 +-
 t/t4035-diff-quiet.sh                         |   2 +-
 t/t4151-am-abort.sh                           |   4 +-
 t/t4200-rerere.sh                             |  22 +-
 t/t5000-tar-tree.sh                           |   4 +-
 t/t5300-pack-object.sh                        |   4 +-
 t/t5301-sliding-window.sh                     |   2 +-
 t/t5302-pack-index.sh                         |  14 +-
 t/t5303-pack-corruption-resilience.sh         |  10 +-
 t/t5304-prune.sh                              |  16 +-
 t/t5310-pack-bitmaps.sh                       |   2 +-
 t/t5313-pack-bounds-checks.sh                 |   4 +-
 t/t5314-pack-cycle-detection.sh               |   2 +-
 t/t5316-pack-delta-depth.sh                   |   2 +-
 t/t5400-send-pack.sh                          |   2 +-
 t/t5516-fetch-push.sh                         |   2 +-
 t/t5546-receive-limits.sh                     |   2 +-
 t/t5547-push-quarantine.sh                    |   2 +-
 t/t5608-clone-2gb.sh                          |   2 +-
 t/t6022-merge-rename.sh                       |  30 +-
 t/t6500-gc.sh                                 |   2 +-
 t/t6501-freshen-objects.sh                    |   4 +-
 t/t7411-submodule-config.sh                   |  18 +-
 t/t7508-status.sh                             |   6 +-
 t/t7701-repack-unpack-unreachable.sh          |   6 +-
 t/t7812-grep-icase-non-ascii.sh               |   2 +-
 t/t9004-example.sh                            |   2 +-
 t/t9100-git-svn-basic.sh                      |   4 +-
 t/t9300-fast-import.sh                        |   2 +-
 t/t9802-git-p4-filetype.sh                    |   2 +-
 t/t9803-git-p4-shell-metachars.sh             |   4 +-
 t/t9813-git-p4-preserve-users.sh              |   6 +-
 t/t9820-git-p4-editor-handling.sh             |   2 +-
 t/test-lib.sh                                 |  10 +-
 123 files changed, 694 insertions(+), 549 deletions(-)
 create mode 100644 t/helper/test-tool.c
 create mode 100644 t/helper/test-tool.h

-- 
2.16.2.903.gd04caf5039


^ permalink raw reply	[flat|nested] 110+ messages in thread

* [PATCH 01/36] t/helper: add an empty test-tool program
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
                   ` (36 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

This will become an umbrella program that absorbs most [1] t/helper
programs in. By having a single executable binary we reduce disk usage
(libgit.a is replicated by every t/helper program) and shorten link
time a bit.

Running "make --jobs=1; du -sh t/helper" with ccache fully populated,
it takes 27 seconds and 277MB at the beginning of this series, 17
seconds and 42MB at the end.

[1] There are a couple programs that will not become part of
    test-tool: test-line-buffer and test-svn-fe have extra
    dependencies and test-fake-ssh's program name has to be a single
    word for some ssh tests.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile             |  6 +++++-
 t/helper/test-tool.c | 27 +++++++++++++++++++++++++++
 t/helper/test-tool.h |  4 ++++
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 t/helper/test-tool.c
 create mode 100644 t/helper/test-tool.h

diff --git a/Makefile b/Makefile
index a1d8775adb..2376646e98 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,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
@@ -690,6 +691,7 @@ 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-tool
 TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
 TEST_PROGRAMS_NEED_X += test-wildmatch
 
@@ -2083,7 +2085,7 @@ VCSSVN_OBJS += vcs-svn/fast_export.o
 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) \
@@ -2494,6 +2496,8 @@ 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)
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
new file mode 100644
index 0000000000..c730f718ca
--- /dev/null
+++ b/t/helper/test-tool.c
@@ -0,0 +1,27 @@
+#include "git-compat-util.h"
+#include "test-tool.h"
+
+struct test_cmd {
+	const char *name;
+	int (*main)(int argc, const char **argv);
+};
+
+static struct test_cmd cmds[] = {
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	int i;
+
+	if (argc < 2)
+		die("I need a test name!");
+
+	for (i = 0; i < ARRAY_SIZE(cmds); i++) {
+		if (!strcmp(cmds[i].name, argv[1])) {
+			argv++;
+			argc--;
+			return cmds[i].main(argc, argv);
+		}
+	}
+	die("There is no test named '%s'", argv[1]);
+}
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
new file mode 100644
index 0000000000..6ce57ae0cc
--- /dev/null
+++ b/t/helper/test-tool.h
@@ -0,0 +1,4 @@
+#ifndef __TEST_TOOL_H__
+#define __TEST_TOOL_H__
+
+#endif
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 02/36] t/helper: merge test-chmtime into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 03/36] t/helper: merge test-sha1 " Nguyễn Thái Ngọc Duy
                   ` (35 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                             |  3 ++-
 t/helper/test-chmtime.c              | 15 +++++++-------
 t/helper/test-tool.c                 |  1 +
 t/helper/test-tool.h                 |  2 ++
 t/lib-git-svn.sh                     |  2 +-
 t/t1700-split-index.sh               | 12 +++++------
 t/t2022-checkout-paths.sh            |  4 ++--
 t/t3306-notes-prune.sh               |  2 +-
 t/t3404-rebase-interactive.sh        |  4 ++--
 t/t3418-rebase-continue.sh           |  4 ++--
 t/t3501-revert-cherry-pick.sh        |  2 +-
 t/t3510-cherry-pick-sequence.sh      |  4 ++--
 t/t3600-rm.sh                        |  2 +-
 t/t3700-add.sh                       |  2 +-
 t/t4011-diff-symlink.sh              |  2 +-
 t/t4013-diff-various.sh              |  2 +-
 t/t4035-diff-quiet.sh                |  2 +-
 t/t4151-am-abort.sh                  |  4 ++--
 t/t4200-rerere.sh                    | 22 ++++++++++----------
 t/t5000-tar-tree.sh                  |  2 +-
 t/t5304-prune.sh                     | 16 +++++++--------
 t/t5400-send-pack.sh                 |  2 +-
 t/t5516-fetch-push.sh                |  2 +-
 t/t6022-merge-rename.sh              | 30 ++++++++++++++--------------
 t/t6500-gc.sh                        |  2 +-
 t/t6501-freshen-objects.sh           |  4 ++--
 t/t7508-status.sh                    |  6 +++---
 t/t7701-repack-unpack-unreachable.sh |  6 +++---
 t/t9100-git-svn-basic.sh             |  4 ++--
 t/t9803-git-p4-shell-metachars.sh    |  4 ++--
 t/t9813-git-p4-preserve-users.sh     |  6 +++---
 t/t9820-git-p4-editor-handling.sh    |  2 +-
 t/test-lib.sh                        |  6 +++---
 33 files changed, 94 insertions(+), 89 deletions(-)

diff --git a/Makefile b/Makefile
index 2376646e98..416a8e39c1 100644
--- a/Makefile
+++ b/Makefile
@@ -652,7 +652,8 @@ X =
 
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
-TEST_PROGRAMS_NEED_X += test-chmtime
+TEST_BUILTINS_OBJS += test-chmtime.o
+
 TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-config
 TEST_PROGRAMS_NEED_X += test-date
diff --git a/t/helper/test-chmtime.c b/t/helper/test-chmtime.c
index e760256406..f460b660a6 100644
--- a/t/helper/test-chmtime.c
+++ b/t/helper/test-chmtime.c
@@ -5,28 +5,29 @@
  *
  * The mtime can be changed to an absolute value:
  *
- *	test-chmtime =<seconds> file...
+ *	test-tool chmtime =<seconds> file...
  *
  * Relative to the current time as returned by time(3):
  *
- *	test-chmtime =+<seconds> (or =-<seconds>) file...
+ *	test-tool chmtime =+<seconds> (or =-<seconds>) file...
  *
  * Or relative to the current mtime of the file:
  *
- *	test-chmtime <seconds> file...
- *	test-chmtime +<seconds> (or -<seconds>) file...
+ *	test-tool chmtime <seconds> file...
+ *	test-tool chmtime +<seconds> (or -<seconds>) file...
  *
  * Examples:
  *
  * To just print the mtime use --verbose and set the file mtime offset to 0:
  *
- *	test-chmtime -v +0 file
+ *	test-tool chmtime -v +0 file
  *
  * To set the mtime to current time:
  *
- *	test-chmtime =+0 file
+ *	test-tool chmtime =+0 file
  *
  */
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include <utime.h>
 
@@ -56,7 +57,7 @@ static int timespec_arg(const char *arg, long int *set_time, int *set_eq)
 	return 1;
 }
 
-int cmd_main(int argc, const char **argv)
+int test_chmtime(int argc, const char **argv)
 {
 	static int verbose;
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index c730f718ca..c22f300f5e 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -7,6 +7,7 @@ struct test_cmd {
 };
 
 static struct test_cmd cmds[] = {
+	{ "chmtime", test_chmtime },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 6ce57ae0cc..61ca4a7055 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -1,4 +1,6 @@
 #ifndef __TEST_TOOL_H__
 #define __TEST_TOOL_H__
 
+int test_chmtime(int argc, const char **argv);
+
 #endif
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 4c1f81f167..a8130f9119 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -49,7 +49,7 @@ rawsvnrepo="$svnrepo"
 svnrepo="file://$svnrepo"
 
 poke() {
-	test-chmtime +1 "$1"
+	test-tool chmtime +1 "$1"
 }
 
 # We need this, because we should pass empty configuration directory to
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index a66936fe9b..4b5d443280 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -332,12 +332,12 @@ test_expect_success 'shared index files expire after 2 weeks by default' '
 	git update-index --add ten &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_under_2_weeks_ago=$((5-14*86400)) &&
-	test-chmtime =$just_under_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_under_2_weeks_ago .git/sharedindex.* &&
 	: >eleven &&
 	git update-index --add eleven &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_over_2_weeks_ago=$((-1-14*86400)) &&
-	test-chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
 	: >twelve &&
 	git update-index --add twelve &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
@@ -345,12 +345,12 @@ test_expect_success 'shared index files expire after 2 weeks by default' '
 
 test_expect_success 'check splitIndex.sharedIndexExpire set to 16 days' '
 	git config splitIndex.sharedIndexExpire "16.days.ago" &&
-	test-chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
 	: >thirteen &&
 	git update-index --add thirteen &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_over_16_days_ago=$((-1-16*86400)) &&
-	test-chmtime =$just_over_16_days_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_16_days_ago .git/sharedindex.* &&
 	: >fourteen &&
 	git update-index --add fourteen &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
@@ -359,13 +359,13 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to 16 days' '
 test_expect_success 'check splitIndex.sharedIndexExpire set to "never" and "now"' '
 	git config splitIndex.sharedIndexExpire never &&
 	just_10_years_ago=$((-365*10*86400)) &&
-	test-chmtime =$just_10_years_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_10_years_ago .git/sharedindex.* &&
 	: >fifteen &&
 	git update-index --add fifteen &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	git config splitIndex.sharedIndexExpire now &&
 	just_1_second_ago=-1 &&
-	test-chmtime =$just_1_second_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_1_second_ago .git/sharedindex.* &&
 	: >sixteen &&
 	git update-index --add sixteen &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
diff --git a/t/t2022-checkout-paths.sh b/t/t2022-checkout-paths.sh
index f46d0499bc..e74d58b9e1 100755
--- a/t/t2022-checkout-paths.sh
+++ b/t/t2022-checkout-paths.sh
@@ -68,13 +68,13 @@ test_expect_success 'do not touch files that are already up-to-date' '
 	git add file1 file2 &&
 	git commit -m base &&
 	echo modified >file1 &&
-	test-chmtime =1000000000 file2 &&
+	test-tool chmtime =1000000000 file2 &&
 	git update-index -q --refresh &&
 	git checkout HEAD -- file1 file2 &&
 	echo one >expect &&
 	test_cmp expect file1 &&
 	echo "1000000000	file2" >expect &&
-	test-chmtime -v +0 file2 >actual &&
+	test-tool chmtime -v +0 file2 >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh
index 86bf909ee3..61748088eb 100755
--- a/t/t3306-notes-prune.sh
+++ b/t/t3306-notes-prune.sh
@@ -22,7 +22,7 @@ test_expect_success 'setup: create a few commits with notes' '
 	git commit -m 3rd &&
 	COMMIT_FILE=.git/objects/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
 	test -f $COMMIT_FILE &&
-	test-chmtime =+0 $COMMIT_FILE &&
+	test-tool chmtime =+0 $COMMIT_FILE &&
 	git notes add -m "Note #3"
 '
 
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 3b905406df..961ac9d6b8 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -711,13 +711,13 @@ test_expect_success 'rebase -i continue with unstaged submodule' '
 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
 '
 
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index 7c91a85f43..9214d0bb51 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -24,7 +24,7 @@ test_expect_success 'interactive rebase --continue works with touched file' '
 	git checkout master &&
 
 	FAKE_LINES="edit 1" git rebase -i HEAD^ &&
-	test-chmtime =-60 F1 &&
+	test-tool chmtime =-60 F1 &&
 	git rebase --continue
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'non-interactive rebase --continue works with touched file'
 	test_must_fail git rebase --onto master master topic &&
 	echo "Resolved" >F2 &&
 	git add F2 &&
-	test-chmtime =-60 F1 &&
+	test-tool chmtime =-60 F1 &&
 	git rebase --continue
 '
 
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 783bdbf59d..ccbc118514 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -86,7 +86,7 @@ test_expect_success 'cherry-pick on stat-dirty working tree' '
 	(
 		cd copy &&
 		git checkout initial &&
-		test-chmtime +40 oops &&
+		test-tool chmtime +40 oops &&
 		git cherry-pick added
 	)
 '
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index 0acf4b1461..9f93445f1e 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -247,9 +247,9 @@ test_expect_success '--abort after last commit in sequence' '
 test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
 	pristine_detach initial &&
 	test_expect_code 1 git cherry-pick base..anotherpick &&
-	test-chmtime -v +0 .git/sequencer >expect &&
+	test-tool chmtime -v +0 .git/sequencer >expect &&
 	test_expect_code 128 git cherry-pick unrelatedpick &&
-	test-chmtime -v +0 .git/sequencer >actual &&
+	test-tool chmtime -v +0 .git/sequencer >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 46f15169f5..b8fbdefcdc 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -232,7 +232,7 @@ test_expect_success 'Call "rm" from outside the work tree' '
 test_expect_success 'refresh index before checking if it is up-to-date' '
 
 	git reset --hard &&
-	test-chmtime -86400 frotz/nitfol &&
+	test-tool chmtime -86400 frotz/nitfol &&
 	git rm frotz/nitfol &&
 	test ! -f frotz/nitfol
 
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 2748805642..07af05d7ae 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -187,7 +187,7 @@ test_expect_success 'git add --refresh with pathspec' '
 	echo >foo && echo >bar && echo >baz &&
 	git add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&
 	echo "100644 $H 3	foo" | git update-index --index-info &&
-	test-chmtime -60 bar baz &&
+	test-tool chmtime -60 bar baz &&
 	>expect &&
 	git add --refresh bar >actual &&
 	test_cmp expect actual &&
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index 13e7f621ab..cf0f3a1ee7 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -73,7 +73,7 @@ test_expect_success 'diff identical, but newly created symlink and file' '
 	>expected &&
 	rm -f frotz nitfol &&
 	echo xyzzy >nitfol &&
-	test-chmtime +10 nitfol &&
+	test-tool chmtime +10 nitfol &&
 	if test_have_prereq SYMLINKS
 	then
 		ln -s xyzzy frotz
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 3f9a24fd56..f8d853595b 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -76,7 +76,7 @@ test_expect_success setup '
 
 	mkdir dir3 &&
 	cp dir/sub dir3/sub &&
-	test-chmtime +1 dir3/sub &&
+	test-tool chmtime +1 dir3/sub &&
 
 	git config log.showroot false &&
 	git commit --amend &&
diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh
index 2f1737fcef..0352bf81a9 100755
--- a/t/t4035-diff-quiet.sh
+++ b/t/t4035-diff-quiet.sh
@@ -147,7 +147,7 @@ test_expect_success 'git diff --ignore-all-space, both files outside repo' '
 '
 
 test_expect_success 'git diff --quiet ignores stat-change only entries' '
-	test-chmtime +10 a &&
+	test-tool chmtime +10 a &&
 	echo modified >>b &&
 	test_expect_code 1 git diff --quiet
 '
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 16432781d2..9d8d3c72e7 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -171,7 +171,7 @@ test_expect_success 'am --skip leaves index stat info alone' '
 	git checkout -f --orphan skip-stat-info &&
 	git reset &&
 	test_commit skip-should-be-untouched &&
-	test-chmtime =0 skip-should-be-untouched.t &&
+	test-tool chmtime =0 skip-should-be-untouched.t &&
 	git update-index --refresh &&
 	git diff-files --exit-code --quiet &&
 	test_must_fail git am 0001-*.patch &&
@@ -183,7 +183,7 @@ test_expect_success 'am --abort leaves index stat info alone' '
 	git checkout -f --orphan abort-stat-info &&
 	git reset &&
 	test_commit abort-should-be-untouched &&
-	test-chmtime =0 abort-should-be-untouched.t &&
+	test-tool chmtime =0 abort-should-be-untouched.t &&
 	git update-index --refresh &&
 	git diff-files --exit-code --quiet &&
 	test_must_fail git am 0001-*.patch &&
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index d97d2bebc9..deafaa3e07 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -166,7 +166,7 @@ test_expect_success 'first postimage wins' '
 	git commit -q -a -m "prefer first over second" &&
 	test -f $rr/postimage &&
 
-	oldmtimepost=$(test-chmtime -v -60 $rr/postimage | cut -f 1) &&
+	oldmtimepost=$(test-tool chmtime -v -60 $rr/postimage | cut -f 1) &&
 
 	git checkout -b third master &&
 	git show second^:a1 | sed "s/To die: t/To die! T/" >a1 &&
@@ -179,7 +179,7 @@ test_expect_success 'first postimage wins' '
 '
 
 test_expect_success 'rerere updates postimage timestamp' '
-	newmtimepost=$(test-chmtime -v +0 $rr/postimage | cut -f 1) &&
+	newmtimepost=$(test-tool chmtime -v +0 $rr/postimage | cut -f 1) &&
 	test $oldmtimepost -lt $newmtimepost
 '
 
@@ -220,9 +220,9 @@ test_expect_success 'set up for garbage collection tests' '
 	almost_60_days_ago=$((60-60*86400)) &&
 	just_over_60_days_ago=$((-1-60*86400)) &&
 
-	test-chmtime =$just_over_60_days_ago $rr/preimage &&
-	test-chmtime =$almost_60_days_ago $rr/postimage &&
-	test-chmtime =$almost_15_days_ago $rr2/preimage
+	test-tool chmtime =$just_over_60_days_ago $rr/preimage &&
+	test-tool chmtime =$almost_60_days_ago $rr/postimage &&
+	test-tool chmtime =$almost_15_days_ago $rr2/preimage
 '
 
 test_expect_success 'gc preserves young or recently used records' '
@@ -232,8 +232,8 @@ test_expect_success 'gc preserves young or recently used records' '
 '
 
 test_expect_success 'old records rest in peace' '
-	test-chmtime =$just_over_60_days_ago $rr/postimage &&
-	test-chmtime =$just_over_15_days_ago $rr2/preimage &&
+	test-tool chmtime =$just_over_60_days_ago $rr/postimage &&
+	test-tool chmtime =$just_over_15_days_ago $rr2/preimage &&
 	git rerere gc &&
 	! test -f $rr/preimage &&
 	! test -f $rr2/preimage
@@ -249,8 +249,8 @@ rerere_gc_custom_expiry_test () {
 		>"$rr/postimage" &&
 
 		two_days_ago=$((-2*86400)) &&
-		test-chmtime =$two_days_ago "$rr/preimage" &&
-		test-chmtime =$two_days_ago "$rr/postimage" &&
+		test-tool chmtime =$two_days_ago "$rr/preimage" &&
+		test-tool chmtime =$two_days_ago "$rr/postimage" &&
 
 		find .git/rr-cache -type f | sort >original &&
 
@@ -512,7 +512,7 @@ test_expect_success 'multiple identical conflicts' '
 	count_pre_post 2 0 &&
 
 	# Pretend that the conflicts were made quite some time ago
-	find .git/rr-cache/ -type f | xargs test-chmtime -172800 &&
+	find .git/rr-cache/ -type f | xargs test-tool chmtime -172800 &&
 
 	# Unresolved entries have not expired yet
 	git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
@@ -568,7 +568,7 @@ test_expect_success 'multiple identical conflicts' '
 	git rerere &&
 
 	# Pretend that the resolutions are old again
-	find .git/rr-cache/ -type f | xargs test-chmtime -172800 &&
+	find .git/rr-cache/ -type f | xargs test-tool chmtime -172800 &&
 
 	# Resolved entries have not expired yet
 	git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index fe2d4f15a7..266d052efb 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -192,7 +192,7 @@ test_expect_success \
     'validate file modification time' \
     'mkdir extract &&
      "$TAR" xf b.tar -C extract a/a &&
-     test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
+     test-tool chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
      echo "1117231200" >expected.mtime &&
      test_cmp expected.mtime b.mtime'
 
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 6694c19a1e..f0f6e2a5f3 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -15,7 +15,7 @@ add_blob() {
 	BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =+0 $BLOB_FILE
+	test-tool chmtime =+0 $BLOB_FILE
 }
 
 test_expect_success setup '
@@ -33,7 +33,7 @@ test_expect_success 'prune stale packs' '
 	orig_pack=$(echo .git/objects/pack/*.pack) &&
 	: > .git/objects/tmp_1.pack &&
 	: > .git/objects/tmp_2.pack &&
-	test-chmtime =-86501 .git/objects/tmp_1.pack &&
+	test-tool chmtime =-86501 .git/objects/tmp_1.pack &&
 	git prune --expire 1.day &&
 	test_path_is_file $orig_pack &&
 	test_path_is_file .git/objects/tmp_2.pack &&
@@ -47,7 +47,7 @@ test_expect_success 'prune --expire' '
 	git prune --expire=1.hour.ago &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =-86500 $BLOB_FILE &&
+	test-tool chmtime =-86500 $BLOB_FILE &&
 	git prune --expire 1.day &&
 	verbose test $before = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_missing $BLOB_FILE
@@ -57,11 +57,11 @@ test_expect_success 'prune --expire' '
 test_expect_success 'gc: implicit prune --expire' '
 
 	add_blob &&
-	test-chmtime =-$((2*$week-30)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week-30)) $BLOB_FILE &&
 	git gc &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
 	git gc &&
 	verbose test $before = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_missing $BLOB_FILE
@@ -141,7 +141,7 @@ test_expect_success 'prune: do not prune heads listed as an argument' '
 test_expect_success 'gc --no-prune' '
 
 	add_blob &&
-	test-chmtime =-$((5001*$day)) $BLOB_FILE &&
+	test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
 	git config gc.pruneExpire 2.days.ago &&
 	git gc --no-prune &&
 	verbose test 1 = $(git count-objects | sed "s/ .*//") &&
@@ -163,7 +163,7 @@ test_expect_success 'gc respects gc.pruneExpire' '
 test_expect_success 'gc --prune=<date>' '
 
 	add_blob &&
-	test-chmtime =-$((5001*$day)) $BLOB_FILE &&
+	test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
 	git gc --prune=5002.days.ago &&
 	test_path_is_file $BLOB_FILE &&
 	git gc --prune=5000.days.ago &&
@@ -205,7 +205,7 @@ test_expect_success 'prune --expire=never' '
 
 test_expect_success 'gc: prune old objects after local clone' '
 	add_blob &&
-	test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
 	git clone --no-hardlinks . aclone &&
 	(
 		cd aclone &&
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index d375d7110d..911eae1bf7 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -180,7 +180,7 @@ test_expect_success 'receive-pack runs auto-gc in remote repo' '
 	    # And create a file that follows the temporary object naming
 	    # convention for the auto-gc to remove
 	    : >.git/objects/tmp_test_object &&
-	    test-chmtime =-1209601 .git/objects/tmp_test_object
+	    test-tool chmtime =-1209601 .git/objects/tmp_test_object
 	) &&
 	(
 	    cd parent &&
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 177897ea0b..82239138d5 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1418,7 +1418,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
 		cd testrepo &&
 		git reset --hard HEAD^ &&
 		test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
-		test-chmtime +100 path1
+		test-tool chmtime +100 path1
 	) &&
 	git push testrepo master &&
 	(
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index c01f721f13..a1fad6980b 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -635,10 +635,10 @@ test_expect_success 'setup avoid unnecessary update, normal rename' '
 
 test_expect_success 'avoid unnecessary update, normal rename' '
 	git checkout -q avoid-unnecessary-update-1^0 &&
-	test-chmtime =1000000000 rename &&
-	test-chmtime -v +0 rename >expect &&
+	test-tool chmtime =1000000000 rename &&
+	test-tool chmtime -v +0 rename >expect &&
 	git merge merge-branch-1 &&
-	test-chmtime -v +0 rename >actual &&
+	test-tool chmtime -v +0 rename >actual &&
 	test_cmp expect actual # "rename" should have stayed intact
 '
 
@@ -668,10 +668,10 @@ test_expect_success 'setup to test avoiding unnecessary update, with D/F conflic
 
 test_expect_success 'avoid unnecessary update, with D/F conflict' '
 	git checkout -q avoid-unnecessary-update-2^0 &&
-	test-chmtime =1000000000 df &&
-	test-chmtime -v +0 df >expect &&
+	test-tool chmtime =1000000000 df &&
+	test-tool chmtime -v +0 df >expect &&
 	git merge merge-branch-2 &&
-	test-chmtime -v +0 df >actual &&
+	test-tool chmtime -v +0 df >actual &&
 	test_cmp expect actual # "df" should have stayed intact
 '
 
@@ -700,10 +700,10 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '
 
 test_expect_success 'avoid unnecessary update, dir->(file,nothing)' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 df &&
-	test-chmtime -v +0 df >expect &&
+	test-tool chmtime =1000000000 df &&
+	test-tool chmtime -v +0 df >expect &&
 	git merge side &&
-	test-chmtime -v +0 df >actual &&
+	test-tool chmtime -v +0 df >actual &&
 	test_cmp expect actual # "df" should have stayed intact
 '
 
@@ -730,10 +730,10 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '
 
 test_expect_success 'avoid unnecessary update, modify/delete' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 file &&
-	test-chmtime -v +0 file >expect &&
+	test-tool chmtime =1000000000 file &&
+	test-tool chmtime -v +0 file >expect &&
 	test_must_fail git merge side &&
-	test-chmtime -v +0 file >actual &&
+	test-tool chmtime -v +0 file >actual &&
 	test_cmp expect actual # "file" should have stayed intact
 '
 
@@ -759,10 +759,10 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '
 
 test_expect_success 'avoid unnecessary update, rename/add-dest' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 newfile &&
-	test-chmtime -v +0 newfile >expect &&
+	test-tool chmtime =1000000000 newfile &&
+	test-tool chmtime -v +0 newfile >expect &&
 	git merge side &&
-	test-chmtime -v +0 newfile >actual &&
+	test-tool chmtime -v +0 newfile >actual &&
 	test_cmp expect actual # "file" should have stayed intact
 '
 
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 41b0be575d..d5255dd576 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -87,7 +87,7 @@ test_expect_success 'background auto gc does not run if gc.log is present and re
 	test_must_fail git gc --auto 2>err &&
 	test_i18ngrep "^error:" err &&
 	test_config gc.logexpiry 5.days &&
-	test-chmtime =-345600 .git/gc.log &&
+	test-tool chmtime =-345600 .git/gc.log &&
 	test_must_fail git gc --auto &&
 	test_config gc.logexpiry 2.days &&
 	run_and_wait_for_auto_gc &&
diff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh
index 394b169ead..765cced60b 100755
--- a/t/t6501-freshen-objects.sh
+++ b/t/t6501-freshen-objects.sh
@@ -73,7 +73,7 @@ for repack in '' true; do
 
 	test_expect_success "simulate time passing ($title)" '
 		find .git/objects -type f |
-		xargs test-chmtime -v -86400
+		xargs test-tool chmtime -v -86400
 	'
 
 	test_expect_success "start writing new commit with old blob ($title)" '
@@ -104,7 +104,7 @@ for repack in '' true; do
 	test_expect_success "abandon objects again ($title)" '
 		git reset --hard HEAD^ &&
 		find .git/objects -type f |
-		xargs test-chmtime -v -86400
+		xargs test-tool chmtime -v -86400
 	'
 
 	test_expect_success "start writing new commit with same tree ($title)" '
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 50052e2872..7afadb175a 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1672,12 +1672,12 @@ test_expect_success '"Initial commit" should not be noted in commit template' '
 '
 
 test_expect_success '--no-optional-locks prevents index update' '
-	test-chmtime =1234567890 .git/index &&
+	test-tool chmtime =1234567890 .git/index &&
 	git --no-optional-locks status &&
-	test-chmtime -v +0 .git/index >out &&
+	test-tool chmtime -v +0 .git/index >out &&
 	grep ^1234567890 out &&
 	git status &&
-	test-chmtime -v +0 .git/index >out &&
+	test-tool chmtime -v +0 .git/index >out &&
 	! grep ^1234567890 out
 '
 
diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh
index 987573c41f..8a586ab021 100755
--- a/t/t7701-repack-unpack-unreachable.sh
+++ b/t/t7701-repack-unpack-unreachable.sh
@@ -90,7 +90,7 @@ test_expect_success 'unpacked objects receive timestamp of pack file' '
 	tmppack=".git/objects/pack/tmp_pack" &&
 	ln "$packfile" "$tmppack" &&
 	git repack -A -l -d &&
-	test-chmtime -v +0 "$tmppack" "$fsha1path" "$csha1path" "$tsha1path" \
+	test-tool chmtime -v +0 "$tmppack" "$fsha1path" "$csha1path" "$tsha1path" \
 		> mtimes &&
 	compare_mtimes < mtimes
 '
@@ -103,7 +103,7 @@ test_expect_success 'do not bother loosening old objects' '
 	git prune-packed &&
 	git cat-file -p $obj1 &&
 	git cat-file -p $obj2 &&
-	test-chmtime =-86400 .git/objects/pack/pack-$pack2.pack &&
+	test-tool chmtime =-86400 .git/objects/pack/pack-$pack2.pack &&
 	git repack -A -d --unpack-unreachable=1.hour.ago &&
 	git cat-file -p $obj1 &&
 	test_must_fail git cat-file -p $obj2
@@ -117,7 +117,7 @@ test_expect_success 'keep packed objects found only in index' '
 	git reset HEAD^ &&
 	git reflog expire --expire=now --all &&
 	git add file &&
-	test-chmtime =-86400 .git/objects/pack/* &&
+	test-tool chmtime =-86400 .git/objects/pack/* &&
 	git gc --prune=1.hour.ago &&
 	git cat-file blob :file
 '
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 8a8ba65a2a..c937330a5f 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -288,12 +288,12 @@ test_expect_success 'able to dcommit to a subdirectory' '
 
 test_expect_success 'dcommit should not fail with a touched file' '
 	test_commit "commit-new-file-foo2" foo2 &&
-	test-chmtime =-60 foo &&
+	test-tool chmtime =-60 foo &&
 	git svn dcommit
 '
 
 test_expect_success 'rebase should not fail with a touched file' '
-	test-chmtime =-60 foo &&
+	test-tool chmtime =-60 foo &&
 	git svn rebase
 '
 
diff --git a/t/t9803-git-p4-shell-metachars.sh b/t/t9803-git-p4-shell-metachars.sh
index d950c7d665..d5c3675100 100755
--- a/t/t9803-git-p4-shell-metachars.sh
+++ b/t/t9803-git-p4-shell-metachars.sh
@@ -28,7 +28,7 @@ test_expect_success 'shell metachars in filenames' '
 		echo f2 >"file with spaces" &&
 		git add "file with spaces" &&
 		git commit -m "add files" &&
-		P4EDITOR="test-chmtime +5" git p4 submit
+		P4EDITOR="test-tool chmtime +5" git p4 submit
 	) &&
 	(
 		cd "$cli" &&
@@ -47,7 +47,7 @@ test_expect_success 'deleting with shell metachars' '
 		git rm foo\$bar &&
 		git rm file\ with\ spaces &&
 		git commit -m "remove files" &&
-		P4EDITOR="test-chmtime +5" git p4 submit
+		P4EDITOR="test-tool chmtime +5" git p4 submit
 	) &&
 	(
 		cd "$cli" &&
diff --git a/t/t9813-git-p4-preserve-users.sh b/t/t9813-git-p4-preserve-users.sh
index bda222aa02..783c6ad165 100755
--- a/t/t9813-git-p4-preserve-users.sh
+++ b/t/t9813-git-p4-preserve-users.sh
@@ -53,7 +53,7 @@ test_expect_success 'preserve users' '
 		git commit --author "Alice <alice@example.com>" -m "a change by alice" file1 &&
 		git commit --author "Bob <bob@example.com>" -m "a change by bob" file2 &&
 		git config git-p4.skipSubmitEditCheck true &&
-		P4EDITOR="test-chmtime +5" P4USER=alice P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=alice P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		git p4 commit --preserve-user &&
 		p4_check_commit_author file1 alice &&
@@ -71,7 +71,7 @@ test_expect_success 'refuse to preserve users without perms' '
 		git config git-p4.skipSubmitEditCheck true &&
 		echo "username-noperms: a change by alice" >>file1 &&
 		git commit --author "Alice <alice@example.com>" -m "perms: a change by alice" file1 &&
-		P4EDITOR="test-chmtime +5" P4USER=bob P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=bob P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		test_must_fail git p4 commit --preserve-user &&
 		! git diff --exit-code HEAD..p4/master
@@ -89,7 +89,7 @@ test_expect_success 'preserve user where author is unknown to p4' '
 		git commit --author "Bob <bob@example.com>" -m "preserve: a change by bob" file1 &&
 		echo "username-unknown: a change by charlie" >>file1 &&
 		git commit --author "Charlie <charlie@example.com>" -m "preserve: a change by charlie" file1 &&
-		P4EDITOR="test-chmtime +5" P4USER=alice P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=alice P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		test_must_fail git p4 commit --preserve-user &&
 		! git diff --exit-code HEAD..p4/master &&
diff --git a/t/t9820-git-p4-editor-handling.sh b/t/t9820-git-p4-editor-handling.sh
index 6dc6df032e..3c22f74bd4 100755
--- a/t/t9820-git-p4-editor-handling.sh
+++ b/t/t9820-git-p4-editor-handling.sh
@@ -26,7 +26,7 @@ test_expect_success 'EDITOR with options' '
 		cd "$git" &&
 		echo change >file1 &&
 		git commit -m "change" file1 &&
-		P4EDITOR=": >\"$git/touched\" && test-chmtime +5" git p4 submit &&
+		P4EDITOR=": >\"$git/touched\" && test-tool chmtime +5" git p4 submit &&
 		test_path_is_file "$git/touched"
 	)
 '
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7740d511d2..7ab8af47a5 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -963,10 +963,10 @@ test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
 }
 
-if ! test -x "$GIT_BUILD_DIR"/t/helper/test-chmtime
+if ! test -x "$GIT_BUILD_DIR"/t/helper/test-tool
 then
-	echo >&2 'You need to build test-chmtime:'
-	echo >&2 'Run "make t/helper/test-chmtime" in the source (toplevel) directory'
+	echo >&2 'You need to build test-tool:'
+	echo >&2 'Run "make t/helper/test-tool" in the source (toplevel) directory'
 	exit 1
 fi
 
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 03/36] t/helper: merge test-sha1 into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 04/36] t/helper: merge test-lazy-init-name-hash " Nguyễn Thái Ngọc Duy
                   ` (34 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/howto/recover-corrupted-object-harder.txt | 2 +-
 Makefile                                                | 4 ++--
 t/helper/test-sha1.c                                    | 3 ++-
 t/helper/test-sha1.sh                                   | 4 ++--
 t/helper/test-tool.c                                    | 1 +
 t/helper/test-tool.h                                    | 1 +
 t/lib-pack.sh                                           | 2 +-
 t/t0013-sha1dc.sh                                       | 2 +-
 8 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Documentation/howto/recover-corrupted-object-harder.txt b/Documentation/howto/recover-corrupted-object-harder.txt
index 9c4cd0915f..8994e2559e 100644
--- a/Documentation/howto/recover-corrupted-object-harder.txt
+++ b/Documentation/howto/recover-corrupted-object-harder.txt
@@ -80,7 +80,7 @@ valid pack like:
     # now add our object data
     cat object >>tmp.pack
     # and then append the pack trailer
-    /path/to/git.git/test-sha1 -b <tmp.pack >trailer
+    /path/to/git.git/t/helper/test-tool sha1 -b <tmp.pack >trailer
     cat trailer >>tmp.pack
 ------------
 
diff --git a/Makefile b/Makefile
index 416a8e39c1..3c0d0474af 100644
--- a/Makefile
+++ b/Makefile
@@ -653,6 +653,7 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-config
@@ -684,7 +685,6 @@ 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
@@ -2502,7 +2502,7 @@ 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))
diff --git a/t/helper/test-sha1.c b/t/helper/test-sha1.c
index a1c13f54ec..afee24e027 100644
--- a/t/helper/test-sha1.c
+++ b/t/helper/test-sha1.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int ac, const char **av)
+int test_sha1(int ac, const char **av)
 {
 	git_SHA_CTX ctx;
 	unsigned char sha1[20];
diff --git a/t/helper/test-sha1.sh b/t/helper/test-sha1.sh
index 750b95a0a1..84594885c7 100755
--- a/t/helper/test-sha1.sh
+++ b/t/helper/test-sha1.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
-/usr/bin/time t/helper/test-sha1 >/dev/null
+/usr/bin/time t/helper/test-tool sha1 >/dev/null
 
 while read expect cnt pfx
 do
@@ -11,7 +11,7 @@ do
 			test -z "$pfx" || echo "$pfx"
 			dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
 			perl -pe 'y/\000/g/'
-		} | ./t/helper/test-sha1 $cnt
+		} | ./t/helper/test-tool sha1 $cnt
 	)
 	if test "$expect" = "$actual"
 	then
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index c22f300f5e..ca1f462cce 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", test_chmtime },
+	{ "sha1", test_sha1 },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 61ca4a7055..e7a2a7cb5b 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,5 +2,6 @@
 #define __TEST_TOOL_H__
 
 int test_chmtime(int argc, const char **argv);
+int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/lib-pack.sh b/t/lib-pack.sh
index 7509846571..501078249d 100644
--- a/t/lib-pack.sh
+++ b/t/lib-pack.sh
@@ -85,7 +85,7 @@ pack_obj () {
 
 # Compute and append pack trailer to "$1"
 pack_trailer () {
-	test-sha1 -b <"$1" >trailer.tmp &&
+	test-tool sha1 -b <"$1" >trailer.tmp &&
 	cat trailer.tmp >>"$1" &&
 	rm -f trailer.tmp
 }
diff --git a/t/t0013-sha1dc.sh b/t/t0013-sha1dc.sh
index 6d655cb161..419f31a8f7 100755
--- a/t/t0013-sha1dc.sh
+++ b/t/t0013-sha1dc.sh
@@ -11,7 +11,7 @@ then
 fi
 
 test_expect_success 'test-sha1 detects shattered pdf' '
-	test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
+	test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
 	test_i18ngrep collision err &&
 	grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
 '
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 04/36] t/helper: merge test-lazy-init-name-hash into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (2 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 03/36] t/helper: merge test-sha1 " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-18  2:11   ` Eric Sunshine
  2018-03-17  7:53 ` [PATCH 05/36] t/helper: merge test-config " Nguyễn Thái Ngọc Duy
                   ` (33 subsequent siblings)
  37 siblings, 1 reply; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                                |  2 +-
 cache.h                                 |  2 +-
 name-hash.c                             |  2 +-
 t/helper/test-lazy-init-name-hash.c     | 26 ++++++++++++++-----------
 t/helper/test-tool.c                    |  1 +
 t/helper/test-tool.h                    |  1 +
 t/perf/p0004-lazy-init-name-hash.sh     |  8 ++++----
 t/t3008-ls-files-lazy-init-name-hash.sh |  2 +-
 8 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index 3c0d0474af..31287cedf2 100644
--- a/Makefile
+++ b/Makefile
@@ -653,6 +653,7 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-ctype
@@ -669,7 +670,6 @@ 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
diff --git a/cache.h b/cache.h
index d06932ed0b..8ff5ae9903 100644
--- a/cache.h
+++ b/cache.h
@@ -333,7 +333,7 @@ struct index_state {
 extern struct index_state the_index;
 
 /* Name hashing */
-extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
+extern int lazy_init_name_hash_for_testing(struct index_state *istate, int try_threaded);
 extern void add_name_hash(struct index_state *istate, struct cache_entry *ce);
 extern void remove_name_hash(struct index_state *istate, struct cache_entry *ce);
 extern void free_name_hash(struct index_state *istate);
diff --git a/name-hash.c b/name-hash.c
index 163849831c..182f630acc 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -614,7 +614,7 @@ static void lazy_init_name_hash(struct index_state *istate)
  * Requesting threading WILL NOT override guards
  * in lookup_lazy_params().
  */
-int test_lazy_init_name_hash(struct index_state *istate, int try_threaded)
+int lazy_init_name_hash_for_testing(struct index_state *istate, int try_threaded)
 {
 	lazy_nr_dir_threads = 0;
 	lazy_try_threaded = try_threaded;
diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
index 297fb01d61..dd4e753008 100644
--- a/t/helper/test-lazy-init-name-hash.c
+++ b/t/helper/test-lazy-init-name-hash.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "parse-options.h"
 
@@ -9,6 +10,9 @@ static int perf;
 static int analyze;
 static int analyze_step;
 
+static int (*init_name_hash)(struct index_state *istate, int try_threaded) =
+	lazy_init_name_hash_for_testing;
+
 /*
  * Dump the contents of the "dir" and "name" hash tables to stdout.
  * If you sort the result, you can compare it with the other type
@@ -33,9 +37,9 @@ static void dump_run(void)
 
 	read_cache();
 	if (single) {
-		test_lazy_init_name_hash(&the_index, 0);
+		init_name_hash(&the_index, 0);
 	} else {
-		int nr_threads_used = test_lazy_init_name_hash(&the_index, 1);
+		int nr_threads_used = init_name_hash(&the_index, 1);
 		if (!nr_threads_used)
 			die("non-threaded code path used");
 	}
@@ -71,7 +75,7 @@ static uint64_t time_runs(int try_threaded)
 		t0 = getnanotime();
 		read_cache();
 		t1 = getnanotime();
-		nr_threads_used = test_lazy_init_name_hash(&the_index, try_threaded);
+		nr_threads_used = init_name_hash(&the_index, try_threaded);
 		t2 = getnanotime();
 
 		sum += (t2 - t1);
@@ -134,7 +138,7 @@ static void analyze_run(void)
 			read_cache();
 			the_index.cache_nr = nr; /* cheap truncate of index */
 			t1s = getnanotime();
-			test_lazy_init_name_hash(&the_index, 0);
+			init_name_hash(&the_index, 0);
 			t2s = getnanotime();
 			sum_single += (t2s - t1s);
 			the_index.cache_nr = cache_nr_limit;
@@ -143,7 +147,7 @@ static void analyze_run(void)
 			read_cache();
 			the_index.cache_nr = nr; /* cheap truncate of index */
 			t1m = getnanotime();
-			nr_threads_used = test_lazy_init_name_hash(&the_index, 1);
+			nr_threads_used = init_name_hash(&the_index, 1);
 			t2m = getnanotime();
 			sum_multi += (t2m - t1m);
 			the_index.cache_nr = cache_nr_limit;
@@ -184,14 +188,14 @@ static void analyze_run(void)
 	}
 }
 
-int cmd_main(int argc, const char **argv)
+int test_lazy_init_name_hash(int argc, const char **argv)
 {
 	const char *usage[] = {
-		"test-lazy-init-name-hash -d (-s | -m)",
-		"test-lazy-init-name-hash -p [-c c]",
-		"test-lazy-init-name-hash -a a [--step s] [-c c]",
-		"test-lazy-init-name-hash (-s | -m) [-c c]",
-		"test-lazy-init-name-hash -s -m [-c c]",
+		"test-tool lazy-init-name-hash -d (-s | -m)",
+		"test-tool lazy-init-name-hash -p [-c c]",
+		"test-tool lazy-init-name-hash -a a [--step s] [-c c]",
+		"test-tool lazy-init-name-hash (-s | -m) [-c c]",
+		"test-tool lazy-init-name-hash -s -m [-c c]",
 		NULL
 	};
 	struct option options[] = {
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index ca1f462cce..c4e9933f93 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", test_chmtime },
+	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index e7a2a7cb5b..eaec143259 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,6 +2,7 @@
 #define __TEST_TOOL_H__
 
 int test_chmtime(int argc, const char **argv);
+int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/perf/p0004-lazy-init-name-hash.sh b/t/perf/p0004-lazy-init-name-hash.sh
index 8de5a98cfc..1afc08fe7f 100755
--- a/t/perf/p0004-lazy-init-name-hash.sh
+++ b/t/perf/p0004-lazy-init-name-hash.sh
@@ -7,8 +7,8 @@ test_perf_large_repo
 test_checkout_worktree
 
 test_expect_success 'verify both methods build the same hashmaps' '
-	test-lazy-init-name-hash --dump --single >out.single &&
-	if test-lazy-init-name-hash --dump --multi >out.multi
+	test-tool lazy-init-name-hash --dump --single >out.single &&
+	if test-tool lazy-init-name-hash --dump --multi >out.multi
 	then
 		test_set_prereq REPO_BIG_ENOUGH_FOR_MULTI &&
 		sort <out.single >sorted.single &&
@@ -46,11 +46,11 @@ test_expect_success 'calibrate' '
 '
 
 test_perf "single-threaded, $desc" "
-	test-lazy-init-name-hash --single --count=$count
+	test-tool lazy-init-name-hash --single --count=$count
 "
 
 test_perf REPO_BIG_ENOUGH_FOR_MULTI "multi-threaded, $desc" "
-	test-lazy-init-name-hash --multi --count=$count
+	test-tool lazy-init-name-hash --multi --count=$count
 "
 
 test_done
diff --git a/t/t3008-ls-files-lazy-init-name-hash.sh b/t/t3008-ls-files-lazy-init-name-hash.sh
index bdf5198b7e..8df4aa7c99 100755
--- a/t/t3008-ls-files-lazy-init-name-hash.sh
+++ b/t/t3008-ls-files-lazy-init-name-hash.sh
@@ -21,7 +21,7 @@ test_expect_success 'no buffer overflow in lazy_init_name_hash' '
 	) |
 	sed "s/^/100644 $EMPTY_BLOB	/" |
 	git update-index --index-info &&
-	test-lazy-init-name-hash -m
+	test-tool lazy-init-name-hash -m
 '
 
 test_done
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 05/36] t/helper: merge test-config into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (3 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 04/36] t/helper: merge test-lazy-init-name-hash " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 06/36] t/helper: merge test-ctype " Nguyễn Thái Ngọc Duy
                   ` (32 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                  |  2 +-
 t/helper/test-config.c    |  5 +++--
 t/helper/test-tool.c      |  1 +
 t/helper/test-tool.h      |  1 +
 t/t1305-config-include.sh |  2 +-
 t/t1308-config-set.sh     | 22 +++++++++++-----------
 t/t1309-early-config.sh   | 12 ++++++------
 7 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile
index 31287cedf2..227f16ad17 100644
--- a/Makefile
+++ b/Makefile
@@ -653,11 +653,11 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-config.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 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
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 1a7b8bd3d6..b91cac2c6f 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "config.h"
 #include "string-list.h"
@@ -32,7 +33,7 @@
  * Examples:
  *
  * To print the value with highest priority for key "foo.bAr Baz.rock":
- * 	test-config get_value "foo.bAr Baz.rock"
+ * 	test-tool config get_value "foo.bAr Baz.rock"
  *
  */
 
@@ -77,7 +78,7 @@ static int early_config_cb(const char *var, const char *value, void *vdata)
 	return 0;
 }
 
-int cmd_main(int argc, const char **argv)
+int test_config(int argc, const char **argv)
 {
 	int i, val;
 	const char *v;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index c4e9933f93..64d1632d92 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", test_chmtime },
+	{ "config", test_config },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index eaec143259..00eef888fa 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,6 +2,7 @@
 #define __TEST_TOOL_H__
 
 int test_chmtime(int argc, const char **argv);
+int test_config(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
index d9d2f545a4..f035ee40a3 100755
--- a/t/t1305-config-include.sh
+++ b/t/t1305-config-include.sh
@@ -224,7 +224,7 @@ test_expect_success 'conditional include, early config reading' '
 		echo "[includeIf \"gitdir:foo/\"]path=bar6" >>.git/config &&
 		echo "[test]six=6" >.git/bar6 &&
 		echo 6 >expect &&
-		test-config read_early_config test.six >actual &&
+		test-tool config read_early_config test.six >actual &&
 		test_cmp expect actual
 	)
 '
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index bafed5c9b8..3e00d1af01 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -18,7 +18,7 @@ check_config () {
 	then
 		printf "%s\n" "$@"
 	fi >expect &&
-	test_expect_code $expect_code test-config "$op" "$key" >actual &&
+	test_expect_code $expect_code test-tool config "$op" "$key" >actual &&
 	test_cmp expect actual
 }
 
@@ -125,7 +125,7 @@ test_expect_success 'find string value for a key' '
 '
 
 test_expect_success 'check line error when NULL string is queried' '
-	test_expect_code 128 test-config get_string case.foo 2>result &&
+	test_expect_code 128 test-tool config get_string case.foo 2>result &&
 	test_i18ngrep "fatal: .*case\.foo.*\.git/config.*line 7" result
 '
 
@@ -155,13 +155,13 @@ test_expect_success 'find value from a configset' '
 		baz = ball
 	EOF
 	echo silk >expect &&
-	test-config configset_get_value my.new config2 .git/config >actual &&
+	test-tool config configset_get_value my.new config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'find value with highest priority from a configset' '
 	echo hask >expect &&
-	test-config configset_get_value case.baz config2 .git/config >actual &&
+	test-tool config configset_get_value case.baz config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
@@ -173,20 +173,20 @@ test_expect_success 'find value_list for a key from a configset' '
 	lama
 	ball
 	EOF
-	test-config configset_get_value case.baz config2 .git/config >actual &&
+	test-tool config configset_get_value case.baz config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'proper error on non-existent files' '
 	echo "Error (-1) reading configuration file non-existent-file." >expect &&
-	test_expect_code 2 test-config configset_get_value foo.bar non-existent-file 2>actual &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar non-existent-file 2>actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'proper error on directory "files"' '
 	echo "Error (-1) reading configuration file a-directory." >expect &&
 	mkdir a-directory &&
-	test_expect_code 2 test-config configset_get_value foo.bar a-directory 2>output &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar a-directory 2>output &&
 	grep "^warning:" output &&
 	grep "^Error" output >actual &&
 	test_cmp expect actual
@@ -196,7 +196,7 @@ test_expect_success POSIXPERM,SANITY 'proper error on non-accessible files' '
 	chmod -r .git/config &&
 	test_when_finished "chmod +r .git/config" &&
 	echo "Error (-1) reading configuration file .git/config." >expect &&
-	test_expect_code 2 test-config configset_get_value foo.bar .git/config 2>output &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar .git/config 2>output &&
 	grep "^warning:" output &&
 	grep "^Error" output >actual &&
 	test_cmp expect actual
@@ -207,14 +207,14 @@ test_expect_success 'proper error on error in default config files' '
 	test_when_finished "mv .git/config.old .git/config" &&
 	echo "[" >>.git/config &&
 	echo "fatal: bad config line 34 in file .git/config" >expect &&
-	test_expect_code 128 test-config get_value foo.bar 2>actual &&
+	test_expect_code 128 test-tool config get_value foo.bar 2>actual &&
 	test_i18ncmp expect actual
 '
 
 test_expect_success 'proper error on error in custom config files' '
 	echo "[" >>syntax-error &&
 	echo "fatal: bad config line 1 in file syntax-error" >expect &&
-	test_expect_code 128 test-config configset_get_value foo.bar syntax-error 2>actual &&
+	test_expect_code 128 test-tool config configset_get_value foo.bar syntax-error 2>actual &&
 	test_i18ncmp expect actual
 '
 
@@ -267,7 +267,7 @@ test_expect_success 'iteration shows correct origins' '
 	name=
 	scope=cmdline
 	EOF
-	GIT_CONFIG_PARAMETERS=$cmdline_config test-config iterate >actual &&
+	GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t1309-early-config.sh b/t/t1309-early-config.sh
index 3dda215e8e..413642aa56 100755
--- a/t/t1309-early-config.sh
+++ b/t/t1309-early-config.sh
@@ -6,7 +6,7 @@ test_description='Test read_early_config()'
 
 test_expect_success 'read early config' '
 	test_config early.config correct &&
-	test-config read_early_config early.config >output &&
+	test-tool config read_early_config early.config >output &&
 	test correct = "$(cat output)"
 '
 
@@ -15,7 +15,7 @@ test_expect_success 'in a sub-directory' '
 	mkdir -p sub &&
 	(
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test sub = "$(cat output)"
 '
@@ -27,7 +27,7 @@ test_expect_success 'ceiling' '
 		GIT_CEILING_DIRECTORIES="$PWD" &&
 		export GIT_CEILING_DIRECTORIES &&
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test -z "$(cat output)"
 '
@@ -42,7 +42,7 @@ test_expect_success 'ceiling #2' '
 		GIT_CEILING_DIRECTORIES="$PWD" &&
 		export GIT_CEILING_DIRECTORIES XDG_CONFIG_HOME &&
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test xdg = "$(cat output)"
 '
@@ -54,7 +54,7 @@ test_expect_success 'read config file in right order' '
 	(
 		cd foo &&
 		echo "[test]source = repo" >>.git/config &&
-		GIT_CONFIG_PARAMETERS=$cmdline_config test-config \
+		GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config \
 			read_early_config test.source >actual &&
 		cat >expected <<-\EOF &&
 		home
@@ -71,7 +71,7 @@ test_with_config () {
 	(
 		cd throwaway &&
 		echo "$*" >.git/config &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	)
 }
 
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 06/36] t/helper: merge test-ctype into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (4 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 05/36] t/helper: merge test-config " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 07/36] t/helper: merge test-date " Nguyễn Thái Ngọc Duy
                   ` (31 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile               | 2 +-
 t/helper/test-ctype.c  | 3 ++-
 t/helper/test-tool.c   | 1 +
 t/helper/test-tool.h   | 1 +
 t/t0070-fundamental.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 227f16ad17..d09710dc3d 100644
--- a/Makefile
+++ b/Makefile
@@ -654,10 +654,10 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
 TEST_BUILTINS_OBJS += test-config.o
+TEST_BUILTINS_OBJS += test-ctype.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-date
 TEST_PROGRAMS_NEED_X += test-delta
 TEST_PROGRAMS_NEED_X += test-drop-caches
diff --git a/t/helper/test-ctype.c b/t/helper/test-ctype.c
index bb72c47df5..a1b0fb344a 100644
--- a/t/helper/test-ctype.c
+++ b/t/helper/test-ctype.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 
 static int rc;
@@ -28,7 +29,7 @@ static int is_in(const char *s, int ch)
 #define LOWER "abcdefghijklmnopqrstuvwxyz"
 #define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
-int cmd_main(int argc, const char **argv)
+int test_ctype(int argc, const char **argv)
 {
 	TEST_CLASS(isdigit, DIGIT);
 	TEST_CLASS(isspace, " \n\r\t");
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 64d1632d92..eef6a8e003 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -9,6 +9,7 @@ struct test_cmd {
 static struct test_cmd cmds[] = {
 	{ "chmtime", test_chmtime },
 	{ "config", test_config },
+	{ "ctype", test_ctype },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 00eef888fa..41620666e3 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -3,6 +3,7 @@
 
 int test_chmtime(int argc, const char **argv);
 int test_config(int argc, const char **argv);
+int test_ctype(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 991ed2a48d..70d4d98a2e 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -9,7 +9,7 @@ Verify wrappers and compatibility functions.
 . ./test-lib.sh
 
 test_expect_success 'character classes (isspace, isalpha etc.)' '
-	test-ctype
+	test-tool ctype
 '
 
 test_expect_success 'mktemp to nonexistent directory prints filename' '
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 07/36] t/helper: merge test-date into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (5 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 06/36] t/helper: merge test-ctype " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 08/36] t/helper: merge (unused) test-delta " Nguyễn Thái Ngọc Duy
                   ` (30 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile               |  2 +-
 t/helper/test-date.c   | 17 +++++++++--------
 t/helper/test-tool.c   |  1 +
 t/helper/test-tool.h   |  1 +
 t/t0006-date.sh        |  8 ++++----
 t/t1300-repo-config.sh |  2 +-
 t/test-lib.sh          |  4 ++--
 7 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index d09710dc3d..efb1872c52 100644
--- a/Makefile
+++ b/Makefile
@@ -655,10 +655,10 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-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
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index ac83687970..96f4631c35 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -1,13 +1,14 @@
+#include "test-tool.h"
 #include "cache.h"
 
 static const char *usage_msg = "\n"
-"  test-date relative [time_t]...\n"
-"  test-date show:<format> [time_t]...\n"
-"  test-date parse [date]...\n"
-"  test-date approxidate [date]...\n"
-"  test-date timestamp [date]...\n"
-"  test-date is64bit\n"
-"  test-date time_t-is64bit\n";
+"  test-tool date relative [time_t]...\n"
+"  test-tool date show:<format> [time_t]...\n"
+"  test-tool date parse [date]...\n"
+"  test-tool date approxidate [date]...\n"
+"  test-tool date timestamp [date]...\n"
+"  test-tool date is64bit\n"
+"  test-tool date time_t-is64bit\n";
 
 static void show_relative_dates(const char **argv, struct timeval *now)
 {
@@ -81,7 +82,7 @@ static void parse_approx_timestamp(const char **argv, struct timeval *now)
 	}
 }
 
-int cmd_main(int argc, const char **argv)
+int test_date(int argc, const char **argv)
 {
 	struct timeval now;
 	const char *x;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index eef6a8e003..fe130ffbf2 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -10,6 +10,7 @@ static struct test_cmd cmds[] = {
 	{ "chmtime", test_chmtime },
 	{ "config", test_config },
 	{ "ctype", test_ctype },
+	{ "date", test_date },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 41620666e3..99ca1176dc 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -4,6 +4,7 @@
 int test_chmtime(int argc, const char **argv);
 int test_config(int argc, const char **argv);
 int test_ctype(int argc, const char **argv);
+int test_date(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 7ac9466d50..64ff86df8e 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -10,7 +10,7 @@ check_relative() {
 	t=$(($TEST_DATE_NOW - $1))
 	echo "$t -> $2" >expect
 	test_expect_${3:-success} "relative date ($2)" "
-	test-date relative $t >actual &&
+	test-tool date relative $t >actual &&
 	test_i18ncmp expect actual
 	"
 }
@@ -35,7 +35,7 @@ check_show () {
 	zone=$5
 	test_expect_success $prereqs "show date ($format:$time)" '
 		echo "$time -> $expect" >expect &&
-		TZ=${zone:-$TZ} test-date show:"$format" "$time" >actual &&
+		TZ=${zone:-$TZ} test-tool date show:"$format" "$time" >actual &&
 		test_cmp expect actual
 	'
 }
@@ -71,7 +71,7 @@ check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT,TIME_T_
 check_parse() {
 	echo "$1 -> $2" >expect
 	test_expect_${4:-success} "parse date ($1${3:+ TZ=$3})" "
-	TZ=${3:-$TZ} test-date parse '$1' >actual &&
+	TZ=${3:-$TZ} test-tool date parse '$1' >actual &&
 	test_cmp expect actual
 	"
 }
@@ -92,7 +92,7 @@ check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 -0500' EST5
 check_approxidate() {
 	echo "$1 -> $2 +0000" >expect
 	test_expect_${3:-success} "parse approxidate ($1)" "
-	test-date approxidate '$1' >actual &&
+	test-tool date approxidate '$1' >actual &&
 	test_cmp expect actual
 	"
 }
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 4f8e6f5fde..8780934478 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -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
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7ab8af47a5..483c8d6d7c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1206,5 +1206,5 @@ test_lazy_prereq LONG_IS_64BIT '
 	test 8 -le "$(build_option sizeof-long)"
 '
 
-test_lazy_prereq TIME_IS_64BIT 'test-date is64bit'
-test_lazy_prereq TIME_T_IS_64BIT 'test-date time_t-is64bit'
+test_lazy_prereq TIME_IS_64BIT 'test-tool date is64bit'
+test_lazy_prereq TIME_T_IS_64BIT 'test-tool date time_t-is64bit'
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 08/36] t/helper: merge (unused) test-delta into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (6 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 07/36] t/helper: merge test-date " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 09/36] t/helper: merge test-drop-caches " Nguyễn Thái Ngọc Duy
                   ` (29 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile              | 2 +-
 t/helper/test-delta.c | 5 +++--
 t/helper/test-tool.c  | 1 +
 t/helper/test-tool.h  | 1 +
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index efb1872c52..327d63217a 100644
--- a/Makefile
+++ b/Makefile
@@ -656,10 +656,10 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-delta
 TEST_PROGRAMS_NEED_X += test-drop-caches
 TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c
index 591730adc4..fae9712d57 100644
--- a/t/helper/test-delta.c
+++ b/t/helper/test-delta.c
@@ -8,14 +8,15 @@
  * published by the Free Software Foundation.
  */
 
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "delta.h"
 #include "cache.h"
 
 static const char usage_str[] =
-	"test-delta (-d|-p) <from_file> <data_file> <out_file>";
+	"test-tool delta (-d|-p) <from_file> <data_file> <out_file>";
 
-int cmd_main(int argc, const char **argv)
+int test_delta(int argc, const char **argv)
 {
 	int fd;
 	struct stat st;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index fe130ffbf2..e48c1f2d5f 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -11,6 +11,7 @@ static struct test_cmd cmds[] = {
 	{ "config", test_config },
 	{ "ctype", test_ctype },
 	{ "date", test_date },
+	{ "delta", test_delta },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 99ca1176dc..0ee098f1e3 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -5,6 +5,7 @@ int test_chmtime(int argc, const char **argv);
 int test_config(int argc, const char **argv);
 int test_ctype(int argc, const char **argv);
 int test_date(int argc, const char **argv);
+int test_delta(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 09/36] t/helper: merge test-drop-caches into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (7 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 08/36] t/helper: merge (unused) test-delta " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 10/36] t/helper: merge test-dump-cache-tree " Nguyễn Thái Ngọc Duy
                   ` (28 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    |  2 +-
 t/helper/test-drop-caches.c |  3 ++-
 t/helper/test-tool.c        |  1 +
 t/helper/test-tool.h        |  1 +
 t/perf/p7519-fsmonitor.sh   | 12 ++++++------
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 327d63217a..edd9c43982 100644
--- a/Makefile
+++ b/Makefile
@@ -657,10 +657,10 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-drop-caches
 TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-split-index
diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
index bd1a857d52..2aa7c57b4a 100644
--- a/t/helper/test-drop-caches.c
+++ b/t/helper/test-drop-caches.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 
 #if defined(GIT_WINDOWS_NATIVE)
@@ -157,7 +158,7 @@ static int cmd_dropcaches(void)
 
 #endif
 
-int cmd_main(int argc, const char **argv)
+int test_drop_caches(int argc, const char **argv)
 {
 	cmd_sync();
 	return cmd_dropcaches();
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index e48c1f2d5f..904e4103fd 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -12,6 +12,7 @@ static struct test_cmd cmds[] = {
 	{ "ctype", test_ctype },
 	{ "date", test_date },
 	{ "delta", test_delta },
+	{ "drop-caches", test_drop_caches },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 0ee098f1e3..1e96bf44a2 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -6,6 +6,7 @@ int test_config(int argc, const char **argv);
 int test_ctype(int argc, const char **argv);
 int test_date(int argc, const char **argv);
 int test_delta(int argc, const char **argv);
+int test_drop_caches(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 65e145c02d..def7ecdbc7 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -118,7 +118,7 @@ test_expect_success "setup for fsmonitor" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -126,7 +126,7 @@ test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -134,7 +134,7 @@ test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -148,7 +148,7 @@ test_expect_success "setup without fsmonitor" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -156,7 +156,7 @@ test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -164,7 +164,7 @@ test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 10/36] t/helper: merge test-dump-cache-tree into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (8 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 09/36] t/helper: merge test-drop-caches " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 11/36] t/helper: merge test-dump-split-index " Nguyễn Thái Ngọc Duy
                   ` (27 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                        | 2 +-
 t/helper/test-dump-cache-tree.c | 3 ++-
 t/helper/test-tool.c            | 1 +
 t/helper/test-tool.h            | 1 +
 t/t0090-cache-tree.sh           | 6 +++---
 t/t1700-split-index.sh          | 2 +-
 6 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index edd9c43982..991bafa6fb 100644
--- a/Makefile
+++ b/Makefile
@@ -658,10 +658,10 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-split-index
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
index ebf3aab22d..2697152e50 100644
--- a/t/helper/test-dump-cache-tree.c
+++ b/t/helper/test-dump-cache-tree.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "tree.h"
 #include "cache-tree.h"
@@ -54,7 +55,7 @@ static int dump_cache_tree(struct cache_tree *it,
 	return errs;
 }
 
-int cmd_main(int ac, const char **av)
+int test_dump_cache_tree(int ac, const char **av)
 {
 	struct index_state istate;
 	struct cache_tree *another = cache_tree();
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 904e4103fd..9c56c169c2 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -13,6 +13,7 @@ static struct test_cmd cmds[] = {
 	{ "date", test_date },
 	{ "delta", test_delta },
 	{ "drop-caches", test_drop_caches },
+	{ "dump-cache-tree", test_dump_cache_tree },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 1e96bf44a2..37e578b75e 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -7,6 +7,7 @@ int test_ctype(int argc, const char **argv);
 int test_date(int argc, const char **argv);
 int test_delta(int argc, const char **argv);
 int test_drop_caches(int argc, const char **argv);
+int test_dump_cache_tree(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index adfd4f0b5e..f81e3deead 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -8,13 +8,13 @@ cache-tree extension.
  . ./test-lib.sh
 
 cmp_cache_tree () {
-	test-dump-cache-tree | sed -e '/#(ref)/d' >actual &&
+	test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
 	sed "s/$_x40/SHA/" <actual >filtered &&
 	test_cmp "$1" filtered
 }
 
 # We don't bother with actually checking the SHA1:
-# test-dump-cache-tree already verifies that all existing data is
+# test-tool dump-cache-tree already verifies that all existing data is
 # correct.
 generate_expected_cache_tree_rec () {
 	dir="$1${1:+/}" &&
@@ -47,7 +47,7 @@ test_cache_tree () {
 
 test_invalid_cache_tree () {
 	printf "invalid                                  %s ()\n" "" "$@" >expect &&
-	test-dump-cache-tree |
+	test-tool dump-cache-tree |
 	sed -n -e "s/[0-9]* subtrees//" -e '/#(ref)/d' -e '/^invalid /p' >actual &&
 	test_cmp expect actual
 }
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index 4b5d443280..b778975de8 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -435,7 +435,7 @@ test_expect_success 'writing split index with null sha1 does not write cache tre
 	commit=$(git commit-tree $tree -p HEAD <msg) &&
 	git update-ref HEAD "$commit" &&
 	GIT_ALLOW_NULL_SHA1=1 git reset --hard &&
-	(test-dump-cache-tree >cache-tree.out || true) &&
+	(test-tool dump-cache-tree >cache-tree.out || true) &&
 	test_line_count = 0 cache-tree.out
 '
 
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 11/36] t/helper: merge test-dump-split-index into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (9 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 10/36] t/helper: merge test-dump-cache-tree " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 12/36] t/helper: merge test-example-decorate " Nguyễn Thái Ngọc Duy
                   ` (26 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         |  2 +-
 t/helper/test-dump-split-index.c |  3 +-
 t/helper/test-tool.c             |  1 +
 t/helper/test-tool.h             |  1 +
 t/t0090-cache-tree.sh            |  4 +--
 t/t1700-split-index.sh           | 48 ++++++++++++++++----------------
 6 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile
index 991bafa6fb..8993cec274 100644
--- a/Makefile
+++ b/Makefile
@@ -659,11 +659,11 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.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
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index e44430b699..1e541b4792 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "split-index.h"
 #include "ewah/ewok.h"
@@ -7,7 +8,7 @@ static void show_bit(size_t pos, void *data)
 	printf(" %d", (int)pos);
 }
 
-int cmd_main(int ac, const char **av)
+int test_dump_split_index(int ac, const char **av)
 {
 	struct split_index *si;
 	int i;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 9c56c169c2..9be6ec3764 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -14,6 +14,7 @@ static struct test_cmd cmds[] = {
 	{ "delta", test_delta },
 	{ "drop-caches", test_drop_caches },
 	{ "dump-cache-tree", test_dump_cache_tree },
+	{ "dump-split-index", test_dump_split_index },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 37e578b75e..d062bad365 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -8,6 +8,7 @@ int test_date(int argc, const char **argv);
 int test_delta(int argc, const char **argv);
 int test_drop_caches(int argc, const char **argv);
 int test_dump_cache_tree(int argc, const char **argv);
+int test_dump_split_index(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index f81e3deead..3266209e41 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -246,9 +246,9 @@ test_expect_success 'switching trees does not invalidate shared index' '
 	git update-index --split-index &&
 	>split &&
 	git add split &&
-	test-dump-split-index .git/index | grep -v ^own >before &&
+	test-tool dump-split-index .git/index | grep -v ^own >before &&
 	git commit -m "as-is" &&
-	test-dump-split-index .git/index | grep -v ^own >after &&
+	test-tool dump-split-index .git/index | grep -v ^own >after &&
 	test_cmp before after
 '
 
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index b778975de8..ec179fbaf7 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -11,7 +11,7 @@ sane_unset GIT_FSMONITOR_TEST
 test_expect_success 'enable split index' '
 	git config splitIndex.maxPercentChange 100 &&
 	git update-index --split-index &&
-	test-dump-split-index .git/index >actual &&
+	test-tool dump-split-index .git/index >actual &&
 	indexversion=$(test-index-version <.git/index) &&
 	if test "$indexversion" = "4"
 	then
@@ -39,7 +39,7 @@ test_expect_success 'add one file' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	base $base
 	100644 $EMPTY_BLOB 0	one
@@ -57,8 +57,8 @@ test_expect_success 'disable split index' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	BASE=$(test-dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	not a split index
 	EOF
@@ -73,7 +73,7 @@ test_expect_success 'enable split index again, "one" now belongs to base index"'
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -91,7 +91,7 @@ test_expect_success 'modify original file, base index untouched' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	q_to_tab >expect <<-EOF &&
 	$BASE
 	100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -111,7 +111,7 @@ test_expect_success 'add another file, which stays index' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	q_to_tab >expect <<-EOF &&
 	$BASE
 	100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -130,7 +130,7 @@ test_expect_success 'remove file not in base index' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	q_to_tab >expect <<-EOF &&
 	$BASE
 	100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -147,7 +147,7 @@ test_expect_success 'remove file in base index' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -165,7 +165,7 @@ test_expect_success 'add original file back' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	100644 $EMPTY_BLOB 0	one
@@ -195,7 +195,7 @@ test_expect_success 'unify index, two files remain' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	not a split index
 	EOF
@@ -229,8 +229,8 @@ test_expect_success 'set core.splitIndex config variable to true' '
 	100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	two
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -248,7 +248,7 @@ test_expect_success 'set core.splitIndex config variable to false' '
 	100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	two
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	not a split index
 	EOF
@@ -259,8 +259,8 @@ test_expect_success 'set core.splitIndex config variable to true' '
 	git config core.splitIndex true &&
 	: >three &&
 	git update-index --add three &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -269,7 +269,7 @@ test_expect_success 'set core.splitIndex config variable to true' '
 	test_cmp expect actual &&
 	: >four &&
 	git update-index --add four &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	four
@@ -283,8 +283,8 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
 	git config --unset splitIndex.maxPercentChange &&
 	: >five &&
 	git update-index --add five &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -293,7 +293,7 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
 	test_cmp expect actual &&
 	: >six &&
 	git update-index --add six &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	six
@@ -307,8 +307,8 @@ test_expect_success 'check splitIndex.maxPercentChange set to 0' '
 	git config splitIndex.maxPercentChange 0 &&
 	: >seven &&
 	git update-index --add seven &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -317,8 +317,8 @@ test_expect_success 'check splitIndex.maxPercentChange set to 0' '
 	test_cmp expect actual &&
 	: >eight &&
 	git update-index --add eight &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 12/36] t/helper: merge test-example-decorate into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (10 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 11/36] t/helper: merge test-dump-split-index " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 13/36] t/helper: merge test-genrandom " Nguyễn Thái Ngọc Duy
                   ` (25 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         | 2 +-
 t/helper/test-example-decorate.c | 3 ++-
 t/helper/test-tool.c             | 1 +
 t/helper/test-tool.h             | 1 +
 t/t9004-example.sh               | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 8993cec274..895b170fe3 100644
--- a/Makefile
+++ b/Makefile
@@ -660,12 +660,12 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 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
diff --git a/t/helper/test-example-decorate.c b/t/helper/test-example-decorate.c
index 90dc97a9d0..280b5a8fbe 100644
--- a/t/helper/test-example-decorate.c
+++ b/t/helper/test-example-decorate.c
@@ -1,8 +1,9 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "object.h"
 #include "decorate.h"
 
-int cmd_main(int argc, const char **argv)
+int test_example_decorate(int argc, const char **argv)
 {
 	struct decoration n;
 	struct object_id one_oid = { {1} };
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 9be6ec3764..92e6f0d5b4 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -15,6 +15,7 @@ static struct test_cmd cmds[] = {
 	{ "drop-caches", test_drop_caches },
 	{ "dump-cache-tree", test_dump_cache_tree },
 	{ "dump-split-index", test_dump_split_index },
+	{ "example-decorate", test_example_decorate },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index d062bad365..e97d6c4aaa 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -9,6 +9,7 @@ int test_delta(int argc, const char **argv);
 int test_drop_caches(int argc, const char **argv);
 int test_dump_cache_tree(int argc, const char **argv);
 int test_dump_split_index(int argc, const char **argv);
+int test_example_decorate(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t9004-example.sh b/t/t9004-example.sh
index b28a028f55..7e8894a4a7 100755
--- a/t/t9004-example.sh
+++ b/t/t9004-example.sh
@@ -4,7 +4,7 @@ test_description='check that example code compiles and runs'
 . ./test-lib.sh
 
 test_expect_success 'decorate' '
-	test-example-decorate
+	test-tool example-decorate
 '
 
 test_done
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 13/36] t/helper: merge test-genrandom into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (11 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 12/36] t/helper: merge test-example-decorate " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:53 ` [PATCH 14/36] t/helper: merge test-hashmap " Nguyễn Thái Ngọc Duy
                   ` (24 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                              |  2 +-
 t/helper/test-genrandom.c             |  3 ++-
 t/helper/test-tool.c                  |  1 +
 t/helper/test-tool.h                  |  1 +
 t/t0005-signals.sh                    |  2 +-
 t/t0021-conversion.sh                 |  4 ++--
 t/t1006-cat-file.sh                   |  2 +-
 t/t1050-large.sh                      |  6 +++---
 t/t5000-tar-tree.sh                   |  2 +-
 t/t5300-pack-object.sh                |  4 ++--
 t/t5301-sliding-window.sh             |  2 +-
 t/t5302-pack-index.sh                 | 14 +++++++-------
 t/t5303-pack-corruption-resilience.sh | 10 +++++-----
 t/t5310-pack-bitmaps.sh               |  2 +-
 t/t5313-pack-bounds-checks.sh         |  4 ++--
 t/t5314-pack-cycle-detection.sh       |  2 +-
 t/t5316-pack-delta-depth.sh           |  2 +-
 t/t5546-receive-limits.sh             |  2 +-
 t/t5547-push-quarantine.sh            |  2 +-
 t/t5608-clone-2gb.sh                  |  2 +-
 t/t9300-fast-import.sh                |  2 +-
 t/t9802-git-p4-filetype.sh            |  2 +-
 22 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/Makefile b/Makefile
index 895b170fe3..d0bc6cfecf 100644
--- a/Makefile
+++ b/Makefile
@@ -661,13 +661,13 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 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-line-buffer
diff --git a/t/helper/test-genrandom.c b/t/helper/test-genrandom.c
index 8d11d22d98..2cc9515f92 100644
--- a/t/helper/test-genrandom.c
+++ b/t/helper/test-genrandom.c
@@ -4,9 +4,10 @@
  * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.
  */
 
+#include "test-tool.h"
 #include "git-compat-util.h"
 
-int cmd_main(int argc, const char **argv)
+int test_genrandom(int argc, const char **argv)
 {
 	unsigned long count, next = 0;
 	unsigned char *c;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 92e6f0d5b4..ce13108374 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -16,6 +16,7 @@ static struct test_cmd cmds[] = {
 	{ "dump-cache-tree", test_dump_cache_tree },
 	{ "dump-split-index", test_dump_split_index },
 	{ "example-decorate", test_example_decorate },
+	{ "genrandom", test_genrandom },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index e97d6c4aaa..6742558cb4 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -10,6 +10,7 @@ int test_drop_caches(int argc, const char **argv);
 int test_dump_cache_tree(int argc, const char **argv);
 int test_dump_split_index(int argc, const char **argv);
 int test_example_decorate(int argc, const char **argv);
+int test_genrandom(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index 46042f1f13..c16947cf5d 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -36,7 +36,7 @@ large_git () {
 }
 
 test_expect_success 'create blob' '
-	test-genrandom foo 16384 >file &&
+	test-tool genrandom foo 16384 >file &&
 	git add file
 '
 
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 46f8e583c3..9479a4aaab 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -19,7 +19,7 @@ write_script rot13-filter.pl "$PERL_PATH" \
 generate_random_characters () {
 	LEN=$1
 	NAME=$2
-	test-genrandom some-seed $LEN |
+	test-tool genrandom some-seed $LEN |
 		perl -pe "s/./chr((ord($&) % 26) + ord('a'))/sge" >"$TEST_ROOT/$NAME"
 }
 
@@ -267,7 +267,7 @@ test_expect_success 'filtering large input to small output should use little mem
 '
 
 test_expect_success 'filter that does not read is fine' '
-	test-genrandom foo $((128 * 1024 + 1)) >big &&
+	test-tool genrandom foo $((128 * 1024 + 1)) >big &&
 	echo "big filter=epipe" >.gitattributes &&
 	test_config filter.epipe.clean "echo xyzzy" &&
 	git add big &&
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index b19f332694..2ac3b940c6 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -282,7 +282,7 @@ test_expect_success "--batch-check with multiple sha1s gives correct format" '
 '
 
 test_expect_success 'setup blobs which are likely to delta' '
-	test-genrandom foo 10240 >foo &&
+	test-tool genrandom foo 10240 >foo &&
 	{ cat foo; echo plus; } >foo-plus &&
 	git add foo foo-plus &&
 	git commit -m foo &&
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index 6fd264cff0..f9eb143f43 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -103,9 +103,9 @@ test_expect_success 'packsize limit' '
 		# mid1 and mid2 will fit within 256k limit but
 		# appending mid3 will bust the limit and will
 		# result in a separate packfile.
-		test-genrandom "a" $(( 66 * 1024 )) >mid1 &&
-		test-genrandom "b" $(( 80 * 1024 )) >mid2 &&
-		test-genrandom "c" $(( 128 * 1024 )) >mid3 &&
+		test-tool genrandom "a" $(( 66 * 1024 )) >mid1 &&
+		test-tool genrandom "b" $(( 80 * 1024 )) >mid2 &&
+		test-tool genrandom "c" $(( 128 * 1024 )) >mid3 &&
 		git add mid1 mid2 mid3 &&
 
 		count=0
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 266d052efb..af4d9b8876 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -101,7 +101,7 @@ test_expect_success \
      ten=0123456789 && hundred=$ten$ten$ten$ten$ten$ten$ten$ten$ten$ten &&
      echo long filename >a/four$hundred &&
      mkdir a/bin &&
-     test-genrandom "frotz" 500000 >a/bin/sh &&
+     test-tool genrandom "frotz" 500000 >a/bin/sh &&
      printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
      printf "A not substituted O" >a/substfile2 &&
      if test_have_prereq SYMLINKS; then
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 9c68b99251..3bac1f20e0 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -16,8 +16,8 @@ test_expect_success \
      perl -e "print \"a\" x 4096;" > a &&
      perl -e "print \"b\" x 4096;" > b &&
      perl -e "print \"c\" x 4096;" > c &&
-     test-genrandom "seed a" 2097152 > a_big &&
-     test-genrandom "seed b" 2097152 > b_big &&
+     test-tool genrandom "seed a" 2097152 > a_big &&
+     test-tool genrandom "seed b" 2097152 > b_big &&
      git update-index --add a a_big b b_big c &&
      cat c >d && echo foo >>d && git update-index --add d &&
      tree=$(git write-tree) &&
diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
index cae8c2e882..8132642163 100755
--- a/t/t5301-sliding-window.sh
+++ b/t/t5301-sliding-window.sh
@@ -12,7 +12,7 @@ test_expect_success \
      for i in a b c
      do
          echo $i >$i &&
-         test-genrandom "$i" 32768 >>$i &&
+         test-tool genrandom "$i" 32768 >>$i &&
          git update-index --add $i || return 1
      done &&
      echo d >d && cat c >>d && git update-index --add d &&
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index c2fc584dac..95fb9e40b4 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -15,17 +15,17 @@ test_expect_success \
      while test $i -le 100
      do
          iii=$(printf '%03i' $i)
-         test-genrandom "bar" 200 > wide_delta_$iii &&
-         test-genrandom "baz $iii" 50 >> wide_delta_$iii &&
-         test-genrandom "foo"$i 100 > deep_delta_$iii &&
-         test-genrandom "foo"$(expr $i + 1) 100 >> deep_delta_$iii &&
-         test-genrandom "foo"$(expr $i + 2) 100 >> deep_delta_$iii &&
+         test-tool genrandom "bar" 200 > wide_delta_$iii &&
+         test-tool genrandom "baz $iii" 50 >> wide_delta_$iii &&
+         test-tool genrandom "foo"$i 100 > deep_delta_$iii &&
+         test-tool genrandom "foo"$(expr $i + 1) 100 >> deep_delta_$iii &&
+         test-tool genrandom "foo"$(expr $i + 2) 100 >> deep_delta_$iii &&
          echo $iii >file_$iii &&
-         test-genrandom "$iii" 8192 >>file_$iii &&
+         test-tool genrandom "$iii" 8192 >>file_$iii &&
          git update-index --add file_$iii deep_delta_$iii wide_delta_$iii &&
          i=$(expr $i + 1) || return 1
      done &&
-     { echo 101 && test-genrandom 100 8192; } >file_101 &&
+     { echo 101 && test-tool genrandom 100 8192; } >file_101 &&
      git update-index --add file_101 &&
      tree=$(git write-tree) &&
      commit=$(git commit-tree $tree </dev/null) && {
diff --git a/t/t5303-pack-corruption-resilience.sh b/t/t5303-pack-corruption-resilience.sh
index 5940ce2084..3634e258f8 100755
--- a/t/t5303-pack-corruption-resilience.sh
+++ b/t/t5303-pack-corruption-resilience.sh
@@ -19,14 +19,14 @@ test_description='resilience to pack corruptions with redundant objects'
 # 3) object header is always 2 bytes.
 
 create_test_files() {
-    test-genrandom "foo" 2000 > file_1 &&
-    test-genrandom "foo" 1800 > file_2 &&
-    test-genrandom "foo" 1800 > file_3 &&
+    test-tool genrandom "foo" 2000 > file_1 &&
+    test-tool genrandom "foo" 1800 > file_2 &&
+    test-tool genrandom "foo" 1800 > file_3 &&
     echo " base " >> file_1 &&
     echo " delta1 " >> file_2 &&
     echo " delta delta2 " >> file_3 &&
-    test-genrandom "bar" 150 >> file_2 &&
-    test-genrandom "baz" 100 >> file_3
+    test-tool genrandom "bar" 150 >> file_2 &&
+    test-tool genrandom "baz" 100 >> file_3
 }
 
 create_new_pack() {
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index 20e2473a03..f6d600fd82 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -284,7 +284,7 @@ test_expect_success JGIT 'jgit can read our bitmaps' '
 '
 
 test_expect_success 'splitting packs does not generate bogus bitmaps' '
-	test-genrandom foo $((1024 * 1024)) >rand &&
+	test-tool genrandom foo $((1024 * 1024)) >rand &&
 	git add rand &&
 	git commit -m "commit with big file" &&
 	git -c pack.packSizeLimit=500k repack -adb &&
diff --git a/t/t5313-pack-bounds-checks.sh b/t/t5313-pack-bounds-checks.sh
index 9372508c99..4fe4ad9d61 100755
--- a/t/t5313-pack-bounds-checks.sh
+++ b/t/t5313-pack-bounds-checks.sh
@@ -163,8 +163,8 @@ test_expect_success 'bogus offset inside v2 extended table' '
 
 test_expect_success 'bogus OFS_DELTA in packfile' '
 	# Generate a pack with a delta in it.
-	base=$(test-genrandom foo 3000 | git hash-object --stdin -w) &&
-	delta=$(test-genrandom foo 2000 | git hash-object --stdin -w) &&
+	base=$(test-tool genrandom foo 3000 | git hash-object --stdin -w) &&
+	delta=$(test-tool genrandom foo 2000 | git hash-object --stdin -w) &&
 	do_pack "$base $delta" --delta-base-offset &&
 	rm -f .git/objects/??/* &&
 
diff --git a/t/t5314-pack-cycle-detection.sh b/t/t5314-pack-cycle-detection.sh
index f7dbdfb412..f31995d3d2 100755
--- a/t/t5314-pack-cycle-detection.sh
+++ b/t/t5314-pack-cycle-detection.sh
@@ -73,7 +73,7 @@ make_pack () {
 }
 
 test_expect_success 'setup' '
-	test-genrandom base 4096 >base &&
+	test-tool genrandom base 4096 >base &&
 	for i in one two
 	do
 		# we want shared content here to encourage deltas...
diff --git a/t/t5316-pack-delta-depth.sh b/t/t5316-pack-delta-depth.sh
index 2ed479b712..0f06c40eb1 100755
--- a/t/t5316-pack-delta-depth.sh
+++ b/t/t5316-pack-delta-depth.sh
@@ -47,7 +47,7 @@ test_description='pack-objects breaks long cross-pack delta chains'
 # repeatedly-modified file to generate the delta chain).
 
 test_expect_success 'create series of packs' '
-	test-genrandom foo 4096 >content &&
+	test-tool genrandom foo 4096 >content &&
 	prev= &&
 	for i in $(test_seq 1 10)
 	do
diff --git a/t/t5546-receive-limits.sh b/t/t5546-receive-limits.sh
index 10cb0be2b7..0b0e987fdb 100755
--- a/t/t5546-receive-limits.sh
+++ b/t/t5546-receive-limits.sh
@@ -44,7 +44,7 @@ test_pack_input_limit () {
 }
 
 test_expect_success "create known-size (1024 bytes) commit" '
-	test-genrandom foo 1024 >one-k &&
+	test-tool genrandom foo 1024 >one-k &&
 	git add one-k &&
 	test_commit one-k
 '
diff --git a/t/t5547-push-quarantine.sh b/t/t5547-push-quarantine.sh
index 113c87007f..faaa51ccc5 100755
--- a/t/t5547-push-quarantine.sh
+++ b/t/t5547-push-quarantine.sh
@@ -39,7 +39,7 @@ test_expect_success 'push to repo path with path separator (colon)' '
 	# so make it likely for us to generate a delta by having
 	# a non-trivial file with multiple versions.
 
-	test-genrandom foo 4096 >file.bin &&
+	test-tool genrandom foo 4096 >file.bin &&
 	git add file.bin &&
 	git commit -m bin &&
 
diff --git a/t/t5608-clone-2gb.sh b/t/t5608-clone-2gb.sh
index 191d6d3a78..df822d9a3e 100755
--- a/t/t5608-clone-2gb.sh
+++ b/t/t5608-clone-2gb.sh
@@ -21,7 +21,7 @@ test_expect_success CLONE_2GB 'setup' '
 	 do
 		printf "Generating blob $i/$blobcount\r" >&2 &&
 		printf "blob\nmark :$i\ndata $blobsize\n" &&
-		#test-genrandom $i $blobsize &&
+		#test-tool genrandom $i $blobsize &&
 		printf "%-${blobsize}s" $i &&
 		echo "M 100644 :$i $i" >> commit
 		i=$(($i+1)) ||
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index e4d06accc4..dc79df7b04 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -2654,7 +2654,7 @@ test_expect_success 'R: corrupt lines do not mess marks file' '
 ##
 test_expect_success 'R: blob bigger than threshold' '
 	blobsize=$((2*1024*1024 + 53)) &&
-	test-genrandom bar $blobsize >expect &&
+	test-tool genrandom bar $blobsize >expect &&
 	cat >input <<-INPUT_END &&
 	commit refs/heads/big-file
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
index eb9a8ed197..1fc9b33aeb 100755
--- a/t/t9802-git-p4-filetype.sh
+++ b/t/t9802-git-p4-filetype.sh
@@ -237,7 +237,7 @@ test_expect_success 'ignore apple' '
 	build_gendouble &&
 	(
 		cd "$cli" &&
-		test-genrandom apple 1024 >double.png &&
+		test-tool genrandom apple 1024 >double.png &&
 		"$PYTHON_PATH" "$TRASH_DIRECTORY/gendouble.py" >%double.png &&
 		p4 add -t apple double.png &&
 		p4 submit -d appledouble
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 14/36] t/helper: merge test-hashmap into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (12 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 13/36] t/helper: merge test-genrandom " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:53 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 15/36] t/helper: merge test-index-version " Nguyễn Thái Ngọc Duy
                   ` (23 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:53 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                | 2 +-
 t/helper/test-hashmap.c | 5 +++--
 t/helper/test-tool.c    | 1 +
 t/helper/test-tool.h    | 1 +
 t/t0011-hashmap.sh      | 4 ++--
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index d0bc6cfecf..f6c3ddc703 100644
--- a/Makefile
+++ b/Makefile
@@ -662,13 +662,13 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
-TEST_PROGRAMS_NEED_X += test-hashmap
 TEST_PROGRAMS_NEED_X += test-index-version
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-match-trees
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index 9ae9281c07..6fc840ff72 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "hashmap.h"
 #include "strbuf.h"
@@ -77,7 +78,7 @@ static unsigned int hash(unsigned int method, unsigned int i, const char *key)
 
 /*
  * Test performance of hashmap.[ch]
- * Usage: time echo "perfhashmap method rounds" | test-hashmap
+ * Usage: time echo "perfhashmap method rounds" | test-tool hashmap
  */
 static void perf_hashmap(unsigned int method, unsigned int rounds)
 {
@@ -144,7 +145,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
  *
  * perfhashmap method rounds -> test hashmap.[ch] performance
  */
-int cmd_main(int argc, const char **argv)
+int test_hashmap(int argc, const char **argv)
 {
 	struct strbuf line = STRBUF_INIT;
 	struct hashmap map;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index ce13108374..924d8c80f7 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -17,6 +17,7 @@ static struct test_cmd cmds[] = {
 	{ "dump-split-index", test_dump_split_index },
 	{ "example-decorate", test_example_decorate },
 	{ "genrandom", test_genrandom },
+	{ "hashmap", test_hashmap },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 6742558cb4..161f5becb7 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -11,6 +11,7 @@ int test_dump_cache_tree(int argc, const char **argv);
 int test_dump_split_index(int argc, const char **argv);
 int test_example_decorate(int argc, const char **argv);
 int test_genrandom(int argc, const char **argv);
+int test_hashmap(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t0011-hashmap.sh b/t/t0011-hashmap.sh
index 9c217d948c..3f1f505e89 100755
--- a/t/t0011-hashmap.sh
+++ b/t/t0011-hashmap.sh
@@ -4,7 +4,7 @@ test_description='test hashmap and string hash functions'
 . ./test-lib.sh
 
 test_hashmap() {
-	echo "$1" | test-hashmap $3 > actual &&
+	echo "$1" | test-tool hashmap $3 > actual &&
 	echo "$2" > expect &&
 	test_cmp expect actual
 }
@@ -232,7 +232,7 @@ test_expect_success 'grow / shrink' '
 	echo value40 >> expect &&
 	echo size >> in &&
 	echo 64 39 >> expect &&
-	cat in | test-hashmap > out &&
+	cat in | test-tool hashmap > out &&
 	test_cmp expect out
 
 '
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 15/36] t/helper: merge test-index-version into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (13 preceding siblings ...)
  2018-03-17  7:53 ` [PATCH 14/36] t/helper: merge test-hashmap " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 16/36] t/helper: merge (unused) test-match-trees " Nguyễn Thái Ngọc Duy
                   ` (22 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                              | 2 +-
 t/helper/test-index-version.c         | 3 ++-
 t/helper/test-tool.c                  | 1 +
 t/helper/test-tool.h                  | 1 +
 t/t1600-index.sh                      | 2 +-
 t/t1700-split-index.sh                | 2 +-
 t/t2104-update-index-skip-worktree.sh | 6 +++---
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f6c3ddc703..d7342e3a8b 100644
--- a/Makefile
+++ b/Makefile
@@ -663,13 +663,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
-TEST_PROGRAMS_NEED_X += test-index-version
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-match-trees
 TEST_PROGRAMS_NEED_X += test-mergesort
diff --git a/t/helper/test-index-version.c b/t/helper/test-index-version.c
index f569f6b7ef..5fc3b8d7ba 100644
--- a/t/helper/test-index-version.c
+++ b/t/helper/test-index-version.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int argc, const char **argv)
+int test_index_version(int argc, const char **argv)
 {
 	struct cache_header hdr;
 	int version;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 924d8c80f7..c8c8f3ead6 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -18,6 +18,7 @@ static struct test_cmd cmds[] = {
 	{ "example-decorate", test_example_decorate },
 	{ "genrandom", test_genrandom },
 	{ "hashmap", test_hashmap },
+	{ "index-version", test_index_version },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 161f5becb7..a81e071a80 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -12,6 +12,7 @@ int test_dump_split_index(int argc, const char **argv);
 int test_example_decorate(int argc, const char **argv);
 int test_genrandom(int argc, const char **argv);
 int test_hashmap(int argc, const char **argv);
+int test_index_version(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t1600-index.sh b/t/t1600-index.sh
index 079d241145..c4422312f4 100755
--- a/t/t1600-index.sh
+++ b/t/t1600-index.sh
@@ -68,7 +68,7 @@ test_expect_success 'GIT_INDEX_VERSION takes precedence over config' '
 		git config --add index.version 2 &&
 		git add a 2>&1 &&
 		echo 4 >expect &&
-		test-index-version <.git/index >actual &&
+		test-tool index-version <.git/index >actual &&
 		test_cmp expect actual
 	)
 '
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index ec179fbaf7..e4f4c4df4e 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -12,7 +12,7 @@ test_expect_success 'enable split index' '
 	git config splitIndex.maxPercentChange 100 &&
 	git update-index --split-index &&
 	test-tool dump-split-index .git/index >actual &&
-	indexversion=$(test-index-version <.git/index) &&
+	indexversion=$(test-tool index-version <.git/index) &&
 	if test "$indexversion" = "4"
 	then
 		own=432ef4b63f32193984f339431fd50ca796493569
diff --git a/t/t2104-update-index-skip-worktree.sh b/t/t2104-update-index-skip-worktree.sh
index cc830da58d..7e2e7dd4ae 100755
--- a/t/t2104-update-index-skip-worktree.sh
+++ b/t/t2104-update-index-skip-worktree.sh
@@ -33,7 +33,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'index is at version 2' '
-	test "$(test-index-version < .git/index)" = 2
+	test "$(test-tool index-version < .git/index)" = 2
 '
 
 test_expect_success 'update-index --skip-worktree' '
@@ -42,7 +42,7 @@ test_expect_success 'update-index --skip-worktree' '
 '
 
 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
-	test "$(test-index-version < .git/index)" = 3
+	test "$(test-tool index-version < .git/index)" = 3
 '
 
 test_expect_success 'ls-files -t' '
@@ -55,7 +55,7 @@ test_expect_success 'update-index --no-skip-worktree' '
 '
 
 test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
-	test "$(test-index-version < .git/index)" = 2
+	test "$(test-tool index-version < .git/index)" = 2
 '
 
 test_done
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 16/36] t/helper: merge (unused) test-match-trees into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (14 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 15/36] t/helper: merge test-index-version " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 17/36] t/helper: merge (unused) test-mergesort " Nguyễn Thái Ngọc Duy
                   ` (21 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    | 2 +-
 t/helper/test-match-trees.c | 3 ++-
 t/helper/test-tool.c        | 1 +
 t/helper/test-tool.h        | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d7342e3a8b..6552a8f4ed 100644
--- a/Makefile
+++ b/Makefile
@@ -665,13 +665,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 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
diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c
index 356d8edef1..2d58886acb 100644
--- a/t/helper/test-match-trees.c
+++ b/t/helper/test-match-trees.c
@@ -1,7 +1,8 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "tree.h"
 
-int cmd_main(int ac, const char **av)
+int test_match_trees(int ac, const char **av)
 {
 	struct object_id hash1, hash2, shifted;
 	struct tree *one, *two;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index c8c8f3ead6..cde9f16fc8 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -20,6 +20,7 @@ static struct test_cmd cmds[] = {
 	{ "hashmap", test_hashmap },
 	{ "index-version", test_index_version },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
+	{ "match-trees", test_match_trees },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index a81e071a80..937c408dcc 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -14,6 +14,7 @@ int test_genrandom(int argc, const char **argv);
 int test_hashmap(int argc, const char **argv);
 int test_index_version(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
+int test_match_trees(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 17/36] t/helper: merge (unused) test-mergesort into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (15 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 16/36] t/helper: merge (unused) test-match-trees " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 18/36] t/helper: merge test-mktemp " Nguyễn Thái Ngọc Duy
                   ` (20 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                  | 2 +-
 t/helper/test-mergesort.c | 3 ++-
 t/helper/test-tool.c      | 1 +
 t/helper/test-tool.h      | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 6552a8f4ed..67f37b849e 100644
--- a/Makefile
+++ b/Makefile
@@ -666,13 +666,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
-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
diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c
index 335cf6b626..31258e40d9 100644
--- a/t/helper/test-mergesort.c
+++ b/t/helper/test-mergesort.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "mergesort.h"
 
@@ -22,7 +23,7 @@ static int compare_strings(const void *a, const void *b)
 	return strcmp(x->text, y->text);
 }
 
-int cmd_main(int argc, const char **argv)
+int test_mergesort(int argc, const char **argv)
 {
 	struct line *line, *p = NULL, *lines = NULL;
 	struct strbuf sb = STRBUF_INIT;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index cde9f16fc8..4206d96304 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -21,6 +21,7 @@ static struct test_cmd cmds[] = {
 	{ "index-version", test_index_version },
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "match-trees", test_match_trees },
+	{ "mergesort", test_mergesort },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 937c408dcc..dff1b804cb 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -15,6 +15,7 @@ int test_hashmap(int argc, const char **argv);
 int test_index_version(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_match_trees(int argc, const char **argv);
+int test_mergesort(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 18/36] t/helper: merge test-mktemp into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (16 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 17/36] t/helper: merge (unused) test-mergesort " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 19/36] t/helper: merge test-online-cpus " Nguyễn Thái Ngọc Duy
                   ` (19 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile               | 2 +-
 t/helper/test-mktemp.c | 3 ++-
 t/helper/test-tool.c   | 1 +
 t/helper/test-tool.h   | 1 +
 t/t0070-fundamental.sh | 4 ++--
 5 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 67f37b849e..3145a9b1b2 100644
--- a/Makefile
+++ b/Makefile
@@ -667,13 +667,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
-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
diff --git a/t/helper/test-mktemp.c b/t/helper/test-mktemp.c
index 89d9b2f7be..afc9dee91d 100644
--- a/t/helper/test-mktemp.c
+++ b/t/helper/test-mktemp.c
@@ -1,9 +1,10 @@
 /*
  * test-mktemp.c: code to exercise the creation of temporary files
  */
+#include "test-tool.h"
 #include "git-compat-util.h"
 
-int cmd_main(int argc, const char **argv)
+int test_mktemp(int argc, const char **argv)
 {
 	if (argc != 2)
 		usage("Expected 1 parameter defining the temporary file template");
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 4206d96304..4a563e08c3 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -22,6 +22,7 @@ static struct test_cmd cmds[] = {
 	{ "lazy-init-name-hash", test_lazy_init_name_hash },
 	{ "match-trees", test_match_trees },
 	{ "mergesort", test_mergesort },
+	{ "mktemp", test_mktemp },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index dff1b804cb..5bbe3e96cf 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -16,6 +16,7 @@ int test_index_version(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_match_trees(int argc, const char **argv);
 int test_mergesort(int argc, const char **argv);
+int test_mktemp(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 70d4d98a2e..ac007938ee 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -13,7 +13,7 @@ test_expect_success 'character classes (isspace, isalpha etc.)' '
 '
 
 test_expect_success 'mktemp to nonexistent directory prints filename' '
-	test_must_fail test-mktemp doesnotexist/testXXXXXX 2>err &&
+	test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
 	grep "doesnotexist/test" err
 '
 
@@ -21,7 +21,7 @@ test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints file
 	mkdir cannotwrite &&
 	chmod -w cannotwrite &&
 	test_when_finished "chmod +w cannotwrite" &&
-	test_must_fail test-mktemp cannotwrite/testXXXXXX 2>err &&
+	test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err &&
 	grep "cannotwrite/test" err
 '
 
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 19/36] t/helper: merge test-online-cpus into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (17 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 18/36] t/helper: merge test-mktemp " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 20/36] t/helper: merge test-path-utils " Nguyễn Thái Ngọc Duy
                   ` (18 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                                | 2 +-
 t/helper/test-online-cpus.c             | 3 ++-
 t/helper/test-tool.c                    | 1 +
 t/helper/test-tool.h                    | 1 +
 t/t3008-ls-files-lazy-init-name-hash.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 3145a9b1b2..91af906d08 100644
--- a/Makefile
+++ b/Makefile
@@ -668,13 +668,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
-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
diff --git a/t/helper/test-online-cpus.c b/t/helper/test-online-cpus.c
index 06c09c6b88..5899e3098f 100644
--- a/t/helper/test-online-cpus.c
+++ b/t/helper/test-online-cpus.c
@@ -1,7 +1,8 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "thread-utils.h"
 
-int cmd_main(int argc, const char **argv)
+int test_online_cpus(int argc, const char **argv)
 {
 	printf("%d\n", online_cpus());
 	return 0;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 4a563e08c3..29b04dd103 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -23,6 +23,7 @@ static struct test_cmd cmds[] = {
 	{ "match-trees", test_match_trees },
 	{ "mergesort", test_mergesort },
 	{ "mktemp", test_mktemp },
+	{ "online-cpus", test_online_cpus },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 5bbe3e96cf..b7dafee709 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -17,6 +17,7 @@ int test_lazy_init_name_hash(int argc, const char **argv);
 int test_match_trees(int argc, const char **argv);
 int test_mergesort(int argc, const char **argv);
 int test_mktemp(int argc, const char **argv);
+int test_online_cpus(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t3008-ls-files-lazy-init-name-hash.sh b/t/t3008-ls-files-lazy-init-name-hash.sh
index 8df4aa7c99..08af596ba6 100755
--- a/t/t3008-ls-files-lazy-init-name-hash.sh
+++ b/t/t3008-ls-files-lazy-init-name-hash.sh
@@ -4,7 +4,7 @@ test_description='Test the lazy init name hash with various folder structures'
 
 . ./test-lib.sh
 
-if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-online-cpus)
+if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-tool online-cpus)
 then
 	skip_all='skipping lazy-init tests, single cpu'
 	test_done
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 20/36] t/helper: merge test-path-utils into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (18 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 19/36] t/helper: merge test-online-cpus " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 21/36] t/helper: merge test-prio-queue " Nguyễn Thái Ngọc Duy
                   ` (17 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   |  2 +-
 t/helper/test-path-utils.c |  3 +-
 t/helper/test-tool.c       |  1 +
 t/helper/test-tool.h       |  1 +
 t/lib-git-p4.sh            |  2 +-
 t/t0060-path-utils.sh      | 60 +++++++++++++++++++-------------------
 t/t1501-work-tree.sh       |  8 ++---
 7 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/Makefile b/Makefile
index 91af906d08..751ea6cad7 100644
--- a/Makefile
+++ b/Makefile
@@ -669,6 +669,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -676,7 +677,6 @@ TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 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
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index 2b3c5092a1..e00e423325 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "string-list.h"
 
@@ -170,7 +171,7 @@ static struct test_data dirname_data[] = {
 	{ NULL,              NULL     }
 };
 
-int cmd_main(int argc, const char **argv)
+int test_path_utils(int argc, const char **argv)
 {
 	if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) {
 		char *buf = xmallocz(strlen(argv[2]));
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 29b04dd103..23e843ab46 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -24,6 +24,7 @@ static struct test_cmd cmds[] = {
 	{ "mergesort", test_mergesort },
 	{ "mktemp", test_mktemp },
 	{ "online-cpus", test_online_cpus },
+	{ "path-utils", test_path_utils },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index b7dafee709..4bcca38f8e 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -18,6 +18,7 @@ int test_match_trees(int argc, const char **argv);
 int test_mergesort(int argc, const char **argv);
 int test_mktemp(int argc, const char **argv);
 int test_online_cpus(int argc, const char **argv);
+int test_path_utils(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index 54fd5a6ca0..c27599474c 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -39,7 +39,7 @@ native_path () {
 	then
 		path=$(cygpath --windows "$path")
 	else
-		path=$(test-path-utils real_path "$path")
+		path=$(test-tool path-utils real_path "$path")
 	fi &&
 	echo "$path"
 }
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index 7ea2bb515b..f46e3c4995 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -8,15 +8,15 @@ test_description='Test various path utilities'
 . ./test-lib.sh
 
 norm_path() {
-	expected=$(test-path-utils print_path "$2")
+	expected=$(test-tool path-utils print_path "$2")
 	test_expect_success $3 "normalize path: $1 => $2" \
-	"test \"\$(test-path-utils normalize_path_copy '$1')\" = '$expected'"
+	"test \"\$(test-tool path-utils normalize_path_copy '$1')\" = '$expected'"
 }
 
 relative_path() {
-	expected=$(test-path-utils print_path "$3")
+	expected=$(test-tool path-utils print_path "$3")
 	test_expect_success $4 "relative path: $1 $2 => $3" \
-	"test \"\$(test-path-utils relative_path '$1' '$2')\" = '$expected'"
+	"test \"\$(test-tool path-utils relative_path '$1' '$2')\" = '$expected'"
 }
 
 test_submodule_relative_url() {
@@ -37,7 +37,7 @@ test_git_path() {
 # On Windows, we are using MSYS's bash, which mangles the paths.
 # Absolute paths are anchored at the MSYS installation directory,
 # which means that the path / accounts for this many characters:
-rootoff=$(test-path-utils normalize_path_copy / | wc -c)
+rootoff=$(test-tool path-utils normalize_path_copy / | wc -c)
 # Account for the trailing LF:
 if test $rootoff = 2; then
 	rootoff=	# we are on Unix
@@ -46,7 +46,7 @@ else
 	# In MSYS2, the root directory "/" is translated into a Windows
 	# directory *with* trailing slash. Let's test for that and adjust
 	# our expected longest ancestor length accordingly.
-	case "$(test-path-utils print_path /)" in
+	case "$(test-tool path-utils print_path /)" in
 	*/) rootslash=1;;
 	*) rootslash=0;;
 	esac
@@ -61,7 +61,7 @@ ancestor() {
 		expected=$(($expected+$rootoff))
 	fi
 	test_expect_success "longest ancestor: $1 $2 => $expected" \
-	"actual=\$(test-path-utils longest_ancestor_length '$1' '$2') &&
+	"actual=\$(test-tool path-utils longest_ancestor_length '$1' '$2') &&
 	 test \"\$actual\" = '$expected'"
 }
 
@@ -77,8 +77,8 @@ case $(uname -s) in
 	;;
 esac
 
-test_expect_success basename 'test-path-utils basename'
-test_expect_success dirname 'test-path-utils dirname'
+test_expect_success basename 'test-tool path-utils basename'
+test_expect_success dirname 'test-tool path-utils dirname'
 
 norm_path "" ""
 norm_path . ""
@@ -157,48 +157,48 @@ ancestor /foo/bar /foo:/bar 4
 ancestor /foo/bar /bar -1
 
 test_expect_success 'strip_path_suffix' '
-	test c:/msysgit = $(test-path-utils strip_path_suffix \
+	test c:/msysgit = $(test-tool path-utils strip_path_suffix \
 		c:/msysgit/libexec//git-core libexec/git-core)
 '
 
 test_expect_success 'absolute path rejects the empty string' '
-	test_must_fail test-path-utils absolute_path ""
+	test_must_fail test-tool path-utils absolute_path ""
 '
 
 test_expect_success 'real path rejects the empty string' '
-	test_must_fail test-path-utils real_path ""
+	test_must_fail test-tool path-utils real_path ""
 '
 
 test_expect_success POSIX 'real path works on absolute paths 1' '
 	nopath="hopefully-absent-path" &&
-	test "/" = "$(test-path-utils real_path "/")" &&
-	test "/$nopath" = "$(test-path-utils real_path "/$nopath")"
+	test "/" = "$(test-tool path-utils real_path "/")" &&
+	test "/$nopath" = "$(test-tool path-utils real_path "/$nopath")"
 '
 
 test_expect_success 'real path works on absolute paths 2' '
 	nopath="hopefully-absent-path" &&
 	# Find an existing top-level directory for the remaining tests:
 	d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
-	test "$d" = "$(test-path-utils real_path "$d")" &&
-	test "$d/$nopath" = "$(test-path-utils real_path "$d/$nopath")"
+	test "$d" = "$(test-tool path-utils real_path "$d")" &&
+	test "$d/$nopath" = "$(test-tool path-utils real_path "$d/$nopath")"
 '
 
 test_expect_success POSIX 'real path removes extra leading slashes' '
 	nopath="hopefully-absent-path" &&
-	test "/" = "$(test-path-utils real_path "///")" &&
-	test "/$nopath" = "$(test-path-utils real_path "///$nopath")" &&
+	test "/" = "$(test-tool path-utils real_path "///")" &&
+	test "/$nopath" = "$(test-tool path-utils real_path "///$nopath")" &&
 	# Find an existing top-level directory for the remaining tests:
 	d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
-	test "$d" = "$(test-path-utils real_path "//$d")" &&
-	test "$d/$nopath" = "$(test-path-utils real_path "//$d/$nopath")"
+	test "$d" = "$(test-tool path-utils real_path "//$d")" &&
+	test "$d/$nopath" = "$(test-tool path-utils real_path "//$d/$nopath")"
 '
 
 test_expect_success 'real path removes other extra slashes' '
 	nopath="hopefully-absent-path" &&
 	# Find an existing top-level directory for the remaining tests:
 	d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
-	test "$d" = "$(test-path-utils real_path "$d///")" &&
-	test "$d/$nopath" = "$(test-path-utils real_path "$d///$nopath")"
+	test "$d" = "$(test-tool path-utils real_path "$d///")" &&
+	test "$d/$nopath" = "$(test-tool path-utils real_path "$d///$nopath")"
 '
 
 test_expect_success SYMLINKS 'real path works on symlinks' '
@@ -209,35 +209,35 @@ test_expect_success SYMLINKS 'real path works on symlinks' '
 	mkdir third &&
 	dir="$(cd .git; pwd -P)" &&
 	dir2=third/../second/other/.git &&
-	test "$dir" = "$(test-path-utils real_path $dir2)" &&
+	test "$dir" = "$(test-tool path-utils real_path $dir2)" &&
 	file="$dir"/index &&
-	test "$file" = "$(test-path-utils real_path $dir2/index)" &&
+	test "$file" = "$(test-tool path-utils real_path $dir2/index)" &&
 	basename=blub &&
-	test "$dir/$basename" = "$(cd .git && test-path-utils real_path "$basename")" &&
+	test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" &&
 	ln -s ../first/file .git/syml &&
 	sym="$(cd first; pwd -P)"/file &&
-	test "$sym" = "$(test-path-utils real_path "$dir2/syml")"
+	test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")"
 '
 
 test_expect_success SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' '
 	ln -s target symlink &&
-	test "$(test-path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
+	test "$(test-tool path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
 '
 
 test_expect_success 'prefix_path works with only absolute path to work tree' '
 	echo "" >expected &&
-	test-path-utils prefix_path prefix "$(pwd)" >actual &&
+	test-tool path-utils prefix_path prefix "$(pwd)" >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success 'prefix_path rejects absolute path to dir with same beginning as work tree' '
-	test_must_fail test-path-utils prefix_path prefix "$(pwd)a"
+	test_must_fail test-tool path-utils prefix_path prefix "$(pwd)a"
 '
 
 test_expect_success SYMLINKS 'prefix_path works with absolute path to a symlink to work tree having  same beginning as work tree' '
 	git init repo &&
 	ln -s repo repolink &&
-	test "a" = "$(cd repo && test-path-utils prefix_path prefix "$(pwd)/../repolink/a")"
+	test "a" = "$(cd repo && test-tool path-utils prefix_path prefix "$(pwd)/../repolink/a")"
 '
 
 relative_path /foo/a/b/c/	/foo/a/b/	c/
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index b06210ec5e..b07cb9140e 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -360,7 +360,7 @@ test_expect_success 'GIT_DIR set (1)' '
 	(
 		cd work &&
 		GIT_DIR=../gitfile git rev-parse --git-common-dir >actual &&
-		test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
+		test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
 		test_cmp expect actual
 	)
 '
@@ -371,7 +371,7 @@ test_expect_success 'GIT_DIR set (2)' '
 	(
 		cd work &&
 		GIT_DIR=../gitfile git rev-parse --git-common-dir >actual &&
-		test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
+		test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
 		test_cmp expect actual
 	)
 '
@@ -382,7 +382,7 @@ test_expect_success 'Auto discovery' '
 	(
 		cd work &&
 		git rev-parse --git-common-dir >actual &&
-		test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
+		test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
 		test_cmp expect actual &&
 		echo haha >data1 &&
 		git add data1 &&
@@ -400,7 +400,7 @@ test_expect_success '$GIT_DIR/common overrides core.worktree' '
 	(
 		cd work &&
 		git rev-parse --git-common-dir >actual &&
-		test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
+		test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
 		test_cmp expect actual &&
 		echo haha >data2 &&
 		git add data2 &&
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 21/36] t/helper: merge test-prio-queue into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (19 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 20/36] t/helper: merge test-path-utils " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 22/36] t/helepr: merge test-read-cache " Nguyễn Thái Ngọc Duy
                   ` (16 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   | 2 +-
 t/helper/test-prio-queue.c | 3 ++-
 t/helper/test-tool.c       | 1 +
 t/helper/test-tool.h       | 1 +
 t/t0009-prio-queue.sh      | 6 +++---
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 751ea6cad7..076c778494 100644
--- a/Makefile
+++ b/Makefile
@@ -670,6 +670,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -677,7 +678,6 @@ TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
-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
diff --git a/t/helper/test-prio-queue.c b/t/helper/test-prio-queue.c
index ae58fff359..a50216e332 100644
--- a/t/helper/test-prio-queue.c
+++ b/t/helper/test-prio-queue.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "prio-queue.h"
 
@@ -16,7 +17,7 @@ static void show(int *v)
 	free(v);
 }
 
-int cmd_main(int argc, const char **argv)
+int test_prio_queue(int argc, const char **argv)
 {
 	struct prio_queue pq = { intcmp };
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 23e843ab46..24ce124868 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -25,6 +25,7 @@ static struct test_cmd cmds[] = {
 	{ "mktemp", test_mktemp },
 	{ "online-cpus", test_online_cpus },
 	{ "path-utils", test_path_utils },
+	{ "prio-queue", test_prio_queue },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 4bcca38f8e..713be481d5 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -19,6 +19,7 @@ int test_mergesort(int argc, const char **argv);
 int test_mktemp(int argc, const char **argv);
 int test_online_cpus(int argc, const char **argv);
 int test_path_utils(int argc, const char **argv);
+int test_prio_queue(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0009-prio-queue.sh b/t/t0009-prio-queue.sh
index 94045c3fad..e56dfce668 100755
--- a/t/t0009-prio-queue.sh
+++ b/t/t0009-prio-queue.sh
@@ -17,7 +17,7 @@ cat >expect <<'EOF'
 10
 EOF
 test_expect_success 'basic ordering' '
-	test-prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
+	test-tool prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
 	test_cmp expect actual
 '
 
@@ -30,7 +30,7 @@ cat >expect <<'EOF'
 6
 EOF
 test_expect_success 'mixed put and get' '
-	test-prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
+	test-tool prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
 	test_cmp expect actual
 '
 
@@ -43,7 +43,7 @@ NULL
 NULL
 EOF
 test_expect_success 'notice empty queue' '
-	test-prio-queue 1 2 get get get 1 2 get get get >actual &&
+	test-tool prio-queue 1 2 get get get 1 2 get get get >actual &&
 	test_cmp expect actual
 '
 
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 22/36] t/helepr: merge test-read-cache into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (20 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 21/36] t/helper: merge test-prio-queue " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-18  2:21   ` Eric Sunshine
  2018-03-17  7:54 ` [PATCH 23/36] t/helper: merge test-ref-store " Nguyễn Thái Ngọc Duy
                   ` (15 subsequent siblings)
  37 siblings, 1 reply; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   | 2 +-
 t/helper/test-read-cache.c | 3 ++-
 t/helper/test-tool.c       | 1 +
 t/helper/test-tool.h       | 1 +
 t/perf/p0002-read-cache.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 076c778494..393fb9aca4 100644
--- a/Makefile
+++ b/Makefile
@@ -671,6 +671,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -678,7 +679,6 @@ TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
-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
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index 48255eef31..cd38f09414 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int argc, const char **argv)
+int test_read_cache(int argc, const char **argv)
 {
 	int i, cnt = 1;
 	if (argc == 2)
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 24ce124868..d82db3c90f 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -26,6 +26,7 @@ static struct test_cmd cmds[] = {
 	{ "online-cpus", test_online_cpus },
 	{ "path-utils", test_path_utils },
 	{ "prio-queue", test_prio_queue },
+	{ "read-cache", test_read_cache },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 713be481d5..2c98cdde41 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -20,6 +20,7 @@ int test_mktemp(int argc, const char **argv);
 int test_online_cpus(int argc, const char **argv);
 int test_path_utils(int argc, const char **argv);
 int test_prio_queue(int argc, const char **argv);
+int test_read_cache(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/perf/p0002-read-cache.sh b/t/perf/p0002-read-cache.sh
index 9180ae9343..cdd105a594 100755
--- a/t/perf/p0002-read-cache.sh
+++ b/t/perf/p0002-read-cache.sh
@@ -8,7 +8,7 @@ test_perf_default_repo
 
 count=1000
 test_perf "read_cache/discard_cache $count times" "
-	test-read-cache $count
+	test-tool read-cache $count
 "
 
 test_done
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 23/36] t/helper: merge test-ref-store into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (21 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 22/36] t/helepr: merge test-read-cache " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 24/36] t/helper: merge test-regex " Nguyễn Thái Ngọc Duy
                   ` (14 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                       | 2 +-
 t/helper/test-ref-store.c      | 3 ++-
 t/helper/test-tool.c           | 1 +
 t/helper/test-tool.h           | 1 +
 t/t1405-main-ref-store.sh      | 2 +-
 t/t1406-submodule-ref-store.sh | 2 +-
 t/t1407-worktree-ref-store.sh  | 4 ++--
 7 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 393fb9aca4..20080fddb8 100644
--- a/Makefile
+++ b/Makefile
@@ -672,6 +672,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -680,7 +681,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 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
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 7120634b04..a797bc532b 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "refs.h"
 #include "worktree.h"
@@ -274,7 +275,7 @@ static struct command commands[] = {
 	{ NULL, NULL }
 };
 
-int cmd_main(int argc, const char **argv)
+int test_ref_store(int argc, const char **argv)
 {
 	struct ref_store *refs;
 	const char *func;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index d82db3c90f..92bd38ac61 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -27,6 +27,7 @@ static struct test_cmd cmds[] = {
 	{ "path-utils", test_path_utils },
 	{ "prio-queue", test_prio_queue },
 	{ "read-cache", test_read_cache },
+	{ "ref-store", test_ref_store },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 2c98cdde41..662d3c9645 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -21,6 +21,7 @@ int test_online_cpus(int argc, const char **argv);
 int test_path_utils(int argc, const char **argv);
 int test_prio_queue(int argc, const char **argv);
 int test_read_cache(int argc, const char **argv);
+int test_ref_store(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh
index e8115df5ba..a30a080b20 100755
--- a/t/t1405-main-ref-store.sh
+++ b/t/t1405-main-ref-store.sh
@@ -4,7 +4,7 @@ test_description='test main ref store api'
 
 . ./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 &&
diff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh
index c32d4cc465..e093782cc3 100755
--- a/t/t1406-submodule-ref-store.sh
+++ b/t/t1406-submodule-ref-store.sh
@@ -4,7 +4,7 @@ test_description='test submodule ref store api'
 
 . ./test-lib.sh
 
-RUN="test-ref-store submodule:sub"
+RUN="test-tool ref-store submodule:sub"
 
 test_expect_success 'setup' '
 	git init sub &&
diff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh
index 8842d0329f..2211f9831f 100755
--- a/t/t1407-worktree-ref-store.sh
+++ b/t/t1407-worktree-ref-store.sh
@@ -4,8 +4,8 @@ test_description='test worktree ref store api'
 
 . ./test-lib.sh
 
-RWT="test-ref-store worktree:wt"
-RMAIN="test-ref-store worktree:main"
+RWT="test-tool ref-store worktree:wt"
+RMAIN="test-tool ref-store worktree:main"
 
 test_expect_success 'setup' '
 	test_commit first &&
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 24/36] t/helper: merge test-regex into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (22 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 23/36] t/helper: merge test-ref-store " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 25/36] t/helper: merge test-revision-walking " Nguyễn Thái Ngọc Duy
                   ` (13 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                        | 2 +-
 t/helper/test-regex.c           | 7 ++++---
 t/helper/test-tool.c            | 1 +
 t/helper/test-tool.h            | 1 +
 t/t0070-fundamental.sh          | 2 +-
 t/t7812-grep-icase-non-ascii.sh | 2 +-
 6 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 20080fddb8..7444c00bbb 100644
--- a/Makefile
+++ b/Makefile
@@ -673,6 +673,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -681,7 +682,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-regex.c b/t/helper/test-regex.c
index b5ea8a97c5..99d1c8edae 100644
--- a/t/helper/test-regex.c
+++ b/t/helper/test-regex.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "gettext.h"
 
@@ -36,7 +37,7 @@ static int test_regex_bug(void)
 	return 0;
 }
 
-int cmd_main(int argc, const char **argv)
+int test_regex(int argc, const char **argv)
 {
 	const char *pat;
 	const char *str;
@@ -47,8 +48,8 @@ int cmd_main(int argc, const char **argv)
 	if (argc == 2 && !strcmp(argv[1], "--bug"))
 		return test_regex_bug();
 	else if (argc < 3)
-		usage("test-regex --bug\n"
-		      "test-regex <pattern> <string> [<options>]");
+		usage("test-tool regex --bug\n"
+		      "test-tool regex <pattern> <string> [<options>]");
 
 	argv++;
 	pat = *argv++;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 92bd38ac61..7352bd40e8 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -28,6 +28,7 @@ static struct test_cmd cmds[] = {
 	{ "prio-queue", test_prio_queue },
 	{ "read-cache", test_read_cache },
 	{ "ref-store", test_ref_store },
+	{ "regex", test_regex },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 662d3c9645..3cb2fd9509 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -22,6 +22,7 @@ int test_path_utils(int argc, const char **argv);
 int test_prio_queue(int argc, const char **argv);
 int test_read_cache(int argc, const char **argv);
 int test_ref_store(int argc, const char **argv);
+int test_regex(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index ac007938ee..23fbe6434a 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -31,7 +31,7 @@ test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' '
 
 test_expect_success 'check for a bug in the regex routines' '
 	# if this test fails, re-build git with NO_REGEX=1
-	test-regex --bug
+	test-tool regex --bug
 '
 
 test_done
diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
index 0059a1f837..0c685d3598 100755
--- a/t/t7812-grep-icase-non-ascii.sh
+++ b/t/t7812-grep-icase-non-ascii.sh
@@ -12,7 +12,7 @@ test_expect_success GETTEXT_LOCALE 'setup' '
 '
 
 test_have_prereq GETTEXT_LOCALE &&
-test-regex "HALLÓ" "Halló" ICASE &&
+test-tool regex "HALLÓ" "Halló" ICASE &&
 test_set_prereq REGEX_LOCALE
 
 test_expect_success REGEX_LOCALE 'grep literal string, no -F' '
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 25/36] t/helper: merge test-revision-walking into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (23 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 24/36] t/helper: merge test-regex " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 26/36] t/helper: merge test-run-command " Nguyễn Thái Ngọc Duy
                   ` (12 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         | 2 +-
 t/helper/test-revision-walking.c | 3 ++-
 t/helper/test-tool.c             | 1 +
 t/helper/test-tool.h             | 1 +
 t/t0062-revision-walking.sh      | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7444c00bbb..3ed461cd55 100644
--- a/Makefile
+++ b/Makefile
@@ -674,6 +674,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -682,7 +683,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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-array
diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c
index b8e6fe1d00..467d710da8 100644
--- a/t/helper/test-revision-walking.c
+++ b/t/helper/test-revision-walking.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#include "test-tool.h"
 #include "cache.h"
 #include "commit.h"
 #include "diff.h"
@@ -45,7 +46,7 @@ static int run_revision_walk(void)
 	return got_revision;
 }
 
-int cmd_main(int argc, const char **argv)
+int test_revision_walking(int argc, const char **argv)
 {
 	if (argc < 2)
 		return 1;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 7352bd40e8..4586ae9440 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -29,6 +29,7 @@ static struct test_cmd cmds[] = {
 	{ "read-cache", test_read_cache },
 	{ "ref-store", test_ref_store },
 	{ "regex", test_regex },
+	{ "revision-walking", test_revision_walking },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 3cb2fd9509..9bbdb05848 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -23,6 +23,7 @@ int test_prio_queue(int argc, const char **argv);
 int test_read_cache(int argc, const char **argv);
 int test_ref_store(int argc, const char **argv);
 int test_regex(int argc, const char **argv);
+int test_revision_walking(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0062-revision-walking.sh b/t/t0062-revision-walking.sh
index 113c728e67..8e215867b8 100755
--- a/t/t0062-revision-walking.sh
+++ b/t/t0062-revision-walking.sh
@@ -26,7 +26,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'revision walking can be done twice' '
-	test-revision-walking run-twice >run_twice_actual &&
+	test-tool revision-walking run-twice >run_twice_actual &&
 	test_cmp run_twice_expected run_twice_actual
 '
 
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 26/36] t/helper: merge test-run-command into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (24 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 25/36] t/helper: merge test-revision-walking " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 27/36] t/helper: merge test-scrap-cache-tree " Nguyễn Thái Ngọc Duy
                   ` (11 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    |  2 +-
 t/helper/test-run-command.c |  3 ++-
 t/helper/test-tool.c        |  1 +
 t/helper/test-tool.h        |  1 +
 t/t0061-run-command.sh      | 24 ++++++++++++------------
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 3ed461cd55..adece67b8e 100644
--- a/Makefile
+++ b/Makefile
@@ -675,6 +675,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -683,7 +684,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-TEST_PROGRAMS_NEED_X += test-run-command
 TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
 TEST_PROGRAMS_NEED_X += test-sha1-array
 TEST_PROGRAMS_NEED_X += test-sigchain
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index 153342e44d..3aa49c3fbb 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "run-command.h"
 #include "argv-array.h"
@@ -49,7 +50,7 @@ static int task_finished(int result,
 	return 1;
 }
 
-int cmd_main(int argc, const char **argv)
+int test_run_command(int argc, const char **argv)
 {
 	struct child_process proc = CHILD_PROCESS_INIT;
 	int jobs;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 4586ae9440..a8a92b6a10 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -30,6 +30,7 @@ static struct test_cmd cmds[] = {
 	{ "ref-store", test_ref_store },
 	{ "regex", test_regex },
 	{ "revision-walking", test_revision_walking },
+	{ "run-command", test_run_command },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 9bbdb05848..23f63ee357 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -24,6 +24,7 @@ int test_read_cache(int argc, const char **argv);
 int test_ref_store(int argc, const char **argv);
 int test_regex(int argc, const char **argv);
 int test_revision_walking(int argc, const char **argv);
+int test_run_command(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 24c92b6cd7..d03149be9f 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -14,13 +14,13 @@ EOF
 >empty
 
 test_expect_success 'start_command reports ENOENT' '
-	test-run-command start-command-ENOENT ./does-not-exist
+	test-tool run-command start-command-ENOENT ./does-not-exist
 '
 
 test_expect_success 'run_command can run a command' '
 	cat hello-script >hello.sh &&
 	chmod +x hello.sh &&
-	test-run-command run-command ./hello.sh >actual 2>err &&
+	test-tool run-command run-command ./hello.sh >actual 2>err &&
 
 	test_cmp hello-script actual &&
 	test_cmp empty err
@@ -31,7 +31,7 @@ test_expect_success !MINGW 'run_command can run a script without a #! line' '
 	cat hello-script
 	EOF
 	chmod +x hello &&
-	test-run-command run-command ./hello >actual 2>err &&
+	test-tool run-command run-command ./hello >actual 2>err &&
 
 	test_cmp hello-script actual &&
 	test_cmp empty err
@@ -45,7 +45,7 @@ test_expect_success 'run_command does not try to execute a directory' '
 	EOF
 
 	PATH=$PWD/bin1:$PWD/bin2:$PATH \
-		test-run-command run-command greet >actual 2>err &&
+		test-tool run-command run-command greet >actual 2>err &&
 	test_cmp bin2/greet actual &&
 	test_cmp empty err
 '
@@ -62,7 +62,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
 	EOF
 
 	PATH=$PWD/bin1:$PWD/bin2:$PATH \
-		test-run-command run-command greet >actual 2>err &&
+		test-tool run-command run-command greet >actual 2>err &&
 	test_cmp bin2/greet actual &&
 	test_cmp empty err
 '
@@ -70,7 +70,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
 test_expect_success POSIXPERM 'run_command reports EACCES' '
 	cat hello-script >hello.sh &&
 	chmod -x hello.sh &&
-	test_must_fail test-run-command run-command ./hello.sh 2>err &&
+	test_must_fail test-tool run-command run-command ./hello.sh 2>err &&
 
 	grep "fatal: cannot exec.*hello.sh" err
 '
@@ -104,17 +104,17 @@ World
 EOF
 
 test_expect_success 'run_command runs in parallel with more jobs available than tasks' '
-	test-run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+	test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'run_command runs in parallel with as many jobs as tasks' '
-	test-run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+	test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'run_command runs in parallel with more tasks than jobs available' '
-	test-run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+	test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
 	test_cmp expect actual
 '
 
@@ -128,7 +128,7 @@ asking for a quick stop
 EOF
 
 test_expect_success 'run_command is asked to abort gracefully' '
-	test-run-command run-command-abort 3 false 2>actual &&
+	test-tool run-command run-command-abort 3 false 2>actual &&
 	test_cmp expect actual
 '
 
@@ -137,14 +137,14 @@ no further jobs available
 EOF
 
 test_expect_success 'run_command outputs ' '
-	test-run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+	test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
 	test_cmp expect actual
 '
 
 test_trace () {
 	expect="$1"
 	shift
-	GIT_TRACE=1 test-run-command "$@" run-command true 2>&1 >/dev/null | \
+	GIT_TRACE=1 test-tool run-command "$@" run-command true 2>&1 >/dev/null | \
 		sed 's/.* run_command: //' >actual &&
 	echo "$expect true" >expect &&
 	test_cmp expect actual
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 27/36] t/helper: merge test-scrap-cache-tree into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (25 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 26/36] t/helper: merge test-run-command " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 28/36] t/helper: merge test-sha1-array " Nguyễn Thái Ngọc Duy
                   ` (10 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         | 2 +-
 t/helper/test-scrap-cache-tree.c | 3 ++-
 t/helper/test-tool.c             | 1 +
 t/helper/test-tool.h             | 1 +
 t/t0090-cache-tree.sh            | 8 ++++----
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index adece67b8e..ba7c7d8a79 100644
--- a/Makefile
+++ b/Makefile
@@ -676,6 +676,7 @@ 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.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -684,7 +685,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
 TEST_PROGRAMS_NEED_X += test-sha1-array
 TEST_PROGRAMS_NEED_X += test-sigchain
 TEST_PROGRAMS_NEED_X += test-strcmp-offset
diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c
index d2a63bea43..e1246602a7 100644
--- a/t/helper/test-scrap-cache-tree.c
+++ b/t/helper/test-scrap-cache-tree.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "lockfile.h"
 #include "tree.h"
@@ -5,7 +6,7 @@
 
 static struct lock_file index_lock;
 
-int cmd_main(int ac, const char **av)
+int test_scrap_cache_tree(int ac, const char **av)
 {
 	setup_git_directory();
 	hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index a8a92b6a10..f12f1ec5bb 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -31,6 +31,7 @@ static struct test_cmd cmds[] = {
 	{ "regex", test_regex },
 	{ "revision-walking", test_revision_walking },
 	{ "run-command", test_run_command },
+	{ "scrap-cache-tree", test_scrap_cache_tree },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 23f63ee357..92504e951f 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -25,6 +25,7 @@ int test_ref_store(int argc, const char **argv);
 int test_regex(int argc, const char **argv);
 int test_revision_walking(int argc, const char **argv);
 int test_run_command(int argc, const char **argv);
+int test_scrap_cache_tree(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 3266209e41..4ae0995cd9 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -115,14 +115,14 @@ test_expect_success 'update-index invalidates cache-tree' '
 '
 
 test_expect_success 'write-tree establishes cache-tree' '
-	test-scrap-cache-tree &&
+	test-tool scrap-cache-tree &&
 	git write-tree &&
 	test_cache_tree
 '
 
-test_expect_success 'test-scrap-cache-tree works' '
+test_expect_success 'test-tool scrap-cache-tree works' '
 	git read-tree HEAD &&
-	test-scrap-cache-tree &&
+	test-tool scrap-cache-tree &&
 	test_no_cache_tree
 '
 
@@ -170,7 +170,7 @@ test_expect_success 'commit in child dir has cache-tree' '
 '
 
 test_expect_success 'reset --hard gives cache-tree' '
-	test-scrap-cache-tree &&
+	test-tool scrap-cache-tree &&
 	git reset --hard &&
 	test_cache_tree
 '
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 28/36] t/helper: merge test-sha1-array into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (26 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 27/36] t/helper: merge test-scrap-cache-tree " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 29/36] t/helper: merge test-sigchain " Nguyễn Thái Ngọc Duy
                   ` (9 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   |  2 +-
 t/helper/test-sha1-array.c |  3 ++-
 t/helper/test-tool.c       |  1 +
 t/helper/test-tool.h       |  1 +
 t/t0064-sha1-array.sh      | 16 ++++++++--------
 5 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index ba7c7d8a79..b50a0818a9 100644
--- a/Makefile
+++ b/Makefile
@@ -677,6 +677,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -685,7 +686,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-sha1-array.c b/t/helper/test-sha1-array.c
index edfd52d82a..1e08598beb 100644
--- a/t/helper/test-sha1-array.c
+++ b/t/helper/test-sha1-array.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "sha1-array.h"
 
@@ -7,7 +8,7 @@ static int print_oid(const struct object_id *oid, void *data)
 	return 0;
 }
 
-int cmd_main(int argc, const char **argv)
+int test_sha1_array(int argc, const char **argv)
 {
 	struct oid_array array = OID_ARRAY_INIT;
 	struct strbuf line = STRBUF_INIT;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index f12f1ec5bb..54d62b8b32 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -32,6 +32,7 @@ static struct test_cmd cmds[] = {
 	{ "revision-walking", test_revision_walking },
 	{ "run-command", test_run_command },
 	{ "scrap-cache-tree", test_scrap_cache_tree },
+	{ "sha1-array", test_sha1_array },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 92504e951f..10d1322e0d 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -26,6 +26,7 @@ int test_regex(int argc, const char **argv);
 int test_revision_walking(int argc, const char **argv);
 int test_run_command(int argc, const char **argv);
 int test_scrap_cache_tree(int argc, const char **argv);
+int test_sha1_array(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0064-sha1-array.sh b/t/t0064-sha1-array.sh
index 50b31ffe75..67484502a0 100755
--- a/t/t0064-sha1-array.sh
+++ b/t/t0064-sha1-array.sh
@@ -18,7 +18,7 @@ test_expect_success 'ordered enumeration' '
 	{
 		echo20 append 88 44 aa 55 &&
 		echo for_each_unique
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	test_cmp expect actual
 '
 
@@ -28,7 +28,7 @@ test_expect_success 'ordered enumeration with duplicate suppression' '
 		echo20 append 88 44 aa 55 &&
 		echo20 append 88 44 aa 55 &&
 		echo for_each_unique
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	test_cmp expect actual
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'lookup' '
 	{
 		echo20 append 88 44 aa 55 &&
 		echo20 lookup 55
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -eq 1
 '
@@ -45,7 +45,7 @@ test_expect_success 'lookup non-existing entry' '
 	{
 		echo20 append 88 44 aa 55 &&
 		echo20 lookup 33
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -lt 0
 '
@@ -55,7 +55,7 @@ test_expect_success 'lookup with duplicates' '
 		echo20 append 88 44 aa 55 &&
 		echo20 append 88 44 aa 55 &&
 		echo20 lookup 55
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -ge 2 &&
 	test "$n" -le 3
@@ -66,7 +66,7 @@ test_expect_success 'lookup non-existing entry with duplicates' '
 		echo20 append 88 44 aa 55 &&
 		echo20 append 88 44 aa 55 &&
 		echo20 lookup 66
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -lt 0
 '
@@ -76,7 +76,7 @@ test_expect_success 'lookup with almost duplicate values' '
 		echo "append 5555555555555555555555555555555555555555" &&
 		echo "append 555555555555555555555555555555555555555f" &&
 		echo20 lookup 55
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -eq 0
 '
@@ -85,7 +85,7 @@ test_expect_success 'lookup with single duplicate value' '
 	{
 		echo20 append 55 55 &&
 		echo20 lookup 55
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -ge 0 &&
 	test "$n" -le 1
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 29/36] t/helper: merge test-sigchain into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (27 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 28/36] t/helper: merge test-sha1-array " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 30/36] t/helper: merge test-strcmp-offset " Nguyễn Thái Ngọc Duy
                   ` (8 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                 | 2 +-
 t/helper/test-sigchain.c | 3 ++-
 t/helper/test-tool.c     | 1 +
 t/helper/test-tool.h     | 1 +
 t/t0005-signals.sh       | 4 ++--
 5 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b50a0818a9..51de8882d0 100644
--- a/Makefile
+++ b/Makefile
@@ -679,6 +679,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -686,7 +687,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-sigchain.c b/t/helper/test-sigchain.c
index b71edbd442..0cfbf9e0af 100644
--- a/t/helper/test-sigchain.c
+++ b/t/helper/test-sigchain.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "sigchain.h"
 
@@ -13,7 +14,7 @@ X(two)
 X(three)
 #undef X
 
-int cmd_main(int argc, const char **argv) {
+int test_sigchain(int argc, const char **argv) {
 	sigchain_push(SIGTERM, one);
 	sigchain_push(SIGTERM, two);
 	sigchain_push(SIGTERM, three);
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 54d62b8b32..99db507a24 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -34,6 +34,7 @@ static struct test_cmd cmds[] = {
 	{ "scrap-cache-tree", test_scrap_cache_tree },
 	{ "sha1-array", test_sha1_array },
 	{ "sha1", test_sha1 },
+	{ "sigchain", test_sigchain },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 10d1322e0d..4c71df8c79 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -28,5 +28,6 @@ int test_run_command(int argc, const char **argv);
 int test_scrap_cache_tree(int argc, const char **argv);
 int test_sha1_array(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
+int test_sigchain(int argc, const char **argv);
 
 #endif
diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index c16947cf5d..4c214bd11c 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -10,7 +10,7 @@ one
 EOF
 
 test_expect_success 'sigchain works' '
-	{ test-sigchain >actual; ret=$?; } &&
+	{ test-tool sigchain >actual; ret=$?; } &&
 	{
 		# Signal death by raise() on Windows acts like exit(3),
 		# regardless of the signal number. So we must allow that
@@ -24,7 +24,7 @@ test_expect_success 'sigchain works' '
 test_expect_success !MINGW 'signals are propagated using shell convention' '
 	# we use exec here to avoid any sub-shell interpretation
 	# of the exit code
-	git config alias.sigterm "!exec test-sigchain" &&
+	git config alias.sigterm "!exec test-tool sigchain" &&
 	test_expect_code 143 git sigterm
 '
 
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 30/36] t/helper: merge test-strcmp-offset into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (28 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 29/36] t/helper: merge test-sigchain " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 31/36] t/helper: merge test-string-list " Nguyễn Thái Ngọc Duy
                   ` (7 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                      | 2 +-
 t/helper/test-strcmp-offset.c | 3 ++-
 t/helper/test-tool.c          | 1 +
 t/helper/test-tool.h          | 1 +
 t/t0065-strcmp-offset.sh      | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 51de8882d0..528a80b6a6 100644
--- a/Makefile
+++ b/Makefile
@@ -680,6 +680,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -687,7 +688,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-strcmp-offset.c b/t/helper/test-strcmp-offset.c
index e159c9a127..3f80833542 100644
--- a/t/helper/test-strcmp-offset.c
+++ b/t/helper/test-strcmp-offset.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int argc, const char **argv)
+int test_strcmp_offset(int argc, const char **argv)
 {
 	int result;
 	size_t offset;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 99db507a24..7e684960e0 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -35,6 +35,7 @@ static struct test_cmd cmds[] = {
 	{ "sha1-array", test_sha1_array },
 	{ "sha1", test_sha1 },
 	{ "sigchain", test_sigchain },
+	{ "strcmp-offset", test_strcmp_offset },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 4c71df8c79..42ebb67af6 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -29,5 +29,6 @@ int test_scrap_cache_tree(int argc, const char **argv);
 int test_sha1_array(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 int test_sigchain(int argc, const char **argv);
+int test_strcmp_offset(int argc, const char **argv);
 
 #endif
diff --git a/t/t0065-strcmp-offset.sh b/t/t0065-strcmp-offset.sh
index 7d6d21425f..91fa639c4a 100755
--- a/t/t0065-strcmp-offset.sh
+++ b/t/t0065-strcmp-offset.sh
@@ -8,7 +8,7 @@ while read s1 s2 expect
 do
 	test_expect_success "strcmp_offset($s1, $s2)" '
 		echo "$expect" >expect &&
-		test-strcmp-offset "$s1" "$s2" >actual &&
+		test-tool strcmp-offset "$s1" "$s2" >actual &&
 		test_cmp expect actual
 	'
 done <<-EOF
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 31/36] t/helper: merge test-string-list into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (29 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 30/36] t/helper: merge test-strcmp-offset " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 32/36] t/helper: merge test-submodule-config " Nguyễn Thái Ngọc Duy
                   ` (6 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    |  2 +-
 t/helper/test-string-list.c |  3 ++-
 t/helper/test-tool.c        |  1 +
 t/helper/test-tool.h        |  1 +
 t/perf/p0071-sort.sh        |  2 +-
 t/t0063-string-list.sh      | 48 ++++++++++++++++++-------------------
 6 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index 528a80b6a6..6819792c2b 100644
--- a/Makefile
+++ b/Makefile
@@ -681,6 +681,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -688,7 +689,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index 829ec3d7d2..4ad957c31c 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "string-list.h"
 
@@ -41,7 +42,7 @@ static int prefix_cb(struct string_list_item *item, void *cb_data)
 	return starts_with(item->string, prefix);
 }
 
-int cmd_main(int argc, const char **argv)
+int test_string_list(int argc, const char **argv)
 {
 	if (argc == 5 && !strcmp(argv[1], "split")) {
 		struct string_list list = STRING_LIST_INIT_DUP;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 7e684960e0..2e428825d5 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -36,6 +36,7 @@ static struct test_cmd cmds[] = {
 	{ "sha1", test_sha1 },
 	{ "sigchain", test_sigchain },
 	{ "strcmp-offset", test_strcmp_offset },
+	{ "string-list", test_string_list },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 42ebb67af6..943d92452a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -30,5 +30,6 @@ int test_sha1_array(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 int test_sigchain(int argc, const char **argv);
 int test_strcmp_offset(int argc, const char **argv);
+int test_string_list(int argc, const char **argv);
 
 #endif
diff --git a/t/perf/p0071-sort.sh b/t/perf/p0071-sort.sh
index 7c9a35a646..6e924f5fa3 100755
--- a/t/perf/p0071-sort.sh
+++ b/t/perf/p0071-sort.sh
@@ -16,7 +16,7 @@ test_perf 'sort(1)' '
 '
 
 test_perf 'string_list_sort()' '
-	test-string-list sort <unsorted >actual
+	test-tool string-list sort <unsorted >actual
 '
 
 test_expect_success 'string_list_sort() sorts like sort(1)' '
diff --git a/t/t0063-string-list.sh b/t/t0063-string-list.sh
index dbfc05ebdc..c6ee9f66b1 100755
--- a/t/t0063-string-list.sh
+++ b/t/t0063-string-list.sh
@@ -10,9 +10,9 @@ test_description='Test string list functionality'
 test_split () {
 	cat >expected &&
 	test_expect_success "split $1 at $2, max $3" "
-		test-string-list split '$1' '$2' '$3' >actual &&
+		test-tool string-list split '$1' '$2' '$3' >actual &&
 		test_cmp expected actual &&
-		test-string-list split_in_place '$1' '$2' '$3' >actual &&
+		test-tool string-list split_in_place '$1' '$2' '$3' >actual &&
 		test_cmp expected actual
 	"
 }
@@ -61,31 +61,31 @@ test_split ":" ":" "-1" <<EOF
 EOF
 
 test_expect_success "test filter_string_list" '
-	test "x-" = "x$(test-string-list filter - y)" &&
-	test "x-" = "x$(test-string-list filter no y)" &&
-	test yes = "$(test-string-list filter yes y)" &&
-	test yes = "$(test-string-list filter no:yes y)" &&
-	test yes = "$(test-string-list filter yes:no y)" &&
-	test y1:y2 = "$(test-string-list filter y1:y2 y)" &&
-	test y2:y1 = "$(test-string-list filter y2:y1 y)" &&
-	test "x-" = "x$(test-string-list filter x1:x2 y)"
+	test "x-" = "x$(test-tool string-list filter - y)" &&
+	test "x-" = "x$(test-tool string-list filter no y)" &&
+	test yes = "$(test-tool string-list filter yes y)" &&
+	test yes = "$(test-tool string-list filter no:yes y)" &&
+	test yes = "$(test-tool string-list filter yes:no y)" &&
+	test y1:y2 = "$(test-tool string-list filter y1:y2 y)" &&
+	test y2:y1 = "$(test-tool string-list filter y2:y1 y)" &&
+	test "x-" = "x$(test-tool string-list filter x1:x2 y)"
 '
 
 test_expect_success "test remove_duplicates" '
-	test "x-" = "x$(test-string-list remove_duplicates -)" &&
-	test "x" = "x$(test-string-list remove_duplicates "")" &&
-	test a = "$(test-string-list remove_duplicates a)" &&
-	test a = "$(test-string-list remove_duplicates a:a)" &&
-	test a = "$(test-string-list remove_duplicates a:a:a:a:a)" &&
-	test a:b = "$(test-string-list remove_duplicates a:b)" &&
-	test a:b = "$(test-string-list remove_duplicates a:a:b)" &&
-	test a:b = "$(test-string-list remove_duplicates a:b:b)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:b:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:a:b:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:b:b:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:b:c:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:a:b:b:c:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
+	test "x-" = "x$(test-tool string-list remove_duplicates -)" &&
+	test "x" = "x$(test-tool string-list remove_duplicates "")" &&
+	test a = "$(test-tool string-list remove_duplicates a)" &&
+	test a = "$(test-tool string-list remove_duplicates a:a)" &&
+	test a = "$(test-tool string-list remove_duplicates a:a:a:a:a)" &&
+	test a:b = "$(test-tool string-list remove_duplicates a:b)" &&
+	test a:b = "$(test-tool string-list remove_duplicates a:a:b)" &&
+	test a:b = "$(test-tool string-list remove_duplicates a:b:b)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:b:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:b:b:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:b:c:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:b:c:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
 '
 
 test_done
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 32/36] t/helper: merge test-submodule-config into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (30 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 31/36] t/helper: merge test-string-list " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 33/36] t/helper: merge test-subprocess " Nguyễn Thái Ngọc Duy
                   ` (5 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         |  2 +-
 t/helper/test-submodule-config.c |  3 ++-
 t/helper/test-tool.c             |  1 +
 t/helper/test-tool.h             |  1 +
 t/t7411-submodule-config.sh      | 18 +++++++++---------
 5 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 6819792c2b..c1dc9ff8d6 100644
--- a/Makefile
+++ b/Makefile
@@ -682,6 +682,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -689,7 +690,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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-tool
diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c
index f23db3b19a..63c4b90e37 100644
--- a/t/helper/test-submodule-config.c
+++ b/t/helper/test-submodule-config.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "config.h"
 #include "submodule-config.h"
@@ -10,7 +11,7 @@ static void die_usage(int argc, const char **argv, const char *msg)
 	exit(1);
 }
 
-int cmd_main(int argc, const char **argv)
+int test_submodule_config(int argc, const char **argv)
 {
 	const char **arg = argv;
 	int my_argc = argc;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 2e428825d5..1b95f1b30b 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -37,6 +37,7 @@ static struct test_cmd cmds[] = {
 	{ "sigchain", test_sigchain },
 	{ "strcmp-offset", test_strcmp_offset },
 	{ "string-list", test_string_list },
+	{ "submodule-config", test_submodule_config },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 943d92452a..16a05993e5 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -31,5 +31,6 @@ int test_sha1(int argc, const char **argv);
 int test_sigchain(int argc, const char **argv);
 int test_strcmp_offset(int argc, const char **argv);
 int test_string_list(int argc, const char **argv);
+int test_submodule_config(int argc, const char **argv);
 
 #endif
diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh
index 46c09c7765..0bde5850ac 100755
--- a/t/t7411-submodule-config.sh
+++ b/t/t7411-submodule-config.sh
@@ -41,7 +41,7 @@ test_expect_success 'configuration parsing with error' '
 	EOF
 	(
 		cd repo &&
-		test_must_fail test-submodule-config "" s 2>actual &&
+		test_must_fail test-tool submodule-config "" s 2>actual &&
 		test_i18ngrep "bad config" actual
 	)
 '
@@ -55,7 +55,7 @@ EOF
 
 test_expect_success 'test parsing and lookup of submodule config by path' '
 	(cd super &&
-		test-submodule-config \
+		test-tool submodule-config \
 			HEAD^ a \
 			HEAD b \
 			HEAD^ submodule \
@@ -67,7 +67,7 @@ test_expect_success 'test parsing and lookup of submodule config by path' '
 
 test_expect_success 'test parsing and lookup of submodule config by name' '
 	(cd super &&
-		test-submodule-config --name \
+		test-tool submodule-config --name \
 			HEAD^ a \
 			HEAD a \
 			HEAD^ submodule \
@@ -89,7 +89,7 @@ test_expect_success 'error in one submodule config lets continue' '
 		git add .gitmodules &&
 		mv .gitmodules.bak .gitmodules &&
 		git commit -m "add error" &&
-		test-submodule-config \
+		test-tool submodule-config \
 			HEAD b \
 			HEAD submodule \
 				>actual &&
@@ -100,7 +100,7 @@ test_expect_success 'error in one submodule config lets continue' '
 test_expect_success 'error message contains blob reference' '
 	(cd super &&
 		sha1=$(git rev-parse HEAD) &&
-		test-submodule-config \
+		test-tool submodule-config \
 			HEAD b \
 			HEAD submodule \
 				2>actual_err &&
@@ -114,9 +114,9 @@ test_expect_success 'using different treeishs works' '
 		git tag new_tag &&
 		tree=$(git rev-parse HEAD^{tree}) &&
 		commit=$(git rev-parse HEAD^{commit}) &&
-		test-submodule-config $commit b >expect &&
-		test-submodule-config $tree b >actual.1 &&
-		test-submodule-config new_tag b >actual.2 &&
+		test-tool submodule-config $commit b >expect &&
+		test-tool submodule-config $tree b >actual.1 &&
+		test-tool submodule-config new_tag b >actual.2 &&
 		test_cmp expect actual.1 &&
 		test_cmp expect actual.2
 	)
@@ -130,7 +130,7 @@ test_expect_success 'error in history in fetchrecursesubmodule lets continue' '
 		git config --unset -f .gitmodules \
 			submodule.submodule.fetchrecursesubmodules &&
 		git commit -m "add error in fetchrecursesubmodules" &&
-		test-submodule-config \
+		test-tool submodule-config \
 			HEAD b \
 			HEAD submodule \
 				>actual &&
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 33/36] t/helper: merge test-subprocess into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (31 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 32/36] t/helper: merge test-submodule-config " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 34/36] t/helper: merge test-urlmatch-.. " Nguyễn Thái Ngọc Duy
                   ` (4 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   | 2 +-
 t/helper/test-subprocess.c | 3 ++-
 t/helper/test-tool.c       | 1 +
 t/helper/test-tool.h       | 1 +
 t/t1501-work-tree.sh       | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index c1dc9ff8d6..893ea64ca2 100644
--- a/Makefile
+++ b/Makefile
@@ -683,6 +683,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -690,7 +691,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-TEST_PROGRAMS_NEED_X += test-subprocess
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
 TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
diff --git a/t/helper/test-subprocess.c b/t/helper/test-subprocess.c
index 30c5765bfc..2699257663 100644
--- a/t/helper/test-subprocess.c
+++ b/t/helper/test-subprocess.c
@@ -1,7 +1,8 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "run-command.h"
 
-int cmd_main(int argc, const char **argv)
+int test_subprocess(int argc, const char **argv)
 {
 	struct child_process cp = CHILD_PROCESS_INIT;
 	int nogit = 0;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 1b95f1b30b..49f4d6f901 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -38,6 +38,7 @@ static struct test_cmd cmds[] = {
 	{ "strcmp-offset", test_strcmp_offset },
 	{ "string-list", test_string_list },
 	{ "submodule-config", test_submodule_config },
+	{ "subprocess", test_subprocess },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 16a05993e5..eaf15cbd84 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -32,5 +32,6 @@ int test_sigchain(int argc, const char **argv);
 int test_strcmp_offset(int argc, const char **argv);
 int test_string_list(int argc, const char **argv);
 int test_submodule_config(int argc, const char **argv);
+int test_subprocess(int argc, const char **argv);
 
 #endif
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index b07cb9140e..02cf2013fc 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -341,7 +341,7 @@ test_expect_success 'make_relative_path handles double slashes in GIT_DIR' '
 
 test_expect_success 'relative $GIT_WORK_TREE and git subprocesses' '
 	GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work \
-	test-subprocess --setup-work-tree rev-parse --show-toplevel >actual &&
+	test-tool subprocess --setup-work-tree rev-parse --show-toplevel >actual &&
 	echo "$(pwd)/repo.git/work" >expected &&
 	test_cmp expected actual
 '
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 34/36] t/helper: merge test-urlmatch-.. into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (32 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 33/36] t/helper: merge test-subprocess " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-18  2:32   ` Eric Sunshine
  2018-03-17  7:54 ` [PATCH 35/36] t/helper: merge test-wildmatch " Nguyễn Thái Ngọc Duy
                   ` (3 subsequent siblings)
  37 siblings, 1 reply; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                               |   2 +-
 t/helper/test-tool.c                   |   1 +
 t/helper/test-tool.h                   |   1 +
 t/helper/test-urlmatch-normalization.c |   5 +-
 t/t0110-urlmatch-normalization.sh      | 266 ++++++++++++-------------
 5 files changed, 139 insertions(+), 136 deletions(-)

diff --git a/Makefile b/Makefile
index 893ea64ca2..7923ec3747 100644
--- a/Makefile
+++ b/Makefile
@@ -684,6 +684,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -693,7 +694,6 @@ TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
-TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
 TEST_PROGRAMS_NEED_X += test-wildmatch
 
 TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 49f4d6f901..f2d60af898 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -39,6 +39,7 @@ static struct test_cmd cmds[] = {
 	{ "string-list", test_string_list },
 	{ "submodule-config", test_submodule_config },
 	{ "subprocess", test_subprocess },
+	{ "urlmatch-normalization", test_urlmatch_normalization },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index eaf15cbd84..704ac9df35 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -33,5 +33,6 @@ int test_strcmp_offset(int argc, const char **argv);
 int test_string_list(int argc, const char **argv);
 int test_submodule_config(int argc, const char **argv);
 int test_subprocess(int argc, const char **argv);
+int test_urlmatch_normalization(int argc, const char **argv);
 
 #endif
diff --git a/t/helper/test-urlmatch-normalization.c b/t/helper/test-urlmatch-normalization.c
index 49b6e836be..8edd4da7e1 100644
--- a/t/helper/test-urlmatch-normalization.c
+++ b/t/helper/test-urlmatch-normalization.c
@@ -1,9 +1,10 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "urlmatch.h"
 
-int cmd_main(int argc, const char **argv)
+int test_urlmatch_normalization(int argc, const char **argv)
 {
-	const char usage[] = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
+	const char usage[] = "test-tool urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
 	char *url1, *url2;
 	int opt_p = 0, opt_l = 0;
 
diff --git a/t/t0110-urlmatch-normalization.sh b/t/t0110-urlmatch-normalization.sh
index 410d5768ca..f99529d838 100755
--- a/t/t0110-urlmatch-normalization.sh
+++ b/t/t0110-urlmatch-normalization.sh
@@ -9,172 +9,172 @@ tu="$TEST_DIRECTORY/t0110/url"
 # Note that only file: URLs should be allowed without a host
 
 test_expect_success 'url scheme' '
-	! test-urlmatch-normalization "" &&
-	! test-urlmatch-normalization "_" &&
-	! test-urlmatch-normalization "scheme" &&
-	! test-urlmatch-normalization "scheme:" &&
-	! test-urlmatch-normalization "scheme:/" &&
-	! test-urlmatch-normalization "scheme://" &&
-	! test-urlmatch-normalization "file" &&
-	! test-urlmatch-normalization "file:" &&
-	! test-urlmatch-normalization "file:/" &&
-	test-urlmatch-normalization "file://" &&
-	! test-urlmatch-normalization "://acme.co" &&
-	! test-urlmatch-normalization "x_test://acme.co" &&
-	! test-urlmatch-normalization "-test://acme.co" &&
-	! test-urlmatch-normalization "0test://acme.co" &&
-	! test-urlmatch-normalization "+test://acme.co" &&
-	! test-urlmatch-normalization ".test://acme.co" &&
-	! test-urlmatch-normalization "schem%6e://" &&
-	test-urlmatch-normalization "x-Test+v1.0://acme.co" &&
-	test "$(test-urlmatch-normalization -p "AbCdeF://x.Y")" = "abcdef://x.y/"
+	! test-tool urlmatch-normalization "" &&
+	! test-tool urlmatch-normalization "_" &&
+	! test-tool urlmatch-normalization "scheme" &&
+	! test-tool urlmatch-normalization "scheme:" &&
+	! test-tool urlmatch-normalization "scheme:/" &&
+	! test-tool urlmatch-normalization "scheme://" &&
+	! test-tool urlmatch-normalization "file" &&
+	! test-tool urlmatch-normalization "file:" &&
+	! test-tool urlmatch-normalization "file:/" &&
+	test-tool urlmatch-normalization "file://" &&
+	! test-tool urlmatch-normalization "://acme.co" &&
+	! test-tool urlmatch-normalization "x_test://acme.co" &&
+	! test-tool urlmatch-normalization "-test://acme.co" &&
+	! test-tool urlmatch-normalization "0test://acme.co" &&
+	! test-tool urlmatch-normalization "+test://acme.co" &&
+	! test-tool urlmatch-normalization ".test://acme.co" &&
+	! test-tool urlmatch-normalization "schem%6e://" &&
+	test-tool urlmatch-normalization "x-Test+v1.0://acme.co" &&
+	test "$(test-tool urlmatch-normalization -p "AbCdeF://x.Y")" = "abcdef://x.y/"
 '
 
 test_expect_success 'url authority' '
-	! test-urlmatch-normalization "scheme://user:pass@" &&
-	! test-urlmatch-normalization "scheme://?" &&
-	! test-urlmatch-normalization "scheme://#" &&
-	! test-urlmatch-normalization "scheme:///" &&
-	! test-urlmatch-normalization "scheme://:" &&
-	! test-urlmatch-normalization "scheme://:555" &&
-	test-urlmatch-normalization "file://user:pass@" &&
-	test-urlmatch-normalization "file://?" &&
-	test-urlmatch-normalization "file://#" &&
-	test-urlmatch-normalization "file:///" &&
-	test-urlmatch-normalization "file://:" &&
-	! test-urlmatch-normalization "file://:555" &&
-	test-urlmatch-normalization "scheme://user:pass@host" &&
-	test-urlmatch-normalization "scheme://@host" &&
-	test-urlmatch-normalization "scheme://%00@host" &&
-	! test-urlmatch-normalization "scheme://%%@host" &&
-	! test-urlmatch-normalization "scheme://host_" &&
-	test-urlmatch-normalization "scheme://user:pass@host/" &&
-	test-urlmatch-normalization "scheme://@host/" &&
-	test-urlmatch-normalization "scheme://host/" &&
-	test-urlmatch-normalization "scheme://host?x" &&
-	test-urlmatch-normalization "scheme://host#x" &&
-	test-urlmatch-normalization "scheme://host/@" &&
-	test-urlmatch-normalization "scheme://host?@x" &&
-	test-urlmatch-normalization "scheme://host#@x" &&
-	test-urlmatch-normalization "scheme://[::1]" &&
-	test-urlmatch-normalization "scheme://[::1]/" &&
-	! test-urlmatch-normalization "scheme://hos%41/" &&
-	test-urlmatch-normalization "scheme://[invalid....:/" &&
-	test-urlmatch-normalization "scheme://invalid....:]/" &&
-	! test-urlmatch-normalization "scheme://invalid....:[/" &&
-	! test-urlmatch-normalization "scheme://invalid....:["
+	! test-tool urlmatch-normalization "scheme://user:pass@" &&
+	! test-tool urlmatch-normalization "scheme://?" &&
+	! test-tool urlmatch-normalization "scheme://#" &&
+	! test-tool urlmatch-normalization "scheme:///" &&
+	! test-tool urlmatch-normalization "scheme://:" &&
+	! test-tool urlmatch-normalization "scheme://:555" &&
+	test-tool urlmatch-normalization "file://user:pass@" &&
+	test-tool urlmatch-normalization "file://?" &&
+	test-tool urlmatch-normalization "file://#" &&
+	test-tool urlmatch-normalization "file:///" &&
+	test-tool urlmatch-normalization "file://:" &&
+	! test-tool urlmatch-normalization "file://:555" &&
+	test-tool urlmatch-normalization "scheme://user:pass@host" &&
+	test-tool urlmatch-normalization "scheme://@host" &&
+	test-tool urlmatch-normalization "scheme://%00@host" &&
+	! test-tool urlmatch-normalization "scheme://%%@host" &&
+	! test-tool urlmatch-normalization "scheme://host_" &&
+	test-tool urlmatch-normalization "scheme://user:pass@host/" &&
+	test-tool urlmatch-normalization "scheme://@host/" &&
+	test-tool urlmatch-normalization "scheme://host/" &&
+	test-tool urlmatch-normalization "scheme://host?x" &&
+	test-tool urlmatch-normalization "scheme://host#x" &&
+	test-tool urlmatch-normalization "scheme://host/@" &&
+	test-tool urlmatch-normalization "scheme://host?@x" &&
+	test-tool urlmatch-normalization "scheme://host#@x" &&
+	test-tool urlmatch-normalization "scheme://[::1]" &&
+	test-tool urlmatch-normalization "scheme://[::1]/" &&
+	! test-tool urlmatch-normalization "scheme://hos%41/" &&
+	test-tool urlmatch-normalization "scheme://[invalid....:/" &&
+	test-tool urlmatch-normalization "scheme://invalid....:]/" &&
+	! test-tool urlmatch-normalization "scheme://invalid....:[/" &&
+	! test-tool urlmatch-normalization "scheme://invalid....:["
 '
 
 test_expect_success 'url port checks' '
-	test-urlmatch-normalization "xyz://q@some.host:" &&
-	test-urlmatch-normalization "xyz://q@some.host:456/" &&
-	! test-urlmatch-normalization "xyz://q@some.host:0" &&
-	! test-urlmatch-normalization "xyz://q@some.host:0000000" &&
-	test-urlmatch-normalization "xyz://q@some.host:0000001?" &&
-	test-urlmatch-normalization "xyz://q@some.host:065535#" &&
-	test-urlmatch-normalization "xyz://q@some.host:65535" &&
-	! test-urlmatch-normalization "xyz://q@some.host:65536" &&
-	! test-urlmatch-normalization "xyz://q@some.host:99999" &&
-	! test-urlmatch-normalization "xyz://q@some.host:100000" &&
-	! test-urlmatch-normalization "xyz://q@some.host:100001" &&
-	test-urlmatch-normalization "http://q@some.host:80" &&
-	test-urlmatch-normalization "https://q@some.host:443" &&
-	test-urlmatch-normalization "http://q@some.host:80/" &&
-	test-urlmatch-normalization "https://q@some.host:443?" &&
-	! test-urlmatch-normalization "http://q@:8008" &&
-	! test-urlmatch-normalization "http://:8080" &&
-	! test-urlmatch-normalization "http://:" &&
-	test-urlmatch-normalization "xyz://q@some.host:456/" &&
-	test-urlmatch-normalization "xyz://[::1]:456/" &&
-	test-urlmatch-normalization "xyz://[::1]:/" &&
-	! test-urlmatch-normalization "xyz://[::1]:000/" &&
-	! test-urlmatch-normalization "xyz://[::1]:0%300/" &&
-	! test-urlmatch-normalization "xyz://[::1]:0x80/" &&
-	! test-urlmatch-normalization "xyz://[::1]:4294967297/" &&
-	! test-urlmatch-normalization "xyz://[::1]:030f/"
+	test-tool urlmatch-normalization "xyz://q@some.host:" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:456/" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:0" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:0000000" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:0000001?" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:065535#" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:65535" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:65536" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:99999" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:100000" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:100001" &&
+	test-tool urlmatch-normalization "http://q@some.host:80" &&
+	test-tool urlmatch-normalization "https://q@some.host:443" &&
+	test-tool urlmatch-normalization "http://q@some.host:80/" &&
+	test-tool urlmatch-normalization "https://q@some.host:443?" &&
+	! test-tool urlmatch-normalization "http://q@:8008" &&
+	! test-tool urlmatch-normalization "http://:8080" &&
+	! test-tool urlmatch-normalization "http://:" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:456/" &&
+	test-tool urlmatch-normalization "xyz://[::1]:456/" &&
+	test-tool urlmatch-normalization "xyz://[::1]:/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:000/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:0%300/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:0x80/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:4294967297/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:030f/"
 '
 
 test_expect_success 'url port normalization' '
-	test "$(test-urlmatch-normalization -p "http://x:800")" = "http://x:800/" &&
-	test "$(test-urlmatch-normalization -p "http://x:0800")" = "http://x:800/" &&
-	test "$(test-urlmatch-normalization -p "http://x:00000800")" = "http://x:800/" &&
-	test "$(test-urlmatch-normalization -p "http://x:065535")" = "http://x:65535/" &&
-	test "$(test-urlmatch-normalization -p "http://x:1")" = "http://x:1/" &&
-	test "$(test-urlmatch-normalization -p "http://x:80")" = "http://x/" &&
-	test "$(test-urlmatch-normalization -p "http://x:080")" = "http://x/" &&
-	test "$(test-urlmatch-normalization -p "http://x:000000080")" = "http://x/" &&
-	test "$(test-urlmatch-normalization -p "https://x:443")" = "https://x/" &&
-	test "$(test-urlmatch-normalization -p "https://x:0443")" = "https://x/" &&
-	test "$(test-urlmatch-normalization -p "https://x:000000443")" = "https://x/"
+	test "$(test-tool urlmatch-normalization -p "http://x:800")" = "http://x:800/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:0800")" = "http://x:800/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:00000800")" = "http://x:800/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:065535")" = "http://x:65535/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:1")" = "http://x:1/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:80")" = "http://x/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:080")" = "http://x/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:000000080")" = "http://x/" &&
+	test "$(test-tool urlmatch-normalization -p "https://x:443")" = "https://x/" &&
+	test "$(test-tool urlmatch-normalization -p "https://x:0443")" = "https://x/" &&
+	test "$(test-tool urlmatch-normalization -p "https://x:000000443")" = "https://x/"
 '
 
 test_expect_success 'url general escapes' '
-	! test-urlmatch-normalization "http://x.y?%fg" &&
-	test "$(test-urlmatch-normalization -p "X://W/%7e%41^%3a")" = "x://w/~A%5E%3A" &&
-	test "$(test-urlmatch-normalization -p "X://W/:/?#[]@")" = "x://w/:/?#[]@" &&
-	test "$(test-urlmatch-normalization -p "X://W/$&()*+,;=")" = "x://w/$&()*+,;=" &&
-	test "$(test-urlmatch-normalization -p "X://W/'\''")" = "x://w/'\''" &&
-	test "$(test-urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
+	! test-tool urlmatch-normalization "http://x.y?%fg" &&
+	test "$(test-tool urlmatch-normalization -p "X://W/%7e%41^%3a")" = "x://w/~A%5E%3A" &&
+	test "$(test-tool urlmatch-normalization -p "X://W/:/?#[]@")" = "x://w/:/?#[]@" &&
+	test "$(test-tool urlmatch-normalization -p "X://W/$&()*+,;=")" = "x://w/$&()*+,;=" &&
+	test "$(test-tool urlmatch-normalization -p "X://W/'\''")" = "x://w/'\''" &&
+	test "$(test-tool urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
 '
 
 test_expect_success !MINGW 'url high-bit escapes' '
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-4")")" = "x://q/%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-5")")" = "x://q/%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-6")")" = "x://q/%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-7")")" = "x://q/%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-8")")" = "x://q/%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-9")")" = "x://q/%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-10")")" = "x://q/%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-4")")" = "x://q/%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-5")")" = "x://q/%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-6")")" = "x://q/%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-7")")" = "x://q/%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-8")")" = "x://q/%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-9")")" = "x://q/%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-10")")" = "x://q/%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"
 '
 
 test_expect_success 'url utf-8 escapes' '
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-11")")" = "x://q/%C2%80%DF%BF%E0%A0%80%EF%BF%BD%F0%90%80%80%F0%AF%BF%BD"
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-11")")" = "x://q/%C2%80%DF%BF%E0%A0%80%EF%BF%BD%F0%90%80%80%F0%AF%BF%BD"
 '
 
 test_expect_success 'url username/password escapes' '
-	test "$(test-urlmatch-normalization -p "x://%41%62(^):%70+d@foo")" = "x://Ab(%5E):p+d@foo/"
+	test "$(test-tool urlmatch-normalization -p "x://%41%62(^):%70+d@foo")" = "x://Ab(%5E):p+d@foo/"
 '
 
 test_expect_success 'url normalized lengths' '
-	test "$(test-urlmatch-normalization -l "Http://%4d%65:%4d^%70@The.Host")" = 25 &&
-	test "$(test-urlmatch-normalization -l "http://%41:%42@x.y/%61/")" = 17 &&
-	test "$(test-urlmatch-normalization -l "http://@x.y/^")" = 15
+	test "$(test-tool urlmatch-normalization -l "Http://%4d%65:%4d^%70@The.Host")" = 25 &&
+	test "$(test-tool urlmatch-normalization -l "http://%41:%42@x.y/%61/")" = 17 &&
+	test "$(test-tool urlmatch-normalization -l "http://@x.y/^")" = 15
 '
 
 test_expect_success 'url . and .. segments' '
-	test "$(test-urlmatch-normalization -p "x://y/.")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/./")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/.")" = "x://y/a" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./")" = "x://y/a/" &&
-	test "$(test-urlmatch-normalization -p "x://y/.?")" = "x://y/?" &&
-	test "$(test-urlmatch-normalization -p "x://y/./?")" = "x://y/?" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/.?")" = "x://y/a?" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./?")" = "x://y/a/?" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./b/.././../c")" = "x://y/c" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./b/../.././c/")" = "x://y/c/" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./b/.././../c/././.././.")" = "x://y/" &&
-	! test-urlmatch-normalization "x://y/a/./b/.././../c/././.././.." &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./?/././..")" = "x://y/a/?/././.." &&
-	test "$(test-urlmatch-normalization -p "x://y/%2e/")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/%2E/")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/%2e./")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/b/.%2E/")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/c/%2e%2E/")" = "x://y/"
+	test "$(test-tool urlmatch-normalization -p "x://y/.")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/./")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/.")" = "x://y/a" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./")" = "x://y/a/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/.?")" = "x://y/?" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/./?")" = "x://y/?" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/.?")" = "x://y/a?" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./?")" = "x://y/a/?" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./b/.././../c")" = "x://y/c" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./b/../.././c/")" = "x://y/c/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./b/.././../c/././.././.")" = "x://y/" &&
+	! test-tool urlmatch-normalization "x://y/a/./b/.././../c/././.././.." &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./?/././..")" = "x://y/a/?/././.." &&
+	test "$(test-tool urlmatch-normalization -p "x://y/%2e/")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/%2E/")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/%2e./")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/b/.%2E/")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/c/%2e%2E/")" = "x://y/"
 '
 
 # http://@foo specifies an empty user name but does not specify a password
 # http://foo  specifies neither a user name nor a password
 # So they should not be equivalent
 test_expect_success 'url equivalents' '
-	test-urlmatch-normalization "httP://x" "Http://X/" &&
-	test-urlmatch-normalization "Http://%4d%65:%4d^%70@The.Host" "hTTP://Me:%4D^p@the.HOST:80/" &&
-	! test-urlmatch-normalization "https://@x.y/^" "httpS://x.y:443/^" &&
-	test-urlmatch-normalization "https://@x.y/^" "httpS://@x.y:0443/^" &&
-	test-urlmatch-normalization "https://@x.y/^/../abc" "httpS://@x.y:0443/abc" &&
-	test-urlmatch-normalization "https://@x.y/^/.." "httpS://@x.y:0443/"
+	test-tool urlmatch-normalization "httP://x" "Http://X/" &&
+	test-tool urlmatch-normalization "Http://%4d%65:%4d^%70@The.Host" "hTTP://Me:%4D^p@the.HOST:80/" &&
+	! test-tool urlmatch-normalization "https://@x.y/^" "httpS://x.y:443/^" &&
+	test-tool urlmatch-normalization "https://@x.y/^" "httpS://@x.y:0443/^" &&
+	test-tool urlmatch-normalization "https://@x.y/^/../abc" "httpS://@x.y:0443/abc" &&
+	test-tool urlmatch-normalization "https://@x.y/^/.." "httpS://@x.y:0443/"
 '
 
 test_done
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 35/36] t/helper: merge test-wildmatch into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (33 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 34/36] t/helper: merge test-urlmatch-.. " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-17  7:54 ` [PATCH 36/36] t/helper: merge test-write-cache " Nguyễn Thái Ngọc Duy
                   ` (2 subsequent siblings)
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                  |  2 +-
 t/helper/test-tool.c      |  1 +
 t/helper/test-tool.h      |  1 +
 t/helper/test-wildmatch.c |  3 ++-
 t/t3070-wildmatch.sh      | 14 +++++++-------
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 7923ec3747..2ab76c6838 100644
--- a/Makefile
+++ b/Makefile
@@ -685,6 +685,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -694,7 +695,6 @@ TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
-TEST_PROGRAMS_NEED_X += test-wildmatch
 
 TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index f2d60af898..ebf28859b4 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -40,6 +40,7 @@ static struct test_cmd cmds[] = {
 	{ "submodule-config", test_submodule_config },
 	{ "subprocess", test_subprocess },
 	{ "urlmatch-normalization", test_urlmatch_normalization },
+	{ "wildmatch", test_wildmatch },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 704ac9df35..b7c8272689 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -34,5 +34,6 @@ int test_string_list(int argc, const char **argv);
 int test_submodule_config(int argc, const char **argv);
 int test_subprocess(int argc, const char **argv);
 int test_urlmatch_normalization(int argc, const char **argv);
+int test_wildmatch(int argc, const char **argv);
 
 #endif
diff --git a/t/helper/test-wildmatch.c b/t/helper/test-wildmatch.c
index 66d33dfcfd..b5c6d10b5e 100644
--- a/t/helper/test-wildmatch.c
+++ b/t/helper/test-wildmatch.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int argc, const char **argv)
+int test_wildmatch(int argc, const char **argv)
 {
 	int i;
 	for (i = 2; i < argc; i++) {
diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
index c1fc6ca730..dce102130f 100755
--- a/t/t3070-wildmatch.sh
+++ b/t/t3070-wildmatch.sh
@@ -79,12 +79,12 @@ match_with_function() {
 	if test "$match_expect" = 1
 	then
 		test_expect_success "$match_function: match '$text' '$pattern'" "
-			test-wildmatch $match_function '$text' '$pattern'
+			test-tool wildmatch $match_function '$text' '$pattern'
 		"
 	elif test "$match_expect" = 0
 	then
 		test_expect_success "$match_function: no match '$text' '$pattern'" "
-			test_must_fail test-wildmatch $match_function '$text' '$pattern'
+			test_must_fail test-tool wildmatch $match_function '$text' '$pattern'
 		"
 	else
 		test_expect_success "PANIC: Test framework error. Unknown matches value $match_expect" 'false'
@@ -148,7 +148,7 @@ match_with_ls_files() {
 match() {
 	if test "$#" = 6
 	then
-		# When test-wildmatch and git ls-files produce the same
+		# When test-tool wildmatch and git ls-files produce the same
 		# result.
 		match_glob=$1
 		match_file_glob=$match_glob
@@ -204,19 +204,19 @@ match() {
 		fi
 	'
 
-	# $1: Case sensitive glob match: test-wildmatch & ls-files
+	# $1: Case sensitive glob match: test-tool wildmatch & ls-files
 	match_with_function "$text" "$pattern" $match_glob "wildmatch"
 	match_with_ls_files "$text" "$pattern" $match_file_glob "wildmatch" " --glob-pathspecs"
 
-	# $2: Case insensitive glob match: test-wildmatch & ls-files
+	# $2: Case insensitive glob match: test-tool wildmatch & ls-files
 	match_with_function "$text" "$pattern" $match_iglob "iwildmatch"
 	match_with_ls_files "$text" "$pattern" $match_file_iglob "iwildmatch" " --glob-pathspecs --icase-pathspecs"
 
-	# $3: Case sensitive path match: test-wildmatch & ls-files
+	# $3: Case sensitive path match: test-tool wildmatch & ls-files
 	match_with_function "$text" "$pattern" $match_pathmatch "pathmatch"
 	match_with_ls_files "$text" "$pattern" $match_file_pathmatch "pathmatch" ""
 
-	# $4: Case insensitive path match: test-wildmatch & ls-files
+	# $4: Case insensitive path match: test-tool wildmatch & ls-files
 	match_with_function "$text" "$pattern" $match_pathmatchi "ipathmatch"
 	match_with_ls_files "$text" "$pattern" $match_file_pathmatchi "ipathmatch" " --icase-pathspecs"
 }
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH 36/36] t/helper: merge test-write-cache into test-tool
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (34 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 35/36] t/helper: merge test-wildmatch " Nguyễn Thái Ngọc Duy
@ 2018-03-17  7:54 ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  37 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-17  7:54 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    | 2 +-
 t/helper/test-tool.c        | 1 +
 t/helper/test-tool.h        | 1 +
 t/helper/test-write-cache.c | 3 ++-
 t/perf/p0007-write-cache.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 2ab76c6838..8ad9a2a1a9 100644
--- a/Makefile
+++ b/Makefile
@@ -686,13 +686,13 @@ 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-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
-TEST_PROGRAMS_NEED_X += test-write-cache
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index ebf28859b4..e4c04cd593 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -41,6 +41,7 @@ static struct test_cmd cmds[] = {
 	{ "subprocess", test_subprocess },
 	{ "urlmatch-normalization", test_urlmatch_normalization },
 	{ "wildmatch", test_wildmatch },
+	{ "write-cache", test_write_cache },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index b7c8272689..c0c2d1d18c 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -35,5 +35,6 @@ int test_submodule_config(int argc, const char **argv);
 int test_subprocess(int argc, const char **argv);
 int test_urlmatch_normalization(int argc, const char **argv);
 int test_wildmatch(int argc, const char **argv);
+int test_write_cache(int argc, const char **argv);
 
 #endif
diff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c
index b7ee039669..69de7f95aa 100644
--- a/t/helper/test-write-cache.c
+++ b/t/helper/test-write-cache.c
@@ -1,9 +1,10 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "lockfile.h"
 
 static struct lock_file index_lock;
 
-int cmd_main(int argc, const char **argv)
+int test_write_cache(int argc, const char **argv)
 {
 	int i, cnt = 1, lockfd;
 	if (argc == 2)
diff --git a/t/perf/p0007-write-cache.sh b/t/perf/p0007-write-cache.sh
index 261fe92fd9..09595264f0 100755
--- a/t/perf/p0007-write-cache.sh
+++ b/t/perf/p0007-write-cache.sh
@@ -23,7 +23,7 @@ test_expect_success "setup repo" '
 
 count=3
 test_perf "write_locked_index $count times ($nr_files files)" "
-	test-write-cache $count
+	test-tool write-cache $count
 "
 
 test_done
-- 
2.16.2.903.gd04caf5039


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* Re: [PATCH 04/36] t/helper: merge test-lazy-init-name-hash into test-tool
  2018-03-17  7:53 ` [PATCH 04/36] t/helper: merge test-lazy-init-name-hash " Nguyễn Thái Ngọc Duy
@ 2018-03-18  2:11   ` Eric Sunshine
  2018-03-18  8:25     ` Duy Nguyen
  0 siblings, 1 reply; 110+ messages in thread
From: Eric Sunshine @ 2018-03-18  2:11 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: Git List

On Sat, Mar 17, 2018 at 3:53 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> diff --git a/cache.h b/cache.h
> @@ -333,7 +333,7 @@ struct index_state {
> -extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
> +extern int lazy_init_name_hash_for_testing(struct index_state *istate, int try_threaded);

I get why you renamed this since the "main" function in the test
program wants to be called 'test_lazy_init_name_hash'...

> diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
> @@ -9,6 +10,9 @@ static int perf;
> +static int (*init_name_hash)(struct index_state *istate, int try_threaded) =
> +       lazy_init_name_hash_for_testing;
> +
> @@ -33,9 +37,9 @@ static void dump_run(void)
>         if (single) {
> -               test_lazy_init_name_hash(&the_index, 0);
> +               init_name_hash(&the_index, 0);

... but I'm having trouble understanding why this indirection through
'init_name_hash' is used rather than just calling
lazy_init_name_hash_for_testing() directly. Am I missing something
obvious or is 'init_name_hash' just an unneeded artifact of an earlier
iteration before the rename in cache.{c,h}?

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH 22/36] t/helepr: merge test-read-cache into test-tool
  2018-03-17  7:54 ` [PATCH 22/36] t/helepr: merge test-read-cache " Nguyễn Thái Ngọc Duy
@ 2018-03-18  2:21   ` Eric Sunshine
  0 siblings, 0 replies; 110+ messages in thread
From: Eric Sunshine @ 2018-03-18  2:21 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: Git List

On Sat, Mar 17, 2018 at 3:54 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> t/helepr: merge test-read-cache into test-tool

s/helepr/helper/

> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH 34/36] t/helper: merge test-urlmatch-.. into test-tool
  2018-03-17  7:54 ` [PATCH 34/36] t/helper: merge test-urlmatch-.. " Nguyễn Thái Ngọc Duy
@ 2018-03-18  2:32   ` Eric Sunshine
  0 siblings, 0 replies; 110+ messages in thread
From: Eric Sunshine @ 2018-03-18  2:32 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: Git List

On Sat, Mar 17, 2018 at 3:54 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> t/helper: merge test-urlmatch-.. into test-tool

Spelled out fully:

    t/helper: merge test-urlmatch-normalization into test-tool

needs only 58 columns, so is well within the 70-72 column
recommendation for summary line.

> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH 04/36] t/helper: merge test-lazy-init-name-hash into test-tool
  2018-03-18  2:11   ` Eric Sunshine
@ 2018-03-18  8:25     ` Duy Nguyen
  2018-03-18  8:47       ` Eric Sunshine
  0 siblings, 1 reply; 110+ messages in thread
From: Duy Nguyen @ 2018-03-18  8:25 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Git List

On Sun, Mar 18, 2018 at 3:11 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Sat, Mar 17, 2018 at 3:53 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>> diff --git a/cache.h b/cache.h
>> @@ -333,7 +333,7 @@ struct index_state {
>> -extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
>> +extern int lazy_init_name_hash_for_testing(struct index_state *istate, int try_threaded);
>
> I get why you renamed this since the "main" function in the test
> program wants to be called 'test_lazy_init_name_hash'...
>
>> diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
>> @@ -9,6 +10,9 @@ static int perf;
>> +static int (*init_name_hash)(struct index_state *istate, int try_threaded) =
>> +       lazy_init_name_hash_for_testing;
>> +
>> @@ -33,9 +37,9 @@ static void dump_run(void)
>>         if (single) {
>> -               test_lazy_init_name_hash(&the_index, 0);
>> +               init_name_hash(&the_index, 0);
>
> ... but I'm having trouble understanding why this indirection through
> 'init_name_hash' is used rather than just calling
> lazy_init_name_hash_for_testing() directly. Am I missing something
> obvious or is 'init_name_hash' just an unneeded artifact of an earlier
> iteration before the rename in cache.{c,h}?

Nope. It just feels too long to me and because we're already in the
test I don't feel the need to repeat _for_testing everywhere. If it's
confusing, I'll remove init_name_hash.
-- 
Duy

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH 04/36] t/helper: merge test-lazy-init-name-hash into test-tool
  2018-03-18  8:25     ` Duy Nguyen
@ 2018-03-18  8:47       ` Eric Sunshine
  2018-03-19  9:40         ` Jeff Hostetler
  0 siblings, 1 reply; 110+ messages in thread
From: Eric Sunshine @ 2018-03-18  8:47 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git List

On Sun, Mar 18, 2018 at 4:25 AM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Sun, Mar 18, 2018 at 3:11 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> On Sat, Mar 17, 2018 at 3:53 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>>> -extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
>>> +extern int lazy_init_name_hash_for_testing(struct index_state *istate, int try_threaded);
>>
>> I get why you renamed this since the "main" function in the test
>> program wants to be called 'test_lazy_init_name_hash'...
>>
>>> diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
>>> @@ -9,6 +10,9 @@ static int perf;
>>> +static int (*init_name_hash)(struct index_state *istate, int try_threaded) =
>>> +       lazy_init_name_hash_for_testing;
>>> +
>>> @@ -33,9 +37,9 @@ static void dump_run(void)
>>>         if (single) {
>>> -               test_lazy_init_name_hash(&the_index, 0);
>>> +               init_name_hash(&the_index, 0);
>>
>> ... but I'm having trouble understanding why this indirection through
>> 'init_name_hash' is used rather than just calling
>> lazy_init_name_hash_for_testing() directly. Am I missing something
>> obvious or is 'init_name_hash' just an unneeded artifact of an earlier
>> iteration before the rename in cache.{c,h}?
>
> Nope. It just feels too long to me and because we're already in the
> test I don't feel the need to repeat _for_testing everywhere. If it's
> confusing, I'll remove init_name_hash.

Without an explanatory in-code comment, I'd guess that someone coming
across this in the future will also stumble over it just like I did in
the review.

What if, instead, you rename test_lazy_init_name_hash() to
lazy_init_name_hash_test(), shifting 'test' from the front to the back
of the name? That way, the name remains the same length at the call
sites in the test helper, and you don't have to introduce the
confusing, otherwise unneeded 'init_name_hash'.

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH 04/36] t/helper: merge test-lazy-init-name-hash into test-tool
  2018-03-18  8:47       ` Eric Sunshine
@ 2018-03-19  9:40         ` Jeff Hostetler
  2018-03-19 15:51           ` Duy Nguyen
  0 siblings, 1 reply; 110+ messages in thread
From: Jeff Hostetler @ 2018-03-19  9:40 UTC (permalink / raw)
  To: Eric Sunshine, Duy Nguyen; +Cc: Git List



On 3/18/2018 4:47 AM, Eric Sunshine wrote:
> On Sun, Mar 18, 2018 at 4:25 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>> On Sun, Mar 18, 2018 at 3:11 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>>> On Sat, Mar 17, 2018 at 3:53 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>>>> -extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
>>>> +extern int lazy_init_name_hash_for_testing(struct index_state *istate, int try_threaded);
>>>
>>> I get why you renamed this since the "main" function in the test
>>> program wants to be called 'test_lazy_init_name_hash'...
>>>
>>>> diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
>>>> @@ -9,6 +10,9 @@ static int perf;
>>>> +static int (*init_name_hash)(struct index_state *istate, int try_threaded) =
>>>> +       lazy_init_name_hash_for_testing;
>>>> +
>>>> @@ -33,9 +37,9 @@ static void dump_run(void)
>>>>          if (single) {
>>>> -               test_lazy_init_name_hash(&the_index, 0);
>>>> +               init_name_hash(&the_index, 0);
>>>
>>> ... but I'm having trouble understanding why this indirection through
>>> 'init_name_hash' is used rather than just calling
>>> lazy_init_name_hash_for_testing() directly. Am I missing something
>>> obvious or is 'init_name_hash' just an unneeded artifact of an earlier
>>> iteration before the rename in cache.{c,h}?
>>
>> Nope. It just feels too long to me and because we're already in the
>> test I don't feel the need to repeat _for_testing everywhere. If it's
>> confusing, I'll remove init_name_hash.
> 
> Without an explanatory in-code comment, I'd guess that someone coming
> across this in the future will also stumble over it just like I did in
> the review.

I agree with Eric, this indirection seems unnecessary and confusing.
Generally, when I see function pointers initialized like that, I
think that there are plans for additional providers/drivers for that
functionality, but I don't see that here.  And it seems odd.

> 
> What if, instead, you rename test_lazy_init_name_hash() to
> lazy_init_name_hash_test(), shifting 'test' from the front to the back
> of the name? That way, the name remains the same length at the call
> sites in the test helper, and you don't have to introduce the
> confusing, otherwise unneeded 'init_name_hash'.
> 

I see 2 problems.
1. The test function in name-hash.c that needs access to private data.
     I'm not a fan of the "_for_testing" suffix, but I'm open.  I might
     either leave it as is, or make it a "TEST_" or "test__" prefix (as
     a guide for people used to languages with namespaces.

2. The new name for cmd_main().  There's no real need why it needs to
    be "test_*", right?   Your cmds[] maps the command line string to a
    function, but it could be anything.  That is, "cmd_main()" could be
    renamed "cmd__lazy_init_name_hash()".  Then you can conceptually
    reserve the "cmd__" prefix throughout t/helper for each test handler.

Just a thought,
Thanks,
Jeff


^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH 04/36] t/helper: merge test-lazy-init-name-hash into test-tool
  2018-03-19  9:40         ` Jeff Hostetler
@ 2018-03-19 15:51           ` Duy Nguyen
  0 siblings, 0 replies; 110+ messages in thread
From: Duy Nguyen @ 2018-03-19 15:51 UTC (permalink / raw)
  To: Jeff Hostetler; +Cc: Eric Sunshine, Git List

On Mon, Mar 19, 2018 at 10:40 AM, Jeff Hostetler <git@jeffhostetler.com> wrote:
>
>
> On 3/18/2018 4:47 AM, Eric Sunshine wrote:
>>
>> On Sun, Mar 18, 2018 at 4:25 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>>>
>>> On Sun, Mar 18, 2018 at 3:11 AM, Eric Sunshine <sunshine@sunshineco.com>
>>> wrote:
>>>>
>>>> On Sat, Mar 17, 2018 at 3:53 AM, Nguyễn Thái Ngọc Duy
>>>> <pclouds@gmail.com> wrote:
>>>>>
>>>>> -extern int test_lazy_init_name_hash(struct index_state *istate, int
>>>>> try_threaded);
>>>>> +extern int lazy_init_name_hash_for_testing(struct index_state *istate,
>>>>> int try_threaded);
>>>>
>>>>
>>>> I get why you renamed this since the "main" function in the test
>>>> program wants to be called 'test_lazy_init_name_hash'...
>>>>
>>>>> diff --git a/t/helper/test-lazy-init-name-hash.c
>>>>> b/t/helper/test-lazy-init-name-hash.c
>>>>> @@ -9,6 +10,9 @@ static int perf;
>>>>> +static int (*init_name_hash)(struct index_state *istate, int
>>>>> try_threaded) =
>>>>> +       lazy_init_name_hash_for_testing;
>>>>> +
>>>>> @@ -33,9 +37,9 @@ static void dump_run(void)
>>>>>          if (single) {
>>>>> -               test_lazy_init_name_hash(&the_index, 0);
>>>>> +               init_name_hash(&the_index, 0);
>>>>
>>>>
>>>> ... but I'm having trouble understanding why this indirection through
>>>> 'init_name_hash' is used rather than just calling
>>>> lazy_init_name_hash_for_testing() directly. Am I missing something
>>>> obvious or is 'init_name_hash' just an unneeded artifact of an earlier
>>>> iteration before the rename in cache.{c,h}?
>>>
>>>
>>> Nope. It just feels too long to me and because we're already in the
>>> test I don't feel the need to repeat _for_testing everywhere. If it's
>>> confusing, I'll remove init_name_hash.
>>
>>
>> Without an explanatory in-code comment, I'd guess that someone coming
>> across this in the future will also stumble over it just like I did in
>> the review.
>
>
> I agree with Eric, this indirection seems unnecessary and confusing.
> Generally, when I see function pointers initialized like that, I
> think that there are plans for additional providers/drivers for that
> functionality, but I don't see that here.  And it seems odd.
>
>>
>> What if, instead, you rename test_lazy_init_name_hash() to
>> lazy_init_name_hash_test(), shifting 'test' from the front to the back
>> of the name? That way, the name remains the same length at the call
>> sites in the test helper, and you don't have to introduce the
>> confusing, otherwise unneeded 'init_name_hash'.
>>
>
> I see 2 problems.
> 1. The test function in name-hash.c that needs access to private data.
>     I'm not a fan of the "_for_testing" suffix, but I'm open.  I might
>     either leave it as is, or make it a "TEST_" or "test__" prefix (as
>     a guide for people used to languages with namespaces.
>
> 2. The new name for cmd_main().  There's no real need why it needs to
>    be "test_*", right?   Your cmds[] maps the command line string to a
>    function, but it could be anything.  That is, "cmd_main()" could be
>    renamed "cmd__lazy_init_name_hash()".  Then you can conceptually
>    reserve the "cmd__" prefix throughout t/helper for each test handler.

cmd__ prefix solves my problem nicely. I'll wait for a while before
resending another 30+ patches.
-- 
Duy

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [PATCH v2 00/36] Combine t/helper binaries into a single one
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (35 preceding siblings ...)
  2018-03-17  7:54 ` [PATCH 36/36] t/helper: merge test-write-cache " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42 ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 1/7] t7700: have closing quote of a test at the beginning of line Nguyễn Thái Ngọc Duy
                     ` (13 more replies)
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  37 siblings, 14 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

v2 fixes a couple of typos in commit messages and use the cmd__ prefix
for test commands instead of test_, which avoids a naming conflict
with the existing function test_lazy_init_name_hash

Nguyễn Thái Ngọc Duy (36):
  t/helper: add an empty test-tool program
  t/helper: merge test-chmtime into test-tool
  t/helper: merge test-sha1 into test-tool
  t/helper: merge test-lazy-init-name-hash into test-tool
  t/helper: merge test-config into test-tool
  t/helper: merge test-ctype into test-tool
  t/helper: merge test-date into test-tool
  t/helper: merge (unused) test-delta into test-tool
  t/helper: merge test-drop-caches into test-tool
  t/helper: merge test-dump-cache-tree into test-tool
  t/helper: merge test-dump-split-index into test-tool
  t/helper: merge test-example-decorate into test-tool
  t/helper: merge test-genrandom into test-tool
  t/helper: merge test-hashmap into test-tool
  t/helper: merge test-index-version into test-tool
  t/helper: merge (unused) test-match-trees into test-tool
  t/helper: merge (unused) test-mergesort into test-tool
  t/helper: merge test-mktemp into test-tool
  t/helper: merge test-online-cpus into test-tool
  t/helper: merge test-path-utils into test-tool
  t/helper: merge test-prio-queue into test-tool
  t/helper: merge test-read-cache into test-tool
  t/helper: merge test-ref-store into test-tool
  t/helper: merge test-regex into test-tool
  t/helper: merge test-revision-walking into test-tool
  t/helper: merge test-run-command into test-tool
  t/helper: merge test-scrap-cache-tree into test-tool
  t/helper: merge test-sha1-array into test-tool
  t/helper: merge test-sigchain into test-tool
  t/helper: merge test-strcmp-offset into test-tool
  t/helper: merge test-string-list into test-tool
  t/helper: merge test-submodule-config into test-tool
  t/helper: merge test-subprocess into test-tool
  t/helper: merge test-urlmatch-normalization into test-tool
  t/helper: merge test-wildmatch into test-tool
  t/helper: merge test-write-cache into test-tool

 .../howto/recover-corrupted-object-harder.txt |   2 +-
 Makefile                                      |  79 +++---
 t/helper/test-chmtime.c                       |  15 +-
 t/helper/test-config.c                        |   5 +-
 t/helper/test-ctype.c                         |   3 +-
 t/helper/test-date.c                          |  17 +-
 t/helper/test-delta.c                         |   5 +-
 t/helper/test-drop-caches.c                   |   3 +-
 t/helper/test-dump-cache-tree.c               |   3 +-
 t/helper/test-dump-split-index.c              |   3 +-
 t/helper/test-example-decorate.c              |   3 +-
 t/helper/test-genrandom.c                     |   3 +-
 t/helper/test-hashmap.c                       |   5 +-
 t/helper/test-index-version.c                 |   3 +-
 t/helper/test-lazy-init-name-hash.c           |  13 +-
 t/helper/test-match-trees.c                   |   3 +-
 t/helper/test-mergesort.c                     |   3 +-
 t/helper/test-mktemp.c                        |   3 +-
 t/helper/test-online-cpus.c                   |   3 +-
 t/helper/test-path-utils.c                    |   3 +-
 t/helper/test-prio-queue.c                    |   3 +-
 t/helper/test-read-cache.c                    |   3 +-
 t/helper/test-ref-store.c                     |   3 +-
 t/helper/test-regex.c                         |   7 +-
 t/helper/test-revision-walking.c              |   3 +-
 t/helper/test-run-command.c                   |   3 +-
 t/helper/test-scrap-cache-tree.c              |   3 +-
 t/helper/test-sha1-array.c                    |   3 +-
 t/helper/test-sha1.c                          |   3 +-
 t/helper/test-sha1.sh                         |   4 +-
 t/helper/test-sigchain.c                      |   3 +-
 t/helper/test-strcmp-offset.c                 |   3 +-
 t/helper/test-string-list.c                   |   3 +-
 t/helper/test-submodule-config.c              |   3 +-
 t/helper/test-subprocess.c                    |   3 +-
 t/helper/test-tool.c                          |  62 ++++
 t/helper/test-tool.h                          |  40 +++
 t/helper/test-urlmatch-normalization.c        |   5 +-
 t/helper/test-wildmatch.c                     |   3 +-
 t/helper/test-write-cache.c                   |   3 +-
 t/lib-git-p4.sh                               |   2 +-
 t/lib-git-svn.sh                              |   2 +-
 t/lib-pack.sh                                 |   2 +-
 t/perf/p0002-read-cache.sh                    |   2 +-
 t/perf/p0004-lazy-init-name-hash.sh           |   8 +-
 t/perf/p0007-write-cache.sh                   |   2 +-
 t/perf/p0071-sort.sh                          |   2 +-
 t/perf/p7519-fsmonitor.sh                     |  12 +-
 t/t0005-signals.sh                            |   6 +-
 t/t0006-date.sh                               |   8 +-
 t/t0009-prio-queue.sh                         |   6 +-
 t/t0011-hashmap.sh                            |   4 +-
 t/t0013-sha1dc.sh                             |   2 +-
 t/t0021-conversion.sh                         |   4 +-
 t/t0060-path-utils.sh                         |  60 ++--
 t/t0061-run-command.sh                        |  24 +-
 t/t0062-revision-walking.sh                   |   2 +-
 t/t0063-string-list.sh                        |  48 ++--
 t/t0064-sha1-array.sh                         |  16 +-
 t/t0065-strcmp-offset.sh                      |   2 +-
 t/t0070-fundamental.sh                        |   8 +-
 t/t0090-cache-tree.sh                         |  18 +-
 t/t0110-urlmatch-normalization.sh             | 266 +++++++++---------
 t/t1006-cat-file.sh                           |   2 +-
 t/t1050-large.sh                              |   6 +-
 t/t1300-repo-config.sh                        |   2 +-
 t/t1305-config-include.sh                     |   2 +-
 t/t1308-config-set.sh                         |  22 +-
 t/t1309-early-config.sh                       |  12 +-
 t/t1405-main-ref-store.sh                     |   2 +-
 t/t1406-submodule-ref-store.sh                |   2 +-
 t/t1407-worktree-ref-store.sh                 |   4 +-
 t/t1501-work-tree.sh                          |  10 +-
 t/t1600-index.sh                              |   2 +-
 t/t1700-split-index.sh                        |  64 ++---
 t/t2022-checkout-paths.sh                     |   4 +-
 t/t2104-update-index-skip-worktree.sh         |   6 +-
 t/t3008-ls-files-lazy-init-name-hash.sh       |   4 +-
 t/t3070-wildmatch.sh                          |  14 +-
 t/t3306-notes-prune.sh                        |   2 +-
 t/t3404-rebase-interactive.sh                 |   4 +-
 t/t3418-rebase-continue.sh                    |   4 +-
 t/t3501-revert-cherry-pick.sh                 |   2 +-
 t/t3510-cherry-pick-sequence.sh               |   4 +-
 t/t3600-rm.sh                                 |   2 +-
 t/t3700-add.sh                                |   2 +-
 t/t4011-diff-symlink.sh                       |   2 +-
 t/t4013-diff-various.sh                       |   2 +-
 t/t4035-diff-quiet.sh                         |   2 +-
 t/t4151-am-abort.sh                           |   4 +-
 t/t4200-rerere.sh                             |  22 +-
 t/t5000-tar-tree.sh                           |   4 +-
 t/t5300-pack-object.sh                        |   4 +-
 t/t5301-sliding-window.sh                     |   2 +-
 t/t5302-pack-index.sh                         |  14 +-
 t/t5303-pack-corruption-resilience.sh         |  10 +-
 t/t5304-prune.sh                              |  16 +-
 t/t5310-pack-bitmaps.sh                       |   2 +-
 t/t5313-pack-bounds-checks.sh                 |   4 +-
 t/t5314-pack-cycle-detection.sh               |   2 +-
 t/t5316-pack-delta-depth.sh                   |   2 +-
 t/t5400-send-pack.sh                          |   2 +-
 t/t5516-fetch-push.sh                         |   2 +-
 t/t5546-receive-limits.sh                     |   2 +-
 t/t5547-push-quarantine.sh                    |   2 +-
 t/t5608-clone-2gb.sh                          |   2 +-
 t/t6022-merge-rename.sh                       |  30 +-
 t/t6500-gc.sh                                 |   2 +-
 t/t6501-freshen-objects.sh                    |   4 +-
 t/t7411-submodule-config.sh                   |  18 +-
 t/t7508-status.sh                             |   6 +-
 t/t7701-repack-unpack-unreachable.sh          |   6 +-
 t/t7812-grep-icase-non-ascii.sh               |   2 +-
 t/t9004-example.sh                            |   2 +-
 t/t9100-git-svn-basic.sh                      |   4 +-
 t/t9300-fast-import.sh                        |   2 +-
 t/t9802-git-p4-filetype.sh                    |   2 +-
 t/t9803-git-p4-shell-metachars.sh             |   4 +-
 t/t9813-git-p4-preserve-users.sh              |   6 +-
 t/t9820-git-p4-editor-handling.sh             |   2 +-
 t/test-lib.sh                                 |  10 +-
 121 files changed, 684 insertions(+), 542 deletions(-)
 create mode 100644 t/helper/test-tool.c
 create mode 100644 t/helper/test-tool.h

-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply	[flat|nested] 110+ messages in thread

* [PATCH v4 1/7] t7700: have closing quote of a test at the beginning of line
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v2 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
                     ` (12 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

The closing quote of a test body by convention is always at the start
of line.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t7700-repack.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index 6061a04147..38247afbec 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -194,7 +194,7 @@ test_expect_success 'objects made unreachable by grafts only are kept' '
 	git reflog expire --expire=$test_tick --expire-unreachable=$test_tick --all &&
 	git repack -a -d &&
 	git cat-file -t $H1
-	'
+'
 
 test_done
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 01/36] t/helper: add an empty test-tool program
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 1/7] t7700: have closing quote of a test at the beginning of line Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 2/7] repack: add --keep-pack option Nguyễn Thái Ngọc Duy
                     ` (11 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

This will become an umbrella program that absorbs most [1] t/helper
programs in. By having a single executable binary we reduce disk usage
(libgit.a is replicated by every t/helper program) and shorten link
time a bit.

Running "make --jobs=1; du -sh t/helper" with ccache fully populated,
it takes 27 seconds and 277MB at the beginning of this series, 17
seconds and 42MB at the end.

[1] There are a couple programs that will not become part of
    test-tool: test-line-buffer and test-svn-fe have extra
    dependencies and test-fake-ssh's program name has to be a single
    word for some ssh tests.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile             |  6 +++++-
 t/helper/test-tool.c | 27 +++++++++++++++++++++++++++
 t/helper/test-tool.h |  4 ++++
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 t/helper/test-tool.c
 create mode 100644 t/helper/test-tool.h

diff --git a/Makefile b/Makefile
index a1d8775adb..2376646e98 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,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
@@ -690,6 +691,7 @@ 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-tool
 TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
 TEST_PROGRAMS_NEED_X += test-wildmatch
 
@@ -2083,7 +2085,7 @@ VCSSVN_OBJS += vcs-svn/fast_export.o
 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) \
@@ -2494,6 +2496,8 @@ 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)
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
new file mode 100644
index 0000000000..c730f718ca
--- /dev/null
+++ b/t/helper/test-tool.c
@@ -0,0 +1,27 @@
+#include "git-compat-util.h"
+#include "test-tool.h"
+
+struct test_cmd {
+	const char *name;
+	int (*main)(int argc, const char **argv);
+};
+
+static struct test_cmd cmds[] = {
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	int i;
+
+	if (argc < 2)
+		die("I need a test name!");
+
+	for (i = 0; i < ARRAY_SIZE(cmds); i++) {
+		if (!strcmp(cmds[i].name, argv[1])) {
+			argv++;
+			argc--;
+			return cmds[i].main(argc, argv);
+		}
+	}
+	die("There is no test named '%s'", argv[1]);
+}
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
new file mode 100644
index 0000000000..6ce57ae0cc
--- /dev/null
+++ b/t/helper/test-tool.h
@@ -0,0 +1,4 @@
+#ifndef __TEST_TOOL_H__
+#define __TEST_TOOL_H__
+
+#endif
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v4 2/7] repack: add --keep-pack option
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 1/7] t7700: have closing quote of a test at the beginning of line Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v2 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v2 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
                     ` (10 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

We allow to keep existing packs by having companion .keep files. This
is helpful when a pack is permanently kept. In the next patch, git-gc
just wants to keep a pack temporarily, for one pack-objects
run. git-gc can use --keep-pack for this use case.

A note about why the pack_keep field cannot be reused and
pack_keep_in_core has to be added. This is about the case when
--keep-pack is specified together with either --keep-unreachable or
--unpack-unreachable, but --honor-pack-keep is NOT specified.

In this case, we want to exclude objects from the packs specified on
command line, not from ones with .keep files. If only one bit flag is
used, we have to clear pack_keep on pack files with the .keep file.

But we can't make any assumption about unreachable objects in .keep
packs. If "pack_keep" field is false for .keep packs, we could
potentially pull lots of unreachable objects into the new pack, or
unpack them loose. The safer approach is ignore all packs with either
.keep file or --keep-pack.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/git-pack-objects.txt |  9 ++++-
 Documentation/git-repack.txt       |  9 ++++-
 builtin/pack-objects.c             | 64 ++++++++++++++++++++++++------
 builtin/repack.c                   | 21 ++++++++--
 cache.h                            |  1 +
 t/t7700-repack.sh                  | 25 ++++++++++++
 6 files changed, 111 insertions(+), 18 deletions(-)

diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
index 81bc490ac5..403524652a 100644
--- a/Documentation/git-pack-objects.txt
+++ b/Documentation/git-pack-objects.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 'git pack-objects' [-q | --progress | --all-progress] [--all-progress-implied]
 	[--no-reuse-delta] [--delta-base-offset] [--non-empty]
 	[--local] [--incremental] [--window=<n>] [--depth=<n>]
-	[--revs [--unpacked | --all]]
+	[--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
 	[--stdout [--filter=<filter-spec>] | base-name]
 	[--shallow] [--keep-true-parents] < object-list
 
@@ -126,6 +126,13 @@ base-name::
 	has a .keep file to be ignored, even if it would have
 	otherwise been packed.
 
+--keep-pack=<pack-name>::
+	This flag causes an object already in the given pack to be
+	ignored, even if it would have otherwise been
+	packed. `<pack-name>` is the the pack file name without
+	leading directory (e.g. `pack-123.pack`). The option could be
+	specified multiple times to keep multiple packs.
+
 --incremental::
 	This flag causes an object already in a pack to be ignored
 	even if it would have otherwise been packed.
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index ae750e9e11..ce497d9d12 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -9,7 +9,7 @@ git-repack - Pack unpacked objects in a repository
 SYNOPSIS
 --------
 [verse]
-'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>]
+'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
 
 DESCRIPTION
 -----------
@@ -133,6 +133,13 @@ other objects in that pack they already have locally.
 	with `-b` or `repack.writeBitmaps`, as it ensures that the
 	bitmapped packfile has the necessary objects.
 
+--keep-pack=<pack-name>::
+	Exclude the given pack from repacking. This is the equivalent
+	of having `.keep` file on the pack. `<pack-name>` is the the
+	pack file name without leading directory (e.g. `pack-123.pack`).
+	The option could be specified multiple times to keep multiple
+	packs.
+
 --unpack-unreachable=<when>::
 	When loosening unreachable objects, do not bother loosening any
 	objects older than `<when>`. This can be used to optimize out
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index a197926eaa..7ec70131a9 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -28,6 +28,7 @@
 #include "argv-array.h"
 #include "list.h"
 #include "packfile.h"
+#include "dir.h"
 
 static const char *pack_usage[] = {
 	N_("git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"),
@@ -53,7 +54,8 @@ static int pack_loose_unreachable;
 static int local;
 static int have_non_local_packs;
 static int incremental;
-static int ignore_packed_keep;
+static int ignore_packed_keep_on_disk;
+static int ignore_packed_keep_in_core;
 static int allow_ofs_delta;
 static struct pack_idx_option pack_idx_opts;
 static const char *base_name;
@@ -982,13 +984,16 @@ static int want_found_object(int exclude, struct packed_git *p)
 	 * Otherwise, we signal "-1" at the end to tell the caller that we do
 	 * not know either way, and it needs to check more packs.
 	 */
-	if (!ignore_packed_keep &&
+	if (!ignore_packed_keep_on_disk &&
+	    !ignore_packed_keep_in_core &&
 	    (!local || !have_non_local_packs))
 		return 1;
 
 	if (local && !p->pack_local)
 		return 0;
-	if (ignore_packed_keep && p->pack_local && p->pack_keep)
+	if (p->pack_local &&
+	    ((ignore_packed_keep_on_disk && p->pack_keep) ||
+	     (ignore_packed_keep_in_core && p->pack_keep_in_core)))
 		return 0;
 
 	/* we don't know yet; keep looking for more packs */
@@ -2677,7 +2682,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
 		struct object_id oid;
 		struct object *o;
 
-		if (!p->pack_local || p->pack_keep)
+		if (!p->pack_local || p->pack_keep || p->pack_keep_in_core)
 			continue;
 		if (open_pack_index(p))
 			die("cannot open pack index");
@@ -2739,7 +2744,8 @@ static int has_sha1_pack_kept_or_nonlocal(const struct object_id *oid)
 	p = (last_found != (void *)1) ? last_found : packed_git;
 
 	while (p) {
-		if ((!p->pack_local || p->pack_keep) &&
+		if ((!p->pack_local || p->pack_keep ||
+				p->pack_keep_in_core) &&
 			find_pack_entry_one(oid->hash, p)) {
 			last_found = p;
 			return 1;
@@ -2782,7 +2788,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
 	struct object_id oid;
 
 	for (p = packed_git; p; p = p->next) {
-		if (!p->pack_local || p->pack_keep)
+		if (!p->pack_local || p->pack_keep || p->pack_keep_in_core)
 			continue;
 
 		if (open_pack_index(p))
@@ -2808,7 +2814,8 @@ static int pack_options_allow_reuse(void)
 {
 	return pack_to_stdout &&
 	       allow_ofs_delta &&
-	       !ignore_packed_keep &&
+	       !ignore_packed_keep_on_disk &&
+	       !ignore_packed_keep_in_core &&
 	       (!local || !have_non_local_packs) &&
 	       !incremental;
 }
@@ -2917,6 +2924,33 @@ static void get_object_list(int ac, const char **av)
 	oid_array_clear(&recent_objects);
 }
 
+static void add_extra_kept_packs(const struct string_list *names)
+{
+	struct packed_git *p;
+
+	if (!names->nr)
+		return;
+
+	prepare_packed_git();
+	for (p = packed_git; p; p = p->next) {
+		const char *name = basename(p->pack_name);
+		int i;
+
+		if (!p->pack_local)
+			continue;
+
+		for (i = 0; i < names->nr; i++)
+			if (!fspathcmp(name, names->items[i].string))
+				break;
+
+		if (i < names->nr) {
+			p->pack_keep_in_core = 1;
+			ignore_packed_keep_in_core = 1;
+			continue;
+		}
+	}
+}
+
 static int option_parse_index_version(const struct option *opt,
 				      const char *arg, int unset)
 {
@@ -2956,6 +2990,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 	struct argv_array rp = ARGV_ARRAY_INIT;
 	int rev_list_unpacked = 0, rev_list_all = 0, rev_list_reflog = 0;
 	int rev_list_index = 0;
+	struct string_list keep_pack_list = STRING_LIST_INIT_NODUP;
 	struct option pack_objects_options[] = {
 		OPT_SET_INT('q', "quiet", &progress,
 			    N_("do not show progress meter"), 0),
@@ -3020,8 +3055,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 			 N_("create thin packs")),
 		OPT_BOOL(0, "shallow", &shallow,
 			 N_("create packs suitable for shallow fetches")),
-		OPT_BOOL(0, "honor-pack-keep", &ignore_packed_keep,
+		OPT_BOOL(0, "honor-pack-keep", &ignore_packed_keep_on_disk,
 			 N_("ignore packs that have companion .keep file")),
+		OPT_STRING_LIST(0, "keep-pack", &keep_pack_list, N_("name"),
+				N_("ignore this pack")),
 		OPT_INTEGER(0, "compression", &pack_compression_level,
 			    N_("pack compression level")),
 		OPT_SET_INT(0, "keep-true-parents", &grafts_replace_parents,
@@ -3150,19 +3187,20 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 		progress = 2;
 
 	prepare_packed_git();
-	if (ignore_packed_keep) {
+	add_extra_kept_packs(&keep_pack_list);
+	if (ignore_packed_keep_on_disk) {
 		struct packed_git *p;
 		for (p = packed_git; p; p = p->next)
 			if (p->pack_local && p->pack_keep)
 				break;
 		if (!p) /* no keep-able packs found */
-			ignore_packed_keep = 0;
+			ignore_packed_keep_on_disk = 0;
 	}
 	if (local) {
 		/*
-		 * unlike ignore_packed_keep above, we do not want to
-		 * unset "local" based on looking at packs, as it
-		 * also covers non-local objects
+		 * unlike ignore_packed_keep_on_disk above, we do not
+		 * want to unset "local" based on looking at packs, as
+		 * it also covers non-local objects
 		 */
 		struct packed_git *p;
 		for (p = packed_git; p; p = p->next) {
diff --git a/builtin/repack.c b/builtin/repack.c
index 7bdb40142f..6c636e159e 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -86,7 +86,8 @@ static void remove_pack_on_signal(int signo)
  * have a corresponding .keep or .promisor file. These packs are not to
  * be kept if we are going to pack everything into one file.
  */
-static void get_non_kept_pack_filenames(struct string_list *fname_list)
+static void get_non_kept_pack_filenames(struct string_list *fname_list,
+					const struct string_list *extra_keep)
 {
 	DIR *dir;
 	struct dirent *e;
@@ -97,6 +98,14 @@ static void get_non_kept_pack_filenames(struct string_list *fname_list)
 
 	while ((e = readdir(dir)) != NULL) {
 		size_t len;
+		int i;
+
+		for (i = 0; i < extra_keep->nr; i++)
+			if (!fspathcmp(e->d_name, extra_keep->items[i].string))
+				break;
+		if (extra_keep->nr > 0 && i < extra_keep->nr)
+			continue;
+
 		if (!strip_suffix(e->d_name, ".pack", &len))
 			continue;
 
@@ -148,7 +157,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 	struct string_list rollback = STRING_LIST_INIT_NODUP;
 	struct string_list existing_packs = STRING_LIST_INIT_DUP;
 	struct strbuf line = STRBUF_INIT;
-	int ext, ret, failed;
+	int i, ext, ret, failed;
 	FILE *out;
 
 	/* variables to be filled by option parsing */
@@ -160,6 +169,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 	const char *depth = NULL;
 	const char *threads = NULL;
 	const char *max_pack_size = NULL;
+	struct string_list keep_pack_list = STRING_LIST_INIT_NODUP;
 	int no_reuse_delta = 0, no_reuse_object = 0;
 	int no_update_server_info = 0;
 	int quiet = 0;
@@ -200,6 +210,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 				N_("maximum size of each packfile")),
 		OPT_BOOL(0, "pack-kept-objects", &pack_kept_objects,
 				N_("repack objects in packs marked with .keep")),
+		OPT_STRING_LIST(0, "keep-pack", &keep_pack_list, N_("name"),
+				N_("do not repack this pack")),
 		OPT_END()
 	};
 
@@ -230,6 +242,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 	argv_array_push(&cmd.args, "--keep-true-parents");
 	if (!pack_kept_objects)
 		argv_array_push(&cmd.args, "--honor-pack-keep");
+	for (i = 0; i < keep_pack_list.nr; i++)
+		argv_array_pushf(&cmd.args, "--keep-pack=%s",
+				 keep_pack_list.items[i].string);
 	argv_array_push(&cmd.args, "--non-empty");
 	argv_array_push(&cmd.args, "--all");
 	argv_array_push(&cmd.args, "--reflog");
@@ -254,7 +269,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 		argv_array_push(&cmd.args, "--write-bitmap-index");
 
 	if (pack_everything & ALL_INTO_ONE) {
-		get_non_kept_pack_filenames(&existing_packs);
+		get_non_kept_pack_filenames(&existing_packs, &keep_pack_list);
 
 		if (existing_packs.nr && delete_redundant) {
 			if (unpack_unreachable) {
diff --git a/cache.h b/cache.h
index d06932ed0b..ba168e3571 100644
--- a/cache.h
+++ b/cache.h
@@ -1635,6 +1635,7 @@ extern struct packed_git {
 	int pack_fd;
 	unsigned pack_local:1,
 		 pack_keep:1,
+		 pack_keep_in_core:1,
 		 freshened:1,
 		 do_not_close:1,
 		 pack_promisor:1;
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index 38247afbec..6162e2a8e6 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -4,6 +4,12 @@ test_description='git repack works correctly'
 
 . ./test-lib.sh
 
+commit_and_pack() {
+	test_commit "$@" >/dev/null &&
+	SHA1=$(git pack-objects --all --unpacked --incremental .git/objects/pack/pack </dev/null) &&
+	echo pack-${SHA1}.pack
+}
+
 test_expect_success 'objects in packs marked .keep are not repacked' '
 	echo content1 > file1 &&
 	echo content2 > file2 &&
@@ -196,5 +202,24 @@ test_expect_success 'objects made unreachable by grafts only are kept' '
 	git cat-file -t $H1
 '
 
+test_expect_success 'repack --keep-pack' '
+	test_create_repo keep-pack &&
+	(
+		cd keep-pack &&
+		P1=$(commit_and_pack 1) &&
+		P2=$(commit_and_pack 2) &&
+		P3=$(commit_and_pack 3) &&
+		P4=$(commit_and_pack 4) &&
+		ls .git/objects/pack/*.pack >old-counts &&
+		test_line_count = 4 old-counts &&
+		git repack -a -d --keep-pack $P1 --keep-pack $P4 &&
+		ls .git/objects/pack/*.pack >new-counts &&
+		grep -q $P1 new-counts &&
+		grep -q $P4 new-counts &&
+		test_line_count = 3 new-counts &&
+		git fsck
+	)
+'
+
 test_done
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 02/36] t/helper: merge test-chmtime into test-tool
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (2 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v4 2/7] repack: add --keep-pack option Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 3/7] gc: add --keep-largest-pack option Nguyễn Thái Ngọc Duy
                     ` (9 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                             |  3 ++-
 t/helper/test-chmtime.c              | 15 +++++++-------
 t/helper/test-tool.c                 |  1 +
 t/helper/test-tool.h                 |  2 ++
 t/lib-git-svn.sh                     |  2 +-
 t/t1700-split-index.sh               | 12 +++++------
 t/t2022-checkout-paths.sh            |  4 ++--
 t/t3306-notes-prune.sh               |  2 +-
 t/t3404-rebase-interactive.sh        |  4 ++--
 t/t3418-rebase-continue.sh           |  4 ++--
 t/t3501-revert-cherry-pick.sh        |  2 +-
 t/t3510-cherry-pick-sequence.sh      |  4 ++--
 t/t3600-rm.sh                        |  2 +-
 t/t3700-add.sh                       |  2 +-
 t/t4011-diff-symlink.sh              |  2 +-
 t/t4013-diff-various.sh              |  2 +-
 t/t4035-diff-quiet.sh                |  2 +-
 t/t4151-am-abort.sh                  |  4 ++--
 t/t4200-rerere.sh                    | 22 ++++++++++----------
 t/t5000-tar-tree.sh                  |  2 +-
 t/t5304-prune.sh                     | 16 +++++++--------
 t/t5400-send-pack.sh                 |  2 +-
 t/t5516-fetch-push.sh                |  2 +-
 t/t6022-merge-rename.sh              | 30 ++++++++++++++--------------
 t/t6500-gc.sh                        |  2 +-
 t/t6501-freshen-objects.sh           |  4 ++--
 t/t7508-status.sh                    |  6 +++---
 t/t7701-repack-unpack-unreachable.sh |  6 +++---
 t/t9100-git-svn-basic.sh             |  4 ++--
 t/t9803-git-p4-shell-metachars.sh    |  4 ++--
 t/t9813-git-p4-preserve-users.sh     |  6 +++---
 t/t9820-git-p4-editor-handling.sh    |  2 +-
 t/test-lib.sh                        |  6 +++---
 33 files changed, 94 insertions(+), 89 deletions(-)

diff --git a/Makefile b/Makefile
index 2376646e98..416a8e39c1 100644
--- a/Makefile
+++ b/Makefile
@@ -652,7 +652,8 @@ X =
 
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
-TEST_PROGRAMS_NEED_X += test-chmtime
+TEST_BUILTINS_OBJS += test-chmtime.o
+
 TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-config
 TEST_PROGRAMS_NEED_X += test-date
diff --git a/t/helper/test-chmtime.c b/t/helper/test-chmtime.c
index e760256406..1790ceab51 100644
--- a/t/helper/test-chmtime.c
+++ b/t/helper/test-chmtime.c
@@ -5,28 +5,29 @@
  *
  * The mtime can be changed to an absolute value:
  *
- *	test-chmtime =<seconds> file...
+ *	test-tool chmtime =<seconds> file...
  *
  * Relative to the current time as returned by time(3):
  *
- *	test-chmtime =+<seconds> (or =-<seconds>) file...
+ *	test-tool chmtime =+<seconds> (or =-<seconds>) file...
  *
  * Or relative to the current mtime of the file:
  *
- *	test-chmtime <seconds> file...
- *	test-chmtime +<seconds> (or -<seconds>) file...
+ *	test-tool chmtime <seconds> file...
+ *	test-tool chmtime +<seconds> (or -<seconds>) file...
  *
  * Examples:
  *
  * To just print the mtime use --verbose and set the file mtime offset to 0:
  *
- *	test-chmtime -v +0 file
+ *	test-tool chmtime -v +0 file
  *
  * To set the mtime to current time:
  *
- *	test-chmtime =+0 file
+ *	test-tool chmtime =+0 file
  *
  */
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include <utime.h>
 
@@ -56,7 +57,7 @@ static int timespec_arg(const char *arg, long int *set_time, int *set_eq)
 	return 1;
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__chmtime(int argc, const char **argv)
 {
 	static int verbose;
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index c730f718ca..63ec15cb56 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -7,6 +7,7 @@ struct test_cmd {
 };
 
 static struct test_cmd cmds[] = {
+	{ "chmtime", cmd__chmtime },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 6ce57ae0cc..3a35e70e79 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -1,4 +1,6 @@
 #ifndef __TEST_TOOL_H__
 #define __TEST_TOOL_H__
 
+int cmd__chmtime(int argc, const char **argv);
+
 #endif
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 4c1f81f167..a8130f9119 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -49,7 +49,7 @@ rawsvnrepo="$svnrepo"
 svnrepo="file://$svnrepo"
 
 poke() {
-	test-chmtime +1 "$1"
+	test-tool chmtime +1 "$1"
 }
 
 # We need this, because we should pass empty configuration directory to
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index a66936fe9b..4b5d443280 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -332,12 +332,12 @@ test_expect_success 'shared index files expire after 2 weeks by default' '
 	git update-index --add ten &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_under_2_weeks_ago=$((5-14*86400)) &&
-	test-chmtime =$just_under_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_under_2_weeks_ago .git/sharedindex.* &&
 	: >eleven &&
 	git update-index --add eleven &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_over_2_weeks_ago=$((-1-14*86400)) &&
-	test-chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
 	: >twelve &&
 	git update-index --add twelve &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
@@ -345,12 +345,12 @@ test_expect_success 'shared index files expire after 2 weeks by default' '
 
 test_expect_success 'check splitIndex.sharedIndexExpire set to 16 days' '
 	git config splitIndex.sharedIndexExpire "16.days.ago" &&
-	test-chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
 	: >thirteen &&
 	git update-index --add thirteen &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_over_16_days_ago=$((-1-16*86400)) &&
-	test-chmtime =$just_over_16_days_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_16_days_ago .git/sharedindex.* &&
 	: >fourteen &&
 	git update-index --add fourteen &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
@@ -359,13 +359,13 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to 16 days' '
 test_expect_success 'check splitIndex.sharedIndexExpire set to "never" and "now"' '
 	git config splitIndex.sharedIndexExpire never &&
 	just_10_years_ago=$((-365*10*86400)) &&
-	test-chmtime =$just_10_years_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_10_years_ago .git/sharedindex.* &&
 	: >fifteen &&
 	git update-index --add fifteen &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	git config splitIndex.sharedIndexExpire now &&
 	just_1_second_ago=-1 &&
-	test-chmtime =$just_1_second_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_1_second_ago .git/sharedindex.* &&
 	: >sixteen &&
 	git update-index --add sixteen &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
diff --git a/t/t2022-checkout-paths.sh b/t/t2022-checkout-paths.sh
index f46d0499bc..e74d58b9e1 100755
--- a/t/t2022-checkout-paths.sh
+++ b/t/t2022-checkout-paths.sh
@@ -68,13 +68,13 @@ test_expect_success 'do not touch files that are already up-to-date' '
 	git add file1 file2 &&
 	git commit -m base &&
 	echo modified >file1 &&
-	test-chmtime =1000000000 file2 &&
+	test-tool chmtime =1000000000 file2 &&
 	git update-index -q --refresh &&
 	git checkout HEAD -- file1 file2 &&
 	echo one >expect &&
 	test_cmp expect file1 &&
 	echo "1000000000	file2" >expect &&
-	test-chmtime -v +0 file2 >actual &&
+	test-tool chmtime -v +0 file2 >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh
index 86bf909ee3..61748088eb 100755
--- a/t/t3306-notes-prune.sh
+++ b/t/t3306-notes-prune.sh
@@ -22,7 +22,7 @@ test_expect_success 'setup: create a few commits with notes' '
 	git commit -m 3rd &&
 	COMMIT_FILE=.git/objects/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
 	test -f $COMMIT_FILE &&
-	test-chmtime =+0 $COMMIT_FILE &&
+	test-tool chmtime =+0 $COMMIT_FILE &&
 	git notes add -m "Note #3"
 '
 
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 3b905406df..961ac9d6b8 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -711,13 +711,13 @@ test_expect_success 'rebase -i continue with unstaged submodule' '
 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
 '
 
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index 7c91a85f43..9214d0bb51 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -24,7 +24,7 @@ test_expect_success 'interactive rebase --continue works with touched file' '
 	git checkout master &&
 
 	FAKE_LINES="edit 1" git rebase -i HEAD^ &&
-	test-chmtime =-60 F1 &&
+	test-tool chmtime =-60 F1 &&
 	git rebase --continue
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'non-interactive rebase --continue works with touched file'
 	test_must_fail git rebase --onto master master topic &&
 	echo "Resolved" >F2 &&
 	git add F2 &&
-	test-chmtime =-60 F1 &&
+	test-tool chmtime =-60 F1 &&
 	git rebase --continue
 '
 
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 783bdbf59d..ccbc118514 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -86,7 +86,7 @@ test_expect_success 'cherry-pick on stat-dirty working tree' '
 	(
 		cd copy &&
 		git checkout initial &&
-		test-chmtime +40 oops &&
+		test-tool chmtime +40 oops &&
 		git cherry-pick added
 	)
 '
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index 0acf4b1461..9f93445f1e 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -247,9 +247,9 @@ test_expect_success '--abort after last commit in sequence' '
 test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
 	pristine_detach initial &&
 	test_expect_code 1 git cherry-pick base..anotherpick &&
-	test-chmtime -v +0 .git/sequencer >expect &&
+	test-tool chmtime -v +0 .git/sequencer >expect &&
 	test_expect_code 128 git cherry-pick unrelatedpick &&
-	test-chmtime -v +0 .git/sequencer >actual &&
+	test-tool chmtime -v +0 .git/sequencer >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 46f15169f5..b8fbdefcdc 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -232,7 +232,7 @@ test_expect_success 'Call "rm" from outside the work tree' '
 test_expect_success 'refresh index before checking if it is up-to-date' '
 
 	git reset --hard &&
-	test-chmtime -86400 frotz/nitfol &&
+	test-tool chmtime -86400 frotz/nitfol &&
 	git rm frotz/nitfol &&
 	test ! -f frotz/nitfol
 
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 2748805642..07af05d7ae 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -187,7 +187,7 @@ test_expect_success 'git add --refresh with pathspec' '
 	echo >foo && echo >bar && echo >baz &&
 	git add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&
 	echo "100644 $H 3	foo" | git update-index --index-info &&
-	test-chmtime -60 bar baz &&
+	test-tool chmtime -60 bar baz &&
 	>expect &&
 	git add --refresh bar >actual &&
 	test_cmp expect actual &&
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index 13e7f621ab..cf0f3a1ee7 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -73,7 +73,7 @@ test_expect_success 'diff identical, but newly created symlink and file' '
 	>expected &&
 	rm -f frotz nitfol &&
 	echo xyzzy >nitfol &&
-	test-chmtime +10 nitfol &&
+	test-tool chmtime +10 nitfol &&
 	if test_have_prereq SYMLINKS
 	then
 		ln -s xyzzy frotz
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 3f9a24fd56..f8d853595b 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -76,7 +76,7 @@ test_expect_success setup '
 
 	mkdir dir3 &&
 	cp dir/sub dir3/sub &&
-	test-chmtime +1 dir3/sub &&
+	test-tool chmtime +1 dir3/sub &&
 
 	git config log.showroot false &&
 	git commit --amend &&
diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh
index 2f1737fcef..0352bf81a9 100755
--- a/t/t4035-diff-quiet.sh
+++ b/t/t4035-diff-quiet.sh
@@ -147,7 +147,7 @@ test_expect_success 'git diff --ignore-all-space, both files outside repo' '
 '
 
 test_expect_success 'git diff --quiet ignores stat-change only entries' '
-	test-chmtime +10 a &&
+	test-tool chmtime +10 a &&
 	echo modified >>b &&
 	test_expect_code 1 git diff --quiet
 '
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 16432781d2..9d8d3c72e7 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -171,7 +171,7 @@ test_expect_success 'am --skip leaves index stat info alone' '
 	git checkout -f --orphan skip-stat-info &&
 	git reset &&
 	test_commit skip-should-be-untouched &&
-	test-chmtime =0 skip-should-be-untouched.t &&
+	test-tool chmtime =0 skip-should-be-untouched.t &&
 	git update-index --refresh &&
 	git diff-files --exit-code --quiet &&
 	test_must_fail git am 0001-*.patch &&
@@ -183,7 +183,7 @@ test_expect_success 'am --abort leaves index stat info alone' '
 	git checkout -f --orphan abort-stat-info &&
 	git reset &&
 	test_commit abort-should-be-untouched &&
-	test-chmtime =0 abort-should-be-untouched.t &&
+	test-tool chmtime =0 abort-should-be-untouched.t &&
 	git update-index --refresh &&
 	git diff-files --exit-code --quiet &&
 	test_must_fail git am 0001-*.patch &&
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index d97d2bebc9..deafaa3e07 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -166,7 +166,7 @@ test_expect_success 'first postimage wins' '
 	git commit -q -a -m "prefer first over second" &&
 	test -f $rr/postimage &&
 
-	oldmtimepost=$(test-chmtime -v -60 $rr/postimage | cut -f 1) &&
+	oldmtimepost=$(test-tool chmtime -v -60 $rr/postimage | cut -f 1) &&
 
 	git checkout -b third master &&
 	git show second^:a1 | sed "s/To die: t/To die! T/" >a1 &&
@@ -179,7 +179,7 @@ test_expect_success 'first postimage wins' '
 '
 
 test_expect_success 'rerere updates postimage timestamp' '
-	newmtimepost=$(test-chmtime -v +0 $rr/postimage | cut -f 1) &&
+	newmtimepost=$(test-tool chmtime -v +0 $rr/postimage | cut -f 1) &&
 	test $oldmtimepost -lt $newmtimepost
 '
 
@@ -220,9 +220,9 @@ test_expect_success 'set up for garbage collection tests' '
 	almost_60_days_ago=$((60-60*86400)) &&
 	just_over_60_days_ago=$((-1-60*86400)) &&
 
-	test-chmtime =$just_over_60_days_ago $rr/preimage &&
-	test-chmtime =$almost_60_days_ago $rr/postimage &&
-	test-chmtime =$almost_15_days_ago $rr2/preimage
+	test-tool chmtime =$just_over_60_days_ago $rr/preimage &&
+	test-tool chmtime =$almost_60_days_ago $rr/postimage &&
+	test-tool chmtime =$almost_15_days_ago $rr2/preimage
 '
 
 test_expect_success 'gc preserves young or recently used records' '
@@ -232,8 +232,8 @@ test_expect_success 'gc preserves young or recently used records' '
 '
 
 test_expect_success 'old records rest in peace' '
-	test-chmtime =$just_over_60_days_ago $rr/postimage &&
-	test-chmtime =$just_over_15_days_ago $rr2/preimage &&
+	test-tool chmtime =$just_over_60_days_ago $rr/postimage &&
+	test-tool chmtime =$just_over_15_days_ago $rr2/preimage &&
 	git rerere gc &&
 	! test -f $rr/preimage &&
 	! test -f $rr2/preimage
@@ -249,8 +249,8 @@ rerere_gc_custom_expiry_test () {
 		>"$rr/postimage" &&
 
 		two_days_ago=$((-2*86400)) &&
-		test-chmtime =$two_days_ago "$rr/preimage" &&
-		test-chmtime =$two_days_ago "$rr/postimage" &&
+		test-tool chmtime =$two_days_ago "$rr/preimage" &&
+		test-tool chmtime =$two_days_ago "$rr/postimage" &&
 
 		find .git/rr-cache -type f | sort >original &&
 
@@ -512,7 +512,7 @@ test_expect_success 'multiple identical conflicts' '
 	count_pre_post 2 0 &&
 
 	# Pretend that the conflicts were made quite some time ago
-	find .git/rr-cache/ -type f | xargs test-chmtime -172800 &&
+	find .git/rr-cache/ -type f | xargs test-tool chmtime -172800 &&
 
 	# Unresolved entries have not expired yet
 	git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
@@ -568,7 +568,7 @@ test_expect_success 'multiple identical conflicts' '
 	git rerere &&
 
 	# Pretend that the resolutions are old again
-	find .git/rr-cache/ -type f | xargs test-chmtime -172800 &&
+	find .git/rr-cache/ -type f | xargs test-tool chmtime -172800 &&
 
 	# Resolved entries have not expired yet
 	git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index fe2d4f15a7..266d052efb 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -192,7 +192,7 @@ test_expect_success \
     'validate file modification time' \
     'mkdir extract &&
      "$TAR" xf b.tar -C extract a/a &&
-     test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
+     test-tool chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
      echo "1117231200" >expected.mtime &&
      test_cmp expected.mtime b.mtime'
 
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 6694c19a1e..f0f6e2a5f3 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -15,7 +15,7 @@ add_blob() {
 	BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =+0 $BLOB_FILE
+	test-tool chmtime =+0 $BLOB_FILE
 }
 
 test_expect_success setup '
@@ -33,7 +33,7 @@ test_expect_success 'prune stale packs' '
 	orig_pack=$(echo .git/objects/pack/*.pack) &&
 	: > .git/objects/tmp_1.pack &&
 	: > .git/objects/tmp_2.pack &&
-	test-chmtime =-86501 .git/objects/tmp_1.pack &&
+	test-tool chmtime =-86501 .git/objects/tmp_1.pack &&
 	git prune --expire 1.day &&
 	test_path_is_file $orig_pack &&
 	test_path_is_file .git/objects/tmp_2.pack &&
@@ -47,7 +47,7 @@ test_expect_success 'prune --expire' '
 	git prune --expire=1.hour.ago &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =-86500 $BLOB_FILE &&
+	test-tool chmtime =-86500 $BLOB_FILE &&
 	git prune --expire 1.day &&
 	verbose test $before = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_missing $BLOB_FILE
@@ -57,11 +57,11 @@ test_expect_success 'prune --expire' '
 test_expect_success 'gc: implicit prune --expire' '
 
 	add_blob &&
-	test-chmtime =-$((2*$week-30)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week-30)) $BLOB_FILE &&
 	git gc &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
 	git gc &&
 	verbose test $before = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_missing $BLOB_FILE
@@ -141,7 +141,7 @@ test_expect_success 'prune: do not prune heads listed as an argument' '
 test_expect_success 'gc --no-prune' '
 
 	add_blob &&
-	test-chmtime =-$((5001*$day)) $BLOB_FILE &&
+	test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
 	git config gc.pruneExpire 2.days.ago &&
 	git gc --no-prune &&
 	verbose test 1 = $(git count-objects | sed "s/ .*//") &&
@@ -163,7 +163,7 @@ test_expect_success 'gc respects gc.pruneExpire' '
 test_expect_success 'gc --prune=<date>' '
 
 	add_blob &&
-	test-chmtime =-$((5001*$day)) $BLOB_FILE &&
+	test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
 	git gc --prune=5002.days.ago &&
 	test_path_is_file $BLOB_FILE &&
 	git gc --prune=5000.days.ago &&
@@ -205,7 +205,7 @@ test_expect_success 'prune --expire=never' '
 
 test_expect_success 'gc: prune old objects after local clone' '
 	add_blob &&
-	test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
 	git clone --no-hardlinks . aclone &&
 	(
 		cd aclone &&
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index d375d7110d..911eae1bf7 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -180,7 +180,7 @@ test_expect_success 'receive-pack runs auto-gc in remote repo' '
 	    # And create a file that follows the temporary object naming
 	    # convention for the auto-gc to remove
 	    : >.git/objects/tmp_test_object &&
-	    test-chmtime =-1209601 .git/objects/tmp_test_object
+	    test-tool chmtime =-1209601 .git/objects/tmp_test_object
 	) &&
 	(
 	    cd parent &&
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 177897ea0b..82239138d5 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1418,7 +1418,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
 		cd testrepo &&
 		git reset --hard HEAD^ &&
 		test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
-		test-chmtime +100 path1
+		test-tool chmtime +100 path1
 	) &&
 	git push testrepo master &&
 	(
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index c01f721f13..a1fad6980b 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -635,10 +635,10 @@ test_expect_success 'setup avoid unnecessary update, normal rename' '
 
 test_expect_success 'avoid unnecessary update, normal rename' '
 	git checkout -q avoid-unnecessary-update-1^0 &&
-	test-chmtime =1000000000 rename &&
-	test-chmtime -v +0 rename >expect &&
+	test-tool chmtime =1000000000 rename &&
+	test-tool chmtime -v +0 rename >expect &&
 	git merge merge-branch-1 &&
-	test-chmtime -v +0 rename >actual &&
+	test-tool chmtime -v +0 rename >actual &&
 	test_cmp expect actual # "rename" should have stayed intact
 '
 
@@ -668,10 +668,10 @@ test_expect_success 'setup to test avoiding unnecessary update, with D/F conflic
 
 test_expect_success 'avoid unnecessary update, with D/F conflict' '
 	git checkout -q avoid-unnecessary-update-2^0 &&
-	test-chmtime =1000000000 df &&
-	test-chmtime -v +0 df >expect &&
+	test-tool chmtime =1000000000 df &&
+	test-tool chmtime -v +0 df >expect &&
 	git merge merge-branch-2 &&
-	test-chmtime -v +0 df >actual &&
+	test-tool chmtime -v +0 df >actual &&
 	test_cmp expect actual # "df" should have stayed intact
 '
 
@@ -700,10 +700,10 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '
 
 test_expect_success 'avoid unnecessary update, dir->(file,nothing)' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 df &&
-	test-chmtime -v +0 df >expect &&
+	test-tool chmtime =1000000000 df &&
+	test-tool chmtime -v +0 df >expect &&
 	git merge side &&
-	test-chmtime -v +0 df >actual &&
+	test-tool chmtime -v +0 df >actual &&
 	test_cmp expect actual # "df" should have stayed intact
 '
 
@@ -730,10 +730,10 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '
 
 test_expect_success 'avoid unnecessary update, modify/delete' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 file &&
-	test-chmtime -v +0 file >expect &&
+	test-tool chmtime =1000000000 file &&
+	test-tool chmtime -v +0 file >expect &&
 	test_must_fail git merge side &&
-	test-chmtime -v +0 file >actual &&
+	test-tool chmtime -v +0 file >actual &&
 	test_cmp expect actual # "file" should have stayed intact
 '
 
@@ -759,10 +759,10 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '
 
 test_expect_success 'avoid unnecessary update, rename/add-dest' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 newfile &&
-	test-chmtime -v +0 newfile >expect &&
+	test-tool chmtime =1000000000 newfile &&
+	test-tool chmtime -v +0 newfile >expect &&
 	git merge side &&
-	test-chmtime -v +0 newfile >actual &&
+	test-tool chmtime -v +0 newfile >actual &&
 	test_cmp expect actual # "file" should have stayed intact
 '
 
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 41b0be575d..d5255dd576 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -87,7 +87,7 @@ test_expect_success 'background auto gc does not run if gc.log is present and re
 	test_must_fail git gc --auto 2>err &&
 	test_i18ngrep "^error:" err &&
 	test_config gc.logexpiry 5.days &&
-	test-chmtime =-345600 .git/gc.log &&
+	test-tool chmtime =-345600 .git/gc.log &&
 	test_must_fail git gc --auto &&
 	test_config gc.logexpiry 2.days &&
 	run_and_wait_for_auto_gc &&
diff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh
index 394b169ead..765cced60b 100755
--- a/t/t6501-freshen-objects.sh
+++ b/t/t6501-freshen-objects.sh
@@ -73,7 +73,7 @@ for repack in '' true; do
 
 	test_expect_success "simulate time passing ($title)" '
 		find .git/objects -type f |
-		xargs test-chmtime -v -86400
+		xargs test-tool chmtime -v -86400
 	'
 
 	test_expect_success "start writing new commit with old blob ($title)" '
@@ -104,7 +104,7 @@ for repack in '' true; do
 	test_expect_success "abandon objects again ($title)" '
 		git reset --hard HEAD^ &&
 		find .git/objects -type f |
-		xargs test-chmtime -v -86400
+		xargs test-tool chmtime -v -86400
 	'
 
 	test_expect_success "start writing new commit with same tree ($title)" '
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 50052e2872..7afadb175a 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1672,12 +1672,12 @@ test_expect_success '"Initial commit" should not be noted in commit template' '
 '
 
 test_expect_success '--no-optional-locks prevents index update' '
-	test-chmtime =1234567890 .git/index &&
+	test-tool chmtime =1234567890 .git/index &&
 	git --no-optional-locks status &&
-	test-chmtime -v +0 .git/index >out &&
+	test-tool chmtime -v +0 .git/index >out &&
 	grep ^1234567890 out &&
 	git status &&
-	test-chmtime -v +0 .git/index >out &&
+	test-tool chmtime -v +0 .git/index >out &&
 	! grep ^1234567890 out
 '
 
diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh
index 987573c41f..8a586ab021 100755
--- a/t/t7701-repack-unpack-unreachable.sh
+++ b/t/t7701-repack-unpack-unreachable.sh
@@ -90,7 +90,7 @@ test_expect_success 'unpacked objects receive timestamp of pack file' '
 	tmppack=".git/objects/pack/tmp_pack" &&
 	ln "$packfile" "$tmppack" &&
 	git repack -A -l -d &&
-	test-chmtime -v +0 "$tmppack" "$fsha1path" "$csha1path" "$tsha1path" \
+	test-tool chmtime -v +0 "$tmppack" "$fsha1path" "$csha1path" "$tsha1path" \
 		> mtimes &&
 	compare_mtimes < mtimes
 '
@@ -103,7 +103,7 @@ test_expect_success 'do not bother loosening old objects' '
 	git prune-packed &&
 	git cat-file -p $obj1 &&
 	git cat-file -p $obj2 &&
-	test-chmtime =-86400 .git/objects/pack/pack-$pack2.pack &&
+	test-tool chmtime =-86400 .git/objects/pack/pack-$pack2.pack &&
 	git repack -A -d --unpack-unreachable=1.hour.ago &&
 	git cat-file -p $obj1 &&
 	test_must_fail git cat-file -p $obj2
@@ -117,7 +117,7 @@ test_expect_success 'keep packed objects found only in index' '
 	git reset HEAD^ &&
 	git reflog expire --expire=now --all &&
 	git add file &&
-	test-chmtime =-86400 .git/objects/pack/* &&
+	test-tool chmtime =-86400 .git/objects/pack/* &&
 	git gc --prune=1.hour.ago &&
 	git cat-file blob :file
 '
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 8a8ba65a2a..c937330a5f 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -288,12 +288,12 @@ test_expect_success 'able to dcommit to a subdirectory' '
 
 test_expect_success 'dcommit should not fail with a touched file' '
 	test_commit "commit-new-file-foo2" foo2 &&
-	test-chmtime =-60 foo &&
+	test-tool chmtime =-60 foo &&
 	git svn dcommit
 '
 
 test_expect_success 'rebase should not fail with a touched file' '
-	test-chmtime =-60 foo &&
+	test-tool chmtime =-60 foo &&
 	git svn rebase
 '
 
diff --git a/t/t9803-git-p4-shell-metachars.sh b/t/t9803-git-p4-shell-metachars.sh
index d950c7d665..d5c3675100 100755
--- a/t/t9803-git-p4-shell-metachars.sh
+++ b/t/t9803-git-p4-shell-metachars.sh
@@ -28,7 +28,7 @@ test_expect_success 'shell metachars in filenames' '
 		echo f2 >"file with spaces" &&
 		git add "file with spaces" &&
 		git commit -m "add files" &&
-		P4EDITOR="test-chmtime +5" git p4 submit
+		P4EDITOR="test-tool chmtime +5" git p4 submit
 	) &&
 	(
 		cd "$cli" &&
@@ -47,7 +47,7 @@ test_expect_success 'deleting with shell metachars' '
 		git rm foo\$bar &&
 		git rm file\ with\ spaces &&
 		git commit -m "remove files" &&
-		P4EDITOR="test-chmtime +5" git p4 submit
+		P4EDITOR="test-tool chmtime +5" git p4 submit
 	) &&
 	(
 		cd "$cli" &&
diff --git a/t/t9813-git-p4-preserve-users.sh b/t/t9813-git-p4-preserve-users.sh
index bda222aa02..783c6ad165 100755
--- a/t/t9813-git-p4-preserve-users.sh
+++ b/t/t9813-git-p4-preserve-users.sh
@@ -53,7 +53,7 @@ test_expect_success 'preserve users' '
 		git commit --author "Alice <alice@example.com>" -m "a change by alice" file1 &&
 		git commit --author "Bob <bob@example.com>" -m "a change by bob" file2 &&
 		git config git-p4.skipSubmitEditCheck true &&
-		P4EDITOR="test-chmtime +5" P4USER=alice P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=alice P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		git p4 commit --preserve-user &&
 		p4_check_commit_author file1 alice &&
@@ -71,7 +71,7 @@ test_expect_success 'refuse to preserve users without perms' '
 		git config git-p4.skipSubmitEditCheck true &&
 		echo "username-noperms: a change by alice" >>file1 &&
 		git commit --author "Alice <alice@example.com>" -m "perms: a change by alice" file1 &&
-		P4EDITOR="test-chmtime +5" P4USER=bob P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=bob P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		test_must_fail git p4 commit --preserve-user &&
 		! git diff --exit-code HEAD..p4/master
@@ -89,7 +89,7 @@ test_expect_success 'preserve user where author is unknown to p4' '
 		git commit --author "Bob <bob@example.com>" -m "preserve: a change by bob" file1 &&
 		echo "username-unknown: a change by charlie" >>file1 &&
 		git commit --author "Charlie <charlie@example.com>" -m "preserve: a change by charlie" file1 &&
-		P4EDITOR="test-chmtime +5" P4USER=alice P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=alice P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		test_must_fail git p4 commit --preserve-user &&
 		! git diff --exit-code HEAD..p4/master &&
diff --git a/t/t9820-git-p4-editor-handling.sh b/t/t9820-git-p4-editor-handling.sh
index 6dc6df032e..3c22f74bd4 100755
--- a/t/t9820-git-p4-editor-handling.sh
+++ b/t/t9820-git-p4-editor-handling.sh
@@ -26,7 +26,7 @@ test_expect_success 'EDITOR with options' '
 		cd "$git" &&
 		echo change >file1 &&
 		git commit -m "change" file1 &&
-		P4EDITOR=": >\"$git/touched\" && test-chmtime +5" git p4 submit &&
+		P4EDITOR=": >\"$git/touched\" && test-tool chmtime +5" git p4 submit &&
 		test_path_is_file "$git/touched"
 	)
 '
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7740d511d2..7ab8af47a5 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -963,10 +963,10 @@ test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
 }
 
-if ! test -x "$GIT_BUILD_DIR"/t/helper/test-chmtime
+if ! test -x "$GIT_BUILD_DIR"/t/helper/test-tool
 then
-	echo >&2 'You need to build test-chmtime:'
-	echo >&2 'Run "make t/helper/test-chmtime" in the source (toplevel) directory'
+	echo >&2 'You need to build test-tool:'
+	echo >&2 'Run "make t/helper/test-tool" in the source (toplevel) directory'
 	exit 1
 fi
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v4 3/7] gc: add --keep-largest-pack option
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (3 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v2 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  9:36     ` Ævar Arnfjörð Bjarmason
  2018-03-24  7:42   ` [PATCH v2 03/36] t/helper: merge test-sha1 into test-tool Nguyễn Thái Ngọc Duy
                     ` (8 subsequent siblings)
  13 siblings, 1 reply; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

This adds a new repack mode that combines everything into a secondary
pack, leaving the largest pack alone.

This could help reduce memory pressure. On linux-2.6.git, valgrind
massif reports 1.6GB heap in "pack all" case, and 535MB in "pack
all except the base pack" case. We save roughly 1GB memory by
excluding the base pack.

This should also lower I/O because we don't have to rewrite a giant
pack every time (e.g. for linux-2.6.git that's a 1.4GB pack file)..

PS. The use of string_list here seems overkill, but we'll need it in
the next patch...

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/git-gc.txt |  6 ++++-
 builtin/gc.c             | 47 ++++++++++++++++++++++++++++++++++++----
 t/t6500-gc.sh            | 25 +++++++++++++++++++++
 3 files changed, 73 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 571b5a7e3c..bf81b8de30 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -9,7 +9,7 @@ git-gc - Cleanup unnecessary files and optimize the local repository
 SYNOPSIS
 --------
 [verse]
-'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force]
+'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force] [--keep-largest-pack]
 
 DESCRIPTION
 -----------
@@ -78,6 +78,10 @@ automatic consolidation of packs.
 	Force `git gc` to run even if there may be another `git gc`
 	instance running on this repository.
 
+--keep-largest-pack::
+	All packs except the largest pack and those marked with a
+	`.keep` files are consolidated into a single pack.
+
 Configuration
 -------------
 
diff --git a/builtin/gc.c b/builtin/gc.c
index 77fa720bd0..9a09cf53b0 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -164,6 +164,24 @@ static int too_many_loose_objects(void)
 	return needed;
 }
 
+static void find_base_packs(struct string_list *packs)
+{
+	struct packed_git *p, *base = NULL;
+
+	prepare_packed_git();
+
+	for (p = packed_git; p; p = p->next) {
+		if (!p->pack_local)
+			continue;
+		if (!base || base->pack_size < p->pack_size) {
+			base = p;
+		}
+	}
+
+	if (base)
+		string_list_append(packs, base->pack_name);
+}
+
 static int too_many_packs(void)
 {
 	struct packed_git *p;
@@ -187,7 +205,13 @@ static int too_many_packs(void)
 	return gc_auto_pack_limit < cnt;
 }
 
-static void add_repack_all_option(void)
+static int keep_one_pack(struct string_list_item *item, void *data)
+{
+	argv_array_pushf(&repack, "--keep-pack=%s", basename(item->string));
+	return 0;
+}
+
+static void add_repack_all_option(struct string_list *keep_pack)
 {
 	if (prune_expire && !strcmp(prune_expire, "now"))
 		argv_array_push(&repack, "-a");
@@ -196,6 +220,9 @@ static void add_repack_all_option(void)
 		if (prune_expire)
 			argv_array_pushf(&repack, "--unpack-unreachable=%s", prune_expire);
 	}
+
+	if (keep_pack)
+		for_each_string_list(keep_pack, keep_one_pack, NULL);
 }
 
 static void add_repack_incremental_option(void)
@@ -219,7 +246,7 @@ static int need_to_gc(void)
 	 * there is no need.
 	 */
 	if (too_many_packs())
-		add_repack_all_option();
+		add_repack_all_option(NULL);
 	else if (too_many_loose_objects())
 		add_repack_incremental_option();
 	else
@@ -353,6 +380,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 	const char *name;
 	pid_t pid;
 	int daemonized = 0;
+	int keep_base_pack = -1;
 
 	struct option builtin_gc_options[] = {
 		OPT__QUIET(&quiet, N_("suppress progress reporting")),
@@ -362,6 +390,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 		OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
 		OPT_BOOL(0, "auto", &auto_gc, N_("enable auto-gc mode")),
 		OPT_BOOL(0, "force", &force, N_("force running gc even if there may be another gc running")),
+		OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
+			 N_("repack all other packs except the largest pack")),
 		OPT_END()
 	};
 
@@ -427,8 +457,17 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 			 */
 			daemonized = !daemonize();
 		}
-	} else
-		add_repack_all_option();
+	} else {
+		struct string_list keep_pack = STRING_LIST_INIT_NODUP;
+
+		if (keep_base_pack != -1) {
+			if (keep_base_pack)
+				find_base_packs(&keep_pack);
+		}
+
+		add_repack_all_option(&keep_pack);
+		string_list_clear(&keep_pack, 0);
+	}
 
 	name = lock_repo_for_gc(force, &pid);
 	if (name) {
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 41b0be575d..a95969af2a 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -43,6 +43,31 @@ test_expect_success 'gc is not aborted due to a stale symref' '
 	)
 '
 
+test_expect_success 'gc --keep-largest-pack' '
+	test_create_repo keep-pack &&
+	(
+		cd keep-pack &&
+		test_commit one &&
+		test_commit two &&
+		test_commit three &&
+		git gc &&
+		( cd .git/objects/pack && ls *.pack ) >pack-list &&
+		test_line_count = 1 pack-list &&
+		BASE_PACK=.git/objects/pack/pack-*.pack &&
+		test_commit four &&
+		git repack -d &&
+		test_commit five &&
+		git repack -d &&
+		( cd .git/objects/pack && ls *.pack ) >pack-list &&
+		test_line_count = 3 pack-list &&
+		git gc --keep-largest-pack &&
+		( cd .git/objects/pack && ls *.pack ) >pack-list &&
+		test_line_count = 2 pack-list &&
+		test_path_is_file $BASE_PACK &&
+		git fsck
+	)
+'
+
 test_expect_success 'auto gc with too many loose objects does not attempt to create bitmaps' '
 	test_config gc.auto 3 &&
 	test_config gc.autodetach false &&
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 03/36] t/helper: merge test-sha1 into test-tool
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (4 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v4 3/7] gc: add --keep-largest-pack option Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 4/7] gc: add gc.bigPackThreshold config Nguyễn Thái Ngọc Duy
                     ` (7 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/howto/recover-corrupted-object-harder.txt | 2 +-
 Makefile                                                | 4 ++--
 t/helper/test-sha1.c                                    | 3 ++-
 t/helper/test-sha1.sh                                   | 4 ++--
 t/helper/test-tool.c                                    | 1 +
 t/helper/test-tool.h                                    | 1 +
 t/lib-pack.sh                                           | 2 +-
 t/t0013-sha1dc.sh                                       | 2 +-
 8 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Documentation/howto/recover-corrupted-object-harder.txt b/Documentation/howto/recover-corrupted-object-harder.txt
index 9c4cd0915f..8994e2559e 100644
--- a/Documentation/howto/recover-corrupted-object-harder.txt
+++ b/Documentation/howto/recover-corrupted-object-harder.txt
@@ -80,7 +80,7 @@ valid pack like:
     # now add our object data
     cat object >>tmp.pack
     # and then append the pack trailer
-    /path/to/git.git/test-sha1 -b <tmp.pack >trailer
+    /path/to/git.git/t/helper/test-tool sha1 -b <tmp.pack >trailer
     cat trailer >>tmp.pack
 ------------
 
diff --git a/Makefile b/Makefile
index 416a8e39c1..3c0d0474af 100644
--- a/Makefile
+++ b/Makefile
@@ -653,6 +653,7 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-config
@@ -684,7 +685,6 @@ 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
@@ -2502,7 +2502,7 @@ 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))
diff --git a/t/helper/test-sha1.c b/t/helper/test-sha1.c
index a1c13f54ec..1ba0675c75 100644
--- a/t/helper/test-sha1.c
+++ b/t/helper/test-sha1.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int ac, const char **av)
+int cmd__sha1(int ac, const char **av)
 {
 	git_SHA_CTX ctx;
 	unsigned char sha1[20];
diff --git a/t/helper/test-sha1.sh b/t/helper/test-sha1.sh
index 750b95a0a1..84594885c7 100755
--- a/t/helper/test-sha1.sh
+++ b/t/helper/test-sha1.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
-/usr/bin/time t/helper/test-sha1 >/dev/null
+/usr/bin/time t/helper/test-tool sha1 >/dev/null
 
 while read expect cnt pfx
 do
@@ -11,7 +11,7 @@ do
 			test -z "$pfx" || echo "$pfx"
 			dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
 			perl -pe 'y/\000/g/'
-		} | ./t/helper/test-sha1 $cnt
+		} | ./t/helper/test-tool sha1 $cnt
 	)
 	if test "$expect" = "$actual"
 	then
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 63ec15cb56..7a9bb9f140 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
+	{ "sha1", cmd__sha1 },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 3a35e70e79..a05b8bd14c 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,5 +2,6 @@
 #define __TEST_TOOL_H__
 
 int cmd__chmtime(int argc, const char **argv);
+int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/lib-pack.sh b/t/lib-pack.sh
index 7509846571..501078249d 100644
--- a/t/lib-pack.sh
+++ b/t/lib-pack.sh
@@ -85,7 +85,7 @@ pack_obj () {
 
 # Compute and append pack trailer to "$1"
 pack_trailer () {
-	test-sha1 -b <"$1" >trailer.tmp &&
+	test-tool sha1 -b <"$1" >trailer.tmp &&
 	cat trailer.tmp >>"$1" &&
 	rm -f trailer.tmp
 }
diff --git a/t/t0013-sha1dc.sh b/t/t0013-sha1dc.sh
index 6d655cb161..419f31a8f7 100755
--- a/t/t0013-sha1dc.sh
+++ b/t/t0013-sha1dc.sh
@@ -11,7 +11,7 @@ then
 fi
 
 test_expect_success 'test-sha1 detects shattered pdf' '
-	test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
+	test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
 	test_i18ngrep collision err &&
 	grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
 '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v4 4/7] gc: add gc.bigPackThreshold config
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (5 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v2 03/36] t/helper: merge test-sha1 into test-tool Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v2 04/36] t/helper: merge test-lazy-init-name-hash into test-tool Nguyễn Thái Ngọc Duy
                     ` (6 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

The --keep-largest-pack option is not very convenient to use because
you need to tell gc to do this explicitly (and probably on just a few
large repos).

Add a config key that enables this mode when packs larger than a limit
are found. Note that there's a slight behavior difference compared to
--keep-largest-pack: all packs larger than the threshold are kept, not
just the largest one.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/config.txt |  8 ++++++++
 Documentation/git-gc.txt |  6 ++++--
 builtin/gc.c             | 26 ++++++++++++++++++++------
 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index ce9102cea8..d63db3f12c 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1558,6 +1558,14 @@ gc.autoDetach::
 	Make `git gc --auto` return immediately and run in background
 	if the system supports it. Default is true.
 
+gc.bigPackThreshold::
+	If non-zero, all packs larger than this limit are kept when
+	`git gc` is run. This is very similar to `--keep-base-pack`
+	except that all packs that meet the threshold are kept, not
+	just the base pack. Defaults to zero. Common unit suffixes of
+	'k', 'm', or 'g' are supported.
+
+
 gc.logExpiry::
 	If the file gc.log exists, then `git gc --auto` won't run
 	unless that file is more than 'gc.logExpiry' old.  Default is
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index bf81b8de30..0adf381b52 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -55,7 +55,8 @@ all loose objects are combined into a single pack using
 disables automatic packing of loose objects.
 +
 If the number of packs exceeds the value of `gc.autoPackLimit`,
-then existing packs (except those marked with a `.keep` file)
+then existing packs (except those marked with a `.keep` file
+or over `gc.bigPackThreshold` limit)
 are consolidated into a single pack by using the `-A` option of
 'git repack'. Setting `gc.autoPackLimit` to 0 disables
 automatic consolidation of packs.
@@ -80,7 +81,8 @@ automatic consolidation of packs.
 
 --keep-largest-pack::
 	All packs except the largest pack and those marked with a
-	`.keep` files are consolidated into a single pack.
+	`.keep` files are consolidated into a single pack. When this
+	option is used, `gc.bigPackThreshold` is ignored.
 
 Configuration
 -------------
diff --git a/builtin/gc.c b/builtin/gc.c
index 9a09cf53b0..53a0500898 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -39,6 +39,7 @@ static timestamp_t gc_log_expire_time;
 static const char *gc_log_expire = "1.day.ago";
 static const char *prune_expire = "2.weeks.ago";
 static const char *prune_worktrees_expire = "3.months.ago";
+static unsigned long big_pack_threshold;
 
 static struct argv_array pack_refs_cmd = ARGV_ARRAY_INIT;
 static struct argv_array reflog = ARGV_ARRAY_INIT;
@@ -126,6 +127,8 @@ static void gc_config(void)
 	git_config_get_expiry("gc.worktreepruneexpire", &prune_worktrees_expire);
 	git_config_get_expiry("gc.logexpiry", &gc_log_expire);
 
+	git_config_get_ulong("gc.bigpackthreshold", &big_pack_threshold);
+
 	git_config(git_default_config, NULL);
 }
 
@@ -164,7 +167,7 @@ static int too_many_loose_objects(void)
 	return needed;
 }
 
-static void find_base_packs(struct string_list *packs)
+static void find_base_packs(struct string_list *packs, unsigned long limit)
 {
 	struct packed_git *p, *base = NULL;
 
@@ -173,7 +176,10 @@ static void find_base_packs(struct string_list *packs)
 	for (p = packed_git; p; p = p->next) {
 		if (!p->pack_local)
 			continue;
-		if (!base || base->pack_size < p->pack_size) {
+		if (limit) {
+			if (p->pack_size >= limit)
+				string_list_append(packs, p->pack_name);
+		} else if (!base || base->pack_size < p->pack_size) {
 			base = p;
 		}
 	}
@@ -245,9 +251,15 @@ static int need_to_gc(void)
 	 * we run "repack -A -d -l".  Otherwise we tell the caller
 	 * there is no need.
 	 */
-	if (too_many_packs())
-		add_repack_all_option(NULL);
-	else if (too_many_loose_objects())
+	if (too_many_packs()) {
+		struct string_list keep_pack = STRING_LIST_INIT_NODUP;
+
+		if (big_pack_threshold)
+			find_base_packs(&keep_pack, big_pack_threshold);
+
+		add_repack_all_option(&keep_pack);
+		string_list_clear(&keep_pack, 0);
+	} else if (too_many_loose_objects())
 		add_repack_incremental_option();
 	else
 		return 0;
@@ -462,7 +474,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 
 		if (keep_base_pack != -1) {
 			if (keep_base_pack)
-				find_base_packs(&keep_pack);
+				find_base_packs(&keep_pack, 0);
+		} else if (big_pack_threshold) {
+			find_base_packs(&keep_pack, big_pack_threshold);
 		}
 
 		add_repack_all_option(&keep_pack);
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 04/36] t/helper: merge test-lazy-init-name-hash into test-tool
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (6 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v4 4/7] gc: add gc.bigPackThreshold config Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 5/7] gc: handle a corner case in gc.bigPackThreshold Nguyễn Thái Ngọc Duy
                     ` (5 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                                |  2 +-
 t/helper/test-lazy-init-name-hash.c     | 13 +++++++------
 t/helper/test-tool.c                    |  1 +
 t/helper/test-tool.h                    |  1 +
 t/perf/p0004-lazy-init-name-hash.sh     |  8 ++++----
 t/t3008-ls-files-lazy-init-name-hash.sh |  2 +-
 6 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 3c0d0474af..31287cedf2 100644
--- a/Makefile
+++ b/Makefile
@@ -653,6 +653,7 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-ctype
@@ -669,7 +670,6 @@ 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
diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
index 297fb01d61..b99a37080d 100644
--- a/t/helper/test-lazy-init-name-hash.c
+++ b/t/helper/test-lazy-init-name-hash.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "parse-options.h"
 
@@ -184,14 +185,14 @@ static void analyze_run(void)
 	}
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__lazy_init_name_hash(int argc, const char **argv)
 {
 	const char *usage[] = {
-		"test-lazy-init-name-hash -d (-s | -m)",
-		"test-lazy-init-name-hash -p [-c c]",
-		"test-lazy-init-name-hash -a a [--step s] [-c c]",
-		"test-lazy-init-name-hash (-s | -m) [-c c]",
-		"test-lazy-init-name-hash -s -m [-c c]",
+		"test-tool lazy-init-name-hash -d (-s | -m)",
+		"test-tool lazy-init-name-hash -p [-c c]",
+		"test-tool lazy-init-name-hash -a a [--step s] [-c c]",
+		"test-tool lazy-init-name-hash (-s | -m) [-c c]",
+		"test-tool lazy-init-name-hash -s -m [-c c]",
 		NULL
 	};
 	struct option options[] = {
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 7a9bb9f140..afc7a518d6 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
+	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index a05b8bd14c..1dc4673c3a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,6 +2,7 @@
 #define __TEST_TOOL_H__
 
 int cmd__chmtime(int argc, const char **argv);
+int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/perf/p0004-lazy-init-name-hash.sh b/t/perf/p0004-lazy-init-name-hash.sh
index 8de5a98cfc..1afc08fe7f 100755
--- a/t/perf/p0004-lazy-init-name-hash.sh
+++ b/t/perf/p0004-lazy-init-name-hash.sh
@@ -7,8 +7,8 @@ test_perf_large_repo
 test_checkout_worktree
 
 test_expect_success 'verify both methods build the same hashmaps' '
-	test-lazy-init-name-hash --dump --single >out.single &&
-	if test-lazy-init-name-hash --dump --multi >out.multi
+	test-tool lazy-init-name-hash --dump --single >out.single &&
+	if test-tool lazy-init-name-hash --dump --multi >out.multi
 	then
 		test_set_prereq REPO_BIG_ENOUGH_FOR_MULTI &&
 		sort <out.single >sorted.single &&
@@ -46,11 +46,11 @@ test_expect_success 'calibrate' '
 '
 
 test_perf "single-threaded, $desc" "
-	test-lazy-init-name-hash --single --count=$count
+	test-tool lazy-init-name-hash --single --count=$count
 "
 
 test_perf REPO_BIG_ENOUGH_FOR_MULTI "multi-threaded, $desc" "
-	test-lazy-init-name-hash --multi --count=$count
+	test-tool lazy-init-name-hash --multi --count=$count
 "
 
 test_done
diff --git a/t/t3008-ls-files-lazy-init-name-hash.sh b/t/t3008-ls-files-lazy-init-name-hash.sh
index bdf5198b7e..8df4aa7c99 100755
--- a/t/t3008-ls-files-lazy-init-name-hash.sh
+++ b/t/t3008-ls-files-lazy-init-name-hash.sh
@@ -21,7 +21,7 @@ test_expect_success 'no buffer overflow in lazy_init_name_hash' '
 	) |
 	sed "s/^/100644 $EMPTY_BLOB	/" |
 	git update-index --index-info &&
-	test-lazy-init-name-hash -m
+	test-tool lazy-init-name-hash -m
 '
 
 test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v4 5/7] gc: handle a corner case in gc.bigPackThreshold
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (7 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v2 04/36] t/helper: merge test-lazy-init-name-hash into test-tool Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v2 05/36] t/helper: merge test-config into test-tool Nguyễn Thái Ngọc Duy
                     ` (4 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

This config allows us to keep <N> packs back if their size is larger
than a limit. But if this N >= gc.autoPackLimit, we may have a
problem. We are supposed to reduce the number of packs after a
threshold because it affects performance.

We could tell the user that they have incompatible gc.bigPackThreshold
and gc.autoPackLimit, but it's kinda hard when 'git gc --auto' runs in
background. Instead let's fall back to the next best stategy: try to
reduce the number of packs anyway, but keep the base pack out. This
reduces the number of packs to two and hopefully won't take up too
much resources to repack (the assumption still is the base pack takes
most resources to handle).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/config.txt | 6 +++++-
 builtin/gc.c             | 8 +++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index d63db3f12c..cf862d3edf 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1564,7 +1564,11 @@ gc.bigPackThreshold::
 	except that all packs that meet the threshold are kept, not
 	just the base pack. Defaults to zero. Common unit suffixes of
 	'k', 'm', or 'g' are supported.
-
++
+Note that if the number of kept packs is more than gc.autoPackLimit,
+this configuration variable is ignored, all packs except the base pack
+will be repacked. After this the number of packs should go below
+gc.autoPackLimit and gc.bigPackThreshold should be respected again.
 
 gc.logExpiry::
 	If the file gc.log exists, then `git gc --auto` won't run
diff --git a/builtin/gc.c b/builtin/gc.c
index 53a0500898..74d3aaa270 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -254,8 +254,14 @@ static int need_to_gc(void)
 	if (too_many_packs()) {
 		struct string_list keep_pack = STRING_LIST_INIT_NODUP;
 
-		if (big_pack_threshold)
+		if (big_pack_threshold) {
 			find_base_packs(&keep_pack, big_pack_threshold);
+			if (keep_pack.nr >= gc_auto_pack_limit) {
+				big_pack_threshold = 0;
+				string_list_clear(&keep_pack, 0);
+				find_base_packs(&keep_pack, 0);
+			}
+		}
 
 		add_repack_all_option(&keep_pack);
 		string_list_clear(&keep_pack, 0);
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 05/36] t/helper: merge test-config into test-tool
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (8 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v4 5/7] gc: handle a corner case in gc.bigPackThreshold Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 6/7] gc --auto: exclude base pack if not enough mem to "repack -ad" Nguyễn Thái Ngọc Duy
                     ` (3 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                  |  2 +-
 t/helper/test-config.c    |  5 +++--
 t/helper/test-tool.c      |  1 +
 t/helper/test-tool.h      |  1 +
 t/t1305-config-include.sh |  2 +-
 t/t1308-config-set.sh     | 22 +++++++++++-----------
 t/t1309-early-config.sh   | 12 ++++++------
 7 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile
index 31287cedf2..227f16ad17 100644
--- a/Makefile
+++ b/Makefile
@@ -653,11 +653,11 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-config.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 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
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 1a7b8bd3d6..214003d5b2 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "config.h"
 #include "string-list.h"
@@ -32,7 +33,7 @@
  * Examples:
  *
  * To print the value with highest priority for key "foo.bAr Baz.rock":
- * 	test-config get_value "foo.bAr Baz.rock"
+ * 	test-tool config get_value "foo.bAr Baz.rock"
  *
  */
 
@@ -77,7 +78,7 @@ static int early_config_cb(const char *var, const char *value, void *vdata)
 	return 0;
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__config(int argc, const char **argv)
 {
 	int i, val;
 	const char *v;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index afc7a518d6..e8d6c6b9eb 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
+	{ "config", cmd__config },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 1dc4673c3a..3084f458a0 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,6 +2,7 @@
 #define __TEST_TOOL_H__
 
 int cmd__chmtime(int argc, const char **argv);
+int cmd__config(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
index d9d2f545a4..f035ee40a3 100755
--- a/t/t1305-config-include.sh
+++ b/t/t1305-config-include.sh
@@ -224,7 +224,7 @@ test_expect_success 'conditional include, early config reading' '
 		echo "[includeIf \"gitdir:foo/\"]path=bar6" >>.git/config &&
 		echo "[test]six=6" >.git/bar6 &&
 		echo 6 >expect &&
-		test-config read_early_config test.six >actual &&
+		test-tool config read_early_config test.six >actual &&
 		test_cmp expect actual
 	)
 '
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index bafed5c9b8..3e00d1af01 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -18,7 +18,7 @@ check_config () {
 	then
 		printf "%s\n" "$@"
 	fi >expect &&
-	test_expect_code $expect_code test-config "$op" "$key" >actual &&
+	test_expect_code $expect_code test-tool config "$op" "$key" >actual &&
 	test_cmp expect actual
 }
 
@@ -125,7 +125,7 @@ test_expect_success 'find string value for a key' '
 '
 
 test_expect_success 'check line error when NULL string is queried' '
-	test_expect_code 128 test-config get_string case.foo 2>result &&
+	test_expect_code 128 test-tool config get_string case.foo 2>result &&
 	test_i18ngrep "fatal: .*case\.foo.*\.git/config.*line 7" result
 '
 
@@ -155,13 +155,13 @@ test_expect_success 'find value from a configset' '
 		baz = ball
 	EOF
 	echo silk >expect &&
-	test-config configset_get_value my.new config2 .git/config >actual &&
+	test-tool config configset_get_value my.new config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'find value with highest priority from a configset' '
 	echo hask >expect &&
-	test-config configset_get_value case.baz config2 .git/config >actual &&
+	test-tool config configset_get_value case.baz config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
@@ -173,20 +173,20 @@ test_expect_success 'find value_list for a key from a configset' '
 	lama
 	ball
 	EOF
-	test-config configset_get_value case.baz config2 .git/config >actual &&
+	test-tool config configset_get_value case.baz config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'proper error on non-existent files' '
 	echo "Error (-1) reading configuration file non-existent-file." >expect &&
-	test_expect_code 2 test-config configset_get_value foo.bar non-existent-file 2>actual &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar non-existent-file 2>actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'proper error on directory "files"' '
 	echo "Error (-1) reading configuration file a-directory." >expect &&
 	mkdir a-directory &&
-	test_expect_code 2 test-config configset_get_value foo.bar a-directory 2>output &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar a-directory 2>output &&
 	grep "^warning:" output &&
 	grep "^Error" output >actual &&
 	test_cmp expect actual
@@ -196,7 +196,7 @@ test_expect_success POSIXPERM,SANITY 'proper error on non-accessible files' '
 	chmod -r .git/config &&
 	test_when_finished "chmod +r .git/config" &&
 	echo "Error (-1) reading configuration file .git/config." >expect &&
-	test_expect_code 2 test-config configset_get_value foo.bar .git/config 2>output &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar .git/config 2>output &&
 	grep "^warning:" output &&
 	grep "^Error" output >actual &&
 	test_cmp expect actual
@@ -207,14 +207,14 @@ test_expect_success 'proper error on error in default config files' '
 	test_when_finished "mv .git/config.old .git/config" &&
 	echo "[" >>.git/config &&
 	echo "fatal: bad config line 34 in file .git/config" >expect &&
-	test_expect_code 128 test-config get_value foo.bar 2>actual &&
+	test_expect_code 128 test-tool config get_value foo.bar 2>actual &&
 	test_i18ncmp expect actual
 '
 
 test_expect_success 'proper error on error in custom config files' '
 	echo "[" >>syntax-error &&
 	echo "fatal: bad config line 1 in file syntax-error" >expect &&
-	test_expect_code 128 test-config configset_get_value foo.bar syntax-error 2>actual &&
+	test_expect_code 128 test-tool config configset_get_value foo.bar syntax-error 2>actual &&
 	test_i18ncmp expect actual
 '
 
@@ -267,7 +267,7 @@ test_expect_success 'iteration shows correct origins' '
 	name=
 	scope=cmdline
 	EOF
-	GIT_CONFIG_PARAMETERS=$cmdline_config test-config iterate >actual &&
+	GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t1309-early-config.sh b/t/t1309-early-config.sh
index 3dda215e8e..413642aa56 100755
--- a/t/t1309-early-config.sh
+++ b/t/t1309-early-config.sh
@@ -6,7 +6,7 @@ test_description='Test read_early_config()'
 
 test_expect_success 'read early config' '
 	test_config early.config correct &&
-	test-config read_early_config early.config >output &&
+	test-tool config read_early_config early.config >output &&
 	test correct = "$(cat output)"
 '
 
@@ -15,7 +15,7 @@ test_expect_success 'in a sub-directory' '
 	mkdir -p sub &&
 	(
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test sub = "$(cat output)"
 '
@@ -27,7 +27,7 @@ test_expect_success 'ceiling' '
 		GIT_CEILING_DIRECTORIES="$PWD" &&
 		export GIT_CEILING_DIRECTORIES &&
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test -z "$(cat output)"
 '
@@ -42,7 +42,7 @@ test_expect_success 'ceiling #2' '
 		GIT_CEILING_DIRECTORIES="$PWD" &&
 		export GIT_CEILING_DIRECTORIES XDG_CONFIG_HOME &&
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test xdg = "$(cat output)"
 '
@@ -54,7 +54,7 @@ test_expect_success 'read config file in right order' '
 	(
 		cd foo &&
 		echo "[test]source = repo" >>.git/config &&
-		GIT_CONFIG_PARAMETERS=$cmdline_config test-config \
+		GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config \
 			read_early_config test.source >actual &&
 		cat >expected <<-\EOF &&
 		home
@@ -71,7 +71,7 @@ test_with_config () {
 	(
 		cd throwaway &&
 		echo "$*" >.git/config &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	)
 }
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v4 6/7] gc --auto: exclude base pack if not enough mem to "repack -ad"
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (9 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v2 05/36] t/helper: merge test-config into test-tool Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v2 06/36] t/helper: merge test-ctype into test-tool Nguyễn Thái Ngọc Duy
                     ` (2 subsequent siblings)
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

pack-objects could be a big memory hog especially on large repos,
everybody knows that. The suggestion to stick a .keep file on the
giant base pack to avoid this problem is also known for a long time.

Recent patches add an option to do just this, but it has to be either
configured or activated manually. This patch lets `git gc --auto`
activate this mode automatically when it thinks `repack -ad` will use
a lot of memory and start affecting the system due to swapping or
flushing OS cache.

gc --auto decides to do this based on an estimation of pack-objects
memory usage, which is quite accurate at least for the heap part, and
whether that fits in half of system memory (the assumption here is for
desktop environment where there are many other applications running).

This mechanism only kicks in if gc.bigBasePackThreshold is not configured.
If it is, it is assumed that the user already knows what they want.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/git-gc.txt |  9 +++-
 builtin/gc.c             | 98 +++++++++++++++++++++++++++++++++++++++-
 builtin/pack-objects.c   |  2 +-
 config.mak.uname         |  1 +
 git-compat-util.h        |  4 ++
 pack-objects.h           |  2 +
 t/t6500-gc.sh            |  7 +++
 7 files changed, 119 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 0adf381b52..7549094900 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -58,8 +58,13 @@ If the number of packs exceeds the value of `gc.autoPackLimit`,
 then existing packs (except those marked with a `.keep` file
 or over `gc.bigPackThreshold` limit)
 are consolidated into a single pack by using the `-A` option of
-'git repack'. Setting `gc.autoPackLimit` to 0 disables
-automatic consolidation of packs.
+'git repack'.
+If the amount of memory is estimated not enough for `git repack` to
+run smoothly and `gc.bigPackThreshold` is not set, the largest
+pack will also be excluded (this is the equivalent of running `git gc`
+with `--keep-base-pack`).
+Setting `gc.autoPackLimit` to 0 disables automatic consolidation of
+packs.
 
 --prune=<date>::
 	Prune loose objects older than date (default is 2 weeks ago,
diff --git a/builtin/gc.c b/builtin/gc.c
index 74d3aaa270..d0b04e369e 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -20,6 +20,10 @@
 #include "argv-array.h"
 #include "commit.h"
 #include "packfile.h"
+#include "pack.h"
+#include "pack-objects.h"
+#include "blob.h"
+#include "tree.h"
 
 #define FAILED_RUN "failed to run %s"
 
@@ -40,6 +44,7 @@ static const char *gc_log_expire = "1.day.ago";
 static const char *prune_expire = "2.weeks.ago";
 static const char *prune_worktrees_expire = "3.months.ago";
 static unsigned long big_pack_threshold;
+static unsigned long max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE;
 
 static struct argv_array pack_refs_cmd = ARGV_ARRAY_INIT;
 static struct argv_array reflog = ARGV_ARRAY_INIT;
@@ -128,6 +133,7 @@ static void gc_config(void)
 	git_config_get_expiry("gc.logexpiry", &gc_log_expire);
 
 	git_config_get_ulong("gc.bigpackthreshold", &big_pack_threshold);
+	git_config_get_ulong("pack.deltacachesize", &max_delta_cache_size);
 
 	git_config(git_default_config, NULL);
 }
@@ -167,7 +173,8 @@ static int too_many_loose_objects(void)
 	return needed;
 }
 
-static void find_base_packs(struct string_list *packs, unsigned long limit)
+static struct packed_git *find_base_packs(struct string_list *packs,
+					  unsigned long limit)
 {
 	struct packed_git *p, *base = NULL;
 
@@ -186,6 +193,8 @@ static void find_base_packs(struct string_list *packs, unsigned long limit)
 
 	if (base)
 		string_list_append(packs, base->pack_name);
+
+	return base;
 }
 
 static int too_many_packs(void)
@@ -211,6 +220,79 @@ static int too_many_packs(void)
 	return gc_auto_pack_limit < cnt;
 }
 
+static uint64_t total_ram(void)
+{
+#if defined(HAVE_SYSINFO)
+	struct sysinfo si;
+
+	if (!sysinfo(&si))
+		return si.totalram;
+#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM))
+	int64_t physical_memory;
+	int mib[2];
+	size_t length;
+
+	mib[0] = CTL_HW;
+# if defined(HW_MEMSIZE)
+	mib[1] = HW_MEMSIZE;
+# else
+	mib[1] = HW_PHYSMEM;
+# endif
+	length = sizeof(int64_t);
+	if (!sysctl(mib, 2, &physical_memory, &length, NULL, 0))
+		return physical_memory;
+#elif defined(GIT_WINDOWS_NATIVE)
+	MEMORYSTATUSEX memInfo;
+
+	memInfo.dwLength = sizeof(MEMORYSTATUSEX);
+	if (GlobalMemoryStatusEx(&memInfo))
+		return memInfo.ullTotalPhys;
+#endif
+	return 0;
+}
+
+static uint64_t estimate_repack_memory(struct packed_git *pack)
+{
+	unsigned long nr_objects = approximate_object_count();
+	size_t os_cache, heap;
+
+	if (!pack || !nr_objects)
+		return 0;
+
+	/*
+	 * First we have to scan through at least one pack.
+	 * Assume enough room in OS file cache to keep the entire pack
+	 * or we may accidentally evict data of other processes from
+	 * the cache.
+	 */
+	os_cache = pack->pack_size + pack->index_size;
+	/* then pack-objects needs lots more for book keeping */
+	heap = sizeof(struct object_entry) * nr_objects;
+	/*
+	 * internal rev-list --all --objects takes up some memory too,
+	 * let's say half of it is for blobs
+	 */
+	heap += sizeof(struct blob) * nr_objects / 2;
+	/*
+	 * and the other half is for trees (commits and tags are
+	 * usually insignificant)
+	 */
+	heap += sizeof(struct tree) * nr_objects / 2;
+	/* and then obj_hash[], underestimated in fact */
+	heap += sizeof(struct object *) * nr_objects;
+	/* revindex is used also */
+	heap += sizeof(struct revindex_entry) * nr_objects;
+	/*
+	 * read_sha1_file() (either at delta calculation phase, or
+	 * writing phase) also fills up the delta base cache
+	 */
+	heap += delta_base_cache_limit;
+	/* and of course pack-objects has its own delta cache */
+	heap += max_delta_cache_size;
+
+	return os_cache + heap;
+}
+
 static int keep_one_pack(struct string_list_item *item, void *data)
 {
 	argv_array_pushf(&repack, "--keep-pack=%s", basename(item->string));
@@ -261,6 +343,20 @@ static int need_to_gc(void)
 				string_list_clear(&keep_pack, 0);
 				find_base_packs(&keep_pack, 0);
 			}
+		} else {
+			struct packed_git *p = find_base_packs(&keep_pack, 0);
+			uint64_t mem_have, mem_want;
+
+			mem_have = total_ram();
+			mem_want = estimate_repack_memory(p);
+
+			/*
+			 * Only allow 1/2 of memory for pack-objects, leave
+			 * the rest for the OS and other processes in the
+			 * system.
+			 */
+			if (!mem_have || mem_want < mem_have / 2)
+				string_list_clear(&keep_pack, 0);
 		}
 
 		add_repack_all_option(&keep_pack);
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 7ec70131a9..8b2f8b72bf 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -80,7 +80,7 @@ static uint16_t write_bitmap_options;
 static int exclude_promisor_objects;
 
 static unsigned long delta_cache_size = 0;
-static unsigned long max_delta_cache_size = 256 * 1024 * 1024;
+static unsigned long max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE;
 static unsigned long cache_max_small_delta_size = 1000;
 
 static unsigned long window_memory_limit = 0;
diff --git a/config.mak.uname b/config.mak.uname
index 6a1d0de0cc..ae9cbccec1 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -37,6 +37,7 @@ ifeq ($(uname_S),Linux)
 	HAVE_GETDELIM = YesPlease
 	SANE_TEXT_GREP=-a
 	FREAD_READS_DIRECTORIES = UnfortunatelyYes
+	BASIC_CFLAGS += -DHAVE_SYSINFO
 endif
 ifeq ($(uname_S),GNU/kFreeBSD)
 	HAVE_ALLOCA_H = YesPlease
diff --git a/git-compat-util.h b/git-compat-util.h
index 07e383257b..e373af48b8 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -284,6 +284,10 @@ extern char *gitdirname(char *);
 #include <openssl/err.h>
 #endif
 
+#ifdef HAVE_SYSINFO
+# include <sys/sysinfo.h>
+#endif
+
 /* On most systems <netdb.h> would have given us this, but
  * not on some systems (e.g. z/OS).
  */
diff --git a/pack-objects.h b/pack-objects.h
index 03f1191659..af4f46c026 100644
--- a/pack-objects.h
+++ b/pack-objects.h
@@ -1,6 +1,8 @@
 #ifndef PACK_OBJECTS_H
 #define PACK_OBJECTS_H
 
+#define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)
+
 struct object_entry {
 	struct pack_idx_entry idx;
 	unsigned long size;	/* uncompressed size */
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index a95969af2a..100f287b97 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -5,6 +5,13 @@ test_description='basic git gc tests
 
 . ./test-lib.sh
 
+test_expect_success 'setup' '
+	# do not let the amount of physical memory affects gc
+	# behavior, make sure we always pack everything to one pack by
+	# default
+	git config gc.bigPackThreshold 2g
+'
+
 test_expect_success 'gc empty repository' '
 	git gc
 '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 06/36] t/helper: merge test-ctype into test-tool
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (10 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v4 6/7] gc --auto: exclude base pack if not enough mem to "repack -ad" Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v4 7/7] pack-objects: show some progress when counting kept objects Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v2 07/36] t/helper: merge test-date into test-tool Nguyễn Thái Ngọc Duy
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile               | 2 +-
 t/helper/test-ctype.c  | 3 ++-
 t/helper/test-tool.c   | 1 +
 t/helper/test-tool.h   | 1 +
 t/t0070-fundamental.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 227f16ad17..d09710dc3d 100644
--- a/Makefile
+++ b/Makefile
@@ -654,10 +654,10 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
 TEST_BUILTINS_OBJS += test-config.o
+TEST_BUILTINS_OBJS += test-ctype.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-date
 TEST_PROGRAMS_NEED_X += test-delta
 TEST_PROGRAMS_NEED_X += test-drop-caches
diff --git a/t/helper/test-ctype.c b/t/helper/test-ctype.c
index bb72c47df5..92c4c2313e 100644
--- a/t/helper/test-ctype.c
+++ b/t/helper/test-ctype.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 
 static int rc;
@@ -28,7 +29,7 @@ static int is_in(const char *s, int ch)
 #define LOWER "abcdefghijklmnopqrstuvwxyz"
 #define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
-int cmd_main(int argc, const char **argv)
+int cmd__ctype(int argc, const char **argv)
 {
 	TEST_CLASS(isdigit, DIGIT);
 	TEST_CLASS(isspace, " \n\r\t");
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index e8d6c6b9eb..d600a31935 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -9,6 +9,7 @@ struct test_cmd {
 static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
 	{ "config", cmd__config },
+	{ "ctype", cmd__ctype },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 3084f458a0..41805ecd1c 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -3,6 +3,7 @@
 
 int cmd__chmtime(int argc, const char **argv);
 int cmd__config(int argc, const char **argv);
+int cmd__ctype(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 991ed2a48d..70d4d98a2e 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -9,7 +9,7 @@ Verify wrappers and compatibility functions.
 . ./test-lib.sh
 
 test_expect_success 'character classes (isspace, isalpha etc.)' '
-	test-ctype
+	test-tool ctype
 '
 
 test_expect_success 'mktemp to nonexistent directory prints filename' '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v4 7/7] pack-objects: show some progress when counting kept objects
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (11 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v2 06/36] t/helper: merge test-ctype into test-tool Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:42   ` [PATCH v2 07/36] t/helper: merge test-date into test-tool Nguyễn Thái Ngọc Duy
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

We only show progress when there are new objects to be packed. But
when --keep-pack is specified on the base pack, we will exclude most
of objects. This makes 'pack-objects' stay silent for a long time
while the counting phase is going.

Let's show some progress whenever we visit an object instead. The old
"Counting objects" is renamed to "Enumerating objects" and a new
progress "Counting objects" line is added.

This new "Counting objects" line should progress pretty quick when the
system is beefy. But when the system is under pressure, the reading
object header done in this phase could be slow and showing progress is
an improvement over staying silent in the current code.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/pack-objects.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 8b2f8b72bf..1379b4cb92 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -44,7 +44,7 @@ static const char *pack_usage[] = {
 static struct packing_data to_pack;
 
 static struct pack_idx_entry **written_list;
-static uint32_t nr_result, nr_written;
+static uint32_t nr_result, nr_written, nr_seen;
 
 static int non_empty;
 static int reuse_delta = 1, reuse_object = 1;
@@ -1096,6 +1096,8 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
 	off_t found_offset = 0;
 	uint32_t index_pos;
 
+	display_progress(progress_state, ++nr_seen);
+
 	if (have_duplicate_entry(oid, exclude, &index_pos))
 		return 0;
 
@@ -1111,8 +1113,6 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
 	create_object_entry(oid, type, pack_name_hash(name),
 			    exclude, name && no_try_delta(name),
 			    index_pos, found_pack, found_offset);
-
-	display_progress(progress_state, nr_result);
 	return 1;
 }
 
@@ -1123,6 +1123,8 @@ static int add_object_entry_from_bitmap(const struct object_id *oid,
 {
 	uint32_t index_pos;
 
+	display_progress(progress_state, ++nr_seen);
+
 	if (have_duplicate_entry(oid, 0, &index_pos))
 		return 0;
 
@@ -1130,8 +1132,6 @@ static int add_object_entry_from_bitmap(const struct object_id *oid,
 		return 0;
 
 	create_object_entry(oid, type, name_hash, 0, 0, index_pos, pack, offset);
-
-	display_progress(progress_state, nr_result);
 	return 1;
 }
 
@@ -1717,6 +1717,10 @@ static void get_object_details(void)
 	uint32_t i;
 	struct object_entry **sorted_by_offset;
 
+	if (progress)
+		progress_state = start_progress(_("Counting objects"),
+						to_pack.nr_objects);
+
 	sorted_by_offset = xcalloc(to_pack.nr_objects, sizeof(struct object_entry *));
 	for (i = 0; i < to_pack.nr_objects; i++)
 		sorted_by_offset[i] = to_pack.objects + i;
@@ -1727,7 +1731,9 @@ static void get_object_details(void)
 		check_object(entry);
 		if (big_file_threshold < entry->size)
 			entry->no_try_delta = 1;
+		display_progress(progress_state, i + 1);
 	}
+	stop_progress(&progress_state);
 
 	/*
 	 * This must happen in a second pass, since we rely on the delta
@@ -3212,7 +3218,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 	}
 
 	if (progress)
-		progress_state = start_progress(_("Counting objects"), 0);
+		progress_state = start_progress(_("Enumerating objects"), 0);
 	if (!use_internal_rev_list)
 		read_object_list_from_stdin();
 	else {
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 07/36] t/helper: merge test-date into test-tool
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (12 preceding siblings ...)
  2018-03-24  7:42   ` [PATCH v4 7/7] pack-objects: show some progress when counting kept objects Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:42   ` Nguyễn Thái Ngọc Duy
  13 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:42 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile               |  2 +-
 t/helper/test-date.c   | 17 +++++++++--------
 t/helper/test-tool.c   |  1 +
 t/helper/test-tool.h   |  1 +
 t/t0006-date.sh        |  8 ++++----
 t/t1300-repo-config.sh |  2 +-
 t/test-lib.sh          |  4 ++--
 7 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index d09710dc3d..efb1872c52 100644
--- a/Makefile
+++ b/Makefile
@@ -655,10 +655,10 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-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
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index ac83687970..a0837371ab 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -1,13 +1,14 @@
+#include "test-tool.h"
 #include "cache.h"
 
 static const char *usage_msg = "\n"
-"  test-date relative [time_t]...\n"
-"  test-date show:<format> [time_t]...\n"
-"  test-date parse [date]...\n"
-"  test-date approxidate [date]...\n"
-"  test-date timestamp [date]...\n"
-"  test-date is64bit\n"
-"  test-date time_t-is64bit\n";
+"  test-tool date relative [time_t]...\n"
+"  test-tool date show:<format> [time_t]...\n"
+"  test-tool date parse [date]...\n"
+"  test-tool date approxidate [date]...\n"
+"  test-tool date timestamp [date]...\n"
+"  test-tool date is64bit\n"
+"  test-tool date time_t-is64bit\n";
 
 static void show_relative_dates(const char **argv, struct timeval *now)
 {
@@ -81,7 +82,7 @@ static void parse_approx_timestamp(const char **argv, struct timeval *now)
 	}
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__date(int argc, const char **argv)
 {
 	struct timeval now;
 	const char *x;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index d600a31935..e92f93ac3b 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -10,6 +10,7 @@ static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
 	{ "config", cmd__config },
 	{ "ctype", cmd__ctype },
+	{ "date", cmd__date },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 41805ecd1c..31c20bb656 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -4,6 +4,7 @@
 int cmd__chmtime(int argc, const char **argv);
 int cmd__config(int argc, const char **argv);
 int cmd__ctype(int argc, const char **argv);
+int cmd__date(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 7ac9466d50..64ff86df8e 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -10,7 +10,7 @@ check_relative() {
 	t=$(($TEST_DATE_NOW - $1))
 	echo "$t -> $2" >expect
 	test_expect_${3:-success} "relative date ($2)" "
-	test-date relative $t >actual &&
+	test-tool date relative $t >actual &&
 	test_i18ncmp expect actual
 	"
 }
@@ -35,7 +35,7 @@ check_show () {
 	zone=$5
 	test_expect_success $prereqs "show date ($format:$time)" '
 		echo "$time -> $expect" >expect &&
-		TZ=${zone:-$TZ} test-date show:"$format" "$time" >actual &&
+		TZ=${zone:-$TZ} test-tool date show:"$format" "$time" >actual &&
 		test_cmp expect actual
 	'
 }
@@ -71,7 +71,7 @@ check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT,TIME_T_
 check_parse() {
 	echo "$1 -> $2" >expect
 	test_expect_${4:-success} "parse date ($1${3:+ TZ=$3})" "
-	TZ=${3:-$TZ} test-date parse '$1' >actual &&
+	TZ=${3:-$TZ} test-tool date parse '$1' >actual &&
 	test_cmp expect actual
 	"
 }
@@ -92,7 +92,7 @@ check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 -0500' EST5
 check_approxidate() {
 	echo "$1 -> $2 +0000" >expect
 	test_expect_${3:-success} "parse approxidate ($1)" "
-	test-date approxidate '$1' >actual &&
+	test-tool date approxidate '$1' >actual &&
 	test_cmp expect actual
 	"
 }
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 4f8e6f5fde..8780934478 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -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
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7ab8af47a5..483c8d6d7c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1206,5 +1206,5 @@ test_lazy_prereq LONG_IS_64BIT '
 	test 8 -le "$(build_option sizeof-long)"
 '
 
-test_lazy_prereq TIME_IS_64BIT 'test-date is64bit'
-test_lazy_prereq TIME_T_IS_64BIT 'test-date time_t-is64bit'
+test_lazy_prereq TIME_IS_64BIT 'test-tool date is64bit'
+test_lazy_prereq TIME_T_IS_64BIT 'test-tool date time_t-is64bit'
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 00/36] Combine t/helper binaries into a single one
  2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                   ` (36 preceding siblings ...)
  2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44 ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
                     ` (38 more replies)
  37 siblings, 39 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

v2 fixes a couple of typos in commit messages and use the cmd__ prefix
for test commands instead of test_, which avoids a naming conflict
with the existing function test_lazy_init_name_hash

[the previous v2 send out was aborted because I messed it up with some
other patches]

Nguyễn Thái Ngọc Duy (36):
  t/helper: add an empty test-tool program
  t/helper: merge test-chmtime into test-tool
  t/helper: merge test-sha1 into test-tool
  t/helper: merge test-lazy-init-name-hash into test-tool
  t/helper: merge test-config into test-tool
  t/helper: merge test-ctype into test-tool
  t/helper: merge test-date into test-tool
  t/helper: merge (unused) test-delta into test-tool
  t/helper: merge test-drop-caches into test-tool
  t/helper: merge test-dump-cache-tree into test-tool
  t/helper: merge test-dump-split-index into test-tool
  t/helper: merge test-example-decorate into test-tool
  t/helper: merge test-genrandom into test-tool
  t/helper: merge test-hashmap into test-tool
  t/helper: merge test-index-version into test-tool
  t/helper: merge (unused) test-match-trees into test-tool
  t/helper: merge (unused) test-mergesort into test-tool
  t/helper: merge test-mktemp into test-tool
  t/helper: merge test-online-cpus into test-tool
  t/helper: merge test-path-utils into test-tool
  t/helper: merge test-prio-queue into test-tool
  t/helper: merge test-read-cache into test-tool
  t/helper: merge test-ref-store into test-tool
  t/helper: merge test-regex into test-tool
  t/helper: merge test-revision-walking into test-tool
  t/helper: merge test-run-command into test-tool
  t/helper: merge test-scrap-cache-tree into test-tool
  t/helper: merge test-sha1-array into test-tool
  t/helper: merge test-sigchain into test-tool
  t/helper: merge test-strcmp-offset into test-tool
  t/helper: merge test-string-list into test-tool
  t/helper: merge test-submodule-config into test-tool
  t/helper: merge test-subprocess into test-tool
  t/helper: merge test-urlmatch-normalization into test-tool
  t/helper: merge test-wildmatch into test-tool
  t/helper: merge test-write-cache into test-tool

 .../howto/recover-corrupted-object-harder.txt |   2 +-
 Makefile                                      |  79 +++---
 t/helper/test-chmtime.c                       |  15 +-
 t/helper/test-config.c                        |   5 +-
 t/helper/test-ctype.c                         |   3 +-
 t/helper/test-date.c                          |  17 +-
 t/helper/test-delta.c                         |   5 +-
 t/helper/test-drop-caches.c                   |   3 +-
 t/helper/test-dump-cache-tree.c               |   3 +-
 t/helper/test-dump-split-index.c              |   3 +-
 t/helper/test-example-decorate.c              |   3 +-
 t/helper/test-genrandom.c                     |   3 +-
 t/helper/test-hashmap.c                       |   5 +-
 t/helper/test-index-version.c                 |   3 +-
 t/helper/test-lazy-init-name-hash.c           |  13 +-
 t/helper/test-match-trees.c                   |   3 +-
 t/helper/test-mergesort.c                     |   3 +-
 t/helper/test-mktemp.c                        |   3 +-
 t/helper/test-online-cpus.c                   |   3 +-
 t/helper/test-path-utils.c                    |   3 +-
 t/helper/test-prio-queue.c                    |   3 +-
 t/helper/test-read-cache.c                    |   3 +-
 t/helper/test-ref-store.c                     |   3 +-
 t/helper/test-regex.c                         |   7 +-
 t/helper/test-revision-walking.c              |   3 +-
 t/helper/test-run-command.c                   |   3 +-
 t/helper/test-scrap-cache-tree.c              |   3 +-
 t/helper/test-sha1-array.c                    |   3 +-
 t/helper/test-sha1.c                          |   3 +-
 t/helper/test-sha1.sh                         |   4 +-
 t/helper/test-sigchain.c                      |   3 +-
 t/helper/test-strcmp-offset.c                 |   3 +-
 t/helper/test-string-list.c                   |   3 +-
 t/helper/test-submodule-config.c              |   3 +-
 t/helper/test-subprocess.c                    |   3 +-
 t/helper/test-tool.c                          |  62 ++++
 t/helper/test-tool.h                          |  40 +++
 t/helper/test-urlmatch-normalization.c        |   5 +-
 t/helper/test-wildmatch.c                     |   3 +-
 t/helper/test-write-cache.c                   |   3 +-
 t/lib-git-p4.sh                               |   2 +-
 t/lib-git-svn.sh                              |   2 +-
 t/lib-pack.sh                                 |   2 +-
 t/perf/p0002-read-cache.sh                    |   2 +-
 t/perf/p0004-lazy-init-name-hash.sh           |   8 +-
 t/perf/p0007-write-cache.sh                   |   2 +-
 t/perf/p0071-sort.sh                          |   2 +-
 t/perf/p7519-fsmonitor.sh                     |  12 +-
 t/t0005-signals.sh                            |   6 +-
 t/t0006-date.sh                               |   8 +-
 t/t0009-prio-queue.sh                         |   6 +-
 t/t0011-hashmap.sh                            |   4 +-
 t/t0013-sha1dc.sh                             |   2 +-
 t/t0021-conversion.sh                         |   4 +-
 t/t0060-path-utils.sh                         |  60 ++--
 t/t0061-run-command.sh                        |  24 +-
 t/t0062-revision-walking.sh                   |   2 +-
 t/t0063-string-list.sh                        |  48 ++--
 t/t0064-sha1-array.sh                         |  16 +-
 t/t0065-strcmp-offset.sh                      |   2 +-
 t/t0070-fundamental.sh                        |   8 +-
 t/t0090-cache-tree.sh                         |  18 +-
 t/t0110-urlmatch-normalization.sh             | 266 +++++++++---------
 t/t1006-cat-file.sh                           |   2 +-
 t/t1050-large.sh                              |   6 +-
 t/t1300-repo-config.sh                        |   2 +-
 t/t1305-config-include.sh                     |   2 +-
 t/t1308-config-set.sh                         |  22 +-
 t/t1309-early-config.sh                       |  12 +-
 t/t1405-main-ref-store.sh                     |   2 +-
 t/t1406-submodule-ref-store.sh                |   2 +-
 t/t1407-worktree-ref-store.sh                 |   4 +-
 t/t1501-work-tree.sh                          |  10 +-
 t/t1600-index.sh                              |   2 +-
 t/t1700-split-index.sh                        |  64 ++---
 t/t2022-checkout-paths.sh                     |   4 +-
 t/t2104-update-index-skip-worktree.sh         |   6 +-
 t/t3008-ls-files-lazy-init-name-hash.sh       |   4 +-
 t/t3070-wildmatch.sh                          |  14 +-
 t/t3306-notes-prune.sh                        |   2 +-
 t/t3404-rebase-interactive.sh                 |   4 +-
 t/t3418-rebase-continue.sh                    |   4 +-
 t/t3501-revert-cherry-pick.sh                 |   2 +-
 t/t3510-cherry-pick-sequence.sh               |   4 +-
 t/t3600-rm.sh                                 |   2 +-
 t/t3700-add.sh                                |   2 +-
 t/t4011-diff-symlink.sh                       |   2 +-
 t/t4013-diff-various.sh                       |   2 +-
 t/t4035-diff-quiet.sh                         |   2 +-
 t/t4151-am-abort.sh                           |   4 +-
 t/t4200-rerere.sh                             |  22 +-
 t/t5000-tar-tree.sh                           |   4 +-
 t/t5300-pack-object.sh                        |   4 +-
 t/t5301-sliding-window.sh                     |   2 +-
 t/t5302-pack-index.sh                         |  14 +-
 t/t5303-pack-corruption-resilience.sh         |  10 +-
 t/t5304-prune.sh                              |  16 +-
 t/t5310-pack-bitmaps.sh                       |   2 +-
 t/t5313-pack-bounds-checks.sh                 |   4 +-
 t/t5314-pack-cycle-detection.sh               |   2 +-
 t/t5316-pack-delta-depth.sh                   |   2 +-
 t/t5400-send-pack.sh                          |   2 +-
 t/t5516-fetch-push.sh                         |   2 +-
 t/t5546-receive-limits.sh                     |   2 +-
 t/t5547-push-quarantine.sh                    |   2 +-
 t/t5608-clone-2gb.sh                          |   2 +-
 t/t6022-merge-rename.sh                       |  30 +-
 t/t6500-gc.sh                                 |   2 +-
 t/t6501-freshen-objects.sh                    |   4 +-
 t/t7411-submodule-config.sh                   |  18 +-
 t/t7508-status.sh                             |   6 +-
 t/t7701-repack-unpack-unreachable.sh          |   6 +-
 t/t7812-grep-icase-non-ascii.sh               |   2 +-
 t/t9004-example.sh                            |   2 +-
 t/t9100-git-svn-basic.sh                      |   4 +-
 t/t9300-fast-import.sh                        |   2 +-
 t/t9802-git-p4-filetype.sh                    |   2 +-
 t/t9803-git-p4-shell-metachars.sh             |   4 +-
 t/t9813-git-p4-preserve-users.sh              |   6 +-
 t/t9820-git-p4-editor-handling.sh             |   2 +-
 t/test-lib.sh                                 |  10 +-
 121 files changed, 684 insertions(+), 542 deletions(-)
 create mode 100644 t/helper/test-tool.c
 create mode 100644 t/helper/test-tool.h

-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply	[flat|nested] 110+ messages in thread

* [PATCH v2 01/36] t/helper: add an empty test-tool program
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-26 15:27     ` Johannes Schindelin
  2018-03-24  7:44   ` [PATCH v2 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
                     ` (37 subsequent siblings)
  38 siblings, 1 reply; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

This will become an umbrella program that absorbs most [1] t/helper
programs in. By having a single executable binary we reduce disk usage
(libgit.a is replicated by every t/helper program) and shorten link
time a bit.

Running "make --jobs=1; du -sh t/helper" with ccache fully populated,
it takes 27 seconds and 277MB at the beginning of this series, 17
seconds and 42MB at the end.

[1] There are a couple programs that will not become part of
    test-tool: test-line-buffer and test-svn-fe have extra
    dependencies and test-fake-ssh's program name has to be a single
    word for some ssh tests.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile             |  6 +++++-
 t/helper/test-tool.c | 27 +++++++++++++++++++++++++++
 t/helper/test-tool.h |  4 ++++
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 t/helper/test-tool.c
 create mode 100644 t/helper/test-tool.h

diff --git a/Makefile b/Makefile
index a1d8775adb..2376646e98 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,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
@@ -690,6 +691,7 @@ 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-tool
 TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
 TEST_PROGRAMS_NEED_X += test-wildmatch
 
@@ -2083,7 +2085,7 @@ VCSSVN_OBJS += vcs-svn/fast_export.o
 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) \
@@ -2494,6 +2496,8 @@ 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)
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
new file mode 100644
index 0000000000..c730f718ca
--- /dev/null
+++ b/t/helper/test-tool.c
@@ -0,0 +1,27 @@
+#include "git-compat-util.h"
+#include "test-tool.h"
+
+struct test_cmd {
+	const char *name;
+	int (*main)(int argc, const char **argv);
+};
+
+static struct test_cmd cmds[] = {
+};
+
+int cmd_main(int argc, const char **argv)
+{
+	int i;
+
+	if (argc < 2)
+		die("I need a test name!");
+
+	for (i = 0; i < ARRAY_SIZE(cmds); i++) {
+		if (!strcmp(cmds[i].name, argv[1])) {
+			argv++;
+			argc--;
+			return cmds[i].main(argc, argv);
+		}
+	}
+	die("There is no test named '%s'", argv[1]);
+}
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
new file mode 100644
index 0000000000..6ce57ae0cc
--- /dev/null
+++ b/t/helper/test-tool.h
@@ -0,0 +1,4 @@
+#ifndef __TEST_TOOL_H__
+#define __TEST_TOOL_H__
+
+#endif
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 02/36] t/helper: merge test-chmtime into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 03/36] t/helper: merge test-sha1 " Nguyễn Thái Ngọc Duy
                     ` (36 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                             |  3 ++-
 t/helper/test-chmtime.c              | 15 +++++++-------
 t/helper/test-tool.c                 |  1 +
 t/helper/test-tool.h                 |  2 ++
 t/lib-git-svn.sh                     |  2 +-
 t/t1700-split-index.sh               | 12 +++++------
 t/t2022-checkout-paths.sh            |  4 ++--
 t/t3306-notes-prune.sh               |  2 +-
 t/t3404-rebase-interactive.sh        |  4 ++--
 t/t3418-rebase-continue.sh           |  4 ++--
 t/t3501-revert-cherry-pick.sh        |  2 +-
 t/t3510-cherry-pick-sequence.sh      |  4 ++--
 t/t3600-rm.sh                        |  2 +-
 t/t3700-add.sh                       |  2 +-
 t/t4011-diff-symlink.sh              |  2 +-
 t/t4013-diff-various.sh              |  2 +-
 t/t4035-diff-quiet.sh                |  2 +-
 t/t4151-am-abort.sh                  |  4 ++--
 t/t4200-rerere.sh                    | 22 ++++++++++----------
 t/t5000-tar-tree.sh                  |  2 +-
 t/t5304-prune.sh                     | 16 +++++++--------
 t/t5400-send-pack.sh                 |  2 +-
 t/t5516-fetch-push.sh                |  2 +-
 t/t6022-merge-rename.sh              | 30 ++++++++++++++--------------
 t/t6500-gc.sh                        |  2 +-
 t/t6501-freshen-objects.sh           |  4 ++--
 t/t7508-status.sh                    |  6 +++---
 t/t7701-repack-unpack-unreachable.sh |  6 +++---
 t/t9100-git-svn-basic.sh             |  4 ++--
 t/t9803-git-p4-shell-metachars.sh    |  4 ++--
 t/t9813-git-p4-preserve-users.sh     |  6 +++---
 t/t9820-git-p4-editor-handling.sh    |  2 +-
 t/test-lib.sh                        |  6 +++---
 33 files changed, 94 insertions(+), 89 deletions(-)

diff --git a/Makefile b/Makefile
index 2376646e98..416a8e39c1 100644
--- a/Makefile
+++ b/Makefile
@@ -652,7 +652,8 @@ X =
 
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
-TEST_PROGRAMS_NEED_X += test-chmtime
+TEST_BUILTINS_OBJS += test-chmtime.o
+
 TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-config
 TEST_PROGRAMS_NEED_X += test-date
diff --git a/t/helper/test-chmtime.c b/t/helper/test-chmtime.c
index e760256406..1790ceab51 100644
--- a/t/helper/test-chmtime.c
+++ b/t/helper/test-chmtime.c
@@ -5,28 +5,29 @@
  *
  * The mtime can be changed to an absolute value:
  *
- *	test-chmtime =<seconds> file...
+ *	test-tool chmtime =<seconds> file...
  *
  * Relative to the current time as returned by time(3):
  *
- *	test-chmtime =+<seconds> (or =-<seconds>) file...
+ *	test-tool chmtime =+<seconds> (or =-<seconds>) file...
  *
  * Or relative to the current mtime of the file:
  *
- *	test-chmtime <seconds> file...
- *	test-chmtime +<seconds> (or -<seconds>) file...
+ *	test-tool chmtime <seconds> file...
+ *	test-tool chmtime +<seconds> (or -<seconds>) file...
  *
  * Examples:
  *
  * To just print the mtime use --verbose and set the file mtime offset to 0:
  *
- *	test-chmtime -v +0 file
+ *	test-tool chmtime -v +0 file
  *
  * To set the mtime to current time:
  *
- *	test-chmtime =+0 file
+ *	test-tool chmtime =+0 file
  *
  */
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include <utime.h>
 
@@ -56,7 +57,7 @@ static int timespec_arg(const char *arg, long int *set_time, int *set_eq)
 	return 1;
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__chmtime(int argc, const char **argv)
 {
 	static int verbose;
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index c730f718ca..63ec15cb56 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -7,6 +7,7 @@ struct test_cmd {
 };
 
 static struct test_cmd cmds[] = {
+	{ "chmtime", cmd__chmtime },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 6ce57ae0cc..3a35e70e79 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -1,4 +1,6 @@
 #ifndef __TEST_TOOL_H__
 #define __TEST_TOOL_H__
 
+int cmd__chmtime(int argc, const char **argv);
+
 #endif
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 4c1f81f167..a8130f9119 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -49,7 +49,7 @@ rawsvnrepo="$svnrepo"
 svnrepo="file://$svnrepo"
 
 poke() {
-	test-chmtime +1 "$1"
+	test-tool chmtime +1 "$1"
 }
 
 # We need this, because we should pass empty configuration directory to
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index a66936fe9b..4b5d443280 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -332,12 +332,12 @@ test_expect_success 'shared index files expire after 2 weeks by default' '
 	git update-index --add ten &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_under_2_weeks_ago=$((5-14*86400)) &&
-	test-chmtime =$just_under_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_under_2_weeks_ago .git/sharedindex.* &&
 	: >eleven &&
 	git update-index --add eleven &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_over_2_weeks_ago=$((-1-14*86400)) &&
-	test-chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
 	: >twelve &&
 	git update-index --add twelve &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
@@ -345,12 +345,12 @@ test_expect_success 'shared index files expire after 2 weeks by default' '
 
 test_expect_success 'check splitIndex.sharedIndexExpire set to 16 days' '
 	git config splitIndex.sharedIndexExpire "16.days.ago" &&
-	test-chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_2_weeks_ago .git/sharedindex.* &&
 	: >thirteen &&
 	git update-index --add thirteen &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	just_over_16_days_ago=$((-1-16*86400)) &&
-	test-chmtime =$just_over_16_days_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_over_16_days_ago .git/sharedindex.* &&
 	: >fourteen &&
 	git update-index --add fourteen &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
@@ -359,13 +359,13 @@ test_expect_success 'check splitIndex.sharedIndexExpire set to 16 days' '
 test_expect_success 'check splitIndex.sharedIndexExpire set to "never" and "now"' '
 	git config splitIndex.sharedIndexExpire never &&
 	just_10_years_ago=$((-365*10*86400)) &&
-	test-chmtime =$just_10_years_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_10_years_ago .git/sharedindex.* &&
 	: >fifteen &&
 	git update-index --add fifteen &&
 	test $(ls .git/sharedindex.* | wc -l) -gt 2 &&
 	git config splitIndex.sharedIndexExpire now &&
 	just_1_second_ago=-1 &&
-	test-chmtime =$just_1_second_ago .git/sharedindex.* &&
+	test-tool chmtime =$just_1_second_ago .git/sharedindex.* &&
 	: >sixteen &&
 	git update-index --add sixteen &&
 	test $(ls .git/sharedindex.* | wc -l) -le 2
diff --git a/t/t2022-checkout-paths.sh b/t/t2022-checkout-paths.sh
index f46d0499bc..e74d58b9e1 100755
--- a/t/t2022-checkout-paths.sh
+++ b/t/t2022-checkout-paths.sh
@@ -68,13 +68,13 @@ test_expect_success 'do not touch files that are already up-to-date' '
 	git add file1 file2 &&
 	git commit -m base &&
 	echo modified >file1 &&
-	test-chmtime =1000000000 file2 &&
+	test-tool chmtime =1000000000 file2 &&
 	git update-index -q --refresh &&
 	git checkout HEAD -- file1 file2 &&
 	echo one >expect &&
 	test_cmp expect file1 &&
 	echo "1000000000	file2" >expect &&
-	test-chmtime -v +0 file2 >actual &&
+	test-tool chmtime -v +0 file2 >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh
index 86bf909ee3..61748088eb 100755
--- a/t/t3306-notes-prune.sh
+++ b/t/t3306-notes-prune.sh
@@ -22,7 +22,7 @@ test_expect_success 'setup: create a few commits with notes' '
 	git commit -m 3rd &&
 	COMMIT_FILE=.git/objects/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
 	test -f $COMMIT_FILE &&
-	test-chmtime =+0 $COMMIT_FILE &&
+	test-tool chmtime =+0 $COMMIT_FILE &&
 	git notes add -m "Note #3"
 '
 
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 3b905406df..961ac9d6b8 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -711,13 +711,13 @@ test_expect_success 'rebase -i continue with unstaged submodule' '
 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
 '
 
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index 7c91a85f43..9214d0bb51 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -24,7 +24,7 @@ test_expect_success 'interactive rebase --continue works with touched file' '
 	git checkout master &&
 
 	FAKE_LINES="edit 1" git rebase -i HEAD^ &&
-	test-chmtime =-60 F1 &&
+	test-tool chmtime =-60 F1 &&
 	git rebase --continue
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'non-interactive rebase --continue works with touched file'
 	test_must_fail git rebase --onto master master topic &&
 	echo "Resolved" >F2 &&
 	git add F2 &&
-	test-chmtime =-60 F1 &&
+	test-tool chmtime =-60 F1 &&
 	git rebase --continue
 '
 
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 783bdbf59d..ccbc118514 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -86,7 +86,7 @@ test_expect_success 'cherry-pick on stat-dirty working tree' '
 	(
 		cd copy &&
 		git checkout initial &&
-		test-chmtime +40 oops &&
+		test-tool chmtime +40 oops &&
 		git cherry-pick added
 	)
 '
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index 0acf4b1461..9f93445f1e 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -247,9 +247,9 @@ test_expect_success '--abort after last commit in sequence' '
 test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
 	pristine_detach initial &&
 	test_expect_code 1 git cherry-pick base..anotherpick &&
-	test-chmtime -v +0 .git/sequencer >expect &&
+	test-tool chmtime -v +0 .git/sequencer >expect &&
 	test_expect_code 128 git cherry-pick unrelatedpick &&
-	test-chmtime -v +0 .git/sequencer >actual &&
+	test-tool chmtime -v +0 .git/sequencer >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 46f15169f5..b8fbdefcdc 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -232,7 +232,7 @@ test_expect_success 'Call "rm" from outside the work tree' '
 test_expect_success 'refresh index before checking if it is up-to-date' '
 
 	git reset --hard &&
-	test-chmtime -86400 frotz/nitfol &&
+	test-tool chmtime -86400 frotz/nitfol &&
 	git rm frotz/nitfol &&
 	test ! -f frotz/nitfol
 
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 2748805642..07af05d7ae 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -187,7 +187,7 @@ test_expect_success 'git add --refresh with pathspec' '
 	echo >foo && echo >bar && echo >baz &&
 	git add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&
 	echo "100644 $H 3	foo" | git update-index --index-info &&
-	test-chmtime -60 bar baz &&
+	test-tool chmtime -60 bar baz &&
 	>expect &&
 	git add --refresh bar >actual &&
 	test_cmp expect actual &&
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index 13e7f621ab..cf0f3a1ee7 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -73,7 +73,7 @@ test_expect_success 'diff identical, but newly created symlink and file' '
 	>expected &&
 	rm -f frotz nitfol &&
 	echo xyzzy >nitfol &&
-	test-chmtime +10 nitfol &&
+	test-tool chmtime +10 nitfol &&
 	if test_have_prereq SYMLINKS
 	then
 		ln -s xyzzy frotz
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 3f9a24fd56..f8d853595b 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -76,7 +76,7 @@ test_expect_success setup '
 
 	mkdir dir3 &&
 	cp dir/sub dir3/sub &&
-	test-chmtime +1 dir3/sub &&
+	test-tool chmtime +1 dir3/sub &&
 
 	git config log.showroot false &&
 	git commit --amend &&
diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh
index 2f1737fcef..0352bf81a9 100755
--- a/t/t4035-diff-quiet.sh
+++ b/t/t4035-diff-quiet.sh
@@ -147,7 +147,7 @@ test_expect_success 'git diff --ignore-all-space, both files outside repo' '
 '
 
 test_expect_success 'git diff --quiet ignores stat-change only entries' '
-	test-chmtime +10 a &&
+	test-tool chmtime +10 a &&
 	echo modified >>b &&
 	test_expect_code 1 git diff --quiet
 '
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 16432781d2..9d8d3c72e7 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -171,7 +171,7 @@ test_expect_success 'am --skip leaves index stat info alone' '
 	git checkout -f --orphan skip-stat-info &&
 	git reset &&
 	test_commit skip-should-be-untouched &&
-	test-chmtime =0 skip-should-be-untouched.t &&
+	test-tool chmtime =0 skip-should-be-untouched.t &&
 	git update-index --refresh &&
 	git diff-files --exit-code --quiet &&
 	test_must_fail git am 0001-*.patch &&
@@ -183,7 +183,7 @@ test_expect_success 'am --abort leaves index stat info alone' '
 	git checkout -f --orphan abort-stat-info &&
 	git reset &&
 	test_commit abort-should-be-untouched &&
-	test-chmtime =0 abort-should-be-untouched.t &&
+	test-tool chmtime =0 abort-should-be-untouched.t &&
 	git update-index --refresh &&
 	git diff-files --exit-code --quiet &&
 	test_must_fail git am 0001-*.patch &&
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index d97d2bebc9..deafaa3e07 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -166,7 +166,7 @@ test_expect_success 'first postimage wins' '
 	git commit -q -a -m "prefer first over second" &&
 	test -f $rr/postimage &&
 
-	oldmtimepost=$(test-chmtime -v -60 $rr/postimage | cut -f 1) &&
+	oldmtimepost=$(test-tool chmtime -v -60 $rr/postimage | cut -f 1) &&
 
 	git checkout -b third master &&
 	git show second^:a1 | sed "s/To die: t/To die! T/" >a1 &&
@@ -179,7 +179,7 @@ test_expect_success 'first postimage wins' '
 '
 
 test_expect_success 'rerere updates postimage timestamp' '
-	newmtimepost=$(test-chmtime -v +0 $rr/postimage | cut -f 1) &&
+	newmtimepost=$(test-tool chmtime -v +0 $rr/postimage | cut -f 1) &&
 	test $oldmtimepost -lt $newmtimepost
 '
 
@@ -220,9 +220,9 @@ test_expect_success 'set up for garbage collection tests' '
 	almost_60_days_ago=$((60-60*86400)) &&
 	just_over_60_days_ago=$((-1-60*86400)) &&
 
-	test-chmtime =$just_over_60_days_ago $rr/preimage &&
-	test-chmtime =$almost_60_days_ago $rr/postimage &&
-	test-chmtime =$almost_15_days_ago $rr2/preimage
+	test-tool chmtime =$just_over_60_days_ago $rr/preimage &&
+	test-tool chmtime =$almost_60_days_ago $rr/postimage &&
+	test-tool chmtime =$almost_15_days_ago $rr2/preimage
 '
 
 test_expect_success 'gc preserves young or recently used records' '
@@ -232,8 +232,8 @@ test_expect_success 'gc preserves young or recently used records' '
 '
 
 test_expect_success 'old records rest in peace' '
-	test-chmtime =$just_over_60_days_ago $rr/postimage &&
-	test-chmtime =$just_over_15_days_ago $rr2/preimage &&
+	test-tool chmtime =$just_over_60_days_ago $rr/postimage &&
+	test-tool chmtime =$just_over_15_days_ago $rr2/preimage &&
 	git rerere gc &&
 	! test -f $rr/preimage &&
 	! test -f $rr2/preimage
@@ -249,8 +249,8 @@ rerere_gc_custom_expiry_test () {
 		>"$rr/postimage" &&
 
 		two_days_ago=$((-2*86400)) &&
-		test-chmtime =$two_days_ago "$rr/preimage" &&
-		test-chmtime =$two_days_ago "$rr/postimage" &&
+		test-tool chmtime =$two_days_ago "$rr/preimage" &&
+		test-tool chmtime =$two_days_ago "$rr/postimage" &&
 
 		find .git/rr-cache -type f | sort >original &&
 
@@ -512,7 +512,7 @@ test_expect_success 'multiple identical conflicts' '
 	count_pre_post 2 0 &&
 
 	# Pretend that the conflicts were made quite some time ago
-	find .git/rr-cache/ -type f | xargs test-chmtime -172800 &&
+	find .git/rr-cache/ -type f | xargs test-tool chmtime -172800 &&
 
 	# Unresolved entries have not expired yet
 	git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
@@ -568,7 +568,7 @@ test_expect_success 'multiple identical conflicts' '
 	git rerere &&
 
 	# Pretend that the resolutions are old again
-	find .git/rr-cache/ -type f | xargs test-chmtime -172800 &&
+	find .git/rr-cache/ -type f | xargs test-tool chmtime -172800 &&
 
 	# Resolved entries have not expired yet
 	git -c gc.rerereresolved=5 -c gc.rerereunresolved=5 rerere gc &&
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index fe2d4f15a7..266d052efb 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -192,7 +192,7 @@ test_expect_success \
     'validate file modification time' \
     'mkdir extract &&
      "$TAR" xf b.tar -C extract a/a &&
-     test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
+     test-tool chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
      echo "1117231200" >expected.mtime &&
      test_cmp expected.mtime b.mtime'
 
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 6694c19a1e..f0f6e2a5f3 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -15,7 +15,7 @@ add_blob() {
 	BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =+0 $BLOB_FILE
+	test-tool chmtime =+0 $BLOB_FILE
 }
 
 test_expect_success setup '
@@ -33,7 +33,7 @@ test_expect_success 'prune stale packs' '
 	orig_pack=$(echo .git/objects/pack/*.pack) &&
 	: > .git/objects/tmp_1.pack &&
 	: > .git/objects/tmp_2.pack &&
-	test-chmtime =-86501 .git/objects/tmp_1.pack &&
+	test-tool chmtime =-86501 .git/objects/tmp_1.pack &&
 	git prune --expire 1.day &&
 	test_path_is_file $orig_pack &&
 	test_path_is_file .git/objects/tmp_2.pack &&
@@ -47,7 +47,7 @@ test_expect_success 'prune --expire' '
 	git prune --expire=1.hour.ago &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =-86500 $BLOB_FILE &&
+	test-tool chmtime =-86500 $BLOB_FILE &&
 	git prune --expire 1.day &&
 	verbose test $before = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_missing $BLOB_FILE
@@ -57,11 +57,11 @@ test_expect_success 'prune --expire' '
 test_expect_success 'gc: implicit prune --expire' '
 
 	add_blob &&
-	test-chmtime =-$((2*$week-30)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week-30)) $BLOB_FILE &&
 	git gc &&
 	verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_file $BLOB_FILE &&
-	test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
 	git gc &&
 	verbose test $before = $(git count-objects | sed "s/ .*//") &&
 	test_path_is_missing $BLOB_FILE
@@ -141,7 +141,7 @@ test_expect_success 'prune: do not prune heads listed as an argument' '
 test_expect_success 'gc --no-prune' '
 
 	add_blob &&
-	test-chmtime =-$((5001*$day)) $BLOB_FILE &&
+	test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
 	git config gc.pruneExpire 2.days.ago &&
 	git gc --no-prune &&
 	verbose test 1 = $(git count-objects | sed "s/ .*//") &&
@@ -163,7 +163,7 @@ test_expect_success 'gc respects gc.pruneExpire' '
 test_expect_success 'gc --prune=<date>' '
 
 	add_blob &&
-	test-chmtime =-$((5001*$day)) $BLOB_FILE &&
+	test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
 	git gc --prune=5002.days.ago &&
 	test_path_is_file $BLOB_FILE &&
 	git gc --prune=5000.days.ago &&
@@ -205,7 +205,7 @@ test_expect_success 'prune --expire=never' '
 
 test_expect_success 'gc: prune old objects after local clone' '
 	add_blob &&
-	test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
+	test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
 	git clone --no-hardlinks . aclone &&
 	(
 		cd aclone &&
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index d375d7110d..911eae1bf7 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -180,7 +180,7 @@ test_expect_success 'receive-pack runs auto-gc in remote repo' '
 	    # And create a file that follows the temporary object naming
 	    # convention for the auto-gc to remove
 	    : >.git/objects/tmp_test_object &&
-	    test-chmtime =-1209601 .git/objects/tmp_test_object
+	    test-tool chmtime =-1209601 .git/objects/tmp_test_object
 	) &&
 	(
 	    cd parent &&
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 177897ea0b..82239138d5 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1418,7 +1418,7 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
 		cd testrepo &&
 		git reset --hard HEAD^ &&
 		test $(git -C .. rev-parse HEAD^) = $(git rev-parse HEAD) &&
-		test-chmtime +100 path1
+		test-tool chmtime +100 path1
 	) &&
 	git push testrepo master &&
 	(
diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh
index c01f721f13..a1fad6980b 100755
--- a/t/t6022-merge-rename.sh
+++ b/t/t6022-merge-rename.sh
@@ -635,10 +635,10 @@ test_expect_success 'setup avoid unnecessary update, normal rename' '
 
 test_expect_success 'avoid unnecessary update, normal rename' '
 	git checkout -q avoid-unnecessary-update-1^0 &&
-	test-chmtime =1000000000 rename &&
-	test-chmtime -v +0 rename >expect &&
+	test-tool chmtime =1000000000 rename &&
+	test-tool chmtime -v +0 rename >expect &&
 	git merge merge-branch-1 &&
-	test-chmtime -v +0 rename >actual &&
+	test-tool chmtime -v +0 rename >actual &&
 	test_cmp expect actual # "rename" should have stayed intact
 '
 
@@ -668,10 +668,10 @@ test_expect_success 'setup to test avoiding unnecessary update, with D/F conflic
 
 test_expect_success 'avoid unnecessary update, with D/F conflict' '
 	git checkout -q avoid-unnecessary-update-2^0 &&
-	test-chmtime =1000000000 df &&
-	test-chmtime -v +0 df >expect &&
+	test-tool chmtime =1000000000 df &&
+	test-tool chmtime -v +0 df >expect &&
 	git merge merge-branch-2 &&
-	test-chmtime -v +0 df >actual &&
+	test-tool chmtime -v +0 df >actual &&
 	test_cmp expect actual # "df" should have stayed intact
 '
 
@@ -700,10 +700,10 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '
 
 test_expect_success 'avoid unnecessary update, dir->(file,nothing)' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 df &&
-	test-chmtime -v +0 df >expect &&
+	test-tool chmtime =1000000000 df &&
+	test-tool chmtime -v +0 df >expect &&
 	git merge side &&
-	test-chmtime -v +0 df >actual &&
+	test-tool chmtime -v +0 df >actual &&
 	test_cmp expect actual # "df" should have stayed intact
 '
 
@@ -730,10 +730,10 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '
 
 test_expect_success 'avoid unnecessary update, modify/delete' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 file &&
-	test-chmtime -v +0 file >expect &&
+	test-tool chmtime =1000000000 file &&
+	test-tool chmtime -v +0 file >expect &&
 	test_must_fail git merge side &&
-	test-chmtime -v +0 file >actual &&
+	test-tool chmtime -v +0 file >actual &&
 	test_cmp expect actual # "file" should have stayed intact
 '
 
@@ -759,10 +759,10 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '
 
 test_expect_success 'avoid unnecessary update, rename/add-dest' '
 	git checkout -q master^0 &&
-	test-chmtime =1000000000 newfile &&
-	test-chmtime -v +0 newfile >expect &&
+	test-tool chmtime =1000000000 newfile &&
+	test-tool chmtime -v +0 newfile >expect &&
 	git merge side &&
-	test-chmtime -v +0 newfile >actual &&
+	test-tool chmtime -v +0 newfile >actual &&
 	test_cmp expect actual # "file" should have stayed intact
 '
 
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 41b0be575d..d5255dd576 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -87,7 +87,7 @@ test_expect_success 'background auto gc does not run if gc.log is present and re
 	test_must_fail git gc --auto 2>err &&
 	test_i18ngrep "^error:" err &&
 	test_config gc.logexpiry 5.days &&
-	test-chmtime =-345600 .git/gc.log &&
+	test-tool chmtime =-345600 .git/gc.log &&
 	test_must_fail git gc --auto &&
 	test_config gc.logexpiry 2.days &&
 	run_and_wait_for_auto_gc &&
diff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh
index 394b169ead..765cced60b 100755
--- a/t/t6501-freshen-objects.sh
+++ b/t/t6501-freshen-objects.sh
@@ -73,7 +73,7 @@ for repack in '' true; do
 
 	test_expect_success "simulate time passing ($title)" '
 		find .git/objects -type f |
-		xargs test-chmtime -v -86400
+		xargs test-tool chmtime -v -86400
 	'
 
 	test_expect_success "start writing new commit with old blob ($title)" '
@@ -104,7 +104,7 @@ for repack in '' true; do
 	test_expect_success "abandon objects again ($title)" '
 		git reset --hard HEAD^ &&
 		find .git/objects -type f |
-		xargs test-chmtime -v -86400
+		xargs test-tool chmtime -v -86400
 	'
 
 	test_expect_success "start writing new commit with same tree ($title)" '
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 50052e2872..7afadb175a 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1672,12 +1672,12 @@ test_expect_success '"Initial commit" should not be noted in commit template' '
 '
 
 test_expect_success '--no-optional-locks prevents index update' '
-	test-chmtime =1234567890 .git/index &&
+	test-tool chmtime =1234567890 .git/index &&
 	git --no-optional-locks status &&
-	test-chmtime -v +0 .git/index >out &&
+	test-tool chmtime -v +0 .git/index >out &&
 	grep ^1234567890 out &&
 	git status &&
-	test-chmtime -v +0 .git/index >out &&
+	test-tool chmtime -v +0 .git/index >out &&
 	! grep ^1234567890 out
 '
 
diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh
index 987573c41f..8a586ab021 100755
--- a/t/t7701-repack-unpack-unreachable.sh
+++ b/t/t7701-repack-unpack-unreachable.sh
@@ -90,7 +90,7 @@ test_expect_success 'unpacked objects receive timestamp of pack file' '
 	tmppack=".git/objects/pack/tmp_pack" &&
 	ln "$packfile" "$tmppack" &&
 	git repack -A -l -d &&
-	test-chmtime -v +0 "$tmppack" "$fsha1path" "$csha1path" "$tsha1path" \
+	test-tool chmtime -v +0 "$tmppack" "$fsha1path" "$csha1path" "$tsha1path" \
 		> mtimes &&
 	compare_mtimes < mtimes
 '
@@ -103,7 +103,7 @@ test_expect_success 'do not bother loosening old objects' '
 	git prune-packed &&
 	git cat-file -p $obj1 &&
 	git cat-file -p $obj2 &&
-	test-chmtime =-86400 .git/objects/pack/pack-$pack2.pack &&
+	test-tool chmtime =-86400 .git/objects/pack/pack-$pack2.pack &&
 	git repack -A -d --unpack-unreachable=1.hour.ago &&
 	git cat-file -p $obj1 &&
 	test_must_fail git cat-file -p $obj2
@@ -117,7 +117,7 @@ test_expect_success 'keep packed objects found only in index' '
 	git reset HEAD^ &&
 	git reflog expire --expire=now --all &&
 	git add file &&
-	test-chmtime =-86400 .git/objects/pack/* &&
+	test-tool chmtime =-86400 .git/objects/pack/* &&
 	git gc --prune=1.hour.ago &&
 	git cat-file blob :file
 '
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 8a8ba65a2a..c937330a5f 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -288,12 +288,12 @@ test_expect_success 'able to dcommit to a subdirectory' '
 
 test_expect_success 'dcommit should not fail with a touched file' '
 	test_commit "commit-new-file-foo2" foo2 &&
-	test-chmtime =-60 foo &&
+	test-tool chmtime =-60 foo &&
 	git svn dcommit
 '
 
 test_expect_success 'rebase should not fail with a touched file' '
-	test-chmtime =-60 foo &&
+	test-tool chmtime =-60 foo &&
 	git svn rebase
 '
 
diff --git a/t/t9803-git-p4-shell-metachars.sh b/t/t9803-git-p4-shell-metachars.sh
index d950c7d665..d5c3675100 100755
--- a/t/t9803-git-p4-shell-metachars.sh
+++ b/t/t9803-git-p4-shell-metachars.sh
@@ -28,7 +28,7 @@ test_expect_success 'shell metachars in filenames' '
 		echo f2 >"file with spaces" &&
 		git add "file with spaces" &&
 		git commit -m "add files" &&
-		P4EDITOR="test-chmtime +5" git p4 submit
+		P4EDITOR="test-tool chmtime +5" git p4 submit
 	) &&
 	(
 		cd "$cli" &&
@@ -47,7 +47,7 @@ test_expect_success 'deleting with shell metachars' '
 		git rm foo\$bar &&
 		git rm file\ with\ spaces &&
 		git commit -m "remove files" &&
-		P4EDITOR="test-chmtime +5" git p4 submit
+		P4EDITOR="test-tool chmtime +5" git p4 submit
 	) &&
 	(
 		cd "$cli" &&
diff --git a/t/t9813-git-p4-preserve-users.sh b/t/t9813-git-p4-preserve-users.sh
index bda222aa02..783c6ad165 100755
--- a/t/t9813-git-p4-preserve-users.sh
+++ b/t/t9813-git-p4-preserve-users.sh
@@ -53,7 +53,7 @@ test_expect_success 'preserve users' '
 		git commit --author "Alice <alice@example.com>" -m "a change by alice" file1 &&
 		git commit --author "Bob <bob@example.com>" -m "a change by bob" file2 &&
 		git config git-p4.skipSubmitEditCheck true &&
-		P4EDITOR="test-chmtime +5" P4USER=alice P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=alice P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		git p4 commit --preserve-user &&
 		p4_check_commit_author file1 alice &&
@@ -71,7 +71,7 @@ test_expect_success 'refuse to preserve users without perms' '
 		git config git-p4.skipSubmitEditCheck true &&
 		echo "username-noperms: a change by alice" >>file1 &&
 		git commit --author "Alice <alice@example.com>" -m "perms: a change by alice" file1 &&
-		P4EDITOR="test-chmtime +5" P4USER=bob P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=bob P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		test_must_fail git p4 commit --preserve-user &&
 		! git diff --exit-code HEAD..p4/master
@@ -89,7 +89,7 @@ test_expect_success 'preserve user where author is unknown to p4' '
 		git commit --author "Bob <bob@example.com>" -m "preserve: a change by bob" file1 &&
 		echo "username-unknown: a change by charlie" >>file1 &&
 		git commit --author "Charlie <charlie@example.com>" -m "preserve: a change by charlie" file1 &&
-		P4EDITOR="test-chmtime +5" P4USER=alice P4PASSWD=secret &&
+		P4EDITOR="test-tool chmtime +5" P4USER=alice P4PASSWD=secret &&
 		export P4EDITOR P4USER P4PASSWD &&
 		test_must_fail git p4 commit --preserve-user &&
 		! git diff --exit-code HEAD..p4/master &&
diff --git a/t/t9820-git-p4-editor-handling.sh b/t/t9820-git-p4-editor-handling.sh
index 6dc6df032e..3c22f74bd4 100755
--- a/t/t9820-git-p4-editor-handling.sh
+++ b/t/t9820-git-p4-editor-handling.sh
@@ -26,7 +26,7 @@ test_expect_success 'EDITOR with options' '
 		cd "$git" &&
 		echo change >file1 &&
 		git commit -m "change" file1 &&
-		P4EDITOR=": >\"$git/touched\" && test-chmtime +5" git p4 submit &&
+		P4EDITOR=": >\"$git/touched\" && test-tool chmtime +5" git p4 submit &&
 		test_path_is_file "$git/touched"
 	)
 '
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7740d511d2..7ab8af47a5 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -963,10 +963,10 @@ test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
 }
 
-if ! test -x "$GIT_BUILD_DIR"/t/helper/test-chmtime
+if ! test -x "$GIT_BUILD_DIR"/t/helper/test-tool
 then
-	echo >&2 'You need to build test-chmtime:'
-	echo >&2 'Run "make t/helper/test-chmtime" in the source (toplevel) directory'
+	echo >&2 'You need to build test-tool:'
+	echo >&2 'Run "make t/helper/test-tool" in the source (toplevel) directory'
 	exit 1
 fi
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 03/36] t/helper: merge test-sha1 into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 04/36] t/helper: merge test-lazy-init-name-hash " Nguyễn Thái Ngọc Duy
                     ` (35 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/howto/recover-corrupted-object-harder.txt | 2 +-
 Makefile                                                | 4 ++--
 t/helper/test-sha1.c                                    | 3 ++-
 t/helper/test-sha1.sh                                   | 4 ++--
 t/helper/test-tool.c                                    | 1 +
 t/helper/test-tool.h                                    | 1 +
 t/lib-pack.sh                                           | 2 +-
 t/t0013-sha1dc.sh                                       | 2 +-
 8 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Documentation/howto/recover-corrupted-object-harder.txt b/Documentation/howto/recover-corrupted-object-harder.txt
index 9c4cd0915f..8994e2559e 100644
--- a/Documentation/howto/recover-corrupted-object-harder.txt
+++ b/Documentation/howto/recover-corrupted-object-harder.txt
@@ -80,7 +80,7 @@ valid pack like:
     # now add our object data
     cat object >>tmp.pack
     # and then append the pack trailer
-    /path/to/git.git/test-sha1 -b <tmp.pack >trailer
+    /path/to/git.git/t/helper/test-tool sha1 -b <tmp.pack >trailer
     cat trailer >>tmp.pack
 ------------
 
diff --git a/Makefile b/Makefile
index 416a8e39c1..3c0d0474af 100644
--- a/Makefile
+++ b/Makefile
@@ -653,6 +653,7 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-config
@@ -684,7 +685,6 @@ 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
@@ -2502,7 +2502,7 @@ 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))
diff --git a/t/helper/test-sha1.c b/t/helper/test-sha1.c
index a1c13f54ec..1ba0675c75 100644
--- a/t/helper/test-sha1.c
+++ b/t/helper/test-sha1.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int ac, const char **av)
+int cmd__sha1(int ac, const char **av)
 {
 	git_SHA_CTX ctx;
 	unsigned char sha1[20];
diff --git a/t/helper/test-sha1.sh b/t/helper/test-sha1.sh
index 750b95a0a1..84594885c7 100755
--- a/t/helper/test-sha1.sh
+++ b/t/helper/test-sha1.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
-/usr/bin/time t/helper/test-sha1 >/dev/null
+/usr/bin/time t/helper/test-tool sha1 >/dev/null
 
 while read expect cnt pfx
 do
@@ -11,7 +11,7 @@ do
 			test -z "$pfx" || echo "$pfx"
 			dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
 			perl -pe 'y/\000/g/'
-		} | ./t/helper/test-sha1 $cnt
+		} | ./t/helper/test-tool sha1 $cnt
 	)
 	if test "$expect" = "$actual"
 	then
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 63ec15cb56..7a9bb9f140 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
+	{ "sha1", cmd__sha1 },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 3a35e70e79..a05b8bd14c 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,5 +2,6 @@
 #define __TEST_TOOL_H__
 
 int cmd__chmtime(int argc, const char **argv);
+int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/lib-pack.sh b/t/lib-pack.sh
index 7509846571..501078249d 100644
--- a/t/lib-pack.sh
+++ b/t/lib-pack.sh
@@ -85,7 +85,7 @@ pack_obj () {
 
 # Compute and append pack trailer to "$1"
 pack_trailer () {
-	test-sha1 -b <"$1" >trailer.tmp &&
+	test-tool sha1 -b <"$1" >trailer.tmp &&
 	cat trailer.tmp >>"$1" &&
 	rm -f trailer.tmp
 }
diff --git a/t/t0013-sha1dc.sh b/t/t0013-sha1dc.sh
index 6d655cb161..419f31a8f7 100755
--- a/t/t0013-sha1dc.sh
+++ b/t/t0013-sha1dc.sh
@@ -11,7 +11,7 @@ then
 fi
 
 test_expect_success 'test-sha1 detects shattered pdf' '
-	test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
+	test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
 	test_i18ngrep collision err &&
 	grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
 '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 04/36] t/helper: merge test-lazy-init-name-hash into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (2 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 03/36] t/helper: merge test-sha1 " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 05/36] t/helper: merge test-config " Nguyễn Thái Ngọc Duy
                     ` (34 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                                |  2 +-
 t/helper/test-lazy-init-name-hash.c     | 13 +++++++------
 t/helper/test-tool.c                    |  1 +
 t/helper/test-tool.h                    |  1 +
 t/perf/p0004-lazy-init-name-hash.sh     |  8 ++++----
 t/t3008-ls-files-lazy-init-name-hash.sh |  2 +-
 6 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 3c0d0474af..31287cedf2 100644
--- a/Makefile
+++ b/Makefile
@@ -653,6 +653,7 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-ctype
@@ -669,7 +670,6 @@ 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
diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
index 297fb01d61..b99a37080d 100644
--- a/t/helper/test-lazy-init-name-hash.c
+++ b/t/helper/test-lazy-init-name-hash.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "parse-options.h"
 
@@ -184,14 +185,14 @@ static void analyze_run(void)
 	}
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__lazy_init_name_hash(int argc, const char **argv)
 {
 	const char *usage[] = {
-		"test-lazy-init-name-hash -d (-s | -m)",
-		"test-lazy-init-name-hash -p [-c c]",
-		"test-lazy-init-name-hash -a a [--step s] [-c c]",
-		"test-lazy-init-name-hash (-s | -m) [-c c]",
-		"test-lazy-init-name-hash -s -m [-c c]",
+		"test-tool lazy-init-name-hash -d (-s | -m)",
+		"test-tool lazy-init-name-hash -p [-c c]",
+		"test-tool lazy-init-name-hash -a a [--step s] [-c c]",
+		"test-tool lazy-init-name-hash (-s | -m) [-c c]",
+		"test-tool lazy-init-name-hash -s -m [-c c]",
 		NULL
 	};
 	struct option options[] = {
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 7a9bb9f140..afc7a518d6 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
+	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index a05b8bd14c..1dc4673c3a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,6 +2,7 @@
 #define __TEST_TOOL_H__
 
 int cmd__chmtime(int argc, const char **argv);
+int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/perf/p0004-lazy-init-name-hash.sh b/t/perf/p0004-lazy-init-name-hash.sh
index 8de5a98cfc..1afc08fe7f 100755
--- a/t/perf/p0004-lazy-init-name-hash.sh
+++ b/t/perf/p0004-lazy-init-name-hash.sh
@@ -7,8 +7,8 @@ test_perf_large_repo
 test_checkout_worktree
 
 test_expect_success 'verify both methods build the same hashmaps' '
-	test-lazy-init-name-hash --dump --single >out.single &&
-	if test-lazy-init-name-hash --dump --multi >out.multi
+	test-tool lazy-init-name-hash --dump --single >out.single &&
+	if test-tool lazy-init-name-hash --dump --multi >out.multi
 	then
 		test_set_prereq REPO_BIG_ENOUGH_FOR_MULTI &&
 		sort <out.single >sorted.single &&
@@ -46,11 +46,11 @@ test_expect_success 'calibrate' '
 '
 
 test_perf "single-threaded, $desc" "
-	test-lazy-init-name-hash --single --count=$count
+	test-tool lazy-init-name-hash --single --count=$count
 "
 
 test_perf REPO_BIG_ENOUGH_FOR_MULTI "multi-threaded, $desc" "
-	test-lazy-init-name-hash --multi --count=$count
+	test-tool lazy-init-name-hash --multi --count=$count
 "
 
 test_done
diff --git a/t/t3008-ls-files-lazy-init-name-hash.sh b/t/t3008-ls-files-lazy-init-name-hash.sh
index bdf5198b7e..8df4aa7c99 100755
--- a/t/t3008-ls-files-lazy-init-name-hash.sh
+++ b/t/t3008-ls-files-lazy-init-name-hash.sh
@@ -21,7 +21,7 @@ test_expect_success 'no buffer overflow in lazy_init_name_hash' '
 	) |
 	sed "s/^/100644 $EMPTY_BLOB	/" |
 	git update-index --index-info &&
-	test-lazy-init-name-hash -m
+	test-tool lazy-init-name-hash -m
 '
 
 test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 05/36] t/helper: merge test-config into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (3 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 04/36] t/helper: merge test-lazy-init-name-hash " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 06/36] t/helper: merge test-ctype " Nguyễn Thái Ngọc Duy
                     ` (33 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                  |  2 +-
 t/helper/test-config.c    |  5 +++--
 t/helper/test-tool.c      |  1 +
 t/helper/test-tool.h      |  1 +
 t/t1305-config-include.sh |  2 +-
 t/t1308-config-set.sh     | 22 +++++++++++-----------
 t/t1309-early-config.sh   | 12 ++++++------
 7 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile
index 31287cedf2..227f16ad17 100644
--- a/Makefile
+++ b/Makefile
@@ -653,11 +653,11 @@ X =
 PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
+TEST_BUILTINS_OBJS += test-config.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 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
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 1a7b8bd3d6..214003d5b2 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "config.h"
 #include "string-list.h"
@@ -32,7 +33,7 @@
  * Examples:
  *
  * To print the value with highest priority for key "foo.bAr Baz.rock":
- * 	test-config get_value "foo.bAr Baz.rock"
+ * 	test-tool config get_value "foo.bAr Baz.rock"
  *
  */
 
@@ -77,7 +78,7 @@ static int early_config_cb(const char *var, const char *value, void *vdata)
 	return 0;
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__config(int argc, const char **argv)
 {
 	int i, val;
 	const char *v;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index afc7a518d6..e8d6c6b9eb 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
 
 static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
+	{ "config", cmd__config },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 1dc4673c3a..3084f458a0 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,6 +2,7 @@
 #define __TEST_TOOL_H__
 
 int cmd__chmtime(int argc, const char **argv);
+int cmd__config(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
index d9d2f545a4..f035ee40a3 100755
--- a/t/t1305-config-include.sh
+++ b/t/t1305-config-include.sh
@@ -224,7 +224,7 @@ test_expect_success 'conditional include, early config reading' '
 		echo "[includeIf \"gitdir:foo/\"]path=bar6" >>.git/config &&
 		echo "[test]six=6" >.git/bar6 &&
 		echo 6 >expect &&
-		test-config read_early_config test.six >actual &&
+		test-tool config read_early_config test.six >actual &&
 		test_cmp expect actual
 	)
 '
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index bafed5c9b8..3e00d1af01 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -18,7 +18,7 @@ check_config () {
 	then
 		printf "%s\n" "$@"
 	fi >expect &&
-	test_expect_code $expect_code test-config "$op" "$key" >actual &&
+	test_expect_code $expect_code test-tool config "$op" "$key" >actual &&
 	test_cmp expect actual
 }
 
@@ -125,7 +125,7 @@ test_expect_success 'find string value for a key' '
 '
 
 test_expect_success 'check line error when NULL string is queried' '
-	test_expect_code 128 test-config get_string case.foo 2>result &&
+	test_expect_code 128 test-tool config get_string case.foo 2>result &&
 	test_i18ngrep "fatal: .*case\.foo.*\.git/config.*line 7" result
 '
 
@@ -155,13 +155,13 @@ test_expect_success 'find value from a configset' '
 		baz = ball
 	EOF
 	echo silk >expect &&
-	test-config configset_get_value my.new config2 .git/config >actual &&
+	test-tool config configset_get_value my.new config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'find value with highest priority from a configset' '
 	echo hask >expect &&
-	test-config configset_get_value case.baz config2 .git/config >actual &&
+	test-tool config configset_get_value case.baz config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
@@ -173,20 +173,20 @@ test_expect_success 'find value_list for a key from a configset' '
 	lama
 	ball
 	EOF
-	test-config configset_get_value case.baz config2 .git/config >actual &&
+	test-tool config configset_get_value case.baz config2 .git/config >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'proper error on non-existent files' '
 	echo "Error (-1) reading configuration file non-existent-file." >expect &&
-	test_expect_code 2 test-config configset_get_value foo.bar non-existent-file 2>actual &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar non-existent-file 2>actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'proper error on directory "files"' '
 	echo "Error (-1) reading configuration file a-directory." >expect &&
 	mkdir a-directory &&
-	test_expect_code 2 test-config configset_get_value foo.bar a-directory 2>output &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar a-directory 2>output &&
 	grep "^warning:" output &&
 	grep "^Error" output >actual &&
 	test_cmp expect actual
@@ -196,7 +196,7 @@ test_expect_success POSIXPERM,SANITY 'proper error on non-accessible files' '
 	chmod -r .git/config &&
 	test_when_finished "chmod +r .git/config" &&
 	echo "Error (-1) reading configuration file .git/config." >expect &&
-	test_expect_code 2 test-config configset_get_value foo.bar .git/config 2>output &&
+	test_expect_code 2 test-tool config configset_get_value foo.bar .git/config 2>output &&
 	grep "^warning:" output &&
 	grep "^Error" output >actual &&
 	test_cmp expect actual
@@ -207,14 +207,14 @@ test_expect_success 'proper error on error in default config files' '
 	test_when_finished "mv .git/config.old .git/config" &&
 	echo "[" >>.git/config &&
 	echo "fatal: bad config line 34 in file .git/config" >expect &&
-	test_expect_code 128 test-config get_value foo.bar 2>actual &&
+	test_expect_code 128 test-tool config get_value foo.bar 2>actual &&
 	test_i18ncmp expect actual
 '
 
 test_expect_success 'proper error on error in custom config files' '
 	echo "[" >>syntax-error &&
 	echo "fatal: bad config line 1 in file syntax-error" >expect &&
-	test_expect_code 128 test-config configset_get_value foo.bar syntax-error 2>actual &&
+	test_expect_code 128 test-tool config configset_get_value foo.bar syntax-error 2>actual &&
 	test_i18ncmp expect actual
 '
 
@@ -267,7 +267,7 @@ test_expect_success 'iteration shows correct origins' '
 	name=
 	scope=cmdline
 	EOF
-	GIT_CONFIG_PARAMETERS=$cmdline_config test-config iterate >actual &&
+	GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual &&
 	test_cmp expect actual
 '
 
diff --git a/t/t1309-early-config.sh b/t/t1309-early-config.sh
index 3dda215e8e..413642aa56 100755
--- a/t/t1309-early-config.sh
+++ b/t/t1309-early-config.sh
@@ -6,7 +6,7 @@ test_description='Test read_early_config()'
 
 test_expect_success 'read early config' '
 	test_config early.config correct &&
-	test-config read_early_config early.config >output &&
+	test-tool config read_early_config early.config >output &&
 	test correct = "$(cat output)"
 '
 
@@ -15,7 +15,7 @@ test_expect_success 'in a sub-directory' '
 	mkdir -p sub &&
 	(
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test sub = "$(cat output)"
 '
@@ -27,7 +27,7 @@ test_expect_success 'ceiling' '
 		GIT_CEILING_DIRECTORIES="$PWD" &&
 		export GIT_CEILING_DIRECTORIES &&
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test -z "$(cat output)"
 '
@@ -42,7 +42,7 @@ test_expect_success 'ceiling #2' '
 		GIT_CEILING_DIRECTORIES="$PWD" &&
 		export GIT_CEILING_DIRECTORIES XDG_CONFIG_HOME &&
 		cd sub &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	) >output &&
 	test xdg = "$(cat output)"
 '
@@ -54,7 +54,7 @@ test_expect_success 'read config file in right order' '
 	(
 		cd foo &&
 		echo "[test]source = repo" >>.git/config &&
-		GIT_CONFIG_PARAMETERS=$cmdline_config test-config \
+		GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config \
 			read_early_config test.source >actual &&
 		cat >expected <<-\EOF &&
 		home
@@ -71,7 +71,7 @@ test_with_config () {
 	(
 		cd throwaway &&
 		echo "$*" >.git/config &&
-		test-config read_early_config early.config
+		test-tool config read_early_config early.config
 	)
 }
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 06/36] t/helper: merge test-ctype into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (4 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 05/36] t/helper: merge test-config " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 07/36] t/helper: merge test-date " Nguyễn Thái Ngọc Duy
                     ` (32 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile               | 2 +-
 t/helper/test-ctype.c  | 3 ++-
 t/helper/test-tool.c   | 1 +
 t/helper/test-tool.h   | 1 +
 t/t0070-fundamental.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 227f16ad17..d09710dc3d 100644
--- a/Makefile
+++ b/Makefile
@@ -654,10 +654,10 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_BUILTINS_OBJS += test-chmtime.o
 TEST_BUILTINS_OBJS += test-config.o
+TEST_BUILTINS_OBJS += test-ctype.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-ctype
 TEST_PROGRAMS_NEED_X += test-date
 TEST_PROGRAMS_NEED_X += test-delta
 TEST_PROGRAMS_NEED_X += test-drop-caches
diff --git a/t/helper/test-ctype.c b/t/helper/test-ctype.c
index bb72c47df5..92c4c2313e 100644
--- a/t/helper/test-ctype.c
+++ b/t/helper/test-ctype.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 
 static int rc;
@@ -28,7 +29,7 @@ static int is_in(const char *s, int ch)
 #define LOWER "abcdefghijklmnopqrstuvwxyz"
 #define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
-int cmd_main(int argc, const char **argv)
+int cmd__ctype(int argc, const char **argv)
 {
 	TEST_CLASS(isdigit, DIGIT);
 	TEST_CLASS(isspace, " \n\r\t");
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index e8d6c6b9eb..d600a31935 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -9,6 +9,7 @@ struct test_cmd {
 static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
 	{ "config", cmd__config },
+	{ "ctype", cmd__ctype },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 3084f458a0..41805ecd1c 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -3,6 +3,7 @@
 
 int cmd__chmtime(int argc, const char **argv);
 int cmd__config(int argc, const char **argv);
+int cmd__ctype(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 991ed2a48d..70d4d98a2e 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -9,7 +9,7 @@ Verify wrappers and compatibility functions.
 . ./test-lib.sh
 
 test_expect_success 'character classes (isspace, isalpha etc.)' '
-	test-ctype
+	test-tool ctype
 '
 
 test_expect_success 'mktemp to nonexistent directory prints filename' '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 07/36] t/helper: merge test-date into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (5 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 06/36] t/helper: merge test-ctype " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 08/36] t/helper: merge (unused) test-delta " Nguyễn Thái Ngọc Duy
                     ` (31 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile               |  2 +-
 t/helper/test-date.c   | 17 +++++++++--------
 t/helper/test-tool.c   |  1 +
 t/helper/test-tool.h   |  1 +
 t/t0006-date.sh        |  8 ++++----
 t/t1300-repo-config.sh |  2 +-
 t/test-lib.sh          |  4 ++--
 7 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index d09710dc3d..efb1872c52 100644
--- a/Makefile
+++ b/Makefile
@@ -655,10 +655,10 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-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
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index ac83687970..a0837371ab 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -1,13 +1,14 @@
+#include "test-tool.h"
 #include "cache.h"
 
 static const char *usage_msg = "\n"
-"  test-date relative [time_t]...\n"
-"  test-date show:<format> [time_t]...\n"
-"  test-date parse [date]...\n"
-"  test-date approxidate [date]...\n"
-"  test-date timestamp [date]...\n"
-"  test-date is64bit\n"
-"  test-date time_t-is64bit\n";
+"  test-tool date relative [time_t]...\n"
+"  test-tool date show:<format> [time_t]...\n"
+"  test-tool date parse [date]...\n"
+"  test-tool date approxidate [date]...\n"
+"  test-tool date timestamp [date]...\n"
+"  test-tool date is64bit\n"
+"  test-tool date time_t-is64bit\n";
 
 static void show_relative_dates(const char **argv, struct timeval *now)
 {
@@ -81,7 +82,7 @@ static void parse_approx_timestamp(const char **argv, struct timeval *now)
 	}
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__date(int argc, const char **argv)
 {
 	struct timeval now;
 	const char *x;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index d600a31935..e92f93ac3b 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -10,6 +10,7 @@ static struct test_cmd cmds[] = {
 	{ "chmtime", cmd__chmtime },
 	{ "config", cmd__config },
 	{ "ctype", cmd__ctype },
+	{ "date", cmd__date },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 41805ecd1c..31c20bb656 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -4,6 +4,7 @@
 int cmd__chmtime(int argc, const char **argv);
 int cmd__config(int argc, const char **argv);
 int cmd__ctype(int argc, const char **argv);
+int cmd__date(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 7ac9466d50..64ff86df8e 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -10,7 +10,7 @@ check_relative() {
 	t=$(($TEST_DATE_NOW - $1))
 	echo "$t -> $2" >expect
 	test_expect_${3:-success} "relative date ($2)" "
-	test-date relative $t >actual &&
+	test-tool date relative $t >actual &&
 	test_i18ncmp expect actual
 	"
 }
@@ -35,7 +35,7 @@ check_show () {
 	zone=$5
 	test_expect_success $prereqs "show date ($format:$time)" '
 		echo "$time -> $expect" >expect &&
-		TZ=${zone:-$TZ} test-date show:"$format" "$time" >actual &&
+		TZ=${zone:-$TZ} test-tool date show:"$format" "$time" >actual &&
 		test_cmp expect actual
 	'
 }
@@ -71,7 +71,7 @@ check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT,TIME_T_
 check_parse() {
 	echo "$1 -> $2" >expect
 	test_expect_${4:-success} "parse date ($1${3:+ TZ=$3})" "
-	TZ=${3:-$TZ} test-date parse '$1' >actual &&
+	TZ=${3:-$TZ} test-tool date parse '$1' >actual &&
 	test_cmp expect actual
 	"
 }
@@ -92,7 +92,7 @@ check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 -0500' EST5
 check_approxidate() {
 	echo "$1 -> $2 +0000" >expect
 	test_expect_${3:-success} "parse approxidate ($1)" "
-	test-date approxidate '$1' >actual &&
+	test-tool date approxidate '$1' >actual &&
 	test_cmp expect actual
 	"
 }
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 4f8e6f5fde..8780934478 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -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
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7ab8af47a5..483c8d6d7c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1206,5 +1206,5 @@ test_lazy_prereq LONG_IS_64BIT '
 	test 8 -le "$(build_option sizeof-long)"
 '
 
-test_lazy_prereq TIME_IS_64BIT 'test-date is64bit'
-test_lazy_prereq TIME_T_IS_64BIT 'test-date time_t-is64bit'
+test_lazy_prereq TIME_IS_64BIT 'test-tool date is64bit'
+test_lazy_prereq TIME_T_IS_64BIT 'test-tool date time_t-is64bit'
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 08/36] t/helper: merge (unused) test-delta into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (6 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 07/36] t/helper: merge test-date " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 09/36] t/helper: merge test-drop-caches " Nguyễn Thái Ngọc Duy
                     ` (30 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile              | 2 +-
 t/helper/test-delta.c | 5 +++--
 t/helper/test-tool.c  | 1 +
 t/helper/test-tool.h  | 1 +
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index efb1872c52..327d63217a 100644
--- a/Makefile
+++ b/Makefile
@@ -656,10 +656,10 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-delta
 TEST_PROGRAMS_NEED_X += test-drop-caches
 TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c
index 591730adc4..34c7259248 100644
--- a/t/helper/test-delta.c
+++ b/t/helper/test-delta.c
@@ -8,14 +8,15 @@
  * published by the Free Software Foundation.
  */
 
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "delta.h"
 #include "cache.h"
 
 static const char usage_str[] =
-	"test-delta (-d|-p) <from_file> <data_file> <out_file>";
+	"test-tool delta (-d|-p) <from_file> <data_file> <out_file>";
 
-int cmd_main(int argc, const char **argv)
+int cmd__delta(int argc, const char **argv)
 {
 	int fd;
 	struct stat st;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index e92f93ac3b..6bef386842 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -11,6 +11,7 @@ static struct test_cmd cmds[] = {
 	{ "config", cmd__config },
 	{ "ctype", cmd__ctype },
 	{ "date", cmd__date },
+	{ "delta", cmd__delta },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 31c20bb656..761705e110 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -5,6 +5,7 @@ int cmd__chmtime(int argc, const char **argv);
 int cmd__config(int argc, const char **argv);
 int cmd__ctype(int argc, const char **argv);
 int cmd__date(int argc, const char **argv);
+int cmd__delta(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 09/36] t/helper: merge test-drop-caches into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (7 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 08/36] t/helper: merge (unused) test-delta " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 10/36] t/helper: merge test-dump-cache-tree " Nguyễn Thái Ngọc Duy
                     ` (29 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    |  2 +-
 t/helper/test-drop-caches.c |  3 ++-
 t/helper/test-tool.c        |  1 +
 t/helper/test-tool.h        |  1 +
 t/perf/p7519-fsmonitor.sh   | 12 ++++++------
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 327d63217a..edd9c43982 100644
--- a/Makefile
+++ b/Makefile
@@ -657,10 +657,10 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-drop-caches
 TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-split-index
diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
index bd1a857d52..838760898b 100644
--- a/t/helper/test-drop-caches.c
+++ b/t/helper/test-drop-caches.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 
 #if defined(GIT_WINDOWS_NATIVE)
@@ -157,7 +158,7 @@ static int cmd_dropcaches(void)
 
 #endif
 
-int cmd_main(int argc, const char **argv)
+int cmd__drop_caches(int argc, const char **argv)
 {
 	cmd_sync();
 	return cmd_dropcaches();
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 6bef386842..b6f648d387 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -12,6 +12,7 @@ static struct test_cmd cmds[] = {
 	{ "ctype", cmd__ctype },
 	{ "date", cmd__date },
 	{ "delta", cmd__delta },
+	{ "drop-caches", cmd__drop_caches },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 761705e110..f585b7776e 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -6,6 +6,7 @@ int cmd__config(int argc, const char **argv);
 int cmd__ctype(int argc, const char **argv);
 int cmd__date(int argc, const char **argv);
 int cmd__delta(int argc, const char **argv);
+int cmd__drop_caches(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 65e145c02d..def7ecdbc7 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -118,7 +118,7 @@ test_expect_success "setup for fsmonitor" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -126,7 +126,7 @@ test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -134,7 +134,7 @@ test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -148,7 +148,7 @@ test_expect_success "setup without fsmonitor" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -156,7 +156,7 @@ test_perf "status (fsmonitor=$INTEGRATION_SCRIPT)" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
@@ -164,7 +164,7 @@ test_perf "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
 '
 
 if test -n "$GIT_PERF_7519_DROP_CACHE"; then
-	test-drop-caches
+	test-tool drop-caches
 fi
 
 test_perf "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 10/36] t/helper: merge test-dump-cache-tree into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (8 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 09/36] t/helper: merge test-drop-caches " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 11/36] t/helper: merge test-dump-split-index " Nguyễn Thái Ngọc Duy
                     ` (28 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                        | 2 +-
 t/helper/test-dump-cache-tree.c | 3 ++-
 t/helper/test-tool.c            | 1 +
 t/helper/test-tool.h            | 1 +
 t/t0090-cache-tree.sh           | 6 +++---
 t/t1700-split-index.sh          | 2 +-
 6 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index edd9c43982..991bafa6fb 100644
--- a/Makefile
+++ b/Makefile
@@ -658,10 +658,10 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
-TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-split-index
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
index ebf3aab22d..98a4891f1d 100644
--- a/t/helper/test-dump-cache-tree.c
+++ b/t/helper/test-dump-cache-tree.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "tree.h"
 #include "cache-tree.h"
@@ -54,7 +55,7 @@ static int dump_cache_tree(struct cache_tree *it,
 	return errs;
 }
 
-int cmd_main(int ac, const char **av)
+int cmd__dump_cache_tree(int ac, const char **av)
 {
 	struct index_state istate;
 	struct cache_tree *another = cache_tree();
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index b6f648d387..3d8d9ed1ce 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -13,6 +13,7 @@ static struct test_cmd cmds[] = {
 	{ "date", cmd__date },
 	{ "delta", cmd__delta },
 	{ "drop-caches", cmd__drop_caches },
+	{ "dump-cache-tree", cmd__dump_cache_tree },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index f585b7776e..2a0d034adf 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -7,6 +7,7 @@ int cmd__ctype(int argc, const char **argv);
 int cmd__date(int argc, const char **argv);
 int cmd__delta(int argc, const char **argv);
 int cmd__drop_caches(int argc, const char **argv);
+int cmd__dump_cache_tree(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index adfd4f0b5e..f81e3deead 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -8,13 +8,13 @@ cache-tree extension.
  . ./test-lib.sh
 
 cmp_cache_tree () {
-	test-dump-cache-tree | sed -e '/#(ref)/d' >actual &&
+	test-tool dump-cache-tree | sed -e '/#(ref)/d' >actual &&
 	sed "s/$_x40/SHA/" <actual >filtered &&
 	test_cmp "$1" filtered
 }
 
 # We don't bother with actually checking the SHA1:
-# test-dump-cache-tree already verifies that all existing data is
+# test-tool dump-cache-tree already verifies that all existing data is
 # correct.
 generate_expected_cache_tree_rec () {
 	dir="$1${1:+/}" &&
@@ -47,7 +47,7 @@ test_cache_tree () {
 
 test_invalid_cache_tree () {
 	printf "invalid                                  %s ()\n" "" "$@" >expect &&
-	test-dump-cache-tree |
+	test-tool dump-cache-tree |
 	sed -n -e "s/[0-9]* subtrees//" -e '/#(ref)/d' -e '/^invalid /p' >actual &&
 	test_cmp expect actual
 }
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index 4b5d443280..b778975de8 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -435,7 +435,7 @@ test_expect_success 'writing split index with null sha1 does not write cache tre
 	commit=$(git commit-tree $tree -p HEAD <msg) &&
 	git update-ref HEAD "$commit" &&
 	GIT_ALLOW_NULL_SHA1=1 git reset --hard &&
-	(test-dump-cache-tree >cache-tree.out || true) &&
+	(test-tool dump-cache-tree >cache-tree.out || true) &&
 	test_line_count = 0 cache-tree.out
 '
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 11/36] t/helper: merge test-dump-split-index into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (9 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 10/36] t/helper: merge test-dump-cache-tree " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 12/36] t/helper: merge test-example-decorate " Nguyễn Thái Ngọc Duy
                     ` (27 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         |  2 +-
 t/helper/test-dump-split-index.c |  3 +-
 t/helper/test-tool.c             |  1 +
 t/helper/test-tool.h             |  1 +
 t/t0090-cache-tree.sh            |  4 +--
 t/t1700-split-index.sh           | 48 ++++++++++++++++----------------
 6 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile
index 991bafa6fb..8993cec274 100644
--- a/Makefile
+++ b/Makefile
@@ -659,11 +659,11 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.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
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index e44430b699..4e2fdb5e30 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "split-index.h"
 #include "ewah/ewok.h"
@@ -7,7 +8,7 @@ static void show_bit(size_t pos, void *data)
 	printf(" %d", (int)pos);
 }
 
-int cmd_main(int ac, const char **av)
+int cmd__dump_split_index(int ac, const char **av)
 {
 	struct split_index *si;
 	int i;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 3d8d9ed1ce..26ae209cd5 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -14,6 +14,7 @@ static struct test_cmd cmds[] = {
 	{ "delta", cmd__delta },
 	{ "drop-caches", cmd__drop_caches },
 	{ "dump-cache-tree", cmd__dump_cache_tree },
+	{ "dump-split-index", cmd__dump_split_index },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 2a0d034adf..e8363e851f 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -8,6 +8,7 @@ int cmd__date(int argc, const char **argv);
 int cmd__delta(int argc, const char **argv);
 int cmd__drop_caches(int argc, const char **argv);
 int cmd__dump_cache_tree(int argc, const char **argv);
+int cmd__dump_split_index(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index f81e3deead..3266209e41 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -246,9 +246,9 @@ test_expect_success 'switching trees does not invalidate shared index' '
 	git update-index --split-index &&
 	>split &&
 	git add split &&
-	test-dump-split-index .git/index | grep -v ^own >before &&
+	test-tool dump-split-index .git/index | grep -v ^own >before &&
 	git commit -m "as-is" &&
-	test-dump-split-index .git/index | grep -v ^own >after &&
+	test-tool dump-split-index .git/index | grep -v ^own >after &&
 	test_cmp before after
 '
 
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index b778975de8..ec179fbaf7 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -11,7 +11,7 @@ sane_unset GIT_FSMONITOR_TEST
 test_expect_success 'enable split index' '
 	git config splitIndex.maxPercentChange 100 &&
 	git update-index --split-index &&
-	test-dump-split-index .git/index >actual &&
+	test-tool dump-split-index .git/index >actual &&
 	indexversion=$(test-index-version <.git/index) &&
 	if test "$indexversion" = "4"
 	then
@@ -39,7 +39,7 @@ test_expect_success 'add one file' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	base $base
 	100644 $EMPTY_BLOB 0	one
@@ -57,8 +57,8 @@ test_expect_success 'disable split index' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	BASE=$(test-dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^own" | sed "s/own/base/") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	not a split index
 	EOF
@@ -73,7 +73,7 @@ test_expect_success 'enable split index again, "one" now belongs to base index"'
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -91,7 +91,7 @@ test_expect_success 'modify original file, base index untouched' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	q_to_tab >expect <<-EOF &&
 	$BASE
 	100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -111,7 +111,7 @@ test_expect_success 'add another file, which stays index' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	q_to_tab >expect <<-EOF &&
 	$BASE
 	100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -130,7 +130,7 @@ test_expect_success 'remove file not in base index' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	q_to_tab >expect <<-EOF &&
 	$BASE
 	100644 2e0996000b7e9019eabcad29391bf0f5c7702f0b 0Q
@@ -147,7 +147,7 @@ test_expect_success 'remove file in base index' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -165,7 +165,7 @@ test_expect_success 'add original file back' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	100644 $EMPTY_BLOB 0	one
@@ -195,7 +195,7 @@ test_expect_success 'unify index, two files remain' '
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
 
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	not a split index
 	EOF
@@ -229,8 +229,8 @@ test_expect_success 'set core.splitIndex config variable to true' '
 	100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	two
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -248,7 +248,7 @@ test_expect_success 'set core.splitIndex config variable to false' '
 	100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	two
 	EOF
 	test_cmp ls-files.expect ls-files.actual &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	not a split index
 	EOF
@@ -259,8 +259,8 @@ test_expect_success 'set core.splitIndex config variable to true' '
 	git config core.splitIndex true &&
 	: >three &&
 	git update-index --add three &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -269,7 +269,7 @@ test_expect_success 'set core.splitIndex config variable to true' '
 	test_cmp expect actual &&
 	: >four &&
 	git update-index --add four &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	four
@@ -283,8 +283,8 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
 	git config --unset splitIndex.maxPercentChange &&
 	: >five &&
 	git update-index --add five &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -293,7 +293,7 @@ test_expect_success 'check behavior with splitIndex.maxPercentChange unset' '
 	test_cmp expect actual &&
 	: >six &&
 	git update-index --add six &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0	six
@@ -307,8 +307,8 @@ test_expect_success 'check splitIndex.maxPercentChange set to 0' '
 	git config splitIndex.maxPercentChange 0 &&
 	: >seven &&
 	git update-index --add seven &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
@@ -317,8 +317,8 @@ test_expect_success 'check splitIndex.maxPercentChange set to 0' '
 	test_cmp expect actual &&
 	: >eight &&
 	git update-index --add eight &&
-	BASE=$(test-dump-split-index .git/index | grep "^base") &&
-	test-dump-split-index .git/index | sed "/^own/d" >actual &&
+	BASE=$(test-tool dump-split-index .git/index | grep "^base") &&
+	test-tool dump-split-index .git/index | sed "/^own/d" >actual &&
 	cat >expect <<-EOF &&
 	$BASE
 	replacements:
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 12/36] t/helper: merge test-example-decorate into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (10 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 11/36] t/helper: merge test-dump-split-index " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 13/36] t/helper: merge test-genrandom " Nguyễn Thái Ngọc Duy
                     ` (26 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         | 2 +-
 t/helper/test-example-decorate.c | 3 ++-
 t/helper/test-tool.c             | 1 +
 t/helper/test-tool.h             | 1 +
 t/t9004-example.sh               | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 8993cec274..895b170fe3 100644
--- a/Makefile
+++ b/Makefile
@@ -660,12 +660,12 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 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
diff --git a/t/helper/test-example-decorate.c b/t/helper/test-example-decorate.c
index 90dc97a9d0..081115bf8e 100644
--- a/t/helper/test-example-decorate.c
+++ b/t/helper/test-example-decorate.c
@@ -1,8 +1,9 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "object.h"
 #include "decorate.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__example_decorate(int argc, const char **argv)
 {
 	struct decoration n;
 	struct object_id one_oid = { {1} };
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 26ae209cd5..a0e95c13ed 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -15,6 +15,7 @@ static struct test_cmd cmds[] = {
 	{ "drop-caches", cmd__drop_caches },
 	{ "dump-cache-tree", cmd__dump_cache_tree },
 	{ "dump-split-index", cmd__dump_split_index },
+	{ "example-decorate", cmd__example_decorate },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index e8363e851f..721a1e1b09 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -9,6 +9,7 @@ int cmd__delta(int argc, const char **argv);
 int cmd__drop_caches(int argc, const char **argv);
 int cmd__dump_cache_tree(int argc, const char **argv);
 int cmd__dump_split_index(int argc, const char **argv);
+int cmd__example_decorate(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t9004-example.sh b/t/t9004-example.sh
index b28a028f55..7e8894a4a7 100755
--- a/t/t9004-example.sh
+++ b/t/t9004-example.sh
@@ -4,7 +4,7 @@ test_description='check that example code compiles and runs'
 . ./test-lib.sh
 
 test_expect_success 'decorate' '
-	test-example-decorate
+	test-tool example-decorate
 '
 
 test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 13/36] t/helper: merge test-genrandom into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (11 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 12/36] t/helper: merge test-example-decorate " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 14/36] t/helper: merge test-hashmap " Nguyễn Thái Ngọc Duy
                     ` (25 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                              |  2 +-
 t/helper/test-genrandom.c             |  3 ++-
 t/helper/test-tool.c                  |  1 +
 t/helper/test-tool.h                  |  1 +
 t/t0005-signals.sh                    |  2 +-
 t/t0021-conversion.sh                 |  4 ++--
 t/t1006-cat-file.sh                   |  2 +-
 t/t1050-large.sh                      |  6 +++---
 t/t5000-tar-tree.sh                   |  2 +-
 t/t5300-pack-object.sh                |  4 ++--
 t/t5301-sliding-window.sh             |  2 +-
 t/t5302-pack-index.sh                 | 14 +++++++-------
 t/t5303-pack-corruption-resilience.sh | 10 +++++-----
 t/t5310-pack-bitmaps.sh               |  2 +-
 t/t5313-pack-bounds-checks.sh         |  4 ++--
 t/t5314-pack-cycle-detection.sh       |  2 +-
 t/t5316-pack-delta-depth.sh           |  2 +-
 t/t5546-receive-limits.sh             |  2 +-
 t/t5547-push-quarantine.sh            |  2 +-
 t/t5608-clone-2gb.sh                  |  2 +-
 t/t9300-fast-import.sh                |  2 +-
 t/t9802-git-p4-filetype.sh            |  2 +-
 22 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/Makefile b/Makefile
index 895b170fe3..d0bc6cfecf 100644
--- a/Makefile
+++ b/Makefile
@@ -661,13 +661,13 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 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-line-buffer
diff --git a/t/helper/test-genrandom.c b/t/helper/test-genrandom.c
index 8d11d22d98..99b8dc1e2d 100644
--- a/t/helper/test-genrandom.c
+++ b/t/helper/test-genrandom.c
@@ -4,9 +4,10 @@
  * Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.
  */
 
+#include "test-tool.h"
 #include "git-compat-util.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__genrandom(int argc, const char **argv)
 {
 	unsigned long count, next = 0;
 	unsigned char *c;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index a0e95c13ed..eb20b7d8fe 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -16,6 +16,7 @@ static struct test_cmd cmds[] = {
 	{ "dump-cache-tree", cmd__dump_cache_tree },
 	{ "dump-split-index", cmd__dump_split_index },
 	{ "example-decorate", cmd__example_decorate },
+	{ "genrandom", cmd__genrandom },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 721a1e1b09..f7ec6ae0c3 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -10,6 +10,7 @@ int cmd__drop_caches(int argc, const char **argv);
 int cmd__dump_cache_tree(int argc, const char **argv);
 int cmd__dump_split_index(int argc, const char **argv);
 int cmd__example_decorate(int argc, const char **argv);
+int cmd__genrandom(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index 46042f1f13..c16947cf5d 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -36,7 +36,7 @@ large_git () {
 }
 
 test_expect_success 'create blob' '
-	test-genrandom foo 16384 >file &&
+	test-tool genrandom foo 16384 >file &&
 	git add file
 '
 
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 46f8e583c3..9479a4aaab 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -19,7 +19,7 @@ write_script rot13-filter.pl "$PERL_PATH" \
 generate_random_characters () {
 	LEN=$1
 	NAME=$2
-	test-genrandom some-seed $LEN |
+	test-tool genrandom some-seed $LEN |
 		perl -pe "s/./chr((ord($&) % 26) + ord('a'))/sge" >"$TEST_ROOT/$NAME"
 }
 
@@ -267,7 +267,7 @@ test_expect_success 'filtering large input to small output should use little mem
 '
 
 test_expect_success 'filter that does not read is fine' '
-	test-genrandom foo $((128 * 1024 + 1)) >big &&
+	test-tool genrandom foo $((128 * 1024 + 1)) >big &&
 	echo "big filter=epipe" >.gitattributes &&
 	test_config filter.epipe.clean "echo xyzzy" &&
 	git add big &&
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index b19f332694..2ac3b940c6 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -282,7 +282,7 @@ test_expect_success "--batch-check with multiple sha1s gives correct format" '
 '
 
 test_expect_success 'setup blobs which are likely to delta' '
-	test-genrandom foo 10240 >foo &&
+	test-tool genrandom foo 10240 >foo &&
 	{ cat foo; echo plus; } >foo-plus &&
 	git add foo foo-plus &&
 	git commit -m foo &&
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index 6fd264cff0..f9eb143f43 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -103,9 +103,9 @@ test_expect_success 'packsize limit' '
 		# mid1 and mid2 will fit within 256k limit but
 		# appending mid3 will bust the limit and will
 		# result in a separate packfile.
-		test-genrandom "a" $(( 66 * 1024 )) >mid1 &&
-		test-genrandom "b" $(( 80 * 1024 )) >mid2 &&
-		test-genrandom "c" $(( 128 * 1024 )) >mid3 &&
+		test-tool genrandom "a" $(( 66 * 1024 )) >mid1 &&
+		test-tool genrandom "b" $(( 80 * 1024 )) >mid2 &&
+		test-tool genrandom "c" $(( 128 * 1024 )) >mid3 &&
 		git add mid1 mid2 mid3 &&
 
 		count=0
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 266d052efb..af4d9b8876 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -101,7 +101,7 @@ test_expect_success \
      ten=0123456789 && hundred=$ten$ten$ten$ten$ten$ten$ten$ten$ten$ten &&
      echo long filename >a/four$hundred &&
      mkdir a/bin &&
-     test-genrandom "frotz" 500000 >a/bin/sh &&
+     test-tool genrandom "frotz" 500000 >a/bin/sh &&
      printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
      printf "A not substituted O" >a/substfile2 &&
      if test_have_prereq SYMLINKS; then
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 9c68b99251..3bac1f20e0 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -16,8 +16,8 @@ test_expect_success \
      perl -e "print \"a\" x 4096;" > a &&
      perl -e "print \"b\" x 4096;" > b &&
      perl -e "print \"c\" x 4096;" > c &&
-     test-genrandom "seed a" 2097152 > a_big &&
-     test-genrandom "seed b" 2097152 > b_big &&
+     test-tool genrandom "seed a" 2097152 > a_big &&
+     test-tool genrandom "seed b" 2097152 > b_big &&
      git update-index --add a a_big b b_big c &&
      cat c >d && echo foo >>d && git update-index --add d &&
      tree=$(git write-tree) &&
diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
index cae8c2e882..8132642163 100755
--- a/t/t5301-sliding-window.sh
+++ b/t/t5301-sliding-window.sh
@@ -12,7 +12,7 @@ test_expect_success \
      for i in a b c
      do
          echo $i >$i &&
-         test-genrandom "$i" 32768 >>$i &&
+         test-tool genrandom "$i" 32768 >>$i &&
          git update-index --add $i || return 1
      done &&
      echo d >d && cat c >>d && git update-index --add d &&
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index d695a6082e..7a62947f74 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -15,17 +15,17 @@ test_expect_success \
      while test $i -le 100
      do
          iii=$(printf '%03i' $i)
-         test-genrandom "bar" 200 > wide_delta_$iii &&
-         test-genrandom "baz $iii" 50 >> wide_delta_$iii &&
-         test-genrandom "foo"$i 100 > deep_delta_$iii &&
-         test-genrandom "foo"$(expr $i + 1) 100 >> deep_delta_$iii &&
-         test-genrandom "foo"$(expr $i + 2) 100 >> deep_delta_$iii &&
+         test-tool genrandom "bar" 200 > wide_delta_$iii &&
+         test-tool genrandom "baz $iii" 50 >> wide_delta_$iii &&
+         test-tool genrandom "foo"$i 100 > deep_delta_$iii &&
+         test-tool genrandom "foo"$(expr $i + 1) 100 >> deep_delta_$iii &&
+         test-tool genrandom "foo"$(expr $i + 2) 100 >> deep_delta_$iii &&
          echo $iii >file_$iii &&
-         test-genrandom "$iii" 8192 >>file_$iii &&
+         test-tool genrandom "$iii" 8192 >>file_$iii &&
          git update-index --add file_$iii deep_delta_$iii wide_delta_$iii &&
          i=$(expr $i + 1) || return 1
      done &&
-     { echo 101 && test-genrandom 100 8192; } >file_101 &&
+     { echo 101 && test-tool genrandom 100 8192; } >file_101 &&
      git update-index --add file_101 &&
      tree=$(git write-tree) &&
      commit=$(git commit-tree $tree </dev/null) && {
diff --git a/t/t5303-pack-corruption-resilience.sh b/t/t5303-pack-corruption-resilience.sh
index 5940ce2084..3634e258f8 100755
--- a/t/t5303-pack-corruption-resilience.sh
+++ b/t/t5303-pack-corruption-resilience.sh
@@ -19,14 +19,14 @@ test_description='resilience to pack corruptions with redundant objects'
 # 3) object header is always 2 bytes.
 
 create_test_files() {
-    test-genrandom "foo" 2000 > file_1 &&
-    test-genrandom "foo" 1800 > file_2 &&
-    test-genrandom "foo" 1800 > file_3 &&
+    test-tool genrandom "foo" 2000 > file_1 &&
+    test-tool genrandom "foo" 1800 > file_2 &&
+    test-tool genrandom "foo" 1800 > file_3 &&
     echo " base " >> file_1 &&
     echo " delta1 " >> file_2 &&
     echo " delta delta2 " >> file_3 &&
-    test-genrandom "bar" 150 >> file_2 &&
-    test-genrandom "baz" 100 >> file_3
+    test-tool genrandom "bar" 150 >> file_2 &&
+    test-tool genrandom "baz" 100 >> file_3
 }
 
 create_new_pack() {
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index 20e2473a03..f6d600fd82 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -284,7 +284,7 @@ test_expect_success JGIT 'jgit can read our bitmaps' '
 '
 
 test_expect_success 'splitting packs does not generate bogus bitmaps' '
-	test-genrandom foo $((1024 * 1024)) >rand &&
+	test-tool genrandom foo $((1024 * 1024)) >rand &&
 	git add rand &&
 	git commit -m "commit with big file" &&
 	git -c pack.packSizeLimit=500k repack -adb &&
diff --git a/t/t5313-pack-bounds-checks.sh b/t/t5313-pack-bounds-checks.sh
index 9372508c99..4fe4ad9d61 100755
--- a/t/t5313-pack-bounds-checks.sh
+++ b/t/t5313-pack-bounds-checks.sh
@@ -163,8 +163,8 @@ test_expect_success 'bogus offset inside v2 extended table' '
 
 test_expect_success 'bogus OFS_DELTA in packfile' '
 	# Generate a pack with a delta in it.
-	base=$(test-genrandom foo 3000 | git hash-object --stdin -w) &&
-	delta=$(test-genrandom foo 2000 | git hash-object --stdin -w) &&
+	base=$(test-tool genrandom foo 3000 | git hash-object --stdin -w) &&
+	delta=$(test-tool genrandom foo 2000 | git hash-object --stdin -w) &&
 	do_pack "$base $delta" --delta-base-offset &&
 	rm -f .git/objects/??/* &&
 
diff --git a/t/t5314-pack-cycle-detection.sh b/t/t5314-pack-cycle-detection.sh
index f7dbdfb412..f31995d3d2 100755
--- a/t/t5314-pack-cycle-detection.sh
+++ b/t/t5314-pack-cycle-detection.sh
@@ -73,7 +73,7 @@ make_pack () {
 }
 
 test_expect_success 'setup' '
-	test-genrandom base 4096 >base &&
+	test-tool genrandom base 4096 >base &&
 	for i in one two
 	do
 		# we want shared content here to encourage deltas...
diff --git a/t/t5316-pack-delta-depth.sh b/t/t5316-pack-delta-depth.sh
index 2ed479b712..0f06c40eb1 100755
--- a/t/t5316-pack-delta-depth.sh
+++ b/t/t5316-pack-delta-depth.sh
@@ -47,7 +47,7 @@ test_description='pack-objects breaks long cross-pack delta chains'
 # repeatedly-modified file to generate the delta chain).
 
 test_expect_success 'create series of packs' '
-	test-genrandom foo 4096 >content &&
+	test-tool genrandom foo 4096 >content &&
 	prev= &&
 	for i in $(test_seq 1 10)
 	do
diff --git a/t/t5546-receive-limits.sh b/t/t5546-receive-limits.sh
index 10cb0be2b7..0b0e987fdb 100755
--- a/t/t5546-receive-limits.sh
+++ b/t/t5546-receive-limits.sh
@@ -44,7 +44,7 @@ test_pack_input_limit () {
 }
 
 test_expect_success "create known-size (1024 bytes) commit" '
-	test-genrandom foo 1024 >one-k &&
+	test-tool genrandom foo 1024 >one-k &&
 	git add one-k &&
 	test_commit one-k
 '
diff --git a/t/t5547-push-quarantine.sh b/t/t5547-push-quarantine.sh
index 113c87007f..faaa51ccc5 100755
--- a/t/t5547-push-quarantine.sh
+++ b/t/t5547-push-quarantine.sh
@@ -39,7 +39,7 @@ test_expect_success 'push to repo path with path separator (colon)' '
 	# so make it likely for us to generate a delta by having
 	# a non-trivial file with multiple versions.
 
-	test-genrandom foo 4096 >file.bin &&
+	test-tool genrandom foo 4096 >file.bin &&
 	git add file.bin &&
 	git commit -m bin &&
 
diff --git a/t/t5608-clone-2gb.sh b/t/t5608-clone-2gb.sh
index 191d6d3a78..df822d9a3e 100755
--- a/t/t5608-clone-2gb.sh
+++ b/t/t5608-clone-2gb.sh
@@ -21,7 +21,7 @@ test_expect_success CLONE_2GB 'setup' '
 	 do
 		printf "Generating blob $i/$blobcount\r" >&2 &&
 		printf "blob\nmark :$i\ndata $blobsize\n" &&
-		#test-genrandom $i $blobsize &&
+		#test-tool genrandom $i $blobsize &&
 		printf "%-${blobsize}s" $i &&
 		echo "M 100644 :$i $i" >> commit
 		i=$(($i+1)) ||
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index e4d06accc4..dc79df7b04 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -2654,7 +2654,7 @@ test_expect_success 'R: corrupt lines do not mess marks file' '
 ##
 test_expect_success 'R: blob bigger than threshold' '
 	blobsize=$((2*1024*1024 + 53)) &&
-	test-genrandom bar $blobsize >expect &&
+	test-tool genrandom bar $blobsize >expect &&
 	cat >input <<-INPUT_END &&
 	commit refs/heads/big-file
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
index eb9a8ed197..1fc9b33aeb 100755
--- a/t/t9802-git-p4-filetype.sh
+++ b/t/t9802-git-p4-filetype.sh
@@ -237,7 +237,7 @@ test_expect_success 'ignore apple' '
 	build_gendouble &&
 	(
 		cd "$cli" &&
-		test-genrandom apple 1024 >double.png &&
+		test-tool genrandom apple 1024 >double.png &&
 		"$PYTHON_PATH" "$TRASH_DIRECTORY/gendouble.py" >%double.png &&
 		p4 add -t apple double.png &&
 		p4 submit -d appledouble
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 14/36] t/helper: merge test-hashmap into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (12 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 13/36] t/helper: merge test-genrandom " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 15/36] t/helper: merge test-index-version " Nguyễn Thái Ngọc Duy
                     ` (24 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                | 2 +-
 t/helper/test-hashmap.c | 5 +++--
 t/helper/test-tool.c    | 1 +
 t/helper/test-tool.h    | 1 +
 t/t0011-hashmap.sh      | 4 ++--
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index d0bc6cfecf..f6c3ddc703 100644
--- a/Makefile
+++ b/Makefile
@@ -662,13 +662,13 @@ 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-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
-TEST_PROGRAMS_NEED_X += test-hashmap
 TEST_PROGRAMS_NEED_X += test-index-version
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-match-trees
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index 9ae9281c07..23d2b172fe 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "hashmap.h"
 #include "strbuf.h"
@@ -77,7 +78,7 @@ static unsigned int hash(unsigned int method, unsigned int i, const char *key)
 
 /*
  * Test performance of hashmap.[ch]
- * Usage: time echo "perfhashmap method rounds" | test-hashmap
+ * Usage: time echo "perfhashmap method rounds" | test-tool hashmap
  */
 static void perf_hashmap(unsigned int method, unsigned int rounds)
 {
@@ -144,7 +145,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
  *
  * perfhashmap method rounds -> test hashmap.[ch] performance
  */
-int cmd_main(int argc, const char **argv)
+int cmd__hashmap(int argc, const char **argv)
 {
 	struct strbuf line = STRBUF_INIT;
 	struct hashmap map;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index eb20b7d8fe..b9a6e7cbaa 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -17,6 +17,7 @@ static struct test_cmd cmds[] = {
 	{ "dump-split-index", cmd__dump_split_index },
 	{ "example-decorate", cmd__example_decorate },
 	{ "genrandom", cmd__genrandom },
+	{ "hashmap", cmd__hashmap },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index f7ec6ae0c3..fba4bd80b9 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -11,6 +11,7 @@ int cmd__dump_cache_tree(int argc, const char **argv);
 int cmd__dump_split_index(int argc, const char **argv);
 int cmd__example_decorate(int argc, const char **argv);
 int cmd__genrandom(int argc, const char **argv);
+int cmd__hashmap(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t0011-hashmap.sh b/t/t0011-hashmap.sh
index 9c217d948c..3f1f505e89 100755
--- a/t/t0011-hashmap.sh
+++ b/t/t0011-hashmap.sh
@@ -4,7 +4,7 @@ test_description='test hashmap and string hash functions'
 . ./test-lib.sh
 
 test_hashmap() {
-	echo "$1" | test-hashmap $3 > actual &&
+	echo "$1" | test-tool hashmap $3 > actual &&
 	echo "$2" > expect &&
 	test_cmp expect actual
 }
@@ -232,7 +232,7 @@ test_expect_success 'grow / shrink' '
 	echo value40 >> expect &&
 	echo size >> in &&
 	echo 64 39 >> expect &&
-	cat in | test-hashmap > out &&
+	cat in | test-tool hashmap > out &&
 	test_cmp expect out
 
 '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 15/36] t/helper: merge test-index-version into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (13 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 14/36] t/helper: merge test-hashmap " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 16/36] t/helper: merge (unused) test-match-trees " Nguyễn Thái Ngọc Duy
                     ` (23 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                              | 2 +-
 t/helper/test-index-version.c         | 3 ++-
 t/helper/test-tool.c                  | 1 +
 t/helper/test-tool.h                  | 1 +
 t/t1600-index.sh                      | 2 +-
 t/t1700-split-index.sh                | 2 +-
 t/t2104-update-index-skip-worktree.sh | 6 +++---
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f6c3ddc703..d7342e3a8b 100644
--- a/Makefile
+++ b/Makefile
@@ -663,13 +663,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
-TEST_PROGRAMS_NEED_X += test-index-version
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-match-trees
 TEST_PROGRAMS_NEED_X += test-mergesort
diff --git a/t/helper/test-index-version.c b/t/helper/test-index-version.c
index f569f6b7ef..fcd10968cc 100644
--- a/t/helper/test-index-version.c
+++ b/t/helper/test-index-version.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__index_version(int argc, const char **argv)
 {
 	struct cache_header hdr;
 	int version;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index b9a6e7cbaa..88fbe8ddbd 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -18,6 +18,7 @@ static struct test_cmd cmds[] = {
 	{ "example-decorate", cmd__example_decorate },
 	{ "genrandom", cmd__genrandom },
 	{ "hashmap", cmd__hashmap },
+	{ "index-version", cmd__index_version },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "sha1", cmd__sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index fba4bd80b9..b855203477 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -12,6 +12,7 @@ int cmd__dump_split_index(int argc, const char **argv);
 int cmd__example_decorate(int argc, const char **argv);
 int cmd__genrandom(int argc, const char **argv);
 int cmd__hashmap(int argc, const char **argv);
+int cmd__index_version(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
diff --git a/t/t1600-index.sh b/t/t1600-index.sh
index 079d241145..c4422312f4 100755
--- a/t/t1600-index.sh
+++ b/t/t1600-index.sh
@@ -68,7 +68,7 @@ test_expect_success 'GIT_INDEX_VERSION takes precedence over config' '
 		git config --add index.version 2 &&
 		git add a 2>&1 &&
 		echo 4 >expect &&
-		test-index-version <.git/index >actual &&
+		test-tool index-version <.git/index >actual &&
 		test_cmp expect actual
 	)
 '
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index ec179fbaf7..e4f4c4df4e 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -12,7 +12,7 @@ test_expect_success 'enable split index' '
 	git config splitIndex.maxPercentChange 100 &&
 	git update-index --split-index &&
 	test-tool dump-split-index .git/index >actual &&
-	indexversion=$(test-index-version <.git/index) &&
+	indexversion=$(test-tool index-version <.git/index) &&
 	if test "$indexversion" = "4"
 	then
 		own=432ef4b63f32193984f339431fd50ca796493569
diff --git a/t/t2104-update-index-skip-worktree.sh b/t/t2104-update-index-skip-worktree.sh
index cc830da58d..7e2e7dd4ae 100755
--- a/t/t2104-update-index-skip-worktree.sh
+++ b/t/t2104-update-index-skip-worktree.sh
@@ -33,7 +33,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'index is at version 2' '
-	test "$(test-index-version < .git/index)" = 2
+	test "$(test-tool index-version < .git/index)" = 2
 '
 
 test_expect_success 'update-index --skip-worktree' '
@@ -42,7 +42,7 @@ test_expect_success 'update-index --skip-worktree' '
 '
 
 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
-	test "$(test-index-version < .git/index)" = 3
+	test "$(test-tool index-version < .git/index)" = 3
 '
 
 test_expect_success 'ls-files -t' '
@@ -55,7 +55,7 @@ test_expect_success 'update-index --no-skip-worktree' '
 '
 
 test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
-	test "$(test-index-version < .git/index)" = 2
+	test "$(test-tool index-version < .git/index)" = 2
 '
 
 test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 16/36] t/helper: merge (unused) test-match-trees into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (14 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 15/36] t/helper: merge test-index-version " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 17/36] t/helper: merge (unused) test-mergesort " Nguyễn Thái Ngọc Duy
                     ` (22 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    | 2 +-
 t/helper/test-match-trees.c | 3 ++-
 t/helper/test-tool.c        | 1 +
 t/helper/test-tool.h        | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d7342e3a8b..6552a8f4ed 100644
--- a/Makefile
+++ b/Makefile
@@ -665,13 +665,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 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
diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c
index 356d8edef1..96857f26ac 100644
--- a/t/helper/test-match-trees.c
+++ b/t/helper/test-match-trees.c
@@ -1,7 +1,8 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "tree.h"
 
-int cmd_main(int ac, const char **av)
+int cmd__match_trees(int ac, const char **av)
 {
 	struct object_id hash1, hash2, shifted;
 	struct tree *one, *two;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 88fbe8ddbd..3653646f3a 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -20,6 +20,7 @@ static struct test_cmd cmds[] = {
 	{ "hashmap", cmd__hashmap },
 	{ "index-version", cmd__index_version },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
+	{ "match-trees", cmd__match_trees },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index b855203477..d2f009cb3e 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -14,6 +14,7 @@ int cmd__genrandom(int argc, const char **argv);
 int cmd__hashmap(int argc, const char **argv);
 int cmd__index_version(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
+int cmd__match_trees(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 17/36] t/helper: merge (unused) test-mergesort into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (15 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 16/36] t/helper: merge (unused) test-match-trees " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 18/36] t/helper: merge test-mktemp " Nguyễn Thái Ngọc Duy
                     ` (21 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                  | 2 +-
 t/helper/test-mergesort.c | 3 ++-
 t/helper/test-tool.c      | 1 +
 t/helper/test-tool.h      | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 6552a8f4ed..67f37b849e 100644
--- a/Makefile
+++ b/Makefile
@@ -666,13 +666,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
-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
diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c
index 335cf6b626..c5cffaa4b7 100644
--- a/t/helper/test-mergesort.c
+++ b/t/helper/test-mergesort.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "mergesort.h"
 
@@ -22,7 +23,7 @@ static int compare_strings(const void *a, const void *b)
 	return strcmp(x->text, y->text);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__mergesort(int argc, const char **argv)
 {
 	struct line *line, *p = NULL, *lines = NULL;
 	struct strbuf sb = STRBUF_INIT;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 3653646f3a..7ec0e8efe5 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -21,6 +21,7 @@ static struct test_cmd cmds[] = {
 	{ "index-version", cmd__index_version },
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "match-trees", cmd__match_trees },
+	{ "mergesort", cmd__mergesort },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index d2f009cb3e..6c9437ff5e 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -15,6 +15,7 @@ int cmd__hashmap(int argc, const char **argv);
 int cmd__index_version(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__match_trees(int argc, const char **argv);
+int cmd__mergesort(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 18/36] t/helper: merge test-mktemp into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (16 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 17/36] t/helper: merge (unused) test-mergesort " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 19/36] t/helper: merge test-online-cpus " Nguyễn Thái Ngọc Duy
                     ` (20 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile               | 2 +-
 t/helper/test-mktemp.c | 3 ++-
 t/helper/test-tool.c   | 1 +
 t/helper/test-tool.h   | 1 +
 t/t0070-fundamental.sh | 4 ++--
 5 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 67f37b849e..3145a9b1b2 100644
--- a/Makefile
+++ b/Makefile
@@ -667,13 +667,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
-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
diff --git a/t/helper/test-mktemp.c b/t/helper/test-mktemp.c
index 89d9b2f7be..2290688940 100644
--- a/t/helper/test-mktemp.c
+++ b/t/helper/test-mktemp.c
@@ -1,9 +1,10 @@
 /*
  * test-mktemp.c: code to exercise the creation of temporary files
  */
+#include "test-tool.h"
 #include "git-compat-util.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__mktemp(int argc, const char **argv)
 {
 	if (argc != 2)
 		usage("Expected 1 parameter defining the temporary file template");
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 7ec0e8efe5..fd3bf560d4 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -22,6 +22,7 @@ static struct test_cmd cmds[] = {
 	{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
 	{ "match-trees", cmd__match_trees },
 	{ "mergesort", cmd__mergesort },
+	{ "mktemp", cmd__mktemp },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 6c9437ff5e..cf2598798a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -16,6 +16,7 @@ int cmd__index_version(int argc, const char **argv);
 int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__match_trees(int argc, const char **argv);
 int cmd__mergesort(int argc, const char **argv);
+int cmd__mktemp(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 70d4d98a2e..ac007938ee 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -13,7 +13,7 @@ test_expect_success 'character classes (isspace, isalpha etc.)' '
 '
 
 test_expect_success 'mktemp to nonexistent directory prints filename' '
-	test_must_fail test-mktemp doesnotexist/testXXXXXX 2>err &&
+	test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
 	grep "doesnotexist/test" err
 '
 
@@ -21,7 +21,7 @@ test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints file
 	mkdir cannotwrite &&
 	chmod -w cannotwrite &&
 	test_when_finished "chmod +w cannotwrite" &&
-	test_must_fail test-mktemp cannotwrite/testXXXXXX 2>err &&
+	test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err &&
 	grep "cannotwrite/test" err
 '
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 19/36] t/helper: merge test-online-cpus into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (17 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 18/36] t/helper: merge test-mktemp " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 20/36] t/helper: merge test-path-utils " Nguyễn Thái Ngọc Duy
                     ` (19 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                                | 2 +-
 t/helper/test-online-cpus.c             | 3 ++-
 t/helper/test-tool.c                    | 1 +
 t/helper/test-tool.h                    | 1 +
 t/t3008-ls-files-lazy-init-name-hash.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 3145a9b1b2..91af906d08 100644
--- a/Makefile
+++ b/Makefile
@@ -668,13 +668,13 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
-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
diff --git a/t/helper/test-online-cpus.c b/t/helper/test-online-cpus.c
index 06c09c6b88..8cb0d53840 100644
--- a/t/helper/test-online-cpus.c
+++ b/t/helper/test-online-cpus.c
@@ -1,7 +1,8 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "thread-utils.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__online_cpus(int argc, const char **argv)
 {
 	printf("%d\n", online_cpus());
 	return 0;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index fd3bf560d4..8f78d61b68 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -23,6 +23,7 @@ static struct test_cmd cmds[] = {
 	{ "match-trees", cmd__match_trees },
 	{ "mergesort", cmd__mergesort },
 	{ "mktemp", cmd__mktemp },
+	{ "online-cpus", cmd__online_cpus },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index cf2598798a..aeabc9740f 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -17,6 +17,7 @@ int cmd__lazy_init_name_hash(int argc, const char **argv);
 int cmd__match_trees(int argc, const char **argv);
 int cmd__mergesort(int argc, const char **argv);
 int cmd__mktemp(int argc, const char **argv);
+int cmd__online_cpus(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t3008-ls-files-lazy-init-name-hash.sh b/t/t3008-ls-files-lazy-init-name-hash.sh
index 8df4aa7c99..08af596ba6 100755
--- a/t/t3008-ls-files-lazy-init-name-hash.sh
+++ b/t/t3008-ls-files-lazy-init-name-hash.sh
@@ -4,7 +4,7 @@ test_description='Test the lazy init name hash with various folder structures'
 
 . ./test-lib.sh
 
-if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-online-cpus)
+if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-tool online-cpus)
 then
 	skip_all='skipping lazy-init tests, single cpu'
 	test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 20/36] t/helper: merge test-path-utils into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (18 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 19/36] t/helper: merge test-online-cpus " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 21/36] t/helper: merge test-prio-queue " Nguyễn Thái Ngọc Duy
                     ` (18 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   |  2 +-
 t/helper/test-path-utils.c |  3 +-
 t/helper/test-tool.c       |  1 +
 t/helper/test-tool.h       |  1 +
 t/lib-git-p4.sh            |  2 +-
 t/t0060-path-utils.sh      | 60 +++++++++++++++++++-------------------
 t/t1501-work-tree.sh       |  8 ++---
 7 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/Makefile b/Makefile
index 91af906d08..751ea6cad7 100644
--- a/Makefile
+++ b/Makefile
@@ -669,6 +669,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -676,7 +677,6 @@ TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 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
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index 2b3c5092a1..e115d44ac2 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "string-list.h"
 
@@ -170,7 +171,7 @@ static struct test_data dirname_data[] = {
 	{ NULL,              NULL     }
 };
 
-int cmd_main(int argc, const char **argv)
+int cmd__path_utils(int argc, const char **argv)
 {
 	if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) {
 		char *buf = xmallocz(strlen(argv[2]));
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 8f78d61b68..4c985074b7 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -24,6 +24,7 @@ static struct test_cmd cmds[] = {
 	{ "mergesort", cmd__mergesort },
 	{ "mktemp", cmd__mktemp },
 	{ "online-cpus", cmd__online_cpus },
+	{ "path-utils", cmd__path_utils },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index aeabc9740f..3b7ced01f5 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -18,6 +18,7 @@ int cmd__match_trees(int argc, const char **argv);
 int cmd__mergesort(int argc, const char **argv);
 int cmd__mktemp(int argc, const char **argv);
 int cmd__online_cpus(int argc, const char **argv);
+int cmd__path_utils(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index 54fd5a6ca0..c27599474c 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -39,7 +39,7 @@ native_path () {
 	then
 		path=$(cygpath --windows "$path")
 	else
-		path=$(test-path-utils real_path "$path")
+		path=$(test-tool path-utils real_path "$path")
 	fi &&
 	echo "$path"
 }
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index 7ea2bb515b..f46e3c4995 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -8,15 +8,15 @@ test_description='Test various path utilities'
 . ./test-lib.sh
 
 norm_path() {
-	expected=$(test-path-utils print_path "$2")
+	expected=$(test-tool path-utils print_path "$2")
 	test_expect_success $3 "normalize path: $1 => $2" \
-	"test \"\$(test-path-utils normalize_path_copy '$1')\" = '$expected'"
+	"test \"\$(test-tool path-utils normalize_path_copy '$1')\" = '$expected'"
 }
 
 relative_path() {
-	expected=$(test-path-utils print_path "$3")
+	expected=$(test-tool path-utils print_path "$3")
 	test_expect_success $4 "relative path: $1 $2 => $3" \
-	"test \"\$(test-path-utils relative_path '$1' '$2')\" = '$expected'"
+	"test \"\$(test-tool path-utils relative_path '$1' '$2')\" = '$expected'"
 }
 
 test_submodule_relative_url() {
@@ -37,7 +37,7 @@ test_git_path() {
 # On Windows, we are using MSYS's bash, which mangles the paths.
 # Absolute paths are anchored at the MSYS installation directory,
 # which means that the path / accounts for this many characters:
-rootoff=$(test-path-utils normalize_path_copy / | wc -c)
+rootoff=$(test-tool path-utils normalize_path_copy / | wc -c)
 # Account for the trailing LF:
 if test $rootoff = 2; then
 	rootoff=	# we are on Unix
@@ -46,7 +46,7 @@ else
 	# In MSYS2, the root directory "/" is translated into a Windows
 	# directory *with* trailing slash. Let's test for that and adjust
 	# our expected longest ancestor length accordingly.
-	case "$(test-path-utils print_path /)" in
+	case "$(test-tool path-utils print_path /)" in
 	*/) rootslash=1;;
 	*) rootslash=0;;
 	esac
@@ -61,7 +61,7 @@ ancestor() {
 		expected=$(($expected+$rootoff))
 	fi
 	test_expect_success "longest ancestor: $1 $2 => $expected" \
-	"actual=\$(test-path-utils longest_ancestor_length '$1' '$2') &&
+	"actual=\$(test-tool path-utils longest_ancestor_length '$1' '$2') &&
 	 test \"\$actual\" = '$expected'"
 }
 
@@ -77,8 +77,8 @@ case $(uname -s) in
 	;;
 esac
 
-test_expect_success basename 'test-path-utils basename'
-test_expect_success dirname 'test-path-utils dirname'
+test_expect_success basename 'test-tool path-utils basename'
+test_expect_success dirname 'test-tool path-utils dirname'
 
 norm_path "" ""
 norm_path . ""
@@ -157,48 +157,48 @@ ancestor /foo/bar /foo:/bar 4
 ancestor /foo/bar /bar -1
 
 test_expect_success 'strip_path_suffix' '
-	test c:/msysgit = $(test-path-utils strip_path_suffix \
+	test c:/msysgit = $(test-tool path-utils strip_path_suffix \
 		c:/msysgit/libexec//git-core libexec/git-core)
 '
 
 test_expect_success 'absolute path rejects the empty string' '
-	test_must_fail test-path-utils absolute_path ""
+	test_must_fail test-tool path-utils absolute_path ""
 '
 
 test_expect_success 'real path rejects the empty string' '
-	test_must_fail test-path-utils real_path ""
+	test_must_fail test-tool path-utils real_path ""
 '
 
 test_expect_success POSIX 'real path works on absolute paths 1' '
 	nopath="hopefully-absent-path" &&
-	test "/" = "$(test-path-utils real_path "/")" &&
-	test "/$nopath" = "$(test-path-utils real_path "/$nopath")"
+	test "/" = "$(test-tool path-utils real_path "/")" &&
+	test "/$nopath" = "$(test-tool path-utils real_path "/$nopath")"
 '
 
 test_expect_success 'real path works on absolute paths 2' '
 	nopath="hopefully-absent-path" &&
 	# Find an existing top-level directory for the remaining tests:
 	d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
-	test "$d" = "$(test-path-utils real_path "$d")" &&
-	test "$d/$nopath" = "$(test-path-utils real_path "$d/$nopath")"
+	test "$d" = "$(test-tool path-utils real_path "$d")" &&
+	test "$d/$nopath" = "$(test-tool path-utils real_path "$d/$nopath")"
 '
 
 test_expect_success POSIX 'real path removes extra leading slashes' '
 	nopath="hopefully-absent-path" &&
-	test "/" = "$(test-path-utils real_path "///")" &&
-	test "/$nopath" = "$(test-path-utils real_path "///$nopath")" &&
+	test "/" = "$(test-tool path-utils real_path "///")" &&
+	test "/$nopath" = "$(test-tool path-utils real_path "///$nopath")" &&
 	# Find an existing top-level directory for the remaining tests:
 	d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
-	test "$d" = "$(test-path-utils real_path "//$d")" &&
-	test "$d/$nopath" = "$(test-path-utils real_path "//$d/$nopath")"
+	test "$d" = "$(test-tool path-utils real_path "//$d")" &&
+	test "$d/$nopath" = "$(test-tool path-utils real_path "//$d/$nopath")"
 '
 
 test_expect_success 'real path removes other extra slashes' '
 	nopath="hopefully-absent-path" &&
 	# Find an existing top-level directory for the remaining tests:
 	d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
-	test "$d" = "$(test-path-utils real_path "$d///")" &&
-	test "$d/$nopath" = "$(test-path-utils real_path "$d///$nopath")"
+	test "$d" = "$(test-tool path-utils real_path "$d///")" &&
+	test "$d/$nopath" = "$(test-tool path-utils real_path "$d///$nopath")"
 '
 
 test_expect_success SYMLINKS 'real path works on symlinks' '
@@ -209,35 +209,35 @@ test_expect_success SYMLINKS 'real path works on symlinks' '
 	mkdir third &&
 	dir="$(cd .git; pwd -P)" &&
 	dir2=third/../second/other/.git &&
-	test "$dir" = "$(test-path-utils real_path $dir2)" &&
+	test "$dir" = "$(test-tool path-utils real_path $dir2)" &&
 	file="$dir"/index &&
-	test "$file" = "$(test-path-utils real_path $dir2/index)" &&
+	test "$file" = "$(test-tool path-utils real_path $dir2/index)" &&
 	basename=blub &&
-	test "$dir/$basename" = "$(cd .git && test-path-utils real_path "$basename")" &&
+	test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" &&
 	ln -s ../first/file .git/syml &&
 	sym="$(cd first; pwd -P)"/file &&
-	test "$sym" = "$(test-path-utils real_path "$dir2/syml")"
+	test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")"
 '
 
 test_expect_success SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' '
 	ln -s target symlink &&
-	test "$(test-path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
+	test "$(test-tool path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
 '
 
 test_expect_success 'prefix_path works with only absolute path to work tree' '
 	echo "" >expected &&
-	test-path-utils prefix_path prefix "$(pwd)" >actual &&
+	test-tool path-utils prefix_path prefix "$(pwd)" >actual &&
 	test_cmp expected actual
 '
 
 test_expect_success 'prefix_path rejects absolute path to dir with same beginning as work tree' '
-	test_must_fail test-path-utils prefix_path prefix "$(pwd)a"
+	test_must_fail test-tool path-utils prefix_path prefix "$(pwd)a"
 '
 
 test_expect_success SYMLINKS 'prefix_path works with absolute path to a symlink to work tree having  same beginning as work tree' '
 	git init repo &&
 	ln -s repo repolink &&
-	test "a" = "$(cd repo && test-path-utils prefix_path prefix "$(pwd)/../repolink/a")"
+	test "a" = "$(cd repo && test-tool path-utils prefix_path prefix "$(pwd)/../repolink/a")"
 '
 
 relative_path /foo/a/b/c/	/foo/a/b/	c/
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index b06210ec5e..b07cb9140e 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -360,7 +360,7 @@ test_expect_success 'GIT_DIR set (1)' '
 	(
 		cd work &&
 		GIT_DIR=../gitfile git rev-parse --git-common-dir >actual &&
-		test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
+		test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
 		test_cmp expect actual
 	)
 '
@@ -371,7 +371,7 @@ test_expect_success 'GIT_DIR set (2)' '
 	(
 		cd work &&
 		GIT_DIR=../gitfile git rev-parse --git-common-dir >actual &&
-		test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
+		test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
 		test_cmp expect actual
 	)
 '
@@ -382,7 +382,7 @@ test_expect_success 'Auto discovery' '
 	(
 		cd work &&
 		git rev-parse --git-common-dir >actual &&
-		test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
+		test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
 		test_cmp expect actual &&
 		echo haha >data1 &&
 		git add data1 &&
@@ -400,7 +400,7 @@ test_expect_success '$GIT_DIR/common overrides core.worktree' '
 	(
 		cd work &&
 		git rev-parse --git-common-dir >actual &&
-		test-path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
+		test-tool path-utils real_path "$TRASH_DIRECTORY/repo.git" >expect &&
 		test_cmp expect actual &&
 		echo haha >data2 &&
 		git add data2 &&
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 21/36] t/helper: merge test-prio-queue into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (19 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 20/36] t/helper: merge test-path-utils " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 22/36] t/helper: merge test-read-cache " Nguyễn Thái Ngọc Duy
                     ` (17 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   | 2 +-
 t/helper/test-prio-queue.c | 3 ++-
 t/helper/test-tool.c       | 1 +
 t/helper/test-tool.h       | 1 +
 t/t0009-prio-queue.sh      | 6 +++---
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 751ea6cad7..076c778494 100644
--- a/Makefile
+++ b/Makefile
@@ -670,6 +670,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -677,7 +678,6 @@ TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
-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
diff --git a/t/helper/test-prio-queue.c b/t/helper/test-prio-queue.c
index ae58fff359..9807b649b1 100644
--- a/t/helper/test-prio-queue.c
+++ b/t/helper/test-prio-queue.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "prio-queue.h"
 
@@ -16,7 +17,7 @@ static void show(int *v)
 	free(v);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__prio_queue(int argc, const char **argv)
 {
 	struct prio_queue pq = { intcmp };
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 4c985074b7..be5f784865 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -25,6 +25,7 @@ static struct test_cmd cmds[] = {
 	{ "mktemp", cmd__mktemp },
 	{ "online-cpus", cmd__online_cpus },
 	{ "path-utils", cmd__path_utils },
+	{ "prio-queue", cmd__prio_queue },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 3b7ced01f5..900c96dc02 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -19,6 +19,7 @@ int cmd__mergesort(int argc, const char **argv);
 int cmd__mktemp(int argc, const char **argv);
 int cmd__online_cpus(int argc, const char **argv);
 int cmd__path_utils(int argc, const char **argv);
+int cmd__prio_queue(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0009-prio-queue.sh b/t/t0009-prio-queue.sh
index 94045c3fad..e56dfce668 100755
--- a/t/t0009-prio-queue.sh
+++ b/t/t0009-prio-queue.sh
@@ -17,7 +17,7 @@ cat >expect <<'EOF'
 10
 EOF
 test_expect_success 'basic ordering' '
-	test-prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
+	test-tool prio-queue 2 6 3 10 9 5 7 4 5 8 1 dump >actual &&
 	test_cmp expect actual
 '
 
@@ -30,7 +30,7 @@ cat >expect <<'EOF'
 6
 EOF
 test_expect_success 'mixed put and get' '
-	test-prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
+	test-tool prio-queue 6 2 4 get 5 3 get get 1 dump >actual &&
 	test_cmp expect actual
 '
 
@@ -43,7 +43,7 @@ NULL
 NULL
 EOF
 test_expect_success 'notice empty queue' '
-	test-prio-queue 1 2 get get get 1 2 get get get >actual &&
+	test-tool prio-queue 1 2 get get get 1 2 get get get >actual &&
 	test_cmp expect actual
 '
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 22/36] t/helper: merge test-read-cache into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (20 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 21/36] t/helper: merge test-prio-queue " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 23/36] t/helper: merge test-ref-store " Nguyễn Thái Ngọc Duy
                     ` (16 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   | 2 +-
 t/helper/test-read-cache.c | 3 ++-
 t/helper/test-tool.c       | 1 +
 t/helper/test-tool.h       | 1 +
 t/perf/p0002-read-cache.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 076c778494..393fb9aca4 100644
--- a/Makefile
+++ b/Makefile
@@ -671,6 +671,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -678,7 +679,6 @@ TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
-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
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index 48255eef31..d674c88ba0 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__read_cache(int argc, const char **argv)
 {
 	int i, cnt = 1;
 	if (argc == 2)
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index be5f784865..f64355c25c 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -26,6 +26,7 @@ static struct test_cmd cmds[] = {
 	{ "online-cpus", cmd__online_cpus },
 	{ "path-utils", cmd__path_utils },
 	{ "prio-queue", cmd__prio_queue },
+	{ "read-cache", cmd__read_cache },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 900c96dc02..4d51c17f5a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -20,6 +20,7 @@ int cmd__mktemp(int argc, const char **argv);
 int cmd__online_cpus(int argc, const char **argv);
 int cmd__path_utils(int argc, const char **argv);
 int cmd__prio_queue(int argc, const char **argv);
+int cmd__read_cache(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/perf/p0002-read-cache.sh b/t/perf/p0002-read-cache.sh
index 9180ae9343..cdd105a594 100755
--- a/t/perf/p0002-read-cache.sh
+++ b/t/perf/p0002-read-cache.sh
@@ -8,7 +8,7 @@ test_perf_default_repo
 
 count=1000
 test_perf "read_cache/discard_cache $count times" "
-	test-read-cache $count
+	test-tool read-cache $count
 "
 
 test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 23/36] t/helper: merge test-ref-store into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (21 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 22/36] t/helper: merge test-read-cache " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 24/36] t/helper: merge test-regex " Nguyễn Thái Ngọc Duy
                     ` (15 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                       | 2 +-
 t/helper/test-ref-store.c      | 3 ++-
 t/helper/test-tool.c           | 1 +
 t/helper/test-tool.h           | 1 +
 t/t1405-main-ref-store.sh      | 2 +-
 t/t1406-submodule-ref-store.sh | 2 +-
 t/t1407-worktree-ref-store.sh  | 4 ++--
 7 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 393fb9aca4..20080fddb8 100644
--- a/Makefile
+++ b/Makefile
@@ -672,6 +672,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -680,7 +681,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 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
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 7120634b04..cdefb66a87 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "refs.h"
 #include "worktree.h"
@@ -274,7 +275,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 --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index f64355c25c..777150e4ad 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -27,6 +27,7 @@ static struct test_cmd cmds[] = {
 	{ "path-utils", cmd__path_utils },
 	{ "prio-queue", cmd__prio_queue },
 	{ "read-cache", cmd__read_cache },
+	{ "ref-store", cmd__ref_store },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 4d51c17f5a..2b5cc6e117 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -21,6 +21,7 @@ int cmd__online_cpus(int argc, const char **argv);
 int cmd__path_utils(int argc, const char **argv);
 int cmd__prio_queue(int argc, const char **argv);
 int cmd__read_cache(int argc, const char **argv);
+int cmd__ref_store(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh
index e8115df5ba..a30a080b20 100755
--- a/t/t1405-main-ref-store.sh
+++ b/t/t1405-main-ref-store.sh
@@ -4,7 +4,7 @@ test_description='test main ref store api'
 
 . ./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 &&
diff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh
index c32d4cc465..e093782cc3 100755
--- a/t/t1406-submodule-ref-store.sh
+++ b/t/t1406-submodule-ref-store.sh
@@ -4,7 +4,7 @@ test_description='test submodule ref store api'
 
 . ./test-lib.sh
 
-RUN="test-ref-store submodule:sub"
+RUN="test-tool ref-store submodule:sub"
 
 test_expect_success 'setup' '
 	git init sub &&
diff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh
index 8842d0329f..2211f9831f 100755
--- a/t/t1407-worktree-ref-store.sh
+++ b/t/t1407-worktree-ref-store.sh
@@ -4,8 +4,8 @@ test_description='test worktree ref store api'
 
 . ./test-lib.sh
 
-RWT="test-ref-store worktree:wt"
-RMAIN="test-ref-store worktree:main"
+RWT="test-tool ref-store worktree:wt"
+RMAIN="test-tool ref-store worktree:main"
 
 test_expect_success 'setup' '
 	test_commit first &&
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 24/36] t/helper: merge test-regex into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (22 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 23/36] t/helper: merge test-ref-store " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 25/36] t/helper: merge test-revision-walking " Nguyễn Thái Ngọc Duy
                     ` (14 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                        | 2 +-
 t/helper/test-regex.c           | 7 ++++---
 t/helper/test-tool.c            | 1 +
 t/helper/test-tool.h            | 1 +
 t/t0070-fundamental.sh          | 2 +-
 t/t7812-grep-icase-non-ascii.sh | 2 +-
 6 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 20080fddb8..7444c00bbb 100644
--- a/Makefile
+++ b/Makefile
@@ -673,6 +673,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -681,7 +682,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-regex.c b/t/helper/test-regex.c
index b5ea8a97c5..10284cc56f 100644
--- a/t/helper/test-regex.c
+++ b/t/helper/test-regex.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "gettext.h"
 
@@ -36,7 +37,7 @@ static int test_regex_bug(void)
 	return 0;
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__regex(int argc, const char **argv)
 {
 	const char *pat;
 	const char *str;
@@ -47,8 +48,8 @@ int cmd_main(int argc, const char **argv)
 	if (argc == 2 && !strcmp(argv[1], "--bug"))
 		return test_regex_bug();
 	else if (argc < 3)
-		usage("test-regex --bug\n"
-		      "test-regex <pattern> <string> [<options>]");
+		usage("test-tool regex --bug\n"
+		      "test-tool regex <pattern> <string> [<options>]");
 
 	argv++;
 	pat = *argv++;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 777150e4ad..0dd3b879ad 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -28,6 +28,7 @@ static struct test_cmd cmds[] = {
 	{ "prio-queue", cmd__prio_queue },
 	{ "read-cache", cmd__read_cache },
 	{ "ref-store", cmd__ref_store },
+	{ "regex", cmd__regex },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 2b5cc6e117..5f73c83ac0 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -22,6 +22,7 @@ int cmd__path_utils(int argc, const char **argv);
 int cmd__prio_queue(int argc, const char **argv);
 int cmd__read_cache(int argc, const char **argv);
 int cmd__ref_store(int argc, const char **argv);
+int cmd__regex(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index ac007938ee..23fbe6434a 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -31,7 +31,7 @@ test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' '
 
 test_expect_success 'check for a bug in the regex routines' '
 	# if this test fails, re-build git with NO_REGEX=1
-	test-regex --bug
+	test-tool regex --bug
 '
 
 test_done
diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
index 0059a1f837..0c685d3598 100755
--- a/t/t7812-grep-icase-non-ascii.sh
+++ b/t/t7812-grep-icase-non-ascii.sh
@@ -12,7 +12,7 @@ test_expect_success GETTEXT_LOCALE 'setup' '
 '
 
 test_have_prereq GETTEXT_LOCALE &&
-test-regex "HALLÓ" "Halló" ICASE &&
+test-tool regex "HALLÓ" "Halló" ICASE &&
 test_set_prereq REGEX_LOCALE
 
 test_expect_success REGEX_LOCALE 'grep literal string, no -F' '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 25/36] t/helper: merge test-revision-walking into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (23 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 24/36] t/helper: merge test-regex " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 26/36] t/helper: merge test-run-command " Nguyễn Thái Ngọc Duy
                     ` (13 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         | 2 +-
 t/helper/test-revision-walking.c | 3 ++-
 t/helper/test-tool.c             | 1 +
 t/helper/test-tool.h             | 1 +
 t/t0062-revision-walking.sh      | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7444c00bbb..3ed461cd55 100644
--- a/Makefile
+++ b/Makefile
@@ -674,6 +674,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -682,7 +683,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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-array
diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c
index b8e6fe1d00..4f8bc75821 100644
--- a/t/helper/test-revision-walking.c
+++ b/t/helper/test-revision-walking.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#include "test-tool.h"
 #include "cache.h"
 #include "commit.h"
 #include "diff.h"
@@ -45,7 +46,7 @@ static int run_revision_walk(void)
 	return got_revision;
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__revision_walking(int argc, const char **argv)
 {
 	if (argc < 2)
 		return 1;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 0dd3b879ad..e43405bea9 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -29,6 +29,7 @@ static struct test_cmd cmds[] = {
 	{ "read-cache", cmd__read_cache },
 	{ "ref-store", cmd__ref_store },
 	{ "regex", cmd__regex },
+	{ "revision-walking", cmd__revision_walking },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 5f73c83ac0..4dff220646 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -23,6 +23,7 @@ int cmd__prio_queue(int argc, const char **argv);
 int cmd__read_cache(int argc, const char **argv);
 int cmd__ref_store(int argc, const char **argv);
 int cmd__regex(int argc, const char **argv);
+int cmd__revision_walking(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0062-revision-walking.sh b/t/t0062-revision-walking.sh
index 113c728e67..8e215867b8 100755
--- a/t/t0062-revision-walking.sh
+++ b/t/t0062-revision-walking.sh
@@ -26,7 +26,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'revision walking can be done twice' '
-	test-revision-walking run-twice >run_twice_actual &&
+	test-tool revision-walking run-twice >run_twice_actual &&
 	test_cmp run_twice_expected run_twice_actual
 '
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 26/36] t/helper: merge test-run-command into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (24 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 25/36] t/helper: merge test-revision-walking " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 27/36] t/helper: merge test-scrap-cache-tree " Nguyễn Thái Ngọc Duy
                     ` (12 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    |  2 +-
 t/helper/test-run-command.c |  3 ++-
 t/helper/test-tool.c        |  1 +
 t/helper/test-tool.h        |  1 +
 t/t0061-run-command.sh      | 24 ++++++++++++------------
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 3ed461cd55..adece67b8e 100644
--- a/Makefile
+++ b/Makefile
@@ -675,6 +675,7 @@ 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-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -683,7 +684,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-TEST_PROGRAMS_NEED_X += test-run-command
 TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
 TEST_PROGRAMS_NEED_X += test-sha1-array
 TEST_PROGRAMS_NEED_X += test-sigchain
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index 153342e44d..2cc93bb69c 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "run-command.h"
 #include "argv-array.h"
@@ -49,7 +50,7 @@ static int task_finished(int result,
 	return 1;
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__run_command(int argc, const char **argv)
 {
 	struct child_process proc = CHILD_PROCESS_INIT;
 	int jobs;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index e43405bea9..94ceda66e7 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -30,6 +30,7 @@ static struct test_cmd cmds[] = {
 	{ "ref-store", cmd__ref_store },
 	{ "regex", cmd__regex },
 	{ "revision-walking", cmd__revision_walking },
+	{ "run-command", cmd__run_command },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 4dff220646..0fe2dd640b 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -24,6 +24,7 @@ int cmd__read_cache(int argc, const char **argv);
 int cmd__ref_store(int argc, const char **argv);
 int cmd__regex(int argc, const char **argv);
 int cmd__revision_walking(int argc, const char **argv);
+int cmd__run_command(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 24c92b6cd7..d03149be9f 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -14,13 +14,13 @@ EOF
 >empty
 
 test_expect_success 'start_command reports ENOENT' '
-	test-run-command start-command-ENOENT ./does-not-exist
+	test-tool run-command start-command-ENOENT ./does-not-exist
 '
 
 test_expect_success 'run_command can run a command' '
 	cat hello-script >hello.sh &&
 	chmod +x hello.sh &&
-	test-run-command run-command ./hello.sh >actual 2>err &&
+	test-tool run-command run-command ./hello.sh >actual 2>err &&
 
 	test_cmp hello-script actual &&
 	test_cmp empty err
@@ -31,7 +31,7 @@ test_expect_success !MINGW 'run_command can run a script without a #! line' '
 	cat hello-script
 	EOF
 	chmod +x hello &&
-	test-run-command run-command ./hello >actual 2>err &&
+	test-tool run-command run-command ./hello >actual 2>err &&
 
 	test_cmp hello-script actual &&
 	test_cmp empty err
@@ -45,7 +45,7 @@ test_expect_success 'run_command does not try to execute a directory' '
 	EOF
 
 	PATH=$PWD/bin1:$PWD/bin2:$PATH \
-		test-run-command run-command greet >actual 2>err &&
+		test-tool run-command run-command greet >actual 2>err &&
 	test_cmp bin2/greet actual &&
 	test_cmp empty err
 '
@@ -62,7 +62,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
 	EOF
 
 	PATH=$PWD/bin1:$PWD/bin2:$PATH \
-		test-run-command run-command greet >actual 2>err &&
+		test-tool run-command run-command greet >actual 2>err &&
 	test_cmp bin2/greet actual &&
 	test_cmp empty err
 '
@@ -70,7 +70,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
 test_expect_success POSIXPERM 'run_command reports EACCES' '
 	cat hello-script >hello.sh &&
 	chmod -x hello.sh &&
-	test_must_fail test-run-command run-command ./hello.sh 2>err &&
+	test_must_fail test-tool run-command run-command ./hello.sh 2>err &&
 
 	grep "fatal: cannot exec.*hello.sh" err
 '
@@ -104,17 +104,17 @@ World
 EOF
 
 test_expect_success 'run_command runs in parallel with more jobs available than tasks' '
-	test-run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+	test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'run_command runs in parallel with as many jobs as tasks' '
-	test-run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+	test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'run_command runs in parallel with more tasks than jobs available' '
-	test-run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+	test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
 	test_cmp expect actual
 '
 
@@ -128,7 +128,7 @@ asking for a quick stop
 EOF
 
 test_expect_success 'run_command is asked to abort gracefully' '
-	test-run-command run-command-abort 3 false 2>actual &&
+	test-tool run-command run-command-abort 3 false 2>actual &&
 	test_cmp expect actual
 '
 
@@ -137,14 +137,14 @@ no further jobs available
 EOF
 
 test_expect_success 'run_command outputs ' '
-	test-run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+	test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
 	test_cmp expect actual
 '
 
 test_trace () {
 	expect="$1"
 	shift
-	GIT_TRACE=1 test-run-command "$@" run-command true 2>&1 >/dev/null | \
+	GIT_TRACE=1 test-tool run-command "$@" run-command true 2>&1 >/dev/null | \
 		sed 's/.* run_command: //' >actual &&
 	echo "$expect true" >expect &&
 	test_cmp expect actual
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 27/36] t/helper: merge test-scrap-cache-tree into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (25 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 26/36] t/helper: merge test-run-command " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 28/36] t/helper: merge test-sha1-array " Nguyễn Thái Ngọc Duy
                     ` (11 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         | 2 +-
 t/helper/test-scrap-cache-tree.c | 3 ++-
 t/helper/test-tool.c             | 1 +
 t/helper/test-tool.h             | 1 +
 t/t0090-cache-tree.sh            | 8 ++++----
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index adece67b8e..ba7c7d8a79 100644
--- a/Makefile
+++ b/Makefile
@@ -676,6 +676,7 @@ 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.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -684,7 +685,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
 TEST_PROGRAMS_NEED_X += test-sha1-array
 TEST_PROGRAMS_NEED_X += test-sigchain
 TEST_PROGRAMS_NEED_X += test-strcmp-offset
diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c
index d2a63bea43..d26d3e7c8b 100644
--- a/t/helper/test-scrap-cache-tree.c
+++ b/t/helper/test-scrap-cache-tree.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "lockfile.h"
 #include "tree.h"
@@ -5,7 +6,7 @@
 
 static struct lock_file index_lock;
 
-int cmd_main(int ac, const char **av)
+int cmd__scrap_cache_tree(int ac, const char **av)
 {
 	setup_git_directory();
 	hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 94ceda66e7..96d8df69d4 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -31,6 +31,7 @@ static struct test_cmd cmds[] = {
 	{ "regex", cmd__regex },
 	{ "revision-walking", cmd__revision_walking },
 	{ "run-command", cmd__run_command },
+	{ "scrap-cache-tree", cmd__scrap_cache_tree },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 0fe2dd640b..448119a44a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -25,6 +25,7 @@ int cmd__ref_store(int argc, const char **argv);
 int cmd__regex(int argc, const char **argv);
 int cmd__revision_walking(int argc, const char **argv);
 int cmd__run_command(int argc, const char **argv);
+int cmd__scrap_cache_tree(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 3266209e41..4ae0995cd9 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -115,14 +115,14 @@ test_expect_success 'update-index invalidates cache-tree' '
 '
 
 test_expect_success 'write-tree establishes cache-tree' '
-	test-scrap-cache-tree &&
+	test-tool scrap-cache-tree &&
 	git write-tree &&
 	test_cache_tree
 '
 
-test_expect_success 'test-scrap-cache-tree works' '
+test_expect_success 'test-tool scrap-cache-tree works' '
 	git read-tree HEAD &&
-	test-scrap-cache-tree &&
+	test-tool scrap-cache-tree &&
 	test_no_cache_tree
 '
 
@@ -170,7 +170,7 @@ test_expect_success 'commit in child dir has cache-tree' '
 '
 
 test_expect_success 'reset --hard gives cache-tree' '
-	test-scrap-cache-tree &&
+	test-tool scrap-cache-tree &&
 	git reset --hard &&
 	test_cache_tree
 '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 28/36] t/helper: merge test-sha1-array into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (26 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 27/36] t/helper: merge test-scrap-cache-tree " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 29/36] t/helper: merge test-sigchain " Nguyễn Thái Ngọc Duy
                     ` (10 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   |  2 +-
 t/helper/test-sha1-array.c |  3 ++-
 t/helper/test-tool.c       |  1 +
 t/helper/test-tool.h       |  1 +
 t/t0064-sha1-array.sh      | 16 ++++++++--------
 5 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index ba7c7d8a79..b50a0818a9 100644
--- a/Makefile
+++ b/Makefile
@@ -677,6 +677,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
@@ -685,7 +686,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-sha1-array.c b/t/helper/test-sha1-array.c
index edfd52d82a..ad5e69f9d3 100644
--- a/t/helper/test-sha1-array.c
+++ b/t/helper/test-sha1-array.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "sha1-array.h"
 
@@ -7,7 +8,7 @@ static int print_oid(const struct object_id *oid, void *data)
 	return 0;
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__sha1_array(int argc, const char **argv)
 {
 	struct oid_array array = OID_ARRAY_INIT;
 	struct strbuf line = STRBUF_INIT;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 96d8df69d4..27f7b6ff75 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -32,6 +32,7 @@ static struct test_cmd cmds[] = {
 	{ "revision-walking", cmd__revision_walking },
 	{ "run-command", cmd__run_command },
 	{ "scrap-cache-tree", cmd__scrap_cache_tree },
+	{ "sha1-array", cmd__sha1_array },
 	{ "sha1", cmd__sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 448119a44a..d8066e3f63 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -26,6 +26,7 @@ int cmd__regex(int argc, const char **argv);
 int cmd__revision_walking(int argc, const char **argv);
 int cmd__run_command(int argc, const char **argv);
 int cmd__scrap_cache_tree(int argc, const char **argv);
+int cmd__sha1_array(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t0064-sha1-array.sh b/t/t0064-sha1-array.sh
index 50b31ffe75..67484502a0 100755
--- a/t/t0064-sha1-array.sh
+++ b/t/t0064-sha1-array.sh
@@ -18,7 +18,7 @@ test_expect_success 'ordered enumeration' '
 	{
 		echo20 append 88 44 aa 55 &&
 		echo for_each_unique
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	test_cmp expect actual
 '
 
@@ -28,7 +28,7 @@ test_expect_success 'ordered enumeration with duplicate suppression' '
 		echo20 append 88 44 aa 55 &&
 		echo20 append 88 44 aa 55 &&
 		echo for_each_unique
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	test_cmp expect actual
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'lookup' '
 	{
 		echo20 append 88 44 aa 55 &&
 		echo20 lookup 55
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -eq 1
 '
@@ -45,7 +45,7 @@ test_expect_success 'lookup non-existing entry' '
 	{
 		echo20 append 88 44 aa 55 &&
 		echo20 lookup 33
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -lt 0
 '
@@ -55,7 +55,7 @@ test_expect_success 'lookup with duplicates' '
 		echo20 append 88 44 aa 55 &&
 		echo20 append 88 44 aa 55 &&
 		echo20 lookup 55
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -ge 2 &&
 	test "$n" -le 3
@@ -66,7 +66,7 @@ test_expect_success 'lookup non-existing entry with duplicates' '
 		echo20 append 88 44 aa 55 &&
 		echo20 append 88 44 aa 55 &&
 		echo20 lookup 66
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -lt 0
 '
@@ -76,7 +76,7 @@ test_expect_success 'lookup with almost duplicate values' '
 		echo "append 5555555555555555555555555555555555555555" &&
 		echo "append 555555555555555555555555555555555555555f" &&
 		echo20 lookup 55
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -eq 0
 '
@@ -85,7 +85,7 @@ test_expect_success 'lookup with single duplicate value' '
 	{
 		echo20 append 55 55 &&
 		echo20 lookup 55
-	} | test-sha1-array >actual &&
+	} | test-tool sha1-array >actual &&
 	n=$(cat actual) &&
 	test "$n" -ge 0 &&
 	test "$n" -le 1
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 29/36] t/helper: merge test-sigchain into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (27 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 28/36] t/helper: merge test-sha1-array " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:44   ` [PATCH v2 30/36] t/helper: merge test-strcmp-offset " Nguyễn Thái Ngọc Duy
                     ` (9 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                 | 2 +-
 t/helper/test-sigchain.c | 3 ++-
 t/helper/test-tool.c     | 1 +
 t/helper/test-tool.h     | 1 +
 t/t0005-signals.sh       | 4 ++--
 5 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b50a0818a9..51de8882d0 100644
--- a/Makefile
+++ b/Makefile
@@ -679,6 +679,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -686,7 +687,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-sigchain.c b/t/helper/test-sigchain.c
index b71edbd442..77ac5bc33f 100644
--- a/t/helper/test-sigchain.c
+++ b/t/helper/test-sigchain.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "sigchain.h"
 
@@ -13,7 +14,7 @@ X(two)
 X(three)
 #undef X
 
-int cmd_main(int argc, const char **argv) {
+int cmd__sigchain(int argc, const char **argv) {
 	sigchain_push(SIGTERM, one);
 	sigchain_push(SIGTERM, two);
 	sigchain_push(SIGTERM, three);
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 27f7b6ff75..c1de1a3397 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -34,6 +34,7 @@ static struct test_cmd cmds[] = {
 	{ "scrap-cache-tree", cmd__scrap_cache_tree },
 	{ "sha1-array", cmd__sha1_array },
 	{ "sha1", cmd__sha1 },
+	{ "sigchain", cmd__sigchain },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index d8066e3f63..1d366846f3 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -28,5 +28,6 @@ int cmd__run_command(int argc, const char **argv);
 int cmd__scrap_cache_tree(int argc, const char **argv);
 int cmd__sha1_array(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
+int cmd__sigchain(int argc, const char **argv);
 
 #endif
diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index c16947cf5d..4c214bd11c 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -10,7 +10,7 @@ one
 EOF
 
 test_expect_success 'sigchain works' '
-	{ test-sigchain >actual; ret=$?; } &&
+	{ test-tool sigchain >actual; ret=$?; } &&
 	{
 		# Signal death by raise() on Windows acts like exit(3),
 		# regardless of the signal number. So we must allow that
@@ -24,7 +24,7 @@ test_expect_success 'sigchain works' '
 test_expect_success !MINGW 'signals are propagated using shell convention' '
 	# we use exec here to avoid any sub-shell interpretation
 	# of the exit code
-	git config alias.sigterm "!exec test-sigchain" &&
+	git config alias.sigterm "!exec test-tool sigchain" &&
 	test_expect_code 143 git sigterm
 '
 
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 30/36] t/helper: merge test-strcmp-offset into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (28 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 29/36] t/helper: merge test-sigchain " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:44   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:45   ` [PATCH v2 31/36] t/helper: merge test-string-list " Nguyễn Thái Ngọc Duy
                     ` (8 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:44 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                      | 2 +-
 t/helper/test-strcmp-offset.c | 3 ++-
 t/helper/test-tool.c          | 1 +
 t/helper/test-tool.h          | 1 +
 t/t0065-strcmp-offset.sh      | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 51de8882d0..528a80b6a6 100644
--- a/Makefile
+++ b/Makefile
@@ -680,6 +680,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -687,7 +688,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-strcmp-offset.c b/t/helper/test-strcmp-offset.c
index e159c9a127..44e4a6d143 100644
--- a/t/helper/test-strcmp-offset.c
+++ b/t/helper/test-strcmp-offset.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__strcmp_offset(int argc, const char **argv)
 {
 	int result;
 	size_t offset;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index c1de1a3397..41b8f869ae 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -35,6 +35,7 @@ static struct test_cmd cmds[] = {
 	{ "sha1-array", cmd__sha1_array },
 	{ "sha1", cmd__sha1 },
 	{ "sigchain", cmd__sigchain },
+	{ "strcmp-offset", cmd__strcmp_offset },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 1d366846f3..035e82ec6a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -29,5 +29,6 @@ int cmd__scrap_cache_tree(int argc, const char **argv);
 int cmd__sha1_array(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 int cmd__sigchain(int argc, const char **argv);
+int cmd__strcmp_offset(int argc, const char **argv);
 
 #endif
diff --git a/t/t0065-strcmp-offset.sh b/t/t0065-strcmp-offset.sh
index 7d6d21425f..91fa639c4a 100755
--- a/t/t0065-strcmp-offset.sh
+++ b/t/t0065-strcmp-offset.sh
@@ -8,7 +8,7 @@ while read s1 s2 expect
 do
 	test_expect_success "strcmp_offset($s1, $s2)" '
 		echo "$expect" >expect &&
-		test-strcmp-offset "$s1" "$s2" >actual &&
+		test-tool strcmp-offset "$s1" "$s2" >actual &&
 		test_cmp expect actual
 	'
 done <<-EOF
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 31/36] t/helper: merge test-string-list into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (29 preceding siblings ...)
  2018-03-24  7:44   ` [PATCH v2 30/36] t/helper: merge test-strcmp-offset " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:45   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:45   ` [PATCH v2 32/36] t/helper: merge test-submodule-config " Nguyễn Thái Ngọc Duy
                     ` (7 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:45 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    |  2 +-
 t/helper/test-string-list.c |  3 ++-
 t/helper/test-tool.c        |  1 +
 t/helper/test-tool.h        |  1 +
 t/perf/p0071-sort.sh        |  2 +-
 t/t0063-string-list.sh      | 48 ++++++++++++++++++-------------------
 6 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/Makefile b/Makefile
index 528a80b6a6..6819792c2b 100644
--- a/Makefile
+++ b/Makefile
@@ -681,6 +681,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -688,7 +689,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index 829ec3d7d2..2123dda85b 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "string-list.h"
 
@@ -41,7 +42,7 @@ static int prefix_cb(struct string_list_item *item, void *cb_data)
 	return starts_with(item->string, prefix);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__string_list(int argc, const char **argv)
 {
 	if (argc == 5 && !strcmp(argv[1], "split")) {
 		struct string_list list = STRING_LIST_INIT_DUP;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 41b8f869ae..90008533cd 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -36,6 +36,7 @@ static struct test_cmd cmds[] = {
 	{ "sha1", cmd__sha1 },
 	{ "sigchain", cmd__sigchain },
 	{ "strcmp-offset", cmd__strcmp_offset },
+	{ "string-list", cmd__string_list },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 035e82ec6a..19ad2b0df8 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -30,5 +30,6 @@ int cmd__sha1_array(int argc, const char **argv);
 int cmd__sha1(int argc, const char **argv);
 int cmd__sigchain(int argc, const char **argv);
 int cmd__strcmp_offset(int argc, const char **argv);
+int cmd__string_list(int argc, const char **argv);
 
 #endif
diff --git a/t/perf/p0071-sort.sh b/t/perf/p0071-sort.sh
index 7c9a35a646..6e924f5fa3 100755
--- a/t/perf/p0071-sort.sh
+++ b/t/perf/p0071-sort.sh
@@ -16,7 +16,7 @@ test_perf 'sort(1)' '
 '
 
 test_perf 'string_list_sort()' '
-	test-string-list sort <unsorted >actual
+	test-tool string-list sort <unsorted >actual
 '
 
 test_expect_success 'string_list_sort() sorts like sort(1)' '
diff --git a/t/t0063-string-list.sh b/t/t0063-string-list.sh
index dbfc05ebdc..c6ee9f66b1 100755
--- a/t/t0063-string-list.sh
+++ b/t/t0063-string-list.sh
@@ -10,9 +10,9 @@ test_description='Test string list functionality'
 test_split () {
 	cat >expected &&
 	test_expect_success "split $1 at $2, max $3" "
-		test-string-list split '$1' '$2' '$3' >actual &&
+		test-tool string-list split '$1' '$2' '$3' >actual &&
 		test_cmp expected actual &&
-		test-string-list split_in_place '$1' '$2' '$3' >actual &&
+		test-tool string-list split_in_place '$1' '$2' '$3' >actual &&
 		test_cmp expected actual
 	"
 }
@@ -61,31 +61,31 @@ test_split ":" ":" "-1" <<EOF
 EOF
 
 test_expect_success "test filter_string_list" '
-	test "x-" = "x$(test-string-list filter - y)" &&
-	test "x-" = "x$(test-string-list filter no y)" &&
-	test yes = "$(test-string-list filter yes y)" &&
-	test yes = "$(test-string-list filter no:yes y)" &&
-	test yes = "$(test-string-list filter yes:no y)" &&
-	test y1:y2 = "$(test-string-list filter y1:y2 y)" &&
-	test y2:y1 = "$(test-string-list filter y2:y1 y)" &&
-	test "x-" = "x$(test-string-list filter x1:x2 y)"
+	test "x-" = "x$(test-tool string-list filter - y)" &&
+	test "x-" = "x$(test-tool string-list filter no y)" &&
+	test yes = "$(test-tool string-list filter yes y)" &&
+	test yes = "$(test-tool string-list filter no:yes y)" &&
+	test yes = "$(test-tool string-list filter yes:no y)" &&
+	test y1:y2 = "$(test-tool string-list filter y1:y2 y)" &&
+	test y2:y1 = "$(test-tool string-list filter y2:y1 y)" &&
+	test "x-" = "x$(test-tool string-list filter x1:x2 y)"
 '
 
 test_expect_success "test remove_duplicates" '
-	test "x-" = "x$(test-string-list remove_duplicates -)" &&
-	test "x" = "x$(test-string-list remove_duplicates "")" &&
-	test a = "$(test-string-list remove_duplicates a)" &&
-	test a = "$(test-string-list remove_duplicates a:a)" &&
-	test a = "$(test-string-list remove_duplicates a:a:a:a:a)" &&
-	test a:b = "$(test-string-list remove_duplicates a:b)" &&
-	test a:b = "$(test-string-list remove_duplicates a:a:b)" &&
-	test a:b = "$(test-string-list remove_duplicates a:b:b)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:b:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:a:b:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:b:b:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:b:c:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:a:b:b:c:c)" &&
-	test a:b:c = "$(test-string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
+	test "x-" = "x$(test-tool string-list remove_duplicates -)" &&
+	test "x" = "x$(test-tool string-list remove_duplicates "")" &&
+	test a = "$(test-tool string-list remove_duplicates a)" &&
+	test a = "$(test-tool string-list remove_duplicates a:a)" &&
+	test a = "$(test-tool string-list remove_duplicates a:a:a:a:a)" &&
+	test a:b = "$(test-tool string-list remove_duplicates a:b)" &&
+	test a:b = "$(test-tool string-list remove_duplicates a:a:b)" &&
+	test a:b = "$(test-tool string-list remove_duplicates a:b:b)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:b:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:b:b:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:b:c:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:a:b:b:c:c)" &&
+	test a:b:c = "$(test-tool string-list remove_duplicates a:a:a:b:b:b:c:c:c)"
 '
 
 test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 32/36] t/helper: merge test-submodule-config into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (30 preceding siblings ...)
  2018-03-24  7:45   ` [PATCH v2 31/36] t/helper: merge test-string-list " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:45   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:45   ` [PATCH v2 33/36] t/helper: merge test-subprocess " Nguyễn Thái Ngọc Duy
                     ` (6 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:45 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                         |  2 +-
 t/helper/test-submodule-config.c |  3 ++-
 t/helper/test-tool.c             |  1 +
 t/helper/test-tool.h             |  1 +
 t/t7411-submodule-config.sh      | 18 +++++++++---------
 5 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 6819792c2b..c1dc9ff8d6 100644
--- a/Makefile
+++ b/Makefile
@@ -682,6 +682,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -689,7 +690,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-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-tool
diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c
index f23db3b19a..5c6e4b010d 100644
--- a/t/helper/test-submodule-config.c
+++ b/t/helper/test-submodule-config.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "config.h"
 #include "submodule-config.h"
@@ -10,7 +11,7 @@ static void die_usage(int argc, const char **argv, const char *msg)
 	exit(1);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__submodule_config(int argc, const char **argv)
 {
 	const char **arg = argv;
 	int my_argc = argc;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 90008533cd..434fedc8d8 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -37,6 +37,7 @@ static struct test_cmd cmds[] = {
 	{ "sigchain", cmd__sigchain },
 	{ "strcmp-offset", cmd__strcmp_offset },
 	{ "string-list", cmd__string_list },
+	{ "submodule-config", cmd__submodule_config },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 19ad2b0df8..be7e79738f 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -31,5 +31,6 @@ int cmd__sha1(int argc, const char **argv);
 int cmd__sigchain(int argc, const char **argv);
 int cmd__strcmp_offset(int argc, const char **argv);
 int cmd__string_list(int argc, const char **argv);
+int cmd__submodule_config(int argc, const char **argv);
 
 #endif
diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh
index 46c09c7765..0bde5850ac 100755
--- a/t/t7411-submodule-config.sh
+++ b/t/t7411-submodule-config.sh
@@ -41,7 +41,7 @@ test_expect_success 'configuration parsing with error' '
 	EOF
 	(
 		cd repo &&
-		test_must_fail test-submodule-config "" s 2>actual &&
+		test_must_fail test-tool submodule-config "" s 2>actual &&
 		test_i18ngrep "bad config" actual
 	)
 '
@@ -55,7 +55,7 @@ EOF
 
 test_expect_success 'test parsing and lookup of submodule config by path' '
 	(cd super &&
-		test-submodule-config \
+		test-tool submodule-config \
 			HEAD^ a \
 			HEAD b \
 			HEAD^ submodule \
@@ -67,7 +67,7 @@ test_expect_success 'test parsing and lookup of submodule config by path' '
 
 test_expect_success 'test parsing and lookup of submodule config by name' '
 	(cd super &&
-		test-submodule-config --name \
+		test-tool submodule-config --name \
 			HEAD^ a \
 			HEAD a \
 			HEAD^ submodule \
@@ -89,7 +89,7 @@ test_expect_success 'error in one submodule config lets continue' '
 		git add .gitmodules &&
 		mv .gitmodules.bak .gitmodules &&
 		git commit -m "add error" &&
-		test-submodule-config \
+		test-tool submodule-config \
 			HEAD b \
 			HEAD submodule \
 				>actual &&
@@ -100,7 +100,7 @@ test_expect_success 'error in one submodule config lets continue' '
 test_expect_success 'error message contains blob reference' '
 	(cd super &&
 		sha1=$(git rev-parse HEAD) &&
-		test-submodule-config \
+		test-tool submodule-config \
 			HEAD b \
 			HEAD submodule \
 				2>actual_err &&
@@ -114,9 +114,9 @@ test_expect_success 'using different treeishs works' '
 		git tag new_tag &&
 		tree=$(git rev-parse HEAD^{tree}) &&
 		commit=$(git rev-parse HEAD^{commit}) &&
-		test-submodule-config $commit b >expect &&
-		test-submodule-config $tree b >actual.1 &&
-		test-submodule-config new_tag b >actual.2 &&
+		test-tool submodule-config $commit b >expect &&
+		test-tool submodule-config $tree b >actual.1 &&
+		test-tool submodule-config new_tag b >actual.2 &&
 		test_cmp expect actual.1 &&
 		test_cmp expect actual.2
 	)
@@ -130,7 +130,7 @@ test_expect_success 'error in history in fetchrecursesubmodule lets continue' '
 		git config --unset -f .gitmodules \
 			submodule.submodule.fetchrecursesubmodules &&
 		git commit -m "add error in fetchrecursesubmodules" &&
-		test-submodule-config \
+		test-tool submodule-config \
 			HEAD b \
 			HEAD submodule \
 				>actual &&
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 33/36] t/helper: merge test-subprocess into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (31 preceding siblings ...)
  2018-03-24  7:45   ` [PATCH v2 32/36] t/helper: merge test-submodule-config " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:45   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:45   ` [PATCH v2 34/36] t/helper: merge test-urlmatch-normalization " Nguyễn Thái Ngọc Duy
                     ` (5 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:45 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                   | 2 +-
 t/helper/test-subprocess.c | 3 ++-
 t/helper/test-tool.c       | 1 +
 t/helper/test-tool.h       | 1 +
 t/t1501-work-tree.sh       | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index c1dc9ff8d6..893ea64ca2 100644
--- a/Makefile
+++ b/Makefile
@@ -683,6 +683,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -690,7 +691,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
-TEST_PROGRAMS_NEED_X += test-subprocess
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
 TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
diff --git a/t/helper/test-subprocess.c b/t/helper/test-subprocess.c
index 30c5765bfc..92b69de635 100644
--- a/t/helper/test-subprocess.c
+++ b/t/helper/test-subprocess.c
@@ -1,7 +1,8 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "run-command.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__subprocess(int argc, const char **argv)
 {
 	struct child_process cp = CHILD_PROCESS_INIT;
 	int nogit = 0;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 434fedc8d8..96180f0350 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -38,6 +38,7 @@ static struct test_cmd cmds[] = {
 	{ "strcmp-offset", cmd__strcmp_offset },
 	{ "string-list", cmd__string_list },
 	{ "submodule-config", cmd__submodule_config },
+	{ "subprocess", cmd__subprocess },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index be7e79738f..a611801061 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -32,5 +32,6 @@ int cmd__sigchain(int argc, const char **argv);
 int cmd__strcmp_offset(int argc, const char **argv);
 int cmd__string_list(int argc, const char **argv);
 int cmd__submodule_config(int argc, const char **argv);
+int cmd__subprocess(int argc, const char **argv);
 
 #endif
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index b07cb9140e..02cf2013fc 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -341,7 +341,7 @@ test_expect_success 'make_relative_path handles double slashes in GIT_DIR' '
 
 test_expect_success 'relative $GIT_WORK_TREE and git subprocesses' '
 	GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work \
-	test-subprocess --setup-work-tree rev-parse --show-toplevel >actual &&
+	test-tool subprocess --setup-work-tree rev-parse --show-toplevel >actual &&
 	echo "$(pwd)/repo.git/work" >expected &&
 	test_cmp expected actual
 '
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 34/36] t/helper: merge test-urlmatch-normalization into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (32 preceding siblings ...)
  2018-03-24  7:45   ` [PATCH v2 33/36] t/helper: merge test-subprocess " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:45   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:45   ` [PATCH v2 35/36] t/helper: merge test-wildmatch " Nguyễn Thái Ngọc Duy
                     ` (4 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:45 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                               |   2 +-
 t/helper/test-tool.c                   |   1 +
 t/helper/test-tool.h                   |   1 +
 t/helper/test-urlmatch-normalization.c |   5 +-
 t/t0110-urlmatch-normalization.sh      | 266 ++++++++++++-------------
 5 files changed, 139 insertions(+), 136 deletions(-)

diff --git a/Makefile b/Makefile
index 893ea64ca2..7923ec3747 100644
--- a/Makefile
+++ b/Makefile
@@ -684,6 +684,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -693,7 +694,6 @@ TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
-TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
 TEST_PROGRAMS_NEED_X += test-wildmatch
 
 TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 96180f0350..b3d84fdac9 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -39,6 +39,7 @@ static struct test_cmd cmds[] = {
 	{ "string-list", cmd__string_list },
 	{ "submodule-config", cmd__submodule_config },
 	{ "subprocess", cmd__subprocess },
+	{ "urlmatch-normalization", cmd__urlmatch_normalization },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index a611801061..fa53c82659 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -33,5 +33,6 @@ int cmd__strcmp_offset(int argc, const char **argv);
 int cmd__string_list(int argc, const char **argv);
 int cmd__submodule_config(int argc, const char **argv);
 int cmd__subprocess(int argc, const char **argv);
+int cmd__urlmatch_normalization(int argc, const char **argv);
 
 #endif
diff --git a/t/helper/test-urlmatch-normalization.c b/t/helper/test-urlmatch-normalization.c
index 49b6e836be..8f4d67e646 100644
--- a/t/helper/test-urlmatch-normalization.c
+++ b/t/helper/test-urlmatch-normalization.c
@@ -1,9 +1,10 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "urlmatch.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__urlmatch_normalization(int argc, const char **argv)
 {
-	const char usage[] = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
+	const char usage[] = "test-tool urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
 	char *url1, *url2;
 	int opt_p = 0, opt_l = 0;
 
diff --git a/t/t0110-urlmatch-normalization.sh b/t/t0110-urlmatch-normalization.sh
index 410d5768ca..f99529d838 100755
--- a/t/t0110-urlmatch-normalization.sh
+++ b/t/t0110-urlmatch-normalization.sh
@@ -9,172 +9,172 @@ tu="$TEST_DIRECTORY/t0110/url"
 # Note that only file: URLs should be allowed without a host
 
 test_expect_success 'url scheme' '
-	! test-urlmatch-normalization "" &&
-	! test-urlmatch-normalization "_" &&
-	! test-urlmatch-normalization "scheme" &&
-	! test-urlmatch-normalization "scheme:" &&
-	! test-urlmatch-normalization "scheme:/" &&
-	! test-urlmatch-normalization "scheme://" &&
-	! test-urlmatch-normalization "file" &&
-	! test-urlmatch-normalization "file:" &&
-	! test-urlmatch-normalization "file:/" &&
-	test-urlmatch-normalization "file://" &&
-	! test-urlmatch-normalization "://acme.co" &&
-	! test-urlmatch-normalization "x_test://acme.co" &&
-	! test-urlmatch-normalization "-test://acme.co" &&
-	! test-urlmatch-normalization "0test://acme.co" &&
-	! test-urlmatch-normalization "+test://acme.co" &&
-	! test-urlmatch-normalization ".test://acme.co" &&
-	! test-urlmatch-normalization "schem%6e://" &&
-	test-urlmatch-normalization "x-Test+v1.0://acme.co" &&
-	test "$(test-urlmatch-normalization -p "AbCdeF://x.Y")" = "abcdef://x.y/"
+	! test-tool urlmatch-normalization "" &&
+	! test-tool urlmatch-normalization "_" &&
+	! test-tool urlmatch-normalization "scheme" &&
+	! test-tool urlmatch-normalization "scheme:" &&
+	! test-tool urlmatch-normalization "scheme:/" &&
+	! test-tool urlmatch-normalization "scheme://" &&
+	! test-tool urlmatch-normalization "file" &&
+	! test-tool urlmatch-normalization "file:" &&
+	! test-tool urlmatch-normalization "file:/" &&
+	test-tool urlmatch-normalization "file://" &&
+	! test-tool urlmatch-normalization "://acme.co" &&
+	! test-tool urlmatch-normalization "x_test://acme.co" &&
+	! test-tool urlmatch-normalization "-test://acme.co" &&
+	! test-tool urlmatch-normalization "0test://acme.co" &&
+	! test-tool urlmatch-normalization "+test://acme.co" &&
+	! test-tool urlmatch-normalization ".test://acme.co" &&
+	! test-tool urlmatch-normalization "schem%6e://" &&
+	test-tool urlmatch-normalization "x-Test+v1.0://acme.co" &&
+	test "$(test-tool urlmatch-normalization -p "AbCdeF://x.Y")" = "abcdef://x.y/"
 '
 
 test_expect_success 'url authority' '
-	! test-urlmatch-normalization "scheme://user:pass@" &&
-	! test-urlmatch-normalization "scheme://?" &&
-	! test-urlmatch-normalization "scheme://#" &&
-	! test-urlmatch-normalization "scheme:///" &&
-	! test-urlmatch-normalization "scheme://:" &&
-	! test-urlmatch-normalization "scheme://:555" &&
-	test-urlmatch-normalization "file://user:pass@" &&
-	test-urlmatch-normalization "file://?" &&
-	test-urlmatch-normalization "file://#" &&
-	test-urlmatch-normalization "file:///" &&
-	test-urlmatch-normalization "file://:" &&
-	! test-urlmatch-normalization "file://:555" &&
-	test-urlmatch-normalization "scheme://user:pass@host" &&
-	test-urlmatch-normalization "scheme://@host" &&
-	test-urlmatch-normalization "scheme://%00@host" &&
-	! test-urlmatch-normalization "scheme://%%@host" &&
-	! test-urlmatch-normalization "scheme://host_" &&
-	test-urlmatch-normalization "scheme://user:pass@host/" &&
-	test-urlmatch-normalization "scheme://@host/" &&
-	test-urlmatch-normalization "scheme://host/" &&
-	test-urlmatch-normalization "scheme://host?x" &&
-	test-urlmatch-normalization "scheme://host#x" &&
-	test-urlmatch-normalization "scheme://host/@" &&
-	test-urlmatch-normalization "scheme://host?@x" &&
-	test-urlmatch-normalization "scheme://host#@x" &&
-	test-urlmatch-normalization "scheme://[::1]" &&
-	test-urlmatch-normalization "scheme://[::1]/" &&
-	! test-urlmatch-normalization "scheme://hos%41/" &&
-	test-urlmatch-normalization "scheme://[invalid....:/" &&
-	test-urlmatch-normalization "scheme://invalid....:]/" &&
-	! test-urlmatch-normalization "scheme://invalid....:[/" &&
-	! test-urlmatch-normalization "scheme://invalid....:["
+	! test-tool urlmatch-normalization "scheme://user:pass@" &&
+	! test-tool urlmatch-normalization "scheme://?" &&
+	! test-tool urlmatch-normalization "scheme://#" &&
+	! test-tool urlmatch-normalization "scheme:///" &&
+	! test-tool urlmatch-normalization "scheme://:" &&
+	! test-tool urlmatch-normalization "scheme://:555" &&
+	test-tool urlmatch-normalization "file://user:pass@" &&
+	test-tool urlmatch-normalization "file://?" &&
+	test-tool urlmatch-normalization "file://#" &&
+	test-tool urlmatch-normalization "file:///" &&
+	test-tool urlmatch-normalization "file://:" &&
+	! test-tool urlmatch-normalization "file://:555" &&
+	test-tool urlmatch-normalization "scheme://user:pass@host" &&
+	test-tool urlmatch-normalization "scheme://@host" &&
+	test-tool urlmatch-normalization "scheme://%00@host" &&
+	! test-tool urlmatch-normalization "scheme://%%@host" &&
+	! test-tool urlmatch-normalization "scheme://host_" &&
+	test-tool urlmatch-normalization "scheme://user:pass@host/" &&
+	test-tool urlmatch-normalization "scheme://@host/" &&
+	test-tool urlmatch-normalization "scheme://host/" &&
+	test-tool urlmatch-normalization "scheme://host?x" &&
+	test-tool urlmatch-normalization "scheme://host#x" &&
+	test-tool urlmatch-normalization "scheme://host/@" &&
+	test-tool urlmatch-normalization "scheme://host?@x" &&
+	test-tool urlmatch-normalization "scheme://host#@x" &&
+	test-tool urlmatch-normalization "scheme://[::1]" &&
+	test-tool urlmatch-normalization "scheme://[::1]/" &&
+	! test-tool urlmatch-normalization "scheme://hos%41/" &&
+	test-tool urlmatch-normalization "scheme://[invalid....:/" &&
+	test-tool urlmatch-normalization "scheme://invalid....:]/" &&
+	! test-tool urlmatch-normalization "scheme://invalid....:[/" &&
+	! test-tool urlmatch-normalization "scheme://invalid....:["
 '
 
 test_expect_success 'url port checks' '
-	test-urlmatch-normalization "xyz://q@some.host:" &&
-	test-urlmatch-normalization "xyz://q@some.host:456/" &&
-	! test-urlmatch-normalization "xyz://q@some.host:0" &&
-	! test-urlmatch-normalization "xyz://q@some.host:0000000" &&
-	test-urlmatch-normalization "xyz://q@some.host:0000001?" &&
-	test-urlmatch-normalization "xyz://q@some.host:065535#" &&
-	test-urlmatch-normalization "xyz://q@some.host:65535" &&
-	! test-urlmatch-normalization "xyz://q@some.host:65536" &&
-	! test-urlmatch-normalization "xyz://q@some.host:99999" &&
-	! test-urlmatch-normalization "xyz://q@some.host:100000" &&
-	! test-urlmatch-normalization "xyz://q@some.host:100001" &&
-	test-urlmatch-normalization "http://q@some.host:80" &&
-	test-urlmatch-normalization "https://q@some.host:443" &&
-	test-urlmatch-normalization "http://q@some.host:80/" &&
-	test-urlmatch-normalization "https://q@some.host:443?" &&
-	! test-urlmatch-normalization "http://q@:8008" &&
-	! test-urlmatch-normalization "http://:8080" &&
-	! test-urlmatch-normalization "http://:" &&
-	test-urlmatch-normalization "xyz://q@some.host:456/" &&
-	test-urlmatch-normalization "xyz://[::1]:456/" &&
-	test-urlmatch-normalization "xyz://[::1]:/" &&
-	! test-urlmatch-normalization "xyz://[::1]:000/" &&
-	! test-urlmatch-normalization "xyz://[::1]:0%300/" &&
-	! test-urlmatch-normalization "xyz://[::1]:0x80/" &&
-	! test-urlmatch-normalization "xyz://[::1]:4294967297/" &&
-	! test-urlmatch-normalization "xyz://[::1]:030f/"
+	test-tool urlmatch-normalization "xyz://q@some.host:" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:456/" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:0" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:0000000" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:0000001?" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:065535#" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:65535" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:65536" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:99999" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:100000" &&
+	! test-tool urlmatch-normalization "xyz://q@some.host:100001" &&
+	test-tool urlmatch-normalization "http://q@some.host:80" &&
+	test-tool urlmatch-normalization "https://q@some.host:443" &&
+	test-tool urlmatch-normalization "http://q@some.host:80/" &&
+	test-tool urlmatch-normalization "https://q@some.host:443?" &&
+	! test-tool urlmatch-normalization "http://q@:8008" &&
+	! test-tool urlmatch-normalization "http://:8080" &&
+	! test-tool urlmatch-normalization "http://:" &&
+	test-tool urlmatch-normalization "xyz://q@some.host:456/" &&
+	test-tool urlmatch-normalization "xyz://[::1]:456/" &&
+	test-tool urlmatch-normalization "xyz://[::1]:/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:000/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:0%300/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:0x80/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:4294967297/" &&
+	! test-tool urlmatch-normalization "xyz://[::1]:030f/"
 '
 
 test_expect_success 'url port normalization' '
-	test "$(test-urlmatch-normalization -p "http://x:800")" = "http://x:800/" &&
-	test "$(test-urlmatch-normalization -p "http://x:0800")" = "http://x:800/" &&
-	test "$(test-urlmatch-normalization -p "http://x:00000800")" = "http://x:800/" &&
-	test "$(test-urlmatch-normalization -p "http://x:065535")" = "http://x:65535/" &&
-	test "$(test-urlmatch-normalization -p "http://x:1")" = "http://x:1/" &&
-	test "$(test-urlmatch-normalization -p "http://x:80")" = "http://x/" &&
-	test "$(test-urlmatch-normalization -p "http://x:080")" = "http://x/" &&
-	test "$(test-urlmatch-normalization -p "http://x:000000080")" = "http://x/" &&
-	test "$(test-urlmatch-normalization -p "https://x:443")" = "https://x/" &&
-	test "$(test-urlmatch-normalization -p "https://x:0443")" = "https://x/" &&
-	test "$(test-urlmatch-normalization -p "https://x:000000443")" = "https://x/"
+	test "$(test-tool urlmatch-normalization -p "http://x:800")" = "http://x:800/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:0800")" = "http://x:800/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:00000800")" = "http://x:800/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:065535")" = "http://x:65535/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:1")" = "http://x:1/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:80")" = "http://x/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:080")" = "http://x/" &&
+	test "$(test-tool urlmatch-normalization -p "http://x:000000080")" = "http://x/" &&
+	test "$(test-tool urlmatch-normalization -p "https://x:443")" = "https://x/" &&
+	test "$(test-tool urlmatch-normalization -p "https://x:0443")" = "https://x/" &&
+	test "$(test-tool urlmatch-normalization -p "https://x:000000443")" = "https://x/"
 '
 
 test_expect_success 'url general escapes' '
-	! test-urlmatch-normalization "http://x.y?%fg" &&
-	test "$(test-urlmatch-normalization -p "X://W/%7e%41^%3a")" = "x://w/~A%5E%3A" &&
-	test "$(test-urlmatch-normalization -p "X://W/:/?#[]@")" = "x://w/:/?#[]@" &&
-	test "$(test-urlmatch-normalization -p "X://W/$&()*+,;=")" = "x://w/$&()*+,;=" &&
-	test "$(test-urlmatch-normalization -p "X://W/'\''")" = "x://w/'\''" &&
-	test "$(test-urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
+	! test-tool urlmatch-normalization "http://x.y?%fg" &&
+	test "$(test-tool urlmatch-normalization -p "X://W/%7e%41^%3a")" = "x://w/~A%5E%3A" &&
+	test "$(test-tool urlmatch-normalization -p "X://W/:/?#[]@")" = "x://w/:/?#[]@" &&
+	test "$(test-tool urlmatch-normalization -p "X://W/$&()*+,;=")" = "x://w/$&()*+,;=" &&
+	test "$(test-tool urlmatch-normalization -p "X://W/'\''")" = "x://w/'\''" &&
+	test "$(test-tool urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
 '
 
 test_expect_success !MINGW 'url high-bit escapes' '
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-4")")" = "x://q/%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-5")")" = "x://q/%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-6")")" = "x://q/%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-7")")" = "x://q/%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-8")")" = "x://q/%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-9")")" = "x://q/%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF" &&
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-10")")" = "x://q/%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-4")")" = "x://q/%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-5")")" = "x://q/%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-6")")" = "x://q/%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-7")")" = "x://q/%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-8")")" = "x://q/%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-9")")" = "x://q/%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF" &&
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-10")")" = "x://q/%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"
 '
 
 test_expect_success 'url utf-8 escapes' '
-	test "$(test-urlmatch-normalization -p "$(cat "$tu-11")")" = "x://q/%C2%80%DF%BF%E0%A0%80%EF%BF%BD%F0%90%80%80%F0%AF%BF%BD"
+	test "$(test-tool urlmatch-normalization -p "$(cat "$tu-11")")" = "x://q/%C2%80%DF%BF%E0%A0%80%EF%BF%BD%F0%90%80%80%F0%AF%BF%BD"
 '
 
 test_expect_success 'url username/password escapes' '
-	test "$(test-urlmatch-normalization -p "x://%41%62(^):%70+d@foo")" = "x://Ab(%5E):p+d@foo/"
+	test "$(test-tool urlmatch-normalization -p "x://%41%62(^):%70+d@foo")" = "x://Ab(%5E):p+d@foo/"
 '
 
 test_expect_success 'url normalized lengths' '
-	test "$(test-urlmatch-normalization -l "Http://%4d%65:%4d^%70@The.Host")" = 25 &&
-	test "$(test-urlmatch-normalization -l "http://%41:%42@x.y/%61/")" = 17 &&
-	test "$(test-urlmatch-normalization -l "http://@x.y/^")" = 15
+	test "$(test-tool urlmatch-normalization -l "Http://%4d%65:%4d^%70@The.Host")" = 25 &&
+	test "$(test-tool urlmatch-normalization -l "http://%41:%42@x.y/%61/")" = 17 &&
+	test "$(test-tool urlmatch-normalization -l "http://@x.y/^")" = 15
 '
 
 test_expect_success 'url . and .. segments' '
-	test "$(test-urlmatch-normalization -p "x://y/.")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/./")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/.")" = "x://y/a" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./")" = "x://y/a/" &&
-	test "$(test-urlmatch-normalization -p "x://y/.?")" = "x://y/?" &&
-	test "$(test-urlmatch-normalization -p "x://y/./?")" = "x://y/?" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/.?")" = "x://y/a?" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./?")" = "x://y/a/?" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./b/.././../c")" = "x://y/c" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./b/../.././c/")" = "x://y/c/" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./b/.././../c/././.././.")" = "x://y/" &&
-	! test-urlmatch-normalization "x://y/a/./b/.././../c/././.././.." &&
-	test "$(test-urlmatch-normalization -p "x://y/a/./?/././..")" = "x://y/a/?/././.." &&
-	test "$(test-urlmatch-normalization -p "x://y/%2e/")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/%2E/")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/a/%2e./")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/b/.%2E/")" = "x://y/" &&
-	test "$(test-urlmatch-normalization -p "x://y/c/%2e%2E/")" = "x://y/"
+	test "$(test-tool urlmatch-normalization -p "x://y/.")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/./")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/.")" = "x://y/a" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./")" = "x://y/a/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/.?")" = "x://y/?" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/./?")" = "x://y/?" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/.?")" = "x://y/a?" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./?")" = "x://y/a/?" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./b/.././../c")" = "x://y/c" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./b/../.././c/")" = "x://y/c/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./b/.././../c/././.././.")" = "x://y/" &&
+	! test-tool urlmatch-normalization "x://y/a/./b/.././../c/././.././.." &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/./?/././..")" = "x://y/a/?/././.." &&
+	test "$(test-tool urlmatch-normalization -p "x://y/%2e/")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/%2E/")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/a/%2e./")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/b/.%2E/")" = "x://y/" &&
+	test "$(test-tool urlmatch-normalization -p "x://y/c/%2e%2E/")" = "x://y/"
 '
 
 # http://@foo specifies an empty user name but does not specify a password
 # http://foo  specifies neither a user name nor a password
 # So they should not be equivalent
 test_expect_success 'url equivalents' '
-	test-urlmatch-normalization "httP://x" "Http://X/" &&
-	test-urlmatch-normalization "Http://%4d%65:%4d^%70@The.Host" "hTTP://Me:%4D^p@the.HOST:80/" &&
-	! test-urlmatch-normalization "https://@x.y/^" "httpS://x.y:443/^" &&
-	test-urlmatch-normalization "https://@x.y/^" "httpS://@x.y:0443/^" &&
-	test-urlmatch-normalization "https://@x.y/^/../abc" "httpS://@x.y:0443/abc" &&
-	test-urlmatch-normalization "https://@x.y/^/.." "httpS://@x.y:0443/"
+	test-tool urlmatch-normalization "httP://x" "Http://X/" &&
+	test-tool urlmatch-normalization "Http://%4d%65:%4d^%70@The.Host" "hTTP://Me:%4D^p@the.HOST:80/" &&
+	! test-tool urlmatch-normalization "https://@x.y/^" "httpS://x.y:443/^" &&
+	test-tool urlmatch-normalization "https://@x.y/^" "httpS://@x.y:0443/^" &&
+	test-tool urlmatch-normalization "https://@x.y/^/../abc" "httpS://@x.y:0443/abc" &&
+	test-tool urlmatch-normalization "https://@x.y/^/.." "httpS://@x.y:0443/"
 '
 
 test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 35/36] t/helper: merge test-wildmatch into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (33 preceding siblings ...)
  2018-03-24  7:45   ` [PATCH v2 34/36] t/helper: merge test-urlmatch-normalization " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:45   ` Nguyễn Thái Ngọc Duy
  2018-03-24  7:45   ` [PATCH v2 36/36] t/helper: merge test-write-cache " Nguyễn Thái Ngọc Duy
                     ` (3 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:45 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                  |  2 +-
 t/helper/test-tool.c      |  1 +
 t/helper/test-tool.h      |  1 +
 t/helper/test-wildmatch.c |  3 ++-
 t/t3070-wildmatch.sh      | 14 +++++++-------
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 7923ec3747..2ab76c6838 100644
--- a/Makefile
+++ b/Makefile
@@ -685,6 +685,7 @@ 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_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@@ -694,7 +695,6 @@ TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-write-cache
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
-TEST_PROGRAMS_NEED_X += test-wildmatch
 
 TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index b3d84fdac9..a804e64048 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -40,6 +40,7 @@ static struct test_cmd cmds[] = {
 	{ "submodule-config", cmd__submodule_config },
 	{ "subprocess", cmd__subprocess },
 	{ "urlmatch-normalization", cmd__urlmatch_normalization },
+	{ "wildmatch", cmd__wildmatch },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index fa53c82659..84c583e68f 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -34,5 +34,6 @@ int cmd__string_list(int argc, const char **argv);
 int cmd__submodule_config(int argc, const char **argv);
 int cmd__subprocess(int argc, const char **argv);
 int cmd__urlmatch_normalization(int argc, const char **argv);
+int cmd__wildmatch(int argc, const char **argv);
 
 #endif
diff --git a/t/helper/test-wildmatch.c b/t/helper/test-wildmatch.c
index 66d33dfcfd..2c103d1824 100644
--- a/t/helper/test-wildmatch.c
+++ b/t/helper/test-wildmatch.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int argc, const char **argv)
+int cmd__wildmatch(int argc, const char **argv)
 {
 	int i;
 	for (i = 2; i < argc; i++) {
diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
index c1fc6ca730..dce102130f 100755
--- a/t/t3070-wildmatch.sh
+++ b/t/t3070-wildmatch.sh
@@ -79,12 +79,12 @@ match_with_function() {
 	if test "$match_expect" = 1
 	then
 		test_expect_success "$match_function: match '$text' '$pattern'" "
-			test-wildmatch $match_function '$text' '$pattern'
+			test-tool wildmatch $match_function '$text' '$pattern'
 		"
 	elif test "$match_expect" = 0
 	then
 		test_expect_success "$match_function: no match '$text' '$pattern'" "
-			test_must_fail test-wildmatch $match_function '$text' '$pattern'
+			test_must_fail test-tool wildmatch $match_function '$text' '$pattern'
 		"
 	else
 		test_expect_success "PANIC: Test framework error. Unknown matches value $match_expect" 'false'
@@ -148,7 +148,7 @@ match_with_ls_files() {
 match() {
 	if test "$#" = 6
 	then
-		# When test-wildmatch and git ls-files produce the same
+		# When test-tool wildmatch and git ls-files produce the same
 		# result.
 		match_glob=$1
 		match_file_glob=$match_glob
@@ -204,19 +204,19 @@ match() {
 		fi
 	'
 
-	# $1: Case sensitive glob match: test-wildmatch & ls-files
+	# $1: Case sensitive glob match: test-tool wildmatch & ls-files
 	match_with_function "$text" "$pattern" $match_glob "wildmatch"
 	match_with_ls_files "$text" "$pattern" $match_file_glob "wildmatch" " --glob-pathspecs"
 
-	# $2: Case insensitive glob match: test-wildmatch & ls-files
+	# $2: Case insensitive glob match: test-tool wildmatch & ls-files
 	match_with_function "$text" "$pattern" $match_iglob "iwildmatch"
 	match_with_ls_files "$text" "$pattern" $match_file_iglob "iwildmatch" " --glob-pathspecs --icase-pathspecs"
 
-	# $3: Case sensitive path match: test-wildmatch & ls-files
+	# $3: Case sensitive path match: test-tool wildmatch & ls-files
 	match_with_function "$text" "$pattern" $match_pathmatch "pathmatch"
 	match_with_ls_files "$text" "$pattern" $match_file_pathmatch "pathmatch" ""
 
-	# $4: Case insensitive path match: test-wildmatch & ls-files
+	# $4: Case insensitive path match: test-tool wildmatch & ls-files
 	match_with_function "$text" "$pattern" $match_pathmatchi "ipathmatch"
 	match_with_ls_files "$text" "$pattern" $match_file_pathmatchi "ipathmatch" " --icase-pathspecs"
 }
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* [PATCH v2 36/36] t/helper: merge test-write-cache into test-tool
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (34 preceding siblings ...)
  2018-03-24  7:45   ` [PATCH v2 35/36] t/helper: merge test-wildmatch " Nguyễn Thái Ngọc Duy
@ 2018-03-24  7:45   ` Nguyễn Thái Ngọc Duy
  2018-03-24 12:50   ` [PATCH v2 00/36] Combine t/helper binaries into a single one Ævar Arnfjörð Bjarmason
                     ` (2 subsequent siblings)
  38 siblings, 0 replies; 110+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-03-24  7:45 UTC (permalink / raw)
  To: pclouds; +Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile                    | 2 +-
 t/helper/test-tool.c        | 1 +
 t/helper/test-tool.h        | 1 +
 t/helper/test-write-cache.c | 3 ++-
 t/perf/p0007-write-cache.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 2ab76c6838..8ad9a2a1a9 100644
--- a/Makefile
+++ b/Makefile
@@ -686,13 +686,13 @@ 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-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-parse-options
-TEST_PROGRAMS_NEED_X += test-write-cache
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
 
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index a804e64048..cd5e28b045 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -41,6 +41,7 @@ static struct test_cmd cmds[] = {
 	{ "subprocess", cmd__subprocess },
 	{ "urlmatch-normalization", cmd__urlmatch_normalization },
 	{ "wildmatch", cmd__wildmatch },
+	{ "write-cache", cmd__write_cache },
 };
 
 int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 84c583e68f..7116ddfb94 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -35,5 +35,6 @@ int cmd__submodule_config(int argc, const char **argv);
 int cmd__subprocess(int argc, const char **argv);
 int cmd__urlmatch_normalization(int argc, const char **argv);
 int cmd__wildmatch(int argc, const char **argv);
+int cmd__write_cache(int argc, const char **argv);
 
 #endif
diff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c
index b7ee039669..017dc30380 100644
--- a/t/helper/test-write-cache.c
+++ b/t/helper/test-write-cache.c
@@ -1,9 +1,10 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "lockfile.h"
 
 static struct lock_file index_lock;
 
-int cmd_main(int argc, const char **argv)
+int cmd__write_cache(int argc, const char **argv)
 {
 	int i, cnt = 1, lockfd;
 	if (argc == 2)
diff --git a/t/perf/p0007-write-cache.sh b/t/perf/p0007-write-cache.sh
index 261fe92fd9..09595264f0 100755
--- a/t/perf/p0007-write-cache.sh
+++ b/t/perf/p0007-write-cache.sh
@@ -23,7 +23,7 @@ test_expect_success "setup repo" '
 
 count=3
 test_perf "write_locked_index $count times ($nr_files files)" "
-	test-write-cache $count
+	test-tool write-cache $count
 "
 
 test_done
-- 
2.17.0.rc0.348.gd5a49e0b6f


^ permalink raw reply related	[flat|nested] 110+ messages in thread

* Re: [PATCH v4 3/7] gc: add --keep-largest-pack option
  2018-03-24  7:42   ` [PATCH v4 3/7] gc: add --keep-largest-pack option Nguyễn Thái Ngọc Duy
@ 2018-03-24  9:36     ` Ævar Arnfjörð Bjarmason
  2018-03-24 12:13       ` Duy Nguyen
  0 siblings, 1 reply; 110+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-03-24  9:36 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy
  Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano


On Sat, Mar 24 2018, Nguyễn Thái Ngọc Duy wrote:

>  	struct option builtin_gc_options[] = {
>  		OPT__QUIET(&quiet, N_("suppress progress reporting")),
> @@ -362,6 +390,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
>  		OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
>  		OPT_BOOL(0, "auto", &auto_gc, N_("enable auto-gc mode")),
>  		OPT_BOOL(0, "force", &force, N_("force running gc even if there may be another gc running")),
> +		OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
> +			 N_("repack all other packs except the largest pack")),
>  		OPT_END()
>  	};

This conflicts with master because of your own 7e1eeaa431 ("completion:
use __gitcomp_builtin in _git_gc", 2018-02-09). I pushed out a
avar-pclouds/gc-auto-keep-base-pack branch to github.com/avar/git which
resolves it as:

    @@ -365,6 +393,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                    OPT_BOOL_F(0, "force", &force,
                               N_("force running gc even if there may be another gc running"),
                               PARSE_OPT_NOCOMPLETE),
    +               OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
    +                        N_("repack all other packs except the largest pack")),
                    OPT_END()
            };

I assume that's the intention here.

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v4 3/7] gc: add --keep-largest-pack option
  2018-03-24  9:36     ` Ævar Arnfjörð Bjarmason
@ 2018-03-24 12:13       ` Duy Nguyen
  2018-03-26  2:05         ` Junio C Hamano
  0 siblings, 1 reply; 110+ messages in thread
From: Duy Nguyen @ 2018-03-24 12:13 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Git Mailing List, Eric Sunshine, Jeff Hostetler, Junio C Hamano

On Sat, Mar 24, 2018 at 10:36 AM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
> On Sat, Mar 24 2018, Nguyễn Thái Ngọc Duy wrote:
>
>>       struct option builtin_gc_options[] = {
>>               OPT__QUIET(&quiet, N_("suppress progress reporting")),
>> @@ -362,6 +390,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
>>               OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
>>               OPT_BOOL(0, "auto", &auto_gc, N_("enable auto-gc mode")),
>>               OPT_BOOL(0, "force", &force, N_("force running gc even if there may be another gc running")),
>> +             OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
>> +                      N_("repack all other packs except the largest pack")),
>>               OPT_END()
>>       };
>
> This conflicts with master because of your own 7e1eeaa431 ("completion:
> use __gitcomp_builtin in _git_gc", 2018-02-09). I pushed out a
> avar-pclouds/gc-auto-keep-base-pack branch to github.com/avar/git which
> resolves it as:
>
>     @@ -365,6 +393,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
>                     OPT_BOOL_F(0, "force", &force,
>                                N_("force running gc even if there may be another gc running"),
>                                PARSE_OPT_NOCOMPLETE),
>     +               OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
>     +                        N_("repack all other packs except the largest pack")),
>                     OPT_END()
>             };
>
> I assume that's the intention here.

Yeah, I want  to keep the same base for easy interdiff. There are
worse conflicts are with the other series I'm helping Stefan.
-- 
Duy

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 00/36] Combine t/helper binaries into a single one
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (35 preceding siblings ...)
  2018-03-24  7:45   ` [PATCH v2 36/36] t/helper: merge test-write-cache " Nguyễn Thái Ngọc Duy
@ 2018-03-24 12:50   ` Ævar Arnfjörð Bjarmason
  2018-03-24 12:57     ` Duy Nguyen
  2018-03-26  2:16   ` Junio C Hamano
  2018-03-27 14:00   ` Johannes Schindelin
  38 siblings, 1 reply; 110+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-03-24 12:50 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy
  Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano


On Sat, Mar 24 2018, Nguyễn Thái Ngọc Duy wrote:

> v2 fixes a couple of typos in commit messages and use the cmd__ prefix
> for test commands instead of test_, which avoids a naming conflict
> with the existing function test_lazy_init_name_hash
>
> [the previous v2 send out was aborted because I messed it up with some
> other patches]

This whole thing looks good to me, and I've applied it to my own build
and run several modes (normal, split index etc.) of the test suite with
it. Didn't get any problems.

Micronit: If you M-x sort-lines (and I assume similar in other editors
that have a function to sort stuff in ASCII order) the test-tool.c list
you get this diff on top:

    diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
    index cd5e28b045..c38939b93e 100644
    --- a/t/helper/test-tool.c
    +++ b/t/helper/test-tool.c
    @@ -32,8 +32,8 @@ static struct test_cmd cmds[] = {
            { "revision-walking", cmd__revision_walking },
            { "run-command", cmd__run_command },
            { "scrap-cache-tree", cmd__scrap_cache_tree },
    -       { "sha1-array", cmd__sha1_array },
            { "sha1", cmd__sha1 },
    +       { "sha1-array", cmd__sha1_array },
            { "sigchain", cmd__sigchain },
            { "strcmp-offset", cmd__strcmp_offset },
            { "string-list", cmd__string_list },

I think it makes sense to keep such lists in ASCII order (" before -)
for subsequent edits where one or more things are added to the list and
then sorted before submission.

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 00/36] Combine t/helper binaries into a single one
  2018-03-24 12:50   ` [PATCH v2 00/36] Combine t/helper binaries into a single one Ævar Arnfjörð Bjarmason
@ 2018-03-24 12:57     ` Duy Nguyen
  0 siblings, 0 replies; 110+ messages in thread
From: Duy Nguyen @ 2018-03-24 12:57 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Git Mailing List, Eric Sunshine, Jeff Hostetler, Junio C Hamano

On Sat, Mar 24, 2018 at 1:50 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
> On Sat, Mar 24 2018, Nguyễn Thái Ngọc Duy wrote:
>
>> v2 fixes a couple of typos in commit messages and use the cmd__ prefix
>> for test commands instead of test_, which avoids a naming conflict
>> with the existing function test_lazy_init_name_hash
>>
>> [the previous v2 send out was aborted because I messed it up with some
>> other patches]
>
> This whole thing looks good to me, and I've applied it to my own build
> and run several modes (normal, split index etc.) of the test suite with
> it. Didn't get any problems.
>
> Micronit: If you M-x sort-lines (and I assume similar in other editors
> that have a function to sort stuff in ASCII order) the test-tool.c list
> you get this diff on top:
>
>     diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
>     index cd5e28b045..c38939b93e 100644
>     --- a/t/helper/test-tool.c
>     +++ b/t/helper/test-tool.c
>     @@ -32,8 +32,8 @@ static struct test_cmd cmds[] = {
>             { "revision-walking", cmd__revision_walking },
>             { "run-command", cmd__run_command },
>             { "scrap-cache-tree", cmd__scrap_cache_tree },
>     -       { "sha1-array", cmd__sha1_array },
>             { "sha1", cmd__sha1 },
>     +       { "sha1-array", cmd__sha1_array },
>             { "sigchain", cmd__sigchain },
>             { "strcmp-offset", cmd__strcmp_offset },
>             { "string-list", cmd__string_list },
>
> I think it makes sense to keep such lists in ASCII order (" before -)
> for subsequent edits where one or more things are added to the list and
> then sorted before submission.

Yeah, my brain just failed to see that sha1-array should be behind
sha1. Bad brain!
-- 
Duy

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v4 3/7] gc: add --keep-largest-pack option
  2018-03-24 12:13       ` Duy Nguyen
@ 2018-03-26  2:05         ` Junio C Hamano
  0 siblings, 0 replies; 110+ messages in thread
From: Junio C Hamano @ 2018-03-26  2:05 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Ævar Arnfjörð Bjarmason, Git Mailing List,
	Eric Sunshine, Jeff Hostetler

Duy Nguyen <pclouds@gmail.com> writes:

>> This conflicts with master because of your own 7e1eeaa431 ("completion:
>> use __gitcomp_builtin in _git_gc", 2018-02-09). I pushed out a
>> avar-pclouds/gc-auto-keep-base-pack branch to github.com/avar/git which
>> resolves it as:
>>
>>     @@ -365,6 +393,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
>>                     OPT_BOOL_F(0, "force", &force,
>>                                N_("force running gc even if there may be another gc running"),
>>                                PARSE_OPT_NOCOMPLETE),
>>     +               OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
>>     +                        N_("repack all other packs except the largest pack")),
>>                     OPT_END()
>>             };
>>
>> I assume that's the intention here.
>
> Yeah, I want  to keep the same base for easy interdiff. There are
> worse conflicts are with the other series I'm helping Stefan.

Right now there are a couple of topics that wants to touch options
array and also the builtins command table, which are both good
examples of "central registry" that everybody needs to touch and are
bound to become a source of conflict.  Until I scream (and I try
hard not to have to), contributors should not have to worry too much
about causing conflicts---being traffic cop and directing orderly
integration of these topics is what the maintainer(s) do.

Thanks.

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 00/36] Combine t/helper binaries into a single one
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (36 preceding siblings ...)
  2018-03-24 12:50   ` [PATCH v2 00/36] Combine t/helper binaries into a single one Ævar Arnfjörð Bjarmason
@ 2018-03-26  2:16   ` Junio C Hamano
  2018-03-27 14:00   ` Johannes Schindelin
  38 siblings, 0 replies; 110+ messages in thread
From: Junio C Hamano @ 2018-03-26  2:16 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Eric Sunshine, Jeff Hostetler

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> v2 fixes a couple of typos in commit messages and use the cmd__ prefix
> for test commands instead of test_, which avoids a naming conflict
> with the existing function test_lazy_init_name_hash
>
> [the previous v2 send out was aborted because I messed it up with some
> other patches]

Yeah, I was wondering if the 7 v4 patches for --keep-pack should be
picked up, or I should just wait for a proper resubmission under its
own cover letter.

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 01/36] t/helper: add an empty test-tool program
  2018-03-24  7:44   ` [PATCH v2 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
@ 2018-03-26 15:27     ` Johannes Schindelin
  2018-03-26 17:09       ` Duy Nguyen
  0 siblings, 1 reply; 110+ messages in thread
From: Johannes Schindelin @ 2018-03-26 15:27 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy
  Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]

Hi Duy,

On Sat, 24 Mar 2018, Nguyễn Thái Ngọc Duy wrote:

> diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
> new file mode 100644
> index 0000000000..c730f718ca
> --- /dev/null
> +++ b/t/helper/test-tool.c
> @@ -0,0 +1,27 @@
> +#include "git-compat-util.h"
> +#include "test-tool.h"
> +
> +struct test_cmd {
> +	const char *name;
> +	int (*main)(int argc, const char **argv);

This makes the build fail on Windows, as we override `main` in
compat/mingw.h:

	/*
	 * A replacement of main() that adds win32 specific initialization.
	 */

	void mingw_startup(void);
	#define main(c,v) dummy_decl_mingw_main(void); \
	static int mingw_main(c,v); \
	int main(int argc, const char **argv) \
	{ \
		mingw_startup(); \
		return mingw_main(__argc, (void *)__argv); \
	} \
	static int mingw_main(c,v)


I know, I know, now that common-main.c is a thing, we could simply pluck a
`platform_specific_pre_main()` or some such, which is overridden in
compat/mingw.h to `mingw_startup` and to a no-op in git-compat-util.h as a
fall-back.

The truth is: I simply did not get around to doing this yet.

In the meantime, could we have this SQUASH???, please?

-- snipsnap --
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index cd5e28b045a..87066ced62a 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -3,7 +3,7 @@
 
 struct test_cmd {
 	const char *name;
-	int (*main)(int argc, const char **argv);
+	int (*fn)(int argc, const char **argv);
 };
 
 static struct test_cmd cmds[] = {
@@ -55,7 +55,7 @@ int cmd_main(int argc, const char **argv)
 		if (!strcmp(cmds[i].name, argv[1])) {
 			argv++;
 			argc--;
-			return cmds[i].main(argc, argv);
+			return cmds[i].fn(argc, argv);
 		}
 	}
 	die("There is no test named '%s'", argv[1]);

^ permalink raw reply related	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 01/36] t/helper: add an empty test-tool program
  2018-03-26 15:27     ` Johannes Schindelin
@ 2018-03-26 17:09       ` Duy Nguyen
  2018-03-26 22:14         ` Johannes Schindelin
  0 siblings, 1 reply; 110+ messages in thread
From: Duy Nguyen @ 2018-03-26 17:09 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Git Mailing List, Eric Sunshine, Jeff Hostetler, Junio C Hamano

On Mon, Mar 26, 2018 at 5:27 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi Duy,
>
> On Sat, 24 Mar 2018, Nguyễn Thái Ngọc Duy wrote:
>
>> diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
>> new file mode 100644
>> index 0000000000..c730f718ca
>> --- /dev/null
>> +++ b/t/helper/test-tool.c
>> @@ -0,0 +1,27 @@
>> +#include "git-compat-util.h"
>> +#include "test-tool.h"
>> +
>> +struct test_cmd {
>> +     const char *name;
>> +     int (*main)(int argc, const char **argv);
>
> This makes the build fail on Windows, as we override `main` in
> compat/mingw.h:

Sigh.. not complaining, but I wish somebody tries to compile git with
wine (and automate it in travis). This way we could at least cover the
compilation part for all major platforms. Probably too small for a
GSoC (and making the test suite pass with wine may be too large for
GSoC)
-- 
Duy

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 01/36] t/helper: add an empty test-tool program
  2018-03-26 17:09       ` Duy Nguyen
@ 2018-03-26 22:14         ` Johannes Schindelin
  2018-03-26 23:07           ` SZEDER Gábor
  0 siblings, 1 reply; 110+ messages in thread
From: Johannes Schindelin @ 2018-03-26 22:14 UTC (permalink / raw)
  To: Duy Nguyen, SZEDER Gábor
  Cc: Git Mailing List, Eric Sunshine, Jeff Hostetler, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

Hi Duy,

On Mon, 26 Mar 2018, Duy Nguyen wrote:

> On Mon, Mar 26, 2018 at 5:27 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Sat, 24 Mar 2018, Nguyễn Thái Ngọc Duy wrote:
> >
> >> diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
> >> new file mode 100644
> >> index 0000000000..c730f718ca
> >> --- /dev/null
> >> +++ b/t/helper/test-tool.c
> >> @@ -0,0 +1,27 @@
> >> +#include "git-compat-util.h"
> >> +#include "test-tool.h"
> >> +
> >> +struct test_cmd {
> >> +     const char *name;
> >> +     int (*main)(int argc, const char **argv);
> >
> > This makes the build fail on Windows, as we override `main` in
> > compat/mingw.h:
> 
> Sigh.. not complaining, but I wish somebody tries to compile git with
> wine (and automate it in travis). This way we could at least cover the
> compilation part for all major platforms. Probably too small for a
> GSoC (and making the test suite pass with wine may be too large for
> GSoC)

We do have Continuous Testing of maint, master, next & pu.

However, it seems that something is off, as
ba5bec9589e9eefe2446044657963e25b7c8d88e is reported as fine on Windows:
https://travis-ci.org/git/git/jobs/358260023 (while there is clearly a red
X next to that commit in
https://github.com/git/git/commits/ba5bec9589e9eefe2446044657963e25b7c8d88e,
that X is due to a hiccup on macOS).

It seems that the good-trees feature for Travis does not quite work as
intended. Gábor?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 01/36] t/helper: add an empty test-tool program
  2018-03-26 22:14         ` Johannes Schindelin
@ 2018-03-26 23:07           ` SZEDER Gábor
  2018-03-27 13:57             ` Johannes Schindelin
  0 siblings, 1 reply; 110+ messages in thread
From: SZEDER Gábor @ 2018-03-26 23:07 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Duy Nguyen, Git Mailing List, Eric Sunshine, Jeff Hostetler,
	Junio C Hamano

On Tue, Mar 27, 2018 at 12:14 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> However, it seems that something is off, as
> ba5bec9589e9eefe2446044657963e25b7c8d88e is reported as fine on Windows:
> https://travis-ci.org/git/git/jobs/358260023 (while there is clearly a red
> X next to that commit in
> https://github.com/git/git/commits/ba5bec9589e9eefe2446044657963e25b7c8d88e,
> that X is due to a hiccup on macOS).
>
> It seems that the good-trees feature for Travis does not quite work as
> intended. Gábor?

AFAICT it works as expected.

When a build job encounters a commit with a tree that has previously
been built and tested successfully, then first it says so, like this:

  https://travis-ci.org/szeder/git/jobs/347295038#L635

and then skips the rest of the build job (see the 'exit 0' a few lines
later).

In case of this Windows build job we haven't seen this tree yet:

  https://travis-ci.org/git/git/jobs/358260023#L467

so the build job continues as usual (see the 'test -z Windows' two lines
later).

Unfortunately, I have no idea about how the rest of the Windows build
job is supposed to work...

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 01/36] t/helper: add an empty test-tool program
  2018-03-26 23:07           ` SZEDER Gábor
@ 2018-03-27 13:57             ` Johannes Schindelin
  0 siblings, 0 replies; 110+ messages in thread
From: Johannes Schindelin @ 2018-03-27 13:57 UTC (permalink / raw)
  To: SZEDER Gábor
  Cc: Duy Nguyen, Git Mailing List, Eric Sunshine, Jeff Hostetler,
	Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 1528 bytes --]

Hi Gábor,

On Tue, 27 Mar 2018, SZEDER Gábor wrote:

> On Tue, Mar 27, 2018 at 12:14 AM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > However, it seems that something is off, as
> > ba5bec9589e9eefe2446044657963e25b7c8d88e is reported as fine on Windows:
> > https://travis-ci.org/git/git/jobs/358260023 (while there is clearly a red
> > X next to that commit in
> > https://github.com/git/git/commits/ba5bec9589e9eefe2446044657963e25b7c8d88e,
> > that X is due to a hiccup on macOS).
> >
> > It seems that the good-trees feature for Travis does not quite work as
> > intended. Gábor?
> 
> AFAICT it works as expected.
> 
> When a build job encounters a commit with a tree that has previously
> been built and tested successfully, then first it says so, like this:
> 
>   https://travis-ci.org/szeder/git/jobs/347295038#L635

But what if it has not been built successfully (as was the case here)?
This very commit that is "succeeding" on Travis fails to compile on
Windows.

> and then skips the rest of the build job (see the 'exit 0' a few lines
> later).
> 
> In case of this Windows build job we haven't seen this tree yet:
> 
>   https://travis-ci.org/git/git/jobs/358260023#L467
> 
> so the build job continues as usual (see the 'test -z Windows' two lines
> later).
> 
> Unfortunately, I have no idea about how the rest of the Windows build
> job is supposed to work...

Maybe Travis timed out waiting for the result, and marked it as a success?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 00/36] Combine t/helper binaries into a single one
  2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
                     ` (37 preceding siblings ...)
  2018-03-26  2:16   ` Junio C Hamano
@ 2018-03-27 14:00   ` Johannes Schindelin
  2018-03-27 15:42     ` Junio C Hamano
  38 siblings, 1 reply; 110+ messages in thread
From: Johannes Schindelin @ 2018-03-27 14:00 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy
  Cc: git, Eric Sunshine, Jeff Hostetler, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

Hi Duy,

On Sat, 24 Mar 2018, Nguyễn Thái Ngọc Duy wrote:

> v2 fixes a couple of typos in commit messages and use the cmd__ prefix
> for test commands instead of test_, which avoids a naming conflict
> with the existing function test_lazy_init_name_hash
> 
> [the previous v2 send out was aborted because I messed it up with some
> other patches]

This iteration, with the SQUASH??? I proposed (and that Junio will
hopefully pick up soon), works well on Windows.

Thank you,
Dscho

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 00/36] Combine t/helper binaries into a single one
  2018-03-27 14:00   ` Johannes Schindelin
@ 2018-03-27 15:42     ` Junio C Hamano
  2018-03-27 16:12       ` Johannes Schindelin
  0 siblings, 1 reply; 110+ messages in thread
From: Junio C Hamano @ 2018-03-27 15:42 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Nguyễn Thái Ngọc Duy, git, Eric Sunshine,
	Jeff Hostetler

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> This iteration, with the SQUASH??? I proposed (and that Junio will
> hopefully pick up soon), works well on Windows.

Thanks; is that the "call it fn, as main is macro-ed away by us?"
change?

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [PATCH v2 00/36] Combine t/helper binaries into a single one
  2018-03-27 15:42     ` Junio C Hamano
@ 2018-03-27 16:12       ` Johannes Schindelin
  0 siblings, 0 replies; 110+ messages in thread
From: Johannes Schindelin @ 2018-03-27 16:12 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Nguyễn Thái Ngọc Duy, git, Eric Sunshine,
	Jeff Hostetler

Hi Junio,

On Tue, 27 Mar 2018, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > This iteration, with the SQUASH??? I proposed (and that Junio will
> > hopefully pick up soon), works well on Windows.
> 
> Thanks; is that the "call it fn, as main is macro-ed away by us?"
> change?

Precisely.

Thanks,
Dscho

^ permalink raw reply	[flat|nested] 110+ messages in thread

end of thread, other threads:[~2018-03-27 16:13 UTC | newest]

Thread overview: 110+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-17  7:53 [PATCH 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 03/36] t/helper: merge test-sha1 " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 04/36] t/helper: merge test-lazy-init-name-hash " Nguyễn Thái Ngọc Duy
2018-03-18  2:11   ` Eric Sunshine
2018-03-18  8:25     ` Duy Nguyen
2018-03-18  8:47       ` Eric Sunshine
2018-03-19  9:40         ` Jeff Hostetler
2018-03-19 15:51           ` Duy Nguyen
2018-03-17  7:53 ` [PATCH 05/36] t/helper: merge test-config " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 06/36] t/helper: merge test-ctype " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 07/36] t/helper: merge test-date " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 08/36] t/helper: merge (unused) test-delta " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 09/36] t/helper: merge test-drop-caches " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 10/36] t/helper: merge test-dump-cache-tree " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 11/36] t/helper: merge test-dump-split-index " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 12/36] t/helper: merge test-example-decorate " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 13/36] t/helper: merge test-genrandom " Nguyễn Thái Ngọc Duy
2018-03-17  7:53 ` [PATCH 14/36] t/helper: merge test-hashmap " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 15/36] t/helper: merge test-index-version " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 16/36] t/helper: merge (unused) test-match-trees " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 17/36] t/helper: merge (unused) test-mergesort " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 18/36] t/helper: merge test-mktemp " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 19/36] t/helper: merge test-online-cpus " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 20/36] t/helper: merge test-path-utils " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 21/36] t/helper: merge test-prio-queue " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 22/36] t/helepr: merge test-read-cache " Nguyễn Thái Ngọc Duy
2018-03-18  2:21   ` Eric Sunshine
2018-03-17  7:54 ` [PATCH 23/36] t/helper: merge test-ref-store " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 24/36] t/helper: merge test-regex " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 25/36] t/helper: merge test-revision-walking " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 26/36] t/helper: merge test-run-command " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 27/36] t/helper: merge test-scrap-cache-tree " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 28/36] t/helper: merge test-sha1-array " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 29/36] t/helper: merge test-sigchain " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 30/36] t/helper: merge test-strcmp-offset " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 31/36] t/helper: merge test-string-list " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 32/36] t/helper: merge test-submodule-config " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 33/36] t/helper: merge test-subprocess " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 34/36] t/helper: merge test-urlmatch-.. " Nguyễn Thái Ngọc Duy
2018-03-18  2:32   ` Eric Sunshine
2018-03-17  7:54 ` [PATCH 35/36] t/helper: merge test-wildmatch " Nguyễn Thái Ngọc Duy
2018-03-17  7:54 ` [PATCH 36/36] t/helper: merge test-write-cache " Nguyễn Thái Ngọc Duy
2018-03-24  7:42 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v4 1/7] t7700: have closing quote of a test at the beginning of line Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v2 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v4 2/7] repack: add --keep-pack option Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v2 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v4 3/7] gc: add --keep-largest-pack option Nguyễn Thái Ngọc Duy
2018-03-24  9:36     ` Ævar Arnfjörð Bjarmason
2018-03-24 12:13       ` Duy Nguyen
2018-03-26  2:05         ` Junio C Hamano
2018-03-24  7:42   ` [PATCH v2 03/36] t/helper: merge test-sha1 into test-tool Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v4 4/7] gc: add gc.bigPackThreshold config Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v2 04/36] t/helper: merge test-lazy-init-name-hash into test-tool Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v4 5/7] gc: handle a corner case in gc.bigPackThreshold Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v2 05/36] t/helper: merge test-config into test-tool Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v4 6/7] gc --auto: exclude base pack if not enough mem to "repack -ad" Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v2 06/36] t/helper: merge test-ctype into test-tool Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v4 7/7] pack-objects: show some progress when counting kept objects Nguyễn Thái Ngọc Duy
2018-03-24  7:42   ` [PATCH v2 07/36] t/helper: merge test-date into test-tool Nguyễn Thái Ngọc Duy
2018-03-24  7:44 ` [PATCH v2 00/36] Combine t/helper binaries into a single one Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 01/36] t/helper: add an empty test-tool program Nguyễn Thái Ngọc Duy
2018-03-26 15:27     ` Johannes Schindelin
2018-03-26 17:09       ` Duy Nguyen
2018-03-26 22:14         ` Johannes Schindelin
2018-03-26 23:07           ` SZEDER Gábor
2018-03-27 13:57             ` Johannes Schindelin
2018-03-24  7:44   ` [PATCH v2 02/36] t/helper: merge test-chmtime into test-tool Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 03/36] t/helper: merge test-sha1 " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 04/36] t/helper: merge test-lazy-init-name-hash " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 05/36] t/helper: merge test-config " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 06/36] t/helper: merge test-ctype " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 07/36] t/helper: merge test-date " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 08/36] t/helper: merge (unused) test-delta " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 09/36] t/helper: merge test-drop-caches " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 10/36] t/helper: merge test-dump-cache-tree " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 11/36] t/helper: merge test-dump-split-index " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 12/36] t/helper: merge test-example-decorate " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 13/36] t/helper: merge test-genrandom " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 14/36] t/helper: merge test-hashmap " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 15/36] t/helper: merge test-index-version " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 16/36] t/helper: merge (unused) test-match-trees " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 17/36] t/helper: merge (unused) test-mergesort " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 18/36] t/helper: merge test-mktemp " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 19/36] t/helper: merge test-online-cpus " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 20/36] t/helper: merge test-path-utils " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 21/36] t/helper: merge test-prio-queue " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 22/36] t/helper: merge test-read-cache " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 23/36] t/helper: merge test-ref-store " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 24/36] t/helper: merge test-regex " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 25/36] t/helper: merge test-revision-walking " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 26/36] t/helper: merge test-run-command " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 27/36] t/helper: merge test-scrap-cache-tree " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 28/36] t/helper: merge test-sha1-array " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 29/36] t/helper: merge test-sigchain " Nguyễn Thái Ngọc Duy
2018-03-24  7:44   ` [PATCH v2 30/36] t/helper: merge test-strcmp-offset " Nguyễn Thái Ngọc Duy
2018-03-24  7:45   ` [PATCH v2 31/36] t/helper: merge test-string-list " Nguyễn Thái Ngọc Duy
2018-03-24  7:45   ` [PATCH v2 32/36] t/helper: merge test-submodule-config " Nguyễn Thái Ngọc Duy
2018-03-24  7:45   ` [PATCH v2 33/36] t/helper: merge test-subprocess " Nguyễn Thái Ngọc Duy
2018-03-24  7:45   ` [PATCH v2 34/36] t/helper: merge test-urlmatch-normalization " Nguyễn Thái Ngọc Duy
2018-03-24  7:45   ` [PATCH v2 35/36] t/helper: merge test-wildmatch " Nguyễn Thái Ngọc Duy
2018-03-24  7:45   ` [PATCH v2 36/36] t/helper: merge test-write-cache " Nguyễn Thái Ngọc Duy
2018-03-24 12:50   ` [PATCH v2 00/36] Combine t/helper binaries into a single one Ævar Arnfjörð Bjarmason
2018-03-24 12:57     ` Duy Nguyen
2018-03-26  2:16   ` Junio C Hamano
2018-03-27 14:00   ` Johannes Schindelin
2018-03-27 15:42     ` Junio C Hamano
2018-03-27 16:12       ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).