]> xenbits.xensource.com Git - people/iwj/osstest.git/commitdiff
tcl: fixes following merge/reorg
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 14 Feb 2013 12:41:25 +0000 (12:41 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 14 Feb 2013 12:41:25 +0000 (12:41 +0000)
sg-execute-flight
tcl/JobDB-Executive.tcl

index dd276e2446b03bb2eb3f302b5d3c5910d4e5a6a7..c91562581785566d1b54b959db7c49f2009f59a7 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-source osstestlib.tcl
-
+source ./tcl/osstestlib.tcl
 readconfig
+source-method JobDB
 
 proc check {} {
     global flight jobinfo running blessing killing stopping startdelay
 
     if {$stopping} return
 
-    db-open
+    jobdb::db-open
 
     set nqueued [pg_execute dbh "
         SELECT job FROM jobs j
@@ -69,7 +69,7 @@ proc check {} {
          ORDER BY job
     " maybe-spawn-job
 
-    db-close
+    jobdb::db-close
 }
 
 proc prequit {why} {
@@ -87,12 +87,7 @@ proc maybe-spawn-job {} {
         if {[string equal $job $jobinfo(job)]} return
     }
 
-    switch -glob $jobinfo(recipe) {
-        build* { set runner sg-run-builds }
-        test* { set runner sg-run-tests }
-        * { error "unknown runner for recipe $jobinfo(recipe)" }
-    }
-    log "flight $flight spawning $jobinfo(job) $jobinfo(recipe) $runner"
+    log "flight $flight spawning $jobinfo(job)"
 
     incr startdelay 300
 
@@ -114,8 +109,8 @@ proc maybe-spawn-job {} {
             execl sh {-c {trap '' TERM; read dummy}}
             error "execl sh returned success ?!"
         }
-        execl ./$runner [list --start-delay $startdelay \
-                             $flight --jobs=$jobinfo(job)]
+        execl ./sg-run-job [list --start-delay $startdelay \
+                             $flight $jobinfo(job)]
         error "execl returned success ?!"
     }
     close $waiter_sentinel_r
@@ -220,7 +215,7 @@ proc kill-kill {job pid} {
 
 proc parse-args {} {
     global argv blessing
-    set-flight
+    jobdb::set-flight
     if {[llength $argv]!=1} { error "wrong # args" }
     lassign $argv blessing
 }
index 252edb5a79663fdd027269c288b148632f7e59e8..eb64a4bd030155a25d07401e371bf5476e675168 100644 (file)
@@ -27,7 +27,7 @@ proc logputs {f m} {
 }
 
 proc prepare {job} {
-    global jobinfo
+    global flight jobinfo
     db-open
     set found 0
     pg_execute -array jobinfo dbh "
@@ -79,17 +79,26 @@ proc set-flight {} {
     set env(OSSTEST_FLIGHT) $flight
 }
 
+variable dbusers 0
 
 proc db-open {} {
     global g
-    variable dbusers 0
+    variable dbusers
 
     if {$dbusers > 0} { incr dbusers; return }
 
+    set pl {
+       use Osstest;
+       use Osstest::Executive;
+       readglobalconfig();
+       print db_pg_dsn("osstestdb") or die $!;
+    }
+    set db_pg_dsn [exec perl -e $pl]
+
     # PgDbName_* are odbc-style strings as accepted by Perl's DBD::Pg
     # but Tcl pg_connect unaccountably uses a different format which
     # is whitespace-separated.
-    regsub -all {;} $c(ExecutiveDbname_osstestdb) { } conninfo
+    regsub -all {;} $db_pg_dsn { } conninfo
     pg_connect -conninfo $conninfo -connhandle dbh
     incr dbusers
 }