summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@microsoft.com>2020-12-16 18:51:40 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-20 00:03:04 +0000
commit715591d95207a2d884a400f3ef5607a27907c44d (patch)
tree8d628ae09254a6b553e7beafa58ce79a45ab3676 /meta/lib
parenta49a29892e24f36aa3eba2bcb5da89283e6ec4a7 (diff)
downloadpoky-715591d95207a2d884a400f3ef5607a27907c44d.tar.gz
oe-selftest: move FIT image tests to their own module
I'm about to add an additional test, and on the assumption that we might also add more in future it seems reasonable to have the tests in their own module. (From OE-Core rev: 89f620cc142df9b4af6d49a13db96452ec838139) Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/cases/fitimage.py84
-rw-r--r--meta/lib/oeqa/selftest/cases/imagefeatures.py74
2 files changed, 84 insertions, 74 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py
new file mode 100644
index 0000000000..2c3803d5be
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -0,0 +1,84 @@
1#
2# SPDX-License-Identifier: MIT
3#
4
5from oeqa.selftest.case import OESelftestTestCase
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
7import os
8import json
9
10class FitImageTests(OESelftestTestCase):
11
12 def test_fit_image(self):
13 """
14 Summary: Check if FIT image and Image Tree Source (its) are built
15 and the Image Tree Source has the correct fields.
16 Expected: 1. fitImage and fitImage-its can be built
17 2. The type, load address, entrypoint address and
18 default values of kernel and ramdisk are as expected
19 in the Image Tree Source. Not all the fields are tested,
20 only the key fields that wont vary between different
21 architectures.
22 Product: oe-core
23 Author: Usama Arif <usama.arif@arm.com>
24 """
25 config = """
26# Enable creation of fitImage
27KERNEL_IMAGETYPE = "Image"
28KERNEL_IMAGETYPES += " fitImage "
29KERNEL_CLASSES = " kernel-fitimage "
30
31# RAM disk variables including load address and entrypoint for kernel and RAM disk
32IMAGE_FSTYPES += "cpio.gz"
33INITRAMFS_IMAGE = "core-image-minimal"
34UBOOT_RD_LOADADDRESS = "0x88000000"
35UBOOT_RD_ENTRYPOINT = "0x88000000"
36UBOOT_LOADADDRESS = "0x80080000"
37UBOOT_ENTRYPOINT = "0x80080000"
38"""
39 self.write_config(config)
40
41 # fitImage is created as part of linux recipe
42 bitbake("virtual/kernel")
43
44 image_type = "core-image-minimal"
45 deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
46 machine = get_bb_var('MACHINE')
47 fitimage_its_path = os.path.join(deploy_dir_image,
48 "fitImage-its-%s-%s-%s" % (image_type, machine, machine))
49 fitimage_path = os.path.join(deploy_dir_image,
50 "fitImage-%s-%s-%s" % (image_type, machine, machine))
51
52 self.assertTrue(os.path.exists(fitimage_its_path),
53 "%s image tree source doesn't exist" % (fitimage_its_path))
54 self.assertTrue(os.path.exists(fitimage_path),
55 "%s FIT image doesn't exist" % (fitimage_path))
56
57 # Check that the type, load address, entrypoint address and default
58 # values for kernel and ramdisk in Image Tree Source are as expected.
59 # The order of fields in the below array is important. Not all the
60 # fields are tested, only the key fields that wont vary between
61 # different architectures.
62 its_field_check = ['type = "kernel";',
63 'load = <0x80080000>;',
64 'entry = <0x80080000>;',
65 'type = "ramdisk";',
66 'load = <0x88000000>;',
67 'entry = <0x88000000>;',
68 'default = "conf@1";',
69 'kernel = "kernel@1";',
70 'ramdisk = "ramdisk@1";'
71 ]
72
73 with open(fitimage_its_path) as its_file:
74 field_index = 0
75 for line in its_file:
76 if field_index == len(its_field_check):
77 break
78 if its_field_check[field_index] in line:
79 field_index +=1
80
81 if field_index != len(its_field_check): # if its equal, the test passed
82 self.assertTrue(field_index == len(its_field_check),
83 "Fields in Image Tree Source File %s did not match, error in finding %s"
84 % (fitimage_its_path, its_field_check[field_index]))
diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py
index 415e0315fc..6723a8198f 100644
--- a/meta/lib/oeqa/selftest/cases/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py
@@ -264,80 +264,6 @@ PNBLACKLIST[busybox] = "Don't build this"
264 264
265 bitbake("--graphviz core-image-sato") 265 bitbake("--graphviz core-image-sato")
266 266
267 def test_fit_image(self):
268 """
269 Summary: Check if FIT image and Image Tree Source (its) are built
270 and the Image Tree Source has the correct fields.
271 Expected: 1. fitImage and fitImage-its can be built
272 2. The type, load address, entrypoint address and
273 default values of kernel and ramdisk are as expected
274 in the Image Tree Source. Not all the fields are tested,
275 only the key fields that wont vary between different
276 architectures.
277 Product: oe-core
278 Author: Usama Arif <usama.arif@arm.com>
279 """
280 config = """
281# Enable creation of fitImage
282KERNEL_IMAGETYPE = "Image"
283KERNEL_IMAGETYPES += " fitImage "
284KERNEL_CLASSES = " kernel-fitimage "
285
286# RAM disk variables including load address and entrypoint for kernel and RAM disk
287IMAGE_FSTYPES += "cpio.gz"
288INITRAMFS_IMAGE = "core-image-minimal"
289UBOOT_RD_LOADADDRESS = "0x88000000"
290UBOOT_RD_ENTRYPOINT = "0x88000000"
291UBOOT_LOADADDRESS = "0x80080000"
292UBOOT_ENTRYPOINT = "0x80080000"
293"""
294 self.write_config(config)
295
296 # fitImage is created as part of linux recipe
297 bitbake("virtual/kernel")
298
299 image_type = "core-image-minimal"
300 deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
301 machine = get_bb_var('MACHINE')
302 fitimage_its_path = os.path.join(deploy_dir_image,
303 "fitImage-its-%s-%s-%s" % (image_type, machine, machine))
304 fitimage_path = os.path.join(deploy_dir_image,
305 "fitImage-%s-%s-%s" % (image_type, machine, machine))
306
307 self.assertTrue(os.path.exists(fitimage_its_path),
308 "%s image tree source doesn't exist" % (fitimage_its_path))
309 self.assertTrue(os.path.exists(fitimage_path),
310 "%s FIT image doesn't exist" % (fitimage_path))
311
312 # Check that the type, load address, entrypoint address and default
313 # values for kernel and ramdisk in Image Tree Source are as expected.
314 # The order of fields in the below array is important. Not all the
315 # fields are tested, only the key fields that wont vary between
316 # different architectures.
317 its_field_check = ['type = "kernel";',
318 'load = <0x80080000>;',
319 'entry = <0x80080000>;',
320 'type = "ramdisk";',
321 'load = <0x88000000>;',
322 'entry = <0x88000000>;',
323 'default = "conf@1";',
324 'kernel = "kernel@1";',
325 'ramdisk = "ramdisk@1";'
326 ]
327
328 with open(fitimage_its_path) as its_file:
329 field_index = 0
330 for line in its_file:
331 if field_index == len(its_field_check):
332 break
333 if its_field_check[field_index] in line:
334 field_index +=1
335
336 if field_index != len(its_field_check): # if its equal, the test passed
337 self.assertTrue(field_index == len(its_field_check),
338 "Fields in Image Tree Source File %s did not match, error in finding %s"
339 % (fitimage_its_path, its_field_check[field_index]))
340
341 def test_image_gen_debugfs(self): 267 def test_image_gen_debugfs(self):
342 """ 268 """
343 Summary: Check debugfs generation 269 Summary: Check debugfs generation