tests: Introduce running tests with GNU autotest in OpenBSC

The quality of the tests is of different value but it is good to
get started and improve from here.
changes/88/3188/1
Holger Hans Peter Freyther 11 years ago
parent d5b3ca621b
commit 6c88217c19
  1. 6
      openbsc/.gitignore
  2. 1
      openbsc/configure.ac
  3. 44
      openbsc/tests/Makefile.am
  4. 2
      openbsc/tests/bsc-nat/Makefile.am
  5. 21
      openbsc/tests/bsc-nat/bsc_nat_test.ok
  6. 2
      openbsc/tests/channel/Makefile.am
  7. 2
      openbsc/tests/channel/channel_test.ok
  8. 2
      openbsc/tests/db/Makefile.am
  9. 4
      openbsc/tests/db/db_test.ok
  10. 2
      openbsc/tests/gsm0408/Makefile.am
  11. 5
      openbsc/tests/gsm0408/gsm0408_test.ok
  12. 2
      openbsc/tests/mgcp/Makefile.am
  13. 2
      openbsc/tests/mgcp/mgcp_test.ok
  14. 39
      openbsc/tests/testsuite.at

@ -52,4 +52,10 @@ tests/sccp/sccp_test
tests/sms/sms_test
tests/timer/timer_test
tests/atconfig
tests/package.m4
tests/testsuite
tests/testsuite.log
src/openbsc.cfg*

@ -4,6 +4,7 @@ AC_INIT([openbsc],
[openbsc-devel@lists.openbsc.org])
AM_INIT_AUTOMAKE([dist-bzip2])
AC_CONFIG_TESTDIR(tests)
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

@ -2,4 +2,48 @@ SUBDIRS = debug gsm0408 db channel mgcp
if BUILD_NAT
SUBDIRS += bsc-nat
ENABLE_NAT_TEST = echo 'm4_define([ENABLE_NAT_TEST], [1])';
else
ENABLE_NAT_TEST = echo '';
endif
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
$(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_builddir)/config.log
:;{ \
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)])'; \
$(ENABLE_NAT_TEST) \
} >'$(srcdir)/package.m4'
EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE)
TESTSUITE = $(srcdir)/testsuite
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
$(RM) -f atconfig
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 $@

@ -2,7 +2,7 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOSCCP_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
EXTRA_DIST = bsc_data.c
EXTRA_DIST = bsc_nat_test.ok
noinst_PROGRAMS = bsc_nat_test

@ -0,0 +1,21 @@
Testing BSS Filtering.
Going to test item: 0
Going to test item: 1
Going to test item: 2
Going to test item: 3
Going to test item: 4
Going to test item: 5
Going to test item: 6
Going to test item: 7
Going to test item: 8
Going to test item: 9
Going to test item: 10
Going to test item: 11
Going to test item: 12
Testing connection tracking.
Testing paging by lac.
Testing MGCP.
Testing finding of a BSC Connection
Testing rewriting MGCP messages.
Testing MGCP response parsing.
Testing execution completed.

@ -1,6 +1,8 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS)
EXTRA_DIST = channel_test.ok
noinst_PROGRAMS = channel_test
channel_test_SOURCES = channel_test.c

@ -0,0 +1,2 @@
Testing the gsm_subscriber chan logic
Reached, didn't crash, test passed

@ -2,6 +2,8 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
EXTRA_DIST = db_test.ok
noinst_PROGRAMS = db_test
db_test_SOURCES = db_test.c

@ -0,0 +1,4 @@
Testing subscriber database code.
DB: Database initialized.
DB: Database prepared.
Done

@ -2,6 +2,8 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS)
noinst_PROGRAMS = gsm0408_test
EXTRA_DIST = gsm0408_test.ok
gsm0408_test_SOURCES = gsm0408_test.c
gsm0408_test_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libmsc/libmsc.a \

@ -0,0 +1,5 @@
Testing test location area identifier
Testing parsing and generating TMSI/IMSI
hex: 17 08 99 78 56 34 12 90 78 36
hex: 17 09 91 78 56 34 12 90 78 56 f4
Done.

@ -2,6 +2,8 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSCCP_CFLAGS) $(COVERAGE_CFLAGS)
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
EXTRA_DIST = mgcp_test.ok
noinst_PROGRAMS = mgcp_test
mgcp_test_SOURCES = mgcp_test.c

@ -0,0 +1,2 @@
Testing AUEP
Done

@ -0,0 +1,39 @@
AT_INIT
AT_BANNER([Regression tests.])
AT_SETUP([gsm0408])
AT_KEYWORDS([gsm0408])
cat $abs_srcdir/gsm0408/gsm0408_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm0408/gsm0408_test], [], [expout], [ignore])
AT_CLEANUP
AT_SETUP([db])
AT_KEYWORDS([db])
cat $abs_srcdir/db/db_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/db/db_test], [], [expout], [ignore])
AT_CLEANUP
AT_SETUP([channel])
AT_KEYWORDS([channel])
cat $abs_srcdir/channel/channel_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/channel/channel_test], [], [expout], [ignore])
AT_CLEANUP
AT_SETUP([mgcp])
AT_KEYWORDS([mgcp])
cat $abs_srcdir/mgcp/mgcp_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/mgcp/mgcp_test], [], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gprs])
AT_KEYWORDS([gprs])
cat $abs_srcdir/gprs/gprs_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gprs/gprs_test], [], [expout], [ignore])
AT_CLEANUP
m4_ifdef([ENABLE_NAT_TEST],[
AT_SETUP([bsc-nat])
AT_KEYWORDS([bsc-nat])
cat $abs_srcdir/bsc-nat/bsc_nat_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bsc-nat/bsc_nat_test], [], [expout], [ignore])
AT_CLEANUP])
Loading…
Cancel
Save