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

[PATCH v2 09/20] t9300: make the big blob tests self-contained

From
Karthik Nayak <karthik.188@gmail.com>
Date
Nov 12, 2026, 17:34 UTC
Message-ID
<20261112-kn-fast-import-tests-1-v2-9-b8c3a0ab27e8@gmail.com>
In-Reply-To
<20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com>

Similar to the previous commits, modify the big blob tests in 'series R' to make them independent of state from previous tests.

'R: blob bigger than threshold' imports the blobs, and the tests after it inspect the result. Fold them into a single test, which does the import and checks the pack, the blob contents and that the blob is stored only once.

Set 'fastimport.unpackLimit' to 0 for the import so that a pack is written, and verify it with an inline loop in place of 'verify_packs()', which won't be available once the test is moved to another file.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 t/t9300-fast-import.sh | 79 ++++++++++++++++++++++++--------------------------
 1 file changed, 38 insertions(+), 41 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index e0b9663452..2231e1bdab 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -3198,51 +3198,48 @@ test_expect_success 'R: corrupt lines do not mess marks file' '
 ## R: very large blobs
 ##
 test_expect_success 'R: blob bigger than threshold' '
-	blobsize=$((2*1024*1024 + 53)) &&
-	test-tool genrandom bar $blobsize >expect &&
-	cat >input <<-INPUT_END &&
-	commit refs/heads/big-file
-	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	R - big file
-	COMMIT
-
-	M 644 inline big1
-	data $blobsize
-	INPUT_END
-	cat expect >>input &&
-	cat >>input <<-INPUT_END &&
-	M 644 inline big2
-	data $blobsize
-	INPUT_END
-	cat expect >>input &&
-	echo >>input &&
-
-	test_create_repo R &&
-	git --git-dir=R/.git config fastimport.unpackLimit 0 &&
-	git --git-dir=R/.git fast-import --big-file-threshold=1 <input
-'
-
-test_expect_success 'R: verify created pack' '
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
 	(
-		cd R &&
-		verify_packs -v > ../verify
+		cd repo &&
+
+		blobsize=$((2*1024*1024 + 53)) &&
+		test-tool genrandom bar $blobsize >expect &&
+		cat >input <<-INPUT_END &&
+		commit refs/heads/big-file
+		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		R - big file
+		COMMIT
+
+		M 644 inline big1
+		data $blobsize
+		INPUT_END
+		cat expect >>input &&
+		cat >>input <<-INPUT_END &&
+		M 644 inline big2
+		data $blobsize
+		INPUT_END
+		cat expect >>input &&
+		echo >>input &&
+
+		git -c fastimport.unpackLimit=0 fast-import --big-file-threshold=1 <input &&
+
+		for p in .git/objects/pack/*.pack
+		do
+			git verify-pack -v "$p" || return 1
+		done >verify &&
+
+		git cat-file blob big-file:big1 >actual &&
+		test_cmp_bin expect actual &&
+		a=$(git rev-parse big-file:big1) &&
+		b=$(git rev-parse big-file:big2) &&
+		test $a = $b &&
+		n=$(grep $a verify | wc -l) &&
+		test 1 = $n
 	)
 '
 
-test_expect_success 'R: verify written objects' '
-	git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
-	test_cmp_bin expect actual &&
-	a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
-	b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
-	test $a = $b
-'
-
-test_expect_success 'R: blob appears only once' '
-	n=$(grep $a verify | wc -l) &&
-	test 1 = $n
-'
-
 test_expect_success 'R: --git-completion-helper does not read from stdin' '
 	find .git/objects/pack -name "tmp_pack_*" >before &&
 	echo garbage | git fast-import --git-completion-helper >out &&
-- 
2.56.GIT
Previous: Karthik NayakNext: Karthik Nayak
Message 34 of 45 in “t9300: group and move tests to other files”
  1. 00/20 t9300: group and move tests to other filesKarthik Nayak, Nov 10, 2026
  2. 01/20 t9300: move 'fastimport.unpackLimit' to the required testKarthik Nayak, Nov 10, 2026
  3. 02/20 t9300: make the series B tests self-containedKarthik Nayak, Nov 10, 2026
  4. 03/20 t9300: make the series T tests self-containedKarthik Nayak, Nov 10, 2026
  5. 04/20 t9300: make the series S tests self-containedKarthik Nayak, Nov 10, 2026
  6. 05/20 t9300: make the series V tests self-containedKarthik Nayak, Nov 10, 2026
  7. 06/20 t9300: make the series Q tests self-containedKarthik Nayak, Nov 10, 2026
  8. 07/20 t9300: make the series P tests self-containedKarthik Nayak, Nov 10, 2026
  9. 08/20 t9300: make the series O tests self-containedKarthik Nayak, Nov 10, 2026
  10. 09/20 t9300: make the big blob tests self-containedKarthik Nayak, Nov 10, 2026
  11. 10/20 t9300: make the ref update tests self-containedKarthik Nayak, Nov 10, 2026
  12. 11/20 t9300: make the date format tests self-containedKarthik Nayak, Nov 10, 2026
  13. 12/20 t9300: make the pack edges test self-containedKarthik Nayak, Nov 10, 2026
  14. 13/20 t9300: make the marks tests self-containedKarthik Nayak, Nov 10, 2026
  15. 14/20 t9300: make the series Y tests self-containedKarthik Nayak, Nov 10, 2026
  16. 15/20 t9300: make the cat-blob tests self-containedKarthik Nayak, Nov 10, 2026
  17. 16/20 t9300: make the feature and option tests self-containedKarthik Nayak, Nov 10, 2026
  18. 17/20 t9300: make the stream tests self-containedKarthik Nayak, Nov 10, 2026
  19. 18/20 t9300: make the get-mark and encoding tests self-containedKarthik Nayak, Nov 10, 2026
  20. 19/20 t9300: move self-contained tests into dedicated filesKarthik Nayak, Nov 10, 2026
  21. 20/20 t93xx: drop the series letter from the moved test namesKarthik Nayak, Nov 10, 2026
  22. Junio C HamanoNov 10, 2026
  23. Junio C HamanoNov 10, 2026
  24. Karthik NayakNov 11, 2026
  25. 00/20 t9300: group and move tests to other filesKarthik Nayak, Nov 12, 2026
  26. 01/20 t9300: move 'fastimport.unpackLimit' to the required testKarthik Nayak, Nov 12, 2026
  27. 02/20 t9300: make the series B tests self-containedKarthik Nayak, Nov 12, 2026
  28. 03/20 t9300: make the series T tests self-containedKarthik Nayak, Nov 12, 2026
  29. 04/20 t9300: make the series S tests self-containedKarthik Nayak, Nov 12, 2026
  30. 05/20 t9300: make the series V tests self-containedKarthik Nayak, Nov 12, 2026
  31. 06/20 t9300: make the series Q tests self-containedKarthik Nayak, Nov 12, 2026
  32. 07/20 t9300: make the series P tests self-containedKarthik Nayak, Nov 12, 2026
  33. 08/20 t9300: make the series O tests self-containedKarthik Nayak, Nov 12, 2026
  34. 09/20 t9300: make the big blob tests self-containedKarthik Nayak, Nov 12, 2026
  35. 10/20 t9300: make the ref update tests self-containedKarthik Nayak, Nov 12, 2026
  36. 11/20 t9300: make the date format tests self-containedKarthik Nayak, Nov 12, 2026
  37. 12/20 t9300: make the pack edges test self-containedKarthik Nayak, Nov 12, 2026
  38. 13/20 t9300: make the marks tests self-containedKarthik Nayak, Nov 12, 2026
  39. 14/20 t9300: make the series Y tests self-containedKarthik Nayak, Nov 12, 2026
  40. 15/20 t9300: make the cat-blob tests self-containedKarthik Nayak, Nov 12, 2026
  41. 16/20 t9300: make the feature and option tests self-containedKarthik Nayak, Nov 12, 2026
  42. 17/20 t9300: make the stream tests self-containedKarthik Nayak, Nov 12, 2026
  43. 18/20 t9300: make the get-mark and encoding tests self-containedKarthik Nayak, Nov 12, 2026
  44. 19/20 t9300: move self-contained tests into dedicated filesKarthik Nayak, Nov 12, 2026
  45. 20/20 t93xx: drop the series letter from the moved test namesKarthik Nayak, Nov 12, 2026

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.