Skip to content

Commit

Permalink
hiredis: add ptest
Browse files Browse the repository at this point in the history
Use internal test from hiredis project as ptest. If ptest
is in DISTRO_FEATURES tests are enabled default
but can be handled individually through PACKAGECONFIG.
Test config 'testssl' requires 'ssl' option but is not
enabled default as the redis recipe does not build it
with ssl support.

Tested on qemux86_64 and qemuarm64.

Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Peter Bergin <[email protected]>
  • Loading branch information
wrpbergin committed May 23, 2023
1 parent add4d51 commit a3ec4b8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions meta-oe/recipes-core/packagegroups/packagegroup-meta-oe.bb
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ RDEPENDS:packagegroup-meta-oe-ptest-packages = "\
poco-ptest \
cmocka-ptest \
minicoredumper-ptest \
hiredis-ptest \
"
RDEPENDS:packagegroup-meta-oe-ptest-packages:append:x86 = " mcelog-ptest"
RDEPENDS:packagegroup-meta-oe-ptest-packages:append:x86-64 = " mcelog-ptest"
Expand Down
3 changes: 3 additions & 0 deletions meta-oe/recipes-extended/hiredis/hiredis/run-ptest
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

TEST_SSL=0 TEST_ASYNC=0 ./test.sh
26 changes: 23 additions & 3 deletions meta-oe/recipes-extended/hiredis/hiredis_1.1.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,36 @@ SECTION = "libs"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=d84d659a35c666d23233e54503aaea51"

SRC_URI = "git://github.com/redis/hiredis;protocol=https;branch=master"
SRC_URI = " \
git://github.com/redis/hiredis;protocol=https;branch=master \
file://run-ptest \
"
SRCREV = "c14775b4e48334e0262c9f168887578f4a368b5d"

S = "${WORKDIR}/git"

inherit cmake
inherit cmake ptest

PACKAGECONFIG ??= "ssl"
# 'testssl' is not enabled by default as redis recipe does not build with ssl support
# option 'testssl' requires 'ssl'
PACKAGECONFIG ??= "ssl ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'test testasync', '', d)}"
PACKAGECONFIG[ssl] = "-DENABLE_SSL=ON, -DENABLE_SSL=OFF, openssl"
PACKAGECONFIG[test] = "-DDISABLE_TESTS=OFF, -DDISABLE_TESTS=ON"
PACKAGECONFIG[testssl] = "-DENABLE_SSL_TESTS=ON, -DENABLE_SSL_TESTS=OFF, openssl"
PACKAGECONFIG[testasync] = "-DENABLE_ASYNC_TESTS=ON, -DENABLE_ASYNC_TESTS=OFF, libevent"

do_install_ptest() {
install ${S}/test.sh ${D}${PTEST_PATH}/
install ${B}/hiredis-test ${D}${PTEST_PATH}/
if ${@bb.utils.contains('PACKAGECONFIG','testssl','true','false',d)}; then
sed -i 's/TEST_SSL=0/TEST_SSL=1/g' ${D}${PTEST_PATH}/run-ptest
fi
if ${@bb.utils.contains('PACKAGECONFIG','testasync','true','false',d)}; then
sed -i 's/TEST_ASYNC=0/TEST_ASYNC=1/g' ${D}${PTEST_PATH}/run-ptest
fi
}

FILES:${PN}-dev += "${datadir}/hiredis_ssl ${prefix}/build"

RDEPENDS:${PN} = "redis"
RDEPENDS:${PN}-ptest = "${@bb.utils.contains('PACKAGECONFIG', 'testssl', 'openssl-bin', '', d)}"

0 comments on commit a3ec4b8

Please sign in to comment.