copy from other repository

This commit is contained in:
zimoch
2010-09-02 14:52:17 +00:00
parent 35768cbfbb
commit d37c142d36
51 changed files with 4104 additions and 0 deletions

40
streamApp/tests/printdouble Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
filename=$$
trap "rm -f $filename.c $filename " EXIT TERM KILL
cat > $filename.c << EOF
#line 8
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char** args)
{
union {
float f;
double d;
unsigned char c [8];
} u;
int i,j;
for (i = 1; i < argc; i++)
{
u.f = atof (args[i]);
for (j = 0; j < 4; j++)
{
printf ("\\\\x%02x", u.c[j]);
}
printf ("\n");
u.d = atof (args[i]);
for (j = 0; j < 8; j++)
{
printf ("\\\\x%02x", u.c[j]);
}
printf ("\n");
}
return 0;
}
EOF
cc -Wall -pedantic $filename.c -o $filename && $filename "$@"

View File

@ -0,0 +1,180 @@
#
# Usage
# 1) source this file
# 2) define variables records, protocol, starup
# 3) call startioc
# 4) use ioccmd, assure, receive, send,...
# 5) call finish
set testname [file tail $argv0]
proc bgerror msg {
error $::errorInfo
}
set debug 0
proc debugmsg {string} {
global debug
if $debug {puts $string}
}
proc deviceconnect {s addr port} {
debugmsg "incoming connenction"
global sock
set sock $s
fconfigure $sock -blocking no -buffering none -translation binary
fileevent $sock readable "receiveHandler $sock"
}
set inputbuffer {}
proc receiveHandler {sock} {
global inputbuffer inputlog
set input [read $sock]
puts -nonewline $inputlog $input
append inputbuffer $input
debugmsg "receiving \"[escape $inputbuffer]\""
if [eof $sock] {
close $sock
debugmsg "connection closed by ioc"
return
}
}
proc startioc {} {
global debug records protocol startup port sock ioc testname env
set fd [open test.db w]
puts $fd $records
close $fd
set fd [open test.proto w]
puts $fd $protocol
close $fd
set fd [open test.cmd w 0777]
puts $fd "#!../O.$env(EPICS_HOST_ARCH)/streamApp"
puts $fd "dbLoadDatabase ../O.Common/streamApp.dbd"
puts $fd "streamApp_registerRecordDeviceDriver"
puts $fd "epicsEnvSet STREAM_PROTOCOL_PATH ."
puts $fd "drvAsynIPPortConfigure device localhost:$port"
puts $fd "dbLoadRecords test.db"
puts $fd $startup
puts $fd "iocInit"
puts $fd "dbl"
puts $fd "dbior stream 2"
puts $fd "var streamDebug 1"
close $fd
set ioc [open "|../O.$env(EPICS_HOST_ARCH)/streamApp test.cmd >& $testname.ioclog 2>@stderr" w]
fconfigure $ioc -blocking yes -buffering none
debugmsg "waiting to connect"
vwait sock
}
set lastcommand ""
set line 0
proc ioccmd {command} {
global ioc
global lastcommand
global line
set lastcommand $command
set line 0
debugmsg "$command"
puts $ioc $command
}
proc send {string} {
global sock
debugmsg "sending \"[escape $string]\""
puts -nonewline $sock $string
}
set timeout 5000
proc receive {} {
global inputbuffer timeoutid timeout
set timeoutid [after $timeout {
set inputbuffer {}
}]
if {$inputbuffer == {}} { vwait inputbuffer }
after cancel $timeoutid
if {$inputbuffer == {}} {
return -code error "Error in receive: timeout"
}
set index [string first "\n" $inputbuffer]
if {$index > -1} {
set input [string range $inputbuffer 0 $index]
set inputbuffer [string range $inputbuffer [expr $index+1] end]
} else {
set input $inputbuffer
set inputbuffer {}
}
return $input
}
set faults 0
proc assure {args} {
global faults
global lastcommand
global line
incr line
set input {}
for {set i 0} {$i < [llength $args]} {incr i} {
if [catch {lappend input [receive]} msg] {
puts stderr $msg
break
}
}
set notfound {}
foreach expected $args {
set index [lsearch -exact $input $expected]
if {$index > -1} {
set input [lreplace $input $index $index]
} else {
lappend notfound $expected
}
}
if {[llength $notfound] || [llength $input]} {
puts stderr "In command \"$lastcommand\""
}
foreach string $notfound {
puts stderr "Error in assure: line $line missing \"[escape $string]\""
}
foreach string $input {
puts stderr "Error in assure: got unexpected \"[escape $string]\""
}
if {[llength $notfound] || [llength $input]} {incr faults}
}
proc escape {string} {
while {![string is print -failindex index $string]} {
set char [string index $string $index]
scan $char "%c" code
switch $char {
"\r" { set escaped "\\r" }
"\n" { set escaped "\\n" }
"\a" { set escaped "\\a" }
"\t" { set escaped "\\t" }
default { set escaped [format "<%02x>" $code] }
}
set string [string replace $string $index $index $escaped]
}
return $string
}
proc finish {} {
global ioc timeout testname faults
set timeout 1000
while {![catch {set string [receive]}]} {
puts stderr "Error in finish: unexpected \"[escape $string]\""
incr faults
}
after 100
close $ioc
if $faults {
puts "Test failed."
exit 1
}
puts "Test passed."
eval file delete [glob -nocomplain test.*] StreamDebug.log $testname.ioclog
}
set port 40123
socket -server deviceconnect $port
set inputlog [open "test.inputlog" w]

94
streamApp/tests/test64Bit Executable file
View File

@ -0,0 +1,94 @@
#!/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 (ao, "DZ:ao")
{
field (DTYP, "stream")
field (OUT, "@test.proto ao device")
}
record (longout, "DZ:longout")
{
field (DTYP, "stream")
field (OUT, "@test.proto longout device")
}
record (bo, "DZ:bo")
{
field (DTYP, "stream")
field (OUT, "@test.proto bo device")
field (MASK, "-1")
}
record (mbbo, "DZ:mbbo")
{
field (DTYP, "stream")
field (OUT, "@test.proto mbbo device")
field (ZRVL, "0")
field (ONVL, "-1")
}
record (mbboDirect, "DZ:mbboDirect")
{
field (DTYP, "stream")
field (OUT, "@test.proto mbboDirect device")
}
record (ai, "DZ:ai")
{
field (DTYP, "stream")
field (INP, "@test.proto ai device")
}
record (longin, "DZ:longin")
{
field (DTYP, "stream")
field (INP, "@test.proto longin device")
}
}
set protocol {
Terminator = LF;
# these records use signed values: %d
ao {out "ao %.3f %d %(VAL).3f %(RVAL)d";}
longout {out "longout %d %(VAL)d";}
ai {out "ai?"; in "%d"; out "ai %d";}
longin {out "longin?"; in "%d"; out "longin %d";}
# these records use unsigned values: %u, %x
bo {out "bo %u %x %b";}
mbbo {out "mbbo %u %x %b";}
mbboDirect {out "mbboDirect %u %x %b";}
bi {out "bi?"; in "%d"; out "bi %d %x";}
mbbi {out "mbbi?"; in "%d"; out "mbbi %d %x";}
mbbiDirect {out "mbbiDirect?"; in "%d"; out "mbbiDirect %d %x";}
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:ao -1}
assure "ao -1.000 -1 -1.000 -1\n"
ioccmd {dbpf DZ:longout -1}
assure "longout -1 -1\n"
ioccmd {dbpf DZ:bo 1}
assure "bo 4294967295 ffffffff 11111111111111111111111111111111\n"
ioccmd {dbpf DZ:mbbo 1}
assure "mbbo 4294967295 ffffffff 11111111111111111111111111111111\n"
ioccmd {dbpf DZ:mbboDirect.B0 1}
assure "mbboDirect 1 1 1\n"
ioccmd {dbpf DZ:mbboDirect -1}
assure "mbboDirect 65535 ffff 1111111111111111\n"
ioccmd {dbpf DZ:ai.PROC 1}
assure "ai?\n"
send "-1\n"
assure "ai -1\n"
ioccmd {dbpf DZ:longin.PROC 1}
assure "longin?\n"
send "-1\n"
assure "longin -1\n"
finish

35
streamApp/tests/testBo Executable file
View File

@ -0,0 +1,35 @@
#!/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:test1")
{
field (DTYP, "stream")
field (OUT, "@test.proto test1 device")
field (ZNAM, "OFF")
field (ONAM, "ON")
}
}
set protocol {
test1 {out "%i %r %s";}
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1 0}
assure "0 \x00 OFF"
ioccmd {dbpf DZ:test1 1}
assure "1 \x01 ON"
finish

30
streamApp/tests/testChecksum Executable file
View File

@ -0,0 +1,30 @@
#!/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 (ao, "DZ:test1")
{
field (DTYP, "stream")
field (OUT, "@test.proto test1 device")
}
}
set protocol {
test1 {out 0x55 0x40 0x04 0x00 0x00 'z;' "%<sum>";}
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1 "1"}
assure "\x55\x40\x04\x00\x00z;\x4e"
finish

43
streamApp/tests/testCompare Executable file
View File

@ -0,0 +1,43 @@
#!/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 (ao, "DZ:test1")
{
field (DTYP, "stream")
field (OUT, "@test.proto test1 device")
}
}
set protocol {
Terminator = LF;
@mismatch { out "mismatch"; }
test1 {out "set %.2f"; in "ack %=.2f X"; out "OK"; }
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1 3.14}
assure "set 3.14\n"
send "ack 3.14 X\n"
assure "OK\n"
ioccmd {dbpf DZ:test1 0}
assure "set 0.00\n"
send "ack 0.00 X\n"
assure "OK\n"
ioccmd {dbpf DZ:test1 1}
assure "set 1.00\n"
send "ack 1.0 X\n"
assure "mismatch\n"
finish

View File

@ -0,0 +1,56 @@
#!/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 (longin, "DZ:test1")
{
field (DTYP, "stream")
field (INP, "@test.proto integer device")
}
record (ai, "DZ:test2")
{
field (DTYP, "stream")
field (INP, "@test.proto double device")
}
}
set protocol {
Terminator = LF;
integer {out "integer"; in "n: %?d xx"; out "n = %d"; }
double {out "double"; in "n: %?g xx"; out "n = %.4f"; }
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1.PROC 1}
assure "integer\n";
send "n: -12 xx\n";
assure "n = -12\n";
ioccmd {dbpf DZ:test1.PROC 1}
assure "integer\n";
send "n: xx\n";
assure "n = 0\n";
ioccmd {dbpf DZ:test2.PROC 1}
assure "double\n";
send "n: 3.1415 xx\n";
assure "n = 3.1415\n";
ioccmd {dbpf DZ:test2.PROC 1}
assure "double\n";
send "n: xx\n";
assure "n = 0.0000\n";
finish

107
streamApp/tests/testEnum Executable file
View File

@ -0,0 +1,107 @@
#!/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:testout")
{
field (DTYP, "stream")
field (OUT, "@test.proto out device")
}
record (longin, "DZ:testin")
{
field (DTYP, "stream")
field (INP, "@test.proto in device")
}
record (longout, "DZ:testout1")
{
field (DTYP, "stream")
field (OUT, "@test.proto out1 device")
}
record (longin, "DZ:testin1")
{
field (DTYP, "stream")
field (INP, "@test.proto in1 device")
}
record (longout, "DZ:testout2")
{
field (DTYP, "stream")
field (OUT, "@test.proto out2 device")
}
record (longin, "DZ:testin2")
{
field (DTYP, "stream")
field (INP, "@test.proto in2 device")
}
}
set protocol {
Terminator = LF;
out {out "%{zero|one|two}bla";}
in {in "%{zero|one|two}bla"; out "%d";}
out1 {out "%#{zero|one|two}bla";}
in1 {in "%#{zero|one|two}bla"; out "%d";}
out2 {out "%#{zero=-1|one|two=5}bla";}
in2 {in "%#{zero=-1|one|two=5}bla"; out "%d";}
}
set startup {
var streamDebug 1
}
set debug 0
startioc
ioccmd {dbpf DZ:testout 0}
assure "zerobla\n"
ioccmd {dbpf DZ:testout 1}
assure "onebla\n"
ioccmd {dbpf DZ:testout 2}
assure "twobla\n"
ioccmd {dbpf DZ:testout1 0}
assure "zerobla\n"
ioccmd {dbpf DZ:testout1 1}
assure "onebla\n"
ioccmd {dbpf DZ:testout1 2}
assure "twobla\n"
ioccmd {dbpf DZ:testout2 -1}
assure "zerobla\n"
ioccmd {dbpf DZ:testout2 0}
assure "onebla\n"
ioccmd {dbpf DZ:testout2 5}
assure "twobla\n"
ioccmd {dbpf DZ:testin.PROC 1}
send "zerobla\n"
assure "0\n"
ioccmd {dbpf DZ:testin.PROC 1}
send "onebla\n"
assure "1\n"
ioccmd {dbpf DZ:testin.PROC 1}
send "twobla\n"
assure "2\n"
ioccmd {dbpf DZ:testin1.PROC 1}
send "zerobla\n"
assure "0\n"
ioccmd {dbpf DZ:testin1.PROC 1}
send "onebla\n"
assure "1\n"
ioccmd {dbpf DZ:testin1.PROC 1}
send "twobla\n"
assure "2\n"
ioccmd {dbpf DZ:testin2.PROC 1}
send "zerobla\n"
assure "-1\n"
ioccmd {dbpf DZ:testin2.PROC 1}
send "onebla\n"
assure "0\n"
ioccmd {dbpf DZ:testin2.PROC 1}
send "twobla\n"
assure "5\n"
finish

67
streamApp/tests/testFormatm Executable file
View File

@ -0,0 +1,67 @@
#!/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 (ao, "DZ:ao")
{
field (DTYP, "stream")
field (OUT, "@test.proto ao device")
}
record (ai, "DZ:ai")
{
field (DTYP, "stream")
field (INP, "@test.proto ai device")
}
}
set protocol {
Terminator = LF;
ao {out "'%m' '%.4m' '%+.4m' '% .4m' '% +.4m' '%10.4m' '%-10.4m'";}
ai {out "?"; in "%m"; out "%.4e";}
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:ao 0}
assure "'000000+00' '0000+00' '+0000+00' ' 0000+00' '+0000+00' ' 0000+00' '0000+00 '\n"
ioccmd {dbpf DZ:ao 1}
assure "'100000-05' '1000-03' '+1000-03' ' 1000-03' '+1000-03' ' 1000-03' '1000-03 '\n"
ioccmd {dbpf DZ:ao 1000}
assure "'100000-02' '1000+00' '+1000+00' ' 1000+00' '+1000+00' ' 1000+00' '1000+00 '\n"
ioccmd {dbpf DZ:ao 1000000}
assure "'100000+01' '1000+03' '+1000+03' ' 1000+03' '+1000+03' ' 1000+03' '1000+03 '\n"
ioccmd {dbpf DZ:ao -1}
assure "'-100000-05' '-1000-03' '-1000-03' '-1000-03' '-1000-03' ' -1000-03' '-1000-03 '\n"
ioccmd {dbpf DZ:ao 12345}
assure "'123450-01' '1235+01' '+1235+01' ' 1235+01' '+1235+01' ' 1235+01' '1235+01 '\n"
ioccmd {dbpf DZ:ao -1.2345e-15}
assure "'-123450-20' '-1235-18' '-1235-18' '-1235-18' '-1235-18' ' -1235-18' '-1235-18 '\n"
ioccmd {dbpf DZ:ao 1e-100}
assure "'100000-105' '1000-103' '+1000-103' ' 1000-103' '+1000-103' ' 1000-103' '1000-103 '\n"
ioccmd {dbpf DZ:ai.PROC 1}
assure "?\n"
send "+1234+56\n"
assure "1.2340e+59\n"
ioccmd {dbpf DZ:ai.PROC 1}
assure "?\n"
send "-1234-56\n"
assure "-1.2340e-53\n"
ioccmd {dbpf DZ:ai.PROC 1}
assure "?\n"
send "-12340000-60\n"
assure "-1.2340e-53\n"
ioccmd {dbpf DZ:ai.PROC 1}
assure "?\n"
send "+00000000+0\n"
assure "0.0000e+00\n"
finish

102
streamApp/tests/testFormats Executable file
View File

@ -0,0 +1,102 @@
#!/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 (ao, "DZ:ao")
{
field (DTYP, "stream")
field (OUT, "@test.proto ao device")
field (EOFF, "-10")
field (ESLO, "0.000305180437934")
field (LINR, "LINEAR")
}
record (longout, "DZ:lo")
{
field (DTYP, "stream")
field (OUT, "@test.proto lo device")
}
record (longout, "DZ:bcd")
{
field (DTYP, "stream")
field (OUT, "@test.proto bcd device")
}
record (stringout, "DZ:chksum")
{
field (DTYP, "stream")
field (OUT, "@test.proto chksum device")
}
}
set protocol {
Terminator = LF;
ao {out "%.2f %.2e %.2E %.2g %.2G %i %d %u %o %04x %#.2f %#.2e %#.2E %#.2g %#.2G %#i %#d %#u %#o %#06x";}
lo {out "%d %(VAL)d %06d %x %06X %b %06b %.6b %B.! %06B.!";}
bcd {out "%D %6D %.2D %.4D %.6D %.8D %#D %#6D %#.2D %#.4D %#.6D";}
chksum {out "%s%<xor>";
out "%s%0<sum>";
out "%s%0<crc8>";
out "%s%0<crc16>";
out "%s%0<crc32>";
out "%s%0<adler32>";
}
}
set startup {
}
set debug 0
startioc
# Some formats give different results on 32 bit and 64 bit machines.
# This occurs when printing negative numbers with unsigned formats.
# This is normal. E.g. -1 HAS a different number of 1 bits.
# Specify the width field in the format if this is a problem.
ioccmd {dbpf DZ:ao 0}
assure "0.00 0.00e+00 0.00E+00 0 0 32767 32767 32767 77777 7fff 0.00 0.00e+00 0.00E+00 0.0 0.0 32767 32767 32767 077777 0x7fff\n"
ioccmd {dbpf DZ:ao 10}
assure "10.00 1.00e+01 1.00E+01 10 10 65535 65535 65535 177777 ffff 10.00 1.00e+01 1.00E+01 10. 10. 65535 65535 65535 0177777 0xffff\n"
ioccmd {dbpf DZ:ao -10}
assure "-10.00 -1.00e+01 -1.00E+01 -10 -10 0 0 0 0 0000 -10.00 -1.00e+01 -1.00E+01 -10. -10. 0 0 0 0 000000\n"
ioccmd {dbpf DZ:ao 1e-6}
assure "0.00 1.00e-06 1.00E-06 1e-06 1E-06 32768 32768 32768 100000 8000 0.00 1.00e-06 1.00E-06 1.0e-06 1.0E-06 32768 32768 32768 0100000 0x8000\n"
ioccmd {dbpf DZ:lo 0}
assure "0 0 000000 0 000000 0 000000 000000 . ......\n"
ioccmd {dbpf DZ:lo 12345}
assure "12345 12345 012345 3039 003039 11000000111001 11000000111001 111001 !!......!!!..! !!......!!!..!\n"
ioccmd {dbpf DZ:lo -1}
if {$tcl_platform(machine) == "x86_64"} {
assure "-1 -1 -00001 ffffffffffffffff FFFFFFFFFFFFFFFF 1111111111111111111111111111111111111111111111111111111111111111 1111111111111111111111111111111111111111111111111111111111111111 111111 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
} else {
assure "-1 -1 -00001 ffffffff FFFFFFFF 11111111111111111111111111111111 11111111111111111111111111111111 111111 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
}
ioccmd {dbpf DZ:lo -1234}
if {$tcl_platform(machine) == "x86_64"} {
assure "-1234 -1234 -01234 fffffffffffffb2e FFFFFFFFFFFFFB2E 1111111111111111111111111111111111111111111111111111101100101110 1111111111111111111111111111111111111111111111111111101100101110 101110 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!..!.!!!. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!..!.!!!.\n"
} else {
assure "-1234 -1234 -01234 fffffb2e FFFFFB2E 11111111111111111111101100101110 11111111111111111111101100101110 101110 !!!!!!!!!!!!!!!!!!!!!.!!..!.!!!. !!!!!!!!!!!!!!!!!!!!!.!!..!.!!!.\n"
}
ioccmd {dbpf DZ:lo 255}
assure "255 255 000255 ff 0000FF 11111111 11111111 111111 !!!!!!!! !!!!!!!!\n"
ioccmd {dbpf DZ:lo 65535}
assure "65535 65535 065535 ffff 00FFFF 1111111111111111 1111111111111111 111111 !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!\n"
ioccmd {dbpf DZ:bcd 1020304}
if {$tcl_platform(machine) == "x86_64"} {
assure "\0\0\0\0\1\2\3\4 \0\0\0\0\1\2\3\4 \4 \3\4 \2\3\4 \1\2\3\4 \4\3\2\1\0\0\0\0 \4\3\2\1\0\0\0\0 \4 \4\3 \4\3\2\n"
} else {
assure "\1\2\3\4 \0\0\1\2\3\4 \4 \3\4 \2\3\4 \1\2\3\4 \4\3\2\1 \4\3\2\1\0\0 \4 \4\3 \4\3\2\n"
}
ioccmd {dbpf DZ:chksum "123456789"}
assure "1234567891\n"
assure "123456789DD\n"
assure "123456789F4\n"
assure "123456789FEE8\n"
assure "123456789FC891918\n"
assure "123456789091E01DE\n"
finish

View File

@ -0,0 +1,44 @@
#!/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")
}
}
set protocol {
Terminator = CR LF;
test1 {out "Give input"; in "%s"; out "%s"; }
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1.PROC 1}
assure "Give input\r\n"
send "abc\r\n"
assure "abc\r\n"
ioccmd {dbpf DZ:test1.PROC 1}
assure "Give input\r\n"
send "x\r\n"
assure "x\r\n"
ioccmd {dbpf DZ:test1.PROC 1}
assure "Give input\r\n"
send "\r\n"
assure "\r\n"
finish

View File

@ -0,0 +1,45 @@
#!/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")
}
}
set protocol {
InTerminator = CR CR CR;
OutTerminator = LF;
test1 {out "Give input"; in "%39c"; out "%s"; }
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1.PROC 1}
assure "Give input\n"
send "abc\r\r\r"
assure "abc\n"
ioccmd {dbpf DZ:test1.PROC 1}
assure "Give input\n"
send "klm\rxyz\r\r\r"
assure "klm\rxyz\n"
ioccmd {dbpf DZ:test1.PROC 1}
assure "Give input\n"
send "123\r\rxyz\r\r\r"
assure "123\r\rxyz\n"
finish

View File

@ -0,0 +1,73 @@
#!/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 (stringin, "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")
}
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:read")
field (OMSL, "closed_loop")
field (OUT, "@test.proto printstr device")
}
}
set protocol {
Terminator = LF;
ready {out "ready"; }
readintr {extraInput=ignore; in "%39c"; }
printnum {out "%d";}
printstr {out "%s";}
}
set startup {
var streamDebug 1
}
set debug 0
set rep 500
startioc
assure "ready\n"
after 1000
for {set i 1} {$i <= $rep} {incr i} {
append output "This is line $i.\n"
}
send $output
after 2000
ioccmd {dbpf "DZ:stringout.PROC" 1}
assure "This is line $rep.\n"
ioccmd {dbpf "DZ:countout.PROC" 1}
assure "$rep\n"
finish

View File

@ -0,0 +1,40 @@
#!/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 (stringout, "DZ:test1")
{
field (DTYP, "stream")
field (OUT, "@test.proto test1 device")
}
record (stringout, "DZ:test2")
{
field (DTYP, "stream")
field (OUT, "@test.proto test2 device")
}
}
set protocol {
test1 {out "%s";}
Terminator = "S" CR LF;
test2 { out "%s";}
}
set startup {
asynOctetSetOutputEos device -1 "A\n"
}
set debug 0
startioc
ioccmd {dbpf DZ:test1 "string 1"}
assure "string 1A\n"
ioccmd {dbpf DZ:test2 "string 2"}
assure "string 2S\r\n"
finish

57
streamApp/tests/testPINI Executable file
View File

@ -0,0 +1,57 @@
#!/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
foreach rtype {ao bo mbbo mbboDirect longout stringout calcout} {
append records "
record ($rtype, \"DZ:$rtype\")
{
field (DTYP, \"stream\")
field (OUT, \"@test.proto init($rtype) device\")
field (PINI, \"YES\")
field (VAL, \"0\")
}
"
}
foreach rtype {ai bi mbbi mbbiDirect longin stringin waveform} {
append records "
record ($rtype, \"DZ:$rtype\")
{
field (DTYP, \"stream\")
field (INP, \"@test.proto init($rtype) device\")
field (PINI, \"YES\")
}
"
}
set protocol {
Terminator = LF;
init {out "init \$1"; }
}
set startup {
}
set debug 0
startioc
assure "init ao\n" \
"init bo\n" \
"init mbbo\n" \
"init mbboDirect\n" \
"init longout\n" \
"init stringout\n" \
"init ai\n" \
"init bi\n" \
"init mbbi\n" \
"init mbbiDirect\n" \
"init longin\n" \
"init stringin\n" \
"init calcout\n" \
"init waveform\n" \
finish

197
streamApp/tests/testRaw Executable file
View File

@ -0,0 +1,197 @@
#!/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 "%r"; out "%.1r"; out "%.2r"; out "%.3r"; out "%.4r"; out "%.5r";
out "%#r"; out "%#.1r"; out "%#.2r"; out "%#.3r"; out "%#.4r"; out "%#.5r";
out "%r"; out "%1r"; out "%2r"; out "%3r"; out "%4r"; out "%5r";
out "%0r"; out "%01r"; out "%02r"; out "%03r"; out "%04r"; out "%05r";
out "%#0r"; out "%#01r"; out "%#02r"; out "%#03r"; out "%#04r"; out "%#05r";
};
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1 0}
assure "\x00\n"
assure "\x00\n"
assure "\x00\x00\n"
assure "\x00\x00\x00\n"
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\n"
assure "\x00\n"
assure "\x00\n"
assure "\x00\x00\n"
assure "\x00\x00\x00\n"
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\n"
assure "\x00\n"
assure "\x00\n"
assure "\x00\x00\n"
assure "\x00\x00\x00\n"
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\n"
assure "\x00\n"
assure "\x00\n"
assure "\x00\x00\n"
assure "\x00\x00\x00\n"
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\n"
assure "\x00\n"
assure "\x00\n"
assure "\x00\x00\n"
assure "\x00\x00\x00\n"
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\n"
ioccmd {dbpf DZ:test1 1}
assure "\x01\n"
assure "\x01\n"
assure "\x00\x01\n"
assure "\x00\x00\x01\n"
assure "\x00\x00\x00\x01\n"
assure "\x00\x00\x00\x00\x01\n"
assure "\x01\n"
assure "\x01\n"
assure "\x01\x00\n"
assure "\x01\x00\x00\n"
assure "\x01\x00\x00\x00\n"
assure "\x01\x00\x00\x00\x00\n"
assure "\x01\n"
assure "\x01\n"
assure "\x00\x01\n"
assure "\x00\x00\x01\n"
assure "\x00\x00\x00\x01\n"
assure "\x00\x00\x00\x00\x01\n"
assure "\x01\n"
assure "\x01\n"
assure "\x00\x01\n"
assure "\x00\x00\x01\n"
assure "\x00\x00\x00\x01\n"
assure "\x00\x00\x00\x00\x01\n"
assure "\x01\n"
assure "\x01\n"
assure "\x01\x00\n"
assure "\x01\x00\x00\n"
assure "\x01\x00\x00\x00\n"
assure "\x01\x00\x00\x00\x00\n"
ioccmd {dbpf DZ:test1 -1}
assure "\xff\n"
assure "\xff\n"
assure "\xff\xff\n"
assure "\xff\xff\xff\n"
assure "\xff\xff\xff\xff\n"
assure "\xff\xff\xff\xff\xff\n"
assure "\xff\n"
assure "\xff\n"
assure "\xff\xff\n"
assure "\xff\xff\xff\n"
assure "\xff\xff\xff\xff\n"
assure "\xff\xff\xff\xff\xff\n"
assure "\xff\n"
assure "\xff\n"
assure "\xff\xff\n"
assure "\xff\xff\xff\n"
assure "\xff\xff\xff\xff\n"
assure "\xff\xff\xff\xff\xff\n"
assure "\xff\n"
assure "\xff\n"
assure "\x00\xff\n"
assure "\x00\x00\xff\n"
assure "\x00\x00\x00\xff\n"
assure "\x00\x00\x00\x00\xff\n"
assure "\xff\n"
assure "\xff\n"
assure "\xff\x00\n"
assure "\xff\x00\x00\n"
assure "\xff\x00\x00\x00\n"
assure "\xff\x00\x00\x00\x00\n"
ioccmd {dbpf DZ:test1 269554195}
assure "\x13\n"
assure "\x13\n"
assure "\x12\x13\n"
assure "\x11\x12\x13\n"
assure "\x10\x11\x12\x13\n"
assure "\x00\x10\x11\x12\x13\n"
assure "\x13\n"
assure "\x13\n"
assure "\x13\x12\n"
assure "\x13\x12\x11\n"
assure "\x13\x12\x11\x10\n"
assure "\x13\x12\x11\x10\x00\n"
assure "\x13\n"
assure "\x13\n"
assure "\x00\x13\n"
assure "\x00\x00\x13\n"
assure "\x00\x00\x00\x13\n"
assure "\x00\x00\x00\x00\x13\n"
assure "\x13\n"
assure "\x13\n"
assure "\x00\x13\n"
assure "\x00\x00\x13\n"
assure "\x00\x00\x00\x13\n"
assure "\x00\x00\x00\x00\x13\n"
assure "\x13\n"
assure "\x13\n"
assure "\x13\x00\n"
assure "\x13\x00\x00\n"
assure "\x13\x00\x00\x00\n"
assure "\x13\x00\x00\x00\x00\n"
ioccmd {dbpf DZ:test1 -559038737}
assure "\xef\n"
assure "\xef\n"
assure "\xbe\xef\n"
assure "\xad\xbe\xef\n"
assure "\xde\xad\xbe\xef\n"
assure "\xff\xde\xad\xbe\xef\n"
assure "\xef\n"
assure "\xef\n"
assure "\xef\xbe\n"
assure "\xef\xbe\xad\n"
assure "\xef\xbe\xad\xde\n"
assure "\xef\xbe\xad\xde\xff\n"
assure "\xef\n"
assure "\xef\n"
assure "\xff\xef\n"
assure "\xff\xff\xef\n"
assure "\xff\xff\xff\xef\n"
assure "\xff\xff\xff\xff\xef\n"
assure "\xef\n"
assure "\xef\n"
assure "\x00\xef\n"
assure "\x00\x00\xef\n"
assure "\x00\x00\x00\xef\n"
assure "\x00\x00\x00\x00\xef\n"
assure "\xef\n"
assure "\xef\n"
assure "\xef\x00\n"
assure "\xef\x00\x00\n"
assure "\xef\x00\x00\x00\n"
assure "\xef\x00\x00\x00\x00\n"
finish

61
streamApp/tests/testRawFloat Executable file
View File

@ -0,0 +1,61 @@
#!/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 (ao, "DZ:test1")
{
field (DTYP, "stream")
field (OUT, "@test.proto test1 device")
}
}
set protocol {
Terminator = LF;
test1 {out "%R"; out "%#R"; out "%4R"; out "%#4R"; out "%8R"; out "%#8R";}
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1 "0"}
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\x00\x00\x00\n"
ioccmd {dbpf DZ:test1 "1"}
assure "\x3f\x80\x00\x00\n"
assure "\x00\x00\x80\x3f\n"
assure "\x3f\x80\x00\x00\n"
assure "\x00\x00\x80\x3f\n"
assure "\x3f\xf0\x00\x00\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\x00\xf0\x3f\n"
ioccmd {dbpf DZ:test1 "-1"}
assure "\xbf\x80\x00\x00\n"
assure "\x00\x00\x80\xbf\n"
assure "\xbf\x80\x00\x00\n"
assure "\x00\x00\x80\xbf\n"
assure "\xbf\xf0\x00\x00\x00\x00\x00\x00\n"
assure "\x00\x00\x00\x00\x00\x00\xf0\xbf\n"
ioccmd {dbpf DZ:test1 "3.1415"}
assure "\x40\x49\x0e\x56\n"
assure "\x56\x0e\x49\x40\n"
assure "\x40\x49\x0e\x56\n"
assure "\x56\x0e\x49\x40\n"
assure "\x40\x09\x21\xca\xc0\x83\x12\x6f\n"
assure "\x6f\x12\x83\xc0\xca\x21\x09\x40\n"
finish

View File

@ -0,0 +1,76 @@
#!/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:readTimeout")
{
field (DTYP, "stream")
field (INP, "@test.proto read device")
}
record (bo, "DZ:echo")
{
field (DTYP, "stream")
field (OUT, "@test.proto print(DZ:readTimeout) device")
}
}
set protocol {
Terminator = LF;
read {out "Give me input"; in "%s";}
print {out "Text:'%(\$1.VAL)s' SEVR=%(\$1.SEVR)d STAT=%(\$1.STAT)d";}
}
set startup {
}
set debug 0
startioc
# reply timeout
ioccmd {dbpf DZ:readTimeout.PROC 1}
assure "Give me input\n"
after 1100
ioccmd {dbpf DZ:echo.PROC 1}
ioccmd {dbpr DZ:echo 1}
assure "Text:'' SEVR=3 STAT=10\n"
# read timeout
ioccmd {dbpf DZ:readTimeout.PROC 1}
assure "Give me input\n"
send "Trulala"
after 200
ioccmd {dbpf DZ:echo.PROC 1}
assure "Text:'Trulala' SEVR=3 STAT=1\n"
# reply timeout again, old input stays
ioccmd {dbpf DZ:readTimeout.PROC 1}
assure "Give me input\n"
after 1100
ioccmd {dbpf DZ:echo.PROC 1}
assure "Text:'Trulala' SEVR=3 STAT=10\n"
# mismatch, partially parsed
ioccmd {dbpf DZ:readTimeout.PROC 1}
assure "Give me input\n"
send "bla extra\n"
after 200
ioccmd {dbpf DZ:echo.PROC 1}
assure "Text:'bla' SEVR=3 STAT=12\n"
# success
ioccmd {dbpf DZ:readTimeout.PROC 1}
assure "Give me input\n"
send "Input\n"
after 200
ioccmd {dbpf DZ:echo.PROC 1}
assure "Text:'Input' SEVR=0 STAT=0\n"
finish

View File

@ -0,0 +1,32 @@
#!/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 (stringout, "DZ:test1")
{
field (DTYP, "stream")
field (OUT, "@test.proto test1 device")
}
}
set protocol {
Terminator = LF;
test1 {out "%s";}
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1 "string 1"}
assure "string 1\n"
finish

View File

@ -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 (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
ioccmd {dbpf "DZ:request.PROC" 1}
assure "Give input\n"
for {set i 1} {$i <= $rep} {incr i} {
append output "This is line $i.\n"
}
send $output
after 2000
ioccmd {dbpf "DZ:echo.PROC" 1}
assure "This is line 253.\n"
ioccmd {dbpf "DZ:stringout.PROC" 1}
assure "This is line $rep.\n"
ioccmd {dbpf "DZ:countout.PROC" 1}
assure "$rep\n"
finish

View File

@ -0,0 +1,59 @@
rm -f test.*
cat > test.cc << EOF
#include <StreamBuffer.h>
#include <assert.h>
#include <stdio.h>
int main () {
StreamBuffer haystack = "12345abc123xyz123";
StreamBuffer needle = "1n4m6p7q";
needle.remove(2,4);
assert (needle.equals("1n7q"));
needle.append("2x3y");
assert (needle.equals("1n7q2x3y"));
needle.remove(4);
assert (needle.equals("2x3y"));
needle.remove(1,1);
assert (needle.equals("23y"));
needle.truncate(-1);
assert (needle.equals("23"));
assert (haystack.find(needle) == 1);
assert (haystack.find(needle, 2) == 9);
assert (haystack.find(needle, -5) == 15);
assert (haystack.find("23", -5) == 15);
assert (haystack.find((char*)NULL, 10) == 10);
assert (haystack.find(needle, -1) == -1);
assert (haystack.find(needle, 100) == -1);
assert (haystack.find(needle, 0) == 1);
assert (haystack.find(needle, -100) == 1);
haystack.set("12345xy67890xy");
needle.set("xy");
assert (haystack.find(needle) == 5);
needle.set("x");
assert (haystack.find(needle) == 5);
haystack.set("12345\n67890\n");
needle.set("\n");
assert (haystack.find(needle) == 5);
haystack.set("12341234567890\n");
needle.set("2345");
assert (haystack.find(needle) == 5);
needle="7890";
assert (haystack.find(needle) == 10);
needle.append('\0');
assert (haystack.find(needle) == -1);
haystack.clear();
assert (haystack.find(needle) == -1);
haystack.set("deadbeef");
needle.clear();
assert (haystack.find(needle) == 0);
haystack.clear();
assert (haystack.find(needle) == 0);
return 0;
}
EOF
g++ -I ../../src ../../src/O.$EPICS_HOST_ARCH/StreamBuffer.o test.cc -o test.exe
test.exe || exit 1
rm test.*
echo "Test passed."

58
streamApp/tests/testTimestamp Executable file
View File

@ -0,0 +1,58 @@
#!/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 (ao, "DZ:test1")
{
field (DTYP, "stream")
field (OUT, "@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")
}
}
set protocol {
Terminator = LF;
test1 {out "%T(%d.%m.%Y %H:%M:%.2S %z)"; }
test2 {out "?"; in "%T"; out "%.0f %T"; }
test3 {out "?"; in "%(TIME)T(%Ed. %B %Y %H:%M:%.S%+0100) %f"; out "%(TIME)T %f"; }
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:test1 1044068706.789}
assure "01.02.2003 04:05:06.79 +0100\n"
ioccmd {dbpf DZ:test2.PROC 1}
assure "?\n"
send "2003-02-01 04:05:06 +0100\n"
assure "1044068706 2003-02-01 04:05:06 +0100\n";
ioccmd {dbpf DZ:test3.PROC 1}
assure "?\n"
send "1. Feb 2003 04:05:06.789 3.1415\n"
assure "2003-02-01 04:05:06 +0100 3.141500\n";
package require Epics
array set PV [pvinfo DZ:test3.TSE]
if {$PV(VAL) != -2 || $PV(TIME) != "02/01/03 04:05:06.789000000"} {incr faults}
finish

56
streamApp/tests/testWaage Executable file
View File

@ -0,0 +1,56 @@
#!/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 (bi, "DZ:sign")
{
field (DTYP, "stream")
field (INP, "@test.proto m(DZ:weight.A) device")
}
record (calc, "DZ:weight")
{
field (INPB, "DZ:sign")
field (CALC, "B?A:-A")
field (FLNK, "DZ:out")
}
record (ao, "DZ:out")
{
field (DTYP, "stream")
field (DOL, "DZ:weight")
field (OMSL, "closed_loop")
field (OUT, "@test.proto out device")
}
}
set protocol {
Terminator = LF;
m {out "w"; in "%*/ */%{-|}%(\$1)f Kg";}
out {out "%.2f";}
}
set startup {
}
set debug 0
startioc
ioccmd {dbpf DZ:sign.PROC 1}
assure "w\n"
send " - 15.20 Kg\n"
assure "-15.20\n"
ioccmd {dbpf DZ:sign.PROC 1}
assure "w\n"
send " 15.00 Kg\n"
assure "15.00\n"
finish

18
streamApp/tests/testall Executable file
View File

@ -0,0 +1,18 @@
for i in test*
do
if [ $i != testall -a -x $i ]
then
echo $i
if ! $i
then
echo "Failed."
(( fail++ ))
fi
fi
done
if [ "$fail" ]
then echo "$fail tests failed"
else echo "All tests passsed."
fi
exit $fail