[Git][reproducible-builds/diffoscope][master] Search for expected keywords in the output of cbfstool tests and not a...

Chris Lamb gitlab at salsa.debian.org
Thu Jan 23 11:48:42 UTC 2020



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
d59dd2a9 by Marc Herbert at 2020-01-23T11:46:19+00:00
Search for expected keywords in the output of cbfstool tests and not a specific output. (Closes: reproducible-builds/diffoscope!42)

Stop trying to track every small change in the output of the "cbfstool print"
command, just search for some expected keywords instead.

- Around 2015 the legacy master header stopped being generated by default:
   https://www.coreboot.org/CBFS#FMAP
   https://review.coreboot.org/c/coreboot/+/10135

- In v4.7, cbfstool added the Comp(ression) column.

- v4.8 or v4.9 added a new header " FMAP REGION: COREBOOT", see new
  contextual diff below.

Signed-off-by: Chris Lamb <lamby at debian.org>

- - - - -


4 changed files:

- tests/comparators/test_cbfs.py
- − tests/data/cbfs_listing_comp_column_expected.diff
- − tests/data/cbfs_listing_expected_diff
- − tests/data/cbfs_listing_no_legacy_header_expected_diff


Changes:

=====================================
tests/comparators/test_cbfs.py
=====================================
@@ -19,6 +19,7 @@
 
 import struct
 import pytest
+import re
 import subprocess
 
 from diffoscope.comparators.cbfs import CbfsFile
@@ -122,15 +123,14 @@ def differences(rom1, rom2):
 
 @skip_unless_tools_exist('cbfstool')
 def test_listing(differences):
-    # Newer versions of cbfstool do not create the "legacy" header by default
-    # and thus is missing from the diff.
-    # Even newer versions added a "compression" column.
-
-    assert differences[0].unified_diff in (
-        get_data('cbfs_listing_expected_diff'),
-        get_data('cbfs_listing_no_legacy_header_expected_diff'),
-        get_data('cbfs_listing_comp_column_expected.diff'),  # cbfs >= 4.6
-    )
+    # Compares outputs of: "cbfstool $tmpdir/coreboot*.rom print"
+    #
+    # As the output of this command keeps changing slightly (see
+    # https://salsa.debian.org/reproducible-builds/diffoscope/merge_requests/38/
+    # and the git log of this file), perform only these basic sanity checks.
+
+    assert differences[0].source1.startswith("cbfstool")
+    assert re.search(r'\+text\s.*\sraw\s', differences[0].unified_diff)
 
 
 @skip_unless_tools_exist('cbfstool')


=====================================
tests/data/cbfs_listing_comp_column_expected.diff deleted
=====================================
@@ -1,6 +0,0 @@
-@@ -1,3 +1,3 @@
- Name                           Offset     Type           Size   Comp
--text                           0x0        raw               446 none
--(empty)                        0x200      null            32152 none
-+text                           0x0        raw               671 none
-+(empty)                        0x300      null            31896 none


=====================================
tests/data/cbfs_listing_expected_diff deleted
=====================================
@@ -1,9 +0,0 @@
-@@ -1,6 +1,3 @@
--32 kB, bootblocksize 0, romsize 32768, offset 0x0
--alignment: 64 bytes, architecture: x86
--
- Name                           Offset     Type         Size
--text                           0x0        raw          446
--(empty)                        0x200      null         32152
-+text                           0x0        raw          671
-+(empty)                        0x300      null         31896


=====================================
tests/data/cbfs_listing_no_legacy_header_expected_diff deleted
=====================================
@@ -1,6 +0,0 @@
-@@ -1,3 +1,3 @@
- Name                           Offset     Type         Size
--text                           0x0        raw          446
--(empty)                        0x200      null         32152
-+text                           0x0        raw          671
-+(empty)                        0x300      null         31896



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

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/d59dd2a9006723f221cf6a3cce04d547f1ac3a06
You're receiving this email because of your account on salsa.debian.org.


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


More information about the rb-commits mailing list