diff options
| author | Adrian Freihofer <adrian.freihofer@siemens.com> | 2024-07-04 09:09:38 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-13 23:28:30 +0100 |
| commit | 7889a5cd4bff32ea5d7a049d3f78434364e36758 (patch) | |
| tree | a83cd6ebfd4c0e1ac18e664b3b4c64fc93c288ec /meta/lib/oeqa | |
| parent | 22b8761c5aee0361de9fe0b93984ce4ffeb0c25c (diff) | |
| download | poky-7889a5cd4bff32ea5d7a049d3f78434364e36758.tar.gz | |
oe-selftest: fitimage refactor u-boot-tools-native
Eliminate code duplication with a new function.
Use get_bb_var instead of bitbake -e | grep.
(From OE-Core rev: 0c7b7c5c98217b5f139058533159f61d1989d46e)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/fitimage.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 347c065377..15baf3b239 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py | |||
| @@ -11,6 +11,11 @@ import re | |||
| 11 | 11 | ||
| 12 | class FitImageTests(OESelftestTestCase): | 12 | class FitImageTests(OESelftestTestCase): |
| 13 | 13 | ||
| 14 | def _setup_uboot_tools_native(self): | ||
| 15 | """build u-boot-tools-native and return RECIPE_SYSROOT_NATIVE""" | ||
| 16 | bitbake("u-boot-tools-native -c addto_recipe_sysroot") | ||
| 17 | return get_bb_var('RECIPE_SYSROOT_NATIVE', 'u-boot-tools-native') | ||
| 18 | |||
| 14 | def test_fit_image(self): | 19 | def test_fit_image(self): |
| 15 | """ | 20 | """ |
| 16 | Summary: Check if FIT image and Image Tree Source (its) are built | 21 | Summary: Check if FIT image and Image Tree Source (its) are built |
| @@ -195,10 +200,8 @@ UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'" | |||
| 195 | self.assertEqual(value, reqvalue) | 200 | self.assertEqual(value, reqvalue) |
| 196 | 201 | ||
| 197 | # Dump the image to see if it really got signed | 202 | # Dump the image to see if it really got signed |
| 198 | bitbake("u-boot-tools-native -c addto_recipe_sysroot") | 203 | uboot_tools_sysroot_native = self._setup_uboot_tools_native() |
| 199 | result = runCmd('bitbake -e u-boot-tools-native | grep ^RECIPE_SYSROOT_NATIVE=') | 204 | dumpimage_path = os.path.join(uboot_tools_sysroot_native, 'usr', 'bin', 'dumpimage') |
| 200 | recipe_sysroot_native = result.output.split('=')[1].strip('"') | ||
| 201 | dumpimage_path = os.path.join(recipe_sysroot_native, 'usr', 'bin', 'dumpimage') | ||
| 202 | result = runCmd('%s -l %s' % (dumpimage_path, fitimage_path)) | 205 | result = runCmd('%s -l %s' % (dumpimage_path, fitimage_path)) |
| 203 | in_signed = None | 206 | in_signed = None |
| 204 | signed_sections = {} | 207 | signed_sections = {} |
| @@ -516,10 +519,8 @@ UBOOT_FIT_HASH_ALG = "sha256" | |||
| 516 | self.assertEqual(value, reqvalue) | 519 | self.assertEqual(value, reqvalue) |
| 517 | 520 | ||
| 518 | # Dump the image to see if it really got signed | 521 | # Dump the image to see if it really got signed |
| 519 | bitbake("u-boot-tools-native -c addto_recipe_sysroot") | 522 | uboot_tools_sysroot_native = self._setup_uboot_tools_native() |
| 520 | result = runCmd('bitbake -e u-boot-tools-native | grep ^RECIPE_SYSROOT_NATIVE=') | 523 | dumpimage_path = os.path.join(uboot_tools_sysroot_native, 'usr', 'bin', 'dumpimage') |
| 521 | recipe_sysroot_native = result.output.split('=')[1].strip('"') | ||
| 522 | dumpimage_path = os.path.join(recipe_sysroot_native, 'usr', 'bin', 'dumpimage') | ||
| 523 | result = runCmd('%s -l %s' % (dumpimage_path, fitimage_path)) | 524 | result = runCmd('%s -l %s' % (dumpimage_path, fitimage_path)) |
| 524 | in_signed = None | 525 | in_signed = None |
| 525 | signed_sections = {} | 526 | signed_sections = {} |
| @@ -671,10 +672,8 @@ FIT_SIGN_INDIVIDUAL = "1" | |||
| 671 | self.assertEqual(value, reqvalue) | 672 | self.assertEqual(value, reqvalue) |
| 672 | 673 | ||
| 673 | # Dump the image to see if it really got signed | 674 | # Dump the image to see if it really got signed |
| 674 | bitbake("u-boot-tools-native -c addto_recipe_sysroot") | 675 | uboot_tools_sysroot_native = self._setup_uboot_tools_native() |
| 675 | result = runCmd('bitbake -e u-boot-tools-native | grep ^RECIPE_SYSROOT_NATIVE=') | 676 | dumpimage_path = os.path.join(uboot_tools_sysroot_native, 'usr', 'bin', 'dumpimage') |
| 676 | recipe_sysroot_native = result.output.split('=')[1].strip('"') | ||
| 677 | dumpimage_path = os.path.join(recipe_sysroot_native, 'usr', 'bin', 'dumpimage') | ||
| 678 | result = runCmd('%s -l %s' % (dumpimage_path, fitimage_path)) | 677 | result = runCmd('%s -l %s' % (dumpimage_path, fitimage_path)) |
| 679 | in_signed = None | 678 | in_signed = None |
| 680 | signed_sections = {} | 679 | signed_sections = {} |
