diff --git a/meta-oe/recipes-support/dc/double-conversion_3.2.1.bb b/meta-oe/recipes-support/dc/double-conversion_3.2.1.bb index cc54dc64814..92466f67a30 100644 --- a/meta-oe/recipes-support/dc/double-conversion_3.2.1.bb +++ b/meta-oe/recipes-support/dc/double-conversion_3.2.1.bb @@ -10,9 +10,32 @@ S = "${WORKDIR}/git" SRC_URI = " \ git://github.com/google/double-conversion.git;protocol=https;branch=master \ + file://run-ptest \ " SRCREV = "af09fd65fcf24eee95dc62813ba9123414635428" -inherit cmake +inherit cmake ptest 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 + +} diff --git a/meta-oe/recipes-support/dc/files/run-ptest b/meta-oe/recipes-support/dc/files/run-ptest new file mode 100644 index 00000000000..9240a3f851f --- /dev/null +++ b/meta-oe/recipes-support/dc/files/run-ptest @@ -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 diff --git a/meta-python/recipes-devtools/python/python3-lorem/run-ptest b/meta-python/recipes-devtools/python/python3-lorem/run-ptest new file mode 100644 index 00000000000..8d2017d39ce --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-lorem/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +pytest --automake diff --git a/meta-python/recipes-devtools/python/python3-lorem_0.1.1.bb b/meta-python/recipes-devtools/python/python3-lorem_0.1.1.bb index 9ce7a6293c1..a855c39141e 100644 --- a/meta-python/recipes-devtools/python/python3-lorem_0.1.1.bb +++ b/meta-python/recipes-devtools/python/python3-lorem_0.1.1.bb @@ -5,12 +5,25 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=5301c01b2bcdeedba23645f94db2f179" SRC_URI[md5sum] = "e3f0064a94c13e19780eb724affdb426" SRC_URI[sha256sum] = "785f4109a241fc2891e59705e85d065f6e6d3ed6ad91750a8cb54d4f3e59d934" +SRC_URI += "\ + file://run-ptest \ +" + PYPI_PACKAGE = "lorem" -inherit pypi setuptools3 +inherit pypi setuptools3 ptest CLEANBROKEN = "1" RDEPENDS:${PN} += " \ python3 \ " +RDEPENDS:${PN}-ptest += " \ + ${PYTHON_PN}-pytest \ + ${PYTHON_PN}-unittest-automake-output \ +" + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/tests + cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/ +} diff --git a/meta-python/recipes-devtools/python/python3-path/run-ptest b/meta-python/recipes-devtools/python/python3-path/run-ptest new file mode 100644 index 00000000000..8d2017d39ce --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-path/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +pytest --automake diff --git a/meta-python/recipes-devtools/python/python3-path_16.6.0.bb b/meta-python/recipes-devtools/python/python3-path_16.6.0.bb index 41fe374619e..479177ed781 100644 --- a/meta-python/recipes-devtools/python/python3-path_16.6.0.bb +++ b/meta-python/recipes-devtools/python/python3-path_16.6.0.bb @@ -4,8 +4,27 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=7a7126e068206290f3fe9f8d6c713ea6" SRC_URI[sha256sum] = "bea3816e1d54f4e33aac78d2031a0b0ed2f95e69db85b45d51f17df97071da69" -inherit pypi python_setuptools_build_meta +SRC_URI += "\ + file://run-ptest \ +" + +inherit pypi python_setuptools_build_meta ptest DEPENDS += "python3-setuptools-scm-native" +RDEPENDS:${PN} += " \ + ${PYTHON_PN}-appdirs \ +" +RDEPENDS:${PN}-ptest += " \ + ${PYTHON_PN}-pytest \ + ${PYTHON_PN}-unittest-automake-output \ +" + BBCLASSEXTEND = "nativesdk native" + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/test + cp -rf ${S}/test_* ${D}${PTEST_PATH}/test/ + install -d ${D}${PTEST_PATH}/path + cp -rf ${S}/path/* ${D}${PTEST_PATH}/path/ +}