From 2530ace540da5a79e8a0e352f353be7c4a92bb53 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Wed, 2 Jun 2021 16:14:59 +0200 Subject: [PATCH] libgpiod: ptest: run all test-suites if possible We have four test-suites total in libgpiod: for the core C library, gpio-tools and for C++ and Python bindings. Modify the recipe to install all of them depending on build settings and make run-ptest execute them if available. Signed-off-by: Bartosz Golaszewski Signed-off-by: Khem Raj --- .../recipes-support/libgpiod/files/run-ptest | 21 ++++++++++++------- .../libgpiod/libgpiod_1.6.3.bb | 20 +++++++++++++++++- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/meta-oe/recipes-support/libgpiod/files/run-ptest b/meta-oe/recipes-support/libgpiod/files/run-ptest index 3ad737dfc8..60c661fc10 100644 --- a/meta-oe/recipes-support/libgpiod/files/run-ptest +++ b/meta-oe/recipes-support/libgpiod/files/run-ptest @@ -1,12 +1,19 @@ #!/bin/sh -testbin="gpiod-test" +testbins="gpiod-test gpio-tools-test gpiod-cxx-test gpiod_py_test.py" + ptestdir=$(dirname "$(readlink -f "$0")") cd $ptestdir/tests -./$testbin > ./$testbin.out -if [ $? -ne 0 ]; then - echo "FAIL: $testbin" -else - echo "PASS: $testbin" -fi +for testbin in $testbins; do + if test -e ./$testbin; then + ./$testbin > ./$testbin.out + if [ $? -ne 0 ]; then + echo "FAIL: $testbin" + else + echo "PASS: $testbin" + fi + else + echo "SKIP: $testbin" + fi +done diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb index c0ebb8aa5a..874453fbd6 100644 --- a/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb +++ b/meta-oe/recipes-support/libgpiod/libgpiod_1.6.3.bb @@ -53,5 +53,23 @@ PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'tests do_install_ptest() { install -d ${D}${PTEST_PATH}/tests - cp ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/ + + # These are the core C library tests + install -m 0755 ${B}/tests/.libs/gpiod-test ${D}${PTEST_PATH}/tests/ + + # Tools are always built so let's always install them for ptest even if + # we're not selecting libgpiod-tools. + install -m 0755 ${S}/tools/gpio-tools-test ${D}${PTEST_PATH}/tests/ + install -m 0755 ${S}/tools/gpio-tools-test.bats ${D}${PTEST_PATH}/tests/ + for tool in ${FILES_${PN}-tools}; do + install ${B}/tools/.libs/$(basename $tool) ${D}${PTEST_PATH}/tests/ + done + + if ${@bb.utils.contains('PACKAGECONFIG', 'cxx', 'true', 'false', d)}; then + install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/ + fi + + if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then + install -m 0755 ${S}/bindings/python/tests/gpiod_py_test.py ${D}${PTEST_PATH}/tests/ + fi }