diff options
| author | Chi Xu <chi.xu@eng.windriver.com> | 2024-01-26 13:48:20 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-27 08:20:02 +0000 |
| commit | 4cb6ff8a57cb27bce31b76136fd32b1a54c01eaf (patch) | |
| tree | 7def3659e91285a887da5ae1824740c3aef86c4d /meta/recipes-extended/xz | |
| parent | 82eb0c47e4874d4600432d8daa04f470b7b1676e (diff) | |
| download | poky-4cb6ff8a57cb27bce31b76136fd32b1a54c01eaf.tar.gz | |
xz: Add ptest support
There are two types of cases: executables and POSIX shell scripts.
All test cases PASS.
Add xz-ptest to PTESTS_FAST because test duration less than 30s
on qemux86-64.
root@qemux86-64:~# ptest-runner xz
START: ptest-runner
2024-01-26T03:32
BEGIN: /usr/lib/xz/ptest
=== test_bcj_exact_size.c ===
PASS: test_exact_size
PASS: test_empty_block
(From OE-Core rev: 2704983f972e4fe1d4e0bee8491a07eb4f629346)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/xz')
| -rw-r--r-- | meta/recipes-extended/xz/xz/run-ptest | 26 | ||||
| -rw-r--r-- | meta/recipes-extended/xz/xz_5.4.5.bb | 28 |
2 files changed, 52 insertions, 2 deletions
diff --git a/meta/recipes-extended/xz/xz/run-ptest b/meta/recipes-extended/xz/xz/run-ptest new file mode 100644 index 0000000000..cc8ba92016 --- /dev/null +++ b/meta/recipes-extended/xz/xz/run-ptest | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | ptestdir=$(dirname "$(readlink -f "$0")") | ||
| 4 | cd "$ptestdir"/tests || exit | ||
| 5 | |||
| 6 | # executables test cases | ||
| 7 | tests_exec=$(file $(ls test_*) | grep "ELF" | awk -F: '{print $1}') | ||
| 8 | for i in ${tests_exec}; do | ||
| 9 | ./$i | ||
| 10 | done | ||
| 11 | |||
| 12 | # POSIX shell script test cases | ||
| 13 | export srcdir=${ptestdir}/tests | ||
| 14 | test_shell="test_files.sh test_scripts.sh test_compress.sh" | ||
| 15 | for j in ${test_shell}; do | ||
| 16 | if [ $j == "test_compress.sh" ]; then | ||
| 17 | ./$j create_compress_files | ||
| 18 | else | ||
| 19 | ./$j | ||
| 20 | fi | ||
| 21 | if [ $? -eq 0 ]; then | ||
| 22 | echo "PASS: $j" | ||
| 23 | else | ||
| 24 | echo "FAIL: $j" | ||
| 25 | fi | ||
| 26 | done | ||
diff --git a/meta/recipes-extended/xz/xz_5.4.5.bb b/meta/recipes-extended/xz/xz_5.4.5.bb index 09eade8be0..0f0849c3e5 100644 --- a/meta/recipes-extended/xz/xz_5.4.5.bb +++ b/meta/recipes-extended/xz/xz_5.4.5.bb | |||
| @@ -24,13 +24,15 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=c8ea84ebe7b93cce676b54355dc6b2c0 \ | |||
| 24 | file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 \ | 24 | file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 \ |
| 25 | " | 25 | " |
| 26 | 26 | ||
| 27 | SRC_URI = "https://tukaani.org/xz/xz-${PV}.tar.gz" | 27 | SRC_URI = "https://tukaani.org/xz/xz-${PV}.tar.gz \ |
| 28 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'file://run-ptest', '', d)} \ | ||
| 29 | " | ||
| 28 | SRC_URI[sha256sum] = "135c90b934aee8fbc0d467de87a05cb70d627da36abe518c357a873709e5b7d6" | 30 | SRC_URI[sha256sum] = "135c90b934aee8fbc0d467de87a05cb70d627da36abe518c357a873709e5b7d6" |
| 29 | UPSTREAM_CHECK_REGEX = "xz-(?P<pver>\d+(\.\d+)+)\.tar" | 31 | UPSTREAM_CHECK_REGEX = "xz-(?P<pver>\d+(\.\d+)+)\.tar" |
| 30 | 32 | ||
| 31 | CACHED_CONFIGUREVARS += "gl_cv_posix_shell=/bin/sh" | 33 | CACHED_CONFIGUREVARS += "gl_cv_posix_shell=/bin/sh" |
| 32 | 34 | ||
| 33 | inherit autotools gettext | 35 | inherit autotools gettext ptest |
| 34 | 36 | ||
| 35 | PACKAGES =+ "liblzma" | 37 | PACKAGES =+ "liblzma" |
| 36 | 38 | ||
| @@ -42,3 +44,25 @@ ALTERNATIVE:${PN} = "xz xzcat unxz \ | |||
| 42 | lzma lzcat unlzma" | 44 | lzma lzcat unlzma" |
| 43 | 45 | ||
| 44 | BBCLASSEXTEND = "native nativesdk" | 46 | BBCLASSEXTEND = "native nativesdk" |
| 47 | |||
| 48 | RDEPENDS:${PN}-ptest += "bash file" | ||
| 49 | |||
| 50 | do_compile_ptest() { | ||
| 51 | oe_runmake check TESTS= | ||
| 52 | } | ||
| 53 | |||
| 54 | do_install_ptest () { | ||
| 55 | install -d ${D}${PTEST_PATH}/tests | ||
| 56 | find ${B}/tests/.libs -type f -executable -exec cp {} ${D}${PTEST_PATH}/tests \; | ||
| 57 | cp ${B}/config.h ${D}${PTEST_PATH} | ||
| 58 | for i in files xzgrep_expected_output test_files.sh test_scripts.sh test_compress.sh; do | ||
| 59 | cp -r ${S}/tests/$i ${D}${PTEST_PATH}/tests | ||
| 60 | done | ||
| 61 | mkdir -p ${D}${PTEST_PATH}/src/xz | ||
| 62 | ln -s ${bindir}/xz ${D}${PTEST_PATH}/src/xz/xz | ||
| 63 | mkdir -p ${D}${PTEST_PATH}/src/xzdec | ||
| 64 | ln -s ${bindir}/xzdec ${D}${PTEST_PATH}/src/xzdec/xzdec | ||
| 65 | mkdir -p ${D}${PTEST_PATH}/src/scripts | ||
| 66 | ln -s ${bindir}/xzdiff ${D}${PTEST_PATH}/src/scripts/xzdiff | ||
| 67 | ln -s ${bindir}/xzgrep ${D}${PTEST_PATH}/src/scripts/xzgrep | ||
| 68 | } | ||
