Skip to contentSkip to conversation

Merge remaining t/helper binaries to test-tool

PATCH In review Nguyễn Thái Ngọc Duy 3 participants 10 messages Sep 9, 2018 – Sep 10, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Merge remaining t/helper binaries to test-tool

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(-)
Signature · 1 line
2.19.0.rc0.337.ge906d732e7
#1 lore raw

PATCH 1/6 t/helper: keep test-tool command list sorted

---
 Makefile             | 2 +-
 t/helper/test-tool.c | 2 +-
 t/helper/test-tool.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Makefile +1 -1
index 5a969f5830..1208584fa1 100644
@@ -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
t/helper/test-tool.c +1 -1
index 0edafcfd65..79e03eecb5 100644
@@ -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 },
t/helper/test-tool.h +1 -1
index e954e8c522..4b7212827a 100644
@@ -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);
Signature · 1 line
2.19.0.rc0.337.ge906d732e7
#3 lore raw

PATCH 2/6 t/helper: merge test-dump-untracked-cache into test-tool

In reply to Nguyễn Thái Ngọc Duy
---
 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(-)
Makefile +1 -1
index 1208584fa1..fa67d76780 100644
@@ -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
t/helper/test-dump-untracked-cache.c +2 -1
index bd92fb305a..52870ebbb3 100644
@@ -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;
t/helper/test-tool.c +1 -0
index 79e03eecb5..820335704a 100644
@@ -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 },
t/helper/test-tool.h +1 -0
index 4b7212827a..118c700c7a 100644
@@ -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);
t/t7063-status-untracked-cache.sh +34 -34

221 lines not on this page · raw message

t/t7519-status-fsmonitor.sh +2 -2
index 756beb0d8e..603d27789b 100755
@@ -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 &&
Signature · 1 line
2.19.0.rc0.337.ge906d732e7
#4 lore raw

PATCH 3/6 t/helper: merge test-pkt-line into test-tool

In reply to Nguyễn Thái Ngọc Duy
---
 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(-)
Makefile +1 -1
index fa67d76780..d9a4029895 100644
@@ -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
 
t/helper/test-pkt-line.c +2 -1
index 30775f986f..282d536384 100644
@@ -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");
t/helper/test-tool.c +1 -0
index 820335704a..0ef53152c4 100644
@@ -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 },
t/helper/test-tool.h +1 -0
index 118c700c7a..7a0ac22ef7 100644
@@ -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);
t/t5701-git-serve.sh +18 -18
index 75ec79e6cb..29a54fbfff 100755
@@ -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
t/t5702-protocol-v2.sh +1 -1
index 3beeed4546..88a886975d 100755
@@ -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)
t/t5703-upload-pack-ref-in-want.sh +7 -7
index d1ccc22331..3f58f05cbb 100755
@@ -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
Signature · 1 line
2.19.0.rc0.337.ge906d732e7
#5 lore raw

PATCH 4/6 t/helper: merge test-parse-options into test-tool

In reply to Nguyễn Thái Ngọc Duy
---
 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(-)
Makefile +1 -1
index d9a4029895..1a8a7cb82d 100644
@@ -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
 
t/helper/test-parse-options.c +3 -2
index 630c76d127..9cb8a0ea0f 100644
@@ -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
t/helper/test-tool.c +1 -0
index 0ef53152c4..9cc21024e9 100644
@@ -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 },
t/helper/test-tool.h +1 -0
index 7a0ac22ef7..527722f4b0 100644
@@ -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);
t/t0040-parse-options.sh +35 -35

230 lines not on this page · raw message

Signature · 1 line
2.19.0.rc0.337.ge906d732e7
#6 lore raw

PATCH 5/6 t/helper: merge test-dump-fsmonitor into test-tool

In reply to Nguyễn Thái Ngọc Duy
---
 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(-)
Makefile +1 -1
index 1a8a7cb82d..ea7454632d 100644
@@ -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
t/helper/test-dump-fsmonitor.c +2 -1
index ad452707e8..08e3684aff 100644
@@ -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;
t/helper/test-tool.c +1 -0
index 9cc21024e9..6261c2fda0 100644
@@ -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 },
t/helper/test-tool.h +1 -0
index 527722f4b0..38da025511 100644
@@ -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);
t/t7519-status-fsmonitor.sh +5 -5
index 603d27789b..8384ad258c 100755
@@ -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
 '
Signature · 1 line
2.19.0.rc0.337.ge906d732e7
#7 lore raw

PATCH 6/6 Makefile: add a hint about TEST_BUILTINS_OBJS

In reply to Nguyễn Thái Ngọc Duy
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +2 -0
index ea7454632d..39d39257e0 100644
@@ -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
Signature · 1 line
2.19.0.rc0.337.ge906d732e7
#8 lore raw
In reply to Nguyễn Thái Ngọc Duy
Quoted 5 lines · 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.

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?

author
#9 lore raw
Quoted 10 lines · Ævar Arnfjörð Bjarmason
Quoted 5 lines · 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.

Quoted 3 lines

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?

Quoted 5 lines

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.

Signature · 1 line
Duy
#2 lore raw

Re: [PATCH 1/6] t/helper: keep test-tool command list sorted

In reply to Nguyễn Thái Ngọc Duy
Quoted 12 lines · Nguyễn Thái Ngọc Duy
---
 Makefile             | 2 +-
 t/helper/test-tool.c | 2 +-
 t/helper/test-tool.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Makefile +0 -0
index 5a969f5830..1208584fa1 100644

Makefile TEST_BUILTINS_OBJS += test-repository.o · line 736

Quoted 9 lines
Makefile +1 -1
@@ -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.

Signature · 2 lines
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204