Commit Graph

4030 Commits

Author SHA1 Message Date
Richard Purdie
5230e088bd oeqa/sstatetests: Improve/fix sstate creation tests
There are multiple problems with the sstate creation tests. They currently both execute
twice, once to check one set of files, then another. We can do this together in one
test which makes the code easier to follow.

The common test function also has parameters which were always the same value, so
those can be simplified.

We can use the umask context manager from bb.utils to simplfy the umask code.

The badperms test was actually broken, it was detecting bad permissions, then
ignoring them. This patch fixes that regression too and allows the check to
operate (relying on a separate fix to sstate umask handling).

The result should be an easier to understand couple of test cases which should
also function correctly and be more reliable.

(From OE-Core rev: 4951d08046f66e905e6ab4bdd7af347c7ed14c64)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 5b9263040013199c5cb480125d5ca349f5d6dc55)
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-07-04 07:50:16 -07:00
Richard Purdie
9c7e905faf oeqa/sstatetests: Fix NATIVELSBSTRING handling
The NATIVELSBSTRING variable changes value once a BuildStarted event occurs in a build
directory. This meant running some of the tests directly in a fresh build directory
would fail but they'd pass when run as a group of tests. This is clearly suboptimal.

Move the NATIVELSBSTRING handling to a location where the value is consistent
and a comment about the interesting behaviour of the variable so it hopefully doesn't
catch out others in future.

(From OE-Core rev: cb50ca2faac6418ec8f3f3fefa162531177f7460)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit e1c46fdb44fed18909d9ff4b43b4e445c5a22d33)
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-07-04 07:50:16 -07:00
Richard Purdie
1875244b49 sstatetests: Switch to new CDN
The project is switching the way handle our CDN provision of sstate objects,
update the URL accordingly.

(From OE-Core rev: a7322472e41c3cac922e29d867ae3f2f74318279)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit fea96974f1ee6ae6dceb39e3ca8157797d81586c)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-06-05 09:18:43 -07:00
Changqing Li
2fe0f26f45 patch.py: set commituser and commitemail for addNote
When PATCHTOOL is set to 'git', and user don't setup
user.name and user.email for git, do_patch fail with
the following error, fix by passing -c options.
CmdError("git notes --ref refs/notes/devtool append -m 'original patch: 0001-PATCH-increase-to-cpp17-version.patch' HEAD", 0, 'stdout:
stderr: Author identity unknown
*** Please tell me who you are.
Run
  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

(From OE-Core rev: 2d202462cf85e92cc18bc07cffdb0f335e524256)

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-05-14 08:33:40 -07:00
Hongxu Jia
0834a9cdf6 spdx3: support to override the version of a package in SBOM 3
By default, still use ${PV} as the the version of a package in SBOM 3
$ bitbake acl
$ jq . tmp/deploy/spdx/3.0.1/core2-64/packages/package-acl.spdx.json
...
    {
      "type": "software_Package",
       ...
      "name": "acl",
      "software_packageVersion": "2.3.2"
    },
...

Support to override it by setting SPDX_PACKAGE_VERSION, such as
set SPDX_PACKAGE_VERSION = "${EXTENDPKGV}" in local.conf to append
PR to software_packageVersion in SBOM 3
$ echo 'SPDX_PACKAGE_VERSION = "${EXTENDPKGV}"' >> conf/local.conf
$ bitbake acl
$ jq . tmp/deploy/spdx/3.0.1/core2-64/packages/package-acl.spdx.json
...
    {
      "type": "software_Package",
       ...
      "name": "acl",
      "software_packageVersion": "2.3.2-r0"
    },
...

(From OE-Core rev: e6ff5f4d870624795bd36572f5c2bfeec90d83ce)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-24 17:29:16 +00:00
Joshua Watt
3b585c5e11 oeqa: spdx: Add tar test for SPDX 2.2
The base-files test for SPDX 2.2 did not give good coverage, since
base-files doesn't have any dependencies. Add building tar as another
test which more fully exercises the code

(From OE-Core rev: d678e25419c89e09c1c438363bf3a940ce903d43)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-24 17:29:16 +00:00
Khem Raj
b76c04bdcb oeqa: Build cpio with C17 std
cpio is not yet buildable with C23 standard which is default with
GCC 15, therefore ensure to apply needed bandage to keep it compiling
in C17 mode even with GCC 15

(From OE-Core rev: 0c637099887f1be421c8e1203f99631a1e040150)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-24 17:29:16 +00:00
Peter Marko
769a4479e1 spdx30: handle links to inaccessible locations
This is the same as e105befbe4ee0d85e94c2048a744f0373e2dbcdf on
additional place in the code.

When a link is pointing to location inaccessible to build user (e.g. "/root/something"),
filepath.is_file() throws "PermissionError: [Errno 13] Permission denied".
Fix this by first checking if it is a link.

(From OE-Core rev: 26f35f866cf7888431963cf4fc5d2019cd28de74)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-20 17:49:16 +00:00
Richard Purdie
110b2c124b spdx: Update for bitbake changes
Bitbake is dropping the need for fetcher name iteration and multiple revisions
per url. Update the code to match (removal of the for loop).

(From OE-Core rev: 4859cdf97fd9a260036e148e25f0b78eb393df1e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-20 13:50:40 +00:00
Peter Kjellerstedt
c0f3bc79b3 devtool: reset: Escape command line input used in regular expression
Running, e.g., `devtool reset sdbus-c++` would result in the following
error:

  re.error: multiple repeat at position 35

This was due to the ++ in the recipe name, which would be treated as an
incorrect regular expression in _reset().

Use re.escape() to make sure all characters in the recipe name are
treated literally.

(From OE-Core rev: 6e73bd9b3e6d529752db93879f2c0ed53873dd1a)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-20 11:29:04 +00:00
hongxu
d029e4e033 spdx30: test the existence of directory before walking
Due to commit [spdx30: Improve os.walk() handling][1] applied,
it reported an error if walk directory failed

While SPDX_INCLUDE_SOURCES = "1", if recipe does not provide sysroots,
the walk in function add_package_files is broken

$ echo 'SPDX_INCLUDE_SOURCES = "1"' >> conf/local.conf
$ bitbake packagegroup-core-boot
|DEBUG: Adding sysroot files to SPDX
|ERROR: packagegroup-core-boot-1.0-r0 do_create_spdx: ERROR walking tmp/sysroots-components/intel_x86_64/packagegroup-core-boot: [Errno 2]
| No such file or directory: 'tmp/sysroots-components/intel_x86_64/packagegroup-core-boot'

Test the existence of directory before walking

[1] https://git.openembedded.org/openembedded-core/commit/?id=86b581e80637cd8136ce7a7e95db94d9553d2f60

(From OE-Core rev: cb1792e4950d5075be9bbe4c5337a5215db9669e)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-19 09:48:14 +00:00
Alexander Kanavin
05d23378c2 meta/lib/oe/recipeutils.py: handle fetcher errors when checking for new commits
Recent freedesktop instabilities are causing 'devtool check-upgrade-status' to
fail with:

bb.fetch2.FetchError: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; git -c gc.autoDetach=false -c core.pager=cat -c safe.bareRepository=all -c clone.defaultRemoteName=origin ls-remote https://gitlab.>
fatal: unable to access 'https://gitlab.freedesktop.org/mesa/kmscube/': The requested URL returned error: 502

and not print any results for this one or any unrelated recipes included in the check.

This change handles the error, so that if some upstream server isn't working
properly, latest upstream revision for that is marked as unknown, a
warning is printed and upstream version check for other recipes
isn't thwarted:

WARNING: Unable to obtain latest revision: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; git -c gc.autoDetach=false -c core.pager=cat -c safe.bareRepository=all -c clone.defaultRemoteName=origin ls-remote https://gitlab.freedesktop.org/mesa/piglit.git  failed with exit code 128, output:
remote: GitLab is not responding
fatal: unable to access 'https://gitlab.freedesktop.org/mesa/piglit.git/': The requested URL returned error: 502

piglit                    1.0             UNKNOWN_BROKEN  Ross Burton <ross.burton@arm.com>

(From OE-Core rev: c1056293f7cb32ee2bdf31441cc0b59d9ccfe556)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-19 09:48:14 +00:00
Adrian Freihofer
12801c7bbb oe-selftest: fitimage add more u-boot tests
Add a new test function which checks that the device-tree of U-Boot
contains the public keys which are required for checking the signature
of the kernel FIT image at run-time.

Use this new _check_kernel_dtb function in the existing
test_sign_cascaded_uboot_fit_image test case which already creates a
build configuration with UBOOT_SIGN_ENABLE = "1" and keys for the kernel.
But so far there was no check that the keys for the kernel verification
got added to U-Boot's DTB.
This test case checks the configuration where only the configuration
nodes of the kernel FIT image are signed.

A new test case test_sign_uboot_kernel_individual checks the
configuration with two keys and signed image and signed configuration
nodes.
This test case covers the use case which recently broke with commit:
  OE-Core rev: 259bfa86f384206f0d0a96a5b84887186c5f689e
               u-boot: kernel-fitimage: Fix dependency loop if
               UBOOT_SIGN_ENABLE and UBOOT_ENV enabled
and got fixed with commit
  OE-Core rev: 0106e5efab99c8016836a2ab71e2327ce58a9a9d
               u-boot: kernel-fitimage: Restore FIT_SIGN_INDIVIDUAL="1"
               behavior

This patch also fixes a few more details:
- Simplify the code by moving all the U-Boot related variables to the
  _fit_get_bb_vars function.
- Do not set FIT_GENERATE_KEYS = "1" without inheriting the
  kernel-fitimage.bbclass which handles this variable.

(From OE-Core rev: dda1fcbc85c26d1851dda6ed235238b15939998e)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-18 10:27:31 +00:00
Adrian Freihofer
4632788c43 oe-selftest: fitimage improve bb_vars access
Make the code slightly more robust by using e.g.
bb_vars.get('UBOOT_SIGN_ENABLE') instead of bb_vars['UBOOT_SIGN_ENABLE']
for variables which are potentially undefined.
This is a general cleanup but also a preparation for additional test
cases.
Log bb_vars in verbose mode.
Drop one no longer used log message.

(From OE-Core rev: 22a554e1d5a2449c4c1b34f4d5cfe1572a72a142)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-18 10:27:31 +00:00
Alex Kiernan
0b212fef33 selftest: gdbserver: Adjust regex for change to output
The updated kmod build (using meson) causes the output which results from `info
line kmod_help` to change. Relax the regex so that both old and new reponses
will pass.

(From OE-Core rev: 8783e7b8109b02847cf3b07421582c4fdb18949c)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-17 17:09:22 +00:00
Hongxu Jia
99e1e8c0b9 lib: spdx30_tasks: remove duplicated patched CVEs
Due to commit [lib: spdx30_tasks: Handle patched CVEs][1] applied,
duplicated CVE identifier for each CVE which increased +25% build
time (image task: do_create_image_sbom_spdx)

$ bitbake binutils-cross-x86_64
$ jq . tmp/deploy/spdx/3.0.1/x86_64/recipes/recipe-binutils-cross-x86_64.spdx.json | grep CVE-2023-25584
      "spdxId": "http://spdx.org/spdxdocs/binutils-cross-x86_64-5de92009-80e6-55c5-8b1f-cc37f04fbe09/962efd5da447b81b017db54d3077be796d2e5b6e770a6b050467b24339c0995f/vulnerability/CVE-2023-25584",
          "https://rdf.openembedded.org/spdx/3.0/alias": "http://spdxdocs.org/openembedded-alias/by-doc-hash/594f521fb7a3a4e9a2d3905303ffb04b016c3ce7693a775cca08be5af4d06658/binutils-cross-x86_64/UNIHASH/vulnerability/CVE-2023-25584"
          "identifier": "CVE-2023-25584",
            "https://cveawg.mitre.org/api/cve/CVE-2023-25584",
            "https://www.cve.org/CVERecord?id=CVE-2023-25584"
      "spdxId": "http://spdx.org/spdxdocs/binutils-cross-x86_64-5de92009-80e6-55c5-8b1f-cc37f04fbe09/962efd5da447b81b017db54d3077be796d2e5b6e770a6b050467b24339c0995f/vulnerability/CVE-2023-25584",
          "https://rdf.openembedded.org/spdx/3.0/alias": "http://spdxdocs.org/openembedded-alias/by-doc-hash/594f521fb7a3a4e9a2d3905303ffb04b016c3ce7693a775cca08be5af4d06658/binutils-cross-x86_64/UNIHASH/vulnerability/CVE-2023-25584"
          "identifier": "CVE-2023-25584",
            "https://cveawg.mitre.org/api/cve/CVE-2023-25584",
            "https://www.cve.org/CVERecord?id=CVE-2023-25584"

Since the commit [cve-check: annotate CVEs during analysis][2] improved
function get_patched_cves to:
- Check each patch file;
- Search for additional patched CVEs from CVE_STATUS;

And return dictionary patched_cve for each cve:
{
  "abbrev-status": "xxx",
  "status": "xxx",
  "justification": "xxx",
  "resource": "xxx",
  "affected-vendor": "xxx",
  "affected-product": "xxx",
}

But while adding CVE in meta/lib/oe/spdx30_tasks.py, the cve_by_status
requires decoded_status
{
  "mapping": "xxx",
  "detail": "xxx",
  "description": "xxx",
}

This commit converts patched_cve to decoded_status

  patched_cve["abbrev-status"] --> decoded_status["mapping"]
  patched_cve["status"] --> decoded_status["detail"]
  patched_cve["justification"] --> decoded_status["description"]

And remove duplicated search for additional patched CVEs from CVE_STATUS
(calling oe.cve_check.decode_cve_status)

After applying this commit
$ bitbake binutils-cross-x86_64
$ jq . tmp/deploy/spdx/3.0.1/x86_64/recipes/recipe-binutils-cross-x86_64.spdx.json | grep CVE-2023-25584
      "spdxId": "http://spdx.org/spdxdocs/binutils-cross-x86_64-5de92009-80e6-55c5-8b1f-cc37f04fbe09/381bf593d99c005ecd2c2e0815b86bca2b9ff4cc2db59587aaddd3db95c67470/vulnerability/CVE-2023-25584",
          "https://rdf.openembedded.org/spdx/3.0/alias": "http://spdxdocs.org/openembedded-alias/by-doc-hash/594f521fb7a3a4e9a2d3905303ffb04b016c3ce7693a775cca08be5af4d06658/binutils-cross-x86_64/UNIHASH/vulnerability/CVE-2023-25584"
          "identifier": "CVE-2023-25584",
            "https://cveawg.mitre.org/api/cve/CVE-2023-25584",
            "https://www.cve.org/CVERecord?id=CVE-2023-25584"

[1] https://git.openembedded.org/openembedded-core/commit/?id=1ff496546279d8a97df5ec475007cfb095c2a0bc
[2] https://git.openembedded.org/openembedded-core/commit/?id=452e605b55ad61c08f4af7089a5a9c576ca28f7d

(From OE-Core rev: 08595b39b46ef2bf3a928d4528292ee31a990c98)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-12 15:58:14 +00:00
Joshua Watt
143103a1c4 lib: Fix dependencies on SPDX code
The SPDX library code was being ignored from taskhash calculations due
to accidentally being omitted from BBIMPORTS. This meant that changes in
the code or dependent variables would not cause the task to rebuild
correctly.

In order to add spdx_common, convert the `Dep` object from a named tuple
to a frozen dataclass. These function more or less equivalently, but the
bitbake code parser cannot handle named tuples.

Finally, the vardepsexclude that used to be present on the recipe tasks
needs to be moved to the python code in order for the variables to be
correctly ignored. Several unused exclusions were removed

(From OE-Core rev: eb597bf61cbcb0a4d43149404c93eec0894fb4c7)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-11 21:29:50 +00:00
Adrian Freihofer
840504e256 oe-selftest: fitimage add more kernel tests
* Test with only one externally provided ssh key not only with two
  keys generated by the kernel-fitimage.bbclass itself.
* Add a test which signs only the configuration but not the image nodes.
  There was no test case which covered the probably much more important
  use case of setting FIT_SIGN_INDIVIDUAL = "0".
* Cover also the unbundled initramfs use case. Also this use case is
  probably much more relevant than the bundled initramnfs use case.

(From OE-Core rev: 0a5b65b83dcd9f8d1d22d074fdfad1f1e472827c)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-11 11:20:34 +00:00
Adrian Freihofer
2db2709b8b oe-selftest: fitimage cleanup
This is a comprehensive cleanup of the fitImage related test cases.
The existing test cases were essentially the same code copied and pasted
9 times. All 9 test cases contained the code to parse an its file and to
parse the output of the dumpimage utility in slightly different variants.
Changing the kernel-fitimage.bbclass or the uboot-sign.bbclass would mean
changing 9 test cases individually. This is no longer maintainable.

This cleanup converts the code into reusable functions. The new test
code is more like a reverse implementation of the bbclasses to be tested
than a collection of straightforward test sequences.
This also means that the test code evaluates the same bitbake variables
as the implementation. This makes it much easier to add new test cases,
as a test case is basically just another local.conf file. The code is
not yet complete. But it can now be improved step by step in this
direction.

(From OE-Core rev: 1dfa03a182d9d9e9e38c410847c7dac4ed7e8ce6)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-11 11:20:34 +00:00
Adrian Freihofer
02d2b95e6e oe-selftest: fitimage sort tests
This is a trivial refactoring.
The goal is to have all tests for kernel-fitimage.bbclass and all tests
for uboot-sign.bbclass together. This refactoring greatly simplifies
the diff of the next commit.

(From OE-Core rev: 638abab58b653a1fb120368bd5e30bc80478757c)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-11 11:20:34 +00:00
Adrian Freihofer
c93f487dc4 oe-selftest: adapt u-boot tests to latest changes
For u-boot test cases (bitbake virtual/bootloader) inheriting the
kernel-fitimage.bbclass is no longer needed. Also setting any variable
which is evaluated by the kernel-fitimage.bbclass but not by
uboot-sign.bbclass is pointless since:

* Commit OE-Core rev: 5e12dc911d0c541f43aa6d0c046fb87e8b7c1f7e
  changed the test case from
    bitbake virtual/kernel
  to
    bitbake virtual/bootloader

* Commit OE-Core rev: 259bfa86f384206f0d0a96a5b84887186c5f689e has
  finally removed the dependency of uboot-sign.bbclass on the
  kernel-fitimage.bbclass completely.

Remove the related lines of code which are now without any effect.

The two test cases test_uboot_fit_image and test_uboot_sign_fit_image
do the exact same test. Both generate a binary equal its file:

/dts-v1/;

/ {
    description = "A model description";
    #address-cells = <1>;

    images {
        uboot {
            description = "U-Boot image";
            data = /incbin/("u-boot-nodtb.bin");
            type = "standalone";
            os = "u-boot";
            arch = "arm";
            compression = "none";
            load = <0x80080000>;
            entry = <0x80080000>;
        };
        fdt {
            description = "U-Boot FDT";
            data = /incbin/("u-boot.dtb");
            type = "flat_dt";
            arch = "arm";
            compression = "none";
        };
    };

    configurations {
        default = "conf";
        conf {
            description = "Boot with signed U-Boot FIT";
            loadables = "uboot";
            fdt = "fdt";
        };
    };
};

The code diff between the two equal test cases looks like:

@@ -1,8 +1,9 @@
-    def test_uboot_fit_image(self):
+    def test_uboot_sign_fit_image(self):
         """
         Summary:     Check if Uboot FIT image and Image Tree Source
                      (its) are built and the Image Tree Source has the
-                     correct fields.
+                     correct fields, in the scenario where the Kernel
+                     is also creating/signing it's fitImage.
         Expected:    1. u-boot-fitImage and u-boot-its can be built
                      2. The type, load address, entrypoint address and
                      default values of U-boot image are correct in the
@@ -26,16 +27,15 @@
 UBOOT_LOADADDRESS = "0x80080000"
 UBOOT_ENTRYPOINT = "0x80080000"
 UBOOT_FIT_DESC = "A model description"
-
-# Enable creation of Kernel fitImage
 KERNEL_IMAGETYPES += " fitImage "
-KERNEL_CLASSES = " kernel-fitimage"
+KERNEL_CLASSES = " kernel-fitimage "
 UBOOT_SIGN_ENABLE = "1"
 FIT_GENERATE_KEYS = "1"
 UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
 UBOOT_SIGN_IMG_KEYNAME = "img-oe-selftest"
 UBOOT_SIGN_KEYNAME = "cfg-oe-selftest"
 FIT_SIGN_INDIVIDUAL = "1"
+UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart U-Boot comment'"
 """
         self.write_config(config)

Conclusion: The test case test_uboot_sign_fit_image looks redundant.
Contrary to its name, it does not insert any signature nodes into the
its-file and therefore does not test any type of signature.

Code history:
- Commit OE-Core rev: e71e4c617568496ae3bd6bb678f97b4f73cb43d8
  introduces both test cases.
- Commit OE-Core rev: 5e12dc911d0c541f43aa6d0c046fb87e8b7c1f7e
  changes both test cases like this:
  -        bitbake("virtual/kernel")
  +        bitbake("virtual/bootloader")

It looks like the original implementation of test_uboot_sign_fit_image
was supposed to test the interaction between the kernel-fitimage.bbclass
and uboot-sign.bbclass which does not longer work like that.

When compiling u-boot, the variable that is relevant for creating an its
file with signature nodes is: SPL_SIGN_ENABLE. This is what the test
case test_sign_standalone_uboot_fit_image verifies. Lets just delete the
now obsolete test_uboot_sign_fit_image test case.

(From OE-Core rev: de8bfdff0f997f59a2bd27842a2ffcd365f725f3)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-11 11:20:34 +00:00
Joshua Watt
e852d99018 lib: spdx30_tasks: Handle patched CVEs
The code to iterate over patched CVEs (e.g. those patched by a .patch
file in SRC_URI) was accidentally omitted when writing the SPDX 3
handling. Add it in now

[YOCTO #15789]

(From OE-Core rev: 1ff496546279d8a97df5ec475007cfb095c2a0bc)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-08 18:08:04 +00:00
Xiaotian Wu
5323603048 lib/oe/elf.py: Add loongarch64 architecture definition for musl
Add the ELF definition for the loongarch64 architecture when building
with musl as libc.

(From OE-Core rev: c6498e4ca43dc2f8bc326bc6b6dbc8fd7f0bef79)

Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-07 11:13:24 +00:00
Joshua Watt
5d7d2981bd lib: sbom30: Add action statement for affected VEX statements
VEX Affected relationships have a mandatory action statement that
indicates the mitigation for a vulnerability. Since we don't track this
add a statement indicating that no mitigation is known.

(From OE-Core rev: 39545c955474a43d11a45d74a88a5999b02cb8b3)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-06 16:33:20 +00:00
Richard Purdie
ab830b19ee qemurunner: Fix a bug with fork/exit handling
If you send this forked process a SIGTERM, it will execute all of the
parent's exit code leading to two sets of console/exit output which is
extremely confusing. Wrap the code in a try/finally to ensure we always
call os._exit() to avoid this.

I spent far too long trying to work out the crazy console output from this.

(From OE-Core rev: 652e40bfae24b8e23bbf7a7f35d900d2ab8d0f92)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-03-03 18:01:30 +00:00
Richard Purdie
430ed4a884 lib/package/utils: Improve multiprocess_launch argument passing
The current code for multiple argument passing is horrible. Tweak the
multiprocess_launch function to only convert to a tuple if it isn't already
one, which means we can then use function arguments in a standard way.

(From OE-Core rev: 7c99f90079e722764ebdc30e8d0e781454b3a51a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-28 07:49:18 +00:00
Jamin Lin
0247289464 oe-selftest: fitimage: add testcases to test ATF and TEE
Add "test_uboot_atf_tee_fit_image" test caste to check u-boot FIT image and
Image Tree Source(ITS) are built and the ITS has the correct fields.

Add "test_sign_standalone_uboot_atf_tee_fit_image" test case to check if u-boot
FIT image and Image Tree Source (ITS) are created and signed correctly for the
scenario where only the u-boot proper fitImage is being created and signed.

Currently, ATF and TEE(optee-os) recipes are placed in meta-arm layer.
OpenEmbedded-Core is a basic and core meta layer. To avoid OpenEmbedded-core
depends meta-arm, both test cases are used dummy images for testing.

(From OE-Core rev: 92e51452f8831f74e0907b960135eef8cecd012a)

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-27 10:55:17 +00:00
Christos Gavros
de51bc3cd9 oeqa/selftest: add a newline in local.conf (newbuilddir)
If the build-st/conf/local.conf does not end with a newline
when is generated then add one

[YOCTO #15734]

CC: Yoann Congal <yoann.congal@smile.fr>
CC: Randy MacLeod <randy.macleod@windriver.com>
CC: Alexander Kanavin <alex.kanavin@gmail.com>
(From OE-Core rev: d2fcd9e880126bc33be2ef14e678cc1aa72683c3)

Signed-off-by: Christos Gavros <gavrosc@yahoo.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-27 10:55:17 +00:00
Christos Gavros
dd8195473f skeletoninit: remove broken link
The link in the comment is broken.
It's removed together with some text.

CC: Yoann Congal <yoann.congal@smile.fr>
CC: Randy MacLeod <randy.macleod@windriver.com>
(From OE-Core rev: 4d5ce199d44bbeee7a7cff1dc7deac3d45a15d35)

Signed-off-by: Christos Gavros <gavrosc@yahoo.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-25 12:17:22 +00:00
Enrico Scholz
60ab4d0a80 oeqa/selftest/devtool: use 'config.toml' instead of plain 'config'
After changing naming of cargo config in cargo_common.bbclass, adapt
devtool to use the new name.

(From OE-Core rev: 715d27f0b4301c97f05ed3cbbaace0ba01c28f39)

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-25 12:17:22 +00:00
Deepesh Varatharajan
36f4602671 rust: Oe-selftest changes for rust v1.82.0
A few tests are getting failed with x86 arch.The unsupported/failing tests
are added to the exclude list and ignore the failing unit tests.

Upstream-Status: Pending

(From OE-Core rev: b1340173be2a3a91fbb135eb0e24e50c3b996425)

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-20 11:57:49 +00:00
Richard Purdie
00f5339c2a oeqa/qemurunner: Convert from ifconfig to use ip
ifconfig is obsolete and being removed, convert to use ip instead.

(From OE-Core rev: 3b2fb477750606976359884b18c33a37832e5a78)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-20 11:57:49 +00:00
Vyacheslav Yurkov
a7b14b3ca2 oeqa/selftest: Drop dependency on systemd-native
The tests don't need it. On top of that, this extra requirement
creates a dependency loop between systemd-systemctl-native and util-linux.

(From OE-Core rev: b5770d8c56036bdfef8d596d27433d8f408ee36f)

Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-18 22:53:45 +00:00
Richard Purdie
1460b73e01 oeqa/runtime/connman: Drop unused test
This test checks for an IP address and then tests if interface aliases work. We
don't run it on any of our automated testing as it only applies for non-qemu.

The connectivity test is unrealted to connman and pretty pointless as it depends
on ssh being working, so networking is probably ok.

The alias interface test is unrelated to commman and a general networking test
but seems out of place.

The code uses obsolete ifconfig calls and overall, the value of the test we're
never using seems low. Delete it.

(From OE-Core rev: 5e40277d1ee9df8dbc612a39b575f9a50806cd62)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-18 22:53:45 +00:00
Zoltán Böszörményi
6dd4120d62 oeqa/selftest/cases/signing.py: Re-enable self-test
With all the pieces in place, the self test can be re-enabled.

(From OE-Core rev: 46e8b94582ea9734117d20cd62c39fb4450c00c4)

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-18 11:56:04 +00:00
Joshua Watt
54e4a89a75 spdx30: Improve os.walk() handling
There have been errors seen when assembling root file system SPDX
documents where they will references files that don't exist in the
package SPDX.

The speculation is that this is caused by os.walk() ignoring errors when
walking, causing files to be omitted. Improve the code by adding an
error handler to os.walk() to report errors when they occur.

In addition, sort the files and directories while walking to ensure
consistent ordering of the file SPDX IDs.

(From OE-Core rev: 86b581e80637cd8136ce7a7e95db94d9553d2f60)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-18 11:56:03 +00:00
Richard Purdie
261a1409b1 oeqa/runtime: Add debugging if networking fails
If networking fails, we can get useful informaiton over the serial connection. Add
this fallback code so that any issues can be more easily debugged by showing the
host and target networking states.

(From OE-Core rev: 3291f9d07ecfe7d3301dc914f5e6a80577cf1d5d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-11 11:44:19 +00:00
Adrian Freihofer
4558f1b722 oe-selftest: fitimage add u-boot env script
Extend all kernel-fitimage tests to add a boot.cmd script to the
fitImage and verify the script ends up in the fitImage.

The test covers the use case which is documented here:
https://docs.u-boot.org/en/latest/usage/cmd/source.html#fit-image.
But instead of adding the sctip inline a script file is generated.

(From OE-Core rev: 816f25359935f54881b557d55c29a390dd991609)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-11 11:44:19 +00:00
Adrian Freihofer
d29786839f oe-selftest: fitimage split run_dumpimage function
Provide a re-usable function which calls the dumpimage utiliy.
This is a refactoring.

(From OE-Core rev: f69f54d72d89fb381ea1945ea52f4c9963552e9f)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-11 11:44:19 +00:00
Richard Purdie
e0a7a6eb09 lib/oeqa/metadata: Add commit_time to branch metadata being saved
As well as commit counts, it is helpful to know when metadata dates from. Store
the unix timestamp for commits in a commit_time field alongside the commit count.

This is useful for performance graph analysis and saves having to recompute the
data.

(From OE-Core rev: 56d1bc3f8f45d2f9c8ca0319c429cec562a16384)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-09 22:23:30 +00:00
Richard Purdie
cfb975c62e Revert "selftest/sstatetests: run CDN mirror check only once"
This reverts commit 0d3901b768.

We've still having CDN issues so go back to the double attempt to
see if this improves things.

(From OE-Core rev: 136f0edb75d9601a0ae56e025419d3cddfb90219)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-06 21:44:47 +00:00
Igor Opaniuk
e8d4c8a153 patchtest/README.md: fix markdown style issues
Fix markdown style issues using markdownlint tool [1]:

$ cat ./meta/lib/patchtest/README.md | mdl
(stdin):4: MD034 Bare URL used
(stdin):8: MD034 Bare URL used
(stdin):9: MD034 Bare URL used
(stdin):20: MD034 Bare URL used

[1] https://github.com/markdownlint/markdownlint
(From OE-Core rev: 623cd2ffa8815a60ef630974393b17a1489ebf41)

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-05 12:49:56 +00:00
Yoann Congal
50a609576e selftest/reproducible: Add a method to test a single recipe
Introduce a new variable "OEQA_REPRODUCIBLE_TEST_LEAF_TARGETS".
It can be used like OEQA_REPRODUCIBLE_TEST_TARGET but will try to use
sstate for the dependencies.

This can be used to "quickly" test the reproducibility of a single recipe.

[YOCTO #15701]

(From OE-Core rev: e2440618bd12d7288a7f3f7cfb92d377ae61a3b4)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-05 12:49:56 +00:00
Yoann Congal
41aab515a7 selftest/reproducible: Move a comment to follow the line it concerns
The code line was moved in
commit 5a9a5ad6a7 ("reproducibility: continue testing in case of build failure")

(From OE-Core rev: b4b60941153ebeb5019b26eeed593d0a1cdb4012)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-05 12:49:56 +00:00
Joshua Watt
9600cd875b spdx30: Include files in rootfs
Adds a "contains" relationship that relates the root file system package
to the files contained in it. If a package provides a file with a
matching hash and path, it will be linked, otherwise a new File element
will be created

(From OE-Core rev: e6fe754aef93e834e5226c8b13fdf75e03080ba2)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-05 12:49:55 +00:00
Joshua Watt
c8dda4c735 lib/oe/sbom30: Fix SHA256 hash dictionary
Fixes a bug in the code that created the hash dictionary that was
accidentally excluding items with a SHA256 hash instead of including
them

(From OE-Core rev: 90765467e42241d8b572d035389d7062a0316a9f)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-05 12:49:55 +00:00
Richard Purdie
36f2627b13 oeqa/sdk/context: Improve multilib handling
Rather than hiding the multilib logic in the package tests, move the
multilib setting to the init function of the class so the logic is
clearer.

(From OE-Core rev: 7699867c3ce979ab615eb677a417bb5b82faecb7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-01 13:20:45 +00:00
Chris Laplante
4a7b6f254d oeqa/selftest: also copy local changes from the 'scripts/' dir
The 'devtool' cases make a copy of 'poky', but before this patch, that
only included modifications to the 'meta/' subdirectory.

It's very frustrating to make changes to scripts/ and have them be
silently ignored by oe-selftest.

(From OE-Core rev: 35de7080c53808ade526b3b97cb54f528357deca)

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-01 13:20:45 +00:00
Sean Nyekjaer
8545e5b458 oeqa/sdk/rust: Add a crate that needs the target and SDK host toolchain
Expand the QA tests, to test that the target and SDK host toolchains works.

(From OE-Core rev: ed915e40d24a0a8b9d78374b297a9cd8090c6f9c)

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-01 13:20:45 +00:00
Harish Sadineni
27d7a7540f oeqa/sdk/context: fix for gtk3 test failure during do_testsdk
The do_testsdk for lib32-core-image-sato aborts with below error:
configure: error: Package requirements (gtk+-3.0) were not met:
No package 'gtk+-3.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

This causes due to an absolute path name in 'sdk_env', which is now stripped to have only the environment name.

(From OE-Core rev: 386e4132a9ced75599d92610cf5c0e8fe907c3b6)

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-01 13:20:45 +00:00