From patchwork Thu Aug 30 14:23:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 10581799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B16E517DB for ; Thu, 30 Aug 2018 14:23:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A06582BF6D for ; Thu, 30 Aug 2018 14:23:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 949212BFAD; Thu, 30 Aug 2018 14:23:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 307102BF82 for ; Thu, 30 Aug 2018 14:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729037AbeH3S0E (ORCPT ); Thu, 30 Aug 2018 14:26:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:44442 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728990AbeH3S0E (ORCPT ); Thu, 30 Aug 2018 14:26:04 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CDE2B205C9; Thu, 30 Aug 2018 14:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1535639020; bh=YBrPQjnU3hWQm/lfo1b1xl+xXSLq0gj4JYjuNYpSHvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3LxhL3/G3C0BDTIt4v6kFYg15X5PBV5tQsVRro7nL1A3djVfV3laKStBmnKJ0bEB 3ebxW4JF1jkrvKNQD54QMM6j6k7tQy7it+FNSgyi7HoQiYmChVqUi8WB9AI8vjsuhY RUniBbJ363/k+zr2o3CthVwAuXmOpH7JI37iIyjs= From: Masami Hiramatsu To: Shuah Khan , Steven Rostedt Cc: Ingo Molnar , Masami Hiramatsu , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 23/28] selftests/ftrace: Add function filter on module testcase Date: Thu, 30 Aug 2018 23:23:18 +0900 Message-Id: <153563899783.29700.7635341988251188583.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <153563834333.29700.11242968505215651399.stgit@devbox> References: <153563834333.29700.11242968505215651399.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a testcase for function filter on module. Signed-off-by: Masami Hiramatsu --- Changes in v3: - Remove ".ko" extension from modprobe argument. --- .../ftrace/test.d/ftrace/func_mod_trace.tc | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc new file mode 100644 index 000000000000..9330c873f9fe --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc @@ -0,0 +1,24 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: ftrace - function trace on module + +[ ! -f set_ftrace_filter ] && exit_unsupported + +: "mod: allows to filter a non exist function" +echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter +grep -q "non_exist_func" set_ftrace_filter + +: "mod: on exist module" +echo '*:mod:trace_printk' > set_ftrace_filter +if ! modprobe trace-printk ; then + echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK= +m" + exit_unresolved; +fi + +: "Wildcard should be resolved after loading module" +grep -q "trace_printk_irq_work" set_ftrace_filter + +: "After removing the filter becomes empty" +rmmod trace_printk +test `cat set_ftrace_filter | wc -l` -eq 0