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_Management01" 22f08c3bdfSopenharmony_ciexport TST_TOTAL=1 23f08c3bdfSopenharmony_ci 24f08c3bdfSopenharmony_ci. test.sh 25f08c3bdfSopenharmony_ci. pm_include.sh 26f08c3bdfSopenharmony_ci 27f08c3bdfSopenharmony_citest_sched_mc() { 28f08c3bdfSopenharmony_ci get_kernel_version 29f08c3bdfSopenharmony_ci get_valid_input $kernel_version 30f08c3bdfSopenharmony_ci 31f08c3bdfSopenharmony_ci invalid_input="3 4 5 6 7 8 a abcefg x1999 xffff -1 -00000 32f08c3bdfSopenharmony_ci 2000000000000000000000000000000000000000000000000000000000000000000 33f08c3bdfSopenharmony_ci ox324 -0xfffffffffffffffffffff" 34f08c3bdfSopenharmony_ci test_file="/sys/devices/system/cpu/sched_mc_power_savings" 35f08c3bdfSopenharmony_ci if [ ! -f ${test_file} ] ; then 36f08c3bdfSopenharmony_ci tst_brkm TBROK "MISSING_FILE: missing file ${test_file}" 37f08c3bdfSopenharmony_ci fi 38f08c3bdfSopenharmony_ci 39f08c3bdfSopenharmony_ci RC=0 40f08c3bdfSopenharmony_ci echo "${0}: ---Valid test cases---" 41f08c3bdfSopenharmony_ci check_input "${valid_input}" valid $test_file 42f08c3bdfSopenharmony_ci RC=$? 43f08c3bdfSopenharmony_ci echo "${0}: ---Invalid test cases---" 44f08c3bdfSopenharmony_ci check_input "${invalid_input}" invalid $test_file 45f08c3bdfSopenharmony_ci RC=$(( RC | $? )) 46f08c3bdfSopenharmony_ci return $RC 47f08c3bdfSopenharmony_ci} 48f08c3bdfSopenharmony_ci 49f08c3bdfSopenharmony_ci# Checking test environment 50f08c3bdfSopenharmony_cicheck_arch 51f08c3bdfSopenharmony_ci 52f08c3bdfSopenharmony_ci# Checking sched_mc sysfs interface 53f08c3bdfSopenharmony_cimulti_socket=$(is_multi_socket) 54f08c3bdfSopenharmony_cimulti_core=$(is_multi_core) 55f08c3bdfSopenharmony_ciif [ ! -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then 56f08c3bdfSopenharmony_ci tst_brkm TCONF "Required kernel configuration for SCHED_MC" \ 57f08c3bdfSopenharmony_ci "NOT set" 58f08c3bdfSopenharmony_cielse 59f08c3bdfSopenharmony_ci if [ $multi_socket -ne 0 -a $multi_core -ne 0 ] ; then 60f08c3bdfSopenharmony_ci tst_brkm TCONF "sched_mc_power_savings interface in system" \ 61f08c3bdfSopenharmony_ci "which is not a multi socket &(/) multi core" 62f08c3bdfSopenharmony_ci fi 63f08c3bdfSopenharmony_cifi 64f08c3bdfSopenharmony_ci 65f08c3bdfSopenharmony_ciif test_sched_mc ; then 66f08c3bdfSopenharmony_ci tst_resm TPASS "SCHED_MC sysfs tests" 67f08c3bdfSopenharmony_cielse 68f08c3bdfSopenharmony_ci tst_resm TFAIL "SCHED_MC sysfs tests" 69f08c3bdfSopenharmony_cifi 70f08c3bdfSopenharmony_ci 71f08c3bdfSopenharmony_citst_exit 72