diff options
author | Mingli Yu <mingli.yu@windriver.com> | 2023-11-15 13:47:20 +0800 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2023-11-15 08:41:33 -0500 |
commit | 3f0d6ed420e3315264ca3c16fd95402fb4baada4 (patch) | |
tree | 93605197f74b52ff59a47b42e265dc63d089832d | |
parent | a7e6f56a6862d4b1e9308bd51962510b4d1bf3b3 (diff) | |
download | meta-openembedded-3f0d6ed420e3315264ca3c16fd95402fb4baada4.tar.gz |
nlohmann-json: Add ptest support
* Fetch the test data during do_fetch phase to avoid internet access
during test as some tests need test data.
# ./run-ptest
PASS: test-algorithms
PASS: test-allocator
PASS: test-alt-string
PASS: test-assert_macro
PASS: test-bson
PASS: test-byte_container_with_subtype
PASS: test-capacity
PASS: test-cbor
PASS: test-class_const_iterator
PASS: test-class_iterator
PASS: test-class_lexer
PASS: test-class_parser
PASS: test-comparison
PASS: test-concepts
PASS: test-constructor1
PASS: test-constructor2
PASS: test-convenience
PASS: test-conversions
PASS: test-conversions_cpp17
PASS: test-deserialization
PASS: test-diagnostics
PASS: test-disabled_exceptions
PASS: test-element_access1
PASS: test-element_access2
PASS: test-hash
PASS: test-inspection
PASS: test-items
PASS: test-items_cpp17
PASS: test-iterators1
PASS: test-iterators2
PASS: test-json_patch
PASS: test-json_pointer
PASS: test-large_json
PASS: test-merge_patch
PASS: test-meta
PASS: test-modifiers
PASS: test-msgpack
PASS: test-noexcept
PASS: test-ordered_json
PASS: test-ordered_map
PASS: test-pointer_access
PASS: test-readme
PASS: test-reference_access
PASS: test-regression1
PASS: test-regression1_cpp17
PASS: test-regression2
PASS: test-regression2_cpp17
PASS: test-serialization
PASS: test-testsuites
PASS: test-to_chars
PASS: test-ubjson
PASS: test-udt
PASS: test-udt_macro
PASS: test-unicode1
PASS: test-unicode2
PASS: test-unicode3
PASS: test-unicode4
PASS: test-unicode5
PASS: test-user_defined_input
PASS: test-wstring
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rwxr-xr-x | meta-oe/recipes-devtools/nlohmann-json/files/run-ptest | 12 | ||||
-rw-r--r-- | meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.10.5.bb | 20 |
2 files changed, 29 insertions, 3 deletions
diff --git a/meta-oe/recipes-devtools/nlohmann-json/files/run-ptest b/meta-oe/recipes-devtools/nlohmann-json/files/run-ptest new file mode 100755 index 000000000..2f00267d5 --- /dev/null +++ b/meta-oe/recipes-devtools/nlohmann-json/files/run-ptest | |||
@@ -0,0 +1,12 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd tests | ||
4 | for atest in test-* ; do | ||
5 | rm -rf tests.log | ||
6 | ./${atest} > tests.log 2>&1 | ||
7 | if [ $? = 0 ] ; then | ||
8 | echo "PASS: ${atest}" | ||
9 | else | ||
10 | echo "FAIL: ${atest}" | ||
11 | fi | ||
12 | done | ||
diff --git a/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.10.5.bb b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.10.5.bb index 7a1a7a9db..8c4594914 100644 --- a/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.10.5.bb +++ b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.10.5.bb | |||
@@ -7,22 +7,36 @@ LIC_FILES_CHKSUM = "file://LICENSE.MIT;md5=f969127d7b7ed0a8a63c2bbeae002588" | |||
7 | CVE_PRODUCT = "json-for-modern-cpp" | 7 | CVE_PRODUCT = "json-for-modern-cpp" |
8 | 8 | ||
9 | SRC_URI = "git://github.com/nlohmann/json.git;branch=develop;protocol=https \ | 9 | SRC_URI = "git://github.com/nlohmann/json.git;branch=develop;protocol=https \ |
10 | " | 10 | git://github.com/nlohmann/json_test_data.git;destsuffix=git/json_test_data;name=json-test-data;branch=master;protocol=https \ |
11 | file://run-ptest \ | ||
12 | " | ||
11 | 13 | ||
12 | SRCREV = "4f8fba14066156b73f1189a2b8bd568bde5284c5" | 14 | SRCREV = "4f8fba14066156b73f1189a2b8bd568bde5284c5" |
15 | SRCREV_json-test-data = "a1375cea09d27cc1c4cadb8d00470375b421ac37" | ||
16 | |||
17 | SRCREV_FORMAT = "json-test-data" | ||
13 | 18 | ||
14 | S = "${WORKDIR}/git" | 19 | S = "${WORKDIR}/git" |
15 | 20 | ||
16 | inherit cmake | 21 | inherit cmake ptest |
17 | 22 | ||
18 | EXTRA_OECMAKE += "-DJSON_BuildTests=OFF" | 23 | EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DJSON_BuildTests=ON -DJSON_TestDataDirectory=${PTEST_PATH}/json_test_data', '-DJSON_BuildTests=OFF', d)}" |
19 | 24 | ||
20 | # nlohmann-json is a header only C++ library, so the main package will be empty. | 25 | # nlohmann-json is a header only C++ library, so the main package will be empty. |
21 | ALLOW_EMPTY:${PN} = "1" | 26 | ALLOW_EMPTY:${PN} = "1" |
22 | RDEPENDS:${PN}-dev = "" | 27 | RDEPENDS:${PN}-dev = "" |
28 | RDEPENDS:${PN}-ptest = "perl" | ||
23 | 29 | ||
24 | BBCLASSEXTEND = "native nativesdk" | 30 | BBCLASSEXTEND = "native nativesdk" |
25 | 31 | ||
32 | |||
33 | do_install_ptest () { | ||
34 | install -d ${D}${PTEST_PATH}/tests | ||
35 | cp -r ${S}/json_test_data/ ${D}${PTEST_PATH}/ | ||
36 | cp -r ${B}/test/test-* ${D}${PTEST_PATH}/tests | ||
37 | } | ||
38 | |||
39 | |||
26 | # other packages commonly reference the file directly as "json.hpp" | 40 | # other packages commonly reference the file directly as "json.hpp" |
27 | # create symlink to allow this usage | 41 | # create symlink to allow this usage |
28 | do_install:append() { | 42 | do_install:append() { |