Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp171730rdh; Wed, 22 Nov 2023 23:59:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGYE+0MvqrCalphiRe+Qr+v1GT+c/1OMIQRudCxvsoOelrPLjsrkdUL9Njtl2Qz4SHfzWe X-Received: by 2002:a17:903:443:b0:1cc:436d:39dd with SMTP id iw3-20020a170903044300b001cc436d39ddmr4663404plb.65.1700726396921; Wed, 22 Nov 2023 23:59:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700726396; cv=none; d=google.com; s=arc-20160816; b=So+Om1BrDysPMDflXqcgpGDSUDM8n8W51QVhfO7yTu0GFkzZT0SlBNOpexBw9fE0X+ kvZN2XaQgPAXFoBDOR/NRAcOsUCReKbnkxbjYE7ELFgQ2J4CSs9MXhHIydw/G21w+L9P FjZt7KX5VRj6DLXUWCFkQTvdgVQN9ZNWh5XOi7WDhYVJ6Vy2lTmk+n2LdHaRZkzRKQQ6 HwKjI7x6OMyjkP5aVK5uSjmUFBBl1onUihiLRWQhvH2gDh7KXdimc9HRQduaNHzlk9AL gb2oLWSKdoJnPAqu5VVL499wmJzTLlyvaxRVbcHt7rM1fEHO5eVDCeHzzEgJnOr2YUVW G84w== 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 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u13-20020a170903124d00b001b045d65aedsi655913plh.228.2023.11.22.23.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 23:59:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; 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 23.128.96.32 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 257608236259; Wed, 22 Nov 2023 23:59:53 -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 + 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 ); 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 To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , James Clark , German Gomez , Leo Yan , 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: 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:53 -0800 (PST) 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 --- 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 +} -- 2.34.1