Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1563743pxf; Fri, 2 Apr 2021 14:26:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb319phD8gimlG7D9iVf9M5XrltQrVGvjKRN5xKPXD//LsLVgB3KLshQTHha5wvj/gOPI0 X-Received: by 2002:a5e:8416:: with SMTP id h22mr12463239ioj.119.1617398798617; Fri, 02 Apr 2021 14:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617398798; cv=none; d=google.com; s=arc-20160816; b=KNKDGVJlkAT4N5oI1wACBmCLcBMWh/+j379xcmDrDTy6Q/q8dlGyv4QYF4fICkW2va En7UHMAJOYsP90lCLoaJQzk4xrKT9FI1PvA9hrqSlK5JJwRg/TOZqIk1sJ+VqoCp0veg 0VPjDHbWX8UZw6conTWs41wSW+BwwH+R52QpPdEGcJQnU9ClLa5KxcGmCRhmBkL6Uqzy MhPUOwIeRPTgyuD+kqMD3R+Q75kfsRV0Yn8njXkqLgMXaLHOjXvG2zzY8eW3bIPVZ4VR /bz8uTD3ld19Pfr9mF35KnOck/IO0Vd60tlqNiKIczaXXWxCI89ilihlGNHXEj80EiC3 L9WA== 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=M9rvBUxt0gD7J/4lPVmkW5NC9txJcpKPfeTcuPwhZrE=; b=DdtBlqaIpYYfp2CevBTFi7LA/RTHlMM/oyT1HLmqZHPrlh5v4FPsa2wQBzgKmmlMZR In6bV+3CiwsA0fElLEJUh3J1euikVE4GOmB2YW71mpf5bdHfCiEqIvdrGNGsM3SYYSDN jgKYc/7TEt+JKt1i/bN75xZYUuihmwdK0J1axSmj5x5YmDXsTwxSB6pYCjFeBzryfTzy fNfIF058AyxnZB0gCs236nG5uZJzIsFTMJii+A/kyeJStVtI8X5yXp7/W8prc8F7aOxD ytpXlxeFvINCu3gbnkkb1HEfY6Y9M7XPVwraGMNTEI8ycvfeVNhm5rgL6KBGsxoij0yc bWFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="IAS9s+W/"; 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 v3si10847110ilc.10.2021.04.02.14.26.24; Fri, 02 Apr 2021 14:26:38 -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=@google.com header.s=20161025 header.b="IAS9s+W/"; 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 S235392AbhDBVZP (ORCPT + 99 others); Fri, 2 Apr 2021 17:25:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235256AbhDBVZN (ORCPT ); Fri, 2 Apr 2021 17:25:13 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DA28C06178C for ; Fri, 2 Apr 2021 14:25:12 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id p8so1229698ilm.13 for ; Fri, 02 Apr 2021 14:25:12 -0700 (PDT) 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=M9rvBUxt0gD7J/4lPVmkW5NC9txJcpKPfeTcuPwhZrE=; b=IAS9s+W/KelcH9FuBLGV79jg3RBD5yGvJgOPiLqa5H2ENC9WE56t7KHhTKARkdCq4s nrUjlGcDeknGHHiHSXf31RMlCUm7UYHs/BnjnMhy0EWgeH9KpnnNSLlOJE5Q4Qr8OLwN 8NLNIn+7V5ZYtslSy5abpNiUJ+jHt2RaTgDWr0j3NWTqk89KKA+I7zJjHWbJIxUnZxUL TUcf8qxem91c49uxqRDrN2jLEZq7Gd6npHKc8tCgVxO6MVcGI8rMvoaICojGuDpUyTiS x6UcGDiqXdRp2yr2aMuyJ6woPc6faJgR16MTSiGLnjinGjZrfTvC0BsxZ5s98nHH4ydL yluA== 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=M9rvBUxt0gD7J/4lPVmkW5NC9txJcpKPfeTcuPwhZrE=; b=BW8cqLg2fa1xfynMaPearbxT4aW4OJ7GS6sBLU+WqPbZ7dP6kwpZigagPkyrCVSY5F w80laOgbnQ13ZfMQ2oYv4C0VvmaveC6n3+rtgPfvqRLhcSRtyyMWWzs/172s7N7XzWrI ddfC9pqPvaBCjYI0hLqyHG+R/+9i5SglanvAakorysvTV0y1u8eUu4x2nQ8+YE/Bj4c8 QUKaBYl9j1leInp7+6mRsrxXzELI73rRAFdJ9IEONPWzJfle9bT8BYDqoGNmJIb2pBkx r16OwQ8OVc5egLWThMm2Liw9pDgQWiLwbfOW9p7BLW2xJdFg6wfzn4Z3eWgo/HQUAlh1 9r2A== X-Gm-Message-State: AOAM530JMdo00SG8hVEcVlJO/ooetQNMrF5zhCeDVDlVBLuDbijKP1lo LxDq8w9wDjFvjNTIa8dmnoHXO/iC+zsIX2GnNXu52g== X-Received: by 2002:a92:c24c:: with SMTP id k12mr11813867ilo.75.1617398711588; Fri, 02 Apr 2021 14:25:11 -0700 (PDT) MIME-Version: 1.0 References: <20210311152314.3814916-1-dlatypov@google.com> <20210311152314.3814916-2-dlatypov@google.com> <16fe1cc0-5819-986d-9065-433a80783edb@linuxfoundation.org> In-Reply-To: <16fe1cc0-5819-986d-9065-433a80783edb@linuxfoundation.org> From: Daniel Latypov Date: Fri, 2 Apr 2021 14:25:00 -0700 Message-ID: Subject: Re: [PATCH v4 1/2] kunit: support failure from dynamic analysis tools To: Shuah Khan Cc: Brendan Higgins , David Gow , Alan Maguire , Linux Kernel Mailing List , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Uriel Guajardo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > thanks, > -- Shuah