git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Merge remaining t/helper binaries to test-tool
@ 2018-09-09 17:36 Nguyễn Thái Ngọc Duy
  2018-09-09 17:36 ` [PATCH 1/6] t/helper: keep test-tool command list sorted Nguyễn Thái Ngọc Duy
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-09-09 17:36 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

Last time when I added test-tool in 27f25845cf (Merge branch
'nd/combined-test-helper' - 2018-04-11) I left out a few test programs
because there were a couple in-flight new tests that used them. All
those topics are merged now. So we can merge these to test-tool and
call it done.

Nguyễn Thái Ngọc Duy (6):
  t/helper: keep test-tool command list sorted
  t/helper: merge test-dump-untracked-cache into test-tool
  t/helper: merge test-pkt-line into test-tool
  t/helper: merge test-parse-options into test-tool
  t/helper: merge test-dump-fsmonitor into test-tool
  Makefile: add a hint about TEST_BUILTINS_OBJS

 Makefile                             | 12 +++--
 t/helper/test-dump-fsmonitor.c       |  3 +-
 t/helper/test-dump-untracked-cache.c |  3 +-
 t/helper/test-parse-options.c        |  5 +-
 t/helper/test-pkt-line.c             |  3 +-
 t/helper/test-tool.c                 |  6 ++-
 t/helper/test-tool.h                 |  6 ++-
 t/t0040-parse-options.sh             | 70 ++++++++++++++--------------
 t/t5701-git-serve.sh                 | 36 +++++++-------
 t/t5702-protocol-v2.sh               |  2 +-
 t/t5703-upload-pack-ref-in-want.sh   | 14 +++---
 t/t7063-status-untracked-cache.sh    | 68 +++++++++++++--------------
 t/t7519-status-fsmonitor.sh          | 14 +++---
 13 files changed, 128 insertions(+), 114 deletions(-)

-- 
2.19.0.rc0.337.ge906d732e7


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

* [PATCH 1/6] t/helper: keep test-tool command list sorted
  2018-09-09 17:36 [PATCH 0/6] Merge remaining t/helper binaries to test-tool Nguyễn Thái Ngọc Duy
@ 2018-09-09 17:36 ` Nguyễn Thái Ngọc Duy
  2018-09-09 22:24   ` brian m. carlson
  2018-09-09 17:36 ` [PATCH 2/6] t/helper: merge test-dump-untracked-cache into test-tool Nguyễn Thái Ngọc Duy
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-09-09 17:36 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 | 2 +-
 t/helper/test-tool.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 5a969f5830..1208584fa1 100644
--- a/Makefile
+++ b/Makefile
@@ -729,8 +729,8 @@ TEST_BUILTINS_OBJS += test-repository.o
 TEST_BUILTINS_OBJS += test-revision-walking.o
 TEST_BUILTINS_OBJS += test-run-command.o
 TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
-TEST_BUILTINS_OBJS += test-sha1-array.o
 TEST_BUILTINS_OBJS += test-sha1.o
+TEST_BUILTINS_OBJS += test-sha1-array.o
 TEST_BUILTINS_OBJS += test-sigchain.o
 TEST_BUILTINS_OBJS += test-strcmp-offset.o
 TEST_BUILTINS_OBJS += test-string-list.o
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 0edafcfd65..79e03eecb5 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -34,8 +34,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 },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index e954e8c522..4b7212827a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -30,8 +30,8 @@ int cmd__repository(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);
+int cmd__sha1_array(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);
-- 
2.19.0.rc0.337.ge906d732e7


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

* [PATCH 2/6] t/helper: merge test-dump-untracked-cache into test-tool
  2018-09-09 17:36 [PATCH 0/6] Merge remaining t/helper binaries to test-tool Nguyễn Thái Ngọc Duy
  2018-09-09 17:36 ` [PATCH 1/6] t/helper: keep test-tool command list sorted Nguyễn Thái Ngọc Duy
@ 2018-09-09 17:36 ` Nguyễn Thái Ngọc Duy
  2018-09-09 17:36 ` [PATCH 3/6] t/helper: merge test-pkt-line " Nguyễn Thái Ngọc Duy
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-09-09 17:36 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-untracked-cache.c |  3 +-
 t/helper/test-tool.c                 |  1 +
 t/helper/test-tool.h                 |  1 +
 t/t7063-status-untracked-cache.sh    | 68 ++++++++++++++--------------
 t/t7519-status-fsmonitor.sh          |  4 +-
 6 files changed, 41 insertions(+), 38 deletions(-)

diff --git a/Makefile b/Makefile
index 1208584fa1..fa67d76780 100644
--- a/Makefile
+++ b/Makefile
@@ -710,6 +710,7 @@ 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-dump-untracked-cache.o
 TEST_BUILTINS_OBJS += test-example-decorate.o
 TEST_BUILTINS_OBJS += test-genrandom.o
 TEST_BUILTINS_OBJS += test-hashmap.o
@@ -741,7 +742,6 @@ 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
diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index bd92fb305a..52870ebbb3 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "dir.h"
 
@@ -38,7 +39,7 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
 	strbuf_setlen(base, len);
 }
 
-int cmd_main(int ac, const char **av)
+int cmd__dump_untracked_cache(int ac, const char **av)
 {
 	struct untracked_cache *uc;
 	struct strbuf base = STRBUF_INIT;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 79e03eecb5..820335704a 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 },
+	{ "dump-untracked-cache", cmd__dump_untracked_cache },
 	{ "example-decorate", cmd__example_decorate },
 	{ "genrandom", cmd__genrandom },
 	{ "hashmap", cmd__hashmap },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 4b7212827a..118c700c7a 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -11,6 +11,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__dump_untracked_cache(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);
diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh
index 2da57fce7b..190ae149cf 100755
--- a/t/t7063-status-untracked-cache.sh
+++ b/t/t7063-status-untracked-cache.sh
@@ -55,7 +55,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'untracked cache is empty' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect-empty <<EOF &&
 info/exclude 0000000000000000000000000000000000000000
 core.excludesfile 0000000000000000000000000000000000000000
@@ -106,7 +106,7 @@ EOF
 '
 
 test_expect_success 'untracked cache after first status' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../dump.expect ../actual
 '
 
@@ -126,7 +126,7 @@ EOF
 '
 
 test_expect_success 'untracked cache after second status' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../dump.expect ../actual
 '
 
@@ -157,7 +157,7 @@ EOF
 '
 
 test_expect_success 'verify untracked cache dump' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude $EMPTY_BLOB
 core.excludesfile 0000000000000000000000000000000000000000
@@ -204,7 +204,7 @@ EOF
 '
 
 test_expect_success 'verify untracked cache dump' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude $EMPTY_BLOB
 core.excludesfile 0000000000000000000000000000000000000000
@@ -248,7 +248,7 @@ EOF
 '
 
 test_expect_success 'verify untracked cache dump' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
 core.excludesfile 0000000000000000000000000000000000000000
@@ -267,7 +267,7 @@ EOF
 
 test_expect_success 'move two from tracked to untracked' '
 	git rm --cached two &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
 core.excludesfile 0000000000000000000000000000000000000000
@@ -304,7 +304,7 @@ EOF
 '
 
 test_expect_success 'verify untracked cache dump' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
 core.excludesfile 0000000000000000000000000000000000000000
@@ -324,7 +324,7 @@ EOF
 
 test_expect_success 'move two from untracked to tracked' '
 	git add two &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
 core.excludesfile 0000000000000000000000000000000000000000
@@ -361,7 +361,7 @@ EOF
 '
 
 test_expect_success 'verify untracked cache dump' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
 core.excludesfile 0000000000000000000000000000000000000000
@@ -405,7 +405,7 @@ EOF
 '
 
 test_expect_success 'untracked cache correct after commit' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
 core.excludesfile 0000000000000000000000000000000000000000
@@ -464,7 +464,7 @@ EOF
 '
 
 test_expect_success 'untracked cache correct after status' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect <<EOF &&
 info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
 core.excludesfile 0000000000000000000000000000000000000000
@@ -532,7 +532,7 @@ EOF
 '
 
 test_expect_success 'verify untracked cache dump (sparse/subdirs)' '
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	cat >../expect-from-test-dump <<EOF &&
 info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
 core.excludesfile 0000000000000000000000000000000000000000
@@ -598,66 +598,66 @@ EOF
 
 test_expect_success '--no-untracked-cache removes the cache' '
 	git update-index --no-untracked-cache &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	echo "no untracked cache" >../expect-no-uc &&
 	test_cmp ../expect-no-uc ../actual
 '
 
 test_expect_success 'git status does not change anything' '
 	git status &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-no-uc ../actual
 '
 
 test_expect_success 'setting core.untrackedCache to true and using git status creates the cache' '
 	git config core.untrackedCache true &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-no-uc ../actual &&
 	git status &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-from-test-dump ../actual
 '
 
 test_expect_success 'using --no-untracked-cache does not fail when core.untrackedCache is true' '
 	git update-index --no-untracked-cache &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-no-uc ../actual &&
 	git update-index --untracked-cache &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-empty ../actual
 '
 
 test_expect_success 'setting core.untrackedCache to false and using git status removes the cache' '
 	git config core.untrackedCache false &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-empty ../actual &&
 	git status &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-no-uc ../actual
 '
 
 test_expect_success 'using --untracked-cache does not fail when core.untrackedCache is false' '
 	git update-index --untracked-cache &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-empty ../actual
 '
 
 test_expect_success 'setting core.untrackedCache to keep' '
 	git config core.untrackedCache keep &&
 	git update-index --untracked-cache &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-empty ../actual &&
 	git status &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-from-test-dump ../actual &&
 	git update-index --no-untracked-cache &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-no-uc ../actual &&
 	git update-index --force-untracked-cache &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-empty ../actual &&
 	git status &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	test_cmp ../expect-from-test-dump ../actual
 '
 
@@ -671,23 +671,23 @@ test_expect_success 'test ident field is working' '
 
 test_expect_success 'untracked cache survives a checkout' '
 	git commit --allow-empty -m empty &&
-	test-dump-untracked-cache >../before &&
+	test-tool dump-untracked-cache >../before &&
 	test_when_finished  "git checkout master" &&
 	git checkout -b other_branch &&
-	test-dump-untracked-cache >../after &&
+	test-tool dump-untracked-cache >../after &&
 	test_cmp ../before ../after &&
 	test_commit test &&
-	test-dump-untracked-cache >../before &&
+	test-tool dump-untracked-cache >../before &&
 	git checkout master &&
-	test-dump-untracked-cache >../after &&
+	test-tool dump-untracked-cache >../after &&
 	test_cmp ../before ../after
 '
 
 test_expect_success 'untracked cache survives a commit' '
-	test-dump-untracked-cache >../before &&
+	test-tool dump-untracked-cache >../before &&
 	git add done/two &&
 	git commit -m commit &&
-	test-dump-untracked-cache >../after &&
+	test-tool dump-untracked-cache >../after &&
 	test_cmp ../before ../after
 '
 
@@ -751,7 +751,7 @@ test_expect_success '"status" after file replacement should be clean with UC=tru
 	git checkout master &&
 	avoid_racy &&
 	status_is_clean &&
-	test-dump-untracked-cache >../actual &&
+	test-tool dump-untracked-cache >../actual &&
 	grep -F "recurse valid" ../actual >../actual.grep &&
 	cat >../expect.grep <<EOF &&
 / 0000000000000000000000000000000000000000 recurse valid
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 756beb0d8e..603d27789b 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -333,7 +333,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
 		git update-index --fsmonitor &&
 		GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace-before" \
 		git status &&
-		test-dump-untracked-cache >../before
+		test-tool dump-untracked-cache >../before
 	) &&
 	cat >>dot-git/.git/hooks/fsmonitor-test <<-\EOF &&
 	printf ".git\0"
@@ -345,7 +345,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
 		cd dot-git &&
 		GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace-after" \
 		git status &&
-		test-dump-untracked-cache >../after
+		test-tool dump-untracked-cache >../after
 	) &&
 	grep "directory invalidation" trace-before >>before &&
 	grep "directory invalidation" trace-after >>after &&
-- 
2.19.0.rc0.337.ge906d732e7


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

* [PATCH 3/6] t/helper: merge test-pkt-line into test-tool
  2018-09-09 17:36 [PATCH 0/6] Merge remaining t/helper binaries to test-tool Nguyễn Thái Ngọc Duy
  2018-09-09 17:36 ` [PATCH 1/6] t/helper: keep test-tool command list sorted Nguyễn Thái Ngọc Duy
  2018-09-09 17:36 ` [PATCH 2/6] t/helper: merge test-dump-untracked-cache into test-tool Nguyễn Thái Ngọc Duy
@ 2018-09-09 17:36 ` Nguyễn Thái Ngọc Duy
  2018-09-09 17:36 ` [PATCH 4/6] t/helper: merge test-parse-options " Nguyễn Thái Ngọc Duy
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-09-09 17:36 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-pkt-line.c           |  3 ++-
 t/helper/test-tool.c               |  1 +
 t/helper/test-tool.h               |  1 +
 t/t5701-git-serve.sh               | 36 +++++++++++++++---------------
 t/t5702-protocol-v2.sh             |  2 +-
 t/t5703-upload-pack-ref-in-want.sh | 14 ++++++------
 7 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile
index fa67d76780..d9a4029895 100644
--- a/Makefile
+++ b/Makefile
@@ -722,6 +722,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-pkt-line.o
 TEST_BUILTINS_OBJS += test-prio-queue.o
 TEST_BUILTINS_OBJS += test-read-cache.o
 TEST_BUILTINS_OBJS += test-ref-store.o
@@ -745,7 +746,6 @@ TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 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-pkt-line
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
 
diff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c
index 30775f986f..282d536384 100644
--- a/t/helper/test-pkt-line.c
+++ b/t/helper/test-pkt-line.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "test-tool.h"
 #include "pkt-line.h"
 
 static void pack_line(const char *line)
@@ -79,7 +80,7 @@ static void unpack_sideband(void)
 	}
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__pkt_line(int argc, const char **argv)
 {
 	if (argc < 2)
 		die("too few arguments");
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 820335704a..0ef53152c4 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -27,6 +27,7 @@ static struct test_cmd cmds[] = {
 	{ "mktemp", cmd__mktemp },
 	{ "online-cpus", cmd__online_cpus },
 	{ "path-utils", cmd__path_utils },
+	{ "pkt-line", cmd__pkt_line },
 	{ "prio-queue", cmd__prio_queue },
 	{ "read-cache", cmd__read_cache },
 	{ "ref-store", cmd__ref_store },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 118c700c7a..7a0ac22ef7 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -23,6 +23,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__pkt_line(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);
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index 75ec79e6cb..29a54fbfff 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -15,13 +15,13 @@ test_expect_success 'test capability advertisement' '
 	EOF
 
 	git serve --advertise-capabilities >out &&
-	test-pkt-line unpack <out >actual &&
+	test-tool pkt-line unpack <out >actual &&
 	test_cmp actual expect
 '
 
 test_expect_success 'stateless-rpc flag does not list capabilities' '
 	# Empty request
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	0000
 	EOF
 	git serve --stateless-rpc >out <in &&
@@ -33,7 +33,7 @@ test_expect_success 'stateless-rpc flag does not list capabilities' '
 '
 
 test_expect_success 'request invalid capability' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	foobar
 	0000
 	EOF
@@ -42,7 +42,7 @@ test_expect_success 'request invalid capability' '
 '
 
 test_expect_success 'request with no command' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	agent=git/test
 	0000
 	EOF
@@ -51,7 +51,7 @@ test_expect_success 'request with no command' '
 '
 
 test_expect_success 'request invalid command' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=foo
 	agent=git/test
 	0000
@@ -71,7 +71,7 @@ test_expect_success 'setup some refs and tags' '
 '
 
 test_expect_success 'basics of ls-refs' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=ls-refs
 	0000
 	EOF
@@ -88,12 +88,12 @@ test_expect_success 'basics of ls-refs' '
 	EOF
 
 	git serve --stateless-rpc <in >out &&
-	test-pkt-line unpack <out >actual &&
+	test-tool pkt-line unpack <out >actual &&
 	test_cmp actual expect
 '
 
 test_expect_success 'basic ref-prefixes' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=ls-refs
 	0001
 	ref-prefix refs/heads/master
@@ -108,12 +108,12 @@ test_expect_success 'basic ref-prefixes' '
 	EOF
 
 	git serve --stateless-rpc <in >out &&
-	test-pkt-line unpack <out >actual &&
+	test-tool pkt-line unpack <out >actual &&
 	test_cmp actual expect
 '
 
 test_expect_success 'refs/heads prefix' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=ls-refs
 	0001
 	ref-prefix refs/heads/
@@ -128,12 +128,12 @@ test_expect_success 'refs/heads prefix' '
 	EOF
 
 	git serve --stateless-rpc <in >out &&
-	test-pkt-line unpack <out >actual &&
+	test-tool pkt-line unpack <out >actual &&
 	test_cmp actual expect
 '
 
 test_expect_success 'peel parameter' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=ls-refs
 	0001
 	peel
@@ -149,12 +149,12 @@ test_expect_success 'peel parameter' '
 	EOF
 
 	git serve --stateless-rpc <in >out &&
-	test-pkt-line unpack <out >actual &&
+	test-tool pkt-line unpack <out >actual &&
 	test_cmp actual expect
 '
 
 test_expect_success 'symrefs parameter' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=ls-refs
 	0001
 	symrefs
@@ -170,12 +170,12 @@ test_expect_success 'symrefs parameter' '
 	EOF
 
 	git serve --stateless-rpc <in >out &&
-	test-pkt-line unpack <out >actual &&
+	test-tool pkt-line unpack <out >actual &&
 	test_cmp actual expect
 '
 
 test_expect_success 'sending server-options' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=ls-refs
 	server-option=hello
 	server-option=world
@@ -190,14 +190,14 @@ test_expect_success 'sending server-options' '
 	EOF
 
 	git serve --stateless-rpc <in >out &&
-	test-pkt-line unpack <out >actual &&
+	test-tool pkt-line unpack <out >actual &&
 	test_cmp actual expect
 '
 
 test_expect_success 'unexpected lines are not allowed in fetch request' '
 	git init server &&
 
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=fetch
 	0001
 	this-is-not-a-command
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 3beeed4546..88a886975d 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -334,7 +334,7 @@ test_expect_success 'even with handcrafted request, filter does not work if not
 	git -C server config uploadpack.allowfilter 0 &&
 
 	# Custom request that tries to filter even though it is not advertised.
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=fetch
 	0001
 	want $(git -C server rev-parse master)
diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
index d1ccc22331..3f58f05cbb 100755
--- a/t/t5703-upload-pack-ref-in-want.sh
+++ b/t/t5703-upload-pack-ref-in-want.sh
@@ -9,14 +9,14 @@ get_actual_refs () {
 		/wanted-refs/d
 		/0001/d
 		p
-		}' <out | test-pkt-line unpack >actual_refs
+		}' <out | test-tool pkt-line unpack >actual_refs
 }
 
 get_actual_commits () {
 	sed -n -e '/packfile/,/0000/{
 		/packfile/d
 		p
-		}' <out | test-pkt-line unpack-sideband >o.pack &&
+		}' <out | test-tool pkt-line unpack-sideband >o.pack &&
 	git index-pack o.pack &&
 	git verify-pack -v o.idx | grep commit | cut -c-40 | sort >actual_commits
 }
@@ -61,7 +61,7 @@ test_expect_success 'config controls ref-in-want advertisement' '
 '
 
 test_expect_success 'invalid want-ref line' '
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=fetch
 	0001
 	no-progress
@@ -80,7 +80,7 @@ test_expect_success 'basic want-ref' '
 	EOF
 	git rev-parse f | sort >expected_commits &&
 
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=fetch
 	0001
 	no-progress
@@ -101,7 +101,7 @@ test_expect_success 'multiple want-ref lines' '
 	EOF
 	git rev-parse c d | sort >expected_commits &&
 
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=fetch
 	0001
 	no-progress
@@ -122,7 +122,7 @@ test_expect_success 'mix want and want-ref' '
 	EOF
 	git rev-parse e f | sort >expected_commits &&
 
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=fetch
 	0001
 	no-progress
@@ -143,7 +143,7 @@ test_expect_success 'want-ref with ref we already have commit for' '
 	EOF
 	>expected_commits &&
 
-	test-pkt-line pack >in <<-EOF &&
+	test-tool pkt-line pack >in <<-EOF &&
 	command=fetch
 	0001
 	no-progress
-- 
2.19.0.rc0.337.ge906d732e7


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

* [PATCH 4/6] t/helper: merge test-parse-options into test-tool
  2018-09-09 17:36 [PATCH 0/6] Merge remaining t/helper binaries to test-tool Nguyễn Thái Ngọc Duy
                   ` (2 preceding siblings ...)
  2018-09-09 17:36 ` [PATCH 3/6] t/helper: merge test-pkt-line " Nguyễn Thái Ngọc Duy
@ 2018-09-09 17:36 ` Nguyễn Thái Ngọc Duy
  2018-09-09 17:36 ` [PATCH 5/6] t/helper: merge test-dump-fsmonitor " Nguyễn Thái Ngọc Duy
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-09-09 17:36 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-parse-options.c |  5 ++-
 t/helper/test-tool.c          |  1 +
 t/helper/test-tool.h          |  1 +
 t/t0040-parse-options.sh      | 70 +++++++++++++++++------------------
 5 files changed, 41 insertions(+), 38 deletions(-)

diff --git a/Makefile b/Makefile
index d9a4029895..1a8a7cb82d 100644
--- a/Makefile
+++ b/Makefile
@@ -721,6 +721,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-parse-options.o
 TEST_BUILTINS_OBJS += test-path-utils.o
 TEST_BUILTINS_OBJS += test-pkt-line.o
 TEST_BUILTINS_OBJS += test-prio-queue.o
@@ -745,7 +746,6 @@ TEST_BUILTINS_OBJS += test-write-cache.o
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 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-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
 
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 630c76d127..9cb8a0ea0f 100644
--- a/t/helper/test-parse-options.c
+++ b/t/helper/test-parse-options.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "parse-options.h"
 #include "string-list.h"
@@ -94,11 +95,11 @@ static void show(struct string_list *expect, int *status, const char *fmt, ...)
 	strbuf_release(&buf);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd__parse_options(int argc, const char **argv)
 {
 	const char *prefix = "prefix/";
 	const char *usage[] = {
-		"test-parse-options <options>",
+		"test-tool parse-options <options>",
 		"",
 		"A helper function for the parse-options API.",
 		NULL
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 0ef53152c4..9cc21024e9 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -26,6 +26,7 @@ static struct test_cmd cmds[] = {
 	{ "mergesort", cmd__mergesort },
 	{ "mktemp", cmd__mktemp },
 	{ "online-cpus", cmd__online_cpus },
+	{ "parse-options", cmd__parse_options },
 	{ "path-utils", cmd__path_utils },
 	{ "pkt-line", cmd__pkt_line },
 	{ "prio-queue", cmd__prio_queue },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 7a0ac22ef7..527722f4b0 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -22,6 +22,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__parse_options(int argc, const char **argv);
 int cmd__path_utils(int argc, const char **argv);
 int cmd__pkt_line(int argc, const char **argv);
 int cmd__prio_queue(int argc, const char **argv);
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 5b0560fa20..17d0c18feb 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -8,7 +8,7 @@ test_description='our own option parser'
 . ./test-lib.sh
 
 cat >expect <<\EOF
-usage: test-parse-options <options>
+usage: test-tool parse-options <options>
 
     A helper function for the parse-options API.
 
@@ -52,7 +52,7 @@ Standard options
 EOF
 
 test_expect_success 'test help' '
-	test_must_fail test-parse-options -h >output 2>output.err &&
+	test_must_fail test-tool parse-options -h >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_i18ncmp expect output
 '
@@ -64,7 +64,7 @@ check () {
 	shift &&
 	expect="$1" &&
 	shift &&
-	test-parse-options --expect="$what $expect" "$@"
+	test-tool parse-options --expect="$what $expect" "$@"
 }
 
 check_unknown_i18n() {
@@ -75,7 +75,7 @@ check_unknown_i18n() {
 		echo error: unknown switch \`${1#-}\' >expect ;;
 	esac &&
 	cat expect.err >>expect &&
-	test_must_fail test-parse-options $* >output 2>output.err &&
+	test_must_fail test-tool parse-options $* >output 2>output.err &&
 	test_must_be_empty output &&
 	test_i18ncmp expect output.err
 }
@@ -133,7 +133,7 @@ file: prefix/my.file
 EOF
 
 test_expect_success 'short options' '
-	test-parse-options -s123 -b -i 1729 -m 16k -b -vv -n -F my.file \
+	test-tool parse-options -s123 -b -i 1729 -m 16k -b -vv -n -F my.file \
 	>output 2>output.err &&
 	test_cmp expect output &&
 	test_must_be_empty output.err
@@ -153,7 +153,7 @@ file: prefix/fi.le
 EOF
 
 test_expect_success 'long options' '
-	test-parse-options --boolean --integer 1729 --magnitude 16k \
+	test-tool parse-options --boolean --integer 1729 --magnitude 16k \
 		--boolean --string2=321 --verbose --verbose --no-dry-run \
 		--abbrev=10 --file fi.le --obsolete \
 		>output 2>output.err &&
@@ -162,9 +162,9 @@ test_expect_success 'long options' '
 '
 
 test_expect_success 'missing required value' '
-	test_expect_code 129 test-parse-options -s &&
-	test_expect_code 129 test-parse-options --string &&
-	test_expect_code 129 test-parse-options --file
+	test_expect_code 129 test-tool parse-options -s &&
+	test_expect_code 129 test-tool parse-options --string &&
+	test_expect_code 129 test-tool parse-options --file
 '
 
 cat >expect <<\EOF
@@ -184,7 +184,7 @@ arg 02: --boolean
 EOF
 
 test_expect_success 'intermingled arguments' '
-	test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
+	test-tool parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
 		>output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
@@ -204,21 +204,21 @@ file: (not set)
 EOF
 
 test_expect_success 'unambiguously abbreviated option' '
-	test-parse-options --int 2 --boolean --no-bo >output 2>output.err &&
+	test-tool parse-options --int 2 --boolean --no-bo >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
 test_expect_success 'unambiguously abbreviated option with "="' '
-	test-parse-options --expect="integer: 2" --int=2
+	test-tool parse-options --expect="integer: 2" --int=2
 '
 
 test_expect_success 'ambiguously abbreviated option' '
-	test_expect_code 129 test-parse-options --strin 123
+	test_expect_code 129 test-tool parse-options --strin 123
 '
 
 test_expect_success 'non ambiguous option (after two options it abbreviates)' '
-	test-parse-options --expect="string: 123" --st 123
+	test-tool parse-options --expect="string: 123" --st 123
 '
 
 cat >typo.err <<\EOF
@@ -226,7 +226,7 @@ error: did you mean `--boolean` (with two dashes ?)
 EOF
 
 test_expect_success 'detect possible typos' '
-	test_must_fail test-parse-options -boolean >output 2>output.err &&
+	test_must_fail test-tool parse-options -boolean >output 2>output.err &&
 	test_must_be_empty output &&
 	test_cmp typo.err output.err
 '
@@ -236,13 +236,13 @@ error: did you mean `--ambiguous` (with two dashes ?)
 EOF
 
 test_expect_success 'detect possible typos' '
-	test_must_fail test-parse-options -ambiguous >output 2>output.err &&
+	test_must_fail test-tool parse-options -ambiguous >output 2>output.err &&
 	test_must_be_empty output &&
 	test_cmp typo.err output.err
 '
 
 test_expect_success 'keep some options as arguments' '
-	test-parse-options --expect="arg 00: --quux" --quux
+	test-tool parse-options --expect="arg 00: --quux" --quux
 '
 
 cat >expect <<\EOF
@@ -260,7 +260,7 @@ arg 00: foo
 EOF
 
 test_expect_success 'OPT_DATE() works' '
-	test-parse-options -t "1970-01-01 00:00:01 +0000" \
+	test-tool parse-options -t "1970-01-01 00:00:01 +0000" \
 		foo -q >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
@@ -281,13 +281,13 @@ file: (not set)
 EOF
 
 test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
-	test-parse-options --length=four -b -4 >output 2>output.err &&
+	test-tool parse-options --length=four -b -4 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
 test_expect_success 'OPT_CALLBACK() and callback errors work' '
-	test_must_fail test-parse-options --no-length >output 2>output.err &&
+	test_must_fail test-tool parse-options --no-length >output 2>output.err &&
 	test_must_be_empty output &&
 	test_must_be_empty output.err
 '
@@ -306,31 +306,31 @@ file: (not set)
 EOF
 
 test_expect_success 'OPT_BIT() and OPT_SET_INT() work' '
-	test-parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
+	test-tool parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
 test_expect_success 'OPT_NEGBIT() and OPT_SET_INT() work' '
-	test-parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
+	test-tool parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
 
 test_expect_success 'OPT_BIT() works' '
-	test-parse-options --expect="boolean: 6" -bb --or4
+	test-tool parse-options --expect="boolean: 6" -bb --or4
 '
 
 test_expect_success 'OPT_NEGBIT() works' '
-	test-parse-options --expect="boolean: 6" -bb --no-neg-or4
+	test-tool parse-options --expect="boolean: 6" -bb --no-neg-or4
 '
 
 test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
-	test-parse-options --expect="boolean: 6" + + + + + +
+	test-tool parse-options --expect="boolean: 6" + + + + + +
 '
 
 test_expect_success 'OPT_NUMBER_CALLBACK() works' '
-	test-parse-options --expect="integer: 12345" -12345
+	test-tool parse-options --expect="integer: 12345" -12345
 '
 
 cat >expect <<\EOF
@@ -347,7 +347,7 @@ file: (not set)
 EOF
 
 test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
-	test-parse-options --no-ambig >output 2>output.err &&
+	test-tool parse-options --no-ambig >output 2>output.err &&
 	test_must_be_empty output.err &&
 	test_cmp expect output
 '
@@ -358,38 +358,38 @@ list: bar
 list: baz
 EOF
 test_expect_success '--list keeps list of strings' '
-	test-parse-options --list foo --list=bar --list=baz >output &&
+	test-tool parse-options --list foo --list=bar --list=baz >output &&
 	test_cmp expect output
 '
 
 test_expect_success '--no-list resets list' '
-	test-parse-options --list=other --list=irrelevant --list=options \
+	test-tool parse-options --list=other --list=irrelevant --list=options \
 		--no-list --list=foo --list=bar --list=baz >output &&
 	test_cmp expect output
 '
 
 test_expect_success 'multiple quiet levels' '
-	test-parse-options --expect="quiet: 3" -q -q -q
+	test-tool parse-options --expect="quiet: 3" -q -q -q
 '
 
 test_expect_success 'multiple verbose levels' '
-	test-parse-options --expect="verbose: 3" -v -v -v
+	test-tool parse-options --expect="verbose: 3" -v -v -v
 '
 
 test_expect_success '--no-quiet sets --quiet to 0' '
-	test-parse-options --expect="quiet: 0" --no-quiet
+	test-tool parse-options --expect="quiet: 0" --no-quiet
 '
 
 test_expect_success '--no-quiet resets multiple -q to 0' '
-	test-parse-options --expect="quiet: 0" -q -q -q --no-quiet
+	test-tool parse-options --expect="quiet: 0" -q -q -q --no-quiet
 '
 
 test_expect_success '--no-verbose sets verbose to 0' '
-	test-parse-options --expect="verbose: 0" --no-verbose
+	test-tool parse-options --expect="verbose: 0" --no-verbose
 '
 
 test_expect_success '--no-verbose resets multiple verbose to 0' '
-	test-parse-options --expect="verbose: 0" -v -v -v --no-verbose
+	test-tool parse-options --expect="verbose: 0" -v -v -v --no-verbose
 '
 
 test_done
-- 
2.19.0.rc0.337.ge906d732e7


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

* [PATCH 5/6] t/helper: merge test-dump-fsmonitor into test-tool
  2018-09-09 17:36 [PATCH 0/6] Merge remaining t/helper binaries to test-tool Nguyễn Thái Ngọc Duy
                   ` (3 preceding siblings ...)
  2018-09-09 17:36 ` [PATCH 4/6] t/helper: merge test-parse-options " Nguyễn Thái Ngọc Duy
@ 2018-09-09 17:36 ` Nguyễn Thái Ngọc Duy
  2018-09-09 17:36 ` [PATCH 6/6] Makefile: add a hint about TEST_BUILTINS_OBJS Nguyễn Thái Ngọc Duy
  2018-09-09 18:09 ` [PATCH 0/6] Merge remaining t/helper binaries to test-tool Ævar Arnfjörð Bjarmason
  6 siblings, 0 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-09-09 17:36 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-fsmonitor.c |  3 ++-
 t/helper/test-tool.c           |  1 +
 t/helper/test-tool.h           |  1 +
 t/t7519-status-fsmonitor.sh    | 10 +++++-----
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 1a8a7cb82d..ea7454632d 100644
--- a/Makefile
+++ b/Makefile
@@ -709,6 +709,7 @@ 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-fsmonitor.o
 TEST_BUILTINS_OBJS += test-dump-split-index.o
 TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
 TEST_BUILTINS_OBJS += test-example-decorate.o
@@ -743,7 +744,6 @@ 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-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-svn-fe
diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
index ad452707e8..08e3684aff 100644
--- a/t/helper/test-dump-fsmonitor.c
+++ b/t/helper/test-dump-fsmonitor.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
 #include "cache.h"
 
-int cmd_main(int ac, const char **av)
+int cmd__dump_fsmonitor(int ac, const char **av)
 {
 	struct index_state *istate = &the_index;
 	int i;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 9cc21024e9..6261c2fda0 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-fsmonitor", cmd__dump_fsmonitor },
 	{ "dump-split-index", cmd__dump_split_index },
 	{ "dump-untracked-cache", cmd__dump_untracked_cache },
 	{ "example-decorate", cmd__example_decorate },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 527722f4b0..38da025511 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -10,6 +10,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_fsmonitor(int argc, const char **argv);
 int cmd__dump_split_index(int argc, const char **argv);
 int cmd__dump_untracked_cache(int argc, const char **argv);
 int cmd__example_decorate(int argc, const char **argv);
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 603d27789b..8384ad258c 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -84,21 +84,21 @@ test_expect_success 'setup' '
 
 # test that the fsmonitor extension is off by default
 test_expect_success 'fsmonitor extension is off by default' '
-	test-dump-fsmonitor >actual &&
+	test-tool dump-fsmonitor >actual &&
 	grep "^no fsmonitor" actual
 '
 
 # test that "update-index --fsmonitor" adds the fsmonitor extension
 test_expect_success 'update-index --fsmonitor" adds the fsmonitor extension' '
 	git update-index --fsmonitor &&
-	test-dump-fsmonitor >actual &&
+	test-tool dump-fsmonitor >actual &&
 	grep "^fsmonitor last update" actual
 '
 
 # test that "update-index --no-fsmonitor" removes the fsmonitor extension
 test_expect_success 'update-index --no-fsmonitor" removes the fsmonitor extension' '
 	git update-index --no-fsmonitor &&
-	test-dump-fsmonitor >actual &&
+	test-tool dump-fsmonitor >actual &&
 	grep "^no fsmonitor" actual
 '
 
@@ -307,9 +307,9 @@ test_expect_success 'splitting the index results in the same state' '
 	dirty_repo &&
 	git update-index --fsmonitor  &&
 	git ls-files -f >expect &&
-	test-dump-fsmonitor >&2 && echo &&
+	test-tool dump-fsmonitor >&2 && echo &&
 	git update-index --fsmonitor --split-index &&
-	test-dump-fsmonitor >&2 && echo &&
+	test-tool dump-fsmonitor >&2 && echo &&
 	git ls-files -f >actual &&
 	test_cmp expect actual
 '
-- 
2.19.0.rc0.337.ge906d732e7


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

* [PATCH 6/6] Makefile: add a hint about TEST_BUILTINS_OBJS
  2018-09-09 17:36 [PATCH 0/6] Merge remaining t/helper binaries to test-tool Nguyễn Thái Ngọc Duy
                   ` (4 preceding siblings ...)
  2018-09-09 17:36 ` [PATCH 5/6] t/helper: merge test-dump-fsmonitor " Nguyễn Thái Ngọc Duy
@ 2018-09-09 17:36 ` Nguyễn Thái Ngọc Duy
  2018-09-09 18:09 ` [PATCH 0/6] Merge remaining t/helper binaries to test-tool Ævar Arnfjörð Bjarmason
  6 siblings, 0 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-09-09 17:36 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 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index ea7454632d..39d39257e0 100644
--- a/Makefile
+++ b/Makefile
@@ -744,6 +744,8 @@ TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
 TEST_BUILTINS_OBJS += test-wildmatch.o
 TEST_BUILTINS_OBJS += test-write-cache.o
 
+# Do not add more tests here unless they have extra dependencies. Add
+# them in TEST_BUILTINS_OBJS above.
 TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-svn-fe
-- 
2.19.0.rc0.337.ge906d732e7


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

* Re: [PATCH 0/6] Merge remaining t/helper binaries to test-tool
  2018-09-09 17:36 [PATCH 0/6] Merge remaining t/helper binaries to test-tool Nguyễn Thái Ngọc Duy
                   ` (5 preceding siblings ...)
  2018-09-09 17:36 ` [PATCH 6/6] Makefile: add a hint about TEST_BUILTINS_OBJS Nguyễn Thái Ngọc Duy
@ 2018-09-09 18:09 ` Ævar Arnfjörð Bjarmason
  2018-09-09 18:24   ` Duy Nguyen
  6 siblings, 1 reply; 10+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-09-09 18:09 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git


On Sun, Sep 09 2018, Nguyễn Thái Ngọc Duy wrote:

> Last time when I added test-tool in 27f25845cf (Merge branch
> 'nd/combined-test-helper' - 2018-04-11) I left out a few test programs
> because there were a couple in-flight new tests that used them. All
> those topics are merged now. So we can merge these to test-tool and
> call it done.

This is great. Just a small side-note: Am I the only one who misses the
2.8.0 days when you could do "git clean -dxff" in the t/ directory to
clean up various test crap without breaking subsequent tests?

That went away in e6e7530d10 ("test helpers: move test-* to t/helper/
subdirectory", 2016-04-13) when we started building stuff in t/helper/.

So now that this is one binary perhaps we can build it in the root
directory and get that functionality back?

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

* Re: [PATCH 0/6] Merge remaining t/helper binaries to test-tool
  2018-09-09 18:09 ` [PATCH 0/6] Merge remaining t/helper binaries to test-tool Ævar Arnfjörð Bjarmason
@ 2018-09-09 18:24   ` Duy Nguyen
  0 siblings, 0 replies; 10+ messages in thread
From: Duy Nguyen @ 2018-09-09 18:24 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Git Mailing List

On Sun, Sep 9, 2018 at 8:09 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
>
>
> On Sun, Sep 09 2018, Nguyễn Thái Ngọc Duy wrote:
>
> > Last time when I added test-tool in 27f25845cf (Merge branch
> > 'nd/combined-test-helper' - 2018-04-11) I left out a few test programs
> > because there were a couple in-flight new tests that used them. All
> > those topics are merged now. So we can merge these to test-tool and
> > call it done.
>
> This is great. Just a small side-note: Am I the only one who misses the
> 2.8.0 days when you could do "git clean -dxff" in the t/ directory to
> clean up various test crap without breaking subsequent tests?

Isn't "make clean" (in t/) enough?

> That went away in e6e7530d10 ("test helpers: move test-* to t/helper/
> subdirectory", 2016-04-13) when we started building stuff in t/helper/.
>
> So now that this is one binary perhaps we can build it in the root
> directory and get that functionality back?

It's still a few binaries. Most of them are now merged to test-tool,
but ones that need separate program name, or have extra deps, stay
separate. Having said that, producing the binaries at root directory
is possible. I'm just not sure if it's worth doing.
-- 
Duy

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

* Re: [PATCH 1/6] t/helper: keep test-tool command list sorted
  2018-09-09 17:36 ` [PATCH 1/6] t/helper: keep test-tool command list sorted Nguyễn Thái Ngọc Duy
@ 2018-09-09 22:24   ` brian m. carlson
  0 siblings, 0 replies; 10+ messages in thread
From: brian m. carlson @ 2018-09-09 22:24 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

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

On Sun, Sep 09, 2018 at 07:36:26PM +0200, Nguyễn Thái Ngọc Duy wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  Makefile             | 2 +-
>  t/helper/test-tool.c | 2 +-
>  t/helper/test-tool.h | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 5a969f5830..1208584fa1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -729,8 +729,8 @@ TEST_BUILTINS_OBJS += test-repository.o
>  TEST_BUILTINS_OBJS += test-revision-walking.o
>  TEST_BUILTINS_OBJS += test-run-command.o
>  TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
> -TEST_BUILTINS_OBJS += test-sha1-array.o
>  TEST_BUILTINS_OBJS += test-sha1.o
> +TEST_BUILTINS_OBJS += test-sha1-array.o
>  TEST_BUILTINS_OBJS += test-sigchain.o
>  TEST_BUILTINS_OBJS += test-strcmp-offset.o
>  TEST_BUILTINS_OBJS += test-string-list.o

Thanks for fixing this.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

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

end of thread, other threads:[~2018-09-10  3:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-09 17:36 [PATCH 0/6] Merge remaining t/helper binaries to test-tool Nguyễn Thái Ngọc Duy
2018-09-09 17:36 ` [PATCH 1/6] t/helper: keep test-tool command list sorted Nguyễn Thái Ngọc Duy
2018-09-09 22:24   ` brian m. carlson
2018-09-09 17:36 ` [PATCH 2/6] t/helper: merge test-dump-untracked-cache into test-tool Nguyễn Thái Ngọc Duy
2018-09-09 17:36 ` [PATCH 3/6] t/helper: merge test-pkt-line " Nguyễn Thái Ngọc Duy
2018-09-09 17:36 ` [PATCH 4/6] t/helper: merge test-parse-options " Nguyễn Thái Ngọc Duy
2018-09-09 17:36 ` [PATCH 5/6] t/helper: merge test-dump-fsmonitor " Nguyễn Thái Ngọc Duy
2018-09-09 17:36 ` [PATCH 6/6] Makefile: add a hint about TEST_BUILTINS_OBJS Nguyễn Thái Ngọc Duy
2018-09-09 18:09 ` [PATCH 0/6] Merge remaining t/helper binaries to test-tool Ævar Arnfjörð Bjarmason
2018-09-09 18:24   ` Duy Nguyen

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 NNTP newsgroup(s).