Index: branches/eam_branches/ipp-20121219/ippToPsps/test/fulltest.sh
===================================================================
--- branches/eam_branches/ipp-20121219/ippToPsps/test/fulltest.sh	(revision 35014)
+++ branches/eam_branches/ipp-20121219/ippToPsps/test/fulltest.sh	(revision 35015)
@@ -19,13 +19,13 @@
 # mkgpc1.sh user localhost eam eam
 
-set mkgpc1      = 0
-set initdb      = 0
-set mkdummy     = 0
-set initscratch = 0
-set initbatch   = 0
-set camqueue    = 0
-set cambatch    = 0
+set mkgpc1      = 1
+set initdb      = 1
+set mkdummy     = 1
+set initscratch = 1
+set initbatch   = 1
+set camqueue    = 1
+set cambatch    = 1
 set stackqueue  = 1
-set stackbatch  = 0
+set stackbatch  = 1
 
 set OUTDIR = "testdata"
Index: branches/eam_branches/ipp-20121219/ippToPsps/test/mksasdata.dvo
===================================================================
--- branches/eam_branches/ipp-20121219/ippToPsps/test/mksasdata.dvo	(revision 35015)
+++ branches/eam_branches/ipp-20121219/ippToPsps/test/mksasdata.dvo	(revision 35015)
@@ -0,0 +1,88 @@
+#!/usr/bin/env dvo
+# -*-sh-*-
+input tap.dvo
+
+if (not($?VERBOSE)) set VERBOSE = 0
+
+$OUTDIR = sas12
+
+macro mkfull
+  init.db
+  mkcatdir
+end
+
+macro init.db
+  $dbhost = localhost
+  $dbname = gpc1test
+  $dbuser = dvo
+  $dbpass = dvo
+
+  $RA = 10.0
+  $DEC = 20.0
+
+  break -auto off
+  exec mkgpc1.sh delete $dbhost $dbname $dbuser $dbpass
+  break -auto on
+  exec mkgpc1.sh create $dbhost $dbname $dbuser $dbpass
+
+  dbconnect $dbhost $dbuser $dbname -p $dbpass
+
+  # system-wide info
+  dbinsert ippToPspsFake (my_id) values (2)
+  dbinsert skycell (radeg, decdeg, skycell_id) values ($RA, $DEC, "skycell.0000.000")
+end
+
+# create a populated catdir with a set of cmf files, save the filenames in list for use by insert.exp
+macro mkcatdir
+  if ($0 != 3)
+    echo "mkcatdir.cam (cmftype) (dvotype)"
+    break
+  end
+
+  mkdir $OUTDIR
+
+  local catdir
+  $catdir = $OUTDIR/catdir.sas12
+  exec rm -rf $catdir
+
+  addstar -D CAMERA gpc1 sas12.test.psps/o5745g0620o.356996.cm.473458.smf -D CATDIR $catdir
+
+  # a single exposure
+  dbinsert rawExp (exp_id, exp_name, exp_time, bg, bg_stdev, ra, decl) values ($myID, "test.$myID", 10.0, 100.0, 2.0, {$RA*3.1415/180.0}, {$DEC*3.1415/180.0})
+  dbinsert chipRun (exp_id, chip_id) values ($myID, $myID)
+  dbinsert camRun (chip_id, cam_id, dist_group, software_ver) values ($myID, $myID, "testgroup", "testsoft")
+  dbinsert camProcessedExp (cam_id, path_base) values ($myID, "$filename")
+  dbinsert fakeRun (fake_id, cam_id) values ($myID, $myID)
+  dbinsert warpRun (warp_id, fake_id) values ($myID, $myID)
+  dbinsert warpSkyCellMap (warp_id, skycell_id, class_id) values ($myID, "skycell.0000.000", "XY00")
+  dbinsert addRun (stage, state, stage_id, minidvodb_name) values ("cam", "full", $myID, "catdir.cam")
+
+  addstar -D CAMERA gpc1 sas12.test.psps/RINGS.V3.skycell.1225.070.stk.1032983.skycal.40531.cmf -D CATDIR $catdir
+
+  dbinsert stackRun (stack_id, skycell_id, filter, software_ver) values ($stkID, "skycell.0000.000", "g.00000", "testsoft")
+  dbinsert stackInputSkyfile (stack_id, warp_id) values ($stkID, $expID)
+  dbinsert stackSumSkyfile (stack_id) values ($stkID)
+  dbinsert skycalRun (skycal_id, stack_id) values ($stkID, $stkID)
+  dbinsert skycalResult (skycal_id, path_base) values ($stkID, "$stkfile")
+  
+  dbinsert addRun (stage, state, stage_id, minidvodb_name) values ("skycal", "full", $stkID, "catdir.stk")
+
+  # catdirs for the exposures
+  dbinsert minidvodbRun (minidvodb_name, minidvodb_id, state) values ("catdir.cam", 1, "merged")
+  dbinsert minidvodbProcessed (minidvodb_id, fault) values (1, 0)
+  
+  dbinsert mergedvodbRun (minidvodb_id, merge_id, state, mergedvodb) values (1, 1, "full", "catdir.cam")
+  dbinsert mergedvodbProcessed (merge_id, fault) values (1, 0)
+
+  # catdirs for the stack
+  dbinsert minidvodbRun (minidvodb_name, minidvodb_id, state) values ("catdir.stk", 2, "merged")
+  dbinsert minidvodbProcessed (minidvodb_id, fault) values (2, 0)
+  
+  dbinsert mergedvodbRun (minidvodb_id, merge_id, state, mergedvodb) values (2, 2, "full", "catdir.stk")
+  dbinsert mergedvodbProcessed (merge_id, fault) values (2, 0)
+end
+
+if ($SCRIPT)
+  mkfull
+  exit 0
+end
Index: branches/eam_branches/ipp-20121219/ippToPsps/test/sastest.sh
===================================================================
--- branches/eam_branches/ipp-20121219/ippToPsps/test/sastest.sh	(revision 35015)
+++ branches/eam_branches/ipp-20121219/ippToPsps/test/sastest.sh	(revision 35015)
@@ -0,0 +1,169 @@
+#!/bin/csh -f
+
+# a bit crude : get the datadir path by interpolation of the PATH element for psconfig
+foreach f ( `echo $PATH | tr : ' '` )
+  echo $f | grep $PSCONFDIR > /dev/null
+  if ($status) continue
+  set datadir = `echo $f | sed s/bin\$/share/`
+  break
+end
+setenv IPPTOPSPS_DATA $datadir/ipptopsps
+
+# before running this test, you must have a mysql user:
+# mkgpc1.sh user localhost eam eam
+
+set mkgpc1      = 1
+set initdb      = 1
+set mkdummy     = 1
+set initscratch = 1
+set initbatch   = 1
+set camqueue    = 1
+set cambatch    = 1
+set stackqueue  = 1
+set stackbatch  = 1
+
+set OUTDIR = "testdata"
+set queuename = "test"
+
+if ($mkgpc1) then
+  #addstar -D CAMERA gpc1 sas12.test.psps/o5745g0620o.356996.cm.473458.smf -D CATDIR catdir.sas12
+  #addstar -D CAMERA gpc1 sas12.test.psps/RINGS.V3.skycell.1225.070.stk.1032983.skycal.40531.cmf -D CATDIR catdir.sas12
+  mksasdata.dvo
+endif
+
+# create the ipptopsps database
+if ($initdb) then 
+
+  # does the database already exist?
+  # XXX this command will blow away an existing database!!
+  mysql -h localhost -u dvo -pdvo -e "create database ipptopsps"
+  mysql -h localhost -u dvo -pdvo ipptopsps < $IPPTOPSPS_DATA/ippToPspsDbSchema.sql
+
+endif
+
+# create a dummy config so setupScratchDb.py does not fail
+if ($mkdummy) then
+  ippjython queue.py edit <<EOF
+dummy
+none
+IPP_PSPS
+0
+none
+none
+0
+0
+0
+0
+1
+none
+0
+0
+1
+1
+2001-01-01 00:00:00.0
+NONE
+NONE
+1
+0
+0
+1
+EOF
+endif
+
+# re-create the ipptopsps database
+if ($initscratch) then 
+
+  # create the database (ignore failure if it already exists)
+  mysql -h localhost -u dvo -pdvo -e "drop database ipptopsps_scratch"
+  # mysql -h localhost -u dvo -pdvo -e "drop database ipptopsps_scratch2"
+  # mysql -h localhost -u dvo -pdvo -e "drop database ipptopsps_scratch3"
+
+  mysql -h localhost -u dvo -pdvo -e "create database ipptopsps_scratch"
+  # mysql -h localhost -u dvo -pdvo -e "create database ipptopsps_scratch2"
+  # mysql -h localhost -u dvo -pdvo -e "create database ipptopsps_scratch3"
+
+  ippjython setupScratchDb.py dummy ipptopsps_scratch
+  # ippjython setupScratchDb.py dummy ipptopsps_scratch2
+  # ippjython setupScratchDb.py dummy ipptopsps_scratch3
+endif
+
+# this code is sensitive to a previously existing database?
+if ($camqueue) then
+  ippjython queue.py edit <<EOF
+$queuename
+test_ds
+IPP_PSPS
+0
+catdir.cam
+$OUTDIR/catdir.cam
+9
+11
+19
+21
+1
+$OUTDIR
+0
+0
+1
+1
+2012-12-10 00:00:00.0
+3PI
+3PI
+1
+0
+0
+1
+y
+y
+EOF
+endif
+
+if ($initbatch) then
+  ippjython loader.py $queuename init
+endif
+
+if ($cambatch) then
+  ippjython loader.py $queuename once
+endif
+
+# this code is sensitive to a previously existing database?
+if ($stackqueue) then
+  if ($stackqueuename == 0) then
+    set stackqueuename = $queuename\_stk
+  endif
+  ippjython queue.py edit <<EOF
+$stackqueuename
+test_ds
+IPP_PSPS
+0
+catdir.stk
+$OUTDIR/catdir.stk
+9
+11
+19
+21
+1
+$OUTDIR
+0
+0
+1
+1
+2012-12-10 00:00:00.0
+3PI
+3PI
+0
+1
+0
+1
+y
+y
+EOF
+endif
+
+if ($stackbatch) then
+  if ($stackqueuename == 0) then
+    set stackqueuename = $queuename\_stk
+  endif
+  ippjython loader.py $stackqueuename once
+endif
+
