pty: Test data transmission with SLIP line discipline
PATCH 1/1 pty: Test data transmission with SLIP line discipline
Basic transmission test and try to trigger a possible race between receiving and hangup (it appears there is none from my testing).
This only includes SLIP for now, but more disciplines can be added. Probably at least CAN. However the packet generation will be different for each.
---
FYI, I considered patching the kernel so that SLIP sends unthrottle after each read, but on some physical serial lines this will cause one of the pins to change state which some crappy device was abusing for non-flow control purposes. Also it may interfer with flow control implemented somewhere else in the stack. I doubt this will really cause any problems, but OTOH I don't care about making SLIP work nicely with blocking PTYs enough to risk any change to the kernel. AFAICT there is no reason to use SLIP with a PTY except for virtual testing of SLIP.
runtest/pty | 1 + testcases/kernel/pty/.gitignore | 1 + testcases/kernel/pty/pty04.c | 250 ++++++++++++++++++++++++++++++++ 3 files changed, 252 insertions(+) create mode 100644 testcases/kernel/pty/pty04.c
runtest/pty +1 -0
@@ -2,6 +2,7 @@ pty01 pty01 pty02 pty02 pty03 pty03 +pty04 pty04 ptem01 ptem01 hangup01 hangup01
testcases/kernel/pty/.gitignore +1 -0
@@ -3,3 +3,4 @@ /pty01 /pty02 /pty03 +/pty04
testcases/kernel/pty/pty04.c new file +250 -0
250 lines not on this page · raw message
Signature · 1 line
2.24.0
PATCH 1/1 pty: Test data transmission with SLIP line discipline
Quoted 8 lines · Richard Palethorpe
Basic transmission test and try to trigger a possible race between receiving and hangup (it appears there is none from my testing).
This only includes SLIP for now, but more disciplines can be added. Probably at least CAN. However the packet generation will be different for each.
Signed-off-by Richard Palethorpe <[email protected]>---
...
testcases/kernel/pty/pty04.c
Quoted 3 lines
testcases/kernel/pty/pty04.c new file +0
-0@@ -0,0 +1,250 @@
...> +struct ldisc_info {
testcases/kernel/pty/pty04.c line 56
Quoted 7 lines
testcases/kernel/pty/pty04.c new file +7
-0+int n; +char *name; +int max_mtu; +}; + +static struct ldisc_info ldiscs[] = { + {0 ,"TTY" ,0 },
Why not N_TTY?
Why do you define the line above btw?
testcases/kernel/pty/pty04.c line 57
Quoted 1 line
testcases/kernel/pty/pty04.c new file +1
-0+ {1, "SLIP", 8192},
And N_SLIP?
Quoted 1 line
testcases/kernel/pty/pty04.c new file +1
-0+};
...
Quoted 4 lines
testcases/kernel/pty/pty04.c new file +4
-0+static void read_netdev (void ) +{ +char *data =SAFE_MALLOC (mtu -1 ); +
testcases/kernel/pty/pty04.c line 191
Quoted 10 lines
testcases/kernel/pty/pty04.c new file +10
-0+tst_res (TINFO ,"Reading from socket %d" , sk); + +SAFE_READ (1 , sk, data, mtu -1 ); +tst_res (TPASS ,"Read netdev 1" ); +SAFE_READ (1 , sk, data, mtu -1 ); + +tst_res (TPASS ,"Read netdev 2" ); + +TST_CHECKPOINT_WAKE (0 ); +while (read (sk, data, mtu -1 ) >0 )
Could you check whether '_' is actually received here?
testcases/kernel/pty/pty04.c line 197
Quoted 6 lines
testcases/kernel/pty/pty04.c new file +6
-0+ ; + +tst_res (TPASS ,"Reading data from netdev interrupted by hangup" ); + +free (data); +}
thanks,
Signature · 2 lines
js suse labs