🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
4 messages
4 total messages Started by Karthik Nayak Thu, 12 Nov 2026 17:34
[PATCH v2 02/20] t9300: make the series B tests self-contained
#3002
Author: Karthik Nayak
Date: Thu, 12 Nov 2026 17:34
583 lines
26080 bytes
The 't/t9300-fast-import.sh' test file contains numerous tests and is
currently just shy of 4000 lines. This is because the file contains
tests over multiple series, each series testing particular functionality
or sections of 'git-fast-import(1)'. In upcoming commits, we want to
split out these tests into individual files for better discoverability.

First, we need to remove the dependency tests have on preceding tests.
Modify the tests in 'series B' to each run in a new repository, which is
removed when the test completes, so that they neither depend on nor
leave behind any state.

The 'B: fail on invalid blob sha1' and 'B: accept branch name
"TEMP_TAG"' tests import on top of 'main', which used to exist from
earlier tests. Create it with 'test_commit', so that the first import
can only fail because of the invalid blob ID.

The 'fsck' tests require the whole repository to be free of unreachable
objects. They only passed because of the garbage collection in the
cleanup of other tests. A new repository makes that unnecessary.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 t/t9300-fast-import.sh | 472 ++++++++++++++++++++++++++++---------------------
 1 file changed, 275 insertions(+), 197 deletions(-)

diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 4cffe43a71..e2cf0b7a22 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -358,274 +358,352 @@ test_expect_success 'A: export marks with large values' '
 ###
 
 test_expect_success 'B: fail on invalid blob sha1' '
-	test_tick &&
-	cat >input <<-INPUT_END &&
-	commit refs/heads/branch
-	mark :1
-	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	corrupt
-	COMMIT
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+		test_commit base &&
 
-	from refs/heads/main
-	M 755 $(echo $ZERO_OID | sed -e "s/0$/1/") zero1
+		test_tick &&
+		cat >input <<-INPUT_END &&
+		commit refs/heads/branch
+		mark :1
+		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		corrupt
+		COMMIT
 
-	INPUT_END
+		from refs/heads/main
+		M 755 $(echo $ZERO_OID | sed -e "s/0$/1/") zero1
 
-	test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&
-	test_must_fail git fast-import <input
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: accept branch name "TEMP_TAG"' '
-	cat >input <<-INPUT_END &&
-	commit TEMP_TAG
-	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	tag base
-	COMMIT
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+		test_commit new &&
 
-	from refs/heads/main
+		cat >input <<-INPUT_END &&
+		commit TEMP_TAG
+		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		tag base
+		COMMIT
 
-	INPUT_END
+		from refs/heads/main
 
-	test_when_finished "rm -f .git/TEMP_TAG && git gc --prune=now" &&
-	git fast-import <input &&
-	test $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d " " ) != "$ZERO_OID" &&
-	test $(git rev-parse main) = $(git rev-parse TEMP_TAG^)
+		INPUT_END
+
+		git fast-import <input &&
+		test $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d " " ) != "$ZERO_OID" &&
+		test $(git rev-parse main) = $(git rev-parse TEMP_TAG^)
+	)
 '
 
 test_expect_success 'B: accept empty committer' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/empty-committer-1
-	committer  <> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+		cat >input <<-INPUT_END &&
+		commit refs/heads/empty-committer-1
+		committer  <> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
 
-	test_when_finished "git update-ref -d refs/heads/empty-committer-1
-		git gc --prune=now" &&
-	git fast-import <input &&
-	out=$(git fsck) &&
-	echo "$out" &&
-	test -z "$out"
+		git fast-import <input &&
+		out=$(git fsck) &&
+		echo "$out" &&
+		test -z "$out"
+	)
 '
 
 test_expect_success 'B: reject invalid timezone' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/invalid-timezone
-	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_when_finished "git update-ref -d refs/heads/invalid-timezone" &&
-	test_must_fail git fast-import <input
+		cat >input <<-INPUT_END &&
+		commit refs/heads/invalid-timezone
+		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: accept invalid timezone with raw-permissive' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/invalid-timezone
-	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	git init invalid-timezone &&
-	git -C invalid-timezone fast-import --date-format=raw-permissive <input &&
-	git -C invalid-timezone cat-file -p invalid-timezone >out &&
-	test_grep "1234567890 [+]051800" out
+		cat >input <<-INPUT_END &&
+		commit refs/heads/invalid-timezone
+		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
+
+		git fast-import --date-format=raw-permissive <input &&
+		git cat-file -p invalid-timezone >out &&
+		test_grep "1234567890 [+]051800" out
+	)
 '
 
 test_expect_success 'B: accept and fixup committer with no name' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/empty-committer-2
-	committer <a@b.com> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+		cat >input <<-INPUT_END &&
+		commit refs/heads/empty-committer-2
+		committer <a@b.com> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
 
-	test_when_finished "git update-ref -d refs/heads/empty-committer-2
-		git gc --prune=now" &&
-	git fast-import <input &&
-	out=$(git fsck) &&
-	echo "$out" &&
-	test -z "$out"
+		git fast-import <input &&
+		out=$(git fsck) &&
+		echo "$out" &&
+		test -z "$out"
+	)
 '
 
 test_expect_success 'B: fail on invalid committer (1)' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/invalid-committer
-	committer Name email> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
-	test_must_fail git fast-import <input
+		cat >input <<-INPUT_END &&
+		commit refs/heads/invalid-committer
+		committer Name email> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: fail on invalid committer (2)' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/invalid-committer
-	committer Name <e<mail> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
-	test_must_fail git fast-import <input
+		cat >input <<-INPUT_END &&
+		commit refs/heads/invalid-committer
+		committer Name <e<mail> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: fail on invalid committer (3)' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/invalid-committer
-	committer Name <email>> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
-	test_must_fail git fast-import <input
+		cat >input <<-INPUT_END &&
+		commit refs/heads/invalid-committer
+		committer Name <email>> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: fail on invalid committer (4)' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/invalid-committer
-	committer Name <email $GIT_COMMITTER_DATE
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
-	test_must_fail git fast-import <input
+		cat >input <<-INPUT_END &&
+		commit refs/heads/invalid-committer
+		committer Name <email $GIT_COMMITTER_DATE
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: fail on invalid committer (5)' '
-	cat >input <<-INPUT_END &&
-	commit refs/heads/invalid-committer
-	committer Name<email> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	empty commit
-	COMMIT
-	INPUT_END
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	test_when_finished "git update-ref -d refs/heads/invalid-committer" &&
-	test_must_fail git fast-import <input
+		cat >input <<-INPUT_END &&
+		commit refs/heads/invalid-committer
+		committer Name<email> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		empty commit
+		COMMIT
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: fail on invalid file path of ..' '
-	cat >input <<-INPUT_END &&
-	blob
-	mark :1
-	data <<EOF
-	File contents
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	commit refs/heads/badpath
-	committer Name <email> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	Commit Message
-	COMMIT
-	M 100644 :1 ../invalid-path
-	INPUT_END
+		cat >input <<-INPUT_END &&
+		blob
+		mark :1
+		data <<EOF
+		File contents
+		EOF
 
-	test_when_finished "git update-ref -d refs/heads/badpath" &&
-	test_must_fail git fast-import <input
+		commit refs/heads/badpath
+		committer Name <email> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		Commit Message
+		COMMIT
+		M 100644 :1 ../invalid-path
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: fail on invalid file path of .' '
-	cat >input <<-INPUT_END &&
-	blob
-	mark :1
-	data <<EOF
-	File contents
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	commit refs/heads/badpath
-	committer Name <email> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	Good path
-	COMMIT
-	M 100644 :1 ok-path
+		cat >input <<-INPUT_END &&
+		blob
+		mark :1
+		data <<EOF
+		File contents
+		EOF
 
-	commit refs/heads/badpath
-	committer Name <email> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	Bad path
-	COMMIT
-	R ok-path ./invalid-path
-	INPUT_END
+		commit refs/heads/badpath
+		committer Name <email> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		Good path
+		COMMIT
+		M 100644 :1 ok-path
 
-	test_when_finished "git update-ref -d refs/heads/badpath" &&
-	test_must_fail git fast-import <input
+		commit refs/heads/badpath
+		committer Name <email> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		Bad path
+		COMMIT
+		R ok-path ./invalid-path
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success WINDOWS 'B: fail on invalid file path of C:' '
-	cat >input <<-INPUT_END &&
-	blob
-	mark :1
-	data <<EOF
-	File contents
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	commit refs/heads/badpath
-	committer Name <email> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	Commit Message
-	COMMIT
-	M 100644 :1 C:/invalid-path
-	INPUT_END
+		cat >input <<-INPUT_END &&
+		blob
+		mark :1
+		data <<EOF
+		File contents
+		EOF
 
-	test_when_finished "git update-ref -d refs/heads/badpath" &&
-	test_must_fail git fast-import <input
+		commit refs/heads/badpath
+		committer Name <email> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		Commit Message
+		COMMIT
+		M 100644 :1 C:/invalid-path
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: fail on invalid file path of .git' '
-	cat >input <<-INPUT_END &&
-	blob
-	mark :1
-	data <<EOF
-	File contents
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	commit refs/heads/badpath
-	committer Name <email> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	Commit Message
-	COMMIT
-	M 100644 :1 .git/invalid-path
-	INPUT_END
+		cat >input <<-INPUT_END &&
+		blob
+		mark :1
+		data <<EOF
+		File contents
+		EOF
 
-	test_when_finished "git update-ref -d refs/heads/badpath" &&
-	test_must_fail git fast-import <input
+		commit refs/heads/badpath
+		committer Name <email> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		Commit Message
+		COMMIT
+		M 100644 :1 .git/invalid-path
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 test_expect_success 'B: fail on invalid file path of .gitmodules' '
-	cat >input <<-INPUT_END &&
-	blob
-	mark :1
-	data <<EOF
-	File contents
-	EOF
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
 
-	commit refs/heads/badpath
-	committer Name <email> $GIT_COMMITTER_DATE
-	data <<COMMIT
-	Commit Message
-	COMMIT
-	M 120000 :1 .gitmodules
-	INPUT_END
+		cat >input <<-INPUT_END &&
+		blob
+		mark :1
+		data <<EOF
+		File contents
+		EOF
 
-	test_when_finished "git update-ref -d refs/heads/badpath" &&
-	test_must_fail git fast-import <input
+		commit refs/heads/badpath
+		committer Name <email> $GIT_COMMITTER_DATE
+		data <<COMMIT
+		Commit Message
+		COMMIT
+		M 120000 :1 .gitmodules
+		INPUT_END
+
+		test_must_fail git fast-import <input
+	)
 '
 
 ###

-- 
2.56.GIT
Re: [PATCH v2 02/20] t9300: make the series B tests self-contained
#3387
Author: Kaartic Sivaraam
Date: Thu, 19 Nov 2026 12:22
185 lines
16672 bytes
On 11/12/26 23:04, Karthik Nayak wrote:
> The 't/t9300-fast-import.sh' test file contains numerous tests and is
> currently just shy of 4000 lines. This is because the file contains
> tests over multiple series, each series testing particular functionality
> or sections of 'git-fast-import(1)'. In upcoming commits, we want to
> split out these tests into individual files for better discoverability.
> 
> First, we need to remove the dependency tests have on preceding tests.
> Modify the tests in 'series B' to each run in a new repository, which is
> removed when the test completes, so that they neither depend on nor
> leave behind any state.
> 
> The 'B: fail on invalid blob sha1' and 'B: accept branch name
> "TEMP_TAG"' tests import on top of 'main', which used to exist from
> earlier tests. Create it with 'test_commit', so that the first import
> can only fail because of the invalid blob ID.
> 
> The 'fsck' tests require the whole repository to be free of unreachable
> objects. They only passed because of the garbage collection in the
> cleanup of other tests. A new repository makes that unnecessary.
> 
> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> ---
>   t/t9300-fast-import.sh | 472 ++++++++++++++++++++++++++++---------------------
>   1 file changed, 275 insertions(+), 197 deletions(-)
> 
> diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
> index 4cffe43a71..e2cf0b7a22 100755
> --- a/t/t9300-fast-import.sh
> +++ b/t/t9300-fast-import.sh
> @@ -358,274 +358,352 @@ test_expect_success 'A: export marks with large values' '
>   ###
>   
>   test_expect_success 'B: fail on invalid blob sha1' '
> -	test_tick &&
> -	cat >input <<-INPUT_END &&
> -	commit refs/heads/branch
> -	mark :1
> -	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
> -	data <<COMMIT
> -	corrupt
> -	COMMIT
> +	test_when_finished "rm -rf repo" &&
> +	git init repo &&
> +	(
> +		cd repo &&
> +		test_commit base &&

I suppose we need this test_commit after making wrapping this in a 
subshell since we can't lean on the commit created by the previous test. 
This is just the commit message mentions it. Makes sense.

>   
> -	from refs/heads/main
> -	M 755 $(echo $ZERO_OID | sed -e "s/0$/1/") zero1
> +		test_tick &&
> +		cat >input <<-INPUT_END &&
> +		commit refs/heads/branch
> +		mark :1
> +		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
> +		data <<COMMIT
> +		corrupt
> +		COMMIT
>   
> -	INPUT_END
> +		from refs/heads/main
> +		M 755 $(echo $ZERO_OID | sed -e "s/0$/1/") zero1
>   
> -	test_when_finished "rm -f .git/objects/pack_* .git/objects/index_*" &&

I suppose we're also losing this because the 'repo' itself would cease 
to exist after this change.

> -	test_must_fail git fast-import <input
> +		INPUT_END
> +
> +		test_must_fail git fast-import <input
> +	)
>   '
> 
 >   test_expect_success 'B: accept branch name "TEMP_TAG"' '> -	cat 
 >input <<-INPUT_END &&
> -	commit TEMP_TAG
> -	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
> -	data <<COMMIT
> -	tag base
> -	COMMIT
> +	test_when_finished "rm -rf repo" &&
> +	git init repo &&
> +	(
> +		cd repo &&
> +		test_commit new &&

I think this additional test_commit is deserved, too.

>   test_expect_success 'B: accept invalid timezone with raw-permissive' '
> -	cat >input <<-INPUT_END &&
> -	commit refs/heads/invalid-timezone
> -	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800
> -	data <<COMMIT
> -	empty commit
> -	COMMIT
> -	INPUT_END
> +	test_when_finished "rm -rf repo" &&
> +	git init repo &&
> +	(
> +		cd repo &&
>   
> -	git init invalid-timezone &&
> -	git -C invalid-timezone fast-import --date-format=raw-permissive <input &&
> -	git -C invalid-timezone cat-file -p invalid-timezone >out &&
> -	test_grep "1234567890 [+]051800" out
> +		cat >input <<-INPUT_END &&
> +		commit refs/heads/invalid-timezone
> +		committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1234567890 +051800
> +		data <<COMMIT
> +		empty commit
> +		COMMIT
> +		INPUT_END
> +
> +		git fast-import --date-format=raw-permissive <input &&
> +		git cat-file -p invalid-timezone >out &&

We're losing the '-C invalid-timezone' here since we are already in a 
repo created specifically for this test. Looks good.

> +		test_grep "1234567890 [+]051800" out
> +	)
>   '
>  [ ... snip ... ]
>   
>   test_expect_success 'B: fail on invalid file path of .gitmodules' '
> -	cat >input <<-INPUT_END &&
> -	blob
> -	mark :1
> -	data <<EOF
> -	File contents
> -	EOF
> +	test_when_finished "rm -rf repo" &&
> +	git init repo &&
> +	(
> +		cd repo &&
>   
> -	commit refs/heads/badpath
> -	committer Name <email> $GIT_COMMITTER_DATE
> -	data <<COMMIT
> -	Commit Message
> -	COMMIT
> -	M 120000 :1 .gitmodules
> -	INPUT_END
> +		cat >input <<-INPUT_END &&
> +		blob
> +		mark :1
> +		data <<EOF
> +		File contents
> +		EOF
>   
> -	test_when_finished "git update-ref -d refs/heads/badpath" &&
> -	test_must_fail git fast-import <input
> +		commit refs/heads/badpath
> +		committer Name <email> $GIT_COMMITTER_DATE
> +		data <<COMMIT
> +		Commit Message
> +		COMMIT
> +		M 120000 :1 .gitmodules
> +		INPUT_END
> +
> +		test_must_fail git fast-import <input
> +	)
>   '
>   
>   ###
> 


An --ignore-all-space diff helped me grok that most of this change is 
just the existing test getting their own repository and the test code 
indented to put them within a subshell.

I just wonder how much additional time or work this has resulted in 16 
additional repos being created and torn down.

-- 
Sivaraam
Re: [PATCH v2 02/20] t9300: make the series B tests self-contained
#3657
Author: Karthik Nayak
Date: Mon, 23 Nov 2026 19:48
95 lines
14883 bytes
--0000000000007fc60a0660f6e281
Content-Type: text/plain; charset="UTF-8"

Kaartic Sivaraam <kaartic.sivaraam@gmail.com> writes:

[snip]

>> +		test_grep "1234567890 [+]051800" out
>> +	)
>>   '
>>  [ ... snip ... ]
>>
>>   test_expect_success 'B: fail on invalid file path of .gitmodules' '
>> -	cat >input <<-INPUT_END &&
>> -	blob
>> -	mark :1
>> -	data <<EOF
>> -	File contents
>> -	EOF
>> +	test_when_finished "rm -rf repo" &&
>> +	git init repo &&
>> +	(
>> +		cd repo &&
>>
>> -	commit refs/heads/badpath
>> -	committer Name <email> $GIT_COMMITTER_DATE
>> -	data <<COMMIT
>> -	Commit Message
>> -	COMMIT
>> -	M 120000 :1 .gitmodules
>> -	INPUT_END
>> +		cat >input <<-INPUT_END &&
>> +		blob
>> +		mark :1
>> +		data <<EOF
>> +		File contents
>> +		EOF
>>
>> -	test_when_finished "git update-ref -d refs/heads/badpath" &&
>> -	test_must_fail git fast-import <input
>> +		commit refs/heads/badpath
>> +		committer Name <email> $GIT_COMMITTER_DATE
>> +		data <<COMMIT
>> +		Commit Message
>> +		COMMIT
>> +		M 120000 :1 .gitmodules
>> +		INPUT_END
>> +
>> +		test_must_fail git fast-import <input
>> +	)
>>   '
>>
>>   ###
>>
>
>
> An --ignore-all-space diff helped me grok that most of this change is
> just the existing test getting their own repository and the test code
> indented to put them within a subshell.
>

Yeah that's probably the best way to review this as most of the changes
are just moving to subshell to ensure we don't have any dependencies.

> I just wonder how much additional time or work this has resulted in 16
> additional repos being created and torn down.
>
> --
> Sivaraam

I haven't actually tested, but moving them to different files also
increases the parallelism of tests plus significant readability
improvements.

--0000000000007fc60a0660f6e281
Content-Type: application/pgp-signature; name="signature.asc"
Content-Disposition: attachment; filename="signature.asc"
Content-Transfer-Encoding: base64
X-Attachment-Id: 2c432e71c3e59cd9_0.1

LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSEtCQUVCQ2dBMEZpRUVWODVNZjJOMWNR
L0xaY1lHUHRXZkpJNUdqSDhGQW1zRW1LY1dIR3RoY25Sb2FXc3UKTVRnNFFHZHRZV2xzTG1OdmJR
QUtDUkErMVo4a2prYU1meC9yREFDQ0VnRzc0dHhTS01BZXlMQ1JyeitsVHN2aQpadXBXVHFpM0JR
RXI2L25DSk5BTko2YVdsMGNWTE5FeUpGUEVNbjh5SlpFMjNyYnVORUpTbGtYdzlrQVkzdTNPCkln
M0pXWjZWTlFMUDJtVDBDQUJ5NXpCc05yK1VhQTEvUnNJQy9SNGdzak1MWG9LNnFHdEV1MUU3a0Fs
ck5zYXIKVVRybzg0YTdSN3V3Tkt0UkcxMWVUZ1BxNE9IeTNmSjVpc0NYMWhGZGRhL3ZGVmgzWUw4
KzNlTzlTUEpBYytKNApYMXZlNHdqaklVSnBTdUlJbnlxR1FrZWxMdEdMeS9FV0xEMnVObmRTU3hC
R0N4NzhtVWVWSmxzTUJJSDVMNG14ClVoQm9ueFhCTDlWTkhHYURYUTFBQkJsOFpEZUhoWnlBZDM0
VUQvVnowZWRVR0N3M1FZM1BPRjhqM1VNcXRydmwKdUVQUmFqajg3OXNQY0dVZk1HeThiYWI0TXFx
a0xubXRUZUpPY3BmSk5YL3JMM0lxZ2F6dFVvcTV0eHFsM05tSwo1bFArTTlmL1RYM21rYnJyQkc5
MTJ3VkU4eXhETHA3UlRWZUFGV0JIT1ozUHdqdmlBMk8xYnlTZnFBVEo1dVpFCkRsdXRsRlBtRzZ5
a3padUxrbEtDOGV1MDlnQjFRcHlFVHRWRGdtbz0KPTRXdHAKLS0tLS1FTkQgUEdQIFNJR05BVFVS
RS0tLS0t
--0000000000007fc60a0660f6e281--
Re: [PATCH v2 02/20] t9300: make the series B tests self-contained
#3774
Author: Tanga Joris
Date: Wed, 25 Nov 2026 01:40
15 lines
12395 bytes
Hi Karthik,

On Mon, 23 Nov 2026 at 22:49, Karthik Nayak <karthik.188@gmail.com> wrote:
> I haven't actually tested, but moving them to different files also
> increases the parallelism of tests plus significant readability
> improvements.

I measured it out of curiosity. On my machine (4 cores), all the
fast-import test scripts went from 17.8s to 21.1s when run one after
another, and from 11.0s to 11.9s with prove -j4. So the split doesn't
quite win the time back at -j4, but the readability is worth it.

Thanks,
Tanga
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads