device-discovery: auto detect UART_DEV devices for uart case
PATCH 1/2 device-discovery: auto detect UART_DEV devices for uart case
From: Cixi Geng <[email protected]>
update device-discovery scripts for uart device, it will auto detect the test machine uart devices, and filtered out of the on using dev. This is an updated version which comes from patch [1] written by Cyril
[1] https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
--- device-discovery.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
device-discovery.sh +17 -2
@@ -1,5 +1,20 @@ #!/bin/sh -if [ "$1" = "UART_RX-UART_TX" ]; then - echo "UART_RX=/dev/ttyUSB0 UART_TX=/dev/ttyUSB0" +find_uart_devices() +{ + UART_DEVICE="" + for i in /dev/tty*; do + TTY_DEVICES=`echo $i |grep "tty[[:alpha:]]\{1,\}[0-9]\{1,\}"` + if [ -n "${TTY_DEVICES}" ];then + if ( stty -a -F ${TTY_DEVICES} > /dev/null 2>&1 ) ;then + lsof | grep "${TTY_DEVICES}" 1>/dev/null 2>&1 || \ + UART_DEVICE="${TTY_DEVICES} ${UART_DEVICE}" + fi + fi + done + echo "UART_DEV=${UART_DEVICE}" +} + +if [ "$1" = "UART_DEV" ]; then + find_uart_devices fi
Signature · 1 line
2.17.1
PATCH 2/2 device_drivers/uart01: uart01 test extension
From: Cixi Geng <[email protected]>
expand the uart01 test to support more options:
-f: create a file with ramdom content,and test uart use the file
to transfer data
-l: support to loop test with loop number
-k: support loopback mode test
modify: make UART_Rx and UART_Tx test into the same UART_DEV for we usually test uart transceiver function together.
This is an updated version which comes from patch written by Cyril
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
--- runtest/kernel_misc | 10 +- testcases/kernel/device-drivers/Makefile | 1 + testcases/kernel/device-drivers/uart/uart01.c | 94 +++++++++++++++---- 3 files changed, 80 insertions(+), 25 deletions(-)
runtest/kernel_misc +5 -5
@@ -13,8 +13,8 @@ zram01 zram01.sh zram02 zram02.sh zram03 zram03 umip_basic_test umip_basic_test -uart01_9600 uart01 -b 9600 -uart01_19200 uart01 -b 19200 -uart01_38400 uart01 -b 38400 -uart01_57600 uart01 -b 57600 -uart01_115200 uart01 -b 115200 +uart01_9600 uart01 -b 9600 -f binary -k 0 -l 2 +uart01_19200 uart01 -b 19200 -f binary -k 0 -l 3 +uart01_38400 uart01 -b 38400 -f binary -k 0 -l 1 +uart01_57600 uart01 -b 57600 -f binary -k 0 -l 3 +uart01_115200 uart01 -b 115200 -f /binary -k 0 -l 5
testcases/kernel/device-drivers/Makefile +1 -0
@@ -24,6 +24,7 @@ SUBDIRS := acpi \ locking \ pci \ rcu \ + uart \ rtc \ tbio \ uaccess \
testcases/kernel/device-drivers/uart/uart01.c +74 -20
199 lines not on this page · raw message
Signature · 1 line
2.17.1