Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1455885pxf; Fri, 2 Apr 2021 10:56:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNEQnHhecke1nDCgRoXVyA/q+caK9Uj+qhQ7zfePXXO9rpYY/a1dr72K6TMjn1UThTmQ3W X-Received: by 2002:a17:906:9501:: with SMTP id u1mr15465548ejx.324.1617386167264; Fri, 02 Apr 2021 10:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617386167; cv=none; d=google.com; s=arc-20160816; b=dC+EN1D8fxweEFMDshXEUg+ua9mSKlTqKPa/eEij1Ts6R2pZlPT01LBnMeamCeN/Pp eAecTj2jPhMfaU8wZbvj7acpqxpyCrLueB3JifaFOjmM+QZBkN6LbLwRFVE6R4vIuQC0 6qsKcBj29disNkVdzpK8KHKrzIRJXOM80dskE4JzzUgVm2BbheWEPU/0+FmUIXH4jE0E CVATX/ht6QvXh3KgwZZgpDKCtdljwRndRcCUSrLs0asquLmzDoCjjHhMsvFhWNh6Rt/F XW9/7/++dDI5fZDqJPvzzF3+A/c3p3Wk2KVoDR9JzpdTxGGpapGUdmLJHT65KnaDdOYb isig== 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=whRXq76gjLJkPVfSKotV9dDdRpnCQB8vQShEk4qBurw=; b=VGSKWLUqvjPmxaYKyzL72B2w12NoFUukYxkvYywHE2I3gFZPsbsdeheFgyazfeXPC4 F+6t9HQDhomPlqa8JFgfJ+1pnUuqzR5PoW5AxW5wv4+CSxRHGH36WPomGmRzylQgYhQJ tJdwLg416zBRWxFcaCnezsAc+rURDOydCn6ZxEf0m/zMLU7SaOHQ/g2/N99VpKC7HzFI 1fUvqd1gPFmr7wZJWNA3xQln9VezOPIX3VGrZ8CDnaintuAZwNCoCysXr38K+nt8zSM6 yh3jkZmdh2kyZTvFzqZX1fpROPJ6fmYbZqtSSUXibwpW2pTMeABdK0vKEedPnmIFousF JE9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=F6SYbw6f; 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 i15si6965120ejv.550.2021.04.02.10.55.44; Fri, 02 Apr 2021 10:56:07 -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=F6SYbw6f; 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 S235248AbhDBRxH (ORCPT + 99 others); Fri, 2 Apr 2021 13:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235111AbhDBRxG (ORCPT ); Fri, 2 Apr 2021 13:53:06 -0400 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 246BFC061788 for ; Fri, 2 Apr 2021 10:53:05 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id b10so6064120iot.4 for ; Fri, 02 Apr 2021 10:53:05 -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=whRXq76gjLJkPVfSKotV9dDdRpnCQB8vQShEk4qBurw=; b=F6SYbw6faTLWfI73meZgPfreP/nqSXtNQdx6iM1rVNVXrfabL9IhrVJ4FEOEYh60n0 F9G4345qX6aHJLhkwVqs/kHbWZaPG7iyykKqgO3E8BBog5ljCjILCfRpcgaU7M+F8sy/ UtWs5D2FQVzAGJG+mNgMPimOstbPg4rdg3T8I= 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=whRXq76gjLJkPVfSKotV9dDdRpnCQB8vQShEk4qBurw=; b=D3olwo+aXkKji5lWCrA4R1gmDhklpJul9WrbRvuDipqxU92nRxfyP7gBezRanZvNB6 opskEXDrOQp4XSbvETsw03zmsUNy3emuG73t1sm/EbWBM712qDH3320SN7L9R40T7HFa HYEl95WeZDPh5809rDv20QCG1ua0GEpir/vsExUe08gtQ2pYiixv/l+074KGShPTpCAB IaBLF0D3c4PZ4HjwJA/qlZCxWWbjJ62XXoWCEKFSnAOqatdhQcY6iqUOI3rQ1rXTqkg/ e1GWEqM8DyDjAcN/bMmH9UEMDtdrwNaHr9zloqghWVgz6tqxaEHrPefv0SVQcOuR7aC5 fbHA== X-Gm-Message-State: AOAM530XOkARNPCf9tKZgCagRHwva0g8P2XdSsS+4YoMPidyf4U1SqAx goudVWCoQq0yGoTtgTGYTBUMUg== X-Received: by 2002:a5e:980e:: with SMTP id s14mr12260386ioj.63.1617385984539; Fri, 02 Apr 2021 10:53:04 -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 b9sm4848319iob.4.2021.04.02.10.53.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Apr 2021 10:53:04 -0700 (PDT) Subject: Re: [PATCH v4 1/2] kunit: support failure from dynamic analysis tools To: Brendan Higgins , Daniel Latypov Cc: 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> From: Shuah Khan Message-ID: <16fe1cc0-5819-986d-9065-433a80783edb@linuxfoundation.org> Date: Fri, 2 Apr 2021 11:53:03 -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-kernel@vger.kernel.org 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, -- Shuah