Skip to content
Snippets Groups Projects
Commit d59dd2a9 authored by Marc Herbert's avatar Marc Herbert Committed by Chris Lamb
Browse files

Search for expected keywords in the output of cbfstool tests and not a...

Search for expected keywords in the output of cbfstool tests and not a specific output. (Closes: !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's avatarChris Lamb <lamby@debian.org>
parent 8993168a
No related branches found
No related tags found
No related merge requests found
Pipeline #103855 passed
......@@ -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')
......
@@ -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
@@ -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
@@ -1,3 +1,3 @@
Name Offset Type Size
-text 0x0 raw 446
-(empty) 0x200 null 32152
+text 0x0 raw 671
+(empty) 0x300 null 31896
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment