Description of problem: kernel-selftests测试hid.hid-gamepad.sh和hid.hid-sony.sh失败,ImportError: cannot import name 'AsusGamepad' from 'hidtools.device.base_gamepad' 日志如下: # ./hid-sony.sh + KSELFTEST_SKIP_TEST=4 + command -v python3 + python3 -c 'import pytest' + python3 -c 'import pytest_tap' + python3 -c 'import hidtools' + TARGET=test_sony.py + echo TAP version 13 TAP version 13 + python3 -u -m pytest ./tests/test_sony.py --tap-stream --udevd 1..0 单独执行python3 -u -m pytest ./tests/test_sony.py日志如下: # python3 -u -m pytest ./tests/test_sony.py =========================================================== test session starts ============================================================ platform linux -- Python 3.11.6, pytest-8.4.1, pluggy-1.6.0 rootdir: /var/tmp/tone/run/kernel-selftests/hid plugins: tap-3.5 collected 0 items / 1 error ================================================================== ERRORS ================================================================== ___________________________________________________ ERROR collecting tests/test_sony.py ____________________________________________________ ImportError while importing test module '/var/tmp/tone/run/kernel-selftests/hid/tests/test_sony.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib64/python3.11/importlib/__init__.py:126: in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tests/test_sony.py:10: in <module> from .test_gamepad import BaseTest tests/test_gamepad.py:12: in <module> from hidtools.device.base_gamepad import AsusGamepad, SaitekGamepad E ImportError: cannot import name 'AsusGamepad' from 'hidtools.device.base_gamepad' (/usr/lib/python3.11/site-packages/hidtools/device/base_gamepad.py) ========================================================= short test summary info ========================================================== ERROR tests/test_sony.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ============================================================= 1 error in 0.13s ============================================================= How reproducible: 必现 Steps to Reproduce: wget 内核对应src.rpm包 rpm -ivh xxx.src.rpm 默认安装到/root下 yum install yum-utils yum-builddep -y /root/rpmbuild/SPECS/kernel.spec 自动安装前置依赖包 需要yum-utils rpmbuild -bp /root/rpmbuild/SPECS/kernel.spec # 这个步骤会打相关的patch, 解压缩tar包,生成BUILD目录 cd /root/rpmbuild/BUILD/kernel-*/linux-* make -C tools/testing/selftests/ cd /root/rpmbuild/BUILD/kernel-*/linux-*/tools/testing/selftests/hid make ././hid-sony.sh Actual results: 用例执行失败 Expected results: 用例执行pass Additional info: [环境信息] ECS # uname -r 6.6.88-cbp.git.8c112c479.an23.aarch64 # free -h total used free shared buff/cache available Mem: 15Gi 884Mi 8.2Gi 7.2Mi 6.2Gi 14Gi Swap: 0B 0B 0B # lscpu Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 48 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Vendor ID: ARM BIOS Vendor ID: Alibaba Cloud Model name: Neoverse-N1 BIOS Model name: virt-rhel7.6.0 CPU @ 2.0GHz BIOS CPU family: 1 Model: 1 Thread(s) per core: 1 Core(s) per cluster: 4 Socket(s): 1 Cluster(s): 1 Stepping: r3p1 BogoMIPS: 50.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp NUMA: NUMA node(s): 1 NUMA node0 CPU(s): 0-3 Vulnerabilities: Gather data sampling: Not affected Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Reg file data sampling: Not affected Retbleed: Not affected Spec rstack overflow: Not affected Spec store bypass: Not affected Spectre v1: Mitigation; __user pointer sanitization Spectre v2: Mitigation; CSV2, but not BHB Srbds: Not affected Tsx async abort: Not affected
hid-gamepad.sh用例也存在同样的问题,日志如下: # ./hid-gamepad.sh + export TARGET=test_gamepad.py + TARGET=test_gamepad.py + bash ./run-hid-tools-tests.sh + KSELFTEST_SKIP_TEST=4 + command -v python3 + python3 -c 'import pytest' + python3 -c 'import pytest_tap' + python3 -c 'import hidtools' + TARGET=test_gamepad.py + echo TAP version 13 TAP version 13 + python3 -u -m pytest ./tests/test_gamepad.py --tap-stream --udevd 1..0 # python3 -u -m pytest ./tests/test_gamepad.py =========================================================== test session starts ============================================================ platform linux -- Python 3.11.6, pytest-8.4.1, pluggy-1.6.0 rootdir: /var/tmp/tone/run/kernel-selftests/hid plugins: tap-3.5 collected 0 items / 1 error ================================================================== ERRORS ================================================================== __________________________________________________ ERROR collecting tests/test_gamepad.py __________________________________________________ ImportError while importing test module '/var/tmp/tone/run/kernel-selftests/hid/tests/test_gamepad.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib64/python3.11/importlib/__init__.py:126: in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tests/test_gamepad.py:12: in <module> from hidtools.device.base_gamepad import AsusGamepad, SaitekGamepad E ImportError: cannot import name 'AsusGamepad' from 'hidtools.device.base_gamepad' (/usr/lib/python3.11/site-packages/hidtools/device/base_gamepad.py) ========================================================= short test summary info ========================================================== ERROR tests/test_gamepad.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ============================================================= 1 error in 0.12s =============================================================