Skip to contentSkip to conversation

libyang: fix ptest

PATCH New Yi Zhao 1 participant 3 messages Mar 8, 2023

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/3 libyang: fix ptest

* Disable valgrind tests to get rid of valgrind runtime dependency. Then libyang can support more arches.
* Only copy test cases to ptest directory, not the entire build directory.
* Fix buildpaths issue for test cases.
* Update ptest cases list

Result:

$ ptest-runner libyang
START: ptest-runner
2023-03-08T07:10
BEGIN: /usr/lib/libyang/ptest
PASS: utest_binary
PASS: utest_bits
PASS: utest_boolean
PASS: utest_common
PASS: utest_decimal64
PASS: utest_diff
PASS: utest_empty
PASS: utest_enumeration
PASS: utest_hash_table
PASS: utest_identityref
PASS: utest_inet_types
PASS: utest_inout
PASS: utest_instanceid
PASS: utest_int16
PASS: utest_int32
PASS: utest_int64
PASS: utest_int8
PASS: utest_json
PASS: utest_leafref
PASS: utest_list
PASS: utest_lyb
PASS: utest_merge
PASS: utest_metadata
PASS: utest_nacm
PASS: utest_new
PASS: utest_parser_json
PASS: utest_parser_xml
PASS: utest_parser_yang
PASS: utest_parser_yin
PASS: utest_pattern
PASS: utest_printer_tree
PASS: utest_printer_xml
PASS: utest_printer_yang
PASS: utest_printer_yin
PASS: utest_plugins
PASS: utest_range
PASS: utest_schema
PASS: utest_schema_mount
PASS: utest_set
PASS: utest_string
PASS: utest_tree_data
PASS: utest_tree_schema_compile
PASS: utest_uint16
PASS: utest_uint32
PASS: utest_uint64
PASS: utest_uint8
PASS: utest_union
PASS: utest_validation
PASS: utest_xml
PASS: utest_xpath
PASS: utest_yangdata
PASS: utest_yang_types
PASS: utest_yanglib
DURATION: 12
END: /usr/lib/libyang/ptest
2023-03-08T07:10
STOP: ptest-runner
TOTAL: 1 FAIL: 0
---
 .../libyang/libyang/run-ptest                 | 29 ++++++++++++++++++-
 .../libyang/libyang_2.0.194.bb                | 24 ++++++++-------
 2 files changed, 41 insertions(+), 12 deletions(-)
meta-oe/recipes-extended/libyang/libyang/run-ptest +28 -1
index 1c9f8f47f..4517725b4 100644
@@ -2,28 +2,55 @@
 # Valid tests to run
 tests="utest_binary \
        utest_bits \
+       utest_boolean \
        utest_common \
+       utest_decimal64 \
+       utest_diff \
+       utest_empty \
+       utest_enumeration \
        utest_hash_table \
+       utest_identityref \
        utest_inet_types \
+       utest_inout \
+       utest_instanceid \
+       utest_int16 \
+       utest_int32 \
+       utest_int64 \
        utest_int8 \
        utest_json \
+       utest_leafref \
        utest_list \
+       utest_lyb \
        utest_merge \
        utest_metadata \
+       utest_nacm \
+       utest_new \
+       utest_parser_json \
+       utest_parser_xml \
        utest_parser_yang \
        utest_parser_yin \
        utest_pattern \
+       utest_printer_tree \
+       utest_printer_xml \
        utest_printer_yang \
        utest_printer_yin \
+       utest_plugins \
        utest_range \
        utest_schema \
+       utest_schema_mount \
        utest_set \
        utest_string \
        utest_tree_data \
        utest_tree_schema_compile \
-       utest_types \
+       utest_uint16 \
+       utest_uint32 \
+       utest_uint64 \
+       utest_uint8 \
+       utest_union \
+       utest_validation \
        utest_xml \
        utest_xpath \
+       utest_yangdata \
        utest_yang_types \
        utest_yanglib"
 
meta-oe/recipes-extended/libyang/libyang_2.0.194.bb +13 -11
index 548dcdd2f..16630a715 100644
@@ -15,23 +15,25 @@ SRC_URI = "git://github.com/CESNET/libyang.git;branch=master;protocol=https \
 
 S = "${WORKDIR}/git"
 
-# Due to valgrind not supported on these arches:
-COMPATIBLE_HOST:riscv32 = "null"
-COMPATIBLE_HOST:armv5 = "null"
-COMPATIBLE_HOST:riscv64 = "null"
-
 # Main dependencies
 inherit cmake pkgconfig lib_package ptest
 DEPENDS = "libpcre2"
 DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'cmocka', '', d)}"
 
-# Ptest dependencies
-RDEPENDS:${PN}-ptest += "valgrind"
-
 EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release"
-EXTRA_OECMAKE += " ${@bb.utils.contains('PTEST_ENABLED', '1', '-DENABLE_TESTS=ON', '', d)}"
+EXTRA_OECMAKE += " ${@bb.utils.contains('PTEST_ENABLED', '1', '-DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF', '', d)}"
 
-do_install_ptest () {
-    cp -fR ${B}/tests/ ${D}${PTEST_PATH}/
+do_compile:prepend () {
+    if [ ${PTEST_ENABLED} = "1" ]; then
+        sed -i -e 's|${S}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
+        sed -i -e 's|${B}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
+    fi
 }
 
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/tests
+    cp -f ${B}/tests/utest_* ${D}${PTEST_PATH}/tests/
+    cp -fR ${S}/tests/modules ${D}${PTEST_PATH}/tests/
+    install -d ${D}${PTEST_PATH}/tests/plugins
+    cp -f ${B}/tests/plugins/plugin_*.so ${D}${PTEST_PATH}/tests/plugins/
+}
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/3 libyang: upgrade 2.0.194 -> 2.1.30

* Drop local patch that has been merged upstream.
* Update ptest cases list.

Ptest Result:

$ ptest-runner libyang
START: ptest-runner
2023-03-08T08:25
BEGIN: /usr/lib/libyang/ptest
PASS: utest_binary
PASS: utest_bits
PASS: utest_boolean
PASS: utest_common
PASS: utest_decimal64
PASS: utest_diff
PASS: utest_empty
PASS: utest_enumeration
PASS: utest_hash_table
PASS: utest_identityref
PASS: utest_inet_types
PASS: utest_inout
PASS: utest_instanceid
PASS: utest_instanceid_keys
PASS: utest_int16
PASS: utest_int32
PASS: utest_int64
PASS: utest_int8
PASS: utest_json
PASS: utest_leafref
PASS: utest_list
PASS: utest_lyb
PASS: utest_merge
PASS: utest_metadata
PASS: utest_nacm
PASS: utest_new
PASS: utest_parser_json
PASS: utest_parser_xml
PASS: utest_pattern
PASS: utest_printer_tree
PASS: utest_printer_xml
PASS: utest_plugins
PASS: utest_range
PASS: utest_schema
PASS: utest_schema_mount
PASS: utest_set
PASS: utest_string
PASS: utest_structure
PASS: utest_tree_data
PASS: utest_tree_schema_compile
PASS: utest_uint16
PASS: utest_uint32
PASS: utest_uint64
PASS: utest_uint8
PASS: utest_union
PASS: utest_validation
PASS: utest_xml
PASS: utest_xpath
PASS: utest_yang
PASS: utest_yangdata
PASS: utest_yang_types
PASS: utest_yanglib
PASS: utest_yin
DURATION: 11
END: /usr/lib/libyang/ptest
2023-03-08T08:26
STOP: ptest-runner
TOTAL: 1 FAIL: 0
---
 .../libyang/libyang-add-stdint-h.patch        | 35 -------------------
 .../libyang/libyang/run-ptest                 | 10 +++---
 .../{libyang_2.0.194.bb => libyang_2.1.30.bb} |  5 +--
 3 files changed, 8 insertions(+), 42 deletions(-)
 delete mode 100644 meta-oe/recipes-extended/libyang/libyang/libyang-add-stdint-h.patch
 rename meta-oe/recipes-extended/libyang/{libyang_2.0.194.bb => libyang_2.1.30.bb} (92%)
meta-oe/recipes-extended/libyang/libyang/libyang-add-stdint-h.patch deleted +0 -35
deleted file mode 100644
index d35741114..000000000
@@ -1,35 +0,0 @@
-From c7f3e2a8fe530beec6103cb9071ccc41458879aa Mon Sep 17 00:00:00 2001
-From: Tony Tascioglu <[email protected]>
-Date: Mon, 21 Jun 2021 12:34:22 -0400
-Subject: [PATCH] libyang: fix initial build errors
-
-This patch addresses build errors seen when integrating libyang as a
-recipe.
-
-There is a missing include statement for stdint.h in utests.h which
-causes build problems. stdint.h is required to be imported by cmocka.h
-prior to the cmocka file. Adding the stdint allows it to build the
-tests correctly
-
-Upstream-Status: Submitted [ https://github.com/CESNET/libyang/pull/1819 ]
-
-Signed-off-by: Tony Tascioglu <[email protected]>
-Signed-off-by: Randy MacLeod <[email protected]>
----
- tests/utests/utests.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/tests/utests/utests.h b/tests/utests/utests.h
-index 7e85a66e..8eee26ce 100644
---- a/tests/utests/utests.h
-+++ b/tests/utests/utests.h
-@@ -22,6 +22,7 @@
- #include <stdarg.h>
- #include <stddef.h>
- #include <stdlib.h>
-+#include <stdint.h>
- 
- #include <cmocka.h>
- 
--- 
-2.32.0
meta-oe/recipes-extended/libyang/libyang/run-ptest +5 -5
index 4517725b4..9682540e2 100644
@@ -13,6 +13,7 @@ tests="utest_binary \
        utest_inet_types \
        utest_inout \
        utest_instanceid \
+       utest_instanceid_keys \
        utest_int16 \
        utest_int32 \
        utest_int64 \
@@ -27,19 +28,16 @@ tests="utest_binary \
        utest_new \
        utest_parser_json \
        utest_parser_xml \
-       utest_parser_yang \
-       utest_parser_yin \
        utest_pattern \
        utest_printer_tree \
        utest_printer_xml \
-       utest_printer_yang \
-       utest_printer_yin \
        utest_plugins \
        utest_range \
        utest_schema \
        utest_schema_mount \
        utest_set \
        utest_string \
+       utest_structure \
        utest_tree_data \
        utest_tree_schema_compile \
        utest_uint16 \
@@ -50,9 +48,11 @@ tests="utest_binary \
        utest_validation \
        utest_xml \
        utest_xpath \
+       utest_yang \
        utest_yangdata \
        utest_yang_types \
-       utest_yanglib"
+       utest_yanglib \
+       utest_yin"
 
 # cd into right directory
 ptestdir=$(dirname "$(readlink -f "$0")")
meta-oe/recipes-extended/libyang/libyang_2.1.30.bb renamed from meta-oe/recipes-extended/libyang/libyang_2.0.194.bb +3 -2
similarity index 92%
rename from meta-oe/recipes-extended/libyang/libyang_2.0.194.bb
rename to meta-oe/recipes-extended/libyang/libyang_2.1.30.bb
index 16630a715..5adfc1d80 100644
@@ -6,10 +6,9 @@ LICENSE = "BSD-3-Clause"
 
 LIC_FILES_CHKSUM = "file://LICENSE;md5=f3916d7d8d42a6508d0ea418cfff10ad"
 
-SRCREV = "87375f15159545a87a1e0de200f5d9d67e9091d7"
+SRCREV = "35131b9396a965e01f899127763fb4e0871b845a"
 
 SRC_URI = "git://github.com/CESNET/libyang.git;branch=master;protocol=https \
-           file://libyang-add-stdint-h.patch \
            file://run-ptest \
            "
 
@@ -37,3 +36,5 @@ do_install_ptest () {
     install -d ${D}${PTEST_PATH}/tests/plugins
     cp -f ${B}/tests/plugins/plugin_*.so ${D}${PTEST_PATH}/tests/plugins/
 }
+
+FILES:${PN} += "${datadir}/yang/*"
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 3/3 frr: support more arches

In reply to Yi Zhao

Now frr can support more arches as libyang can be built on all arches.

---
 meta-networking/recipes-protocols/frr/frr_8.4.2.bb | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
meta-networking/recipes-protocols/frr/frr_8.4.2.bb +1 -9
index e5082e2e6..d01d895a8 100644
@@ -20,15 +20,6 @@ UPSTREAM_CHECK_GITTAGREGEX = "frr-(?P<pver>\d+(\.\d+)+)$"
 
 S = "${WORKDIR}/git"
 
-# Due to libyang not supported on these arches:
-COMPATIBLE_HOST:riscv32 = "null"
-COMPATIBLE_HOST:riscv64 = "null"
-COMPATIBLE_HOST:armv5 = "null"
-
-# Fail to build on mips64 with error:
-# Error: PC-relative reference to a different section
-COMPATIBLE_HOST:mips64 = "null"
-
 inherit autotools-brokensep python3native pkgconfig useradd systemd
 
 DEPENDS:class-native = "bison-native elfutils-native"
@@ -71,6 +62,7 @@ CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
 LDFLAGS:append:mips = " -latomic"
 LDFLAGS:append:mipsel = " -latomic"
 LDFLAGS:append:powerpc = " -latomic"
+LDFLAGS:append:riscv32 = " -latomic"
 
 SYSTEMD_PACKAGES = "${PN}"
 SYSTEMD_SERVICE:${PN} = "frr.service"
Signature · 1 line
2.25.1