Skip to content

Commit

Permalink
tests: remove slow /proc/kallsyms tests
Browse files Browse the repository at this point in the history
test_local_proc_kallsyms and test_local_proc_kallsyms_with_modules()
each take a second or two on my Fedora laptop, an order of magnitude
slower than the next slowest test. We already have the synthetic test
case, so let's use that. We can bring these back in a more optimized
form if needed.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
  • Loading branch information
osandov committed Dec 18, 2024
1 parent 36030b9 commit 5cba9ca
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tests/linux_kernel/helpers/test_kallsyms.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,24 @@ def compare_local_symbols(self, finder, modules=False):


class TestProcKallsyms(TestCase):
def test_local_proc_kallsyms(self):
finder = _load_proc_kallsyms()
compare_local_symbols(self, finder)
def test_static_data(self):
with tempfile.NamedTemporaryFile() as f:
f.write(KALLSYMS_DATA)
f.flush()
finder = _load_proc_kallsyms(filename=f.name)

def test_local_proc_kallsyms_with_modules(self):
finder = _load_proc_kallsyms(modules=True)
compare_local_symbols(self, finder, modules=True)
syms = finder(None, None, None, False)
expected = [
Symbol("null", 0x0, 8, SymbolBinding.UNIQUE, SymbolKind.UNKNOWN),
Symbol("local_data", 0x8, 8, SymbolBinding.UNKNOWN, SymbolKind.OBJECT),
Symbol("global_bss", 0x10, 16, SymbolBinding.GLOBAL, SymbolKind.OBJECT),
Symbol("weak_symbol", 0x20, 32, SymbolBinding.WEAK, SymbolKind.OBJECT),
# this one has zero size since it is at the end of vmlinux
Symbol("unknown", 0x40, 0, SymbolBinding.UNKNOWN, SymbolKind.UNKNOWN),
]
self.assertEqual(syms, expected)

def test_static_data(self):
def test_static_data_with_modules(self):
with tempfile.NamedTemporaryFile() as f:
f.write(KALLSYMS_DATA)
f.flush()
Expand Down

0 comments on commit 5cba9ca

Please sign in to comment.