Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1572205pxf; Fri, 2 Apr 2021 14:48:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCVx9z2IdTjLfDvGdxaCg4+h3t78Orm/4MZemcE2Q4wzwy9CcO4EVzn4R9zSY2LFwn7P1J X-Received: by 2002:a92:6510:: with SMTP id z16mr11819847ilb.71.1617400101359; Fri, 02 Apr 2021 14:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617400101; cv=none; d=google.com; s=arc-20160816; b=hCgzYCdxHxQabOudJpc5xigH4kbaMWiR3XxQ/gkvlFCB8V+7OOdIwrkeoy+zvQmRpc Uy9rIBsC+a8tHnQAEmsV7wBgVKoCFLiz+qeOj4bzVLU1P6B8HJXuu96hpywYvEFHcnvm ChqTBg3iNFvv/TwkJxChEWLzlQhtCsCpEFRw2T7dEu5RhMf/KiVA0g+vHgxFVVxv39nh 4mng7e0+u2/29n37WSonSiw6CtVhg/jx5b6xtdGPr1Rp/ROWn7UphcpxjrKEi9QZ+US5 tDOVrV+dXKLI/BAk9PWtjwnEWgyZmxrDfbj+d52C1Wkmf17SSL+/6AsKu99v/I9uK+a1 PCGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=tltgo4wOB5veD6Atp560I36vsQKrOOIkKptJK7NQ6JA=; b=gUK2kOro063WW6dsPmKSo4FBrA9KdNdP4Jho5rYoUF+cfbisssdJY3uyNV6bSly8ws xh2Cdbr4T8JIVMTQdUq3f2Of3PeFwXgw+r5QNRIuK7d91YhrTkakkr1uO7dkJFVZ+/b3 jTXZbEBAUVv2rLJoL3j2Rpz8+VCxou1t/3e5g6/xfWYnRA9/178bqNKE08n3TUzBpGCx zIdRybzfVVPwdN0TxSEp82SWZ22nur5ImInH6zXuarmqKotRvrbFSjaNax6nD/0C8RhY 2hJ75p+rRkYYiOeeoFxigxzFg1YTjbIK4J0+gsmOzp1s9Mh2lQA3eH3Y69fsIJ9JBK8g rZGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=MlxLjTyM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si10249284ilj.146.2021.04.02.14.48.06; Fri, 02 Apr 2021 14:48:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=MlxLjTyM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229722AbhDBVrk (ORCPT + 99 others); Fri, 2 Apr 2021 17:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231149AbhDBVrj (ORCPT ); Fri, 2 Apr 2021 17:47:39 -0400 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47A0CC061788 for ; Fri, 2 Apr 2021 14:47:38 -0700 (PDT) Received: by mail-il1-x133.google.com with SMTP id d2so5581127ilm.10 for ; Fri, 02 Apr 2021 14:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tltgo4wOB5veD6Atp560I36vsQKrOOIkKptJK7NQ6JA=; b=MlxLjTyMB0BGt61VkFDZIaswz3rwNGl9NBIthdNc3yRe2Gx/5RcXbAjLFyTFLwMOHi UVzFur2AgcAjFtQuda4YkA97qQP2Y6v4Axhe178PTYWutusYVXSv/1lKJgbvAnS4Eq/1 9mZEVM+IEHJl9Be2cUj/tiuj51M6nFuDMjl1U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tltgo4wOB5veD6Atp560I36vsQKrOOIkKptJK7NQ6JA=; b=jyLbk2U/jU/VkqEfjcZ0xfS+L/tR3gZM/j35XW4iTOs6u3WzZs5iBfPSvL7f+XLdAv YAQYqhk9u9/NXgpOFcHLrntCWAF/Z7ca1TBbg2Uuoov09fE2ea5cVVgYZReLxvW9vGhm 5VgB84XpVqhQam9DJoCp7J55rPvlBPB2p95/jN87kwuTedqG0ncE2OvnTfoPikauNi5y zfn3btfjeSgI53RNl8c2Ax9W6IUehxgbvFna/UjsdUGlnxQYptDl6PvUt9gtMN7zyTVg ULSUMV0GkOGTiEV8pfoLzBaXrAJy1blFNl3IaeFGKe9HsDBnWpYZv5ShZfmp+lHdKKXs 7MdA== X-Gm-Message-State: AOAM531K6DCxkBpPj8ezf4EI8bxyZ1yjK+ovXmt8/xz5kJxdHoutuYvg uYCU3W88zJbn/aasJwtkuTwyMg== X-Received: by 2002:a92:4452:: with SMTP id a18mr11548229ilm.46.1617400057568; Fri, 02 Apr 2021 14:47:37 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x3sm4734952ilg.2.2021.04.02.14.47.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Apr 2021 14:47:37 -0700 (PDT) Subject: Re: [PATCH v4 1/2] kunit: support failure from dynamic analysis tools To: Daniel Latypov Cc: Brendan Higgins , David Gow , Alan Maguire , Linux Kernel Mailing List , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Uriel Guajardo , Shuah Khan References: <20210311152314.3814916-1-dlatypov@google.com> <20210311152314.3814916-2-dlatypov@google.com> <16fe1cc0-5819-986d-9065-433a80783edb@linuxfoundation.org> <3774e8c7-4183-d627-8c53-16bdc0bed6eb@linuxfoundation.org> From: Shuah Khan Message-ID: <570d4758-8891-2423-fd37-92f69fbb2e1d@linuxfoundation.org> Date: Fri, 2 Apr 2021 15:47:36 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <3774e8c7-4183-d627-8c53-16bdc0bed6eb@linuxfoundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/2/21 3:44 PM, Shuah Khan wrote: > On 4/2/21 3:25 PM, Daniel Latypov wrote: >> On Fri, Apr 2, 2021 at 10:53 AM Shuah Khan >> wrote: >>> >>> On 4/2/21 2:55 AM, Brendan Higgins wrote: >>>> On Thu, Mar 11, 2021 at 7:23 AM Daniel Latypov >>>> wrote: >>>>> >>>>> From: Uriel Guajardo >>>>> >>>>> Add a kunit_fail_current_test() function to fail the currently running >>>>> test, if any, with an error message. >>>>> >>>>> This is largely intended for dynamic analysis tools like UBSAN and for >>>>> fakes. >>>>> E.g. say I had a fake ops struct for testing and I wanted my `free` >>>>> function to complain if it was called with an invalid argument, or >>>>> caught a double-free. Most return void and have no normal means of >>>>> signalling failure (e.g. super_operations, iommu_ops, etc.). >>>>> >>>>> Key points: >>>>> * Always update current->kunit_test so anyone can use it. >>>>>     * commit 83c4e7a0363b ("KUnit: KASAN Integration") only updated >>>>> it for >>>>>     CONFIG_KASAN=y >>>>> >>>>> * Create a new header so non-test code doesn't have >>>>> to include all of (e.g. lib/ubsan.c) >>>>> >>>>> * Forward the file and line number to make it easier to track down >>>>> failures >>>>> >>>>> * Declare the helper function for nice __printf() warnings about >>>>> mismatched >>>>> format strings even when KUnit is not enabled. >>>>> >>>>> Example output from kunit_fail_current_test("message"): >>>>> [15:19:34] [FAILED] example_simple_test >>>>> [15:19:34]     # example_simple_test: initializing >>>>> [15:19:34]     # example_simple_test: >>>>> lib/kunit/kunit-example-test.c:24: message >>>>> [15:19:34]     not ok 1 - example_simple_test >>>>> >>>>> Co-developed-by: Daniel Latypov >>>>> Signed-off-by: Daniel Latypov >>>>> Signed-off-by: Uriel Guajardo >>>>> Reviewed-by: Alan Maguire >>>> >>>> Reviewed-by: Brendan Higgins >>>> >>> >>> Please run checkpatch on your patches in the future. I am seeing >>> a few checkpatch readability type improvements that can be made. >>> >>> Please make changes and send v2 with Brendan's Reviewed-by. >> >> Thanks for the catch. >> checkpatch.pl --strict should now be happy (aside from complaining >> about line wrapping) >> >> v5 here: >> https://lore.kernel.org/linux-kselftest/20210402212131.835276-1-dlatypov@google.com >> >> >> Note: Brendan didn't give an explicit Reviewed-by on the second patch, >> not sure if that was intentional. >> > > No worries. I applied this one as well. I was able to fix it with just > checkpatch --fix option. > Clarification. Applied 1/2 - I will wait for Brendan's ack on 2/2 thanks, -- Shuah