[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <723c98e2-cf75-4565-b78b-711b3022d44d@igalia.com>
Date: Mon, 16 Jun 2025 09:49:46 -0300
From: Maíra Canal <mcanal@...lia.com>
To: Danilo Krummrich <dakr@...nel.org>,
Tvrtko Ursulin <tvrtko.ursulin@...lia.com>
Cc: Philipp Stanner <phasta@...nel.org>,
Matthew Brost <matthew.brost@...el.com>,
Christian König <ckoenig.leichtzumerken@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@....com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/sched/tests: Make timedout_job callback a better role
model
Hi Danilo,
On 16/06/25 08:14, Danilo Krummrich wrote:
> On Mon, Jun 16, 2025 at 11:57:47AM +0100, Tvrtko Ursulin wrote:
>> Code looks fine, but currently nothing is broken and I disagree with the
>> goal that the _mock_^1 components should be role models. The idea is to
>> implement as little in the mock components as it is required to exercise the
>> tested functionality.
>
> No, please consider the following.
>
> 1) When we write tests for common infrastructure we should be testing things
> as close as possible to how we intend real code to use this infrastructure.
> Relying on internals in creative ways is likely to underrun this testing.
Regarding unit testing (and KUnit is a unit testing framework), the core
principle is that individual components of the code should be tested in
isolation to validate that they perform as expected.
The "units" should be tested independently and we use those mocks to
simulate dependencies, ensuring that the test focuses solely on the unit
under scrutiny.
If we introduce more things into the mock, we end up losing the
isolation. The mock scheduler, from what I understand, is not suppose to
be a reference design or even something close to a driver. It should
remain just a mock, a minimal interface to test the scheduler's
internals.
Best Regards,
- Maíra
>
> 2) Being close to a reference design is a good thing, why wouldn't we want
> that? The reality is that people *will* look at this code for reference.
>
>> Also, there are various ways drivers use the scheduler API. Trying to make
>> the mock scheduler a reference driver implementation would only be able to
>> make it a reference for one possible use.
>
> Why? Nothing prevents us from covering all of them eventually.
>
> If for now, we just implement one of them, that's better than none, so why not?
Powered by blists - more mailing lists