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

[PATCH 16/20] t9300: make the feature and option tests self-contained

From
Karthik Nayak <karthik.188@gmail.com>
Date
Nov 10, 2026, 11:50 UTC
Message-ID
<20261110-kn-fast-import-tests-1-v1-16-dbd9ee502aae@gmail.com>
In-Reply-To
<20261110-kn-fast-import-tests-1-v1-0-dbd9ee502aae@gmail.com>

Similar to the previous commits, modify the tests in 'series R' which check the 'feature' command and the command line options to make them independent of state from previous tests.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 t/t9300-fast-import.sh | 188 +++++++++++++++++++++++++++++++++++--------------
 1 file changed, 136 insertions(+), 52 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 3f0e7b8b1f..cf00e4faf9 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -2607,54 +2607,90 @@ test_expect_success 'Q: deny note on empty branch' '
 ###
 
 test_expect_success 'R: abort on unsupported feature' '
-	cat >input <<-EOF &&
-	feature no-such-feature-exists
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_must_fail git fast-import <input
+		cat >input <<-EOF &&
+		feature no-such-feature-exists
+		EOF
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'R: supported feature is accepted' '
-	cat >input <<-EOF &&
-	feature date-format=now
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	git fast-import <input
+		cat >input <<-EOF &&
+		feature date-format=now
+		EOF
+
+		git fast-import <input
+	)
 '
 
 test_expect_success 'R: abort on receiving feature after data command' '
-	cat >input <<-EOF &&
-	blob
-	data 3
-	hi
-	feature date-format=now
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_must_fail git fast-import <input
+		cat >input <<-EOF &&
+		blob
+		data 3
+		hi
+		feature date-format=now
+		EOF
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'R: import-marks features forbidden by default' '
-	>git.marks &&
-	echo "feature import-marks=git.marks" >input &&
-	test_must_fail git fast-import <input &&
-	echo "feature import-marks-if-exists=git.marks" >input &&
-	test_must_fail git fast-import <input
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+
+		>git.marks &&
+		echo "feature import-marks=git.marks" >input &&
+		test_must_fail git fast-import <input &&
+		echo "feature import-marks-if-exists=git.marks" >input &&
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'R: only one import-marks feature allowed per stream' '
-	>git.marks &&
-	>git2.marks &&
-	cat >input <<-EOF &&
-	feature import-marks=git.marks
-	feature import-marks=git2.marks
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_must_fail git fast-import --allow-unsafe-features <input
+		>git.marks &&
+		>git2.marks &&
+		cat >input <<-EOF &&
+		feature import-marks=git.marks
+		feature import-marks=git2.marks
+		EOF
+
+		test_must_fail git fast-import --allow-unsafe-features <input
+	)
 '
 
 test_expect_success 'R: export-marks feature forbidden by default' '
-	echo "feature export-marks=git.marks" >input &&
-	test_must_fail git fast-import <input
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+
+		echo "feature export-marks=git.marks" >input &&
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'R: export-marks feature results in a marks file being created' '
@@ -2969,17 +3005,35 @@ test_expect_success 'R: feature no-relative-marks should be honoured' '
 
 
 test_expect_success 'R: feature ls supported' '
-	echo "feature ls" |
-	git fast-import
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+
+		echo "feature ls" |
+		git fast-import
+	)
 '
 
 test_expect_success 'R: feature cat-blob supported' '
-	echo "feature cat-blob" |
-	git fast-import
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+
+		echo "feature cat-blob" |
+		git fast-import
+	)
 '
 
 test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '
-	test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+
+		test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
+	)
 '
 
 test_expect_success !MINGW 'R: print old blob' '
@@ -3334,38 +3388,68 @@ test_expect_success 'R: terminating "done" within commit' '
 '
 
 test_expect_success 'R: die on unknown option' '
-	cat >input <<-EOF &&
-	option git non-existing-option
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_must_fail git fast-import <input
+		cat >input <<-EOF &&
+		option git non-existing-option
+		EOF
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'R: unknown commandline options are rejected' '\
-	test_must_fail git fast-import --non-existing-option < /dev/null
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+
+		test_must_fail git fast-import --non-existing-option < /dev/null
+	)
 '
 
 test_expect_success 'R: feature-only names are rejected on the command line' '
-	for opt in --alias --get-mark --ls --notes
-	do
-		test_must_fail git fast-import "$opt" </dev/null || return 1
-	done
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+
+		for opt in --alias --get-mark --ls --notes
+		do
+			test_must_fail git fast-import "$opt" </dev/null || return 1
+		done
+	)
 '
 
 test_expect_success 'R: die on invalid option argument' '
-	echo "option git active-branches=-5" |
-	test_must_fail git fast-import &&
-	echo "option git depth=" |
-	test_must_fail git fast-import &&
-	test_must_fail git fast-import --depth="5 elephants" </dev/null
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+
+		echo "option git active-branches=-5" |
+		test_must_fail git fast-import &&
+		echo "option git depth=" |
+		test_must_fail git fast-import &&
+		test_must_fail git fast-import --depth="5 elephants" </dev/null
+	)
 '
 
 test_expect_success 'R: ignore non-git options' '
-	cat >input <<-EOF &&
-	option non-existing-vcs non-existing-option
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	git fast-import <input
+		cat >input <<-EOF &&
+		option non-existing-vcs non-existing-option
+		EOF
+
+		git fast-import <input
+	)
 '
 
 test_expect_success 'R: corrupt lines do not mess marks file' '
-- 
2.56.GIT
Previous: Karthik NayakNext: Karthik Nayak
Message 17 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.