rsyslog: fix some of the ptests

Run test as non-root 'tester'.
Add more rdepends for ptest.

Introduce a patch to skip checking for a libc header:
    sys/inotify

Python scripts no longer called with ./script.
Remove the need to add the correct shebang.
Ptest results:

    8.2102.0
===============
TOTAL: 424
PASS:  417
SKIP:  5
XFAIL: 0
FAIL:  2
XPASS: 0
ERROR: 0

Remaining failure related to relp:
* imrelp-tls-cfgcmd
* sndrcv_relp_tls-cfgcmd

the test expects an error "relp connect failed with return 10031",
but the connection seems to be established and working.

Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Yi Fan Yu 2021-03-30 11:10:51 -04:00 committed by Khem Raj
parent 285e4c9bfb
commit 9dda6b9608
3 changed files with 60 additions and 7 deletions

View File

@ -0,0 +1,46 @@
From 194e199ce08acc2192f6a63420ff24d9064666e5 Mon Sep 17 00:00:00 2001
From: Yi Fan Yu <yifan.yu@windriver.com>
Date: Sat, 27 Mar 2021 19:18:25 -0400
Subject: [PATCH] tests: disable the check for inotify
We don't need to check inotify.h.
Assume it is present since it is part of the linux kernel
since 2.6.13 [1].
[1](https://kernelnewbies.org/Linux_2_6_13)
(it would require installing the libc headers otherwise,
for the test to detect /usr/include/sys/inotify.h.)
Upstream-Status: Inappropriate[OE-specific]
Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
---
tests/diag.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/diag.sh b/tests/diag.sh
index 6cd60ea88..7424f48c5 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -2672,7 +2672,7 @@ case $1 in
fi
;;
'check-inotify') # Check for inotify/fen support
- if [ -n "$(find /usr/include -name 'inotify.h' -print -quit)" ]; then
+ if true; then
echo [inotify mode]
elif [ -n "$(find /usr/include/sys/ -name 'port.h' -print -quit)" ]; then
grep -qF "PORT_SOURCE_FILE" < /usr/include/sys/port.h
@@ -2687,7 +2687,7 @@ case $1 in
fi
;;
'check-inotify-only') # Check for ONLY inotify support
- if [ -n "$(find /usr/include -name 'inotify.h' -print -quit)" ]; then
+ if true; then
echo [inotify mode]
else
echo [inotify not supported, skipping...]
--
2.29.2

View File

@ -5,4 +5,8 @@ set -o pipefail
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
cd ${SCRIPTPATH}
make -C tests -k check-TESTS
useradd tester || echo "user already exists"
ln -sf /usr/sbin/logrotate /usr/bin/logrotate
su tester -c "make -C tests -k check-TESTS"
userdel tester
rm -f /usr/bin/logrotate

View File

@ -24,6 +24,7 @@ SRC_URI = "http://www.rsyslog.com/download/files/download/rsyslog/${BPN}-${PV}.t
file://rsyslog.service \
file://use-pkgconfig-to-check-libgcrypt.patch \
file://run-ptest \
file://0001-tests-disable-the-check-for-inotify.patch \
"
SRC_URI_append_libc-musl = " \
@ -80,11 +81,6 @@ PACKAGECONFIG[mail] = "--enable-mail,--disable-mail,,"
PACKAGECONFIG[valgrind] = ",--without-valgrind-testbench,valgrind,"
PACKAGECONFIG[imhttp] = "--enable-imhttp,--disable-imhttp,civetweb,"
do_configure_prepend() {
sed -i -e 's|python |python3 |g' ${S}/tests/*.sh
sed -i -e 's|/usr/bin/env python|/usr/bin/env python3|g' ${S}/tests/*.py
sed -i -e 's|/usr/bin/env python|/usr/bin/env python3|g' ${S}/tests/testsuites/*.py
}
TESTDIR = "tests"
do_compile_ptest() {
@ -97,6 +93,10 @@ do_install_ptest() {
cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}
cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH}
# give permissions to all users
# some tests need to write to this directory as user 'daemon'
chmod 777 -R ${D}${PTEST_PATH}/tests
# do NOT need to rebuild Makefile itself
sed -i 's/^Makefile:.*$/Makefile:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
# do NOT need to rebuild $(check_PROGRAMS)
@ -195,8 +195,11 @@ VALGRIND_libc-musl_powerpc64le = ''
VALGRIND_riscv64 = ""
VALGRIND_riscv32 = ""
# util-linux: logger needs the -d option
RDEPENDS_${PN}-ptest += "\
make diffutils gzip bash gawk coreutils procps \
libgcc python3-core python3-io \
libgcc python3-core python3-io python3-json \
curl util-linux shadow \
"
RRECOMMENDS_${PN}-ptest += "${TCLIBC}-dbg ${VALGRIND}"