Debian Codegraph @

tests/linux_kernel/crash_commands/test_ascii.py

raw
1 # Copyright (c) 2025 Oracle and/or its affiliates
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3
4 from drgn.commands import CommandArgumentError
5 from tests.linux_kernel.crash_commands import CrashCommandTestCase
6
7
8 class TestAscii(CrashCommandTestCase):
9 def test_ascii(self):
10 cmd = self.check_crash_command("ascii 62696c2f7273752f")
11 self.assertRegex(cmd.stdout, r"(?m)^62696c2f7273752f: /usr/lib$")
12 self.assertEqual(cmd.drgn_option.globals["bytestring"], b"/usr/lib")
13
14 def test_too_large(self):
15 command = "ascii fedcba9876543210f"
16 self.assertRaisesRegex(
17 CommandArgumentError, "too large", self.run_crash_command, command
18 )
19 self.assertRaisesRegex(
20 ValueError, "too large", self.run_crash_command_drgn_option, command
21 )