[PATCH lkp-tests] lib/bootstrap.sh: fix the output error when ping not exist

[Why] If the ping command exists, then run test_ping, if not, then skip. [Error] [ 179.335889] Kernel tests: Boot OK! [ 180.180309] LKP: waiting for network... [ 182.991732] /lkp/lkp/src/lib/bootstrap.sh: line 90: ping: command not found [ 183.010815] /lkp/lkp/src/lib/bootstrap.sh: line 90: ping: command not found Signed-off-by: Wang Chenglong <18509160991@163.com> --- lib/bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 070dabf46..c5b8dcd12 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,7 @@ net_devices_link() test_ping() { + [ $(command -v ping) ] || return 0 ping -c 1 -w 1 $LKP_SERVER > /dev/null } -- 2.23.0

On Sun, Apr 25, 2021 at 09:28:40AM +0800, Wang Chenglong wrote:
[Why] If the ping command exists, then run test_ping, if not, then skip.
[Error] [ 179.335889] Kernel tests: Boot OK! [ 180.180309] LKP: waiting for network... [ 182.991732] /lkp/lkp/src/lib/bootstrap.sh: line 90: ping: command not found [ 183.010815] /lkp/lkp/src/lib/bootstrap.sh: line 90: ping: command not found
Signed-off-by: Wang Chenglong <18509160991@163.com> --- lib/bootstrap.sh | 1 + 1 file changed, 1 insertion(+)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 070dabf46..c5b8dcd12 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,7 @@ net_devices_link()
test_ping() { + [ $(command -v ping) ] || return 0
you should add some logs, not just "return 0". Perhaps, when network faults, we can locate debug in time. Thanks, Liushaofei
ping -c 1 -w 1 $LKP_SERVER > /dev/null }
-- 2.23.0

On Sun, Apr 25, 2021 at 10:19:12AM +0800, Liu Shaofei wrote:
On Sun, Apr 25, 2021 at 09:28:40AM +0800, Wang Chenglong wrote:
[Why] If the ping command exists, then run test_ping, if not, then skip.
[Error] [ 179.335889] Kernel tests: Boot OK! [ 180.180309] LKP: waiting for network... [ 182.991732] /lkp/lkp/src/lib/bootstrap.sh: line 90: ping: command not found [ 183.010815] /lkp/lkp/src/lib/bootstrap.sh: line 90: ping: command not found
Signed-off-by: Wang Chenglong <18509160991@163.com> --- lib/bootstrap.sh | 1 + 1 file changed, 1 insertion(+)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 070dabf46..c5b8dcd12 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,7 @@ net_devices_link()
test_ping() { + [ $(command -v ping) ] || return 0
you should add some logs, not just "return 0". Perhaps, when network faults, we can locate debug in time.
Ok. Thanks, Chenglong
Thanks, Liushaofei
ping -c 1 -w 1 $LKP_SERVER > /dev/null }
-- 2.23.0
participants (2)
-
Liu Shaofei
-
Wang Chenglong