On Dec 24, 2009, at 10:15 AM, Poornima Nayak <[email protected]> wrote:
> Patch to enable Power management testcases in LTP to run on Power > platform > > Signed-off-by: poornima nayak <[email protected]> > > diff -uprN ltp-intermediate-20091209.orig/testcases/kernel/ > power_management/runpwtests.sh ltp-intermediate-20091209.fixes/ > testcases/kernel/power_management/runpwtests.sh > --- ltp-intermediate-20091209.orig/testcases/kernel/power_management/ > runpwtests.sh 2009-12-09 13:18:25.000000000 +0530 > +++ ltp-intermediate-20091209.fixes/testcases/kernel/ > power_management/runpwtests.sh 2009-12-24 23:16:39.859044825 +0530 > @@ -28,10 +28,21 @@ > # History: 26 Aug 2008 - Created this file > # 03 Nov 2008 - Added CPUIDLE sysfs testcase > # > +# Function: main > +# > +# Description: - Execute all tests, exit with test status. > +# > +# Exit: - zero on success > +# - non-zero on failure. > +# > + > +#List of reusable functions defined in pm_include.sh > +. ./pm_include.sh > + > +RC=0 #Return status > > # Exporting Required variables > export TST_TOTAL=1 > -#LTPTMP=${TMP} > export PATH=${PATH}:. > export TCID="Power_Management" > export TST_COUNT=0 > @@ -40,48 +51,39 @@ export analysis="/proctstat" > > YES=0 > NO=1 > -#List of reusable functions defined in pm_include.sh > -. ./pm_include.sh > - > -# Function: main > -# > -# Description: - Execute all tests, exit with test status. > -# > -# Exit: - zero on success > -# - non-zero on failure. > -# > -RC=0 #Return status > > # Checking required kernel version and architecture > tst_kvercmp 2 6 21; rc=$? > if [ $rc -ne 1 -a $rc -ne 2 ] ; then > - tst_resm TCONF "Kernel version not supported; not running > testcases" > - exit 0 > + tst_resm TCONF "Kernel version not supported; not running > testcases" > + exit 0 > else > - case "$(uname -m)" in > - i[4-6]86|x86_64) > + case "$(uname -m)" in > + i[4-6]86|x86_64) > + ;; > + powerpc|ppc|powerpc64|ppc64) > ;; > - *) > - tst_resm TCONF "Arch not supported; not running testcases" > - exit 0 > - ;; > - esac > + *) > + tst_resm TCONF "Arch not supported; not running > testcases" > + exit 0 > + ;; > + esac > fi > > tst_kvercmp 2 6 29; rc=$? > if [ $rc -eq 2 ] ; then > - max_sched_mc=2 > - max_sched_smt=2 > + max_sched_mc=2 > + max_sched_smt=2 > else > - max_sched_mc=1 > - max_sched_smt=1 > + max_sched_mc=1 > + max_sched_smt=1 > fi > > tst_kvercmp 2 6 31; rc=$? > if [ $rc -eq 1 -o $rc -eq 2 ] ; then > - timer_migr_support_compatible=1 > + timer_migr_support_compatible=0 > else > - timer_migr_support_compatible=0 > + timer_migr_support_compatible=1 > fi Why did you invert the logic here? $? => 0 says the kernel version is less, 1 that it's equal, and 2 that it's greater than the version specified. > is_hyper_threaded; hyper_threaded=$? > @@ -90,7 +92,6 @@ is_multi_core; multi_core=$? > is_dual_core; dual_core=$? > > #Checking sched_mc sysfs interface > -#check_config.sh config_sched_mc || RC=$? > TST_COUNT=1 > if [ $multi_socket -eq $YES -a $multi_core -eq $YES ] ; then > if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then > @@ -103,6 +104,25 @@ if [ $multi_socket -eq $YES -a $multi_co > else > tst_resm TCONF "Required kernel configuration for SCHED_MC > NOT set" > fi > + > + : $(( TST_COUNT+=1)) > + if [ -f /proc/sys/kernel/timer_migration ]; then > + if [ $timer_migr_support_compatible -eq $YES ]; then > + if test_timer_migration.sh; then > + tst_resm TPASS "Timer Migration interface test" > + else > + RC=$? > + tst_resm TFAIL "Timer migration interface test" > + fi > + fi > + else > + if [ $supp -eq $YES ]; then > + RC=$? > + tst_resm TFAIL "Timer migration interface missing" > + else > + tst_resm TCONF "Kernel version does not support Timer > migration" > + fi > + fi > else > if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then > tst_resm TFAIL "sched_mc_power_savings interface in system > which is not a multi socket &(/) multi core" > @@ -135,7 +155,6 @@ else > fi > > # Checking cpufreq sysfs interface files > -#check_config.sh config_cpu_freq || RC=$? > : $(( TST_COUNT += 1 )) > if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then > if check_cpufreq_sysfs_files.sh; then > @@ -187,12 +206,13 @@ else > fi > > # sched_domain test > -if ! type python > /dev/null ; then > +which python > /dev/null > +if [ $? -ne 0 ] ; then type is a bourne shell builtin whereas which is a command. Furthermore, you can inline shell true / false checks in branch conditionals. So why did you revert this? > tst_resm TCONF "Python is not installed, CPU Consoldation\ > test cannot run" > else > if [ -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then > - echo "max sched mc $max_sched_mc" > + get_sched_values sched_mc; max_sched_mc=$? > for sched_mc in `seq 0 $max_sched_mc`; do > : $(( TST_COUNT+=1)) > sched_domain.py -c $sched_mc; RC=$? > @@ -210,25 +230,6 @@ else > fi > fi > > -: $(( TST_COUNT+=1)) > -if [ -f /proc/sys/kernel/timer_migration ]; then > - if [ $timer_migr_support_compatible -eq $YES ]; then > - if test_timer_migration.sh; then > - tst_resm TPASS "Timer Migration interface test" > - else > - RC=$? > - tst_resm TFAIL "Timer migration interface test" > - fi > - fi > -else > - if [ $timer_migr_support_compatible -eq $YES ]; then > - RC=$? > - tst_resm TFAIL "Timer migration interface missing" > - else > - tst_resm TCONF "Kernel version does not support Timer > migration" > - fi > -fi > - > if [ $# -gt 0 -a "$1" = "-exclusive" ]; then Sorry for not noticing this sooner. $1 and -exclusive should be prefixed by a character, e.g. x or this will be reported as a [(1) syntax error. > > # Test CPU consolidation > if [ $multi_socket -eq $YES -a $multi_core -eq $YES ]; then > @@ -266,7 +267,7 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; > > fi > > - if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES -a > $multi_core -eq $NO ]; then > + if [ $hyper_threaded -eq $YES ]; then > #Testcase to validate consolidation at core level > for sched_smt in `seq 0 $max_sched_smt`; do > if [ $sched_smt -eq 2 ]; then > @@ -319,7 +320,7 @@ if [ $# -gt 0 -a "$1" = "-exclusive" ]; > fi > > # Verify threads consolidation stops when sched_smt is disabled > in HT systems > - if [ $hyper_threaded -eq $YES -a $multi_socket -eq $YES ]; then > + if [ $hyper_threaded -eq $YES ]; then > # Vary only sched_smt from 1 to 0 when workload is running > and ensure that > # tasks do not consolidate to single core when sched_smt is > set to 0 > : $(( TST_COUNT += 1 )) Thanks, -Garrett ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
