mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 11:03:07 -04:00
firewire: core: add KUnit test skeleton for node tree
Some issues have been reported in node tree management. Refactoring the topology-related code in the core is required. Adding unit tests would help ensure that the refactoring does not introduce regressions. This commit adds a KUnit test skeleton for this purpose. Link: https://lore.kernel.org/r/20260810064119.410324-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
@@ -6,3 +6,4 @@ CONFIG_FIREWIRE_KUNIT_DEVICE_ATTRIBUTE_TEST=y
|
||||
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
|
||||
|
||||
@@ -81,6 +81,21 @@ config FIREWIRE_KUNIT_SELF_ID_SEQUENCE_HELPER_TEST
|
||||
For more information on KUnit and unit tests in general, refer
|
||||
to the KUnit documentation in Documentation/dev-tools/kunit/.
|
||||
|
||||
config FIREWIRE_KUNIT_NODE_TREE_TEST
|
||||
tristate "KUnit tests for node tree" if !KUNIT_ALL_TESTS
|
||||
depends on FIREWIRE && KUNIT
|
||||
default KUNIT_ALL_TESTS
|
||||
help
|
||||
This builds the KUnit tests for node tree.
|
||||
|
||||
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
|
||||
|
||||
@@ -507,3 +507,7 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(fw_core_handle_bus_reset);
|
||||
|
||||
#ifdef CONFIG_FIREWIRE_KUNIT_NODE_TREE_TEST
|
||||
#include "node-tree-test.c"
|
||||
#endif
|
||||
|
||||
19
drivers/firewire/node-tree-test.c
Normal file
19
drivers/firewire/node-tree-test.c
Normal file
@@ -0,0 +1,19 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
//
|
||||
// node-tree-test.c - An application of Kunit to test node tree.
|
||||
//
|
||||
// Copyright (c) 2026 Takashi Sakamoto
|
||||
//
|
||||
// This file can not be built independently since it is intentionally included in core-topology.c.
|
||||
|
||||
#include <kunit/test.h>
|
||||
|
||||
static struct kunit_case node_tree_test_cases[] = {
|
||||
{}
|
||||
};
|
||||
|
||||
static struct kunit_suite node_tree_test_suite = {
|
||||
.name = "firewire-node-tree",
|
||||
.test_cases = node_tree_test_cases,
|
||||
};
|
||||
kunit_test_suite(node_tree_test_suite);
|
||||
Reference in New Issue
Block a user