From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE44AC433ED for ; Fri, 2 Apr 2021 21:44:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B94761057 for ; Fri, 2 Apr 2021 21:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231443AbhDBVoy (ORCPT ); Fri, 2 Apr 2021 17:44:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229722AbhDBVox (ORCPT ); Fri, 2 Apr 2021 17:44:53 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E46F4C0613E6 for ; Fri, 2 Apr 2021 14:44:51 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id r17so5658290ilt.0 for ; Fri, 02 Apr 2021 14:44:51 -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=0Adice11UwmWvW+U6T9ZhShvoUX7I0FtvMtpHfXTd0g=; b=RbULyQYrBgZJQYCm10LOck1E5A+jgyKNlyofQgXi2+mN/UN2+r1i7PV4/z6oaj2VIy xkOUHWl0YOdc+O1oogQ2HJSsNwGom5/H/2Qzdsp4OmIaLw66UWvCWzocOguK/OcZ4DFe bFPXGnoqdv2YkrE9KtBII5vn8ho+AtQLiK7ws= 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=0Adice11UwmWvW+U6T9ZhShvoUX7I0FtvMtpHfXTd0g=; b=hLZFv2LnB0i7oBhCbDs6jWDksI6Ltl8QljYewKR/HduV5xtXgr3hXOR3g+zMV20itM LTKUodAtLVjiO9HsPoVJbhk608kFB6D1UaV0VoCPLz6QBs/uiGLu7levX5uFbmE9jetH i4+NG79VhpDkIlafliMDFHdlR1nlGH9xn+QuDX2VLRf/ztROJGZqcyt2qnUM4dQPHhJI 8wVYl8+BM33XMxc2TQg0oTbkTJk0g74qjFiCP+W7h/Nq0BXmd9R/iVxPK4tpvV1H8iZI iLBH/PFcpnliVsXCdb3SZwjEhDiqAvibXFS522QPbnYujpGqboX3hXm0972dVG/na1En n/3A== X-Gm-Message-State: AOAM530/11Fnc3MKxyUu24FFLjfVGZnpsadbvD5m5XoL7byq2ryUQ829 K6+vxKrencjwV1UNNPYmwzRh1g== X-Google-Smtp-Source: ABdhPJytJaIOHiSDTFJmyHb58wcqaOZ4L9OC6M6avxtkyA1Zu0/Ah94WieinYikzakIoLu3AZFizsw== X-Received: by 2002:a92:d382:: with SMTP id o2mr13044404ilo.94.1617399891285; Fri, 02 Apr 2021 14:44:51 -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 f9sm5111049iol.23.2021.04.02.14.44.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Apr 2021 14:44:50 -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> From: Shuah Khan Message-ID: <3774e8c7-4183-d627-8c53-16bdc0bed6eb@linuxfoundation.org> Date: Fri, 2 Apr 2021 15:44:50 -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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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. All set now. thanks, -- Shuah