[PATCH 5/8] oap: add oap testsuite skeleton

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 1 13:23:54 UTC 2015


Sponsored-by: On-Waves ehf
---
 openbsc/.gitignore            |  1 +
 openbsc/configure.ac          |  1 +
 openbsc/tests/Makefile.am     |  2 +-
 openbsc/tests/oap/Makefile.am | 19 ++++++++++++++
 openbsc/tests/oap/oap_test.c  | 58 +++++++++++++++++++++++++++++++++++++++++++
 openbsc/tests/oap/oap_test.ok |  2 ++
 openbsc/tests/testsuite.at    |  7 ++++++
 7 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 openbsc/tests/oap/Makefile.am
 create mode 100644 openbsc/tests/oap/oap_test.c
 create mode 100644 openbsc/tests/oap/oap_test.ok

diff --git a/openbsc/.gitignore b/openbsc/.gitignore
index 2210c47..ca73db6 100644
--- a/openbsc/.gitignore
+++ b/openbsc/.gitignore
@@ -77,6 +77,7 @@ tests/trau/trau_test
 tests/mgcp/mgcp_transcoding_test
 tests/sgsn/sgsn_test
 tests/subscr/subscr_test
+tests/oap/oap_test
 
 tests/atconfig
 tests/atlocal
diff --git a/openbsc/configure.ac b/openbsc/configure.ac
index 78302dd..228db58 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/oap/Makefile
     doc/Makefile
     doc/examples/Makefile
     Makefile)
diff --git a/openbsc/tests/Makefile.am b/openbsc/tests/Makefile.am
index 773830b..1b557d4 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 oap
 
 if BUILD_NAT
 SUBDIRS += bsc-nat bsc-nat-trie
diff --git a/openbsc/tests/oap/Makefile.am b/openbsc/tests/oap/Makefile.am
new file mode 100644
index 0000000..e160902
--- /dev/null
+++ b/openbsc/tests/oap/Makefile.am
@@ -0,0 +1,19 @@
+AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
+AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS)
+
+EXTRA_DIST = oap_test.ok
+
+noinst_PROGRAMS = oap_test
+
+oap_test_SOURCES = oap_test.c
+
+oap_test_LDADD = \
+	$(top_builddir)/src/gprs/oap.o \
+	$(top_builddir)/src/gprs/oap_messages.o \
+	$(top_builddir)/src/gprs/gprs_utils.o \
+	$(top_builddir)/src/gprs/gsm_04_08_gprs.o \
+	$(top_builddir)/src/libcommon/libcommon.a \
+	$(LIBOSMOCORE_LIBS) \
+	$(LIBOSMOGSM_LIBS) \
+	-lrt
+
diff --git a/openbsc/tests/oap/oap_test.c b/openbsc/tests/oap/oap_test.c
new file mode 100644
index 0000000..b03c8dc
--- /dev/null
+++ b/openbsc/tests/oap/oap_test.c
@@ -0,0 +1,58 @@
+/* Test Osmocom Authentication Protocol */
+/*
+ * (C) 2015 by sysmocom s.f.m.c. GmbH
+ * 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/core/application.h>
+
+#include <openbsc/debug.h>
+
+#include <openbsc/oap.h>
+#include <openbsc/oap_messages.h>
+
+#include <stdio.h>
+
+
+static void test_oap(void)
+{
+	printf("not implemented\n");
+}
+
+static struct log_info_cat gprs_categories[] = {
+	[DGPRS] = {
+		.name = "DGPRS",
+		.description = "GPRS Packet Service",
+		.enabled = 1, .loglevel = LOGL_DEBUG,
+	},
+};
+
+static struct log_info info = {
+	.cat = gprs_categories,
+	.num_cat = ARRAY_SIZE(gprs_categories),
+};
+
+int main(int argc, char **argv)
+{
+	osmo_init_logging(&info);
+
+	test_oap();
+	printf("Done\n");
+
+	return 0;
+}
+
diff --git a/openbsc/tests/oap/oap_test.ok b/openbsc/tests/oap/oap_test.ok
new file mode 100644
index 0000000..e411ad9
--- /dev/null
+++ b/openbsc/tests/oap/oap_test.ok
@@ -0,0 +1,2 @@
+not implemented
+Done
diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at
index 74aaef0..78aa47e 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([oap])
+AT_KEYWORDS([oap])
+AT_CHECK([test "$enable_oap_test" != no || exit 77])
+cat $abs_srcdir/oap/oap_test.ok > expout
+AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [], [expout], [ignore])
+AT_CLEANUP
-- 
2.1.4




More information about the OpenBSC mailing list