1 #!/bin/sh 2 ################################################################################ 3 ## ## 4 ## Copyright (c) International Business Machines Corp., 2008 ## 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 ## 18 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 19 ## ## 20 ################################################################################ 21 22 export TCID=ioctl01_02 23 export TST_TOTAL=2 24 export TST_COUNT=0 25 26 has_tty() 27 { 28 if command -v stty >/dev/null 2>&1; then 29 stty -F $1 > /dev/null 30 if [ $? -ne 0 ]; then 31 return 0 32 fi 33 fi 34 return 1 35 } 36 37 for tttype in `ls /dev/tty*` 38 do 39 device_no=${tttype#/dev/tty} 40 case "$device_no" in 41 [0-9]|[0-9][0-9]) 42 has_tty $tttype 43 if [ $? -eq 0 ]; then 44 tst_resm TINFO "Skipping ioctl01 with $tttype" 45 continue 46 fi 47 tst_resm TINFO "Testing ioctl01 with $tttype" 48 ioctl01 -D $tttype 49 RC=$? 50 if [ $RC -eq 0 ] 51 then 52 tst_resm TPASS "ioctl01 Passed with $tttype" 53 else 54 tst_resm TFAIL "ioctl01 Failed with $tttype" 55 fi 56 echo;; 57 esac 58 done 59 60 for tttype in `ls /dev/tty*` 61 do 62 device_no=${tttype#/dev/tty} 63 case "$device_no" in 64 [0-9]|[0-9][0-9]) 65 has_tty $tttype 66 if [ $? -eq 0 ]; then 67 tst_resm TINFO "Skipping ioctl02 with $tttype" 68 continue 69 fi 70 tst_resm TINFO "Testing ioctl02 with $tttype" 71 ioctl02 -D $tttype 72 RC=$? 73 if [ $RC -eq 0 ] 74 then 75 tst_resm TPASS "ioctl02 Passed with $tttype" 76 else 77 tst_resm TFAIL "ioctl02 Failed with $tttype" 78 fi 79 echo;; 80 esac 81 done 82 tst_exit 83 84