@@ -26,6 +26,7 @@ PTESTS_FAST = "\
gdk-pixbuf \
glib-networking \
gzip \
+ hyperfine \
icu \
json-c \
json-glib \
new file mode 100644
@@ -0,0 +1,39 @@
+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 Opus 5.5
+Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
+---
+ 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
+ }
new file mode 100644
@@ -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
@@ -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"
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> --- v2 adds a missing sign-off in the carried patch file and is more explicit about the LLM version used to create it. .../distro/include/ptest-packagelists.inc | 1 + ...riding-the-hyperfine-binary-with-HYP.patch | 39 +++++++++++++++++++ .../hyperfine/files/run-ptest | 7 ++++ .../hyperfine/hyperfine_2.0.0.bb | 19 ++++++++- 4 files changed, 64 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