From nobody Tue Apr 30 23:55:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1584646485; cv=none; d=zohomail.com; s=zohoarc; b=VEn179dp2NvAXlZ/BmqsOaWmzkean/+c8V0lq08WDB39YtA7jSB7rLgA55pZskbk02HOeaVqcYMrv1zAG1oWXXQZf4apRNnDe5eO9RqTZHzO1i78ztnwPRCtaT3NX2lSRFrj14k6EIPcZtqijj5bSeZRjhTtzIqeVGnPq713PHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584646485; h=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=Jh3gZFW8hITPJm52vDp0+U3ojSlhwuXHPcuBu7ELJi8=; b=eLWLLn9xmHIC+6loLS2j6GLO+m39Fw2hk48eQAXH61AGQ9/8OevirJWwR1BGXhZqfgSWfGMyRTTvb3afEtvZVhUmNheB2ZWNrr3jmIjVyQpTe3uNOduy1vwibbPrqMK4yT0CuZVWD63cFOZNKZDTf3e5zg5Kf0MW/PVQ/NNTMF4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584646485158458.21119911755136; Thu, 19 Mar 2020 12:34:45 -0700 (PDT) Received: from localhost ([::1]:42200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0wE-0005SC-T5 for importer@patchew.org; Thu, 19 Mar 2020 15:34:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58038) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v3-0004GC-G3 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v2-0005o0-Cu for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:29 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:35028) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v2-0005mv-6p for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:28 -0400 Received: by mail-wr1-x444.google.com with SMTP id h4so4675452wru.2 for ; Thu, 19 Mar 2020 12:33:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Jh3gZFW8hITPJm52vDp0+U3ojSlhwuXHPcuBu7ELJi8=; b=qK2Y/gWMId7ULf7kwlPCJlHcu4zU71MQ4LYOH9JpSjK2zll5B3udpVWapKbFgKNuUh DMcAZG6VExueagn3XquNaX/7hRpzX01tTno0TaqvLTRcy+V4K84uWXuQDvMQHihljf0D lMr+Mo0xUX4gsucio9/9oUDOPGOisCAtSeHLbjtRkehMSTzQwGw3KTMPwY9n9dV+0dYW igzGDxfbwpwASRbZGSQj9kaCAdtBS3z/FFSR4mtEkxPIIC6tSLWNiADvFk5Q1IEKd4l5 +uI3EiaNvbzo/1sTCmOVLp+EfK8DksCaPKbz16WvRYjA04nsGQGoPJqr3DmEgLKz3BJ3 FWyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jh3gZFW8hITPJm52vDp0+U3ojSlhwuXHPcuBu7ELJi8=; b=q0Oe3ujHgvYRCLvRImfX9V+Gv+Znj+ylwZ0GDXs0V9y5wjDS4VCukg7RTU4hFFSSSd zPKbgN5pQe85PayBOowQmEMT00DMDBxVwolQVKakyS3JtcUVLRUjefUQY2aMkrQTWOHc 52MdEwMvMOKav9uoaqLzd/y96PXa9MC9KJp7qfWg+9J1u9yaFKptaMoX2kb/OhUIfZVd AUiPXlxelH7pi8APcbuz5sYydeR6t3t4slK7HA46t/PabUl9eSN1D3DddDgL5R1Gugia 96YQqT2YTThM4caKIKx3nD6qglY6vBOY13V97Xpa6JVImIB3l0hsSg15dVm2mh3VB9e2 mT6Q== X-Gm-Message-State: ANhLgQ3Jy6Elwszb60zaP+aV4d3ApVVj3ZL5guuZYhAxIiHnMAeQepcO St5y0CyRIdL8qTAvCyDLWUomHl6zi7C/yA== X-Google-Smtp-Source: ADFU+vui+kepmADB7WGcV2qwsDnMj3fOe8bU4jBFgC1eSaVZM8OG4NMqvQADedT25eARS6wkOZB0tQ== X-Received: by 2002:adf:ecc7:: with SMTP id s7mr6396061wro.386.1584646406640; Thu, 19 Mar 2020 12:33:26 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 1/6] osdep.h: Drop no-longer-needed Coverity workarounds Date: Thu, 19 Mar 2020 19:33:18 +0000 Message-Id: <20200319193323.2038-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 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: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" In commit a1a98357e3fd in 2018 we added some workarounds for Coverity not being able to handle the _Float* types introduced by recent glibc. Newer versions of the Coverity scan tools have support for these types, and will fail with errors about duplicate typedefs if we have our workaround. Remove our copy of the typedefs. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- Sadly I don't think there's any way to tell whether we should or should not provide the typedefs, so anybody with an older Coverity will presumably find this breaks them. --- include/qemu/osdep.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 9bd3dcfd136..20f5c5f197d 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -33,20 +33,6 @@ #else #include "exec/poison.h" #endif -#ifdef __COVERITY__ -/* Coverity does not like the new _Float* types that are used by - * recent glibc, and croaks on every single file that includes - * stdlib.h. These typedefs are enough to please it. - * - * Note that these fix parse errors so they cannot be placed in - * scripts/coverity-model.c. - */ -typedef float _Float32; -typedef double _Float32x; -typedef double _Float64; -typedef __float80 _Float64x; -typedef __float128 _Float128; -#endif =20 #include "qemu/compiler.h" =20 --=20 2.20.1 From nobody Tue Apr 30 23:55:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1584646485; cv=none; d=zohomail.com; s=zohoarc; b=eW4HZUwzE8nOhtVEO1O65bZzjmCmcgPAFm6nSaBQfZS7KgWd3FAwnze8Nm2GnnmmgsWzvdr1bjhI99xYrcbDef8s9NKQeLiHLtd60LV3vKn31vj4f/pz8fzuR9olosVFEYyoLfn5djZcdVYEoqQE50bi4EH3ZLIT6XG3t2toBqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584646485; h=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=smsrtU5x+Ww0fA4g+LeGtvF6EpGiUdbtArUTIrJNIQ0=; b=Hp0MreWgHuImknpLyAu9fGiRAIaLK4XBJpBZY42NNvFiIoJBOKKw49K9moWOTT5ri0hDa4QOQug90q6jdw7A7PpZJHdMe3unHLcRmpSTU5M6hzTpOLhAVatqsgRPRj0s8aEs5qNcV9AH38MxzL9NAfnl4gTWsKKTasl6sfxj02M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584646485717429.7882772137283; Thu, 19 Mar 2020 12:34:45 -0700 (PDT) Received: from localhost ([::1]:42204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0wG-0005TG-F5 for importer@patchew.org; Thu, 19 Mar 2020 15:34:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58055) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v4-0004GD-A9 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v3-0005pT-8B for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:30 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:33977) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v3-0005oW-2N for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:29 -0400 Received: by mail-wr1-x444.google.com with SMTP id z15so4659235wrl.1 for ; Thu, 19 Mar 2020 12:33:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=smsrtU5x+Ww0fA4g+LeGtvF6EpGiUdbtArUTIrJNIQ0=; b=Q0tDhS990sj6uzNWIfGFwU92SMl8u3+aXG+LEXxgAuKb9PRbbSaj39Qgx436xD7Xqc Qc0ZXYx3I1H2suQ1xYvAUdqm9CkjrzaHGLb14LzIvvufALlqyOtknqVA1wp4z3x5MNf5 S7TXvyZZmONJSPtbLXWR7xyfhp4hxQaeKO8KfG/ZAcpz24mcoYRfhtudpc2laRs8Dcpo aXqHX52CeZLfOxldUZrlYlSlnFDaOUooSY2AIfZOdd/acnBbjzxMHLrShItq7JN7ffXI vUj+yrJ0baVZFj16rrgKcYVC3l2RWVMvCt7i/v0a3O29nfwCwwKeKb1skNDp6S5jXEqU 9/Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=smsrtU5x+Ww0fA4g+LeGtvF6EpGiUdbtArUTIrJNIQ0=; b=ijqGu1V411pQhkLK7dNpxYaF1lIVzE5iHT2o8aWdoRSeRZmUqUMeXJrPdvmW3Gao9z EfJrQjZ7wvMAKV/HPRIeXnDdtqVnEOVdhaOgUZUotvNeazACqXGUtb+q8kK5IoIQD65R n9eR93QUUXGPrFn1OJim1Ia4gfzIeS/bV8jiNrNrv4KXLZ5QTHsLHilC0AUAFbnvnddm 2nUan2aYnjlO4YPMkDCUMC+/PoAzbIAB9alpLZJT+OAYZHI6fqq/7itFygoshc/7qTUk LpQ0AqxxRab/1nhWTgGjKWpUv8DNcfUwpfoMyAfBulhocjsEg4T8d6raqkvwBZWFtfBk lC4Q== X-Gm-Message-State: ANhLgQ1FvqGBRyocT0xWYYTCVEFcIV6K7o0uPFWNqbUxnCRbo1dJ+Yxs s0vFGYmQsrT4kcnUAglo/RjgZZdlWLWIIQ== X-Google-Smtp-Source: ADFU+vszgXzNSOUsYqAOa8ppQFJ5p802TxhWT5U+rdHXN/WsN04xjECQYIpIZz+Kfdy8xrKU2PixQw== X-Received: by 2002:a5d:5290:: with SMTP id c16mr5922034wrv.235.1584646407864; Thu, 19 Mar 2020 12:33:27 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 2/6] thread.h: Fix Coverity version of qemu_cond_timedwait() Date: Thu, 19 Mar 2020 19:33:19 +0000 Message-Id: <20200319193323.2038-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 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: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" For Coverity's benefit, we provide simpler versions of functions like qemu_mutex_lock(), qemu_cond_wait() and qemu_cond_timedwait(). When we added qemu_cond_timedwait() in commit 3dcc9c6ec4ea, a cut and paste error meant that the Coverity version of qemu_cond_timedwait() was using the wrong _impl function, which makes the Coverity parser complain: "/qemu/include/qemu/thread.h", line 159: warning #140: too many arguments in function call return qemu_cond_timedwait(cond, mutex, ms); ^ "/qemu/include/qemu/thread.h", line 159: warning #120: return value type do= es not match the function type return qemu_cond_timedwait(cond, mutex, ms); ^ "/qemu/include/qemu/thread.h", line 156: warning #1563: function "qemu_cond_timedwait" not emitted, consider modeling it or review parse diagnostics to improve fidelity static inline bool (qemu_cond_timedwait)(QemuCond *cond, QemuMutex *mutex, ^ These aren't fatal, but reduce the scope of the analysis. Fix the error. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/qemu/thread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/thread.h b/include/qemu/thread.h index 047db0307e7..10262c63f58 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -67,7 +67,7 @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; #define qemu_cond_wait(c, m) \ qemu_cond_wait_impl(c, m, __FILE__, __LINE__); #define qemu_cond_timedwait(c, m, ms) \ - qemu_cond_wait_impl(c, m, ms, __FILE__, __LINE__); + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); #else #define qemu_mutex_lock(m) ({ \ QemuMutexLockFunc _f =3D atomic_read(&qemu_mutex_lock_func); \ --=20 2.20.1 From nobody Tue Apr 30 23:55:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1584646637; cv=none; d=zohomail.com; s=zohoarc; b=iyBjs5HnWRhQdYP6v2gA/uulTjMi8T5JyDSTWp/Ir+Gq2jkXPmhR0icj9AdkB4rOQoAgd1LKS3/AP5KVJ8GCuMIT/MHzNngvY6uiVcxZ7M5V3Ntt5CNU6BSgDQxQbKHplfsqd10W98EJPLHsA+BOBbI3PtNbMQ9iZAet80ik9o8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584646637; h=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=QFHCsQgndAIVNPG9R5oLtcytKTpUJCNgdX7D4zaqb8o=; b=Kq6bzylXvktA5NZEOm0hXchiw8ToStLuWAgdK79kIaKi/ZnOusnYhguaYBDaRWz5TPe81vI8t/2t+wV/VdfSK/dHg4KFhMyLK6nxsBz0nfizHABGMgzH1Dt9PWBG8ZcqicyJ2NNVZb2xyaYj1fkAL06RDh/0/llKiEow0diuNxA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15846466370143.952754439478099; Thu, 19 Mar 2020 12:37:17 -0700 (PDT) Received: from localhost ([::1]:42274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0yh-0000tz-PU for importer@patchew.org; Thu, 19 Mar 2020 15:37:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58085) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v6-0004HE-Ik for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v5-0005tq-Fn for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:32 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:38576) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v5-0005rq-9N for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:31 -0400 Received: by mail-wm1-x344.google.com with SMTP id l20so3745410wmi.3 for ; Thu, 19 Mar 2020 12:33:31 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QFHCsQgndAIVNPG9R5oLtcytKTpUJCNgdX7D4zaqb8o=; b=HZnbEhEtprEyZe0hBcXSwd2zypShGKy/o2KJ7qX8RFxFFPm9J4TQUDWw8dMz3q5zzQ KIPF9hMnZ9LXAM3ficXklUI5hwr6pgV/MzW/EurzvosxdcBJ5k9JnFL/dnvUwzU6W7k3 M7xkP1rlCGjgJrC6d3QU3xbdw51HTlMEalbnpbt3sc00lNYN46FQkbAWT9E5obIbMSxL y+wT33rQ+gB3GSO/62cQ82Vpg6CGomvGlUCJvlRqt0jK6MdNw/HVJjagpQtFj2i2/2vM Yx8Ooi4MOg0Xw83i1w0dlrCoQ3y5rtPM4XueUwla5ZEwhl0x5ANOMUDbCWXfT8m2Nu06 CxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QFHCsQgndAIVNPG9R5oLtcytKTpUJCNgdX7D4zaqb8o=; b=AkgGdm734BTb2pKLlD9q45Mp+B6kicPbKNu0Tp7JP25xzoskCLIGQrPgPzVgN/ZcWg vA1mvnZ4PBh64uJ1j96/Hy96Y7fm3v4Nlsan2PLJ1aLCLbUGfQnnXIMglJAZxTn1ezNO Od6zKKASs+MvnqpQUIXVqfWGJP8I3CdJ9Jg6WEBoDnfHtxy6+PQQbYQbRCzWlqs+88u8 W9yy41nYv+qPa/r6tEunwakStOIzods2DrmBzRKxIprhjVjNPmfEA0pOJHtiPCaNJ67f V9OC+3NDELVnwMrFvpDg6Oja+XUP6M3Mdh1HXSKldZzTWBYUhuq0GhEL9GcpgozqRSHE +rnw== X-Gm-Message-State: ANhLgQ01KBefv1oYYUv0BBZDYzfR/uPexKp7HTgRx0Lf+ZGW3S69MtNQ BxZ9XEM8ILAvj6H2TzmdBRqD8gxlzN+Y9Q== X-Google-Smtp-Source: ADFU+vuP/DX/gp+0h9M+1yc77gZin4zYtQgLMjbqMfASwatydd7SEs99QqWpYR3Oy1CykuO8p+I/cQ== X-Received: by 2002:a1c:2dc7:: with SMTP id t190mr5674694wmt.137.1584646408916; Thu, 19 Mar 2020 12:33:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 3/6] thread.h: Remove trailing semicolons from Coverity qemu_mutex_lock() etc Date: Thu, 19 Mar 2020 19:33:20 +0000 Message-Id: <20200319193323.2038-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 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: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" All the Coverity-specific definitions of qemu_mutex_lock() and friends have a trailing semicolon. This works fine almost everywhere because of QEMU's mandatory-braces coding style and because most callsites are simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as an if() statement, which makes the ';' a syntax error: "../target/s390x/sigp.c", line 461: warning #18: expected a ")" if (qemu_mutex_trylock(&qemu_sigp_mutex)) { ^ Remove the bogus semicolons from the macro definitions. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/qemu/thread.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/qemu/thread.h b/include/qemu/thread.h index 10262c63f58..d22848138ea 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -57,17 +57,17 @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; * hide them. */ #define qemu_mutex_lock(m) \ - qemu_mutex_lock_impl(m, __FILE__, __LINE__); + qemu_mutex_lock_impl(m, __FILE__, __LINE__) #define qemu_mutex_trylock(m) \ - qemu_mutex_trylock_impl(m, __FILE__, __LINE__); + qemu_mutex_trylock_impl(m, __FILE__, __LINE__) #define qemu_rec_mutex_lock(m) \ - qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__); + qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__) #define qemu_rec_mutex_trylock(m) \ - qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__); + qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__) #define qemu_cond_wait(c, m) \ - qemu_cond_wait_impl(c, m, __FILE__, __LINE__); + qemu_cond_wait_impl(c, m, __FILE__, __LINE__) #define qemu_cond_timedwait(c, m, ms) \ - qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__) #else #define qemu_mutex_lock(m) ({ \ QemuMutexLockFunc _f =3D atomic_read(&qemu_mutex_lock_func); \ --=20 2.20.1 From nobody Tue Apr 30 23:55:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1584646487; cv=none; d=zohomail.com; s=zohoarc; b=fQBZBf0Hfa4QVWLJoxp+zKckBTYRw1f5BizBvhoVXhEr+NNP7l5IOsrxXmyL9cSXha1pceWr4gOvRfS7xMXAoFMmE8sBdSsPcKA6HpW9p8ivY7mTXFlbQB4o02xfgcaD1SbOJqlNhmKQfCC0wLCyCrS47WCpQw4+lWqqNnWlXxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584646487; h=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=xmJXguFcCJyV8YvdEoeDLFSPVywWgWvisk8RAVF+M1Y=; b=QxLGO7JjZc+kHqabbI+F9G8zWm1SWg7z528RupEekm7BFiBDGznSb3PvpyQMMcxJ5bI0hcTTI3ejNxv9HQjW7b6YBXLkmLD4oLPA+S+tGJshC+E38GkO9Lz6adducNr9gFHHyaQe7OggONyI2uPvOill6QDsOiyVJaMGe2BBLyU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584646487908567.5067593397503; Thu, 19 Mar 2020 12:34:47 -0700 (PDT) Received: from localhost ([::1]:42208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0wI-0005YV-NQ for importer@patchew.org; Thu, 19 Mar 2020 15:34:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58082) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v6-0004H4-F9 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v5-0005ta-E4 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:32 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:39738) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v5-0005ro-87 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:31 -0400 Received: by mail-wm1-x342.google.com with SMTP id a9so688574wmj.4 for ; Thu, 19 Mar 2020 12:33:31 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xmJXguFcCJyV8YvdEoeDLFSPVywWgWvisk8RAVF+M1Y=; b=QjikPO/llx/bix7LQibhTzqpE1buWelkBsfPF54WGEloF4eLaQRrKbAYm0N8144J0g OHkTXCw/6EXjG/YRKSt6hdqOhAe4LHR7UTDdbJw+pbZRFd6u3fczIJsn19FwxoJ9msgL yEwSj4v6AWOZrHLoUbvT9Rc1DvzSblFlCn641om6KYbyQWHS+pL3pQ86P1ZnHyMLoF4H Gq79P0K1ILHWu5OCDhcOmXP3jcSCAWKTLxhVMUb9JgQrwWFDYCQ4RGC3JPRBV+KJEo8g zaXs2kjVYCKKhGYMGD292ccZokD0h7wiFjHwtHDlmrPINM2d+F6Ha5OyZIP+AvKhczkq hSfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xmJXguFcCJyV8YvdEoeDLFSPVywWgWvisk8RAVF+M1Y=; b=eYTGV8oPuHq2dfD5KEvcRNG8yAYZpUOoowgjvrrx/ILPc/4hV1CeROYS2+fFmMiw2x sNY4CCagrCgoeFzDrCWt8WcJCoL8AazVd90110lfKPvrHg3WXYkpxf2/JbnURPqXVT0b i3P6Z4YenyRNMf3X5rEPZPPYzERyjpBkjvgYZaf9JpTSQn27K5psE5Y4Wdxh1neHqiXc EQjZEL6fPcBf6WOGPGQHLCcLXRLDyF2F4QiICfLWsjj12sqsaqVprzoIWd4+XiiGKT1G o/6H9tO4vYSShcWsOf/xH6VbOTagpioeeAX3qQ9JtQejvuc9ULv/1J0AnD21cRjIlGV0 4hcg== X-Gm-Message-State: ANhLgQ18emOd7CLAXQB03tU2UI0gU30PiPSdRL1ontRLMqig2J3rgone b1f6yBKIUmcs8KLzWFL4L6zwaDGK6kAkPw== X-Google-Smtp-Source: ADFU+vvhAldbnZZHuzl/F9/Uit3jFUwRn/W5naVQPAW9aBh+QtgCKYBW8+yc9+BOKyzXfXF0Jl59cw== X-Received: by 2002:a1c:ba04:: with SMTP id k4mr5648802wmf.165.1584646409886; Thu, 19 Mar 2020 12:33:29 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 4/6] linux-user/flatload.c: Use "" for include of QEMU header target_flat.h Date: Thu, 19 Mar 2020 19:33:21 +0000 Message-Id: <20200319193323.2038-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 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: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The target_flat.h file is a QEMU header, so we should include it using quotes, not angle brackets. Coverity otherwise is unable to find the header: "../linux-user/flatload.c", line 40: error #1712: cannot open source file "target_flat.h" #include ^ because the relevant directory is only on the -iquote path, not the -I path. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- I don't know why Coverity in particular has trouble here but real compilers don't. Still, the "" is the right thing. --- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 0122ab3afe6..66901f39cc5 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -37,7 +37,7 @@ =20 #include "qemu.h" #include "flat.h" -#include +#include "target_flat.h" =20 //#define DEBUG =20 --=20 2.20.1 From nobody Tue Apr 30 23:55:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1584646588; cv=none; d=zohomail.com; s=zohoarc; b=e/sZy/ZalW8iuFv0ZheR2srbjoZjEmgZ8uUVxH/rrN3zXeHkLls9NS7TsMtNj78OC+m+ANxqXjgue/hydxLarNNgzDzdEoiDLAwlc1my3ngG9o4G35Uw44xJUUrCvADXne8Fby4ZWMLE7uEhxv0B+8oc0TaWBtyvYuYll+y0Ks0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584646588; h=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=8ffJlbq2q0JF0+VvZkm8rLGW/gCjOk31Ed0YGik3+A0=; b=HNr3lZH0diE1iB+bl1v/bpz1HlVq1woC/hqTQcG1ZnpwyJecRA7GRFKogHlhIXbBUpKpZOrH6a9B0/2J5X+uZqxCjA7WzNSQ0rRzbH5Ahc1ECTdFDX75Sn1PESi3S3NR4n+RGq0utHiXPFM6Eqv6+MaQutIbPAcl4DEcFgPFuME= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584646588628871.0422764280154; Thu, 19 Mar 2020 12:36:28 -0700 (PDT) Received: from localhost ([::1]:42254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0xv-0008Dd-4e for importer@patchew.org; Thu, 19 Mar 2020 15:36:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58114) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0v9-0004Mv-H8 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v7-00061q-8w for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:35 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:38445) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v7-0005y1-13 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:33 -0400 Received: by mail-wr1-x431.google.com with SMTP id s1so4644601wrv.5 for ; Thu, 19 Mar 2020 12:33:32 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8ffJlbq2q0JF0+VvZkm8rLGW/gCjOk31Ed0YGik3+A0=; b=N9FdOT9JxNuglsVmzMenuwerlNCbVuq94ocs1I5W+u+JT8/+ydoYLTd8N1L0PMtR4T zQXRfb7OS5Ke9wlTO/mMwUb36JqxtbZPNDK1WN9OHXpnJ3P57uBsUfOl5w4FMdKTR4Is kyWAvarw8iCER3Uj4N9DXcP/WOXkdYq5kqljlN/gaoirz5g+YdhnMNkdo/UkPkhEkq2n iv8UVvjpyyvBC2cNCeDc0tTQ5JNopEGhrhYlqH8wcLUUdlqwCkLqnYV1ArtTdL1s4tUT 6R3f2PK2+V0IH1jX+jQzDkXDqHkuBm6axi6Ob1N/1ijTMQ6djl/r+4SsJC9uXhBZU9C3 vHoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8ffJlbq2q0JF0+VvZkm8rLGW/gCjOk31Ed0YGik3+A0=; b=B29KPrt0Y3fz6ywGwJQzVMHrVD1zs5BdMHU5POViITC230bF+WYClRvjwe9jvXty+l n1pyaFPch1Y4RTeukSfSIj0SNr0nM/NS82IuefG6rb11Aync348UmtYASrlzDl0qjGO2 qc3JfwgAyLH8fz5LoBgwT5UcewMAgt74e+q4JEE3okjqkck+CpbWqEp56YNXQiO1RVLh z4pElDJC0llkU44I3eET+ZkAMyydHLt4F2aHL+dEGE5vbnQN/DqgoWuB05ee3kjp/AKE VYWAINXH8XM6/jFYkee5Goud0qmzxiVSkPn5WTtYJy+Z+sDRKNwBPHGofsEwSjQp3VAV +jdw== X-Gm-Message-State: ANhLgQ1iPTUb9UNNV0KBIbb4BYPUE1WsNdwCICRvSXPU8H6V+jetV12s UWXns4VD0n2QV+OYhIPuWzqZSxYGVh14sA== X-Google-Smtp-Source: ADFU+vs/utw+tv6z/iPX6qBaUvTXxSaTBb2op3C4HqPS12k+pxBI+gqvUD6cRjlU/y1mhFwGYWVc6A== X-Received: by 2002:adf:f1c4:: with SMTP id z4mr6599188wro.342.1584646411009; Thu, 19 Mar 2020 12:33:31 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 5/6] scripts/run-coverity-scan: Script to run Coverity Scan build Date: Thu, 19 Mar 2020 19:33:22 +0000 Message-Id: <20200319193323.2038-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 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: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Add a new script to automate the process of running the Coverity Scan build tools and uploading the resulting tarball to the website. This is intended eventually to be driven from Travis, but it can be run locally, if you are a maintainer of the QEMU project on the Coverity Scan website and have the secret upload token. The script must be run on a Fedora 30 system. Support for using a Docker container is added in a following commit. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- changes v1->v2: * fix sense of DRYRUN test in check_upload_permissions * use nproc rather than hardcoding -j8 * use $PWD rather than $(pwd) * minor tweaks to configure line * new --results-tarball option --- MAINTAINERS | 5 + scripts/coverity-scan/run-coverity-scan | 311 ++++++++++++++++++++++++ 2 files changed, 316 insertions(+) create mode 100755 scripts/coverity-scan/run-coverity-scan diff --git a/MAINTAINERS b/MAINTAINERS index 7364af0d8b0..395534522b6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2003,6 +2003,11 @@ M: Markus Armbruster S: Supported F: scripts/coverity-model.c =20 +Coverity Scan integration +M: Peter Maydell +S: Maintained +F: scripts/coverity-scan/ + Device Tree M: Alistair Francis R: David Gibson diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-sca= n/run-coverity-scan new file mode 100755 index 00000000000..d40b51969fa --- /dev/null +++ b/scripts/coverity-scan/run-coverity-scan @@ -0,0 +1,311 @@ +#!/bin/sh -e + +# Upload a created tarball to Coverity Scan, as per +# https://scan.coverity.com/projects/qemu/builds/new + +# This work is licensed under the terms of the GNU GPL version 2, +# or (at your option) any later version. +# See the COPYING file in the top-level directory. +# +# Copyright (c) 2017-2020 Linaro Limited +# Written by Peter Maydell + +# Note that this script will automatically download and +# run the (closed-source) coverity build tools, so don't +# use it if you don't trust them! + +# This script assumes that you're running it from a QEMU source +# tree, and that tree is a fresh clean one, because we do an in-tree +# build. (This is necessary so that the filenames that the Coverity +# Scan server sees are relative paths that match up with the component +# regular expressions it uses; an out-of-tree build won't work for this.) +# The host machine should have as many of QEMU's dependencies +# installed as possible, for maximum coverity coverage. + +# To do an upload you need to be a maintainer in the Coverity online +# service, and you will need to know the "Coverity token", which is a +# secret 8 digit hex string. You can find that from the web UI in the +# project settings, if you have maintainer access there. + +# Command line options: +# --dry-run : run the tools, but don't actually do the upload +# --update-tools-only : update the cached copy of the tools, but don't r= un them +# --tokenfile : file to read Coverity token from +# --version ver : specify version being analyzed (default: ask git) +# --description desc : specify description of this version (default: ask= git) +# --srcdir : QEMU source tree to analyze (default: current working dir) +# --results-tarball : path to copy the results tarball to (default: don't +# copy it anywhere, just upload it) +# +# User-specifiable environment variables: +# COVERITY_TOKEN -- Coverity token +# COVERITY_EMAIL -- the email address to use for uploads (default: +# looks at your git user.email config) +# COVERITY_BUILD_CMD -- make command (default: 'make -jN' where N is +# number of CPUs as determined by 'nproc') +# COVERITY_TOOL_BASE -- set to directory to put coverity tools +# (default: /tmp/coverity-tools) +# +# You must specify the token, either by environment variable or by +# putting it in a file and using --tokenfile. Everything else has +# a reasonable default if this is run from a git tree. + +check_upload_permissions() { + # Check whether we can do an upload to the server; will exit the script + # with status 1 if the check failed (usually a bad token); + # will exit the script with status 0 if the check indicated that we + # can't upload yet (ie we are at quota) + # Assumes that PROJTOKEN, PROJNAME and DRYRUN have been initialized. + + echo "Checking upload permissions..." + + if ! up_perm=3D"$(wget https://scan.coverity.com/api/upload_permitted = --post-data "token=3D$PROJTOKEN&project=3D$PROJNAME" -q -O -)"; then + echo "Coverity Scan API access denied: bad token?" + exit 1 + fi + + # Really up_perm is a JSON response with either + # {upload_permitted:true} or {next_upload_permitted_at:} + # We do some hacky string parsing instead of properly parsing it. + case "$up_perm" in + *upload_permitted*true*) + echo "Coverity Scan: upload permitted" + ;; + *next_upload_permitted_at*) + if [ "$DRYRUN" =3D yes ]; then + echo "Coverity Scan: upload quota reached, continuing dry = run" + else + echo "Coverity Scan: upload quota reached; stopping here" + # Exit success as this isn't a build error. + exit 0 + fi + ;; + *) + echo "Coverity Scan upload check: unexpected result $up_perm" + exit 1 + ;; + esac +} + + +update_coverity_tools () { + # Check for whether we need to download the Coverity tools + # (either because we don't have a copy, or because it's out of date) + # Assumes that COVERITY_TOOL_BASE, PROJTOKEN and PROJNAME are set. + + mkdir -p "$COVERITY_TOOL_BASE" + cd "$COVERITY_TOOL_BASE" + + echo "Checking for new version of coverity build tools..." + wget https://scan.coverity.com/download/linux64 --post-data "token=3D$= PROJTOKEN&project=3D$PROJNAME&md5=3D1" -O coverity_tool.md5.new + + if ! cmp -s coverity_tool.md5 coverity_tool.md5.new; then + # out of date md5 or no md5: download new build tool + # blow away the old build tool + echo "Downloading coverity build tools..." + rm -rf coverity_tool coverity_tool.tgz + wget https://scan.coverity.com/download/linux64 --post-data "token= =3D$PROJTOKEN&project=3D$PROJNAME" -O coverity_tool.tgz + if ! (cat coverity_tool.md5.new; echo " coverity_tool.tgz") | md5= sum -c --status; then + echo "Downloaded tarball didn't match md5sum!" + exit 1 + fi + # extract the new one, keeping it corralled in a 'coverity_tool' d= irectory + echo "Unpacking coverity build tools..." + mkdir -p coverity_tool + cd coverity_tool + tar xf ../coverity_tool.tgz + cd .. + mv coverity_tool.md5.new coverity_tool.md5 + fi + + rm -f coverity_tool.md5.new +} + + +# Check user-provided environment variables and arguments +DRYRUN=3Dno +UPDATE_ONLY=3Dno + +while [ "$#" -ge 1 ]; do + case "$1" in + --dry-run) + shift + DRYRUN=3Dyes + ;; + --update-tools-only) + shift + UPDATE_ONLY=3Dyes + ;; + --version) + shift + if [ $# -eq 0 ]; then + echo "--version needs an argument" + exit 1 + fi + VERSION=3D"$1" + shift + ;; + --description) + shift + if [ $# -eq 0 ]; then + echo "--description needs an argument" + exit 1 + fi + DESCRIPTION=3D"$1" + shift + ;; + --tokenfile) + shift + if [ $# -eq 0 ]; then + echo "--tokenfile needs an argument" + exit 1 + fi + COVERITY_TOKEN=3D"$(cat "$1")" + shift + ;; + --srcdir) + shift + if [ $# -eq 0 ]; then + echo "--srcdir needs an argument" + exit 1 + fi + SRCDIR=3D"$1" + shift + ;; + --results-tarball) + shift + if [ $# -eq 0 ]; then + echo "--results-tarball needs an argument" + exit 1 + fi + RESULTSTARBALL=3D"$1" + shift + ;; + *) + echo "Unexpected argument '$1'" + exit 1 + ;; + esac +done + +if [ -z "$COVERITY_TOKEN" ]; then + echo "COVERITY_TOKEN environment variable not set" + exit 1 +fi + +if [ -z "$COVERITY_BUILD_CMD" ]; then + NPROC=3D$(nproc) + COVERITY_BUILD_CMD=3D"make -j$NPROC" + echo "COVERITY_BUILD_CMD: using default '$COVERITY_BUILD_CMD'" +fi + +if [ -z "$COVERITY_TOOL_BASE" ]; then + echo "COVERITY_TOOL_BASE: using default /tmp/coverity-tools" + COVERITY_TOOL_BASE=3D/tmp/coverity-tools +fi + +if [ -z "$SRCDIR" ]; then + SRCDIR=3D"$PWD" +fi + +PROJTOKEN=3D"$COVERITY_TOKEN" +PROJNAME=3DQEMU +TARBALL=3Dcov-int.tar.xz + + +if [ "$UPDATE_ONLY" =3D yes ]; then + # Just do the tools update; we don't need to check whether + # we are in a source tree or have upload rights for this, + # so do it before some of the command line and source tree checks. + update_coverity_tools + exit 0 +fi + +cd "$SRCDIR" + +echo "Checking this is a QEMU source tree..." +if ! [ -e "$SRCDIR/VERSION" ]; then + echo "Not in a QEMU source tree?" + exit 1 +fi + +# Fill in defaults used by the non-update-only process +if [ -z "$VERSION" ]; then + VERSION=3D"$(git describe --always HEAD)" +fi + +if [ -z "$DESCRIPTION" ]; then + DESCRIPTION=3D"$(git rev-parse HEAD)" +fi + +if [ -z "$COVERITY_EMAIL" ]; then + COVERITY_EMAIL=3D"$(git config user.email)" +fi + +check_upload_permissions + +update_coverity_tools + +TOOLBIN=3D"$(cd "$COVERITY_TOOL_BASE" && echo $PWD/coverity_tool/cov-analy= sis-*/bin)" + +if ! test -x "$TOOLBIN/cov-build"; then + echo "Couldn't find cov-build in the coverity build-tool directory??" + exit 1 +fi + +export PATH=3D"$TOOLBIN:$PATH" + +cd "$SRCDIR" + +echo "Doing make distclean..." +make distclean + +echo "Configuring..." +# We configure with a fixed set of enables here to ensure that we don't +# accidentally reduce the scope of the analysis by doing the build on +# the system that's missing a dependency that we need to build part of +# the codebase. +./configure --disable-modules --enable-sdl --enable-gtk \ + --enable-opengl --enable-vte --enable-gnutls \ + --enable-nettle --enable-curses --enable-curl \ + --audio-drv-list=3Doss,alsa,sdl,pa --enable-virtfs \ + --enable-vnc --enable-vnc-sasl --enable-vnc-jpeg --enable-vnc-png \ + --enable-xen --enable-brlapi \ + --enable-linux-aio --enable-attr \ + --enable-cap-ng --enable-trace-backends=3Dlog --enable-spice --enable-= rbd \ + --enable-xfsctl --enable-libusb --enable-usb-redir \ + --enable-libiscsi --enable-libnfs --enable-seccomp \ + --enable-tpm --enable-libssh --enable-lzo --enable-snappy --enable-bzi= p2 \ + --enable-numa --enable-rdma --enable-smartcard --enable-virglrenderer \ + --enable-mpath --enable-libxml2 --enable-glusterfs \ + --enable-virtfs --enable-zstd + +echo "Making libqemustub.a..." +make libqemustub.a + +echo "Running cov-build..." +rm -rf cov-int +mkdir cov-int +cov-build --dir cov-int $COVERITY_BUILD_CMD + +echo "Creating results tarball..." +tar cvf - cov-int | xz > "$TARBALL" + +if [ ! -z "$RESULTSTARBALL" ]; then + echo "Copying results tarball to $RESULTSTARBALL..." + cp "$TARBALL" "$RESULTSTARBALL" +fi + +echo "Uploading results tarball..." + +if [ "$DRYRUN" =3D yes ]; then + echo "Dry run only, not uploading $TARBALL" + exit 0 +fi + +curl --form token=3D"$PROJTOKEN" --form email=3D"$COVERITY_EMAIL" \ + --form file=3D@"$TARBALL" --form version=3D"$VERSION" \ + --form description=3D"$DESCRIPTION" \ + https://scan.coverity.com/builds?project=3D"$PROJNAME" + +echo "Done." --=20 2.20.1 From nobody Tue Apr 30 23:55:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1584646692; cv=none; d=zohomail.com; s=zohoarc; b=bW97LX6M0SNLaXvXISDwXEm+Alme301CnTcxG5bMKkNKs6R2oDBuaanGtT5/ontJzqUSCGoruDlA80a2kK3JFmSAfJ/x/x9Clj7RZBjy9KXHNqbqoJpGr6fIM7hlBUXpTsl5f5fKvVmfJ0RRs2+i+b05BdR6I9z+gc/c0XpROSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584646692; h=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=SF8R5D5p5UyH4Z2/xaugTdMkdjsfKFt6GxrCOXYQG78=; b=iMEAM869kx8kNol4LB+t8ovAhmkApfTfOzoAtoHIul1z4y7uVC7+/gueUenUgmBWoMKFbTlqibEK4y+hdfL/jxtbLOf9PxB6iKJVYRFQMqQAR1qgzoaaK8mIFqQVBXK2JN+lFUhBO8e1MyfA3w94vw/XPSFqdgNX+FR41UwIooA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584646692617393.3825405205978; Thu, 19 Mar 2020 12:38:12 -0700 (PDT) Received: from localhost ([::1]:42292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0za-0001ll-ST for importer@patchew.org; Thu, 19 Mar 2020 15:38:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58121) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jF0vB-0004Nj-Ek for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jF0v7-00064Y-Vh for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:37 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:40994) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jF0v7-00061G-O9 for qemu-devel@nongnu.org; Thu, 19 Mar 2020 15:33:33 -0400 Received: by mail-wr1-x42a.google.com with SMTP id h9so4623828wrc.8 for ; Thu, 19 Mar 2020 12:33:33 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o9sm4984794wrw.20.2020.03.19.12.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 12:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SF8R5D5p5UyH4Z2/xaugTdMkdjsfKFt6GxrCOXYQG78=; b=jZRPhr5KVfSmJhz+ndRsRgeXlFpnzHf2zU5seVrih4C0XoqHyolvrEsVTkU/ItB4VT YjX2pW1K66uieHOsAFRpLST27jixROhJHLYFIXwEK/Ax+UfmuSlMSgR9CuFk5QrOpggw Zz/C644E+odemwOiAMrKUqkAMs7OITPcHrZb6j16PGmxPw/WgXofSRHn9E6XxSSeI/SQ nUwBB4Zk2HFlYfrqWSOwD1m/jmHo1dExAMNa6uXSo5d+2+Msh/vG3w9VzVYjCtXiLQyz tNLYOzhWsjR/ScfK4W9mQDcsvDOiIgpNQ+v6UDIfVTBTLTiAPT9yThrVGNmO+2w6P8TP 49ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SF8R5D5p5UyH4Z2/xaugTdMkdjsfKFt6GxrCOXYQG78=; b=k/RiulOsLzb7ldeuTsKiNMAxJWCxsJJkFdVWninPWI45XDjA9/Rr/Eqrls0URZ760Z 11PAkkMUDmtbh+zGwdm8e//JKuMthejlmGxM1LVXU3V1QEvqWKD85mTy2hWflt9UryET T+zlfR+lu2jD6eSXWXew0+arI78Dqqs/fqHahOag4jt6WMQ5gLbvK02CdOTomPcxNp0s cAiGYY2ymRsHDoXodYn9FOYKUvtgPSXBVxa1TOEY+RIuDs2e8izdtEFUbXwZ2zA58U/x AH5yTWtT7w6xUFPgd2zciH6/AzwjJakxz65QUNYi4dUpXBG2uPsXHmAMppREjffo3ZJC B7Zw== X-Gm-Message-State: ANhLgQ3rgswtutsWfwoKeVpueAn6I+jsraFwcBYcbqNPIgrZVoEss+sw /R+zQB/YuUKiDFBddC1kFesdSf3fCuLL9w== X-Google-Smtp-Source: ADFU+vsQK53ghDw6BgKLPx/mukwtubdY+ak8tIByLYJbF0HYSYthMHCXFHm0KuUkRxXIz5AcYD1KWw== X-Received: by 2002:adf:83c4:: with SMTP id 62mr6574854wre.105.1584646412099; Thu, 19 Mar 2020 12:33:32 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 6/6] scripts/coverity-scan: Add Docker support Date: Thu, 19 Mar 2020 19:33:23 +0000 Message-Id: <20200319193323.2038-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200319193323.2038-1-peter.maydell@linaro.org> References: <20200319193323.2038-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a 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: Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Add support for running the Coverity Scan tools inside a Docker container rather than directly on the host system. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- v1->v2: * various bug fixes * added --src-tarball rather than putting the whole source tree in the 'secrets' directory * docker file package list updated --- scripts/coverity-scan/coverity-scan.docker | 131 +++++++++++++++++++++ scripts/coverity-scan/run-coverity-scan | 90 ++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 scripts/coverity-scan/coverity-scan.docker diff --git a/scripts/coverity-scan/coverity-scan.docker b/scripts/coverity-= scan/coverity-scan.docker new file mode 100644 index 00000000000..a4f64d12834 --- /dev/null +++ b/scripts/coverity-scan/coverity-scan.docker @@ -0,0 +1,131 @@ +# syntax=3Ddocker/dockerfile:1.0.0-experimental +# +# Docker setup for running the "Coverity Scan" tools over the source +# tree and uploading them to the website, as per +# https://scan.coverity.com/projects/qemu/builds/new +# We do this on a fixed config (currently Fedora 30 with a known +# set of dependencies and a configure command that enables a specific +# set of options) so that random changes don't result in our accidentally +# dropping some files from the scan. +# +# We don't build on top of the fedora.docker file because we don't +# want to accidentally change or break the scan config when that +# is updated. + +# The work of actually doing the build is handled by the +# run-coverity-scan script. + +FROM fedora:30 +ENV PACKAGES \ + alsa-lib-devel \ + bc \ + bison \ + brlapi-devel \ + bzip2 \ + bzip2-devel \ + ccache \ + clang \ + curl \ + cyrus-sasl-devel \ + dbus-daemon \ + device-mapper-multipath-devel \ + findutils \ + flex \ + gcc \ + gcc-c++ \ + gettext \ + git \ + glib2-devel \ + glusterfs-api-devel \ + gnutls-devel \ + gtk3-devel \ + hostname \ + libaio-devel \ + libasan \ + libattr-devel \ + libblockdev-mpath-devel \ + libcap-devel \ + libcap-ng-devel \ + libcurl-devel \ + libepoxy-devel \ + libfdt-devel \ + libgbm-devel \ + libiscsi-devel \ + libjpeg-devel \ + libpmem-devel \ + libnfs-devel \ + libpng-devel \ + librbd-devel \ + libseccomp-devel \ + libssh-devel \ + libubsan \ + libudev-devel \ + libusbx-devel \ + libxml2-devel \ + libzstd-devel \ + llvm \ + lzo-devel \ + make \ + mingw32-bzip2 \ + mingw32-curl \ + mingw32-glib2 \ + mingw32-gmp \ + mingw32-gnutls \ + mingw32-gtk3 \ + mingw32-libjpeg-turbo \ + mingw32-libpng \ + mingw32-libtasn1 \ + mingw32-nettle \ + mingw32-nsis \ + mingw32-pixman \ + mingw32-pkg-config \ + mingw32-SDL2 \ + mingw64-bzip2 \ + mingw64-curl \ + mingw64-glib2 \ + mingw64-gmp \ + mingw64-gnutls \ + mingw64-gtk3 \ + mingw64-libjpeg-turbo \ + mingw64-libpng \ + mingw64-libtasn1 \ + mingw64-nettle \ + mingw64-pixman \ + mingw64-pkg-config \ + mingw64-SDL2 \ + ncurses-devel \ + nettle-devel \ + nss-devel \ + numactl-devel \ + perl \ + perl-Test-Harness \ + pixman-devel \ + pulseaudio-libs-devel \ + python3 \ + python3-sphinx \ + PyYAML \ + rdma-core-devel \ + SDL2-devel \ + snappy-devel \ + sparse \ + spice-server-devel \ + systemd-devel \ + systemtap-sdt-devel \ + tar \ + texinfo \ + usbredir-devel \ + virglrenderer-devel \ + vte291-devel \ + wget \ + which \ + xen-devel \ + xfsprogs-devel \ + zlib-devel +ENV QEMU_CONFIGURE_OPTS --python=3D/usr/bin/python3 + +RUN dnf install -y $PACKAGES +RUN rpm -q $PACKAGES | sort > /packages.txt +ENV PATH $PATH:/usr/libexec/python3-sphinx/ +ENV COVERITY_TOOL_BASE=3D/coverity-tools +COPY run-coverity-scan run-coverity-scan +RUN --mount=3Dtype=3Dsecret,id=3Dcoverity.token,required ./run-coverity-sc= an --update-tools-only --tokenfile /run/secrets/coverity.token diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-sca= n/run-coverity-scan index d40b51969fa..2e067ef5cfc 100755 --- a/scripts/coverity-scan/run-coverity-scan +++ b/scripts/coverity-scan/run-coverity-scan @@ -29,6 +29,7 @@ =20 # Command line options: # --dry-run : run the tools, but don't actually do the upload +# --docker : create and work inside a docker container # --update-tools-only : update the cached copy of the tools, but don't r= un them # --tokenfile : file to read Coverity token from # --version ver : specify version being analyzed (default: ask git) @@ -36,6 +37,8 @@ # --srcdir : QEMU source tree to analyze (default: current working dir) # --results-tarball : path to copy the results tarball to (default: don't # copy it anywhere, just upload it) +# --src-tarball : tarball to untar into src dir (default: none); this +# is intended mainly for internal use by the Docker supp= ort # # User-specifiable environment variables: # COVERITY_TOKEN -- Coverity token @@ -125,6 +128,7 @@ update_coverity_tools () { # Check user-provided environment variables and arguments DRYRUN=3Dno UPDATE_ONLY=3Dno +DOCKER=3Dno =20 while [ "$#" -ge 1 ]; do case "$1" in @@ -181,6 +185,19 @@ while [ "$#" -ge 1 ]; do RESULTSTARBALL=3D"$1" shift ;; + --src-tarball) + shift + if [ $# -eq 0 ]; then + echo "--src-tarball needs an argument" + exit 1 + fi + SRCTARBALL=3D"$1" + shift + ;; + --docker) + DOCKER=3Dyes + shift + ;; *) echo "Unexpected argument '$1'" exit 1 @@ -212,6 +229,10 @@ PROJTOKEN=3D"$COVERITY_TOKEN" PROJNAME=3DQEMU TARBALL=3Dcov-int.tar.xz =20 +if [ "$UPDATE_ONLY" =3D yes ] && [ "$DOCKER" =3D yes ]; then + echo "Combining --docker and --update-only is not supported" + exit 1 +fi =20 if [ "$UPDATE_ONLY" =3D yes ]; then # Just do the tools update; we don't need to check whether @@ -221,8 +242,17 @@ if [ "$UPDATE_ONLY" =3D yes ]; then exit 0 fi =20 +if [ ! -e "$SRCDIR" ]; then + mkdir "$SRCDIR" +fi + cd "$SRCDIR" =20 +if [ ! -z "$SRCTARBALL" ]; then + echo "Untarring source tarball into $SRCDIR..." + tar xvf "$SRCTARBALL" +fi + echo "Checking this is a QEMU source tree..." if ! [ -e "$SRCDIR/VERSION" ]; then echo "Not in a QEMU source tree?" @@ -242,6 +272,66 @@ if [ -z "$COVERITY_EMAIL" ]; then COVERITY_EMAIL=3D"$(git config user.email)" fi =20 +# Run ourselves inside docker if that's what the user wants +if [ "$DOCKER" =3D yes ]; then + # build docker container including the coverity-scan tools + # Put the Coverity token into a temporary file that only + # we have read access to, and then pass it to docker build + # using --secret. This requires at least Docker 18.09. + # Mostly what we are trying to do here is ensure we don't leak + # the token into the Docker image. + umask 077 + SECRETDIR=3D$(mktemp -d) + if [ -z "$SECRETDIR" ]; then + echo "Failed to create temporary directory" + exit 1 + fi + trap 'rm -rf "$SECRETDIR"' INT TERM EXIT + echo "Created temporary directory $SECRETDIR" + SECRET=3D"$SECRETDIR/token" + echo "$COVERITY_TOKEN" > "$SECRET" + echo "Building docker container..." + # TODO: This re-downloads the tools every time, rather than + # caching and reusing the image produced with the downloaded tools. + # Not sure why. + # TODO: how do you get 'docker build' to print the output of the + # commands it is running to its stdout? This would be useful for debug. + DOCKER_BUILDKIT=3D1 docker build -t coverity-scanner \ + --secret id=3Dcoverity.token,src=3D"$SECRET" \ + -f scripts/coverity-scan/coverity-scan.docker \ + scripts/coverity-scan + echo "Archiving sources to be analyzed..." + ./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz" + if [ "$DRYRUN" =3D yes ]; then + DRYRUNARG=3D--dry-run + fi + echo "Running scanner..." + # If we need to capture the output tarball, get the inner run to + # save it to the secrets directory so we can copy it out before the + # directory is cleaned up. + if [ ! -z "$RESULTSTARBALL" ]; then + RTARGS=3D"--results-tarball /work/cov-int.tar.xz" + else + RTARGS=3D"" + fi + # Arrange for this docker run to get access to the sources with -v. + # We pass through all the configuration from the outer script to the i= nner. + export COVERITY_EMAIL COVERITY_BUILD_CMD + docker run -it --env COVERITY_EMAIL --env COVERITY_BUILD_CMD \ + -v "$SECRETDIR:/work" coverity-scanner \ + ./run-coverity-scan --version "$VERSION" \ + --description "$DESCRIPTION" $DRYRUNARG --tokenfile /work/token= \ + --srcdir /qemu --src-tarball /work/qemu-sources.tgz $RTARGS + if [ ! -z "$RESULTSTARBALL" ]; then + echo "Copying results tarball to $RESULTSTARBALL..." + cp "$SECRETDIR/cov-int.tar.xz" "$RESULTSTARBALL" + fi + echo "Docker work complete." + exit 0 +fi + +# Otherwise, continue with the full build and upload process. + check_upload_permissions =20 update_coverity_tools --=20 2.20.1