]> git.proxmox.com Git - mirror_kronosnet.git/commitdiff
[tests] allow shipping of the test suite
authorFabio M. Di Nitto <fdinitto@redhat.com>
Thu, 7 Mar 2019 18:28:19 +0000 (19:28 +0100)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Mon, 11 Mar 2019 10:45:40 +0000 (11:45 +0100)
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Makefile.am
configure.ac
kronosnet.spec.in
libknet/tests/Makefile.am
libnozzle/tests/Makefile.am

index 047127d53f9726e40fe022bf7bb7020b896e9376..263584f31ed6c11c075a67cc9479c3547d1101b3 100644 (file)
@@ -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
index 8cb357ae3be5c202e928dff1333672278cb105b0..8b3dceb76864bfd5835d100c72e180b4a8f5f7da 100644 (file)
@@ -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" ])
@@ -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" ],
@@ -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])
index 9caf13b9fe430ec09413292d311727e6a8275cf7..bb6f073a862002e446cd03105d253b3fc0206160 100644 (file)
@@ -30,6 +30,7 @@
 %@rpmdebuginfo@ rpmdebuginfo
 %@overriderpmdebuginfo@ overriderpmdebuginfo
 %@buildman@ buildman
+%@installtests@ installtests
 
 %if %{with overriderpmdebuginfo}
 %undefine _enable_debug_packages
@@ -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
@@ -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
@@ -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
index 66c12ef93d04ec0f32c364d41cdeee42b46506dd..c726c2129e9c6f6137e8797e8f7fc2ed3890a2f1 100644 (file)
@@ -52,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:
index 9a732d521e96a25b29ae0f986d86ae2d0d41fc06..c7adbe4c7805db3b6627010fecb60bb271c47cc7 100644 (file)
@@ -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: