[PATCH v2 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 070dabf46..c699b40e4 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,10 @@ net_devices_link() test_ping() { + [ $(command -v ping) ] || { + echo "no command ping, skip ping test." + return 0 + } ping -c 1 -w 1 $LKP_SERVER > /dev/null } -- 2.23.0

On Mon, Apr 26, 2021 at 08:51:29AM +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 | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 070dabf46..c699b40e4 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,10 @@ net_devices_link()
test_ping() { + [ $(command -v ping) ] || {
you can use has_cmd in env.sh Thanks, Yong

On Mon, Apr 26, 2021 at 09:13:39AM +0800, Wang Yong wrote:
On Mon, Apr 26, 2021 at 08:51:29AM +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 | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 070dabf46..c699b40e4 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,10 @@ net_devices_link()
test_ping() { + [ $(command -v ping) ] || {
you can use has_cmd in env.sh
ok. Thanks, Chenglong
Thanks, Yong
participants (2)
-
Wang Chenglong
-
Wang Yong