summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-11-23 12:09:35 +0100
committerKhem Raj <raj.khem@gmail.com>2025-11-23 09:05:41 -0800
commit35bc4860f18cd56a80ee29d492540acfcb620b59 (patch)
tree0a72d42d28ccde82522e25e0df2f104d55fdfaf0
parent09c7f76c196876a4366f220b360f4bdb93ab95c0 (diff)
downloadmeta-openembedded-35bc4860f18cd56a80ee29d492540acfcb620b59.tar.gz
exiv2: add ptest support
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> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/conf/include/ptest-packagelists-meta-oe.inc1
-rw-r--r--meta-oe/recipes-support/exiv2/exiv2/0001-Allow-test-data-path-configuration.patch30
-rw-r--r--meta-oe/recipes-support/exiv2/exiv2/0001-Use-automake-output-for-tests.patch35
-rw-r--r--meta-oe/recipes-support/exiv2/exiv2/run-ptest6
-rw-r--r--meta-oe/recipes-support/exiv2/exiv2_0.28.7.bb31
5 files changed, 101 insertions, 2 deletions
diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
index ea336f1058..0473b60504 100644
--- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
+++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
@@ -13,6 +13,7 @@ PTESTS_FAST_META_OE = "\
13 cmocka \ 13 cmocka \
14 cunit \ 14 cunit \
15 duktape \ 15 duktape \
16 exiv2 \
16 fuse3 \ 17 fuse3 \
17 function2 \ 18 function2 \
18 fwupd \ 19 fwupd \
diff --git a/meta-oe/recipes-support/exiv2/exiv2/0001-Allow-test-data-path-configuration.patch b/meta-oe/recipes-support/exiv2/exiv2/0001-Allow-test-data-path-configuration.patch
new file mode 100644
index 0000000000..a5345733fb
--- /dev/null
+++ b/meta-oe/recipes-support/exiv2/exiv2/0001-Allow-test-data-path-configuration.patch
@@ -0,0 +1,30 @@
1From 2483e51df6e02ad0ad5ae636767279fa230da44f Mon Sep 17 00:00:00 2001
2From: Gyorgy Sarvari <skandigraun@gmail.com>
3Date: Sun, 23 Nov 2025 11:52:24 +0100
4Subject: [PATCH] Allow test data path configuration
5
6The unittests expect to the executed in the source folder before/after build,
7and they expect the test data to be in the source folder. However for ptests
8these folders are not available.
9
10This patch allows the test data folders to be configuration during build time.
11
12Upstream-Status: Inappropriate [ptest-specific]
13Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
14---
15 unitTests/CMakeLists.txt | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/unitTests/CMakeLists.txt b/unitTests/CMakeLists.txt
19index 51040c0e2..e2604d4a7 100644
20--- a/unitTests/CMakeLists.txt
21+++ b/unitTests/CMakeLists.txt
22@@ -42,7 +42,7 @@ add_executable(unit_tests
23 target_compile_definitions(unit_tests
24 PRIVATE
25 exiv2lib_STATIC
26- TESTDATA_PATH="${PROJECT_SOURCE_DIR}/test/data"
27+ TESTDATA_PATH="${TEST_FOLDER}/test/data"
28 )
29
30 target_link_libraries(unit_tests
diff --git a/meta-oe/recipes-support/exiv2/exiv2/0001-Use-automake-output-for-tests.patch b/meta-oe/recipes-support/exiv2/exiv2/0001-Use-automake-output-for-tests.patch
new file mode 100644
index 0000000000..6514ac07a3
--- /dev/null
+++ b/meta-oe/recipes-support/exiv2/exiv2/0001-Use-automake-output-for-tests.patch
@@ -0,0 +1,35 @@
1From 09e5f783b3d1dcb7db6e975e9662c8401a614539 Mon Sep 17 00:00:00 2001
2From: Gyorgy Sarvari <skandigraun@gmail.com>
3Date: Sun, 23 Nov 2025 11:35:50 +0100
4Subject: [PATCH] Use automake output for tests
5
6Convert the Python unittest output to automake output so ptest can
7ingest it.
8
9Upstream-Status: Inappropriate [oe-specific]
10Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
11---
12 tests/runner.py | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15diff --git a/tests/runner.py b/tests/runner.py
16index adebf83ba..9800cf971 100755
17--- a/tests/runner.py
18+++ b/tests/runner.py
19@@ -4,6 +4,7 @@
20 import argparse
21 import functools
22 import os
23+import putao.unittest
24 import sys
25 import unittest
26 from fnmatch import fnmatchcase
27@@ -93,7 +94,7 @@ if __name__ == '__main__':
28 DEFAULT_ROOT
29 )
30
31- test_res = unittest.runner.TextTestRunner(verbosity=args.verbose)\
32+ test_res = putao.unittest.TestRunner()\
33 .run(discovered_tests)
34
35 sys.exit(0 if len(test_res.failures) + len(test_res.errors) == 0 else 1)
diff --git a/meta-oe/recipes-support/exiv2/exiv2/run-ptest b/meta-oe/recipes-support/exiv2/exiv2/run-ptest
new file mode 100644
index 0000000000..6c50a12fc1
--- /dev/null
+++ b/meta-oe/recipes-support/exiv2/exiv2/run-ptest
@@ -0,0 +1,6 @@
1#!/bin/sh
2cd tests
3python3 ./runner.py
4
5cd ..
6./build/bin/unit_tests --gtest_print_time=0 | sed -E '/^\[ RUN/d ; s/\[ OK \]/PASS: / ; s/\[ DISABLED \]/SKIP: / ; s/\[ FAILED \]/FAIL: /'
diff --git a/meta-oe/recipes-support/exiv2/exiv2_0.28.7.bb b/meta-oe/recipes-support/exiv2/exiv2_0.28.7.bb
index e1f57ae8c7..82ee232fdc 100644
--- a/meta-oe/recipes-support/exiv2/exiv2_0.28.7.bb
+++ b/meta-oe/recipes-support/exiv2/exiv2_0.28.7.bb
@@ -4,7 +4,34 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=625f055f41728f84a8d7938acc35bdc2"
4 4
5DEPENDS = "zlib expat brotli libinih" 5DEPENDS = "zlib expat brotli libinih"
6 6
7SRC_URI = "git://github.com/Exiv2/exiv2.git;protocol=https;branch=0.28.x;tag=v${PV}" 7SRC_URI = "git://github.com/Exiv2/exiv2.git;protocol=https;branch=0.28.x;tag=v${PV} \
8 file://run-ptest \
9 file://0001-Use-automake-output-for-tests.patch \
10 file://0001-Allow-test-data-path-configuration.patch \
11 "
8SRCREV = "afcb7a8ba84a7de36d2f1ee7689394e078697956" 12SRCREV = "afcb7a8ba84a7de36d2f1ee7689394e078697956"
9 13
10inherit cmake gettext 14inherit cmake gettext ptest
15
16PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'test unittest', '', d)}"
17PACKAGECONFIG[test] = "-DEXIV2_BUILD_SAMPLES=ON -DEXIV2_ENABLE_WEBREADY=ON"
18PACKAGECONFIG[unittest] = "-DEXIV2_BUILD_UNIT_TESTS=ON -DTEST_FOLDER=${PTEST_PATH},,googletest"
19
20RDEPENDS:${PN}-ptest += " \
21 python3-html \
22 python3-lxml \
23 python3-multiprocessing \
24 python3-shell \
25 python3-unittest \
26 python3-unittest-automake-output"
27
28do_install_ptest(){
29 cp -r ${S}/tests ${D}${PTEST_PATH}/
30 cp -r ${S}/test ${D}${PTEST_PATH}/
31
32 install -d ${D}${PTEST_PATH}/build/bin
33 install ${B}/bin/* ${D}${PTEST_PATH}/build/bin
34
35 install -d ${D}${PTEST_PATH}/src
36 install ${S}/src/canonmn_int.cpp ${D}${PTEST_PATH}/src
37}