Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1995860rwl; Thu, 30 Mar 2023 04:42:55 -0700 (PDT) X-Google-Smtp-Source: AKy350YTTLN9uZud1NF9VqPG+lxTamRuqoQgxVopkxAbH2W/iaLXLPwXt/4eDLKDoW1MlKqNBcjv X-Received: by 2002:a17:903:647:b0:19a:7217:32af with SMTP id kh7-20020a170903064700b0019a721732afmr1919952plb.5.1680176574814; Thu, 30 Mar 2023 04:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680176574; cv=none; d=google.com; s=arc-20160816; b=OpR+1ofTwGT72VfJRxg9DMdfHKdj2I1s6eXlRUkVoDJC253ad6vZW0wKm8DSR2GgI8 cK0XqNB/c93yOHBsMuZ5HEQQnZfr7hzYuFEk/6Zt2Jvg6fn4Urj6/E/IMgghv5bJ8q/1 RWP5W9MTpbvfLz8v+iarfQDxQeyuGvSAX5VCJI2p2uDaG1pnhH+c/jl6X3J9ykZrdSIN 6FO5Duplh22yegigcfzsshahHP2VHT2MnrWdlB6cee5H88TkwzVUP0xRGsS0SHEfkeOx /pTSNY1GAl1lVYe7bvab2aqigtmGO+UNEBFFVs1WF27FxWyEuy70GWwFTKCnP8ffwuVd 1zMQ== 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=MdX3A4tqmweHqP4+r0jwhqI52Q2faD2IXjq5/j2tK2zALa9GkSUAtxnts8TxPj3R0O KwULev9gJn/l2Lr4uIXf+Hyjbco2E6koVqegkOwp395ayW4NLwcFeOtFzwWkcDfmNB/g rfGpdhIRO/NFvcQ7ryR2518GIG2UUZnb08QVtjaKxPQ+jiBzquFsFqkpDZ2Ghj5dkBUg i+y7Ej6Nd0UCR3Tcb+M+IgyXExjT38TlzUq0AljMohSliPHtVTj1o1sgq5wcPh1aiCPT gjq+7swPx+GhlRnOVbTQ93OWDLeQfzsMt4jugT5jTEEbueSGvxJzQd3J1TVLmYwTX6t9 WDmw== 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 ob13-20020a17090b390d00b0023d3f169c1csi4198253pjb.2.2023.03.30.04.42.42; Thu, 30 Mar 2023 04:42:54 -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 S231821AbjC3LmG (ORCPT + 99 others); Thu, 30 Mar 2023 07:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231819AbjC3Lll (ORCPT ); Thu, 30 Mar 2023 07:41:41 -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 A64C8A24B; Thu, 30 Mar 2023 04:40:33 -0700 (PDT) Received: from ubuntu.localdomain (unknown [117.133.56.22]) by mail-m118111.qiye.163.com (Hmail) with ESMTPA id 7701D580844; Thu, 30 Mar 2023 19:39: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, 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 v9 8/8] selftests/ftrace: Add funcgraph-retval test case Date: Thu, 30 Mar 2023 04:39:15 -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 tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlDS0tOVklJQh4fHh0dGkIfGlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpKTFVKSEhVTk1VSUlZV1kWGg8SFR0UWUFZT0tIVUpKS09LQ1VKS0tVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MTY6Hio6DT0WSE8*AiwdSTkv PxwwCRBVSlVKTUNLSkxNSExOS0lLVTMWGhIXVQseFRwfFBUcFxIVOwgaFRwdFAlVGBQWVRgVRVlX WRILWUFZSkpMVUpISFVOTVVJSVlXWQgBWUFPSklONwY+ X-HM-Tid: 0a873250e31c2eb7kusn7701d580844 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