Comment: | Improved exit handling of state/status for tests. If RUNNING then automatic handling is done. If other than RUNNING, simply preserve the values and roll up if an itemized test. Added to tests to better enforce this behavior. Previous behavior was mostly right but failed in some corner cases. Added database cleanup routine. Properly handle removal of tests and mark tests for a run as deleted if the run is removed |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
cdf61d9fc0d5d186c24dfa3a9821e079 |
User & Date: | mrwellan on 2013-07-25 14:33:29 |
Other Links: | branch diff | manifest | tags |
2013-07-25
| ||
16:25 | Improved dashboard for case when there are many state/status combinations. Fixed couple issues with -runstep check-in: cf0a7961a9 user: mrwellan tags: dev | |
14:33 | Improved exit handling of state/status for tests. If RUNNING then automatic handling is done. If other than RUNNING, simply preserve the values and roll up if an itemized test. Added to tests to better enforce this behavior. Previous behavior was mostly right but failed in some corner cases. Added database cleanup routine. Properly handle removal of tests and mark tests for a run as deleted if the run is removed check-in: cdf61d9fc0 user: mrwellan tags: dev | |
2013-07-24
| ||
10:41 | Added notes on centos issues. Added logpro to installall.sh check-in: d0b7b33922 user: fdktest tags: dev | |
Modified client.scm from [a87cd08699] to [b5dec59d45].
︙ | ︙ | |||
58 59 60 61 62 63 64 65 66 67 68 69 70 71 | ;; client:setup (define (client:setup #!key (numtries 50)) (if (not *toppath*) (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: failed to find megatest.config, exiting") (exit)))) (debug:print-info 11 "*transport-type* is " *transport-type* ", *runremote* is " *runremote*) (let* ((hostinfo (if (not *transport-type*) ;; If we dont' already have transport type set then figure it out (open-run-close tasks:get-best-server tasks:open-db) #f))) ;; if have hostinfo then extract the transport type ;; else fall back to fs (debug:print-info 11 "CLIENT SETUP, hostinfo=" hostinfo) | > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | ;; client:setup (define (client:setup #!key (numtries 50)) (if (not *toppath*) (if (not (setup-for-run)) (begin (debug:print 0 "ERROR: failed to find megatest.config, exiting") (exit)))) (change-directory *toppath*) ;; This is probably NOT needed (debug:print-info 11 "*transport-type* is " *transport-type* ", *runremote* is " *runremote*) (let* ((hostinfo (if (not *transport-type*) ;; If we dont' already have transport type set then figure it out (open-run-close tasks:get-best-server tasks:open-db) #f))) ;; if have hostinfo then extract the transport type ;; else fall back to fs (debug:print-info 11 "CLIENT SETUP, hostinfo=" hostinfo) |
︙ | ︙ |
Modified db.scm from [aba54015ac] to [9d188be987].
︙ | ︙ | |||
457 458 459 460 461 462 463 464 465 466 467 468 469 470 | (db:set-var db "MEGATEST_VERSION" 1.36) (sqlite3:execute db "ALTER TABLE test_meta ADD COLUMN jobgroup TEXT DEFAULT 'default';")) ((< mver 1.37) (db:set-var db "MEGATEST_VERSION" 1.37) (sqlite3:execute db "ALTER TABLE tests ADD COLUMN archived INTEGER DEFAULT 0;")) ((< mver megatest-version) (db:set-var db "MEGATEST_VERSION" megatest-version)))))) ;;====================================================================== ;; meta get and set vars ;;====================================================================== ;; returns number if string->number is successful, string otherwise ;; also updates *global-delta* | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 457 458 459 460 461 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 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | (db:set-var db "MEGATEST_VERSION" 1.36) (sqlite3:execute db "ALTER TABLE test_meta ADD COLUMN jobgroup TEXT DEFAULT 'default';")) ((< mver 1.37) (db:set-var db "MEGATEST_VERSION" 1.37) (sqlite3:execute db "ALTER TABLE tests ADD COLUMN archived INTEGER DEFAULT 0;")) ((< mver megatest-version) (db:set-var db "MEGATEST_VERSION" megatest-version)))))) ;; Clean out old junk and vacuum the database ;; ;; Ultimately do something like this: ;; ;; 1. Look at test records either deleted or part of deleted run: ;; a. If test dir exists, set the the test to state='UNKNOWN', Set the run to 'unknown' ;; b. If test dir gone, delete the test record ;; 2. Look at run records ;; a. If have tests that are not deleted, set state='unknown' ;; b. .... ;; (define (db:clean-up db) (let ((statements (map (lambda (stmt) (sqlite3:prepare db stmt)) (list ;; delete all tests that belong to runs that are 'deleted' "DELETE FROM tests WHERE run_id in (SELECT run_id FROM runs WHERE state='deleted');" ;; delete all tests that are 'DELETED' "DELETE FROM tests WHERE state='DELETED';" ;; delete all tests that have no run "DELETE FROM tests WHERE run_id NOT IN (SELECT run_id FROM runs);" ;; delete all runs that are state='deleted' "DELETE FROM runs WHERE state='deleted';" ;; delete empty runs "DELETE FROM runs WHERE id NOT IN (SELECT DISTINCT r.id FROM runs AS r INNER JOIN tests AS t ON t.run_id=r.id);" )))) (sqlite3:with-transaction db (lambda () (map sqlite3:execute statements))) (map sqlite3:finalize! statements) (sqlite3:execute db "VACUUM;"))) ;; (define (db:report-junk-records db) ;;====================================================================== ;; meta get and set vars ;;====================================================================== ;; returns number if string->number is successful, string otherwise ;; also updates *global-delta* |
︙ | ︙ | |||
770 771 772 773 774 775 776 | (debug:print-info 11 "db:set-comment-for-run START run-id: " run-id " comment: " comment) (sqlite3:execute db "UPDATE runs SET comment=? WHERE id=?;" comment run-id) (debug:print-info 11 "db:set-comment-for-run END run-id: " run-id " comment: " comment)) ;; does not (obviously!) removed dependent data. But why not!!? (define (db:delete-run db run-id) (common:clear-caches) ;; don't trust caches after doing any deletion | > > | > > | | | > > | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | (debug:print-info 11 "db:set-comment-for-run START run-id: " run-id " comment: " comment) (sqlite3:execute db "UPDATE runs SET comment=? WHERE id=?;" comment run-id) (debug:print-info 11 "db:set-comment-for-run END run-id: " run-id " comment: " comment)) ;; does not (obviously!) removed dependent data. But why not!!? (define (db:delete-run db run-id) (common:clear-caches) ;; don't trust caches after doing any deletion ;; First set any related tests to DELETED (let ((stmt1 (sqlite3:prepare db "UPDATE tests SET state='DELETED' WHERE run_id=?;")) (stmt2 (sqlite3:prepare db "UPDATE runs SET state='deleted' WHERE id=?;"))) (sqlite3:with-transaction db (lambda () (sqlite3:execute stmt1 run-id) (sqlite3:execute stmt2 run-id))) (sqlite3:finalize! stmt1) (sqlite3:finalize! stmt2))) ;; (sqlite3:execute db "DELETE FROM runs WHERE id=?;" run-id)) (define (db:update-run-event_time db run-id) (debug:print-info 11 "db:update-run-event_time START run-id: " run-id) (sqlite3:execute db "UPDATE runs SET event_time=strftime('%s','now') WHERE id=?;" run-id) (debug:print-info 11 "db:update-run-event_time END run-id: " run-id)) (define (db:lock/unlock-run db run-id lock unlock user) |
︙ | ︙ | |||
1343 1344 1345 1346 1347 1348 1349 | ((zmq)(with-output-to-string (lambda ()(serialize obj)))) (else obj))) (define (db:string->obj msg) (case *transport-type* ((fs) msg) ((http) | > | | | | | > | 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | ((zmq)(with-output-to-string (lambda ()(serialize obj)))) (else obj))) (define (db:string->obj msg) (case *transport-type* ((fs) msg) ((http) (if (string? msg) (with-input-from-string (base64:base64-decode (string-substitute (regexp "_") "=" msg #t)) (lambda ()(deserialize))) (vector #f #f #f))) ;; crude reply for when things go awry ((zmq)(with-input-from-string msg (lambda ()(deserialize)))) (else msg))) (define (cdb:use-non-blocking-mode proc) (set! *client-non-blocking-mode* #t) (let ((res (proc))) (set! *client-non-blocking-mode* #f) |
︙ | ︙ |
Modified launch.scm from [7a5f293c75] to [243e14f03c].
︙ | ︙ | |||
325 326 327 328 329 330 331 | (thread-start! th1) (thread-start! th2) (thread-join! th2) (mutex-lock! m) (let* ((item-path (item-list->path itemdat)) (testinfo (cdb:get-test-info-by-id *runremote* test-id))) ;; )) ;; run-id test-name item-path))) ;; Am I completed? | | | < < | > > | | > > > > | > > > > > | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | (thread-start! th1) (thread-start! th2) (thread-join! th2) (mutex-lock! m) (let* ((item-path (item-list->path itemdat)) (testinfo (cdb:get-test-info-by-id *runremote* test-id))) ;; )) ;; run-id test-name item-path))) ;; Am I completed? (if (equal? (db:test-get-state testinfo) "RUNNING") ;; (not (equal? (db:test-get-state testinfo) "COMPLETED")) (let ((new-state (if kill-job? "KILLED" "COMPLETED") ;; (if (eq? (vector-ref exit-info 2) 0) ;; exited with "good" status ;; "COMPLETED" ;; (db:test-get-state testinfo))) ;; else preseve the state as set within the test ) (new-status (cond ((not (vector-ref exit-info 1)) "FAIL") ;; job failed to run ((eq? rollup-status 0) ;; if the current status is AUTO the defer to the calculated value (i.e. leave this AUTO) (if (equal? (db:test-get-status testinfo) "AUTO") "AUTO" "PASS")) ((eq? rollup-status 1) "FAIL") ((eq? rollup-status 2) ;; if the current status is AUTO the defer to the calculated value but qualify (i.e. make this AUTO-WARN) (if (equal? (db:test-get-status testinfo) "AUTO") "AUTO-WARN" "WARN")) (else "FAIL")))) ;; (db:test-get-status testinfo))) (debug:print-info 2 "Test NOT logged as COMPLETED, (state=" (db:test-get-state testinfo) "), updating result, rollup-status is " rollup-status) (tests:test-set-status! test-id new-state new-status (args:get-arg "-m") #f) ;; need to update the top test record if PASS or FAIL and this is a subtest (if (not (equal? item-path "")) (cdb:roll-up-pass-fail-counts *runremote* run-id test-name item-path new-status)) )) ;; for automated creation of the rollup html file this is a good place... (if (not (equal? item-path "")) (tests:summarize-items #f run-id test-name #f)) ;; don't force - just update if no ) (mutex-unlock! m) ;; (exec-results (cmd-run->list fullrunscript)) ;; (list ">" (conc test-name "-run.log")))) ;; (success exec-results)) ;; (eq? (cadr exec-results) 0))) |
︙ | ︙ |
Modified megatest.scm from [8483909d81] to [ce68e14db0].
︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 | -show-config : dump the internal representation of the megatest.config file -show-runconfig : dump the internal representation of the runconfigs.config file -dumpmode json : dump in json format instead of sexpr -show-cmdinfo : dump the command info for a test (run in test environment) Misc -rebuild-db : bring the database schema up to date -update-meta : update the tests metadata for all tests -env2file fname : write the environment to fname.csh and fname.sh -setvars VAR1=val1,VAR2=val2 : Add environment variables to a run NB// these are overwritten by values set in config files. -server -|hostname : start the server (reduces contention on megatest.db), use - to automatically figure out hostname -transport http|fs : use http or direct access for transport (default is http) | > | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | -show-config : dump the internal representation of the megatest.config file -show-runconfig : dump the internal representation of the runconfigs.config file -dumpmode json : dump in json format instead of sexpr -show-cmdinfo : dump the command info for a test (run in test environment) Misc -rebuild-db : bring the database schema up to date -cleanup-db : remove any orphan records, vacuum the db -update-meta : update the tests metadata for all tests -env2file fname : write the environment to fname.csh and fname.sh -setvars VAR1=val1,VAR2=val2 : Add environment variables to a run NB// these are overwritten by values set in config files. -server -|hostname : start the server (reduces contention on megatest.db), use - to automatically figure out hostname -transport http|fs : use http or direct access for transport (default is http) |
︙ | ︙ | |||
226 227 228 229 230 231 232 233 234 235 236 237 238 239 | "-show-cmdinfo" ;; queries "-test-paths" ;; get path(s) to a test, ordered by youngest first "-runall" ;; run all tests "-remove-runs" "-rebuild-db" "-rollup" "-update-meta" "-gen-megatest-area" "-logging" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only | > | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | "-show-cmdinfo" ;; queries "-test-paths" ;; get path(s) to a test, ordered by youngest first "-runall" ;; run all tests "-remove-runs" "-rebuild-db" "-cleanup-db" "-rollup" "-update-meta" "-gen-megatest-area" "-logging" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only |
︙ | ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | (if (args:get-arg "-gen-megatest-test") (let ((testname (args:get-arg "-gen-megatest-test"))) (genexample:mk-megatest-test testname) (set! *didsomething* #t))) ;;====================================================================== | | > > > > > > > > > > | 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | (if (args:get-arg "-gen-megatest-test") (let ((testname (args:get-arg "-gen-megatest-test"))) (genexample:mk-megatest-test testname) (set! *didsomething* #t))) ;;====================================================================== ;; Update the database schema, clean up the db ;;====================================================================== (if (args:get-arg "-rebuild-db") (begin (if (not (setup-for-run)) (begin (debug:print 0 "Failed to setup, exiting") (exit 1))) ;; keep this one local (open-run-close patch-db #f) (set! *didsomething* #t))) (if (args:get-arg "-cleanup-db") (begin (if (not (setup-for-run)) (begin (debug:print 0 "Failed to setup, exiting") (exit 1))) ;; keep this one local (open-run-close db:clean-up #f) (set! *didsomething* #t))) ;;====================================================================== ;; Wait on a run to complete ;;====================================================================== (if (args:get-arg "-run-wait") (begin |
︙ | ︙ |
Modified runs.scm from [6ee79e71cd] to [3d772722d6].
︙ | ︙ | |||
516 517 518 519 520 521 522 | (else (debug:print 4 "FAILS: " fails) ;; If one or more of the prereqs-not-met are FAIL then we can issue ;; a message and drop hed from the items to be processed. (if (null? fails) (begin ;; couldn't run, take a breather | | > | | > > | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | (else (debug:print 4 "FAILS: " fails) ;; If one or more of the prereqs-not-met are FAIL then we can issue ;; a message and drop hed from the items to be processed. (if (null? fails) (begin ;; couldn't run, take a breather (debug:print-info 0 "Shouldn't really get here, race condition? Unable to launch more tests at this moment, killing time ...") (debug:print-info 0 " test is " hed ", prereqs-not-met is " prereqs-not-met) ;; (thread-sleep! (+ 0.01 *global-delta*)) ;; long sleep here - no resources, may as well be patient ;; we made new tal by sticking hed at the back of the list (list (car newtal)(cdr newtal) reg reruns)) ;; the waiton is FAIL so no point in trying to run hed ever again (if (or (not (null? reg))(not (null? tal))) (if (vector? hed) (begin (debug:print 1 "WARN: Dropping test " (db:test-get-testname hed) "/" (db:test-get-item-path hed) " from the launch list as it has prerequistes that are FAIL") (runs:shrink-can-run-more-tests-count) ;; DELAY TWEAKER (still needed?) ;; (thread-sleep! *global-delta*) (hash-table-set! test-registry (runs:make-full-test-name test-name item-path) 'removed) (list (runs:queue-next-hed tal reg reglen regfull) (runs:queue-next-tal tal reg reglen regfull) (runs:queue-next-reg tal reg reglen regfull) (cons hed reruns))) (begin (debug:print 0 "WARNING: Test not processed correctly. Could be a race condition in your test implementation? Dropping test " hed) ;; " as it has prerequistes that are FAIL. (NOTE: hed is not a vector)") (runs:shrink-can-run-more-tests-count) ;; DELAY TWEAKER (still needed?) ;; (list hed tal reg reruns) (list (car newtal)(cdr newtal) reg reruns) )))))))) ;; test-records is a hash table testname:item_path => vector < testname testconfig waitons priority items-info ... > (define (runs:run-tests-queue run-id runname test-records keyvals flags test-patts required-tests reglen-in all-tests-registry) ;; 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 ", flags: " (hash-table->alist flags)) (let ((run-info (cdb:remote-run db:get-run-info #f run-id)) |
︙ | ︙ |
Modified tests/fullrun/config/mt_include_1.config from [bbc52b1b03] to [a782579a4c].
1 2 | [setup] # exectutable /path/to/megatest | | | 1 2 3 4 5 6 7 8 9 10 | [setup] # exectutable /path/to/megatest max_concurrent_jobs 15 linktree #{getenv MT_RUN_AREA_HOME}/tmp/mt_links [jobtools] useshell yes # ## launcher launches jobs, the job is managed on the target host ## by megatest, comment out launcher to run local |
︙ | ︙ |
Added tests/fullrun/tests/blocktestxz/main.sh version [c5c5020d12].
> > > > > > | 1 2 3 4 5 6 | #!/bin/bash $MT_MEGATEST -test-status :state $THESTATE :status $THESTATUS -setlog "nada.html" # By exiting with non-zero we tell Megatest to preseve the state and status exit 1 |
Added tests/fullrun/tests/blocktestxz/testconfig version [4fa5a854fa].
> > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | [setup] runscript main.sh [items] THESTATE UNKNOWN INCOMPLETE KILLED KILLREQ STUCK BOZZLEBLONKED STUCK/DEAD THESTATUS PASS FAIL STUCK/DEAD SKIP [test_meta] author matt owner bob description This test will fail causing the dependent test "testxz" to never run. This triggers the code that must determine that a test will never be run and thus remove it from the queue of tests to be run. tags first,single reviewed 1/1/1965 |
Modified tests/fullrun/tests/runfirst/main.sh from [e4be557feb] to [2d77d9ebfd].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 | faz,bar,10,8mA,,,"this is a comment" EOF $MT_MEGATEST -load-test-data << EOF cat, var, val, exp, comp, units, comment, status, type ameas,iout,1.2,1.9,>,Amps,Comment,,meas EOF | > > > > | > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | faz,bar,10,8mA,,,"this is a comment" EOF $MT_MEGATEST -load-test-data << EOF cat, var, val, exp, comp, units, comment, status, type ameas,iout,1.2,1.9,>,Amps,Comment,,meas EOF loadstatus=$? if [[ `basename $PWD` == "mustfail" ]];then $MT_MEGATEST -test-status :state COMPLETED :status FAIL else $MT_MEGATEST -test-status :state COMPLETED :status $loadstatus -m "This is a test level comment" :value 10e6 :expected_value 1.1e6 :tol 100e3 :category nada :variable sillyvar :units mFarks :comment "This is the value/expected comment" fi # $MT_MEGATEST -test-status :state COMPLETED :status FAIL |
Modified tests/fullrun/tests/runfirst/testconfig from [f0b52bc3c6] to [e478348cce].
1 2 3 4 5 6 7 8 9 10 | [setup] runscript main.sh [pre-launch-env-vars] # These are set before the test is launched on the originating # host. This can be used to control remote launch tools, e.g. to # to choose the target host, select the launch tool etc. SPECIAL_ENV_VAR override with everything after the first space. [items] | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [setup] runscript main.sh [pre-launch-env-vars] # These are set before the test is launched on the originating # host. This can be used to control remote launch tools, e.g. to # to choose the target host, select the launch tool etc. SPECIAL_ENV_VAR override with everything after the first space. [items] SEASON summer winter fall spring [itemstable] BLOCK a b TOCK 1 2 [test_meta] author matt |
︙ | ︙ |
Added tests/fullrun/tests/testxz/testconfig version [b0661b0db5].
> > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Add additional steps here. Format is "stepname script" [ezsteps] listfiles ls # Test requirements are specified here [requirements] waiton blocktestxz # test_meta is a section for storing additional data on your test [test_meta] author mrwellan owner mrwellan description This test should never get run due to blocktestxz failing tags tagone,tagtwo reviewed never |
tests/installall/config/megatest.config.dat became a symlink with target [736a5da885].
tests/installall/config/runconfigs.config.dat became a symlink with target [3b8f260acb].
Modified tests/installall/runconfigs.config from [d70e7613fc] to [636657cf41].
1 2 3 4 5 6 7 8 9 | # # [CHICKEN_VERSION/MEGATEST_VERSION/IUPMODE/PLATFORM/BUILD_TAG] # [default] ALLTESTS see this variable PREFIX #{getenv MT_RUN_AREA_HOME}/#{getenv BUILD_TAG}/#{getenv MT_RUNNAME} DOWNLOADS #{getenv MT_RUN_AREA_HOME}/downloads IUPLIB 26g4 | < > > > > > | 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 | # # [CHICKEN_VERSION/MEGATEST_VERSION/IUPMODE/PLATFORM/BUILD_TAG] # [default] ALLTESTS see this variable PREFIX #{getenv MT_RUN_AREA_HOME}/#{getenv BUILD_TAG}/#{getenv MT_RUNNAME} DOWNLOADS #{getenv MT_RUN_AREA_HOME}/downloads IUPLIB 26g4 PLATFORM linux LOGPRO_VERSION v1.05 BUILDSQLITE yes SQLITE3_VERSION 3071401 ZEROMQ_VERSION 2.2.0 [include configs/hicken-#{getenv CHICKEN_VERSION}.config] # Currently must have at least one variable in a section [4.8.0/trunk/bin/std] IUP_VERSION na [4.8.0.4/trunk/src/std] IUP_VERSION na [4.8.1/trunk/src/std] IUP_VERSION na [4.8.0/v1.5508/opt] IUP_VERSION na PREFIX /opt/chicken/4.8.0 [4.8.0/trunk/centos5.7vm] BUILDSQLITE no |