Overview
Comment: | Implemented fine grained deletion of runs and tests |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
09102f8425e4423c35d3cf292d1b704e |
User & Date: | matt on 2011-05-11 01:21:54 |
Other Links: | manifest | tags |
Context
2011-05-11
| ||
01:24 | Bumped version to 1.04 check-in: 28b7497853 user: matt tags: trunk | |
01:21 | Implemented fine grained deletion of runs and tests check-in: 09102f8425 user: matt tags: trunk | |
2011-05-09
| ||
18:06 | Exit status handling has to be hard coded to a number, can't seem to get a variable to work check-in: 290c7d7cc8 user: mrwellan tags: trunk | |
Changes
Modified db.scm from [499db9fa5f] to [5decf9595d].
︙ | |||
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | + + + + + + + + | (vector-ref row n) (if (null? tal) #f (loop (car tal)(cdr tal)(+ n 1))))))) ;;====================================================================== ;; R U N S ;;====================================================================== (define (runs:get-std-run-fields keys remfields) (let* ((header (append (map key:get-fieldname keys) remfields)) (keystr (conc (keys->keystr keys) "," (string-intersperse remfields ",")))) (list keystr header))) ;; replace header and keystr with a call to runs:get-std-run-fields (define (db-get-runs db runpatt . count) (let* ((res '()) (keys (db-get-keys db)) (remfields (list "id" "runname" "state" "status" "owner" "event_time")) (header (append (map key:get-fieldname keys) remfields)) (keystr (conc (keys->keystr keys) "," |
︙ | |||
155 156 157 158 159 160 161 162 163 164 165 166 167 168 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | + + + | (conc "SELECT " keystr " FROM runs WHERE id=?;") run-id) (vector header res))) (define (db:set-comment-for-run db run-id comment) (sqlite3:execute db "UPDATE runs SET comment=? WHERE id=?;" comment run-id)) (define (db:delete-run db run-id) (sqlite3:execute db "DELETE FROM runs WHERE id=?;" run-id)) ;;====================================================================== ;; T E S T S ;;====================================================================== (define (make-db:test)(make-vector 6)) (define-inline (db:test-get-id vec) (vector-ref vec 0)) (define-inline (db:test-get-run_id vec) (vector-ref vec 1)) |
︙ | |||
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | + + + + + + | (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment) (set! res (cons (vector id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment) res))) 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 run_id=? AND testname like ? AND item_path LIKE ? ORDER BY id DESC;" run-id testpatt (if itempatt itempatt "%")) res)) ;; this one is a bit broken BUG FIXME (define (db:delete-test-step-records db run-id test-name) (sqlite3:execute db "DELETE FROM test_steps WHERE test_id in (SELECT id FROM tests WHERE run_id=? AND testname=?);" run-id test-name)) ;; (define (db:delete-test-records db test-id) (sqlite3:execute db "DELETE FROM test_steps WHERE test_id=?;" test-id) (sqlite3:execute db "DELETE FROM tests WHERE id=?;" test-id)) (define (db:get-count-tests-running db) (let ((res 0)) (sqlite3:for-each-row (lambda (count) (set! res count)) db "SELECT count(id) FROM tests WHERE state = 'RUNNING' OR state = 'LAUNCHED' OR state = 'REMOTEHOSTSTART';") |
︙ |
Modified megatest.scm from [3711174da5] to [660b628f9e].
︙ | |||
42 43 44 45 46 47 48 49 50 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | + + + - - + + | -testpatt patt : in list-runs show only these tests, % is the wildcard -itempatt patt : in list-runs show only tests with items that match patt -showkeys : show the keys used in this megatest setup Misc -force : override some checks -xterm : start an xterm instead of launching the test -remove-runs : remove the data for a run, requires fields, :runname and -testpatt -testpatt patt : remove tests matching patt (requires -remove-runs) Helpers |
︙ | |||
73 74 75 76 77 78 79 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - - + | ":status" "-list-runs" "-testpatt" "-itempatt" "-setlog" "-runstep" "-logpro" |
︙ | |||
263 264 265 266 267 268 269 | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - + + - - + - - + + | (runtests)) ;;====================================================================== ;; Remove old run(s) ;;====================================================================== (define (remove-runs) (cond |
︙ |
Modified runs.scm from [55dbaeab50] to [40e5373888].
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | ;; register a test run with the db (define (register-run db keys) ;; test-name) (let* ((keystr (keys->keystr keys)) (comma (if (> (length keys) 0) "," "")) (andstr (if (> (length keys) 0) " AND " "")) (valslots (keys->valslots keys)) ;; ?,?,? ... |
︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | qryvals) (sqlite3:execute db "UPDATE runs SET state=?,status=? WHERE id=?;" state status res) res) (begin (print "ERROR: Called without all necessary keys") #f)))) ;; runs: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)) ;; to extract info from the structure returned ;; (define (runs:get-runs-by-patt db keys runnamepatt) ;; test-name) (let* ((keyvallst (keys->vallist keys)) (tmp (runs:get-std-run-fields keys '("id" "runname" "state" "status" "owner" "event_time"))) (keystr (car tmp)) (header (cadr tmp)) (res '()) (key-patt "")) (for-each (lambda (keyval) (let* ((key (vector-ref keyval 0)) (fulkey (conc ":" key)) (patt (args:get-arg fulkey))) (if patt (set! key-patt (conc key-patt " AND " key " like '" patt "'")) (begin (print "ERROR: searching for runs with no pattern set for " fulkey) (exit 6))))) keys) (sqlite3:for-each-row (lambda (a . r) (set! res (cons (list->vector (cons a r)) res))) 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) (sqlite3:execute db "INSERT OR IGNORE INTO tests (run_id,testname,event_time,item_path) VALUES (?,?,strftime('%s','now'),?);" run-id test-name item-path)) (define (test-set-status! db run-id test-name state status itemdat-or-path . comment) (let ((item-path (if (string? itemdat-or-path) itemdat-or-path (item-list->path itemdat-or-path)))) (sqlite3:execute db "UPDATE tests SET state=?,status=?,event_time=strftime('%s','now') WHERE run_id=? AND testname=? AND item_path=?;" state status run-id test-name item-path) |
︙ | |||
322 323 324 325 326 327 328 | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | ((cadr testdat)) (hash-table-delete! *waiting-queue* testname))) (if (not db) (sqlite3:finalize! ldb)))) waiting-test-names) (sleep 10) ;; no point in rushing things at this stage? (loop (hash-table-keys *waiting-queue*))))))) |
Modified tests/megatest.config from [bf33696f68] to [0d07485d64].
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | - + | [fields] sysname TEXT fsname TEXT datapath TEXT [setup] # exectutable /path/to/megatest |
︙ |
Modified tests/tests/sqlitespeed/runscript.rb from [0c7cdb0a88] to [404979dd42].
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - + | num_records=rand(60) # 0000 record_step("add #{num_records}","start","n/a") status=false (0..num_records).each do |i| randstring="a;lskdfja;sdfj;alsdfj;aslfdj;alsfja;lsfdj;alsfja;lsjfd;lasfjl;asdfja;slfj;alsjf;asljf;alsjf;lasdjf;lasjf;lasjf;alsjf;lashflkashflkerhflkdsvnlasldhlfaldf" # status=system "sqlite3 testing.db \"insert into blah (name) values ('#{randstring}');\"" system "megatest -step testing :state wrote_junk :status #{num_records}" |
︙ |