summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z/0001-Allow-running-tests-on-target-when-cross-compiling.patch45
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z/0001-Allow-specifying-path-to-7z-library-in-tests.patch48
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z/0001-Fix-tests-with-musl.patch51
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z/run-ptest18
-rw-r--r--meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb64
5 files changed, 224 insertions, 2 deletions
diff --git a/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-running-tests-on-target-when-cross-compiling.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-running-tests-on-target-when-cross-compiling.patch
new file mode 100644
index 0000000000..b6e24a9519
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-running-tests-on-target-when-cross-compiling.patch
@@ -0,0 +1,45 @@
1From 9f0eed91d32ec2f310bd5c23af187f888394fcb4 Mon Sep 17 00:00:00 2001
2From: Peter Marko <peter.marko@siemens.com>
3Date: Wed, 2 Apr 2025 09:33:03 +0200
4Subject: [PATCH] Allow running tests on target when cross-compiling
5
6When bit7z is Cross-compiled, target device does not contain
7source/build directory anymore and thus path to test data is different.
8Make it possible to pass the new path to cmake.
9
10Upstream-Status: Submitted [https://github.com/rikyoz/bit7z/pull/289]
11Signed-off-by: Peter Marko <peter.marko@siemens.com>
12---
13 tests/CMakeLists.txt | 9 +++++++--
14 1 file changed, 7 insertions(+), 2 deletions(-)
15
16diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
17index 60da280..dbdff1f 100644
18--- a/tests/CMakeLists.txt
19+++ b/tests/CMakeLists.txt
20@@ -49,6 +49,11 @@ add_executable( ${TESTS_TARGET_PUBLIC} ${SOURCE_FILES} ${PUBLIC_API_SOURCE_FILES
21
22 if( BIT7Z_TESTS_FILESYSTEM )
23 set( BIT7Z_TESTS_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR}/data )
24+ if( NOT BIT7Z_TESTS_DATA_DIR_TARGET )
25+ set( BIT7Z_TESTS_DATA_DIR_TARGET ${BIT7Z_TESTS_DATA_DIR} )
26+ else()
27+ message( STATUS "Custom test data dir on target: ${BIT7Z_TESTS_DATA_DIR_TARGET}" )
28+ endif()
29
30 include( FetchContent )
31 FetchContent_Declare( bit7z-test-data
32@@ -61,11 +66,11 @@ if( BIT7Z_TESTS_FILESYSTEM )
33 message( STATUS "Tests data directory: ${BIT7Z_TESTS_DATA_DIR}" )
34 target_compile_definitions( ${TESTS_TARGET} PRIVATE
35 BIT7Z_TESTS_FILESYSTEM
36- BIT7Z_TESTS_DATA_DIR="${BIT7Z_TESTS_DATA_DIR}" )
37+ BIT7Z_TESTS_DATA_DIR="${BIT7Z_TESTS_DATA_DIR_TARGET}" )
38 target_compile_definitions( ${TESTS_TARGET_PUBLIC} PRIVATE
39 BIT7Z_TESTS_PUBLIC_API_ONLY
40 BIT7Z_TESTS_FILESYSTEM
41- BIT7Z_TESTS_DATA_DIR="${BIT7Z_TESTS_DATA_DIR}" )
42+ BIT7Z_TESTS_DATA_DIR="${BIT7Z_TESTS_DATA_DIR_TARGET}" )
43 if( NOT EXISTS ${BIT7Z_TESTS_DATA_DIR}/test_filesystem/empty )
44 file( MAKE_DIRECTORY ${BIT7Z_TESTS_DATA_DIR}/test_filesystem/empty )
45 endif()
diff --git a/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-specifying-path-to-7z-library-in-tests.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-specifying-path-to-7z-library-in-tests.patch
new file mode 100644
index 0000000000..adc0d67d97
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/bit7z/0001-Allow-specifying-path-to-7z-library-in-tests.patch
@@ -0,0 +1,48 @@
1From 60137ec132951f941f2fb98cd6353717b322cbf1 Mon Sep 17 00:00:00 2001
2From: Peter Marko <peter.marko@siemens.com>
3Date: Wed, 2 Apr 2025 10:17:38 +0200
4Subject: [PATCH] Allow specifying path to 7z library in tests
5
6For instance to override path to library on Linux when using real 7-zip
7instead of pzip: /usr/lib/lib7z.so
8
9Upstream-Status: Submitted [https://github.com/rikyoz/bit7z/pull/288]
10Signed-off-by: Peter Marko <peter.marko@siemens.com>
11---
12 tests/CMakeLists.txt | 7 +++++++
13 tests/src/utils/shared_lib.hpp | 4 +++-
14 2 files changed, 10 insertions(+), 1 deletion(-)
15
16diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
17index 60da280d..1307366a 100644
18--- a/tests/CMakeLists.txt
19+++ b/tests/CMakeLists.txt
20@@ -103,6 +103,13 @@ message( STATUS "Use system 7-zip for tests: ${BIT7Z_TESTS_USE_SYSTEM_7ZIP}" )
21 if( BIT7Z_TESTS_USE_SYSTEM_7ZIP )
22 target_compile_definitions( ${TESTS_TARGET} PRIVATE BIT7Z_TESTS_USE_SYSTEM_7ZIP )
23 target_compile_definitions( ${TESTS_TARGET_PUBLIC} PRIVATE BIT7Z_TESTS_USE_SYSTEM_7ZIP )
24+else()
25+ set( BIT7Z_TESTS_7Z_LIBRARY_PATH "" CACHE STRING "The path of the 7-Zip library to be used for running the tests" )
26+ if( NOT BIT7Z_TESTS_7Z_LIBRARY_PATH STREQUAL "" )
27+ message( STATUS "Use custom 7-zip library for tests: ${BIT7Z_TESTS_7Z_LIBRARY_PATH}" )
28+ target_compile_definitions( ${TESTS_TARGET} PRIVATE BIT7Z_TESTS_7Z_LIBRARY_PATH="${BIT7Z_TESTS_7Z_LIBRARY_PATH}" )
29+ target_compile_definitions( ${TESTS_TARGET_PUBLIC} PRIVATE BIT7Z_TESTS_7Z_LIBRARY_PATH="${BIT7Z_TESTS_7Z_LIBRARY_PATH}" )
30+ endif()
31 endif()
32
33 # Avoiding linking unnecessary libraries.
34diff --git a/tests/src/utils/shared_lib.hpp b/tests/src/utils/shared_lib.hpp
35index 41435a9b..8bc02939 100644
36--- a/tests/src/utils/shared_lib.hpp
37+++ b/tests/src/utils/shared_lib.hpp
38@@ -20,7 +20,9 @@ namespace bit7z {
39 namespace test {
40
41 inline auto sevenzip_lib_path() -> tstring {
42-#ifdef BIT7Z_TESTS_USE_SYSTEM_7ZIP
43+#ifdef BIT7Z_TESTS_7Z_LIBRARY_PATH
44+ static const tstring lib_path = BIT7Z_STRING( BIT7Z_TESTS_7Z_LIBRARY_PATH );
45+#elif defined( BIT7Z_TESTS_USE_SYSTEM_7ZIP )
46 #ifdef _WIN64
47 static const tstring lib_path = BIT7Z_STRING( "C:\\Program Files\\7-Zip\\7z.dll" );
48 #elif defined( _WIN32 )
diff --git a/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-tests-with-musl.patch b/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-tests-with-musl.patch
new file mode 100644
index 0000000000..b1f3d0f2ec
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/bit7z/0001-Fix-tests-with-musl.patch
@@ -0,0 +1,51 @@
1From bc5f2e5af90854c8f84b5829493dd01facf9af84 Mon Sep 17 00:00:00 2001
2From: Peter Marko <peter.marko@siemens.com>
3Date: Mon, 7 Apr 2025 16:29:32 +0200
4Subject: [PATCH] Fix tests with musl
5
6Upstream-Status: Submitted [https://github.com/rikyoz/bit7z/pull/292]
7Signed-off-by: Peter Marko <peter.marko@siemens.com>
8---
9 tests/src/test_bitexception.cpp | 8 ++++++++
10 1 file changed, 8 insertions(+)
11
12diff --git a/tests/src/test_bitexception.cpp b/tests/src/test_bitexception.cpp
13index 7161fcc5..d85d430d 100644
14--- a/tests/src/test_bitexception.cpp
15+++ b/tests/src/test_bitexception.cpp
16@@ -49,6 +49,8 @@ constexpr PortableErrorTest hresult_tests[] = { // NOLINT(*-avoid-c-arrays)
17 { HRESULT_WIN32_TEST( ERROR_OPEN_FAILED ),
18 #ifdef _WIN32
19 "The system cannot open the device or file specified.",
20+#elif defined( __linux__ ) && !defined ( __GLIBC__ )
21+ "I/O error",
22 #else
23 "Input/output error",
24 #endif
25@@ -67,6 +69,8 @@ constexpr PortableErrorTest hresult_tests[] = { // NOLINT(*-avoid-c-arrays)
26 { HRESULT_WIN32_TEST( ERROR_SEEK ),
27 #ifdef _WIN32
28 "The drive cannot locate a specific area or track on the disk.",
29+#elif defined( __linux__ ) && !defined ( __GLIBC__ )
30+ "I/O error",
31 #else
32 "Input/output error",
33 #endif
34@@ -74,6 +78,8 @@ constexpr PortableErrorTest hresult_tests[] = { // NOLINT(*-avoid-c-arrays)
35 { HRESULT_WIN32_TEST( ERROR_READ_FAULT ),
36 #ifdef _WIN32
37 "The system cannot read from the specified device.",
38+#elif defined( __linux__ ) && !defined ( __GLIBC__ )
39+ "I/O error",
40 #else
41 "Input/output error",
42 #endif
43@@ -81,6 +87,8 @@ constexpr PortableErrorTest hresult_tests[] = { // NOLINT(*-avoid-c-arrays)
44 { HRESULT_WIN32_TEST( ERROR_WRITE_FAULT ),
45 #ifdef _WIN32
46 "The system cannot write to the specified device.",
47+#elif defined( __linux__ ) && !defined ( __GLIBC__ )
48+ "I/O error",
49 #else
50 "Input/output error",
51 #endif
diff --git a/meta-oe/recipes-extended/7zip/bit7z/run-ptest b/meta-oe/recipes-extended/7zip/bit7z/run-ptest
new file mode 100644
index 0000000000..dd1776cab6
--- /dev/null
+++ b/meta-oe/recipes-extended/7zip/bit7z/run-ptest
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3# Disabled tests:
4# "winapi: Allocating BSTR string from nullptr C strings"
5# this test is memory hungry, it allocates 800MB chunks
6# it succeeds when there is enough free RAM, but most machines don't have it
7
8if /usr/lib/bit7z/ptest/bit7z-tests ~"winapi: Allocating BSTR string from nullptr C strings"; then
9 echo "PASS: bit7z-tests"
10else
11 echo "FAIL: bit7z-tests"
12fi
13
14if /usr/lib/bit7z/ptest/bit7z-tests-public; then
15 echo "PASS: bit7z-tests-public"
16else
17 echo "FAIL: bit7z-tests-public"
18fi
diff --git a/meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb b/meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb
index 2b9029d9e3..645ea1a2ae 100644
--- a/meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb
+++ b/meta-oe/recipes-extended/7zip/bit7z_4.0.9.bb
@@ -5,21 +5,68 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=48a3fe23ed1353e0995dadfda05ffdb6"
5 5
6SRC_URI = " \ 6SRC_URI = " \
7 git://github.com/rikyoz/bit7z.git;protocol=https;branch=master \ 7 git://github.com/rikyoz/bit7z.git;protocol=https;branch=master \
8 file://0001-cmake-disable-dependency-inclusion.patch \ 8 ${@bb.utils.contains('PTEST_ENABLED', '1', d.getVar('SRC_URI_PTEST'), 'file://0001-cmake-disable-dependency-inclusion.patch', d)} \
9 file://0001-Fix-reinterpret-cast-compiler-errors.patch \ 9 file://0001-Fix-reinterpret-cast-compiler-errors.patch \
10 file://0001-Fix-int8_t-storage-in-BitPropVariant-on-Arm-architec.patch \ 10 file://0001-Fix-int8_t-storage-in-BitPropVariant-on-Arm-architec.patch \
11 file://0001-Allow-running-tests-on-target-when-cross-compiling.patch \
12 file://0001-Allow-specifying-path-to-7z-library-in-tests.patch \
13 file://0001-Fix-tests-with-musl.patch \
11" 14"
12 15
13SRCREV = "386e00ad3286e7a10e5bb6d05a5b41b523fce623" 16SRCREV = "386e00ad3286e7a10e5bb6d05a5b41b523fce623"
14 17
18# ptest dependencies and their revisions
19SRC_URI_PTEST = " \
20 git://github.com/rikyoz/filesystem.git;protocol=https;branch=glibcxx_wchar_streams_workaround;name=filesystem;destsuffix=filesystem \
21 git://github.com/rikyoz/bit7z-test-data.git;protocol=https;branch=main;name=testdata;destsuffix=testdata \
22 git://github.com/catchorg/Catch2.git;protocol=https;branch=v2.x;name=catch2;destsuffix=catch2;tag=${TAG_catch2} \
23 https://github.com/cpm-cmake/CPM.cmake/releases/download/v${TAG_CPM}/CPM.cmake;downloadfilename=CPM_${TAG_CPM}.cmake \
24 file://run-ptest \
25"
26SRCREV_FORMAT = "${@bb.utils.contains('PTEST_ENABLED', '1', 'default_filesystem_testdata_catch2', 'default', d)}"
27SRCREV_filesystem = "983650f374699e3979f9cdefe13ddff60bd4ac68"
28SRCREV_testdata = "077e407b1c07b7443626b5902eeb4819388bf656"
29SRCREV_catch2 = "182c910b4b63ff587a3440e08f84f70497e49a81"
30TAG_catch2 = "v2.13.10"
31SRCHASH_CPM = "c8cdc32c03816538ce22781ed72964dc864b2a34a310d3b7104812a5ca2d835d"
32TAG_CPM = "0.40.2"
33SRC_URI[sha256sum] = "${SRCHASH_CPM}"
34
15S = "${WORKDIR}/git" 35S = "${WORKDIR}/git"
16 36
17inherit cmake 37inherit cmake ptest
18 38
19DEPENDS = "7zip" 39DEPENDS = "7zip"
20 40
21EXTRA_OECMAKE += "-DBIT7Z_CUSTOM_7ZIP_PATH=${STAGING_INCDIR}/7zip" 41EXTRA_OECMAKE += "-DBIT7Z_CUSTOM_7ZIP_PATH=${STAGING_INCDIR}/7zip"
22 42
43PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}"
44PACKAGECONFIG[tests] = " \
45 -DBIT7Z_BUILD_TESTS=ON -DBIT7Z_DISABLE_USE_STD_FILESYSTEM=ON \
46 -DBIT7Z_TESTS_USE_SYSTEM_7ZIP=OFF -DBIT7Z_TESTS_7Z_LIBRARY_PATH=${libdir}/lib7z.so \
47 -DBIT7Z_TESTS_DATA_DIR_TARGET=${PTEST_PATH}/data \
48 -DCPM_SOURCE_CACHE=${B}/cpm_cache -DFETCHCONTENT_SOURCE_DIR_BIT7Z-TEST-DATA=${UNPACKDIR}/testdata -DFETCHCONTENT_SOURCE_DIR_CATCH2=${B}/catch2 \
49"
50
51do_configure:prepend() {
52 # verify that all dependencies have correct version
53 grep -q ${SRCREV_filesystem} ${S}/cmake/Dependencies.cmake || bbfatal "ERROR: dependency version mismatch, please update 'SRCREV_filesystem'!"
54 grep -q ${SRCREV_testdata} ${S}/tests/CMakeLists.txt || bbfatal "ERROR: dependency version mismatch, please update 'SRCREV_testdata'!"
55 grep -q ${TAG_catch2} ${S}/tests/cmake/Catch2.cmake || bbfatal "ERROR: dependency version mismatch, please update 'SRCREV_catch2'!"
56 grep -q ${SRCHASH_CPM} ${S}/cmake/Dependencies.cmake || bbfatal "ERROR: dependency version mismatch, please update 'SRCHASH_CPM'!"
57
58 if ${@bb.utils.contains('PTEST_ENABLED', '1', 'true', 'false', d)}; then
59 # use cache instead of download for CPM (CMake's missing package manager)
60 mkdir -p ${B}/cmake
61 cp ${UNPACKDIR}/CPM_${TAG_CPM}.cmake ${B}/cmake
62 mkdir -p ${B}/cpm_cache/ghc_filesystem
63 cp -r ${UNPACKDIR}/filesystem ${B}/cpm_cache/ghc_filesystem/fbcc9a9e94e6365273cf51294173f21ff5efdb4f
64 # avoid buildpaths issue as unpackdir is not in prefix maps
65 cp -r ${UNPACKDIR}/catch2 ${B}
66 fi
67}
68do_configure[cleandirs] += "${B}"
69
23do_install() { 70do_install() {
24 install -d ${D}${libdir} 71 install -d ${D}${libdir}
25 install -m 0644 ${S}/lib/*/*.a ${D}${libdir} 72 install -m 0644 ${S}/lib/*/*.a ${D}${libdir}
@@ -27,3 +74,16 @@ do_install() {
27 install -d ${D}${includedir}/${BPN} 74 install -d ${D}${includedir}/${BPN}
28 install -m 0644 ${S}/include/${BPN}/*.hpp ${D}${includedir}/${BPN} 75 install -m 0644 ${S}/include/${BPN}/*.hpp ${D}${includedir}/${BPN}
29} 76}
77
78do_install_ptest() {
79 install -m 0755 ${S}/bin/*/* ${D}${PTEST_PATH}
80 install -d ${D}${PTEST_PATH}/data
81 cp -r ${UNPACKDIR}/testdata/test_archives ${UNPACKDIR}/testdata/test_filesystem ${B}/tests/data/test_filesystem ${D}${PTEST_PATH}/data
82}
83
84# this package contains static library so main package is empty, but ptest package rdepends on it
85ALLOW_EMPTY:${PN} = "1"
86# these are loaded via dlopen, so need explicit rdepends
87RDEPENDS:${PN}-ptest += "libstdc++ 7zip"
88# test data contains various file types with different architectures
89INSANE_SKIP:${PN}-ptest += "arch"