| Message ID | 20241030050745.3702603-7-hongxu.jia@windriver.com |
|---|---|
| State | Accepted, archived |
| Commit | ccd6dde301dc8c45c8f901ebd4676b488d638b08 |
| Headers | show |
| Series | Support SPDX include source for work-share directory | expand |
Excellent! Thanks for adding a test case Reviewed-by: Joshua Watt <JPEWhacker@gmail.com> On Tue, Oct 29, 2024 at 11:07 PM Hongxu Jia <hongxu.jia@windriver.com> wrote: > > 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) > > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > --- > meta/lib/oeqa/selftest/cases/spdx.py | 29 ++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/meta/lib/oeqa/selftest/cases/spdx.py b/meta/lib/oeqa/selftest/cases/spdx.py > index be595babb3..8384070219 100644 > --- a/meta/lib/oeqa/selftest/cases/spdx.py > +++ b/meta/lib/oeqa/selftest/cases/spdx.py > @@ -110,6 +110,7 @@ class SPDX3CheckBase(object): > "SDKMACHINE", > "SDK_DEPLOY", > "SPDX_VERSION", > + "SSTATE_PKGARCH", > "TOOLCHAIN_OUTPUTNAME", > ], > target_name, > @@ -136,6 +137,34 @@ class SPDX30Check(SPDX3CheckBase, OESelftestTestCase): > "{DEPLOY_DIR_SPDX}/{MACHINE_ARCH}/packages/base-files.spdx.json", > ) > > + > + def test_gcc_include_source(self): > + import oe.spdx30 > + > + objset = self.check_recipe_spdx( > + "gcc", > + "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/recipes/gcc.spdx.json", > + extraconf=textwrap.dedent( > + """\ > + SPDX_INCLUDE_SOURCES = "1" > + """ > + ), > + ) > + > + gcc_pv = get_bb_var("PV", "gcc") > + filename = f'gcc-{gcc_pv}/README' > + found = False > + for software_file in objset.foreach_type(oe.spdx30.software_File): > + if software_file.name == filename: > + found = True > + self.logger.info(f"The spdxId of {filename} in gcc.spdx.json is {software_file.spdxId}") > + break > + > + self.assertTrue( > + found, > + f"Not found source file {filename} in gcc.spdx.json\n" > + ) > + > def test_core_image_minimal(self): > objset = self.check_recipe_spdx( > "core-image-minimal", > -- > 2.25.1 >
diff --git a/meta/lib/oeqa/selftest/cases/spdx.py b/meta/lib/oeqa/selftest/cases/spdx.py index be595babb3..8384070219 100644 --- a/meta/lib/oeqa/selftest/cases/spdx.py +++ b/meta/lib/oeqa/selftest/cases/spdx.py @@ -110,6 +110,7 @@ class SPDX3CheckBase(object): "SDKMACHINE", "SDK_DEPLOY", "SPDX_VERSION", + "SSTATE_PKGARCH", "TOOLCHAIN_OUTPUTNAME", ], target_name, @@ -136,6 +137,34 @@ class SPDX30Check(SPDX3CheckBase, OESelftestTestCase): "{DEPLOY_DIR_SPDX}/{MACHINE_ARCH}/packages/base-files.spdx.json", ) + + def test_gcc_include_source(self): + import oe.spdx30 + + objset = self.check_recipe_spdx( + "gcc", + "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/recipes/gcc.spdx.json", + extraconf=textwrap.dedent( + """\ + SPDX_INCLUDE_SOURCES = "1" + """ + ), + ) + + gcc_pv = get_bb_var("PV", "gcc") + filename = f'gcc-{gcc_pv}/README' + found = False + for software_file in objset.foreach_type(oe.spdx30.software_File): + if software_file.name == filename: + found = True + self.logger.info(f"The spdxId of {filename} in gcc.spdx.json is {software_file.spdxId}") + break + + self.assertTrue( + found, + f"Not found source file {filename} in gcc.spdx.json\n" + ) + def test_core_image_minimal(self): objset = self.check_recipe_spdx( "core-image-minimal",
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) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/lib/oeqa/selftest/cases/spdx.py | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)