-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add test for vmcoreinfo special object
Signed-off-by: Stephen Brennan <[email protected]>
- Loading branch information
Showing
2 changed files
with
43 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
import os | ||
|
||
import drgn | ||
from tests.linux_kernel import LinuxKernelTestCase | ||
|
||
|
||
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.set_kernel() | ||
self.assertEqual(prog["UTS_RELEASE"].string_().decode(), os.uname().release) | ||
|
||
|
||
class TestVmcoreinfo(LinuxKernelTestCase): | ||
def test_vmcoreinfo(self): | ||
vmcoreinfo_data = dict( | ||
line.split("=", 1) | ||
for line in self.prog["VMCOREINFO"].string_().decode().strip().split("\n") | ||
) | ||
self.assertEqual( | ||
int(vmcoreinfo_data["SYMBOL(init_uts_ns)"], 16), | ||
self.prog.symbol("init_uts_ns").address, | ||
) | ||
|
||
def test_vmcoreinfo_no_debug_info(self): | ||
prog = drgn.Program() | ||
prog.set_kernel() | ||
vmcoreinfo_data = dict( | ||
line.split("=", 1) | ||
for line in self.prog["VMCOREINFO"].string_().decode().strip().split("\n") | ||
) | ||
self.assertEqual( | ||
vmcoreinfo_data["OSRELEASE"], | ||
os.uname().release, | ||
) |
This file was deleted.
Oops, something went wrong.