ell: add ptests
PATCH v3 1/2 ell: add ptests
Depends on openssl-native and xxd-native to allow generating certificates used for testing.
Create the ${B}/unit dir as that seems to be missing with the automake patches used for building tests separately from running them.
In order to build the test cases, both --enable-tests and --enable-maintainer-mode must be passed to configure.
A few unit tests looks for files in ../ell-0.67/unit (i.e. $(top_srcdir) in automake) when running. Instead of playing games with symlinks or install paths, the "correct" path is just (re)defined in CFLAGS.
Skip a few tests that require additional kernel modules to be enabled.
Test execution time is about 10 seconds.
--- .../distro/include/ptest-packagelists.inc | 1 + meta/recipes-core/ell/ell_0.67.bb | 24 ++++++++++++++++--- meta/recipes-core/ell/files/run-ptest | 23 ++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 meta/recipes-core/ell/files/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
@@ -15,6 +15,7 @@ PTESTS_FAST = "\ cpio \ diffstat \ diffutils \ + ell \ ethtool \ expat \ expect \
meta/recipes-core/ell/ell_0.67.bb +21 -3
@@ -10,9 +10,27 @@ SECTION = "libs" LICENSE = "LGPL-2.1-only" LIC_FILES_CHKSUM = "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09" -DEPENDS = "dbus" +DEPENDS = "dbus openssl-native xxd-native" -inherit autotools pkgconfig +inherit autotools pkgconfig ptest -SRC_URI = "https://mirrors.edge.kernel.org/pub/linux/libs/${BPN}/${BPN}-${PV}.tar.xz" +SRC_URI = " \ + https://mirrors.edge.kernel.org/pub/linux/libs/${BPN}/${BPN}-${PV}.tar.xz \ + file://run-ptest \ +" SRC_URI[sha256sum] = "97942e8cefb130b632496e5485242f3f374f3b8846800fb74fffd76dc2a0c726" + +EXTRA_OECONF += "--enable-tests --enable-maintainer-mode" +CFLAGS += "-UUNITDIR -DUNITDIR="\\"./unit/\\""" + +do_compile:prepend() { + mkdir -p ${B}/unit +} + +do_install_ptest() { + install -m755 -Dt ${D}${PTEST_PATH} $(find ${B}/unit -executable -type f) + install -Dt ${D}${PTEST_PATH}/unit \ + ${S}/unit/dbus.conf \ + ${S}/unit/settings.test \ + $(find ${B}/unit -name \*.pem -type f) +}
meta/recipes-core/ell/files/run-ptest new file +23 -0
@@ -0,0 +1,23 @@ +#!/bin/sh + +ret_val=0 + +for test in test-*; do + case "$test" in + test-pem | test-key) + if ! [ -d /sys/module/pkcs8_key_parser ]; then + echo "SKIP: $test" + continue + fi + ;; + esac + + if "./$test" >> ell_test.log 2>&1; then + echo "PASS: $test" + else + echo "FAIL: $test" + ret_val=1 + fi +done + +exit $ret_val
Signature · 1 line
2.45.2
PATCH v3 2/2 ofono: add ptests
Install and run the unit tests already provided by ofono. Test execution time is about a second.
---
Change since v2:
* disable basic mux test that requires phonesim service to connect to
Change since v1:
* add missing run-ptest file
.../distro/include/ptest-packagelists.inc | 1 + .../ofono/ofono/run-ptest | 25 +++++++++++++++++++ meta/recipes-connectivity/ofono/ofono_2.9.bb | 12 ++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-connectivity/ofono/ofono/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
@@ -54,6 +54,7 @@ PTESTS_FAST = "\ lzo \ m4 \ nettle \ + ofono \ opkg \ popt \ python3-atomicwrites \
meta/recipes-connectivity/ofono/ofono/run-ptest new file +25 -0
@@ -0,0 +1,25 @@ +#!/bin/sh + +ret_val=0 + +for test in test-*; do + case "$test" in + test-mux) + # the basic mux test requires a phonesim server process + # to connect to + args="-s /testmux/basic" + ;; + *) + args="" + ;; + esac + + if "./$test" $args >> ofono_test.log 2>&1; then + echo "PASS: $test" + else + echo "FAIL: $test" + ret_val=1 + fi +done + +exit $ret_val
meta/recipes-connectivity/ofono/ofono_2.9.bb +11 -1
@@ -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] = "9d2612925a23a7fb668f297a044b5ea136215cc399ecc3f127135c8f2a9845f9" -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}"
Signature · 1 line
2.45.2
Re: [OE-core] [PATCH v3 2/2] ofono: add ptests
meta/recipes-connectivity/ofono/ofono_2.9.bb PACKAGECONFIG[bluez] = "--enable-bluetooth, --disable-bluetooth, bluez5" · line 44
Quoted 7 lines · Martin Hundeb?ll via lists.openembedded.org
meta/recipes-connectivity/ofono/ofono_2.9.bb +4
-0+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 +}
As as ell: the binaries are built with libtool, so use libtool —mode=install to install them.
Ross
meta/recipes-core/ell/ell_0.67.bb SECTION = "libs" · line 13
Quoted 10 lines · Martin Hundeb?ll via lists.openembedded.org
meta/recipes-core/ell/ell_0.67.bb +0
-0@@ -10,9 +10,27 @@ SECTION = "libs"LICENSE = "LGPL-2.1-only"
LIC_FILES_CHKSUM= "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09"meta/recipes-core/ell/ell_0.67.bb +1
-1-DEPENDS = "dbus" +DEPENDS = "dbus openssl-native xxd-native"
This should be conditional on ptest, right?
Quoted 1 line
+EXTRA_OECONF += "--enable-tests --enable-maintainer-mode"
Make this conditional on ptest too?
meta/recipes-core/ell/ell_0.67.bb SECTION = "libs" · line 28
Quoted 3 lines
meta/recipes-core/ell/ell_0.67.bb +3
-0+do_compile:prepend() { + mkdir -p ${B}/unit +}
This sounds like a broken Makefile.am that has a bad assumption in.
meta/recipes-core/ell/ell_0.67.bb SECTION = "libs" · line 36
Quoted 7 lines
meta/recipes-core/ell/ell_0.67.bb +7
-0+do_install_ptest() { + install -m755 -Dt ${D}${PTEST_PATH} $(find ${B}/unit -executable -type f) + install -Dt ${D}${PTEST_PATH}/unit \ + ${S}/unit/dbus.conf \ + ${S}/unit/settings.test \ + $(find ${B}/unit -name \*.pem -type f) +}
As the test scripts are built with libtool, it’s best to use libtool —mode=install to install them.
Ross
Quoted 27 lines · Ross Burton via lists.openembedded.org
meta/recipes-core/ell/ell_0.67.bb SECTION = "libs" · line 13
Quoted 12 lines · Martin Hundeb?ll via lists.openembedded.org
meta/recipes- renamed from meta/recipes-core/ell/ell_0.67.bb +0
-0core/ell/ell_0.67.bb
index6b0ebbe62113..ee9aa73d2908100644meta/recipes-core/ell/ell_0.67.bb +0
-0@@ -10,9 +10,27 @@ SECTION = "libs"LICENSE = "LGPL-2.1-only"
LIC_FILES_CHKSUM= "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09"meta/recipes-core/ell/ell_0.67.bb +1
-1-DEPENDS = "dbus" +DEPENDS = "dbus openssl-native xxd-native"This should be conditional on ptest, right?
Quoted 1 line
+EXTRA_OECONF += "--enable-tests --enable-maintainer-mode"
Make this conditional on ptest too?
meta/recipes-core/ell/ell_0.67.bb SECTION = "libs" · line 28
Quoted 3 lines
meta/recipes-core/ell/ell_0.67.bb +3
-0+do_compile:prepend() { + mkdir -p ${B}/unit +}This sounds like a broken Makefile.am that has a bad assumption in.
Quoted 11 lines
Quoted 8 lines
+do_install_ptest() {
+ install -m755 -Dt ${D}${PTEST_PATH} $(find ${B}/unit - executable -type f)
+ install -Dt ${D}${PTEST_PATH}/unit \
+${S}/unit/dbus.conf\
+ ${S}/unit/settings.test \
+ $(find ${B}/unit -name \*.pem -type f)
+}As the test scripts are built with libtool, it’s best to use libtool —mode=install to install them.
Thanks for the review Ross. There was also a failure in automated testing on the autobuilder:
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/6864/steps/12/logs/stdio
The arm tests haven't run yet in that build.
Cheers,
Richard
Quoted 41 lines · Richard Purdie
Quoted 27 lines · Ross Burton via lists.openembedded.org
meta/recipes-core/ell/ell_0.67.bb SECTION = "libs" · line 13
Quoted 12 lines · Martin Hundeb?ll via lists.openembedded.org
meta/recipes- renamed from meta/recipes-core/ell/ell_0.67.bb +0
-0core/ell/ell_0.67.bb
index6b0ebbe62113..ee9aa73d2908100644meta/recipes-core/ell/ell_0.67.bb +0
-0@@ -10,9 +10,27 @@ SECTION = "libs"LICENSE = "LGPL-2.1-only"
LIC_FILES_CHKSUM= "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09"meta/recipes-core/ell/ell_0.67.bb +1
-1-DEPENDS = "dbus" +DEPENDS = "dbus openssl-native xxd-native"This should be conditional on ptest, right?
Quoted 1 line
+EXTRA_OECONF += "--enable-tests --enable-maintainer-mode"
Make this conditional on ptest too?
meta/recipes-core/ell/ell_0.67.bb SECTION = "libs" · line 28
Quoted 3 lines
meta/recipes-core/ell/ell_0.67.bb +3
-0+do_compile:prepend() { + mkdir -p ${B}/unit +}This sounds like a broken Makefile.am that has a bad assumption in.
Quoted 11 lines
Quoted 8 lines
+do_install_ptest() {
+ install -m755 -Dt ${D}${PTEST_PATH} $(find ${B}/unit - executable -type f)
+ install -Dt ${D}${PTEST_PATH}/unit \
+${S}/unit/dbus.conf\
+ ${S}/unit/settings.test \
+ $(find ${B}/unit -name \*.pem -type f)
+}As the test scripts are built with libtool, it’s best to use libtool —mode=install to install them.
Quoted 6 lines
Thanks for the review Ross. There was also a failure in automated testing on the autobuilder:
https://autobuilder.yoctoproject.org/typhoon/#/builders/81/builds/6864/steps/12/logs/stdio
The arm tests haven't run yet in that build.
It failed to build on arm64:
https://autobuilder.yoctoproject.org/typhoon/#/builders/82/builds/6689/steps/11/logs/stdio
Quoted 16 lines
Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#202907): https://lists.openembedded.org/g/openembedded-core/message/202907
Mute This Topic: https://lists.openembedded.org/mt/107661617/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com