*** empty log message ***
This commit is contained in:
@ -41,7 +41,7 @@ proc receiveHandler {sock} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc startioc {} {
|
proc startioc {} {
|
||||||
global debug records protocol startup port sock ioc testname env slsstyle streamversion
|
global debug records protocol startup port sock ioc testname env streamversion
|
||||||
set fd [open test.db w]
|
set fd [open test.db w]
|
||||||
puts $fd $records
|
puts $fd $records
|
||||||
close $fd
|
close $fd
|
||||||
@ -50,13 +50,9 @@ proc startioc {} {
|
|||||||
close $fd
|
close $fd
|
||||||
set fd [open test.cmd w 0777]
|
set fd [open test.cmd w 0777]
|
||||||
|
|
||||||
if {$slsstyle} {
|
if [info exists streamversion] {
|
||||||
puts $fd "#!/usr/local/bin/iocsh"
|
puts $fd "#!/usr/local/bin/iocsh"
|
||||||
if [info exists streamversion] {
|
puts $fd "require stream,$streamversion"
|
||||||
puts $fd "require stream,$streamversion"
|
|
||||||
} else {
|
|
||||||
puts $fd "require stream"
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
puts $fd "#!../O.$env(EPICS_HOST_ARCH)/streamApp"
|
puts $fd "#!../O.$env(EPICS_HOST_ARCH)/streamApp"
|
||||||
puts $fd "dbLoadDatabase ../O.Common/streamApp.dbd"
|
puts $fd "dbLoadDatabase ../O.Common/streamApp.dbd"
|
||||||
@ -71,7 +67,7 @@ proc startioc {} {
|
|||||||
puts $fd "dbior stream 2"
|
puts $fd "dbior stream 2"
|
||||||
puts $fd "var streamDebug 1"
|
puts $fd "var streamDebug 1"
|
||||||
close $fd
|
close $fd
|
||||||
if $slsstyle {
|
if [info exists streamversion] {
|
||||||
set ioc [open "|iocsh test.cmd >& $testname.ioclog 2>@stderr" w]
|
set ioc [open "|iocsh test.cmd >& $testname.ioclog 2>@stderr" w]
|
||||||
} else {
|
} else {
|
||||||
set ioc [open "|../O.$env(EPICS_HOST_ARCH)/streamApp test.cmd >& $testname.ioclog 2>@stderr" w]
|
set ioc [open "|../O.$env(EPICS_HOST_ARCH)/streamApp test.cmd >& $testname.ioclog 2>@stderr" w]
|
||||||
@ -94,8 +90,8 @@ proc ioccmd {command} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc send {string} {
|
proc send {string} {
|
||||||
global sock
|
global sock lastsent
|
||||||
debugmsg "sending \"[escape $string]\""
|
set lastsent $string
|
||||||
puts -nonewline $sock $string
|
puts -nonewline $sock $string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +121,7 @@ set faults 0
|
|||||||
proc assure {args} {
|
proc assure {args} {
|
||||||
global faults
|
global faults
|
||||||
global lastcommand
|
global lastcommand
|
||||||
|
global lastsent
|
||||||
global line
|
global line
|
||||||
|
|
||||||
incr line
|
incr line
|
||||||
@ -146,6 +143,9 @@ proc assure {args} {
|
|||||||
}
|
}
|
||||||
if {[llength $notfound] || [llength $input]} {
|
if {[llength $notfound] || [llength $input]} {
|
||||||
puts stderr "In command \"$lastcommand\""
|
puts stderr "In command \"$lastcommand\""
|
||||||
|
if [info exists lastsent] {
|
||||||
|
puts stderr "last sent: \"[escape $lastsent]\""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach string $notfound {
|
foreach string $notfound {
|
||||||
puts stderr "Error in assure: line $line missing \"[escape $string]\""
|
puts stderr "Error in assure: line $line missing \"[escape $string]\""
|
||||||
@ -182,10 +182,10 @@ proc finish {} {
|
|||||||
after 100
|
after 100
|
||||||
close $ioc
|
close $ioc
|
||||||
if $faults {
|
if $faults {
|
||||||
puts "Test failed."
|
puts "\033\[31;7mTest failed.\033\[0m"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
puts "Test passed."
|
puts "\033\[32mTest passed.\033\[0m"
|
||||||
eval file delete [glob -nocomplain test.*] StreamDebug.log $testname.ioclog
|
eval file delete [glob -nocomplain test.*] StreamDebug.log $testname.ioclog
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,12 +193,8 @@ set port 40123
|
|||||||
socket -server deviceconnect $port
|
socket -server deviceconnect $port
|
||||||
set inputlog [open "test.inputlog" w]
|
set inputlog [open "test.inputlog" w]
|
||||||
|
|
||||||
set slsstyle 0
|
# SLS style driver modules (optionally with version)
|
||||||
if {[lindex $argv 0] == "--sls"} {
|
if {[lindex $argv 0] == "-sls"} {
|
||||||
set argv [lrange $argv 1 end]
|
|
||||||
set slsstyle 1
|
|
||||||
}
|
|
||||||
if {[lindex $argv 0] == "--ver"} {
|
|
||||||
set streamversion [lindex $argv 1]
|
set streamversion [lindex $argv 1]
|
||||||
set argv [lrange $argv 2 end]
|
set argv [lrange $argv 2 end]
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ set records {
|
|||||||
field (OUT, "@test.proto mbbo device")
|
field (OUT, "@test.proto mbbo device")
|
||||||
field (ZRVL, "0")
|
field (ZRVL, "0")
|
||||||
field (ONVL, "-1")
|
field (ONVL, "-1")
|
||||||
|
field (ZRST, "0")
|
||||||
|
field (ONST, "-1")
|
||||||
}
|
}
|
||||||
record (mbboDirect, "DZ:mbboDirect")
|
record (mbboDirect, "DZ:mbboDirect")
|
||||||
{
|
{
|
||||||
@ -75,7 +77,7 @@ ioccmd {dbpf DZ:longout -1}
|
|||||||
assure "longout -1 -1\n"
|
assure "longout -1 -1\n"
|
||||||
ioccmd {dbpf DZ:bo 1}
|
ioccmd {dbpf DZ:bo 1}
|
||||||
assure "bo 4294967295 ffffffff 11111111111111111111111111111111\n"
|
assure "bo 4294967295 ffffffff 11111111111111111111111111111111\n"
|
||||||
ioccmd {dbpf DZ:mbbo 1}
|
ioccmd {dbpf DZ:mbbo -1}
|
||||||
assure "mbbo 4294967295 ffffffff 11111111111111111111111111111111\n"
|
assure "mbbo 4294967295 ffffffff 11111111111111111111111111111111\n"
|
||||||
ioccmd {dbpf DZ:mbboDirect.B0 1}
|
ioccmd {dbpf DZ:mbboDirect.B0 1}
|
||||||
assure "mbboDirect 1 1 1\n"
|
assure "mbboDirect 1 1 1\n"
|
||||||
|
108
streamApp/tests/testCharset
Executable file
108
streamApp/tests/testCharset
Executable file
@ -0,0 +1,108 @@
|
|||||||
|
#!/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:test1")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test1 device")
|
||||||
|
}
|
||||||
|
record (stringin, "DZ:test2")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test2 device")
|
||||||
|
}
|
||||||
|
record (stringin, "DZ:test3")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test3 device")
|
||||||
|
}
|
||||||
|
record (stringin, "DZ:test4")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test4 device")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set protocol {
|
||||||
|
Terminator = LF;
|
||||||
|
extraInput=ignore;
|
||||||
|
@mismatch {out "mismatch";}
|
||||||
|
test1 {in "%[a-zA-Z1-5]%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
test2 {in "%[]A-Za-z ]%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
test3 {in "%[^]A-Z]%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
test4 {in "%[^]-A-Z]%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
}
|
||||||
|
|
||||||
|
set startup {
|
||||||
|
}
|
||||||
|
|
||||||
|
set debug 0
|
||||||
|
|
||||||
|
startioc
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "This is a test\n"
|
||||||
|
assure "This| is a test\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "Test123]bla\n"
|
||||||
|
assure "Test123|]bla\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "Test123456\n"
|
||||||
|
assure "Test12345|6\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "Test43210\n"
|
||||||
|
assure "Test4321|0\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "test-bla\n"
|
||||||
|
assure "test|-bla\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " Space first\n"
|
||||||
|
assure "| Space first\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "This is a test\n"
|
||||||
|
assure "This is a test|\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "Test]xx123bla\n"
|
||||||
|
assure "Test]xx|123bla\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "test-bla\n"
|
||||||
|
assure "test|-bla\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " Space first\n"
|
||||||
|
assure " Space first|\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "this is a test\n"
|
||||||
|
assure "this is a test|\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "test]xx123bla\n"
|
||||||
|
assure "test|]xx123bla\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "test-bla\n"
|
||||||
|
assure "test-bla|\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " Space first\n"
|
||||||
|
assure " |Space first\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "this is a test\n"
|
||||||
|
assure "this is a test|\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "test]xx123bla\n"
|
||||||
|
assure "test|]xx123bla\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "test-bla\n"
|
||||||
|
assure "test|-bla\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " Space first\n"
|
||||||
|
assure " |Space first\n"
|
||||||
|
|
||||||
|
finish
|
||||||
|
|
455
streamApp/tests/testInteger
Executable file
455
streamApp/tests/testInteger
Executable file
@ -0,0 +1,455 @@
|
|||||||
|
#!/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 (ai, "DZ:test1")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test1 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test2")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test2 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test3")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test3 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test4")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test4 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test5")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test5 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test6")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test6 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test7")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test7 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test8")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test8 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test9")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test9 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test10")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test10 device")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set protocol {
|
||||||
|
Terminator = LF;
|
||||||
|
extraInput=ignore;
|
||||||
|
@mismatch {out "mismatch";}
|
||||||
|
test1 {in "%i"; out "%i"; }
|
||||||
|
test2 {in "%d"; out "%d"; }
|
||||||
|
test3 {in "%u"; out "%u"; }
|
||||||
|
test4 {in "%x"; out "%x"; }
|
||||||
|
test5 {in "%o"; out "%o"; }
|
||||||
|
test6 {in "%4i"; out "%i"; }
|
||||||
|
test7 {in "% 4i"; out "%i"; }
|
||||||
|
test8 {in "%#i"; out "%i"; }
|
||||||
|
test9 {in "%-x"; out "%i"; }
|
||||||
|
test10 {in "%-o"; out "%i"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
set startup {
|
||||||
|
}
|
||||||
|
|
||||||
|
set debug 0
|
||||||
|
|
||||||
|
startioc
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "-12345\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "-12345\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "74565\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "5349\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "-74565\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "-1\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "1\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "-12345\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "-12345\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "0\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "ffffffff\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "1234\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "-123\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "1234\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "-123\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "18\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "83\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "-1\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "255\n"
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "-15\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "1234\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "-123\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "1\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "1\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "10\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "-1\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "255\n"
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "-15\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "-12345\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "12345\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "-12345\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "-12345\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "74565\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "5349\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "-74565\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "-1\n"
|
||||||
|
ioccmd {dbpf DZ:test8.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "1\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "74565\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "-74565\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "74565\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "-74565\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "74565\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "74565\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "-74565\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "-1\n"
|
||||||
|
ioccmd {dbpf DZ:test9.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "1\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "5349\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send "-12345\n"
|
||||||
|
assure "-5349\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send " 12345\n"
|
||||||
|
assure "5349\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send " -12345\n"
|
||||||
|
assure "-5349\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send "- 12345\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send "\n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "mismatch\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send " 0x12345\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send " 012345\n"
|
||||||
|
assure "5349\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send "-0x12345\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send "0xffffffff\n"
|
||||||
|
assure "0\n"
|
||||||
|
ioccmd {dbpf DZ:test10.PROC 1}
|
||||||
|
send "-0xffffffff\n"
|
||||||
|
assure "0\n"
|
||||||
|
|
||||||
|
finish
|
55
streamApp/tests/testPerformance
Executable file
55
streamApp/tests/testPerformance
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/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 (waveform, "DZ:test1")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (FTVL, "DOUBLE")
|
||||||
|
field (NELM, "1048576")
|
||||||
|
field (INP, "@test.proto test1 device")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set protocol {
|
||||||
|
replyTimeout =600000;
|
||||||
|
Terminator = LF;
|
||||||
|
Separator = ",";
|
||||||
|
test1 {in "%f"; out "%(NORD)d";}
|
||||||
|
}
|
||||||
|
|
||||||
|
set startup {
|
||||||
|
}
|
||||||
|
|
||||||
|
set debug 0
|
||||||
|
|
||||||
|
set message "3.1415"
|
||||||
|
set size 1
|
||||||
|
set timeout 600000
|
||||||
|
|
||||||
|
startioc
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "$message\n"
|
||||||
|
assure "$size\n"
|
||||||
|
|
||||||
|
ioccmd {var streamDebug 0}
|
||||||
|
for {set log 1} {$log <= 21} {incr log} {
|
||||||
|
set output "$message\n"
|
||||||
|
set starttime [clock clicks]
|
||||||
|
send $output
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
assure "$size\n"
|
||||||
|
set duration [expr [clock clicks] - $starttime]
|
||||||
|
set performance($size) [expr $duration*1.0/$size]
|
||||||
|
puts [format "size %7d duration: %8d time/element: %6.1f" $size $duration $performance($size)]
|
||||||
|
if {$performance($size) > $performance(1)} {incr faults}
|
||||||
|
set message "$message,$message"
|
||||||
|
set size [expr $size*2]
|
||||||
|
}
|
||||||
|
|
||||||
|
finish
|
@ -8,15 +8,15 @@ int main () {
|
|||||||
StreamBuffer haystack = "12345abc123xyz123";
|
StreamBuffer haystack = "12345abc123xyz123";
|
||||||
StreamBuffer needle = "1n4m6p7q";
|
StreamBuffer needle = "1n4m6p7q";
|
||||||
needle.remove(2,4);
|
needle.remove(2,4);
|
||||||
assert (needle.equals("1n7q"));
|
assert (needle.startswith("1n7q"));
|
||||||
needle.append("2x3y");
|
needle.append("2x3y");
|
||||||
assert (needle.equals("1n7q2x3y"));
|
assert (needle.startswith("1n7q2x3y"));
|
||||||
needle.remove(4);
|
needle.remove(4);
|
||||||
assert (needle.equals("2x3y"));
|
assert (needle.startswith("2x3y"));
|
||||||
needle.remove(1,1);
|
needle.remove(1,1);
|
||||||
assert (needle.equals("23y"));
|
assert (needle.startswith("23y"));
|
||||||
needle.truncate(-1);
|
needle.truncate(-1);
|
||||||
assert (needle.equals("23"));
|
assert (needle.startswith("23"));
|
||||||
assert (haystack.find(needle) == 1);
|
assert (haystack.find(needle) == 1);
|
||||||
assert (haystack.find(needle, 2) == 9);
|
assert (haystack.find(needle, 2) == 9);
|
||||||
assert (haystack.find(needle, -5) == 15);
|
assert (haystack.find(needle, -5) == 15);
|
||||||
@ -54,6 +54,11 @@ EOF
|
|||||||
|
|
||||||
g++ -I ../../src ../../src/O.$EPICS_HOST_ARCH/StreamBuffer.o test.cc -o test.exe
|
g++ -I ../../src ../../src/O.$EPICS_HOST_ARCH/StreamBuffer.o test.cc -o test.exe
|
||||||
|
|
||||||
test.exe || exit 1
|
test.exe
|
||||||
|
if [ $? != 0 ]
|
||||||
|
then
|
||||||
|
echo -e "\033[31;7mTest failed.\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
rm test.*
|
rm test.*
|
||||||
echo "Test passed."
|
echo -e "\033[32mTest passed.\033[0m"
|
||||||
|
124
streamApp/tests/testString
Executable file
124
streamApp/tests/testString
Executable file
@ -0,0 +1,124 @@
|
|||||||
|
#!/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:test1")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test1 device")
|
||||||
|
}
|
||||||
|
record (stringin, "DZ:test2")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test2 device")
|
||||||
|
}
|
||||||
|
record (stringin, "DZ:test3")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test3 device")
|
||||||
|
}
|
||||||
|
record (stringin, "DZ:test4")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test4 device")
|
||||||
|
}
|
||||||
|
record (stringin, "DZ:test5")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test5 device")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set protocol {
|
||||||
|
Terminator = LF;
|
||||||
|
extraInput=ignore;
|
||||||
|
@mismatch {out "mismatch";}
|
||||||
|
test1 {in "%s%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
test2 {in "% s%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
test3 {in "%#s%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
test4 {in "%# s%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
test5 {in "% #s%(DESC) #s"; out "%s|%(DESC)s" }
|
||||||
|
}
|
||||||
|
|
||||||
|
set startup {
|
||||||
|
}
|
||||||
|
|
||||||
|
set debug 0
|
||||||
|
|
||||||
|
startioc
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "foobar\n"
|
||||||
|
assure "foobar|\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " foobar \n"
|
||||||
|
assure "foobar| \n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " foo bar \n"
|
||||||
|
assure "foo| bar \n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "|\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "ThisIsAVeryLongInputStringThatExceedsFouryCharacters right?\n"
|
||||||
|
assure "ThisIsAVeryLongInputStringThatExceedsFo| right?\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "foobar\n"
|
||||||
|
assure "foobar|\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " foobar \n"
|
||||||
|
assure " foobar| \n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " foo bar \n"
|
||||||
|
assure " foo| bar \n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure " |\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "foobar\n"
|
||||||
|
assure "foobar|\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " foobar \n"
|
||||||
|
assure "foobar |\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " foo bar \n"
|
||||||
|
assure "foo bar |\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure "|\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "foobar\n"
|
||||||
|
assure "foobar|\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " foobar \n"
|
||||||
|
assure " foobar |\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " foo bar \n"
|
||||||
|
assure " foo bar |\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure " |\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "foobar\n"
|
||||||
|
assure "foobar|\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " foobar \n"
|
||||||
|
assure " foobar |\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " foo bar \n"
|
||||||
|
assure " foo bar |\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " \n"
|
||||||
|
assure " |\n"
|
||||||
|
|
||||||
|
finish
|
||||||
|
|
@ -22,13 +22,37 @@ set records {
|
|||||||
field (DTYP, "stream")
|
field (DTYP, "stream")
|
||||||
field (INP, "@test.proto test3 device")
|
field (INP, "@test.proto test3 device")
|
||||||
}
|
}
|
||||||
|
record (ai, "DZ:test4")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test4 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test5")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test5 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test6")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test6 device")
|
||||||
|
}
|
||||||
|
record (ai, "DZ:test7")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (INP, "@test.proto test7 device")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set protocol {
|
set protocol {
|
||||||
Terminator = LF;
|
Terminator = LF;
|
||||||
test1 {out "%T(%d.%m.%Y %H:%M:%.2S %z)"; }
|
test1 {out "%T(%d.%m.%Y %H:%M:%.2S %z)"; }
|
||||||
test2 {out "?"; in "%T"; out "%.0f %T"; }
|
test2 {in "%T"; out "%.0f %T"; }
|
||||||
test3 {out "?"; in "%(TIME)T(%Ed. %B %Y %H:%M:%.S%+0100) %f"; out "%(TIME)T %f"; }
|
test3 {in "%(TIME)T(%Ed. %B %Y %H:%M:%.S) %f"; out "%(TIME)T(%d.%m.%Y %H:%M:%.2S %z)"; }
|
||||||
|
test4 {in "%(TIME)T(%c) %f"; out "%(TIME)T(%a %d.%m.%Y %H:%M:%.2S %z)"; }
|
||||||
|
test5 {in "%T(%H %p)"; out "%T(%H)"; }
|
||||||
|
test6 {in "%T(%p %H)"; out "%T(%H)"; }
|
||||||
|
test7 {in "%T(%d.%m.%Y %T %z)"; out "%T(%d.%m.%Y %T %z) %.6f"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
set startup {
|
set startup {
|
||||||
@ -36,23 +60,93 @@ set startup {
|
|||||||
|
|
||||||
set debug 0
|
set debug 0
|
||||||
|
|
||||||
|
package require Epics
|
||||||
|
proc checkTS {pv timestamp} {
|
||||||
|
global faults
|
||||||
|
pvget $pv
|
||||||
|
array set PV [pvinfo $pv]
|
||||||
|
if {$PV(TIME) != $timestamp} {
|
||||||
|
puts "expected timestamp: $timestamp"
|
||||||
|
puts "received timestamp: $PV(TIME)"
|
||||||
|
incr faults
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
startioc
|
startioc
|
||||||
|
|
||||||
ioccmd {dbpf DZ:test1 1044068706.789}
|
ioccmd {dbpf DZ:test1 1044068706.789}
|
||||||
assure "01.02.2003 04:05:06.79 +0100\n"
|
assure "01.02.2003 04:05:06.79 +0100\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test1 1057025106.789}
|
||||||
|
assure "01.07.2003 04:05:06.79 +0200\n"
|
||||||
|
|
||||||
ioccmd {dbpf DZ:test2.PROC 1}
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
assure "?\n"
|
send "2003-02-01 04:05:06\n"
|
||||||
send "2003-02-01 04:05:06 +0100\n"
|
assure "1044068706 2003-02-01 04:05:06\n";
|
||||||
assure "1044068706 2003-02-01 04:05:06 +0100\n";
|
|
||||||
|
|
||||||
ioccmd {dbpf DZ:test3.PROC 1}
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
assure "?\n"
|
send "1. February 2003 04:05:06.789 3.1415\n"
|
||||||
send "1. Feb 2003 04:05:06.789 3.1415\n"
|
assure "01.02.2003 04:05:06.79 +0100\n";
|
||||||
assure "2003-02-01 04:05:06 +0100 3.141500\n";
|
checkTS DZ:test3 "02/01/03 04:05:06.789000000"
|
||||||
|
|
||||||
package require Epics
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
array set PV [pvinfo DZ:test3.TSE]
|
send "1. July 2003 04:05:06.789123 3.1415\n"
|
||||||
if {$PV(VAL) != -2 || $PV(TIME) != "02/01/03 04:05:06.789000000"} {incr faults}
|
assure "01.07.2003 04:05:06.79 +0200\n";
|
||||||
|
checkTS DZ:test3 "07/01/03 04:05:06.789123000"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "mon jan 2 04:05:06 2003 3.1415\n"
|
||||||
|
assure "Thu 02.01.2003 04:05:06.00 +0100\n";
|
||||||
|
checkTS DZ:test4 "01/02/03 04:05:06.000000000"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "12 a\n"
|
||||||
|
assure "00\n";
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "01 a\n"
|
||||||
|
assure "01\n";
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "2 a\n"
|
||||||
|
assure "02\n";
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "11 a\n"
|
||||||
|
assure "11\n";
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "12 p\n"
|
||||||
|
assure "12\n";
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "01 p\n"
|
||||||
|
assure "13\n";
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "11 p\n"
|
||||||
|
assure "23\n";
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "am 12\n"
|
||||||
|
assure "00\n";
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "Am 01\n"
|
||||||
|
assure "01\n";
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "aM 2\n"
|
||||||
|
assure "02\n";
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "AM 11\n"
|
||||||
|
assure "11\n";
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "p 12\n"
|
||||||
|
assure "12\n";
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "P 01\n"
|
||||||
|
assure "13\n";
|
||||||
|
ioccmd {dbpf DZ:test6.PROC 1}
|
||||||
|
send "PM 11\n"
|
||||||
|
assure "23\n";
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "1.2.2010 13:56:32 +0000\n"
|
||||||
|
assure "01.02.2010 12:56:32 +0100 1265032592.000000\n";
|
||||||
|
ioccmd {dbpf DZ:test7.PROC 1}
|
||||||
|
send "1.7.2010 13:56:32 +0000\n"
|
||||||
|
assure "01.07.2010 13:56:32 +0200 1277992592.000000\n";
|
||||||
finish
|
finish
|
||||||
|
124
streamApp/tests/testWaveform
Executable file
124
streamApp/tests/testWaveform
Executable file
@ -0,0 +1,124 @@
|
|||||||
|
#!/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 (waveform, "DZ:test1")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (FTVL, "DOUBLE")
|
||||||
|
field (NELM, "3")
|
||||||
|
field (INP, "@test.proto testd device")
|
||||||
|
}
|
||||||
|
record (waveform, "DZ:test2")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (FTVL, "FLOAT")
|
||||||
|
field (NELM, "3")
|
||||||
|
field (INP, "@test.proto testd device")
|
||||||
|
}
|
||||||
|
record (waveform, "DZ:test3")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (FTVL, "LONG")
|
||||||
|
field (NELM, "3")
|
||||||
|
field (INP, "@test.proto testi device")
|
||||||
|
}
|
||||||
|
record (waveform, "DZ:test4")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (FTVL, "SHORT")
|
||||||
|
field (NELM, "3")
|
||||||
|
field (INP, "@test.proto testi device")
|
||||||
|
}
|
||||||
|
record (waveform, "DZ:test5")
|
||||||
|
{
|
||||||
|
field (DTYP, "stream")
|
||||||
|
field (FTVL, "STRING")
|
||||||
|
field (NELM, "3")
|
||||||
|
field (INP, "@test.proto tests device")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set protocol {
|
||||||
|
Terminator = LF;
|
||||||
|
testd {
|
||||||
|
Separator = ",";
|
||||||
|
@mismatch {out "mismatch after %(NORD)d elements: %.1f\n"}
|
||||||
|
in "text %f end"; out "%(NORD)d elements: %.1f";
|
||||||
|
}
|
||||||
|
testi {
|
||||||
|
Separator = " ";
|
||||||
|
@mismatch {out "mismatch after %(NORD)d elements: %i\n"}
|
||||||
|
in "%3i "; out "%(NORD)d elements: %i";
|
||||||
|
}
|
||||||
|
tests {
|
||||||
|
Separator = " ... ";
|
||||||
|
@mismatch {out "mismatch after %(NORD)d elements: %s\n"}
|
||||||
|
in "%s "; out "%(NORD)d elements: %s";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set startup {
|
||||||
|
}
|
||||||
|
|
||||||
|
set debug 0
|
||||||
|
|
||||||
|
startioc
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "text 1.0,2.0,3.0 end\n"
|
||||||
|
assure "3 elements: 1.0,2.0,3.0\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "text 3, 2, 1 end\n"
|
||||||
|
assure "3 elements: 3.0,2.0,1.0\n"
|
||||||
|
ioccmd {dbpf DZ:test1.PROC 1}
|
||||||
|
send "text 7 end\n"
|
||||||
|
assure "1 elements: 7.0\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "text 1.0,2.0,3.0 end\n"
|
||||||
|
assure "3 elements: 1.0,2.0,3.0\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "text 3, 2, 1 end\n"
|
||||||
|
assure "3 elements: 3.0,2.0,1.0\n"
|
||||||
|
ioccmd {dbpf DZ:test2.PROC 1}
|
||||||
|
send "text 7 end\n"
|
||||||
|
assure "1 elements: 7.0\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "1 2 3\n"
|
||||||
|
assure "3 elements: 1 2 3\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send " 3 2 1 \n"
|
||||||
|
assure "3 elements: 3 2 1\n"
|
||||||
|
ioccmd {dbpf DZ:test3.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "2 elements: 123 45\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "1 2 3\n"
|
||||||
|
assure "3 elements: 1 2 3\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send " 3 2 1 \n"
|
||||||
|
assure "3 elements: 3 2 1\n"
|
||||||
|
ioccmd {dbpf DZ:test4.PROC 1}
|
||||||
|
send "12345\n"
|
||||||
|
assure "2 elements: 123 45\n"
|
||||||
|
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send "1...2...3\n"
|
||||||
|
assure "1 elements: 1...2...3\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " 3 ... 2 ... 1\n"
|
||||||
|
assure "3 elements: 3 ... 2 ... 1\n"
|
||||||
|
ioccmd {dbpf DZ:test5.PROC 1}
|
||||||
|
send " 7 \n"
|
||||||
|
assure "1 elements: 7\n"
|
||||||
|
|
||||||
|
|
||||||
|
finish
|
@ -2,17 +2,17 @@ for i in test*
|
|||||||
do
|
do
|
||||||
if [ $i != testall -a -x $i ]
|
if [ $i != testall -a -x $i ]
|
||||||
then
|
then
|
||||||
echo $i
|
echo $i "$@"
|
||||||
if ! $i
|
if ! $i "$@"
|
||||||
then
|
then
|
||||||
echo "Failed."
|
echo -e "\033[31;7mFailed.\033[0m"
|
||||||
(( fail++ ))
|
(( fail++ ))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$fail" ]
|
if [ "$fail" ]
|
||||||
then echo "$fail tests failed"
|
then echo -e "\033[31;7m$fail tests failed\033[0m"
|
||||||
else echo "All tests passsed."
|
else echo -e "\033[32;7mAll tests passed.\033[0m"
|
||||||
fi
|
fi
|
||||||
exit $fail
|
exit $fail
|
||||||
|
Reference in New Issue
Block a user