Overview
Comment: | Got test1 running completely clean |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | test-specific-db |
Files: | files | file ages | folders |
SHA1: |
7dfcb764c65baa7c723a204871ad62c9 |
User & Date: | mrwellan on 2012-10-05 11:37:20 |
Other Links: | branch diff | manifest | tags |
Context
2012-10-05
| ||
16:25 | rpc updates, test1 passes check-in: 105f6a0b2b user: mrwellan tags: test-specific-db | |
11:37 | Got test1 running completely clean check-in: 7dfcb764c6 user: mrwellan tags: test-specific-db | |
2012-10-04
| ||
16:17 | Merged with earlier edits check-in: 902282795a user: matt tags: test-specific-db | |
Changes
Modified db.scm from [85e60dcc09] to [08549858d2].
︙ | ︙ | |||
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 | ;; 2. set status to n/a (begin (db:test-set-state! res "NOT_STARTED") (db:test-set-status! res "n/a"))))) (define *last-test-cache-delete* (current-seconds)) ;; Get test data using test_id (define (db:get-test-info-cached-by-id db test-id) ;; is all this crap really worth it? I somehow doubt it. (let* ((last-delete-str (db:get-var db "DELETED_TESTS")) (last-delete (if (string? last-delete-str)(string->number last-delete-str) #f))) (if (and last-delete (> last-delete *last-test-cache-delete*)) (begin (set! *test-info* (make-hash-table)) (set! *test-id-cache* (make-hash-table)) (set! *last-test-cache-delete* last-delete) (debug:print 4 "INFO: Clearing test data cache")))) (if (not test-id) (begin (debug:print 4 "INFO: db:get-test-info-by-id called with test-id=" test-id) #f) (let* ((res (hash-table-ref/default *test-info* test-id #f))) | > > > > | > | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | ;; 2. set status to n/a (begin (db:test-set-state! res "NOT_STARTED") (db:test-set-status! res "n/a"))))) (define *last-test-cache-delete* (current-seconds)) (define (db:clean-all-caches) (set! *test-info* (make-hash-table)) (set! *test-id-cache* (make-hash-table))) ;; Get test data using test_id (define (db:get-test-info-cached-by-id db test-id) ;; is all this crap really worth it? I somehow doubt it. (let* ((last-delete-str (db:get-var db "DELETED_TESTS")) (last-delete (if (string? last-delete-str)(string->number last-delete-str) #f))) (if (and last-delete (> last-delete *last-test-cache-delete*)) (begin (set! *test-info* (make-hash-table)) (set! *test-id-cache* (make-hash-table)) (set! *last-test-cache-delete* last-delete) (debug:print 4 "INFO: Clearing test data cache")))) (if (not test-id) (begin (debug:print 4 "INFO: db:get-test-info-by-id called with test-id=" test-id) #f) (let* ((res (hash-table-ref/default *test-info* test-id #f))) (if (and res (member (db:test-get-state res) '("RUNNING" "COMPLETED"))) (db:patch-tdb-data-into-test-info db test-id res) ;; if no cached value then full read and write to cache (begin (sqlite3:for-each-row (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment) ;; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 (set! res (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment))) |
︙ | ︙ | |||
862 863 864 865 866 867 868 | ;; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 (set! res (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment))) db "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment FROM tests WHERE id=?;" test-id) res))) | | | 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | ;; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 (set! res (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run_duration final_logf comment))) db "SELECT id,run_id,testname,state,status,event_time,host,cpuload,diskfree,uname,rundir,item_path,run_duration,final_logf,comment FROM tests WHERE id=?;" test-id) res))) (define db:get-test-info-by-id db:get-test-info-not-cached-by-id) (define (db:get-test-info db run-id testname item-path) (db:get-test-info-by-id db (db:get-test-id db run-id testname item-path))) (define (db:test-set-comment db test-id comment) (sqlite3:execute db |
︙ | ︙ |
Modified runs.scm from [a54f46b638] to [edab199daa].
︙ | ︙ | |||
454 455 456 457 458 459 460 | (for-each (lambda (my-itemdat) (let* ((new-test-record (let ((newrec (make-tests:testqueue))) (vector-copy! test-record newrec) newrec)) (my-item-path (item-list->path my-itemdat))) (if (patt-list-match my-item-path item-patts) ;; yes, we want to process this item, NOTE: Should not need this check here! | | | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | (for-each (lambda (my-itemdat) (let* ((new-test-record (let ((newrec (make-tests:testqueue))) (vector-copy! test-record newrec) newrec)) (my-item-path (item-list->path my-itemdat))) (if (patt-list-match my-item-path item-patts) ;; yes, we want to process this item, NOTE: Should not need this check here! (let ((newtestname (runs:make-full-test-name hed my-item-path))) ;; test names are unique on testname/item-path (tests:testqueue-set-items! new-test-record #f) (tests:testqueue-set-itemdat! new-test-record my-itemdat) (tests:testqueue-set-item_path! new-test-record my-item-path) (hash-table-set! test-records newtestname new-test-record) (set! tal (cons newtestname tal)))))) ;; since these are itemized create new test names testname/itempath items) (if (not (null? tal)) |
︙ | ︙ |
Modified tests/tests.scm from [8b33f1945e] to [8c1a0dd425].
︙ | ︙ | |||
128 129 130 131 132 133 134 | (print "Using " testdbpath " for test db") (test #f #t (let ((db (open-test-db testdbpath))) (set! *tdb* db) (sqlite3#database? db))) (sqlite3#finalize! *tdb*) ;; (test "Remove the rollup run" #t (begin (remove-runs) #t)) | | > > > > | > > > > > > > > > > > > > | > > > > > > | | > > > > > > > | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | (print "Using " testdbpath " for test db") (test #f #t (let ((db (open-test-db testdbpath))) (set! *tdb* db) (sqlite3#database? db))) (sqlite3#finalize! *tdb*) ;; (test "Remove the rollup run" #t (begin (remove-runs) #t)) (define tconfig #f) (test "get a testconfig" #t (let ((tconf (tests:get-testconfig "test1" 'return-procs))) (set! tconfig tconf) (hash-table? tconf))) (db:clean-all-caches) ;; (set! *verbosity* 20) (test "Run a test" #t (general-run-call "-runtests" "run a test" (lambda (target runname keys keynames keyvallst) (let ((test-patts "test%")) ;; (runs:run-tests target runname test-patts user (make-hash-table)) (run:test 1 ;; run-id (args:get-arg ":runname") (keys:target->keyval keys target) (vector "test1" ;; testname tconfig ;; testconfig '() ;; waitons 0 ;; priority #f ;; items #f ;; itemsdat #f ;; spare ) args:arg-hash ;; flags (e.g. -itemspatt) #f))))) (test "cache is coherent" #t (let ((cached-info (db:get-test-info-cached-by-id db 2)) (non-cached (db:get-test-info-not-cached-by-id db 2))) (print "\nCached: " cached-info) (print "Noncached: " non-cached) (equal? cached-info non-cached))) (change-directory test-work-dir) (test "Add a step" #t (begin (db:teststep-set-status! db 2 "step1" "start" 0 "This is a comment" "mylogfile.html") (sleep 2) (db:teststep-set-status! db 2 "step1" "end" "pass" "This is a different comment" "finallogfile.html") (set! test-id (db:test-get-id (car (db:get-tests-for-run db 1 "test1" "" '() '())))) (number? test-id))) (sleep 4) (test "Get rundir" #t (let ((rundir (db:test-get-rundir-from-test-id db test-id))) (print "Rundir" rundir) (string? rundir))) (test "Create a test db" "../simpleruns/key1/key2/myrun/test1/testdat.db" (let ((tdb (db:open-test-db-by-test-id db test-id))) (sqlite3#finalize! tdb) (file-exists? "../simpleruns/key1/key2/myrun/test1/testdat.db"))) (test "Get steps for test" #t (> (length (db:get-steps-for-test db test-id)) 0)) (test "Get nice table for steps" "2s" (begin (vector-ref (hash-table-ref (db:get-steps-table db test-id) "step1") 4))) (test "Rollup the run(s)" #t (begin (runs:rollup-run keys (keys->alist keys "na") "rollup" "matt") #t)) |
︙ | ︙ |