Index: Makefile
==================================================================
--- Makefile
+++ Makefile
@@ -105,10 +105,14 @@
chmod a+x $@
$(PREFIX)/bin/nbfind : utils/nbfind
$(INSTALL) $< $@
chmod a+x $@
+
+$(PREFIX)/bin/nbload : utils/nbload
+ $(INSTALL) $< $@
+ chmod a+x $@
$(PREFIX)/bin/refdb : refdb
$(INSTALL) $< $@
chmod a+x $@
@@ -126,11 +130,11 @@
$(INSTALL) dboard $(PREFIX)/bin/dboard
utils/mk_wrapper $(PREFIX) dboard > $(PREFIX)/bin/dashboard
chmod a+x $(PREFIX)/bin/dashboard
install : bin $(PREFIX)/bin/mtest $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard $(PREFIX)/bin/dashboard $(HELPERS) $(PREFIX)/bin/nbfake \
- $(PREFIX)/bin/nbfind $(PREFIX)/bin/newdboard $(PREFIX)/bin/refdb $(PREFIX)/bin/mt_xterm $(PREFIX)/bin/revtagfsl
+ $(PREFIX)/bin/nbfind $(PREFIX)/bin/nbload $(PREFIX)/bin/newdboard $(PREFIX)/bin/refdb $(PREFIX)/bin/mt_xterm $(PREFIX)/bin/revtagfsl
deploytarg/apropos.so : Makefile
for i in apropos base64 canvas-draw csv-xml directory-utils dot-locking extras fmt format hostinfo http-client intarweb json md5 message-digest posix posix-extras readline regex regex-case s11n spiffy spiffy-request-vars sqlite3 srfi-1 srfi-18 srfi-69 tcp test uri-common check-errors synch matchable sql-null tcp-server rpc blob-utils string-utils variable-item defstruct uri-generic sendfile opensll openssl lookup-table list-utils stack; do \
chicken-install -prefix deploytarg -deploy $$i;done
Index: TODO
==================================================================
--- TODO
+++ TODO
@@ -1,4 +1,12 @@
-1. Confirm that branch transaction-for-sequential-writes content was added to trunk/development
-2. Add a host chooser for ssh to launch-tests
-3. Try making static executable
+TODO
+====
+
+Migration to inmem db plus per run db
+-------------------------------------
+
+. Re-work the dbstruct data structure?
+.. Move main.db to global?
+.. [ run-id.db inmemdb last-mod last-read last-sync inuse ]
+. Re-work all queries to use run-id to dereference server
+. Open main.db directly in calls to -runtests etc. No need to talk remote?
Index: api.scm
==================================================================
--- api.scm
+++ api.scm
@@ -71,27 +71,27 @@
(realparams (cddr params)))
(db:with-db dbstruct run-id #t ;; these are all for modifying the db
(lambda (db)
(db:general-call db stmtname realparams)))))
((sync-inmem->db) (db:sync-touched dbstruct force-sync: #t))
- ((kill-server)
- (db:sync-tables (db:tbls *inmemdb*) *inmemdb* *db*) ;; (db:sync-to *inmemdb* *db*)
- (let ((hostname (car *runremote*))
- (port (cadr *runremote*))
- (pid (if (null? params) #f (car params)))
- (th1 (make-thread (lambda ()(thread-sleep! 3)(debug:print 0 "Server exiting!")(exit 0)) "Server exit thread")))
- (debug:print 0 "WARNING: Server on " hostname ":" port " going down by user request!")
- (debug:print-info 1 "current pid=" (current-process-id))
- (open-run-close tasks:server-deregister tasks:open-db
- hostname
- port: port)
- (set! *server-run* #f)
- (thread-sleep! 3)
- (if pid
- (process-signal pid signal/kill)
- (thread-start! th1))
- '(#t "exit process started")))
+ ;; ((kill-server)
+ ;; (db:sync-tables (db:tbls *inmemdb*) *inmemdb* *db*) ;; (db:sync-to *inmemdb* *db*)
+ ;; (let ((hostname (car *runremote*))
+ ;; (port (cadr *runremote*))
+ ;; (pid (if (null? params) #f (car params)))
+ ;; (th1 (make-thread (lambda ()(thread-sleep! 3)(debug:print 0 "Server exiting!")(exit 0)) "Server exit thread")))
+ ;; (debug:print 0 "WARNING: Server on " hostname ":" port " going down by user request!")
+ ;; (debug:print-info 1 "current pid=" (current-process-id))
+ ;; (open-run-close tasks:server-deregister tasks:open-db
+ ;; hostname
+ ;; port: port)
+ ;; (set! *server-run* #f)
+ ;; (thread-sleep! 3)
+ ;; (if pid
+ ;; (process-signal pid signal/kill)
+ ;; (thread-start! th1))
+ ;; '(#t "exit process started")))
((sdb-qry) (apply sdb:qry params))
;; TESTMETA
((testmeta-get-record) (apply db:testmeta-get-record dbstruct params))
((testmeta-add-record) (apply db:testmeta-add-record dbstruct params))
Index: client.scm
==================================================================
--- client.scm
+++ client.scm
@@ -50,43 +50,57 @@
;; 1. We are a test manager and we received *transport-type* and *runremote* via cmdline
;; 2. We are a run tests, list runs or other interactive process and we must figure out
;; *transport-type* and *runremote* from the monitor.db
;;
;; client:setup
-(define (client:setup #!key (numtries 3))
+(define (client:setup run-id #!key (remaining-tries 3))
(if (not *toppath*)
(if (not (setup-for-run))
(begin
(debug:print 0 "ERROR: failed to find megatest.config, exiting")
(exit))))
- (push-directory *toppath*) ;; This is probably NOT needed
+ ;; (push-directory *toppath*) ;; This is probably NOT needed
;; clients get the sdb:qry proc created here
;; (if (not sdb:qry)
;; (begin
;; (set! sdb:qry (make-sdb:qry (conc *toppath* "/db/strings.db"))) ;; we open the normalization helpers here
;; (sdb:qry 'setup #f)))
-
- (debug:print-info 11 "*transport-type* is " *transport-type* ", *runremote* is " *runremote*)
- (let* ((hostinfo (open-run-close tasks:get-best-server tasks:open-db)))
- (debug:print-info 11 "CLIENT SETUP, hostinfo=" hostinfo)
- (set! *transport-type* (if hostinfo
- (string->symbol (tasks:hostinfo-get-transport hostinfo))
- 'fs))
- (debug:print-info 11 "Using transport type of " *transport-type* (if hostinfo (conc " to connect to " hostinfo) ""))
- (case *transport-type*
- ;; ((fs)(if (not *megatest-db*)(set! *megatest-db* (open-db))))
- ((http)
- (http-transport:client-connect (tasks:hostinfo-get-interface hostinfo)
- (tasks:hostinfo-get-port hostinfo)))
- ((zmq)
- (zmq-transport:client-connect (tasks:hostinfo-get-interface hostinfo)
- (tasks:hostinfo-get-port hostinfo)
- (tasks:hostinfo-get-pubport hostinfo)))
- (else ;; default to fs
- (debug:print 0 "ERROR: unrecognised transport type " *transport-type* " exiting now.")
- (exit)))
- (pop-directory)))
+ (let ((hostinfo (and run-id (hash-table-ref/default *runremote* run-id #f))))
+ (debug:print-info 11 "for run-id=" run-id ", *transport-type* is " *transport-type*)
+ (if hostinfo
+ hostinfo ;; have hostinfo - just return it
+ (let* ((hostinfo (open-run-close tasks:get-server tasks:open-db run-id))
+ (transport (if hostinfo
+ (string->symbol (tasks:hostinfo-get-transport hostinfo))
+ 'http)))
+ (if (not hostinfo)
+ (if (> remaining-tries 0)
+ (begin
+ (server:ensure-running run-id)
+ (client:setup run-id remaining-tries: (- remaining-tries 1)))
+ (begin
+ (debug:print 0 "ERROR: Expected to be able to connect to a server by now. No server available for run-id = " run-id)
+ (exit 1)))
+ (begin
+ (hash-table-set! *runremote* run-id hostinfo)
+ (debug:print-info 11 "CLIENT SETUP, hostinfo=" hostinfo)
+ (debug:print-info 11 "Using transport type of " transport (if hostinfo (conc " to connect to " hostinfo) ""))
+ (case *transport-type*
+ ;; ((fs)(if (not *megatest-db*)(set! *megatest-db* (open-db))))
+ ((http)
+ ;; this saves the hostinfo in the *runremote* hash and returns it
+ (http-transport:client-connect run-id
+ (tasks:hostinfo-get-interface hostinfo)
+ (tasks:hostinfo-get-port hostinfo)))
+ ((zmq)
+ (zmq-transport:client-connect (tasks:hostinfo-get-interface hostinfo)
+ (tasks:hostinfo-get-port hostinfo)
+ (tasks:hostinfo-get-pubport hostinfo)))
+ (else ;; default to fs
+ (debug:print 0 "ERROR: unrecognised transport type " *transport-type* " exiting now.")
+ (exit)))))))))
+ ;; (pop-directory)))
;; client:signal-handler
(define (client:signal-handler signum)
(handle-exceptions
exn
@@ -103,13 +117,16 @@
(thread-start! th2)
(thread-start! th1)
(thread-join! th2))))
;; client:launch
-(define (client:launch)
+;; Need to set the signal handler somewhere other than here as this
+;; routine will go away.
+;;
+(define (client:launch run-id)
(set-signal-handler! signal/int client:signal-handler)
- (if (client:setup)
- (debug:print-info 2 "connected as client")
- (begin
- (debug:print 0 "ERROR: Failed to connect as client")
- (exit))))
+ (if (client:setup run-id)
+ (debug:print-info 2 "connected as client")
+ (begin
+ (debug:print 0 "ERROR: Failed to connect as client")
+ (exit))))
Index: common.scm
==================================================================
--- common.scm
+++ common.scm
@@ -43,14 +43,14 @@
;; DATABASE
(define *open-dbs* (vector #f (make-hash-table))) ;; megatestdb run-id-dbs
;; SERVER
(define *my-client-signature* #f)
-(define *transport-type* 'fs)
+(define *transport-type* 'http)
(define *megatest-db* #f)
(define *rpc:listener* #f) ;; if set up for server communication this will hold the tcp port
-(define *runremote* #f) ;; if set up for server communication this will hold
+(define *runremote* (make-hash-table)) ;; if set up for server communication this will hold
(define *last-db-access* (current-seconds)) ;; update when db is accessed via server
(define *max-cache-size* 0)
(define *logged-in-clients* (make-hash-table))
(define *client-non-blocking-mode* #f)
(define *server-id* #f)
@@ -59,10 +59,11 @@
(define *received-response* #f)
(define *default-numtries* 10)
(define *server-run* #t)
(define *db-write-access* #t)
(define *inmemdb* #f)
+(define *run-id* #f)
(define *target* (make-hash-table)) ;; cache the target here; target is keyval1/keyval2/.../keyvalN
(define *keys* (make-hash-table)) ;; cache the keys here
(define *keyvals* (make-hash-table))
(define *toptest-paths* (make-hash-table)) ;; cache toptest path settings here
@@ -346,11 +347,11 @@
"unknown"
(caar uname-res))))
(define (save-environment-as-files fname #!key (ignorevars (list "DISPLAY" "LS_COLORS" "XKEYSYMDB" "EDITOR")))
(let ((envvars (get-environment-variables))
- (whitesp (regexp "[^a-zA-Z0-9_\\-:;,.\\/%$]")))
+ (whitesp (regexp "[^a-zA-Z0-9_\\-:,.\\/%$]")))
(with-output-to-file (conc fname ".csh")
(lambda ()
(for-each (lambda (key)
(if (not (member key ignorevars))
(let* ((val (cdr key))
Index: dashboard-tests.scm
==================================================================
--- dashboard-tests.scm
+++ dashboard-tests.scm
@@ -76,12 +76,18 @@
lbl)
(store-label "testcomment"
(iup:label "TestComment "
#:expand "HORIZONTAL")
(lambda (testdat)
- ;; (sdb:qry 'getstr
- (db:test-get-comment testdat))) ;; )
+ (let ((newcomment (db:test-get-comment testdat)))
+ (if *dashboard-comment-share-slot*
+ (if (not (equal? (iup:attribute *dashboard-comment-share-slot* "VALUE")
+ newcomment))
+ (iup:attribute-set! *dashboard-comment-slot*
+ "VALUE"
+ newcomment)))
+ newcomment)))
(store-label "testid"
(iup:label "TestId "
#:expand "HORIZONTAL")
(lambda (testdat)
(db:test-get-id testdat)))
@@ -140,11 +146,11 @@
;;======================================================================
(define (run-info-panel db keydat testdat runname)
(let* ((run-id (db:test-get-run_id testdat))
(rundat (db:get-run-info db run-id))
(header (db:get-header rundat))
- (event_time (db:get-value-by-header (db:get-row rundat)
+ (event_time (db:get-value-by-header (db:get-rows rundat)
(db:get-header rundat)
"event_time")))
(iup:frame
#:title "Megatest Run Info" ; #:expand "YES"
(iup:hbox ; #:expand "YES"
@@ -216,28 +222,34 @@
(color (car (gutils:get-color-for-state-status state status))))
((vector-ref *state-status* 0) state color)
((vector-ref *state-status* 1) status color)))
(define *dashboard-test-db* #t)
+(define *dashboard-comment-share-slot* #f)
;;======================================================================
;; Set fields
;;======================================================================
(define (set-fields-panel dbstruct run-id test-id testdat #!key (db #f))
(let ((newcomment #f)
(newstatus #f)
- (newstate #f))
+ (newstate #f)
+ (wtxtbox #f))
(iup:frame
#:title "Set fields"
(iup:vbox
(iup:hbox (iup:label "Comment:")
- (iup:textbox #:action (lambda (val a b)
+ (let ((txtbox (iup:textbox #:action (lambda (val a b)
(rmt:test-set-state-status-by-id run-id test-id #f #f b)
- ;; IDEA: Just set a variable with the proc to call?
- (set! newcomment b))
- #:value (db:test-get-comment testdat)
- #:expand "HORIZONTAL"))
+ ;; IDEA: Just set a variable with the proc to call?
+ (open-run-close db:test-set-state-status-by-id db test-id #f #f b)
+ (set! newcomment b))
+ #:value (db:test-get-comment testdat)
+ #:expand "HORIZONTAL")))
+ (set! wtxtbox txtbox)
+ txtbox))
+
(apply iup:hbox
(iup:label "STATE:" #:size "30x")
(let* ((btns (map (lambda (state)
(let ((btn (iup:button state
#:expand "HORIZONTAL" #:size "50x" #:font "Courier New, -10"
@@ -262,12 +274,20 @@
(let ((btn (iup:button status
#:expand "HORIZONTAL" #:size "50x" #:font "Courier New, -10"
#:action (lambda (x)
(let ((t (iup:attribute x "TITLE")))
(if (equal? t "WAIVED")
- (iup:show (dashboard-tests:waiver testdat (lambda (c)
- (set! newcomment c))))
+ (iup:show (dashboard-tests:waiver testdat
+ (if wtxtbox (iup:attribute wtxtbox "VALUE") #f)
+ (lambda (c)
+ (set! newcomment c)
+ (if wtxtbox
+ (begin
+ (iup:attribute-set! wtxtbox "VALUE" c)
+ (if (not *dashboard-comment-share-slot*)
+ (set! *dashboard-comment-share-slot* wtxtbox)))
+ ))))
(begin
(open-run-close db:test-set-state-status-by-id db test-id #f status #f)
(db:test-set-status! testdat status))))))))
btn))
(map cadr *common:std-statuses*)))) ;; (list "PASS" "WARN" "FAIL" "CHECK" "n/a" "WAIVED" "SKIP"))))
@@ -314,21 +334,21 @@
;; #:expand "HORIZONTAL"
;; #:action (lambda (obj)
;; (print "Refresh test data " stepname))
)))
-(define (dashboard-tests:waiver testdat cmtcmd)
+(define (dashboard-tests:waiver testdat ovrdval cmtcmd)
(let* ((wpatt (configf:lookup *configdat* "setup" "waivercommentpatt"))
(wregx (if (string? wpatt)(regexp wpatt) #f))
(wmesg (iup:label (if wpatt (conc "Comment must match pattern " wpatt) "")))
(comnt (iup:textbox #:action (lambda (val a b)
(if wpatt
(if (string-match wregx b)
(iup:attribute-set! wmesg "TITLE" (conc "Comment matches " wpatt))
(iup:attribute-set! wmesg "TITLE" (conc "Comment does not match " wpatt))
)))
- #:value (db:test-get-comment testdat)
+ #:value (if ovrdval ovrdval (db:test-get-comment testdat))
#:expand "HORIZONTAL"))
(dlog #f))
(set! dlog (iup:dialog ;; #:close_cb (lambda (a)(exit)) ; #:expand "YES"
#:title "SET WAIVER"
(iup:vbox ; #:expand "YES"
@@ -462,11 +482,11 @@
(debug:print 2 "ERROR: No test data found for test " test-id ", exiting")
(exit 1))
(let* (;; (run-id (if testdat (db:test-get-run_id testdat) #f))
(keydat (if testdat (db:get-key-val-pairs dbstruct run-id) #f))
(rundat (if testdat (db:get-run-info dbstruct run-id) #f))
- (runname (if testdat (db:get-value-by-header (db:get-row rundat)
+ (runname (if testdat (db:get-value-by-header (db:get-rows rundat)
(db:get-header rundat)
"runname") #f))
(tdb (tdb:open-test-db-by-test-id-local dbstruct run-id test-id))
;; These next two are intentional bad values to ensure errors if they should not
;; get filled in properly.
Index: db.scm
==================================================================
--- db.scm
+++ db.scm
@@ -117,10 +117,11 @@
(let* ((local (dbr:dbstruct-get-local dbstruct))
(toppath (dbr:dbstruct-get-path dbstruct))
(dbpath (conc toppath "/db/" run-id ".db"))
(dbexists (file-exists? dbpath))
(inmem (if local #f (db:open-inmem-db)))
+ (refdb (if local #f (db:open-inmem-db)))
(db (sqlite3:open-database dbpath))
(write-access (file-write-access? dbpath))
(handler (make-busy-timeout 136000)))
(if (and dbexists (not write-access))
(set! *db-write-access* #f)) ;; only unset so other db's also can use this control
@@ -140,10 +141,12 @@
(dbr:dbstruct-set-runvec-val! dbstruct run-id 'inmem db) ;; direct access ...
db)
(begin
(dbr:dbstruct-set-runvec-val! dbstruct run-id 'inmem inmem)
(db:sync-tables db:sync-tests-only db inmem)
+ (dbr:dbstruct-set-runvec-val! dbstruct run-id 'refdb refdb)
+ (db:sync-tables db:sync-tests-only db refdb)
inmem))))))
;; This routine creates the db. It is only called if the db is not already opened
;;
(define (db:open-main dbstruct) ;; (conc *toppath* "/megatest.db") (car *configinfo*)))
@@ -170,23 +173,13 @@
(dbr:dbstruct-set-main! dbstruct db)
db))))
;; Make the dbstruct, setup up auxillary db's and call for main db at least once
;;
-(define (db:setup #!key (local #f))
+(define (db:setup run-id #!key (local #f))
(let ((dbstruct (make-dbr:dbstruct path: *toppath* local: local)))
(db:get-db dbstruct #f) ;; force one call to main
- ;; (if (not sdb:qry)
- ;; (begin
- ;; (set! sdb:qry (make-sdb:qry (conc *toppath* "/db/strings.db"))) ;; we open the normalization helpers here
- ;; (sdb:qry 'setup #f)
- ;; ;; Initialize with some known needed strings, NOTE: set this up to only execute on first db initialization
- ;; (for-each
- ;; (lambda (str)
- ;; (sdb:qry 'get-id str))
- ;; (list "" "logs/final.log"))))
- ;; (set! *fdb* (filedb:open-db (conc *toppath* "/db/paths.db")))
dbstruct))
;; Open the classic megatest.db file in toppath
;;
(define (db:open-megatest-db)
@@ -772,21 +765,25 @@
(db:get-db dbstruct #f)
"SELECT fieldname FROM keys ORDER BY id DESC;")))
(set! *db-keys* res)
res)))
-;;
+;; look up values in a header/data structure
(define (db:get-value-by-header row header field)
- (debug:print-info 4 "db:get-value-by-header row: " row " header: " header " field: " field)
(if (null? header) #f
(let loop ((hed (car header))
(tal (cdr header))
(n 0))
(if (equal? hed field)
(vector-ref row n)
(if (null? tal) #f (loop (car tal)(cdr tal)(+ n 1)))))))
+;; Accessors for the header/data structure
+;; get rows and header from
+(define (db:get-header vec)(vector-ref vec 0))
+(define (db:get-rows vec)(vector-ref vec 1))
+
;;======================================================================
;; R U N S
;;======================================================================
(define (db:get-run-name-from-id dbstruct run-id)
@@ -828,13 +825,14 @@
'("")
patts))
comparator)))
-;; register a test run with the db
+;; register a test run with the db, this accesses the main.db and does NOT
+;; use server api
+;;
(define (db:register-run dbstruct keyvals runname state status user)
- (debug:print 3 "runs:register-run runname: " runname " state: " state " status: " status " user: " user)
(let* ((db (db:get-db dbstruct #f))
(keys (map car keyvals))
(keystr (keys->keystr keys))
(comma (if (> (length keys) 0) "," ""))
(andstr (if (> (length keys) 0) " AND " ""))
@@ -975,11 +973,11 @@
;; db:get-runs-by-patt
;; get runs by list of criteria
;; register a test run with the db
;;
-;; Use: (db-get-value-by-header (db:get-header runinfo)(db:get-row runinfo))
+;; Use: (db:get-value-by-header (db:get-header runinfo)(db:get-rows runinfo))
;; to extract info from the structure returned
;;
(define (db:get-runs-by-patt dbstruct keys runnamepatt targpatt offset limit) ;; test-name)
(let* ((tmp (runs:get-std-run-fields keys '("id" "runname" "state" "status" "owner" "event_time")))
(keystr (car tmp))
@@ -1013,11 +1011,11 @@
(db:get-db dbstruct #f)
qry-str
runnamepatt)))
(vector header res)))
-;; use (get-value-by-header (db:get-header runinfo)(db:get-row runinfo))
+;; use (get-value-by-header (db:get-header runinfo)(db:get-rows runinfo))
(define (db:get-run-info dbstruct run-id)
;;(if (hash-table-ref/default *run-info-cache* run-id #f)
;; (hash-table-ref *run-info-cache* run-id)
(let* ((res (vector #f #f #f #f))
(keys (db:get-keys dbstruct))
@@ -1331,11 +1329,11 @@
(let ((res 0))
(sqlite3:for-each-row
(lambda (count)
(set! res count))
(db:get-db dbstruct run-id)
- "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART');")
+ "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id NOT IN (SELECT id FROM runs WHERE state='deleted');")
res))
;; NEW BEHAVIOR: Look only at single run with run-id
;;
;; (define (db:get-running-stats dbstruct run-id)
@@ -1354,11 +1352,11 @@
(let ((res 0))
(sqlite3:for-each-row
(lambda (count)
(set! res count))
(db:get-db dbstruct run-id)
- "SELECT count(id) FROM tests WHERE state = 'RUNNING' OR state = 'LAUNCHED' OR state = 'REMOTEHOSTSTART'
+ "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART')
AND testname in (SELECT testname FROM test_meta WHERE jobgroup=?);"
jobgroup)
res)))
;; done with run when:
@@ -1897,14 +1895,14 @@
;; read the record given a testname
(define (db:testmeta-get-record dbstruct testname)
(let ((res #f))
(sqlite3:for-each-row
- (lambda (id testname author owner description reviewed iterated avg_runtime avg_disk tags)
- (set! res (vector id testname author owner description reviewed iterated avg_runtime avg_disk tags)))
+ (lambda (id testname author owner description reviewed iterated avg_runtime avg_disk tags jobgroup)
+ (set! res (vector id testname author owner description reviewed iterated avg_runtime avg_disk tags jobgroup)))
(db:get-db dbstruct #f)
- "SELECT id,testname,author,owner,description,reviewed,iterated,avg_runtime,avg_disk,tags FROM test_meta WHERE testname=?;"
+ "SELECT id,testname,author,owner,description,reviewed,iterated,avg_runtime,avg_disk,tags,jobgroup FROM test_meta WHERE testname=?;"
testname)
res))
;; create a new record for a given testname
(define (db:testmeta-add-record dbstruct testname)
Index: db_records.scm
==================================================================
--- db_records.scm
+++ db_records.scm
@@ -8,14 +8,15 @@
;; |-monitor.db
;; |-sdb.db
;; |-fdb.db
;; |-1.db
;; |-.db
+;;
(define (make-dbr:dbstruct #!key (path #f)(local #f))
(vector
#f ;; the main db (contains runs, test_meta etc.) NOT CACHED IN MEM
- (make-hash-table) ;; run-id => [ rundb inmemdb last-mod last-read last-sync ]
+ (make-hash-table) ;; run-id => [ rundb inmemdb last-mod last-read last-sync refdb ]
#f ;; the global string db (use for state, status etc.)
path ;; path to database files/megatest area
local)) ;; read-only local access
;;
@@ -39,12 +40,12 @@
;; get a rundb vector, create it if not already existing
(define (dbr:dbstruct-get-rundb-rec vec run-id)
(let* ((dbhash (dbr:dbstruct-get-dbhash vec)) ;; get the runs hash
(runvec (hash-table-ref/default dbhash run-id #f))) ;; get the vector for run-id
(if (vector? runvec)
- runvec ;; rundb inmemdb last-mod last-read last-sync in-use
- (let ((nvec (vector #f #f -1 -1 -1 #f)))
+ runvec ;; rundb inmemdb last-mod last-read last-sync in-use refdb
+ (let ((nvec (vector #f #f -1 -1 -1 #f #f)))
(hash-table-set! dbhash run-id nvec)
nvec))))
;; [ rundb inmemdb last-mod last-read last-sync ]
(define-inline (dbr:dbstruct-field-name->num field-name)
@@ -53,10 +54,11 @@
((inmem) 1) ;; the in-memory db
((mtime) 2) ;; last modification time
((rtime) 3) ;; last read time
((stime) 4) ;; last sync time
((inuse) 5) ;; is the db currently in use, #t yes, #f no.
+ ((refdb) 6) ;; the db used for reference (can be on disk or inmem)
(else -1)))
;; get/set rundb fields
(define (dbr:dbstruct-get-runvec-val vec run-id field-name)
(let ((runvec (dbr:dbstruct-get-rundb-rec vec run-id))
@@ -109,14 +111,10 @@
(define-inline (db:test-set-state! vec val)(vector-set! vec 3 val))
(define-inline (db:test-set-status! vec val)(vector-set! vec 4 val))
(define-inline (db:test-set-run_duration! vec val)(vector-set! vec 12 val))
(define-inline (db:test-set-final_logf! vec val)(vector-set! vec 13 val))
-;; get rows and header from
-(define-inline (db:get-header vec)(vector-ref vec 0))
-(define-inline (db:get-rows vec)(vector-ref vec 1))
-
;; make-vector-record "" db mintest id run_id testname state status event_time item_path
;;
(define (make-db:mintest)(make-vector 7))
(define-inline (db:mintest-get-id vec) (vector-ref vec 0))
(define-inline (db:mintest-get-run_id vec) (vector-ref vec 1))
@@ -209,13 +207,10 @@
(define-inline (tdb:step-stable-set-start! vec val)(vector-set! vec 1 val))
(define-inline (tdb:step-stable-set-end! vec val)(vector-set! vec 2 val))
(define-inline (tdb:step-stable-set-status! vec val)(vector-set! vec 3 val))
(define-inline (tdb:step-stable-set-runtime! vec val)(vector-set! vec 4 val))
-;; use this one for db-get-run-info
-(define-inline (db:get-row vec)(vector-ref vec 1))
-
;; The data structure for handing off requests via wire
(define (make-cdb:packet)(make-vector 6))
(define-inline (cdb:packet-get-client-sig vec) (vector-ref vec 0))
(define-inline (cdb:packet-get-qtype vec) (vector-ref vec 1))
(define-inline (cdb:packet-get-immediate vec) (vector-ref vec 2))
Index: docs/html/megatest.html
==================================================================
--- docs/html/megatest.html
+++ docs/html/megatest.html
@@ -2,11 +2,11 @@
-
+
Megatest User Manual
@@ -782,11 +782,11 @@
Note: The monitor is usable but incomplete as of Megatest v1.31. Click on the “Monitor” button on the dashboard to start the monitor and give it a try.