Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | 1.65-subrun-ancilliary-usecases |
Files: | files | file ages | folders |
SHA1: |
ddb7261be31d9d3fdc133c51ab4dde72 |
User & Date: | bjbarcla on 2017-12-20 17:53:35 |
Other Links: | branch diff | manifest | tags |
Context
2017-12-22
| ||
16:58 | update mtut to use coalesced param mapper check-in: bb9a5850ab user: bjbarcla tags: 1.65-subrun-ancilliary-usecases | |
2017-12-20
| ||
17:53 | wip check-in: ddb7261be3 user: bjbarcla tags: 1.65-subrun-ancilliary-usecases | |
2017-12-13
| ||
23:54 | TODO: send email to notify admin contact listed in the config that the listener got killed check-in: 7cb9fcca30 user: pjhatwal tags: v1.65 | |
Changes
Modified common.scm from [933bab82d3] to [b53cbe1358].
︙ | ︙ | |||
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 | res) '())) ;; clear vars matching pattern, run proc, set vars back ;; if proc is a string run that string as a command with ;; system. ;; (define (common:without-vars proc . var-patts) (let ((vars (make-hash-table))) (for-each (lambda (vardat) ;; each env var (for-each (lambda (var-patt) (if (string-match var-patt (car vardat)) | > > > | 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 | res) '())) ;; clear vars matching pattern, run proc, set vars back ;; if proc is a string run that string as a command with ;; system. ;; (define (common:without-vars proc . var-patts) (let ((vars (make-hash-table))) (for-each (lambda (vardat) ;; each env var (for-each (lambda (var-patt) (if (string-match var-patt (car vardat)) |
︙ | ︙ | |||
1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 | ((string? proc)(system proc)) (proc (proc))) (hash-table-for-each vars (lambda (var val) (setenv var val))) vars)) (define (common:run-a-command cmd #!key (with-vars #f)) (let* ((pre-cmd (dtests:get-pre-command)) (post-cmd (dtests:get-post-command)) (fullcmd (if (or pre-cmd post-cmd) (conc pre-cmd cmd post-cmd) (conc "viewscreen " cmd)))) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 | ((string? proc)(system proc)) (proc (proc))) (hash-table-for-each vars (lambda (var val) (setenv var val))) vars)) (define (common:get-param-mapping #!key (flavor #f)) "returns alist mapping string keys in testconfig/subrun to megatest command line switches; if flavor is switch-symbol, maps tcmt symbolic switches to megatest switches" (let ((default '(("tag-expr" . "-tagexpr") ("mode-patt" . "-modepatt") ("run-name" . "-runname") ("contour" . "-contour") ("mode-patt" . "-mode-patt") ("test-patt" . "-testpatt") ("msg" . "-m") ("new" . "-set-state-status")))) (if (eq? flavor 'switch) (map (lambda (x) (cons (string->symbol (conc "-" (car x)) (cdr x)))) default) default))) (define (common:sub-megatest-selector-switches test-run-dir) (let* ((switch-def-alist (common:get-param-mapping flavor: 'config))) (subrunfile (conc test-run-dir "/testconfig.subrun" )) (subrundata (with-input-from-file subrunfile read)) (subrunconfig (configf:alist->config subrundata))) ;; note - get precmd from subrun section ;; apply to submegatest commands (apply append (filter-map (lambda (item) (let ((config-key (car item)) (switch (cdr item)) (val (configf:lookup subrunconfig switch))) (if val (list switch val) #f))) switch-def-alist)))) (define (common:sub-megatest-run test-run-dir switches #!key (logfile #f)) (let* ((real-logfile (or logfile (conc (test-run-dir) "/subrun-" (string-substitute "[/*]" "_" (string-intersperse switches "^"))"-" (number->string (current-seconds)) ".log"))) (selector-switches (common:sub-megatest-selector-switches test-run-dir)) (cmd-list `("megatest" ,@selector-switches ,@switches "-log" ,real-logfile)) ) (call-with-environment-variables (list (cons "PATH" (conc (get-environment-variable "PATH") ":."))) (lambda () (common:without-vars proc "^MT_.*") )))) (define (common:run-a-command cmd #!key (with-vars #f)) (let* ((pre-cmd (dtests:get-pre-command)) (post-cmd (dtests:get-post-command)) (fullcmd (if (or pre-cmd post-cmd) (conc pre-cmd cmd post-cmd) (conc "viewscreen " cmd)))) |
︙ | ︙ |
Modified launch.scm from [ab11d5875b] to [f5f7549be1].
︙ | ︙ | |||
319 320 321 322 323 324 325 | ;; 2. unset MT_* vars ;; 3. fix target ;; 4. fix runname ;; 5. fix testpatt or calculate it from contour ;; 6. launch the run ;; 7. roll up the run result and or roll up the logpro processed result (if (configf:lookup testconfig "subrun" "runwait") ;; we use runwait as the flag that a subrun is requested | > | > | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | ;; 2. unset MT_* vars ;; 3. fix target ;; 4. fix runname ;; 5. fix testpatt or calculate it from contour ;; 6. launch the run ;; 7. roll up the run result and or roll up the logpro processed result (if (configf:lookup testconfig "subrun" "runwait") ;; we use runwait as the flag that a subrun is requested (configf:write-alist testconfig "testconfig.subrun") ;; BB: created here (let* ((runarea (let ((ra (configf:lookup testconfig "subrun" "run-area"))) (if ra ;; when runarea is not set we default to *toppath*. However ra ;; we need to force the setting in the testconfig so it will (begin ;; be preserved in the testconfig.subrun file (configf:set-section-var testconfig "subrun" "runarea" *toppath*) *toppath*)))) ;;; BB: TODO - use common:param (passfail (configf:lookup testconfig "subrun" "passfail")) (target (or (configf:lookup testconfig "subrun" "target") (get-environment-variable "MT_TARGET"))) (runname (or (configf:lookup testconfig "subrun" "runname")(get-environment-variable "MT_RUNNAME"))) (contour (configf:lookup testconfig "subrun" "contour")) (testpatt (configf:lookup testconfig "subrun" "test-patt")) (mode-patt (configf:lookup testconfig "subrun" "mode-patt")) (tag-expr (configf:lookup testconfig "subrun" "tag-expr")) (run-wait (configf:lookup testconfig "subrun" "runwait")) (logpro (configf:lookup testconfig "subrun" "logpro")) (compact-stem (string-substitute "[/*]" "_" (conc target "-" runname "-" (or testpatt mode-patt tag-expr)))) (log-file (conc compact-stem ".log")) (mt-cmd (conc "megatest -run -target " target |
︙ | ︙ | |||
364 365 366 367 368 369 370 | ;; (common:without-vars mt-cmd "^MT_.*") (debug:print-info 0 *default-log-port* "Subrun command is \"" mt-cmd "\"") (set! ezsteps #t) ;; set the needed flag (set! ezstepslst (append (or ezstepslst '()) (list (list "subrun" (conc "{subrun=true} " mt-cmd))))) (configf:set-section-var testconfig "logpro" "subrun" logpro) ;; append the logpro rules to the logpro section as stepname subrun (if runarea (configf:set-section-var testconfig "setup" "submegatest" runarea)) | | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | ;; (common:without-vars mt-cmd "^MT_.*") (debug:print-info 0 *default-log-port* "Subrun command is \"" mt-cmd "\"") (set! ezsteps #t) ;; set the needed flag (set! ezstepslst (append (or ezstepslst '()) (list (list "subrun" (conc "{subrun=true} " mt-cmd))))) (configf:set-section-var testconfig "logpro" "subrun" logpro) ;; append the logpro rules to the logpro section as stepname subrun (if runarea (configf:set-section-var testconfig "setup" "submegatest" runarea)) )) ;; process the ezsteps (if ezsteps (begin (if (not (common:file-exists? ".ezsteps"))(create-directory ".ezsteps")) ;; if ezsteps was defined then we are sure to have at least one step but check anyway |
︙ | ︙ |
Modified runs.scm from [b0c63a44c5] to [6620831073].
︙ | ︙ | |||
2070 2071 2072 2073 2074 2075 2076 | (test-fulln (db:test-get-fullname new-test-dat)) (uname (db:test-get-uname new-test-dat)) (toplevel-with-children (and (db:test-get-is-toplevel test) (> (rmt:test-toplevel-num-items run-id test-name) 0)))) (case action ((remove-runs) ;; if the test is a toplevel-with-children issue an error and do not remove | > | < | | 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 | (test-fulln (db:test-get-fullname new-test-dat)) (uname (db:test-get-uname new-test-dat)) (toplevel-with-children (and (db:test-get-is-toplevel test) (> (rmt:test-toplevel-num-items run-id test-name) 0)))) (case action ((remove-runs) ;; if the test is a toplevel-with-children issue an error and do not remove (cond (toplevel-with-children (debug:print 0 *default-log-port* "WARNING: skipping removal of " test-fulln " with run-id " run-id " as it has sub tests") (hash-table-set! toplevel-retries test-fulln (+ (hash-table-ref/default toplevel-retries test-fulln 0) 1)) (if (> (hash-table-ref toplevel-retries test-fulln) 3) (if (not (null? tal)) (loop (car tal)(cdr tal))) ;; no else clause - drop it if no more in queue and > 3 tries (let ((newtal (append tal (list test)))) (loop (car newtal)(cdr newtal))))) ;; loop with test still in queue (else (debug:print-info 0 *default-log-port* "test: " test-name " itest-state: " test-state) (if (member test-state (list "RUNNING" "LAUNCHED" "REMOTEHOSTSTART" "KILLREQ")) (begin (if (not (hash-table-ref/default test-retry-time test-fulln #f)) (begin ;; want to set to REMOVING BUT CANNOT do it here? (hash-table-set! test-retry-time test-fulln (current-seconds)))) |
︙ | ︙ |