[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOS=77WFFV1Xu5vQD6DPJODRr0f+qxJTRgJWS0qobv6vDaA@mail.gmail.com>
Date: Thu, 5 May 2022 07:47:03 +0800
From: David Gow <davidgow@...gle.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Daniel Latypov <dlatypov@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>,
Brendan Higgins <brendanhiggins@...gle.com>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
KUnit Development <kunit-dev@...glegroups.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kunit: take `kunit_assert` as `const`
On Thu, May 5, 2022 at 3:26 AM Miguel Ojeda
<miguel.ojeda.sandonis@...il.com> wrote:
>
> Hi David,
>
> On Wed, May 4, 2022 at 4:05 PM David Gow <davidgow@...gle.com> wrote:
> >
> > I definitely agree here -- I can't recall any particular plan that
> > would require this to be non-const, and we can always change it back
> > if we really need to.
>
> That is good to know, thanks! Out-of-tree users can always be a surprise... :)
>
> > Very exciting! I assume that's the PR here:
> > https://github.com/Rust-for-Linux/linux/pull/757
>
> Indeed! I hope you like it -- we are taking the documentation tests in
> Rust (which are a very lightweight way of writing examples which
> double as tests) and generating KUnit test cases on the fly. For the
> moment it is just for the `kernel` crate, but the idea is to
> generalize it for modules etc.
>
> By the way, since you saw the PR... do you know if KUnit relies (or
> will rely) on "stack-dumping" functions like `longjmp`?
I don't think so -- though there's no fundamental individual tests
couldn't use them if it made sense for them.
KUnit spins off a new kthread per test, and uses
kthread_complete_and_exit() to unwind when an assertion fails. See
lib/kunit/try-catch.c for the actual implementation. The only really
dodgy bit is the test timeout support, which attempts to stop a thread
with kthread_stop(), and IIRC has some problems.
Hope that helps!
-- David
Powered by blists - more mailing lists