Use NORMALIZED_MACHINE_NAME instead of platform.machine() everywhere

Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
Omar Sandoval 2022-10-11 16:00:35 -07:00
parent 856eb18291
commit bcbac26346
4 changed files with 9 additions and 10 deletions

View File

@ -6,7 +6,6 @@ import ctypes
import errno
import os
from pathlib import Path
import platform
import re
import signal
import socket
@ -18,7 +17,7 @@ import unittest
import drgn
from tests import TestCase
from util import SYS
from util import NORMALIZED_MACHINE_NAME, SYS
class LinuxKernelTestCase(TestCase):
@ -93,8 +92,8 @@ skip_unless_have_test_kmod = unittest.skipUnless(
)
skip_unless_have_full_mm_support = unittest.skipUnless(
platform.machine() == "x86_64",
f"mm support is not implemented for {platform.machine()}",
NORMALIZED_MACHINE_NAME == "x86_64",
f"mm support is not implemented for {NORMALIZED_MACHINE_NAME}",
)

View File

@ -1,16 +1,16 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: GPL-3.0-or-later
import platform
import re
import unittest
from drgn.helpers.linux.boot import pgtable_l5_enabled
from tests.linux_kernel import LinuxKernelTestCase
from util import NORMALIZED_MACHINE_NAME
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):
with open("/proc/cpuinfo", "r") as f:
self.assertEqual(

View File

@ -3,7 +3,6 @@
import errno
import os
import platform
import sys
import unittest
@ -35,6 +34,7 @@ from tests.linux_kernel.bpf import (
bpf_prog_load,
)
from tests.linux_kernel.helpers.test_cgroup import tmp_cgroups
from util import NORMALIZED_MACHINE_NAME
class TestBpf(LinuxKernelTestCase):
@ -51,7 +51,7 @@ class TestBpf(LinuxKernelTestCase):
super().setUpClass()
if _SYS_bpf is None:
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:
os.close(bpf_map_create(BPF_MAP_TYPE_HASH, 8, 8, 8))

View File

@ -5,7 +5,6 @@ import contextlib
import ctypes
import mmap
import os
import platform
import struct
import tempfile
import unittest
@ -46,6 +45,7 @@ from tests.linux_kernel import (
skip_unless_have_full_mm_support,
skip_unless_have_test_kmod,
)
from util import NORMALIZED_MACHINE_NAME
class TestMm(LinuxKernelTestCase):
@ -268,7 +268,7 @@ class TestMm(LinuxKernelTestCase):
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):
task = find_task(self.prog, os.getpid())
data = b"hello, world"