From patchwork Thu Apr 27 15:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RnLDqWTDqXJpYyBNYXJ0aW5zb25z?= X-Patchwork-Id: 23084 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 7B701C77B73 for ; Thu, 27 Apr 2023 15:13:03 +0000 (UTC) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.web10.23460.1682608375792374306 for ; Thu, 27 Apr 2023 08:12:56 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=b57LuZRh; spf=pass (domain: gmail.com, ip: 209.85.221.43, mailfrom: frederic.martinsons@gmail.com) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-2fa36231b1cso5403458f8f.2 for ; Thu, 27 Apr 2023 08:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682608373; x=1685200373; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=59+46kOMDS9n8/sSTNrBOrH9O5aQAh18s0f9fR1OZKU=; b=b57LuZRhI7AAWhb+QvuN5khAIxhdS+QL3ZvhwvGLTxuV0Pr8NsSAOGtcL7Z3dUYO// ggVxIYFmQwNS4cidqPDLcA/eT6MV6GcuPmpSP3KPnTfMamqrlQPI139ChNIVDN8PY3+I BGLQpeCyruFbBm0LuGoSMMSAq+rlFZkDyYr1g6hv/NH84rMfDCOiypQyoljbj7f46eYI U3lrFvePP1csNdxHv/TsYeMFJgrE2URrkBrZaSWqhxnpSlSbxKaiFIQpLHVpsWH6sR+5 qc5eMCBZy353+nmwYHKYqD8rqEKZ+1S5nXVbDYUrok7qr5AnWfXab5DuhcTjAl9P7qXR UDlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682608373; x=1685200373; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=59+46kOMDS9n8/sSTNrBOrH9O5aQAh18s0f9fR1OZKU=; b=FXNhEFH+ldw53eYfNic2Oo/K8uBeGT6WSG2oZhpA53CCWNvxoFqbcN7btoS+YlqYf4 96pj7jOe09neu6SfO6Ip6bt54J79TTiLpP4/YikN0jVrZ6PsxKR6Vzq3SUDylDKVAgIy 7iSCHhOhOSIz8f3D+KalUyW4vw1MFnYB2g3SQy2bxqC3njy0DiJFBbzr/cKLMLMQo7AD mEZc2o7I8Rxvhnvffj/uhJva/aNVj+ROvU2Dccc6EQF86ydglVWhVz393sgA60PbqeZ2 yO/NT5iTXRgt1ij55GWbaT3rbmUjXwCEKyAZ+b+HWlDTj5L3WeMRjGf5cJHjDSC+Q1xM 4dow== X-Gm-Message-State: AC+VfDwahilVSPURSg5YkZOqkM/XzBWU8/XuziBMd4u3wAcqdfsGkNwj egy9G/bfgATKS6QEFIPf7KpT6WIm+P4= X-Google-Smtp-Source: ACHHUZ5EpKY8ewSwej7rP3Tf9ZlySVtglR4dmBXgh9BkuvgaXT8o7RpjreZlRfPTbOvjPJnoMzXHGw== X-Received: by 2002:adf:df87:0:b0:2ff:f37:9d02 with SMTP id z7-20020adfdf87000000b002ff0f379d02mr1638665wrl.69.1682608373458; Thu, 27 Apr 2023 08:12:53 -0700 (PDT) Received: from work-pc.core.sigfox.net ([2a01:e0a:8d5:c6c0:e2ba:a159:c9f4:28dc]) by smtp.gmail.com with ESMTPSA id v19-20020a05600c215300b003ee20b4b2dasm21655529wml.46.2023.04.27.08.12.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 08:12:53 -0700 (PDT) From: frederic.martinsons@gmail.com To: openembedded-core@lists.openembedded.org Subject: [PATCHV4 1/3] ptest-cargo.bbclass: create class Date: Thu, 27 Apr 2023 17:12:48 +0200 Message-Id: <54264f6b2766e0f5a70d7286d64d2adc0106ff3e.1682608254.git.frederic.martinsons@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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, 27 Apr 2023 15:13:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/180494 From: Frederic Martinsons This new class offers the possibility to build rust unit tests (and integration tests) and find them correctly. Due to non deterministic names of generated binaries, a custom parsing of build result must be performed. See https://github.com/rust-lang/cargo/issues/1924 All rust projects will generate a test binary with "cargo build --tests" command, even if there are no test defined in source code. The binary will just output that it ran 0 tests. Signed-off-by: Frederic Martinsons --- meta/classes-recipe/ptest-cargo.bbclass | 130 ++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 meta/classes-recipe/ptest-cargo.bbclass diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass new file mode 100644 index 0000000000..f28bc7a826 --- /dev/null +++ b/meta/classes-recipe/ptest-cargo.bbclass @@ -0,0 +1,130 @@ +inherit cargo ptest + +# I didn't find a cleaner way to share data between compile and install tasks +CARGO_TEST_BINARIES_FILES ?= "${B}/test_binaries_list" + +# Sadly, generated test binaries have no deterministic names (https://github.com/rust-lang/cargo/issues/1924) +# This forces us to parse the cargo output in json format to find those test binaries. +python do_compile_ptest_cargo() { + import subprocess + import json + + cargo = bb.utils.which(d.getVar("PATH"), d.getVar("CARGO", True)) + cargo_build_flags = d.getVar("CARGO_BUILD_FLAGS", True) + rust_flags = d.getVar("RUSTFLAGS", True) + manifest_path = d.getVar("MANIFEST_PATH", True) + + env = os.environ.copy() + env['RUSTFLAGS'] = rust_flags + cmd = f"{cargo} build --tests --message-format json {cargo_build_flags}" + bb.note(f"Building tests with cargo ({cmd})") + + try: + proc = subprocess.Popen(cmd, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as e: + bb.fatal(f"Cannot build test with cargo: {e}") + + lines = [] + for line in proc.stdout: + data = line.decode('utf-8').strip('\n') + lines.append(data) + bb.note(data) + proc.communicate() + if proc.returncode != 0: + bb.fatal(f"Unable to compile test with cargo, '{cmd}' failed") + + # Definition of the format: https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages + test_bins = [] + for line in lines: + try: + data = json.loads(line) + except json.JSONDecodeError: + # skip lines that are not a json + pass + else: + try: + # Filter the test packages coming from the current manifest + current_manifest_path = os.path.normpath(data['manifest_path']) + project_manifest_path = os.path.normpath(manifest_path) + if current_manifest_path == project_manifest_path: + if data['target']['test'] or data['target']['doctest'] and data['executable']: + test_bins.append(data['executable']) + except KeyError as e: + # skip lines that do not meet the requirements + pass + + # All rust project will generate at least one unit test binary + # It will just run a test suite with 0 tests, if the project didn't define some + # So it is not expected to have an empty list here + if not test_bins: + bb.fatal("Unable to find any test binaries") + + cargo_test_binaries_file = d.getVar('CARGO_TEST_BINARIES_FILES', True) + bb.note(f"Found {len(test_bins)} tests, write their paths into {cargo_test_binaries_file}") + with open(cargo_test_binaries_file, "w") as f: + for test_bin in test_bins: + f.write(f"{test_bin}\n") + +} + +python do_install_ptest_cargo() { + import shutil + + dest_dir = d.getVar("D", True) + pn = d.getVar("PN", True) + ptest_path = d.getVar("PTEST_PATH", True) + cargo_test_binaries_file = d.getVar('CARGO_TEST_BINARIES_FILES', True) + + ptest_dir = os.path.join(dest_dir, ptest_path.lstrip('/')) + os.makedirs(ptest_dir, exist_ok=True) + + test_bins = [] + with open(cargo_test_binaries_file, "r") as f: + for line in f.readlines(): + test_bins.append(line.strip('\n')) + + test_paths = [] + for test_bin in test_bins: + shutil.copy2(test_bin, ptest_dir) + test_paths.append(os.path.join(ptest_path, os.path.basename(test_bin))) + + ptest_script = os.path.join(ptest_dir, "run-ptest") + if os.path.exists(ptest_script): + with open(ptest_script, "a") as f: + f.write(f"\necho \"\"\n") + f.write(f"echo \"## starting to run rust tests ##\"\n") + for test_path in test_paths: + f.write(f"{test_path}\n") + else: + with open(ptest_script, "a") as f: + f.write("#!/bin/sh\n") + for test_path in test_paths: + f.write(f"{test_path}\n") + os.chmod(ptest_script, 0o755) + + # this is chown -R root:root ${D}${PTEST_PATH} + for root, dirs, files in os.walk(ptest_dir): + for d in dirs: + shutil.chown(os.path.join(root, d), "root", "root") + for f in files: + shutil.chown(os.path.join(root, f), "root", "root") +} + +do_install_ptest_cargo[dirs] = "${B}" +do_install_ptest_cargo[doc] = "Create or update the run-ptest script with rust test binaries generated" +do_compile_ptest_cargo[dirs] = "${B}" +do_compile_ptest_cargo[doc] = "Generate rust test binaries through cargo" + +addtask compile_ptest_cargo after do_compile before do_compile_ptest_base +addtask install_ptest_cargo after do_install_ptest_base before do_package + +python () { + if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): + d.setVarFlag('do_install_ptest_cargo', 'fakeroot', '1') + d.setVarFlag('do_install_ptest_cargo', 'umask', '022') + + # Remove all '*ptest_cargo' tasks when ptest is not enabled + if not(d.getVar('PTEST_ENABLED') == "1"): + for i in ['do_compile_ptest_cargo', 'do_install_ptest_cargo']: + bb.build.deltask(i, d) +} From patchwork Thu Apr 27 15:12:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RnLDqWTDqXJpYyBNYXJ0aW5zb25z?= X-Patchwork-Id: 23085 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 8D622C77B61 for ; Thu, 27 Apr 2023 15:13:03 +0000 (UTC) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.groups.io with SMTP id smtpd.web11.23284.1682608376140118523 for ; Thu, 27 Apr 2023 08:12:56 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=BAUl8+si; spf=pass (domain: gmail.com, ip: 209.85.128.48, mailfrom: frederic.martinsons@gmail.com) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-3f086770a50so58577735e9.2 for ; Thu, 27 Apr 2023 08:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682608374; x=1685200374; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zFd/u77cDpQ/254hAqQuFvN4En4E30r9dIjLiihS64Y=; b=BAUl8+si7SBVHsa7dtUgeL3ArsB4RC0S5mqIlZTbaWkCeyzyjD0+XrttTusMjr14z/ eXd89EN+K2xhF27inHxbQNim5rdmi1wdvVMiUzhzAvyNSnU+cHHXweVEVPlcY5d7H4Ds Lyv7FBRU0AmGujAwPfpsXtKJpuUV/fsbm3hVywtqFCZ9t/GJpC6wdazXZhahaKlvPndI dWIqkDNYI9rNzvScGMtF5SpnPSp+tV9xkFaUMjIDpIKC/41QQ5Ar9bni18fgzsdqmjo/ pJNCYMOd5+QTQrtRG9UKpx6rl5LG1CWpIVkaQro7IbaIQtHzVraDlyW5Hh6TioCpK6Wp vO8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682608374; x=1685200374; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zFd/u77cDpQ/254hAqQuFvN4En4E30r9dIjLiihS64Y=; b=V2opCXsAxnBZyD7D8gjipstmNPruMcC9QaCcbn+hZIGFiW9CGNxyT/P5Z+8n//oN9C TNbQE+YaOTPZAYSeoKdP6ge6bsugXjw5t1lJDcvJeZJXp7F/yG/FppLjElQwjXvkhD3s pXJAf4d53XrCqHwvqiU836yK6zNyYfMOtG7mKiilGWmzw2NGe3VaWeOMbZeTNxk5rEi0 NpDKtud38Q3J7IgORWySaAPFvlbbK2ArcrjnVYeNLsP4VJiUiUudroNWkmzNeVEnQXAK 6Y8pg0En3637IK6CUOioG+oIHEBvVENYPxONMkzj6MA6ONQaDNaRnnDVQ2c2KlOXZQFO a8OA== X-Gm-Message-State: AC+VfDxIrcIFy+ZH+Il9ms549u2psbTIWrNMecOoq13a/HavY0BQXdY9 YJl1St+qaC0cIHWKEZBgeHmae4CbidQ= X-Google-Smtp-Source: ACHHUZ42mr4NeWBss8DyLJEfp5hKu2JdafO0JYGviN53BkHVF6KfqL4+JcLEX5eQueIhnRfbCRGSqw== X-Received: by 2002:a05:600c:24cd:b0:3f1:92e8:a6fe with SMTP id 13-20020a05600c24cd00b003f192e8a6femr1799225wmu.31.1682608374176; Thu, 27 Apr 2023 08:12:54 -0700 (PDT) Received: from work-pc.core.sigfox.net ([2a01:e0a:8d5:c6c0:e2ba:a159:c9f4:28dc]) by smtp.gmail.com with ESMTPSA id v19-20020a05600c215300b003ee20b4b2dasm21655529wml.46.2023.04.27.08.12.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 08:12:53 -0700 (PDT) From: frederic.martinsons@gmail.com To: openembedded-core@lists.openembedded.org Subject: [PATCHV4 2/3] python3-bcrypt: enable build of unit tests Date: Thu, 27 Apr 2023 17:12:49 +0200 Message-Id: <6d52c4f677afb522fcfb289843aa92d7b676fe76.1682608254.git.frederic.martinsons@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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, 27 Apr 2023 15:13:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/180495 From: Frederic Martinsons The source code of bcrypt extension doesn't define any tests but it is to show the ptest-cargo usage Below is the updated test suite output for the recipe (cut): PASS: tests/test_bcrypt.py:test_invalid_params[password-$2b$04$cVWp4XaNU8a4v1uMRum2SO-513-10-ValueError] PASS: tests/test_bcrypt.py:test_invalid_params[password-$2b$04$cVWp4XaNU8a4v1uMRum2SO-20-0-ValueError] PASS: tests/test_bcrypt.py:test_2a_wraparound_bug ============================================================================ Testsuite summary running 0 tests test result: ok$<2>. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s root@qemux86-64:/usr/lib/python3-bcrypt/ptest# Signed-off-by: Frederic Martinsons --- meta/recipes-devtools/python/python3-bcrypt_4.0.1.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meta/recipes-devtools/python/python3-bcrypt_4.0.1.bb b/meta/recipes-devtools/python/python3-bcrypt_4.0.1.bb index 21f2eb6ba4..b4f245530d 100644 --- a/meta/recipes-devtools/python/python3-bcrypt_4.0.1.bb +++ b/meta/recipes-devtools/python/python3-bcrypt_4.0.1.bb @@ -7,12 +7,14 @@ DEPENDS += "${PYTHON_PN}-cffi-native" SRC_URI[sha256sum] = "27d375903ac8261cfe4047f6709d16f7d18d39b1ec92aaf72af989552a650ebd" -inherit pypi python_setuptools3_rust ptest cargo-update-recipe-crates +inherit pypi python_setuptools3_rust ptest-cargo cargo-update-recipe-crates SRC_URI += " \ file://run-ptest \ " +CARGO_SRC_DIR = "src/_bcrypt" + require ${BPN}-crates.inc RDEPENDS:${PN}-ptest += " \ From patchwork Thu Apr 27 15:12:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RnLDqWTDqXJpYyBNYXJ0aW5zb25z?= X-Patchwork-Id: 23086 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 91F03C7EE22 for ; Thu, 27 Apr 2023 15:13:03 +0000 (UTC) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.groups.io with SMTP id smtpd.web10.23462.1682608377399406622 for ; Thu, 27 Apr 2023 08:12:57 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=A2cRru3e; spf=pass (domain: gmail.com, ip: 209.85.128.43, mailfrom: frederic.martinsons@gmail.com) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-3f315712406so27949705e9.0 for ; Thu, 27 Apr 2023 08:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682608375; x=1685200375; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bk4FGaQ1qHPI0pSp0DX3CnD/gxd6F+KGAcORYd6+4Dw=; b=A2cRru3eAyhHe+XO85+qrMYj0pm5KrecnoSRrGdHQ7dJslPDye8q4hShzpAHojIoUp 6nYCJaPEZvFAeI+xXOBFqwAdFtkeTd8aXd004TODtLvxhaUmrEQr7Ety+5fASrDNdzjG NgW7NxzPBHpHMdfBWbU2SLI8IUqEifExY6yjN7VvygKygyZi7t66D1kHn1kQg37GEOyr jjbO8Raxnw1ChMZmBJs/f9aJnKdXd98ivOF2nd0DDsRmG6x38KW/rztK1ROIPms44Ab9 cc6/Sjx5DN6P+xBlgWT9oZ8Cp6bQvjOB8KhNWOIg/0OxKcJ0KoN27D6Ah4M7JBIe68Sj QF2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682608375; x=1685200375; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bk4FGaQ1qHPI0pSp0DX3CnD/gxd6F+KGAcORYd6+4Dw=; b=ZXNSddi6py3KFmdO9Pfz95L077wMABhnAm3IhijvxUiUh/LEcodpT54kPZLlfNamfc qChzP4rkpgYqPib8mo98ejmiEWGwfEXLmRLhF8jXe8GLmMmpko02ay5Y9musyV1seHLF EqmOCPfkYigdyuho/rzwszmbiaj+u/lGt9k7fcnJiX2qUw/0MmecfASOUmwMmemOutMi isYBX0s/X5Xyache80ztQau4xlBlZEXp2q8sER3/JKl+bEZfhIutpU4HMG8W/si3W8q5 mQTkm5sHy9C8Vn/r15Xf+Wov93p2CZkStSW2kgC9r7uXWHVpO1jNr0GOxegdQ3kgFkAp qDJA== X-Gm-Message-State: AC+VfDyJi2QvvrQk4f/LM8Ec3KToiRYWKuJH36AL1h7iiu+OWQtY0b2e CmUcxRTJi1ARS8Ceqjr4mFYfVA+lkR4= X-Google-Smtp-Source: ACHHUZ4CBUy6XWS3zf6+N5EDtnGJ2jTFMmtSsdWJ5RD6SGVzr0uB70pxAD5qDOd+5X+KgDSPvVOIjg== X-Received: by 2002:a05:600c:5409:b0:3f1:754e:69e6 with SMTP id he9-20020a05600c540900b003f1754e69e6mr4485534wmb.17.1682608375419; Thu, 27 Apr 2023 08:12:55 -0700 (PDT) Received: from work-pc.core.sigfox.net ([2a01:e0a:8d5:c6c0:e2ba:a159:c9f4:28dc]) by smtp.gmail.com with ESMTPSA id v19-20020a05600c215300b003ee20b4b2dasm21655529wml.46.2023.04.27.08.12.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 08:12:55 -0700 (PDT) From: frederic.martinsons@gmail.com To: openembedded-core@lists.openembedded.org Subject: [PATCHV4 3/3] zvariant: add ptest feature for zvariant test suite Date: Thu, 27 Apr 2023 17:12:50 +0200 Message-Id: <58f178618b2e44a422ca2ccf2bf32cd6779ddeee.1682608254.git.frederic.martinsons@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 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, 27 Apr 2023 15:13:03 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/180496 From: Frederic Martinsons Below is the output of run-ptest script under qemu root@qemux86-64:~# /usr/lib/zvariant/ptest/run-ptest running 37 tests test framing_offset_size::tests::framing_offset_size_bump ... ok$<2> test owned_value::tests::from_value ... ok$<2> test object_path::unit::owned_from_reader ... ok$<2> test str::tests::from_string ... ok$<2> test signature::tests::signature_slicing ... ok$<2> test str::tests::test_ordering ... ok$<2> test owned_value::tests::map_conversion ... ok$<2> test owned_value::tests::serde ... ok$<2> test tests::enums ... ok$<2> test tests::derive ... ok$<2> test tests::f64_value ... ok$<2> test tests::i16_value ... ok$<2> test tests::fd_value ... ok$<2> test tests::i32_value ... ok$<2> test tests::i8_value ... ok$<2> test tests::i64_value ... ok$<2> test tests::ip_addr ... ok$<2> test tests::issue_59 ... ok$<2> test tests::issue_99 ... ok$<2> test tests::array_value ... ok$<2> test tests::object_path_value ... ok$<2> test tests::dict_value ... ok$<2> test tests::signature_value ... ok$<2> test tests::serialized_size ... ok$<2> test tests::struct_byte_array ... ok$<2> test tests::struct_ref ... ok$<2> test tests::str_value ... ok$<2> test tests::option_value ... ok$<2> test tests::struct_value ... ok$<2> test tests::struct_with_hashmap ... ok$<2> test tests::u16_value ... ok$<2> test tests::u32_value ... ok$<2> test tests::unit ... ok$<2> test tests::u8_value ... ok$<2> test tests::unit_fds ... ok$<2> test tests::value_value ... ok$<2> test tests::recursion_limits ... ok$<2> test result: ok$<2>. 37 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.21s root@qemux86-64:~# Signed-off-by: Frederic Martinsons --- .../recipes-extended/zvariant/zvariant_3.12.0.bb | 9 ++++++++- meta/lib/oeqa/selftest/cases/devtool.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/meta-selftest/recipes-extended/zvariant/zvariant_3.12.0.bb b/meta-selftest/recipes-extended/zvariant/zvariant_3.12.0.bb index 4285d11b72..36f2a07ecf 100644 --- a/meta-selftest/recipes-extended/zvariant/zvariant_3.12.0.bb +++ b/meta-selftest/recipes-extended/zvariant/zvariant_3.12.0.bb @@ -7,6 +7,8 @@ HOMEPAGE = "https://gitlab.freedesktop.org/dbus/zbus/" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://LICENSE;md5=b377b220f43d747efdec40d69fcaa69d" +DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'glib-2.0', '', d)}" + SRC_URI = " \ git://gitlab.freedesktop.org/dbus/zbus;protocol=https;branch=main;subpath=zvariant \ file://0001-Tweak-zvariant-crate-config.patch;striplevel=2 \ @@ -21,10 +23,15 @@ python do_clean_lic_file_symlink() { addtask clean_lic_file_symlink after do_unpack before do_patch -inherit cargo cargo-update-recipe-crates +inherit ptest-cargo pkgconfig cargo-update-recipe-crates # Remove this when the recipe is reproducible EXCLUDE_FROM_WORLD = "1" require ${BPN}-crates.inc require ${BPN}-git-crates.inc + +# zvariant is an indermediate product for the zbus project +# and so, it provided only a static lib (rlib) which fall only +# in -dev package +ALLOW_EMPTY:${PN} = "1" diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 94873fd19f..1896944250 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -876,7 +876,7 @@ class DevtoolModifyTests(DevtoolBase): self.assertTrue(any([uri.startswith('file://') and '.patch' in uri for uri in src_uri]), 'This test expects the %s recipe to have a patch in its src uris' % testrecipe) - self._test_recipe_contents(recipefile, {}, ['cargo']) + self._test_recipe_contents(recipefile, {}, ['ptest-cargo']) # Clean up anything in the workdir/sysroot/sstate cache bitbake('%s -c cleansstate' % testrecipe)