@samitouri / QOSamiQemu / commits / 6ba3255d29

tests/functional: allow tests to define decompression target

When dealing with multi-stage decompression we want to specify the target file name lest we just overload the cache name. It also allows for something is little more friendly than the cache hash. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-ID: <20260320155107.2143191-4-alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Alex Bennée committed Mar 20, 2026 at 15:51 UTC 6ba3255d290940a444c38718c762a4201f4a41d4
1 file changed +6 -3
tests/functional/qemu_test/testcase.py
+6 -3
@@ -35,7 +35,7 @@ from .uncompress import uncompress
35
36 class QemuBaseTest(unittest.TestCase):
37
38 - def uncompress(self, compressed, format=None):
38 + def uncompress(self, compressed, target=None, format=None):
39 '''
40 @params compressed: filename, Asset, or file-like object to uncompress
41 @params format: optional compression format (gzip, lzma)
@@ -52,8 +52,11 @@ class QemuBaseTest(unittest.TestCase):
52 if isinstance(compressed, Asset):
53 compressed.fetch()
54
55 - (name, _ext) = os.path.splitext(str(compressed))
56 - uncompressed = self.scratch_file(os.path.basename(name))
55 + if target is not None:
56 + uncompressed = self.scratch_file(target)
57 + else:
58 + (name, _ext) = os.path.splitext(str(compressed))
59 + uncompressed = self.scratch_file(os.path.basename(name))
60
61 uncompress(compressed, uncompressed, format)
62