diff options
author | Armin Kuster <akuster808@gmail.com> | 2020-09-28 07:15:59 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2020-09-28 09:17:18 -0700 |
commit | f946444879576d8833493a27a22244530b8644d4 (patch) | |
tree | f37806e20a2fbe5f19e59f846e981b5a961fc4a9 /meta-oe/recipes-test | |
parent | 916158a379a71062daa42606a87d5e04659ec157 (diff) | |
download | meta-openembedded-f946444879576d8833493a27a22244530b8644d4.tar.gz |
cmocka: add recipe
includes ptest and bundling of examples that can be used for testing
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-test')
-rw-r--r-- | meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb | 39 | ||||
-rw-r--r-- | meta-oe/recipes-test/cmocka/files/cmocka-uintptr_t.patch | 53 | ||||
-rw-r--r-- | meta-oe/recipes-test/cmocka/files/run-ptest | 10 |
3 files changed, 102 insertions, 0 deletions
diff --git a/meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb b/meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb new file mode 100644 index 0000000000..5aee5ef931 --- /dev/null +++ b/meta-oe/recipes-test/cmocka/cmocka_1.1.5.bb | |||
@@ -0,0 +1,39 @@ | |||
1 | DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \ | ||
2 | objects. It only requires the standard C library, works on a range of computing \ | ||
3 | platforms (including embedded) and with different compilers." | ||
4 | HOMEPAGE = "https://cmocka.org/" | ||
5 | |||
6 | LICENSE = "Apache-2.0" | ||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" | ||
8 | |||
9 | SRCREV = "56eb3a183fc222120f86d0c54fd033992c30135e" | ||
10 | SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git \ | ||
11 | file://run-ptest \ | ||
12 | file://cmocka-uintptr_t.patch \ | ||
13 | " | ||
14 | |||
15 | S = "${WORKDIR}/git" | ||
16 | |||
17 | inherit cmake ptest | ||
18 | |||
19 | EXTRA_OECMAKE = "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}" | ||
20 | |||
21 | do_install_append () { | ||
22 | install -d ${D}${datadir}/${BPN}/example | ||
23 | install -d ${D}${datadir}/${BPN}/example/mock/chef_wrap | ||
24 | install -d ${D}${datadir}/${BPN}/example/mock/uptime | ||
25 | |||
26 | install -m 0755 ${B}/example/*_test ${D}/${datadir}/${BPN}/example | ||
27 | install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${datadir}/${BPN}/example/mock/chef_wrap | ||
28 | install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${datadir}/${BPN}/example/mock/uptime | ||
29 | install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${datadir}/${BPN}/example/mock/uptime | ||
30 | } | ||
31 | |||
32 | do_install_ptest () { | ||
33 | install -d ${D}${PTEST_PATH}/tests | ||
34 | install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests | ||
35 | } | ||
36 | |||
37 | PACKAGE_BEFORE_PN += "${PN}-examples" | ||
38 | |||
39 | FILES_${PN}-examples = "${datadir}/${BPN}/example" | ||
diff --git a/meta-oe/recipes-test/cmocka/files/cmocka-uintptr_t.patch b/meta-oe/recipes-test/cmocka/files/cmocka-uintptr_t.patch new file mode 100644 index 0000000000..8d3b73b631 --- /dev/null +++ b/meta-oe/recipes-test/cmocka/files/cmocka-uintptr_t.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 5bd7b5d04435bd593349825973ce32290f5f604d Mon Sep 17 00:00:00 2001 | ||
2 | From: Changqing Li <changqing.li@windriver.com> | ||
3 | Date: Wed, 25 Jul 2018 09:55:25 +0800 | ||
4 | Subject: [PATCH] samba: cmocka.h: fix musl libc conflicting types error | ||
5 | |||
6 | Fix build on qemumips64(el) | ||
7 | |||
8 | taken from: | ||
9 | [PATCH] libldb: fix musl libc conflicting types error | ||
10 | |||
11 | /third_party/cmocka/cmocka.h:126:28: error: conflicting types for 'uintptr_t' | ||
12 | typedef unsigned int uintptr_t; | ||
13 | ^~~~~~~~~ | ||
14 | use __DEFINED_uintptr_t in alltypes.h to check if uintptr already defined | ||
15 | |||
16 | Upstream-Status: Pending | ||
17 | |||
18 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
19 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
20 | |||
21 | Taken from [PATCH] samba: cmocka.h: fix musl libc conflicting types error | ||
22 | https://git.openembedded.org/meta-openembedded/commit/meta-networking/recipes-connectivity/samba?id=b758150d30a5fbdc47c465d0e9dca3a7e6d71f3c | ||
23 | |||
24 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
25 | |||
26 | This fix is not in cmocka, so pending pending?? | ||
27 | |||
28 | |||
29 | Index: git/include/cmocka.h | ||
30 | =================================================================== | ||
31 | --- git.orig/include/cmocka.h | ||
32 | +++ git/include/cmocka.h | ||
33 | @@ -116,7 +116,7 @@ typedef uintmax_t LargestIntegralType; | ||
34 | ((LargestIntegralType)(value)) | ||
35 | |||
36 | /* Smallest integral type capable of holding a pointer. */ | ||
37 | -#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) | ||
38 | +#if !defined(__DEFINED_uintptr_t) | ||
39 | # if defined(_WIN32) | ||
40 | /* WIN32 is an ILP32 platform */ | ||
41 | typedef unsigned int uintptr_t; | ||
42 | @@ -140,9 +140,8 @@ typedef uintmax_t LargestIntegralType; | ||
43 | # endif /* __WORDSIZE */ | ||
44 | # endif /* _WIN32 */ | ||
45 | |||
46 | -# define _UINTPTR_T | ||
47 | -# define _UINTPTR_T_DEFINED | ||
48 | -#endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */ | ||
49 | +# define __DEFINED_uintptr_t | ||
50 | +#endif /* !defined(__DEFINED_uintptr_t) */ | ||
51 | |||
52 | /* Perform an unsigned cast to uintptr_t. */ | ||
53 | #define cast_to_pointer_integral_type(value) \ | ||
diff --git a/meta-oe/recipes-test/cmocka/files/run-ptest b/meta-oe/recipes-test/cmocka/files/run-ptest new file mode 100644 index 0000000000..48b9cd9fc5 --- /dev/null +++ b/meta-oe/recipes-test/cmocka/files/run-ptest | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd tests | ||
4 | for i in `ls *`; do | ||
5 | if [ ./$i ] ; then | ||
6 | echo "PASS: $i" | ||
7 | else | ||
8 | echo "FAIL: $i" | ||
9 | fi | ||
10 | done | ||