diff mbox series

[2/6] hyperfine: add ptest support

Message ID 20261125155508.3024814-3-tgamblin@baylibre.com
State Superseded
Headers show
Series add hyperfine recipe, improve ptest-cargo.bbclass | expand

Commit Message

Trevor Gamblin Nov. 25, 2026, 3:55 p.m. UTC
Enable ptests for the hyperfine recipe, using ptest-cargo.bbclass like
rpm-sequoia and librsvg.

AI-Generated: Uses Claude Opus 5.5
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 ...riding-the-hyperfine-binary-with-HYP.patch | 38 +++++++++++++++++++
 .../hyperfine/files/run-ptest                 |  7 ++++
 .../hyperfine/hyperfine_2.0.0.bb              | 19 +++++++++-
 4 files changed, 63 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/hyperfine/files/0001-tests-allow-overriding-the-hyperfine-binary-with-HYP.patch
 create mode 100644 meta/recipes-devtools/hyperfine/files/run-ptest

Comments

patchtest@automation.yoctoproject.org Nov. 25, 2026, 4:03 p.m. UTC | #1
Thank you for your submission. Patchtest identified one
or more issues with the patch. Please see the log below for
more information:

---
Testing patch /home/patchtest/share/mboxes/2-6-hyperfine-add-ptest-support.patch

FAIL: test Signed-off-by presence: A patch file has been added without a Signed-off-by tag: '0001-tests-allow-overriding-the-hyperfine-binary-with-HYP.patch' (test_patch.TestPatch.test_signed_off_by_presence)

PASS: test CVE tag format (test_patch.TestPatch.test_cve_tag_format)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test Upstream-Status presence (test_patch.TestPatch.test_upstream_status_presence_format)
PASS: test auh changelog truncation notice (test_mbox.TestMbox.test_auh_changelog_truncation_notice)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: Patch cannot be merged (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: Patch cannot be merged (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this
email with an explanation of why the patch should be accepted. If you
believe these results are due to an error in patchtest, please submit a
bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category
under 'Yocto Project Subprojects'). For more information on specific
failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
you!
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 6c8ff85fd0..a36718fc53 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -26,6 +26,7 @@  PTESTS_FAST = "\
     gdk-pixbuf \
     glib-networking \
     gzip \
+    hyperfine \
     icu \
     json-c \
     json-glib \
diff --git a/meta/recipes-devtools/hyperfine/files/0001-tests-allow-overriding-the-hyperfine-binary-with-HYP.patch b/meta/recipes-devtools/hyperfine/files/0001-tests-allow-overriding-the-hyperfine-binary-with-HYP.patch
new file mode 100644
index 0000000000..458a721297
--- /dev/null
+++ b/meta/recipes-devtools/hyperfine/files/0001-tests-allow-overriding-the-hyperfine-binary-with-HYP.patch
@@ -0,0 +1,38 @@ 
+From b8714ae6630ca9e6a47d686a959b44a56d3ef7bd Mon Sep 17 00:00:00 2001
+From: Trevor Gamblin <tgamblin@baylibre.com>
+Date: Fri, 20 Nov 2026 20:18:36 +0000
+Subject: [PATCH] tests: allow overriding the hyperfine binary with
+ HYPERFINE_BIN
+
+cargo_bin!() resolves to an absolute path in the build tree, so the
+integration tests cannot be run once installed elsewhere (e.g. as Yocto
+ptests on a target), and the path ends up embedded in the test
+binaries. Allow the path to be set at compile time instead.
+
+Upstream-Status: Inappropriate [oe specific]
+AI-Generated: Uses Claude Code
+---
+ tests/common.rs | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/tests/common.rs b/tests/common.rs
+index fa03e46..058c962 100644
+--- a/tests/common.rs
++++ b/tests/common.rs
+@@ -1,7 +1,15 @@
+ use std::process::Command;
+ 
++// Allow overriding the binary location at compile time, e.g. when the tests
++// are run outside of the build tree. Evaluated as a const so that the
++// build-tree path is not embedded in the test binary when overridden.
++const HYPERFINE_BIN: &str = match option_env!("HYPERFINE_BIN") {
++    Some(bin) => bin,
++    None => env!("CARGO_BIN_EXE_hyperfine"),
++};
++
+ pub fn hyperfine_raw_command() -> Command {
+-    let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("hyperfine"));
++    let mut cmd = Command::new(HYPERFINE_BIN);
+     cmd.current_dir("tests/");
+     cmd
+ }
diff --git a/meta/recipes-devtools/hyperfine/files/run-ptest b/meta/recipes-devtools/hyperfine/files/run-ptest
new file mode 100644
index 0000000000..3e44f229a8
--- /dev/null
+++ b/meta/recipes-devtools/hyperfine/files/run-ptest
@@ -0,0 +1,7 @@ 
+#!/bin/sh
+
+# ptest-cargo appends the test binary invocations to this script.
+# The integration tests run hyperfine from the tests/ directory and
+# compare its output against the insta snapshots installed there.
+cd "$(dirname "$0")"
+export INSTA_UPDATE=no
diff --git a/meta/recipes-devtools/hyperfine/hyperfine_2.0.0.bb b/meta/recipes-devtools/hyperfine/hyperfine_2.0.0.bb
index 3a81e1bf32..411ba8f724 100644
--- a/meta/recipes-devtools/hyperfine/hyperfine_2.0.0.bb
+++ b/meta/recipes-devtools/hyperfine/hyperfine_2.0.0.bb
@@ -4,9 +4,12 @@  LICENSE = "Apache-2.0 OR MIT"
 LIC_FILES_CHKSUM = "file://LICENSE-MIT;md5=50c79cd7360537975dfbbd15f8d01a34 \
                     file://LICENSE-APACHE;md5=86d3f3a95c324c9479bd8986968f4327"
 
-inherit cargo cargo-update-recipe-crates
+inherit cargo cargo-update-recipe-crates ptest-cargo
 
-SRC_URI = "git://github.com/sharkdp/hyperfine.git;protocol=https;nobranch=1;tag=v${PV}"
+SRC_URI = "git://github.com/sharkdp/hyperfine.git;protocol=https;nobranch=1;tag=v${PV} \
+           file://0001-tests-allow-overriding-the-hyperfine-binary-with-HYP.patch \
+           file://run-ptest \
+           "
 SRCREV = "b33755fe1fca8bcc1f182c773ca3ab040bfe517d"
 
 require ${BPN}-crates.inc
@@ -14,4 +17,16 @@  require ${BPN}-crates.inc
 # Upstream's release profile sets strip = true; let do_package do the stripping
 export CARGO_PROFILE_RELEASE_STRIP = "false"
 
+# Point the tests at the target locations at compile time, which also keeps
+# build paths (CARGO_BIN_EXE_hyperfine, CARGO_MANIFEST_DIR) out of the test binaries.
+do_compile_ptest_cargo:prepend() {
+    os.environ["HYPERFINE_BIN"] = d.expand("${bindir}/hyperfine")
+    os.environ["INSTA_WORKSPACE_ROOT"] = d.getVar("PTEST_PATH")
+}
+
+do_install_ptest() {
+	cp -r ${S}/tests ${D}${PTEST_PATH}/
+	rm ${D}${PTEST_PATH}/tests/*.rs
+}
+
 BBCLASSEXTEND = "native nativesdk"