mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-16 04:17:25 +00:00
meta-oe: recipes-support: dc: Add ptest
Signed-off-by: Ever ATILANO <ever.atilano@smile.fr> Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
@@ -10,9 +10,32 @@ S = "${WORKDIR}/git"
|
|||||||
|
|
||||||
SRC_URI = " \
|
SRC_URI = " \
|
||||||
git://github.com/google/double-conversion.git;protocol=https;branch=master \
|
git://github.com/google/double-conversion.git;protocol=https;branch=master \
|
||||||
|
file://run-ptest \
|
||||||
"
|
"
|
||||||
SRCREV = "af09fd65fcf24eee95dc62813ba9123414635428"
|
SRCREV = "af09fd65fcf24eee95dc62813ba9123414635428"
|
||||||
|
|
||||||
inherit cmake
|
inherit cmake ptest
|
||||||
|
|
||||||
EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON"
|
EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON"
|
||||||
|
|
||||||
|
# These ptest use ctest (provided by cmake)
|
||||||
|
RDEPENDS:${PN}-ptest += "cmake"
|
||||||
|
# Build tests only if ptest is enabled
|
||||||
|
EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DBUILD_TESTING=ON', '', d)}"
|
||||||
|
|
||||||
|
do_install_ptest() {
|
||||||
|
install -d ${D}${PTEST_PATH}/test
|
||||||
|
cp -rf ${B}/test ${D}${PTEST_PATH}
|
||||||
|
install -m 0644 ${B}/CTestTestfile.cmake ${D}${PTEST_PATH}/
|
||||||
|
files="
|
||||||
|
CTestTestfile.cmake
|
||||||
|
test/CTestTestfile.cmake
|
||||||
|
test/cmake_install.cmake
|
||||||
|
test/cctest/CTestTestfile.cmake
|
||||||
|
test/cctest/cmake_install.cmake
|
||||||
|
"
|
||||||
|
for file in $files; do
|
||||||
|
sed -i -e "s|${B}|${PTEST_PATH}|g" -e "s|${S}|${PTEST_PATH}|g" -e "s|${WORKDIR}/recipe-sysroot-native||g" "${D}${PTEST_PATH}/${file}"
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This script runs tests taken from the github CI for the Double-Conversion library.
|
||||||
|
# For more information, please see: https://github.com/google/double-conversion/blob/master/.github/workflows/ci.yml#L60
|
||||||
|
|
||||||
|
# Count the number of failed tests
|
||||||
|
NUM_FAILS=0
|
||||||
|
|
||||||
|
# Run all tests using ctest
|
||||||
|
ctest -V
|
||||||
|
|
||||||
|
# VCount the number of failed tests by checking the LastTest.log file generated by ctest
|
||||||
|
NUM_FAILS=$(grep -c "Failed" Testing/Temporary/LastTest.log)
|
||||||
|
|
||||||
|
# Run the tests directly as well, just in case we forgot to add it to ctest
|
||||||
|
test/cctest/cctest
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
# If the test failed, increment the number of failed tests
|
||||||
|
NUM_FAILS=$(expr $NUM_FAILS + 1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Return the number of failed tests
|
||||||
|
exit $NUM_FAILS
|
||||||
Reference in New Issue
Block a user