From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136354; cv=none; d=zohomail.com; s=zohoarc; b=eB/x0c1gQn728zEblhKq8JqBFOjQV+4ZNaMJ2el/TVkL9tLUfmGC2bkHluUuEyY0pT3KDd1taoT6+EIB8dI9aUcyEQIRAJQY20HgApnyI9VQHuCTXO893vB7AAEUkcmC1kRpbp8N5qJVE4+/3NtbwyGFvgYwlbF5Pea1ksWNw5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136354; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HTraDd7OsdfeT5pdXBXV83l2Iq2KOtHyPxW0VgP/v2w=; b=mcSZ2GLqIpuFfBxAXGeOHF4DZbcTm3qa6MFdGLH1Y40X/XUS4Dz2W83ZudsAMrOXf3isiweFM1fnqHODyDXq4+uI7vtrLm4smafWfyn9TRvPxjoiPHHysmDjDrGVEmRhhWffZ+0Fd/ZRsnG5P7t0mCjhQxi4vxVed9XDgXcw+BA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613136354163498.33449678995873; Fri, 12 Feb 2021 05:25:54 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-uYguaLQ7P3CiRPKGN6Lg3A-1; Fri, 12 Feb 2021 08:25:50 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59E49107ACE6; Fri, 12 Feb 2021 13:25:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 19A311A262; Fri, 12 Feb 2021 13:25:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A3CFE18095CC; Fri, 12 Feb 2021 13:25:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPdTv008591 for ; Fri, 12 Feb 2021 08:25:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id A20786E51B; Fri, 12 Feb 2021 13:25:39 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id E86F56E405; Fri, 12 Feb 2021 13:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136353; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HTraDd7OsdfeT5pdXBXV83l2Iq2KOtHyPxW0VgP/v2w=; b=HfnFi+KfiVEzHqF4ZpUTviQcrAIlJ5avrMoGZ3S8iYWlCa8p5qO4Rgzt7XqKJFSKExBLzp bBrcOB+jjgkzrmDIgZ6pQ65cTl7f9PcFfA7lD1FIltfU+ykAqv6rWnXC3pYHBT7FArf+qW cRywLDTTiSAYEz5rNHKIU/puFz5eLAw= X-MC-Unique: uYguaLQ7P3CiRPKGN6Lg3A-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] clang-tidy: Add a simple runner Date: Fri, 12 Feb 2021 14:25:25 +0100 Message-Id: <20210212132534.29066-2-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Run clang-tidy with default configuration on all files listed in the compilation database. Note that the generated files in the build directory have to be built first. The simplest way to achieve this is to build libVirt first. Example: $ meson build && ninja -C build $ ./scripts/run-clang-tidy.py -p build Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 scripts/run-clang-tidy.py diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py new file mode 100755 index 0000000000..10c8b80fe0 --- /dev/null +++ b/scripts/run-clang-tidy.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 + +import argparse +import json +import os +import subprocess +import sys + + +def parse_args(): + parser =3D argparse.ArgumentParser(description=3D"caching clang-tidy r= unner") + parser.add_argument( + "-p", + dest=3D"build_dir", + default=3D".", + help=3D"Path to build directory") + + return parser.parse_args() + + +def run_clang_tidy(item): + cmd =3D ( + "clang-tidy", + "--warnings-as-errors=3D*", + "-p", + item["directory"], + item["file"]) + result =3D subprocess.run( + cmd, + stdout=3Dsubprocess.PIPE, + stderr=3Dsubprocess.PIPE, + universal_newlines=3DTrue) + return { + "returncode": result.returncode, + "stdout": result.stdout.strip(), + "stderr": result.stderr.strip(), + } + + +def worker(): + for item in items: + os.chdir(item["directory"]) + + print(item["file"]) + + result =3D run_clang_tidy(item) + + if result["returncode"] !=3D 0: + findings.append(item["file"]) + if result["stdout"]: + print(result["stdout"]) + if result["stderr"]: + print(result["stderr"]) + + +args =3D parse_args() +findings =3D list() + +with open(os.path.join(args.build_dir, "compile_commands.json")) as f: + items =3D json.load(f) + +worker() + +if findings: + print("Findings in %s file(s):" % len(findings)) + for finding in findings: + print(" %s" % finding) + sys.exit(1) --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136371; cv=none; d=zohomail.com; s=zohoarc; b=i6vGyZGIu1vxuWEZLyB9ocM4e8zy+TLdiQFGw/yCjOizA8GvPTGzShzGerY+Mw9g3soKd7L+SH7uja9XipPwRKDSkzPZw7hjSrKg4iO2bBM9hUt4zV1+9C8O4obkcXKMx75BFsuQBOtZ2oG1GMX2/OAfAUebD/BGBSdr8NZghpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136371; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AldqHdb2LNEUJ1U61eqt20UqPU15rdMAfvqCUyJ1W18=; b=MM0ryqIrCWsxjTkCaVhlpm1OQdInEXowl42NtT0SCNW76ouUK/aCxI7KROAQfth7k3iHXXFZstWEkmkVUDruyqQZTzC4Ja8z9xU1HLDQh/kJzObJEyWM0r8F1H9CAzW2rGj6AxIl9EZT/ZqKC9hOx69ikyufkL+bkYGh7vrrYV8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613136371026372.4864418301174; Fri, 12 Feb 2021 05:26:11 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-579-U9veB5FGN3qGaj72gedVVw-1; Fri, 12 Feb 2021 08:26:07 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E9EF1936B70; Fri, 12 Feb 2021 13:26:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E893EE2C3; Fri, 12 Feb 2021 13:26:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AE59B57DFF; Fri, 12 Feb 2021 13:26:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPeFR008602 for ; Fri, 12 Feb 2021 08:25:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id AB35A614EB; Fri, 12 Feb 2021 13:25:40 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 000706E405; Fri, 12 Feb 2021 13:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136369; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AldqHdb2LNEUJ1U61eqt20UqPU15rdMAfvqCUyJ1W18=; b=I3q39WhO5LfF55JKw50RW2bZU4Oce5qSGU9C7ZffbnvsOCNRYYcKj0G+4M0Gec1K0gu63/ O2yUs/VcMwkZvNPclzrTnnpZCxQtbn00jAGXq5WzTQpJL663Wq2KhS61g+QhS7JOBeGAqn gTEucUKwhRRDfyqFw7sJzhqyojoX9OE= X-MC-Unique: U9veB5FGN3qGaj72gedVVw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] clang-tidy: Run in parallel Date: Fri, 12 Feb 2021 14:25:26 +0100 Message-Id: <20210212132534.29066-3-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Similar to the "official" run-clang-tidy script. Defaults to run one thread per core, making the tool more pleasant to use locally. Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index 10c8b80fe0..79d9fb38b2 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -2,9 +2,12 @@ =20 import argparse import json +import multiprocessing import os +import queue import subprocess import sys +import threading =20 =20 def parse_args(): @@ -14,6 +17,12 @@ def parse_args(): dest=3D"build_dir", default=3D".", help=3D"Path to build directory") + parser.add_argument( + "-j", + dest=3D"thread_num", + default=3Dmultiprocessing.cpu_count(), + type=3Dint, + help=3D"Number of threads to run") =20 return parser.parse_args() =20 @@ -38,28 +47,39 @@ def run_clang_tidy(item): =20 =20 def worker(): - for item in items: + while True: + item =3D items.get() os.chdir(item["directory"]) =20 print(item["file"]) =20 result =3D run_clang_tidy(item) =20 - if result["returncode"] !=3D 0: - findings.append(item["file"]) - if result["stdout"]: - print(result["stdout"]) - if result["stderr"]: - print(result["stderr"]) + with lock: + if result["returncode"] !=3D 0: + findings.append(item["file"]) + if result["stdout"]: + print(result["stdout"]) + if result["stderr"]: + print(result["stderr"]) + + items.task_done() =20 =20 args =3D parse_args() +items =3D queue.Queue() +lock =3D threading.Lock() findings =3D list() =20 +for _ in range(args.thread_num): + threading.Thread(target=3Dworker, daemon=3DTrue).start() + with open(os.path.join(args.build_dir, "compile_commands.json")) as f: - items =3D json.load(f) + compile_commands =3D json.load(f) + for compile_command in compile_commands: + items.put(compile_command) =20 -worker() +items.join() =20 if findings: print("Findings in %s file(s):" % len(findings)) --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136373; cv=none; d=zohomail.com; s=zohoarc; b=PYsAk+m2jgiRmYlsF2RxERqtPSTiFycuTQwtMRTp4kYn998nHn7kKrp4jrQNnV0CEdVFny09lDcGEtYR+DbfxgU4D9sT5BFB2OszMHJlG1+4QMZkMtj3gAFG3SejKDSexWz2cK/0F5lT2atBR+HOdl0HOJyGxZHlrXn/TVh4LsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136373; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XIAwwdGghApTBrytY3I8JvCzCSxAX2l8JTWCmcAxfCA=; b=L3tZ/ewMWI2CGrkuP5EMaYU4umlC9Ra3SLgrqALWb6a1hOlGE5eWjtPFa/atE2THC0WWmM6Ypzyt/+LBGJxIxWHXRPKxqB3G5ZvWO4KokXNtN6KQ1/R6Mt56iVVqmzgup5ToBNeS6OAzK6sltErf1osDhTMw6Di62oE2rJzyXd0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613136373550742.7161755743058; Fri, 12 Feb 2021 05:26:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-283-jTtpcW99PBOtk8JWwG5Jeg-1; Fri, 12 Feb 2021 08:26:10 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D176C107ACF5; Fri, 12 Feb 2021 13:26:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A840B5D769; Fri, 12 Feb 2021 13:26:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E70018095CD; Fri, 12 Feb 2021 13:26:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPfRc008607 for ; Fri, 12 Feb 2021 08:25:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id B3489614EB; Fri, 12 Feb 2021 13:25:41 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 091C0648A8; Fri, 12 Feb 2021 13:25:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136372; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XIAwwdGghApTBrytY3I8JvCzCSxAX2l8JTWCmcAxfCA=; b=UlW+GvRpIpcD/Y04B0cLkF95LoAXkuEZKfmKSYDWvF9GNZHS6iUm/Y8QbGgf8tMG9rhnwU KH2LCI80ZlKyWLLO71WUwnYCY6JT9WiJ0E0fYqDizDC2d6lkkAYzNUzzesk2hyA4E3m2zg p9wW6nUAlzufKZn4PmqDPwBj6xpTJjg= X-MC-Unique: jTtpcW99PBOtk8JWwG5Jeg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] clang-tidy: Filter output Date: Fri, 12 Feb 2021 14:25:27 +0100 Message-Id: <20210212132534.29066-4-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" GitLab's CI output is capped at a certain size. Filter out all status messages that do not add value. Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index 79d9fb38b2..dc5880878b 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -5,11 +5,32 @@ import json import multiprocessing import os import queue +import re import subprocess import sys import threading =20 =20 +spam =3D [ + re.compile("^[0-9]+ (warning|error)[s]? .*generated"), + re.compile("^[0-9]+ warning[s]? treated as error"), + re.compile("^Suppressed [0-9]+ warning[s]?"), + re.compile("^Use .* to display errors from all non-system headers"), + re.compile("Error while processing "), + re.compile("Found compiler error"), +] + + +def remove_spam(output): + retval =3D list() + for line in output.split("\n"): + if any([s.match(line) for s in spam]): + continue + retval.append(line) + + return "\n".join(retval) + + def parse_args(): parser =3D argparse.ArgumentParser(description=3D"caching clang-tidy r= unner") parser.add_argument( @@ -41,8 +62,8 @@ def run_clang_tidy(item): universal_newlines=3DTrue) return { "returncode": result.returncode, - "stdout": result.stdout.strip(), - "stderr": result.stderr.strip(), + "stdout": remove_spam(result.stdout.strip()), + "stderr": remove_spam(result.stderr.strip()), } =20 =20 --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136355; cv=none; d=zohomail.com; s=zohoarc; b=NcmnnpRT89AySEz9//Ji7ap4yZMK37oWDvfdqvhUTDjwMh5QJfVryD00iaQSWUUGtBHi700AugDbkTcGyKzJlvEuqajl7ghCv91auXxDNYvPbMGepmGX21vic97ny3fVB9bwEF8pBfCYdZkweMyxP+YP1g3bhuSIflpRIxLqqXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136355; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7DvUxtUhIytZkd8gL9M0TXZ9Ut4g9ZHd6FgjW0dKWjQ=; b=HF3Rtpnxu5oAhPvhn2eBZ0+n287GYJiJQfF9atVX0c4Oitf7fXBDKTSfQ+seRsGWLI+HXp7ysllKknCZVNYQGrbizZtz3kCg31eIe7V49TNxNxWLVuivgmKPM9zLocyiy4sfDVIFbmTDJxs3UEwwC0b0XAs1aDJIKceSUwkbfCc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161313635471393.58229357084304; Fri, 12 Feb 2021 05:25:54 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-214-XCa9qF2-MSaPg6AO-v5O1A-1; Fri, 12 Feb 2021 08:25:51 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC580100CCC4; Fri, 12 Feb 2021 13:25:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9AA95C3FD; Fri, 12 Feb 2021 13:25:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5A37457DFC; Fri, 12 Feb 2021 13:25:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPgUu008616 for ; Fri, 12 Feb 2021 08:25:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF2766E405; Fri, 12 Feb 2021 13:25:42 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10FC7648A8; Fri, 12 Feb 2021 13:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136353; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=7DvUxtUhIytZkd8gL9M0TXZ9Ut4g9ZHd6FgjW0dKWjQ=; b=LI49DNKJs+P4FGldyj40w344HrtPls3v/MvgBgnpmRzTTuvYxryEb/zvga1NdAmCnHHzDP U0iJY+tMw9xJp/oVeo/iC2X+CrB2swkxiOiwIqCT9asau8RpRnWVhQ2Zx2GNxUWYJ4o3MA EIvgNW2wlXG6yZLWNuCN1R9JuMwr768= X-MC-Unique: XCa9qF2-MSaPg6AO-v5O1A-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] clang-tidy: Add cache Date: Fri, 12 Feb 2021 14:25:28 +0100 Message-Id: <20210212132534.29066-5-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Cache the results of clang-tidy. The cache is keyed, for each file, on: * the file name, * the exact command used to compile the file to detect changes in arguments, * the hash of the preprocessor stage output to detect changes in includes. A later patch also adds the list of enabled checks to the cache key. Running clang-tidy uncached takes between 95 and 110 minutes single threaded (just over 9 minutes wall time on a 12 core builder), depending on the set = of enabled checks. In the ideal case, where no source files changes, this numb= er is reduced to 80 seconds (9 seconds on a 12 core builder), when caching is enabled. This makes clang-tidy much more pleasant to work with locally, but is not enough to guarantee painless CI operation: While GitLab does support caching between builds and can be configured to retain the cache even when the job fails, this does not happen when the job times out after 60 minutes or the job is manually aborted. Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 83 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index dc5880878b..cc9c20ea32 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -1,14 +1,17 @@ #!/usr/bin/env python3 =20 import argparse +import hashlib import json import multiprocessing import os import queue import re +import shlex import subprocess import sys import threading +import time =20 =20 spam =3D [ @@ -44,6 +47,10 @@ def parse_args(): default=3Dmultiprocessing.cpu_count(), type=3Dint, help=3D"Number of threads to run") + parser.add_argument( + "--cache", + dest=3D"cache", + help=3D"Path to cache directory") =20 return parser.parse_args() =20 @@ -67,14 +74,75 @@ def run_clang_tidy(item): } =20 =20 +def cache_name(item): + if not args.cache: + return None + + cmd =3D shlex.split(item["command"]) + for index, element in enumerate(cmd): + if element =3D=3D "-o": + cmd[index + 1] =3D "/dev/stdout" + continue + if element =3D=3D "-MD": + cmd[index] =3D None + if element in ("-MQ", "-MF"): + cmd[index] =3D None + cmd[index + 1] =3D None + cmd =3D [c for c in cmd if c is not None] + cmd.append("-E") + + result =3D subprocess.run( + cmd, + stdout=3Dsubprocess.PIPE, + universal_newlines=3DTrue) + + if result.returncode !=3D 0: + return None + + hashsum =3D hashlib.sha256() + hashsum.update(item["command"].encode()) + hashsum.update(result.stdout.encode()) + + basename =3D "".join([c if c.isalnum() else "_" for c in item["output"= ]]) + return os.path.join(args.cache, "%s-%s" % (basename, hashsum.hexdigest= ())) + + +def cache_read(filename): + if filename is None: + return None + + try: + with open(filename) as f: + return json.load(f) + except FileNotFoundError: + pass + except json.decoder.JSONDecodeError: + pass + return None + + +def cache_write(filename, result): + if filename is None: + return + + with open(filename, "w") as f: + json.dump(result, f) + + def worker(): while True: item =3D items.get() os.chdir(item["directory"]) =20 - print(item["file"]) + cache =3D cache_name(item) + result =3D cache_read(cache) + with lock: + print(item["file"], "" if result is None else "(from cache)") + + if result is None: + result =3D run_clang_tidy(item) =20 - result =3D run_clang_tidy(item) + cache_write(cache, result) =20 with lock: if result["returncode"] !=3D 0: @@ -92,6 +160,10 @@ items =3D queue.Queue() lock =3D threading.Lock() findings =3D list() =20 +if args.cache: + args.cache =3D os.path.abspath(args.cache) + os.makedirs(args.cache, exist_ok=3DTrue) + for _ in range(args.thread_num): threading.Thread(target=3Dworker, daemon=3DTrue).start() =20 @@ -102,6 +174,13 @@ with open(os.path.join(args.build_dir, "compile_comman= ds.json")) as f: =20 items.join() =20 +if args.cache: + cutoffdate =3D time.time() - 7 * 24 * 60 * 60 + for filename in os.listdir(args.cache): + pathname =3D os.path.join(args.cache, filename) + if os.path.getmtime(pathname) < cutoffdate: + os.remove(pathname) + if findings: print("Findings in %s file(s):" % len(findings)) for finding in findings: --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136372; cv=none; d=zohomail.com; s=zohoarc; b=nKEYtT2NtJKnb64SPl375f0DlefX0hHrBXGAuhkh6tG4RFnSdmsnDJcjwVexflnRgKZLxszVm0gIjsFgn0nUtxWrjKQEgAxiFPJCmtvP09IZSbTJ4SMErX/t6QYtI6KrUbMxthOagDalaUThT+TQZu3q4EqskSGlhAqc/RsHRbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136372; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YqckMi8qH2vQJ6UznLqZZnsRTunq04SPcjpWb2zwhL4=; b=XGY4H2P9Ymv0fVRpxat96EJGcT9dZe1xEbQPi4jgDp6YZ2JavTXKtjW3f2PWrQluy35+Y2ZVfUekfP8q0S9nCBZY/+2lNv85l1hqqf4GKMetZ14ppPa5D2aQcPUBLGBK5+p11/GEVjgDSiWsrYdVJPNfhMFHOsdgSEbHdU0MP4k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613136372452893.7399478239679; Fri, 12 Feb 2021 05:26:12 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-579-1H6mRgOoPTm-bDbMco1nBw-1; Fri, 12 Feb 2021 08:26:07 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 14F1C80197A; Fri, 12 Feb 2021 13:26:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E39AA5C23D; Fri, 12 Feb 2021 13:26:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AE6443805; Fri, 12 Feb 2021 13:26:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPhYN008632 for ; Fri, 12 Feb 2021 08:25:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id C8EA36B8E5; Fri, 12 Feb 2021 13:25:43 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DB63648A8; Fri, 12 Feb 2021 13:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136371; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YqckMi8qH2vQJ6UznLqZZnsRTunq04SPcjpWb2zwhL4=; b=ZtGusGTzfIGE2uLmvycrqlVJZQE0IvHC/V9IFPjz8iRgpsC51Uc7Ej97b/ZgP9ZyIQKRdf OTzuqU3ZDQFQbYH77tsAgEa/GjARdCbE1MB/2duYkDXODq2yaImOsvVPJ2lJFPi8+VRWF/ rbFeq2W0pCVLgkVZKREYK1RZ8V17JHw= X-MC-Unique: 1H6mRgOoPTm-bDbMco1nBw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] clang-tidy: Add timeout Date: Fri, 12 Feb 2021 14:25:29 +0100 Message-Id: <20210212132534.29066-6-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Defining a custom timeout allows the scan to finish (albeit unsuccessfully) before GitLab's 60 minute limit and thus preserve the cache of already scanned files. A successive run, e.g. when the "rerun" button in GitLab's web interface is clicked, roughly picks up where the previous run stopped, gradually increas= ing the amount of cached results and eventually succeeds. Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index cc9c20ea32..19b8640982 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -51,6 +51,11 @@ def parse_args(): "--cache", dest=3D"cache", help=3D"Path to cache directory") + parser.add_argument( + "--timeout", + dest=3D"timeout", + type=3Dint, + help=3D"Timeout in minutes") =20 return parser.parse_args() =20 @@ -132,6 +137,11 @@ def cache_write(filename, result): def worker(): while True: item =3D items.get() + if args.timeout and args.timeout < time.time(): + findings.append("%s (timeout)" % item["file"]) + items.task_done() + continue + os.chdir(item["directory"]) =20 cache =3D cache_name(item) @@ -164,6 +174,9 @@ if args.cache: args.cache =3D os.path.abspath(args.cache) os.makedirs(args.cache, exist_ok=3DTrue) =20 +if args.timeout: + args.timeout =3D time.time() + args.timeout * 60 + for _ in range(args.thread_num): threading.Thread(target=3Dworker, daemon=3DTrue).start() =20 --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136377; cv=none; d=zohomail.com; s=zohoarc; b=b4An1aN10Mkkk8hg0oXvpozS+Qwzxz70LsB4L1qbpnjls2k6Txg81UGKxbquw66jWw5VNus2boMeU8BHIHZ9G7XotwvJi0yFNmsjFYGG3uryUmMvvtSrc5wca477n9GusZWw9ISUw+Ub7DZc6AiLdgG+7sVlmyrJjMfyHmuXGWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136377; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qSLij16sBragQZcU4+Vmwjdbr6ydaDBMcwN4j7+ypAc=; b=QiXD7YHVSoJ+8+hb5CRuKu9kaajJWkfIj7vILMRSCMzULugasLZVFOng9hHAnWm7PqSMCYbIyJrQGvgoeoO86PyXRe3hgh2dy7XIBTGa8ePoZp+dEBiaXMy5HO8dTW0xQTUBiA2FhdL8G3SwEUIGUkWzoqTkl7vF9uw3scadqUc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613136377275220.01211581109055; Fri, 12 Feb 2021 05:26:17 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-vDepPAnjO1ST-aL3BOTYfA-1; Fri, 12 Feb 2021 08:26:14 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7662E6EE2B; Fri, 12 Feb 2021 13:26:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 531EE648A8; Fri, 12 Feb 2021 13:26:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 13C7158079; Fri, 12 Feb 2021 13:26:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPiZX008639 for ; Fri, 12 Feb 2021 08:25:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id D0B016E405; Fri, 12 Feb 2021 13:25:44 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26A6E648A8; Fri, 12 Feb 2021 13:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136376; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=qSLij16sBragQZcU4+Vmwjdbr6ydaDBMcwN4j7+ypAc=; b=fVsO2jn4W6mBPlYjEmp77ZBxdrTiDE/DSx6puF7qLtmKF98Xazjo8qM5wl95K/s18s2rvH iSzXKC7cR5Sf57wmmm1idGgSMC4zp4/LZ3+oJvKm7OxmRxhwPBjszFf5I/SLD5gDZ9TeFp CuGbBJ5UHavK2QFvkM4ulIQsZs9QZ5E= X-MC-Unique: vDepPAnjO1ST-aL3BOTYfA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] clang-tidy: Allow timeouts Date: Fri, 12 Feb 2021 14:25:30 +0100 Message-Id: <20210212132534.29066-7-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" With an empty cache, the first run of the clang-tidy scan in the CI will fail. While the instinctive reaction "press the rerun button" will eventual= ly lead to the situation where enough files are cached that the entire scan fi= ts within the time window, this creates friction for e.g. new contributors. By allowing timeouts to be non-fatal events, we reduce scanning to a "best effort" approach, that might miss newly introduced regressions. Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index 19b8640982..54eb0ea584 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -56,6 +56,11 @@ def parse_args(): dest=3D"timeout", type=3Dint, help=3D"Timeout in minutes") + parser.add_argument( + "--allow-timeout", + dest=3D"allow_timeout", + action=3D"store_true", + help=3D"Do not treat timeout as failure if set") =20 return parser.parse_args() =20 @@ -138,7 +143,8 @@ def worker(): while True: item =3D items.get() if args.timeout and args.timeout < time.time(): - findings.append("%s (timeout)" % item["file"]) + if not args.allow_timeout: + findings.append("%s (timeout)" % item["file"]) items.task_done() continue =20 --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136381; cv=none; d=zohomail.com; s=zohoarc; b=cRVqQVynbdDVBYl/aRg1Clu3rt2tJIRp+NJwjJxjnWTilBkJXwLDYoFJ6xZ2icfkxOd8Bl4sFc26BdxtJ1UHvONgE8Zv8j3koDtFjX7Tisk4E89sIDBIjsL+ynVIdd7qN11rPODa0zef/1oJVMl/LxxYraWJaPtn+BM1LTjEDaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136381; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=o3f4lXiCPExo3m1TgSIYDf79UmVLdKUBt+GbtITkhW0=; b=JqYNuJNBBKSKet3GaE+X7VIKhDaD8uVCb3IvHCsHWI6wMSHMhFUT3I3zFIcc3hyOMwbvbxIxppdjjVPVWNYV9B5ipDgsCJehoACKGxNpy+HFIjawsJJN/UDdA1t+/4lYE6ExjK0bzUrsD64rXPtQMb7UwRkuan8YxEnwV7MCEfw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613136380592596.5282103904074; Fri, 12 Feb 2021 05:26:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-469-cl0lEVfCNg6fcqvhw1lciw-1; Fri, 12 Feb 2021 08:26:17 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B8661936B68; Fri, 12 Feb 2021 13:26:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 490566E419; Fri, 12 Feb 2021 13:26:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 139C11809C91; Fri, 12 Feb 2021 13:26:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPjdg008648 for ; Fri, 12 Feb 2021 08:25:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id D8AC0614EB; Fri, 12 Feb 2021 13:25:45 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E69D6E51B; Fri, 12 Feb 2021 13:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136379; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=o3f4lXiCPExo3m1TgSIYDf79UmVLdKUBt+GbtITkhW0=; b=EBcVQMP5CvXXKLLIwh+eAfUKwlByeO8Vesy5lZERj1l5tyi6VeEJLqcg+Uejbd6LRXEfoI MVpXZ3qek1mc6bB36AUYHAk4JlyGimuvQEYrDJ92CiCLGYmXdpDYyQna9XPMGYrFFATtg2 EsLJ/r/O8AvLgOaNPh0obDuvEoKA9Ak= X-MC-Unique: cl0lEVfCNg6fcqvhw1lciw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] clang-tidy: Add shuffle Date: Fri, 12 Feb 2021 14:25:31 +0100 Message-Id: <20210212132534.29066-8-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Randomizing the order of files to scan has no impact for local use of the script. The same holds true for use in the CI, if the amount of cached files is big enough for the entire scan to finish before timeout. If the cache is empty or not filled enough to ensure timely completion, randomizing the order of files makes it more likely to spent time on caching new files rather than hashing already cached files to check for the presence of a cache file. Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index 54eb0ea584..1d1038df0f 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -6,6 +6,7 @@ import json import multiprocessing import os import queue +import random import re import shlex import subprocess @@ -61,6 +62,11 @@ def parse_args(): dest=3D"allow_timeout", action=3D"store_true", help=3D"Do not treat timeout as failure if set") + parser.add_argument( + "--shuffle-input", + dest=3D"shuffle_input", + action=3D"store_true", + help=3D"Randomize order of files to check") =20 return parser.parse_args() =20 @@ -188,6 +194,8 @@ for _ in range(args.thread_num): =20 with open(os.path.join(args.build_dir, "compile_commands.json")) as f: compile_commands =3D json.load(f) + if args.shuffle_input: + random.shuffle(compile_commands) for compile_command in compile_commands: items.put(compile_command) =20 --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136436; cv=none; d=zohomail.com; s=zohoarc; b=TIdUWsrCbGF00liJuGmN1NQpSbZnWHsm/X0zq25oC8mpf01zML2Es5QlelKuTX3SlqEkgJ9ckhPYhNqOcDkA4guaJKnHS45kmE1X5jZYJhGrdd7MWZp6MgSntfdPCifk9YLgCBs+wZK5EbIdcqaS7tHqMihsYCvTkXIG9eytw7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136436; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ndjsyIs33ps/PJxAMrIUiqCbbFZ7Cv9YwnMdKSbZ01E=; b=l0whaNIIPtKzh2bi//1aKV0yHew7yRTQ7zMjJAvYGRT9QyeI5buxTD3ck0mHuYxFaC1RNdbTpRMu2nxcjqUG98F938bLNEBOaF3hL6ksI7CpCb4N8/yPSEkBKZfgz44O/oxSwSuZoycRhOMldlI0rkhMRQjVaPwlFrMzl3SMp/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161313643561428.65034810215741; Fri, 12 Feb 2021 05:27:15 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-481-Txe8UUO8MOKwPpLBIqZR2A-1; Fri, 12 Feb 2021 08:26:20 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F9BD6EE26; Fri, 12 Feb 2021 13:26:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE2ED60BE5; Fri, 12 Feb 2021 13:26:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B48BF5807B; Fri, 12 Feb 2021 13:26:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPk9t008663 for ; Fri, 12 Feb 2021 08:25:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id E395A6E405; Fri, 12 Feb 2021 13:25:46 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 360F3614EB; Fri, 12 Feb 2021 13:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136434; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ndjsyIs33ps/PJxAMrIUiqCbbFZ7Cv9YwnMdKSbZ01E=; b=Jy9684Rgrlaa37ZH3fVkqnQx3wRCTVFoLcPF0usRCTByjc7xiGsyItlBZz1Kf/ssiAJPf6 e5VwUIoEPHuv43OpK4uijdEBcjpS/OwkHHFHCM+8P6vh6AFXP06pQ+bYtfp4sltViHejSw 0NKPjGENScH8XxomZW3xVOsnKYJop0Y= X-MC-Unique: Txe8UUO8MOKwPpLBIqZR2A-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] clang-tidy: Make list of checks explicit Date: Fri, 12 Feb 2021 14:25:32 +0100 Message-Id: <20210212132534.29066-9-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Preparation for next patch. Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index 1d1038df0f..945a1f75d4 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -75,6 +75,7 @@ def run_clang_tidy(item): cmd =3D ( "clang-tidy", "--warnings-as-errors=3D*", + "--checks=3D-*,%s" % ",".join(checks), "-p", item["directory"], item["file"]) @@ -90,7 +91,7 @@ def run_clang_tidy(item): } =20 =20 -def cache_name(item): +def cache_name(item, checks): if not args.cache: return None =20 @@ -117,6 +118,7 @@ def cache_name(item): =20 hashsum =3D hashlib.sha256() hashsum.update(item["command"].encode()) + hashsum.update("\n".join(checks).encode()) hashsum.update(result.stdout.encode()) =20 basename =3D "".join([c if c.isalnum() else "_" for c in item["output"= ]]) @@ -145,7 +147,7 @@ def cache_write(filename, result): json.dump(result, f) =20 =20 -def worker(): +def worker(checks): while True: item =3D items.get() if args.timeout and args.timeout < time.time(): @@ -156,7 +158,7 @@ def worker(): =20 os.chdir(item["directory"]) =20 - cache =3D cache_name(item) + cache =3D cache_name(item, checks) result =3D cache_read(cache) with lock: print(item["file"], "" if result is None else "(from cache)") @@ -177,9 +179,19 @@ def worker(): items.task_done() =20 =20 +def list_checks(): + output =3D subprocess.check_output( + ["clang-tidy", "-checks=3D*", "-list-checks"], + universal_newlines=3DTrue).split("\n")[1:] + + output =3D [line.strip() for line in output] + return output + + args =3D parse_args() items =3D queue.Queue() lock =3D threading.Lock() +checks =3D list_checks() findings =3D list() =20 if args.cache: @@ -189,8 +201,12 @@ if args.cache: if args.timeout: args.timeout =3D time.time() + args.timeout * 60 =20 +print("Enabled checks:") +for check in checks: + print(" %s" % check) + for _ in range(args.thread_num): - threading.Thread(target=3Dworker, daemon=3DTrue).start() + threading.Thread(target=3Dworker, daemon=3DTrue, args=3D[checks]).star= t() =20 with open(os.path.join(args.build_dir, "compile_commands.json")) as f: compile_commands =3D json.load(f) --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136374; cv=none; d=zohomail.com; s=zohoarc; b=RoCLz2ROVxoY288cKrjcJbzfHN73f75/ajGrXk2QasCmR5kMd4e07OaJzl3NZdzQZYLhg/Z+YqbNjfX9DTWFRCWALKRN6IjHQZSHsWKjnNmHFiWxSgrcPubIQO8kH4h17Udbr2qOVJxUXdGY0Ng468laJ0qah8nhqULXkvmoy6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136374; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nW8yiBvbys+iiABjJEyQ2gG7a4nU1veFppHZMhrg3mo=; b=La4ZfZly0ypSQW5XrcaTCKHMyPtBC6LLU4V+kixFj4Z15m5mNfxkRzFdpbrFQvy1GEn+dA+dqAd10kLm7R6ByRPPom4FJYB1J/8G6T5Pv+xL/Ub4uu50zWeLs7TvuwUgBfBmi4HwjInURatM4KICPscIpfSqipYE/SBiWo57j3g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613136373676357.63366672501854; Fri, 12 Feb 2021 05:26:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-285-N3e5IB-jP9SMkSYBQeYGsQ-1; Fri, 12 Feb 2021 08:26:10 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E512B107ACF7; Fri, 12 Feb 2021 13:26:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFC5F60C47; Fri, 12 Feb 2021 13:26:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 83A7318095C9; Fri, 12 Feb 2021 13:26:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPlR9008671 for ; Fri, 12 Feb 2021 08:25:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id F03516E405; Fri, 12 Feb 2021 13:25:47 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41DDB614EB; Fri, 12 Feb 2021 13:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136372; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nW8yiBvbys+iiABjJEyQ2gG7a4nU1veFppHZMhrg3mo=; b=SA4xEZKyauXpG4dQ/2G7mpAP3g1jLLD9iUlza8lmVZaqDme26ZUebeO461rvYDdoHBEIh9 ktSIv3gpd6K29xouP6cW/WSIB1CFB1G46EDHhAGyraDCpxT+cOgti0l49V1NJr8DX7kdVG TSxhp0ktHukNIXWSRs+bMMnwzTs0qjc= X-MC-Unique: N3e5IB-jP9SMkSYBQeYGsQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] clang-tidy: Disable irrelevant and failing checks Date: Fri, 12 Feb 2021 14:25:33 +0100 Message-Id: <20210212132534.29066-10-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" clang-tidy's focus is on c++. Disable all checks that do not apply to the libVirt code base. Also disable all checks that are currently failing, to prevent introduction of new issues, while we work down the list of existing issues and / or decide on disabling some checks permanently. Signed-off-by: Tim Wiederhake --- scripts/run-clang-tidy.py | 326 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 326 insertions(+) diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py index 945a1f75d4..24bc034682 100755 --- a/scripts/run-clang-tidy.py +++ b/scripts/run-clang-tidy.py @@ -25,6 +25,331 @@ spam =3D [ ] =20 =20 +disabled_checks =3D [ + # aliases for other checks + "bugprone-narrowing-conversions", + "cert-dcl03-c", + "cert-dcl16-c", + "cert-dcl54-cpp", + "cert-dcl59-cpp", + "cert-err61-cpp", + "cert-fio38-c", + "cert-msc30-c", + "cert-msc32-c", + "cert-oop11-cpp", + "cert-oop54-cpp", + "cert-pos44-c", + "cppcoreguidelines-avoid-c-arrays", + "cppcoreguidelines-avoid-magic-numbers", + "cppcoreguidelines-c-copy-assignment-signature", + "cppcoreguidelines-explicit-virtual-functions", + "cppcoreguidelines-non-private-member-variables-in-classes", + "fuchsia-header-anon-namespaces", + "google-readability-braces-around-statements", + "google-readability-function-size", + "google-readability-namespace-comments", + "hicpp-avoid-c-arrays", + "hicpp-avoid-goto", + "hicpp-braces-around-statements", + "hicpp-deprecated-headers", + "hicpp-explicit-conversions", + "hicpp-function-size", + "hicpp-invalid-access-moved", + "hicpp-member-init", + "hicpp-move-const-arg", + "hicpp-named-parameter", + "hicpp-new-delete-operators", + "hicpp-no-array-decay", + "hicpp-no-malloc", + "hicpp-special-member-functions", + "hicpp-static-assert", + "hicpp-uppercase-literal-suffix", + "hicpp-use-auto", + "hicpp-use-emplace", + "hicpp-use-equals-default", + "hicpp-use-equals-delete", + "hicpp-use-noexcept", + "hicpp-use-nullptr", + "hicpp-use-override", + "hicpp-vararg", + "llvm-qualified-auto", + + # only relevant for c++ + "bugprone-copy-constructor-init", + "bugprone-dangling-handle", + "bugprone-exception-escape", + "bugprone-fold-init-type", + "bugprone-forward-declaration-namespace", + "bugprone-forwarding-reference-overload", + "bugprone-inaccurate-erase", + "bugprone-lambda-function-name", + "bugprone-move-forwarding-reference", + "bugprone-parent-virtual-call", + "bugprone-sizeof-container", + "bugprone-string-constructor", + "bugprone-string-integer-assignment", + "bugprone-swapped-arguments", + "bugprone-throw-keyword-missing", + "bugprone-undelegated-constructor", + "bugprone-unhandled-self-assignment", + "bugprone-unused-raii", + "bugprone-unused-return-value", + "bugprone-use-after-move", + "bugprone-virtual-near-miss", + "cert-dcl21-cpp", + "cert-dcl50-cpp", + "cert-dcl58-cpp", + "cert-err09-cpp", + "cert-err52-cpp", + "cert-err58-cpp", + "cert-err60-cpp", + "cert-mem57-cpp", + "cert-msc50-cpp", + "cert-msc51-cpp", + "cert-oop58-cpp", + "clang-analyzer-cplusplus.InnerPointer", + "clang-analyzer-cplusplus.Move", + "clang-analyzer-cplusplus.NewDelete", + "clang-analyzer-cplusplus.NewDeleteLeaks", + "clang-analyzer-cplusplus.PureVirtualCall", + "clang-analyzer-cplusplus.SelfAssignment", + "clang-analyzer-cplusplus.SmartPtr", + "clang-analyzer-cplusplus.VirtualCallModeling", + "clang-analyzer-optin.cplusplus.UninitializedObject", + "clang-analyzer-optin.cplusplus.VirtualCall", + "cppcoreguidelines-no-malloc", + "cppcoreguidelines-owning-memory", + "cppcoreguidelines-pro-bounds-array-to-pointer-decay", + "cppcoreguidelines-pro-bounds-constant-array-index", + "cppcoreguidelines-pro-bounds-pointer-arithmetic", + "cppcoreguidelines-pro-type-const-cast", + "cppcoreguidelines-pro-type-cstyle-cast", + "cppcoreguidelines-pro-type-member-init", + "cppcoreguidelines-pro-type-reinterpret-cast", + "cppcoreguidelines-pro-type-static-cast-downcast", + "cppcoreguidelines-pro-type-union-access", + "cppcoreguidelines-pro-type-vararg", + "cppcoreguidelines-slicing", + "cppcoreguidelines-special-member-functions", + "fuchsia-default-arguments-calls", + "fuchsia-default-arguments-declarations", + "fuchsia-multiple-inheritance", + "fuchsia-overloaded-operator", + "fuchsia-statically-constructed-objects", + "fuchsia-trailing-return", + "fuchsia-virtual-inheritance", + "google-build-explicit-make-pair", + "google-build-namespaces", + "google-build-using-namespace", + "google-default-arguments", + "google-explicit-constructor", + "google-global-names-in-headers", + "google-readability-casting", + "google-runtime-operator", + "google-runtime-references", + "hicpp-exception-baseclass", + "hicpp-noexcept-move", + "hicpp-undelegated-constructor", + "llvm-namespace-comment", + "llvm-prefer-isa-or-dyn-cast-in-conditionals", + "llvm-prefer-register-over-unsigned", + "llvm-twine-local", + "misc-new-delete-overloads", + "misc-non-private-member-variables-in-classes", + "misc-throw-by-value-catch-by-reference", + "misc-unconventional-assign-operator", + "misc-uniqueptr-reset-release", + "misc-unused-using-decls", + "modernize-avoid-bind", + "modernize-avoid-c-arrays", + "modernize-concat-nested-namespaces", + "modernize-deprecated-headers", + "modernize-deprecated-ios-base-aliases", + "modernize-loop-convert", + "modernize-make-shared", + "modernize-make-unique", + "modernize-pass-by-value", + "modernize-raw-string-literal", + "modernize-redundant-void-arg", + "modernize-replace-auto-ptr", + "modernize-replace-random-shuffle", + "modernize-return-braced-init-list", + "modernize-shrink-to-fit", + "modernize-unary-static-assert", + "modernize-use-auto", + "modernize-use-bool-literals", + "modernize-use-default-member-init", + "modernize-use-emplace", + "modernize-use-equals-default", + "modernize-use-equals-delete", + "modernize-use-nodiscard", + "modernize-use-noexcept", + "modernize-use-nullptr", + "modernize-use-override", + "modernize-use-trailing-return-type", + "modernize-use-transparent-functors", + "modernize-use-uncaught-exceptions", + "modernize-use-using", + "performance-faster-string-find", + "performance-for-range-copy", + "performance-implicit-conversion-in-loop", + "performance-inefficient-algorithm", + "performance-inefficient-string-concatenation", + "performance-inefficient-vector-operation", + "performance-move-const-arg", + "performance-move-constructor-init", + "performance-no-automatic-move", + "performance-noexcept-move-constructor", + "performance-trivially-destructible", + "performance-type-promotion-in-math-fn", + "performance-unnecessary-copy-initialization", + "performance-unnecessary-value-param", + "portability-simd-intrinsics", + "readability-container-size-empty", + "readability-convert-member-functions-to-static", + "readability-deleted-default", + "readability-make-member-function-const", + "readability-qualified-auto", + "readability-redundant-access-specifiers", + "readability-redundant-member-init", + "readability-redundant-smartptr-get", + "readability-redundant-string-cstr", + "readability-redundant-string-init", + "readability-simplify-subscript-expr", + "readability-static-accessed-through-instance", + "readability-static-definition-in-anonymous-namespace", + "readability-string-compare", + "readability-uniqueptr-delete-release", + "zircon-temporary-objects", + + # only relevant for objective c + "clang-analyzer-nullability.NullableDereferenced", + "clang-analyzer-nullability.NullablePassedToNonnull", + "clang-analyzer-nullability.NullableReturnedFromNonnull", + "clang-analyzer-nullability.NullPassedToNonnull", + "clang-analyzer-nullability.NullReturnedFromNonnull", + "clang-analyzer-optin.osx.cocoa.localizability." + + "EmptyLocalizationContextChecker", + "clang-analyzer-optin.osx.cocoa.localizability." + + "NonLocalizedStringChecker", + "clang-analyzer-optin.osx.OSObjectCStyleCast", + "clang-analyzer-optin.performance.GCDAntipattern", + "google-objc-avoid-nsobject-new", + "google-objc-avoid-throwing-exception", + "google-objc-function-naming", + "google-objc-global-variable-declaration", + "objc-avoid-nserror-init", + "objc-forbidden-subclassing", + "objc-missing-hash", + "objc-property-declaration", + "objc-super-self", + + # only relevant for certain libraries + "abseil-duration-addition", + "abseil-duration-comparison", + "abseil-duration-conversion-cast", + "abseil-duration-division", + "abseil-duration-factory-float", + "abseil-duration-factory-scale", + "abseil-duration-subtraction", + "abseil-duration-unnecessary-conversion", + "abseil-faster-strsplit-delimiter", + "abseil-no-internal-dependencies", + "abseil-no-namespace", + "abseil-redundant-strcat-calls", + "abseil-str-cat-append", + "abseil-string-find-startswith", + "abseil-time-comparison", + "abseil-time-subtraction", + "abseil-upgrade-duration-conversions", + "boost-use-to-string", + "clang-analyzer-optin.mpi.MPI-Checker", + "google-readability-avoid-underscore-in-googletest-name", + "google-upgrade-googletest-case", + "mpi-buffer-deref", + "mpi-type-mismatch", + "openmp-exception-escape", + "openmp-use-default-none", + + # only relevant for osx + "clang-analyzer-osx.API", + "clang-analyzer-osx.cocoa.AtSync", + "clang-analyzer-osx.cocoa.AutoreleaseWrite", + "clang-analyzer-osx.cocoa.ClassRelease", + "clang-analyzer-osx.cocoa.Dealloc", + "clang-analyzer-osx.cocoa.IncompatibleMethodTypes", + "clang-analyzer-osx.cocoa.Loops", + "clang-analyzer-osx.cocoa.MissingSuperCall", + "clang-analyzer-osx.cocoa.NilArg", + "clang-analyzer-osx.cocoa.NonNilReturnValue", + "clang-analyzer-osx.cocoa.NSAutoreleasePool", + "clang-analyzer-osx.cocoa.NSError", + "clang-analyzer-osx.cocoa.ObjCGenerics", + "clang-analyzer-osx.cocoa.RetainCount", + "clang-analyzer-osx.cocoa.RetainCountBase", + "clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak", + "clang-analyzer-osx.cocoa.SelfInit", + "clang-analyzer-osx.cocoa.SuperDealloc", + "clang-analyzer-osx.cocoa.UnusedIvars", + "clang-analyzer-osx.cocoa.VariadicMethodTypes", + "clang-analyzer-osx.coreFoundation.CFError", + "clang-analyzer-osx.coreFoundation.CFNumber", + "clang-analyzer-osx.coreFoundation.CFRetainRelease", + "clang-analyzer-osx.coreFoundation.containers.OutOfBounds", + "clang-analyzer-osx.coreFoundation.containers.PointerSizedValues", + "clang-analyzer-osx.MIG", + "clang-analyzer-osx.NSOrCFErrorDerefChecker", + "clang-analyzer-osx.NumberObjectConversion", + "clang-analyzer-osx.ObjCProperty", + "clang-analyzer-osx.OSObjectRetainCount", + "clang-analyzer-osx.SecKeychainAPI", + "darwin-avoid-spinlock", + "darwin-dispatch-once-nonstatic", + + # failing checks + "android-cloexec-dup", + "android-cloexec-fopen", + "android-cloexec-open", + "android-cloexec-pipe", + "bugprone-branch-clone", + "bugprone-integer-division", + "bugprone-macro-parentheses", + "bugprone-signed-char-misuse", + "bugprone-sizeof-expression", + "bugprone-suspicious-missing-comma", + "bugprone-suspicious-string-compare", + "cert-err34-c", + "clang-analyzer-core.CallAndMessage", + "clang-analyzer-core.NonNullParamChecker", + "clang-analyzer-core.NullDereference", + "clang-analyzer-core.UndefinedBinaryOperatorResult", + "clang-analyzer-core.uninitialized.Branch", + "clang-analyzer-deadcode.DeadStores", + "clang-analyzer-optin.performance.Padding", + "clang-analyzer-security.insecureAPI.strcpy", + "clang-analyzer-unix.Malloc", + "cppcoreguidelines-init-variables", + "cppcoreguidelines-interfaces-global-init", + "cppcoreguidelines-narrowing-conversions", + "hicpp-multiway-paths-covered", + "hicpp-no-assembler", + "hicpp-signed-bitwise", + "llvm-include-order", + "readability-braces-around-statements", + "readability-else-after-return", + "readability-function-size", + "readability-inconsistent-declaration-parameter-name", + "readability-isolate-declaration", + "readability-magic-numbers", + "readability-misleading-indentation", + "readability-named-parameter", + "readability-non-const-parameter", + "readability-redundant-control-flow", + "readability-redundant-declaration", + "readability-uppercase-literal-suffix", +] + + def remove_spam(output): retval =3D list() for line in output.split("\n"): @@ -185,6 +510,7 @@ def list_checks(): universal_newlines=3DTrue).split("\n")[1:] =20 output =3D [line.strip() for line in output] + output =3D [line for line in output if line not in disabled_checks] return output =20 =20 --=20 2.26.2 From nobody Sat Apr 27 14:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613136386; cv=none; d=zohomail.com; s=zohoarc; b=bHwZtC9VMStXd4MfnClf+L7Z20sm8mnJXqbIfYWCr/1u5bydYYwdJ5Q7pBVJQFmZ/H7DU7mbUUB02LB9m1zDB7VJXs8lAB1TX1c6zFbdfJ1cK3zz5h0BFodHPP3x5dGy2tm8kn0Tu/4U3/dCM9+J11biwQfC9DNDg85g8CYBywY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613136386; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AkoLZeArv/cmEaYJ7jqwl/MXfBLdkqauSEpaZViexyE=; b=ObA6ZS2Nwlk7TtuX9Q9kAa23/23jTlwjfgBHtfxVrA+yMHqJNMbtJkl7Umqni9RqUvhw/PB1Nifq2+sCG/3fxDusmByWnk+hrbadEXPTk8sY28QwysqXjwHBJhB12o0MRVNReZamhgg2XAHZz9Q1nUbdgmcDzDAfvXImzsIABzM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613136385822305.87423638905113; Fri, 12 Feb 2021 05:26:25 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-226-EZjhga7ONo-vK-4eCQO0VA-1; Fri, 12 Feb 2021 08:26:22 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23D75107ACE8; Fri, 12 Feb 2021 13:26:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02BEC60BE5; Fri, 12 Feb 2021 13:26:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BDDB718089CB; Fri, 12 Feb 2021 13:26:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11CDPnHa008688 for ; Fri, 12 Feb 2021 08:25:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0FDC06B8E5; Fri, 12 Feb 2021 13:25:49 +0000 (UTC) Received: from work.redhat.com (ovpn-112-223.ams2.redhat.com [10.36.112.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5900E614EB; Fri, 12 Feb 2021 13:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613136384; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AkoLZeArv/cmEaYJ7jqwl/MXfBLdkqauSEpaZViexyE=; b=I9jmlS3VjZ/z8VPX0Rwa4T2zLmE53pGs0P2ghSiui7o533G4zKNIu9QyeFUF/ebpWjB61U KtwMyaNqQIXMk3RAk0Bi2Enh/nec9o1AoevvDiD0PwGKpsD/+Y3wf8DuSGDwiGsC/kDRPo EWNW30fAZfCQWrfgdIYegOfJVJ2YLgA= X-MC-Unique: EZjhga7ONo-vK-4eCQO0VA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] clang-tidy: Add CI integration Date: Fri, 12 Feb 2021 14:25:34 +0100 Message-Id: <20210212132534.29066-11-twiederh@redhat.com> In-Reply-To: <20210212132534.29066-1-twiederh@redhat.com> References: <20210212132534.29066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" A better solution would be to have an explicit target that creates all generated files, similar to libvirt-pot-dep. Signed-off-by: Tim Wiederhake --- .gitlab-ci.yml | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5779b1b8b2..3135632222 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -617,3 +617,91 @@ coverity: - curl https://scan.coverity.com/builds?project=3D$COVERITY_SCAN_PROJE= CT_NAME --form token=3D$COVERITY_SCAN_TOKEN --form email=3D$GITLAB_USER_EMA= IL --form file=3D@cov-int.tar.gz --form version=3D"$(git describe --tags)" = --form description=3D"$(git describe --tags) / $CI_COMMIT_TITLE / $CI_COMMI= T_REF_NAME:$CI_PIPELINE_ID" rules: - if: "$CI_PIPELINE_SOURCE =3D=3D 'schedule' && $COVERITY_SCAN_PROJECT= _NAME && $COVERITY_SCAN_TOKEN" + +clang-tidy: + image: $CI_REGISTRY_IMAGE/ci-fedora-32:latest + needs: + - x64-fedora-32-container + stage: builds + cache: + key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" + when: always + paths: + - clang-tidy-cache + script: + - meson build + - ninja -C build src/access/viraccessapicheck.c + - ninja -C build src/access/viraccessapicheck.h + - ninja -C build src/access/viraccessapichecklxc.c + - ninja -C build src/access/viraccessapichecklxc.h + - ninja -C build src/access/viraccessapicheckqemu.c + - ninja -C build src/access/viraccessapicheckqemu.h + - ninja -C build src/admin/admin_client.h + - ninja -C build src/admin/admin_protocol.c + - ninja -C build src/admin/admin_protocol.h + - ninja -C build src/admin/admin_server_dispatch_stubs.h + - ninja -C build src/esx/esx_vi.generated.c + - ninja -C build src/esx/esx_vi.generated.h + - ninja -C build src/esx/esx_vi_methods.generated.c + - ninja -C build src/esx/esx_vi_methods.generated.h + - ninja -C build src/esx/esx_vi_methods.generated.macro + - ninja -C build src/esx/esx_vi_types.generated.c + - ninja -C build src/esx/esx_vi_types.generated.h + - ninja -C build src/esx/esx_vi_types.generated.typedef + - ninja -C build src/esx/esx_vi_types.generated.typeenum + - ninja -C build src/esx/esx_vi_types.generated.typefromstring + - ninja -C build src/esx/esx_vi_types.generated.typetostring + - ninja -C build src/hyperv/hyperv_wmi_classes.generated.c + - ninja -C build src/hyperv/hyperv_wmi_classes.generated.h + - ninja -C build src/hyperv/hyperv_wmi_classes.generated.typedef + - ninja -C build src/libvirt_functions.stp + - ninja -C build src/libvirt_probes.h + - ninja -C build src/libvirt_probes.stp + - ninja -C build src/locking/lock_daemon_dispatch_stubs.h + - ninja -C build src/locking/lock_protocol.c + - ninja -C build src/locking/lock_protocol.h + - ninja -C build src/logging/log_daemon_dispatch_stubs.h + - ninja -C build src/logging/log_protocol.c + - ninja -C build src/logging/log_protocol.h + - ninja -C build src/lxc/lxc_controller_dispatch.h + - ninja -C build src/lxc/lxc_monitor_dispatch.h + - ninja -C build src/lxc/lxc_monitor_protocol.c + - ninja -C build src/lxc/lxc_monitor_protocol.h + - ninja -C build src/qemu/libvirt_qemu_probes.h + - ninja -C build src/qemu/libvirt_qemu_probes.stp + - ninja -C build src/remote/lxc_client_bodies.h + - ninja -C build src/remote/lxc_daemon_dispatch_stubs.h + - ninja -C build src/remote/lxc_protocol.c + - ninja -C build src/remote/lxc_protocol.h + - ninja -C build src/remote/qemu_client_bodies.h + - ninja -C build src/remote/qemu_daemon_dispatch_stubs.h + - ninja -C build src/remote/qemu_protocol.c + - ninja -C build src/remote/qemu_protocol.h + - ninja -C build src/remote/remote_client_bodies.h + - ninja -C build src/remote/remote_daemon_dispatch_stubs.h + - ninja -C build src/remote/remote_protocol.c + - ninja -C build src/remote/remote_protocol.h + - ninja -C build src/rpc/virkeepaliveprotocol.c + - ninja -C build src/rpc/virkeepaliveprotocol.h + - ninja -C build src/rpc/virnetprotocol.c + - ninja -C build src/rpc/virnetprotocol.h + - ninja -C build src/util/virkeycodetable_atset1.h + - ninja -C build src/util/virkeycodetable_atset2.h + - ninja -C build src/util/virkeycodetable_atset3.h + - ninja -C build src/util/virkeycodetable_linux.h + - ninja -C build src/util/virkeycodetable_osx.h + - ninja -C build src/util/virkeycodetable_qnum.h + - ninja -C build src/util/virkeycodetable_usb.h + - ninja -C build src/util/virkeycodetable_win32.h + - ninja -C build src/util/virkeycodetable_xtkbd.h + - ninja -C build src/util/virkeynametable_linux.h + - ninja -C build src/util/virkeynametable_osx.h + - ninja -C build src/util/virkeynametable_win32.h + - ninja -C build tools/wireshark/src/libvirt/keepalive.h + - ninja -C build tools/wireshark/src/libvirt/lxc.h + - ninja -C build tools/wireshark/src/libvirt/protocol.h + - ninja -C build tools/wireshark/src/libvirt/qemu.h + - ninja -C build tools/wireshark/src/libvirt/remote.h + - scripts/run-clang-tidy.py -p build --cache clang-tidy-cache --timeou= t 30 --allow-timeout --shuffle-input + variables: + CC: clang --=20 2.26.2