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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 16F8CC433DB for ; Wed, 10 Feb 2021 01:05:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C54ED64DD1 for ; Wed, 10 Feb 2021 01:05:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234273AbhBJBFi (ORCPT ); Tue, 9 Feb 2021 20:05:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234387AbhBIWYt (ORCPT ); Tue, 9 Feb 2021 17:24:49 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 826CCC061A2A for ; Tue, 9 Feb 2021 14:21:47 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id p15so50723ilq.8 for ; Tue, 09 Feb 2021 14:21:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dVB7ZPJgZD0gpsdinXm4ggMxiYerGmhY62XEYI3Nvq8=; b=MxNbW+PSVA9TGA1dcXUzDd9bAT7WKBNgXyxHyeswIk6TSdAUod8lXC/nWOMXa979O/ xBxNNaElu7TdqiVNrY0TRFzj9jrwd3DdFBtJ48YlJrKoYVQGKsMGZYw1l7akRl14XWpL t7b95PSVF8yxQloGrXMTYycD3J5vKU/hme/z/rF4fOpv9eqK3JmSPu+MC0b2anLybZyN c2/vW44wOhfTXH6SKcrxC/Xcb5cWTh0equ1x4Rs0IGRxPC3QtVEEpwMmokOkOw8ALJRK klH/MzllIuuySzxIaiqaCHjRwC7o6ooA1bm+hwuPmvhNYrbbp0GLBSNflkJDJ1EbkUkP ZJnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dVB7ZPJgZD0gpsdinXm4ggMxiYerGmhY62XEYI3Nvq8=; b=tJgDZS/r4yspQi6b8sCrX4hlwRkRBUGFYQzEaFje4ZA90sl8tAyTow9AzTHK+C+Lce 7CN1AGSZ0LNx+1T4AStf921sebTiZwYF1C9C4OLYFGeeAmm0kqqBGDzdNK84Av37f3Cp mbHPL8JmDVH333FSOat6rMdgC44cwZ7FcXlc1eJ/+5xby9XRoZ7mF4J+laHikQL4k7kH l/P9tpf7PYBpNBtsmV31vBRvpC1FO719XIR8dPvw7XVt2pum/vKv+eSc+MdNpsRzCPZ/ imliO0j8uLaBqzlEYw19AX06QDkAfnOBKV+hrOAdphJte2I5c38gBsfyTmvb1/ufID5b /6OQ== X-Gm-Message-State: AOAM530vntE6WzRXk6GtHYAISO0enegSY6dFAO5Cxyk7RfTKxSLZvRP4 RqsxuU75bHyyJ+7yilA8zI72IsiJXC6RB4b6CWessQ== X-Google-Smtp-Source: ABdhPJx5q2ZQo4k+YcVYi75bqEuxPbjDvIIaQC9E/n5oSuLoAlRW92mjRhtm3o1vU+aF/DAthpqhJ/Ny5hmX7n+FGqA= X-Received: by 2002:a92:cda6:: with SMTP id g6mr175127ild.274.1612909306850; Tue, 09 Feb 2021 14:21:46 -0800 (PST) MIME-Version: 1.0 References: <20210205235302.2022784-1-dlatypov@google.com> <20210205235302.2022784-2-dlatypov@google.com> In-Reply-To: From: Daniel Latypov Date: Tue, 9 Feb 2021 14:21:35 -0800 Message-ID: Subject: Re: [PATCH v2 1/2] kunit: support failure from dynamic analysis tools To: Alan Maguire Cc: Brendan Higgins , David Gow , Linux Kernel Mailing List , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan , Uriel Guajardo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 9, 2021 at 2:12 PM Alan Maguire wrote: > > On Tue, 9 Feb 2021, Daniel Latypov wrote: > > > On Tue, Feb 9, 2021 at 9:26 AM Alan Maguire wrote: > > > > > > On Fri, 5 Feb 2021, 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 > > > > > > > > > > Thanks for doing this! > > > > > > > * Declare it as a function for nice __printf() warnings about mismatched > > > > format strings even when KUnit is not enabled. > > > > > > > > > > One thing I _think_ this assumes is that KUnit is builtin; > > > don't we need an > > > > Ah, you're correct. > > Also going to rename it to have two _ to match other functions used in > > macros like __kunit_test_suites_init. > > > > Great! If you're sending out an updated version with these > changes, feel free to add > > Reviewed-by: Alan Maguire Oops, there was a race in sending v3 and seeing this in my inbox. If you could reply to the v3 that'd be great. I've already amended the commit locally. Thanks!