[PATCH 07/15] gtphub: add gtphub_test.c (empty)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Thu Oct 15 22:13:51 UTC 2015


Sponsored-by: On-Waves ehi

 create mode 100644 openbsc/tests/gtphub/Makefile.am
 create mode 100644 openbsc/tests/gtphub/gtphub_test.c
 create mode 100644 openbsc/tests/gtphub/gtphub_test.ok

diff --git a/openbsc/.gitignore b/openbsc/.gitignore
index f024d76..bf05ac2 100644
--- a/openbsc/.gitignore
+++ b/openbsc/.gitignore
@@ -78,6 +78,7 @@ tests/trau/trau_test
 tests/mgcp/mgcp_transcoding_test
 tests/sgsn/sgsn_test
 tests/subscr/subscr_test
+tests/gtphub/gtphub_test
 
 tests/atconfig
 tests/atlocal
diff --git a/openbsc/configure.ac b/openbsc/configure.ac
index fc30b5e..9393282 100644
--- a/openbsc/configure.ac
+++ b/openbsc/configure.ac
@@ -209,6 +209,7 @@ AC_OUTPUT(
     tests/trau/Makefile
     tests/sgsn/Makefile
     tests/subscr/Makefile
+    tests/gtphub/Makefile
     doc/Makefile
     doc/examples/Makefile
     Makefile)
diff --git a/openbsc/tests/Makefile.am b/openbsc/tests/Makefile.am
index 773830b..7dda124 100644
--- a/openbsc/tests/Makefile.am
+++ b/openbsc/tests/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = gsm0408 db channel mgcp gprs abis gbproxy trau subscr
+SUBDIRS = gsm0408 db channel mgcp gprs abis gbproxy trau subscr gtphub
 
 if BUILD_NAT
 SUBDIRS += bsc-nat bsc-nat-trie
diff --git a/openbsc/tests/gtphub/Makefile.am b/openbsc/tests/gtphub/Makefile.am
new file mode 100644
index 0000000..7cc3ac9
--- /dev/null
+++ b/openbsc/tests/gtphub/Makefile.am
@@ -0,0 +1,14 @@
+AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
+AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS)
+
+EXTRA_DIST = \
+	gtphub_test.ok
+
+noinst_PROGRAMS = gtphub_test
+
+gtphub_test_SOURCES = gtphub_test.c
+
+gtphub_test_LDADD = \
+	$(LIBOSMOCORE_LIBS) \
+	-lgtp -lrt
+
diff --git a/openbsc/tests/gtphub/gtphub_test.c b/openbsc/tests/gtphub/gtphub_test.c
new file mode 100644
index 0000000..95f82c3
--- /dev/null
+++ b/openbsc/tests/gtphub/gtphub_test.c
@@ -0,0 +1,63 @@
+/* Test the GTP hub */
+
+/* (C) 2015 by sysmocom s.f.m.c. GmbH
+ * All Rights Reserved
+ *
+ * Author: Neels Hofmeyr <nhofmeyr at sysmcom.de>
+ *
+ * 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 <stdio.h>
+
+#include <osmocom/core/utils.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/application.h>
+
+#include <openbsc/debug.h>
+
+void *osmo_gtphub_ctx;
+
+static void test_gtphub_api(void)
+{
+	OSMO_ASSERT(1);
+}
+
+static struct log_info_cat gtphub_categories[] = {
+	[DGTPHUB] = {
+		.name = "DGTPHUB",
+		.description = "GTP Hub",
+		.color = "\033[1;33m",
+		.enabled = 1, .loglevel = LOGL_NOTICE,
+	},
+};
+
+static struct log_info info = {
+	.cat = gtphub_categories,
+	.num_cat = ARRAY_SIZE(gtphub_categories),
+};
+
+int main(int argc, char **argv)
+{
+	osmo_init_logging(&info);
+	osmo_gtphub_ctx = talloc_named_const(NULL, 0, "osmo_gtphub");
+
+	test_gtphub_api();
+	printf("Done\n");
+
+	talloc_report_full(osmo_gtphub_ctx, stderr);
+	return 0;
+}
+
diff --git a/openbsc/tests/gtphub/gtphub_test.ok b/openbsc/tests/gtphub/gtphub_test.ok
new file mode 100644
index 0000000..a965a70
--- /dev/null
+++ b/openbsc/tests/gtphub/gtphub_test.ok
@@ -0,0 +1 @@
+Done
diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at
index 74aaef0..bfaa76e 100644
--- a/openbsc/tests/testsuite.at
+++ b/openbsc/tests/testsuite.at
@@ -103,3 +103,10 @@ AT_CHECK([test "$enable_sgsn_test" != no || exit 77])
 cat $abs_srcdir/sgsn/sgsn_test.ok > expout
 AT_CHECK([$abs_top_builddir/tests/sgsn/sgsn_test], [], [expout], [ignore])
 AT_CLEANUP
+
+AT_SETUP([gtphub])
+AT_KEYWORDS([gtphub])
+AT_CHECK([test "$enable_gtphub_test" != no || exit 77])
+cat $abs_srcdir/gtphub/gtphub_test.ok > expout
+AT_CHECK([$abs_top_builddir/tests/gtphub/gtphub_test], [], [expout], [ignore])
+AT_CLEANUP
-- 
2.1.4




More information about the OpenBSC mailing list