diff options
| author | David Pierret <david.pierret@smile.fr> | 2023-10-16 14:37:25 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-10-17 21:42:56 -0700 |
| commit | 4079e922845fcdb1f0cc360483daad8cb3ea66d3 (patch) | |
| tree | af502ebb643a11ec89a7cb3099ca151383d0468e /meta-oe | |
| parent | 35bcd8c6ddfb6bc8729d0006dab887afcc772ec9 (diff) | |
| download | meta-openembedded-4079e922845fcdb1f0cc360483daad8cb3ea66d3.tar.gz | |
cjson: Add ptest
cjson use pure CMake test framework named CTest.
CMake generate CTestTestfile.cmake containing fully defined path.
This path need to be altered on install step to match the ptest directory.
The json_patch_tests doesn't works because of file access and is skip.
Signed-off-by: David Pierret <david.pierret@smile.fr>
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
| -rw-r--r-- | meta-oe/conf/include/ptest-packagelists-meta-oe.inc | 1 | ||||
| -rw-r--r-- | meta-oe/recipes-devtools/cjson/cjson/run-ptest | 8 | ||||
| -rw-r--r-- | meta-oe/recipes-devtools/cjson/cjson_1.7.15.bb | 24 |
3 files changed, 31 insertions, 2 deletions
diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc index a2b2ce4bc9..212b90c868 100644 --- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc +++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc | |||
| @@ -36,6 +36,7 @@ PTESTS_FAST_META_OE = "\ | |||
| 36 | uthash \ | 36 | uthash \ |
| 37 | xmlsec1 \ | 37 | xmlsec1 \ |
| 38 | zeromq \ | 38 | zeromq \ |
| 39 | cjson \ | ||
| 39 | " | 40 | " |
| 40 | PTESTS_FAST_META_OE:append:x86 = " mcelog" | 41 | PTESTS_FAST_META_OE:append:x86 = " mcelog" |
| 41 | PTESTS_FAST_META_OE:append:x86-64 = " mcelog" | 42 | PTESTS_FAST_META_OE:append:x86-64 = " mcelog" |
diff --git a/meta-oe/recipes-devtools/cjson/cjson/run-ptest b/meta-oe/recipes-devtools/cjson/cjson/run-ptest new file mode 100644 index 0000000000..f061e94665 --- /dev/null +++ b/meta-oe/recipes-devtools/cjson/cjson/run-ptest | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # exclude json_patch_tests | ||
| 4 | if ctest -E 'json_patch_tests' ; then | ||
| 5 | echo "PASS: cjson" | ||
| 6 | else | ||
| 7 | echo "FAIL: cjson" | ||
| 8 | fi | ||
diff --git a/meta-oe/recipes-devtools/cjson/cjson_1.7.15.bb b/meta-oe/recipes-devtools/cjson/cjson_1.7.15.bb index 8bf7981ab0..1841aeffc1 100644 --- a/meta-oe/recipes-devtools/cjson/cjson_1.7.15.bb +++ b/meta-oe/recipes-devtools/cjson/cjson_1.7.15.bb | |||
| @@ -4,12 +4,32 @@ SECTION = "libs" | |||
| 4 | LICENSE = "MIT" | 4 | LICENSE = "MIT" |
| 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=218947f77e8cb8e2fa02918dc41c50d0" | 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=218947f77e8cb8e2fa02918dc41c50d0" |
| 6 | 6 | ||
| 7 | SRC_URI = "git://github.com/DaveGamble/cJSON.git;branch=master;protocol=https" | 7 | SRC_URI = "git://github.com/DaveGamble/cJSON.git;branch=master;protocol=https \ |
| 8 | file://run-ptest \ | ||
| 9 | " | ||
| 8 | SRCREV = "d348621ca93571343a56862df7de4ff3bc9b5667" | 10 | SRCREV = "d348621ca93571343a56862df7de4ff3bc9b5667" |
| 9 | 11 | ||
| 10 | S = "${WORKDIR}/git" | 12 | S = "${WORKDIR}/git" |
| 11 | 13 | ||
| 12 | inherit cmake pkgconfig | 14 | inherit cmake pkgconfig ptest |
| 15 | |||
| 16 | RDEPENDS:${PN}-ptest += "cmake" | ||
| 17 | |||
| 18 | do_install_ptest() { | ||
| 19 | # create directories | ||
| 20 | install -d ${D}${PTEST_PATH} ${D}${PTEST_PATH}/tests ${D}${PTEST_PATH}/fuzzing | ||
| 21 | install -d ${D}${PTEST_PATH}/tests/inputs ${D}${PTEST_PATH}/tests/json-patch-tests | ||
| 22 | # CTestTestfiles.cmake contain fully defined path generated by cmake. | ||
| 23 | # Change the fully defined path to ptest path on the target | ||
| 24 | sed s#${B}#${PTEST_PATH}# ${B}/CTestTestfile.cmake > ${D}${PTEST_PATH}/CTestTestfile.cmake | ||
| 25 | sed s#${B}#${PTEST_PATH}# ${B}/tests/CTestTestfile.cmake > ${D}${PTEST_PATH}/tests/CTestTestfile.cmake | ||
| 26 | sed s#${B}#${PTEST_PATH}# ${B}/fuzzing/CTestTestfile.cmake > ${D}${PTEST_PATH}/fuzzing/CTestTestfile.cmake | ||
| 27 | # install test artifacts | ||
| 28 | install ${B}/cJSON_test ${D}${PTEST_PATH} | ||
| 29 | install ${B}/tests/cjson_add ${B}/tests/*_tests ${B}/tests/parse_* ${B}/tests/print_* ${B}/tests/readme_examples ${D}${PTEST_PATH}/tests/ | ||
| 30 | install ${B}/tests/inputs/* ${D}${PTEST_PATH}/tests/inputs | ||
| 31 | install ${B}/fuzzing/fuzz_main ${D}${PTEST_PATH}/fuzzing | ||
| 32 | } | ||
| 13 | 33 | ||
| 14 | EXTRA_OECMAKE += "\ | 34 | EXTRA_OECMAKE += "\ |
| 15 | -DENABLE_CJSON_UTILS=On \ | 35 | -DENABLE_CJSON_UTILS=On \ |
