82 lines
1.8 KiB
Tcl
Executable File
82 lines
1.8 KiB
Tcl
Executable File
#!/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 (stringin, "DZ:request")
|
|
{
|
|
field (DTYP, "stream")
|
|
field (INP, "@test.proto read device")
|
|
}
|
|
record (stringout, "DZ:echo")
|
|
{
|
|
field (DTYP, "stream")
|
|
field (DOL, "DZ:request")
|
|
field (OMSL, "closed_loop")
|
|
field (OUT, "@test.proto printstr device")
|
|
}
|
|
record (stringin, "DZ:spy")
|
|
{
|
|
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")
|
|
}
|
|
record (longout, "DZ:countout")
|
|
{
|
|
field (DTYP, "stream")
|
|
field (DOL, "DZ:count")
|
|
field (OMSL, "closed_loop")
|
|
field (OUT, "@test.proto printnum device")
|
|
}
|
|
record (stringout, "DZ:stringout")
|
|
{
|
|
field (DTYP, "stream")
|
|
field (DOL, "DZ:spy")
|
|
field (OMSL, "closed_loop")
|
|
field (OUT, "@test.proto printstr device")
|
|
}
|
|
}
|
|
|
|
set protocol {
|
|
Terminator = LF;
|
|
read {extraInput=ignore; InTerminator = ""; out "Give input"; in "%/.*253.*/"; }
|
|
readintr {extraInput=ignore; in "%39c"; }
|
|
printnum {out "%d";}
|
|
printstr {out "%s";}
|
|
}
|
|
|
|
set startup {
|
|
var streamDebug 1
|
|
}
|
|
|
|
set debug 0
|
|
set rep 500
|
|
|
|
startioc
|
|
|
|
process DZ:request
|
|
assure "Give input\n"
|
|
for {set i 1} {$i <= $rep} {incr i} {
|
|
append output "This is line $i.\n"
|
|
}
|
|
send $output
|
|
after 2000
|
|
process DZ:echo
|
|
assure "This is line 253.\n"
|
|
process DZ:stringout
|
|
assure "This is line $rep.\n"
|
|
process DZ:countout
|
|
assure "$rep\n"
|
|
|
|
finish
|