unbound: complete ptest support

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>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Gyorgy Sarvari 2025-12-16 12:58:37 +01:00 committed by Khem Raj
parent 0df484a922
commit 70a2b417c6
No known key found for this signature in database
GPG Key ID: BB053355919D3314
3 changed files with 24 additions and 5 deletions

View File

@ -23,6 +23,7 @@ PTESTS_FAST_META_NETWORKING = "\
python3-scapy \
squid \
tcpdump \
unbound \
wolfssl \
"
PTESTS_FAST_META_NETWORKING:remove:libc-musl = "\

View File

@ -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

View File

@ -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"