1#! /bin/sh 2# 3# Copyright (c) International Business Machines Corp., 2001 4# Author: Nageswara R Sastry <nasastry@in.ibm.com> 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_Management02" 22export TST_TOTAL=1 23 24. test.sh 25. pm_include.sh 26 27test_sched_smt() { 28 get_kernel_version 29 get_valid_input $kernel_version 30 31 invalid_input="3 4 5 6 7 8 a abcefg x1999 xffff -1 -00000 32 2000000000000000000000000000000000000000000000000000000000000000000000 33 ox324 -0xfffffffffffffffffffff" 34 test_file="/sys/devices/system/cpu/sched_smt_power_savings" 35 if [ ! -f ${test_file} ] ; then 36 tst_brkm TBROK "MISSING_FILE: missing file ${test_file}" 37 fi 38 39 echo "${0}: ---Valid test cases---" 40 check_input "${valid_input}" valid $test_file 41 RC=$? 42 echo "${0}: ---Invalid test cases---" 43 check_input "${invalid_input}" invalid $test_file 44 RC=$(( RC | $? )) 45 return $RC 46} 47 48# Checking test environment 49check_kervel_arch 50 51# Check sched_smt_power_savings interface on HT machines 52hyper_threaded=$(is_hyper_threaded) 53if [ ! -f /sys/devices/system/cpu/sched_smt_power_savings ] ; then 54 tst_brkm TCONF "Required kernel configuration for SCHED_SMT NOT set" 55else 56 if [ $hyper_threaded -ne 0 ]; then 57 tst_brkm TCONF "sched_smt_power_saving interface in system" \ 58 "not hyper-threaded" 59 fi 60fi 61 62if test_sched_smt ; then 63 tst_resm TPASS "SCHED_SMT sysfs test" 64else 65 tst_resm TFAIL "SCHED_SMT sysfs test" 66fi 67 68tst_exit 69