From patchwork Mon May 4 11:58:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 11525649 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3324913 for ; Mon, 4 May 2020 12:21:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8910E206C0 for ; Mon, 4 May 2020 12:21:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UdJK3YUg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8910E206C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVa66-0006w7-Nu for patchwork-qemu-devel@patchwork.kernel.org; Mon, 04 May 2020 08:21:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVZkb-0004Mh-2Z for qemu-devel@nongnu.org; Mon, 04 May 2020 07:59:10 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:48635 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVZka-0002ve-3T for qemu-devel@nongnu.org; Mon, 04 May 2020 07:59:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588593547; 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: in-reply-to:in-reply-to:references:references; bh=ZbQJE8U0g9/taY1UGB+Es2fg0Z+KJRLr1l0iTS5yKYw=; b=UdJK3YUgQuS/cv9v6rWBfFSYCWcFO9c4MzhpLdWoIjyWX/z/KPlArocdEUJOygmL1v5dYe IRwWJOG2gsOl0Srp2fyxfRD9HaT7RcinozYqXZj+Z3ie51mycuYGRV32gR900OYEeeH9Nu 5MnUFe7U1HdrBJGbl045sEBcGobsDhw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-484-ZLF1LVB2Nmaaftc4W8qbXg-1; Mon, 04 May 2020 07:59:02 -0400 X-MC-Unique: ZLF1LVB2Nmaaftc4W8qbXg-1 Received: by mail-wm1-f71.google.com with SMTP id o26so3368551wmh.1 for ; Mon, 04 May 2020 04:59:01 -0700 (PDT) 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:references :mime-version:content-disposition:in-reply-to; bh=bcYO/D8ZBtkupiZf8L7h1wjpZYqhLskCmEjZ4tplteM=; b=XPt4/V4Su8rbpw0ydtSHj+T2nM7COd5n0OLYlGSjUlSWCCoqIiNtzGCCToswpyE9uy OQ9zAFmBUNZFjKLVISC+zVIMGycYciyMR3ySWafOGPau1je01bRUs6HnuXFWhGd9V4mo xzP5GTXiRjfvM4h9VAklvqCjA4RQmuMWsHg4hfqdtn+08SoerHXu9PumdTIX1Dm9DF7X 75+Un3yx9pgaUs0sQTAaTBzK4fhagGkRb5LPreNwPwByNB2P3wD7TO3/hPwCcxGleiiV CSOLBQ2ay9uO9boeO8T6l7yiNHvqmJFpRwIxm+RpJQ4ZgiW/wem+7qeqedFXv3r6SJOL ODnA== X-Gm-Message-State: AGi0PuZvrfzamsYH2Hv+BtRBD2grl3PBQdLZxFhmWdIO8xicsTTPrvOV MXUxhDZ1V+TcTExKpL7u97twGsUANuchiyC2xnDEULxv9ek/fvi16uWxdUiKl23Rc0xBd1xCfXJ gday0pYSAQ/uXGYk= X-Received: by 2002:a5d:50ce:: with SMTP id f14mr9976376wrt.251.1588593540663; Mon, 04 May 2020 04:59:00 -0700 (PDT) X-Google-Smtp-Source: APiQypLfmb/j5FeF1BME42FpVRXU3QSoDM69pe+udfIAq3W07au5Ij0q7LcAQPA6+c/uzqT1llQVyA== X-Received: by 2002:a5d:50ce:: with SMTP id f14mr9976352wrt.251.1588593540421; Mon, 04 May 2020 04:59:00 -0700 (PDT) Received: from redhat.com (bzq-109-66-7-121.red.bezeqint.net. [109.66.7.121]) by smtp.gmail.com with ESMTPSA id 32sm17110071wrg.19.2020.05.04.04.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 04:59:00 -0700 (PDT) Date: Mon, 4 May 2020 07:58:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PATCH 1/2] checkpatch: fix acpi check with multiple file name Message-ID: <20200504115848.34410-2-mst@redhat.com> References: <20200504115848.34410-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200504115848.34410-1-mst@redhat.com> 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-Disposition: inline Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 04:24:57 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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 , Alex =?utf-8?q?Benn=C3=A9e?= , Shameerali Kolothum Thodi , Stefan Hajnoczi , Igor Mammedov , Paolo Bonzini , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Using global expected/nonexpected values causes false positives when testing multiple patches in one checkpatch run: one patch can change expected, another one non-expected. Use local variables within process() to fix that. Signed-off-by: Michael S. Tsirkin --- scripts/checkpatch.pl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index e658e6546f..c3d08aa99f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -35,8 +35,6 @@ my $summary_file = 0; my $root; my %debug; my $help = 0; -my $acpi_testexpected; -my $acpi_nontestexpected; sub help { my ($exitcode) = @_; @@ -1261,21 +1259,22 @@ sub WARN { # According to tests/qtest/bios-tables-test.c: do not # change expected file in the same commit with adding test sub checkfilename { - my ($name) = @_; + my ($name, $acpi_testexpected, $acpi_nontestexpected) = @_; + if ($name =~ m#^tests/data/acpi/# and # make exception for a shell script that rebuilds the files not $name =~ m#^\.sh$# or $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) { - $acpi_testexpected = $name; + $$acpi_testexpected = $name; } else { - $acpi_nontestexpected = $name; + $$acpi_nontestexpected = $name; } - if (defined $acpi_testexpected and defined $acpi_nontestexpected) { + 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"); + $$acpi_testexpected . " and " . + $$acpi_nontestexpected . " found\n"); } } @@ -1325,6 +1324,9 @@ sub process { my %suppress_whiletrailers; my %suppress_export; + my $acpi_testexpected; + my $acpi_nontestexpected; + # Pre-scan the patch sanitizing the lines. sanitise_line_reset(); @@ -1454,11 +1456,11 @@ sub process { if ($line =~ /^diff --git.*?(\S+)$/) { $realfile = $1; $realfile =~ s@^([^/]*)/@@ if (!$file); - checkfilename($realfile); + checkfilename($realfile, \$acpi_testexpected, \$acpi_nontestexpected); } elsif ($line =~ /^\+\+\+\s+(\S+)/) { $realfile = $1; $realfile =~ s@^([^/]*)/@@ if (!$file); - checkfilename($realfile); + checkfilename($realfile, \$acpi_testexpected, \$acpi_nontestexpected); $p1_prefix = $1; if (!$file && $tree && $p1_prefix ne '' && From patchwork Mon May 4 11:59:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 11525641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D68F14B4 for ; Mon, 4 May 2020 12:15:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1227C206A5 for ; Mon, 4 May 2020 12:15:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iNu31BtR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1227C206A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVa0c-0001e5-82 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 04 May 2020 08:15:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVZkZ-0004Jf-NU for qemu-devel@nongnu.org; Mon, 04 May 2020 07:59:07 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:54449 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jVZkY-0002vN-ND for qemu-devel@nongnu.org; Mon, 04 May 2020 07:59:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588593545; 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: in-reply-to:in-reply-to:references:references; bh=fvBdJ5beAcx5ETaxyqLjGGsvHSXEGwdO8SCWGzPboug=; b=iNu31BtRYBfm0ygi8k9GLX16ZmXvq8BlBpH/7gHSepPcz29WibQZRQKZtQsw0tdLYlrIVL UgshCFOr8mO+R9Sv9kRsMSbNb6z0ZBs0njTw9tIACAh2QGgRM0QX/dpm+8eqszjqDAeelz FQFK0MIT77ZCaYMvTlmVWkxxVJrhHHg= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-240-yry_MjBHPsuuOfh5M4D6sw-1; Mon, 04 May 2020 07:59:04 -0400 X-MC-Unique: yry_MjBHPsuuOfh5M4D6sw-1 Received: by mail-wr1-f72.google.com with SMTP id q13so1753827wrn.14 for ; Mon, 04 May 2020 04:59:04 -0700 (PDT) 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:references :mime-version:content-disposition:in-reply-to; bh=JtHWGy8MS63RnTw62YE9/Nri9iozspFrFIvB4vm6Ufs=; b=DAV5uxOjFXWOT5LZwPcqKyuI/PinLVF0kKX+FFGISLRYDNHEkgk37r8rT1yvu+kF6F dLZsqlAW9brFnNi/dROiZVUjuJ3A/2+zT1fnyI3XLo45s4q9XTogXYLHijrnP7GelF3k A2XDO92P2h59kLDHfY8gxVkbTs3R0MKegwgrabbxY4SM5ZjMVCFzMHHPZbeP6LtF8wMm KlTVidNJfnLylIJtgpOX9COKT7xdc/dR15m4xMMNKaZu/Xo9n0PjEIEaHYDzQbzfBQ1i wWJ+QYF3VFbJuvTLmZD6Uu1mlohlA4jbLqzX/V/TcfCio/L6J3um+06v4wx24oQlnqRK p4ig== X-Gm-Message-State: AGi0PuaC+Ap4ugYnLXAsTiFQhqBkvXTifDQPQetds5U0j0FsRCnFmHNN EwQfSLcels0pxRYvU68PhSKP7KfcKKLpcw7zvszLB1nNENkBbeqWpgFUMGZ4xzNdXkLAo2B+uc8 cdRxln/MmtN2HsVY= X-Received: by 2002:a1c:8141:: with SMTP id c62mr14184560wmd.87.1588593542836; Mon, 04 May 2020 04:59:02 -0700 (PDT) X-Google-Smtp-Source: APiQypIoUoNKzHtakki1Y3rqsnGxwoG8otU9SeIdSkWIE4zIWiyR3cnL77EY4N8aqOWGLb8eBs/zZg== X-Received: by 2002:a1c:8141:: with SMTP id c62mr14184541wmd.87.1588593542671; Mon, 04 May 2020 04:59:02 -0700 (PDT) Received: from redhat.com (bzq-109-66-7-121.red.bezeqint.net. [109.66.7.121]) by smtp.gmail.com with ESMTPSA id y9sm12523345wmm.26.2020.05.04.04.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 04:59:02 -0700 (PDT) Date: Mon, 4 May 2020 07:59:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PATCH 2/2] checkpatch: ignore allowed diff list Message-ID: <20200504115848.34410-3-mst@redhat.com> References: <20200504115848.34410-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200504115848.34410-1-mst@redhat.com> 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-Disposition: inline Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 01:21:32 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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 , Richard Henderson , Shameerali Kolothum Thodi , Stefan Hajnoczi , Igor Mammedov , Paolo Bonzini , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Allow changing allowed diff list at any point: - when changing code under test - when adding expected files It's just a list of files so easy to review and merge anyway. Signed-off-by: Michael S. Tsirkin --- scripts/checkpatch.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c3d08aa99f..0ba213e9f2 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1261,12 +1261,13 @@ sub WARN { sub checkfilename { my ($name, $acpi_testexpected, $acpi_nontestexpected) = @_; - if ($name =~ m#^tests/data/acpi/# and - # make exception for a shell script that rebuilds the files - not $name =~ m#^\.sh$# or - $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) { + # Note: shell script that rebuilds the expected files is in the same + # directory as files themselves. + # Note: allowed diff list can be changed both when changing expected + # files and when changing tests. + if ($name =~ m#^tests/data/acpi/# and not $name =~ m#^\.sh$#) { $$acpi_testexpected = $name; - } else { + } elsif ($name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) { $$acpi_nontestexpected = $name; } if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {