Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.6584-ck5 |
Files: | files | file ages | folders |
SHA1: |
3e47d0a515335f013e48a474cbf8c642 |
User & Date: | matt on 2021-04-14 21:59:23 |
Other Links: | branch diff | manifest | tags |
Context
2021-04-14
| ||
22:37 | wip check-in: 24d5f5ea92 user: matt tags: v1.6584-ck5 | |
21:59 | wip check-in: 3e47d0a515 user: matt tags: v1.6584-ck5 | |
21:42 | wip check-in: b2430732e0 user: matt tags: v1.6584-ck5 | |
Changes
Modified mtmod.scm from [df18d8fd34] to [7dfd12d402].
︙ | ︙ | |||
19 20 21 22 23 24 25 | ;;====================================================================== (declare (unit mtmod)) ;; (declare (uses mtargs)) (declare (uses debugprint)) (declare (uses commonmod)) (declare (uses dbmod)) | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ;;====================================================================== (declare (unit mtmod)) ;; (declare (uses mtargs)) (declare (uses debugprint)) (declare (uses commonmod)) (declare (uses dbmod)) (declare (uses configfmod)) (module mtmod * (import scheme chicken.base |
︙ | ︙ | |||
44 45 46 47 48 49 50 | chicken.time debugprint ;; mtargs ;; pkts commonmod dbmod | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | chicken.time debugprint ;; mtargs ;; pkts commonmod dbmod configfmod (prefix base64 base64:) (prefix dbi dbi:) (prefix sqlite3 sqlite3:) (srfi 18) directory-utils format |
︙ | ︙ | |||
119 120 121 122 123 124 125 126 127 | (loop (car remt) (cdr remt) (if (member failed-test waitons) (begin (debug:print 0 *default-log-port* "Discarding test " testn "(" test-dat ") due to " failed-test) res) (cons testn res))))))))) | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | (loop (car remt) (cdr remt) (if (member failed-test waitons) (begin (debug:print 0 *default-log-port* "Discarding test " testn "(" test-dat ") due to " failed-test) res) (cons testn res))))))))) ;;====================================================================== ;; read a config file, loading only the section pertinent ;; to this run field1val/field2val/field3val ... ;;====================================================================== ;; (use format directory-utils) ;; ;; (declare (unit runconfig)) ;; (declare (uses common)) ;; ;; (include "common_records.scm") ;; NB// to process a runconfig ensure to use environ-patt with target! ;; (define (setup-env-defaults fname run-id already-seen keyvals #!key (environ-patt #f)(change-env #t)) (let* ((keys (map car keyvals)) (thekey (if keyvals (string-intersperse (map (lambda (x)(if x x "-na-")) (map cadr keyvals)) "/") (or (common:args-get-target) (get-environment-variable "MT_TARGET") (begin (debug:print-error 0 *default-log-port* "setup-env-defaults called with no run-id or -target or -reqtarg") "nothing matches this I hope")))) ;; Why was system disallowed in the reading of the runconfigs file? ;; NOTE: Should be setting env vars based on (target|default) (confdat (runconfig:read fname thekey environ-patt)) (whatfound (make-hash-table)) (finaldat (make-hash-table)) (sections (list "default" thekey))) (if (not *target*)(set! *target* thekey)) ;; may save a db access or two but repeats db:get-target code (debug:print 4 *default-log-port* "Using key=\"" thekey "\"") (if change-env (for-each ;; NB// This can be simplified with new content of keyvals having all that is needed. (lambda (keyval) (safe-setenv (car keyval)(cadr keyval))) keyvals)) (for-each (lambda (section) (let ((section-dat (hash-table-ref/default confdat section #f))) (if section-dat (for-each (lambda (envvar) (let ((val (cadr (assoc envvar section-dat)))) (hash-table-set! whatfound section (+ (hash-table-ref/default whatfound section 0) 1)) (if (and (string? envvar) (string? val) change-env) (safe-setenv envvar val)) (hash-table-set! finaldat envvar val))) (map car section-dat))))) sections) (if already-seen (begin (debug:print 2 *default-log-port* "Key settings found in runconfigs.config:") (for-each (lambda (fullkey) (debug:print 2 *default-log-port* (format #f "~20a ~a\n" fullkey (hash-table-ref/default whatfound fullkey 0)))) sections) (debug:print 2 *default-log-port* "---") (set! *already-seen-runconfig-info* #t))) ;; finaldat ;; was returning this "finaldat" which would be good but conflicts with other uses confdat )) (define (set-run-config-vars run-id keyvals targ-from-db) (push-directory *toppath*) ;; the push/pop doesn't appear to do anything ... (let ((runconfigf (conc *toppath* "/runconfigs.config")) (targ (or (common:args-get-target) targ-from-db (get-environment-variable "MT_TARGET")))) (pop-directory) (if (common:file-exists? runconfigf) (setup-env-defaults runconfigf run-id #t keyvals environ-patt: (conc "(default" (if targ (conc "|" targ ")") ")"))) (debug:print 0 *default-log-port* "WARNING: You do not have a run config file: " runconfigf)))) ;; given (a (b c) d) return ((a b d)(a c d)) ;; NOTE: this feels like it has been done before - perhaps with items handling? ;; (define (runconfig:combinations inlst) (let loop ((hed (car inlst)) (tal (cdr inlst)) (res '())) ;; (print "res: " res " hed: " hed) (if (list? hed) (let ((newres (if (null? res) ;; first time through convert incoming items to list of items (map list hed) (apply append (map (lambda (r) ;; iterate over items in res (map (lambda (h) ;; iterate over items in hed (append r (list h))) hed)) res))))) ;; (print "newres1: " newres) (if (null? tal) newres (loop (car tal)(cdr tal) newres))) (let ((newres (if (null? res) (list (list hed)) (map (lambda (r) (append r (list hed))) res)))) ;; (print "newres2: " newres) (if (null? tal) newres (loop (car tal)(cdr tal) newres)))))) ;; multi-part expand ;; Given a/b,c,d/e,f return a/b/e a/b/f a/c/e a/c/f a/d/e a/d/f ;; (define (runconfig:expand target) (let* ((parts (map (lambda (x) (string-split x ",")) (string-split target "/")))) (map (lambda (x) (string-intersperse x "/")) (runconfig:combinations parts)))) ;; multi-target expansion ;; a/b/c/x,y,z a/b/d/x,y => a/b/c/x a/b/c/y a/b/c/z a/b/d/x a/b/d/y ;; (define (runconfig:expand-target target-strs) (delete-duplicates (apply append (map runconfig:expand (string-split target-strs " "))))) #| (if (null? target-strs) '() (let loop ((hed (car target-strs)) (tal (cdr target-strs)) (res '())) ;; first break all parts into individual target patterns (if (string-index hed " ") ;; this is a multi-target target (let ((newres (append (string-split hed " ") res))) (runconfig:expand-target newres)) (if (string-index hed ",") ;; this is a multi-target where one or more parts are comma separated |# ) |
Modified runconfig.scm from [6699d4754a] to [1501321c72].
︙ | ︙ | |||
11 12 13 14 15 16 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 11 12 13 14 15 16 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. |
Modified runsmod.scm from [a2d1c728ab] to [2690188456].
︙ | ︙ | |||
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 41 42 43 44 | ;; ;; 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 runsmod)) (declare (uses debugprint)) (declare (uses commonmod)) (declare (uses configfmod)) (declare (uses mtargs)) (declare (uses mtver)) (declare (uses csv-xml)) (declare (uses keysmod)) (declare (uses mtmod)) (declare (uses processmod)) (declare (uses dbmod)) (declare (uses rmtmod)) (declare (uses testsmod)) (declare (uses tasksmod)) (declare (uses archivemod)) (declare (uses launchmod)) (declare (uses subrunmod)) (module runsmod * (import scheme (prefix sqlite3 sqlite3:) chicken.base | > > > | 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 41 42 43 44 45 46 47 | ;; ;; 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 runsmod)) (declare (uses debugprint)) (declare (uses commonmod)) (declare (uses configfmod)) (declare (uses mtargs)) (declare (uses mtver)) (declare (uses csv-xml)) (declare (uses keysmod)) (declare (uses mtmod)) (declare (uses processmod)) (declare (uses dbmod)) (declare (uses rmtmod)) (declare (uses testsmod)) (declare (uses tasksmod)) (declare (uses archivemod)) (declare (uses launchmod)) (declare (uses subrunmod)) (declare (uses servermod)) (declare (uses itemsmod)) (module runsmod * (import scheme (prefix sqlite3 sqlite3:) chicken.base |
︙ | ︙ | |||
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | dbmod rmtmod testsmod tasksmod archivemod launchmod subrunmod ) (include "db_records.scm") ;; use this struct to facilitate refactoring ;; (defstruct runs:dat reglen regfull runname max-concurrent-jobs run-id | > > > > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | dbmod rmtmod testsmod tasksmod archivemod launchmod subrunmod servermod itemsmod ) (include "db_records.scm") (include "run_records.scm") (include "test_records.scm") (include "key_records.scm") ;; use this struct to facilitate refactoring ;; (defstruct runs:dat reglen regfull runname max-concurrent-jobs run-id |
︙ | ︙ | |||
2051 2052 2053 2054 2055 2056 2057 | ;; ;; target-patts a1/b1/c1,a2/b2/c2 ... ;; ;; This will fail if called with empty target or a bad target (i.e. missing or extra fields) ;; (define (runs:get-hash-by-target target-patts runpatt) (let* ((targets (string-split target-patts ",")) | | | 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 | ;; ;; target-patts a1/b1/c1,a2/b2/c2 ... ;; ;; This will fail if called with empty target or a bad target (i.e. missing or extra fields) ;; (define (runs:get-hash-by-target target-patts runpatt) (let* ((targets (string-split target-patts ",")) (keys (rmt:get-keys)) (res-ht (make-hash-table))) ;; target -> ( runrecord1 runrecord2 ... ) (for-each (lambda (target-patt) (let ((runs (rmt:simple-get-runs runpatt #f #f target-patt #f))) (for-each (lambda (run) (let ((target (simple-run-target run))) |
︙ | ︙ | |||
2131 2132 2133 2134 2135 2136 2137 | ) ) (define (runs:operate-on action target runnamepatt testpatt #!key (state #f)(status #f)(new-state-status #f)(mode #f)(options '())) (common:clear-caches) ;; clear all caches (let* ((db #f) ;; (tdbdat (tasks:open-db)) | | | 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 | ) ) (define (runs:operate-on action target runnamepatt testpatt #!key (state #f)(status #f)(new-state-status #f)(mode #f)(options '())) (common:clear-caches) ;; clear all caches (let* ((db #f) ;; (tdbdat (tasks:open-db)) (keys (rmt:get-keys)) (rundat (mt:get-runs-by-patt keys runnamepatt target)) (header (vector-ref rundat 0)) (runs (vector-ref rundat 1)) (states (if state (string-split state ",") '())) (statuses (if status (string-split status ",") '())) (state-status (if (string? new-state-status) (string-split new-state-status ",") '(#f #f))) (rp-mutex (make-mutex)) |
︙ | ︙ |
Modified tests.scm from [2e4200a426] to [828e21ad30].
︙ | ︙ | |||
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/>. ;; ;;====================================================================== | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; ;;====================================================================== ;;====================================================================== ;; html output from server ;;====================================================================== (define (tests:dynamic-dboard page) |
︙ | ︙ |
Modified testsmod.scm from [687d678365] to [f755d84d12].
︙ | ︙ | |||
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | (s:td (tdb:steps-table-get-runtime step-dat)) (s:td (let ((step-log (tdb:steps-table-get-log-file step-dat))) (s:a 'href step-log step-log))))) steps-dat)) ))) (close-output-port oup))))) ) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 | (s:td (tdb:steps-table-get-runtime step-dat)) (s:td (let ((step-log (tdb:steps-table-get-log-file step-dat))) (s:a 'href step-log step-log))))) steps-dat)) ))) (close-output-port oup))))) ;; for each test: ;; (define (tests:filter-non-runnable run-id testkeynames testrecordshash) (let ((runnables '())) (for-each (lambda (testkeyname) (let* ((test-record (hash-table-ref testrecordshash testkeyname)) (test-name (tests:testqueue-get-testname test-record)) (itemdat (tests:testqueue-get-itemdat test-record)) (item-path (tests:testqueue-get-item_path test-record)) (waitons (tests:testqueue-get-waitons test-record)) (keep-test #t) (test-id (rmt:get-test-id run-id test-name item-path)) (tdat (rmt:get-testinfo-state-status run-id test-id))) ;; (cdb:get-test-info-by-id *runremote* test-id))) (if tdat (begin ;; Look at the test state and status (if (or (and (member (db:test-get-status tdat) '("PASS" "WARN" "WAIVED" "CHECK" "SKIP")) (equal? (db:test-get-state tdat) "COMPLETED")) (member (db:test-get-state tdat) '("INCOMPLETE" "KILLED"))) (set! keep-test #f)) ;; examine waitons for any fails. If it is FAIL or INCOMPLETE then eliminate this test ;; from the runnable list (if keep-test (for-each (lambda (waiton) ;; for now we are waiting only on the parent test (let* ((parent-test-id (rmt:get-test-id run-id waiton "")) (wtdat (rmt:get-testinfo-state-status run-id test-id))) ;; (cdb:get-test-info-by-id *runremote* test-id))) (if (or (and (equal? (db:test-get-state wtdat) "COMPLETED") (member (db:test-get-status wtdat) '("FAIL" "ABORT"))) (member (db:test-get-status wtdat) '("KILLED")) (member (db:test-get-state wtdat) '("INCOMPETE"))) ;; (if (or (member (db:test-get-status wtdat) ;; '("FAIL" "KILLED")) ;; (member (db:test-get-state wtdat) ;; '("INCOMPETE"))) (set! keep-test #f)))) ;; no point in running this one again waitons)))) (if keep-test (set! runnables (cons testkeyname runnables))))) testkeynames) runnables)) ) |