From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBD17C433DF for ; Thu, 15 Oct 2020 13:59:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D26422248 for ; Thu, 15 Oct 2020 13:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602770387; bh=8haq88aRZfHa91NkLFfD9u6mDM75ZHqJEOPYsntrSQY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:List-ID:From; b=bHHP69/s8WBhYIb1Axq0bMBrnxYeD7qSbmNhvDoVpx2D49k2/NiZG9+/Q9a4WCvbp K86Y9bVDWQr2CC2UwQkRoYWuv2dxWx3NLsaIW2B2AY/l3jmdbsYIaaRsoDN36Iqb5D zqvrSbbdlamt+mmIN1qc8Ohpc53/e2znJYNIOZu8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388173AbgJON7q (ORCPT ); Thu, 15 Oct 2020 09:59:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:53328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387904AbgJON7n (ORCPT ); Thu, 15 Oct 2020 09:59:43 -0400 Received: from tzanussi-mobl (c-73-209-127-30.hsd1.il.comcast.net [73.209.127.30]) (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 235972222B; Thu, 15 Oct 2020 13:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602770382; bh=8haq88aRZfHa91NkLFfD9u6mDM75ZHqJEOPYsntrSQY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=2iq9s9GTaPhzIudb9GcF5p3xmUcmVbSjUGU2xk67+oQhOpriRYSmFg15PlnrUQWLu v4/AdBckpjsdnVdBjNpQ7fFy036C+0jy4Koc6dduIrxbZTHd6NVlkypXBRy4cdAkHB KxZojKlNi94M3QLikxj6Hvbf5gV8J08tZIcxWe68= Message-ID: <6cfecc21b67c5aa7e91dfa58b5e59f8545e6524f.camel@kernel.org> Subject: Re: [PATCH v3 7/7] selftests/ftrace: Add test case for synthetic event syntax errors From: Tom Zanussi To: Masami Hiramatsu Cc: rostedt@goodmis.org, axelrasmussen@google.com, linux-kernel@vger.kernel.org Date: Thu, 15 Oct 2020 08:59:40 -0500 In-Reply-To: <20201014110636.139df7be275d40a23b523b84@kernel.org> References: <20201014110636.139df7be275d40a23b523b84@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masami, On Wed, 2020-10-14 at 11:06 +0900, Masami Hiramatsu wrote: > Hi Tom, > > On Tue, 13 Oct 2020 09:17:58 -0500 > Tom Zanussi wrote: > > > Add a selftest that verifies that the syntax error messages and > > caret > > positions are correct for most of the possible synthetic event > > syntax > > error cases. > > > > Signed-off-by: Tom Zanussi > > --- > > .../trigger-synthetic_event_syntax_errors.tc | 19 > > +++++++++++++++++++ > > 1 file changed, 19 insertions(+) > > create mode 100644 > > tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger- > > synthetic_event_syntax_errors.tc > > > > diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter- > > event/trigger-synthetic_event_syntax_errors.tc > > b/tools/testing/selftests/ftrace/test.d/trigger/inter- > > event/trigger-synthetic_event_syntax_errors.tc > > new file mode 100644 > > index 000000000000..ada594fe16cb > > --- /dev/null > > +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter- > > event/trigger-synthetic_event_syntax_errors.tc > > @@ -0,0 +1,19 @@ > > +#!/bin/sh > > +# SPDX-License-Identifier: GPL-2.0 > > +# description: event trigger - test synthetic_events syntax parser > > errors > > +# requires: synthetic_events error_log > > This also requires dynamic strings support. So, its "requires" line > should be > > # requires: synthetic_events error_log "char name[]' >> > synthetic_events":README > Yes, thanks for reminding me. ;-) > > + > > +check_error() { # command-with-error-pos-by-^ > > + ftrace_errlog_check 'synthetic_events' "$1" 'synthetic_events' > > +} > > + > > BTW, some errors looks a bit odd. > > > +check_error 'myevent ^chr arg' # INVALID_TYPE > > +check_error 'myevent ^char str[];; int v' # INVALID_TYPE > > I think there is a wrong "void" argument between ";", instead of > invalid type. Yes, you're right. I think the solution overall is to just treat semicolons as whitespace. > > > +check_error 'myevent char ^str]; int v' # INVALID_NAME > > +check_error 'myevent char ^str;[]' # INVALID_NAME > > This is also not an invalid name but '[]' is an invalid type. > > > +check_error 'myevent ^char str[; int v' # INVALID_TYPE > > +check_error '^mye;vent char str[]' # BAD_NAME > > +check_error 'myevent char str[]; ^int' # INVALID_FIELD > > Isn't it an incomplete command? Yes, but also an invalid field. I'll try to refine these errors a bit and make these more consistent. Tom > > > +check_error '^myevent' # > > INCOMPLETE_CMD > > + > > +exit 0 > > Thank you, > > > -- > > 2.17.1 > > > >