Message ID | 20231123075848.9652-3-adrian.hunter@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp284418vqx; Wed, 22 Nov 2023 23:59:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvUFElA/AQfuEWLHe980hzXTONh9nG3RqqdzRFHQxIM7h2h4fIix3m7Ut4296Reyj+2v78 X-Received: by 2002:a9d:6d05:0:b0:6af:95f9:7adc with SMTP id o5-20020a9d6d05000000b006af95f97adcmr5354049otp.14.1700726393965; Wed, 22 Nov 2023 23:59:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700726393; cv=none; d=google.com; s=arc-20160816; b=n73zFRYGMLRJdRXR3lVQVqXLFY76Y7UnxY4PFAjOkjTVn/Je1SZbANEWa5Y1Ft0EUI gQlJiKa3/gkGOXVT667LDyQDNrvD4vkz3LoLE0oN+vbZQroUHQu1e5Jwg9w4kwf3GOSs 2YoSuNSBLdbFHAFU1N1u3c+4RkKzKjtXUVoIwHnk4iD5+MreNNVv9ZF91WM7CcCs/a+r qM4wvSzOBPm4Fj7oAmvjAjmkYLVwmicgpPg3FdAurSjZqtND3Tg79wS/CFL+Dy+rgUnt AzkGu2LjTQEd0MhyGru/KmntlJ9su6b358CwU2R8T3+BRyyFuIzpyF3MNAoKZJ3sBU91 2sxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YV1qYiFLYqTL4QTLInIyBkyIAmebYkYw8sO4GZKqhs8=; fh=TPQr4nff5QO7OKSg4AL08iZb9B1RwOBx3bV3jWC0cDE=; b=kdjw5jKkHMngciPBJNOwPQJJGQsGNSoLvPGWmr1jGCTe5XnuKB/tY2Yt75W5G/RT+F /1csoJQW/mP29l0tHkRhF/HMSG8tVYI1glHAM+MqiaaZCBc94RTxTbKKvOhz6RHfI03f ImrO+esCh6jbiwQN4p6jAaXzkqtnkR4NhIlOHR9AoLbYfA0Uo7K+8zZULrM4dRMkmLjV ztrczQK9ayQV8h/a5bNAiHCboaTiDmTTtXq8TGoAxiAhI0Qwy+9SlEg+5IEecxCJWznq XWNzKZARsxOXnAEALxs8IM/PnSt9Xb1nkzUpdrLar3rMDsa3JIjo8u2DacnffR8LMTMh M0xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=K9oRkGKn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id 143-20020a630195000000b005b881cc9498si832498pgb.339.2023.11.22.23.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 23:59:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=K9oRkGKn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 40E7381EE2CB; Wed, 22 Nov 2023 23:59:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234981AbjKWH7a (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 23 Nov 2023 02:59:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233940AbjKWH7Y (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Nov 2023 02:59:24 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9EB5DD; Wed, 22 Nov 2023 23:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700726370; x=1732262370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kUUFMnMOTmqXLUn2vId7q0QVssfMrP3gOX/sAt3Ulg0=; b=K9oRkGKnWGnRD3VVQBccxpNVBHIBEFDV7gSazu/dRLskV58/MNu/Hvhx zYpnnwqhTl6zLIvu5dbrtbquLNTpKpEG2dTMn+Sxc27dmu29+t2l/QyBP vFoj6fM5iQcxvDwQbHB7Z+3VVYZY5sVnyvA/EhG5+jjdHZu4JFnyYEGnO NdiJyZBBd7Uo7Up0UmOQSWRPqrn/Y7Zd8pD8zjwvpYNZrVWRm4roZq40f ZRquMC7tarPubZvTHs96CFrl9wh5ZKJk56xIrSIQ3nEYbSxyMiDveS//8 L+EkSLr8DH3XT8VrN0IwqcUtJBkzKn3EBJL0ozG93a7gD8LWwFNoBISg1 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="396126413" X-IronPort-AV: E=Sophos;i="6.04,221,1695711600"; d="scan'208";a="396126413" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 23:59:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,221,1695711600"; d="scan'208";a="8764981" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.41.107]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 23:59:09 -0800 From: Adrian Hunter <adrian.hunter@intel.com> To: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, James Clark <james.clark@arm.com>, German Gomez <german.gomez@arm.com>, Leo Yan <leo.yan@linaro.org>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 2/8] perf tests lib: Add perf_has_symbol.sh Date: Thu, 23 Nov 2023 09:58:42 +0200 Message-Id: <20231123075848.9652-3-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231123075848.9652-1-adrian.hunter@intel.com> References: <20231123075848.9652-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 23:59:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783340879330504134 X-GMAIL-MSGID: 1783340879330504134 |
Series |
perf tests: Reduce inexplicable test failures
|
|
Commit Message
Adrian Hunter
Nov. 23, 2023, 7:58 a.m. UTC
Some shell tests depend on finding symbols for perf itself, and fail if
perf has been stripped and no debug object is available. Add helper
functions to check if perf has a needed symbol. This is preparation for
amending the tests themselves to be skipped if a needed symbol is not
found.
The functions make use of the "Symbols" test which reads and checks symbols
from a dso, perf itself by default. Note the "Symbols" test will find
symbols using the same method as other perf tests, including, for example,
looking in the buildid cache.
An alternative would be to prevent the needed symbols from being stripped,
which seems to work with gcc's externally_visible attribute, but that
attribute is not supported by clang.
Another alternative would be to use option -Wl,-E (which is already used
when perf is built with perl support) which causes the linker to add all
(global) symbols to the dynamic symbol table. Then the required symbols
need only be made global in scope to avoid being strippable. However that
goes beyond what is needed.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/tests/shell/lib/perf_has_symbol.sh | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 tools/perf/tests/shell/lib/perf_has_symbol.sh
diff --git a/tools/perf/tests/shell/lib/perf_has_symbol.sh b/tools/perf/tests/shell/lib/perf_has_symbol.sh new file mode 100644 index 000000000000..5d59c32ae3e7 --- /dev/null +++ b/tools/perf/tests/shell/lib/perf_has_symbol.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +perf_has_symbol() +{ + if perf test -vv "Symbols" 2>&1 | grep "[[:space:]]$1$"; then + echo "perf does have symbol '$1'" + return 0 + fi + echo "perf does not have symbol '$1'" + return 1 +} + +skip_test_missing_symbol() +{ + if ! perf_has_symbol "$1" ; then + echo "perf is missing symbols - skipping test" + exit 2 + fi + return 0 +}