diff mbox series

[meta-networking,3/4] libtevent: fix ptest

Message ID 20231012115614.3133797-3-yi.zhao@windriver.com
State Under Review
Headers show
Series [meta-networking,1/4] samba: upgrade 4.18.6 -> 4.18.8 | expand

Commit Message

Yi Zhao Oct. 12, 2023, 11:56 a.m. UTC
* use external cmocka instead of bundled cmocka
* add run-ptest script

Ptest results:
$ ./run-ptest
PASS: replace_testsuite
PASS: test_tevent_tag
PASS: test_tevent_trace

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 ...ix-musl-libc-conflicting-types-error.patch | 45 -------------------
 .../libtevent/libtevent/run-ptest             | 17 +++++++
 .../libtevent/libtevent_0.14.1.bb             | 20 +++------
 3 files changed, 24 insertions(+), 58 deletions(-)
 delete mode 100644 meta-networking/recipes-support/libtevent/libtevent/cmocka-fix-musl-libc-conflicting-types-error.patch
 create mode 100644 meta-networking/recipes-support/libtevent/libtevent/run-ptest
diff mbox series

Patch

diff --git a/meta-networking/recipes-support/libtevent/libtevent/cmocka-fix-musl-libc-conflicting-types-error.patch b/meta-networking/recipes-support/libtevent/libtevent/cmocka-fix-musl-libc-conflicting-types-error.patch
deleted file mode 100644
index 5795ff3bd..000000000
--- a/meta-networking/recipes-support/libtevent/libtevent/cmocka-fix-musl-libc-conflicting-types-error.patch
+++ /dev/null
@@ -1,45 +0,0 @@ 
-From 1d4dedab5039bb671f44566d8573ee3532ba7176 Mon Sep 17 00:00:00 2001
-From: Changqing Li <changqing.li@windriver.com>
-Date: Wed, 25 Jul 2018 09:55:25 +0800
-Subject: [PATCH] cmocka: fix musl libc conflicting types error
-
-/third_party/cmocka/cmocka.h:126:28: error: conflicting types for 'uintptr_t'
-            typedef unsigned int uintptr_t;
-                                 ^~~~~~~~~
-use __DEFINED_uintptr_t in alltypes.h to check if uintptr already defined
-
-Upstream-Status: Pending
-
-Signed-off-by: Changqing Li <changqing.li@windriver.com>
----
- third_party/cmocka/cmocka.h | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/third_party/cmocka/cmocka.h b/third_party/cmocka/cmocka.h
-index e6861c8..238201d 100644
---- a/third_party/cmocka/cmocka.h
-+++ b/third_party/cmocka/cmocka.h
-@@ -111,7 +111,7 @@ typedef uintmax_t LargestIntegralType;
-     ((LargestIntegralType)(value))
- 
- /* Smallest integral type capable of holding a pointer. */
--#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED)
-+#if !defined(__DEFINED_uintptr_t)
- # if defined(_WIN32)
-     /* WIN32 is an ILP32 platform */
-     typedef unsigned int uintptr_t;
-@@ -135,9 +135,8 @@ typedef uintmax_t LargestIntegralType;
- #  endif /* __WORDSIZE */
- # endif /* _WIN32 */
- 
--# define _UINTPTR_T
--# define _UINTPTR_T_DEFINED
--#endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */
-+# define __DEFINED_uintptr_t
-+#endif /* !defined(__DEFINED_uintptr_t) */
- 
- /* Perform an unsigned cast to uintptr_t. */
- #define cast_to_pointer_integral_type(value) \
--- 
-2.25.1
-
diff --git a/meta-networking/recipes-support/libtevent/libtevent/run-ptest b/meta-networking/recipes-support/libtevent/libtevent/run-ptest
new file mode 100644
index 000000000..19f7a4a3a
--- /dev/null
+++ b/meta-networking/recipes-support/libtevent/libtevent/run-ptest
@@ -0,0 +1,17 @@ 
+#!/bin/sh
+
+ptestdir=$(dirname "$(readlink -f "$0")")
+cd "$ptestdir"/tests || exit
+
+tests="replace_testsuite test_tevent_tag test_tevent_trace"
+
+for f in $tests
+do
+    if test -x ./"$f"; then
+        if ./"$f" > ./"$f".out 2> ./"$f".err; then
+            echo "PASS: $f"
+        else
+            echo "FAIL: $f"
+        fi
+    fi
+done
diff --git a/meta-networking/recipes-support/libtevent/libtevent_0.14.1.bb b/meta-networking/recipes-support/libtevent/libtevent_0.14.1.bb
index b34c186ca..9a2b5ede2 100644
--- a/meta-networking/recipes-support/libtevent/libtevent_0.14.1.bb
+++ b/meta-networking/recipes-support/libtevent/libtevent_0.14.1.bb
@@ -3,7 +3,7 @@  HOMEPAGE = "https://tevent.samba.org"
 SECTION = "libs"
 LICENSE = "LGPL-3.0-or-later"
 
-DEPENDS += "libtalloc libtirpc"
+DEPENDS += "libtalloc libtirpc cmocka"
 RDEPENDS:python3-tevent = "python3"
 
 export PYTHONHASHSEED="1"
@@ -11,10 +11,9 @@  export PYTHONHASHSEED="1"
 SRC_URI = "https://samba.org/ftp/tevent/tevent-${PV}.tar.gz \
            file://0001-Add-configure-options-for-packages.patch \
            file://0002-Fix-pyext_PATTERN-for-cross-compilation.patch \
+           file://run-ptest \
           "
 
-SRC_URI:append:libc-musl = " file://cmocka-fix-musl-libc-conflicting-types-error.patch"
-
 LIC_FILES_CHKSUM = "file://tevent.h;endline=26;md5=47386b7c539bf2706b7ce52dc9341681"
 
 SRC_URI[sha256sum] = "ef85fcaa80ffd2351036ba4b347630fef2a1ac3da964a7f1820466bad03cd00d"
@@ -42,27 +41,22 @@  export WAF_NO_PREFORK="yes"
 
 EXTRA_OECONF += "--disable-rpath \
                  --disable-rpath-install \
-                 --bundled-libraries=cmocka \
+                 --bundled-libraries=NONE \
                  --builtin-libraries=replace \
                  --with-libiconv=${STAGING_DIR_HOST}${prefix}\
                  --without-gettext \
                 "
 
-do_install:append() {
-    install -Dm 0755 ${B}/bin/test_tevent_trace ${D}${bindir}/test_tevent_trace
-    install -Dm 0755 ${B}/bin/test_tevent_tag ${D}${bindir}/test_tevent_tag
-    install -Dm 0755 ${B}/bin/replace_testsuite ${D}${bindir}/replace_testsuite
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    install -m 0755 ${B}/bin/test_tevent_* ${D}${PTEST_PATH}/tests/
+    install -m 0755 ${B}/bin/replace_testsuite ${D}${PTEST_PATH}/tests/
 }
 
 PACKAGES += "python3-tevent"
 
 RPROVIDES:${PN}-dbg += "python3-tevent-dbg"
 
-FILES:${PN} += "${libdir}/tevent/*"
-FILES:${PN}-ptest += "${bindir}/replace_testsuite \
-                      ${bindir}/test_tevent_tag \
-                      ${bindir}/test_tevent_trace \
-                      ${libdir}/libcmocka-tevent.so"
 FILES:python3-tevent = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*"
 
 INSANE_SKIP:${MLPREFIX}python3-tevent = "dev-so"