diff options
| author | Gyorgy Sarvari <skandigraun@gmail.com> | 2025-10-17 14:05:10 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-10-17 08:32:03 -0700 |
| commit | f955474be2bfb8f345147bd4d9aac6364a0af25b (patch) | |
| tree | 00ca89f822be262b228e9999200285801f493660 /meta-oe/recipes-support/cli11 | |
| parent | e1f667ee800edf0f4e46167a24a7b7f603c51095 (diff) | |
| download | meta-openembedded-f955474be2bfb8f345147bd4d9aac6364a0af25b.tar.gz | |
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>
Diffstat (limited to 'meta-oe/recipes-support/cli11')
| -rw-r--r-- | meta-oe/recipes-support/cli11/cli11/remove_tmpdir_from_test_binary.patch | 33 | ||||
| -rw-r--r-- | meta-oe/recipes-support/cli11/cli11/run-ptest | 5 | ||||
| -rw-r--r-- | meta-oe/recipes-support/cli11/cli11_2.5.0.bb | 19 |
3 files changed, 55 insertions, 2 deletions
diff --git a/meta-oe/recipes-support/cli11/cli11/remove_tmpdir_from_test_binary.patch b/meta-oe/recipes-support/cli11/cli11/remove_tmpdir_from_test_binary.patch new file mode 100644 index 0000000000..22c3e5211f --- /dev/null +++ b/meta-oe/recipes-support/cli11/cli11/remove_tmpdir_from_test_binary.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | Remove tmpdir from apptest binary | ||
| 2 | |||
| 3 | This binary is used in the ptest package. It executes another helper binary | ||
| 4 | for the test, which is identified by its absolute path, as it was determined during | ||
| 5 | build. To avoid the QA error (and to find the helper binary during test excution), | ||
| 6 | use pwd command files. | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [oe-specific] | ||
| 9 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 10 | |||
| 11 | |||
| 12 | diff --git a/tests/AppTest.cpp b/tests/AppTest.cpp | ||
| 13 | index 29aff27c..ddb8238b 100644 | ||
| 14 | --- a/tests/AppTest.cpp | ||
| 15 | +++ b/tests/AppTest.cpp | ||
| 16 | @@ -2819,7 +2819,7 @@ TEST_CASE("C20_compile", "simple") { | ||
| 17 | |||
| 18 | // #845 | ||
| 19 | TEST_CASE("Ensure UTF-8", "[app]") { | ||
| 20 | - const char *commandline = CLI11_ENSURE_UTF8_EXE " 1234 false \"hello world\""; | ||
| 21 | + const char *commandline = "$(pwd)/ensure_utf8 1234 false \"hello world\""; | ||
| 22 | int retval = std::system(commandline); | ||
| 23 | |||
| 24 | if(retval == -1) { | ||
| 25 | @@ -2837,7 +2837,7 @@ TEST_CASE("Ensure UTF-8", "[app]") { | ||
| 26 | |||
| 27 | // #845 | ||
| 28 | TEST_CASE("Ensure UTF-8 called twice", "[app]") { | ||
| 29 | - const char *commandline = CLI11_ENSURE_UTF8_TWICE_EXE " 1234 false \"hello world\""; | ||
| 30 | + const char *commandline = "$(pwd)/ensure_utf8_twice 1234 false \"hello world\""; | ||
| 31 | int retval = std::system(commandline); | ||
| 32 | |||
| 33 | if(retval == -1) { | ||
diff --git a/meta-oe/recipes-support/cli11/cli11/run-ptest b/meta-oe/recipes-support/cli11/cli11/run-ptest new file mode 100644 index 0000000000..ef37d44783 --- /dev/null +++ b/meta-oe/recipes-support/cli11/cli11/run-ptest | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | cd tests | ||
| 3 | for t in `ls ./*Test`; do | ||
| 4 | ./$t && echo PASS: $t || echo FAIL: $t | ||
| 5 | done | ||
diff --git a/meta-oe/recipes-support/cli11/cli11_2.5.0.bb b/meta-oe/recipes-support/cli11/cli11_2.5.0.bb index f6c9ac8f69..980932165b 100644 --- a/meta-oe/recipes-support/cli11/cli11_2.5.0.bb +++ b/meta-oe/recipes-support/cli11/cli11_2.5.0.bb | |||
| @@ -6,12 +6,27 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=b8bdde6bda8508bef68a39f3e0d7e939" | |||
| 6 | 6 | ||
| 7 | DEPENDS = "catch2" | 7 | DEPENDS = "catch2" |
| 8 | 8 | ||
| 9 | SRC_URI = "gitsm://github.com/CLIUtils/CLI11;branch=main;protocol=https" | 9 | SRC_URI = "gitsm://github.com/CLIUtils/CLI11;branch=main;protocol=https \ |
| 10 | file://remove_tmpdir_from_test_binary.patch \ | ||
| 11 | file://run-ptest" | ||
| 10 | SRCREV = "4160d259d961cd393fd8d67590a8c7d210207348" | 12 | SRCREV = "4160d259d961cd393fd8d67590a8c7d210207348" |
| 11 | 13 | ||
| 12 | inherit cmake | 14 | inherit cmake ptest |
| 13 | 15 | ||
| 14 | # cli11 is a header only C++ library, so the main package will be empty. | 16 | # cli11 is a header only C++ library, so the main package will be empty. |
| 15 | RDEPENDS:${PN}-dev = "" | 17 | RDEPENDS:${PN}-dev = "" |
| 18 | RDEPENDS:${PN}-ptest = "" | ||
| 19 | |||
| 20 | do_install_ptest(){ | ||
| 21 | # double tests is not a typo. The inner empty tests folder is | ||
| 22 | # used by one the tests. | ||
| 23 | install -d ${D}${PTEST_PATH}/tests/tests | ||
| 24 | for t in `ls ${B}/tests/*Test`; do | ||
| 25 | install $t ${D}${PTEST_PATH}/tests/ | ||
| 26 | done | ||
| 27 | install ${B}/tests/ensure_utf8 ${D}${PTEST_PATH}/tests/ | ||
| 28 | install ${B}/tests/ensure_utf8_twice ${D}${PTEST_PATH}/tests/ | ||
| 29 | install ${B}/tests/link_test_2 ${D}${PTEST_PATH}/tests/ | ||
| 30 | } | ||
| 16 | 31 | ||
| 17 | BBCLASSEXTEND = "native nativesdk" | 32 | BBCLASSEXTEND = "native nativesdk" |
