From: Gyorgy Sarvari <[email protected]>

Also untangle the licenses a bit: the tests/ftest.h header is covered by
MIT license, however it is only included if tests are enabled.

The tests take less than 2 seconds to execute.

Signed-off-by: Gyorgy Sarvari <[email protected]>
Signed-off-by: Mathieu Dubois-Briand <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
(cherry picked from commit 49314caa7eb8efd86577121337a0b0d7472eab1b)
Signed-off-by: Ankur Tyagi <[email protected]>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-support/utfcpp/utfcpp/run-ptest  | 23 +++++++++++++++++++
 meta/recipes-support/utfcpp/utfcpp_4.0.8.bb   | 18 +++++++++++++--
 3 files changed, 40 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-support/utfcpp/utfcpp/run-ptest

diff --git a/meta/conf/distro/include/ptest-packagelists.inc 
b/meta/conf/distro/include/ptest-packagelists.inc
index 3cd5f244be..09613294d6 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -87,6 +87,7 @@ PTESTS_FAST = "\
     rpm-sequoia \
     sed \
     slang \
+    utfcpp \
     wayland \
     xz \
     zlib \
diff --git a/meta/recipes-support/utfcpp/utfcpp/run-ptest 
b/meta/recipes-support/utfcpp/utfcpp/run-ptest
new file mode 100644
index 0000000000..85e18bd4d9
--- /dev/null
+++ b/meta/recipes-support/utfcpp/utfcpp/run-ptest
@@ -0,0 +1,23 @@
+#!/bin/sh
+RET=0
+cd tests
+
+for t in $(find . -type f -executable); do
+  case $t in
+    *negative)
+      ./$t ./test_data/utf8_invalid.txt
+      ;;
+    *)
+      ./$t
+      ;;
+  esac
+
+  if [ $? -eq 0 ]; then
+    echo PASS: $t
+  else
+    echo FAIL: $t
+    RET=1
+  fi
+done
+
+exit $RET
diff --git a/meta/recipes-support/utfcpp/utfcpp_4.0.8.bb 
b/meta/recipes-support/utfcpp/utfcpp_4.0.8.bb
index 7f6eb367f1..628e8ee0ce 100644
--- a/meta/recipes-support/utfcpp/utfcpp_4.0.8.bb
+++ b/meta/recipes-support/utfcpp/utfcpp_4.0.8.bb
@@ -2,14 +2,28 @@ SUMMARY = " UTF-8 with C++ in a Portable Way"
 HOMEPAGE = "https://github.com/nemtrif/utfcpp";
 
 LICENSE = "BSL-1.0 & MIT"
+LICENSE:${PN} = "BSL-1.0"
+LICENSE:${PN}-ptest = "BSL-1.0 & MIT"
 
 LIC_FILES_CHKSUM = "file://LICENSE;md5=e4224ccaecb14d942c71d31bef20d78c \
                     
file://tests/ftest.h;endline=25;md5=d33c6488d3b003723a5f17ac984db030"
 
-SRC_URI = 
"git://github.com/nemtrif/utfcpp;protocol=https;branch=master;tag=v${PV}"
+SRC_URI = 
"git://github.com/nemtrif/utfcpp;protocol=https;branch=master;tag=v${PV} \
+           file://run-ptest"
 
 SRCREV = "f9319195dfddf369f68f18e7c0039b3f351797fd"
 
-inherit cmake
+inherit cmake ptest
 
 FILES:${PN}-dev += "${datadir}/utf8cpp/cmake"
+
+EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', 
'-DUTF8CPP_ENABLE_TESTS=ON', '', d)}"
+
+do_install_ptest(){
+       install -d ${D}${PTEST_PATH}/tests/test_data
+       install -m 0644 ${S}/tests/test_data/* ${D}${PTEST_PATH}/tests/test_data
+       find ${B}/tests -type f -executable -exec install {} 
${D}${PTEST_PATH}/tests/ \;
+}
+
+# the main package is a header-only library, which produces an empty package
+RDEPENDS:${PN}-ptest = ""
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#227667): 
https://lists.openembedded.org/g/openembedded-core/message/227667
Mute This Topic: https://lists.openembedded.org/mt/116760445/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to