File: __init__.py

package info (click to toggle)
drgn 0.0.33-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,892 kB
  • sloc: python: 59,081; ansic: 51,400; awk: 423; makefile: 339; sh: 113
file content (27 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: LGPL-2.1-or-later

from pathlib import Path
import unittest

import drgn
from tests import TestCase
from tests.linux_kernel import LinuxKernelTestCase

VMCORE_PATH = Path("/proc/vmcore")


@unittest.skipUnless(VMCORE_PATH.exists(), "not running in kdump")
class LinuxVMCoreTestCase(TestCase):
    prog = None

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        # We only want to create the Program once for all tests, so it's cached
        # as a class variable (in the base class).
        if LinuxVMCoreTestCase.prog is None:
            prog = drgn.Program()
            prog.set_core_dump(VMCORE_PATH)
            LinuxKernelTestCase._load_debug_info(prog)
            LinuxVMCoreTestCase.prog = prog