Skip to content

Commit

Permalink
Merge branch 'mctp-kunit-tests'
Browse files Browse the repository at this point in the history
Jeremy Kerr says:

====================
MCTP kunit tests

This change adds some initial kunit tests for the MCTP core. We'll
expand the coverage in a future series, and augment with a few
selftests, but this establishes a baseline set of tests for now.

Thanks to the kunit folks for the framework!

---

v2:
 - fix MCTP=m, KUNIT={y,m} breakage
 - fix mctp test netdev initialisation
 - strict route reference count checking
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 3, 2021
2 parents b8aa165 + 1e5e925 commit 0693b27
Show file tree
Hide file tree
Showing 6 changed files with 644 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/mctp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ menuconfig MCTP
This option enables core MCTP support. For communicating with other
devices, you'll want to enable a driver for a specific hardware
channel.

config MCTP_TEST
bool "MCTP core tests" if !KUNIT_ALL_TESTS
depends on MCTP=y && KUNIT=y
default KUNIT_ALL_TESTS
3 changes: 3 additions & 0 deletions net/mctp/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_MCTP) += mctp.o
mctp-objs := af_mctp.o device.o route.o neigh.o

# tests
obj-$(CONFIG_MCTP_TEST) += test/utils.o
5 changes: 5 additions & 0 deletions net/mctp/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/idr.h>
#include <linux/kconfig.h>
#include <linux/mctp.h>
#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
Expand Down Expand Up @@ -1228,3 +1229,7 @@ void __exit mctp_routes_exit(void)
rtnl_unregister(PF_MCTP, RTM_GETROUTE);
dev_remove_pack(&mctp_packet_type);
}

#if IS_ENABLED(CONFIG_MCTP_TEST)
#include "test/route-test.c"
#endif
Loading

0 comments on commit 0693b27

Please sign in to comment.