- Most instrument test files have been tested

- sinqcom undwerwent extension to cover more devices and is now more or
  less finished
This commit is contained in:
koennecke
2007-04-26 14:34:58 +00:00
parent 524dac0fbf
commit a24f56e7fb
14 changed files with 303 additions and 122 deletions

View File

@ -1,7 +1,7 @@
#--------------------------------------------------------------------------
# This is a set of utilities for testing SICServers on instruments
#
# Mark Koennecke, November 2006
# Mark Koennecke, November 2006, March 2007
#-------------------------------------------------------------------------
proc testInventory {inventory} {
set txt [sicscommand list]
@ -38,6 +38,7 @@ proc testMotors {drivecommand motorList notList} {
set failed 0
foreach mot $motorList {
if {[lsearch $notList $mot] < 0 } {
puts stdout "Testing $mot"
set rawVal [eval $mot]
if {[string first ERROR $rawVal] >= 0} {
puts stdout "MOTOR: failed to read $mot, error $rawVal"
@ -54,21 +55,22 @@ proc testMotors {drivecommand motorList notList} {
}
set newval [expr $val + $move]
set status [catch {eval $drivecommand $mot $newval} msg]
if {$status != 0} {
if {[string first ERROR $msg] >= 0 } {
#------------ if we went into a limit, we try the other direction
if {[string first limit $msg] > 0} {
set newval [expr $val - $move]
set status [catch {eval $drivecommand $mot $newval} msg]
}
}
if {$status != 0} {
if {[string first ERROR $msg] >= 0} {
puts stdout "MOTOR: failed to drive $mot with $msg"
incr failed
continue
}
#---------- drive back
set status [catch {eval $drivecommand $mot $val} msg]
if {$status != 0} {
puts stdout "MOTOR: failed to drive $mot with $msg"
if {[string first ERROR $msg] >= 0 } {
puts stdout "MOTOR: failed to drive $mot back with $msg"
incr failed
}
}
@ -121,6 +123,7 @@ proc testCommand args {
proc testCommandList {commandList} {
set count 0
foreach command $commandList {
puts stdout "Testing $command"
if {![testCommand $command]} {
incr count
}
@ -262,3 +265,29 @@ proc SICSValue {command} {
set l [split $txt =]
return [string trim [lindex $l 1]]
}
#----------------------------------------------------------------------
proc standardPrelude {inst {count co}} {
global __threshold __batchpath
set __threshold [SICSValue "counter getthreshold 1"]
set __batchpath [SICSValue "exe batchpath"]
if {[string compare $inst local] == 0} {
catch {sicscommand "exe batchpath /$env(HOME)/tmp"} msg
} else {
catch {sicscommand "exe batchpath /home/$inst/tmp"} msg
}
catch {sicscommand "scan mode timer"} msg
catch {sicscommand "counter setmode timer"} msg
catch {sicscommand "counter setthreshold 1 0"} msg
catch {sicscommand "exe upload"} msg
catch {sicscommand "exe append counter setthreshold 1 0"} msg
catch {sicscommand "exe append $count timer 120"} msg
catch {sicscommand "exe forcesave insttestbatch.tcl"} msg
}
#----------------------------------------------------------------------
proc standardRestore {} {
global __threshold __batchpath
catch {sicscommand "exe batchpath $__batchpath"} msg
catch {sicscommand "scan mode monitor"} msg
catch {sicscommand "counter setmode monitor"} msg
catch {sicscommand "counter setthreshold 1 $__threshold"} msg
}