Overview
Comment: | Merged rollup-runs branch into trunk |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ebea00e4bbe36fd26a8b37983f5f85cf |
User & Date: | mrwellan on 2011-08-24 12:50:12 |
Other Links: | manifest | tags |
Context
2011-08-24
| ||
13:37 | Cleaned up the test steps display a bit more check-in: 55d1298d58 user: mrwellan tags: trunk | |
12:50 | Merged rollup-runs branch into trunk check-in: ebea00e4bb user: mrwellan tags: trunk | |
12:33 | Tweaked test steps reporting in dashboard check-in: fcb61c8998 user: matt tags: trunk | |
07:27 | Removing junk file Closed-Leaf check-in: d14b97e156 user: mrwellan tags: rollup-runs | |
Changes
Modified configf.scm from [2d522c454c] to [ed3f434b69].
︙ | |||
28 29 30 31 32 33 34 | 28 29 30 31 32 33 34 35 36 37 38 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 85 | - + - + - + - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + | (define (config:assoc-safe-add alist 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) |
︙ | |||
100 101 102 103 104 105 106 | 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 | - + - + | (define (find-and-read-config fname) (let* ((curr-dir (current-directory)) (configinfo (find-config fname)) (toppath (car configinfo)) (configfile (cadr configinfo))) (if toppath (change-directory toppath)) |
Modified db.scm from [04b9f6fc1e] to [aed40706ae].
︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | - | final_logf TEXT DEFAULT 'logs/final.log', logdat BLOB, run_duration INTEGER DEFAULT 0, comment TEXT DEFAULT '', event_time TIMESTAMP, fail_count INTEGER DEFAULT 0, pass_count INTEGER DEFAULT 0, |
︙ | |||
107 108 109 110 111 112 113 | 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 | + - + - + + + + + + + + + + + + | (print "Adding megatest-version to metadata") (sqlite3:execute db (db:set-var db "MEGATEST_VERSION" megatest-version)))) ;; (if (< mver 1.18) ;; (begin ;; (print "Adding tags column to tests table") ;; (sqlite3:execute db "ALTER TABLE tests ADD COLUMN tags TEXT DEFAULT '';"))) (if (< mver 1.20) (begin |
︙ | |||
197 198 199 200 201 202 203 204 205 206 207 208 209 210 | 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 | + + + + + + + + + + + + + + + + + + + + + | "") (if (and (> (length count) 1) (number? (cadr count))) (conc " OFFSET " (cadr count)) "")) runpatt) (vector header res))) ;; replace header and keystr with a call to runs:get-std-run-fields ;; keypatt: '(("key1" "patt1")("key2" "patt2")...) (define (db:get-runs db keys keypatts runpatt) (let* ((res '()) (remfields (list "id" "runname" "state" "status" "owner" "event_time")) (header (append (map key:get-fieldname keys) remfields)) (keystr (conc (keys->keystr keys) "," (string-intersperse remfields ",")))) (sqlite3:for-each-row (lambda (a . x) ;; turn all the fields returned into a vector and add to the list (set! res (cons (apply vector a x) res))) db (conc "SELECT " keystr " FROM runs WHERE runname LIKE ? " (map (lambda (keypatt) (conc "AND " (car keypatt) " LIKE " (cadr keypatt) " ")) keypatts) "ORDER BY event_time DESC;") runpatt) (vector header res))) ;; use this one for db-get-run-info (define-inline (db:get-row vec)(vector-ref vec 1)) ;; use (get-value-by-header (db:get-header runinfo)(db:get-row runinfo)) (define (db:get-run-info db run-id) (let* ((res #f) |
︙ | |||
309 310 311 312 313 314 315 | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | - - + + | ;; done with run when: ;; 0 tests in LAUNCHED, NOT_STARTED, REMOTEHOSTSTART, RUNNING (define (db:estimated-tests-remaining db run-id) (let ((res 0)) (sqlite3:for-each-row (lambda (count) (set! res count)) |
︙ | |||
430 431 432 433 434 435 436 | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + | (lambda (id test-id stepname state status event-time) (set! res (cons (vector id test-id stepname state status event-time) res))) db "SELECT id,test_id,stepname,state,status,event_time FROM test_steps WHERE test_id=? ORDER BY id ASC;" ;; event_time DESC,id ASC; test-id) (reverse res))) |
︙ | |||
472 473 474 475 476 477 478 | 504 505 506 507 508 509 510 511 | - - - - - - - - - - - - - - - - - - - | (if (not (and (equal? (db:test-get-state test) "COMPLETED") (member (db:test-get-status test) '("PASS" "WARN" "CHECK")))) (set! result (cons waitontest-name result)))))) tests) (if (not ever-seen)(set! result (cons waitontest-name result))))) waiton) (delete-duplicates result)))) |
Modified launch.scm from [aadffc4da1] to [f0e35ea73c].
︙ | |||
143 144 145 146 147 148 149 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | - + | (set! fullcmd (append launcher (car hosts)(list remote-megatest "-execute" cmdparms)))) (launcher (set! fullcmd (append launcher (list remote-megatest "-execute" cmdparms)))) (else (set! fullcmd (list remote-megatest "-execute" cmdparms)))) (if (args:get-arg "-xterm")(set! fullcmd (append fullcmd (list "-xterm")))) (debug:print 1 "Launching megatest for test " test-name " in " work-area" ...") |
︙ |
Modified megatest-version.scm from [ebeb01abfb] to [9a855b99f9].
1 2 | 1 2 3 | - + | ;; Always use two digit decimal ;; 1.01, 1.02...1.10,1.11 ... 1.99,2.00.. |
Modified megatest.scm from [8f3220a6de] to [3218809c9e].
︙ | |||
35 36 37 38 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 | 35 36 37 38 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 | + + + + + + + + + | -m comment : insert a comment for this test Run data :runname : required, name for this particular test run :state : required if updating step state; e.g. start, end, completed :status : required if updating step status; e.g. pass, fail, n/a Values and record errors and warnings -set-values : update or set values in the megatest db :value : value measured :expected_value : value expected :tol : tolerance |value-expect| <= tol :first_err : record an error message :first_warn : record a warning message Queries -list-runs patt : list runs matching pattern \"patt\", % is the wildcard -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 all fields be specified and :runname ,-testpatt and -itempatt and -testpatt -keepgoing : continue running until no jobs are \"LAUNCHED\" or \"NOT_STARTED\" -rerun FAIL,WARN... : re-run if called on a test that previously ran (nullified if -keepgoing is also specified) -rebuild-db : bring the database schema up to date -rollup N : fill run (set by :runname) with latest test(s) from past N days, requires keys -rename-run <runb> : rename run (set by :runname) to <runb>, requires keys -update-meta : update the tests metadata for all tests Helpers -runstep stepname ... : take remaining params as comand and execute as stepname log will be in stepname.log. Best to put command in quotes -logpro file : with -exec apply logpro file to stepname.log, creates stepname.html and sets log to same If using make use stepname_logpro.log as your target |
︙ | |||
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 | 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 | + + + + + + + + + | "-runstep" "-logpro" "-m" "-rerun" "-days" "-rename-run" "-to" ;; values and messages ":first_err" ":first_warn" ":value" ":expected_value" ":tol" ;; misc "-debug" ;; for *verbosity* > 2 ) (list "-h" "-force" "-xterm" "-showkeys" "-test-status" "-set-values" "-summarize-items" "-gui" "-runall" ;; run all tests "-remove-runs" "-keepgoing" "-usequeue" "-rebuild-db" "-rollup" "-update-meta" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only ) args:arg-hash 0)) (if (args:get-arg "-h") |
︙ | |||
356 357 358 359 360 361 362 | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | - + | (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") (test-set-meta-info db run-id test-name itemdat) |
︙ | |||
444 445 446 447 448 449 450 | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | - + | ;; (test-set-status! db run-id test-name "KILLED" "FAIL" ;; itemdat (args:get-arg "-m")) ;; (sqlite3:finalize! db) ;; (exit 1))))) (begin (debug:print 0 "WARNING: Request received to kill job but problem with process, attempting to kill manager process") (test-set-status! db run-id test-name "KILLED" "FAIL" |
︙ | |||
488 489 490 491 492 493 494 | 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | - + | (test-set-status! db run-id test-name (if kill-job? "KILLED" "COMPLETED") (if (vector-ref exit-info 1) ;; look at the exit-status (if (and (not kill-job?) (eq? (vector-ref exit-info 2) 0)) "PASS" "FAIL") |
︙ | |||
536 537 538 539 540 541 542 543 544 545 546 547 548 549 | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | + | (exit 6))) (sqlite3:finalize! db) (set! *didsomething* #t)))) (if (or (args:get-arg "-setlog") ;; since setting up is so costly lets piggyback on -test-status (args:get-arg "-set-toplog") (args:get-arg "-test-status") (args:get-arg "-set-values") (args:get-arg "-runstep") (args:get-arg "-summarize-items")) (if (not (getenv "MT_CMDINFO")) (begin (debug:print 0 "ERROR: MT_CMDINFO env var not set, commands -test-status, -runstep and -setlog must be called *inside* a megatest environment!") (exit 5)) (let* ((startingdir (current-directory)) |
︙ | |||
614 615 616 617 618 619 620 | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | - + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + | (teststep-set-status! db run-id test-name stepname "end" exitstat itemdat (args:get-arg "-m")) (sqlite3:finalize! db) (if (not (eq? exitstat 0)) (exit 254)) ;; (exit exitstat) doesn't work?!? ;; open the db ;; mark the end of the test ))) |
︙ | |||
663 664 665 666 667 668 669 670 671 672 673 674 675 676 | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | + + + + + + + + + + + + + + + + | (debug:print 0 "Failed to setup, exiting") (exit 1))) ;; now can find our db (set! db (open-db)) (patch-db db) (sqlite3:finalize! db) (set! *didsomething* #t))) ;;====================================================================== ;; Update the tests meta data from the testconfig files ;; (if (args:get-arg "-update-meta") (begin (if (not (setup-for-run)) (begin (debug:print 0 "Failed to setup, exiting") (exit 1))) ;; now can find our db (set! db (open-db)) (runs:update-all-test_meta db) (sqlite3:finalize! db) (set! *didsomething* #t))) (if (not *didsomething*) (debug:print 0 help)) (if (not (eq? *globalexitstatus* 0)) (if (or (args:get-arg "-runtests")(args:get-arg "-runall")) (begin |
︙ |
Modified runconfig.scm from [1140c67c42] to [4dece87b4e].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - + | ;;====================================================================== ;; 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) "/")) |
︙ |
Modified runs.scm from [a71e17f8a8] to [0a86a73c3e].
︙ | |||
71 72 73 74 75 76 77 | 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 | - + - + - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + + | (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))) |
︙ | |||
398 399 400 401 402 403 404 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | - + + + + - + + | (setenv "MT_TEST_NAME" test-name) ;; (setenv "MT_RUNNAME" (args:get-arg ":runname")) (set-megatest-env-vars db run-id) ;; these may be needed by the launching process (change-directory *toppath*) (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))) |
︙ | |||
426 427 428 429 430 431 432 | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | - - - - - + - - - - - - - - - - | (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 |
︙ | |||
465 466 467 468 469 470 471 | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | - + | (if (runs:can-run-more-tests db) (begin (let loop2 ((ts (db:get-test-info db run-id test-name item-path)) ;; #f) (ct 0)) (if (and (not ts) (< ct 10)) (begin |
︙ | |||
680 681 682 683 684 685 686 687 688 | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | (let* ((keys (db-get-keys db)) (keynames (map key:get-fieldname keys)) (keyvallst (keys->vallist keys #t))) (proc db keys keynames keyvallst))) (sqlite3:finalize! db) (set! *didsomething* #t)))) ;;====================================================================== ;; Rollup runs ;;====================================================================== ;; Update the test_meta table for this test (define (runs:update-test_meta db test-name test-conf) (let ((currrecord (db:testmeta-get-record db test-name))) (if (not currrecord) (begin (set! currrecord (make-vector 10 #f)) (db:testmeta-add-record db test-name))) (for-each (lambda (key) (let* ((idx (cadr key)) (fld (car key)) (val (config-lookup test-conf "test_meta" fld))) (if (and val (not (equal? (vector-ref currrecord idx) val))) (begin (print "Updating " test-name " " fld " to " val) (db:testmeta-update-field db test-name fld val))))) '(("author" 2)("owner" 3)("description" 4)("reviewed" 5)("tags" 9))))) ;; Update test_meta for all tests (define (runs:update-all-test_meta db) (let ((test-names (get-all-legal-tests))) (for-each (lambda (test-name) (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))) ;; read configs with tricks turned off (i.e. no system) (test-conf (if testexists (read-config test-configf #f #f)(make-hash-table)))) (runs:update-test_meta db test-name test-conf))) test-names))) (define (runs:rollup-run db keys keynames keyvallst n) (let* ((new-run-id (register-run db keys)) |
Modified tests/tests.scm from [8fcf733fb4] to [197f496658].
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | - - + + - + | (include "../process.scm") (include "../launch.scm") (include "../items.scm") (include "../runs.scm") (include "../megatest-version.scm") (define conffile #f) |
︙ |
Modified tests/tests/runfirst/main.sh from [f575e06d2a] to [b033ad6b4d].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 | - + | #!/bin/bash # megatest -step wasting_time :state start :status n/a -m "This is a test step comment" # sleep 20 # megatest -step wasting_time :state end :status $? touch ../I_was_here $MT_MEGATEST -runstep wasting_time -logpro wasting_time.logpro "sleep 8;echo all done eh?" -m "This is a test step comment" |
Modified tests/tests/singletest/main.sh from [c23e537bd9] to [e63ffb76fa].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 | - + | #!/bin/bash # megatest -step wasting_time :state start :status n/a -m "This is a test step comment" # sleep 20 # megatest -step wasting_time :state end :status $? $MT_MEGATEST -runstep wasting_time -logpro wasting_time.logpro "sleep 5;echo all done eh?" -m "This is a test step comment" |
Modified tests/tests/singletest2/main.sh from [c23e537bd9] to [54d3e4ef49].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 | - + | #!/bin/bash # megatest -step wasting_time :state start :status n/a -m "This is a test step comment" # sleep 20 # megatest -step wasting_time :state end :status $? $MT_MEGATEST -runstep wasting_time -logpro wasting_time.logpro "sleep 5;echo all done eh?" -m "This is a test step comment" |