Skip to contentSkip to conversation

asio: Add ptest support

PATCH Superseded [email protected] 2 participants 4 messages Oct 9, 2024 – Oct 10, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 asio: Add ptest support

From: Mingli Yu <[email protected]>

 # ./run-ptest
PASS: address
PASS: address_v4
PASS: address_v4_iterator
PASS: address_v4_range
PASS: address_v6
PASS: address_v6_iterator
PASS: address_v6_range
PASS: any_completion_executor
PASS: any_completion_handler
PASS: any_executor
PASS: any_io_executor
PASS: append
PASS: as_tuple
PASS: associated_allocator
PASS: associated_cancellation_slot
PASS: associated_executor
PASS: associated_immediate_executor
PASS: associator
PASS: async_result
[snip]
---
 meta-oe/recipes-support/asio/asio/run-ptest | 19 +++++++++++++++++++
 meta-oe/recipes-support/asio/asio_1.30.2.bb | 18 ++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-support/asio/asio/run-ptest
meta-oe/recipes-support/asio/asio/run-ptest new file +19 -0
new file mode 100644
index 000000000..d37db0b31
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+ptestdir=$(dirname "$(readlink -f "$0")")
+cd "$ptestdir"/tests || exit
+
+tests=$(find * -type f -executable)
+
+rm -rf test.log
+
+for f in $tests
+do
+    if test -x ./"$f"; then
+        if ./"$f" > test.log 2>&1; then
+            echo "PASS: $f"
+        else
+            echo "FAIL: $f"
+        fi
+    fi
+done
meta-oe/recipes-support/asio/asio_1.30.2.bb +16 -2
index 6930381ec..ae0baadc6 100644
@@ -8,9 +8,11 @@ LICENSE = "BSL-1.0"
 
 DEPENDS = "openssl"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/asio/${BP}.tar.bz2"
+SRC_URI = "${SOURCEFORGE_MIRROR}/asio/${BP}.tar.bz2 \
+           file://run-ptest \
+"
 
-inherit autotools
+inherit autotools ptest
 
 ALLOW_EMPTY:${PN} = "1"
 
@@ -22,4 +24,16 @@ PACKAGECONFIG ??= "boost"
 
 PACKAGECONFIG[boost] = "--with-boost=${STAGING_LIBDIR},--without-boost,boost"
 
+TESTDIR = "src/tests"
+do_compile_ptest() {
+    echo 'buildtest-TESTS: $(check_PROGRAMS)' >> ${TESTDIR}/Makefile
+    oe_runmake -C ${TESTDIR} buildtest-TESTS
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    # copy executables
+    find ${B}/${TESTDIR}/unit -type f -executable -exec cp {} ${D}${PTEST_PATH}/tests/ \;
+}
+
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.34.1
#1 lore raw

Thanks for adding the tests, this is really helpful in many ways to keep quality of recipe. I would also suggest to add it to per package ptest image mechanism in meta-oe/conf/include/ptest-packagelists-meta-oe.inc, if it is quick then put it
in PTESTS_FAST_META_OE else put it in PTESTS_SLOW_META_OE

After doing this you can run the ptest for just this recipe by doing

bitbake meta-oe-image-ptest-asio

Quoted 104 lines · Mingli via lists.openembedded.org

From: Mingli Yu <[email protected]>

 # ./run-ptest
PASS: address
PASS: address_v4
PASS: address_v4_iterator
PASS: address_v4_range
PASS: address_v6
PASS: address_v6_iterator
PASS: address_v6_range
PASS: any_completion_executor
PASS: any_completion_handler
PASS: any_executor
PASS: any_io_executor
PASS: append
PASS: as_tuple
PASS: associated_allocator
PASS: associated_cancellation_slot
PASS: associated_executor
PASS: associated_immediate_executor
PASS: associator
PASS: async_result
[snip]
---
 meta-oe/recipes-support/asio/asio/run-ptest | 19 +++++++++++++++++++
 meta-oe/recipes-support/asio/asio_1.30.2.bb | 18 ++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-support/asio/asio/run-ptest
meta-oe/recipes-support/asio/asio/run-ptest new file +19 -0
new file mode 100644
index 000000000..d37db0b31
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+ptestdir=$(dirname "$(readlink -f "$0")")
+cd "$ptestdir"/tests || exit
+
+tests=$(find * -type f -executable)
+
+rm -rf test.log
+
+for f in $tests
+do
+    if test -x ./"$f"; then
+        if ./"$f" > test.log 2>&1; then
+            echo "PASS: $f"
+        else
+            echo "FAIL: $f"
+        fi
+    fi
+done
meta-oe/recipes-support/asio/asio_1.30.2.bb +16 -3
index 6930381ec..ae0baadc6 100644
@@ -8,9 +8,11 @@ LICENSE = "BSL-1.0"
 
 DEPENDS = "openssl"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/asio/${BP}.tar.bz2"
+SRC_URI = "${SOURCEFORGE_MIRROR}/asio/${BP}.tar.bz2 \
+           file://run-ptest \
+"
 
-inherit autotools
+inherit autotools ptest
 
 ALLOW_EMPTY:${PN} = "1"
 
@@ -22,4 +24,16 @@ PACKAGECONFIG ??= "boost"
 
 PACKAGECONFIG[boost] = "--with-boost=${STAGING_LIBDIR},--without-boost,boost"
 
+TESTDIR = "src/tests"
+do_compile_ptest() {
+    echo 'buildtest-TESTS: $(check_PROGRAMS)' >> ${TESTDIR}/Makefile
+    oe_runmake -C ${TESTDIR} buildtest-TESTS
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    # copy executables
+    find ${B}/${TESTDIR}/unit -type f -executable -exec cp {} ${D}${PTEST_PATH}/tests/ \;
+}
+
 BBCLASSEXTEND = "native nativesdk"
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#112724): https://lists.openembedded.org/g/openembedded-devel/message/112724
Mute This Topic: https://lists.openembedded.org/mt/108905838/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

also fails to build with clang

https://errors.yoctoproject.org/Errors/Details/807571/

Quoted 118 lines · Khem Raj

Thanks for adding the tests, this is really helpful in many ways to keep quality of recipe. I would also suggest to add it to per package ptest image mechanism in meta-oe/conf/include/ptest-packagelists-meta-oe.inc, if it is quick then put it
in PTESTS_FAST_META_OE else put it in PTESTS_SLOW_META_OE

After doing this you can run the ptest for just this recipe by doing

bitbake meta-oe-image-ptest-asio

Quoted 104 lines · Mingli via lists.openembedded.org

From: Mingli Yu <[email protected]>

 # ./run-ptest
PASS: address
PASS: address_v4
PASS: address_v4_iterator
PASS: address_v4_range
PASS: address_v6
PASS: address_v6_iterator
PASS: address_v6_range
PASS: any_completion_executor
PASS: any_completion_handler
PASS: any_executor
PASS: any_io_executor
PASS: append
PASS: as_tuple
PASS: associated_allocator
PASS: associated_cancellation_slot
PASS: associated_executor
PASS: associated_immediate_executor
PASS: associator
PASS: async_result
[snip]
---
 meta-oe/recipes-support/asio/asio/run-ptest | 19 +++++++++++++++++++
 meta-oe/recipes-support/asio/asio_1.30.2.bb | 18 ++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-support/asio/asio/run-ptest
meta-oe/recipes-support/asio/asio/run-ptest new file +19 -0
new file mode 100644
index 000000000..d37db0b31
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+ptestdir=$(dirname "$(readlink -f "$0")")
+cd "$ptestdir"/tests || exit
+
+tests=$(find * -type f -executable)
+
+rm -rf test.log
+
+for f in $tests
+do
+    if test -x ./"$f"; then
+        if ./"$f" > test.log 2>&1; then
+            echo "PASS: $f"
+        else
+            echo "FAIL: $f"
+        fi
+    fi
+done
meta-oe/recipes-support/asio/asio_1.30.2.bb +16 -3
index 6930381ec..ae0baadc6 100644
@@ -8,9 +8,11 @@ LICENSE = "BSL-1.0"
 
 DEPENDS = "openssl"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/asio/${BP}.tar.bz2"
+SRC_URI = "${SOURCEFORGE_MIRROR}/asio/${BP}.tar.bz2 \
+           file://run-ptest \
+"
 
-inherit autotools
+inherit autotools ptest
 
 ALLOW_EMPTY:${PN} = "1"
 
@@ -22,4 +24,16 @@ PACKAGECONFIG ??= "boost"
 
 PACKAGECONFIG[boost] = "--with-boost=${STAGING_LIBDIR},--without-boost,boost"
 
+TESTDIR = "src/tests"
+do_compile_ptest() {
+    echo 'buildtest-TESTS: $(check_PROGRAMS)' >> ${TESTDIR}/Makefile
+    oe_runmake -C ${TESTDIR} buildtest-TESTS
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    # copy executables
+    find ${B}/${TESTDIR}/unit -type f -executable -exec cp {} ${D}${PTEST_PATH}/tests/ \;
+}
+
 BBCLASSEXTEND = "native nativesdk"
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#112724): https://lists.openembedded.org/g/openembedded-devel/message/112724
Mute This Topic: https://lists.openembedded.org/mt/108905838/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

author
#3 lore raw

Will sent v2.

Thanks,

Quoted 126 lines · Khem Raj

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

also fails to build with clang

https://errors.yoctoproject.org/Errors/Details/807571/

Quoted 118 lines · Khem Raj

Thanks for adding the tests, this is really helpful in many ways to keep quality of recipe. I would also suggest to add it to per package ptest image mechanism in meta-oe/conf/include/ptest-packagelists-meta-oe.inc, if it is quick then put it
in PTESTS_FAST_META_OE else put it in PTESTS_SLOW_META_OE

After doing this you can run the ptest for just this recipe by doing

bitbake meta-oe-image-ptest-asio

Quoted 104 lines · Mingli via lists.openembedded.org

From: Mingli Yu <[email protected]>

  # ./run-ptest
PASS: address
PASS: address_v4
PASS: address_v4_iterator
PASS: address_v4_range
PASS: address_v6
PASS: address_v6_iterator
PASS: address_v6_range
PASS: any_completion_executor
PASS: any_completion_handler
PASS: any_executor
PASS: any_io_executor
PASS: append
PASS: as_tuple
PASS: associated_allocator
PASS: associated_cancellation_slot
PASS: associated_executor
PASS: associated_immediate_executor
PASS: associator
PASS: async_result
[snip]
---
  meta-oe/recipes-support/asio/asio/run-ptest | 19 +++++++++++++++++++
  meta-oe/recipes-support/asio/asio_1.30.2.bb | 18 ++++++++++++++++--
  2 files changed, 35 insertions(+), 2 deletions(-)

create mode 100644 meta-oe/recipes-support/asio/asio/run-ptest

meta-oe/recipes-support/asio/asio/run-ptest new file +19 -0
new file mode 100644
index 000000000..d37db0b31
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+ptestdir=$(dirname "$(readlink -f "$0")")
+cd "$ptestdir"/tests || exit
+
+tests=$(find * -type f -executable)
+
+rm -rf test.log
+
+for f in $tests
+do
+    if test -x ./"$f"; then
+        if ./"$f" > test.log 2>&1; then
+            echo "PASS: $f"
+        else
+            echo "FAIL: $f"
+        fi
+    fi
+done
meta-oe/recipes-support/asio/asio_1.30.2.bb +16 -3
index 6930381ec..ae0baadc6 100644
@@ -8,9 +8,11 @@ LICENSE = "BSL-1.0"
 
  DEPENDS = "openssl"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/asio/${BP}.tar.bz2"
+SRC_URI = "${SOURCEFORGE_MIRROR}/asio/${BP}.tar.bz2 \
+           file://run-ptest \
+"
 
-inherit autotools
+inherit autotools ptest
 
  ALLOW_EMPTY:${PN} = "1"
 
@@ -22,4 +24,16 @@ PACKAGECONFIG ??= "boost"
 
  PACKAGECONFIG[boost] = "--with-boost=${STAGING_LIBDIR},--without-boost,boost"
 
+TESTDIR = "src/tests"
+do_compile_ptest() {
+    echo 'buildtest-TESTS: $(check_PROGRAMS)' >> ${TESTDIR}/Makefile
+    oe_runmake -C ${TESTDIR} buildtest-TESTS
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    # copy executables
+    find ${B}/${TESTDIR}/unit -type f -executable -exec cp {} ${D}${PTEST_PATH}/tests/ \;
+}
+
  BBCLASSEXTEND = "native nativesdk"
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#112724): https://lists.openembedded.org/g/openembedded-devel/message/112724
Mute This Topic: https://lists.openembedded.org/mt/108905838/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-