diff options
author | Oliver Smith <osmith@sysmocom.de> | 2018-12-10 17:10:36 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2018-12-13 11:07:02 +0100 |
commit | 871713bf6acc823115f59427855e96549a5be2ac (patch) | |
tree | 8725985d07b57c285a56a2e898154fd6c7d1498d /tests/Transceiver52M | |
parent | 8d9a05ce5bebb2df636e235e7d568569426e872d (diff) |
LMSDevice: make use of dev-args in osmo-trx.cfg
Allow selecting a specific LimeSDR device by setting dev-args in the
config file. Split up the given dev-args address by comma and select
the device where all substrings can be found.
I could not test this with real hardware, but I have added a test case
to make sure this works as expected.
Related: OS#3654
Change-Id: Ib9aaa066a01bf9de3f78234d7ada884d6f28c852
Diffstat (limited to 'tests/Transceiver52M')
-rw-r--r-- | tests/Transceiver52M/LMSDeviceTest.cpp | 41 | ||||
-rw-r--r-- | tests/Transceiver52M/Makefile.am | 10 |
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/Transceiver52M/LMSDeviceTest.cpp b/tests/Transceiver52M/LMSDeviceTest.cpp new file mode 100644 index 0000000..d40a7ec --- /dev/null +++ b/tests/Transceiver52M/LMSDeviceTest.cpp @@ -0,0 +1,41 @@ +#include <assert.h> +#include <lime/LimeSuite.h> +#include <string> + +extern "C" +{ +size_t osmo_strlcpy(char *dst, const char *src, size_t siz); +} + +int info_list_find(lms_info_str_t* info_list, unsigned int count, const std::string &args); + +using namespace std; + +int main(void) +{ + unsigned int count; + lms_info_str_t* info_list; + std::string args; + + /* two fake entries for info_list */ + count = 2; + info_list = new lms_info_str_t[count]; + osmo_strlcpy(info_list[0], "LimeSDR Mini, addr=24607:1337, serial=FAKESERIAL0001", sizeof(lms_info_str_t)); + osmo_strlcpy(info_list[1], "LimeSDR Mini, addr=24607:1338, serial=FAKESERIAL0002", sizeof(lms_info_str_t)); + + /* find second entry by args filter */ + args = "serial=FAKESERIAL0002,LimeSDR Mini"; + assert(info_list_find(info_list, count, args) == 1); + + /* empty args -> first entry */ + args = ""; + assert(info_list_find(info_list, count, args) == 0); + + /* not matching args -> -1 */ + args = "serial=NOTMATCHING"; + assert(info_list_find(info_list, count, args) == -1); + + /* clean up */ + delete[] info_list; + return 0; +} diff --git a/tests/Transceiver52M/Makefile.am b/tests/Transceiver52M/Makefile.am index 06db5b0..df3ae57 100644 --- a/tests/Transceiver52M/Makefile.am +++ b/tests/Transceiver52M/Makefile.am @@ -16,3 +16,13 @@ endif if HAVE_SSE4_1 convolve_test_CFLAGS += $(SIMD_FLAGS) endif + +if DEVICE_LMS +noinst_PROGRAMS += LMSDeviceTest +LMSDeviceTest_SOURCES = LMSDeviceTest.cpp +LMSDeviceTest_LDFLAGS = $(LIBOSMOCORE_LIBS) $(LMS_LIBS) +LMSDeviceTest_LDADD = \ + $(top_builddir)/Transceiver52M/device/lms/libdevice.la \ + $(COMMON_LA) +LMSDeviceTest_CPPFLAGS = $(AM_CPPFLAGS) $(LMS_CFLAGS) +endif |