summary refs log tree commit diff stats
path: root/tests/functional/qemu_test
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2024-08-30 15:38:24 +0200
committerThomas Huth <thuth@redhat.com>2024-09-04 11:14:33 +0200
commitd5674412ba32b6fb0fc6dfd6d1fcddadf75cbfaa (patch)
tree5a58830e78a9de6472246a55f15bcb069f6ad62a /tests/functional/qemu_test
parent05caa0624256da44974cd68e8f55dbbde3dfede7 (diff)
downloadfocaccia-qemu-d5674412ba32b6fb0fc6dfd6d1fcddadf75cbfaa.tar.gz
focaccia-qemu-d5674412ba32b6fb0fc6dfd6d1fcddadf75cbfaa.zip
tests/functional: Convert the rx_gdbsim avocado test into a standalone test
Provide a "gzip_uncompress" function based on the standard "gzip" module
to avoid the usage of avocado.utils here.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240830133841.142644-31-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/functional/qemu_test')
-rw-r--r--tests/functional/qemu_test/utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_test/utils.py
index a12dac51b6..99eae5fc45 100644
--- a/tests/functional/qemu_test/utils.py
+++ b/tests/functional/qemu_test/utils.py
@@ -8,6 +8,7 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
 
+import gzip
 import lzma
 import os
 import shutil
@@ -23,6 +24,17 @@ def archive_extract(archive, dest_dir, member=None):
         else:
             tf.extractall(path=dest_dir)
 
+def gzip_uncompress(gz_path, output_path):
+    if os.path.exists(output_path):
+        return
+    with gzip.open(gz_path, 'rb') as gz_in:
+        try:
+            with open(output_path, 'wb') as raw_out:
+                shutil.copyfileobj(gz_in, raw_out)
+        except:
+            os.remove(output_path)
+            raise
+
 def lzma_uncompress(xz_path, output_path):
     if os.path.exists(output_path):
         return