diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-12-29 20:48:35 -0800 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-12-30 08:53:55 +0200 |
commit | ee485290c6af942f0371def632c32e747d110b1e (patch) | |
tree | 6571bc3ae7368bbdf83f7cc48bdf4c19679f0730 /net/bluetooth/selftest.c | |
parent | 4da50de895588a0268b636314d7c1d08f18b20c9 (diff) | |
download | linux-ee485290c6af942f0371def632c32e747d110b1e.tar.gz linux-ee485290c6af942f0371def632c32e747d110b1e.tar.bz2 linux-ee485290c6af942f0371def632c32e747d110b1e.zip |
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.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/selftest.c')
-rw-r--r-- | net/bluetooth/selftest.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/net/bluetooth/selftest.c b/net/bluetooth/selftest.c new file mode 100644 index 000000000000..00cac4a5e229 --- /dev/null +++ b/net/bluetooth/selftest.c @@ -0,0 +1,62 @@ +/* + BlueZ - Bluetooth protocol stack for Linux + + Copyright (C) 2014 Intel Corporation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + SOFTWARE IS DISCLAIMED. +*/ + +#include <net/bluetooth/bluetooth.h> + +#include "selftest.h" + +static int __init run_selftest(void) +{ + BT_INFO("Starting self testing"); + + BT_INFO("Finished self testing"); + + return 0; +} + +#if IS_MODULE(CONFIG_BT) + +/* This is run when CONFIG_BT_SELFTEST=y and CONFIG_BT=m and is just a + * wrapper to allow running this at module init. + * + * If CONFIG_BT_SELFTEST=n, then this code is not compiled at all. + */ +int __init bt_selftest(void) +{ + return run_selftest(); +} + +#else + +/* This is run when CONFIG_BT_SELFTEST=y and CONFIG_BT=y and is run + * via late_initcall() as last item in the initialization sequence. + * + * If CONFIG_BT_SELFTEST=n, then this code is not compiled at all. + */ +static int __init bt_selftest_init(void) +{ + return run_selftest(); +} +late_initcall(bt_selftest_init); + +#endif |