1#! /bin/sh 2# 3# Copyright (c) International Business Machines Corp., 2001 4# Author: Nageswara R Sastry <nasastry@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 21export TCID="Power_Management05" 22export TST_TOTAL=2 23 24. test.sh 25. pm_include.sh 26 27# Checking test environment 28check_kervel_arch 29 30tst_kvercmp 2 6 29; rc=$? 31if [ $rc -eq 2 ] ; then 32 max_sched_mc=2 33 max_sched_smt=2 34else 35 max_sched_mc=1 36 max_sched_smt=1 37fi 38 39tst_check_cmds python 40 41if ! grep sched_debug -qw /proc/cmdline ; then 42 tst_brkm TCONF "Kernel cmdline parameter 'sched_debug' needed," \ 43 "CPU Consolidation test cannot run" 44fi 45 46hyper_threaded=$(is_hyper_threaded) 47if [ ! -f /sys/devices/system/cpu/sched_mc_power_savings \ 48 -o $hyper_threaded -ne 0 ] ; then 49 tst_brkm TCONF "Required kernel configuration for SCHED_MC" \ 50 "NOT set, or sched_mc_power_savings interface in system" \ 51 "which is not hyper-threaded" 52fi 53 54# sched_domain test 55echo "max sched mc $max_sched_mc" 56RC=0 57for sched_mc in `seq 0 $max_sched_mc`; do 58 pm_sched_domain.py -c $sched_mc; ret=$? 59 analyze_sched_domain_result $sched_mc $ret; RC=$? 60done 61if [ $RC -eq 0 ]; then 62 tst_resm TPASS "Sched_domain test for sched_mc" 63else 64 tst_resm TFAIL "Sched_domain test for sched_mc" 65fi 66 67# Testcase to validate sched_domain tree 68RC=0 69for sched_mc in `seq 0 $max_sched_mc`; do 70 pm_get_sched_values sched_smt; max_sched_smt=$? 71 for sched_smt in `seq 0 $max_sched_smt`; do 72 pm_sched_domain.py -c $sched_mc -t $sched_smt; ret=$? 73 analyze_sched_domain_result $sched_mc $ret $sched_smt; RC=$? 74 done 75done 76if [ $RC -eq 0 ]; then 77 tst_resm TPASS "Sched_domain test for sched_mc & sched_smt" 78else 79 tst_resm TFAIL "Sched_domain test for sched_mc & sched_smt" 80fi 81 82tst_exit 83