Modifed test_sched_mc interface testing testcase to use reusable function.
Signed-off-by: poornima nayak <[email protected]>
diff -uprN ltp_orig/testcases/kernel/power_management/test_sched_mc.sh
ltp/testcases/kernel/power_management/test_sched_mc.sh
--- ltp_orig/testcases/kernel/power_management/test_sched_mc.sh 2009-04-17
16:32:36.000000000 -0400
+++ ltp/testcases/kernel/power_management/test_sched_mc.sh 2009-04-17
17:00:25.000000000 -0400
@@ -2,44 +2,21 @@
. pm_include.sh
-valid_input="0 1"
-invalid_input="a 2 abcefg x1999 xffff -1 -00000
200000000000000000000000000000000000000000000000000000000000000000000000000000
ox324 -0xfffffffffffffffffffff"
+valid_input="0 1 2"
+invalid_input="a abcefg x1999 xffff -1 -00000
+200000000000000000000000000000000000000000000000000000000000000000000000000000
+ox324 -0xfffffffffffffffffffff"
test_file="/sys/devices/system/cpu/sched_mc_power_savings"
if [ ! -f ${test_file} ] ; then
echo "MISSING_FILE: missing file ${test_file}"
exit $MISSING_FILE
fi
-function check_input() {
- validity_check=${2:-valid}
- if [ "${validity_check}" = "invalid" ] ; then
- PASS="Testcase FAIL - Able to execute"
- FAIL="Testcase PASS - Unable to execute"
- else
- PASS="Testcase PASS"
- FAIL="Testcase FAIL"
- fi
- for input in ${1}
- do
- echo ${input} > ${test_file} 2>/dev/null
- return_value=$?
- output=$(cat ${test_file})
- if [ "${return_value}" = "0" -a "${input}" = "${output}" ] ;
then
- echo "${0}: ${PASS}: echo ${input} > ${test_file}"
- if [ "${validity_check}" = "invalid" ] ; then
- RC=1
- fi
- else
- echo "${0}: ${FAIL}: echo ${input} > ${test_file}"
- if [ "${validity_check}" = "valid" ] ; then
- RC=1
- fi
- fi
- done
-}
RC=0
echo "${0}: ---Valid test cases---"
-check_input "${valid_input}"
+check_input "${valid_input}" valid $test_file
+RC=$?
echo "${0}: ---Invalid test cases---"
-check_input "${invalid_input}" invalid
+check_input "${invalid_input}" invalid $test_file
+RC=$(( RC | $? ))
exit $RC
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list