2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 01:26:38 +00:00

modify rvitals testcase for issue:3184

This commit is contained in:
junxiawang 2017-06-13 11:21:13 -04:00
parent 0580e8d02a
commit 0f3411ae36
2 changed files with 68 additions and 22 deletions

View File

@ -18,9 +18,8 @@ end
start:rvitals_temp
description:Retrieves temperatures
Attribute: $$CN-The operation object of rvitals command
cmd:rvitals $$CN temp
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN temp
check:rc==0
check:output=~System Temperature|Ambient Temp|temperature
end
start:rvitals_disktemp
@ -46,17 +45,15 @@ end
start:rvitals_voltage
description:Retrieves power supply and VRM voltage readings
Attribute: $$CN-The operation object of rvitals command
cmd:rvitals $$CN voltage
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN voltage
check:rc==0
check:output=~Frame Voltages|CPU VDD Volt|SysBrd
end
start:rvitals_power
description:Retrieves power status
Attribute: $$CN-The operation object of rvitals command
cmd:rvitals $$CN power
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN power
check:rc==0
check:output=~Current Power Status:\s*(on|off)|Power Status:\s*(on|off)
end
start:rvitals_state
@ -79,12 +76,8 @@ end
start:rvitals_all
description:Retrieves all status
Attribute: $$CN-The operation object of rvitals command
cmd:rvitals $$CN all
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN all
check:rc==0
check:output=~System Temperature|Ambient Temp
check:output=~Frame Voltages|CPU VDD Volt|SysBrd
check:output=~Current Power Status:\s*(on|off)|Power Status:\s*(on|off)
check:output=~ System State:|System Event:|NMI State
end
start:rvitals_leds
@ -98,34 +91,28 @@ end
start:rvitals_fanspeed
description:Retrieves fan speeds.
Attribute: $$CN-The operation object of rvitals command
cmd:rvitals $$CN fanspeed
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN fanspeed
check:rc==0
check:output=~Fan|Fan\s*\d:\s*\w+\s*RPM
end
start:rvitals_wattage
description:Retrieves wattage readings.
Attribute: $$CN-The operation object of rvitals command
cmd:rvitals $$CN wattage
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN wattage
check:rc==0
check:output=~12V Sense|AC Avg Power
check:output=~Mem Cache Power|MEM Avg Power
end
start:rvitals_altitude
description:Retrieves altitude readings.
Attribute: $$CN-The operation object of rvitals command
cmd:rvitals $$CN altitude
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN altitude
check:rc==0
check:output=~No attributes returned from the BMC
end
start:rvitals_noderange_err
description:using not defined node
cmd:rvitals testnode
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals testnode
check:rc!=0
check:output=~Error
end
start:rvitals_errorcommand
description:using wrong command
cmd: rvitals $$CN errorcommand
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/rvitals/openbmctest.sh rvitals $$CN errorcommand
check:rc!=0
check:output=~Unrecognized rvitals arguments
end

View File

@ -0,0 +1,59 @@
#!/bin/bash
function test_openbmccommand()
{
node_number=0;
number=0;
if [[ $1 ]]&&[[ $2 ]]&&[[ $3 ]];then
`$1 $2 $3 >/tmp/openbmccommand.test`;
if [[ $? -eq 0 ]];then
echo right command;
number=`awk 'END{print NR}' /tmp/openbmccommand.test`
echo number is $number
`cat /tmp/openbmccommand.test |awk -F : '{print $1}' > /tmp/openbmccommand.test1`
for i in `cat /tmp/openbmccommand.test1`
do
echo $i
if [[ $i == $2 ]];then
node_number=1;
else
echo no than more node checkeid
node_number=2;
fi
done
if [[ $node_number -eq 1 ]];then
`cat /tmp/openbmccommand.test |awk -F : '{print $2}'> /tmp/openbmccommand.test2`
if [[ $number -eq 1 ]]&&[[ `awk -F "" '{for(i=1;i<=NF;++i) if($i==":") ++sum}END{print sum}' /tmp/openbmccommand.test` -eq 1 ]];then
if [[ `cat /tmp/openbmccommand.test` =~ "No attributes returned from the BMC" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No mprom information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No deviceid information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No uuid information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No guid information is available" ]];then
echo "No attributes"
return 0;
else
return 1;
fi
else
if [[ `cat /tmp/openbmccommand.test2` =~ "No attributes returned from the BMC" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No mprom information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No deviceid information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No uuid information is available" ]]||[[ `cat /tmp/openbmccommand.test` =~ "No guid information is available" ]];then
echo "wrong return"
return 1;
else
echo "right return"
return 0
fi
fi
else
if [[ $node_number -eq 2 ]];then
return 0;
fi
fi
else
return 1;
fi
else
return 1;
fi
}
test_openbmccommand $1 $2 $3
if [[ $? -eq 0 ]];then
exit 0;
else
exit 1;
fi