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 22export TCID=ioctl01_02 23export TST_TOTAL=2 24export TST_COUNT=0 25 26has_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 37for tttype in `ls /dev/tty*` 38do 39device_no=${tttype#/dev/tty} 40case "$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 56echo;; 57esac 58done 59 60for tttype in `ls /dev/tty*` 61do 62device_no=${tttype#/dev/tty} 63case "$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 79echo;; 80esac 81done 82tst_exit 83 84