[elbe-devel] [PATCH] tests: add a test for archive processing

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Jul 30 09:35:16 CEST 2024


Validate that archives are processed correctly and can be extracted
again.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/tests/test_preproc.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/elbepack/tests/test_preproc.py b/elbepack/tests/test_preproc.py
index 3a8b2b328b20..cd7a99e89150 100644
--- a/elbepack/tests/test_preproc.py
+++ b/elbepack/tests/test_preproc.py
@@ -3,6 +3,7 @@
 # SPDX-FileCopyrightText: 2020-2021 Linutronix GmbH
 
 import pathlib
+import tarfile
 
 import pytest
 
@@ -32,3 +33,20 @@ def test_preproc(inp, out, variant, tmp_path):
     ])
     with open(_test_file_path(out)) as expected, actual.open() as a:
         assert a.read() == expected.read()
+
+
+def test_archive(tmp_path):
+    preprocessed = tmp_path / 'preprocessed.xml'
+    run_elbe_subcommand([
+        'preprocess', '-z', '0',
+        '-o', preprocessed,
+        _test_file_path('simple-validation-image.xml'),
+    ])
+
+    archive = tmp_path / 'archive.tar.bz2'
+    run_elbe_subcommand(['get_archive', preprocessed, archive])
+
+    with tarfile.open(archive) as tf:
+        assert tf.getnames() == [
+            '.', './opt', './opt/archive-file',
+        ]

---
base-commit: dcec7a10e0a4d63c7ee6c3d6077482ab98113211
change-id: 20240730-tests-archive-302bf12d2810

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list