From eac2932826d2cf62083dbc2fe60ecbce28342dfd Mon Sep 17 00:00:00 2001 From: litingt Date: Wed, 16 Jan 2019 02:43:34 -0500 Subject: [PATCH 1/3] Add test case for issue 4511 : rflash -d did not support relative paths --- .../autotest/testcase/rflash/rflash_openbmc.0 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 index e53d25715..0d247ac85 100644 --- a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 +++ b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 @@ -524,3 +524,23 @@ check:rc != 0 check:output =~~$$CN\s*:\s*(\[.*?\]: )?Error: Deleting currently active BMC firmware is not supported end +start:rflash_d_relative_path +description:this case is to check if -d support relative directory path. This case is for issue 4511. +os:Linux +hcp:openbmc +label:cn_bmc_ready,hctrl_openbmc +cmd:lsdef testnode;if [ $? -eq 0 ]; then lsdef -l testnode -z >/tmp/testnode.standa ; rmdef testnode;fi +cmd:mkdef -t node -o testnode groups=all arch=ppc64le bmc=testnode-bmc bmcvlantag=11 cons=openbmc mgt=openbmc +check:rc == 0 +cmd:dir="/tmp/rflashdir";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi +cmd:mkdir -p /tmp/rflashdir;touch /tmp/rflashdir/witherspoon.pnor.squashfs.tar +cmd:cd /tmp;rflash testnode ./rflashdir -d +check:rc != 0 +check:output =~~testnode\s*:\s*Error:\s*Unable to resolved ip address for bmc:\s*testnode-bmc +cmd:dir="/tmp/rflashnotexist/";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi +cmd:cd /tmp;rflash testnode ./rflashnotexist -d +check:rc != 0 +check:output =~~testnode\s*:\s*Error:\s*Invalid option specified with -d:\s*./rflashnotexist +cmd:dir="/tmp/rflashnotexist"; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi +cmd:dir="/tmp/rflashdir"; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi +end From 5c8b82cd49170531064203855207bb8c96a813d0 Mon Sep 17 00:00:00 2001 From: litingt Date: Wed, 16 Jan 2019 21:29:19 -0500 Subject: [PATCH 2/3] update according to comments --- xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 index 0d247ac85..9c86c0bae 100644 --- a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 +++ b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 @@ -536,11 +536,15 @@ cmd:dir="/tmp/rflashdir";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi cmd:mkdir -p /tmp/rflashdir;touch /tmp/rflashdir/witherspoon.pnor.squashfs.tar cmd:cd /tmp;rflash testnode ./rflashdir -d check:rc != 0 -check:output =~~testnode\s*:\s*Error:\s*Unable to resolved ip address for bmc:\s*testnode-bmc +check:output =~Error:\s*\[.*?\]:\s*No BMC tar file found in ./rflashdir +check:output =~Error:\s*\[.*?\]:\s*No Host tar file found in ./rflashdir +check:output =~testnode\s*:\s*Error:\s*Unable to resolved ip address for bmc:\s*testnode-bmc cmd:dir="/tmp/rflashnotexist/";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi cmd:cd /tmp;rflash testnode ./rflashnotexist -d check:rc != 0 -check:output =~~testnode\s*:\s*Error:\s*Invalid option specified with -d:\s*./rflashnotexist +check:output =~testnode\s*:\s*Error:\s*Invalid option specified with -d:\s*./rflashnotexist cmd:dir="/tmp/rflashnotexist"; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi cmd:dir="/tmp/rflashdir"; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi +cmd:rmdef -t node -o testnode +check:rc == 0 end From bb0a82f91ed52faed04bf1cfed056eda80ed653f Mon Sep 17 00:00:00 2001 From: litingt Date: Thu, 17 Jan 2019 01:30:42 -0500 Subject: [PATCH 3/3] add node definition restore --- xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 index 9c86c0bae..5cbefb419 100644 --- a/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 +++ b/xCAT-test/autotest/testcase/rflash/rflash_openbmc.0 @@ -547,4 +547,5 @@ cmd:dir="/tmp/rflashnotexist"; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; cmd:dir="/tmp/rflashdir"; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi cmd:rmdef -t node -o testnode check:rc == 0 +cmd:if [ -e /tmp/testnode.standa ]; then cat /tmp/testnode.standa | mkdef -z; rm -rf /tmp/testnode.standa; fi end