rsyslog: add ptest support

Changed:
- add a patch to use serial-tests config needed by ptest
- add a patch to fix rsyslog test cases don't finish issue
- add run-ptest, do_compile_ptest and do_install_ptest
- add dependency for rsyslog-ptest
- add PACKAGECONFIG for valgrind

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Jackie Huang
2014-09-12 03:41:11 -04:00
committed by Martin Jansa
parent d3f979c07e
commit a6e7689167
4 changed files with 185 additions and 1 deletions
@@ -0,0 +1,96 @@
$MaxMessageSize doesn't work if before $IncludeConfig diag-common.conf, then
test cases fall into infinite loop with error message:
8062.511110729:4902c480: error: message received is larger than max msg size, we split it
8062.511152265:4902c480: discarding zero-sized message
Update configure to fix it.
Upstream-Status: pending
Kai Kang <kai.kang@windriver.com>
---
diff -Nru rsyslog-7.4.4/tests/testsuites/complex1.conf rsyslog-7.4.4.new/tests/testsuites/complex1.conf
--- rsyslog-7.4.4/tests/testsuites/complex1.conf 2013-08-31 00:30:41.000000000 +0800
+++ rsyslog-7.4.4.new/tests/testsuites/complex1.conf 2013-12-18 14:28:10.644004184 +0800
@@ -1,7 +1,7 @@
# complex test case with multiple actions in gzip mode
# rgerhards, 2009-05-22
-$MaxMessageSize 10k
$IncludeConfig diag-common.conf
+$MaxMessageSize 10k
$MainMsgQueueTimeoutEnqueue 5000
diff -Nru rsyslog-7.4.4/tests/testsuites/gzipwr_large.conf rsyslog-7.4.4.new/tests/testsuites/gzipwr_large.conf
--- rsyslog-7.4.4/tests/testsuites/gzipwr_large.conf 2012-04-04 14:29:55.000000000 +0800
+++ rsyslog-7.4.4.new/tests/testsuites/gzipwr_large.conf 2013-12-18 14:28:10.645004186 +0800
@@ -1,7 +1,7 @@
# simple async writing test
# rgerhards, 2010-03-09
-$MaxMessageSize 10k
$IncludeConfig diag-common.conf
+$MaxMessageSize 10k
$ModLoad ../plugins/imtcp/.libs/imtcp
$MainMsgQueueTimeoutShutdown 10000
diff -Nru rsyslog-7.4.4/tests/testsuites/gzipwr_large_dynfile.conf rsyslog-7.4.4.new/tests/testsuites/gzipwr_large_dynfile.conf
--- rsyslog-7.4.4/tests/testsuites/gzipwr_large_dynfile.conf 2012-04-04 14:29:55.000000000 +0800
+++ rsyslog-7.4.4.new/tests/testsuites/gzipwr_large_dynfile.conf 2013-12-18 14:28:10.645004186 +0800
@@ -1,7 +1,7 @@
# simple async writing test
# rgerhards, 2010-03-09
-$MaxMessageSize 10k
$IncludeConfig diag-common.conf
+$MaxMessageSize 10k
$ModLoad ../plugins/imtcp/.libs/imtcp
$MainMsgQueueTimeoutShutdown 10000
diff -Nru rsyslog-7.4.4/tests/testsuites/imptcp_conndrop.conf rsyslog-7.4.4.new/tests/testsuites/imptcp_conndrop.conf
--- rsyslog-7.4.4/tests/testsuites/imptcp_conndrop.conf 2013-08-31 00:30:41.000000000 +0800
+++ rsyslog-7.4.4.new/tests/testsuites/imptcp_conndrop.conf 2013-12-18 14:28:10.646004189 +0800
@@ -1,7 +1,7 @@
# simple async writing test
# rgerhards, 2010-03-09
-$MaxMessageSize 10k
$IncludeConfig diag-common.conf
+$MaxMessageSize 10k
$ModLoad ../plugins/imptcp/.libs/imptcp
$MainMsgQueueTimeoutShutdown 10000
diff -Nru rsyslog-7.4.4/tests/testsuites/imptcp_large.conf rsyslog-7.4.4.new/tests/testsuites/imptcp_large.conf
--- rsyslog-7.4.4/tests/testsuites/imptcp_large.conf 2013-08-31 00:30:41.000000000 +0800
+++ rsyslog-7.4.4.new/tests/testsuites/imptcp_large.conf 2013-12-18 14:28:10.646004189 +0800
@@ -1,7 +1,7 @@
# simple async writing test
# rgerhards, 2010-03-09
-$MaxMessageSize 10k
$IncludeConfig diag-common.conf
+$MaxMessageSize 10k
$ModLoad ../plugins/imptcp/.libs/imptcp
$MainMsgQueueTimeoutShutdown 10000
diff -Nru rsyslog-7.4.4/tests/testsuites/imtcp_conndrop.conf rsyslog-7.4.4.new/tests/testsuites/imtcp_conndrop.conf
--- rsyslog-7.4.4/tests/testsuites/imtcp_conndrop.conf 2013-07-19 20:59:03.000000000 +0800
+++ rsyslog-7.4.4.new/tests/testsuites/imtcp_conndrop.conf 2013-12-18 14:28:10.646004189 +0800
@@ -1,7 +1,7 @@
# simple async writing test
# rgerhards, 2010-03-09
-$MaxMessageSize 10k
$IncludeConfig diag-common.conf
+$MaxMessageSize 10k
$ModLoad ../plugins/imtcp/.libs/imtcp
$MainMsgQueueTimeoutShutdown 10000
diff -Nru rsyslog-7.4.4/tests/testsuites/wr_large.conf rsyslog-7.4.4.new/tests/testsuites/wr_large.conf
--- rsyslog-7.4.4/tests/testsuites/wr_large.conf 2012-04-04 14:29:55.000000000 +0800
+++ rsyslog-7.4.4.new/tests/testsuites/wr_large.conf 2013-12-18 14:28:10.647004190 +0800
@@ -1,7 +1,7 @@
# simple async writing test
# rgerhards, 2010-03-09
-$MaxMessageSize 10k
$IncludeConfig diag-common.conf
+$MaxMessageSize 10k
$ModLoad ../plugins/imtcp/.libs/imtcp
$MainMsgQueueTimeoutShutdown 10000
@@ -0,0 +1,28 @@
Subject: [PATCH] rsyslog: use serial-tests config needed by ptest
ptest needs buildtest-TESTS and runtest-TESTS targets.
serial-tests is required to generate those targets.
Upstream-Status: Inappropriate [default automake behavior incompatible with ptest]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 1b880f8..0e29742 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ(2.61)
AC_INIT([rsyslog],[7.4.4],[rsyslog@lists.adiscon.com])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([serial-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
--
2.0.0
@@ -0,0 +1,3 @@
#!/bin/sh
#
make -C tests -k runtest-TESTS
@@ -22,12 +22,15 @@ SRC_URI = "http://www.rsyslog.com/files/download/rsyslog/${BPN}-${PV}.tar.gz \
file://rsyslog.conf \
file://rsyslog.logrotate \
file://use-pkgconfig-to-check-libgcrypt.patch \
file://run-ptest \
file://rsyslog-fix-ptest-not-finish.patch \
file://rsyslog-use-serial-tests-config-needed-by-ptest.patch \
"
SRC_URI[md5sum] = "ebcc010a6205c28eb505c0fe862f32c6"
SRC_URI[sha256sum] = "276d094d1e4c62c770ec8a72723667f119eee038912b79cf3337d439bc2f9087"
inherit autotools pkgconfig systemd update-rc.d update-alternatives
inherit autotools pkgconfig systemd update-rc.d update-alternatives ptest
EXTRA_OECONF += "--enable-cached-man-pages"
@@ -37,6 +40,7 @@ PACKAGECONFIG ??= " \
imdiag gnutls \
${@base_contains('DISTRO_FEATURES', 'snmp', 'snmp', '', d)} \
${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
${@base_contains('DISTRO_FEATURES', 'ptest', 'testbench ${VALGRIND}', '', d)} \
"
# default yes in configure
@@ -61,6 +65,50 @@ PACKAGECONFIG[postgresql] = "--enable-pgsql,--disable-pgsql,postgresql,"
PACKAGECONFIG[libdbi] = "--enable-libdbi,--disable-libdbi,libdbi,"
PACKAGECONFIG[mail] = "--enable-mail,--disable-mail,,"
PACKAGECONFIG[gui] = "--enable-gui,--disable-gui,,"
PACKAGECONFIG[valgrind] = "--enable-valgrind,--disable-valgrind,valgrind,"
TESTDIR = "tests"
do_compile_ptest() {
sed -i 's/\(^buildtest-TESTS: \)/\1 $(check_PROGRAMS) /' ${TESTDIR}/Makefile
oe_runmake -C ${TESTDIR} buildtest-TESTS
}
do_install_ptest() {
# install the tests
cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}
cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH}
# do NOT need to rebuild Makefile itself
sed -i 's/^Makefile:.*$/Makefile:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
# fix the srcdir
sed -i 's,^\(srcdir = \).*,\1${PTEST_PATH}/tests,' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
# valgrind is not compatible with arm and mips,
# so remove related test cases if there is no valgrind.
if [ x${VALGRIND} = x ]; then
sed -i '/udp-msgreduc-/d' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
fi
# install necessary links
install -d ${D}${PTEST_PATH}/tools
ln -sf ${sbindir}/rsyslogd ${D}${PTEST_PATH}/tools/rsyslogd
install -d ${D}${PTEST_PATH}/runtime
install -d ${D}${PTEST_PATH}/runtime/.libs
(
cd ${D}/${libdir}/rsyslog
allso="*.so"
for i in $allso; do
ln -sf ${libdir}/rsyslog/$i ${D}${PTEST_PATH}/runtime/.libs/$i
done
)
# fix the module load path with runtime/.libs
find ${D}${PTEST_PATH}/${TESTDIR} -name \*.conf -exec \
sed -i -e 's:../plugins/.*/.libs/:../runtime/.libs/:' \
'{}' \;
}
do_install_append() {
install -d "${D}${sysconfdir}/init.d"
@@ -95,6 +143,15 @@ SYSTEMD_SERVICE_${PN} = "${BPN}.service"
RDEPENDS_${PN} += "logrotate"
# for rsyslog-ptest
VALGRIND = "valgrind"
VALGRIND_mips = ""
VALGRIND_mips64 = ""
VALGRIND_arm = ""
VALGRIND_aarch64 = ""
RDEPENDS_${PN}-ptest += "make diffutils gzip"
RRECOMMENDS_${PN}-ptest += "${TCLIBC}-dbg ${VALGRIND}"
# no syslog-init for systemd
python () {
if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):