Stabilize iso format unit tests

Some version of mkisofs does not properly handle if both the input and
the output file of the command are the same. So this commit changes the
unit tests depending on that binary to use a different files.

Related-Bug: #2059809
Change-Id: I6924eb23ff5804c22a48ec6fabcec25f061906bb
This commit is contained in:
Balazs Gibizer 2024-07-11 07:29:40 +02:00
parent a305571262
commit c6d8c6972d

View File

@ -91,10 +91,15 @@ class TestFormatInspectors(test.NoDBTestCase):
subprocess.check_output(
'dd if=/dev/zero of=%s bs=1M count=%i' % (fn, size),
shell=True)
# We need to use different file as input and output as the behavior
# of mkisofs is version dependent if both the input and the output
# are the same and can cause test failures
out_fn = "%s.iso" % fn
subprocess.check_output(
'%s -V "TEST" -o %s %s' % (base_cmd, fn, fn),
'%s -V "TEST" -o %s %s' % (base_cmd, out_fn, fn),
shell=True)
return fn
self._created_files.append(out_fn)
return out_fn
def _create_img(
self, fmt, size, subformat=None, options=None,