xref: /aosp_15_r20/external/ltp/testcases/kernel/power_management/runpwtests_exclusive01.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1#! /bin/sh
2#
3# Copyright (c) International Business Machines  Corp., 2001
4# Author: Nageswara R Sastry <[email protected]>
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_arch
29
30max_sched_mc=2
31max_sched_smt=2
32
33tst_require_cmds python3
34
35hyper_threaded=$(is_hyper_threaded)
36multi_socket=$(is_multi_socket)
37multi_core=$(is_multi_core)
38if [ $multi_socket -ne 0 -o $multi_core -ne 0 -o \
39	$hyper_threaded -ne 0 ]; then
40	tst_brkm TCONF "System is not a multi socket & multi core" \
41		"& hyper-threaded"
42fi
43
44# Test CPU consolidation
45RC=0
46for sched_mc in `seq 0  $max_sched_mc`; do
47	sched_mc_pass_cnt=0
48	if [ $sched_mc -eq 2 ]; then
49		work_load="kernbench"
50	else
51		work_load="ebizzy"
52	fi
53	for repeat_test in `seq 1  10`; do
54		#Testcase to validate CPU consolidation for sched_mc
55		if pm_cpu_consolidation.py -c $sched_mc -w $work_load ; then
56		: $(( sched_mc_pass_cnt += 1 ))
57		fi
58	done
59	analyze_package_consolidation_result $sched_mc \
60		$sched_mc_pass_cnt; RC=$?
61done
62if [ $RC -eq 0 ]; then
63	tst_resm TPASS "CPU consolidation test for sched_mc"
64else
65	tst_resm TFAIL "CPU consolidation test for sched_mc"
66fi
67
68RC=0
69for sched_mc in `seq 0  $max_sched_mc`; do
70	if [ $sched_mc -eq 2 ]; then
71		work_load="kernbench"
72	else
73		work_load="ebizzy"
74	fi
75	for sched_smt in `seq 0 $max_sched_smt`; do
76		sched_mc_smt_pass_cnt=0
77		for repeat_test in `seq 1  10`; do
78			# Testcase to validate CPU consolidation for
79			# for sched_mc & sched_smt with stress=50%
80			if pm_cpu_consolidation.py -c $sched_mc -t $sched_smt \
81				-w $work_load ; then
82				: $(( sched_mc_smt_pass_cnt += 1 ))
83			fi
84		done
85		analyze_package_consolidation_result $sched_mc \
86			$sched_mc_smt_pass_cnt $sched_smt; RC=$?
87	done
88done
89if [ $RC -eq 0 ]; then
90	tst_resm TPASS "CPU consolidation test for sched_mc &" \
91		"sched_smt with stress=50%"
92else
93	tst_resm TFAIL "CPU consolidation test for sched_mc &" \
94		"sched_smt with stress=50%"
95fi
96
97tst_exit
98