[PATCH] osmo-hlr[master]: Add test suite skeleton with empty test (auc_3g_test)

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/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Feb 1 13:41:01 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/1719

to look at the new patch set (#2).

Add test suite skeleton with empty test (auc_3g_test)

Change-Id: I6359b0809ce8578850fd65887a568714fb35dbd8
---
M .gitignore
M Makefile.am
M configure.ac
A tests/Makefile.am
A tests/auc/Makefile.am
A tests/auc/auc_3g_test.c
A tests/auc/auc_3g_test.err
A tests/auc/auc_3g_test.ok
A tests/testsuite.at
9 files changed, 167 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/19/1719/2

diff --git a/.gitignore b/.gitignore
index d06928b..17c4737 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,6 @@
 
 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 @@
 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 @@
 
 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 @@
 	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 at sysmocom.de>
+ * All Rights Reserved
+ *
+ * Author: Neels Hofmeyr <nhofmeyr at 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

-- 
To view, visit https://gerrit.osmocom.org/1719
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6359b0809ce8578850fd65887a568714fb35dbd8
Gerrit-PatchSet: 2
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list