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