git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/5] serve tests: use test_cmp in "protocol violations" test

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 12, 2021, 16:44 UTC
Message-ID
<patch-2.5-64dfd14865c-20210712T164208Z-avarab@gmail.com>
In-Reply-To
<cover-0.5-00000000000-20210712T164208Z-avarab@gmail.com>

Amend the protocol violations tests to check the full output, not just grep it. This changes code added in 4845b772458 (upload-pack: handle unexpected delim packets, 2020-03-27). The newly added test in the preceding commit already did the full test_cmp.

I have a related series to tweak the output from upload-pack et al, we really want to make sure we have this exact output, and not fewer or more lines etc.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t5704-protocol-violations.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/t/t5704-protocol-violations.sh b/t/t5704-protocol-violations.sh
index 95f68e1d4b7..038fffd3d03 100755
--- a/t/t5704-protocol-violations.sh
+++ b/t/t5704-protocol-violations.sh
@@ -14,9 +14,12 @@ test_expect_success 'extra delim packet in v2 ls-refs args' '
 		# protocol expects 0000 flush here
 		printf 0001
 	} >input &&
+	cat >err.expect <<-\EOF &&
+	fatal: expected flush after ls-refs arguments
+	EOF
 	test_must_fail env GIT_PROTOCOL=version=2 \
-		git upload-pack . <input 2>err &&
-	test_i18ngrep "expected flush after ls-refs arguments" err
+		git upload-pack . <input 2>err.actual &&
+	test_cmp err.expect err.actual
 '
 
 test_expect_success 'extra delim packet in v2 fetch args' '
@@ -27,9 +30,12 @@ test_expect_success 'extra delim packet in v2 fetch args' '
 		# protocol expects 0000 flush here
 		printf 0001
 	} >input &&
+	cat >err.expect <<-\EOF &&
+	fatal: expected flush after fetch arguments
+	EOF
 	test_must_fail env GIT_PROTOCOL=version=2 \
-		git upload-pack . <input 2>err &&
-	test_i18ngrep "expected flush after fetch arguments" err
+		git upload-pack . <input 2>err.actual &&
+	test_cmp err.expect err.actual
 '
 
 test_expect_success 'extra delim packet in v2 object-info args' '
-- 
2.32.0-dev
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 9 of 33 in “tests: migrate to "test-tool pkt-line"”
  1. 0/5 tests: migrate to "test-tool pkt-line"Ævar Arnfjörð Bjarmason, Jul 7, 2021
  2. 1/5 serve tests: add missing "extra delim" testÆvar Arnfjörð Bjarmason, Jul 7, 2021
  3. 2/5 serve tests: use test_cmp in "protocol violations" testÆvar Arnfjörð Bjarmason, Jul 7, 2021
  4. 3/5 tests: replace [de]packetize() shell+perl test-tool pkt-lineÆvar Arnfjörð Bjarmason, Jul 7, 2021
  5. 4/5 tests: replace remaining packetize() with "test-tool pkt-line"Ævar Arnfjörð Bjarmason, Jul 7, 2021
  6. 5/5 test-lib-functions.sh: remove unused [de]packetize() functionsÆvar Arnfjörð Bjarmason, Jul 7, 2021
  7. 0/5 tests: migrate to "test-tool pkt-line"Ævar Arnfjörð Bjarmason, Jul 12, 2021
  8. 1/5 serve tests: add missing "extra delim" testÆvar Arnfjörð Bjarmason, Jul 12, 2021
  9. 2/5 serve tests: use test_cmp in "protocol violations" testÆvar Arnfjörð Bjarmason, Jul 12, 2021
  10. 3/5 tests: replace [de]packetize() shell+perl test-tool pkt-lineÆvar Arnfjörð Bjarmason, Jul 12, 2021
  11. Jeff KingJul 13, 2021
  12. Ævar Arnfjörð BjarmasonJul 13, 2021
  13. Jeff KingJul 14, 2021
  14. 4/5 tests: replace remaining packetize() with "test-tool pkt-line"Ævar Arnfjörð Bjarmason, Jul 12, 2021
  15. Jeff KingJul 13, 2021
  16. Ævar Arnfjörð BjarmasonJul 13, 2021
  17. Jeff KingJul 14, 2021
  18. 5/5 test-lib-functions.sh: remove unused [de]packetize() functionsÆvar Arnfjörð Bjarmason, Jul 12, 2021
  19. Junio C HamanoJul 12, 2021
  20. Jeff KingJul 13, 2021
  21. 0/5 tests: migrate to "test-tool pkt-line"Ævar Arnfjörð Bjarmason, Jul 14, 2021
  22. 1/5 serve tests: add missing "extra delim" testÆvar Arnfjörð Bjarmason, Jul 14, 2021
  23. 3/5 tests: replace [de]packetize() shell+perl test-tool pkt-lineÆvar Arnfjörð Bjarmason, Jul 14, 2021
  24. Taylor BlauJul 14, 2021
  25. Junio C HamanoJul 14, 2021
  26. 2/5 serve tests: use test_cmp in "protocol violations" testÆvar Arnfjörð Bjarmason, Jul 14, 2021
  27. 4/5 tests: replace remaining packetize() with "test-tool pkt-line"Ævar Arnfjörð Bjarmason, Jul 14, 2021
  28. 5/5 test-lib-functions.sh: remove unused [de]packetize() functionsÆvar Arnfjörð Bjarmason, Jul 14, 2021
  29. test-lib-functions: use test-tool for [de]packetize()Ævar Arnfjörð Bjarmason, Jul 16, 2021
  30. Taylor BlauJul 16, 2021
  31. Jeff KingJul 16, 2021
  32. Jeff KingJul 16, 2021
  33. Junio C HamanoJul 19, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.