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_exclusive05"
22f08c3bdfSopenharmony_ciexport TST_TOTAL=2
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_mc=2
31f08c3bdfSopenharmony_cimax_sched_smt=2
32f08c3bdfSopenharmony_ci
33f08c3bdfSopenharmony_citst_require_cmds python3
34f08c3bdfSopenharmony_ci
35f08c3bdfSopenharmony_cihyper_threaded=$(is_hyper_threaded)
36f08c3bdfSopenharmony_cimulti_socket=$(is_multi_socket)
37f08c3bdfSopenharmony_cimulti_core=$(is_multi_core)
38f08c3bdfSopenharmony_ciif [ $multi_socket -ne 0 -o $multi_core -ne 0 -o \
39f08c3bdfSopenharmony_ci	$hyper_threaded -ne 0 ]; then
40f08c3bdfSopenharmony_ci	tst_brkm TCONF "System is not a multi socket & multi core" \
41f08c3bdfSopenharmony_ci		"& hyper-threaded"
42f08c3bdfSopenharmony_cifi
43f08c3bdfSopenharmony_ci
44f08c3bdfSopenharmony_ci# Verify ILB runs in same package as workload.
45f08c3bdfSopenharmony_ciRC=0
46f08c3bdfSopenharmony_cifor sched_mc in `seq 1 $max_sched_mc`; do
47f08c3bdfSopenharmony_ci	if [ $sched_mc -eq 2 ]; then
48f08c3bdfSopenharmony_ci		work_load="kernbench"
49f08c3bdfSopenharmony_ci	else
50f08c3bdfSopenharmony_ci		work_load="ebizzy"
51f08c3bdfSopenharmony_ci	fi
52f08c3bdfSopenharmony_ci
53f08c3bdfSopenharmony_ci	pm_ilb_test.py -c $sched_mc -w $work_load
54f08c3bdfSopenharmony_ci	if [ $? -eq 0 ]; then
55f08c3bdfSopenharmony_ci		echo "Test PASS: ILB & workload in same package for" \
56f08c3bdfSopenharmony_ci			"sched_mc=$sched_mc"
57f08c3bdfSopenharmony_ci	else
58f08c3bdfSopenharmony_ci		RC=1
59f08c3bdfSopenharmony_ci		echo "Test FAIL: ILB & workload did not run in same package" \
60f08c3bdfSopenharmony_ci			"for sched_mc=$sched_mc. Ensure CONFIG_NO_HZ is set"
61f08c3bdfSopenharmony_ci	fi
62f08c3bdfSopenharmony_cidone
63f08c3bdfSopenharmony_ciif [ $RC -eq 0 ]; then
64f08c3bdfSopenharmony_ci	tst_resm TPASS "ILB & workload test in same package for sched_mc"
65f08c3bdfSopenharmony_cielse
66f08c3bdfSopenharmony_ci	tst_resm TFAIL "ILB & workload test in same package for sched_mc"
67f08c3bdfSopenharmony_cifi
68f08c3bdfSopenharmony_ci
69f08c3bdfSopenharmony_ciRC=0
70f08c3bdfSopenharmony_cifor sched_mc in `seq 1 $max_sched_mc`; do
71f08c3bdfSopenharmony_ci	if [ $sched_mc -eq 2 ]; then
72f08c3bdfSopenharmony_ci		work_load="kernbench"
73f08c3bdfSopenharmony_ci	else
74f08c3bdfSopenharmony_ci		work_load="ebizzy"
75f08c3bdfSopenharmony_ci	fi
76f08c3bdfSopenharmony_ci	for sched_smt in `seq 1 $max_sched_smt`; do
77f08c3bdfSopenharmony_ci		pm_ilb_test.py -c $sched_mc -t sched_smt -w $work_load
78f08c3bdfSopenharmony_ci		if [ $? -eq 0 ]; then
79f08c3bdfSopenharmony_ci			echo "Test PASS: ILB & workload in same package for" \
80f08c3bdfSopenharmony_ci				"sched_mc=$sched_mc & sched_smt=$sched_smt"
81f08c3bdfSopenharmony_ci		else
82f08c3bdfSopenharmony_ci			RC=1
83f08c3bdfSopenharmony_ci			echo "Test FAIL: ILB & workload did not execute in" \
84f08c3bdfSopenharmony_ci				"same package for sched_mc=$sched_mc &" \
85f08c3bdfSopenharmony_ci				"sched_smt=$sched_smt. Ensure CONFIG_NO_HZ is set"
86f08c3bdfSopenharmony_ci		fi
87f08c3bdfSopenharmony_ci	done
88f08c3bdfSopenharmony_cidone
89f08c3bdfSopenharmony_ciif [ $RC -eq 0 ]; then
90f08c3bdfSopenharmony_ci	tst_resm TPASS "ILB & workload test in same package for" \
91f08c3bdfSopenharmony_ci		"sched_mc & sched_smt"
92f08c3bdfSopenharmony_cielse
93f08c3bdfSopenharmony_ci	tst_resm TFAIL "ILB & workload test in same package for" \
94f08c3bdfSopenharmony_ci		"sched_mc & sched_smt"
95f08c3bdfSopenharmony_cifi
96f08c3bdfSopenharmony_ci
97f08c3bdfSopenharmony_citst_exit
98