1f08c3bdfSopenharmony_ci#! /bin/sh
2f08c3bdfSopenharmony_ci#
3f08c3bdfSopenharmony_ci# Copyright (c) International Business Machines  Corp., 2001
4f08c3bdfSopenharmony_ci# Author: Nageswara R Sastry <nasastry@in.ibm.com>
5f08c3bdfSopenharmony_ci#
6f08c3bdfSopenharmony_ci# This program is free software;  you can redistribute it and#or modify
7f08c3bdfSopenharmony_ci# it under the terms of the GNU General Public License as published by
8f08c3bdfSopenharmony_ci# the Free Software Foundation; either version 2 of the License, or
9f08c3bdfSopenharmony_ci# (at your option) any later version.
10f08c3bdfSopenharmony_ci#
11f08c3bdfSopenharmony_ci# This program is distributed in the hope that it will be useful, but
12f08c3bdfSopenharmony_ci# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13f08c3bdfSopenharmony_ci# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14f08c3bdfSopenharmony_ci# for more details.
15f08c3bdfSopenharmony_ci#
16f08c3bdfSopenharmony_ci# You should have received a copy of the GNU General Public License
17f08c3bdfSopenharmony_ci# along with this program;  if not, write to the Free Software Foundation,
18f08c3bdfSopenharmony_ci# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19f08c3bdfSopenharmony_ci#
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_ciexport TCID="Power_Management_exclusive02"
22f08c3bdfSopenharmony_ciexport TST_TOTAL=1
23f08c3bdfSopenharmony_ci
24f08c3bdfSopenharmony_ci. test.sh
25f08c3bdfSopenharmony_ci. pm_include.sh
26f08c3bdfSopenharmony_ci
27f08c3bdfSopenharmony_ci# Checking test environment
28f08c3bdfSopenharmony_cicheck_arch
29f08c3bdfSopenharmony_ci
30f08c3bdfSopenharmony_cimax_sched_smt=2
31f08c3bdfSopenharmony_ci
32f08c3bdfSopenharmony_citst_require_cmds python3
33f08c3bdfSopenharmony_ci
34f08c3bdfSopenharmony_cihyper_threaded=$(is_hyper_threaded)
35f08c3bdfSopenharmony_cimulti_socket=$(is_multi_socket)
36f08c3bdfSopenharmony_cimulti_core=$(is_multi_core)
37f08c3bdfSopenharmony_ciif [ $hyper_threaded -ne 0 -o $multi_socket -ne 0 \
38f08c3bdfSopenharmony_ci	-o $multi_core -eq 0 ]; then
39f08c3bdfSopenharmony_ci	tst_brkm TCONF "System is a multi core but not multi" \
40f08c3bdfSopenharmony_ci		"socket & hyper-threaded"
41f08c3bdfSopenharmony_cifi
42f08c3bdfSopenharmony_ci
43f08c3bdfSopenharmony_ci#Testcase to validate consolidation at core level
44f08c3bdfSopenharmony_ciRC=0
45f08c3bdfSopenharmony_cifor sched_smt in `seq 0 $max_sched_smt`; do
46f08c3bdfSopenharmony_ci	if [ $sched_smt -eq 2 ]; then
47f08c3bdfSopenharmony_ci		work_load="kernbench"
48f08c3bdfSopenharmony_ci	else
49f08c3bdfSopenharmony_ci		work_load="ebizzy"
50f08c3bdfSopenharmony_ci	fi
51f08c3bdfSopenharmony_ci	sched_smt_pass_cnt=0
52f08c3bdfSopenharmony_ci	stress="thread"
53f08c3bdfSopenharmony_ci	for repeat_test in `seq 1  10`; do
54f08c3bdfSopenharmony_ci		if pm_cpu_consolidation.py -t $sched_smt -w $work_load \
55f08c3bdfSopenharmony_ci			-s $stress; then
56f08c3bdfSopenharmony_ci			: $(( sched_smt_pass_cnt += 1 ))
57f08c3bdfSopenharmony_ci		fi
58f08c3bdfSopenharmony_ci	done
59f08c3bdfSopenharmony_ci	analyze_core_consolidation_result $sched_smt \
60f08c3bdfSopenharmony_ci		$sched_smt_pass_cnt; RC=$?
61f08c3bdfSopenharmony_cidone
62f08c3bdfSopenharmony_ciif [ $RC -eq 0 ]; then
63f08c3bdfSopenharmony_ci    tst_resm TPASS "Consolidation test at core level for sched_smt"
64f08c3bdfSopenharmony_cielse
65f08c3bdfSopenharmony_ci    tst_resm TFAIL "Consolidation test at core level for sched_smt"
66f08c3bdfSopenharmony_cifi
67f08c3bdfSopenharmony_ci
68f08c3bdfSopenharmony_citst_exit
69