[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
1 changed files with 6 additions and 10 deletions

View File

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