Bluetooth: Add support for self testing framework
Subsystems (2)
Marcel Holtmann
maintainerRFC 1/2 Bluetooth: Add support for self testing framework
This add support for the Bluetooth self testing framework that allows running certain test cases of sample data to ensure correctness of its basic functionality.
With this patch only the basic framework will be added. It contains the build magic that allows running this at module loading time or at late_initcall stage when built into the kernel image.
--- net/bluetooth/Kconfig | 13 ++++++++++ net/bluetooth/Makefile | 2 ++ net/bluetooth/af_bluetooth.c | 6 +++++ net/bluetooth/selftest.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ net/bluetooth/selftest.h | 45 ++++++++++++++++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 net/bluetooth/selftest.c create mode 100644 net/bluetooth/selftest.h
net/bluetooth/Kconfig +13 -0
@@ -64,4 +64,17 @@ config BT_6LOWPAN help IPv6 compression over Bluetooth Low Energy. +config BT_SELFTEST + bool "Bluetooth self testing support" + depends on BT && DEBUG_KERNEL + help + Run self tests when initializing the Bluetooth subsystem. This + is a developer option and can cause significant delay when booting + the system. + + When the Bluetooth subsystem is built as module, then the test + cases are run first thing at module load time. When the Bluetooth + subsystem is compiled into the kernel image, then the test cases + are run late in the initcall hierarchy. + source "drivers/bluetooth/Kconfig"
net/bluetooth/Makefile +2 -0
@@ -15,4 +15,6 @@ bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \ hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \ a2mp.o amp.o ecc.o hci_request.o hci_debugfs.o +bluetooth-$(CONFIG_BT_SELFTEST) += selftest.o + subdir-ccflags-y += -D__CHECK_ENDIAN__
net/bluetooth/af_bluetooth.c +6 -0
@@ -31,6 +31,8 @@#include <net/bluetooth/bluetooth.h> #include <linux/proc_fs.h> +#include "selftest.h" +#define VERSION "2.20"/* Bluetooth sockets */
@@ -716,6 +718,10 @@ static int __init bt_init(void)BT_INFO ("Core ver %s" ,VERSION ); + err =bt_selftest (); +if (err <0 ) +return err; + bt_debugfs =debugfs_create_dir ("bluetooth" ,NULL ); err =bt_sysfs_init ();
net/bluetooth/selftest.c new file +62 -0
62 lines not on this page · raw message
net/bluetooth/selftest.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.1.0
Hi Marcel,
Quoted 9 lines · Marcel Holtmann
This add support for the Bluetooth self testing framework that allows running certain test cases of sample data to ensure correctness of its basic functionality.
With this patch only the basic framework will be added. It contains the build magic that allows running this at module loading time or at
late_initcallstage when built into the kernel image.Signed-off-by Marcel Holtmann <[email protected]>
Quoted 9 lines
--- net/bluetooth/Kconfig | 13 ++++++++++ net/bluetooth/Makefile | 2 ++ net/bluetooth/af_bluetooth.c | 6 +++++ net/bluetooth/selftest.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ net/bluetooth/selftest.h | 45 ++++++++++++++++++++++++++++++++ 5 files changed, 128 insertions(+) create mode 100644 net/bluetooth/selftest.c create mode 100644 net/bluetooth/selftest.h
Both of these patches have been applied to bluetooth-next. Thanks.
Johan