Skip to content

Commit

Permalink
tests: move jiffies object finder test case to test_special_objects.py
Browse files Browse the repository at this point in the history
It fits in with the other special objects there.

Signed-off-by: Omar Sandoval <[email protected]>
  • Loading branch information
osandov committed Oct 23, 2024
1 parent bce453d commit 0fff129
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
14 changes: 1 addition & 13 deletions tests/linux_kernel/test_debug_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path
import unittest

from drgn import Object, Program
from drgn import Program
from tests import modifyenv
from tests.linux_kernel import LinuxKernelTestCase, skip_unless_have_test_kmod

Expand Down Expand Up @@ -48,15 +48,3 @@ def test_module_debug_info_use_proc_and_sys(self):

def test_module_debug_info_use_core_dump(self):
self._test_module_debug_info(False)


class TestLinuxKernelObjectFinder(LinuxKernelTestCase):
def test_jiffies(self):
self.assertIdentical(
self.prog["jiffies"],
Object(
self.prog,
"volatile unsigned long",
address=self.prog.symbol("jiffies").address,
),
)
18 changes: 15 additions & 3 deletions tests/linux_kernel/test_special_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@

import os

import drgn
from drgn import Object, Program
from tests.linux_kernel import LinuxKernelTestCase


class TestJiffies(LinuxKernelTestCase):
def test_jiffies(self):
self.assertIdentical(
self.prog["jiffies"],
Object(
self.prog,
"volatile unsigned long",
address=self.prog.symbol("jiffies").address,
),
)


class TestUts(LinuxKernelTestCase):
def test_uts_release(self):
self.assertEqual(
self.prog["UTS_RELEASE"].string_().decode(), os.uname().release
)

def test_uts_release_no_debug_info(self):
prog = drgn.Program()
prog = Program()
prog.set_kernel()
self.assertEqual(prog["UTS_RELEASE"].string_().decode(), os.uname().release)

Expand All @@ -31,7 +43,7 @@ def test_vmcoreinfo(self):
)

def test_vmcoreinfo_no_debug_info(self):
prog = drgn.Program()
prog = Program()
prog.set_kernel()
vmcoreinfo_data = dict(
line.split("=", 1)
Expand Down

0 comments on commit 0fff129

Please sign in to comment.