Skip to content

Commit

Permalink
tests: Fix print_annotated_memory test on SLOB
Browse files Browse the repository at this point in the history
The test for print_annotated_memory() shouldn't assert anything when
CONFIG_SLOB is enabled, because we can't find slab objects. However, the
test shouldn't be skipped entirely, because print_annotated_memory()
should run without error in this case. Skip the assertion only.

Fixes: c771728 ("helpers.common.memory: add print_annotated_memory() helper")

Signed-off-by: Stephen Brennan <[email protected]>
  • Loading branch information
brenns10 authored and osandov committed Jul 19, 2024
1 parent 545aa52 commit 7e8c5d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/linux_kernel/helpers/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ def test_print_annotated_memory(self):
self.prog["drgn_test_small_slab_objects"].address_,
sizeof(self.prog["drgn_test_small_slab_objects"]),
)
self.assertIn("slab object: drgn_test_small+0x0", f.getvalue())
# For CONFIG_SLOB, we cannot find slab objects. However,
# print_annotated_memory() should still function with no error. So we
# don't skip the test here: just skip the assertion.
if not self.prog["drgn_test_slob"]:
self.assertIn("slab object: drgn_test_small+0x0", f.getvalue())


class TestPrintAnnotatedStack(LinuxKernelTestCase):
Expand Down

0 comments on commit 7e8c5d7

Please sign in to comment.