diff mbox series

[v2,3/3] ofono: add ptests

Message ID 20240618073439.2068944-3-martin@geanix.com
State New
Headers show
Series [v2,1/3] ofono: upgrade 2.7 -> 2.8 | expand

Commit Message

Martin Hundebøll June 18, 2024, 7:34 a.m. UTC
Install and run the unit tests already provided by ofono. Test execution
time is about a second.

Signed-off-by: Martin Hundebøll <martin@geanix.com>
---

Change since v1:
 * add missing run-ptest file

 meta/conf/distro/include/ptest-packagelists.inc |  1 +
 meta/recipes-connectivity/ofono/ofono/run-ptest | 14 ++++++++++++++
 meta/recipes-connectivity/ofono/ofono_2.8.bb    | 12 +++++++++++-
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-connectivity/ofono/ofono/run-ptest

Comments

Alexandre Belloni June 19, 2024, 7:26 a.m. UTC | #1
ptest failure:

https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/6727/steps/12/logs/stdio
https://autobuilder.yocto.io/pub/non-release/20240618-20/testresults/qemux86-64-ptest/ofono.log

This seems intermittent as it didn't happen on arm

On 18/06/2024 09:34:37+0200, Martin Hundeb?ll wrote:
> Install and run the unit tests already provided by ofono. Test execution
> time is about a second.
> 
> Signed-off-by: Martin Hundeb�ll <martin@geanix.com>
> ---
> 
> Change since v1:
>  * add missing run-ptest file
> 
>  meta/conf/distro/include/ptest-packagelists.inc |  1 +
>  meta/recipes-connectivity/ofono/ofono/run-ptest | 14 ++++++++++++++
>  meta/recipes-connectivity/ofono/ofono_2.8.bb    | 12 +++++++++++-
>  3 files changed, 26 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-connectivity/ofono/ofono/run-ptest
> 
> diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
> index c60575a45cc2..60cbea0f19e9 100644
> --- a/meta/conf/distro/include/ptest-packagelists.inc
> +++ b/meta/conf/distro/include/ptest-packagelists.inc
> @@ -53,6 +53,7 @@ PTESTS_FAST = "\
>      lzo \
>      m4 \
>      nettle \
> +    ofono \
>      opkg \
>      pango \
>      popt \
> diff --git a/meta/recipes-connectivity/ofono/ofono/run-ptest b/meta/recipes-connectivity/ofono/ofono/run-ptest
> new file mode 100644
> index 000000000000..ba0f66ee4170
> --- /dev/null
> +++ b/meta/recipes-connectivity/ofono/ofono/run-ptest
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +
> +ret_val=0
> +
> +for test in test-*; do
> +    if "./$test" >> ofono_test.log 2>&1; then
> +        echo "PASS: $test"
> +    else
> +        echo "FAIL: $test"
> +        ret_val=1
> +    fi
> +done
> +
> +exit $ret_val
> diff --git a/meta/recipes-connectivity/ofono/ofono_2.8.bb b/meta/recipes-connectivity/ofono/ofono_2.8.bb
> index 809485d42178..f54367848f05 100644
> --- a/meta/recipes-connectivity/ofono/ofono_2.8.bb
> +++ b/meta/recipes-connectivity/ofono/ofono_2.8.bb
> @@ -10,10 +10,11 @@ DEPENDS = "dbus glib-2.0 udev mobile-broadband-provider-info ell"
>  SRC_URI = "\
>      ${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
>      file://ofono \
> +    file://run-ptest \
>  "
>  SRC_URI[sha256sum] = "b5aef455b3a374ce43bad43c2ade9d0430d9c0d28952385c44ac7d0dc933bbb8"
>  
> -inherit autotools pkgconfig update-rc.d systemd gobject-introspection-data
> +inherit autotools pkgconfig update-rc.d systemd gobject-introspection-data ptest
>  
>  INITSCRIPT_NAME = "ofono"
>  INITSCRIPT_PARAMS = "defaults 22"
> @@ -28,11 +29,20 @@ PACKAGECONFIG[bluez] = "--enable-bluetooth, --disable-bluetooth, bluez5"
>  
>  EXTRA_OECONF += "--enable-test --enable-external-ell"
>  
> +do_compile_ptest() {
> +    oe_runmake buildtest-TESTS
> +}
> +
>  do_install:append() {
>      install -d ${D}${sysconfdir}/init.d/
>      install -m 0755 ${UNPACKDIR}/ofono ${D}${sysconfdir}/init.d/ofono
>  }
>  
> +do_install_ptest() {
> +    install -m755 -Dt ${D}${PTEST_PATH} $(find ${B}/unit -executable -type f)
> +    install -m644 -Dt ${D}${PTEST_PATH}/unit ${B}/unit/test-provision.db
> +}
> +
>  PACKAGES =+ "${PN}-tests"
>  
>  FILES:${PN} += "${systemd_unitdir}"
> -- 
> 2.45.2
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#200861): https://lists.openembedded.org/g/openembedded-core/message/200861
> Mute This Topic: https://lists.openembedded.org/mt/106736942/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index c60575a45cc2..60cbea0f19e9 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -53,6 +53,7 @@  PTESTS_FAST = "\
     lzo \
     m4 \
     nettle \
+    ofono \
     opkg \
     pango \
     popt \
diff --git a/meta/recipes-connectivity/ofono/ofono/run-ptest b/meta/recipes-connectivity/ofono/ofono/run-ptest
new file mode 100644
index 000000000000..ba0f66ee4170
--- /dev/null
+++ b/meta/recipes-connectivity/ofono/ofono/run-ptest
@@ -0,0 +1,14 @@ 
+#!/bin/sh
+
+ret_val=0
+
+for test in test-*; do
+    if "./$test" >> ofono_test.log 2>&1; then
+        echo "PASS: $test"
+    else
+        echo "FAIL: $test"
+        ret_val=1
+    fi
+done
+
+exit $ret_val
diff --git a/meta/recipes-connectivity/ofono/ofono_2.8.bb b/meta/recipes-connectivity/ofono/ofono_2.8.bb
index 809485d42178..f54367848f05 100644
--- a/meta/recipes-connectivity/ofono/ofono_2.8.bb
+++ b/meta/recipes-connectivity/ofono/ofono_2.8.bb
@@ -10,10 +10,11 @@  DEPENDS = "dbus glib-2.0 udev mobile-broadband-provider-info ell"
 SRC_URI = "\
     ${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
     file://ofono \
+    file://run-ptest \
 "
 SRC_URI[sha256sum] = "b5aef455b3a374ce43bad43c2ade9d0430d9c0d28952385c44ac7d0dc933bbb8"
 
-inherit autotools pkgconfig update-rc.d systemd gobject-introspection-data
+inherit autotools pkgconfig update-rc.d systemd gobject-introspection-data ptest
 
 INITSCRIPT_NAME = "ofono"
 INITSCRIPT_PARAMS = "defaults 22"
@@ -28,11 +29,20 @@  PACKAGECONFIG[bluez] = "--enable-bluetooth, --disable-bluetooth, bluez5"
 
 EXTRA_OECONF += "--enable-test --enable-external-ell"
 
+do_compile_ptest() {
+    oe_runmake buildtest-TESTS
+}
+
 do_install:append() {
     install -d ${D}${sysconfdir}/init.d/
     install -m 0755 ${UNPACKDIR}/ofono ${D}${sysconfdir}/init.d/ofono
 }
 
+do_install_ptest() {
+    install -m755 -Dt ${D}${PTEST_PATH} $(find ${B}/unit -executable -type f)
+    install -m644 -Dt ${D}${PTEST_PATH}/unit ${B}/unit/test-provision.db
+}
+
 PACKAGES =+ "${PN}-tests"
 
 FILES:${PN} += "${systemd_unitdir}"