From 03876bb1cd0e792fd92d8b78cdc71414f8eac79e Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 31 Jul 2017 15:43:53 +0800 Subject: [PATCH] Make the cuda installation test case to search for the binary packages automatically --- .../cuda/rhel-cuda-diskfull-install.sh | 116 +++++++++++++++--- .../cuda/rhel-cuda-diskless-install.sh | 94 ++++++++++++-- 2 files changed, 185 insertions(+), 25 deletions(-) diff --git a/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskfull-install.sh b/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskfull-install.sh index ebc1f7cc1..83645da90 100755 --- a/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskfull-install.sh +++ b/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskfull-install.sh @@ -3,21 +3,103 @@ ######## # Set all the variables below +LINUX_DISTRO="rhels7.4" +LINUX_ARCH="ppc64le" + COMPUTE_NODE="c910f03c01p10" -OSIMAGE_NAME="rhels7.3-ppc64le-install-cudafull" -OSIMAGE_OTHERPKGDIR="/install/post/otherpkgs/rhels7.3/ppc64le" -SOURCE_BASEDIR="/media/xcat" +SOURCE_DIR="/media/xcat" -RHEL_ISO="${SOURCE_BASEDIR}/RHEL-7.3-20161019.0-Server-ppc64le-dvd1.iso" -CUDA_RPMS=( - "${SOURCE_BASEDIR}/cuda-repo-rhel7-8-0-local-ga2v2-8.0.61-1.ppc64le.rpm" - "${SOURCE_BASEDIR}/cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.ppc64le.rpm" -) -DKMS_RPM="${SOURCE_BASEDIR}/dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm" - -# Set all the variables above ######## +# $SOURCE_DIR is a directory this test case will be searched for. +# Files with the name looked like the following will be searched. +# +# -rw-r--r-- 1 nobody nobody 124064759 Jun 28 16:58 cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.ppc64le.rpm +# -rw-r--r-- 1 nobody nobody 1331397445 Feb 10 18:17 cuda-repo-rhel7-8-0-local-ga2v2-8.0.61-1.ppc64le.rpm +# -rw-r--r-- 1 nobody nobody 79404 Jul 27 01:20 dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm +# -rwxrwxrwx 2 nobody nobody 3283865600 Jul 27 23:21 RHEL-7.4-20170711.0-Server-ppc64le-dvd1.iso + +######## +# Auto detect all the source packages from the ${SOURCE_DIR} + +[ -d "${SOURCE_DIR}" ] +[ "$?" -ne "0" ] && echo "Directory ${SOURCE_DIR} not found." >&2 && exit 1 + +declare RHEL_ISO +declare -a CUDA_RPMS +declare DKMS_RPM + +for f in "${SOURCE_DIR}"/* +do + r="$(realpath "${f}")" + [ -f "${r}" ] || continue + case "${r##*/}" in + "RHEL-"*"-"*"-Server-${LINUX_ARCH}-dvd1.iso") + RHEL_ISO="${r}" + ;; + "cuda-repo-rhel"*"-"*"-local-"*".${LINUX_ARCH}.rpm") + if [[ "$(echo "${r##*/}" | + sed -e 's#.*\([0-9]\+.[0-9]\+.[0-9]\+-[0-9]\+\).*#\1#')" \ + > \ + "$(echo "${CUDA_RPMS[0]}" | + sed -e 's#.*\([0-9]\+.[0-9]\+.[0-9]\+-[0-9]\+\).*#\1#')" ]] + then + CUDA_RPMS=("${r}") + elif [[ "$(echo "${r##*/}" | + sed -e 's#.*\([0-9]\+.[0-9]\+.[0-9]\+-[0-9]\+\).*#\1#')" \ + = \ + "$(echo "${CUDA_RPMS[0]}" | + sed -e 's#.*\([0-9]\+.[0-9]\+.[0-9]\+-[0-9]\+\).*#\1#')" ]] + then + CUDA_RPMS+=("${r}") + fi + ;; + "dkms-"*".el7.noarch.rpm") + DKMS_RPM="${r}" + ;; + esac +done + +######## +# Override the auto detect results here. + +#RHEL_ISO="${SOURCE_DIR}/RHEL-7.4-20170711.0-Server-ppc64le-dvd1.iso" +#CUDA_RPMS=( +# "${SOURCE_DIR}/cuda-repo-rhel7-8-0-local-ga2v2-8.0.61-1.ppc64le.rpm" +# "${SOURCE_DIR}/cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.ppc64le.rpm" +#) +#DKMS_RPM="${SOURCE_DIR}/dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm" + +######## +echo "Red Hat Enterprise Linux Server ISO" +echo "===================================" +echo "${RHEL_ISO}" +echo +echo "CUDA RPM(s)" +echo "===========" +for f in "${CUDA_RPMS[@]}" +do + echo "${f}" +done +echo +echo "DKMS RPM" +echo "========" +echo "${DKMS_RPM}" +echo + +echo "The files listed above were found and will be used for this test case" +echo "Press Ctrl-C to abort!" +for t in {5..1} +do + echo -n " ... ${t}" + sleep 1 + echo -n -e "\b\b\b\b\b\b" +done +######## + +OSIMAGE_NAME="${LINUX_DISTRO}-${LINUX_ARCH}-install-cudafull" +OSIMAGE_OTHERPKGDIR="/install/post/otherpkgs/${LINUX_DISTRO}/${LINUX_ARCH}" + [ -f "${RHEL_ISO}" ] [ "$?" -ne "0" ] && echo "File ${RHEL_ISO} not found." >&2 && exit 1 copycds "${RHEL_ISO}" @@ -30,16 +112,16 @@ mkdef -z <<-EOF ${OSIMAGE_NAME}: objtype=osimage imagetype=linux - osarch=ppc64le - osdistroname=rhels7.3-ppc64le + osarch=${LINUX_ARCH} + osdistroname=${LINUX_DISTRO}-${LINUX_ARCH} osname=Linux - osvers=rhels7.3 + osvers=${LINUX_DISTRO} otherpkgdir="${OSIMAGE_OTHERPKGDIR}" - pkgdir=/install/rhels7.3/ppc64le - pkglist=/opt/xcat/share/xcat/install/rh/cudafull.rhels7.ppc64le.pkglist + pkgdir=/install/${LINUX_DISTRO}/${LINUX_ARCH} + pkglist=/opt/xcat/share/xcat/install/rh/cudafull.${LINUX_DISTRO%%.*}.${LINUX_ARCH}.pkglist profile=compute provmethod=install - template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + template=/opt/xcat/share/xcat/install/rh/compute.${LINUX_DISTRO%%.*}.tmpl EOF [ "$?" -ne "0" ] && echo "Make node definition failed." >&2 && exit 1 diff --git a/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskless-install.sh b/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskless-install.sh index 8ee0c7a64..1e9eeafc5 100755 --- a/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskless-install.sh +++ b/xCAT-test/autotest/testcase/cuda/rhel-cuda-diskless-install.sh @@ -7,16 +7,94 @@ LINUX_DISTRO="rhels7.4" LINUX_ARCH="ppc64le" COMPUTE_NODE="c910f03c01p10" -SOURCE_BASEDIR="/media/xcat" +SOURCE_DIR="/media/xcat" -RHEL_ISO="${SOURCE_BASEDIR}/RHEL-7.4-20170711.0-Server-ppc64le-dvd1.iso" -CUDA_RPMS=( - "${SOURCE_BASEDIR}/cuda-repo-rhel7-8-0-local-ga2v2-8.0.61-1.ppc64le.rpm" - "${SOURCE_BASEDIR}/cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.ppc64le.rpm" -) -DKMS_RPM="${SOURCE_BASEDIR}/dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm" +######## -# Set all the variables above +# $SOURCE_DIR is a directory this test case will be searched for. +# Files with the name looked like the following will be searched. +# +# -rw-r--r-- 1 nobody nobody 124064759 Jun 28 16:58 cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.ppc64le.rpm +# -rw-r--r-- 1 nobody nobody 1331397445 Feb 10 18:17 cuda-repo-rhel7-8-0-local-ga2v2-8.0.61-1.ppc64le.rpm +# -rw-r--r-- 1 nobody nobody 79404 Jul 27 01:20 dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm +# -rwxrwxrwx 2 nobody nobody 3283865600 Jul 27 23:21 RHEL-7.4-20170711.0-Server-ppc64le-dvd1.iso + +######## +# Auto detect all the source packages from the ${SOURCE_DIR} + +[ -d "${SOURCE_DIR}" ] +[ "$?" -ne "0" ] && echo "Directory ${SOURCE_DIR} not found." >&2 && exit 1 + +declare RHEL_ISO +declare -a CUDA_RPMS +declare DKMS_RPM + +for f in "${SOURCE_DIR}"/* +do + r="$(realpath "${f}")" + [ -f "${r}" ] || continue + case "${r##*/}" in + "RHEL-"*"-"*"-Server-${LINUX_ARCH}-dvd1.iso") + RHEL_ISO="${r}" + ;; + "cuda-repo-rhel"*"-"*"-local-"*".${LINUX_ARCH}.rpm") + if [[ "$(echo "${r##*/}" | + sed -e 's#.*\([0-9]\+.[0-9]\+.[0-9]\+-[0-9]\+\).*#\1#')" \ + > \ + "$(echo "${CUDA_RPMS[0]}" | + sed -e 's#.*\([0-9]\+.[0-9]\+.[0-9]\+-[0-9]\+\).*#\1#')" ]] + then + CUDA_RPMS=("${r}") + elif [[ "$(echo "${r##*/}" | + sed -e 's#.*\([0-9]\+.[0-9]\+.[0-9]\+-[0-9]\+\).*#\1#')" \ + = \ + "$(echo "${CUDA_RPMS[0]}" | + sed -e 's#.*\([0-9]\+.[0-9]\+.[0-9]\+-[0-9]\+\).*#\1#')" ]] + then + CUDA_RPMS+=("${r}") + fi + ;; + "dkms-"*".el7.noarch.rpm") + DKMS_RPM="${r}" + ;; + esac +done + +######## +# Override the auto detect results here. + +#RHEL_ISO="${SOURCE_DIR}/RHEL-7.4-20170711.0-Server-ppc64le-dvd1.iso" +#CUDA_RPMS=( +# "${SOURCE_DIR}/cuda-repo-rhel7-8-0-local-ga2v2-8.0.61-1.ppc64le.rpm" +# "${SOURCE_DIR}/cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.ppc64le.rpm" +#) +#DKMS_RPM="${SOURCE_DIR}/dkms-2.3-5.20170523git8c3065c.el7.noarch.rpm" + +######## +echo "Red Hat Enterprise Linux Server ISO" +echo "===================================" +echo "${RHEL_ISO}" +echo +echo "CUDA RPM(s)" +echo "===========" +for f in "${CUDA_RPMS[@]}" +do + echo "${f}" +done +echo +echo "DKMS RPM" +echo "========" +echo "${DKMS_RPM}" +echo + +echo "The files listed above were found and will be used for this test case" +echo "Press Ctrl-C to abort!" +for t in {5..1} +do + echo -n " ... ${t}" + sleep 1 + echo -n -e "\b\b\b\b\b\b" +done ######## OSIMAGE_NAME="${LINUX_DISTRO}-${LINUX_ARCH}-netboot-cudafull"