Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2019-04-18 16:16:51 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-19 08:03:24 +0300
commitb7ce24d09526d4e181920ee029c25438196c2847 (patch)
tree2ae8b7a19cbc5dff59b42caad7e8807f941c7625 /t/t5701-git-serve.sh
parent6ea18fffb016f7267f1f8bd2a4871500c4174f68 (diff)
Turn `git serve` into a test helper
The `git serve` built-in was introduced in ed10cb952d31 (serve: introduce git-serve, 2018-03-15) as a backend to serve Git protocol v2, probably originally intended to be spawned by `git upload-pack`. However, in the version that the protocol v2 patches made it into core Git, `git upload-pack` calls the `serve()` function directly instead of spawning `git serve`; The only reason in life for `git serve` to survive as a built-in command is to provide a way to test the protocol v2 functionality. Meaning that it does not even have to be a built-in that is installed with end-user facing Git installations, but it can be a test helper instead. Let's make it so. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5701-git-serve.sh')
-rwxr-xr-xt/t5701-git-serve.sh32
1 files changed, 18 insertions, 14 deletions
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index fe45bf828d..ffb9613885 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='test git-serve and server commands'
+test_description='test protocol v2 server commands'
. ./test-lib.sh
@@ -14,7 +14,8 @@ test_expect_success 'test capability advertisement' '
0000
EOF
- GIT_TEST_SIDEBAND_ALL=0 git serve --advertise-capabilities >out &&
+ GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \
+ --advertise-capabilities >out &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
'
@@ -24,11 +25,11 @@ test_expect_success 'stateless-rpc flag does not list capabilities' '
test-tool pkt-line pack >in <<-EOF &&
0000
EOF
- git serve --stateless-rpc >out <in &&
+ test-tool serve-v2 --stateless-rpc >out <in &&
test_must_be_empty out &&
# EOF
- git serve --stateless-rpc >out &&
+ test-tool serve-v2 --stateless-rpc >out &&
test_must_be_empty out
'
@@ -37,7 +38,7 @@ test_expect_success 'request invalid capability' '
foobar
0000
EOF
- test_must_fail git serve --stateless-rpc 2>err <in &&
+ test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
test_i18ngrep "unknown capability" err
'
@@ -46,7 +47,7 @@ test_expect_success 'request with no command' '
agent=git/test
0000
EOF
- test_must_fail git serve --stateless-rpc 2>err <in &&
+ test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
test_i18ngrep "no command requested" err
'
@@ -56,7 +57,7 @@ test_expect_success 'request invalid command' '
agent=git/test
0000
EOF
- test_must_fail git serve --stateless-rpc 2>err <in &&
+ test_must_fail test-tool serve-v2 --stateless-rpc 2>err <in &&
test_i18ngrep "invalid command" err
'
@@ -87,7 +88,7 @@ test_expect_success 'basics of ls-refs' '
0000
EOF
- git serve --stateless-rpc <in >out &&
+ test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
'
@@ -107,7 +108,7 @@ test_expect_success 'basic ref-prefixes' '
0000
EOF
- git serve --stateless-rpc <in >out &&
+ test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
'
@@ -127,7 +128,7 @@ test_expect_success 'refs/heads prefix' '
0000
EOF
- git serve --stateless-rpc <in >out &&
+ test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
'
@@ -148,7 +149,7 @@ test_expect_success 'peel parameter' '
0000
EOF
- git serve --stateless-rpc <in >out &&
+ test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
'
@@ -169,7 +170,7 @@ test_expect_success 'symrefs parameter' '
0000
EOF
- git serve --stateless-rpc <in >out &&
+ test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
'
@@ -189,7 +190,7 @@ test_expect_success 'sending server-options' '
0000
EOF
- git serve --stateless-rpc <in >out &&
+ test-tool serve-v2 --stateless-rpc <in >out &&
test-tool pkt-line unpack <out >actual &&
test_cmp expect actual
'
@@ -204,7 +205,10 @@ test_expect_success 'unexpected lines are not allowed in fetch request' '
0000
EOF
- test_must_fail git -C server serve --stateless-rpc <in >/dev/null 2>err &&
+ (
+ cd server &&
+ test_must_fail test-tool serve-v2 --stateless-rpc
+ ) <in >/dev/null 2>err &&
grep "unexpected line: .this-is-not-a-command." err
'