Home | History | Annotate | Download | only in power_management
      1 #! /bin/sh
      2 #
      3 # Copyright (c) International Business Machines  Corp., 2001
      4 # Author: Nageswara R Sastry <nasastry (at] 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 
     21 export TCID="Power_Management06"
     22 export TST_TOTAL=1
     23 
     24 . test.sh
     25 . pm_include.sh
     26 
     27 test_timer_migration() {
     28 	valid_input="0 1"
     29 	invalid_input="3 4 5 6 7 8 a abcefg x1999 xffff -1 -00000
     30 	2000000000000000000000000000000000000000000000000000000000000000000000
     31 	ox324 -0xfffffffffffffffffffff"
     32 	test_file="/proc/sys/kernel/timer_migration"
     33 	if [ ! -f ${test_file} ] ; then
     34 		tst_brkm TBROK "MISSING_FILE: missing file ${test_file}"
     35 	fi
     36 
     37 	RC=0
     38 	echo "${0}: ---Valid test cases---"
     39 	check_input "${valid_input}" valid $test_file
     40 	RC=$?
     41 	echo "${0}: ---Invalid test cases---"
     42 	check_input "${invalid_input}" invalid $test_file
     43 	RC=$(( RC | $? ))
     44 	return $RC
     45 }
     46 
     47 # Checking test environment
     48 check_kervel_arch
     49 
     50 if tst_kvcmp -ge "2.6.31"; then
     51 	timer_migr_support_compatible=0
     52 else
     53 	timer_migr_support_compatible=1
     54 fi
     55 
     56 if [ $timer_migr_support_compatible -eq 1 ]; then
     57 	tst_brkm TCONF "Kernel version does not support Timer migration"
     58 else
     59 	if [ ! -f /proc/sys/kernel/timer_migration ]; then
     60 		tst_brkm TBROK "Timer migration interface missing"
     61 	fi
     62 fi
     63 
     64 if test_timer_migration ; then
     65 	tst_resm TPASS "Timer Migration interface test"
     66 else
     67 	tst_resm TFAIL "Timer migration interface test"
     68 fi
     69 
     70 tst_exit
     71