aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-01-31 01:19:27 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-01 14:22:19 +0100
commit00c069726ed79a79581f13e6654deabbadcff1d9 (patch)
treebffcc13207ac0570aea588d30fb6bcf338257751
parent8089d51f7483926cc253b19550e5fed4171d9b9f (diff)
Add test suite skeleton with empty test (auc_3g_test)
-rw-r--r--.gitignore3
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac4
-rw-r--r--tests/Makefile.am50
-rw-r--r--tests/auc/Makefile.am34
-rw-r--r--tests/auc/auc_3g_test.c61
-rw-r--r--tests/auc/auc_3g_test.err3
-rw-r--r--tests/auc/auc_3g_test.ok2
-rw-r--r--tests/testsuite.at9
9 files changed, 167 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index d06928b..17c4737 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,6 @@ missing
src/osmo-hlr
src/db_test
+
+tests/testsuite
+tests/auc/auc_3g_test
diff --git a/Makefile.am b/Makefile.am
index 40dad90..0d60cee 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,6 +3,7 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2
SUBDIRS = \
src \
sql \
+ tests \
$(NULL)
EXTRA_DIST = \
diff --git a/configure.ac b/configure.ac
index 3ac99c7..fbc1326 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,8 @@ LT_INIT
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.9])
+AC_CONFIG_TESTDIR(tests)
+
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -44,4 +46,6 @@ AC_OUTPUT(
Makefile
src/Makefile
sql/Makefile
+ tests/Makefile
+ tests/auc/Makefile
)
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..21c0e21
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,50 @@
+SUBDIRS = \
+ auc \
+ $(NULL)
+
+# The `:;' works around a Bash 3.2 bug when the output is not writeable.
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+ :;{ \
+ echo '# Signature of the current package.' && \
+ echo 'm4_define([AT_PACKAGE_NAME],' && \
+ echo ' [$(PACKAGE_NAME)])' && \
+ echo 'm4_define([AT_PACKAGE_TARNAME],' && \
+ echo ' [$(PACKAGE_TARNAME)])' && \
+ echo 'm4_define([AT_PACKAGE_VERSION],' && \
+ echo ' [$(PACKAGE_VERSION)])' && \
+ echo 'm4_define([AT_PACKAGE_STRING],' && \
+ echo ' [$(PACKAGE_STRING)])' && \
+ echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
+ echo ' [$(PACKAGE_BUGREPORT)])'; \
+ echo 'm4_define([AT_PACKAGE_URL],' && \
+ echo ' [$(PACKAGE_URL)])'; \
+ } >'$(srcdir)/package.m4'
+
+EXTRA_DIST = \
+ testsuite.at \
+ $(srcdir)/package.m4 \
+ $(TESTSUITE) \
+ $(NULL)
+
+TESTSUITE = $(srcdir)/testsuite
+
+DISTCLEANFILES = \
+ atconfig \
+ $(NULL)
+
+check-local: atconfig $(TESTSUITE)
+ $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
+
+installcheck-local: atconfig $(TESTSUITE)
+ $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
+ $(TESTSUITEFLAGS)
+
+clean-local:
+ test ! -f '$(TESTSUITE)' || \
+ $(SHELL) '$(TESTSUITE)' --clean
+
+AUTOM4TE = $(SHELL) $(top_srcdir)/missing --run autom4te
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
+ $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+ mv $@.tmp $@
diff --git a/tests/auc/Makefile.am b/tests/auc/Makefile.am
new file mode 100644
index 0000000..1d506a7
--- /dev/null
+++ b/tests/auc/Makefile.am
@@ -0,0 +1,34 @@
+AM_CPPFLAGS = \
+ $(all_includes) \
+ -I$(top_srcdir)/src \
+ $(NULL)
+
+AM_CFLAGS = \
+ -Wall \
+ -ggdb3 \
+ $(LIBOSMOCORE_CFLAGS) \
+ $(LIBOSMOGSM_CFLAGS) \
+ $(NULL)
+
+AM_LDFLAGS = \
+ $(NULL)
+
+EXTRA_DIST = \
+ auc_3g_test.ok \
+ auc_3g_test.err \
+ $(NULL)
+
+noinst_PROGRAMS = \
+ auc_3g_test \
+ $(NULL)
+
+auc_3g_test_SOURCES = \
+ auc_3g_test.c \
+ $(NULL)
+
+auc_3g_test_LDADD = \
+ $(top_srcdir)/src/auc.c \
+ $(top_srcdir)/src/logging.c \
+ $(LIBOSMOCORE_LIBS) \
+ $(LIBOSMOGSM_LIBS) \
+ $(NULL)
diff --git a/tests/auc/auc_3g_test.c b/tests/auc/auc_3g_test.c
new file mode 100644
index 0000000..1444f46
--- /dev/null
+++ b/tests/auc/auc_3g_test.c
@@ -0,0 +1,61 @@
+/* (C) 2016 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
+ * All Rights Reserved
+ *
+ * Author: Neels Hofmeyr <nhofmeyr@sysmocom.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 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 <string.h>
+
+#include <osmocom/core/application.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/core/logging.h>
+
+#include "logging.h"
+
+#define comment_start() fprintf(stderr, "===== %s\n", __func__);
+#define comment_end() fprintf(stderr, "===== %s: SUCCESS\n\n", __func__);
+
+uint8_t fake_rand[16] = { 0 };
+
+int rand_get(uint8_t *rand, unsigned int len)
+{
+ OSMO_ASSERT(len <= sizeof(fake_rand));
+ memcpy(rand, fake_rand, len);
+ return len;
+}
+
+static void test_gen_vectors_3g_only(void)
+{
+ comment_start();
+ comment_end();
+}
+
+int main()
+{
+ printf("auc_3g_test.c\n");
+ osmo_init_logging(&hlr_log_info);
+ log_set_print_filename(osmo_stderr_target, 0);
+ log_set_print_timestamp(osmo_stderr_target, 0);
+ log_set_use_color(osmo_stderr_target, 0);
+ log_set_print_category(osmo_stderr_target, 1);
+
+ test_gen_vectors_3g_only();
+
+ printf("Done\n");
+ return 0;
+}
diff --git a/tests/auc/auc_3g_test.err b/tests/auc/auc_3g_test.err
new file mode 100644
index 0000000..c29640a
--- /dev/null
+++ b/tests/auc/auc_3g_test.err
@@ -0,0 +1,3 @@
+===== test_gen_vectors_3g_only
+===== test_gen_vectors_3g_only: SUCCESS
+
diff --git a/tests/auc/auc_3g_test.ok b/tests/auc/auc_3g_test.ok
new file mode 100644
index 0000000..81272cd
--- /dev/null
+++ b/tests/auc/auc_3g_test.ok
@@ -0,0 +1,2 @@
+auc_3g_test.c
+Done
diff --git a/tests/testsuite.at b/tests/testsuite.at
new file mode 100644
index 0000000..b782074
--- /dev/null
+++ b/tests/testsuite.at
@@ -0,0 +1,9 @@
+AT_INIT
+AT_BANNER([Regression tests.])
+
+AT_SETUP([auc])
+AT_KEYWORDS([auc])
+cat $abs_srcdir/auc/auc_3g_test.ok > expout
+cat $abs_srcdir/auc/auc_3g_test.err > experr
+AT_CHECK([$abs_top_builddir/tests/auc/auc_3g_test], [], [expout], [experr])
+AT_CLEANUP