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

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Yi Zhao 2023-03-08 21:49:21 +08:00 committed by Khem Raj
parent f8b54b5243
commit ea17a1bcff
2 changed files with 41 additions and 12 deletions

View File

@ -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"

View File

@ -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/
}