Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4180442rwb; Mon, 31 Jul 2023 02:51:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlG0ULlkThnlu5suuxvbIRrpkqdIf3DNS2aK0SnJiMvAznjHyhMKTLjGQ675UEOzXB6TwsFZ X-Received: by 2002:a17:90a:16d0:b0:268:cdde:18d2 with SMTP id y16-20020a17090a16d000b00268cdde18d2mr1251187pje.25.1690797096405; Mon, 31 Jul 2023 02:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690797096; cv=none; d=google.com; s=arc-20160816; b=XssDwqRt/P0KFu6IIJY5lmiIE3IQSR33sWENFml411cjsZYxNu8Odzis/o0Nt1JzNZ Sw7ON9PSxMu+GIsZqkZbOXrQvOvOS2IG4BzWiaWm7DgvesFvcvZeYVaC+xlydi9FRvgo BRUDyLjEmMI7Q9sLbDeuqnujrspda0bDkbhdJ/Up0Dhnc704Wo6xne+uWI0iiG5qL0n6 tNwLclRH1bmbvttZdYEqrRiY/wozm36wFswrVmYWvwriCstXHinGgGZXm+EuE2jXxP2R IfQNA29sucNYrW7v+b5xqDP3rpIhMuQ+zZOWSGId486MqnkArnZZgN7iuoHb02Vu2Yd3 Qc7A== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=tiK3ZJY13VzEoGev6dw1WmDA73dCnywpMkbD5dfGuGY=; fh=45l3HiZHHYTARATxwfUHoVBa8DRQe4hRkRcQkiuV9Wk=; b=b4SafB0T9RJK0E7z5YFBW9UrCWy9K2DK++Iid9Qmrm2E3dQ1wZbQ4caAy6kwsavNFv DBaybH1pdfZZkLsW8/+srRQaLYpQH4YgBIrRkmjH1z07tbvjK6+Wae133/zJWH2Zfbfr 1t7rwMhSf9wOJy6yRgsCT6AzW3/nYSdEGj8hDgO4/rxMdGZvGVKP+jwW0G5jwqXUfIy9 gox/x14SBpkScAHbLo2ecLRgcJBpOV3a1n6lJ//t1JR10qDCkcpZjqPw7nOnoMZ6lu8N 0QwgDY1fB8AgnV0ILQgownkcSsOoP57K8bAjBAJzA3GtKlYAnezOBGxT/H/U6jg+zb3v m2AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D354Qgvf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a17090a764b00b00267deffa3bdsi7198704pjl.121.2023.07.31.02.51.23; Mon, 31 Jul 2023 02:51:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D354Qgvf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232319AbjGaJWR (ORCPT + 99 others); Mon, 31 Jul 2023 05:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232226AbjGaJVy (ORCPT ); Mon, 31 Jul 2023 05:21:54 -0400 Received: from mgamail.intel.com (unknown [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ACE3212A; Mon, 31 Jul 2023 02:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690795190; x=1722331190; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=M2PCAu0m+56F5IHFQZlXkdD0yF1c9t4/NzwenQcRKM0=; b=D354Qgvf9jn8uJzYmc03tPgAW9PMHZkscNvhTr9suSfptBmAuFRRn2X3 HX29ML0in33WQKh8GMS4Lh0G/S8pqlrat8jmVty1ZbhE7HyXHxagUZ2EU oyyUomOuXj4+hTLTBkYkhb38nD3abCKXVdroA82tq6OHgE9fkYEO+K0jH WjS3GC+goH67RKGaXuW775F3ER09FBtztRMPZOpd3a/iyZ1PnFgznTz55 3/13Vg6j2YM9Fc++Hc8Huo5FaT37askwaVAyMnL7gdKCOpGH3lHtFLGIJ vlhGZbgNnR3VF5Y/O9xUhqIheL3MH958grEJXG+Oj7qzWkZwFacYZljgv w==; X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="435273422" X-IronPort-AV: E=Sophos;i="6.01,244,1684825200"; d="scan'208";a="435273422" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 02:19:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="728232893" X-IronPort-AV: E=Sophos;i="6.01,244,1684825200"; d="scan'208";a="728232893" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.251.208.223]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 02:19:09 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 1/3] perf dlfilter: Add a test for resolve_address() Date: Mon, 31 Jul 2023 12:18:55 +0300 Message-Id: <20230731091857.10681-1-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extend the "dlfilter C API" test to test perf_dlfilter_fns.resolve_address(). The test currently fails, but passes after a subsequent patch. Signed-off-by: Adrian Hunter --- tools/perf/dlfilters/dlfilter-test-api-v0.c | 26 ++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/perf/dlfilters/dlfilter-test-api-v0.c b/tools/perf/dlfilters/dlfilter-test-api-v0.c index b1f51efd67d6..72f263d49121 100644 --- a/tools/perf/dlfilters/dlfilter-test-api-v0.c +++ b/tools/perf/dlfilters/dlfilter-test-api-v0.c @@ -254,6 +254,30 @@ static int check_addr_al(void *ctx) return 0; } +static int check_address_al(void *ctx, const struct perf_dlfilter_sample *sample) +{ + struct perf_dlfilter_al address_al; + const struct perf_dlfilter_al *al; + + al = perf_dlfilter_fns.resolve_ip(ctx); + if (!al) + return test_fail("resolve_ip() failed"); + + address_al.size = sizeof(address_al); + if (perf_dlfilter_fns.resolve_address(ctx, sample->ip, &address_al)) + return test_fail("resolve_address() failed"); + + CHECK(address_al.sym && al->sym); + CHECK(!strcmp(address_al.sym, al->sym)); + CHECK(address_al.addr == al->addr); + CHECK(address_al.sym_start == al->sym_start); + CHECK(address_al.sym_end == al->sym_end); + CHECK(address_al.dso && al->dso); + CHECK(!strcmp(address_al.dso, al->dso)); + + return 0; +} + static int check_attr(void *ctx) { struct perf_event_attr *attr = perf_dlfilter_fns.attr(ctx); @@ -290,7 +314,7 @@ static int do_checks(void *data, const struct perf_dlfilter_sample *sample, void if (early && !d->do_early) return 0; - if (check_al(ctx) || check_addr_al(ctx)) + if (check_al(ctx) || check_addr_al(ctx) || check_address_al(ctx, sample)) return -1; if (early) -- 2.34.1