#!/usr/bin/tclsh
#-------------------------------------------------------------------------
# This is the regression test for SICS on the TRICS instrument
#
# Mark Koennecke, November 2006
#------------------------------------------------------------------------
source sicstcldebug.tcl
source insttestutil.tcl
source tricsinventory.tcl

#------ If there is another argument, test at localhost: for debugging...
if {$argc > 0} {
	set instrument local
} else {
	set instrument trics
} 

initSicsDebug $instrument
config rights lnsmanager lnsSICSlns

#--------- remember soz position
set sompos [SICSValue om]
backup beforetest.tcl
standardPrelude $instrument count

set notList [list dil nv cone]

lappend commandList "counter setthreshold 1 0"
lappend commandList "scan1d"
lappend commandList "cscan om 0 .1 2 2"
lappend commandList "sscan om 0. .1 3 2"
lappend commandList "scan2d"
lappend commandList "cscan om 0 .1 2 2"
lappend commandList "sscan om 0. .1 3 2"
lappend commandList "scan1d"
lappend commandList "wwwsics"
lappend commandList "wwwhm"

# TODO: add tests for the real four circle stuff. This is as of now 
# deferred until the TRICS software has been reorganized.
# Most of the four circle tests should go into the regression
# test for the SICServer anyway.

lappend varList [list xscale1 0.74 .1]
lappend varList [list xscale2 0.74 .1]
lappend varList [list xscale3 -0.74 .1]
lappend varList [list zscale1 1.486 .1]
lappend varList [list zscale2 1.486 .1]
lappend varList [list zscale3 1.486 .1]
lappend varList [list xnull1 128 5]
lappend varList [list xnull2 128 5]
lappend varList [list xnull2 128 5]
lappend varList [list znull1 128 5]
lappend varList [list znull2 64 5]
lappend varList [list znull3 128 5]
lappend varList [list sttoffset1 0 .5]
lappend varList [list sttoffset2 8 .5]
lappend varList [list sttoffset3 1.4 .5]
lappend varList [list dist2  550 120]
lappend varList [list dist3  550 120]

lappend interruptList "drive om 90"
lappend interruptList "count timer 120"
lappend interruptList "exe insttestbatch.tcl"

set par(inventory) $inventory
set par(driveCommand) drive
set par(motorList) $motors
set par(notList) $notList
set par(commandList) $commandList
set par(interruptList) $interruptList
set par(instrument) $instrument
set par(user) lnsmanager
set par(password) lnsSICSlns
set par(varList) $varList

#================= actually test =====================================
set counters [runStandardTests par]

#--------- put om back where it was
drive om $sompos
standardRestore
recover beforetest.tcl

#------------ print a summary
set inst [string toupper $instrument]
puts stdout "Test Summary for $inst"
printStandardSummary $counters


