Skip to content

Commit 8ea40cc

Browse files
pcloudsgitster
authored andcommitted
t/helper: merge test-pkt-line into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cd780f0 commit 8ea40cc

File tree

7 files changed

+31
-28
lines changed

7 files changed

+31
-28
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ TEST_BUILTINS_OBJS += test-mergesort.o
722722
TEST_BUILTINS_OBJS += test-mktemp.o
723723
TEST_BUILTINS_OBJS += test-online-cpus.o
724724
TEST_BUILTINS_OBJS += test-path-utils.o
725+
TEST_BUILTINS_OBJS += test-pkt-line.o
725726
TEST_BUILTINS_OBJS += test-prio-queue.o
726727
TEST_BUILTINS_OBJS += test-read-cache.o
727728
TEST_BUILTINS_OBJS += test-ref-store.o
@@ -745,7 +746,6 @@ TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
745746
TEST_PROGRAMS_NEED_X += test-fake-ssh
746747
TEST_PROGRAMS_NEED_X += test-line-buffer
747748
TEST_PROGRAMS_NEED_X += test-parse-options
748-
TEST_PROGRAMS_NEED_X += test-pkt-line
749749
TEST_PROGRAMS_NEED_X += test-svn-fe
750750
TEST_PROGRAMS_NEED_X += test-tool
751751

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static struct test_cmd cmds[] = {
2727
{ "mktemp", cmd__mktemp },
2828
{ "online-cpus", cmd__online_cpus },
2929
{ "path-utils", cmd__path_utils },
30+
{ "pkt-line", cmd__pkt_line },
3031
{ "prio-queue", cmd__prio_queue },
3132
{ "read-cache", cmd__read_cache },
3233
{ "ref-store", cmd__ref_store },

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ int cmd__mergesort(int argc, const char **argv);
2323
int cmd__mktemp(int argc, const char **argv);
2424
int cmd__online_cpus(int argc, const char **argv);
2525
int cmd__path_utils(int argc, const char **argv);
26+
int cmd__pkt_line(int argc, const char **argv);
2627
int cmd__prio_queue(int argc, const char **argv);
2728
int cmd__read_cache(int argc, const char **argv);
2829
int cmd__ref_store(int argc, const char **argv);

t/t5701-git-serve.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ test_expect_success 'test capability advertisement' '
1515
EOF
1616
1717
git serve --advertise-capabilities >out &&
18-
test-pkt-line unpack <out >actual &&
18+
test-tool pkt-line unpack <out >actual &&
1919
test_cmp actual expect
2020
'
2121

2222
test_expect_success 'stateless-rpc flag does not list capabilities' '
2323
# Empty request
24-
test-pkt-line pack >in <<-EOF &&
24+
test-tool pkt-line pack >in <<-EOF &&
2525
0000
2626
EOF
2727
git serve --stateless-rpc >out <in &&
@@ -33,7 +33,7 @@ test_expect_success 'stateless-rpc flag does not list capabilities' '
3333
'
3434

3535
test_expect_success 'request invalid capability' '
36-
test-pkt-line pack >in <<-EOF &&
36+
test-tool pkt-line pack >in <<-EOF &&
3737
foobar
3838
0000
3939
EOF
@@ -42,7 +42,7 @@ test_expect_success 'request invalid capability' '
4242
'
4343

4444
test_expect_success 'request with no command' '
45-
test-pkt-line pack >in <<-EOF &&
45+
test-tool pkt-line pack >in <<-EOF &&
4646
agent=git/test
4747
0000
4848
EOF
@@ -51,7 +51,7 @@ test_expect_success 'request with no command' '
5151
'
5252

5353
test_expect_success 'request invalid command' '
54-
test-pkt-line pack >in <<-EOF &&
54+
test-tool pkt-line pack >in <<-EOF &&
5555
command=foo
5656
agent=git/test
5757
0000
@@ -71,7 +71,7 @@ test_expect_success 'setup some refs and tags' '
7171
'
7272

7373
test_expect_success 'basics of ls-refs' '
74-
test-pkt-line pack >in <<-EOF &&
74+
test-tool pkt-line pack >in <<-EOF &&
7575
command=ls-refs
7676
0000
7777
EOF
@@ -88,12 +88,12 @@ test_expect_success 'basics of ls-refs' '
8888
EOF
8989
9090
git serve --stateless-rpc <in >out &&
91-
test-pkt-line unpack <out >actual &&
91+
test-tool pkt-line unpack <out >actual &&
9292
test_cmp actual expect
9393
'
9494

9595
test_expect_success 'basic ref-prefixes' '
96-
test-pkt-line pack >in <<-EOF &&
96+
test-tool pkt-line pack >in <<-EOF &&
9797
command=ls-refs
9898
0001
9999
ref-prefix refs/heads/master
@@ -108,12 +108,12 @@ test_expect_success 'basic ref-prefixes' '
108108
EOF
109109
110110
git serve --stateless-rpc <in >out &&
111-
test-pkt-line unpack <out >actual &&
111+
test-tool pkt-line unpack <out >actual &&
112112
test_cmp actual expect
113113
'
114114

115115
test_expect_success 'refs/heads prefix' '
116-
test-pkt-line pack >in <<-EOF &&
116+
test-tool pkt-line pack >in <<-EOF &&
117117
command=ls-refs
118118
0001
119119
ref-prefix refs/heads/
@@ -128,12 +128,12 @@ test_expect_success 'refs/heads prefix' '
128128
EOF
129129
130130
git serve --stateless-rpc <in >out &&
131-
test-pkt-line unpack <out >actual &&
131+
test-tool pkt-line unpack <out >actual &&
132132
test_cmp actual expect
133133
'
134134

135135
test_expect_success 'peel parameter' '
136-
test-pkt-line pack >in <<-EOF &&
136+
test-tool pkt-line pack >in <<-EOF &&
137137
command=ls-refs
138138
0001
139139
peel
@@ -149,12 +149,12 @@ test_expect_success 'peel parameter' '
149149
EOF
150150
151151
git serve --stateless-rpc <in >out &&
152-
test-pkt-line unpack <out >actual &&
152+
test-tool pkt-line unpack <out >actual &&
153153
test_cmp actual expect
154154
'
155155

156156
test_expect_success 'symrefs parameter' '
157-
test-pkt-line pack >in <<-EOF &&
157+
test-tool pkt-line pack >in <<-EOF &&
158158
command=ls-refs
159159
0001
160160
symrefs
@@ -170,12 +170,12 @@ test_expect_success 'symrefs parameter' '
170170
EOF
171171
172172
git serve --stateless-rpc <in >out &&
173-
test-pkt-line unpack <out >actual &&
173+
test-tool pkt-line unpack <out >actual &&
174174
test_cmp actual expect
175175
'
176176

177177
test_expect_success 'sending server-options' '
178-
test-pkt-line pack >in <<-EOF &&
178+
test-tool pkt-line pack >in <<-EOF &&
179179
command=ls-refs
180180
server-option=hello
181181
server-option=world
@@ -190,14 +190,14 @@ test_expect_success 'sending server-options' '
190190
EOF
191191
192192
git serve --stateless-rpc <in >out &&
193-
test-pkt-line unpack <out >actual &&
193+
test-tool pkt-line unpack <out >actual &&
194194
test_cmp actual expect
195195
'
196196

197197
test_expect_success 'unexpected lines are not allowed in fetch request' '
198198
git init server &&
199199
200-
test-pkt-line pack >in <<-EOF &&
200+
test-tool pkt-line pack >in <<-EOF &&
201201
command=fetch
202202
0001
203203
this-is-not-a-command

t/t5702-protocol-v2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ test_expect_success 'even with handcrafted request, filter does not work if not
334334
git -C server config uploadpack.allowfilter 0 &&
335335
336336
# 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 &&
338338
command=fetch
339339
0001
340340
want $(git -C server rev-parse master)

t/t5703-upload-pack-ref-in-want.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ get_actual_refs () {
99
/wanted-refs/d
1010
/0001/d
1111
p
12-
}' <out | test-pkt-line unpack >actual_refs
12+
}' <out | test-tool pkt-line unpack >actual_refs
1313
}
1414

1515
get_actual_commits () {
1616
sed -n -e '/packfile/,/0000/{
1717
/packfile/d
1818
p
19-
}' <out | test-pkt-line unpack-sideband >o.pack &&
19+
}' <out | test-tool pkt-line unpack-sideband >o.pack &&
2020
git index-pack o.pack &&
2121
git verify-pack -v o.idx | grep commit | cut -c-40 | sort >actual_commits
2222
}
@@ -61,7 +61,7 @@ test_expect_success 'config controls ref-in-want advertisement' '
6161
'
6262

6363
test_expect_success 'invalid want-ref line' '
64-
test-pkt-line pack >in <<-EOF &&
64+
test-tool pkt-line pack >in <<-EOF &&
6565
command=fetch
6666
0001
6767
no-progress
@@ -80,7 +80,7 @@ test_expect_success 'basic want-ref' '
8080
EOF
8181
git rev-parse f | sort >expected_commits &&
8282
83-
test-pkt-line pack >in <<-EOF &&
83+
test-tool pkt-line pack >in <<-EOF &&
8484
command=fetch
8585
0001
8686
no-progress
@@ -101,7 +101,7 @@ test_expect_success 'multiple want-ref lines' '
101101
EOF
102102
git rev-parse c d | sort >expected_commits &&
103103
104-
test-pkt-line pack >in <<-EOF &&
104+
test-tool pkt-line pack >in <<-EOF &&
105105
command=fetch
106106
0001
107107
no-progress
@@ -122,7 +122,7 @@ test_expect_success 'mix want and want-ref' '
122122
EOF
123123
git rev-parse e f | sort >expected_commits &&
124124
125-
test-pkt-line pack >in <<-EOF &&
125+
test-tool pkt-line pack >in <<-EOF &&
126126
command=fetch
127127
0001
128128
no-progress
@@ -143,7 +143,7 @@ test_expect_success 'want-ref with ref we already have commit for' '
143143
EOF
144144
>expected_commits &&
145145
146-
test-pkt-line pack >in <<-EOF &&
146+
test-tool pkt-line pack >in <<-EOF &&
147147
command=fetch
148148
0001
149149
no-progress

0 commit comments

Comments
 (0)