diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-01-06 15:16:12 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-01-06 18:52:05 +0100 |
commit | 6c88217c1935fcbf864f0cbcddae105eda7e6bb4 (patch) | |
tree | 7e30cd283c855ea9411dbdbcb5d32c85641db159 /openbsc | |
parent | d5b3ca621b26a70c16cc61fcf9cd4ef0a15fce15 (diff) |
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.
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/.gitignore | 6 | ||||
-rw-r--r-- | openbsc/configure.ac | 1 | ||||
-rw-r--r-- | openbsc/tests/Makefile.am | 44 | ||||
-rw-r--r-- | openbsc/tests/bsc-nat/Makefile.am | 2 | ||||
-rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.ok | 21 | ||||
-rw-r--r-- | openbsc/tests/channel/Makefile.am | 2 | ||||
-rw-r--r-- | openbsc/tests/channel/channel_test.ok | 2 | ||||
-rw-r--r-- | openbsc/tests/db/Makefile.am | 2 | ||||
-rw-r--r-- | openbsc/tests/db/db_test.ok | 4 | ||||
-rw-r--r-- | openbsc/tests/gsm0408/Makefile.am | 2 | ||||
-rw-r--r-- | openbsc/tests/gsm0408/gsm0408_test.ok | 5 | ||||
-rw-r--r-- | openbsc/tests/mgcp/Makefile.am | 2 | ||||
-rw-r--r-- | openbsc/tests/mgcp/mgcp_test.ok | 2 | ||||
-rw-r--r-- | openbsc/tests/testsuite.at | 39 |
14 files changed, 133 insertions, 1 deletions
diff --git a/openbsc/.gitignore b/openbsc/.gitignore index c19c16a76..37495cc91 100644 --- a/openbsc/.gitignore +++ b/openbsc/.gitignore @@ -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* diff --git a/openbsc/configure.ac b/openbsc/configure.ac index f330c99c0..90e3654e2 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -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])]) diff --git a/openbsc/tests/Makefile.am b/openbsc/tests/Makefile.am index 1968119f8..64667c9ad 100644 --- a/openbsc/tests/Makefile.am +++ b/openbsc/tests/Makefile.am @@ -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 $@ diff --git a/openbsc/tests/bsc-nat/Makefile.am b/openbsc/tests/bsc-nat/Makefile.am index 5a6898487..db3cbe542 100644 --- a/openbsc/tests/bsc-nat/Makefile.am +++ b/openbsc/tests/bsc-nat/Makefile.am @@ -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 diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.ok b/openbsc/tests/bsc-nat/bsc_nat_test.ok new file mode 100644 index 000000000..2aff594fb --- /dev/null +++ b/openbsc/tests/bsc-nat/bsc_nat_test.ok @@ -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. diff --git a/openbsc/tests/channel/Makefile.am b/openbsc/tests/channel/Makefile.am index 404ab3225..4f50dab21 100644 --- a/openbsc/tests/channel/Makefile.am +++ b/openbsc/tests/channel/Makefile.am @@ -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 diff --git a/openbsc/tests/channel/channel_test.ok b/openbsc/tests/channel/channel_test.ok new file mode 100644 index 000000000..7976aee0f --- /dev/null +++ b/openbsc/tests/channel/channel_test.ok @@ -0,0 +1,2 @@ +Testing the gsm_subscriber chan logic +Reached, didn't crash, test passed diff --git a/openbsc/tests/db/Makefile.am b/openbsc/tests/db/Makefile.am index aab2cd683..f0d65f897 100644 --- a/openbsc/tests/db/Makefile.am +++ b/openbsc/tests/db/Makefile.am @@ -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 diff --git a/openbsc/tests/db/db_test.ok b/openbsc/tests/db/db_test.ok new file mode 100644 index 000000000..2632a8c8a --- /dev/null +++ b/openbsc/tests/db/db_test.ok @@ -0,0 +1,4 @@ +Testing subscriber database code. +DB: Database initialized. +DB: Database prepared. +Done diff --git a/openbsc/tests/gsm0408/Makefile.am b/openbsc/tests/gsm0408/Makefile.am index 90ca05b5d..6ecdc070c 100644 --- a/openbsc/tests/gsm0408/Makefile.am +++ b/openbsc/tests/gsm0408/Makefile.am @@ -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 \ diff --git a/openbsc/tests/gsm0408/gsm0408_test.ok b/openbsc/tests/gsm0408/gsm0408_test.ok new file mode 100644 index 000000000..52c601e2d --- /dev/null +++ b/openbsc/tests/gsm0408/gsm0408_test.ok @@ -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. diff --git a/openbsc/tests/mgcp/Makefile.am b/openbsc/tests/mgcp/Makefile.am index 472368cb3..ff67cf86b 100644 --- a/openbsc/tests/mgcp/Makefile.am +++ b/openbsc/tests/mgcp/Makefile.am @@ -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 diff --git a/openbsc/tests/mgcp/mgcp_test.ok b/openbsc/tests/mgcp/mgcp_test.ok new file mode 100644 index 000000000..1a01c28a8 --- /dev/null +++ b/openbsc/tests/mgcp/mgcp_test.ok @@ -0,0 +1,2 @@ +Testing AUEP +Done diff --git a/openbsc/tests/testsuite.at b/openbsc/tests/testsuite.at new file mode 100644 index 000000000..fb57d07b0 --- /dev/null +++ b/openbsc/tests/testsuite.at @@ -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]) |