@@ -50,6 +50,7 @@ PTESTS_FAST_META_OE = "\
nlohmann-json \
nodejs \
onig \
+ openjpeg \
oprofile \
pegtl \
pv \
new file mode 100644
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Only run unit tests, exclude nonregression and conformance tests that need external data files
+ctest -E "(NR-|CONF-|ETS-|testjp2)" -V | sed -u 's/\*\*\*/ /g' | awk '/Test +#/{gsub(/Passed/,"PASS"); gsub(/Failed/,"FAIL"); gsub(/Skipped/,"SKIP"); print $6": "$4; fflush();}'
@@ -9,14 +9,48 @@ SRC_URI = "git://github.com/uclouvain/openjpeg.git;branch=master;protocol=https
file://0001-Do-not-ask-cmake-to-export-binaries-they-don-t-make-.patch \
file://CVE-2023-39327.patch \
file://CVE-2026-6192.patch \
+ file://run-ptest \
"
SRCREV = "6c4a29b00211eb0430fa0e5e890f1ce5c80f409f"
-inherit cmake
+inherit cmake ptest
# for multilib
EXTRA_OECMAKE += "-DOPENJPEG_INSTALL_LIB_DIR=${@d.getVar('baselib').replace('/', '')}"
+EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DBUILD_TESTING=ON', '', d)}"
+
FILES:${PN} += "${libdir}/openjpeg*"
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}
+
+ # Install test binaries only
+ if [ -d ${B}/bin ]; then
+ install -d ${D}${PTEST_PATH}/bin
+ find ${B}/bin -maxdepth 1 -type f -executable ! -name "*.so*" \
+ -exec install -m 0755 {} ${D}${PTEST_PATH}/bin/ \;
+ fi
+
+ # Install CTest configuration files with proper structure
+ if [ -d ${B}/tests ]; then
+ cp -r ${B}/tests ${D}${PTEST_PATH}/
+ fi
+ if [ -f ${B}/CTestTestfile.cmake ]; then
+ install -m 0644 ${B}/CTestTestfile.cmake ${D}${PTEST_PATH}/
+ fi
+
+ # Fix all build paths in cmake files to point to ptest installation
+ find ${D}${PTEST_PATH} \( -name "*.cmake" -o -name "*.ctest" \) -type f -exec sed -i \
+ -e "s#${B}/bin#${PTEST_PATH}/bin#g" \
+ -e "s#${B}#${PTEST_PATH}#g" \
+ -e "s#${S}#${PTEST_PATH}#g" \
+ -e "s#${TMPDIR}#/tmp#g" \
+ -e "s#${STAGING_DIR_NATIVE}##g" \
+ -e "s#/tmp/work/[^/]*/[^/]*/[^/]*/recipe-sysroot-native/usr/bin/cmake#/usr/bin/cmake#g" \
+ {} +
+}
+
+RDEPENDS:${PN}-ptest += "${PN} bash cmake"
+
BBCLASSEXTEND = "native nativesdk"