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_Management_exclusive01"
     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_test_cmds python
     39 
     40 hyper_threaded=$(is_hyper_threaded)
     41 multi_socket=$(is_multi_socket)
     42 multi_core=$(is_multi_core)
     43 if [ $multi_socket -ne 0 -o $multi_core -ne 0 -o \
     44 	$hyper_threaded -ne 0 ]; then
     45 	tst_brkm TCONF "System is not a multi socket & multi core" \
     46 		"& hyper-threaded"
     47 fi
     48 
     49 # Test CPU consolidation
     50 RC=0
     51 for sched_mc in `seq 0  $max_sched_mc`; do
     52 	sched_mc_pass_cnt=0
     53 	if [ $sched_mc -eq 2 ]; then
     54 		work_load="kernbench"
     55 	else
     56 		work_load="ebizzy"
     57 	fi
     58 	for repeat_test in `seq 1  10`; do
     59 		#Testcase to validate CPU consolidation for sched_mc
     60 		if pm_cpu_consolidation.py -c $sched_mc -w $work_load ; then
     61 		: $(( sched_mc_pass_cnt += 1 ))
     62 		fi
     63 	done
     64 	analyze_package_consolidation_result $sched_mc \
     65 		$sched_mc_pass_cnt; RC=$?
     66 done
     67 if [ $RC -eq 0 ]; then
     68 	tst_resm TPASS "CPU consolidation test for sched_mc"
     69 else
     70 	tst_resm TFAIL "CPU consolidation test for sched_mc"
     71 fi
     72 
     73 RC=0
     74 for sched_mc in `seq 0  $max_sched_mc`; do
     75 	if [ $sched_mc -eq 2 ]; then
     76 		work_load="kernbench"
     77 	else
     78 		work_load="ebizzy"
     79 	fi
     80 	for sched_smt in `seq 0 $max_sched_smt`; do
     81 		sched_mc_smt_pass_cnt=0
     82 		for repeat_test in `seq 1  10`; do
     83 			# Testcase to validate CPU consolidation for
     84 			# for sched_mc & sched_smt with stress=50%
     85 			if pm_cpu_consolidation.py -c $sched_mc -t $sched_smt \
     86 				-w $work_load ; then
     87 				: $(( sched_mc_smt_pass_cnt += 1 ))
     88 			fi
     89 		done
     90 		analyze_package_consolidation_result $sched_mc \
     91 			$sched_mc_smt_pass_cnt $sched_smt; RC=$?
     92 	done
     93 done
     94 if [ $RC -eq 0 ]; then
     95 	tst_resm TPASS "CPU consolidation test for sched_mc &" \
     96 		"sched_smt with stress=50%"
     97 else
     98 	tst_resm TFAIL "CPU consolidation test for sched_mc &" \
     99 		"sched_smt with stress=50%"
    100 fi
    101 
    102 tst_exit
    103