Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4407919rwl; Tue, 28 Mar 2023 06:49:49 -0700 (PDT) X-Google-Smtp-Source: AKy350ZZg4fM3NpU+LlMqTwc1ZrBhjRadEwkWGeDA5Ker8epcC8F/e+HwqeGwC1xXbeg7Dziu950 X-Received: by 2002:a17:906:15c1:b0:931:fee9:e961 with SMTP id l1-20020a17090615c100b00931fee9e961mr16608598ejd.62.1680011388960; Tue, 28 Mar 2023 06:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680011388; cv=none; d=google.com; s=arc-20160816; b=U0b0jlH4dheAaNeP129jSu806WpEOvSicb8XL+AFoxlJ6BxjVmn5a9dd0qLftIJ0TR X3eZjATiGgbeZQW9u+CiyA23h01r5gZVhkIWFuQVV0LkMbOA+Qm2n22oV/dudKHL4v2Q o4U4F4k5D+2C7ziEg5THPjKH/sJ+Q+WujT4YKFfLtiFlEepIuzFfoFHoFQJSV/6bM1fB SdnELXM9wKiZFh2DhCDDtBVUmV0mW3DULTw6xYxeSzdTt4Ik2uaA8mv3dwP/6lgG+N3s bTMXFp6Dw5ENtx/0NZNA4HDLKFKU3O8GTzZF5Hw8dI7r3pIUY8dJkzFb/BRcTa0Fnbb5 /nYw== 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=wwa1QGu0luErvTV4CZnR61VSG3EOEP9rX8cMiEAxW/0=; b=BV8wHL0/cZM2Va26nEZhnkv2Ch88eht5Clu/dr0O1f1z86q4JfSeH1hO0gBrD3fMhC IeqFwSDjvG3tz9z5V8gVWEtTTpSWFIsRQwI1ZRwJJRyOSLG1l4HgELOhx9Jb00tbAxJV hbE7N/0sj8YfRON5UDBuouTgoTsUD2ii/r/6sIlYkTDnLT8SAwajeforUiyq/2DgLlt7 BF0wcidjG/kmTkewksP2bcDfYWBFXOqcGgWyFq9JEABSpRknWqx3RdvVh4GEVZY+WeOi bkgdjQm7R5sYClMIXLaJwZ0xeg8idfA1LmXu2u197o5O6WuXST+Hz4VXuykwxHb4jxHV O2lg== 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 mb6-20020a170906eb0600b009236817e43asi26666059ejb.380.2023.03.28.06.49.24; Tue, 28 Mar 2023 06:49:48 -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 S232838AbjC1Noj (ORCPT + 99 others); Tue, 28 Mar 2023 09:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233302AbjC1NoQ (ORCPT ); Tue, 28 Mar 2023 09:44:16 -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 BC5E1BDF5; Tue, 28 Mar 2023 06:44:01 -0700 (PDT) Received: from ubuntu.localdomain (unknown [117.133.56.22]) by mail-m118111.qiye.163.com (Hmail) with ESMTPA id BFAA9580979; Tue, 28 Mar 2023 21:43:33 +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, palmer@dabbelt.com, paul.walmsley@sifive.com, tglx@linutronix.de, dave.hansen@linux.intel.com, x86@kernel.org, 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 v8 8/8] selftests/ftrace: Add funcgraph-retval test case Date: Tue, 28 Mar 2023 06:43:19 -0700 Message-Id: <20230328134319.2185812-9-pengdonglin@sangfor.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230328134319.2185812-1-pengdonglin@sangfor.com.cn> References: <20230328134319.2185812-1-pengdonglin@sangfor.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkaSB8eVh5OSR5LQx8ZHk0ZHVUTARMWGhIXJBQOD1 lXWRgSC1lBWUpKTFVKSEhVTk1VSUlZV1kWGg8SFR0UWUFZT0tIVUpKS0hKTFVKS0tVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Mz46Aio6NT0WA1YJAQo6DzoZ Hi0wFDpVSlVKTUNLS0pKS0pOSkpCVTMWGhIXVQseFRwfFBUcFxIVOwgaFRwdFAlVGBQWVRgVRVlX WRILWUFZSkpMVUpISFVOTVVJSVlXWQgBWUFIQk9INwY+ X-HM-Tid: 0a872875b2232eb7kusnbfaa9580979 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 --- v8: - Fix issues in selftest --- .../ftrace/test.d/ftrace/fgraph-retval.tc | 39 +++++++++++++++++++ 1 file changed, 39 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..ac6d0183e4d9 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/ftrace/fgraph-retval.tc @@ -0,0 +1,39 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: ftrace - function graph print function return value +# requires: set_graph_function options/funcgraph-retval options/funcgraph-retval-hex function_graph:tracer + +# Make sure that funcgraph-retval works + +fail() { # msg + echo $1 + exit_fail +} + +echo proc_reg_write > set_graph_function +echo function_graph > current_tracer +echo funcgraph-retval > trace_options + +enable_tracing + +set +e +echo > /proc/interrupts +set -e + +disable_tracing + +: "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