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_exclusive02"
     22 export TST_TOTAL=1
     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_smt=2
     32 else
     33 	max_sched_smt=1
     34 fi
     35 
     36 tst_check_cmds python
     37 
     38 hyper_threaded=$(is_hyper_threaded)
     39 multi_socket=$(is_multi_socket)
     40 multi_core=$(is_multi_core)
     41 if [ $hyper_threaded -ne 0 -o $multi_socket -ne 0 \
     42 	-o $multi_core -eq 0 ]; then
     43 	tst_brkm TCONF "System is a multi core but not multi" \
     44 		"socket & hyper-threaded"
     45 fi
     46 
     47 #Testcase to validate consolidation at core level
     48 RC=0
     49 for sched_smt in `seq 0 $max_sched_smt`; do
     50 	if [ $sched_smt -eq 2 ]; then
     51 		work_load="kernbench"
     52 	else
     53 		work_load="ebizzy"
     54 	fi
     55 	sched_smt_pass_cnt=0
     56 	stress="thread"
     57 	for repeat_test in `seq 1  10`; do
     58 		if pm_cpu_consolidation.py -t $sched_smt -w $work_load \
     59 			-s $stress; then
     60 			: $(( sched_smt_pass_cnt += 1 ))
     61 		fi
     62 	done
     63 	analyze_core_consolidation_result $sched_smt \
     64 		$sched_smt_pass_cnt; RC=$?
     65 done
     66 if [ $RC -eq 0 ]; then
     67     tst_resm TPASS "Consolidation test at core level for sched_smt"
     68 else
     69     tst_resm TFAIL "Consolidation test at core level for sched_smt"
     70 fi
     71 
     72 tst_exit
     73