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

Message ID 20260821094038.1816837-2-felix.moessbauer@siemens.com
State Under Review
Headers show
Series [1/4] testsuite: allow to run all tests below testsuite in container | expand

Commit Message

Felix Moessbauer Aug. 21, 2026, 9:40 a.m. UTC
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.moessbauer@siemens.com>
---
 testsuite/repro-build-test.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Patch

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,
         )