[PATCH v2 lkp-tests] tests: fix error when running host-info in vm

Error: Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory Signed-off-by: Zhang Yu <2134782174@qq.com> --- tests/host-info | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/host-info b/tests/host-info index 0ab8e6c97..d1d0df449 100755 --- a/tests/host-info +++ b/tests/host-info @@ -102,11 +102,9 @@ get_ipmi_ip() # 802.1q VLAN ID : Disabled # RMCP+ Cipher Suites : 0,1,2,3,17 # Cipher Suite Priv Max : XuuaXXXXXXXXXXX - is_virt && return - is_docker && return + [ -e /dev/ipmi0 ] || [ -e /dev/ipmi/0 ] || [ -e /dev/ipmidev/0 ] && return local ip=$(ipmitool lan print | awk 'NR==3{print $4}') [ -n "$ip" ] && echo "ipmi_ip: $ip" - } main() -- 2.23.0

On Wed, Dec 16, 2020 at 05:39:32PM +0800, Zhang Yu wrote:
Error: Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
Signed-off-by: Zhang Yu <2134782174@qq.com> --- tests/host-info | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tests/host-info b/tests/host-info index 0ab8e6c97..d1d0df449 100755 --- a/tests/host-info +++ b/tests/host-info @@ -102,11 +102,9 @@ get_ipmi_ip() # 802.1q VLAN ID : Disabled # RMCP+ Cipher Suites : 0,1,2,3,17 # Cipher Suite Priv Max : XuuaXXXXXXXXXXX - is_virt && return - is_docker && return + [ -e /dev/ipmi0 ] || [ -e /dev/ipmi/0 ] || [ -e /dev/ipmidev/0 ] && return
This style will return when all files do not exist Thanks, Baijing
local ip=$(ipmitool lan print | awk 'NR==3{print $4}') [ -n "$ip" ] && echo "ipmi_ip: $ip" - }
main() -- 2.23.0

On Thu, Dec 17, 2020 at 01:19:57PM +0800, Bai Jing wrote:
On Wed, Dec 16, 2020 at 05:39:32PM +0800, Zhang Yu wrote:
Error: Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
Signed-off-by: Zhang Yu <2134782174@qq.com> --- tests/host-info | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tests/host-info b/tests/host-info index 0ab8e6c97..d1d0df449 100755 --- a/tests/host-info +++ b/tests/host-info @@ -102,11 +102,9 @@ get_ipmi_ip() # 802.1q VLAN ID : Disabled # RMCP+ Cipher Suites : 0,1,2,3,17 # Cipher Suite Priv Max : XuuaXXXXXXXXXXX - is_virt && return - is_docker && return + [ -e /dev/ipmi0 ] || [ -e /dev/ipmi/0 ] || [ -e /dev/ipmidev/0 ] && return
This style will return when all files do not exist
ok
Thanks, Baijing
local ip=$(ipmitool lan print | awk 'NR==3{print $4}') [ -n "$ip" ] && echo "ipmi_ip: $ip" - }
main() -- 2.23.0
participants (2)
-
Bai Jing
-
Zhang Yu