Skip to contentSkip to conversation

libcereal: add ptest support

PATCH New [email protected] 1 participant 1 message Mar 10, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libcereal: add ptest support

From: Mingli Yu <[email protected]>

Add ptest support.

---
 .../recipes-support/libcereal/files/run-ptest  | 12 ++++++++++++
 .../libcereal/libcereal_1.3.2.bb               | 18 +++++++++++++++---
 2 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100755 meta-oe/recipes-support/libcereal/files/run-ptest
meta-oe/recipes-support/libcereal/files/run-ptest new file +12 -0
new file mode 100755
index 000000000..9bc480aa7
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd tests
+for atest in test_* ; do
+    rm -rf tests.log
+    ./${atest} > tests.log 2>&1
+    if [ $? = 0 ] ; then
+        echo "PASS: ${atest}"
+    else
+        echo "FAIL: ${atest}"
+    fi
+done
meta-oe/recipes-support/libcereal/libcereal_1.3.2.bb +15 -3
index 08291d2db..fc58a42d2 100644
@@ -12,17 +12,29 @@ LIC_FILES_CHKSUM = "\
     file://include/cereal/external/rapidjson/msinttypes/LICENSE;md5=dffce65b98c773976de2e338bd130f46 \
 "
 
+DEPENDS = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'boost', '', d)} "
+
 PROVIDES += "${PN}-dev"
 
 PV .= "+git${SRCPV}"
 SRCREV = "ebef1e929807629befafbb2918ea1a08c7194554"
-SRC_URI = "git://github.com/USCiLab/cereal.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/USCiLab/cereal.git;branch=master;protocol=https \
+           file://run-ptest \
+"
 
 S = "${WORKDIR}/git"
 
-inherit cmake pkgconfig
+inherit cmake pkgconfig ptest
+
+PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)}"
+PACKAGECONFIG[with-tests] = "-DBUILD_TESTS=ON -DSKIP_PORTABILITY_TEST=ON,,"
+
+EXTRA_OECMAKE = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '', '-DJUST_INSTALL_CEREAL=ON', d)}"
 
-EXTRA_OECMAKE = "-DJUST_INSTALL_CEREAL=ON"
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    cp ${B}/unittests/test_*  ${D}${PTEST_PATH}/tests
+}
 
 ALLOW_EMPTY:${PN} = "1"
 
Signature · 1 line
2.25.1