@@ -13,6 +13,7 @@ PTESTS_FAST_META_OE = "\
cmocka \
cunit \
duktape \
+ exiv2 \
fuse3 \
function2 \
fwupd \
new file mode 100644
@@ -0,0 +1,30 @@
+From 2483e51df6e02ad0ad5ae636767279fa230da44f Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <skandigraun@gmail.com>
+Date: Sun, 23 Nov 2025 11:52:24 +0100
+Subject: [PATCH] Allow test data path configuration
+
+The unittests expect to the executed in the source folder before/after build,
+and they expect the test data to be in the source folder. However for ptests
+these folders are not available.
+
+This patch allows the test data folders to be configuration during build time.
+
+Upstream-Status: Inappropriate [ptest-specific]
+Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
+---
+ unitTests/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/unitTests/CMakeLists.txt b/unitTests/CMakeLists.txt
+index 51040c0e2..e2604d4a7 100644
+--- a/unitTests/CMakeLists.txt
++++ b/unitTests/CMakeLists.txt
+@@ -42,7 +42,7 @@ add_executable(unit_tests
+ target_compile_definitions(unit_tests
+ PRIVATE
+ exiv2lib_STATIC
+- TESTDATA_PATH="${PROJECT_SOURCE_DIR}/test/data"
++ TESTDATA_PATH="${TEST_FOLDER}/test/data"
+ )
+
+ target_link_libraries(unit_tests
new file mode 100644
@@ -0,0 +1,35 @@
+From 09e5f783b3d1dcb7db6e975e9662c8401a614539 Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <skandigraun@gmail.com>
+Date: Sun, 23 Nov 2025 11:35:50 +0100
+Subject: [PATCH] Use automake output for tests
+
+Convert the Python unittest output to automake output so ptest can
+ingest it.
+
+Upstream-Status: Inappropriate [oe-specific]
+Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
+---
+ tests/runner.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tests/runner.py b/tests/runner.py
+index adebf83ba..9800cf971 100755
+--- a/tests/runner.py
++++ b/tests/runner.py
+@@ -4,6 +4,7 @@
+ import argparse
+ import functools
+ import os
++import putao.unittest
+ import sys
+ import unittest
+ from fnmatch import fnmatchcase
+@@ -93,7 +94,7 @@ if __name__ == '__main__':
+ DEFAULT_ROOT
+ )
+
+- test_res = unittest.runner.TextTestRunner(verbosity=args.verbose)\
++ test_res = putao.unittest.TestRunner()\
+ .run(discovered_tests)
+
+ sys.exit(0 if len(test_res.failures) + len(test_res.errors) == 0 else 1)
new file mode 100644
@@ -0,0 +1,6 @@
+#!/bin/sh
+cd tests
+python3 ./runner.py
+
+cd ..
+./build/bin/unit_tests --gtest_print_time=0 | sed -E '/^\[ RUN/d ; s/\[ OK \]/PASS: / ; s/\[ DISABLED \]/SKIP: / ; s/\[ FAILED \]/FAIL: /'
@@ -4,7 +4,34 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=625f055f41728f84a8d7938acc35bdc2"
DEPENDS = "zlib expat brotli libinih"
-SRC_URI = "git://github.com/Exiv2/exiv2.git;protocol=https;branch=0.28.x;tag=v${PV}"
+SRC_URI = "git://github.com/Exiv2/exiv2.git;protocol=https;branch=0.28.x;tag=v${PV} \
+ file://run-ptest \
+ file://0001-Use-automake-output-for-tests.patch \
+ file://0001-Allow-test-data-path-configuration.patch \
+ "
SRCREV = "afcb7a8ba84a7de36d2f1ee7689394e078697956"
-inherit cmake gettext
+inherit cmake gettext ptest
+
+PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'test unittest', '', d)}"
+PACKAGECONFIG[test] = "-DEXIV2_BUILD_SAMPLES=ON -DEXIV2_ENABLE_WEBREADY=ON"
+PACKAGECONFIG[unittest] = "-DEXIV2_BUILD_UNIT_TESTS=ON -DTEST_FOLDER=${PTEST_PATH},,googletest"
+
+RDEPENDS:${PN}-ptest += " \
+ python3-html \
+ python3-lxml \
+ python3-multiprocessing \
+ python3-shell \
+ python3-unittest \
+ python3-unittest-automake-output"
+
+do_install_ptest(){
+ cp -r ${S}/tests ${D}${PTEST_PATH}/
+ cp -r ${S}/test ${D}${PTEST_PATH}/
+
+ install -d ${D}${PTEST_PATH}/build/bin
+ install ${B}/bin/* ${D}${PTEST_PATH}/build/bin
+
+ install -d ${D}${PTEST_PATH}/src
+ install ${S}/src/canonmn_int.cpp ${D}${PTEST_PATH}/src
+}
The project has extensive runtime- and unittest suite - make use of it. It takes around 10 seconds to run both suites. Added two patches: One is needed to convert python unittest output into automake output. The other is required to be able to configure test data folder at compile time - otherwise the tests are looking for the test-data with absolute paths from the build machine. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> --- .../include/ptest-packagelists-meta-oe.inc | 1 + ...1-Allow-test-data-path-configuration.patch | 30 ++++++++++++++++ .../0001-Use-automake-output-for-tests.patch | 35 +++++++++++++++++++ meta-oe/recipes-support/exiv2/exiv2/run-ptest | 6 ++++ meta-oe/recipes-support/exiv2/exiv2_0.28.7.bb | 31 ++++++++++++++-- 5 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 meta-oe/recipes-support/exiv2/exiv2/0001-Allow-test-data-path-configuration.patch create mode 100644 meta-oe/recipes-support/exiv2/exiv2/0001-Use-automake-output-for-tests.patch create mode 100644 meta-oe/recipes-support/exiv2/exiv2/run-ptest