Article View: linux.kernel.git
Article #3387Re: [PATCH v2 02/20] t9300: make the series B tests self-contained
From: Kaartic Sivaraam
Date: Thu, 19 Nov 2026 12:22
Date: Thu, 19 Nov 2026 12:22
185 lines
16672 bytes
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
Technical Details
Message-ID:
<db459a4f-9454-4855-b1c5-c8ffc9b277ce@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-75830-linux-kernel-git=dewy.ruReferences:
<20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com> <20261112-kn-fast-import-tests-1-v2-2-b8c3a0ab27e8@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-75830-linux-kernel-git=dewy.ru
From: kaartic.sivaraam@gmail.com (Kaartic Sivaraam)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2 02/20] t9300: make the series B tests self-contained
Date: Thu, 19 Nov 2026 17:52:33 +0530
Organization: Usenet Network
Message-ID: <db459a4f-9454-4855-b1c5-c8ffc9b277ce@gmail.com>
References: <20261112-kn-fast-import-tests-1-v2-0-b8c3a0ab27e8@gmail.com>
<20261112-kn-fast-import-tests-1-v2-2-b8c3a0ab27e8@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="2868809"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ADAkRMEMBxKikm4evRsexjO4oJ0= sha256:odwXJgrWuLGvOC0f8zVIWOgMCCICoFsu6gOGAZmH6Uw=
sha1:7Xq5qD6J3J/Bg/koT6USsjB/LT4= sha256:3Pl/QQm04+Omb8FOvpcg66RSQq6zdJ/fqasVoNQ5PcQ=
Content-Language: en-US
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 3861C115623; Thu, 19 Nov 2026 15:22:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id Z2vmXA2JNYE1;
Thu, 19 Nov 2026 15:22:53 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-75830-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 88C0A115607; Thu, 19 Nov 2026 15:22:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 96DD2E711E; Thu, 19 Nov 2026 12:22:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1795090959;
b=wS5KQipw4N5jvzVK8qI+nSyQXrh+ZLeWao7FxaElJjVSNzsPZIdsQ8md2GaznujDCSxD
tWjoGHr0dcUf9vy2ygRCBt1H0yvL1r64Xhql3u0Qtfd6usHfoSoBQMA3NC/4j2fV7ntqj
H4BV9iRhvbYqp9xaUI88Fn6lihJc/MVH9/hWQog5eRgb9Meuyc3ipG5wvbNIhKwNbKFp4
Ep42O7v/ZnXgOA6IEmcVVD00JGxZcH7FQj1G4OO6zZuNLyZfJeKRNJJU21yDmfMlfa8GD
r42CSHApnOJlvUviYXprxrAeOBoqDoHSvDKM/AF5BZ1SLf1vERlVwd9HnTIo/g/Gucg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795090959;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=gMevfWyYDAq/uXFAXCjx80YlEeGrTQFvBJ/PfoThMJc=;
b=TyX24rUkpzAti9Hm+4sjEJ1bEiF27O962QvmstFDveXBF5MBc5d8qCcthUaAJpfOyo3v
BIGrK+IJkJbM/4F4IpZmTGCHGnfQcp1eU5SHGqbSQXc5+8QzJOZwp5CsGhfY5AYG4rBhq
bmrr9itJ1JjeSHP4Pk+W56gdXLriqq974Yw8Fp1YSIy6ajteduBwgbvuK+gsHZwMLRR82
v98aO6Ex6WzjS/9067izZGZ6dfrXZiD81vYpkDXz0+MB05XMgHy95pxWNNlloOpf42QBT
ZPdBC4w8kKejTt5i7DdZhssxjb4cT1kvv046i4oqdAAVCKiC/AZrpsQa5JsZhnSmTqA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=VBNFXxFF;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E2D96606A331;
Thu, 19 Nov 2026 12:22:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=VBNFXxFF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795090958;
b=dkK6aDRPu1RgU/hvlwOgTqDFcqnSkm9Oq8OLpOo9J7K4VcGIZMUt2r6PxTVDrCg9RLvv
csRNTUhSGSlCrPVo/5zOs4IcPAr2O91gt7do3MXPjywf3av9uNfP+vAHI+mQJ1ZUj2gZz
wekElpX7T/7tPyKqZoZ22IeEDybiNKTUjLUEQN1Rgspyzt7zbvY+IFb9XyPPdkw4E9DKB
wCSR0apDWZ3eWO83Kvrp+6mPshzvrJKfOIlZvkDdk+53iaut/upsVgi+eId7sVYn50mPS
e3pcSwdlDt5MiX9vGzVyBbQR+lTLdPA3hduU10euUYKJ7IIffiqkEQxHXp+A8AJ9NGQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795090958;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=gMevfWyYDAq/uXFAXCjx80YlEeGrTQFvBJ/PfoThMJc=;
b=e+twPdB30GkQCL7t/UrJDKTdnNYv3SGYrQwHEcUbJeON8ikkyHrmXGRJuYLvIZLlk8NX
p2B+42fWXw3TxCzwEhT5YMdGWvMiK9dPQ/Ps6cCf9mxEnRQaM9VEFolalp1LEn5LiXOKv
VzMfIVfQVFUbFN2lImvcnxLMkyqgJs8NRb9dt4trgkIhVmnkvwc7OidQyz18VJvdDF5ab
+A28K3GakOWhcs3EP/N0rBB/axEeBrJM1kPlcA0T8quBl27s6DU9v/s/NHBzy6MdwZZul
foif3dutKMWfXS6cUui7TFukhW/rGxq6noNB//zZxS2LOZgVoqXmPNN9LimlZkLhC3A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=VBNFXxFF;
arc=none smtp.remote-ip=209.85.216.46
X-Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7FAB606A32F
for <git@vger.kernel.org>; Thu, 19 Nov 2026 12:22:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A7FAB606A32F
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-3b179528d56so1164286a91.3
for <git@vger.kernel.org>; Thu, 19 Nov 2026 04:22:37 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1795090957; x=1795695757; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=gMevfWyYDAq/uXFAXCjx80YlEeGrTQFvBJ/PfoThMJc=;
b=VBNFXxFFE5uMq968D1yBaj0iA3Ed8zQvNa6FrRCJzhMUejggzVfpEJO+8LPgQ2INol
RqkwA2luxSA47VgXU2P5rn1wGVvXxImIteXRJ0rhkY9BGQnkWySKvrH5Btz4AMYqrZmK
ogPEUgc5zKp0//CU1Xb3ozjt4GAcM4BiLVP5ggy4p2RPG19ZU0guaHQAd1Z2ovnjQyq/
evItvA52+n3EhYzQaK/DDe+5+0Jz1b7E4Juv7yEs+3llzHCooMSGJCBweRjBT3tw40Hl
CGLUvQRr2txAIYyd7ca0eq/0q2o36h87UeqPq0BV1htBFeoZhhXZAX0/keyIpaJHMdLg
ppoA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795090957; x=1795695757;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:re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9jkBqnbQI+TIR+cWLLEPCZu5gQ8w0CaDXouy
8N2ZBV9AM41LVwM4EP6qmhgf/aS3Y2LFFWRlAiZufGqbzSJhnF0iuMcqSewH+W68N+whmsUKOo3
5y/QjPD4JXYxDCEsy2omfISBuXc18IQFKljX3F4538qzQe7k/OYuGGngStlMDVnsAiF3MBcx3yw
EaH5iQRGExDh1jx0CEe1AW2RWkHLqhdQ3qrpvCsX
X-Received: by 2002:a17:90b:57cf:b0:3b4:ac3:8af2 with SMTP id 98e67ed59e1d1-3b40ac38bbamr799997a91.27.1795090956882;
Thu, 19 Nov 2026 04:22:36 -0800 (PST)
X-Received: from [192.168.0.11] ([106.51.27.147])
by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b405776019sm2557963a91.4.2026.11.19.04.22.35
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Thu, 19 Nov 2026 04:22:36 -0800 (PST)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: gitster@pobox.com
X-In-Reply-To: <20261112-kn-fast-import-tests-1-v2-2-b8c3a0ab27e8@gmail.com>