t/helper: merge test-pkt-line into test-tool

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

Nguyễn Thái Ngọc Duy committed Sep 9, 2018 at 19:36 UTC 8ea40cc55d716e4fb2821c2ec2e55aa2a5220ba6
7 files changed +31 -28
Makefile
+1 -1
@@ -722,6 +722,7 @@ TEST_BUILTINS_OBJS += test-mergesort.o
722 TEST_BUILTINS_OBJS += test-mktemp.o
723 TEST_BUILTINS_OBJS += test-online-cpus.o
724 TEST_BUILTINS_OBJS += test-path-utils.o
725 +TEST_BUILTINS_OBJS += test-pkt-line.o
726 TEST_BUILTINS_OBJS += test-prio-queue.o
727 TEST_BUILTINS_OBJS += test-read-cache.o
728 TEST_BUILTINS_OBJS += test-ref-store.o
@@ -745,7 +746,6 @@ TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
746 TEST_PROGRAMS_NEED_X += test-fake-ssh
747 TEST_PROGRAMS_NEED_X += test-line-buffer
748 TEST_PROGRAMS_NEED_X += test-parse-options
748 -TEST_PROGRAMS_NEED_X += test-pkt-line
749 TEST_PROGRAMS_NEED_X += test-svn-fe
750 TEST_PROGRAMS_NEED_X += test-tool
751
t/helper/test-pkt-line.c
+2 -1
@@ -1,4 +1,5 @@
1 #include "cache.h"
2 +#include "test-tool.h"
3 #include "pkt-line.h"
4
5 static void pack_line(const char *line)
@@ -79,7 +80,7 @@ static void unpack_sideband(void)
80 }
81 }
82
82 -int cmd_main(int argc, const char **argv)
83 +int cmd__pkt_line(int argc, const char **argv)
84 {
85 if (argc < 2)
86 die("too few arguments");
t/helper/test-tool.c
+1
@@ -27,6 +27,7 @@ static struct test_cmd cmds[] = {
27 { "mktemp", cmd__mktemp },
28 { "online-cpus", cmd__online_cpus },
29 { "path-utils", cmd__path_utils },
30 + { "pkt-line", cmd__pkt_line },
31 { "prio-queue", cmd__prio_queue },
32 { "read-cache", cmd__read_cache },
33 { "ref-store", cmd__ref_store },
t/helper/test-tool.h
+1
@@ -23,6 +23,7 @@ int cmd__mergesort(int argc, const char **argv);
23 int cmd__mktemp(int argc, const char **argv);
24 int cmd__online_cpus(int argc, const char **argv);
25 int cmd__path_utils(int argc, const char **argv);
26 +int cmd__pkt_line(int argc, const char **argv);
27 int cmd__prio_queue(int argc, const char **argv);
28 int cmd__read_cache(int argc, const char **argv);
29 int cmd__ref_store(int argc, const char **argv);
t/t5701-git-serve.sh
+18 -18
@@ -15,13 +15,13 @@ test_expect_success 'test capability advertisement' '
15 EOF
16
17 git serve --advertise-capabilities >out &&
18 - test-pkt-line unpack <out >actual &&
18 + test-tool pkt-line unpack <out >actual &&
19 test_cmp actual expect
20 '
21
22 test_expect_success 'stateless-rpc flag does not list capabilities' '
23 # Empty request
24 - test-pkt-line pack >in <<-EOF &&
24 + test-tool pkt-line pack >in <<-EOF &&
25 0000
26 EOF
27 git serve --stateless-rpc >out <in &&
@@ -33,7 +33,7 @@ test_expect_success 'stateless-rpc flag does not list capabilities' '
33 '
34
35 test_expect_success 'request invalid capability' '
36 - test-pkt-line pack >in <<-EOF &&
36 + test-tool pkt-line pack >in <<-EOF &&
37 foobar
38 0000
39 EOF
@@ -42,7 +42,7 @@ test_expect_success 'request invalid capability' '
42 '
43
44 test_expect_success 'request with no command' '
45 - test-pkt-line pack >in <<-EOF &&
45 + test-tool pkt-line pack >in <<-EOF &&
46 agent=git/test
47 0000
48 EOF
@@ -51,7 +51,7 @@ test_expect_success 'request with no command' '
51 '
52
53 test_expect_success 'request invalid command' '
54 - test-pkt-line pack >in <<-EOF &&
54 + test-tool pkt-line pack >in <<-EOF &&
55 command=foo
56 agent=git/test
57 0000
@@ -71,7 +71,7 @@ test_expect_success 'setup some refs and tags' '
71 '
72
73 test_expect_success 'basics of ls-refs' '
74 - test-pkt-line pack >in <<-EOF &&
74 + test-tool pkt-line pack >in <<-EOF &&
75 command=ls-refs
76 0000
77 EOF
@@ -88,12 +88,12 @@ test_expect_success 'basics of ls-refs' '
88 EOF
89
90 git serve --stateless-rpc <in >out &&
91 - test-pkt-line unpack <out >actual &&
91 + test-tool pkt-line unpack <out >actual &&
92 test_cmp actual expect
93 '
94
95 test_expect_success 'basic ref-prefixes' '
96 - test-pkt-line pack >in <<-EOF &&
96 + test-tool pkt-line pack >in <<-EOF &&
97 command=ls-refs
98 0001
99 ref-prefix refs/heads/master
@@ -108,12 +108,12 @@ test_expect_success 'basic ref-prefixes' '
108 EOF
109
110 git serve --stateless-rpc <in >out &&
111 - test-pkt-line unpack <out >actual &&
111 + test-tool pkt-line unpack <out >actual &&
112 test_cmp actual expect
113 '
114
115 test_expect_success 'refs/heads prefix' '
116 - test-pkt-line pack >in <<-EOF &&
116 + test-tool pkt-line pack >in <<-EOF &&
117 command=ls-refs
118 0001
119 ref-prefix refs/heads/
@@ -128,12 +128,12 @@ test_expect_success 'refs/heads prefix' '
128 EOF
129
130 git serve --stateless-rpc <in >out &&
131 - test-pkt-line unpack <out >actual &&
131 + test-tool pkt-line unpack <out >actual &&
132 test_cmp actual expect
133 '
134
135 test_expect_success 'peel parameter' '
136 - test-pkt-line pack >in <<-EOF &&
136 + test-tool pkt-line pack >in <<-EOF &&
137 command=ls-refs
138 0001
139 peel
@@ -149,12 +149,12 @@ test_expect_success 'peel parameter' '
149 EOF
150
151 git serve --stateless-rpc <in >out &&
152 - test-pkt-line unpack <out >actual &&
152 + test-tool pkt-line unpack <out >actual &&
153 test_cmp actual expect
154 '
155
156 test_expect_success 'symrefs parameter' '
157 - test-pkt-line pack >in <<-EOF &&
157 + test-tool pkt-line pack >in <<-EOF &&
158 command=ls-refs
159 0001
160 symrefs
@@ -170,12 +170,12 @@ test_expect_success 'symrefs parameter' '
170 EOF
171
172 git serve --stateless-rpc <in >out &&
173 - test-pkt-line unpack <out >actual &&
173 + test-tool pkt-line unpack <out >actual &&
174 test_cmp actual expect
175 '
176
177 test_expect_success 'sending server-options' '
178 - test-pkt-line pack >in <<-EOF &&
178 + test-tool pkt-line pack >in <<-EOF &&
179 command=ls-refs
180 server-option=hello
181 server-option=world
@@ -190,14 +190,14 @@ test_expect_success 'sending server-options' '
190 EOF
191
192 git serve --stateless-rpc <in >out &&
193 - test-pkt-line unpack <out >actual &&
193 + test-tool pkt-line unpack <out >actual &&
194 test_cmp actual expect
195 '
196
197 test_expect_success 'unexpected lines are not allowed in fetch request' '
198 git init server &&
199
200 - test-pkt-line pack >in <<-EOF &&
200 + test-tool pkt-line pack >in <<-EOF &&
201 command=fetch
202 0001
203 this-is-not-a-command
t/t5702-protocol-v2.sh
+1 -1
@@ -334,7 +334,7 @@ test_expect_success 'even with handcrafted request, filter does not work if not
334 git -C server config uploadpack.allowfilter 0 &&
335
336 # Custom request that tries to filter even though it is not advertised.
337 - test-pkt-line pack >in <<-EOF &&
337 + test-tool pkt-line pack >in <<-EOF &&
338 command=fetch
339 0001
340 want $(git -C server rev-parse master)
t/t5703-upload-pack-ref-in-want.sh
+7 -7
@@ -9,14 +9,14 @@ get_actual_refs () {
9 /wanted-refs/d
10 /0001/d
11 p
12 - }' <out | test-pkt-line unpack >actual_refs
12 + }' <out | test-tool pkt-line unpack >actual_refs
13 }
14
15 get_actual_commits () {
16 sed -n -e '/packfile/,/0000/{
17 /packfile/d
18 p
19 - }' <out | test-pkt-line unpack-sideband >o.pack &&
19 + }' <out | test-tool pkt-line unpack-sideband >o.pack &&
20 git index-pack o.pack &&
21 git verify-pack -v o.idx | grep commit | cut -c-40 | sort >actual_commits
22 }
@@ -61,7 +61,7 @@ test_expect_success 'config controls ref-in-want advertisement' '
61 '
62
63 test_expect_success 'invalid want-ref line' '
64 - test-pkt-line pack >in <<-EOF &&
64 + test-tool pkt-line pack >in <<-EOF &&
65 command=fetch
66 0001
67 no-progress
@@ -80,7 +80,7 @@ test_expect_success 'basic want-ref' '
80 EOF
81 git rev-parse f | sort >expected_commits &&
82
83 - test-pkt-line pack >in <<-EOF &&
83 + test-tool pkt-line pack >in <<-EOF &&
84 command=fetch
85 0001
86 no-progress
@@ -101,7 +101,7 @@ test_expect_success 'multiple want-ref lines' '
101 EOF
102 git rev-parse c d | sort >expected_commits &&
103
104 - test-pkt-line pack >in <<-EOF &&
104 + test-tool pkt-line pack >in <<-EOF &&
105 command=fetch
106 0001
107 no-progress
@@ -122,7 +122,7 @@ test_expect_success 'mix want and want-ref' '
122 EOF
123 git rev-parse e f | sort >expected_commits &&
124
125 - test-pkt-line pack >in <<-EOF &&
125 + test-tool pkt-line pack >in <<-EOF &&
126 command=fetch
127 0001
128 no-progress
@@ -143,7 +143,7 @@ test_expect_success 'want-ref with ref we already have commit for' '
143 EOF
144 >expected_commits &&
145
146 - test-pkt-line pack >in <<-EOF &&
146 + test-tool pkt-line pack >in <<-EOF &&
147 command=fetch
148 0001
149 no-progress