diff options
| author | Ines KCHELFI <ines.kchelfi@smile.fr> | 2025-05-12 16:44:09 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-15 10:55:26 +0100 |
| commit | d3208b539d1dbd10168c8705281e0bf0879faffb (patch) | |
| tree | 0a1637d86e674c6260a5fcaa9ab66741c99eb1b0 /meta/recipes-devtools/rpm-sequoia | |
| parent | 931ff89bdc9559910fe8852d0a047cfbea51e8fe (diff) | |
| download | poky-d3208b539d1dbd10168c8705281e0bf0879faffb.tar.gz | |
rpm-sequoia: add ptest
In rpm-sequoia, some default paths in test code (OUT_DIR,
CARGO_MANIFEST_DIR) are invalid at runtime and cause test failures.
To fix this, patch the test code (symbols.rs) to support overriding these
paths via optional environment variables: FORCE_RUNTIME_PATH_LIB and
FORCE_RUNTIME_PATH_SRC.
Also make -ptest package RDEPEND on -dev package.
Tests take less than a second so this is added to PTEST_FAST.
ptest result:
|root@qemux86-64:~# ptest-runner rpm-sequoia
|START: ptest-runner
|2025-05-02T15:57
|BEGIN: /usr/lib/rpm-sequoia/ptest
|
|running 1 test
|test symbols ... ok
|
|test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
|
|
|running 2 tests
|test tests::merge_certs_mismatch ... ok
|test tests::merge_certs ... ok
|
|test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
|
|DURATION: 0
|END: /usr/lib/rpm-sequoia/ptest
|2025-05-02T15:57
|STOP: ptest-runner
|TOTAL: 1 FAIL: 0
(From OE-Core rev: 16499cf903718e6bf022a13baa09df610cd43d62)
Signed-off-by: Ines KCHELFI <ines.kchelfi@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rpm-sequoia')
| -rw-r--r-- | meta/recipes-devtools/rpm-sequoia/files/0001-Use-optional-env-vars-to-force-runtime-paths-in-test.patch | 35 | ||||
| -rw-r--r-- | meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb | 26 |
2 files changed, 59 insertions, 2 deletions
diff --git a/meta/recipes-devtools/rpm-sequoia/files/0001-Use-optional-env-vars-to-force-runtime-paths-in-test.patch b/meta/recipes-devtools/rpm-sequoia/files/0001-Use-optional-env-vars-to-force-runtime-paths-in-test.patch new file mode 100644 index 0000000000..d0179fc53c --- /dev/null +++ b/meta/recipes-devtools/rpm-sequoia/files/0001-Use-optional-env-vars-to-force-runtime-paths-in-test.patch | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | From 590937523deea4ad2a2ee0e1ae4412a8f59e0170 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ines KCHELFI <ines.kchelfi@smile.fr> | ||
| 3 | Date: Thu, 10 Apr 2025 15:14:11 +0200 | ||
| 4 | Subject: [PATCH] Use optional env vars to force runtime paths in tests | ||
| 5 | |||
| 6 | Signed-off-by: Ines KCHELFI <ines.kchelfi@smile.fr> | ||
| 7 | Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm-sequoia/pull/86] | ||
| 8 | --- | ||
| 9 | tests/symbols.rs | 6 ++++-- | ||
| 10 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/tests/symbols.rs b/tests/symbols.rs | ||
| 13 | index c16dd9b..dc4a42c 100644 | ||
| 14 | --- a/tests/symbols.rs | ||
| 15 | +++ b/tests/symbols.rs | ||
| 16 | @@ -14,7 +14,8 @@ fn symbols() -> anyhow::Result<()> { | ||
| 17 | // OUT_DIR gives us | ||
| 18 | // `/tmp/rpm-sequoia/debug/build/rpm-sequoia-HASH/out`. | ||
| 19 | |||
| 20 | - let out_dir = PathBuf::from(env!("OUT_DIR")); | ||
| 21 | + let out_dir = PathBuf::from(option_env!("FORCE_RUNTIME_PATH_LIB") | ||
| 22 | + .unwrap_or(env!("OUT_DIR"))); | ||
| 23 | let mut build_dir = out_dir; | ||
| 24 | let lib = loop { | ||
| 25 | let mut lib = build_dir.clone(); | ||
| 26 | @@ -53,7 +54,8 @@ fn symbols() -> anyhow::Result<()> { | ||
| 27 | } | ||
| 28 | |||
| 29 | let mut expected_symbols_txt_fn | ||
| 30 | - = PathBuf::from(env!("CARGO_MANIFEST_DIR")); | ||
| 31 | + = PathBuf::from(option_env!("FORCE_RUNTIME_PATH_SRC") | ||
| 32 | + .unwrap_or(env!("CARGO_MANIFEST_DIR"))); | ||
| 33 | expected_symbols_txt_fn.push("src/symbols.txt"); | ||
| 34 | |||
| 35 | let mut expected_symbols_txt = Vec::new(); | ||
diff --git a/meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb b/meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb index 57062b100a..6ef626e466 100644 --- a/meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb +++ b/meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb | |||
| @@ -10,9 +10,12 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f0ff5ff7747cf7d394079c6ae87f5f0c" | |||
| 10 | 10 | ||
| 11 | DEPENDS = "openssl" | 11 | DEPENDS = "openssl" |
| 12 | 12 | ||
| 13 | inherit pkgconfig rust cargo cargo-update-recipe-crates | 13 | inherit pkgconfig rust cargo cargo-update-recipe-crates ptest-cargo |
| 14 | |||
| 15 | SRC_URI = "git://github.com/rpm-software-management/rpm-sequoia.git;protocol=https;branch=main \ | ||
| 16 | file://0001-Use-optional-env-vars-to-force-runtime-paths-in-test.patch \ | ||
| 17 | " | ||
| 14 | 18 | ||
| 15 | SRC_URI = "git://github.com/rpm-software-management/rpm-sequoia.git;protocol=https;branch=main" | ||
| 16 | 19 | ||
| 17 | SRCREV = "0667e04ae7fb8cf0490919978d69883d16400e41" | 20 | SRCREV = "0667e04ae7fb8cf0490919978d69883d16400e41" |
| 18 | 21 | ||
| @@ -41,6 +44,13 @@ do_compile:prepend () { | |||
| 41 | export LIBDIR="${libdir}" | 44 | export LIBDIR="${libdir}" |
| 42 | } | 45 | } |
| 43 | 46 | ||
| 47 | # By default, ptest binaries contain host build dir paths. | ||
| 48 | # Use custom environment variables to force these paths to match the target instead. | ||
| 49 | do_compile_ptest_cargo:prepend() { | ||
| 50 | os.environ["FORCE_RUNTIME_PATH_LIB"] = d.getVar("libdir") | ||
| 51 | os.environ["FORCE_RUNTIME_PATH_SRC"] = d.getVar("PTEST_PATH") | ||
| 52 | } | ||
| 53 | |||
| 44 | do_install:append () { | 54 | do_install:append () { |
| 45 | # Move the library to the correct location expected by rpm-sequoia.pc | 55 | # Move the library to the correct location expected by rpm-sequoia.pc |
| 46 | mkdir -p ${D}${libdir} | 56 | mkdir -p ${D}${libdir} |
| @@ -54,6 +64,18 @@ do_install:append () { | |||
| 54 | install -m644 ${S}/target/release/rpm-sequoia.pc ${D}${libdir}/pkgconfig | 64 | install -m644 ${S}/target/release/rpm-sequoia.pc ${D}${libdir}/pkgconfig |
| 55 | } | 65 | } |
| 56 | 66 | ||
| 67 | do_install_ptest:append () { | ||
| 68 | install -d ${D}${PTEST_PATH}/src | ||
| 69 | install -m 644 ${S}/src/symbols.txt ${D}${PTEST_PATH}/src/symbols.txt | ||
| 70 | } | ||
| 71 | |||
| 72 | # Tests need objdump | ||
| 73 | # ptest requires a symlinked library that is only present in the -dev package, | ||
| 74 | # so we add the -dev to runtime dependencies. | ||
| 75 | # The "dev-deps" QA check is skipped to avoid warnings about this dev package dependency. | ||
| 76 | RDEPENDS:${PN}-ptest += "binutils ${PN}-dev" | ||
| 77 | INSANE_SKIP:${PN}-ptest += "dev-deps" | ||
| 78 | |||
| 57 | RDEPENDS:${PN} = "rpm-sequoia-crypto-policy" | 79 | RDEPENDS:${PN} = "rpm-sequoia-crypto-policy" |
| 58 | PACKAGE_WRITE_DEPS += "rpm-sequoia-crypto-policy-native" | 80 | PACKAGE_WRITE_DEPS += "rpm-sequoia-crypto-policy-native" |
| 59 | 81 | ||
