mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 09:43:06 +00:00
Use NORMALIZED_MACHINE_NAME instead of platform.machine() everywhere
Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
parent
856eb18291
commit
bcbac26346
@ -6,7 +6,6 @@ import ctypes
|
|||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import platform
|
|
||||||
import re
|
import re
|
||||||
import signal
|
import signal
|
||||||
import socket
|
import socket
|
||||||
@ -18,7 +17,7 @@ import unittest
|
|||||||
|
|
||||||
import drgn
|
import drgn
|
||||||
from tests import TestCase
|
from tests import TestCase
|
||||||
from util import SYS
|
from util import NORMALIZED_MACHINE_NAME, SYS
|
||||||
|
|
||||||
|
|
||||||
class LinuxKernelTestCase(TestCase):
|
class LinuxKernelTestCase(TestCase):
|
||||||
@ -93,8 +92,8 @@ skip_unless_have_test_kmod = unittest.skipUnless(
|
|||||||
)
|
)
|
||||||
|
|
||||||
skip_unless_have_full_mm_support = unittest.skipUnless(
|
skip_unless_have_full_mm_support = unittest.skipUnless(
|
||||||
platform.machine() == "x86_64",
|
NORMALIZED_MACHINE_NAME == "x86_64",
|
||||||
f"mm support is not implemented for {platform.machine()}",
|
f"mm support is not implemented for {NORMALIZED_MACHINE_NAME}",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import platform
|
|
||||||
import re
|
import re
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from drgn.helpers.linux.boot import pgtable_l5_enabled
|
from drgn.helpers.linux.boot import pgtable_l5_enabled
|
||||||
from tests.linux_kernel import LinuxKernelTestCase
|
from tests.linux_kernel import LinuxKernelTestCase
|
||||||
|
from util import NORMALIZED_MACHINE_NAME
|
||||||
|
|
||||||
|
|
||||||
class TestBoot(LinuxKernelTestCase):
|
class TestBoot(LinuxKernelTestCase):
|
||||||
@unittest.skipUnless(platform.machine() == "x86_64", "machine is not x86_64")
|
@unittest.skipUnless(NORMALIZED_MACHINE_NAME == "x86_64", "machine is not x86_64")
|
||||||
def test_pgtable_l5_enabled(self):
|
def test_pgtable_l5_enabled(self):
|
||||||
with open("/proc/cpuinfo", "r") as f:
|
with open("/proc/cpuinfo", "r") as f:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@ -35,6 +34,7 @@ from tests.linux_kernel.bpf import (
|
|||||||
bpf_prog_load,
|
bpf_prog_load,
|
||||||
)
|
)
|
||||||
from tests.linux_kernel.helpers.test_cgroup import tmp_cgroups
|
from tests.linux_kernel.helpers.test_cgroup import tmp_cgroups
|
||||||
|
from util import NORMALIZED_MACHINE_NAME
|
||||||
|
|
||||||
|
|
||||||
class TestBpf(LinuxKernelTestCase):
|
class TestBpf(LinuxKernelTestCase):
|
||||||
@ -51,7 +51,7 @@ class TestBpf(LinuxKernelTestCase):
|
|||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
if _SYS_bpf is None:
|
if _SYS_bpf is None:
|
||||||
raise unittest.SkipTest(
|
raise unittest.SkipTest(
|
||||||
f"bpf syscall number is not known on {platform.machine()}"
|
f"bpf syscall number is not known on {NORMALIZED_MACHINE_NAME}"
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
os.close(bpf_map_create(BPF_MAP_TYPE_HASH, 8, 8, 8))
|
os.close(bpf_map_create(BPF_MAP_TYPE_HASH, 8, 8, 8))
|
||||||
|
@ -5,7 +5,6 @@ import contextlib
|
|||||||
import ctypes
|
import ctypes
|
||||||
import mmap
|
import mmap
|
||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
import struct
|
import struct
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
@ -46,6 +45,7 @@ from tests.linux_kernel import (
|
|||||||
skip_unless_have_full_mm_support,
|
skip_unless_have_full_mm_support,
|
||||||
skip_unless_have_test_kmod,
|
skip_unless_have_test_kmod,
|
||||||
)
|
)
|
||||||
|
from util import NORMALIZED_MACHINE_NAME
|
||||||
|
|
||||||
|
|
||||||
class TestMm(LinuxKernelTestCase):
|
class TestMm(LinuxKernelTestCase):
|
||||||
@ -268,7 +268,7 @@ class TestMm(LinuxKernelTestCase):
|
|||||||
data,
|
data,
|
||||||
)
|
)
|
||||||
|
|
||||||
@unittest.skipUnless(platform.machine() == "x86_64", "machine is not x86_64")
|
@unittest.skipUnless(NORMALIZED_MACHINE_NAME == "x86_64", "machine is not x86_64")
|
||||||
def test_non_canonical_x86_64(self):
|
def test_non_canonical_x86_64(self):
|
||||||
task = find_task(self.prog, os.getpid())
|
task = find_task(self.prog, os.getpid())
|
||||||
data = b"hello, world"
|
data = b"hello, world"
|
||||||
|
Loading…
Reference in New Issue
Block a user