[PATCH v3 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..5b82c2a6b 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,10 @@ net_devices_link() test_ping() { + has_cmd 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 09:17:10AM +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..5b82c2a6b 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,10 @@ net_devices_link()
test_ping() { + has_cmd ping || { + echo "no command ping, skip ping test."
Suggest use linux log format: echo "command not found: ping, skip ping test." -------- Thanks, Xijian

On Mon, Apr 26, 2021 at 11:20:08AM +0800, Xu Xijian wrote:
On Mon, Apr 26, 2021 at 09:17:10AM +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..5b82c2a6b 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -88,6 +88,10 @@ net_devices_link()
test_ping() { + has_cmd ping || { + echo "no command ping, skip ping test."
Suggest use linux log format: echo "command not found: ping, skip ping test."
Ok. Thanks, Chenglong
-------- Thanks, Xijian
participants (2)
-
Wang Chenglong
-
Xu Xijian