🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
3 messages
3 total messages Started by Karthik Nayak Thu, 12 Nov 2026 17:34
[PATCH v2 05/20] t9300: make the series V tests self-contained
#2996
Author: Karthik Nayak
Date: Thu, 12 Nov 2026 17:34
175 lines
17385 bytes
Similar to the previous commits, modify the tests in 'series V' to make
them independent of state from previous tests.

Move the setup to a 'setup_checkpoint_repo()' function, so each test can
invoke it. The tests used to build on the 'U' branch from series U, so
let the function create a 'base' commit instead. For the same reason,
the tag test now tags 'base' and not 'V'.

'background_import_then_checkpoint()' registers a cleanup with
'test_when_finished', which is not allowed in a subshell, so call it
from the main shell.

The 'no new objects' test needs the 'V' commit in a pack, because
fast-import only detects duplicates against packs and not against loose
objects. It used to rely on the 'fastimport.unpackLimit' set by an
earlier test, so create the commit in the test with
'fastimport.unpackLimit' set to 0.

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

diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index f9359bbaf3..809a5a59c5 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -3854,7 +3854,7 @@ background_import_then_checkpoint () {
 	rm V.output
 
 	(
-		git fast-import $options <&8 >&9 &
+		git -C repo fast-import $options <&8 >&9 &
 		echo $! >&9
 		wait $!
 		echo >&2 "background fast-import terminated too early with exit code $?"
@@ -3906,80 +3906,110 @@ background_import_still_running () {
 	fi
 }
 
+setup_checkpoint_repo () {
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	test_tick &&
+	git -C repo fast-import <<-INPUT_END
+	commit refs/heads/base
+	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+	data <<COMMIT
+	base commit
+	COMMIT
+	INPUT_END
+}
+
 test_expect_success PIPE 'V: checkpoint helper does not get stuck with extra output' '
-	cat >input <<-INPUT_END &&
+	setup_checkpoint_repo &&
+	cat >repo/input <<-INPUT_END &&
 	progress foo
 	progress bar
 
 	INPUT_END
 
-	background_import_then_checkpoint "" input &&
+	background_import_then_checkpoint "" repo/input &&
 	background_import_still_running
 '
 
 test_expect_success PIPE 'V: checkpoint updates refs after reset' '
-	cat >input <<-\INPUT_END &&
+	setup_checkpoint_repo &&
+	cat >repo/input <<-\INPUT_END &&
 	reset refs/heads/V
-	from refs/heads/U
+	from refs/heads/base
 
 	INPUT_END
 
-	background_import_then_checkpoint "" input &&
-	test "$(git rev-parse --verify V)" = "$(git rev-parse --verify U)" &&
+	background_import_then_checkpoint "" repo/input &&
+	test "$(git -C repo rev-parse --verify V)" = "$(git -C repo rev-parse --verify base)" &&
 	background_import_still_running
 '
 
 test_expect_success PIPE 'V: checkpoint updates refs and marks after commit' '
-	cat >input <<-INPUT_END &&
+	setup_checkpoint_repo &&
+	cat >repo/input <<-INPUT_END &&
 	commit refs/heads/V
 	mark :1
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 	data 0
-	from refs/heads/U
+	from refs/heads/base
 
 	INPUT_END
 
-	background_import_then_checkpoint "--export-marks=marks.actual" input &&
+	background_import_then_checkpoint "--export-marks=marks.actual" repo/input &&
+	(
+		cd repo &&
+		echo ":1 $(git rev-parse --verify V)" >marks.expected &&
 
-	echo ":1 $(git rev-parse --verify V)" >marks.expected &&
-
-	test "$(git rev-parse --verify V^)" = "$(git rev-parse --verify U)" &&
-	test_cmp marks.expected marks.actual &&
+		test "$(git rev-parse --verify V^)" = "$(git rev-parse --verify base)" &&
+		test_cmp marks.expected marks.actual
+	) &&
 	background_import_still_running
 '
 
 # Re-create the exact same commit, but on a different branch: no new object is
 # created in the database, but the refs and marks still need to be updated.
 test_expect_success PIPE 'V: checkpoint updates refs and marks after commit (no new objects)' '
-	cat >input <<-INPUT_END &&
+	setup_checkpoint_repo &&
+	git -C repo -c fastimport.unpackLimit=0 fast-import <<-INPUT_END &&
+	commit refs/heads/V
+	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+	data 0
+	from refs/heads/base
+
+	INPUT_END
+
+	cat >repo/input <<-INPUT_END &&
 	commit refs/heads/V2
 	mark :2
 	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 	data 0
-	from refs/heads/U
+	from refs/heads/base
 
 	INPUT_END
 
-	background_import_then_checkpoint "--export-marks=marks.actual" input &&
+	background_import_then_checkpoint "--export-marks=marks.actual" repo/input &&
+	(
+		cd repo &&
+		echo ":2 $(git rev-parse --verify V2)" >marks.expected &&
 
-	echo ":2 $(git rev-parse --verify V2)" >marks.expected &&
-
-	test "$(git rev-parse --verify V2)" = "$(git rev-parse --verify V)" &&
-	test_cmp marks.expected marks.actual &&
+		test "$(git rev-parse --verify V2)" = "$(git rev-parse --verify V)" &&
+		test_cmp marks.expected marks.actual
+	) &&
 	background_import_still_running
 '
 
 test_expect_success PIPE 'V: checkpoint updates tags after tag' '
-	cat >input <<-INPUT_END &&
+	setup_checkpoint_repo &&
+	cat >repo/input <<-INPUT_END &&
 	tag Vtag
-	from refs/heads/V
+	from refs/heads/base
 	tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 	data 0
 
 	INPUT_END
 
-	background_import_then_checkpoint "" input &&
-	git show-ref -d Vtag &&
+	background_import_then_checkpoint "" repo/input &&
+	git -C repo show-ref -d Vtag &&
 	background_import_still_running
 '
 

-- 
2.56.GIT
Re: [PATCH v2 05/20] t9300: make the series V tests self-contained
#3447
Author: Kaartic Sivaraam
Date: Fri, 20 Nov 2026 12:48
55 lines
12761 bytes
On 11/12/26 23:04, Karthik Nayak wrote:
> Similar to the previous commits, modify the tests in 'series V' to make
> them independent of state from previous tests.
> 
> Move the setup to a 'setup_checkpoint_repo()' function, so each test can
> invoke it. The tests used to build on the 'U' branch from series U, so
> let the function create a 'base' commit instead. For the same reason,
> the tag test now tags 'base' and not 'V'.
> 
> 'background_import_then_checkpoint()' registers a cleanup with
> 'test_when_finished', which is not allowed in a subshell, so call it
> from the main shell.
> 

May be also mention that it sets fi_pid that 
background_import_still_running_ expects?

> The 'no new objects' test needs the 'V' commit in a pack, because
> fast-import only detects duplicates against packs and not against loose
> objects. It used to rely on the 'fastimport.unpackLimit' set by an
> earlier test, so create the commit in the test with
> 'fastimport.unpackLimit' set to 0.
> 
> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> ---
>   
>   test_expect_success PIPE 'V: checkpoint updates tags after tag' '
> -	cat >input <<-INPUT_END &&
> +	setup_checkpoint_repo &&
> +	cat >repo/input <<-INPUT_END &&
>   	tag Vtag
> -	from refs/heads/V
> +	from refs/heads/base
>   	tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
>   	data 0
>   
>   	INPUT_END
>   
> -	background_import_then_checkpoint "" input &&
> -	git show-ref -d Vtag &&
> +	background_import_then_checkpoint "" repo/input &&
> +	git -C repo show-ref -d Vtag &&
>   	background_import_still_running
>   '
>   
> 

The way this test series is refactored is different but it is consistent 
with how the commit message describes it to be.

LGTM.

-- 
Sivaraam
Re: [PATCH v2 05/20] t9300: make the series V tests self-contained
#3658
Author: Karthik Nayak
Date: Mon, 23 Nov 2026 19:53
83 lines
15119 bytes
--00000000000099c0600660f6f2d3
Content-Type: text/plain; charset="UTF-8"

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

> On 11/12/26 23:04, Karthik Nayak wrote:
>> Similar to the previous commits, modify the tests in 'series V' to make
>> them independent of state from previous tests.
>>
>> Move the setup to a 'setup_checkpoint_repo()' function, so each test can
>> invoke it. The tests used to build on the 'U' branch from series U, so
>> let the function create a 'base' commit instead. For the same reason,
>> the tag test now tags 'base' and not 'V'.
>>
>> 'background_import_then_checkpoint()' registers a cleanup with
>> 'test_when_finished', which is not allowed in a subshell, so call it
>> from the main shell.
>>
>
> May be also mention that it sets fi_pid that
> background_import_still_running_ expects?
>

True, I'll add it in, but will avoid re-rolling just for it.

>> The 'no new objects' test needs the 'V' commit in a pack, because
>> fast-import only detects duplicates against packs and not against loose
>> objects. It used to rely on the 'fastimport.unpackLimit' set by an
>> earlier test, so create the commit in the test with
>> 'fastimport.unpackLimit' set to 0.
>>
>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
>> ---
>>
>>   test_expect_success PIPE 'V: checkpoint updates tags after tag' '
>> -	cat >input <<-INPUT_END &&
>> +	setup_checkpoint_repo &&
>> +	cat >repo/input <<-INPUT_END &&
>>   	tag Vtag
>> -	from refs/heads/V
>> +	from refs/heads/base
>>   	tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
>>   	data 0
>>
>>   	INPUT_END
>>
>> -	background_import_then_checkpoint "" input &&
>> -	git show-ref -d Vtag &&
>> +	background_import_then_checkpoint "" repo/input &&
>> +	git -C repo show-ref -d Vtag &&
>>   	background_import_still_running
>>   '
>>
>>
>
> The way this test series is refactored is different but it is consistent
> with how the commit message describes it to be.
>
> LGTM.

Thanks for your review :)

--00000000000099c0600660f6f2d3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Disposition: attachment; filename="signature.asc"
Content-Transfer-Encoding: base64
X-Attachment-Id: c51c06777456adaa_0.1

LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSEtCQUVCQ2dBMEZpRUVWODVNZjJOMWNR
L0xaY1lHUHRXZkpJNUdqSDhGQW1zRW1iTVdIR3RoY25Sb2FXc3UKTVRnNFFHZHRZV2xzTG1OdmJR
QUtDUkErMVo4a2prYU1mN2sxREFDQmRhQjRDbmcvMXNQNXI4cWhFYmQrVTUyTgpaMGRjNkdBenRT
bHFBQUpody9qNUg4UkNtQkRwRjk0M09FS3YxUWF0RmF4KzNRNER3UWFUc2lmb1pYY1RBTzNTCjFO
V0ptWHc0QlFnTVBPOGpFWnNEcDZEV3duRUJPWDNybWFVN3BMdU0zWktQS2FxWlpMS1AxRWJ2YWJS
UFJtd3AKZnVjNE51MjQ0b3EvZDE2RElCMnhEaWVTcGFZaktTMHI1Zml6a2lmamorUE94SldzWVdO
VEdDVUkvZWcrNnRwMQp5VVJETHFvcDlBcFBnYTFnaXBndVlRWWJDUWNGUFJEY2pWWVZiMnVZSzVz
c0tMcGZvZFdSQkY1S0JoSUFjTlZ6CkdueW9UdkNISWcyeldvNVBVOUV1c2dmeHduQ3NENUcxQTQ0
QU9HeS9QM3YwenFGanREdWwyWGc2TUo3N3RrRUUKaGNrM0JsaUtjSmZpcWZFZmRFVFpoRDBaVDBm
WHNwNm4vNmlETGRJd0dLay9IRlh2dkNNeUR6ZXpYQVVyQS9FTQpyMW5DYTd0N21QQ2c1eitEY2Jl
bGNIMitWL3pHcElhY2tiMTBNaVk3OXZxTHVDZXNlMzNKNFpqYSs3RHhnL29ZCmo1d1F0dnl2UjVF
Q3JqUFRRS0l4eGVKeVZ3eHUwV0k3OE5RcEJPZz0KPVNUaTIKLS0tLS1FTkQgUEdQIFNJR05BVFVS
RS0tLS0t
--00000000000099c0600660f6f2d3--
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