From 3609831b65abcef0346291305eab8ab6dcd56ceb Mon Sep 17 00:00:00 2001 From: cxhong Date: Tue, 11 Jun 2019 11:12:55 -0400 Subject: [PATCH] Add verification test case for copycds --- xCAT-test/autotest/testcase/copycds/cases0 | 2 ++ .../autotest/testcase/copycds/copycds.sh | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 xCAT-test/autotest/testcase/copycds/copycds.sh diff --git a/xCAT-test/autotest/testcase/copycds/cases0 b/xCAT-test/autotest/testcase/copycds/cases0 index b1d796fd5..02e88d4df 100644 --- a/xCAT-test/autotest/testcase/copycds/cases0 +++ b/xCAT-test/autotest/testcase/copycds/cases0 @@ -9,6 +9,8 @@ check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($ check:output=~Media copy operation successful cmd:ls /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__ check:rc==0 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/copycds/copycds.sh __GETNODEATTR($$CN,os)__ +check:rc==0 end start:lskmodules_o diff --git a/xCAT-test/autotest/testcase/copycds/copycds.sh b/xCAT-test/autotest/testcase/copycds/copycds.sh new file mode 100755 index 000000000..f7e04f842 --- /dev/null +++ b/xCAT-test/autotest/testcase/copycds/copycds.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +if [[ -z ${1} ]]; then + echo "ERROR, pass in the '\$OS' variable as the second argument" + exit 1 +fi +OS=${1} + +if [[ $OS != *"rhels"* ]]; then + echo "INFO: will not run this test for $OS" + exit 0 +fi + +MAJOR_OS_VER=${OS%.*} +if [[ $OS == *"$MAJOR_OS_VER"* ]]; then + IFS=' +' + for image in `lsdef -t osimage -i template -c | grep $OS | grep "install"`; do + THE_NAME=`echo $image | cut -d' ' -f1` + THE_TEMPLATE=`echo $image | cut -d' ' -f2` + TEMPLATE_FILE=`echo $THE_TEMPLATE | cut -d= -f2` + + if [[ $TEMPLATE_FILE != *"$MAJOR_OS_VER"* ]]; then + echo "ERROR - template attribute not set correctly when copycds for $THE_NAME" + echo -e "ERROR - $TEMPLATE_FILE" + exit 1 + else + echo "Template file looks good for $THE_NAME" + echo -e "\t$THE_TEMPLATE" + fi + done +fi + +exit 0