[PATCH v6 lkp-tests] tests/cci-makepkg: update gcc for centos7 when use initramfs os

Signed-off-by: Lin Jiaxin <ljx.joe@qq.com> --- tests/cci-makepkg | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/cci-makepkg b/tests/cci-makepkg index 530c9fef..905ad689 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -88,13 +88,22 @@ update_shared_pkg() echo "update shared pkg link ${benchmark}.cgz -> ${bm_name}/${cgz_name}" } +centos_update_gcc() +{ + if grep -sqF "CentOS Linux release 7" /etc/centos-release; then + [ "$os_mount" = "initramfs" ] && { + yum install -y centos-release-scl-rh + yum install -y "devtoolset-8-gcc*" + } + source /opt/rh/devtoolset-8/enable + fi +} + [ -n "$PKGBUILD_TAG" ] && download_pkgfile distro_install_depends lkp-dev -[ $os = "centos" ] && -grep -sqF "CentOS Linux release 7" /etc/centos-release && -source /opt/rh/devtoolset-8/enable +[ "$os" = "centos" ] && centos_update_gcc distro_install_depends ${benchmark}-dev -- 2.23.0

On Wed, Nov 18, 2020 at 04:06:52PM +0800, Lin Jiaxin wrote:
Signed-off-by: Lin Jiaxin <ljx.joe@qq.com> --- tests/cci-makepkg | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/tests/cci-makepkg b/tests/cci-makepkg index 530c9fef..905ad689 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -88,13 +88,22 @@ update_shared_pkg() echo "update shared pkg link ${benchmark}.cgz -> ${bm_name}/${cgz_name}" }
+centos_update_gcc() +{ + if grep -sqF "CentOS Linux release 7" /etc/centos-release; then
Typically such test can be changed to ... || return to reduce one level of indent below.
+ [ "$os_mount" = "initramfs" ] && { + yum install -y centos-release-scl-rh + yum install -y "devtoolset-8-gcc*" + } + source /opt/rh/devtoolset-8/enable + fi +} + [ -n "$PKGBUILD_TAG" ] && download_pkgfile
distro_install_depends lkp-dev
-[ $os = "centos" ] && -grep -sqF "CentOS Linux release 7" /etc/centos-release && -source /opt/rh/devtoolset-8/enable +[ "$os" = "centos" ] && centos_update_gcc
Better move the test into centos_update_gcc().
distro_install_depends ${benchmark}-dev
-- 2.23.0
participants (2)
-
Lin Jiaxin
-
Wu Fengguang