Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1040427rwl; Fri, 24 Mar 2023 05:38:40 -0700 (PDT) X-Google-Smtp-Source: AKy350YraiL4s0p+nniLpDP9jTVXxdYSvDn+u956+smI3lvx9iwwtwiykST9KnZK3HTkJoeji7nv X-Received: by 2002:a17:903:7cc:b0:1a1:97b5:c63e with SMTP id ko12-20020a17090307cc00b001a197b5c63emr2343349plb.38.1679661520310; Fri, 24 Mar 2023 05:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679661520; cv=none; d=google.com; s=arc-20160816; b=yuRXlIDD+jBl0QnEcheNq2qkyTX/Y0D/gb3q6S1jhqve3UFbnQ+By3W9hMzUexGT45 z2eUcfslk0hj4B/sSnXJV8UagneC5EYx47/KPYHwJqyQUENVE1CBcFM+VkQ7+/Pv7Wc6 Mcov5Ax377BCBJh63iz7FQTCZP2ENfJGUiYTzrg0jnN9GsUUsudjDyZlPWtsEXNaL7Gu dC7uzfoSF+ovX4BcDo8MmYSHwjuhpYm1FKmXTLc7UlJX+5cz8RKcmMlbhyw2gHeVx8Ld 6KGzYPv5/nFdY0JcrL2CguNOipNmMy5gvSCgG6IBeHGYGT5jxBaJLcT5wo7vzhgZhxCo y1hw== 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=SE8WnWIRzPj23pCTArRlk2WAsqixmJbxsKzz2juhgh0=; b=n5Bu4XSNbCyAGbzYUTEBufQ5O0fjA1diVgftPmv2HCtzLmi4gRMVQQXM3BMIe6if4e OUcmTbJyY57KMp88OUGsWy3daK9AVq3VzPxkj3iKsG6UzErbluyLSB6e1SJhg1Z6t61z E+wmdxgY+9KxFfTc9ulH9eTlbG8pGpWY3Ufx2a9RsHb3iTMnFJQRcP7rTR1saN+kXbTR 3KgbS6r3Q/Fm9X9wzr8xepqgHSYDJ7utqThiV8SMa83w6kdl8SdpE5THDKgRuFEBNdxO P4UPcRVbFNecmeo5DjZm7iAmF/WCmEaP19H0aAlkCc6sIu3LxFrpNSRmD3B8oQR5jQGQ x1gA== 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 h9-20020a170902f54900b0017a0e7aaf6bsi22173053plf.128.2023.03.24.05.38.21; Fri, 24 Mar 2023 05:38:40 -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 S231777AbjCXMiD (ORCPT + 99 others); Fri, 24 Mar 2023 08:38:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231501AbjCXMiA (ORCPT ); Fri, 24 Mar 2023 08:38:00 -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 D60843C2F; Fri, 24 Mar 2023 05:37:57 -0700 (PDT) Received: from ubuntu.localdomain (unknown [117.133.56.22]) by mail-m118111.qiye.163.com (Hmail) with ESMTPA id 650CD580A4D; Fri, 24 Mar 2023 20:37:48 +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 v7 8/8] selftests/ftrace: Add funcgraph-retval test case Date: Fri, 24 Mar 2023 05:37:31 -0700 Message-Id: <20230324123731.3801920-9-pengdonglin@sangfor.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230324123731.3801920-1-pengdonglin@sangfor.com.cn> References: <20230324123731.3801920-1-pengdonglin@sangfor.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlCSUIdVk5NGEhPSkxIGEpDTVUTARMWGhIXJBQOD1 lXWRgSC1lBWUpKTFVKSEhVTk1VSUlZV1kWGg8SFR0UWUFZT0tIVUpKS09ISFVKS0tVS1kG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OAg6Sio4Lj0cHw8LT0gXEQ0t HDwwChlVSlVKTUxCTU1KT01CQ0NLVTMWGhIXVQseFRwfFBUcFxIVOwgaFRwdFAlVGBQWVRgVRVlX WRILWUFZSkpMVUpISFVOTVVJSVlXWQgBWUFIQk9MNwY+ X-HM-Tid: 0a8713a00efc2eb7kusn650cd580a4d 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 --- .../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..bee466bef8b2 --- /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: 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 +} + +disable_tracing +clear_trace + +echo proc_reg_write > set_graph_function +echo function_graph > current_tracer +echo funcgraph-retval > trace_options + +enable_tracing + +set +e +echo > /proc/interrupts 2>/dev/null +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 = -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