diff --git a/README.en.md b/README.en.md index b653c08826c7d6a96bc721dce07c68d5994c3d51..96ffce913475d25b1e366055dc561df68b719096 100644 --- a/README.en.md +++ b/README.en.md @@ -144,6 +144,7 @@ oec-hardware-1.1.1 is no longer updated or maintained. Obtain the latest oec-har | | https://github.com/NVIDIA/cuda-samples/archive/refs/heads/master.zip | `/opt` | | VGPU | NVIDIA vGPU client driver | `/root` | | | Download the VM image file of the corresponding version and architecture. The following uses openEuler 22.03 LTS in x86_64 as an example: https://repo.openeuler.org/openEuler-22.03-LTS/virtual_machine_img/x86_64/openEuler-22.03-LTS-x86_64.qcow2.xz | `/opt` | + | kabiwhitelist | The current architecture's kabi white list file (kabi_whitelist_ $arch), ko or rpm file to be tested | /root | # Tool Installation diff --git a/README.md b/README.md index 8184e5aa37ef6822e8935321cfbd5c0a286d8e75..7c5fc2e18db5f4c562f5c28436c3bc30dfb21795 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ oec-hardware工具发布新版本后,社区将只针对最新版本进行维 | | https://github.com/NVIDIA/cuda-samples/archive/refs/heads/master.zip | `/opt` | | VGPU | NVIDIA vgpu client驱动软件包 | /root | | | 下载对应版本和架构的虚拟机镜像文件,此处以openEuler 22.03LTS、x86_64为例:https://repo.openeuler.org/openEuler-22.03-LTS/virtual_machine_img/x86_64/openEuler-22.03-LTS-x86_64.qcow2.xz | `/opt` | + | kabiwhitelist | 当前架构的kabi白名单文件(kabi_whitelist_$arch)、待测ko或rpm文件 | /root | # 工具安装 diff --git a/docs/design_docs/dev_design.md b/docs/design_docs/dev_design.md index 54439a37831fb1790a0faac9b8934f1c021de3ca..f2635acbe17fbcce87a2662baa530841823d2699 100644 --- a/docs/design_docs/dev_design.md +++ b/docs/design_docs/dev_design.md @@ -308,7 +308,17 @@ infiniband: device: ibp1s0 client_ip: server_ip: - ``` +# kabiwhitelist是用于检查核外驱动是否符合openEuler社区kabi白名单。核外驱动是指非内核自带的硬件驱动,一般通过源码编译安装,或者rpm二进制文件安装的硬件驱动。 +# 一般来讲,系统安装完成后,通过手动方式安装的硬件驱动需要执行该测试项。如果不存在此类驱动,可跳过该测试项。 +# 配置待测ko或rpm文件,并将待测ko或rpm文件以及当前架构的kabi白名单文件(kabi_whitelist_$arch)放入/root目录下。 +kabiwhitelist: + ko1: + ko_name: '' + ko2: + ko_name: '' + rpm: + rpm_name: '' +``` ### 3.5 内部模块间接口清单 diff --git a/oec-hardware.spec b/oec-hardware.spec index 8b4a84b303f774c7a520a865098fb9f935e20e66..45c5ebd56e311a60677d34a261cfd8358aa63eb8 100644 --- a/oec-hardware.spec +++ b/oec-hardware.spec @@ -3,6 +3,8 @@ %define debug_package %{nil} %global _build_id_links none %undefine __brp_mangle_shebangs +%define vendor %{?_vendor:%{_vendor}}%{!?_vendor:openEuler} +%define vendor_lowercase %{?_vendor:%(echo %{_vendor} | tr '[:upper:]' '[:lower:]')}%{!?_vendor:openeuler} Name: oec-hardware Summary: openEuler Hardware Compatibility Test Suite @@ -46,6 +48,9 @@ DESTDIR=$RPM_BUILD_ROOT VERSION_RELEASE=%{version} make %install DESTDIR=$RPM_BUILD_ROOT make install +# Custom vendor +sed -i 's#grep openeulerversion /etc/openEuler-latest#grep %{vendor_lowercase}version /etc/%{vendor}-latest#g' %{buildroot}/usr/share/oech/lib/hwcompatible/cert_info.py + %clean [ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT; diff --git a/tests/compatible/gpu/nvidia_gpu.py b/tests/compatible/gpu/nvidia_gpu.py index 7860db220c61e66e9629758f0a8923520d516997..ca4f344214763d00ce10093dd618ed3323ea2ac4 100644 --- a/tests/compatible/gpu/nvidia_gpu.py +++ b/tests/compatible/gpu/nvidia_gpu.py @@ -176,7 +176,7 @@ class NvidiaGpuTest(): self.logger.error("Using nvidia-smi to test Drvier failed.") env_display = os.getenv('DISPLAY') - if env_display != '': + if env_display is not None and env_display != '': self.logger.info("Start to test Vulkan.") self.set_default_gpu() code = self.command.run_cmd( diff --git a/tests/compatible/kabi/kabi.py b/tests/compatible/kabi/kabi.py index c6a7a7b51410322efd401bb5e4ce5e712d6c66d8..6692186033a7440488f80f809460637d0c054f04 100644 --- a/tests/compatible/kabi/kabi.py +++ b/tests/compatible/kabi/kabi.py @@ -121,8 +121,8 @@ class KabiTest(Test): if product == "openEuler": standard_kernel_version = getoutput( "dnf list --repo=source | grep '^kernel.src' | awk '{print $2}'") - self.command.run_cmd("dnf download --source kernel-%s" - % standard_kernel_version) + self.command.run_cmd("dnf download --source kernel-%s --downloaddir %s" + % (standard_kernel_version, rpmpath)) elif product == "KylinSec": kylinsec_version = getoutput("cat /etc/dnf/vars/osversion | sed 's/[^0-9]//g'") kernel_dict = Document(CertEnv.kernelinfo, self.logger) @@ -138,7 +138,7 @@ class KabiTest(Test): self.logger.info("Currently, this system is not supported to test kabi," " Please add the corresponding system in kernelrelease.json.") - rpm = os.path.join("kernel-" + standard_kernel_version + ".src.rpm") + rpm = os.path.join(rpmpath, "kernel-" + standard_kernel_version + ".src.rpm") getoutput("rpm -ivh %s" % rpm) os.remove(rpm) return standard_symvers diff --git a/tests/compatible/kabiwhitelist/kabi_check.sh b/tests/compatible/kabiwhitelist/kabi_check.sh index 16f7987914ffe58561bc8a40f69d542c183bd548..f3beb7b2cea56d58e55730c41b52235fe6fc8ff3 100644 --- a/tests/compatible/kabiwhitelist/kabi_check.sh +++ b/tests/compatible/kabiwhitelist/kabi_check.sh @@ -19,6 +19,10 @@ os_version=`cat /etc/openEuler-latest|grep openeulerversion |awk -F = '{print $2 arch=`uname -m` url="https://gitee.com/src-openeuler/kernel/raw/$os_version/kabi_whitelist_$arch" wget $url +# if get kabi_whitelist failed because of internet or other +if [ ! -f $testdir"/kabi_whitelist_"$arch ]; then + cp /root/kabi_whitelist_$arch $testdir/ +fi kernel_version=`uname -r` symvers_gz="symvers-"$kernel_version".gz" cp /boot/$symvers_gz /usr/share/oech/lib/tests/compatible/kabiwhitelist/test_log @@ -103,6 +107,9 @@ do if [ -f /root/$line ]; then cp /root/$line ./ echo $line >> dirth + else + echo "no ko or rpm file" >> nofile.txt + exit 0 fi done cat dirth|while read line; diff --git a/tests/compatible/kabiwhitelist/kabiwhitelist.py b/tests/compatible/kabiwhitelist/kabiwhitelist.py index 8eba68cb137ee4d0c0a999016941ce24210e203e..5b6c03534f61cc7dadcf79fd7c408482a2bfeb4b 100644 --- a/tests/compatible/kabiwhitelist/kabiwhitelist.py +++ b/tests/compatible/kabiwhitelist/kabiwhitelist.py @@ -46,6 +46,10 @@ class KabiWhiteListTest(Test): if ko_result[2] == 0: self.logger.error("Please configure the board information in the configuration file") return False + ko_file_result = self.command.run_cmd("ls %s/test_log/ | grep nofile" % kabi_whitelist_dir) + if ko_file_result[2] == 0: + self.logger.error("Please put ko or rpm file configured in the configuration file into the /root") + return False self.logger.info("Ko or rpm check complete") test_result = self.command.run_cmd("ls %s/test_log | grep change" % kabi_whitelist_dir) diff --git a/tests/compatible/system/system.py b/tests/compatible/system/system.py index 3c29e40943fcca415f59ff7394aafa91571d1b01..cd31a1d3a0100b229bf2cdcc56b63fcd27a64f95 100644 --- a/tests/compatible/system/system.py +++ b/tests/compatible/system/system.py @@ -94,6 +94,8 @@ class SystemTest(Test): os_version = getoutput("cat /etc/os-release | grep -i version_id | awk -F = '{print $2}' | sed 's/[\"]//g'") elif product == "UOS": os_version = getoutput("cat /etc/os-release | grep -i version_id | awk -F = '{print $2}' | sed 's/[\"]//g'") + elif self.sysinfo.product is not None and self.sysinfo.get_version() is not None: + os_version = self.sysinfo.product + " " + self.sysinfo.get_version() else: self.logger.error("Failed to get os version info.") self.logger.info("OS Version: %s" % os_version, terminal_print=False) @@ -115,6 +117,8 @@ class SystemTest(Test): kernel_release = kernel_dict.document[product][os_version].split('/')[1].split('-')[0] elif product == "UOS": kernel_release = kernel_dict.document[product][os_version].split('/')[1].split('-')[0] + elif kernel_dict.document[product] is not None and kernel_dict.document[product][os_version] is not None: + kernel_release = kernel_dict.document[product][os_version] try: if kernel_release != self.sysinfo.kernel_version: self.logger.error("Failed to check kernel %s GA status." %