From: Yi Fan Yu <[email protected]>

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 <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
(cherry picked from commit 9dda6b9608f3d8a06806b595a909d44bc00c377b)
Signed-off-by: Armin Kuster <[email protected]>
---
 ...-tests-disable-the-check-for-inotify.patch | 46 +++++++++++++++++++
 .../rsyslog/rsyslog/run-ptest                 |  6 ++-
 .../rsyslog/rsyslog_8.2102.0.bb               | 15 +++---
 3 files changed, 60 insertions(+), 7 deletions(-)
 create mode 100644 
meta-oe/recipes-extended/rsyslog/rsyslog/0001-tests-disable-the-check-for-inotify.patch

diff --git 
a/meta-oe/recipes-extended/rsyslog/rsyslog/0001-tests-disable-the-check-for-inotify.patch
 
b/meta-oe/recipes-extended/rsyslog/rsyslog/0001-tests-disable-the-check-for-inotify.patch
new file mode 100644
index 00000000000..552172d3974
--- /dev/null
+++ 
b/meta-oe/recipes-extended/rsyslog/rsyslog/0001-tests-disable-the-check-for-inotify.patch
@@ -0,0 +1,46 @@
+From 194e199ce08acc2192f6a63420ff24d9064666e5 Mon Sep 17 00:00:00 2001
+From: Yi Fan Yu <[email protected]>
+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 <[email protected]>
+---
+ 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
+
diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/run-ptest 
b/meta-oe/recipes-extended/rsyslog/rsyslog/run-ptest
index aa698d85ce1..efa9ba3ed01 100644
--- a/meta-oe/recipes-extended/rsyslog/rsyslog/run-ptest
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog/run-ptest
@@ -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
diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog_8.2102.0.bb 
b/meta-oe/recipes-extended/rsyslog/rsyslog_8.2102.0.bb
index 22059d1407b..921124024cb 100644
--- a/meta-oe/recipes-extended/rsyslog/rsyslog_8.2102.0.bb
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog_8.2102.0.bb
@@ -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}"
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#90673): 
https://lists.openembedded.org/g/openembedded-devel/message/90673
Mute This Topic: https://lists.openembedded.org/mt/81947023/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to