diff mbox

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

Message ID 1444227508-26608-8-git-send-email-nhofmeyr@sysmocom.de
State Superseded
Headers show

Commit Message

Neels Hofmeyr Oct. 7, 2015, 2:18 p.m. UTC
Sponsored-by: On-Waves ehi
---
 openbsc/.gitignore                  |  1 +
 openbsc/tests/gtphub/Makefile.am    | 15 ++++++++-
 openbsc/tests/gtphub/gtphub_test.c  | 63 +++++++++++++++++++++++++++++++++++++
 openbsc/tests/gtphub/gtphub_test.ok |  1 +
 openbsc/tests/testsuite.at          |  2 ++
 5 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 openbsc/tests/gtphub/gtphub_test.c
 create mode 100644 openbsc/tests/gtphub/gtphub_test.ok
diff mbox

Patch

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/tests/gtphub/Makefile.am b/openbsc/tests/gtphub/Makefile.am
index d53c19d..c4b3ec1 100644
--- a/openbsc/tests/gtphub/Makefile.am
+++ b/openbsc/tests/gtphub/Makefile.am
@@ -1,3 +1,16 @@ 
+AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
+AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS)
+
 EXTRA_DIST = \
 	gtphub_nc_test.sh \
-	gtphub_nc_test.ok
+	gtphub_nc_test.ok \
+	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@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 14d1f72..9a1f9dd 100644
--- a/openbsc/tests/testsuite.at
+++ b/openbsc/tests/testsuite.at
@@ -109,4 +109,6 @@  AT_KEYWORDS([gtphub])
 AT_CHECK([test "$enable_gtphub_test" != no || exit 77])
 cat $abs_srcdir/gtphub/gtphub_nc_test.ok > expout
 AT_CHECK([$abs_top_builddir/tests/gtphub/gtphub_nc_test.sh $abs_top_builddir/src/gprs/osmo-gtphub], [], [expout], [ignore])
+cat $abs_srcdir/gtphub/gtphub_test.ok > expout
+AT_CHECK([$abs_top_builddir/tests/gtphub/gtphub_test], [], [expout], [ignore])
 AT_CLEANUP