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.
This commit is contained in:
Thomas Haller 2019-08-24 14:27:11 +02:00
parent a5bc4cb785
commit 878d4963ed
3 changed files with 88 additions and 13 deletions

1
.gitignore vendored
View File

@ -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

View File

@ -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"

View File

@ -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;
}