Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3440192imu; Sun, 11 Nov 2018 15:08:43 -0800 (PST) X-Google-Smtp-Source: AJdET5eFHaDn0cegDkigbBMgmvdVmecze5qcloXBPIWjcEm3WAKrfX2RzPJkL0iELkGauYooisNy X-Received: by 2002:a17:902:bd96:: with SMTP id q22-v6mr5482896pls.167.1541977723730; Sun, 11 Nov 2018 15:08:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977723; cv=none; d=google.com; s=arc-20160816; b=luLwNkZyJMggWllAxHEF0NzlWIzCYKeHkG2kQ1UprIeMecaEJHtG1Wu0sYf8hlTpXW afRzL38B1EWolbz7QNPDwrwBwHgqXQ/ZY9znRePhXjaVKn+PEnht/zSZjD9tqgV1V0d2 yCOejIIqoew2n45MaOtUXvP4evsfDKIR8ke6CNSqpxx51NRmYXwp60gcsB7g8Q0XbHel AEOoelQAIcODDExvLT+dVuX9wiTqQOkqrdHlnL0aL0IIYHju0oRtHZ3dfoJdE395G/J0 u06F92RZ9YwvO0qpNmQ0aHpSRInQLXmZGwzaAfKY5O/P78lWYQHHnshu+0CZ6lF328G5 e+QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6mPnmo2haTmxSmkPtdkS/8nTRgo8WRy3A9qkAVvejpE=; b=oI6FWCRPkfrlS/jpE4X3Ih6ymBwfzDyl7sx0bI8HYwkb4DT6GiA8HQ2cZQNvzMs7Zr x7BTLebLvMHj1cpmtszj4+F9zlLTw324gDQjsFAY+EOocUr7xAgKUWT9gNzwVjsz38AO Hi46lujIwLYsoAXDTtfcdh8WJXDgDfOw0uXglPBeQkDTlEIzkAhgUncco9tGXTJ5ko1p 5pP8FMjc7wfbOhu5+jDoa1X8PNlXV8npuIwaDppbr9sBxduR1fS/BT73N8W8qJpQMcff X8+K4oNdjzzG7BWlt1vDygg9xZPRXVwToCK7v2myp+1yEn73ZpOVeR1EuFpm1yYv4Tlv iHow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wspWOFfp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si13830209pga.440.2018.11.11.15.08.28; Sun, 11 Nov 2018 15:08:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wspWOFfp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390289AbeKLIWI (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:51200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389119AbeKLIWH (ORCPT ); Mon, 12 Nov 2018 03:22:07 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DBE5223CB; Sun, 11 Nov 2018 22:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975530; bh=RdH1+MhMH/9atVZN0DncY/nv8o+luAF4J50/tmLHMco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wspWOFfpkjLWyoJF1RG0VKe4J17kQ4zeek8CMUlq2WmpEnOjR+esOlCRMMwJmUdZL epThSJ/o8Wh5vjIsSBv9m9VGLg7QSnBqG2E6ZJho2uRVpyzKeBookQI07Rt3Ib7SSL 3dcTybBouIKu/mKI2YdLoM641V0aoRWugyn9XdZc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , Masami Hiramatsu , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 4.14 037/222] selftests: ftrace: Add synthetic event syntax testcase Date: Sun, 11 Nov 2018 14:22:14 -0800 Message-Id: <20181111221651.506444646@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masami Hiramatsu [ Upstream commit ba0e41ca81b935b958006c7120466e2217357827 ] Add a testcase to check the syntax and field types for synthetic_events interface. Link: http://lkml.kernel.org/r/153986838264.18251.16627517536956299922.stgit@devbox Acked-by: Shuah Khan Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-syntax.tc | 80 ++++++++++ 1 file changed, 80 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-syntax.tc --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-syntax.tc @@ -0,0 +1,80 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: event trigger - test synthetic_events syntax parser + +do_reset() { + reset_trigger + echo > set_event + clear_trace +} + +fail() { #msg + do_reset + echo $1 + exit_fail +} + +if [ ! -f set_event ]; then + echo "event tracing is not supported" + exit_unsupported +fi + +if [ ! -f synthetic_events ]; then + echo "synthetic event is not supported" + exit_unsupported +fi + +reset_tracer +do_reset + +echo "Test synthetic_events syntax parser" + +echo > synthetic_events + +# synthetic event must have a field +! echo "myevent" >> synthetic_events +echo "myevent u64 var1" >> synthetic_events + +# synthetic event must be found in synthetic_events +grep "myevent[[:space:]]u64 var1" synthetic_events + +# it is not possible to add same name event +! echo "myevent u64 var2" >> synthetic_events + +# Non-append open will cleanup all events and add new one +echo "myevent u64 var2" > synthetic_events + +# multiple fields with different spaces +echo "myevent u64 var1; u64 var2;" > synthetic_events +grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events +echo "myevent u64 var1 ; u64 var2 ;" > synthetic_events +grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events +echo "myevent u64 var1 ;u64 var2" > synthetic_events +grep "myevent[[:space:]]u64 var1; u64 var2" synthetic_events + +# test field types +echo "myevent u32 var" > synthetic_events +echo "myevent u16 var" > synthetic_events +echo "myevent u8 var" > synthetic_events +echo "myevent s64 var" > synthetic_events +echo "myevent s32 var" > synthetic_events +echo "myevent s16 var" > synthetic_events +echo "myevent s8 var" > synthetic_events + +echo "myevent char var" > synthetic_events +echo "myevent int var" > synthetic_events +echo "myevent long var" > synthetic_events +echo "myevent pid_t var" > synthetic_events + +echo "myevent unsigned char var" > synthetic_events +echo "myevent unsigned int var" > synthetic_events +echo "myevent unsigned long var" > synthetic_events +grep "myevent[[:space:]]unsigned long var" synthetic_events + +# test string type +echo "myevent char var[10]" > synthetic_events +grep "myevent[[:space:]]char\[10\] var" synthetic_events + +do_reset + +exit 0