Skip to contentSkip to conversation

shunit2: new recipe

PATCH New Bartosz Golaszewski 1 participant 2 messages Nov 3, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 shunit2: new recipe

From: Bartosz Golaszewski <[email protected]>

Add a recipe for shunit2 - a testing framework for command-line tools and shell scripts.

---
 meta-oe/recipes-test/shunit2/shunit2_2.1.8.bb | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 meta-oe/recipes-test/shunit2/shunit2_2.1.8.bb
meta-oe/recipes-test/shunit2/shunit2_2.1.8.bb new file +14 -0
new file mode 100644
index 000000000..0ac06c361
@@ -0,0 +1,14 @@
+SUMMARY = "shUnit2 is a xUnit based unit test framework for Bourne based shell scripts"
+AUTHOR = "Kate Ward <[email protected]>"
+HOMEPAGE = "https://github.com/kward/shunit2"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
+
+SRC_URI = " git://github.com/kward/shunit2.git;branch=master;protocol=https"
+SRCREV = "080159b303537888c5d41910b4d47a5002638e30"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+    install -D -m 0755 ${S}/shunit2 ${D}${bindir}/shunit2
+}
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 libgpiod: update to v2.1

From: Bartosz Golaszewski <[email protected]>

This is a small release bringing in a bunch of improvements and a couple new interfaces. Details are available in NEWS.

We need to move the code in recipes around a bit as the tests now use shunit2.

---
 meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest   | 2 +-
 meta-oe/recipes-support/libgpiod/libgpiod.inc             | 3 ---
 meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb        | 8 +++++++-
 .../libgpiod/{libgpiod_2.0.2.bb => libgpiod_2.1.bb}       | 7 ++++++-
 4 files changed, 14 insertions(+), 6 deletions(-)
 rename meta-oe/recipes-support/libgpiod/{libgpiod_2.0.2.bb => libgpiod_2.1.bb} (79%)
meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest +1 -1
index 9475f0253..29ec0d102 100644
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-testbins="gpiod-test gpio-tools-test gpiod-cxx-test"
+testbins="gpiod-test gpio-tools-test.bash gpiod-cxx-test"
 
 ptestdir=$(dirname "$(readlink -f "$0")")
 cd $ptestdir/tests
meta-oe/recipes-support/libgpiod/libgpiod.inc +0 -3
index 0eda47bba..dc1fb4fe9 100644
@@ -33,7 +33,6 @@ FILES:${PN}-tools += " \
 FILES:libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
 
 RRECOMMENDS:${PN}-ptest += "coreutils"
-RDEPENDS:${PN}-ptest += "${@bb.utils.contains('PTEST_ENABLED', '1', 'bats', '', d)}"
 
 do_install:append() {
     rm -f ${D}${bindir}/gpiod-test
@@ -50,8 +49,6 @@ do_install_ptest() {
 
     # 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
meta-oe/recipes-support/libgpiod/libgpiod_1.6.4.bb +7 -1
index b28aa8e69..111a5727b 100644
@@ -30,9 +30,15 @@ RRECOMMENDS:${PN}-ptest += " \
     kernel-module-gpio-mockup \
     ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-unittest', '', d)} \
 "
-RDEPENDS:${PN}-ptest += "python3-packaging"
+RDEPENDS:${PN}-ptest += " \
+    python3-packaging \
+    ${@bb.utils.contains('PTEST_ENABLED', '1', 'bats', '', d)} \
+"
 
 do_install_ptest:append() {
+    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/
+
     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
meta-oe/recipes-support/libgpiod/libgpiod_2.1.bb renamed from meta-oe/recipes-support/libgpiod/libgpiod_2.0.2.bb +6 -1
similarity index 79%
rename from meta-oe/recipes-support/libgpiod/libgpiod_2.0.2.bb
rename to meta-oe/recipes-support/libgpiod/libgpiod_2.1.bb
index 7533e0a25..1e92d0079 100644
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = " \
 
 FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:"
 
-SRC_URI[sha256sum] = "c3c923dc63b7b1b02639c9179c81e3d9febf0887bbaa59775990229cdbedb88b"
+SRC_URI[sha256sum] = "fa4024a080121c958502f9a46a5bda44bea85e7a4dd7fcb3dead463b6fc4261c"
 
 # Enable all project features for ptest
 PACKAGECONFIG[tests] = "--enable-tests --enable-tools --enable-bindings-cxx --enable-gpioset-interactive,--disable-tests,kmod util-linux glib-2.0 catch2 libedit"
@@ -20,8 +20,13 @@ FILES:${PN}-tools += "${bindir}/gpionotify"
 FILES:${PN}-ptest += "${libdir}/libgpiosim.so.*"
 FILES:${PN}-ptest-dev += "${includedir}/gpiosim.h"
 
+RDEPENDS:${PN}-ptest += " \
+    bash \
+    ${@bb.utils.contains('PTEST_ENABLED', '1', 'shunit2', '', d)} \
+"
 RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim"
 
 do_install_ptest:append() {
+    install -m 0755 ${S}/tools/gpio-tools-test.bash ${D}${PTEST_PATH}/tests/
     install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h
 }
Signature · 1 line
2.39.2