From patchwork Wed Jun 21 06:34:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sunliming X-Patchwork-Id: 13286727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62F4FEB64DD for ; Wed, 21 Jun 2023 06:36:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbjFUGg1 (ORCPT ); Wed, 21 Jun 2023 02:36:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbjFUGf7 (ORCPT ); Wed, 21 Jun 2023 02:35:59 -0400 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 417E21FF5; Tue, 20 Jun 2023 23:35:16 -0700 (PDT) Received: by mail-pf1-f194.google.com with SMTP id d2e1a72fcca58-6687446eaccso2784668b3a.3; Tue, 20 Jun 2023 23:35:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687329286; x=1689921286; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UwLBYM4w/H7KoFqtcB4hQtAsyswAe46iM2ztf4QLeWA=; b=COJbwxBxfLaJFS0hvhVtk93zfccR4O+Msv0xAle/hAmP1tPByHcBYsYjIpTtsr17Ey fTIp98oH3oF6VEImZYXYBEQxqfoUTcDVJCNpKbsneans6aXMzvqpalPb6Ai/GmBCkoWH a9V26DaaOPc+Sb3e6WRqkycWfa8d7zKDzDAJxxOwqftKAWRcPGXey5YuQMEQ6PP9Y9vv whj7G31T6IHRi2OYxso0Zp04yszxR4XofO4SM9wErNOoHyRe6F9H4c9SZyNTaPH5h6Bm gAw9isAXq96x56hGhRN89RU4I0VjLQKZ+XUr6W5nuJ4fkZmUQlzqRsuO+t5AcLNrwYL4 SNMA== X-Gm-Message-State: AC+VfDzrvkeTWJ97fwGkKxaaF7hzfMhxBjddcVXki7jABMkSjs1siXE7 +K37D5M9xF8lpD+CmL6yrw== X-Google-Smtp-Source: ACHHUZ4VjU0MwUo7X5EhB5iTtxuauMxunWUWBc7vFtY9ck4VfMOvMDrNcKLLqgFDf3BORuPgsIPKLA== X-Received: by 2002:a05:6a00:1a56:b0:658:c1a9:becc with SMTP id h22-20020a056a001a5600b00658c1a9beccmr20749626pfv.12.1687329286205; Tue, 20 Jun 2023 23:34:46 -0700 (PDT) Received: from localhost.localdomain ([116.128.244.169]) by smtp.gmail.com with ESMTPSA id c25-20020a62e819000000b00666d7ef2310sm2306298pfi.94.2023.06.20.23.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 23:34:45 -0700 (PDT) From: sunliming To: rostedt@goodmis.org, mhiramat@kernel.org, beaub@linux.microsoft.com Cc: kelulanainsley@gmail.com, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, sunliming Subject: [PATCH v3 2/3] selftests/user_events: Enable the event before write_fault test in ftrace self-test Date: Wed, 21 Jun 2023 14:34:38 +0800 Message-Id: <20230621063438.154271-1-sunliming@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org The user_event has not be enabled in write_fault test in ftrace self-test, Just enable it. Signed-off-by: sunliming Acked-by: Beau Belgrave --- tools/testing/selftests/user_events/ftrace_test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c index abfb49558a26..d33bd31425db 100644 --- a/tools/testing/selftests/user_events/ftrace_test.c +++ b/tools/testing/selftests/user_events/ftrace_test.c @@ -373,6 +373,10 @@ TEST_F(user, write_fault) { ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, ®)); ASSERT_EQ(0, reg.write_index); + /* Enable event */ + self->enable_fd = open(enable_file, O_RDWR); + ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1"))) + /* Write should work normally */ ASSERT_NE(-1, writev(self->data_fd, (const struct iovec *)io, 2)); From patchwork Wed Jun 21 06:35:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sunliming X-Patchwork-Id: 13286728 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6321EB64D7 for ; Wed, 21 Jun 2023 06:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230328AbjFUGgz (ORCPT ); Wed, 21 Jun 2023 02:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbjFUGgH (ORCPT ); Wed, 21 Jun 2023 02:36:07 -0400 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C604C10FB; Tue, 20 Jun 2023 23:35:25 -0700 (PDT) Received: by mail-pl1-f196.google.com with SMTP id d9443c01a7336-1b525af07a6so26098425ad.1; Tue, 20 Jun 2023 23:35:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687329308; x=1689921308; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rOw6lr7KCaSTbJVfVX5591M2W/FZfWw7G+MVsaNTI+g=; b=cWqYMvgy2v4E6fjpyYOM+qaoxJLvUVCx2qfGCFe2QYlzrCZGWZTpB3j1PG6omhA6VZ 4PB7esX2zOjLVTZS/k5GhshOO6+qUX8PnSqJthKKr7lo/6/8vTVYam4p8HUA3s2ZRbK/ bboFlV0zJ1pn5U1CyF9892lQHZHcF8kL7nYltZlvg4SjVkntTUHUnknp3zpcLkas8wA6 /RP6lGIlBWQzaojyJjSFqyo8wSoC9mk8dsR86ejWONzf6vVSpjt2F14Q2QJDSaeeio8s 1i/yAx8N5h7FHWkburxYzLjDWpk2ulMIyJRHbJ2yl702QVKHkLgJdzJwlFANVzKsmSOz j+Uw== X-Gm-Message-State: AC+VfDxhd5RHpzSgm8sof0UU79gAxIWJgSqpd8QZi/iIX+iTmvxAIN8I LUFmYlGiKJf7hL7Fab9eVQ== X-Google-Smtp-Source: ACHHUZ5UFqt4bZo98PnGsOl8cmIyq++2mSRoSZ9M/lz6KCX1WvNV4k4qrQCYPZ5sDR7n3y23mLPtkw== X-Received: by 2002:a17:902:d353:b0:1b3:c7c1:8ded with SMTP id l19-20020a170902d35300b001b3c7c18dedmr8466029plk.27.1687329308272; Tue, 20 Jun 2023 23:35:08 -0700 (PDT) Received: from localhost.localdomain ([116.128.244.169]) by smtp.gmail.com with ESMTPSA id z7-20020a170902708700b001b3dada0e78sm2593054plk.258.2023.06.20.23.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 23:35:07 -0700 (PDT) From: sunliming To: rostedt@goodmis.org, mhiramat@kernel.org, beaub@linux.microsoft.com Cc: kelulanainsley@gmail.com, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, sunliming Subject: [PATCH v3 3/3] selftests/user_events: Add test cases when event is diabled Date: Wed, 21 Jun 2023 14:35:02 +0800 Message-Id: <20230621063502.154378-1-sunliming@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org When user_events are disabled, it's write operation should return zero. Add this test cases. Signed-off-by: sunliming Acked-by: Beau Belgrave --- tools/testing/selftests/user_events/ftrace_test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c index d33bd31425db..7968d69c3a5c 100644 --- a/tools/testing/selftests/user_events/ftrace_test.c +++ b/tools/testing/selftests/user_events/ftrace_test.c @@ -297,6 +297,9 @@ TEST_F(user, write_events) { io[0].iov_base = ®.write_index; io[0].iov_len = sizeof(reg.write_index); + /* Write should return zero when event is not enabled */ + ASSERT_EQ(0, writev(self->data_fd, (const struct iovec *)io, 3)); + /* Enable event */ self->enable_fd = open(enable_file, O_RDWR); ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1")))