From patchwork Thu Nov 9 09:15:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yu, Mingli" X-Patchwork-Id: 34144 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08F37C4167D for ; Thu, 9 Nov 2023 09:15:34 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.117286.1699521328873043698 for ; Thu, 09 Nov 2023 01:15:28 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=qWvEyIyE; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=96774aeeec=mingli.yu@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A97V4Cs018812 for ; Thu, 9 Nov 2023 01:15:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=PPS06212021; bh=kxzgB 30gX7Ph2zC6wb0YaCu6SMdUXREVBsFocSVN1W4=; b=qWvEyIyEcF2466B2w5Wx0 9FCLuVsjf2eDcz8vdr6Wn8eetme95jZJChAhMNLG5z9/O2ED27wViJMjt+UOPevU +bW9q387J4z7S2V/Sd/54mzlx5HkRFZfGy82fyvFyeyREpOxIB1sLQ7IAL4oC/Iv 9G0zGGdRA2+roN4rmqtRZsMsYDYKVf/4t0VF1fUvEvvHSM1uKdr/R2nSnkPc8tLU mWjceka7gjbnfzuO/blM9awSWlF0qMqZGmig170k51bcKxFi8ZoHHoacgNcrqllN ZG8IRcRoJrw58FKVnqLTMRetH0LJQAWi8zGt5TXBu3vCZhtg1ztrR4+Z215bMv1c w== Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3u7w2shpr6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 09 Nov 2023 01:15:28 -0800 (PST) Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 9 Nov 2023 01:15:31 -0800 Received: from pek-lpg-core2.wrs.com (128.224.153.41) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 9 Nov 2023 01:15:30 -0800 From: To: Subject: [meta-oe][PATCH 1/2] nlohmann-json: Add ptest support Date: Thu, 9 Nov 2023 17:15:25 +0800 Message-ID: <20231109091526.484831-1-mingli.yu@windriver.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: DdlCVZZvOHI0pXRiaUmkzJZtEtlEWjoz X-Proofpoint-ORIG-GUID: DdlCVZZvOHI0pXRiaUmkzJZtEtlEWjoz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-09_07,2023-11-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311060001 definitions=main-2311090073 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 09 Nov 2023 09:15:34 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/106511 From: Mingli Yu * Backport 2 patches [1] [2] to fix the build failure under tests dir. * 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_cpp11 PASS: test-allocator_cpp11 PASS: test-alt-string_cpp11 PASS: test-assert_macro_cpp11 PASS: test-binary_formats_cpp11 [snip] PASS: test-unicode5_cpp11 PASS: test-user_defined_input_cpp11 PASS: test-windows_h_cpp11 PASS: test-wstring_cpp11 [1] https://github.com/nlohmann/json/commit/6cec5aefc97ad219b6fd5a4132f88f7c8f6800ee [2] https://github.com/nlohmann/json/commit/660d0b58565073975d6f5d94365d6cbf150a4cf8 Signed-off-by: Mingli Yu --- ...tors-define-missing-rebind-type-3895.patch | 61 +++++++++++++++++++ ...tors2-use-std-ranges-equals-for-rang.patch | 31 ++++++++++ .../nlohmann-json/files/run-ptest | 12 ++++ .../nlohmann-json/nlohmann-json_3.11.2.bb | 21 ++++++- 4 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 meta-oe/recipes-devtools/nlohmann-json/files/0001-custom-allocators-define-missing-rebind-type-3895.patch create mode 100644 meta-oe/recipes-devtools/nlohmann-json/files/0001-tests-unit-iterators2-use-std-ranges-equals-for-rang.patch create mode 100755 meta-oe/recipes-devtools/nlohmann-json/files/run-ptest diff --git a/meta-oe/recipes-devtools/nlohmann-json/files/0001-custom-allocators-define-missing-rebind-type-3895.patch b/meta-oe/recipes-devtools/nlohmann-json/files/0001-custom-allocators-define-missing-rebind-type-3895.patch new file mode 100644 index 000000000..d964586c1 --- /dev/null +++ b/meta-oe/recipes-devtools/nlohmann-json/files/0001-custom-allocators-define-missing-rebind-type-3895.patch @@ -0,0 +1,61 @@ +From 6cec5aefc97ad219b6fd5a4132f88f7c8f6800ee Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Wed, 8 Mar 2023 11:31:56 +0000 +Subject: [PATCH] custom allocators: define missing 'rebind' type (#3895) + +Upstream-Status: Backport [https://github.com/nlohmann/json/commit/6cec5aefc97ad219b6fd5a4132f88f7c8f6800ee] + +Signed-off-by: Mingli Yu +--- + tests/src/unit-allocator.cpp | 9 +++++++++ + tests/src/unit-regression2.cpp | 9 +++++++++ + 2 files changed, 18 insertions(+) + +diff --git a/tests/src/unit-allocator.cpp b/tests/src/unit-allocator.cpp +index 76e3b03f..f2e63552 100644 +--- a/tests/src/unit-allocator.cpp ++++ b/tests/src/unit-allocator.cpp +@@ -20,11 +20,20 @@ struct bad_allocator : std::allocator + { + using std::allocator::allocator; + ++ bad_allocator() = default; ++ template bad_allocator(const bad_allocator& /*unused*/) { } ++ + template + void construct(T* /*unused*/, Args&& ... /*unused*/) + { + throw std::bad_alloc(); + } ++ ++ template ++ struct rebind ++ { ++ using other = bad_allocator; ++ }; + }; + } // namespace + +diff --git a/tests/src/unit-regression2.cpp b/tests/src/unit-regression2.cpp +index 2bb9b32e..dbafb436 100644 +--- a/tests/src/unit-regression2.cpp ++++ b/tests/src/unit-regression2.cpp +@@ -189,6 +189,15 @@ class my_allocator : public std::allocator + { + public: + using std::allocator::allocator; ++ ++ my_allocator() = default; ++ template my_allocator(const my_allocator& /*unused*/) { } ++ ++ template ++ struct rebind ++ { ++ using other = my_allocator; ++ }; + }; + + ///////////////////////////////////////////////////////////////////// +-- +2.25.1 + diff --git a/meta-oe/recipes-devtools/nlohmann-json/files/0001-tests-unit-iterators2-use-std-ranges-equals-for-rang.patch b/meta-oe/recipes-devtools/nlohmann-json/files/0001-tests-unit-iterators2-use-std-ranges-equals-for-rang.patch new file mode 100644 index 000000000..463912e4b --- /dev/null +++ b/meta-oe/recipes-devtools/nlohmann-json/files/0001-tests-unit-iterators2-use-std-ranges-equals-for-rang.patch @@ -0,0 +1,31 @@ +From 660d0b58565073975d6f5d94365d6cbf150a4cf8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= +Date: Sun, 5 Mar 2023 14:11:22 +0100 +Subject: [PATCH] tests/unit-iterators2: use std::ranges::equals for range + comparisons (#3950) + +Closes https://github.com/nlohmann/json/issues/3927 + +Upstream-Status: Backport [https://github.com/nlohmann/json/commit/660d0b58565073975d6f5d94365d6cbf150a4cf8] + +Signed-off-by: Mingli Yu +--- + tests/src/unit-iterators2.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/src/unit-iterators2.cpp b/tests/src/unit-iterators2.cpp +index 27926084..72a5d9dc 100644 +--- a/tests/src/unit-iterators2.cpp ++++ b/tests/src/unit-iterators2.cpp +@@ -943,7 +943,7 @@ TEST_CASE("iterators 2") + json j_expected{5, 4, 3, 2, 1}; + + auto reversed = j | std::views::reverse; +- CHECK(reversed == j_expected); ++ CHECK(std::ranges::equal(reversed, j_expected)); + } + + SECTION("transform") +-- +2.25.1 + 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 @@ +#!/bin/sh + +cd tests +for atest in test-* ; do + rm -rf tests.log + ./${atest} > tests.log 2>&1 + if [ $? = 0 ] ; then + echo "PASS: ${atest}" + else + echo "FAIL: ${atest}" + fi +done diff --git a/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.11.2.bb b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.11.2.bb index 74e40942a..d6a8fbe63 100644 --- a/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.11.2.bb +++ b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.11.2.bb @@ -7,15 +7,22 @@ LIC_FILES_CHKSUM = "file://LICENSE.MIT;md5=f969127d7b7ed0a8a63c2bbeae002588" CVE_PRODUCT = "json-for-modern-cpp" SRC_URI = "git://github.com/nlohmann/json.git;branch=develop;protocol=https \ - " + git://github.com/nlohmann/json_test_data.git;destsuffix=git/json_test_data;name=json-test-data;branch=master;protocol=https \ + file://0001-custom-allocators-define-missing-rebind-type-3895.patch \ + file://0001-tests-unit-iterators2-use-std-ranges-equals-for-rang.patch \ + file://run-ptest \ +" SRCREV = "bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d" +SRCREV_json-test-data = "a1375cea09d27cc1c4cadb8d00470375b421ac37" + +SRCREV_FORMAT = "json-test-data" S = "${WORKDIR}/git" -inherit cmake +inherit cmake ptest -EXTRA_OECMAKE += "-DJSON_BuildTests=OFF" +EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DJSON_BuildTests=ON -DJSON_TestDataDirectory=${PTEST_PATH}/json_test_data', '-DJSON_BuildTests=OFF', d)}" # nlohmann-json is a header only C++ library, so the main package will be empty. ALLOW_EMPTY:${PN} = "1" @@ -23,6 +30,14 @@ RDEPENDS:${PN}-dev = "" BBCLASSEXTEND = "native nativesdk" + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/tests + cp -r ${S}/json_test_data/ ${D}${PTEST_PATH}/ + cp -r ${B}/tests/test-* ${D}${PTEST_PATH}/tests +} + + # other packages commonly reference the file directly as "json.hpp" # create symlink to allow this usage do_install:append() { From patchwork Thu Nov 9 09:15:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yu, Mingli" X-Patchwork-Id: 34143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08F7BC41535 for ; Thu, 9 Nov 2023 09:15:34 +0000 (UTC) Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by mx.groups.io with SMTP id smtpd.web10.117287.1699521330753747560 for ; Thu, 09 Nov 2023 01:15:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=EpXMW7eZ; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.178.238, mailfrom: prvs=96774aeeec=mingli.yu@windriver.com) Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3A97hVbe011074 for ; Thu, 9 Nov 2023 09:15:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PPS06212021; bh=uomjQs3GrXL+KVBcZSSmThU32QTdw9CdTa312sQR1r0=; b= EpXMW7eZ1fmS0/atQXSAozqsVGbJ46oXxMzf5rIQcCpGXRiSHpis/a3gsqjjfo+d qLxzCqPYZM2RV2KJe7WjJAPXqmNM4ZTIq/xyJJcHuPfXeVl7loYPsnRaQ0mbBA+u muaL/lkqZv6XPzxv38d5VQvEBNjKauvXxNmfmvq3tt1+vSQOPVR+nz+Ky57uGukp LMknKZ9+xt/fVnnHc7mkoceAw7j1Buj3cW/F2REv3zLrHMX5jSZrlO1y7rhMn12O 0CWvg9aXA+kVIYSvYtih/pSNYm0LJVdTlSX/UaL2bzCN62ZInHXeb16IPcxrMBiJ EGHMNOcahUpip0ffjjCSdA== Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3u7w3y1nwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 09 Nov 2023 09:15:29 +0000 (GMT) Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 9 Nov 2023 01:15:32 -0800 Received: from pek-lpg-core2.wrs.com (128.224.153.41) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 9 Nov 2023 01:15:31 -0800 From: To: Subject: [meta-oe][PATCH 2/2] ptest-packagelists-meta-oe.inc: Add nlohmann-json Date: Thu, 9 Nov 2023 17:15:26 +0800 Message-ID: <20231109091526.484831-2-mingli.yu@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231109091526.484831-1-mingli.yu@windriver.com> References: <20231109091526.484831-1-mingli.yu@windriver.com> MIME-Version: 1.0 X-Proofpoint-GUID: 9-Pu5E9vzN3EcAiuGmX9AgUgivYrBU3E X-Proofpoint-ORIG-GUID: 9-Pu5E9vzN3EcAiuGmX9AgUgivYrBU3E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-09_07,2023-11-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 mlxscore=0 spamscore=0 impostorscore=0 suspectscore=0 mlxlogscore=753 malwarescore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311060001 definitions=main-2311090073 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 09 Nov 2023 09:15:34 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/106512 From: Mingli Yu Signed-off-by: Mingli Yu --- meta-oe/conf/include/ptest-packagelists-meta-oe.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc index bab9d4372..33aff7f44 100644 --- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc +++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc @@ -28,6 +28,7 @@ PTESTS_FAST_META_OE = "\ lmdb \ minicoredumper \ neon \ + nlohmann-json \ nodejs \ onig \ poco \