Skip to content

Commit

Permalink
Merge pull request #203 from kronosnet/test-rpm
Browse files Browse the repository at this point in the history
enable shipping of the testsuite
  • Loading branch information
fabbione committed Mar 11, 2019
2 parents b1f8077 + ccf9dee commit 9e6a7f7
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ if BUILD_MAN
sed -i -e "s#@buildman@#bcond_without#g" $@-t
else
sed -i -e "s#@buildman@#bcond_with#g" $@-t
endif
if INSTALL_TESTS
sed -i -e "s#@installtests@#bcond_without#g" $@-t
else
sed -i -e "s#@installtests@#bcond_with#g" $@-t
endif
sed -i -e "s#@defaultadmgroup@#$(DEFAULTADMGROUP)#g" $@-t
chmod a-w $@-t
Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ KNET_OPTION_DEFINES([bzip2],[compress],[
[AC_MSG_ERROR(["missing required bzlib.h"])])])
])

AC_ARG_ENABLE([install-tests],
[AS_HELP_STRING([--enable-install-tests],[install tests])],,
[ enable_install_tests="no" ])
AM_CONDITIONAL([INSTALL_TESTS], [test x$enable_install_tests = xyes])

AC_ARG_ENABLE([poc],
[AS_HELP_STRING([--enable-poc],[enable building poc code])],,
[ enable_poc="no" ])
Expand Down Expand Up @@ -294,6 +299,11 @@ fi
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[enable debug build])])

AC_ARG_WITH([testdir],
[AS_HELP_STRING([--with-testdir=DIR],[path to /usr/lib../kronosnet/tests/ dir where to install the test suite])],
[ TESTDIR="$withval" ],
[ TESTDIR="$libdir/kronosnet/tests" ])

AC_ARG_WITH([initdefaultdir],
[AS_HELP_STRING([--with-initdefaultdir=DIR],[path to /etc/sysconfig or /etc/default dir])],
[ INITDEFAULTDIR="$withval" ],
Expand Down Expand Up @@ -333,6 +343,7 @@ DEFAULT_CONFIG_DIR=${sysconfdir}/kronosnet

## do subst

AC_SUBST([TESTDIR])
AC_SUBST([DEFAULT_CONFIG_DIR])
AC_SUBST([INITDEFAULTDIR])
AC_SUBST([INITDDIR])
Expand Down
22 changes: 22 additions & 0 deletions kronosnet.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
%@rpmdebuginfo@ rpmdebuginfo
%@overriderpmdebuginfo@ overriderpmdebuginfo
%@buildman@ buildman
%@installtests@ installtests

%if %{with overriderpmdebuginfo}
%undefine _enable_debug_packages
Expand Down Expand Up @@ -72,6 +73,9 @@
%if %{with buildman}
%global buildmanpages 1
%endif
%if %{with installtests}
%global installtestsuite 1
%endif

# main (empty) package
# http://www.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html
Expand Down Expand Up @@ -140,6 +144,11 @@ BuildRequires: libtool
%endif

%{configure} \
%if %{defined installtestsuite}
--enable-install-tests \
%else
--disable-install-tests \
%endif
%if %{defined buildmanpages}
--enable-man \
%else
Expand Down Expand Up @@ -531,6 +540,19 @@ Requires: libknet1-crypto-plugins-all

%files -n libknet1-plugins-all

%if %{with installtests}
%package -n kronosnet-tests
Group: System Environment/Libraries
Summary: kronosnet test suite

%description -n kronosnet-tests
this package contains all the libknet and libnozzle test suite

%files -n kronosnet-tests
%defattr(-,root,root,-)
%{_libdir}/kronosnet/tests/*
%endif

%if %{with rpmdebuginfo}
%debug_package
%endif
Expand Down
6 changes: 5 additions & 1 deletion libknet/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ fun_checks =
benchmarks = \
knet_bench_test

# int_links_acl_test can´t run yet standalone
noinst_PROGRAMS = \
api_knet_handle_new_limit_test \
pckt_test \
Expand All @@ -53,6 +52,11 @@ noinst_SCRIPTS = \

TESTS = $(check_PROGRAMS)

if INSTALL_TESTS
testsuitedir = $(TESTDIR)
testsuite_PROGRAMS = $(noinst_PROGRAMS)
endif

check-local: check-api-test-coverage

check-api-test-coverage:
Expand Down
5 changes: 5 additions & 0 deletions libnozzle/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ noinst_SCRIPTS = \

TESTS = $(check_PROGRAMS)

if INSTALL_TESTS
testsuitedir = $(TESTDIR)
testsuite_PROGRAMS = $(noinst_PROGRAMS)
endif

check-local: check-api-test-coverage

check-api-test-coverage:
Expand Down

0 comments on commit 9e6a7f7

Please sign in to comment.