From 02a4aa4c317d55b768229bbb01a15110e30a17d3 Mon Sep 17 00:00:00 2001 From: cuixucui <350255958@qq.com> Date: Mon, 14 Nov 2022 16:02:15 +0800 Subject: [PATCH] Judge whether to support kabi testing by architecture. --- hwcompatible/common.py | 7 +++++-- hwcompatible/constants.py | 1 + tests/kabi/kabi.py | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hwcompatible/common.py b/hwcompatible/common.py index dd4964d..4e282eb 100644 --- a/hwcompatible/common.py +++ b/hwcompatible/common.py @@ -21,7 +21,8 @@ import filecmp import importlib from .test import Test from .env import CertEnv -from .constants import NODEVICE +from .constants import NODEVICE, TEST_KABI_ARCH +from .command import Command def create_test_suite(test_factory, logger, subtests_filter=None): @@ -53,7 +54,9 @@ def create_test_suite(test_factory, logger, subtests_filter=None): if test["name"] == "kabi": kabi_test = test - if kabi_select: + command = Command(logger) + arch = command.run_cmd("uname -m")[0].strip() + if kabi_select and arch in TEST_KABI_ARCH: logger.info("The hardware will test kabi automatically.") kabi_test["run"] = True testcase = __create_testcase(kabi_test, logger, subtests_filter) diff --git a/hwcompatible/constants.py b/hwcompatible/constants.py index 86713d8..5ba426a 100644 --- a/hwcompatible/constants.py +++ b/hwcompatible/constants.py @@ -26,6 +26,7 @@ DRIVER = "driverName" VERSION = "driverVersion" NODEVICE = ("cpufreq", "memory", "clock", "profiler", "system", "stress", "kdump", "perf", "acpi", "watchdog", "kabi") +TEST_KABI_ARCH = ("aarch64", "x86_64") CDTYPES = ("DVD_RW", "DVD_PLUS_RW", "DVD_R", "DVD_PLUS_R", "DVD", "BD_RE", "BD_R", "BD", "CD_RW", "CD_R", "CD") GPU_DRIVER = ("nouveau", "nvidia", "bi_driver", "amdgpu") diff --git a/tests/kabi/kabi.py b/tests/kabi/kabi.py index e4f112e..967d7a9 100644 --- a/tests/kabi/kabi.py +++ b/tests/kabi/kabi.py @@ -19,6 +19,7 @@ from subprocess import getoutput from hwcompatible.env import CertEnv from hwcompatible.command import Command from hwcompatible.test import Test +from hwcompatible.constants import TEST_KABI_ARCH kabi_dir = os.path.dirname(os.path.realpath(__file__)) @@ -55,6 +56,11 @@ class KabiTest(Test): Run kabi test case return: result """ + arch = self.command.run_cmd("uname -m")[0].strip() + if arch not in TEST_KABI_ARCH: + self.logger.info(" %s architecture does not support kabi testing." % arch) + return True + result = True os_version = getoutput( "grep openeulerversion /etc/openEuler-latest | awk -F = '{print $2}'") -- Gitee