mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2025-12-15 06:45:32 +01:00
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>
This commit is contained in:
parent
09c7f76c19
commit
35bc4860f1
|
|
@ -13,6 +13,7 @@ PTESTS_FAST_META_OE = "\
|
|||
cmocka \
|
||||
cunit \
|
||||
duktape \
|
||||
exiv2 \
|
||||
fuse3 \
|
||||
function2 \
|
||||
fwupd \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
6
meta-oe/recipes-support/exiv2/exiv2/run-ptest
Normal file
6
meta-oe/recipes-support/exiv2/exiv2/run-ptest
Normal file
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user