From nobody Wed May 1 07:55:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584272242; cv=none; d=zohomail.com; s=zohoarc; b=F66rArYsyNdTJeBEcwbt9fWNBoWXdnOBYKCJp6vDM/vuYxYud2mhxO4H32BEZBeCUPTrdyHehuA4BGGqDfQfCN2fkpyMzawPkItolp74V4SKYmGWSig68f8EpXhar11ce2k2z8rqajwV9BG/rm7TmFq2LL1t5Kn//EkCCxfIbio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584272242; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=RjdB9XcGgG/dFT3rZPnXe/qxzZfls3cE6swBtV2krPs=; b=IaBl04S/aYOq0xfxgU4ll1nmk5wzaK3ceF7By7kwpeJ1xV3E2v6uQ+K8mgpoPaAJSQQdsfkMD8ANFShWhqwDMLmQKc+IqWUt0nyhP1Jy4/Fxild6bEl6DyLV8wIoSwdTLnCdG3mfkR7uqBsLYoTO8zj7tw44ZThNebcUEkYycNg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584272242086160.68853331012792; Sun, 15 Mar 2020 04:37:22 -0700 (PDT) Received: from localhost ([::1]:53092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDRa4-00072G-34 for importer@patchew.org; Sun, 15 Mar 2020 07:37:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52628) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDRYj-0006cQ-5b for qemu-devel@nongnu.org; Sun, 15 Mar 2020 07:35:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDRYh-0005EA-Tr for qemu-devel@nongnu.org; Sun, 15 Mar 2020 07:35:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:23837 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDRYh-0005AH-Nn for qemu-devel@nongnu.org; Sun, 15 Mar 2020 07:35:55 -0400 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-zw7ufqfkMye-sKXUI2EEkg-1; Sun, 15 Mar 2020 07:35:53 -0400 Received: by mail-qk1-f200.google.com with SMTP id a21so14156902qkg.6 for ; Sun, 15 Mar 2020 04:35:53 -0700 (PDT) Received: from redhat.com (bzq-79-180-7-202.red.bezeqint.net. [79.180.7.202]) by smtp.gmail.com with ESMTPSA id x11sm19485332qkf.67.2020.03.15.04.35.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2020 04:35:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584272155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RjdB9XcGgG/dFT3rZPnXe/qxzZfls3cE6swBtV2krPs=; b=Krz1oRtVXkz6ukByOw5vlknGoFjNEgt66WBKXSk5bNGz9bEa44QXErmhXnAHk2OfcIl+1L SDJQq1TCHT5OL0hp4HXRdGzewPD18npdo8RTS84h/IwUkDvD4MTmin1XCm0M3qa1z6ozWd xzTxnRr40OVokhh1mXCXz0nMKF7jJ7A= X-MC-Unique: zw7ufqfkMye-sKXUI2EEkg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=eK4MVihWNVcAO0TRQlIG3t5TCKOqRslNJy/UTzxk9sI=; b=nPtdEdq0q1QMa4PMJMXwduHcs8tvjnQ+ojQV6+SdueKygUDFqln9Oxp3Ey0UJXDHTT dT+OnFHI/0MgyG6FeLYB+6N+JsI4809b8KZJYO+UhHYF61MwGYsdMNXWVBquqn3NSQSx O1zDKah/472maYe09+ncMfREkH67Pyi2EmRaahA9IqoZi1qp+xQTfkqXsB0ncArlu31o 4+AzLQwCczjXH9azIpqN0HJovEGPpPCuscNwYHP5GQoo3scMvHgH+EPAtfd6zSpQpzef T72m62skQjBLT5cudaPk6Ycl4rg3KM/5Vq/E/KI8Hz7khSRsbGo5GlBCE/abkIa3SeBj 7KOA== X-Gm-Message-State: ANhLgQ2sWZy6CdDyGq8kKq4p1WN+OWt5+FcwyEQWX9kLeAFPEFF4sZxM A+qghMi8UsFCwpvcyRPt3yxlzkcXttLHrWljS4ow8AID5Vy0FbTB5rV4biBOam8emO1AB/V45ES Onpb8RUsU/Px7lkk= X-Received: by 2002:a37:a08b:: with SMTP id j133mr22666377qke.265.1584272152822; Sun, 15 Mar 2020 04:35:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsaTD6YCrcRI5JRuivMcwgFPz+OpZpuNiO60mFyd4qqKXZroL1/wvvpiy0xzGgD0GzU/Wvd5Q== X-Received: by 2002:a37:a08b:: with SMTP id j133mr22666357qke.265.1584272152577; Sun, 15 Mar 2020 04:35:52 -0700 (PDT) Date: Sun, 15 Mar 2020 07:35:46 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PATCH] checkpatch: enforce process for expected files Message-ID: <20200315113323.526984-1-mst@redhat.com> MIME-Version: 1.0 X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson , Stefan Hajnoczi , imammedo@redhat.com, Paolo Bonzini , Alex =?utf-8?Q?Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" If the process documented in tests/qtest/bios-tables-test.c is followed, then same patch never touches both expected files and code. Teach checkpatch to enforce this rule. Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi Tested-by: Igor Mammedov --- Peter, Igor what do you think? scripts/checkpatch.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b27e4ff5e9..96583e3fff 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -35,6 +35,8 @@ my $summary_file =3D 0; my $root; my %debug; my $help =3D 0; +my $testexpected; +my $nontestexpected; =20 sub help { my ($exitcode) =3D @_; @@ -1256,6 +1258,26 @@ sub WARN { } } =20 +# According to tests/qtest/bios-tables-test.c: do not +# change expected file in the same commit with adding test +sub checkfilename { + my ($name) =3D @_; + if ($name =3D~ m#^tests/data/acpi/# and + # make exception for a shell script that rebuilds the files + not $name =3D~ m#^\.sh$# or + $name =3D~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) { + $testexpected =3D $name; + } else { + $nontestexpected =3D $name; + } + if (defined $testexpected and defined $nontestexpected) { + ERROR("Do not add expected files together with tests, " . + "follow instructions in " . + "tests/qtest/bios-tables-test.c: both " . + $testexpected . " and " . $nontestexpected . " found\n"); + } +} + sub process { my $filename =3D shift; =20 @@ -1431,9 +1453,11 @@ sub process { if ($line =3D~ /^diff --git.*?(\S+)$/) { $realfile =3D $1; $realfile =3D~ s@^([^/]*)/@@ if (!$file); + checkfilename($realfile); } elsif ($line =3D~ /^\+\+\+\s+(\S+)/) { $realfile =3D $1; $realfile =3D~ s@^([^/]*)/@@ if (!$file); + checkfilename($realfile); =20 $p1_prefix =3D $1; if (!$file && $tree && $p1_prefix ne '' && --=20 MST