From: Shuah Khan <skhan@linuxfoundation.org>
To: Brendan Higgins <brendanhiggins@google.com>,
Daniel Latypov <dlatypov@google.com>
Cc: David Gow <davidgow@google.com>,
Alan Maguire <alan.maguire@oracle.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
KUnit Development <kunit-dev@googlegroups.com>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
Uriel Guajardo <urielguajardo@google.com>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v4 1/2] kunit: support failure from dynamic analysis tools
Date: Fri, 2 Apr 2021 11:53:03 -0600 [thread overview]
Message-ID: <16fe1cc0-5819-986d-9065-433a80783edb@linuxfoundation.org> (raw)
In-Reply-To: <CAFd5g46fy_9mPH6AihwUf5GW7aTJ=ecvmD0S266EKtNtweSOcg@mail.gmail.com>
On 4/2/21 2:55 AM, Brendan Higgins wrote:
> On Thu, Mar 11, 2021 at 7:23 AM Daniel Latypov <dlatypov@google.com> wrote:
>>
>> From: Uriel Guajardo <urielguajardo@google.com>
>>
>> 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 <kunit/test-bug.h> so non-test code doesn't have
>> to include all of <kunit/test.h> (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 <dlatypov@google.com>
>> Signed-off-by: Daniel Latypov <dlatypov@google.com>
>> Signed-off-by: Uriel Guajardo <urielguajardo@google.com>
>> Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
>
> Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
>
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
next prev parent reply other threads:[~2021-04-02 17:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 15:23 [PATCH v4 0/2] kunit: fail tests on UBSAN errors Daniel Latypov
2021-03-11 15:23 ` [PATCH v4 1/2] kunit: support failure from dynamic analysis tools Daniel Latypov
2021-04-02 8:55 ` Brendan Higgins
2021-04-02 17:53 ` Shuah Khan [this message]
2021-04-02 21:25 ` Daniel Latypov
2021-04-02 21:44 ` Shuah Khan
2021-04-02 21:47 ` Shuah Khan
2021-03-11 15:23 ` [PATCH v4 2/2] kunit: ubsan integration Daniel Latypov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16fe1cc0-5819-986d-9065-433a80783edb@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=alan.maguire@oracle.com \
--cc=brendanhiggins@google.com \
--cc=davidgow@google.com \
--cc=dlatypov@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=urielguajardo@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).