mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
firewire: core: add KUnit test skeleton for config ROM parser and generator
In IEEE 1394, all devices on the bus are required to provide structured data in response to requests to a specific range of their address space. This structured data is called configuration ROM and is defined in IEEE 1212. The core function of this subsystem contains the generator and parser for the configuration ROM. The generator constructs the configuration ROM for the local host node, while the parser interprets the configuration ROM of detected nodes. Both the generator and parser are fundamental to identifying the node capabilities. Add KUnit test skeletons for testing their implementations. Link: https://lore.kernel.org/r/20260901134534.2386577-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
parent
53f839d09a
commit
428ef9ca38
|
|
@ -7,3 +7,4 @@ CONFIG_FIREWIRE_KUNIT_PACKET_SERDES_TEST=y
|
|||
CONFIG_FIREWIRE_KUNIT_SELF_ID_SEQUENCE_HELPER_TEST=y
|
||||
CONFIG_FIREWIRE_KUNIT_OHCI_SERDES_TEST=y
|
||||
CONFIG_FIREWIRE_KUNIT_NODE_TREE_TEST=y
|
||||
CONFIG_FIREWIRE_KUNIT_CONFIG_ROM_PARSER_AND_GENERATOR_TEST=y
|
||||
|
|
|
|||
|
|
@ -96,6 +96,22 @@ config FIREWIRE_KUNIT_NODE_TREE_TEST
|
|||
For more information on KUnit and unit tests in general, refer
|
||||
to the KUnit documentation in Documentation/dev-tools/kunit/.
|
||||
|
||||
config FIREWIRE_KUNIT_CONFIG_ROM_PARSER_AND_GENERATOR_TEST
|
||||
tristate "KUnit tests for config ROM parser and generator" if !KUNIT_ALL_TESTS
|
||||
depends on FIREWIRE && KUNIT
|
||||
default KUNIT_ALL_TESTS
|
||||
help
|
||||
This builds the KUnit tests to check parser and generator for
|
||||
configuration ROM content defined in IEEE 1212.
|
||||
|
||||
KUnit tests run during boot and output the results to the debug
|
||||
log in TAP format (https://testanything.org/). Only useful for
|
||||
kernel devs running KUnit test harness and are not for inclusion
|
||||
into a production build.
|
||||
|
||||
For more information on KUnit and unit tests in general, refer
|
||||
to the KUnit documentation in Documentation/dev-tools/kunit/.
|
||||
|
||||
config FIREWIRE_OHCI
|
||||
tristate "OHCI-1394 controllers"
|
||||
depends on PCI && FIREWIRE
|
||||
|
|
|
|||
19
drivers/firewire/config-rom-generator-test.c
Normal file
19
drivers/firewire/config-rom-generator-test.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
//
|
||||
// config-rom-generator-test.c - An application of Kunit to test configuration ROM generator.
|
||||
//
|
||||
// Copyright (c) 2026 Takashi Sakamoto
|
||||
//
|
||||
// This file can not be built independently since it is intentionally included in core-card.c.
|
||||
|
||||
#include <kunit/test.h>
|
||||
|
||||
static struct kunit_case config_rom_generator_test_cases[] = {
|
||||
{}
|
||||
};
|
||||
|
||||
static struct kunit_suite config_rom_generator_test_suite = {
|
||||
.name = "firewire-config-rom-generator",
|
||||
.test_cases = config_rom_generator_test_cases,
|
||||
};
|
||||
kunit_test_suite(config_rom_generator_test_suite);
|
||||
19
drivers/firewire/config-rom-parser-test.c
Normal file
19
drivers/firewire/config-rom-parser-test.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
//
|
||||
// config-rom-parser-test.c - An application of Kunit to test configuration ROM parser.
|
||||
//
|
||||
// Copyright (c) 2026 Takashi Sakamoto
|
||||
//
|
||||
// This file can not be built independently since it is intentionally included in core-device.c.
|
||||
|
||||
#include <kunit/test.h>
|
||||
|
||||
static struct kunit_case config_rom_parser_test_cases[] = {
|
||||
{}
|
||||
};
|
||||
|
||||
static struct kunit_suite config_rom_parser_test_suite = {
|
||||
.name = "firewire-config-rom-parser",
|
||||
.test_cases = config_rom_parser_test_cases,
|
||||
};
|
||||
kunit_test_suite(config_rom_parser_test_suite);
|
||||
|
|
@ -851,3 +851,7 @@ int fw_card_read_cycle_time(struct fw_card *card, u32 *cycle_time)
|
|||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fw_card_read_cycle_time);
|
||||
|
||||
#ifdef CONFIG_FIREWIRE_KUNIT_CONFIG_ROM_PARSER_AND_GENERATOR_TEST
|
||||
#include "config-rom-generator-test.c"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1442,3 +1442,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
|
|||
#ifdef CONFIG_FIREWIRE_KUNIT_DEVICE_ATTRIBUTE_TEST
|
||||
#include "device-attribute-test.c"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FIREWIRE_KUNIT_CONFIG_ROM_PARSER_AND_GENERATOR_TEST
|
||||
#include "config-rom-parser-test.c"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user