aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-10-11 08:25:36 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-10-12 16:23:31 +0200
commitbc5dcb11a714c3e73982299f421790b3da93e584 (patch)
tree9fc1bb946e6643383bde9eddbb2d60f4ca44bc83 /tests
parentf684976724b04324f2634755bc0f2904c67d91c9 (diff)
tests: Add a test stub for the subchan_demux tests
Tobias has worked on CSD support and Dieter has helped with a CSD trau fix. This is a stub that should allow to easily write a test case for the syncing issue observed by Tobias. Run the tests: $ make check In case of failure: $ vi tests/testsuite.dir/1/testsuite.log Add the actual content: $ edit tests/subchan_demux/subchan_demux_test.c Update the test result: $ ./tests/subchan_demux/subchan_demux_test > tests/subchan_demux/subchan_demux_test.ok
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/subchan_demux/subchan_demux_test.c57
-rw-r--r--tests/subchan_demux/subchan_demux_test.ok3
-rw-r--r--tests/testsuite.at6
4 files changed, 74 insertions, 2 deletions
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