tests: Use atlocal/atlocal.in to enable/disable the NAT test

Kill the hacking, use atlocal to remember if the NAT test should
be enabled and then skip the test (exit with 77).
This commit is contained in:
Holger Hans Peter Freyther 2012-01-09 22:53:04 +01:00
parent 03ff1c8477
commit 93ef33edb6
5 changed files with 7 additions and 7 deletions

1
openbsc/.gitignore vendored
View File

@ -54,6 +54,7 @@ tests/timer/timer_test
tests/gprs/gprs_test tests/gprs/gprs_test
tests/atconfig tests/atconfig
tests/atlocal
tests/package.m4 tests/package.m4
tests/testsuite tests/testsuite
tests/testsuite.log tests/testsuite.log

View File

@ -29,6 +29,7 @@ AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Require
osmo_ac_build_nat="no" osmo_ac_build_nat="no"
]) ])
AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes") AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
AC_SUBST(osmo_ac_build_nat)
AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])], AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
[ [
@ -106,6 +107,7 @@ AC_OUTPUT(
src/libgb/Makefile src/libgb/Makefile
src/gprs/Makefile src/gprs/Makefile
tests/Makefile tests/Makefile
tests/atlocal
tests/debug/Makefile tests/debug/Makefile
tests/gsm0408/Makefile tests/gsm0408/Makefile
tests/db/Makefile tests/db/Makefile

View File

@ -2,14 +2,11 @@ SUBDIRS = debug gsm0408 db channel mgcp gprs
if BUILD_NAT if BUILD_NAT
SUBDIRS += bsc-nat SUBDIRS += bsc-nat
ENABLE_NAT_TEST = echo 'm4_define([ENABLE_NAT_TEST], [1])';
else
ENABLE_NAT_TEST = echo '';
endif endif
# The `:;' works around a Bash 3.2 bug when the output is not writeable. # 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 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
:;{ \ :;{ \
echo '# Signature of the current package.' && \ echo '# Signature of the current package.' && \
echo 'm4_define([AT_PACKAGE_NAME],' && \ echo 'm4_define([AT_PACKAGE_NAME],' && \
@ -24,7 +21,6 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_builddir)/config.log
echo ' [$(PACKAGE_BUGREPORT)])'; \ echo ' [$(PACKAGE_BUGREPORT)])'; \
echo 'm4_define([AT_PACKAGE_URL],' && \ echo 'm4_define([AT_PACKAGE_URL],' && \
echo ' [$(PACKAGE_URL)])'; \ echo ' [$(PACKAGE_URL)])'; \
$(ENABLE_NAT_TEST) \
} >'$(srcdir)/package.m4' } >'$(srcdir)/package.m4'
EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE)

1
openbsc/tests/atlocal.in Normal file
View File

@ -0,0 +1 @@
enable_nat_test='@osmo_ac_build_nat@'

View File

@ -31,9 +31,9 @@ cat $abs_srcdir/gprs/gprs_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gprs/gprs_test], [], [expout], [ignore]) AT_CHECK([$abs_top_builddir/tests/gprs/gprs_test], [], [expout], [ignore])
AT_CLEANUP AT_CLEANUP
m4_ifdef([ENABLE_NAT_TEST],[
AT_SETUP([bsc-nat]) AT_SETUP([bsc-nat])
AT_KEYWORDS([bsc-nat]) AT_KEYWORDS([bsc-nat])
AT_CHECK([test "$enable_nat_test" != no || exit 77])
cat $abs_srcdir/bsc-nat/bsc_nat_test.ok > expout cat $abs_srcdir/bsc-nat/bsc_nat_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bsc-nat/bsc_nat_test], [], [expout], [ignore]) AT_CHECK([$abs_top_builddir/tests/bsc-nat/bsc_nat_test], [], [expout], [ignore])
AT_CLEANUP]) AT_CLEANUP