[PATCH lkp-tests] lib/bootstrap.sh: avoid the problem caused by the lack of ruby pkg

[Why] We use $LKP_SRC/sbin/adapt-packages to find the ntpdate pkg suitable for different systems. But we are not sure that ruby is pre-installed in each system. So add a check, if ruby is not pre-installed, return. Signed-off-by: Yu Chuan <13186087857@163.com> --- lib/bootstrap.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 30e4af828bcd..d4b41f3bd0d5 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -244,6 +244,10 @@ run_ntpdate() echo "[WARNING] Current os cannot be recognized by lkp-test, so skip run_ntpdate." return } + has_cmd ruby || { + echo "[WARNING] Cannot find ruby in $DISTRO, so skip run_ntpdate." + return + } . $LKP_SRC/distro/installer/$DISTRO $(echo ntpdate | $LKP_SRC/sbin/adapt-packages $DISTRO) } -- 2.23.0

On Wed, Jan 06, 2021 at 06:31:51PM +0800, Yu Chuan wrote:
[Why] We use $LKP_SRC/sbin/adapt-packages to find the ntpdate pkg suitable for different systems. But we are not sure that ruby is pre-installed in each system.
Well that is really bad -- the LKP framework scripts shall only rely on /bin/sh in order to run on small systems.
So add a check, if ruby is not pre-installed, return.
Signed-off-by: Yu Chuan <13186087857@163.com> --- lib/bootstrap.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 30e4af828bcd..d4b41f3bd0d5 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -244,6 +244,10 @@ run_ntpdate() echo "[WARNING] Current os cannot be recognized by lkp-test, so skip run_ntpdate." return } + has_cmd ruby || { + echo "[WARNING] Cannot find ruby in $DISTRO, so skip run_ntpdate." + return + }
Don't even try to install ntpdate. Just skip running it if not available. Thanks, Fengguang
. $LKP_SRC/distro/installer/$DISTRO $(echo ntpdate | $LKP_SRC/sbin/adapt-packages $DISTRO) }
-- 2.23.0
participants (2)
-
Wu Fengguang
-
Yu Chuan