Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp931458pxb; Tue, 9 Feb 2021 17:06:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcMv2DW2dGqYXpl3pRANtZ3zFTwylkqD+one/RgPY8UipsIJpb0PVf2kPWP39e3xgl6XrH X-Received: by 2002:aa7:dbd4:: with SMTP id v20mr883791edt.330.1612919184930; Tue, 09 Feb 2021 17:06:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612919184; cv=none; d=google.com; s=arc-20160816; b=NEF2+ZsYCzXJQOMbvVSCnWRb0ddIMI27gOwYxHlwFpb84yKnjSnI6kVIPRcnHnzC7a F0ufw73YMvlfdiZl+Kpyq/Tixip41sZpsWF+m9uEumb1Gls0fWgPkqKEp6xHjphNLN16 vrVHW968uwwqLDBPG4usPnrBjsvTTPfpc80aumf1vtTJQmd5pwSkxoi0p9MSqALELstp uW38/plsFdbuZqFZcKYpWJQ6Dw15kEv79ryZgKf8vbqSfuCDFoZLm87M/BMpoX5Gvwlh +sCTQznXDQKE2TaJ7JYDMYDm5QkGqBfeLhniel9usFd57CgHxPD7xzq2i/NDwXYGvW8T BuCg== 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=dVB7ZPJgZD0gpsdinXm4ggMxiYerGmhY62XEYI3Nvq8=; b=JJfpqoEu21ncuo7Kgis5WLt7UUusAT/MBlMs0YSP0tFHT6ALxgd9AaKz5WCfukn67v uOq5jE2T7GyxKe/s22Nsci21Fyn7jjBwLrO4JcVoWj3G0P4x1e9+qg0MTSXdj7GmzuZJ PFL3THz6zo6QmpoTX62G9Bv6VJ99UdRIMrRsCzpBjiP/yFziEJJgFKkvM4CcryHq9qwK WyPTGyQQ0bxGneW6jbGcuhDmOx5k9LAn0DYsKXIv1JYdwpCN+wUMlz1KOtw3I4Wi7CK+ tE4lBhYXLGmRgGvpWkheFn405RQbiNa3rvWnUclA5vM4HhCtGhbTUbKRYmO31ay6d++P G1lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MxNbW+PS; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jl7si194957ejc.746.2021.02.09.17.06.01; Tue, 09 Feb 2021 17:06:24 -0800 (PST) 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=@google.com header.s=20161025 header.b=MxNbW+PS; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233874AbhBJBFR (ORCPT + 99 others); Tue, 9 Feb 2021 20:05:17 -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-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!