Overview
Comment: | Cherrypicked genexample work f81a, 31ed, 3213, c9ef, 0c39, 0dbb, 658e ==/6.1/0.8/WARN/1201/mars/== |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | v1.65-genexample |
Files: | files | file ages | folders |
SHA1: |
ba70452f7f188a28b93147b41dd4df47 |
User & Date: | mrwellan on 2020-09-28 22:37:51 |
Original Comment: | Cherrypicked genexample work f81a, 31ed, 3213, c9ef, 0c39, 0dbb, 658e |
Other Links: | branch diff | manifest | tags |
Context
2020-09-28
| ||
22:37 | Cherrypicked genexample work f81a, 31ed, 3213, c9ef, 0c39, 0dbb, 658e ==/6.1/0.8/WARN/1201/mars/== Closed-Leaf check-in: ba70452f7f user: mrwellan tags: v1.65-genexample | |
2020-08-20
| ||
11:11 | changed version to 1.6564 ==3.39/1.0/PASS/1203/orion== v1.70 START check-in: cd0bb84cf2 user: mmgraham tags: v1.65, v1.6564 | |
Changes
Modified db.scm from [5d8ca5b259] to [657556a545].
︙ | ︙ | |||
1758 1759 1760 1761 1762 1763 1764 1765 | (debug:print-info 18 *default-log-port* "Found " (length oldlaunched) " old LAUNCHED items, " (length toplevels) " old LAUNCHED toplevel tests and " (length incompleted) " tests marked RUNNING but apparently dead.") (if (and (null? incompleted) (null? oldlaunched) (null? toplevels)) #f #t))))) | < < < < < < < | < | | | | | | < < < < < | 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 | (debug:print-info 18 *default-log-port* "Found " (length oldlaunched) " old LAUNCHED items, " (length toplevels) " old LAUNCHED toplevel tests and " (length incompleted) " tests marked RUNNING but apparently dead.") (if (and (null? incompleted) (null? oldlaunched) (null? toplevels)) #f #t))))) (define (db:get-status-from-final-status-file run-dir) (let ((infile (conc run-dir "/.final-status"))) ;; first verify we are able to write the output file (if (not (file-read-access? infile)) (begin (debug:print 0 *default-log-port* "ERROR: cannot read " infile) (debug:print 0 *default-log-port* "ERROR: run-dir is " run-dir) #f ) (with-input-from-file infile read-lines) ))) ;; select end_time-now from ;; (select testname,item_path,event_time+run_duration as ;; end_time,strftime('%s','now') as now from tests where state in ;; ('RUNNING','REMOTEHOSTSTART','LAUNCHED')); (define (db:find-and-mark-incomplete dbstruct run-id ovr-deadtime) |
︙ | ︙ | |||
3229 3230 3231 3232 3233 3234 3235 | ;; NEW BEHAVIOR: Look only at single run with run-id ;; ;; (define (db:get-running-stats dbstruct run-id) (define (db:get-count-tests-running-for-run-id dbstruct run-id fastmode) (let* ((qry (if fastmode "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id=? LIMIT 1;" | | > > | < < | | 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 | ;; NEW BEHAVIOR: Look only at single run with run-id ;; ;; (define (db:get-running-stats dbstruct run-id) (define (db:get-count-tests-running-for-run-id dbstruct run-id fastmode) (let* ((qry (if fastmode "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id=? LIMIT 1;" "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id=?;"))) (db:with-db dbstruct run-id #f (lambda (db) (let* ((stmth (db:get-cache-stmth dbstruct db qry))) (sqlite3:first-result stmth run-id)))))) ;; For a given testname how many items are running? Used to determine ;; probability for regenerating html ;; (define (db:get-count-tests-running-for-testname dbstruct run-id testname) (db:with-db dbstruct run-id #f (lambda (db) (let* ((stmt "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id=? AND NOT (uname = 'n/a' AND item_path = '') AND testname=?;") (stmth (db:get-cache-stmth dbstruct db stmt))) (sqlite3:first-result stmth run-id testname))))) (define (db:get-not-completed-cnt dbstruct run-id) (db:with-db dbstruct run-id #f (lambda (db) |
︙ | ︙ | |||
4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 | db "SELECT state,status,count(id) FROM tests WHERE run_id=? GROUP BY state,status;" run-id ))))) test-count-recs)) ;; BBnote: db:get-all-state-status-counts-for-test returns dbr:counts object aggregating state and status of items of a given test, *not including rollup state/status* (define (db:get-all-state-status-counts-for-test dbstruct run-id test-name item-path item-state-in item-status-in) (let* ((test-info (db:get-test-info dbstruct run-id test-name item-path)) (item-state (or item-state-in (db:test-get-state test-info))) (item-status (or item-status-in (db:test-get-status test-info))) (other-items-count-recs (db:with-db dbstruct #f #f (lambda (db) | > > > | 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 | db "SELECT state,status,count(id) FROM tests WHERE run_id=? GROUP BY state,status;" run-id ))))) test-count-recs)) ;; BBnote: db:get-all-state-status-counts-for-test returns dbr:counts object aggregating state and status of items of a given test, *not including rollup state/status* ;; ;; NOTE: This is called within a transaction ;; (define (db:get-all-state-status-counts-for-test dbstruct run-id test-name item-path item-state-in item-status-in) (let* ((test-info (db:get-test-info dbstruct run-id test-name item-path)) (item-state (or item-state-in (db:test-get-state test-info))) (item-status (or item-status-in (db:test-get-status test-info))) (other-items-count-recs (db:with-db dbstruct #f #f (lambda (db) |
︙ | ︙ |
Modified genexample.scm from [2597a6cc06] to [5f76eb3afd].
︙ | ︙ | |||
15 16 17 18 19 20 21 | ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;;====================================================================== (declare (unit genexample)) | | > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;;====================================================================== (declare (unit genexample)) (use posix regex matchable) (include "db_records.scm") (define genexample:example-logpro #<<EOF ;; You should have at least one expect:required. This ensures that your process ran ;; comment out the line below and replace "put pattern here" with a pattern that will ;; always be seen in your log file if the step runs successfully. ;; |
︙ | ︙ | |||
336 337 338 339 340 341 342 | (if (string-match ".*\\.sh$" script) (begin (with-output-to-file (conc testdir "/" script) (lambda () (print genexample:example-script))) (system (conc "chmod ug+r,a+x " (conc testdir "/" script))))))) steps)))))) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 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 508 509 510 511 512 513 514 515 516 517 518 | (if (string-match ".*\\.sh$" script) (begin (with-output-to-file (conc testdir "/" script) (lambda () (print genexample:example-script))) (system (conc "chmod ug+r,a+x " (conc testdir "/" script))))))) steps)))))) ;; easier to work backwards than change the upstream code ;; (define (hrs-min-sec->seconds str) (let* ((parts (string-split str)) (res 0)) (for-each (lambda (part) (set! res (+ res (match (string-match "(\\d+)([a-z])" part) ((_ val units)(* (string->number val)(case (string->symbol units) ((s) 1) ((m) 60) ((h) 3600)))) (else 0))))) parts) res)) ;; generate a skeleton Megatest area from a current area with runs ;; ;; specify target, runname etc to use specific runs for the template ;; (define (genexample:extract-skeleton-area dest-path) (let* ((target (args:get-arg "-target")) (runname (args:get-arg "-runname")) (obtuse (make-hash-table)) (obtusef (args:get-arg "-obfuscate")) (letters (string-split-fields "\\S" "abcdefghijklmnopqrstuvwxyz")) (maxletter (- (length letters) 1)) (lastlet 0) (lastnum 1) (obfuscate (lambda (instr) (or (hash-table-ref/default obtuse instr #f) (if obtusef (let* ((letter (list-ref letters lastlet)) (val (conc letter lastnum))) (if (>= lastlet maxletter) (begin (set! lastlet 0) (set! lastnum (+ lastnum 1))) (set! lastlet (+ lastlet 1))) (hash-table-set! obtuse instr val) val) instr))))) (if (not (and target runname)) (debug:print 0 *default-log-port* "WARNING: For best results please specifiy -target and -runname for a good run to use as a template.")) (if (not (and (file-exists? "megatest.config") (file-exists? "megatest.db"))) (begin (debug:print 0 *default-log-port* "ERROR: this command must be run at the top level of a megatest area where runs have been completed") (exit))) ;; first create the dest path and needed subdirectories (if (not (file-exists? dest-path)) (begin (create-directory dest-path) (create-directory (conc dest-path "/tests"))) (if (file-exists? (conc dest-path "/megatest.config")) (begin (debug:print 0 *default-log-port* "ERROR: destination path already has megatest.config, stopping now.") (exit)))) ;; dump the config files from this area to the dest area (if (args:get-arg "-obfuscate") (debug:print 0 *default-log-port* "WARNING: obfuscation is NOT done on megatest.config and runconfigs.config. Please edit those files to remove any sensitive information!")) (system (conc "megatest -show-config > " dest-path "/megatest.config")) (system (conc "megatest -show-runconfig > " dest-path "/runconfigs.config")) ;; create stepsinfo and items refdbs, some stuff has to be done due to refdb not initing area ;; ;; sheet row col value ;; stepsinfo testname itempath stepname steptime ;; miscinfo "itemsinfo" testname itempath "x" ;; (for-each (lambda (rdbname) (if (not (file-exists? (conc dest-path "/" rdbname))) (begin (create-directory (conc dest-path "/" rdbname "/sxml") #t) (with-output-to-file (conc dest-path "/" rdbname "/sheet-names.cfg") (lambda ()(print)))))) '("stepsinfo" "miscinfo")) (let* ((runs (rmt:simple-get-runs (or runname "%") #f #f (or target "%") #f)) (tests (make-hash-table)) ;; just tests (fullt (make-hash-table)) ;; all test/items (testreg (make-hash-table)) ;; for the testconfigs (stepsrdb (conc dest-path "/stepsinfo")) (miscrdb (conc dest-path "/miscinfo"))) (if (> (length runs) 1) (debug:print-info 0 *default-log-port* "More than one run matches, first found data will be used.")) ;; get all testnames (for-each (lambda (run-id) (let* ((tests-data (rmt:get-tests-for-run run-id "%" '() '() #f #f #f #f #f #f #f #f))) (for-each (lambda (testdat) (let* ((test-id (db:test-get-id testdat)) (testname (db:test-get-testname testdat)) (item-path (db:test-get-item-path testdat)) (tlevel (db:test-get-is-toplevel testdat)) (tfullname (db:test-get-fullname testdat)) ;; now get steps info (test-steps (tests:get-compressed-steps run-id test-id)) (testconfig (tests:get-testconfig testname item-path testreg #f))) (if (not (hash-table-exists? fullt tfullname)) ;; do the work for this test if not previously done (let* ((new-test-dir (conc dest-path "/tests/" (obfuscate testname))) (tconfigf (conc new-test-dir "/testconfig"))) (print "Analyzing and extracting info for " tfullname " as " (obfuscate testname)) (print " toplevel: " (if tlevel "yes" "no")) (hash-table-set! fullt tfullname #t) ;; track that this one has been seen (if (not (directory-exists? new-test-dir)) (create-directory new-test-dir #t)) ;; create the testconfig IIF we are a toplevel or an item AND the testconfig has not been previously created (if (and (or (not tlevel) (not (equal? item-path ""))) (not (file-exists? tconfigf))) (with-output-to-file tconfigf (lambda () ;; first the ezsteps (print "[ezsteps]") (for-each (lambda (teststep) (let* ((step-name (vector-ref teststep 0))) (print (obfuscate step-name) " sleep $(refdb lookup #{getenv MT_RUN_AREA_HOME}/stepsinfo " (obfuscate testname) " $MT_ITEMPATH " (obfuscate step-name) ")"))) test-steps) ;; now the requirements section (if testconfig (begin (print "\n[requirements]") (for-each (lambda (entry) (let* ((key (car entry)) (val (cadr entry))) (case (string->symbol key) ((waiton) (print "waiton " (obfuscate val))) (else (print key " " val))))) (configf:get-section testconfig "requirements"))) (print "WARNING: No testconfig data for " testname ", " item-path)) (print "\n[items]") (print "THE_ITEM [system refdb getrow #{getenv MT_RUN_AREA_HOME}/miscinfo itemsinfo " (obfuscate testname)" | awk '{print $1}']") ))) ;; fill the stepsrdb (for-each (lambda (teststep) (let* ((step-name (vector-ref teststep 0)) (step-duration (hrs-min-sec->seconds (vector-ref teststep 4)))) (system (conc "refdb set " stepsrdb " " (obfuscate testname) " '" (if (equal? item-path "") "no-item-path" (obfuscate item-path)) "' " (obfuscate step-name) " " step-duration)))) test-steps) ;; miscinfo "itemsinfo" testname itempath "x" (if (not (equal? item-path "")) (system (conc "refdb set " miscrdb " itemsinfo " (obfuscate testname) " " (obfuscate item-path) " x"))) )))) tests-data))) (map (lambda (runrec)(simple-run-id runrec)) runs))) )) |
Modified megatest.scm from [5f03716a04] to [52da2391a8].
︙ | ︙ | |||
230 231 232 233 234 235 236 | in the [archive-disks] section. cmd: keep-html, restore, save, save-remove, get,replicate-db (use -dest to set destination), -include path1,path2... to get or save specific files -generate-html : create a simple html dashboard for browsing your runs -generate-html-structure : create a top level html veiw to list targets/runs and a Run view within each run directory. -list-run-time : list time requered to complete runs. It supports following switches -run-patt <patt> -target-patt <patt> -dumpmode <csv,json,plain-text> | | | < < | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | in the [archive-disks] section. cmd: keep-html, restore, save, save-remove, get,replicate-db (use -dest to set destination), -include path1,path2... to get or save specific files -generate-html : create a simple html dashboard for browsing your runs -generate-html-structure : create a top level html veiw to list targets/runs and a Run view within each run directory. -list-run-time : list time requered to complete runs. It supports following switches -run-patt <patt> -target-patt <patt> -dumpmode <csv,json,plain-text> -list-test-time : list time requered to complete each test in a run. It following following arguments -runname <patt> -target <patt> -dumpmode <csv,json,plain-text> -extract-skeleton targd : extract a skeleton area based on the current area. Use median step run times. Diff report -diff-rep : generate diff report (must include -src-target, -src-runname, -target, -runname and either -diff-email or -diff-html) -src-target <target> -src-runname <target> -diff-email <emails> : comma separated list of email addresses to send diff report |
︙ | ︙ | |||
369 370 371 372 373 374 375 376 377 378 379 380 381 382 | "-src-target" "-src-runname" "-diff-email" "-sync-to" "-pgsync" "-kill-wait" ;; wait this long before removing test (default is 10 sec) "-diff-html" ) (list "-h" "-help" "--help" "-manual" "-version" "-force" "-xterm" "-showkeys" | > > > | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | "-src-target" "-src-runname" "-diff-email" "-sync-to" "-pgsync" "-kill-wait" ;; wait this long before removing test (default is 10 sec) "-diff-html" ;; wizards, area capture, setup new ... "-extract-skeleton" ) (list "-h" "-help" "--help" "-manual" "-version" "-force" "-xterm" "-showkeys" |
︙ | ︙ | |||
444 445 446 447 448 449 450 451 452 453 454 455 456 457 | "-sync-brute-force" "-logging" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only "-diff-rep" ;; junk placeholder ;; "-:p" ) args:arg-hash 0)) | > | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | "-sync-brute-force" "-logging" "-v" ;; verbose 2, more than normal (normal is 1) "-q" ;; quiet 0, errors/warnings only "-diff-rep" "-obfuscate" ;; junk placeholder ;; "-:p" ) args:arg-hash 0)) |
︙ | ︙ | |||
2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 | (if (args:get-arg "-generate-html") (let* ((toppath (launch:setup))) (if (tests:create-html-tree #f) (debug:print-info 0 *default-log-port* "HTML output created in " toppath "/lt/page0.html") (debug:print 0 *default-log-port* "Failed to create HTML output in " toppath "/lt/runs-index.html")) (set! *didsomething* #t))) (if (args:get-arg "-generate-html-structure") (let* ((toppath (launch:setup))) ;(if (tests:create-html-tree #f) (if (tests:create-html-summary #f) (debug:print-info 0 *default-log-port* "HTML output created in " toppath "/lt/targets.html") (debug:print 0 *default-log-port* "Failed to create HTML output in " toppath "/lt/runs-index.html")) (set! *didsomething* #t))) ;;====================================================================== ;; Exit and clean up ;;====================================================================== (if (not *didsomething*) (debug:print 0 *default-log-port* help) (set! *time-to-exit* #t) | > > > > > > > | 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 | (if (args:get-arg "-generate-html") (let* ((toppath (launch:setup))) (if (tests:create-html-tree #f) (debug:print-info 0 *default-log-port* "HTML output created in " toppath "/lt/page0.html") (debug:print 0 *default-log-port* "Failed to create HTML output in " toppath "/lt/runs-index.html")) (set! *didsomething* #t))) (if (args:get-arg "-generate-html-structure") (let* ((toppath (launch:setup))) ;(if (tests:create-html-tree #f) (if (tests:create-html-summary #f) (debug:print-info 0 *default-log-port* "HTML output created in " toppath "/lt/targets.html") (debug:print 0 *default-log-port* "Failed to create HTML output in " toppath "/lt/runs-index.html")) (set! *didsomething* #t))) (if (args:get-arg "-extract-skeleton") (let* ((toppath (launch:setup))) (genexample:extract-skeleton-area (args:get-arg "-extract-skeleton")) (set! *didsomething* #t))) ;;====================================================================== ;; Exit and clean up ;;====================================================================== (if (not *didsomething*) (debug:print 0 *default-log-port* help) (set! *time-to-exit* #t) |
︙ | ︙ |
Modified runs.scm from [fad1b4b96b] to [ace8916649].
︙ | ︙ | |||
100 101 102 103 104 105 106 | (lambda ()(print (current-seconds)))) (close-output-port ouf)))) (runs:dat-last-fuel-check-set! rdat (current-seconds)))))) ;; Fourth try, do accounting through time ;; (define (runs:parallel-runners-mgmt rdat) | | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | (lambda ()(print (current-seconds)))) (close-output-port ouf)))) (runs:dat-last-fuel-check-set! rdat (current-seconds)))))) ;; Fourth try, do accounting through time ;; (define (runs:parallel-runners-mgmt rdat) (let ((time-to-check (configf:lookup-number *configdat* "runners" "time-to-check" default: 10)) ;; 28 (time-to-wait (configf:lookup-number *configdat* "runners" "time-to-wait" default: 30)) (now-time (current-seconds))) (if (> (- now-time (runs:dat-last-fuel-check rdat)) time-to-check) ;; time to check (runs:wait-on-softlock rdat "runners")))) ;; To test parallel-runners management start a repl: ;; megatest -repl ;; then run: |
︙ | ︙ | |||
2041 2042 2043 2044 2045 2046 2047 | (begin (mt:test-set-state-status-by-id run-id test-id "COMPLETED" "SKIP" skip-test) (debug:print-info 1 *default-log-port* "SKIPPING Test " full-test-name " due to " skip-test)) ;; ;; Here the test is handed off to launch.scm for launch-test to complete the launch process ;; (if (not (launch-test test-id run-id run-info keyvals runname test-conf test-name test-path itemdat flags)) | | | 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 | (begin (mt:test-set-state-status-by-id run-id test-id "COMPLETED" "SKIP" skip-test) (debug:print-info 1 *default-log-port* "SKIPPING Test " full-test-name " due to " skip-test)) ;; ;; Here the test is handed off to launch.scm for launch-test to complete the launch process ;; (if (not (launch-test test-id run-id run-info keyvals runname test-conf test-name test-path itemdat flags)) (begin (print "ERROR: Failed to launch the test. Exiting as soon as possible") (set! *globalexitstatus* 1) ;; (process-signal (current-process-id) signal/kill)))))))) ((KILLED) (debug:print 1 *default-log-port* "NOTE: " full-test-name " is already running or was explictly killed, use -force to launch it.") (hash-table-set! test-registry (db:test-make-full-name test-name test-path) 'DONOTRUN)) ;; KILLED)) ((LAUNCHED REMOTEHOSTSTART RUNNING) |
︙ | ︙ |