xref: /aosp_15_r20/external/ltp/testcases/kernel/power_management/runpwtests05.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_Management05"
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
35if ! grep sched_debug -qw /proc/cmdline ; then
36	tst_brkm TCONF "Kernel cmdline parameter 'sched_debug' needed," \
37		"CPU Consolidation test cannot run"
38fi
39
40hyper_threaded=$(is_hyper_threaded)
41if [ ! -f /sys/devices/system/cpu/sched_mc_power_savings \
42	-o $hyper_threaded -ne 0 ] ; then
43	tst_brkm TCONF "Required kernel configuration for SCHED_MC" \
44		"NOT set, or sched_mc_power_savings interface in system" \
45		"which is not hyper-threaded"
46fi
47
48# sched_domain test
49echo "max sched mc $max_sched_mc"
50RC=0
51for sched_mc in `seq 0 $max_sched_mc`; do
52	pm_sched_domain.py -c $sched_mc; ret=$?
53	analyze_sched_domain_result $sched_mc $ret; RC=$?
54done
55if [ $RC -eq 0 ]; then
56	tst_resm TPASS "Sched_domain test for sched_mc"
57else
58	tst_resm TFAIL "Sched_domain test for sched_mc"
59fi
60
61# Testcase to validate sched_domain tree
62RC=0
63for sched_mc in `seq 0 $max_sched_mc`; do
64	pm_get_sched_values sched_smt; max_sched_smt=$?
65	for sched_smt in `seq 0 $max_sched_smt`; do
66		pm_sched_domain.py -c $sched_mc -t $sched_smt; ret=$?
67		analyze_sched_domain_result $sched_mc $ret $sched_smt; RC=$?
68	done
69done
70if [ $RC -eq 0 ]; then
71	tst_resm TPASS "Sched_domain test for sched_mc & sched_smt"
72else
73	tst_resm TFAIL "Sched_domain test for sched_mc & sched_smt"
74fi
75
76tst_exit
77