Skip to contentSkip to conversation

cmocka: add recipe

PATCH In review akuster 2 participants 6 messages Sep 25, 2020 – Sep 27, 2020

lore
Share & tools
lore

akuster

author
#0 lore raw

PATCH 1/1 cmocka: add recipe

From: Armin Kuster <[email protected]>

includes ptest and bundling of examples that can be used for testing

---
 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb | 37 +++++++++++++++++++++
 meta-oe/recipes-test/cmocka/files/run-ptest | 10 ++++++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb
 create mode 100644 meta-oe/recipes-test/cmocka/files/run-ptest
meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb new file +37 -0
new file mode 100644
index 0000000000..6125d116cd
@@ -0,0 +1,37 @@
+DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \
+objects. It only requires the standard C library, works on a range of computing \
+platforms (including embedded) and with different compilers."
+HOMEPAGE = "https://cmocka.org/"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRCREV = "56eb3a183fc222120f86d0c54fd033992c30135e"
+SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git \
+           file://run-ptest "
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE = "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}"
+
+do_install_append () {
+    install -d ${D}${datadir}/${BPN}/example
+    install -d ${D}${datadir}/${BPN}/example/mock/chef_wrap
+    install -d ${D}${datadir}/${BPN}/example/mock/uptime
+
+    install -m 0755 ${B}/example/*_test ${D}/${datadir}/${BPN}/example
+    install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${datadir}/${BPN}/example/mock/chef_wrap
+    install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+    install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+}
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
+
+PACKAGE_BEFORE_PN += "${PN}-examples"
+
+FILES_${PN}-examples = "${datadir}/${BPN}/example"
meta-oe/recipes-test/cmocka/files/run-ptest new file +10 -0
new file mode 100644
index 0000000000..48b9cd9fc5
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd tests
+for i in `ls *`; do
+   if [ ./$i ] ; then
+       echo "PASS: $i"
+   else
+       echo "FAIL: $i"
+   fi
+done
Signature · 1 line
2.17.1
#1 lore raw

Can you add it to appropriate packagegroups too for testing purposes

Quoted 78 lines · akuster

From: Armin Kuster <[email protected]>

includes ptest and bundling of examples that can be used for testing

---
 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb | 37 +++++++++++++++++++++
 meta-oe/recipes-test/cmocka/files/run-ptest | 10 ++++++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb
 create mode 100644 meta-oe/recipes-test/cmocka/files/run-ptest
meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb new file +37 -0
new file mode 100644
index 0000000000..6125d116cd
@@ -0,0 +1,37 @@
+DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \
+objects. It only requires the standard C library, works on a range of computing \
+platforms (including embedded) and with different compilers."
+HOMEPAGE = "https://cmocka.org/"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRCREV = "56eb3a183fc222120f86d0c54fd033992c30135e"
+SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git \
+           file://run-ptest "
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE = "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}"
+
+do_install_append () {
+    install -d ${D}${datadir}/${BPN}/example
+    install -d ${D}${datadir}/${BPN}/example/mock/chef_wrap
+    install -d ${D}${datadir}/${BPN}/example/mock/uptime
+
+    install -m 0755 ${B}/example/*_test ${D}/${datadir}/${BPN}/example
+    install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${datadir}/${BPN}/example/mock/chef_wrap
+    install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+    install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+}
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
+
+PACKAGE_BEFORE_PN += "${PN}-examples"
+
+FILES_${PN}-examples = "${datadir}/${BPN}/example"
meta-oe/recipes-test/cmocka/files/run-ptest new file +10 -1
new file mode 100644
index 0000000000..48b9cd9fc5
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd tests
+for i in `ls *`; do
+   if [ ./$i ] ; then
+       echo "PASS: $i"
+   else
+       echo "FAIL: $i"
+   fi
+done
--

2.17.1

#2 lore raw

Now this recipe is added I wonder if libldb and samba can use this copy instead of their internal version ?

Quoted 82 lines · Khem Raj

Can you add it to appropriate packagegroups too for testing purposes

Quoted 78 lines · akuster

From: Armin Kuster <[email protected]>

includes ptest and bundling of examples that can be used for testing

---
 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb | 37 +++++++++++++++++++++
 meta-oe/recipes-test/cmocka/files/run-ptest | 10 ++++++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb
 create mode 100644 meta-oe/recipes-test/cmocka/files/run-ptest
meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb new file +37 -0
new file mode 100644
index 0000000000..6125d116cd
@@ -0,0 +1,37 @@
+DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \
+objects. It only requires the standard C library, works on a range of computing \
+platforms (including embedded) and with different compilers."
+HOMEPAGE = "https://cmocka.org/"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRCREV = "56eb3a183fc222120f86d0c54fd033992c30135e"
+SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git \
+           file://run-ptest "
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE = "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}"
+
+do_install_append () {
+    install -d ${D}${datadir}/${BPN}/example
+    install -d ${D}${datadir}/${BPN}/example/mock/chef_wrap
+    install -d ${D}${datadir}/${BPN}/example/mock/uptime
+
+    install -m 0755 ${B}/example/*_test ${D}/${datadir}/${BPN}/example
+    install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${datadir}/${BPN}/example/mock/chef_wrap
+    install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+    install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+}
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
+
+PACKAGE_BEFORE_PN += "${PN}-examples"
+
+FILES_${PN}-examples = "${datadir}/${BPN}/example"
meta-oe/recipes-test/cmocka/files/run-ptest new file +10 -1
new file mode 100644
index 0000000000..48b9cd9fc5
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd tests
+for i in `ls *`; do
+   if [ ./$i ] ; then
+       echo "PASS: $i"
+   else
+       echo "FAIL: $i"
+   fi
+done
--

2.17.1

#3 lore raw

fails on musl too
https://errors.yoctoproject.org/Errors/Details/500726/

Quoted 87 lines · Khem Raj

Now this recipe is added I wonder if libldb and samba can use this copy instead of their internal version ?

Quoted 82 lines · Khem Raj

Can you add it to appropriate packagegroups too for testing purposes

Quoted 78 lines · akuster

From: Armin Kuster <[email protected]>

includes ptest and bundling of examples that can be used for testing

---
 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb | 37 +++++++++++++++++++++
 meta-oe/recipes-test/cmocka/files/run-ptest | 10 ++++++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb
 create mode 100644 meta-oe/recipes-test/cmocka/files/run-ptest
meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb new file +37 -0
new file mode 100644
index 0000000000..6125d116cd
@@ -0,0 +1,37 @@
+DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \
+objects. It only requires the standard C library, works on a range of computing \
+platforms (including embedded) and with different compilers."
+HOMEPAGE = "https://cmocka.org/"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRCREV = "56eb3a183fc222120f86d0c54fd033992c30135e"
+SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git \
+           file://run-ptest "
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE = "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}"
+
+do_install_append () {
+    install -d ${D}${datadir}/${BPN}/example
+    install -d ${D}${datadir}/${BPN}/example/mock/chef_wrap
+    install -d ${D}${datadir}/${BPN}/example/mock/uptime
+
+    install -m 0755 ${B}/example/*_test ${D}/${datadir}/${BPN}/example
+    install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${datadir}/${BPN}/example/mock/chef_wrap
+    install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+    install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+}
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
+
+PACKAGE_BEFORE_PN += "${PN}-examples"
+
+FILES_${PN}-examples = "${datadir}/${BPN}/example"
meta-oe/recipes-test/cmocka/files/run-ptest new file +10 -1
new file mode 100644
index 0000000000..48b9cd9fc5
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd tests
+for i in `ls *`; do
+   if [ ./$i ] ; then
+       echo "PASS: $i"
+   else
+       echo "FAIL: $i"
+   fi
+done
--

2.17.1

author
#4 lore raw
Quoted 2 lines · Khem Raj

fails on musl too
https://errors.yoctoproject.org/Errors/Details/500726/

ok. thanks.  keep forgetting that use-case

-armin

Quoted 86 lines · Khem Raj
Quoted 84 lines

Now this recipe is added I wonder if libldb and samba can use this copy instead of their internal version ?

Quoted 80 lines · Khem Raj

Can you add it to appropriate packagegroups too for testing purposes

Quoted 77 lines · akuster

From: Armin Kuster <[email protected]>

includes ptest and bundling of examples that can be used for testing

---
 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb | 37 +++++++++++++++++++++
 meta-oe/recipes-test/cmocka/files/run-ptest | 10 ++++++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb
 create mode 100644 meta-oe/recipes-test/cmocka/files/run-ptest
meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb new file +37 -0
new file mode 100644
index 0000000000..6125d116cd
@@ -0,0 +1,37 @@
+DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \
+objects. It only requires the standard C library, works on a range of computing \
+platforms (including embedded) and with different compilers."
+HOMEPAGE = "https://cmocka.org/"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRCREV = "56eb3a183fc222120f86d0c54fd033992c30135e"
+SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git \
+           file://run-ptest "
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE = "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}"
+
+do_install_append () {
+    install -d ${D}${datadir}/${BPN}/example
+    install -d ${D}${datadir}/${BPN}/example/mock/chef_wrap
+    install -d ${D}${datadir}/${BPN}/example/mock/uptime
+
+    install -m 0755 ${B}/example/*_test ${D}/${datadir}/${BPN}/example
+    install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${datadir}/${BPN}/example/mock/chef_wrap
+    install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+    install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+}
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
+
+PACKAGE_BEFORE_PN += "${PN}-examples"
+
+FILES_${PN}-examples = "${datadir}/${BPN}/example"
meta-oe/recipes-test/cmocka/files/run-ptest new file +10 -1
new file mode 100644
index 0000000000..48b9cd9fc5
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd tests
+for i in `ls *`; do
+   if [ ./$i ] ; then
+       echo "PASS: $i"
+   else
+       echo "FAIL: $i"
+   fi
+done
--

2.17.1

author
#5 lore raw
In reply to Khem Raj
Quoted 2 lines · Khem Raj

fails on musl too
https://errors.yoctoproject.org/Errors/Details/500726/

this fix looks promising.

https://git.cryptomilk.org/projects/cmocka.git/commit/?id=28ce16b29911e5adc60140b572dee177adc7a178

Quoted 86 lines · Khem Raj
Quoted 84 lines

Now this recipe is added I wonder if libldb and samba can use this copy instead of their internal version ?

Quoted 80 lines · Khem Raj

Can you add it to appropriate packagegroups too for testing purposes

Quoted 77 lines · akuster

From: Armin Kuster <[email protected]>

includes ptest and bundling of examples that can be used for testing

---
 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb | 37 +++++++++++++++++++++
 meta-oe/recipes-test/cmocka/files/run-ptest | 10 ++++++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb
 create mode 100644 meta-oe/recipes-test/cmocka/files/run-ptest
meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb new file +37 -0
new file mode 100644
index 0000000000..6125d116cd
@@ -0,0 +1,37 @@
+DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \
+objects. It only requires the standard C library, works on a range of computing \
+platforms (including embedded) and with different compilers."
+HOMEPAGE = "https://cmocka.org/"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRCREV = "56eb3a183fc222120f86d0c54fd033992c30135e"
+SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git \
+           file://run-ptest "
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE = "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}"
+
+do_install_append () {
+    install -d ${D}${datadir}/${BPN}/example
+    install -d ${D}${datadir}/${BPN}/example/mock/chef_wrap
+    install -d ${D}${datadir}/${BPN}/example/mock/uptime
+
+    install -m 0755 ${B}/example/*_test ${D}/${datadir}/${BPN}/example
+    install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${datadir}/${BPN}/example/mock/chef_wrap
+    install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+    install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${datadir}/${BPN}/example/mock/uptime
+}
+
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
+
+PACKAGE_BEFORE_PN += "${PN}-examples"
+
+FILES_${PN}-examples = "${datadir}/${BPN}/example"
meta-oe/recipes-test/cmocka/files/run-ptest new file +10 -1
new file mode 100644
index 0000000000..48b9cd9fc5
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd tests
+for i in `ls *`; do
+   if [ ./$i ] ; then
+       echo "PASS: $i"
+   else
+       echo "FAIL: $i"
+   fi
+done
--

2.17.1