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
(cherry picked from commit c6d8c6972d)
(cherry picked from commit a8783a7675)
(cherry picked from commit 02147b36d3)
This commit is contained in:
Balazs Gibizer 2024-07-11 07:29:40 +02:00
parent 673103fd63
commit 47428f6caf

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,