Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21492119rwd; Thu, 29 Jun 2023 17:24:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ43aEzcC00aCB6nC09DoSiY1OrY4wD/wKpkI5sTlBKj8kiUB1m+BRUVh3vfIjhYWQApkCpB X-Received: by 2002:a54:4199:0:b0:3a2:572a:eaa6 with SMTP id 25-20020a544199000000b003a2572aeaa6mr966840oiy.5.1688084679542; Thu, 29 Jun 2023 17:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688084679; cv=none; d=google.com; s=arc-20160816; b=Q8GsClM8ycNhugcBpsjt05qjbDI2Ydzdz4wMHKQn/0aRvJejeNHUCMTy0/ECLRpfkP AubRiB/ogDo7CPYfdqOlv07HNvCCHatec5P6QKr3EyYpZ5qKqIGaGUYdro9H15aPUDRz Y1u89V1wbtcAk0a8brGbx0E3GxH2KyBtu7FbLVpfTzwcFKSG3z6q2EGEkT9VNmCTI+5J VvU6fRUQLez89z5tajHTO4AZAGKOeMak7DQqoy5kPKbUiwhZFuQIYMH7pBOYy1cVlOW2 XezjMvduOAc6T4P+gShl12LxRAyFb4TdgnJNe/ZT2MLg1weXJwagxTQPPa7HQWdNZFH3 MVTw== 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 :dkim-signature:dkim-filter; bh=0aQD7w91qsRnUacHvqCqrLheZ0AfaxAuOy5KqQ12dw8=; fh=p4jcC6qPA5R6qIqhMXvm4Q5Zg5H5ZjhkM/jXdOBVsQs=; b=EEVIJfyfjZPYDffRvJKVNkJSCqfMkDtfMDTmPhTgRUmYlSFM1jTN7kiI/+ktEssW7L W4ozXdpqdNfbMDedZ/dpzKNiQ/bGplFiPMLYVRpOHjq8XiaC5peA6KwDUWxz7PxNn6bs 9od9WnqI/I5+O0M2U2wPLxRB6tQi7W+62d1DVRJmcGVvRWsLFZoxbIf0J+4v0dzEKu4H rLShTFMMJa6IofXODh7D0ZaE+kpRcS/uTM9YfzCBOJNnioyWhgEmXHIn6QFb3rGRsEaN 7g9jV+isdtOtIVVYWpg6x5S6RZvG0s+EUH7ewG8nPzAXOI9lnY88Xa3ZEzqywYtIpkGs k6zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Y3trTN8u; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn8-20020a056a00340800b00666add78ca9si1842429pfb.326.2023.06.29.17.24.28; Thu, 29 Jun 2023 17:24:39 -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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Y3trTN8u; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230453AbjF2XvA (ORCPT + 99 others); Thu, 29 Jun 2023 19:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjF2Xu4 (ORCPT ); Thu, 29 Jun 2023 19:50:56 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 966DA2D55; Thu, 29 Jun 2023 16:50:55 -0700 (PDT) Received: from CPC-beaub-VBQ1L.localdomain (unknown [4.155.48.123]) by linux.microsoft.com (Postfix) with ESMTPSA id C2F84208396C; Thu, 29 Jun 2023 16:50:54 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C2F84208396C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1688082654; bh=0aQD7w91qsRnUacHvqCqrLheZ0AfaxAuOy5KqQ12dw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y3trTN8upge61n68tUauMvmEglojh7Eu6kcf56/khalzgWsTsroZzvWzaUKgLrdN/ +VVBUDDdlaaVYvB3tXU7DJyJwwPzOQnF9N438SsZY3IExQpDlZuAbzECcByTb4VA84 hJOXprKkVX4WLa6kbaWfgUv9lPttAuHsGFfHA2R0= From: Beau Belgrave To: rostedt@goodmis.org, mhiramat@kernel.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH 2/2] selftests/user_events: Test struct size match cases Date: Thu, 29 Jun 2023 23:50:49 +0000 Message-Id: <20230629235049.581-3-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230629235049.581-1-beaub@linux.microsoft.com> References: <20230629235049.581-1-beaub@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham 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 The self tests for user_events currently does not ensure that the edge case for struct types work properly with size differences. Add cases for mis-matching struct names and sizes to ensure they work properly. Signed-off-by: Beau Belgrave --- tools/testing/selftests/user_events/dyn_test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/testing/selftests/user_events/dyn_test.c b/tools/testing/selftests/user_events/dyn_test.c index d6979a48478f..91a4444ad42b 100644 --- a/tools/testing/selftests/user_events/dyn_test.c +++ b/tools/testing/selftests/user_events/dyn_test.c @@ -217,6 +217,18 @@ TEST_F(user, matching) { /* Types don't match */ TEST_NMATCH("__test_event u64 a; u64 b", "__test_event u32 a; u32 b"); + + /* Struct name and size matches */ + TEST_MATCH("__test_event struct my_struct a 20", + "__test_event struct my_struct a 20"); + + /* Struct name don't match */ + TEST_NMATCH("__test_event struct my_struct a 20", + "__test_event struct my_struct b 20"); + + /* Struct size don't match */ + TEST_NMATCH("__test_event struct my_struct a 20", + "__test_event struct my_struct a 21"); } int main(int argc, char **argv) -- 2.34.1