From patchwork Fri Mar 31 12:47:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pengdonglin X-Patchwork-Id: 13195979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BBB8C77B6E for ; Fri, 31 Mar 2023 12:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rj+4eWVTgBjtadbMpqm4+yP/iSTkmFTyPh0UY6rz1qU=; b=ShtjDLyoTo38Hg /tk7puP6MnhOrMVhsO3hDn+Lv/4ZVx2nv6pBUzcVS/JES436wnpmjZuih+JC+6fzXTkxJ7AoEFhcC NNwywKjFFEnllMwbO9NwB9ZkefuW9biltA1+Pktp6ZI/Dj2SyoQbvK6k1/jOZ/78kmC+lbT//k2Fm /GAx7lDSx9VSEhU6eRzcloUzo1dTyfanErDnZEvSx9/c+v6FZY6vZLAYj0X1J54lgbohjDkxoJZkK 6ADVeLJvoKDk3ZXgHRHb3IqkzSVc17hPFQw4MVmKSIii1qsdc67t/Hc4uDByxB3fioRdYzAVA5NWf neplWN9Z1KP//RK7UgAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1piECS-007PgQ-3A; Fri, 31 Mar 2023 12:49:49 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1piEBO-007OvY-3C; Fri, 31 Mar 2023 12:48:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=zrvi+dEdRBnxpXXGywfcprTgG5DE87uciZ1DYc3PoIo=; b=lQuwLRb29ESg/bHxo8LjuttaiH ytrCKLYrVVB6yAUOuSkQor/kn+R/aExulwxQN1qnvpiGNfl12hqtcf/XOPbmhVpQz+9GwGhIwWmKn bRYVGttwPrQFuSopVH0uTYSrSaN6F8B3bu5Cvy19M/V2IpHRmmNUX2ZrdcxQNXgJi2pRUZGKyQlG8 3EoY8SMpkPICv89RN6mO9z0scL6AVX6nvf3scPBwIqb2ww05SMnHHRs6jGOb10L4VfN5uK4lrE1ZR UGUNfu1BuZMGkkAzBEzyy/uZZ/qQ7CeZLShQdnXOcbq81r7Zj1p+M+/FyoGB+6NF0s6WgZ9084S2I cgkrnvYw==; Received: from mail-m118111.qiye.163.com ([115.236.118.111]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1piEBK-007fJ4-2k; Fri, 31 Mar 2023 12:48:41 +0000 Received: from ubuntu.localdomain (unknown [117.133.56.22]) by mail-m118111.qiye.163.com (Hmail) with ESMTPA id 4BB2A580485; Fri, 31 Mar 2023 20:48:15 +0800 (CST) From: Donglin Peng To: mhiramat@kernel.org, rostedt@goodmis.org, linux@armlinux.org.uk, mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com, rmk+kernel@armlinux.org.uk, palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, tglx@linutronix.de, dave.hansen@linux.intel.com, x86@kernel.org, bp@alien8.de, hpa@zytor.com, chenhuacai@kernel.org, zhangqing@loongson.cn, kernel@xen0n.name, mingo@redhat.com, peterz@infradead.org, xiehuan09@gmail.com, dinghui@sangfor.com.cn, huangcun@sangfor.com.cn, dolinux.peng@gmail.com Cc: linux-trace-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Donglin Peng Subject: [PATCH v10 8/8] selftests/ftrace: Add funcgraph-retval test case Date: Fri, 31 Mar 2023 05:47:44 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlCQ0NOVh5DS0gfQxodQh9KTlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpKTFVKSEhVTk1VSUlZV1kWGg8SFR0UWUFZT0tIVUpKS0hKTFVKS0tVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NxQ6MDo6MT0WIU0SHTo6IT0N IilPClZVSlVKTUNLSU1NQ0JNQkhNVTMWGhIXVQseFRwfFBUcFxIVOwgaFRwdFAlVGBQWVRgVRVlX WRILWUFZSkpMVUpISFVOTVVJSVlXWQgBWUFPSE5DNwY+ X-HM-Tid: 0a8737b624292eb7kusn4bb2a580485 X-HM-MType: 1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230331_134839_344127_4E9E2512 X-CRM114-Status: GOOD ( 10.30 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add a test case for the funcgraph-retval and funcgraph-retval-hex trace options. Signed-off-by: Donglin Peng --- v10: - Fix issues in selftest v8: - Fix issues in selftest --- .../ftrace/test.d/ftrace/fgraph-retval.tc | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc new file mode 100644 index 000000000000..5819aa2dd6ad --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc @@ -0,0 +1,43 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: ftrace - function graph print function return value +# requires: options/funcgraph-retval options/funcgraph-retval-hex function_graph:tracer + +# Make sure that funcgraph-retval works + +fail() { # msg + echo $1 + exit_fail +} + +disable_tracing +clear_trace + +read PID _ < /proc/self/stat +[ -f set_ftrace_pid ] && echo ${PID} > set_ftrace_pid +[ -f set_ftrace_filter ] && echo proc_reg_write > set_ftrace_filter +[ -f set_graph_function ] && echo proc_reg_write > set_graph_function +echo function_graph > current_tracer +echo funcgraph-retval > trace_options + +set +e +enable_tracing +echo > /proc/interrupts +disable_tracing +set -e + +: "Test printing the error code in signed decimal format" +echo nofuncgraph-retval-hex > trace_options +count=`cat trace | grep 'proc_reg_write' | grep '= -5' | wc -l` +if [ $count -eq 0 ]; then + fail "Return value can not be printed in signed decimal format" +fi + +: "Test printing the error code in hexadecimal format" +echo funcgraph-retval-hex > trace_options +count=`cat trace | grep 'proc_reg_write' | grep 'fffffffb' | wc -l` +if [ $count -eq 0 ]; then + fail "Return value can not be printed in hexadecimal format" +fi + +exit 0