Add test suite skeleton with empty test (auc_3g_test)

Change-Id: I6359b0809ce8578850fd65887a568714fb35dbd8
This commit is contained in:
Neels Hofmeyr 2017-01-31 01:19:27 +01:00
parent 8089d51f74
commit 00c069726e
9 changed files with 167 additions and 0 deletions

3
.gitignore vendored
View File

@ -22,3 +22,6 @@ missing
src/osmo-hlr
src/db_test
tests/testsuite
tests/auc/auc_3g_test

View File

@ -3,6 +3,7 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2
SUBDIRS = \
src \
sql \
tests \
$(NULL)
EXTRA_DIST = \

View File

@ -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
)

50
tests/Makefile.am Normal file
View File

@ -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 $@

34
tests/auc/Makefile.am Normal file
View File

@ -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)

61
tests/auc/auc_3g_test.c Normal file
View File

@ -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;
}

View File

@ -0,0 +1,3 @@
===== test_gen_vectors_3g_only
===== test_gen_vectors_3g_only: SUCCESS

2
tests/auc/auc_3g_test.ok Normal file
View File

@ -0,0 +1,2 @@
auc_3g_test.c
Done

9
tests/testsuite.at Normal file
View File

@ -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