Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp997231rwd; Thu, 8 Jun 2023 10:28:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BSaqfpWsGGDkd8yaJRfcn2F2CcQCQAWt2oNxWkhA1N8X75b6OLFae9g2SlsNEg6Hx5oI7 X-Received: by 2002:a17:903:234c:b0:1ae:1659:bfe2 with SMTP id c12-20020a170903234c00b001ae1659bfe2mr5676895plh.34.1686245312990; Thu, 08 Jun 2023 10:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686245312; cv=none; d=google.com; s=arc-20160816; b=axfELxs9YB7DkmmGr5z/Fb7wZ14BU3vJnfoIkLIvwDEo5Qfl3e8wRrykyyqoIJPo32 K+tbkoTU6fT/xRJZgfftOxu/ZZ2UEcH4L4rIb0gYDD0eHMk9cnPIihDR0lm4Bwk3nAOG 3j1S54EgJlP+UbacE2UoDyR+PuQVGFD4n+8tN71sHhfzPT6Q8W2TJrxjByzOV350kmdA /i15L5UcL0i+9dfNZUCmDlFHKoyQ/sx1og9RBtnXm5Dtf9SHxdjFELrMJelkJFnC/jes FoBLWKv1dwrf5Gf9A8j2y72FuwSmp9G6N1PFfhORNxNIgjbbt3d0/X089E5/jMRgwSva JBIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-filter; bh=VBaFkE6GX3eC/7r1EJyEukf/dkEnREgtJAdwAFf6fgI=; b=dz5FEYxGgNmH5gxQNyVTDhk9rKWwU35NYGFYyHZXqNaLoz0qcusbplF25f06ySaQuw MY+1HfIgnWFKzj0P1PCGySQ7uOtpoaxibYmW7/FYMTuYRPx9U+z2puVSHGxgZTjvSzFa UmlLn1umt7j+Uy71ffaQVxbbfJr8VxQUP9MuobGDPwPljbOImYwie8beaGiLYdSnVMV5 dyfBv/AiWvgLCcMspA4JPUBUhnOKHXmx3Dol8ANrdBuVM04Dhph8jYsgCL3cg0BIh9ND 9F1/aZdVZZX+aDXr2PgTHD1g/TeNYGO8Zg9Skb3Xw402XR0MvoEioVon1gC02/ekFyn7 4jmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=PRUnpGMP; 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 u13-20020a17090341cd00b001ae3214162dsi1344138ple.548.2023.06.08.10.28.21; Thu, 08 Jun 2023 10:28:32 -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=PRUnpGMP; 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 S237008AbjFHRVw (ORCPT + 99 others); Thu, 8 Jun 2023 13:21:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236852AbjFHRVu (ORCPT ); Thu, 8 Jun 2023 13:21:50 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7D7A72D61; Thu, 8 Jun 2023 10:21:47 -0700 (PDT) Received: from W11-BEAU-MD.localdomain (unknown [76.135.27.212]) by linux.microsoft.com (Postfix) with ESMTPSA id D83DE20B92C2; Thu, 8 Jun 2023 10:21:46 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D83DE20B92C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1686244907; bh=VBaFkE6GX3eC/7r1EJyEukf/dkEnREgtJAdwAFf6fgI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PRUnpGMPyM/oASGKLPfI+Y43/nnlBH8E54/JaJa+Tmz8oum5swWUqwgpBjJEQUTi+ NHl0IvSGeGD5SSdRshDGqeVHJR2XdclvYsARIhq6LO23qcB0BbdXucXbgf/ozYtzg6 bGshuHgl/6TvS9jcXwAvIFAULQTCQZcux+67tvzk= Date: Thu, 8 Jun 2023 10:21:43 -0700 From: Beau Belgrave To: sunliming Cc: mhiramat@kernel.org, rostedt@goodmis.org, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kelulanainsley@gmail.com Subject: Re: [PATCH 3/3] selftests/user_events: Add test cases when event is disabled Message-ID: <20230608172143.GB74@W11-BEAU-MD.localdomain> References: <20230608011554.1181097-1-sunliming@kylinos.cn> <20230608011554.1181097-4-sunliming@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230608011554.1181097-4-sunliming@kylinos.cn> 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 On Thu, Jun 08, 2023 at 09:15:54AM +0800, sunliming wrote: > When user_events are disabled, it's write operation should be fail. 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..d3240a97f23d 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 fail when event is not enabled */ > + ASSERT_EQ(-1, writev(self->data_fd, (const struct iovec *)io, 3)); > + We should also check errno value in this case. See my reply in the other patch about -EFAULT vs -ENOENT in this case. Thanks, -Beau > /* Enable event */ > self->enable_fd = open(enable_file, O_RDWR); > ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1"))) > -- > 2.25.1