diff mbox series

[meta-networking] Wolfssl: add ptest

Message ID 20250305170435.3320386-1-sofiane.hamam@smile.fr
State Accepted
Headers show
Series [meta-networking] Wolfssl: add ptest | expand

Commit Message

Sofiane HAMAM March 5, 2025, 5:04 p.m. UTC
Add ptest for Wolfssl package.
Set IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-wolfssl to 700M
enough to avoid a "No space left on device".

BEGIN: /usr/lib/wolfssl/ptest
Wolfssl ptest logs are stored in /tmp/wolfss_temp.qvuQ9h/ptest.log
Test script returned: 0
unit_test: Success for all configured tests.
PASS: Wolfssl
DURATION: 7
END: /usr/lib/wolfssl/ptest

Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>
---
 .../ptest-packagelists-meta-networking.inc    |  1 +
 .../wolfssl/files/run-ptest                   | 24 +++++++++++++++++++
 .../wolfssl/wolfssl_5.7.2.bb                  | 24 +++++++++++++++++--
 .../images/meta-networking-image-ptest.bb     |  1 +
 4 files changed, 48 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-connectivity/wolfssl/files/run-ptest

Comments

Yoann Congal March 5, 2025, 5:13 p.m. UTC | #1
Hello,

Le mer. 5 mars 2025 à 18:07, Sofiane HAMAM via lists.openembedded.org
<sofiane.hamam=smile.fr@lists.openembedded.org> a écrit :
>
> Add ptest for Wolfssl package.
> Set IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-wolfssl to 700M
> enough to avoid a "No space left on device".
>
> BEGIN: /usr/lib/wolfssl/ptest
> Wolfssl ptest logs are stored in /tmp/wolfss_temp.qvuQ9h/ptest.log
> Test script returned: 0
> unit_test: Success for all configured tests.
> PASS: Wolfssl
> DURATION: 7
> END: /usr/lib/wolfssl/ptest
>
> Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>

Thank you Sofiane!
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>

> ---
>  .../ptest-packagelists-meta-networking.inc    |  1 +
>  .../wolfssl/files/run-ptest                   | 24 +++++++++++++++++++
>  .../wolfssl/wolfssl_5.7.2.bb                  | 24 +++++++++++++++++--
>  .../images/meta-networking-image-ptest.bb     |  1 +
>  4 files changed, 48 insertions(+), 2 deletions(-)
>  create mode 100644 meta-networking/recipes-connectivity/wolfssl/files/run-ptest
>
> diff --git a/meta-networking/conf/include/ptest-packagelists-meta-networking.inc b/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
> index 2197a06e7..113725882 100644
> --- a/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
> +++ b/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
> @@ -19,6 +19,7 @@ PTESTS_FAST_META_NETWORKING = "\
>      openhpi \
>      squid \
>      tcpdump \
> +    wolfssl \
>  "
>
>  # firewalld currently hangs forever so disable it for now
> diff --git a/meta-networking/recipes-connectivity/wolfssl/files/run-ptest b/meta-networking/recipes-connectivity/wolfssl/files/run-ptest
> new file mode 100644
> index 000000000..ff66f4ef6
> --- /dev/null
> +++ b/meta-networking/recipes-connectivity/wolfssl/files/run-ptest
> @@ -0,0 +1,24 @@
> +#!/bin/sh
> +
> +echo "############ Running Wolfssl Ptest ##########"
> +
> +log_file=ptest.log
> +temp_dir=$(mktemp -d /tmp/wolfss_temp.XXXXXX)
> +echo "Wolfssl ptest logs are stored in ${temp_dir}/${log_file}"
> +
> +./test/unit.test > "$temp_dir/$log_file" 2>&1
> +
> +echo "Test script returned: $?"
> +
> +MAGIC_SENTENCE=$(grep "unit_test: Success for all configured tests." $temp_dir/$log_file)
> +
> +if [ -n "$MAGIC_SENTENCE" ]; then
> +    echo "$MAGIC_SENTENCE"
> +    echo "PASS: Wolfssl"
> +else
> +    echo "#### Issue with at least one test !####"
> +    echo "FAIL: Wolfssl"
> +fi
> +NUM_FAILS=$(grep -c "Failed" $temp_dir/$log_file)
> +
> +exit $NUM_FAILS
> diff --git a/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.7.2.bb b/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.7.2.bb
> index 009434d96..b7ff23e71 100644
> --- a/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.7.2.bb
> +++ b/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.7.2.bb
> @@ -12,14 +12,34 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
>  PROVIDES += "cyassl"
>  RPROVIDES:${PN} = "cyassl"
>
> -SRC_URI = "git://github.com/wolfSSL/wolfssl.git;protocol=https;branch=master"
> +SRC_URI = " \
> +    git://github.com/wolfSSL/wolfssl.git;protocol=https;branch=master \
> +    file://run-ptest \
> +"
> +
>  SRCREV = "00e42151ca061463ba6a95adb2290f678cbca472"
>
>  S = "${WORKDIR}/git"
>
> -inherit autotools
> +inherit autotools ptest
>
>  PACKAGECONFIG ?= "reproducible-build"
>
>  PACKAGECONFIG[reproducible-build] = "--enable-reproducible-build,--disable-reproducible-build,"
>  BBCLASSEXTEND += "native nativesdk"
> +
> +RDEPENDS:${PN}-ptest += " bash"
> +
> +do_install_ptest() {
> +    # Prevent QA Error "package contains reference to TMPDIR [buildpaths]" for unit.test script
> +    # Replace the occurences of ${B}/src with '${PTEST_PATH}'
> +    sed -i 's|${B}/src|${PTEST_PATH}|g' ${B}/tests/unit.test
> +
> +    install -d ${D}${PTEST_PATH}/test
> +
> +    # create an empty folder examples, needed in wolfssl's tests/api.c to "Test loading path with no files"
> +    install -d ${D}${PTEST_PATH}/examples
> +    cp -rf ${B}/tests/. ${D}${PTEST_PATH}/test
> +    cp -rf ${S}/certs  ${D}${PTEST_PATH}
> +    cp -rf ${S}/tests  ${D}${PTEST_PATH}
> +}
> diff --git a/meta-networking/recipes-core/images/meta-networking-image-ptest.bb b/meta-networking/recipes-core/images/meta-networking-image-ptest.bb
> index 295da982e..b6238d610 100644
> --- a/meta-networking/recipes-core/images/meta-networking-image-ptest.bb
> +++ b/meta-networking/recipes-core/images/meta-networking-image-ptest.bb
> @@ -20,6 +20,7 @@ BBCLASSEXTEND = "${@' '.join(['mcextend:'+x for x in d.getVar('PTESTS_META_NETWO
>  # box) and explicitly add up to 1500MB.
>  IMAGE_OVERHEAD_FACTOR = "1.0"
>  IMAGE_ROOTFS_EXTRA_SPACE = "324288"
> +IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-wolfssl = "714288"
>  # If a particular ptest needs more space, it can be customized:
>  #IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-<pn> = "1024288"
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#115760): https://lists.openembedded.org/g/openembedded-devel/message/115760
> Mute This Topic: https://lists.openembedded.org/mt/111531871/4316185
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [yoann.congal@smile.fr]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-networking/conf/include/ptest-packagelists-meta-networking.inc b/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
index 2197a06e7..113725882 100644
--- a/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
+++ b/meta-networking/conf/include/ptest-packagelists-meta-networking.inc
@@ -19,6 +19,7 @@  PTESTS_FAST_META_NETWORKING = "\
     openhpi \
     squid \
     tcpdump \
+    wolfssl \
 "
 
 # firewalld currently hangs forever so disable it for now
diff --git a/meta-networking/recipes-connectivity/wolfssl/files/run-ptest b/meta-networking/recipes-connectivity/wolfssl/files/run-ptest
new file mode 100644
index 000000000..ff66f4ef6
--- /dev/null
+++ b/meta-networking/recipes-connectivity/wolfssl/files/run-ptest
@@ -0,0 +1,24 @@ 
+#!/bin/sh
+
+echo "############ Running Wolfssl Ptest ##########"
+
+log_file=ptest.log
+temp_dir=$(mktemp -d /tmp/wolfss_temp.XXXXXX)
+echo "Wolfssl ptest logs are stored in ${temp_dir}/${log_file}"
+
+./test/unit.test > "$temp_dir/$log_file" 2>&1  
+
+echo "Test script returned: $?"
+
+MAGIC_SENTENCE=$(grep "unit_test: Success for all configured tests." $temp_dir/$log_file)
+
+if [ -n "$MAGIC_SENTENCE" ]; then
+    echo "$MAGIC_SENTENCE"
+    echo "PASS: Wolfssl"
+else
+    echo "#### Issue with at least one test !####"
+    echo "FAIL: Wolfssl"
+fi
+NUM_FAILS=$(grep -c "Failed" $temp_dir/$log_file)
+
+exit $NUM_FAILS
diff --git a/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.7.2.bb b/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.7.2.bb
index 009434d96..b7ff23e71 100644
--- a/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.7.2.bb
+++ b/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.7.2.bb
@@ -12,14 +12,34 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 PROVIDES += "cyassl"
 RPROVIDES:${PN} = "cyassl"
 
-SRC_URI = "git://github.com/wolfSSL/wolfssl.git;protocol=https;branch=master"
+SRC_URI = " \
+    git://github.com/wolfSSL/wolfssl.git;protocol=https;branch=master \
+    file://run-ptest \
+"
+
 SRCREV = "00e42151ca061463ba6a95adb2290f678cbca472"
 
 S = "${WORKDIR}/git"
 
-inherit autotools
+inherit autotools ptest
 
 PACKAGECONFIG ?= "reproducible-build"
 
 PACKAGECONFIG[reproducible-build] = "--enable-reproducible-build,--disable-reproducible-build,"
 BBCLASSEXTEND += "native nativesdk"
+
+RDEPENDS:${PN}-ptest += " bash"
+
+do_install_ptest() {
+    # Prevent QA Error "package contains reference to TMPDIR [buildpaths]" for unit.test script
+    # Replace the occurences of ${B}/src with '${PTEST_PATH}'
+    sed -i 's|${B}/src|${PTEST_PATH}|g' ${B}/tests/unit.test
+
+    install -d ${D}${PTEST_PATH}/test
+
+    # create an empty folder examples, needed in wolfssl's tests/api.c to "Test loading path with no files"
+    install -d ${D}${PTEST_PATH}/examples
+    cp -rf ${B}/tests/. ${D}${PTEST_PATH}/test
+    cp -rf ${S}/certs  ${D}${PTEST_PATH}
+    cp -rf ${S}/tests  ${D}${PTEST_PATH}
+}
diff --git a/meta-networking/recipes-core/images/meta-networking-image-ptest.bb b/meta-networking/recipes-core/images/meta-networking-image-ptest.bb
index 295da982e..b6238d610 100644
--- a/meta-networking/recipes-core/images/meta-networking-image-ptest.bb
+++ b/meta-networking/recipes-core/images/meta-networking-image-ptest.bb
@@ -20,6 +20,7 @@  BBCLASSEXTEND = "${@' '.join(['mcextend:'+x for x in d.getVar('PTESTS_META_NETWO
 # box) and explicitly add up to 1500MB.
 IMAGE_OVERHEAD_FACTOR = "1.0"
 IMAGE_ROOTFS_EXTRA_SPACE = "324288"
+IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-wolfssl = "714288" 
 # If a particular ptest needs more space, it can be customized:
 #IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-<pn> = "1024288"