[test] Make image test at end of compose less strict

Originally, the idea was to remove non-blocking images that failed the
check. They were only removed from the manifest, which creates some
confusion as to what is going on. With this patch, a failed check on
non-blocking deliverable will only print an error message.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-08-16 10:11:24 +02:00
parent b4765459f3
commit 91b2f6e941

View File

@ -106,8 +106,8 @@ def run_repoclosure(compose):
def check_image_sanity(compose):
"""
Go through all images in manifest and make basic sanity tests on them. If
any check fails for a failable deliverable, it will be removed from
manifest and logged. Otherwise the compose will be aborted.
any check fails for a failable deliverable, a message will be printed and
logged. Otherwise the compose will be aborted.
"""
im = compose.im
for variant in compose.get_variants():
@ -116,13 +116,11 @@ def check_image_sanity(compose):
for arch in variant.arches:
if arch not in im.images[variant.uid]:
continue
images = im.images[variant.uid][arch]
im.images[variant.uid][arch] = [img for img in images
if check(compose, variant, arch, img)]
for img in im.images[variant.uid][arch]:
check(compose, variant, arch, img)
def check(compose, variant, arch, image):
result = True
path = os.path.join(compose.paths.compose.topdir(), image.path)
deliverable = getattr(image, 'deliverable')
can_fail = getattr(image, 'can_fail', False)
@ -131,19 +129,17 @@ def check(compose, variant, arch, image):
with open(path) as f:
iso = is_iso(f)
if image.format == 'iso' and not iso:
result = False
raise RuntimeError('%s does not look like an ISO file' % path)
if (image.arch in ('x86_64', 'i386') and
image.bootable and
not has_mbr(f) and
not has_gpt(f) and
not (iso and has_eltorito(f))):
result = False
raise RuntimeError(
'%s is supposed to be bootable, but does not have MBR nor '
'GPT nor is it a bootable ISO' % path)
# If exception is raised above, failable may catch it
return result
# If exception is raised above, failable may catch it, in which case
# nothing else will happen.
def _check_magic(f, offset, bytes):