Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -14,8 +14,8 @@ $(PREFIX)/bin/dashboard : dashboard cp dashboard $(PREFIX)/bin/dashboard install : $(PREFIX)/bin/megatest $(PREFIX)/bin/dashboard -test: megatest tests/tests.scm +test: tests/tests.scm cd tests;csi -I .. -b -n tests.scm Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -25,12 +25,12 @@ (if (null? remcwd) (list #f #f #f) ;; #f #f) (loop remcwd)))))))) (define (config:assoc-safe-add alist key val) - (let ((newalist (filter (lambda (x)(not (equal? key x))) alist))) - (append alist (list (list key val))))) + (let ((newalist (filter (lambda (x)(not (equal? key (car x)))) alist))) + (append newalist (list (list key val))))) ;; read a config file, returns two level hierarchial hash-table, ;; adds to ht if given (must be #f otherwise) (define (read-config path . ht) (if (not (file-exists? path)) @@ -40,25 +40,28 @@ (include-rx (regexp "^\\[include\\s+(.*)\\]\\s*$")) (section-rx (regexp "^\\[(.*)\\]\\s*$")) (blank-l-rx (regexp "^\\s*$")) (key-sys-pr (regexp "^(\\S+)\\s+\\[system\\s+(\\S+.*)\\]\\s*$")) (key-val-pr (regexp "^(\\S+)\\s+(.*)$")) - (comment-rx (regexp "^\\s*#.*"))) + (comment-rx (regexp "^\\s*#.*")) + (cont-ln-rx (regexp "^(\\s+)(\\S+.*)$"))) (let loop ((inl (read-line inp)) - (curr-section-name "default")) + (curr-section-name "default") + (var-flag #f);; turn on for key-var-pr and cont-ln-rx, turn off elsewhere + (lead #f)) (if (eof-object? inl) (begin (close-input-port inp) res) (regex-case inl - (comment-rx _ (loop (read-line inp) curr-section-name)) - (blank-l-rx _ (loop (read-line inp) curr-section-name)) + (comment-rx _ (loop (read-line inp) curr-section-name #f #f)) + (blank-l-rx _ (loop (read-line inp) curr-section-name #f #f)) (include-rx ( x include-file ) (begin (read-config include-file res) - (loop (read-line inp) curr-section-name))) - (section-rx ( x section-name ) (loop (read-line inp) section-name)) + (loop (read-line inp) curr-section-name #f #f))) + (section-rx ( x section-name ) (loop (read-line inp) section-name #f #f)) (key-sys-pr ( x key cmd ) (let ((alist (hash-table-ref/default res curr-section-name '())) (val (let* ((cmdres (cmd-run->list cmd)) (status (cadr cmdres)) (res (car cmdres))) (if (not (eq? status 0)) @@ -69,17 +72,32 @@ "" (string-intersperse res " "))))) (hash-table-set! res curr-section-name (config:assoc-safe-add alist key val)) ;; (append alist (list (list key val)))) - (loop (read-line inp) curr-section-name))) + (loop (read-line inp) curr-section-name #f #f))) (key-val-pr ( x key val ) (let ((alist (hash-table-ref/default res curr-section-name '()))) (hash-table-set! res curr-section-name (config:assoc-safe-add alist key val)) - ;; (append alist (list (list key val)))) - (loop (read-line inp) curr-section-name))) + (loop (read-line inp) curr-section-name key #f))) + ;; if a continued line + (cont-ln-rx ( x whsp val ) (let ((alist (hash-table-ref/default res curr-section-name '()))) + (if var-flag ;; if set to a string then we have a continued var + (let ((newval (conc + (config-lookup res curr-section-name var-flag) "\n" + ;; trim lead from the incoming whsp to support some indenting. + (if lead + (string-substitute (regexp lead) "" whsp) + "") + val))) + (print "val: " val "\nnewval: \"" newval "\"\nvarflag: " var-flag) + (hash-table-set! res curr-section-name + (config:assoc-safe-add alist var-flag newval)) + (loop (read-line inp) curr-section-name var-flag (if lead lead whsp))) + (loop (read-line inp) curr-section-name #f #f)))) (else (debug:print 0 "ERROR: problem parsing " path ",\n \"" inl "\"") + (set! var-flag #f) (loop (read-line inp) curr-section-name)))))))) (define (find-and-read-config fname) (let* ((curr-dir (current-directory)) (configinfo (find-config fname)) Index: db.scm ================================================================== --- db.scm +++ db.scm @@ -79,11 +79,23 @@ CONSTRAINT test_steps_constraint UNIQUE (test_id,stepname,state));") (sqlite3:execute db "CREATE TABLE extradat (id INTEGER PRIMARY KEY, run_id INTEGER, key TEXT, val TEXT);") (sqlite3:execute db "CREATE TABLE metadat (id INTEGER PRIMARY KEY, var TEXT, val TEXT, 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);"))) + (sqlite3:execute db "CREATE TABLE access_log (id INTEGER PRIMARY KEY, user TEXT, accessed TIMESTAMP, args TEXT);") + (sqlite3:execute db "CREATE TABLE test_meta (id INTEGER PRIMARY KEY, + testname TEXT DEFAULT '', + author TEXT DEFAULT '', + owner TEXT DEFAULT '', + description TEXT DEFAULT '', + reviewed TIMESTAMP, + iterated TEXT DEFAULT '', + avg_runtime REAL, + avg_disk REAL, + CONSTRAINT test_meta_contstraint UNIQUE (id,testname));") + + )) db)) ;;====================================================================== ;; TODO: ;; put deltas into an assoc list with version numbers @@ -99,11 +111,11 @@ CONSTRAINT metadat_constraint UNIQUE (id,var));") (sqlite3:execute db "ALTER TABLE tests ADD COLUMN tags TEXT DEFAULT '';") (db:set-var db "MEGATEST_VERSION" 1.17) ) (let ((mver (db:get-var db "MEGATEST_VERSION"))) - (if(not mver) + (if (not mver) (begin (print "Adding megatest-version to metadata") (sqlite3:execute db (db:set-var db "MEGATEST_VERSION" megatest-version)))) (if (< mver 1.18) (begin Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -302,22 +302,18 @@ ;; - step completed, exit status, timestamp ;; 6. test phone home ;; - if test run time > allowed run time then kill job ;; - if cannot access db > allowed disconnect time then kill job - -(define (runtests) +(if (args:get-arg "-runtests") (general-run-call "-runtests" "run a test" (lambda (db keys keynames keyvallst) (let ((test-names (string-split (args:get-arg "-runtests") ","))) (run-tests db test-names))))) -(if (args:get-arg "-runtests") - (runtests)) - ;;====================================================================== ;; execute the test ;; - gets called on remote host ;; - receives info from the -execute param ;; - passes info to steps via MT_CMDINFO env var (future is to use a dot file) Index: runs.scm ================================================================== --- runs.scm +++ runs.scm @@ -426,10 +426,16 @@ (begin (print "items: ")(pp (item-assoc->item-list items)) (print "itestable: ")(pp (item-table->item-list itemstable)))) (if (args:get-arg "-m") (db:set-comment-for-run db run-id (args:get-arg "-m"))) + ;; Here is where the test_meta table is best updated + (for-each + (lambda (key) + (let ((val (config-lookup *configdat* "test_meta" key))) + + ;; braindead work-around for poorly specified allitems list BUG!!! FIXME (if (null? allitems)(set! allitems '(()))) (let loop ((itemdat (car allitems)) (tal (cdr allitems))) ;; (lambda (itemdat) ;;; ((ripeness "overripe") (temperature "cool") (season "summer")) Index: tests/test.config ================================================================== --- tests/test.config +++ tests/test.config @@ -17,5 +17,15 @@ blah nada # now inlcude a file tha tdoes exist [include megatest.config] + +[metadata] +description This is a multiline + description. The leading whitespace is discarded + irrespective of amount of indenting. + This line is indented more. + + +author matt +lastreview never Index: tests/tests.scm ================================================================== --- tests/tests.scm +++ tests/tests.scm @@ -18,10 +18,11 @@ (set! conffile (read-config "test.config")) (test "Get available diskspace" #t (number? (get-df "./"))) (test "Get best dir" #t (let ((bestdir (get-best-disk conffile))) (or (equal? "./" bestdir) (equal? "/tmp" bestdir)))) +(test "Multiline variable" 4 (length (string-split (config-lookup conffile "metadata" "description") "\n"))) ;; db (define row (vector "a" "b" "c" "blah")) (define header (list "col1" "col2" "col3" "col4")) (test "Get row by header" "blah" (db:get-value-by-header row header "col4")) @@ -60,11 +61,11 @@ (test "get all legal tests" (list "runfirst" "runwithfirst" "singletest" "singletest2" "sqlitespeed") (sort (get-all-legal-tests) string<=?)) (test "register-test, test info" "NOT_STARTED" (begin - (register-test *db* 1 "nada" "") + (register-test *db* 1 "nada" "" '("tag1" "tag2" "tag3")) (test:get-state (db:get-test-info *db* 1 "nada" "")))) (test "get-keys" "sysname" (key:get-fieldname (car (sort (db-get-keys *db*)(lambda (a b)(string>=? (vector-ref a 0)(vector-ref b 0))))))) (define remargs (args:get-args Index: tests/tests/runfirst/testconfig ================================================================== --- tests/tests/runfirst/testconfig +++ tests/tests/runfirst/testconfig @@ -12,5 +12,13 @@ [itemstable] BLOCK a b TOCK 1 2 +[test_meta] +author matt +owner bob +description This test must + be run before the other tests + +tags first,single +reviewed 1/1/1965