From: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
To: Karthik Nayak <karthik.188@gmail.com>, git@vger.kernel.org
Cc: gitster@pobox.com
Subject: Re: [PATCH v2 02/20] t9300: make the series B tests self-contained
Date: Thu, 19 Nov 2026 17:52:33 +0530 [thread overview]
Message-ID: <db459a4f-9454-4855-b1c5-c8ffc9b277ce@gmail.com> (raw)
In-Reply-To: <20261112-kn-fast-import-tests-1-v2-2-b8c3a0ab27e8@gmail.com>
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
next prev parent reply other threads:[~2026-11-19 12:22 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 11:49 [PATCH 00/20] t9300: group and move tests to other files Karthik Nayak
2026-11-10 11:49 ` [PATCH 01/20] t9300: move 'fastimport.unpackLimit' to the required test Karthik Nayak
2026-11-10 11:49 ` [PATCH 02/20] t9300: make the series B tests self-contained Karthik Nayak
2026-11-10 11:49 ` [PATCH 03/20] t9300: make the series T " Karthik Nayak
2026-11-10 11:49 ` [PATCH 04/20] t9300: make the series S " Karthik Nayak
2026-11-10 11:49 ` [PATCH 05/20] t9300: make the series V " Karthik Nayak
2026-11-10 11:49 ` [PATCH 06/20] t9300: make the series Q " Karthik Nayak
2026-11-10 11:49 ` [PATCH 07/20] t9300: make the series P " Karthik Nayak
2026-11-10 11:49 ` [PATCH 08/20] t9300: make the series O " Karthik Nayak
2026-11-10 11:49 ` [PATCH 09/20] t9300: make the big blob " Karthik Nayak
2026-11-10 11:49 ` [PATCH 10/20] t9300: make the ref update " Karthik Nayak
2026-11-10 11:49 ` [PATCH 11/20] t9300: make the date format " Karthik Nayak
2026-11-10 11:49 ` [PATCH 12/20] t9300: make the pack edges test self-contained Karthik Nayak
2026-11-10 11:49 ` [PATCH 13/20] t9300: make the marks tests self-contained Karthik Nayak
2026-11-10 11:49 ` [PATCH 14/20] t9300: make the series Y " Karthik Nayak
2026-11-10 11:50 ` [PATCH 15/20] t9300: make the cat-blob " Karthik Nayak
2026-11-10 11:50 ` [PATCH 16/20] t9300: make the feature and option " Karthik Nayak
2026-11-10 11:50 ` [PATCH 17/20] t9300: make the stream " Karthik Nayak
2026-11-10 11:50 ` [PATCH 18/20] t9300: make the get-mark and encoding " Karthik Nayak
2026-11-10 11:50 ` [PATCH 19/20] t9300: move self-contained tests into dedicated files Karthik Nayak
2026-11-10 11:50 ` [PATCH 20/20] t93xx: drop the series letter from the moved test names Karthik Nayak
2026-11-10 16:45 ` [PATCH 00/20] t9300: group and move tests to other files Junio C Hamano
2026-11-10 20:06 ` Junio C Hamano
2026-11-11 11:22 ` Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 01/20] t9300: move 'fastimport.unpackLimit' to the required test Karthik Nayak
2026-11-19 10:06 ` Kaartic Sivaraam
2026-11-12 17:34 ` [PATCH v2 02/20] t9300: make the series B tests self-contained Karthik Nayak
2026-11-19 12:22 ` Kaartic Sivaraam [this message]
2026-11-12 17:34 ` [PATCH v2 03/20] t9300: make the series T " Karthik Nayak
2026-11-19 12:45 ` Kaartic Sivaraam
2026-11-12 17:34 ` [PATCH v2 04/20] t9300: make the series S " Karthik Nayak
2026-11-19 18:27 ` Kaartic Sivaraam
2026-11-12 17:34 ` [PATCH v2 05/20] t9300: make the series V " Karthik Nayak
2026-11-20 12:48 ` Kaartic Sivaraam
2026-11-12 17:34 ` [PATCH v2 06/20] t9300: make the series Q " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 07/20] t9300: make the series P " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 08/20] t9300: make the series O " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 09/20] t9300: make the big blob " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 10/20] t9300: make the ref update " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 11/20] t9300: make the date format " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 12/20] t9300: make the pack edges test self-contained Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 13/20] t9300: make the marks tests self-contained Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 14/20] t9300: make the series Y " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 15/20] t9300: make the cat-blob " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 16/20] t9300: make the feature and option " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 17/20] t9300: make the stream " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 18/20] t9300: make the get-mark and encoding " Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 19/20] t9300: move self-contained tests into dedicated files Karthik Nayak
2026-11-12 17:34 ` [PATCH v2 20/20] t93xx: drop the series letter from the moved test names Karthik Nayak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db459a4f-9454-4855-b1c5-c8ffc9b277ce@gmail.com \
--to=kaartic.sivaraam@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karthik.188@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.