test_ioctl 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. export TCID=ioctl01_02
  22. export TST_TOTAL=2
  23. export TST_COUNT=0
  24. has_tty()
  25. {
  26. if command -v stty >/dev/null 2>&1; then
  27. stty -F $1 > /dev/null
  28. if [ $? -ne 0 ]; then
  29. return 0
  30. fi
  31. fi
  32. return 1
  33. }
  34. for tttype in `ls /dev/tty*`
  35. do
  36. device_no=${tttype#/dev/tty}
  37. case "$device_no" in
  38. [0-9]|[0-9][0-9])
  39. has_tty $tttype
  40. if [ $? -eq 0 ]; then
  41. tst_resm TINFO "Skipping ioctl01 with $tttype"
  42. continue
  43. fi
  44. tst_resm TINFO "Testing ioctl01 with $tttype"
  45. ioctl01 -D $tttype
  46. RC=$?
  47. if [ $RC -eq 0 ]
  48. then
  49. tst_resm TPASS "ioctl01 Passed with $tttype"
  50. else
  51. tst_resm TFAIL "ioctl01 Failed with $tttype"
  52. fi
  53. echo;;
  54. esac
  55. done
  56. for tttype in `ls /dev/tty*`
  57. do
  58. device_no=${tttype#/dev/tty}
  59. case "$device_no" in
  60. [0-9]|[0-9][0-9])
  61. has_tty $tttype
  62. if [ $? -eq 0 ]; then
  63. tst_resm TINFO "Skipping ioctl02 with $tttype"
  64. continue
  65. fi
  66. tst_resm TINFO "Testing ioctl02 with $tttype"
  67. ioctl02 -D $tttype
  68. RC=$?
  69. if [ $RC -eq 0 ]
  70. then
  71. tst_resm TPASS "ioctl02 Passed with $tttype"
  72. else
  73. tst_resm TFAIL "ioctl02 Failed with $tttype"
  74. fi
  75. echo;;
  76. esac
  77. done
  78. tst_exit