diff options
| author | Hongxu Jia <hongxu.jia@windriver.com> | 2025-11-07 14:14:46 +0100 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-11-14 06:45:30 -0800 |
| commit | 568c1afab48e92eadf8a3469315681c77a3e887b (patch) | |
| tree | 92ab575c44442379635d3e8e8fcde63976c0f617 /meta/lib | |
| parent | f5a9af087b6e25b648cd091883316fba6a9e2ecd (diff) | |
| download | poky-568c1afab48e92eadf8a3469315681c77a3e887b.tar.gz | |
oeqa/selftest: Add SPDX 3.0 include source case for work-share
Build gcc and check gcc-14.2.0/README in objset is available
$ oe-selftest -r spdx.SPDX30Check.test_gcc_include_source
...
2024-10-26 01:24:57,063 - oe-selftest - INFO - test_gcc_include_source (spdx.SPDX30Check.test_gcc_include_source)
2024-10-26 01:28:24,204 - oe-selftest - INFO - The spdxId of gcc-14.2.0/README in gcc.spdx.json is http://spdx.org/spdxdocs/gcc-f2eaeb0d-b54b-53ba-899a-8c36c21139bf/88d5068ffd41e5ea6b4e0dd390b23bf499bb2b6674a41e09eaf2a887eced16c8/sourcefile/42
2024-10-26 01:28:26,369 - oe-selftest - INFO - ... ok
2024-10-26 01:28:33,315 - oe-selftest - INFO - ----------------------------------------------------------------------
2024-10-26 01:28:33,316 - oe-selftest - INFO - Ran 1 test in 216.457s
2024-10-26 01:28:33,316 - oe-selftest - INFO - OK
2024-10-26 01:28:45,254 - oe-selftest - INFO - RESULTS:
2024-10-26 01:28:45,254 - oe-selftest - INFO - RESULTS - spdx.SPDX30Check.test_gcc_include_source: PASSED (209.31s)
2024-10-26 01:28:45,260 - oe-selftest - INFO - SUMMARY:
2024-10-26 01:28:45,260 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 216.457s
2024-10-26 01:28:45,260 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)
(From OE-Core rev: 45f3039a4f0fcea208e317ed7134458f7aa7a4cc)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Reviewed-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit ccd6dde301dc8c45c8f901ebd4676b488d638b08)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/spdx.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/spdx.py b/meta/lib/oeqa/selftest/cases/spdx.py index 5364f70e21..f50beb52c4 100644 --- a/meta/lib/oeqa/selftest/cases/spdx.py +++ b/meta/lib/oeqa/selftest/cases/spdx.py | |||
| @@ -110,6 +110,7 @@ class SPDX3CheckBase(object): | |||
| 110 | "SDKMACHINE", | 110 | "SDKMACHINE", |
| 111 | "SDK_DEPLOY", | 111 | "SDK_DEPLOY", |
| 112 | "SPDX_VERSION", | 112 | "SPDX_VERSION", |
| 113 | "SSTATE_PKGARCH", | ||
| 113 | "TOOLCHAIN_OUTPUTNAME", | 114 | "TOOLCHAIN_OUTPUTNAME", |
| 114 | ], | 115 | ], |
| 115 | target_name, | 116 | target_name, |
| @@ -136,6 +137,34 @@ class SPDX30Check(SPDX3CheckBase, OESelftestTestCase): | |||
| 136 | "{DEPLOY_DIR_SPDX}/{MACHINE_ARCH}/packages/base-files.spdx.json", | 137 | "{DEPLOY_DIR_SPDX}/{MACHINE_ARCH}/packages/base-files.spdx.json", |
| 137 | ) | 138 | ) |
| 138 | 139 | ||
| 140 | |||
| 141 | def test_gcc_include_source(self): | ||
| 142 | import oe.spdx30 | ||
| 143 | |||
| 144 | objset = self.check_recipe_spdx( | ||
| 145 | "gcc", | ||
| 146 | "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/recipes/gcc.spdx.json", | ||
| 147 | extraconf=textwrap.dedent( | ||
| 148 | """\ | ||
| 149 | SPDX_INCLUDE_SOURCES = "1" | ||
| 150 | """ | ||
| 151 | ), | ||
| 152 | ) | ||
| 153 | |||
| 154 | gcc_pv = get_bb_var("PV", "gcc") | ||
| 155 | filename = f'gcc-{gcc_pv}/README' | ||
| 156 | found = False | ||
| 157 | for software_file in objset.foreach_type(oe.spdx30.software_File): | ||
| 158 | if software_file.name == filename: | ||
| 159 | found = True | ||
| 160 | self.logger.info(f"The spdxId of {filename} in gcc.spdx.json is {software_file.spdxId}") | ||
| 161 | break | ||
| 162 | |||
| 163 | self.assertTrue( | ||
| 164 | found, | ||
| 165 | f"Not found source file {filename} in gcc.spdx.json\n" | ||
| 166 | ) | ||
| 167 | |||
| 139 | def test_core_image_minimal(self): | 168 | def test_core_image_minimal(self): |
| 140 | objset = self.check_recipe_spdx( | 169 | objset = self.check_recipe_spdx( |
| 141 | "core-image-minimal", | 170 | "core-image-minimal", |
