Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6535289rwr; Mon, 24 Apr 2023 23:08:56 -0700 (PDT) X-Google-Smtp-Source: AKy350ZuixWCHr7KVlBrjvq5xvpBExD3aQq/2QCNXVoSWRUEf3WXvdTI6UdBi+GCdwbz7K9kC18a X-Received: by 2002:a17:903:1d1:b0:1a6:f765:de5a with SMTP id e17-20020a17090301d100b001a6f765de5amr21005827plh.13.1682402936112; Mon, 24 Apr 2023 23:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682402936; cv=none; d=google.com; s=arc-20160816; b=sJnTehD48jAFKdx0k6RgTqYreMLheRHq5tF0BXbQWQXMsXFQHh6S+lhSj3jN3X82JN mJnWos6Y66toeoH34bPLr4ASYM7gVcOBO7g4RTnnaQWpKEHe++zYb+Qe7YAiiUZDFyF+ n2286vVFJCteH+rsk1y+9iPKO8ytpsWgV41ElPANE4KCJXl9sadPfCi2qxK784Qildv+ lwhlwVVluq0qPQq19H+wFpEq+rpKpaLGNwzfF4PSTLJotruohpDwfVj0/jMf+uhYOS19 U+zR68GQ8Hw1rMQZTWYAcdcl5/RAtFzIfnp9998ivttTbZU6+evXEW9jb9g58jrUmLs9 O7XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VNTCPwELmejGyX0PHoDzgEHBOGMtopWJi8WSu8WZm6Y=; b=YJfyItfyKMu/dqMYx6HPKUq1GtNVckw4HlstShh4XpfahG3/00RvcqNQCKGf9yswu/ FoOHwAa23M3yrDfIw89fayYwfOjH169Zec+JHp/Ngsd9QqFU3qaMd4+1DRWliQN98cs9 f/sWwdo6wIAVn4fRZ0ADS5H0fsM71dynTb0EEIPa+7UdoWS4j+Ro27Yf7D6RKfKYQxpT Lg3vCR/MIBVLIZCrOyyyjU9KwTpeL8Yif/tzzKYs2tVSk+zCVyK2XmW1jwZ3yJZXWGmM JeSqPSi5UdyeDFEiqam545slC4B6B3Opz7nBMyvys2ajV97a6/8Y/zegS02qIK1+kC8l VIvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=tid6Vhav; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a170902ccc200b001a6f3949171si13113492ple.24.2023.04.24.23.08.41; Mon, 24 Apr 2023 23:08:56 -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=@google.com header.s=20221208 header.b=tid6Vhav; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233281AbjDYF4m (ORCPT + 99 others); Tue, 25 Apr 2023 01:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbjDYF4l (ORCPT ); Tue, 25 Apr 2023 01:56:41 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DE1C4C15 for ; Mon, 24 Apr 2023 22:56:40 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1a682eee3baso41650025ad.0 for ; Mon, 24 Apr 2023 22:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682402200; x=1684994200; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VNTCPwELmejGyX0PHoDzgEHBOGMtopWJi8WSu8WZm6Y=; b=tid6VhavUBckO1Th/UH6CvlgJfZnJpvGasl2MY3m0mjt77Y8IMoPKvvzndHIotQ6xx QwYCjtGWzKWFUO2zJ5xE57BQOJg+WPcf9HfCiW3QFud9cWAiRiVTwmi/yIoyAlmDeCx1 SlIMeztzMLZaE1K2rGWTC1YLt8YRHLa+p7j00whfQ6Xw8XdNFkC6f8cmFn+JqGYQLLJ0 uOQi85ZiONgxcya6s3D+Wp9/as7i13UhgICTCvzMi+bF0ocYTh++gmHU3NjYVRn8o9/C iCLXOJBoG+4DRuvIB476dpSoxJkNlYDDBBLnfVXw8NdYBMr8K0ohC13ujEibQa4iTmwe e9FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682402200; x=1684994200; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VNTCPwELmejGyX0PHoDzgEHBOGMtopWJi8WSu8WZm6Y=; b=ESL6/mYhL75xq6oVZp+ficLcyTa9PhyLNeK8dAXt/6GnUCJEd92BGnqlgIOmNlPyII sf/5enWeOv2kuJXQCYtgNWSYB6xvADvUssN8fnJKpryvLr/f4eDVLWjO5lrsKrRtD8lM E14cZvefAx19QwSoGi3Nz5C/BVZtS4SFe0c+1NpiUcfw+4I6/zplufcJYLh37fqJSE4u SrmYc5t7LmvDWPf7MEd+PH4yxO+f/e8E+z1tm84P7oEbUIMKSMZICOqFWkCFcK7jYL5f xGD+7KDRb6KU87nCYdfZzqadvO13cvOggyW25jUPgf+IsLETYtMSj2ygYcE+a/HGs7p7 808w== X-Gm-Message-State: AC+VfDz1et8mWvjzE9czr6e+dm2jDE9TEpLkpAsXFKFZ2jEyi2RIvxFV Ib/QMiuQ3a4ujuLujs0IFQJkMVIA14ce2Duq9DPZNQ== X-Received: by 2002:a17:902:e5c1:b0:1a9:8ab1:9f3b with SMTP id u1-20020a170902e5c100b001a98ab19f3bmr1853997plf.14.1682402199701; Mon, 24 Apr 2023 22:56:39 -0700 (PDT) MIME-Version: 1.0 References: <20230421040218.2156548-1-davidgow@google.com> <20230421040218.2156548-2-davidgow@google.com> In-Reply-To: <20230421040218.2156548-2-davidgow@google.com> From: Sadiya Kazi Date: Tue, 25 Apr 2023 11:26:28 +0530 Message-ID: Subject: Re: [PATCH v3 2/4] Documentation: kunit: Note that assertions should not be used in cleanup To: David Gow Cc: Benjamin Berg , Brendan Higgins , Shuah Khan , Rae Moar , Daniel Latypov , maxime@cerno.tech, Stephen Boyd , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 Fri, Apr 21, 2023 at 9:32=E2=80=AFAM David Gow wro= te: > > As assertions abort the test cleanup process, they should be avoided > from within a suite's exit function, or from within resource 'free' > functions. Unlike with initialisation or main test execution, no further > cleanup will be performed after a failed assertion, potentially causing > a leak of resources. > > Signed-off-by: David Gow > --- Thank you, David. The note looks fine to me. Reviewed-by: Sadiya Kazi Regards, Sadiya > > No changes since v2: > https://lore.kernel.org/linux-kselftest/20230419085426.1671703-2-davidgow= @google.com/ > > This patch was introduced in v2. > > --- > Documentation/dev-tools/kunit/usage.rst | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/Documentation/dev-tools/kunit/usage.rst b/Documentation/dev-= tools/kunit/usage.rst > index 9faf2b4153fc..9f720f1317d3 100644 > --- a/Documentation/dev-tools/kunit/usage.rst > +++ b/Documentation/dev-tools/kunit/usage.rst > @@ -121,6 +121,12 @@ there's an allocation error. > ``return`` so they only work from the test function. In KUnit, we sto= p the > current kthread on failure, so you can call them from anywhere. > > +.. note:: > + Warning: There is an exception to the above rule. You shouldn't use a= ssertions > + in the suite's exit() function, or in the free function for a resourc= e. These > + run when a test is shutting down, and an assertion here prevents furt= her > + cleanup code from running, potentially leading to a memory leak. > + > Customizing error messages > -------------------------- > > -- > 2.40.0.634.g4ca3ef3211-goog >