cli11: add ptest support

The tests take single digit seconds to execute.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Gyorgy Sarvari
2025-10-17 14:05:10 +02:00
committed by Khem Raj
parent e1f667ee80
commit f955474be2
4 changed files with 56 additions and 2 deletions
@@ -8,6 +8,7 @@
# ptests which take less than ~30s each
PTESTS_FAST_META_OE = "\
asio \
cli11 \
cmocka \
cunit \
duktape \
@@ -0,0 +1,33 @@
Remove tmpdir from apptest binary
This binary is used in the ptest package. It executes another helper binary
for the test, which is identified by its absolute path, as it was determined during
build. To avoid the QA error (and to find the helper binary during test excution),
use pwd command files.
Upstream-Status: Inappropriate [oe-specific]
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
diff --git a/tests/AppTest.cpp b/tests/AppTest.cpp
index 29aff27c..ddb8238b 100644
--- a/tests/AppTest.cpp
+++ b/tests/AppTest.cpp
@@ -2819,7 +2819,7 @@ TEST_CASE("C20_compile", "simple") {
// #845
TEST_CASE("Ensure UTF-8", "[app]") {
- const char *commandline = CLI11_ENSURE_UTF8_EXE " 1234 false \"hello world\"";
+ const char *commandline = "$(pwd)/ensure_utf8 1234 false \"hello world\"";
int retval = std::system(commandline);
if(retval == -1) {
@@ -2837,7 +2837,7 @@ TEST_CASE("Ensure UTF-8", "[app]") {
// #845
TEST_CASE("Ensure UTF-8 called twice", "[app]") {
- const char *commandline = CLI11_ENSURE_UTF8_TWICE_EXE " 1234 false \"hello world\"";
+ const char *commandline = "$(pwd)/ensure_utf8_twice 1234 false \"hello world\"";
int retval = std::system(commandline);
if(retval == -1) {
@@ -0,0 +1,5 @@
#!/bin/sh
cd tests
for t in `ls ./*Test`; do
./$t && echo PASS: $t || echo FAIL: $t
done
+17 -2
View File
@@ -6,12 +6,27 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=b8bdde6bda8508bef68a39f3e0d7e939"
DEPENDS = "catch2"
SRC_URI = "gitsm://github.com/CLIUtils/CLI11;branch=main;protocol=https"
SRC_URI = "gitsm://github.com/CLIUtils/CLI11;branch=main;protocol=https \
file://remove_tmpdir_from_test_binary.patch \
file://run-ptest"
SRCREV = "4160d259d961cd393fd8d67590a8c7d210207348"
inherit cmake
inherit cmake ptest
# cli11 is a header only C++ library, so the main package will be empty.
RDEPENDS:${PN}-dev = ""
RDEPENDS:${PN}-ptest = ""
do_install_ptest(){
# double tests is not a typo. The inner empty tests folder is
# used by one the tests.
install -d ${D}${PTEST_PATH}/tests/tests
for t in `ls ${B}/tests/*Test`; do
install $t ${D}${PTEST_PATH}/tests/
done
install ${B}/tests/ensure_utf8 ${D}${PTEST_PATH}/tests/
install ${B}/tests/ensure_utf8_twice ${D}${PTEST_PATH}/tests/
install ${B}/tests/link_test_2 ${D}${PTEST_PATH}/tests/
}
BBCLASSEXTEND = "native nativesdk"