diff mbox series

[meta-oe,kirkstone,2/2] poco: fix ptests

Message ID 20251029205339.3826693-2-skandigraun@gmail.com
State New
Headers show
Series [meta-oe,kirkstone,1/2] mongodb: add tzdata to runtime dependencies | expand

Commit Message

Gyorgy Sarvari Oct. 29, 2025, 8:53 p.m. UTC
1. Add a patch to fix an incorrect and failing test
2. Add missing dependencies and test files
3. Enable network in run-ptest script by adding a nameserver
4. Start mongodb from run-ptest script, if it wouldn't be running.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 ...-bit-IV-with-aes-256-gcm-to-fix-4347.patch | 26 +++++++++++++++++++
 meta-oe/recipes-support/poco/poco/run-ptest   | 18 ++++++++++++-
 meta-oe/recipes-support/poco/poco_1.11.2.bb   | 17 +++++++-----
 3 files changed, 53 insertions(+), 8 deletions(-)
 create mode 100644 meta-oe/recipes-support/poco/poco/0001-fix-test-Use-96-bit-IV-with-aes-256-gcm-to-fix-4347.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/poco/poco/0001-fix-test-Use-96-bit-IV-with-aes-256-gcm-to-fix-4347.patch b/meta-oe/recipes-support/poco/poco/0001-fix-test-Use-96-bit-IV-with-aes-256-gcm-to-fix-4347.patch
new file mode 100644
index 0000000000..54d005d0c1
--- /dev/null
+++ b/meta-oe/recipes-support/poco/poco/0001-fix-test-Use-96-bit-IV-with-aes-256-gcm-to-fix-4347.patch
@@ -0,0 +1,26 @@ 
+From aa202b4eedfef259718b74a66cf0abfe7b49bb6f Mon Sep 17 00:00:00 2001
+From: Matej Kenda <matejken@gmail.com>
+Date: Wed, 3 Jan 2024 20:13:57 +0100
+Subject: [PATCH] fix(test): Use 96-bit IV with aes-256-gcm to fix (#4347):
+
+I/O error: error:1C800066:Provider routines::cipher operation failed
+
+Upstream-Status: Backport [https://github.com/pocoproject/poco/commit/0f25b4c114f23c22681a981d8aed3464530fa6b1]
+Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
+---
+ Crypto/testsuite/src/CryptoTest.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Crypto/testsuite/src/CryptoTest.cpp b/Crypto/testsuite/src/CryptoTest.cpp
+index d60f1988e..fd798e72b 100644
+--- a/Crypto/testsuite/src/CryptoTest.cpp
++++ b/Crypto/testsuite/src/CryptoTest.cpp
+@@ -214,7 +214,7 @@ void CryptoTest::testEncryptDecryptGCM()
+ {
+ 	CipherKey key("aes-256-gcm");
+ 
+-	CipherKey::ByteVec iv(20, 213);
++	CipherKey::ByteVec iv(12, 213);
+ 	key.setIV(iv);
+ 
+ 	Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(key);
diff --git a/meta-oe/recipes-support/poco/poco/run-ptest b/meta-oe/recipes-support/poco/poco/run-ptest
index 521cc08a75..fc34e86389 100644
--- a/meta-oe/recipes-support/poco/poco/run-ptest
+++ b/meta-oe/recipes-support/poco/poco/run-ptest
@@ -1,8 +1,24 @@ 
 #!/bin/sh
+
+KILL_MONGODB=false
+
+if ! pidof mongod; then
+    /usr/bin/mongod --config /etc/mongod.conf &
+    KILL_MONGODB=true
+fi
+
+if ! nslookup example.com; then
+  mv /etc/resolv.conf /etc/resolv.conf.bak
+  echo "nameserver 8.8.8.8" > /etc/resolv.conf
+  trap "mv /etc/resolv.conf.bak /etc/resolv.conf" INT EXIT
+fi
+
 while read runner; do
   oldpath=`pwd` >/dev/null
   cd bin
   echo Testing $runner
-  ./$runner -ignore $oldpath/cppignore.lnx -all
+  ./$runner -ignore $oldpath/cppignore.lnx -all && echo PASS: $runner || echo FAIL: $runner
   cd $oldpath >/dev/null
 done < testrunners
+
+[ "$KILL_MONGODB" = "true" ] && killall mongod
diff --git a/meta-oe/recipes-support/poco/poco_1.11.2.bb b/meta-oe/recipes-support/poco/poco_1.11.2.bb
index 4711c6bb92..53ea13a480 100644
--- a/meta-oe/recipes-support/poco/poco_1.11.2.bb
+++ b/meta-oe/recipes-support/poco/poco_1.11.2.bb
@@ -8,11 +8,11 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=4267f48fc738f50380cbeeb76f95cebc"
 # These dependencies are required by Foundation
 DEPENDS = "libpcre zlib"
 
-SRC_URI = " \
-    git://github.com/pocoproject/poco.git;branch=main;protocol=https \
-    file://run-ptest \
-    file://CVE-2025-6375.patch \
-   "
+SRC_URI = "git://github.com/pocoproject/poco.git;branch=main;protocol=https \
+           file://run-ptest \
+           file://CVE-2025-6375.patch \
+           file://0001-fix-test-Use-96-bit-IV-with-aes-256-gcm-to-fix-4347.patch \
+           "
 SRCREV = "9d1c428c861f2e5ccf09149bbe8d2149720c5896"
 
 UPSTREAM_CHECK_GITTAGREGEX = "poco-(?P<pver>\d+(\.\d+)+)"
@@ -79,13 +79,15 @@  python populate_packages:prepend () {
 do_install_ptest () {
        cp -rf ${B}/bin/ ${D}${PTEST_PATH}
        cp -f ${B}/lib/libCppUnit.so* ${D}${libdir}
-       cp -rf ${B}/*/testsuite/data ${D}${PTEST_PATH}/bin/
+       cp -rf ${S}/*/testsuite/data ${D}${PTEST_PATH}/bin/
        find "${D}${PTEST_PATH}" -executable -exec chrpath -d {} \;
        rm -f ${D}${PTEST_PATH}/testrunners
        for f in ${D}${PTEST_PATH}/bin/*-testrunner; do
             echo `basename $f` >> ${D}${PTEST_PATH}/testrunners
        done
        install -Dm 0644 ${S}/cppignore.lnx ${D}${PTEST_PATH}/cppignore.lnx
+       install ${B}/bin/TestLibrary.so ${D}${libdir}
+       install -D ${B}/bin/TestApp ${D}${bindir}/TestApp
 }
 
 PACKAGES_DYNAMIC = "poco-.*"
@@ -97,7 +99,8 @@  ALLOW_EMPTY:${PN} = "1"
 PACKAGES =+ "${PN}-cppunit"
 FILES:${PN}-cppunit += "${libdir}/libCppUnit.so*"
 ALLOW_EMPTY:${PN}-cppunit = "1"
+FILES:${PN}-ptest += "${bindir}/TestApp ${libdir}/TestLibrary.so"
 
-RDEPENDS:${PN}-ptest += "${PN}-cppunit"
+RDEPENDS:${PN}-ptest += "${PN}-cppunit redis mongodb"
 
 BBCLASSEXTEND = "native"