summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-24 14:27:11 +0200
committerThomas Haller <thaller@redhat.com>2019-09-22 16:05:50 +0200
commit878d4963ed7e3058c13f03dc1b2978fce1bed9c6 (patch)
tree439c0ff72b6f12693e23fbaca94ee372e46e974f
parenta5bc4cb785480755574a11b214cc615504966cc9 (diff)
downloadNetworkManager-878d4963ed7e3058c13f03dc1b2978fce1bed9c6.tar.gz
bluetooth/tests: add "nm-bt-test helper" program for manual testing of bluetooth code
Just add a stub implementation and let it build. More will be added later.
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am64
-rw-r--r--src/devices/bluetooth/tests/nm-bt-test.c36
3 files changed, 88 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 55e8317e31..afa51c3ec2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -206,6 +206,7 @@ test-*.trs
/src/NetworkManager
/src/NetworkManager.ver
+/src/devices/bluetooth/tests/nm-bt-test
/src/devices/tests/test-acd
/src/devices/tests/test-lldp
/src/devices/wifi/tests/test-devices-wifi
diff --git a/Makefile.am b/Makefile.am
index 48e0cd55df..e519cedd2f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3408,18 +3408,44 @@ EXTRA_DIST += \
if WITH_MODEM_MANAGER_1
+noinst_LTLIBRARIES += src/devices/bluetooth/libnm-bluetooth-utils.la
+
+src_devices_bluetooth_libnm_bluetooth_utils_la_SOURCES = \
+ src/devices/bluetooth/nm-bluez-common.h \
+ src/devices/bluetooth/nm-bt-error.c \
+ src/devices/bluetooth/nm-bt-error.h \
+ $(NULL)
+
+src_devices_bluetooth_libnm_bluetooth_utils_la_CPPFLAGS = \
+ $(src_cppflags_base) \
+ $(NULL)
+
+src_devices_bluetooth_libnm_bluetooth_utils_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(NULL)
+
+if WITH_BLUEZ5_DUN
+src_devices_bluetooth_libnm_bluetooth_utils_la_SOURCES += \
+ src/devices/bluetooth/nm-bluez5-dun.c \
+ src/devices/bluetooth/nm-bluez5-dun.h \
+ $(NULL)
+
+src_devices_bluetooth_libnm_bluetooth_utils_la_CPPFLAGS += $(BLUEZ5_CFLAGS)
+src_devices_bluetooth_libnm_bluetooth_utils_la_LIBADD += $(BLUEZ5_LIBS)
+endif
+
+$(src_devices_bluetooth_libnm_bluetooth_utils_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
+
+###############################################################################
+
core_plugins += src/devices/bluetooth/libnm-device-plugin-bluetooth.la
src_devices_bluetooth_libnm_device_plugin_bluetooth_la_SOURCES = \
- src/devices/bluetooth/nm-bluez-manager.c \
- src/devices/bluetooth/nm-bluez-common.h \
src/devices/bluetooth/nm-bluez-device.c \
src/devices/bluetooth/nm-bluez-device.h \
+ src/devices/bluetooth/nm-bluez-manager.c \
src/devices/bluetooth/nm-bluez5-manager.c \
src/devices/bluetooth/nm-bluez5-manager.h \
- src/devices/bluetooth/nm-bt-error.h \
- src/devices/bluetooth/nm-bt-error.c \
- \
src/devices/bluetooth/nm-device-bt.c \
src/devices/bluetooth/nm-device-bt.h \
$(NULL)
@@ -3431,18 +3457,30 @@ src_devices_bluetooth_libnm_device_plugin_bluetooth_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
src_devices_bluetooth_libnm_device_plugin_bluetooth_la_LIBADD = \
+ src/devices/bluetooth/libnm-bluetooth-utils.la \
src/devices/wwan/libnm-wwan.la \
- $(GLIB_LIBS)
+ $(GLIB_LIBS) \
+ $(NULL)
-if WITH_BLUEZ5_DUN
-src_devices_bluetooth_libnm_device_plugin_bluetooth_la_CPPFLAGS += $(BLUEZ5_CFLAGS)
+$(src_devices_bluetooth_libnm_device_plugin_bluetooth_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
-src_devices_bluetooth_libnm_device_plugin_bluetooth_la_SOURCES += \
- src/devices/bluetooth/nm-bluez5-dun.c \
- src/devices/bluetooth/nm-bluez5-dun.h
+###############################################################################
-src_devices_bluetooth_libnm_device_plugin_bluetooth_la_LIBADD += $(BLUEZ5_LIBS)
-endif
+check_programs_norun += \
+ src/devices/bluetooth/tests/nm-bt-test
+
+src_devices_bluetooth_tests_nm_bt_test_CPPFLAGS = \
+ $(src_cppflags_test) \
+ $(NULL)
+src_devices_bluetooth_tests_nm_bt_test_LDADD = \
+ src/devices/bluetooth/libnm-bluetooth-utils.la \
+ src/libNetworkManager.la \
+ $(GLIB_LIBS) \
+ $(NULL)
+
+$(src_devices_bluetooth_tests_nm_bt_test_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
+
+###############################################################################
check-local-devices-bluetooth: src/devices/bluetooth/libnm-device-plugin-bluetooth.la
$(srcdir)/tools/check-exports.sh $(builddir)/src/devices/bluetooth/.libs/libnm-device-plugin-bluetooth.so "$(srcdir)/linker-script-devices.ver"
diff --git a/src/devices/bluetooth/tests/nm-bt-test.c b/src/devices/bluetooth/tests/nm-bt-test.c
new file mode 100644
index 0000000000..42f3f2e553
--- /dev/null
+++ b/src/devices/bluetooth/tests/nm-bt-test.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: LGPL-2.1+
+
+#include "nm-default.h"
+
+#include "devices/bluetooth/nm-bluez5-dun.h"
+
+#include "nm-test-utils-core.h"
+
+/*****************************************************************************/
+
+NMTST_DEFINE ();
+
+int
+main (int argc, char **argv)
+{
+ NMBluez5DunContext *dun_context;
+ GMainLoop *loop;
+
+ if (!g_getenv ("G_MESSAGES_DEBUG"))
+ g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
+
+ nmtst_init_with_logging (&argc, &argv, "DEBUG", "ALL");
+
+ nm_log_info (LOGD_BT, "bluetooth test util start");
+
+ dun_context = nm_bluez5_dun_new ("aa:bb:cc:dd:ee:ff",
+ "aa:bb:cc:dd:ee:fa");
+
+ loop = g_main_loop_new (NULL, FALSE);
+
+ g_main_loop_unref (loop);
+
+ nm_bluez5_dun_free (dun_context);
+
+ return EXIT_SUCCESS;
+}