Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1575523pxu; Thu, 17 Dec 2020 13:18:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzslwwEffud+cWGr/2P85mzLDVbLls20LQinHnq3jMdTsvTFW1fQIFlhSqq6klM1hd+XKEx X-Received: by 2002:a17:906:402:: with SMTP id d2mr942978eja.35.1608239927388; Thu, 17 Dec 2020 13:18:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608239927; cv=none; d=google.com; s=arc-20160816; b=ze95tMOVV5/c/vCeTqjwS7LnRl9nObEvVSy/QJxnf5UZ7VcSf30D/1Z2z7KTpLGPkH e9hkiXZ9n2CurEbI77GIYAm9fcjHyiwRx3aif0Svqb9OZMzji8L2Tqx5CN1ExHbYaG32 O9Lnq1SjP34GtoPTkUphcq0V8/nvtcSTo1wgqyo0hB3DBaai3TG18ZEkTsaAtiCASjnR gluAllT4DS3tNU+WYdmLnUutGBjYTxI6J9JS+S7Qa7wFD0HzIkeNTiTp1/7FNsVaCy5/ DeELQRA1FCKWtDMQ80x1tTDfFMNPMfFjVpPr2g092cXKihcVLqFR3tcAKo7/Nm+hmajk iccg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=oRgnTckepzs+mZXYgyaFQASITdcY8dZWbdJJFGDImcc=; b=tzNWQ58OerVFuTw6oEDRbi46R6SWE05F8Pn8fH/qmZ8ztn8fm7EawNendtbNJCSXPg kqh2i0QEVuDpPExXLGUMKjrKubSvMW04DhlUSgNKqtpfIfHteLU71JgrsGrBtuElfzTF +/+OXXaGvcU/ihbY6YFtGRF/UcE/NHlMZ29DmsMUesY1ufAQiE3W2u1/NA++eCtct/CB Fe1DZKydk6Ty2Gte2+yhDHTENuEKK0VdvsmTfBBo8eCj5A7KU3AJgjtnux7+dJlKTRHw AOK2OVQDf9OXJdDABi22k81FVdyqC96wvPtDiLtLAMvxR+9EmQOr6QNHMnyOL+c7RbYG pcpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k8si3346635ejg.191.2020.12.17.13.18.24; Thu, 17 Dec 2020 13:18:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730244AbgLQVPz (ORCPT + 99 others); Thu, 17 Dec 2020 16:15:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:50126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgLQVPz (ORCPT ); Thu, 17 Dec 2020 16:15:55 -0500 From: Tom Zanussi Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: rostedt@goodmis.org, axelrasmussen@google.com Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 5/5] selftests/ftrace: Update synthetic event syntax errors Date: Thu, 17 Dec 2020 15:14:30 -0600 Message-Id: <6cb978ea1a56e76f723fb7aee74422b0766db8e9.1608238451.git.zanussi@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some of the synthetic event errors and positions have changed in the code - update those and add several more tests. Also add a runtime check to ensure that the kernel supports dynamic strings in synthetic events, which these tests require. Fixes: 81ff92a93d95 (selftests/ftrace: Add test case for synthetic event syntax errors) Reported-by: Masami Hiramatsu Signed-off-by: Tom Zanussi --- .../trigger-synthetic_event_syntax_errors.tc | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) 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 index ada594fe16cb..955e3ceea44b 100644 --- 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 @@ -1,19 +1,38 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: event trigger - test synthetic_events syntax parser errors -# requires: synthetic_events error_log +# requires: synthetic_events error_log "char name[]' >> synthetic_events":README check_error() { # command-with-error-pos-by-^ ftrace_errlog_check 'synthetic_events' "$1" 'synthetic_events' } +check_dyn_error() { # command-with-error-pos-by-^ + ftrace_errlog_check 'synthetic_events' "$1" 'dynamic_events' +} + check_error 'myevent ^chr arg' # INVALID_TYPE -check_error 'myevent ^char str[];; int v' # INVALID_TYPE -check_error 'myevent char ^str]; int v' # INVALID_NAME -check_error 'myevent char ^str;[]' # INVALID_NAME -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 -check_error '^myevent' # INCOMPLETE_CMD +check_error 'myevent ^unsigned arg' # INCOMPLETE_TYPE + +check_error 'myevent char ^str]; int v' # BAD_NAME +check_error '^mye-vent char str[]' # BAD_NAME +check_error 'myevent char ^st-r[]' # BAD_NAME + +check_error 'myevent char str;^[]' # INVALID_FIELD +check_error 'myevent char str; ^int' # INVALID_FIELD + +check_error 'myevent char ^str[; int v' # INVALID_ARRAY_SPEC +check_error 'myevent char ^str[kdjdk]' # INVALID_ARRAY_SPEC +check_error 'myevent char ^str[257]' # INVALID_ARRAY_SPEC + +check_error '^mye;vent char str[]' # INVALID_CMD +check_error '^myevent ; char str[]' # INVALID_CMD +check_error '^myevent; char str[]' # INVALID_CMD +check_error '^myevent ;char str[]' # INVALID_CMD +check_error '^; char str[]' # INVALID_CMD +check_error '^;myevent char str[]' # INVALID_CMD +check_error '^myevent' # INVALID_CMD + +check_dyn_error '^s:junk/myevent char str[' # INVALID_DYN_CMD exit 0 -- 2.17.1