ioctl testcases fail on s390x because it doesn't
support virtual consoles.

Trying to use such device node fails:
ioctl01_02    0  TINFO  :  Testing ioctl01 with /dev/tty0
ioctl01     1  TBROK  :  Couldn't open /dev/tty0: errno=ENXIO(6): No
such device or address

This patch tries to get terminal line settings for each tty,
that would be used in test. If that fails, tty is skipped.

Signed-off-by: Jan Stancek <[email protected]>
---
 testcases/kernel/syscalls/ioctl/test_ioctl |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/ioctl/test_ioctl 
b/testcases/kernel/syscalls/ioctl/test_ioctl
index e824ff7..062212b 100755
--- a/testcases/kernel/syscalls/ioctl/test_ioctl
+++ b/testcases/kernel/syscalls/ioctl/test_ioctl
@@ -23,11 +23,27 @@ export TCID=ioctl01_02
 export TST_TOTAL=2
 export TST_COUNT=0
 
+has_tty()
+{
+    if command -v stty >/dev/null 2>&1; then
+        stty --file=$1 > /dev/null
+        if [ $? -ne 0 ]; then
+            return 0;
+        fi
+    fi
+    return 1;
+}
+
 for tttype in `ls /dev/tty*`
 do
 device_no=${tttype#/dev/tty}
 case "$device_no" in
 [0-9]|[0-9][0-9])
+    has_tty $tttype
+    if [ $? -eq 0 ]; then
+        tst_resm TINFO "Skipping ioctl01 with $tttype"
+        continue;
+    fi
     tst_resm TINFO "Testing ioctl01 with $tttype"
     ioctl01 -D $tttype
     RC=$?
@@ -46,6 +62,11 @@ do
 device_no=${tttype#/dev/tty}
 case "$device_no" in
 [0-9]|[0-9][0-9])
+    has_tty $tttype
+    if [ $? -eq 0 ]; then
+        tst_resm TINFO "Skipping ioctl02 with $tttype"
+        continue;
+    fi
     tst_resm TINFO "Testing ioctl02 with $tttype"
     ioctl02 -D $tttype
     RC=$?
-- 
1.7.1


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to