Skip to content

Commit 8244f39

Browse files
keszybzbluca
authored andcommitted
tests: fix section mapping in test_ukify.py
The regexp only worked if the sections were small enough for the size to start with "0". I have an initrd that is 0x1078ec7e bytes, so the tests would spuriously fail.
1 parent 1707d5d commit 8244f39

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ukify/test/test_ukify.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def test_sections(kernel_initrd, tmpdir):
464464
dump = subprocess.check_output(['objdump', '-h', output], text=True)
465465

466466
for sect in 'text osrel cmdline linux initrd uname test'.split():
467-
assert re.search(fr'^\s*\d+\s+.{sect}\s+0', dump, re.MULTILINE)
467+
assert re.search(fr'^\s*\d+\s+\.{sect}\s+[0-9a-f]+', dump, re.MULTILINE)
468468

469469
def test_addon(tmpdir):
470470
output = f'{tmpdir}/addon.efi'
@@ -499,7 +499,7 @@ def test_addon(tmpdir):
499499
dump = subprocess.check_output(['objdump', '-h', output], text=True)
500500

501501
for sect in 'text cmdline test sbat'.split():
502-
assert re.search(fr'^\s*\d+\s+.{sect}\s+0', dump, re.MULTILINE)
502+
assert re.search(fr'^\s*\d+\s+\.{sect}\s+[0-9a-f]+', dump, re.MULTILINE)
503503

504504
pe = pefile.PE(output, fast_load=True)
505505
found = False
@@ -694,7 +694,7 @@ def test_pcr_signing(kernel_initrd, tmpdir):
694694
dump = subprocess.check_output(['objdump', '-h', output], text=True)
695695

696696
for sect in 'text osrel cmdline linux initrd uname pcrsig'.split():
697-
assert re.search(fr'^\s*\d+\s+.{sect}\s+0', dump, re.MULTILINE)
697+
assert re.search(fr'^\s*\d+\s+\.{sect}\s+[0-9a-f]+', dump, re.MULTILINE)
698698

699699
# objcopy fails when called without an output argument (EPERM).
700700
# It also fails when called with /dev/null (file truncated).
@@ -767,7 +767,7 @@ def test_pcr_signing2(kernel_initrd, tmpdir):
767767
dump = subprocess.check_output(['objdump', '-h', output], text=True)
768768

769769
for sect in 'text osrel cmdline linux initrd uname pcrsig'.split():
770-
assert re.search(fr'^\s*\d+\s+.{sect}\s+0', dump, re.MULTILINE)
770+
assert re.search(fr'^\s*\d+\s+\.{sect}\s+[0-9a-f]+', dump, re.MULTILINE)
771771

772772
subprocess.check_call([
773773
'objcopy',

0 commit comments

Comments
 (0)