uart: add uart testcase in kernel device-drivers
PATCH v3 1/1 uart: add uart testcase in kernel device-drivers
From: Cixi Geng <[email protected]>
---
the serialcheck.c is from github(https://github.com/nsekhar/serialcheck.git)
the uart.sh refer to ltp-ddt serialcheck.sh testcase.
test log:
<<<test_output>>>
incrementing stop
serialcheck 1 TINFO: timeout per run is 0h 5m 0s
serialcheck 1 TINFO: start test on /dev/ttyS0 115200
1+0 records in
1+0 records out
57600 bytes (58 kB, 56 KiB) copied, 0.002604 s, 22.1 MB/s
Needed 0 reads 1 writes loops 5 / 5
cts: 0 dsr: 0 rng: 0 dcd: 0 rx: 0 tx: 283968 frame 0 ovr 0 par: 0 brk: 0 buf_ovrr: 0 serialcheck 1 TPASS: uart /dev/ttyS0 test 115200 passed
serialcheck 1 TCONF: ttyS1 port is used, skip
Summary:
passed 1
failed 0
skipped 1
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=25 termination_type=exited termination_id=0 corefile=no cutime=21 cstime=36
<<<test_end>>>
---
use serialcheck tool test uart device in loopback mode. the shell scripts can automatically detect the machine's uart device, and filter out the busy used port. then run serialcheck to test
--- runtest/uart | 6 + testcases/kernel/device-drivers/Makefile | 1 + testcases/kernel/device-drivers/uart/Makefile | 13 + .../kernel/device-drivers/uart/serialcheck.c | 578 ++++++++++++++++++ testcases/kernel/device-drivers/uart/uart.sh | 61 ++ 5 files changed, 659 insertions(+) create mode 100644 runtest/uart create mode 100644 testcases/kernel/device-drivers/uart/Makefile create mode 100644 testcases/kernel/device-drivers/uart/serialcheck.c create mode 100755 testcases/kernel/device-drivers/uart/uart.sh
runtest/uart new file +6 -0
@@ -0,0 +1,6 @@ +# uart test in loopback mode +uart_9600_k uart.sh 9600 5 k +uart_19200_k uart.sh 19200 5 k +uart_38400_k uart.sh 38400 5 k +uart_57600_k uart.sh 57600 5 k +uart_115200_k uart.sh 115200 5 k
testcases/kernel/device-drivers/Makefile +1 -0
@@ -27,6 +27,7 @@ SUBDIRS := acpi \ rtc \ tbio \ uaccess \ + uart \ zram include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/kernel/device-drivers/uart/Makefile new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved. + +top_srcdir ?= ../../../.. + +CFLAGS+=-O2 -Wall -Wextra -g -Wno-sign-compare -Wno-pointer-sign + +include $(top_srcdir)/include/mk/testcases.mk + +INSTALL_TARGETS := *.sh serialcheck + +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/device-drivers/uart/serialcheck.c new file +578 -0
578 lines not on this page · raw message
testcases/kernel/device-drivers/uart/uart.sh new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 1/1 uart: add uart testcase in kernel device-drivers
Hi Cixi,
thanks for your patch and effort. While we appreciate it, I have to admit that Cyril's version is IMHO much cleaner and more adjusted to LTP style.
So I'd vote for him to add the loopback and merge his version.
Kind regards,
Petr
PATCH v3 1/1 uart: add uart testcase in kernel device-drivers
Hi Petr:
I hope the ltp test devices have a more convenient way?
like auto detect if the machine have these devices
and can run the device test.
Now we only test the uart device,we can export PORTxx for the test. but if we have to test dozens or even hundreds devices,
the way to set device environment variable needed test is very trouble and time consuming
So I don't think add need_devices is the best desirable way
Petr Vorel <[email protected]> ?2020?3?31??? ??3:41???
Quoted 11 lines
Hi Cixi,
thanks for your patch and effort. While we appreciate it, I have to admit that
Cyril's version is IMHO much cleaner and more adjusted to LTP style.So I'd vote for him to add the loopback and merge his version.
Kind regards,
Petr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200331/1947c7b8/attachment.htm>
PATCH v3 1/1 uart: add uart testcase in kernel device-drivers
Hi!
Quoted 8 lines
I hope the ltp test devices have a more convenient way???
like auto detect if the machine have these devices
and can run the device test.
Now we only test the uart device,we can export PORTxx for the test. but if we have to test dozens or even hundreds devices,
the way to set device environment variable needed test is very trouble and time consuming
So I don't think addneed_devicesis the best desirable way
I think that the right way is that the detection is in the test execution framework, not it the test, where it does not belong.
So either the execution framework has to be able to re-run the test for each UART pair, or we have to be able to pass more structured data to the test. I will think a bit more about this.
Signature · 2 lines
Cyril Hrubis [email protected]