[PATCH 00/13] firewire: core: add KUnit tests for config ROM parser and generator

Takashi Sakamoto posted 13 patches 3 weeks, 3 days ago
drivers/firewire/.kunitconfig                |   1 +
drivers/firewire/Kconfig                     |  16 +
drivers/firewire/config-rom-generator-test.c | 407 +++++++++++++++++++
drivers/firewire/config-rom-parser-test.c    | 355 ++++++++++++++++
drivers/firewire/core-card.c                 |   4 +
drivers/firewire/core-device.c               |   4 +
drivers/firewire/core-transaction.c          |   4 +
7 files changed, 791 insertions(+)
create mode 100644 drivers/firewire/config-rom-generator-test.c
create mode 100644 drivers/firewire/config-rom-parser-test.c
[PATCH 00/13] firewire: core: add KUnit tests for config ROM parser and generator
Posted by Takashi Sakamoto 3 weeks, 3 days ago
Hi,

(Resent because the previous email was sent to the wrong address...)

This series adds KUnit tests for the configuration ROM parser and
generator in the core function.

The parser tests cover existing device quirks and malformed configuration
ROMs, including out-of-bounds directory/leaf entries.

The generator tests cover AV/C and IIDC devices layouts, combinations of
units, and invalid or oversized extension data.

The tests are intended to document existing behavior and provide regression
coverage for the parser and generator.

The test execution samples:

```
$ python3 tools/testing/kunit/kunit.py run \
  --kunitconfig=drivers/firewire/ \
  'firewire-config-rom-*'
[22:12:56] Configuring KUnit Kernel ...
[22:12:56] 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=16
[22:12:59] Starting KUnit Kernel (1/1)...
[22:12:59] ============================================================
Running tests with:
$ .kunit/linux 'kunit.filter_glob=firewire-config-rom-*' kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[22:12:59] ======== firewire-config-rom-generator (4 subtests) ========
[22:12:59] ================ test_config_rom_generator  ================
[22:12:59] [PASSED] bare
[22:12:59] [PASSED] with_avc_unit
[22:12:59] [PASSED] with_iidc_unit
[22:12:59] [PASSED] with_avc_and_iidc_unit
[22:12:59] ============ [PASSED] test_config_rom_generator ============
[22:12:59] [PASSED] add_descriptor_with_invalid_length
[22:12:59] [PASSED] add_descriptor_with_invalid_data
[22:12:59] [PASSED] add_descriptor_beyond_upper_limit
[22:12:59] ========== [PASSED] firewire-config-rom-generator ==========
[22:12:59] ========= firewire-config-rom-parser (2 subtests) ==========
[22:12:59] ============= test_parser_with_regular_cases  ==============
[22:12:59] [PASSED] detect_irm_is_1394_1995_only_quirk
[22:12:59] [PASSED] detect_irm_ignores_bus_manager_quirk
[22:12:59] [PASSED] detect_ack_packet_with_invalid_pending_code_quirk
[22:12:59] [PASSED] detect_unstable_at_s400_quirk
[22:12:59] ========= [PASSED] test_parser_with_regular_cases ==========
[22:12:59] [PASSED] test_parser_with_overflowed_case
[22:12:59] =========== [PASSED] firewire-config-rom-parser ============
[22:12:59] ============================================================
[22:12:59] Testing complete. Ran 12 tests: passed: 12
[22:12:59] Elapsed time: 2.743s total, 0.001s configuring, 2.625s building, 0.085s running
```

Regards


Takashi Sakamoto (13):
  firewire: core: add KUnit test skeleton for config ROM parser and
    generator
  firewire: core: add test to detect irm-is-1394-1995-only quirk in
    config ROM parser
  firewire: core: add test to detect irm-ignores-bus-manager quirk in
    config ROM parser
  firewire: core: add test to detect
    ack-packet-with-invalid-pending-code quirk in config ROM parser
  firewire: core: add test to detect unstable-at-s400 quirk in config
    ROM parser
  firewire: core: add test to avoid excessive configuration ROM length
  firewire: core: add test for root directory generation in config ROM
    generator
  firewire: core: add test to generate with AV/C unit in config ROM
    generator
  firewire: core: add test to generate with IIDC unit in config ROM
    generator
  firewire: core: add test to generate with both AV/C and IIDC units in
    config ROM generator
  firewire: core: add test for invalid length in config ROM generator
  firewire: core: add invalid block test for config ROM generator
  firewire: core: add test for beyond-boundary case in config ROM
    generator

 drivers/firewire/.kunitconfig                |   1 +
 drivers/firewire/Kconfig                     |  16 +
 drivers/firewire/config-rom-generator-test.c | 407 +++++++++++++++++++
 drivers/firewire/config-rom-parser-test.c    | 355 ++++++++++++++++
 drivers/firewire/core-card.c                 |   4 +
 drivers/firewire/core-device.c               |   4 +
 drivers/firewire/core-transaction.c          |   4 +
 7 files changed, 791 insertions(+)
 create mode 100644 drivers/firewire/config-rom-generator-test.c
 create mode 100644 drivers/firewire/config-rom-parser-test.c


base-commit: 61defa04bf0578ff9f7a52a8c74a9cb5acd8fced
-- 
2.53.0
Re: [PATCH 00/13] firewire: core: add KUnit tests for config ROM parser and generator
Posted by Takashi Sakamoto 3 weeks, 2 days ago
Hi,

On Tue, Sep 01, 2026 at 10:45:21PM +0900, Takashi Sakamoto wrote:
> Hi,
> 
> (Resent because the previous email was sent to the wrong address...)
> 
> This series adds KUnit tests for the configuration ROM parser and
> generator in the core function.
> 
> The parser tests cover existing device quirks and malformed configuration
> ROMs, including out-of-bounds directory/leaf entries.
> 
> The generator tests cover AV/C and IIDC devices layouts, combinations of
> units, and invalid or oversized extension data.
> 
> The tests are intended to document existing behavior and provide regression
> coverage for the parser and generator.
> 
> The test execution samples:
> 
> ```
> $ python3 tools/testing/kunit/kunit.py run \
>   --kunitconfig=drivers/firewire/ \
>   'firewire-config-rom-*'
> [22:12:56] Configuring KUnit Kernel ...
> [22:12:56] 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=16
> [22:12:59] Starting KUnit Kernel (1/1)...
> [22:12:59] ============================================================
> Running tests with:
> $ .kunit/linux 'kunit.filter_glob=firewire-config-rom-*' kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
> [22:12:59] ======== firewire-config-rom-generator (4 subtests) ========
> [22:12:59] ================ test_config_rom_generator  ================
> [22:12:59] [PASSED] bare
> [22:12:59] [PASSED] with_avc_unit
> [22:12:59] [PASSED] with_iidc_unit
> [22:12:59] [PASSED] with_avc_and_iidc_unit
> [22:12:59] ============ [PASSED] test_config_rom_generator ============
> [22:12:59] [PASSED] add_descriptor_with_invalid_length
> [22:12:59] [PASSED] add_descriptor_with_invalid_data
> [22:12:59] [PASSED] add_descriptor_beyond_upper_limit
> [22:12:59] ========== [PASSED] firewire-config-rom-generator ==========
> [22:12:59] ========= firewire-config-rom-parser (2 subtests) ==========
> [22:12:59] ============= test_parser_with_regular_cases  ==============
> [22:12:59] [PASSED] detect_irm_is_1394_1995_only_quirk
> [22:12:59] [PASSED] detect_irm_ignores_bus_manager_quirk
> [22:12:59] [PASSED] detect_ack_packet_with_invalid_pending_code_quirk
> [22:12:59] [PASSED] detect_unstable_at_s400_quirk
> [22:12:59] ========= [PASSED] test_parser_with_regular_cases ==========
> [22:12:59] [PASSED] test_parser_with_overflowed_case
> [22:12:59] =========== [PASSED] firewire-config-rom-parser ============
> [22:12:59] ============================================================
> [22:12:59] Testing complete. Ran 12 tests: passed: 12
> [22:12:59] Elapsed time: 2.743s total, 0.001s configuring, 2.625s building, 0.085s running
> ```
> 
> Regards
> 
> 
> Takashi Sakamoto (13):
>   firewire: core: add KUnit test skeleton for config ROM parser and
>     generator
>   firewire: core: add test to detect irm-is-1394-1995-only quirk in
>     config ROM parser
>   firewire: core: add test to detect irm-ignores-bus-manager quirk in
>     config ROM parser
>   firewire: core: add test to detect
>     ack-packet-with-invalid-pending-code quirk in config ROM parser
>   firewire: core: add test to detect unstable-at-s400 quirk in config
>     ROM parser
>   firewire: core: add test to avoid excessive configuration ROM length
>   firewire: core: add test for root directory generation in config ROM
>     generator
>   firewire: core: add test to generate with AV/C unit in config ROM
>     generator
>   firewire: core: add test to generate with IIDC unit in config ROM
>     generator
>   firewire: core: add test to generate with both AV/C and IIDC units in
>     config ROM generator
>   firewire: core: add test for invalid length in config ROM generator
>   firewire: core: add invalid block test for config ROM generator
>   firewire: core: add test for beyond-boundary case in config ROM
>     generator
> 
>  drivers/firewire/.kunitconfig                |   1 +
>  drivers/firewire/Kconfig                     |  16 +
>  drivers/firewire/config-rom-generator-test.c | 407 +++++++++++++++++++
>  drivers/firewire/config-rom-parser-test.c    | 355 ++++++++++++++++
>  drivers/firewire/core-card.c                 |   4 +
>  drivers/firewire/core-device.c               |   4 +
>  drivers/firewire/core-transaction.c          |   4 +
>  7 files changed, 791 insertions(+)
>  create mode 100644 drivers/firewire/config-rom-generator-test.c
>  create mode 100644 drivers/firewire/config-rom-parser-test.c

Applied to for-next branch.


Regards

Takashi Sakamoto