<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/leds/led-test.c, branch linux-6.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.18.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.18.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2025-05-14T08:25:07Z</updated>
<entry>
<title>leds: led-test: Provide tests for the lookup and get infrastructure</title>
<updated>2025-05-14T08:25:07Z</updated>
<author>
<name>Lee Jones</name>
<email>lee@kernel.org</email>
</author>
<published>2025-05-01T08:19:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=cfa40f29df08c7ad296c81a2fac677830af83ec7'/>
<id>urn:sha1:cfa40f29df08c7ad296c81a2fac677830af83ec7</id>
<content type='text'>
This API allows providers to offer an specific LED to be looked-up by a
consumer.  Consumers are then able to describe the aforementioned LED
and take a reference on it.

For convenience, we're testing both sides of the API in just one test
function here.  In reality, both the provider and the consumer would be
logistically orthogonal.

CMD:
  tools/testing/kunit/kunit.py run --kunitconfig drivers/leds

RESULTS:
  [16:38:57] Configuring KUnit Kernel ...
  [16:38:57] Building KUnit Kernel ...
  Populating config with:
  $ make ARCH=um O=.kunit olddefconfig
  Building with:
  $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=20
  [16:39:02] Starting KUnit Kernel (1/1)...
  [16:39:02] ============================================================
  Running tests with:
  $ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
  [16:39:03] ===================== led (2 subtests) =====================
  [16:39:03] [PASSED] led_test_class_register
  [16:39:03] [PASSED] led_test_class_add_lookup_and_get
  [16:39:03] ======================= [PASSED] led =======================
  [16:39:03] ============================================================
  [16:39:03] Testing complete. Ran 2 tests: passed: 2
  [16:39:03] Elapsed time: 6.255s total, 0.001s configuring, 5.131s building, 1.106s running

Link: https://lore.kernel.org/r/20250501081918.3621432-3-lee@kernel.org
Signed-off-by: Lee Jones &lt;lee@kernel.org&gt;
</content>
</entry>
<entry>
<title>leds: led-test: Fill out the registration test to cover more test cases</title>
<updated>2025-05-14T08:25:06Z</updated>
<author>
<name>Lee Jones</name>
<email>lee@kernel.org</email>
</author>
<published>2025-05-01T08:19:12Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=eb58933b78cdad9b879dc2dd248e7284341a1cfc'/>
<id>urn:sha1:eb58933b78cdad9b879dc2dd248e7284341a1cfc</id>
<content type='text'>
Upon successful LED class device registration, it is expected that
certain attributes are filled out in pre-defined ways.  For instance, if
provided, the .brightness_get() call-back should be called to populate
the class device 'brightness' attribute, 'max_brightness' should be
initialised as LED_FULL (at least until we can rid these pesky enums)
and the sysfs group should be created with the class device name
supplied by the caller.

If subsequent registrations take place that would result in name
conflicts, various outcomes are expected depending on which flags are
set.  If LED_REJECT_NAME_CONFLICT is disabled, registration should
succeed resulting in an iteration on the provided name.  Conversely, if
it's enabled, then registration is expected to fail outright.

We test for all of these scenarios here.

Link: https://lore.kernel.org/r/20250501081918.3621432-2-lee@kernel.org
Signed-off-by: Lee Jones &lt;lee@kernel.org&gt;
</content>
</entry>
<entry>
<title>leds: led-test: Remove standard error checking after KUNIT_ASSERT_*()</title>
<updated>2025-05-14T08:25:05Z</updated>
<author>
<name>Lee Jones</name>
<email>lee@kernel.org</email>
</author>
<published>2025-05-01T08:19:11Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=1d7f25483c8791f395dd857cce8a6a65bcfa295f'/>
<id>urn:sha1:1d7f25483c8791f395dd857cce8a6a65bcfa295f</id>
<content type='text'>
If a KUNIT_ASSERT_*() call ends up in an assertion, the test is marked
as a failure and the subsequent error checking is never executed, making
it superfluous.  Remove it for simplicity and to avoid confusion.

Link: https://lore.kernel.org/r/20250501081918.3621432-1-lee@kernel.org
Signed-off-by: Lee Jones &lt;lee@kernel.org&gt;
</content>
</entry>
<entry>
<title>leds: Provide skeleton KUnit testing for the LEDs framework</title>
<updated>2025-05-14T08:25:02Z</updated>
<author>
<name>Lee Jones</name>
<email>lee@kernel.org</email>
</author>
<published>2025-04-24T14:45:38Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=5039a33fed8851fcf384fae2bcb8fd4858edd597'/>
<id>urn:sha1:5039a33fed8851fcf384fae2bcb8fd4858edd597</id>
<content type='text'>
Apply a very basic implementation of KUnit LED testing.

More tests / use-cases will be added steadily over time.

CMD:
  tools/testing/kunit/kunit.py run --kunitconfig drivers/leds

OUTPUT:
  [15:34:19] Configuring KUnit Kernel ...
  [15:34:19] Building KUnit Kernel ...
  Populating config with:
  $ make ARCH=um O=.kunit olddefconfig
  Building with:
  $ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=20
  [15:34:22] Starting KUnit Kernel (1/1)...
  [15:34:22] ============================================================
  Running tests with:
  $ .kunit/linux kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
  [15:34:23] ===================== led (1 subtest) ======================
  [15:34:23] [PASSED] led_test_class_register
  [15:34:23] ======================= [PASSED] led =======================
  [15:34:23] ============================================================
  [15:34:23] Testing complete. Ran 1 tests: passed: 1
  [15:34:23] Elapsed time: 4.268s total, 0.001s configuring, 3.048s building, 1.214s running

Link: https://lore.kernel.org/r/20250424144544.1438584-1-lee@kernel.org
Signed-off-by: Lee Jones &lt;lee@kernel.org&gt;
</content>
</entry>
</feed>
