[PATCH 2/4] testsuite: fallback to diff in compare_repro_image if diffoscope is missing

1 view
Skip to first unread message

Felix Moessbauer

unread,
Aug 21, 2026, 5:40:49 AMAug 21
to isar-...@googlegroups.com, Felix Moessbauer
When running the test in the container, diffoscope is missing. This is
not a test failure, but just makes the output less helpful in case the
artifacts are not identical.

To still be able to get the binary result of the test, we just fall back
to a hash comparison, using diff -q.

Signed-off-by: Felix Moessbauer <felix.mo...@siemens.com>
---
testsuite/repro-build-test.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/testsuite/repro-build-test.py b/testsuite/repro-build-test.py
index c1b51aff..eb2cb3b1 100755
--- a/testsuite/repro-build-test.py
+++ b/testsuite/repro-build-test.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

+import shutil
+
from cibuilder import CIBuilder
from utils import CIUtils
from avocado.utils import process
@@ -68,8 +70,13 @@ class ReproBuild(CIBuilder):
self.log.info(
"Compare artifacts image1: " + image1 + ", image2: " + image2
)
+
+ compare_cmd = "diff -q"
+ if shutil.which('diffoscope'):
+ compare_cmd = \
+ f"diffoscope --text {self.build_dir}/diffoscope-output.txt"
result = process.run(
- f"diffoscope --text {self.build_dir}/diffoscope-output.txt"
+ f"{compare_cmd}"
f" {self.build_dir}/{image1} {self.build_dir}/{image2}",
ignore_status=True,
)
--
2.55.0

Reply all
Reply to author
Forward
0 new messages