diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/subchan_demux/subchan_demux_test.c | 57 | ||||
-rw-r--r-- | tests/subchan_demux/subchan_demux_test.ok | 3 | ||||
-rw-r--r-- | tests/testsuite.at | 6 |
5 files changed, 77 insertions, 2 deletions
@@ -32,6 +32,9 @@ tests/atconfig tests/package.m4 tests/testsuite tests/testsuite.log +tests/subchan_demux/.dirstamp +tests/subchan_demux/subchan_demux_test + # vi/vim files diff --git a/tests/Makefile.am b/tests/Makefile.am index 724285c..8704014 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,7 +6,8 @@ check_PROGRAMS = e1inp_ipa_bsc_test \ e1inp_ipa_bts_test \ e1inp_hsl_bsc_test \ e1inp_hsl_bts_test \ - ipa_proxy_test + ipa_proxy_test \ + subchan_demux/subchan_demux_test e1inp_ipa_bsc_test_SOURCES = e1inp_ipa_bsc_test.c e1inp_ipa_bsc_test_LDADD = $(top_builddir)/src/libosmoabis.la \ @@ -29,6 +30,10 @@ ipa_proxy_test_LDADD = $(top_builddir)/src/libosmoabis.la \ $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) \ $(LIBOSMOVTY_LIBS) +subchan_demux_subchan_demux_test_SOURCES = subchan_demux/subchan_demux_test.c +subchan_demux_subchan_demux_test_LDADD = $(top_builddir)/src/libosmoabis.la \ + $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOVTY_LIBS) # boilerplate for the tests # The `:;' works around a Bash 3.2 bug when the output is not writeable. @@ -49,7 +54,8 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac echo ' [$(PACKAGE_URL)])'; \ } >'$(srcdir)/package.m4' -EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) +EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \ + subchan_demux/subchan_demux_test.ok TESTSUITE = $(srcdir)/testsuite diff --git a/tests/subchan_demux/subchan_demux_test.c b/tests/subchan_demux/subchan_demux_test.c new file mode 100644 index 0000000..75c5901 --- /dev/null +++ b/tests/subchan_demux/subchan_demux_test.c @@ -0,0 +1,57 @@ +/* Subchan Demux syncing test */ + +/* (C) 2012 by Holger Hans Peter Freyther + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <osmocom/abis/subchan_demux.h> +#include <osmocom/core/utils.h> + +#include <stdio.h> +#include <string.h> + +static int data_cb(struct subch_demux *demux, int ch, uint8_t *data, int len, void *p) +{ + printf("DATA_CB Channel(%d): %s\n", + ch, osmo_hexdump(data, len)); + return 0; +} + +static void test_csd(void) +{ + struct subch_demux demux; + memset(&demux, 0, sizeof(demux)); + subch_demux_init(&demux); + + demux.out_cb = data_cb; + + /* Push data into the demuxer and see what happens. */ + printf("Testing the csd sync.\n"); + +} + +int main(int argc, char **argv) +{ + printf("Testing the subchannel demux.\n"); + + /* run the tests */ + test_csd(); + + printf("No crashes.\n"); + return 0; +} diff --git a/tests/subchan_demux/subchan_demux_test.ok b/tests/subchan_demux/subchan_demux_test.ok new file mode 100644 index 0000000..756f25e --- /dev/null +++ b/tests/subchan_demux/subchan_demux_test.ok @@ -0,0 +1,3 @@ +Testing the subchannel demux. +Testing the csd sync. +No crashes. diff --git a/tests/testsuite.at b/tests/testsuite.at index 1358534..04193c5 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -10,3 +10,9 @@ AT_BANNER([Regression tests.]) # cat $abs_srcdir/NAME/NAME_test.ok > expout # AT_CHECK([$abs_top_builddir/tests/NAME/NAME_test], [], [expout]) # AT_CLEANUP + +AT_SETUP([subchan_demux]) +AT_KEYWORDS([subchan_demux]) +cat $abs_srcdir/subchan_demux/subchan_demux_test.ok > expout +AT_CHECK([$abs_top_builddir/tests/subchan_demux/subchan_demux_test], [], [expout]) +AT_CLEANUP |