Skip to content

Commit 77b5046

Browse files
committed
Merge branch 'nd/test-tool'
Test helper binaries clean-up. * nd/test-tool: Makefile: add a hint about TEST_BUILTINS_OBJS t/helper: merge test-dump-fsmonitor into test-tool t/helper: merge test-parse-options into test-tool t/helper: merge test-pkt-line into test-tool t/helper: merge test-dump-untracked-cache into test-tool t/helper: keep test-tool command list sorted
2 parents 3ba371f + c9a1f41 commit 77b5046

13 files changed

+128
-114
lines changed

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,9 @@ TEST_BUILTINS_OBJS += test-date.o
709709
TEST_BUILTINS_OBJS += test-delta.o
710710
TEST_BUILTINS_OBJS += test-drop-caches.o
711711
TEST_BUILTINS_OBJS += test-dump-cache-tree.o
712+
TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
712713
TEST_BUILTINS_OBJS += test-dump-split-index.o
714+
TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
713715
TEST_BUILTINS_OBJS += test-example-decorate.o
714716
TEST_BUILTINS_OBJS += test-genrandom.o
715717
TEST_BUILTINS_OBJS += test-hashmap.o
@@ -720,7 +722,9 @@ TEST_BUILTINS_OBJS += test-match-trees.o
720722
TEST_BUILTINS_OBJS += test-mergesort.o
721723
TEST_BUILTINS_OBJS += test-mktemp.o
722724
TEST_BUILTINS_OBJS += test-online-cpus.o
725+
TEST_BUILTINS_OBJS += test-parse-options.o
723726
TEST_BUILTINS_OBJS += test-path-utils.o
727+
TEST_BUILTINS_OBJS += test-pkt-line.o
724728
TEST_BUILTINS_OBJS += test-prio-queue.o
725729
TEST_BUILTINS_OBJS += test-reach.o
726730
TEST_BUILTINS_OBJS += test-read-cache.o
@@ -731,8 +735,8 @@ TEST_BUILTINS_OBJS += test-repository.o
731735
TEST_BUILTINS_OBJS += test-revision-walking.o
732736
TEST_BUILTINS_OBJS += test-run-command.o
733737
TEST_BUILTINS_OBJS += test-scrap-cache-tree.o
734-
TEST_BUILTINS_OBJS += test-sha1-array.o
735738
TEST_BUILTINS_OBJS += test-sha1.o
739+
TEST_BUILTINS_OBJS += test-sha1-array.o
736740
TEST_BUILTINS_OBJS += test-sigchain.o
737741
TEST_BUILTINS_OBJS += test-strcmp-offset.o
738742
TEST_BUILTINS_OBJS += test-string-list.o
@@ -743,12 +747,10 @@ TEST_BUILTINS_OBJS += test-wildmatch.o
743747
TEST_BUILTINS_OBJS += test-windows-named-pipe.o
744748
TEST_BUILTINS_OBJS += test-write-cache.o
745749

746-
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
747-
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
750+
# Do not add more tests here unless they have extra dependencies. Add
751+
# them in TEST_BUILTINS_OBJS above.
748752
TEST_PROGRAMS_NEED_X += test-fake-ssh
749753
TEST_PROGRAMS_NEED_X += test-line-buffer
750-
TEST_PROGRAMS_NEED_X += test-parse-options
751-
TEST_PROGRAMS_NEED_X += test-pkt-line
752754
TEST_PROGRAMS_NEED_X += test-svn-fe
753755
TEST_PROGRAMS_NEED_X += test-tool
754756

t/helper/test-dump-fsmonitor.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#include "test-tool.h"
12
#include "cache.h"
23

3-
int cmd_main(int ac, const char **av)
4+
int cmd__dump_fsmonitor(int ac, const char **av)
45
{
56
struct index_state *istate = &the_index;
67
int i;

t/helper/test-dump-untracked-cache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "test-tool.h"
12
#include "cache.h"
23
#include "dir.h"
34

@@ -38,7 +39,7 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
3839
strbuf_setlen(base, len);
3940
}
4041

41-
int cmd_main(int ac, const char **av)
42+
int cmd__dump_untracked_cache(int ac, const char **av)
4243
{
4344
struct untracked_cache *uc;
4445
struct strbuf base = STRBUF_INIT;

t/helper/test-parse-options.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "test-tool.h"
12
#include "cache.h"
23
#include "parse-options.h"
34
#include "string-list.h"
@@ -94,11 +95,11 @@ static void show(struct string_list *expect, int *status, const char *fmt, ...)
9495
strbuf_release(&buf);
9596
}
9697

97-
int cmd_main(int argc, const char **argv)
98+
int cmd__parse_options(int argc, const char **argv)
9899
{
99100
const char *prefix = "prefix/";
100101
const char *usage[] = {
101-
"test-parse-options <options>",
102+
"test-tool parse-options <options>",
102103
"",
103104
"A helper function for the parse-options API.",
104105
NULL

t/helper/test-pkt-line.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "cache.h"
2+
#include "test-tool.h"
23
#include "pkt-line.h"
34

45
static void pack_line(const char *line)
@@ -79,7 +80,7 @@ static void unpack_sideband(void)
7980
}
8081
}
8182

82-
int cmd_main(int argc, const char **argv)
83+
int cmd__pkt_line(int argc, const char **argv)
8384
{
8485
if (argc < 2)
8586
die("too few arguments");

t/helper/test-tool.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ static struct test_cmd cmds[] = {
1414
{ "delta", cmd__delta },
1515
{ "drop-caches", cmd__drop_caches },
1616
{ "dump-cache-tree", cmd__dump_cache_tree },
17+
{ "dump-fsmonitor", cmd__dump_fsmonitor },
1718
{ "dump-split-index", cmd__dump_split_index },
19+
{ "dump-untracked-cache", cmd__dump_untracked_cache },
1820
{ "example-decorate", cmd__example_decorate },
1921
{ "genrandom", cmd__genrandom },
2022
{ "hashmap", cmd__hashmap },
@@ -25,7 +27,9 @@ static struct test_cmd cmds[] = {
2527
{ "mergesort", cmd__mergesort },
2628
{ "mktemp", cmd__mktemp },
2729
{ "online-cpus", cmd__online_cpus },
30+
{ "parse-options", cmd__parse_options },
2831
{ "path-utils", cmd__path_utils },
32+
{ "pkt-line", cmd__pkt_line },
2933
{ "prio-queue", cmd__prio_queue },
3034
{ "reach", cmd__reach },
3135
{ "read-cache", cmd__read_cache },
@@ -36,8 +40,8 @@ static struct test_cmd cmds[] = {
3640
{ "revision-walking", cmd__revision_walking },
3741
{ "run-command", cmd__run_command },
3842
{ "scrap-cache-tree", cmd__scrap_cache_tree },
39-
{ "sha1-array", cmd__sha1_array },
4043
{ "sha1", cmd__sha1 },
44+
{ "sha1-array", cmd__sha1_array },
4145
{ "sigchain", cmd__sigchain },
4246
{ "strcmp-offset", cmd__strcmp_offset },
4347
{ "string-list", cmd__string_list },

t/helper/test-tool.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ int cmd__date(int argc, const char **argv);
1010
int cmd__delta(int argc, const char **argv);
1111
int cmd__drop_caches(int argc, const char **argv);
1212
int cmd__dump_cache_tree(int argc, const char **argv);
13+
int cmd__dump_fsmonitor(int argc, const char **argv);
1314
int cmd__dump_split_index(int argc, const char **argv);
15+
int cmd__dump_untracked_cache(int argc, const char **argv);
1416
int cmd__example_decorate(int argc, const char **argv);
1517
int cmd__genrandom(int argc, const char **argv);
1618
int cmd__hashmap(int argc, const char **argv);
@@ -21,7 +23,9 @@ int cmd__match_trees(int argc, const char **argv);
2123
int cmd__mergesort(int argc, const char **argv);
2224
int cmd__mktemp(int argc, const char **argv);
2325
int cmd__online_cpus(int argc, const char **argv);
26+
int cmd__parse_options(int argc, const char **argv);
2427
int cmd__path_utils(int argc, const char **argv);
28+
int cmd__pkt_line(int argc, const char **argv);
2529
int cmd__prio_queue(int argc, const char **argv);
2630
int cmd__reach(int argc, const char **argv);
2731
int cmd__read_cache(int argc, const char **argv);
@@ -32,8 +36,8 @@ int cmd__repository(int argc, const char **argv);
3236
int cmd__revision_walking(int argc, const char **argv);
3337
int cmd__run_command(int argc, const char **argv);
3438
int cmd__scrap_cache_tree(int argc, const char **argv);
35-
int cmd__sha1_array(int argc, const char **argv);
3639
int cmd__sha1(int argc, const char **argv);
40+
int cmd__sha1_array(int argc, const char **argv);
3741
int cmd__sigchain(int argc, const char **argv);
3842
int cmd__strcmp_offset(int argc, const char **argv);
3943
int cmd__string_list(int argc, const char **argv);

0 commit comments

Comments
 (0)