xref: /aosp_15_r20/external/ltp/testcases/kernel/power_management/runpwtests06.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker#! /bin/sh
2*49cdfc7eSAndroid Build Coastguard Worker#
3*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) International Business Machines  Corp., 2001
4*49cdfc7eSAndroid Build Coastguard Worker# Author: Nageswara R Sastry <[email protected]>
5*49cdfc7eSAndroid Build Coastguard Worker#
6*49cdfc7eSAndroid Build Coastguard Worker# This program is free software;  you can redistribute it and#or modify
7*49cdfc7eSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by
8*49cdfc7eSAndroid Build Coastguard Worker# the Free Software Foundation; either version 2 of the License, or
9*49cdfc7eSAndroid Build Coastguard Worker# (at your option) any later version.
10*49cdfc7eSAndroid Build Coastguard Worker#
11*49cdfc7eSAndroid Build Coastguard Worker# This program is distributed in the hope that it will be useful, but
12*49cdfc7eSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13*49cdfc7eSAndroid Build Coastguard Worker# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14*49cdfc7eSAndroid Build Coastguard Worker# for more details.
15*49cdfc7eSAndroid Build Coastguard Worker#
16*49cdfc7eSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License
17*49cdfc7eSAndroid Build Coastguard Worker# along with this program;  if not, write to the Free Software Foundation,
18*49cdfc7eSAndroid Build Coastguard Worker# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19*49cdfc7eSAndroid Build Coastguard Worker#
20*49cdfc7eSAndroid Build Coastguard Worker
21*49cdfc7eSAndroid Build Coastguard Workerexport TCID="Power_Management06"
22*49cdfc7eSAndroid Build Coastguard Workerexport TST_TOTAL=1
23*49cdfc7eSAndroid Build Coastguard Worker
24*49cdfc7eSAndroid Build Coastguard Worker. test.sh
25*49cdfc7eSAndroid Build Coastguard Worker. pm_include.sh
26*49cdfc7eSAndroid Build Coastguard Worker
27*49cdfc7eSAndroid Build Coastguard Workertest_timer_migration() {
28*49cdfc7eSAndroid Build Coastguard Worker	valid_input="0 1"
29*49cdfc7eSAndroid Build Coastguard Worker	invalid_input="3 4 5 6 7 8 a abcefg x1999 xffff -1 -00000
30*49cdfc7eSAndroid Build Coastguard Worker	2000000000000000000000000000000000000000000000000000000000000000000000
31*49cdfc7eSAndroid Build Coastguard Worker	ox324 -0xfffffffffffffffffffff"
32*49cdfc7eSAndroid Build Coastguard Worker	test_file="/proc/sys/kernel/timer_migration"
33*49cdfc7eSAndroid Build Coastguard Worker	if [ ! -f ${test_file} ] ; then
34*49cdfc7eSAndroid Build Coastguard Worker		tst_brkm TBROK "MISSING_FILE: missing file ${test_file}"
35*49cdfc7eSAndroid Build Coastguard Worker	fi
36*49cdfc7eSAndroid Build Coastguard Worker
37*49cdfc7eSAndroid Build Coastguard Worker	RC=0
38*49cdfc7eSAndroid Build Coastguard Worker	echo "${0}: ---Valid test cases---"
39*49cdfc7eSAndroid Build Coastguard Worker	check_input "${valid_input}" valid $test_file
40*49cdfc7eSAndroid Build Coastguard Worker	RC=$?
41*49cdfc7eSAndroid Build Coastguard Worker	echo "${0}: ---Invalid test cases---"
42*49cdfc7eSAndroid Build Coastguard Worker	check_input "${invalid_input}" invalid $test_file
43*49cdfc7eSAndroid Build Coastguard Worker	RC=$(( RC | $? ))
44*49cdfc7eSAndroid Build Coastguard Worker	return $RC
45*49cdfc7eSAndroid Build Coastguard Worker}
46*49cdfc7eSAndroid Build Coastguard Worker
47*49cdfc7eSAndroid Build Coastguard Worker# Checking test environment
48*49cdfc7eSAndroid Build Coastguard Workercheck_arch
49*49cdfc7eSAndroid Build Coastguard Worker
50*49cdfc7eSAndroid Build Coastguard Workertimer_migr_support_compatible=0
51*49cdfc7eSAndroid Build Coastguard Worker
52*49cdfc7eSAndroid Build Coastguard Workerif [ $timer_migr_support_compatible -eq 1 ]; then
53*49cdfc7eSAndroid Build Coastguard Worker	tst_brkm TCONF "Kernel version does not support Timer migration"
54*49cdfc7eSAndroid Build Coastguard Workerelse
55*49cdfc7eSAndroid Build Coastguard Worker	if [ ! -f /proc/sys/kernel/timer_migration ]; then
56*49cdfc7eSAndroid Build Coastguard Worker		tst_brkm TBROK "Timer migration interface missing"
57*49cdfc7eSAndroid Build Coastguard Worker	fi
58*49cdfc7eSAndroid Build Coastguard Workerfi
59*49cdfc7eSAndroid Build Coastguard Worker
60*49cdfc7eSAndroid Build Coastguard Workerif test_timer_migration ; then
61*49cdfc7eSAndroid Build Coastguard Worker	tst_resm TPASS "Timer Migration interface test"
62*49cdfc7eSAndroid Build Coastguard Workerelse
63*49cdfc7eSAndroid Build Coastguard Worker	tst_resm TFAIL "Timer migration interface test"
64*49cdfc7eSAndroid Build Coastguard Workerfi
65*49cdfc7eSAndroid Build Coastguard Worker
66*49cdfc7eSAndroid Build Coastguard Workertst_exit
67