Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp418420pxb; Tue, 1 Feb 2022 02:51:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVhK4eYvCVOCT8W6DSI9oIeZLFcApOkt5eSQ4rs2CEEDuS7L5sbSfSOMaaLDHWtg6sKpJ6 X-Received: by 2002:a17:906:4dd7:: with SMTP id f23mr20580470ejw.385.1643712668384; Tue, 01 Feb 2022 02:51:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643712668; cv=none; d=google.com; s=arc-20160816; b=Zydhh+d+/GPn0MjvddmGe8fNAsCf3bFA0rOvRZ8i0PZZHZYrIWBEL02+Zx2xJCSUd+ WXNSXrpCknY5/jMP75Zt7fk0R9X8p2rmDmscpw3UL5NtVC2E+1TMSTSH5OB+hxxq3gAT UFL6VweQO63OH5LM9r13TrYBBHaURwXAVDstKV64m28XfnJBCRckEaqdPzCOoAiRpd0m VE1b1QeNeepy3N5GMSrtbGgR04h7YD84QfzY6OQ10OYdSmhpp6/btl6zSGG/fmxUV22t Mo2xePRmeTaoM/ZK/MfVhXnSsf0cR6+WWMNlW92D4cUTov3HMV9uAOKPxuL81KFRYb6k Li4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kryIRj8itYCF1TTsF9+Gx7ZLlBZd5qrSWyChaI+fLhg=; b=ss30J09EOOnJysB0gXd17Y0CCoDPSCcFVJHQbuXxrLjJ9VakDvJWaw65+s+1CzzL4P fhiu3Jqe7x7PC20i8zKIIT4Sc5VkWtuhAnul6yC+lu/39m41+Zsp6ssbgtcV1QhjARyL YmlU04tv0HZCyEUP8HT/FW6BMon8ngPkmx5uttp+0xKyL+Etojkc4EMTXi9W3sr7FJKR SqbzLkL63NjkU6GT3cFyWJe5SSsSX4lh5mBT7hz+7Myo1gdGcERqAMVOpFY8LAHd8s/l mz9XubvVvmQYEgahSRd1lmBa2+NqP6hv2jt58OVOyIsdhqtM5i5W1DzlT06yitwjw9qW i2LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MMiKK8jw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si8604851edv.450.2022.02.01.02.50.42; Tue, 01 Feb 2022 02:51:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MMiKK8jw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355124AbiA3OpM (ORCPT + 99 others); Sun, 30 Jan 2022 09:45:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355109AbiA3Ooz (ORCPT ); Sun, 30 Jan 2022 09:44:55 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD88C061714 for ; Sun, 30 Jan 2022 06:44:54 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id n32so10581866pfv.11 for ; Sun, 30 Jan 2022 06:44:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kryIRj8itYCF1TTsF9+Gx7ZLlBZd5qrSWyChaI+fLhg=; b=MMiKK8jwpOK13mc21HfEe654xK0nw4NOyaOMmklAJMgkLAR51PoZ34JqZExYOghXRF S6p926neaWY6GnSSe1PYLdRbIck7pqIO4fTDLLazAXbwm92LAs3n09TqiZXJi37bvgdk Xy0jYTN4F1qdb6Ameb+IC4l9KtAowmfc9wrsIjHGpKwS2FT3ucMJX+xDIXeTfYaDMzbo OHTbHk6pRxIQN/8JHvjiWwrACwb/jdVmjKzz/4OIhmAzSEWJn/9SU6aOq0TIAjq+OrJV bQIgwYWA4B2G4afkSqDHwFokT4XvLyXjPoZnNONHnR2wh0ZkZynCQmrMampYwPCnTh59 6JUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kryIRj8itYCF1TTsF9+Gx7ZLlBZd5qrSWyChaI+fLhg=; b=ePOGUh9QDPc0ObvkN12yygi9oCJUjlStgtl0URoL/+N2EscFW7rHu8s6r6NdwLOLWg QrsAV8tzMqRpRbSTzcnlkE7iTRzHLQsPqYWFnh5iWHZuH4Lx/+R1lEtRqP1PgYP/z/EH O97jPYe//Os/ST7PTLuqisRkLe8TWIXfdLQejjIFJlRiaKFBpSdndrWEFcIORxnP87ip FOD+fE2HrzPY6gA3WVTvLGqliJ73j/j65XCZUFDNQ2wu4leEUIiqhkZO0zZx+VeMDhDA 6Sbfl6+ioWKaSL4BPrcsC7WN+W7ZpUfEy9UU6WUbVdWlYz0396JBeTgBpVlYwh1FbMV1 9CwQ== X-Gm-Message-State: AOAM530+IBhD0p2t5eHdz8uXlmqQ6zE6EEWJretbt0T/fmZMljjBDWAQ iBDnxKXDkMquR5oMrd3WTxI= X-Received: by 2002:a63:c106:: with SMTP id w6mr13600672pgf.313.1643553894499; Sun, 30 Jan 2022 06:44:54 -0800 (PST) Received: from localhost.localdomain (li567-56.members.linode.com. [192.155.81.56]) by smtp.gmail.com with ESMTPSA id w8sm10502126pfu.128.2022.01.30.06.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 06:44:54 -0800 (PST) From: Jeff Xie To: rostedt@goodmis.org Cc: mhiramat@kernel.org, mingo@redhat.com, zanussi@kernel.org, linux-kernel@vger.kernel.org, Jeff Xie Subject: [PATCH v8 3/4] trace/objtrace: Add testcases for objtrace Date: Sun, 30 Jan 2022 22:44:29 +0800 Message-Id: <20220130144430.453221-4-xiehuan09@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220130144430.453221-1-xiehuan09@gmail.com> References: <20220130144430.453221-1-xiehuan09@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a series of testcases to illustrate correct and incorrect usage of objtrace trigger. Signed-off-by: Jeff Xie --- .../ftrace/test.d/trigger/trigger-objtrace.tc | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-objtrace.tc diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-objtrace.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-objtrace.tc new file mode 100644 index 000000000000..d71eb157c51f --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-objtrace.tc @@ -0,0 +1,39 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: event trigger - test objtrace-trigger +# requires: kprobe_events "objtrace":README + +fail() { #msg + echo $1 + exit_fail +} + +echo 'p bio_add_page arg1=$arg1' > kprobe_events + +FEATURE=`grep objtrace events/kprobes/p_bio_add_page_0/trigger` +if [ -z "$FEATURE" ]; then + echo "objtrace trigger is not supported" + exit_unsupported +fi + +echo "Test objtrace trigger" +echo 'objtrace:add:arg1,0x28:u32:1 if comm == "cat"' > \ + events/kprobes/p_bio_add_page_0/trigger +if [ -z $? ]; then + fail "objtrace trigger syntax error" +fi + +echo "Test objtrace semantic errors" + +# Being lack of objtrace command +! echo 'objtrace:arg1,0x28:u32:1' > events/kprobes/p_bio_add_page_0/trigger +# Bad parameter name +! echo 'objtrace:add:argx:u32:1' > events/kprobes/p_bio_add_page_0/trigger + +echo "reset objtrace trigger" + +echo '!objtrace:add:arg1,0x28:u32' > \ + events/kprobes/p_bio_add_page_0/trigger +echo '-:p_bio_add_page_0' >> ./kprobe_events + +exit 0 -- 2.25.1