[elbe-devel] [PATCH 2/2] elbepack: introduce test_validate

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Mar 18 15:29:24 CET 2024


Make sure that all examples and testfiles validate successfully.

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

diff --git a/elbepack/tests/test_validate.py b/elbepack/tests/test_validate.py
new file mode 100644
index 000000000000..c6580a903f20
--- /dev/null
+++ b/elbepack/tests/test_validate.py
@@ -0,0 +1,35 @@
+# ELBE - Debian Based Embedded Rootfilesystem Builder
+# SPDX-License-Identifier: GPL-3.0-or-later
+# SPDX-FileCopyrightText: 2024 Linutronix GmbH
+
+import itertools
+import os
+
+from elbepack.directories import run_elbe
+
+import pytest
+
+
+def _test_cases():
+    return [
+        os.path.join('tests', fname)
+        for fname
+        in os.listdir('tests')
+        if fname.endswith('.xml')
+    ]
+
+
+def _examples():
+    return [
+        os.path.join('examples', fname)
+        for fname
+        in os.listdir('examples')
+        if fname.endswith('.xml')
+    ]
+
+
+ at pytest.mark.parametrize('f', itertools.chain(_test_cases(), _examples()))
+def test_validate(f, tmp_path):
+    p = tmp_path / 'preprocessed.xml'
+    run_elbe(['preprocess', '-o', p, f], check=True)
+    run_elbe(['validate', p], check=True)

-- 
2.44.0



More information about the elbe-devel mailing list