[Git][reproducible-builds/diffoscope][master] Debian adds an extra "Flags:" line in the output of ocamlobjinfo, so adjust...

Chris Lamb (@lamby) gitlab at salsa.debian.org
Mon Jun 29 14:53:04 UTC 2026



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
3a2303e5 by Chris Lamb at 2026-06-29T07:52:59-07:00
Debian adds an extra "Flags:" line in the output of ocamlobjinfo, so adjust the test for cross-distribution compatibility. (Closes: reproducible-builds/diffoscope#430)

- - - - -


3 changed files:

- tests/comparators/test_ocaml.py
- tests/data/ocaml_expected_diff
- tests/utils/data.py


Changes:

=====================================
tests/comparators/test_ocaml.py
=====================================
@@ -23,7 +23,7 @@ from diffoscope.comparators.ocaml import OcamlInterfaceFile
 from diffoscope.comparators.binary import FilesystemFile
 from diffoscope.comparators.utils.specialize import specialize
 
-from ..utils.data import assert_diff_startswith
+from ..utils.data import assert_diff_endswith
 from ..utils.tools import skip_unless_tool_is_at_least
 from ..utils.nonexisting import assert_non_existing
 
@@ -74,7 +74,10 @@ def test_no_differences(cmi1):
 
 @skip_unless_tool_is_at_least("ocamlobjinfo", ocaml_version, "5.4.1")
 def test_diff(differences):
-    assert_diff_startswith(differences[0], "ocaml_expected_diff")
+    # Debian adds an extra "Flags:" line in the output, so we only compare the
+    # bottom parts of the diff to ensure cross-distro compatibility.
+    # (diffoscope#430)
+    assert_diff_endswith(differences[0], "ocaml_expected_diff")
 
 
 @skip_unless_tool_is_at_least("ocamlobjinfo", ocaml_version, "4.11")


=====================================
tests/data/ocaml_expected_diff
=====================================
@@ -1,7 +1,3 @@
-@@ -1,6 +1,6 @@
--Unit name: Test1
-+Unit name: Test2
- Flags: [ Alerts _ ]
  Interfaces imported:
 -	351c2dc2fb4a56dac258b47c26262db6	Test1
 +	ac02205dc900024a67ede9f394c59d72	Test2


=====================================
tests/utils/data.py
=====================================
@@ -70,6 +70,12 @@ def assert_diff_startswith(difference, filename):
     assert haystack.startswith(needle)
 
 
+def assert_diff_endswith(difference, filename):
+    haystack = difference.unified_diff
+    needle = get_data(filename)
+    assert haystack.endswith(needle)
+
+
 # https://code.activestate.com/recipes/576620-changedirectory-context-manager/#c3
 @contextlib.contextmanager
 def cwd_data():



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/3a2303e5d4d207c4f66f4f06fa4393e5daab07ed

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/3a2303e5d4d207c4f66f4f06fa4393e5daab07ed
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20260629/7c9f2076/attachment.htm>


More information about the rb-commits mailing list