Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5355150pxb; Sun, 6 Feb 2022 23:20:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzc9mF02DpKG5QUn7M7qwD/DU424ErtiidFQFkkisMEKIL/DZkCscX3dr4iOBtJEpUWvtIz X-Received: by 2002:a17:906:1d14:: with SMTP id n20mr8901877ejh.714.1644218416960; Sun, 06 Feb 2022 23:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644218416; cv=none; d=google.com; s=arc-20160816; b=GJRSUgKloSXqzSBmPIe1RgNf0xHAYNwakmzb30/MvT5jBetHDXqeBsO/4k+KHIGG73 nGWn7adMWuRyJLf0guPNkpiC+NkbHhwGO8PGSJx+gm4cZhAmPXfYEQaN4sq8YsFsJ5QO XZTo8fnVT8VujT2/k6gPD4gZmHoBbmhvKNyciSlWbdJmXA/hgaolOBVbsP6OyCInN9ov 3vvoRyC2kXfEqiZePbE+98uVxShC83FvBIbhrPzOYJZVEhIsWnRVVjezFrglMAG/Ur4d hPr5WiQwbJgOOW5X/sH9SuGBvCesxjRJpnJOhbuA0GkhWMBR3TY7dZ14ROl7RqtplRpo sGwQ== 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=3RAHC5JpxAqYMofiRYRDeUYE27k98N5i2YcPubXjat4=; b=FghnuRbPTH86tSdbxEwl50hFB7awur7B0YMbsajFDfByLQf3V6p0lM0ApjexAHWEvP EOPDXiUns2lqXqZjc790jQwPmokef9Sdf71u2/2MBEtwqhGfipNwwbFyLLaNAZP6W9Rc I3GfudHV1aaUznu7AZVEp1DOaV64+anx7HQIK/kZLjRexnU+tQ8uQsmOU4T3ZzMtRBel shOeRVzLXVNPEH4K4urCCdibaH1F3aWSHL/WtwbIr8z/jXgIAIluGKlm6hJWAgX531CA kgsygoTCu54EzkI5EGWEoqBXK9nYetclDmmCUsU7PEMiEDNF47MWZIKFR2HtgQ/Yv/An C0vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SJyXuCfQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd36si6747536ejc.457.2022.02.06.23.19.52; Sun, 06 Feb 2022 23:20:16 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=SJyXuCfQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356879AbiBDD5T (ORCPT + 99 others); Thu, 3 Feb 2022 22:57:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356873AbiBDD5N (ORCPT ); Thu, 3 Feb 2022 22:57:13 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ACC8C061714 for ; Thu, 3 Feb 2022 19:57:13 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id o16-20020a17090aac1000b001b62f629953so11905382pjq.3 for ; Thu, 03 Feb 2022 19:57:13 -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=3RAHC5JpxAqYMofiRYRDeUYE27k98N5i2YcPubXjat4=; b=SJyXuCfQLgYHmeTZ7aZCE98hIP2BB4/vL0Duh8M6pd27jCJyirDKscDdTAp7zstDb6 SXnRBLJ58sk8+GfxsLGYzd20RSvcC6bwMdNY67BHXO0ZyfC2Hsk9m1em0YABkNWpC0r5 hnmFLqBqbdw3X9ahgizBIXf85JIxMwv/dTW4d1ZkeNmYyBR4Tbk9hWv7Z7fVAST0dmxg qQbBUYEwXjGJ0cc7k49Na0+LRgRrDO+ilL4xyLqDsllXcPa8bsP8tlaCarHcRcfqlQnG OywyZx7eury2E7Ed8tOOzmx1a8RGi3jKUe5gUu9OdyPdkIkAzjd4ucvhVistRYz2SYKW Iomw== 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=3RAHC5JpxAqYMofiRYRDeUYE27k98N5i2YcPubXjat4=; b=4TSacPkWZrM/Y13Iv8jzqzZcCVoVlxlt0ylO+fGqSOpg8bofhE45jlrilixj00upNj UZ+wnmJn0Rlzg3t7w1GujVzSgGIYpqWJAS1Azppl/WuhusIbM1LxJllBvokGQTC2z1g0 Ol7GFXWAJkjHnRLJR4x0GUZV7FXcnF9nvcTyuAK+MUg9i8pfwmd+S3xm0+Fxety7iEjK 2gTxHEldYZECeHyTYKsoFyIHpNmt+uZtTfPObHnjAEHcmk/qtYuv8XlJOZHjTb+9YjNS W84r3ngNVX0Shz5+T9rWz+FSf/qI+oCAdOTYZlFfk63zMN+T3MoY2Dwt5/0HxGxRjcXj JwFw== X-Gm-Message-State: AOAM533cUpukX+gh/jTV9wlCvbmMg4Nq9g7u8ZmFP3xWjQmB9Ra5n8Ko ZcLasP32M3p9sLIaWEEDaKTIFZVX2NU= X-Received: by 2002:a17:90b:1012:: with SMTP id gm18mr1065375pjb.84.1643947032421; Thu, 03 Feb 2022 19:57:12 -0800 (PST) Received: from localhost.localdomain (li567-56.members.linode.com. [192.155.81.56]) by smtp.gmail.com with ESMTPSA id 204sm506229pfu.91.2022.02.03.19.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 19:57:11 -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 v9 3/4] trace/objtrace: Add testcases for objtrace Date: Fri, 4 Feb 2022 11:56:43 +0800 Message-Id: <20220204035644.734878-4-xiehuan09@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204035644.734878-1-xiehuan09@gmail.com> References: <20220204035644.734878-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 | 41 +++++++++++++++++++ 1 file changed, 41 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..d894442b6a30 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-objtrace.tc @@ -0,0 +1,41 @@ +#!/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 arg2=$arg2' > 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 +# The parameter existed on event +! echo 'objtrace:add:arg2: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