diff mbox series

[meta-networking,2/2] unbound: complete ptest support

Message ID 20251216115837.1669852-2-skandigraun@gmail.com
State New
Headers show
Series [meta-networking,1/2] unbound: upgrade 1.22.0 -> 1.24.2 | expand

Commit Message

Gyorgy Sarvari Dec. 16, 2025, 11:58 a.m. UTC
The recipe had already an almost working ptest config which
wasn't enabled, it just needed some small fixes to make it work:
correct the output of the run-ptest script, and install some
extra testdata.

Execution is quick, single digit seconds:

root@qemux86-64:/usr/lib/unbound/ptest/tests# ptest-runner
START: ptest-runner
2025-12-16T11:53
BEGIN: /usr/lib/unbound/ptest
Start of unbound 1.24.2 unit test.
test authzone functions
test negative cache functions
test ub_random functions
[...many lines...]
PASS: ./testdata/val_unsecds_negcache.rpl
PASS: ./testdata/val_unsecds_qtypeds.rpl
PASS: ./testdata/val_wild_pos.rpl
PASS: ./testdata/version_bind.rpl
PASS: ./testdata/version_bind_hide.rpl
PASS: ./testdata/views.rpl
DURATION: 4
END: /usr/lib/unbound/ptest
2025-12-16T11:53
STOP: ptest-runner
TOTAL: 1 FAIL: 0

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 .../ptest-packagelists-meta-networking.inc    |  1 +
 .../recipes-support/unbound/unbound/run-ptest | 20 +++++++++++++++----
 .../recipes-support/unbound/unbound_1.24.2.bb |  8 +++++++-
 3 files changed, 24 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/meta-networking/conf/include/ptest-packagelists-meta-networking.inc b/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
index 838aee94d3..9bbae5ac91 100644
--- a/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
+++ b/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
@@ -23,6 +23,7 @@  PTESTS_FAST_META_NETWORKING = "\
     python3-scapy \
     squid \
     tcpdump \
+    unbound \
     wolfssl \
 "
 PTESTS_FAST_META_NETWORKING:remove:libc-musl = "\
diff --git a/meta-networking/recipes-support/unbound/unbound/run-ptest b/meta-networking/recipes-support/unbound/unbound/run-ptest
index 433a687c65..3801233eeb 100644
--- a/meta-networking/recipes-support/unbound/unbound/run-ptest
+++ b/meta-networking/recipes-support/unbound/unbound/run-ptest
@@ -2,15 +2,27 @@ 
 
 cd tests || exit 1
 retVal=0
-./unittest
-./testbound -s
+if ./unittest; then
+    echo PASS: unittest
+else
+    echo FAIL: unittest
+    retVal=1
+fi
+
+if ./testbound -s; then
+    echo PASS: testbound selftest
+else
+    echo FAIL: testbound selftest
+    retVal=1
+fi
+
 for x in ./testdata/*.rpl; do
 	output="$(./testbound -p $x -o -vvvvv 2>&1)"
         if test $? -eq 0; then
-                echo "$x :Pass"
+                echo "PASS: $x"
         else
                 echo "$output"
-                echo "$x :Fail"
+                echo "FAIL: $x"
                 retVal=1
         fi
 done
diff --git a/meta-networking/recipes-support/unbound/unbound_1.24.2.bb b/meta-networking/recipes-support/unbound/unbound_1.24.2.bb
index 4ae8db4d08..e41e2dc065 100644
--- a/meta-networking/recipes-support/unbound/unbound_1.24.2.bb
+++ b/meta-networking/recipes-support/unbound/unbound_1.24.2.bb
@@ -47,8 +47,11 @@  do_install:append() {
 }
 
 do_install_ptest() {
-        install -d ${D}${PTEST_PATH}/tests
         install -d ${D}${PTEST_PATH}/tests/testdata
+        install -d ${D}${PTEST_PATH}/sources/${BP}
+        # unittests are looking for the data in the source folder, though it's the
+        # same data used by the other tests
+        ln -sr ${D}${PTEST_PATH}/tests ${D}${PTEST_PATH}/sources/${BP}/testdata
 
         install -m 0544 ${B}/unittest ${D}${PTEST_PATH}/tests/
         install -m 0544 ${B}/testbound ${D}${PTEST_PATH}/tests/
@@ -56,7 +59,10 @@  do_install_ptest() {
         install -m 0664 ${S}/testdata/test_sigs* ${D}${PTEST_PATH}/tests/
         install -m 0664 ${S}/testdata/test_ds* ${D}${PTEST_PATH}/tests/
         install -m 0664 ${S}/testdata/test_nsec3_hash* ${D}${PTEST_PATH}/tests/
+        install -m 0664 ${S}/testdata/test_ldnsrr* ${D}${PTEST_PATH}/tests/
+        install -m 0664 ${S}/testdata/zonemd.example* ${D}${PTEST_PATH}/tests/
         install -m 0644 ${S}/testdata/*.rpl ${D}/${PTEST_PATH}/tests/testdata/
+
 }
 
 SYSTEMD_SERVICE:${PN} = "${BPN}.service"