[elbe-devel] [PATCH] tests: simple-validation-image-test: validate generated elbe files

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Jun 25 07:48:02 CEST 2024


Elbe creates a few non-standard files inside the RFS.
Validate their existence and contents.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 tests/simple-validation-image-test.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/tests/simple-validation-image-test.py b/tests/simple-validation-image-test.py
index a2c10eeb7f07..836f00013b57 100755
--- a/tests/simple-validation-image-test.py
+++ b/tests/simple-validation-image-test.py
@@ -108,6 +108,18 @@ def test_elbe_report_txt(build_dir):
     assert '\n|+/usr/bin/mount+|mount\n' in elbe_report
 
 
+def _test_generated_elbe_files(build_dir, root):
+    elbe_version = root.joinpath('etc', 'elbe_version').read_text()
+    assert elbe_version.startswith('simple-validation-image 1.0\nthis RFS was generated by elbe')
+
+    assert root.joinpath('etc', 'updated_version').read_text() == '1.0'
+
+    img_elbe_xml = root.joinpath('etc', 'elbe_base.xml').read_text()
+    build_dir_elbe_xml = build_dir.joinpath('source.xml').read_text()
+
+    assert img_elbe_xml == build_dir_elbe_xml
+
+
 def _test_finetuning(root):
     # <rm>var/cache/apt/archives/*.deb</rm>
     for f in root.joinpath('var', 'cache', 'apt', 'archives').iterdir():
@@ -152,7 +164,7 @@ def _test_finetuning(root):
     assert root.joinpath('etc', 'hosts4').read_text().startswith('     1\t127.0.0.1\tlocalhost\n')
 
 
-def _test_rfs_partition(part):
+def _test_rfs_partition(build_dir, part):
     assert part.number == 1
     assert part.start == 1 * 1024 * 1024
     assert part.size == 799 * 1024 * 1024
@@ -198,6 +210,7 @@ def _test_rfs_partition(part):
         assert getty_service.is_symlink()
         assert str(getty_service.readlink()) == '/lib/systemd/system/serial-getty at .service'
 
+        _test_generated_elbe_files(build_dir, root)
         _test_finetuning(root)
 
 
@@ -211,7 +224,7 @@ def test_image(build_dir):
         partitions = img.partitions
         assert len(partitions) == 1
 
-        _test_rfs_partition(partitions[0])
+        _test_rfs_partition(build_dir, partitions[0])
 
 
 if __name__ == '__main__':

---
base-commit: 655893d3249c0ae1a23fec6f611c64aaa9a3b14e
change-id: 20240625-elbevalidate-gen-files-87ccaf9958c1

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



More information about the elbe-devel mailing list