Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1023802rwl; Fri, 31 Mar 2023 05:54:01 -0700 (PDT) X-Google-Smtp-Source: AKy350aBHQVixL4kSNW3MjCPeiDXB9wZH5ta6E53SnaltILWIkHvocRfJjuiODOPGZj02MsuzQyA X-Received: by 2002:a17:906:1c4:b0:931:5145:c51f with SMTP id 4-20020a17090601c400b009315145c51fmr929149ejj.4.1680267241393; Fri, 31 Mar 2023 05:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680267241; cv=none; d=google.com; s=arc-20160816; b=BrpaZDbhSsggGNOY+dFOYOPwXBCRo1S9lW+3KP72P/hMJ3i/WwT3Cr62bhZz0sgVNn qTzLLyqBKjWFoo8k3HahPHpbcl8Gkn169Sr2YfSgoAHzLTdO5R0HnFA6IVFcweQZVdTF gBC9i1ZwHH9KU8DZG6zxAU8tLYnQBLsMQeSgdtqfpaUzkJpcyVXK+yKYGtWxqaw2Q5QO OqteO/j7p0VkZRDGvU3usSi/hLL04HeOe2Oa9u8B+6TtR1RJS3PPL4P+kvAGHfgsoEA+ RaLiG8awXR2VZiUDUXneX/g43deJHXMnZ75Jp7H0zQrY1ZuStONk1nU0SGno6W9gGps3 MZWA== 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; bh=zrvi+dEdRBnxpXXGywfcprTgG5DE87uciZ1DYc3PoIo=; b=S2dmfBoX52uuTL9jamcqdot8Dm2TY2BD7K9Ssg1ezez5Ik8hatFc7k03Wg8cGb3ACE nbucGsJ9tAYhG+NtcXXcWPRqhddcqAFq5UVOfsuI7GJGzvXKCFixK5JKp96OAQCQZNWt soDBW7IZC6q2+V/Ag2vXl7fooJSTUEuj50Cxci1kSlqX9tWrOs05dtWAV3QlD0Mt/+An Pw+V+tbWbs202+KGwnrZ3evZzCrZfed6NyAs4L8ptysrXc4xIA2FXDXmJMeoP3FZpgDE BNy/X7wu1PI2+E70VONPXDiSH3M6FYkLyjpyhmNcMWSxiY2+0ISxB7U+RLIrE8DP8L9R 7U+A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oq11-20020a170906cc8b00b0092604f32e91si1761650ejb.730.2023.03.31.05.53.36; Fri, 31 Mar 2023 05:54:01 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sangfor.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232429AbjCaMuF (ORCPT + 99 others); Fri, 31 Mar 2023 08:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232628AbjCaMt1 (ORCPT ); Fri, 31 Mar 2023 08:49:27 -0400 Received: from mail-m118111.qiye.163.com (mail-m118111.qiye.163.com [115.236.118.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D08291FD0A; Fri, 31 Mar 2023 05:49:07 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlCQ0NOVh5DS0gfQxodQh9KTlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpKTFVKSEhVTk1VSUlZV1kWGg8SFR0UWUFZT0tIVUpKS0hKTFVKS0tVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NxQ6MDo6MT0WIU0SHTo6IT0N IilPClZVSlVKTUNLSU1NQ0JNQkhNVTMWGhIXVQseFRwfFBUcFxIVOwgaFRwdFAlVGBQWVRgVRVlX WRILWUFZSkpMVUpISFVOTVVJSVlXWQgBWUFPSE5DNwY+ X-HM-Tid: 0a8737b624292eb7kusn4bb2a580485 X-HM-MType: 1 X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.25.1