diff --git a/streamApp/tests/streamtestlib.tcl b/streamApp/tests/streamtestlib.tcl index 2e0c6e2..9359e8b 100644 --- a/streamApp/tests/streamtestlib.tcl +++ b/streamApp/tests/streamtestlib.tcl @@ -93,6 +93,7 @@ proc send {string} { global sock lastsent set lastsent $string puts -nonewline $sock $string + flush $sock } set timeout 5000 diff --git a/streamApp/tests/testIoIntrPollTimeout b/streamApp/tests/testIoIntrPollTimeout new file mode 100755 index 0000000..7bf86f4 --- /dev/null +++ b/streamApp/tests/testIoIntrPollTimeout @@ -0,0 +1,81 @@ +#!/usr/bin/env tclsh +source streamtestlib.tcl + +# Define records, protocol and startup (text goes to files) +# The asynPort "device" is connected to a network TCP socket +# Talk to the socket with send/receive/assure +# Send commands to the ioc shell with ioccmd + +set records { + record (bo, "DZ:ready") + { + field (DTYP, "stream") + field (OUT, "@test.proto ready device") + field (PINI, "YES") + } + record (longin, "DZ:read") + { + field (DTYP, "stream") + field (INP, "@test.proto readintr device") + field (SCAN, "I/O Intr") + field (FLNK, "DZ:count") + } + record (calc, "DZ:count") + { + field (INPA, "DZ:count") + field (CALC, "A+1") + field (FLNK, "DZ:errorcount") + } + record (calc, "DZ:errorcount") + { + field (INPA, "DZ:errorcount") + field (INPB, "DZ:read") + field (INPC, "DZ:count") + field (CALC, "A+(B#C)") + } + record (longout, "DZ:printresult") + { + field (DTYP, "stream") + field (DOL, "DZ:read") + field (OMSL, "closed_loop") + field (OUT, "@test.proto printresult device") + } +} + +set protocol { + Terminator = LF; + PollPeriod=10; + ReadTimeout=50; + ready {out "ready"; } + readintr {in "This is a line in chunks with number %d"; } + printresult {out "Last line received: %d"; + out "Line count: %(DZ:count)d"; + out "Error count: %(DZ:errorcount)d"; } +} + +set startup { +} + +set debug 0 + +startioc + +set rep 10 + +assure "ready\n" +for {set i 1} {$i <= $rep} {incr i} { + send "This " + after 10 + send "is a " + after 10 + send "line in chunks " + after 10 + send "with number $i\n" + after 100 +} +ioccmd {dbpf "DZ:printresult.PROC" 1} +assure "Last line received: $rep\n" +assure "Line count: $rep\n" +assure "Error count: 0\n" +finish + diff --git a/streamApp/tests/testPercent b/streamApp/tests/testPercent new file mode 100755 index 0000000..bf8e815 --- /dev/null +++ b/streamApp/tests/testPercent @@ -0,0 +1,33 @@ +#!/usr/bin/env tclsh +source streamtestlib.tcl + +# Define records, protocol and startup (text goes to files) +# The asynPort "device" is connected to a network TCP socket +# Talk to the socket with send/receive/assure +# Send commands to the ioc shell with ioccmd + +set records { + record (longout, "DZ:test1") + { + field (DTYP, "stream") + field (OUT, "@test.proto test1 device") + } +} + +set protocol { + Terminator = LF; + test1 {out "\%\e%d\e\e\%";} +} + +set startup { + var streamDebug 1 +} + +set debug 0 + +startioc + +ioccmd {dbpf DZ:test1 1} +assure "%\0331\033\033%\n" + +finish