Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4080770pxb; Mon, 1 Feb 2021 11:53:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEQ91NO7tE6LU49vk/K5J+DwBgsOwV7t8RD02WMf2zwwWQdLsT+ha8rtzEXWfZ8nZH3Zpi X-Received: by 2002:aa7:ca13:: with SMTP id y19mr20223833eds.59.1612209224998; Mon, 01 Feb 2021 11:53:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612209224; cv=none; d=google.com; s=arc-20160816; b=Nd2m5ECtoh40nPT21db4eXGLTx1Cp8BwhLr6tXFem1WvJSRiHou5kWpPTIJ/8k1gOY V2XlZ7zoaQXp/X+l4u+Ft/6pPviyEb2M6GqmsOY+PO9EOrBV/Zdj8UrpeUr/vOYChF/+ 3J624EHXX5Bm0rBizcXxJfg7s8AIOex30g/XrLVs37hro4DFTTu/+/37aKGGhzQDI+GY VbIxwkkojFjkmd9V3gcVgQjCVB53lEaQ7swYdh2WALQLBJ918grHMUqZct3HOBeQAr5A DNrtVPFXLCx7M7Nb7P+31SlQeszYO82VXHGT6HfgiGwZrEQhxUTJxnMLEkZrq968mgkc rRRA== 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:dkim-signature; bh=oRgnTckepzs+mZXYgyaFQASITdcY8dZWbdJJFGDImcc=; b=j/KBvCS/PNyjA0txtnnRTi/3RQRd7lv3g9hQWg2ax5aukCaSJjwlCPyS2+b3MAs6/D oR1zEXVeY2xksXLA9odvGVoNH3Gccyhiqn1hhA0rPNF4IZ2z0ouYbVoDGFw6Ph5YkJQh zOJT2qI6Vu35MImxBecriVA27oDRBJZ/wjUsW1kW81G6Ts8WlzdrXn/XnZflGcuck2kY KGySNqVPhOg0a4k3wBuGiIfluJRSHtfluPoyAvKcSBOqSrWrRn5X7pVhI/Y56I6EKIuD Ccf3NbmF3LiuvZBt2iU4Pul3b7HobTD5eRhzZG4NXhtAEh4H9FiINrl21hRh1gXyeO4j Iykg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=in3jzHme; 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 n8si4536270eji.230.2021.02.01.11.53.20; Mon, 01 Feb 2021 11:53:44 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=in3jzHme; 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 S232517AbhBATwu (ORCPT + 99 others); Mon, 1 Feb 2021 14:52:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:55614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232739AbhBATu6 (ORCPT ); Mon, 1 Feb 2021 14:50:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 949A764EC7; Mon, 1 Feb 2021 19:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612208908; bh=xgOBus5e/9Dm2CNFG/dmYKTPsdUbEBzhnA2rRSLxD64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=in3jzHme5Xk+Z3zZ3bKuEjxsea5X2aof5gl/3y8xCbGcMBZbevQuuEFk9hhMR2y76 qioYcGR0lv727zfB9BW084RL261+Vl5SAaejZhXOZIfdN/wQ3MEElg5G2jaMWbZsXT KCXov0/fUdMdcjVZiQUQphUZAbfLf+60MtziP/WcRmQq9fEK96FHZtD/DaNE35gNFh va+KJWvbHTA9Z+v9SUrYY426Kbo+0+GJOyj4VeYLjAK5so2dOZnCC3bSU11BE/AtZq Uq2/JYMCDXE7cNU9CCk0vEKtf4JsI323hM7XOSKkG7pOW7Z7b07k4J5wAsRTSYwJh5 s4SEKLkCrp0mA== From: Tom Zanussi To: rostedt@goodmis.org, axelrasmussen@google.com Cc: mhiramat@kernel.org, dan.carpenter@oracle.com, linux-kernel@vger.kernel.org Subject: [PATCH v7 5/6] selftests/ftrace: Update synthetic event syntax errors Date: Mon, 1 Feb 2021 13:48:15 -0600 Message-Id: <51402656433455baead34f068c6e9466b64df9c0.1612208610.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