export RESULT="PASS"
echo -e "-----start testing-----" | tee -a ${OUTPUTFILE}
num=`/usr/bin/getconf _NPROCESSORS_ONLN`
echo -e "cpu num " $num |tee -a ${OUTPUTFILE}
for i in `seq 1 $num` ;do
echo $i | tee -a ${OUTPUTFILE}
./busy 2>&1 |tee -a ${OUTPUTFILE} &
done
echo -e "powertop record" | tee -a ${OUTPUTFILE}
powertop -d -t 60 |tee busy.output |tee -a ${OUTPUTFILE}
echo -e "powertop record finished" | tee -a ${OUTPUTFILE}
# analys
if grep -q "C0 (cpu running)" busy.output ;then
str=`grep "C0 (cpu running)" busy.output | awk '{print $4}'`
str=${str%%.*}
num=${str##(}
echo -e "get the num: " $num | tee -a ${OUTPUTFILE}
if [ $num -lt 95 ];then
echo -e "the value of C0 is low:" $val | tee -a ${OUTPUTFILE}
RESULT="FAIL"
fi
else
echo -e "can't show C state" |tee -a ${OUTPUTFILE}
result="FAIL"
fi
if grep -q "P-states (frequencies)" busy.output ;then
val=`sed -n -e '/P-states/{n;p}' busy.output | awk '{print $3}'`
val=${val%.*}
echo -e "the value of p-high-state is" $val | tee -a ${OUTPUTFILE}
if [ $val -lt 95 ];then
echo -e "the value of p-high-state is low:" $val | tee -a ${OUTPUTFILE}
RESULT="FAIL"
fi
else
echo -e "No P-states " | tee -a ${OUTPUTFILE}
RESULT="FAIL"
fi
if grep -q "Wakeups-from-idle per second" busy.output ;then
value=`grep "Wakeups-from-idle per second" busy.output | awk '{print $5}'`
value=${value%.*}
echo -e "Wakeup-from-idle per second:" $value | tee -a ${OUTPUTFILE}
if [ $value -ne 0 ] ;then
echo -e "the value not equal to 0" | tee -a ${OUTPUTFILE}
RESULT="FAIL"
fi
else
echo -e "No Wakeups-from-idle" | tee -a ${OUTPUTFILE}
RESULT="FAIL"
fi
echo -e "finish testing" | tee -a ${OUTPUTFILE}
rm -f busy.output
killall busy
if [ "${result}" = "PASS" ]
then
report_result ${TEST} ${RESULT}
else
report_result ${TEST} ${RESULT} 1
fi
阅读(1010) | 评论(0) | 转发(0) |