Home | History | Annotate | Download | only in power_management
      1 #! /bin/sh
      2 #
      3 # Copyright (c) International Business Machines  Corp., 2001
      4 # Author: Nageswara R Sastry <nasastry (at] in.ibm.com>
      5 #
      6 # This program is free software;  you can redistribute it and#or modify
      7 # it under the terms of the GNU General Public License as published by
      8 # the Free Software Foundation; either version 2 of the License, or
      9 # (at your option) any later version.
     10 #
     11 # This program is distributed in the hope that it will be useful, but
     12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     13 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     14 # for more details.
     15 #
     16 # You should have received a copy of the GNU General Public License
     17 # along with this program;  if not, write to the Free Software Foundation,
     18 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     19 #
     20 
     21 export TCID="Power_Management05"
     22 export TST_TOTAL=2
     23 
     24 . test.sh
     25 . pm_include.sh
     26 
     27 # Checking test environment
     28 check_kervel_arch
     29 
     30 if tst_kvcmp -gt "2.6.29"; then
     31 	max_sched_mc=2
     32 	max_sched_smt=2
     33 else
     34 	max_sched_mc=1
     35 	max_sched_smt=1
     36 fi
     37 
     38 tst_check_cmds python
     39 
     40 if ! grep sched_debug -qw /proc/cmdline ; then
     41 	tst_brkm TCONF "Kernel cmdline parameter 'sched_debug' needed," \
     42 		"CPU Consolidation test cannot run"
     43 fi
     44 
     45 hyper_threaded=$(is_hyper_threaded)
     46 if [ ! -f /sys/devices/system/cpu/sched_mc_power_savings \
     47 	-o $hyper_threaded -ne 0 ] ; then
     48 	tst_brkm TCONF "Required kernel configuration for SCHED_MC" \
     49 		"NOT set, or sched_mc_power_savings interface in system" \
     50 		"which is not hyper-threaded"
     51 fi
     52 
     53 # sched_domain test
     54 echo "max sched mc $max_sched_mc"
     55 RC=0
     56 for sched_mc in `seq 0 $max_sched_mc`; do
     57 	pm_sched_domain.py -c $sched_mc; ret=$?
     58 	analyze_sched_domain_result $sched_mc $ret; RC=$?
     59 done
     60 if [ $RC -eq 0 ]; then
     61 	tst_resm TPASS "Sched_domain test for sched_mc"
     62 else
     63 	tst_resm TFAIL "Sched_domain test for sched_mc"
     64 fi
     65 
     66 # Testcase to validate sched_domain tree
     67 RC=0
     68 for sched_mc in `seq 0 $max_sched_mc`; do
     69 	pm_get_sched_values sched_smt; max_sched_smt=$?
     70 	for sched_smt in `seq 0 $max_sched_smt`; do
     71 		pm_sched_domain.py -c $sched_mc -t $sched_smt; ret=$?
     72 		analyze_sched_domain_result $sched_mc $ret $sched_smt; RC=$?
     73 	done
     74 done
     75 if [ $RC -eq 0 ]; then
     76 	tst_resm TPASS "Sched_domain test for sched_mc & sched_smt"
     77 else
     78 	tst_resm TFAIL "Sched_domain test for sched_mc & sched_smt"
     79 fi
     80 
     81 tst_exit
     82