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