Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -82,11 +82,11 @@ CONSTRAINT metadat_constraint UNIQUE (id,var));") (db:set-var db "MEGATEST_VERSION" megatest-version) (sqlite3:execute db "CREATE TABLE access_log (id INTEGER PRIMARY KEY, user TEXT, accessed TIMESTAMP, args TEXT);"))) db)) -(define (patch-db db) +(define (patch-db db)heh (handle-exceptions exn (begin (print "Exception: " exn) (print "ERROR: Possible out of date schema, attempting to add table metadata...") Index: launch.scm ================================================================== --- launch.scm +++ launch.scm @@ -20,38 +20,10 @@ (if *toppath* (setenv "MT_RUN_AREA_HOME" *toppath*) ;; to be deprecated (debug:print 0 "ERROR: failed to find the top path to your run setup.")) *toppath*) -(define (setup-env-defaults db fname run-id . already-seen) - (let* ((keys (get-keys db)) - (keyvals (get-key-vals db run-id)) - (thekey (string-intersperse (map (lambda (x)(if x x "-na-")) keyvals) "/")) - (confdat (read-config fname)) - (whatfound (make-hash-table)) - (sections (list "default" thekey))) - (debug:print 4 "Using key=\"" thekey "\"") - (for-each - (lambda (section) - (let ((section-dat (hash-table-ref/default confdat section #f))) - (if section-dat - (for-each - (lambda (envvar) - (hash-table-set! whatfound section (+ (hash-table-ref/default whatfound section 0) 1)) - (setenv envvar (cadr (assoc envvar section-dat)))) - (map car section-dat))))) - sections) - (if (and (not (null? already-seen)) - (not (car already-seen))) - (begin - (debug:print 2 "Key settings found in runconfig.config:") - (for-each (lambda (fullkey) - (debug:print 2 (format #f "~20a ~a\n" fullkey (hash-table-ref/default whatfound fullkey 0)))) - sections) - (debug:print 2 "---") - (set! *already-seen-runconfig-info* #t))))) - (define (get-best-disk confdat) (let* ((disks (hash-table-ref/default confdat "disks" #f)) (best #f) (bestsize 0)) (if disks @@ -92,12 +64,16 @@ (debug:print 2 "Setting up test run area") (debug:print 2 " - creating run area in " dfullp) (system (conc "mkdir -p " dfullp)) (debug:print 2 " - creating link from " dfullp "/" testname " to " lnkpath) (system (conc "mkdir -p " lnkpath)) - (if (file-exists? (conc lnkpath "/" testname)) - (system (conc "rm -f " lnkpath "/" testname))) + +;; I suspect this section was deleting test directories under some +;; wierd sitations + +;; (if (file-exists? (conc lnkpath "/" testname)) +;; (system (conc "rm -f " lnkpath "/" testname))) (system (conc "ln -sf " dfullp " " lnkpath "/" testname)) (if (directory? dfullp) (begin (let* ((cmd (conc "rsync -av" (if (> *verbosity* 1) "" "q") " " test-path "/ " dfullp "/")) (status (system cmd))) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -118,11 +118,11 @@ (include "db.scm") (include "configf.scm") (include "process.scm") (include "launch.scm") (include "runs.scm") -;; (include "gui.scm") +(include "runconfig.scm") (define *didsomething* #f) ;;====================================================================== ;; Misc setup stuff @@ -362,14 +362,11 @@ (debug:print 0 "Failed to setup, exiting") (exit 1))) ;; now can find our db (set! db (open-db)) (change-directory work-area) - (let ((runconfigf (conc *toppath* "/runconfigs.config"))) - (if (file-exists? runconfigf) - (setup-env-defaults db runconfigf run-id) - (debug:print 0 "WARNING: You do not have a run config file: " runconfigf))) + (set-run-config-vars db run-id) ;; environment overrides are done *before* the remaining critical envars. (alist->env-vars env-ovrd) (set-megatest-env-vars db run-id) (set-item-env-vars itemdat) (save-environment-as-files "megatest") ADDED runconfig.scm Index: runconfig.scm ================================================================== --- /dev/null +++ runconfig.scm @@ -0,0 +1,38 @@ +;;====================================================================== +;; read a config file, loading only the section pertinent +;; to this run field1val/field2val/field3val ... +;;====================================================================== +(define (setup-env-defaults db fname run-id . already-seen) + (let* ((keys (get-keys db)) + (keyvals (get-key-vals db run-id)) + (thekey (string-intersperse (map (lambda (x)(if x x "-na-")) keyvals) "/")) + (confdat (read-config fname)) + (whatfound (make-hash-table)) + (sections (list "default" thekey))) + (debug:print 4 "Using key=\"" thekey "\"") + (for-each + (lambda (section) + (let ((section-dat (hash-table-ref/default confdat section #f))) + (if section-dat + (for-each + (lambda (envvar) + (hash-table-set! whatfound section (+ (hash-table-ref/default whatfound section 0) 1)) + (setenv envvar (cadr (assoc envvar section-dat)))) + (map car section-dat))))) + sections) + (if (and (not (null? already-seen)) + (not (car already-seen))) + (begin + (debug:print 2 "Key settings found in runconfig.config:") + (for-each (lambda (fullkey) + (debug:print 2 (format #f "~20a ~a\n" fullkey (hash-table-ref/default whatfound fullkey 0)))) + sections) + (debug:print 2 "---") + (set! *already-seen-runconfig-info* #t))))) + +(define (set-run-config-vars db run-id) + (let ((runconfigf (conc *toppath* "/runconfigs.config"))) + (if (file-exists? runconfigf) + (setup-env-defaults db runconfigf run-id) + (debug:print 0 "WARNING: You do not have a run config file: " runconfigf)))) + Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -73,18 +73,22 @@ db (conc "SELECT " keystr " FROM runs WHERE runname like ? " key-patt ";") runnamepatt) (vector header res))) -(define (register-test db run-id test-name item-path) +(define (register-test db run-id test-name item-path tags) (let ((item-paths (if (equal? item-path "") (list item-path) (list item-path "")))) (for-each (lambda (pth) - (sqlite3:execute db "INSERT OR IGNORE INTO tests (run_id,testname,event_time,item_path,state,status) VALUES (?,?,strftime('%s','now'),?,'NOT_STARTED','n/a');" run-id test-name pth)) - item-paths))) + (sqlite3:execute db "INSERT OR IGNORE INTO tests (run_id,testname,event_time,item_path,state,status,tags) VALUES (?,?,strftime('%s','now'),?,'NOT_STARTED','n/a',?);" + run-id + test-name + pth + (conc "," (string-intersperse tags ",") ","))) + item-paths ))) ;; (define db (open-db)) ;; (test-set-status! db 2 "runfirst" "COMPLETED" "PASS" "summer") (define (test-set-status! db run-id test-name state status itemdat-or-path . comment) @@ -313,11 +317,13 @@ (let* ((test-path (conc *toppath* "/tests/" test-name)) (test-configf (conc test-path "/testconfig")) (testexists (and (file-exists? test-configf)(file-read-access? test-configf))) (test-conf (if testexists (read-config test-configf) (make-hash-table))) (waiton (let ((w (config-lookup test-conf "requirements" "waiton"))) - (if (string? w)(string-split w)'())))) + (if (string? w)(string-split w)'()))) + (tags (let ((t (config-lookup test-conf "setup" "tags"))) + (if (string? t)(string-split t ",") '())))) (if (not testexists) (begin (debug:print 0 "ERROR: Can't find config file " test-configf) (exit 2)) ;; put top vars into convenient variables and open the db @@ -358,11 +364,11 @@ (let loop2 ((ts (db:get-test-info db run-id test-name item-path)) ;; #f) (ct 0)) (if (and (not ts) (< ct 10)) (begin - (register-test db run-id test-name item-path) + (register-test db run-id test-name item-path tags) (db:test-set-comment db run-id test-name item-path "") (loop2 (db:get-test-info db run-id test-name item-path) (+ ct 1))) (if ts (set! testdat ts) Index: tests/tests/sqlitespeed/testconfig ================================================================== --- tests/tests/sqlitespeed/testconfig +++ tests/tests/sqlitespeed/testconfig @@ -1,7 +1,8 @@ [setup] runscript runscript.rb +tags non important,dumb junk [requirements] waiton runfirst [items]