From nobody Mon Apr 29 13:54:28 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=1584396509; cv=none; d=zohomail.com; s=zohoarc; b=QtnV7ltC3JCshJ6heOyv6+FwCwM7T72LlOR0wWh+wTQL6vAL0MC4eW4l+4/xnPe7fJ5DAwkhn1ch/ILe9ZZCc8++yq08nmqmIKhcYQROXlDNR/Sjsvz+dKzDk30tRreufk/efEKmCVZ0cUpyH/Osv3arhOu/g4+ByQOXGevv85k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396509; 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=RvegJ88q70bON/LohdWsxFm4RI480T8ytw4ZvouggGw=; b=XCPRm9yQA5qskB4ihUtBvpN6I7T1RE2FJi77ETZNHKjn/FTPCbwIKW4eIVnbqVPFh/BYHWZJkUw4wbifBds7ok/+xACwdD2TPVX8xKsubOo3Y6gqS9oUXzmBpTdxU2SDTQWuzwrQMIDUhC+chETDSiJUbmpK+yZqgnKTfK9bTVo= 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 1584396509591853.7439879308628; Mon, 16 Mar 2020 15:08:29 -0700 (PDT) Received: from localhost ([::1]:49806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxuO-0004qt-CZ for importer@patchew.org; Mon, 16 Mar 2020 18:08:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxJg-0006c2-Ps for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:30:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxJf-0007E9-F9 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:30:32 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:40921) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxJf-00078c-8X for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:30:31 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-FWfJVSHBPAij-F8FF4f79Q-1; Mon, 16 Mar 2020 17:30:28 -0400 Received: by mail-wr1-f70.google.com with SMTP id u18so9572832wrn.11 for ; Mon, 16 Mar 2020 14:30:28 -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 r9sm1227253wma.47.2020.03.16.14.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 14:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394230; 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=RvegJ88q70bON/LohdWsxFm4RI480T8ytw4ZvouggGw=; b=hjf3EOJSuePAbojHODSbASxqL7DcH+6CQBa2c1xbyuP3qdjZJHcdwUhgCbrqxL0NPSBxcB gv6mila1weusjHVUuh7eeFfdGXoWaAR3sFIpBMIUnXOcjBsjgKqKcRputLyGkpL8vD+rUW Rx+uxr77SjmeQWviSxj69C1hXtfDjuw= X-MC-Unique: FWfJVSHBPAij-F8FF4f79Q-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=muzU+wYjkhlwqhSb/6Hfi5D5d8nln1GaBm49ftTglK8=; b=pMm6XLKLwcdILyK5jhkAwYHOZH2i6ACDS8nUw90mmAjcb/oGFqGPZk89d7oHAs0qy6 za5appFVubmPmyQVElOvwSPnNYJuuyaZTIu02Jp+U5MoYwfWc5XzfC+rc1jbm12KYpS9 9bnGgSQ0lYlezqLTyDJ4XU9QfbHzMenZhGjVGUmssks0X5FrysGoEYin9swKIpSLVDlM vPjuJxC9yPw589mY4RLFAzjdO48OOxxIpL5ZPc57dktdIbEmpHO+KKUCPW4UTtVkYc7v yOBjDXoksxLoOVRPUPkivS+OgOWIRFNpJpCc7OLfSiDFqScHb+kgLXLAck4Hc1meZ7UU ra4g== X-Gm-Message-State: ANhLgQ3zOmWEDLzb8nfSox6yEo4BnLddK9LvBp6v47i+opHHePxas7Hu vQdTT8Q/NoeQUGPcsiGHepqZ8OtROj8+3AzEyqY9Yfq+D57D2gqTF/K/J6Nn6EBx5+6bv9REWtV iUHPEP0nboAQiubo= X-Received: by 2002:a5d:658f:: with SMTP id q15mr1391218wru.110.1584394226940; Mon, 16 Mar 2020 14:30:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs930wP7+QYV5gzenk0bfT8/td5Vdq02IzYnA4BvZYqs4KZCopo49L5hyBTVPfaAjoE4I9qeg== X-Received: by 2002:a5d:658f:: with SMTP id q15mr1391198wru.110.1584394226692; Mon, 16 Mar 2020 14:30:26 -0700 (PDT) Date: Mon, 16 Mar 2020 17:30:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PATCH v2] checkpatch: enforce process for expected files Message-ID: <20200316212834.664247-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] X-Received-From: 63.128.21.74 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. Tested-by: Igor Mammedov Reviewed-by: Stefan Hajnoczi Signed-off-by: Michael S. Tsirkin --- scripts/checkpatch.pl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b27e4ff5e9..e658e6546f 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 $acpi_testexpected; +my $acpi_nontestexpected; =20 sub help { my ($exitcode) =3D @_; @@ -1256,6 +1258,27 @@ 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$#) { + $acpi_testexpected =3D $name; + } else { + $acpi_nontestexpected =3D $name; + } + if (defined $acpi_testexpected and defined $acpi_nontestexpected) { + ERROR("Do not add expected files together with tests, " . + "follow instructions in " . + "tests/qtest/bios-tables-test.c: both " . + $acpi_testexpected . " and " . + $acpi_nontestexpected . " found\n"); + } +} + sub process { my $filename =3D shift; =20 @@ -1431,9 +1454,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