tests: Enable the vty tests for the osmo-pcap as well

Change-Id: I1704e0d58a04770a3aac1f70f3e01ee9ac585dbf
This commit is contained in:
Holger Hans Peter Freyther 2016-09-08 15:09:16 +02:00
parent fa5572e2af
commit 0b4b824887
7 changed files with 114 additions and 2 deletions

7
.gitignore vendored
View File

@ -5,6 +5,7 @@ Makefile
Makefile.in
*.*~
*.sw?
*.pyc
#configure
aclocal.m4
@ -27,3 +28,9 @@ osmopcapconfig.h*
# apps
src/osmo_pcap_client
src/osmo_pcap_server
# tests
tests/atconfig
tests/package.m4
tests/testsuite
tests/testsuite.log

View File

@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6
SUBDIRS = include src contrib
SUBDIRS = include src contrib tests
BUILT_SOURCES = $(top_srcdir)/.version
EXTRA_DIST = git-version-gen .version

View File

@ -4,6 +4,7 @@ AC_INIT([osmo-pcap],
[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])])
@ -17,6 +18,20 @@ AC_PROG_RANLIB
dnl checks for header files
AC_HEADER_STDC
AC_ARG_ENABLE([external_tests],
AC_HELP_STRING([--enable-external-tests],
[Include the VTY tests in make check [default=no]]),
[enable_ext_tests="$enableval"],[enable_ext_tests="no"])
if test "x$enable_ext_tests" = "xyes" ; then
AM_PATH_PYTHON
AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
AC_MSG_ERROR([Please install osmocom-python to run the VTY tests.])
fi
fi
AC_MSG_CHECKING([whether to enable VTY tests])
AC_MSG_RESULT([$enable_ext_tests])
AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
dnl Checks for typedefs, structures and compiler characteristics
AC_ARG_WITH([pcap-config],
@ -72,4 +87,5 @@ AC_OUTPUT(
include/osmo-pcap/Makefile
src/Makefile
contrib/Makefile
tests/Makefile
Makefile)

View File

@ -12,9 +12,16 @@ git reset --hard 460f9ef7da1db11b104fdfe635ebcbd8a071f205
autoreconf --install --force
./configure --prefix=$PWD/../install
make -j 4 install
export LD_LIBRARY_PATH=$PWD/../install/lib
cd ../
git clone git://git.osmocom.org/python/osmo-python-tests
cd osmo-python-tests
sudo ./setup.py install
cd ../../
autoreconf --install --force
PCAP_LIBS="-lpcap" PCAP_CFLAGS="" PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig ./configure --with-pcap-config=/bin/true
PCAP_LIBS="-lpcap" PCAP_CFLAGS="" PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig ./configure --with-pcap-config=/bin/true --enable-external-tests
PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig make -j 4
PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig make check
DISTCHECK_CONFIGURE_FLAGS="--with-pcap-config=/bin/true" PCAP_LIBS="-lpcap" PCAP_CFLAGS="" PKG_CONFIG_PATH=$PWD/deps/install/lib/pkgconfig LD_LIBRARY_PATH=$PWD/deps/install/lib make distcheck

30
osmoappdesc.py Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
# (C) 2016 by Holger Hans Peter Freyther
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
app_configs = {
"osmo-pcap-client": ["contrib/osmo-pcap-client.cfg"],
"osmo-pcap-server": ["contrib/osmo-pcap-server.cfg"]
}
apps = [
(4241, "src/osmo_pcap_server", "OsmoPCAPServer", "osmo-pcap-server"),
(4240, "src/osmo_pcap_client", "OsmoPCAPClient", "osmo-pcap-client"),
]
vty_command = ["src/osmo_pcap_server", "-c", "contrib/osmo-pcap-server.cfg"]
vty_app = apps[0]

49
tests/Makefile.am Normal file
View File

@ -0,0 +1,49 @@
# 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)
TESTSUITE = $(srcdir)/testsuite
if ENABLE_EXT_TESTS
python-tests: $(BUILT_SOURCES)
osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
else
python-tests: $(BUILT_SOURCES)
echo "Not running python-based tests (determined at configure-time)"
endif
check-local: atconfig $(TESTSUITE)
$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
$(MAKE) $(AM_MAKEFLAGS) python-tests
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 $@

3
tests/testsuite.at Normal file
View File

@ -0,0 +1,3 @@
AT_INIT
AT_BANNER([Regression tests.])