Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp939347rwb; Thu, 10 Nov 2022 09:08:22 -0800 (PST) X-Google-Smtp-Source: AMsMyM7KYItPT6HdTGKwaPRF7DxnpjYLEirdmuUTot0/N869g30+dmoDCuzu9F3GBHLGgqsQBTHS X-Received: by 2002:a17:902:b086:b0:187:27b3:74e8 with SMTP id p6-20020a170902b08600b0018727b374e8mr53324926plr.140.1668100102614; Thu, 10 Nov 2022 09:08:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668100102; cv=none; d=google.com; s=arc-20160816; b=NHFw6UhnVAuLU/oEb5tOQgKtTmQyq52gM4xl7MiU52keaAXXopSOnnnoua7+NW68eE 8mdvuGBhXzTSN5TFDSLwqROEkdRsheXwvut1SoUpIjDQ+Woa+9Xv8vRnEJ/PXfkDFNd+ kHaIOzHHyqQrEWXvnss8yybsBDx3jWw4Xmze9L5pgR3Z56wYiXT/vieyeHn22rNHfE2x 2hlPF/C9rt5HXMQU1f0u8wLO8uNJHRLFJUeBLL2UXbIlyyDtg9nehIZ8Y29yVW5KjyEn 5cF13tu3b9NsNK67WU6AiGr+XXsbnyh7HOSwBgMPoDjXrsVne8e8gFtmfNnDxVOW4Yxz 0zJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hFaoVWX3RPLpACkyedBV3PTT5TMZWxPD/ZAqJUgyn/4=; b=ClXKUO+ygJJxcZRJbb/y3pH86qhK7DUGIHjggyEH0guWu443T0wosBVk/gZ5TIxvsw iegDHG+5Y3hZmR85XAC8Wv3sViYJlCNtN10sX9//GMG2ErBxOyvcpxLs92FYa/bCKx69 G3ImqfV2b5oT3O5SRxtjXKS30ScrBtoK/IKfIrN1CePqzetcqPkfF3LtTmcQ4SrjmLOc 7jjkDSotAG3nB1Ucxt+CrGT5fN3N25ewE+A0HycjiaLccxN3kNJdzvce69+ShYydVBo6 F+otOkfn9kgYN4x0Eh91oMpOcgr1IwzG8051XaQG/lHtSgxXuJB2vwB7gBQJNzPUpfXN pMww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=sU5cwCge; 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 c10-20020a170902aa4a00b0017f7fffb591si18271595plr.374.2022.11.10.09.08.03; Thu, 10 Nov 2022 09:08:22 -0800 (PST) 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=20210112 header.b=sU5cwCge; 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 S229478AbiKJQE2 (ORCPT + 92 others); Thu, 10 Nov 2022 11:04:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbiKJQEZ (ORCPT ); Thu, 10 Nov 2022 11:04:25 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5750193EE for ; Thu, 10 Nov 2022 08:04:24 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id kt23so6138651ejc.7 for ; Thu, 10 Nov 2022 08:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hFaoVWX3RPLpACkyedBV3PTT5TMZWxPD/ZAqJUgyn/4=; b=sU5cwCgeyQCJm0kHPrAsrs7Abf5eyH0+ZHOohF8AwyBR3OR5Q/Q/dIs3vmXOLPvREJ 4UJycZDcZp2evi0vIe3xVNlCLbfVKshwTqBnn/XK/641byYkNJro75KmRnYnkdyCybQ8 9TPHT0EqAXOxN/OoC0ONxvHuKAbLnRtWsPx6L0ro6hf78bh4kH8PKbfpa+yJOidv7UBN lidi3qlCaPmmgY08f7H+Ugp45YwfktAF8FJc5OheO4wuJN1B4s26RcfGk3rJHKJFbyHC m9KBpXPdr6UPU+exj5Of6FOmoTQ7OhAwNoDdY3gVy7r7rYuTKYdNvOkUER7i0aNIyLdN 1/ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=hFaoVWX3RPLpACkyedBV3PTT5TMZWxPD/ZAqJUgyn/4=; b=wpg6i7GFiLA83LuZGCgWfzrNK+IPPwOJVoy18CzEUK+bGt7jgnHd/VMxA69TUZTR4J Fd+pD1Fx96LuAaRt0R45RjWmRIu2CTkJEZIZ2N4AvsaW6keBHy5rV0c6WiBKSnslIL4v x53nqf1AgRhU/nXOQjZx+7mTiQoJLvJWtktpzjGj4uU0a/Yp0CRrnfSNffccZRStRW5i 3RcJmJEegQvRaLYFejeuMplkVKAR+sNzG3OVsyAoRXMo/VJ0Hj6VTkLVg1XSeesiNKW1 J64RXsWv3GXmJtsXkGAl1ItwbfayUBcxs1sgCW1B9dulIDy/5nHUlur3/QavCsiMkA3G KI1g== X-Gm-Message-State: ACrzQf0Zbc5hYkYJXm7msZe54ZxUWbXnFhRyKw0pF5RgLH+pVyaWCxC3 E7gqfAWi9owRpNZiOFcZmlcvge3BTd+Jn0C7HoadkQ== X-Received: by 2002:a17:906:3bc1:b0:78d:8cf3:6ae with SMTP id v1-20020a1709063bc100b0078d8cf306aemr3101932ejf.173.1668096263221; Thu, 10 Nov 2022 08:04:23 -0800 (PST) MIME-Version: 1.0 References: <20221109003618.3784591-1-dlatypov@google.com> <20221109003618.3784591-2-dlatypov@google.com> In-Reply-To: From: Daniel Latypov Date: Thu, 10 Nov 2022 08:04:12 -0800 Message-ID: Subject: Re: [PATCH v2 2/3] Documentation: KUnit: reword description of assertions To: Sadiya Kazi Cc: brendanhiggins@google.com, davidgow@google.com, rmoar@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, skhan@linuxfoundation.org Content-Type: text/plain; charset="UTF-8" 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, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Wed, Nov 9, 2022 at 9:07 PM Sadiya Kazi wrote: > > On Wed, Nov 9, 2022 at 6:06 AM 'Daniel Latypov' via KUnit Development > wrote: > > > > The existing wording implies that kunit_kmalloc_array() is "the method > > under test". We're actually testing the sort() function in that example. > > This is because the example was changed in commit 953574390634 > > ("Documentation: KUnit: Rework writing page to focus on writing tests"), > > but the wording was not. > > > > Also add a `note` telling people they can use the KUNIT_ASSERT_EQ() > > macros from any function. Some users might be coming from a framework > > like gUnit where that'll compile but silently do the wrong thing. > > > > Signed-off-by: Daniel Latypov > > --- > > Thank you, Daniel. This looks fine to me except for a small typo in > this line "to abort > the test if we there's an allocation error". Also, I have reworded > that paragraph a bit > as below. Please feel free to ignore, if you do not agree: > > In this example, to test the ``sort()`` function, we must be able to > allocate an array. > If there is an allocation error, the test is terminated using the function > ``KUNIT ASSERT NOT ERR OR NULL()``. Thanks for catching that. Hmm, I slightly prefer the current structure since I like having the being described near the start of the sentence as opposed to the very end. I'll wait a bit before sending a v3 to give time for anyone else to chime in, if they want. Snipping the email to the block in question: > > +In this example, we need to be able to allocate an array to test the ``sort()`` > > +function. So we use ``KUNIT_ASSERT_NOT_ERR_OR_NULL()`` to abort the test if > > +we there's an allocation error.