[elbe-devel] [PATCH v2 2/2] tests: validate variant preprocessing

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Apr 9 12:51:40 CEST 2024


Test that variant processing works correctly, producing the correct
output data.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/tests/test_preproc.py                   | 13 +++++++---
 tests/preproc-variants-none.out.xml              | 26 ++++++++++++++++++++
 tests/preproc-variants-variant1,variant2.out.xml | 30 +++++++++++++++++++++++
 tests/preproc-variants-variant1.out.xml          | 29 ++++++++++++++++++++++
 tests/preproc-variants-variant2.out.xml          | 29 ++++++++++++++++++++++
 tests/preproc-variants.xml                       | 31 ++++++++++++++++++++++++
 6 files changed, 154 insertions(+), 4 deletions(-)

diff --git a/elbepack/tests/test_preproc.py b/elbepack/tests/test_preproc.py
index 6454a007494d..66644b2b479d 100644
--- a/elbepack/tests/test_preproc.py
+++ b/elbepack/tests/test_preproc.py
@@ -13,15 +13,20 @@ def _test_file_path(name):
     return pathlib.Path(__file__).parents[2].joinpath('tests', name)
 
 
- at pytest.mark.parametrize(('inp', 'out'), [
-    ('preproc-01.xml', 'preproc-01.out.xml'),
-    ('preproc-02.xml', 'preproc-02.out.xml'),
+ at pytest.mark.parametrize(('inp', 'out', 'variant'), [
+    ('preproc-01.xml', 'preproc-01.out.xml', None),
+    ('preproc-02.xml', 'preproc-02.out.xml', None),
+    ('preproc-variants.xml', 'preproc-variants-none.out.xml', None),
+    ('preproc-variants.xml', 'preproc-variants-variant1.out.xml', 'variant1'),
+    ('preproc-variants.xml', 'preproc-variants-variant2.out.xml', 'variant2'),
+    ('preproc-variants.xml', 'preproc-variants-variant1,variant2.out.xml', 'variant1,variant2'),
 ])
-def test_preproc(inp, out, tmp_path):
+def test_preproc(inp, out, variant, tmp_path):
     actual = tmp_path / (inp + '.out')
     run_elbe([
         'preprocess',
         '-z', '0',
+        *(['-v', variant] if variant else []),
         '-o', actual,
         _test_file_path(inp),
     ], check=True)
diff --git a/tests/preproc-variants-none.out.xml b/tests/preproc-variants-none.out.xml
new file mode 100644
index 000000000000..41f6787c1b44
--- /dev/null
+++ b/tests/preproc-variants-none.out.xml
@@ -0,0 +1,26 @@
+<!--
+SPDX-License-Identifier: 0BSD
+SPDX-FileCopyrightText: Linutronix GmbH
+-->
+<ns0:RootFileSystem xmlns:ns0="https://www.linutronix.de/projects/Elbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" created="2009-05-20T08:50:56" revision="6" xsi:schemaLocation="https://www.linutronix.de/projects/Elbe dbsfed.xsd">
+	<project>
+		<name>aarch64</name>
+		<version>1.0</version>
+		<buildtype>aarch64</buildtype>
+		<mirror>
+			<primary_host>deb.debian.org</primary_host>
+			<primary_path>/debian</primary_path>
+			<primary_proto>http</primary_proto>
+		</mirror>
+		<suite>bookworm</suite>
+	</project>
+	<target>
+		<hostname>lx64</hostname>
+		<domain>linutronix.de</domain>
+		<!-- <passwd>root</passwd> -->
+		<passwd_hashed>$6$9Qq25BkNNlhJir0v$4OHpMS5BqY2fLY2g2wzp8TIjKNmmSHNSFjAM84gIU0rZesJY45bg1uoyq08KI8ZIg/BXTCUPOwuWSNDtSCE7X/</passwd_hashed>
+		<pkg-list>
+			<pkg>package1</pkg>
+			</pkg-list>
+	</target>
+</ns0:RootFileSystem>
diff --git a/tests/preproc-variants-variant1,variant2.out.xml b/tests/preproc-variants-variant1,variant2.out.xml
new file mode 100644
index 000000000000..f36ee25aa7ec
--- /dev/null
+++ b/tests/preproc-variants-variant1,variant2.out.xml
@@ -0,0 +1,30 @@
+<!--
+SPDX-License-Identifier: 0BSD
+SPDX-FileCopyrightText: Linutronix GmbH
+-->
+<ns0:RootFileSystem xmlns:ns0="https://www.linutronix.de/projects/Elbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" created="2009-05-20T08:50:56" revision="6" xsi:schemaLocation="https://www.linutronix.de/projects/Elbe dbsfed.xsd">
+	<project>
+		<name>aarch64</name>
+		<version>1.0</version>
+		<buildtype>aarch64</buildtype>
+		<mirror>
+			<primary_host>deb.debian.org</primary_host>
+			<primary_path>/debian</primary_path>
+			<primary_proto>http</primary_proto>
+		</mirror>
+		<suite>bookworm</suite>
+	</project>
+	<target>
+		<hostname>lx64</hostname>
+		<domain>linutronix.de</domain>
+		<!-- <passwd>root</passwd> -->
+		<passwd_hashed>$6$9Qq25BkNNlhJir0v$4OHpMS5BqY2fLY2g2wzp8TIjKNmmSHNSFjAM84gIU0rZesJY45bg1uoyq08KI8ZIg/BXTCUPOwuWSNDtSCE7X/</passwd_hashed>
+		<pkg-list>
+			<pkg>package1</pkg>
+			<pkg>package2</pkg>
+			<pkg>package3</pkg>
+			<pkg>package4</pkg>
+			<pkg>package5</pkg>
+			</pkg-list>
+	</target>
+</ns0:RootFileSystem>
diff --git a/tests/preproc-variants-variant1.out.xml b/tests/preproc-variants-variant1.out.xml
new file mode 100644
index 000000000000..37c9be666abb
--- /dev/null
+++ b/tests/preproc-variants-variant1.out.xml
@@ -0,0 +1,29 @@
+<!--
+SPDX-License-Identifier: 0BSD
+SPDX-FileCopyrightText: Linutronix GmbH
+-->
+<ns0:RootFileSystem xmlns:ns0="https://www.linutronix.de/projects/Elbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" created="2009-05-20T08:50:56" revision="6" xsi:schemaLocation="https://www.linutronix.de/projects/Elbe dbsfed.xsd">
+	<project>
+		<name>aarch64</name>
+		<version>1.0</version>
+		<buildtype>aarch64</buildtype>
+		<mirror>
+			<primary_host>deb.debian.org</primary_host>
+			<primary_path>/debian</primary_path>
+			<primary_proto>http</primary_proto>
+		</mirror>
+		<suite>bookworm</suite>
+	</project>
+	<target>
+		<hostname>lx64</hostname>
+		<domain>linutronix.de</domain>
+		<!-- <passwd>root</passwd> -->
+		<passwd_hashed>$6$9Qq25BkNNlhJir0v$4OHpMS5BqY2fLY2g2wzp8TIjKNmmSHNSFjAM84gIU0rZesJY45bg1uoyq08KI8ZIg/BXTCUPOwuWSNDtSCE7X/</passwd_hashed>
+		<pkg-list>
+			<pkg>package1</pkg>
+			<pkg>package2</pkg>
+			<pkg>package4</pkg>
+			<pkg>package5</pkg>
+			</pkg-list>
+	</target>
+</ns0:RootFileSystem>
diff --git a/tests/preproc-variants-variant2.out.xml b/tests/preproc-variants-variant2.out.xml
new file mode 100644
index 000000000000..d0e32b1c62b5
--- /dev/null
+++ b/tests/preproc-variants-variant2.out.xml
@@ -0,0 +1,29 @@
+<!--
+SPDX-License-Identifier: 0BSD
+SPDX-FileCopyrightText: Linutronix GmbH
+-->
+<ns0:RootFileSystem xmlns:ns0="https://www.linutronix.de/projects/Elbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" created="2009-05-20T08:50:56" revision="6" xsi:schemaLocation="https://www.linutronix.de/projects/Elbe dbsfed.xsd">
+	<project>
+		<name>aarch64</name>
+		<version>1.0</version>
+		<buildtype>aarch64</buildtype>
+		<mirror>
+			<primary_host>deb.debian.org</primary_host>
+			<primary_path>/debian</primary_path>
+			<primary_proto>http</primary_proto>
+		</mirror>
+		<suite>bookworm</suite>
+	</project>
+	<target>
+		<hostname>lx64</hostname>
+		<domain>linutronix.de</domain>
+		<!-- <passwd>root</passwd> -->
+		<passwd_hashed>$6$9Qq25BkNNlhJir0v$4OHpMS5BqY2fLY2g2wzp8TIjKNmmSHNSFjAM84gIU0rZesJY45bg1uoyq08KI8ZIg/BXTCUPOwuWSNDtSCE7X/</passwd_hashed>
+		<pkg-list>
+			<pkg>package1</pkg>
+			<pkg>package3</pkg>
+			<pkg>package4</pkg>
+			<pkg>package5</pkg>
+			</pkg-list>
+	</target>
+</ns0:RootFileSystem>
diff --git a/tests/preproc-variants.xml b/tests/preproc-variants.xml
new file mode 100644
index 000000000000..9687d102a473
--- /dev/null
+++ b/tests/preproc-variants.xml
@@ -0,0 +1,31 @@
+<!--
+SPDX-License-Identifier: 0BSD
+SPDX-FileCopyrightText: Linutronix GmbH
+-->
+<ns0:RootFileSystem xmlns:ns0="https://www.linutronix.de/projects/Elbe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" created="2009-05-20T08:50:56" revision="6" xsi:schemaLocation="https://www.linutronix.de/projects/Elbe dbsfed.xsd">
+	<project>
+		<name>aarch64</name>
+		<version>1.0</version>
+		<buildtype>aarch64</buildtype>
+		<mirror>
+			<primary_host>deb.debian.org</primary_host>
+			<primary_path>/debian</primary_path>
+			<primary_proto>http</primary_proto>
+		</mirror>
+		<suite>bookworm</suite>
+	</project>
+	<target>
+		<hostname>lx64</hostname>
+		<domain>linutronix.de</domain>
+		<!-- <passwd>root</passwd> -->
+		<passwd_hashed>$6$9Qq25BkNNlhJir0v$4OHpMS5BqY2fLY2g2wzp8TIjKNmmSHNSFjAM84gIU0rZesJY45bg1uoyq08KI8ZIg/BXTCUPOwuWSNDtSCE7X/</passwd_hashed>
+		<pkg-list>
+			<pkg>package1</pkg>
+			<pkg variant="variant1">package2</pkg>
+			<pkg variant="variant2">package3</pkg>
+			<pkg variant="variant1,variant2">package4</pkg>
+			<pkg variant="variant2,variant1">package5</pkg>
+			<pkg variant="variant-nonexistent">package6</pkg>
+		</pkg-list>
+	</target>
+</ns0:RootFileSystem>

-- 
2.44.0



More information about the elbe-devel mailing list