public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] ioctl: check if tty device nodes are usable
@ 2012-08-17  7:43 Jan Stancek
  2012-08-18 23:13 ` Wanlong Gao
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Stancek @ 2012-08-17  7:43 UTC (permalink / raw)
  To: ltp-list

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 <jstancek@redhat.com>
---
 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..2e5ef25 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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH v2] ioctl: check if tty device nodes are usable
  2012-08-17  7:43 [LTP] [PATCH v2] ioctl: check if tty device nodes are usable Jan Stancek
@ 2012-08-18 23:13 ` Wanlong Gao
  0 siblings, 0 replies; 2+ messages in thread
From: Wanlong Gao @ 2012-08-18 23:13 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

On 08/17/2012 03:43 PM, Jan Stancek wrote:
> 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 <jstancek@redhat.com>

Pushed, thank you Jan.

Wanlong Gao


------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-18 23:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-17  7:43 [LTP] [PATCH v2] ioctl: check if tty device nodes are usable Jan Stancek
2012-08-18 23:13 ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox