Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp917475lqh; Sat, 1 Jun 2024 01:33:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVfsKdsvzalfdWIHUPbu+oCjp6Amhf9mwOibpuahXAqdqkijb7mT0g8oC9q0fdlxF42akgOafPsnoIXluJ/WNTjwD/E1BrAGIHNSkw5A== X-Google-Smtp-Source: AGHT+IGw2vLRXa3wxDaIGmqrNnGJZS6cas5CZp0suEeVrtmhMgl00lxvwk2GZKQKSNJ43A5NN1Aq X-Received: by 2002:a50:f69a:0:b0:57a:2269:a101 with SMTP id 4fb4d7f45d1cf-57a3641a26dmr2540328a12.22.1717230802726; Sat, 01 Jun 2024 01:33:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717230802; cv=pass; d=google.com; s=arc-20160816; b=o0C/lkZUJFL/yWp1JGebF0zoueXiHHod95GGMep1O8j70Q44C5KvAeOeKLEFZbGAWH YsB6fSTOHcgTq4BPK/hGT5/lq+0IwPbqg8ZqDNuX5CCdvtgbYt7WZ4oB4XZIXEXzLCfX 6Bwkga6x0+FrRpp5PRaT9IBTzoBleui0Wacr/UPDJHUBlvmZAAzGOuNUCjWDIRKCb11c ph4dGonNpcinFnS7ca5jJPEubf6MRbekyjLZr8kuUpLC7uwLhjLY6r9rKHieeiDp2xCS 4em68un2SN6XCJ1ZVKXJcUorbPBdjKAgkXfc2tAcRSzkzD8AJUnUe9fiaT2h7dxx3hRX 1ALw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=9CHreT7/aU7/VUBz6fd/jhzmTfRtTunOnmknD477HtQ=; fh=MVwHBGRSGmZU74aLqYm+M/AGhZWHsMrP0c2+q3cgSNc=; b=VHZjjDWzUj6RN7AImQ4EQyIFUvbKVUiQNYsj9hRD7y6O0Bn7Ik65zq1/G/SGfmJ41U YOvaVN5ocAPysIposkCwmD2AisVWfGAGWey8yyDXd+UjjsCUJxng0pXKVGK/51/nd781 NYQ2ub6wHtuA9H9w49JfCbbad6efZEbdf0yVmnd5u6putrvkG90K722n/Z6oFYavQ5p5 PxL9iT9aps0ENKqhFse340Myln8PvbjNpwJiFXAuXDEKu3aDecJ0IpBsVzbAMOo8ucrP 0Eldm/Meoys28n9z0Q4WyFTl0QATo4JjzlAiM8Hs8SWq6bq3yijZiHXW9K3PtF+82jqD 0GoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JLkBfIXG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c62b81si1874324a12.311.2024.06.01.01.33.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 01:33:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JLkBfIXG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 07E611F27BE4 for ; Sat, 1 Jun 2024 08:23:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5CD020DF7; Sat, 1 Jun 2024 08:22:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JLkBfIXG" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1769811711; Sat, 1 Jun 2024 08:22:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717230179; cv=none; b=GRuZhhD8fQjWh3OYwxEw8Kp6gbgGfBxEmvtK6ZPzqBKTMQpoY80FrmMxNMLoGB47AGVO+4Q9VmR1HjGgAkazz17KRhJWepuUdRPqWI7wwhoHiM7XDjeu+C44WQNq+dgx3bDaOncKuYud2GG2TYgZvmXRuvJo39jipmi53PlhEmA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717230179; c=relaxed/simple; bh=ir1GPv/WVZeGeHO6Nly4BHiSZZOFn2vs7jsNY1Z2JXs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=rTIDbgukqSi4UnokVFjuOslOYnFT4l1ZiaiuCfJgk/qi/naBVnL1tK6Cvhv63HTA2FgMV6v+PROvoYcjkd6FzpQkbZ6ArVmRbVIJ7W2POJWTX6xej3bGd/AVnQ+WHKVYYShinH4Zib/vKq3Fm9D/4uWDThUkiFJDp2FA81mSm6g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JLkBfIXG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E6C5C116B1; Sat, 1 Jun 2024 08:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717230179; bh=ir1GPv/WVZeGeHO6Nly4BHiSZZOFn2vs7jsNY1Z2JXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JLkBfIXGZZFBMaImA+rmmP+F0KASs+OeR7q6vA4tFXZo7nUFBTfY7JDy240OCUv/0 pLIK5OqREwS4EwZtHzI0gxprdPLqLYE4/g6rI2lzFkTjA+Icl9xV1VkAghGLxABqZT v0phh+7Z9qugL5gMDGLLM5HGvPkoTv0uG7RczE9uMLb3pKcQY1nc6TdENGAU+1WMUK FZAlXfRZ35zmmtXbqR/cyqY5qzaWGJ72EWuW0jNery01qbW7ZTgcFudui509rCdTwa h4qDgNKAM8xdhOHJKKXYSpESOf3CpPF2CGigKtR4ZWXFJtxctJGU1P+g7qZnwW6qvN kVuGIXYaLndkA== From: "Masami Hiramatsu (Google)" To: Steven Rostedt Cc: Mathieu Desnoyers , don , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org Subject: [PATCH v2 3/3] sefltests/tracing: Add a test for tracepoint events on modules Date: Sat, 1 Jun 2024 17:22:55 +0900 Message-Id: <171723017495.258703.11572784928592807749.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <171723014778.258703.6731294779199848686.stgit@devnote2> References: <171723014778.258703.6731294779199848686.stgit@devnote2> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit From: Masami Hiramatsu (Google) Add a test case for tracepoint events on modules. This checks if it can add and remove the events correctly. Signed-off-by: Masami Hiramatsu (Google) --- tools/testing/selftests/ftrace/config | 1 + .../test.d/dynevent/add_remove_tprobe_module.tc | 34 ++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/add_remove_tprobe_module.tc diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config index 048a312abf40..544de0db5f58 100644 --- a/tools/testing/selftests/ftrace/config +++ b/tools/testing/selftests/ftrace/config @@ -20,6 +20,7 @@ CONFIG_PREEMPT_TRACER=y CONFIG_PROBE_EVENTS_BTF_ARGS=y CONFIG_SAMPLES=y CONFIG_SAMPLE_FTRACE_DIRECT=m +CONFIG_SAMPLE_TRACE_EVENTS=m CONFIG_SAMPLE_TRACE_PRINTK=m CONFIG_SCHED_TRACER=y CONFIG_STACK_TRACER=y diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_tprobe_module.tc b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_tprobe_module.tc new file mode 100644 index 000000000000..2caed9454caa --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_tprobe_module.tc @@ -0,0 +1,34 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Generic dynamic event - add/remove tracepoint probe events on module +# requires: dynamic_events "t[:[/][]] []":README + +rmmod trace-events-sample ||: +if ! modprobe trace-events-sample ; then + echo "No trace-events sample module - please make CONFIG_SAMPLE_TRACE_EVENTS=m" + exit_unresolved; +fi +trap "rmmod trace-events-sample" EXIT + +echo 0 > events/enable +echo > dynamic_events + +TRACEPOINT1=foo_bar +TRACEPOINT2=foo_bar_with_cond + +echo "t:myevent1 $TRACEPOINT1" >> dynamic_events +echo "t:myevent2 $TRACEPOINT2" >> dynamic_events + +grep -q myevent1 dynamic_events +grep -q myevent2 dynamic_events +test -d events/tracepoints/myevent1 +test -d events/tracepoints/myevent2 + +echo "-:myevent2" >> dynamic_events + +grep -q myevent1 dynamic_events +! grep -q myevent2 dynamic_events + +echo > dynamic_events + +clear_trace