Overview
Comment: | Many tweaks for server mode |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | servermode |
Files: | files | file ages | folders |
SHA1: |
a941b43e9137e75347551ef1002fc37f |
User & Date: | matt on 2012-03-11 18:33:08 |
Other Links: | branch diff | manifest | tags |
Context
2012-03-11
| ||
20:01 | Tweaks for server mode check-in: e51571f4ff user: matt tags: servermode | |
18:33 | Many tweaks for server mode check-in: a941b43e91 user: matt tags: servermode | |
13:31 | Couple tweaks to improve server mode check-in: 7f3c39ccb6 user: matt tags: servermode | |
Changes
Modified common.scm from [4f03816054] to [28e4357992].
︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + | (define *waiting-queue* (make-hash-table)) (define *test-meta-updated* (make-hash-table)) (define *globalexitstatus* 0) ;; attempt to work around possible thread issues (define *passnum* 0) ;; when running track calls to run-tests or similar (define *verbosity* 1) (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 <host port> (define *last-db-access* 0) ;; update when db is accessed via server (define (get-with-default val default) (let ((val (args:get-arg val))) (if val val default))) (define (assoc/default key lst . default) (let ((res (assoc key lst))) |
︙ |
Modified db.scm from [a300371475] to [48ed807e56].
︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | - + + + | (define *incoming-mutex* (make-mutex)) (define *cache-on* #f) (define (open-db) ;; (conc *toppath* "/megatest.db") (car *configinfo*))) (let* ((dbpath (conc *toppath* "/megatest.db")) ;; fname) (dbexists (file-exists? dbpath)) (db (sqlite3:open-database dbpath)) ;; (never-give-up-open-db dbpath)) |
︙ | |||
536 537 538 539 540 541 542 | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | - + - - + + - + - - + + | (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)) |
︙ | |||
680 681 682 683 684 685 686 687 | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | + + - + - - | ((meta-info) (apply sqlite3:execute meta-stmt (vector-ref entry 2))) ((step-status) (apply sqlite3:execute step-stmt (vector-ref entry 2))) (else (debug:print 0 "ERROR: Queued entry not recognised " entry)))) data))) (sqlite3:finalize! meta-stmt) ;; sqlite is the bottleneck, clear the statements asap? (sqlite3:finalize! step-stmt) (set! *incoming-data* '()) |
︙ | |||
711 712 713 714 715 716 717 | 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | - + + + | db "UPDATE tests SET state=CASE WHEN (SELECT count(id) FROM tests WHERE run_id=? AND testname=? AND item_path != '' AND state in ('RUNNING','NOT_STARTED')) > 0 THEN 'RUNNING' ELSE 'COMPLETED' END, status=CASE WHEN fail_count > 0 THEN 'FAIL' WHEN pass_count > 0 AND fail_count=0 THEN 'PASS' ELSE 'UNKNOWN' END WHERE run_id=? AND testname=? AND item_path='';" |
︙ | |||
807 808 809 810 811 812 813 | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 | - + - - - - - - - - - - - - - - - + + + + + + + + + | (sqlite3:for-each-row (lambda (id test_id category variable value expected tol units comment status type) (set! res (cons (vector id test_id category variable value expected tol units comment status type) res))) db "SELECT id,test_id,category,variable,value,expected,tol,units,comment,status,type FROM test_data WHERE test_id=? AND category LIKE ? ORDER BY category,variable;" test-id categorypatt) (reverse res))) |
︙ | |||
1174 1175 1176 1177 1178 1179 1180 | 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | - + - - + + - + - - + + | (if *runremote* (let ((host (vector-ref *runremote* 0)) (port (vector-ref *runremote* 1))) ((rpc:procedure 'rdb:roll-up-pass-fail-counts host port) run-id test-name item-path status)) (db:roll-up-pass-fail-counts db run-id test-name item-path status))) |
︙ |
Modified launch.scm from [5ea99db72b] to [08d732cd8f].
︙ | |||
204 205 206 207 208 209 210 | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | - + | (processloop (+ i 1)))) )) (let ((exinfo (vector-ref exit-info 2)) (logfna (if logpro-used (conc stepname ".html") ""))) ;; testing if procedures called in a remote call cause problems (ans: no or so I suspect) (rdb:teststep-set-status! db test-id stepname "end" exinfo itemdat #f logfna)) (if logpro-used |
︙ |
Modified megatest.scm from [a532abd9c2] to [cba9eecfc2].
︙ | |||
159 160 161 162 163 164 165 166 167 168 169 170 171 172 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | + | ;; misc "-server" "-extract-ods" "-pathmod" "-env2file" "-setvars" "-debug" ;; for *verbosity* > 2 "-override-timeout" ) (list "-h" "-force" "-xterm" "-showkeys" "-test-status" "-set-values" |
︙ | |||
337 338 339 340 341 342 343 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | + - - + + + + + | (if (and (args:get-arg "-server") (not (or (args:get-arg "-runall") (args:get-arg "-runtests")))) (let* ((toppath (setup-for-run)) (db (if toppath (open-db) #f))) (debug:print 0 "INFO: Starting the standalone server") (if db (let* ((host:port (db:get-var "SERVER")) ;; this doen't support multiple servers BUG!!!! |
︙ | |||
617 618 619 620 621 622 623 | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | - + - + | (debug:print 0 "Failed to setup, exiting") (exit 1))) (set! db (open-db)) (if (not (args:get-arg "-server")) (server:client-setup db)) (if (args:get-arg "-load-test-data") ;; has sub commands that are rdb: |
︙ | |||
667 668 669 670 671 672 673 | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | - + | (oldexitstat exitstat) (cmd (string-intersperse (list "logpro" logprofile htmllogfile "<" logfile ">" (conc stepname "_logpro.log")) " "))) (debug:print 2 "INFO: running \"" cmd "\"") (change-directory startingdir) (set! exitstat (system cmd)) (set! *globalexitstatus* exitstat) ;; no necessary (change-directory testpath) |
︙ |
Modified runs.scm from [7a34943964] to [4ae48c4de9].
︙ | |||
257 258 259 260 261 262 263 264 265 266 267 268 269 270 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | + | (if (not (null? remtests)) (loop (car remtests)(cdr remtests))))))) (if (not (null? required-tests)) (debug:print 1 "INFO: Adding " required-tests " to the run queue")) ;; NOTE: these are all parent tests, items are not expanded yet. (runs:run-tests-queue db run-id runname test-records keyvallst flags) (if *rpc:listener* (server:keep-running db)) (debug:print 4 "INFO: All done by here"))) (define (runs:run-tests-queue db run-id runname test-records keyvallst flags) ;; At this point the list of parent tests is expanded ;; NB// Should expand items here and then insert into the run queue. (debug:print 5 "test-records: " test-records ", keyvallst: " keyvallst) (let ((sorted-test-names (tests:sort-by-priority-and-waiton test-records)) |
︙ | |||
360 361 362 363 364 365 366 | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | - - + + + | (debug:print 0 "ERROR: Should not have a list of items in a test and the itemspath set - please report this") (exit 1)))) ;; we get here on "drop through" - loop for next test in queue (if (null? tal) (begin ;; FIXME!!!! THIS SHOULD NOT REQUIRE AN EXIT!!!!!!! |
︙ | |||
595 596 597 598 599 600 601 | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | - + | (debug:print 0 "Failed to setup, exiting") (exit 1))) (set! db (open-db)) (if (args:get-arg "-server") (server:start db (args:get-arg "-server")) (if (not (or (args:get-arg "-runall") (args:get-arg "-runtests"))) |
︙ |
Modified server.scm from [19c58ea73a] to [2c62a156d9].
︙ | |||
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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 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 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 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 | + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + | ;;====================================================================== ;; db specials here ;;====================================================================== ;; ** set-tests-state-status (rpc:publish-procedure! 'rdb:set-tests-state-status (lambda (run-id testnames currstate currstatus newstate newstatus) (set! *last-db-access* (current-seconds)) (db:set-tests-state-status db run-id testnames currstate currstatus newstate newstatus))) (rpc:publish-procedure! 'rdb:teststep-set-status! (lambda (test-id teststep-name state-in status-in item-path comment logfile) (set! *last-db-access* (current-seconds)) (db:teststep-set-status! db test-id teststep-name state-in status-in item-path comment logfile))) (rpc:publish-procedure! 'rdb:test-update-meta-info (lambda (run-id testname item-path minutes cpuload diskfree tmpfree) (set! *last-db-access* (current-seconds)) (db:test-update-meta-info db run-id testname item-path minutes cpuload diskfree tmpfree))) (rpc:publish-procedure! 'rdb:test-set-state-status-by-run-id-testname (lambda (run-id test-name item-path status state) (set! *last-db-access* (current-seconds)) (db:test-set-state-status-by-run-id-testname db run-id test-name item-path status state))) (rpc:publish-procedure! 'rdb:csv->test-data (lambda (test-id csvdata) (set! *last-db-access* (current-seconds)) (db:csv->test-data db test-id csvdata))) (rpc:publish-procedure! 'rdb:roll-up-pass-fail-counts (lambda (run-id test-name item-path status) (set! *last-db-access* (current-seconds)) (db:roll-up-pass-fail-counts db run-id test-name item-path status))) (rpc:publish-procedure! 'rdb:test-set-comment (lambda (run-id test-name item-path comment) (set! *last-db-access* (current-seconds)) (db:test-set-comment db run-id test-name item-path comment))) (rpc:publish-procedure! 'rdb:test-set-log! (lambda (run-id test-name item-path logf) (set! *last-db-access* (current-seconds)) |
︙ |
Modified tests.scm from [c1bacdf4ec] to [682b0daae9].
︙ | |||
163 164 165 166 167 168 169 | 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 192 193 194 195 196 197 | - - - - - - - - - - + + + + + + + + + + + + - + - - - - | (units (hash-table-ref/default otherdat ":units" "")) (type (hash-table-ref/default otherdat ":type" "")) (dcomment (hash-table-ref/default otherdat ":comment" ""))) (debug:print 4 "category: " category ", variable: " variable ", value: " value ", expected: " expected ", tol: " tol ", units: " units) (if (and value expected tol) ;; all three required |
︙ |
Modified tests/Makefile from [2552822744] to [26fc507d28].
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - + | # run some tests BINPATH=$(shell realpath ../bin) MEGATEST=$(BINPATH)/megatest PATH := $(BINPATH):$(PATH) RUNNAME := $(shell date +w%V.%u.%H) |
︙ |