Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8900358rwd; Tue, 20 Jun 2023 23:48:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67HIh0nar0P0IakEItj1X2gr1Y3skr1A2LezcFZysqDXmObHULZ0TthR5pl7Y6Q4dvbn+M X-Received: by 2002:a05:6a20:12cb:b0:122:76e8:ea10 with SMTP id v11-20020a056a2012cb00b0012276e8ea10mr4272088pzg.13.1687330101650; Tue, 20 Jun 2023 23:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687330101; cv=none; d=google.com; s=arc-20160816; b=gqwXUO99PdIbSlCFPhBqwlQJkGMKRZNWbEnKTgD8DhBx945KSdwNWGI4hNXx2PUC0S fS/Y6kD7pG/SWbbRqRvELrjiWqeytE0dje3XN5IV7MHVxJRxmawHc4BkNVE/WBIWv4UG O322XFUfo5PGqRxz+KDUd+uXLB6slxqeLov1Nr+CN/cCzu+8oB3V4NJLSVz5jfJFpYYb mUYZOkpmiypgfJRYCVqATg/aVtftuhUOB1Vuh5G2rywTZjEDJi++AjvQEo8TsjeCJx7U X4QCbMk9NA9unYRHE58y7D9fTYL4XelgLoLlFlRcG6XCnizl0Kp3xRuz3f779JnrVnEE U8eg== 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 :message-id:date:subject:cc:to:from; bh=rOw6lr7KCaSTbJVfVX5591M2W/FZfWw7G+MVsaNTI+g=; b=EkaT4zSc1xszRw5JHeIkTVNLu9PCzoAmmQBG8rIjLU17Qm4nHoic3aFeVuH3M+wywu pBlBF5cMqJWGWuUxuej2C5t/jdA61BwtGPDYcrJpso4aKJwrfJHAcPyQQ5D+NjbG57/x QVUJbGCxxdBzD9Te9LEsZNf5Z0ZPBXbKJIV8iFO59scG3//6RBh5yHb1agwOy+XycpXw ++6Asad3ENAl9hBv/BJidFs/m4zxxiIuSTdpcyl6djI61QoNz8gcKWwlORR/2d+ykw8k puN6+4FpivGnExHyhMuJuv4TKvOG4kVKw+ww3OJNp6VM4HBYA2SfMHgnk/+cTAuRSJX9 TYDg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a170902dac400b001b043fb4083si4022700plx.16.2023.06.20.23.48.05; Tue, 20 Jun 2023 23:48:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230345AbjFUGg4 (ORCPT + 99 others); Wed, 21 Jun 2023 02:36:56 -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-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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 When user_events are disabled, it's write operation should return zero. Add this test cases. Signed-off-by: sunliming --- 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"))) -- 2.25.1