From da47ff291bf892cd8c5ee26698227dd8663f9e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AErekc=C3=A4H=20nitraM=E2=80=AE?= Date: Sat, 15 Mar 2025 15:39:19 +0100 Subject: [PATCH] poco: add checkPhase This executes at least part of the testsutie. All testsuites that require a service running in the background (Postgress, MongoDB, MariaDB, ...) have been skipped. If one attempts to run them, this likely requires a nixosTest to do so and provide the dependencies. Some tests I had to skip, because they break on darwin. Perhaps fixes for theste test can be developed and upstreamed, but that requires more expertise than I possess. --- .../po/poco/disable-broken-tests.patch | 21 ++++++++++++++ pkgs/by-name/po/poco/package.nix | 29 ++++++++++++++++--- 2 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 pkgs/by-name/po/poco/disable-broken-tests.patch diff --git a/pkgs/by-name/po/poco/disable-broken-tests.patch b/pkgs/by-name/po/poco/disable-broken-tests.patch new file mode 100644 index 000000000000..7c0f27352e15 --- /dev/null +++ b/pkgs/by-name/po/poco/disable-broken-tests.patch @@ -0,0 +1,21 @@ +diff --git a/Data/testsuite/src/DataTest.cpp b/Data/testsuite/src/DataTest.cpp +index a78c4e5..e8d9335 100644 +--- a/Data/testsuite/src/DataTest.cpp ++++ b/Data/testsuite/src/DataTest.cpp +@@ -1652 +1652 @@ CppUnit::Test* DataTest::suite() +- CppUnit_addTest(pSuite, DataTest, testSQLChannel); ++ // CppUnit_addTest(pSuite, DataTest, testSQLChannel); +diff --git a/Net/testsuite/src/HTTPClientSessionTest.cpp b/Net/testsuite/src/HTTPClientSessionTest.cpp +index 31de150..b5c0d13 100644 +--- a/Net/testsuite/src/HTTPClientSessionTest.cpp ++++ b/Net/testsuite/src/HTTPClientSessionTest.cpp +@@ -406 +406 @@ CppUnit::Test* HTTPClientSessionTest::suite() +- CppUnit_addTest(pSuite, HTTPClientSessionTest, testGetSmallUnix); ++ // CppUnit_addTest(pSuite, HTTPClientSessionTest, testGetSmallUnix); +diff --git a/Net/testsuite/src/SocketTest.cpp b/Net/testsuite/src/SocketTest.cpp +index 27c1800..9bd684b 100644 +--- a/Net/testsuite/src/SocketTest.cpp ++++ b/Net/testsuite/src/SocketTest.cpp +@@ -900 +900 @@ CppUnit::Test* SocketTest::suite() +- CppUnit_addTest(pSuite, SocketTest, testEchoUnixLocal); ++ // CppUnit_addTest(pSuite, SocketTest, testEchoUnixLocal); diff --git a/pkgs/by-name/po/poco/package.nix b/pkgs/by-name/po/poco/package.nix index 2117341d5232..6fa0f07d1286 100644 --- a/pkgs/by-name/po/poco/package.nix +++ b/pkgs/by-name/po/poco/package.nix @@ -54,10 +54,23 @@ stdenv.mkDerivation rec { MYSQL_DIR = libmysqlclient; MYSQL_INCLUDE_DIR = "${MYSQL_DIR}/include/mysql"; - cmakeFlags = [ - # use nix provided versions of sqlite, zlib, pcre, expat, ... instead of bundled versions - (lib.cmakeBool "POCO_UNBUNDLED" true) - ]; + cmakeFlags = + let + # These tests require running services, which the checkPhase is ill equipeed to provide + # TODO get them running in a nixosTest + excludeTestsRegex = lib.concatStringsSep "|" [ + "Redis" + "DataODBC" + "MongoDB" + "DataMySQL" + ]; + in + [ + # use nix provided versions of sqlite, zlib, pcre, expat, ... instead of bundled versions + (lib.cmakeBool "POCO_UNBUNDLED" true) + (lib.cmakeBool "ENABLE_TESTS" true) + (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;'${excludeTestsRegex}'") + ]; patches = [ # Remove on next release @@ -67,8 +80,16 @@ stdenv.mkDerivation rec { url = "https://patch-diff.githubusercontent.com/raw/pocoproject/poco/pull/4879.patch"; hash = "sha256-VFWuRuf0GPYFp43WKI8utl+agP+7a5biLg7m64EMnVo="; }) + # failing on darwin, could perhaps be patched / a fix upstreamed later + ./disable-broken-tests.patch ]; + doCheck = true; + preCheck = '' + # workaround for some tests trying to write to /homeless-shelter + export HOME=$(mktemp -d) + ''; + postFixup = '' grep -rlF INTERFACE_INCLUDE_DIRECTORIES "$dev/lib/cmake/Poco" | while read -r f; do substituteInPlace "$f" \