From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BEA42236FD for ; Sun, 5 Apr 2026 19:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775416586; cv=none; b=tkpAF1BhB8TmL3ZoDHQ1JeGc4tU+Re5AmPTvrjNTuP8MmTF9Whxhi3hfuMuo+G44fOct7+2AYc5IArBb68Ge0rJgiv4cl7N9zHgUJkSQTV89BuVgnW8ejlZneLX73H74mJMLYszZj5qzzEMvGxQpwpdTwtXnPYKYJr2Bfxbh5I0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775416586; c=relaxed/simple; bh=rv70oa9BlpfvyMvveLMQ051qs1rdjAK24HTFNCqVJK4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Lnm82ZKVWeLqKaeO0HrAcDjJx3CYFyYAZjUJ0UMLj/+11tlk7Rb4qJEJKBAOUdcaCOvSACYrRzaoJUfOkLvhwmlJPhcnJ/WjoPrJw4Ds4oThbf9FvaP2W/cjYVZIGhmXap7J/04gqVg+2CNQEgQthFptlZHrEkdsglnBL7B+/Hw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=SYhcV6JN; arc=none smtp.client-ip=117.135.210.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="SYhcV6JN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=2/ HvmOGEAXP/Hz2JRLEWPm3f5t6xc7QOJfJd7vslW1A=; b=SYhcV6JN0f2+vltCDC 95CHCmizIZexsLRjWZXH9J3BvQyiWYSRo1i/8FmuhO50clTP07jy1II+UMvewq4B DD3eVVOMuSp5yA0AiqwidbFop2azerDhuIENIKn9q+xBNC22fppgiXIprzcGnEnE mda5/wXSyFfvGHW9g5hGmKKOI= Received: from localhost.localdomain (unknown []) by gzsmtp3 (Coremail) with SMTP id PigvCgA3WorytNJpOg2CCA--.145S4; Mon, 06 Apr 2026 03:16:08 +0800 (CST) From: CaoRuichuang To: apw@canonical.com, joe@perches.com Cc: dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, linux-kernel@vger.kernel.org, CaoRuichuang Subject: [PATCH v2 2/2] scripts: add sparse checkout regression test for checkpatch tools Date: Mon, 6 Apr 2026 03:15:55 +0800 Message-Id: <20260405191555.80315-3-create0818@163.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20260405191555.80315-1-create0818@163.com> References: <20260405185504.76040-1-create0818@163.com> <20260405191555.80315-1-create0818@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:PigvCgA3WorytNJpOg2CCA--.145S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kr1fJF1DGFy5uw1kJF1xuFg_yoW8Kw48pF 4Y9w15A3y7KrZ7Zws2gF18Jry5t3ZakF45WrnFgF4rtF98tFs5JrWSkF45ZFnrAF15Ga43 Wa98X343Ka1j93JanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRt3kAUUUUU= X-CM-SenderInfo: pfuht3jhqyimi6rwjhhfrp/xtbC6Bh6s2nStPi6VgAA3i Add a shell-based regression test that exercises checkpatch.pl and get_maintainer.pl from a minimal sparse checkout style tree. This locks in the sparse checkout behavior added by the preceding patch and catches future regressions in top_of_kernel_tree() handling for these scripts. Signed-off-by: CaoRuichuang --- scripts/checkpatch-sparse-checkout-test.sh | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 scripts/checkpatch-sparse-checkout-test.sh diff --git a/scripts/checkpatch-sparse-checkout-test.sh b/scripts/checkpatch-sparse-checkout-test.sh new file mode 100755 index 000000000..02e2774a8 --- /dev/null +++ b/scripts/checkpatch-sparse-checkout-test.sh @@ -0,0 +1,48 @@ +#!/bin/sh -eu +# SPDX-License-Identifier: GPL-2.0 + +srctree=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +tmpdir=$(mktemp -d) +trap 'rm -rf "$tmpdir"' EXIT + +mkdir -p "$tmpdir/Documentation/process" "$tmpdir/scripts" + +for file in COPYING CREDITS Kbuild MAINTAINERS Makefile README; do + cp "$srctree/$file" "$tmpdir/$file" +done + +cp "$srctree/Documentation/process/submitting-patches.rst" \ + "$tmpdir/Documentation/process/" +cp "$srctree/scripts/checkpatch.pl" "$tmpdir/scripts/" +cp "$srctree/scripts/get_maintainer.pl" "$tmpdir/scripts/" +cp "$srctree/scripts/spdxcheck.py" "$tmpdir/scripts/" +cp "$srctree/scripts/spelling.txt" "$tmpdir/scripts/" + +git -C "$tmpdir" init -q +git -C "$tmpdir" add \ + COPYING CREDITS Kbuild MAINTAINERS Makefile README \ + Documentation/process/submitting-patches.rst \ + scripts/checkpatch.pl scripts/get_maintainer.pl \ + scripts/spdxcheck.py scripts/spelling.txt + +checkpatch_out=$( + cd "$tmpdir" && + perl scripts/checkpatch.pl --file Documentation/process/submitting-patches.rst \ + 2>&1 || true +) + +echo "$checkpatch_out" | + grep -q "Must be run from the top-level dir. of a kernel tree" && + exit 1 + +get_maintainer_out=$( + cd "$tmpdir" && + perl scripts/get_maintainer.pl -f Documentation/process/submitting-patches.rst \ + 2>&1 +) + +echo "$get_maintainer_out" | + grep -q "The current directory does not appear to be a linux kernel source tree" && + exit 1 + +echo "$get_maintainer_out" | grep -q "Jonathan Corbet" || exit 1 -- 2.39.5 (Apple Git-154)