jsoncpp: add ptest support
PATCH 1/1 jsoncpp: add ptest support
Add ptest support for jsoncpp to enable automated testing of the JSON C++ library functionality.
Note:
- Tested on: WRLinux master-wr (based on meta-openembedded master)
- jsoncpp version: 1.9.7
- Unable to test on pure upstream due to poky/meta-oe branch mismatch
Test Result:
root@qemux86-64:~# ptest-runner jsoncpp START: ptest-runner 2026-04-15T14:04 BEGIN: /usr/lib64/jsoncpp/ptest PASS: jsoncpp_readerwriter PASS: jsoncpp_readerwriter_json_checker PASS: jsoncpp_test DURATION: 122 END: /usr/lib64/jsoncpp/ptest 2026-04-15T14:06 STOP: ptest-runner TOTAL: 1 FAIL: 0
Signed-off-by Zeming LIU <[email protected]>
--- .../include/ptest-packagelists-meta-oe.inc | 1 + .../recipes-devtools/jsoncpp/files/run-ptest | 4 +++ .../recipes-devtools/jsoncpp/jsoncpp_1.9.7.bb | 34 +++++++++++++++---- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 meta-oe/recipes-devtools/jsoncpp/files/run-ptest
meta-oe/conf/include/ptest-packagelists-meta-oe.inc +1 -0
@@ -73,6 +73,7 @@ PTESTS_SLOW_META_OE = "\ c-ares \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'freerdp', '', d)} \ fftw \ + jsoncpp \ libusb-compat \ mariadb \ postgresql \
meta-oe/recipes-devtools/jsoncpp/files/run-ptest new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh + +cd src +ctest --force-new-ctest-process | sed -u 's/\*\*\*/ /g' | awk '/Test +#/{gsub(/Passed/,"PASS"); gsub(/Failed/,"FAIL"); gsub(/Skipped/,"SKIP"); print $6": "$4; fflush();}'
meta-oe/recipes-devtools/jsoncpp/jsoncpp_1.9.7.bb +28 -6
@@ -14,11 +14,33 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926" PE = "1" SRCREV = "3455302847cf1e4671f1d8f5fa953fd46a7b1404" -SRC_URI = "git://github.com/open-source-parsers/jsoncpp;branch=master;protocol=https;tag=${PV}" - - -inherit cmake - -EXTRA_OECMAKE += "-DBUILD_SHARED_LIBS=ON -DBUILD_OBJECT_LIBS=OFF -DJSONCPP_WITH_TESTS=OFF" +SRC_URI = "git://github.com/open-source-parsers/jsoncpp;branch=master;protocol=https;tag=${PV} \ + file://run-ptest \ + " + +inherit cmake ptest + +EXTRA_OECMAKE += "-DBUILD_SHARED_LIBS=ON -DBUILD_OBJECT_LIBS=OFF \ + ${@bb.utils.contains('PTEST_ENABLED', '1', '-DJSONCPP_WITH_TESTS=ON -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF', '-DJSONCPP_WITH_TESTS=OFF', d)} \ + " + +DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'rsync-native', '', d)}" +RDEPENDS:${PN}-ptest += "cmake python3-core" + +do_install_ptest () { + cp -r ${B}/bin ${D}${PTEST_PATH} + cp -r ${S}/test ${D}${PTEST_PATH} + + rsync -a ${B}/src ${D}${PTEST_PATH} \ + --exclude CMakeFiles \ + --exclude cmake_install.cmake \ + --exclude Makefile \ + --exclude generated + sed -i -e 's#${B}#${PTEST_PATH}#g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake` + sed -i -e 's#${S}#${PTEST_PATH}#g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake` + sed -i -e 's#${RECIPE_SYSROOT_NATIVE}##g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake` + sed -i -e 's#${PYTHON}#/usr/bin/python3#g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake` + sed -i -e 's#${WORKDIR}##g' `find ${D}${PTEST_PATH} -name CTestTestfile.cmake` +} BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.51.2