0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30 .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77 06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53 r.;; greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72 .;; This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 RRANTY; without
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70 even the.;; imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 or FITNESS FOR
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20 A PARTICULAR.;;
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73 PURPOSE...;; s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25 trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77 Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66 (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20 i-1 posix regex
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 20 28 69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 20 70 6f 73 69 78 2d 65 srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28 utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73 prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29 are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 .(declare (uses
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65 ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73 s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28 es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65 declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28 uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75 rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73 de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72 cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72 by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63 uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73 riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61 Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64 lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77 info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74 runinfo)).;; t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66 o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64 e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 runs-by-patt db
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 keys runnamepatt
0450: 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65 . params) ;; te
0460: 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a st-name). (let*
0470: 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65 ((keyvallst (ke
0480: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 ys->vallist keys
0490: 29 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28 )).. (tmp (
04a0: 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e runs:get-std-run
04b0: 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22 -fields keys '("
04c0: 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73 id" "runname" "s
04d0: 74 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22 tate" "status" "
04e0: 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69 owner" "event_ti
04f0: 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72 me"))).. (keystr
0500: 20 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20 (car tmp))..
0510: 28 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20 (header (cadr
0520: 74 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20 tmp)).. (res
0530: 20 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74 '()).. (key-pat
0540: 74 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d t "")). (for-
0550: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65 each (lambda (ke
0560: 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28 yval)...(let* ((
0570: 6b 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72 key (vector-r
0580: 65 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09 ef keyval 0))...
0590: 20 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28 (fulkey (
05a0: 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09 conc ":" key))..
05b0: 09 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20 . (patt
05c0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75 (args:get-arg fu
05d0: 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20 lkey)))... (if
05e0: 70 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 patt... (se
05f0: 74 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e t! key-patt (con
0600: 63 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 c key-patt " AND
0610: 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22 " key " like '"
0620: 20 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20 patt "'"))...
0630: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64 (begin....(d
0640: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
0650: 52 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66 ROR: searching f
0660: 6f 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20 or runs with no
0670: 70 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20 pattern set for
0680: 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78 " fulkey)....(ex
0690: 69 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20 it 6)))))..
06a0: 20 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69 keys). (sqli
06b0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
06c0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
06d0: 61 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73 a . r). (s
06e0: 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c et! res (cons (l
06f0: 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e ist->vector (con
0700: 73 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20 s a r)) res))).
0710: 20 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f db . (co
0720: 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79 nc "SELECT " key
0730: 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 str " FROM runs
0740: 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69 WHERE runname li
0750: 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 ke ? " key-patt
0760: 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d ";"). runnam
0770: 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74 epatt). (vect
0780: 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29 or header res)))
0790: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
07a0: 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61 test-get-full-pa
07b0: 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 2a th test). (let*
07c0: 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 3a ((testname (db:
07d0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
07e0: 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 74 e test)).. (it
07f0: 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d empath (db:test-
0800: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
0810: 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 st))). (conc
0820: 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 71 testname (if (eq
0830: 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22 ual? itempath ""
0840: 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 69 ) "" (conc "(" i
0850: 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 29 tempath ")")))))
0860: 0a 0a 3b 3b 20 41 77 66 75 6c 2e 20 50 6c 65 61 ..;; Awful. Plea
0870: 73 65 20 46 49 58 4d 45 0a 28 64 65 66 69 6e 65 se FIXME.(define
0880: 20 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 *env-vars-by-ru
0890: 6e 2d 69 64 2a 20 28 6d 61 6b 65 2d 68 61 73 68 n-id* (make-hash
08a0: 2d 74 61 62 6c 65 29 29 0a 28 64 65 66 69 6e 65 -table)).(define
08b0: 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e 2d 6e 61 *current-run-na
08c0: 6d 65 2a 20 20 20 23 66 29 0a 0a 28 64 65 66 69 me* #f)..(defi
08d0: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 ne (set-megatest
08e0: 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e -env-vars db run
08f0: 2d 69 64 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 -id). (let ((ke
0900: 79 73 20 28 64 62 3a 67 65 74 2d 6b 65 79 73 20 ys (db:get-keys
0910: 64 62 29 29 0a 09 28 76 61 6c 73 20 28 68 61 73 db))..(vals (has
0920: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
0930: 75 6c 74 20 2a 65 6e 76 2d 76 61 72 73 2d 62 79 ult *env-vars-by
0940: 2d 72 75 6e 2d 69 64 2a 20 72 75 6e 2d 69 64 20 -run-id* run-id
0950: 23 66 29 29 29 0a 20 20 20 20 3b 3b 20 67 65 74 #f))). ;; get
0960: 20 74 68 65 20 69 6e 66 6f 20 66 72 6f 6d 20 74 the info from t
0970: 68 65 20 64 62 20 61 6e 64 20 70 75 74 20 69 74 he db and put it
0980: 20 69 6e 20 74 68 65 20 63 61 63 68 65 0a 20 20 in the cache.
0990: 20 20 28 69 66 20 28 6e 6f 74 20 76 61 6c 73 29 (if (not vals)
09a0: 0a 09 28 6c 65 74 20 28 28 68 74 20 28 6d 61 6b ..(let ((ht (mak
09b0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
09c0: 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 . (hash-table-s
09d0: 65 74 21 20 2a 65 6e 76 2d 76 61 72 73 2d 62 79 et! *env-vars-by
09e0: 2d 72 75 6e 2d 69 64 2a 20 72 75 6e 2d 69 64 20 -run-id* run-id
09f0: 68 74 29 0a 09 20 20 28 73 65 74 21 20 76 61 6c ht).. (set! val
0a00: 73 20 68 74 29 0a 09 20 20 28 66 6f 72 2d 65 61 s ht).. (for-ea
0a10: 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 28 ch.. (lambda (
0a20: 6b 65 79 29 0a 09 20 20 20 20 20 28 73 71 6c 69 key).. (sqli
0a30: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
0a40: 0a 09 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 .. (lambda
0a50: 28 76 61 6c 29 0a 09 09 28 68 61 73 68 2d 74 61 (val)...(hash-ta
0a60: 62 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65 ble-set! vals ke
0a70: 79 20 76 61 6c 29 29 0a 09 20 20 20 20 20 20 64 y val)).. d
0a80: 62 20 0a 09 20 20 20 20 20 20 28 63 6f 6e 63 20 b .. (conc
0a90: 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 "SELECT " (key:g
0aa0: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 et-fieldname key
0ab0: 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 ) " FROM runs WH
0ac0: 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 20 20 20 ERE id=?;")..
0ad0: 20 20 20 72 75 6e 2d 69 64 29 29 0a 09 20 20 20 run-id))..
0ae0: 6b 65 79 73 29 29 29 0a 20 20 20 20 3b 3b 20 66 keys))). ;; f
0af0: 72 6f 6d 20 74 68 65 20 63 61 63 68 65 64 20 64 rom the cached d
0b00: 61 74 61 20 73 65 74 20 74 68 65 20 76 61 72 73 ata set the vars
0b10: 0a 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 . (hash-table
0b20: 2d 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 76 -for-each. v
0b30: 61 6c 73 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 als. (lambda
0b40: 20 28 6b 65 79 20 76 61 6c 29 0a 20 20 20 20 20 (key val).
0b50: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
0b60: 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65 79 3a "setenv " (key:
0b70: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
0b80: 79 29 20 22 20 22 20 76 61 6c 29 0a 20 20 20 20 y) " " val).
0b90: 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65 79 3a (setenv (key:
0ba0: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
0bb0: 79 29 20 76 61 6c 29 29 29 0a 20 20 20 20 28 61 y) val))). (a
0bc0: 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72 73 20 28 list->env-vars (
0bd0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
0be0: 65 66 61 75 6c 74 20 2a 63 6f 6e 66 69 67 64 61 efault *configda
0bf0: 74 2a 20 22 65 6e 76 2d 6f 76 65 72 72 69 64 65 t* "env-override
0c00: 22 20 27 28 29 29 29 0a 20 20 20 20 3b 3b 20 4c " '())). ;; L
0c10: 65 74 73 20 75 73 65 20 74 68 69 73 20 61 73 20 ets use this as
0c20: 61 6e 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 74 an opportunity t
0c30: 6f 20 70 75 74 20 4d 54 5f 52 55 4e 4e 41 4d 45 o put MT_RUNNAME
0c40: 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d in the environm
0c50: 65 6e 74 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 ent. (if (not
0c60: 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e 2d 6e 61 *current-run-na
0c70: 6d 65 2a 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 me*)..(sqlite3:f
0c80: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 20 28 6c or-each-row.. (l
0c90: 61 6d 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a ambda (runname).
0ca0: 09 20 20 20 28 73 65 74 21 20 2a 63 75 72 72 65 . (set! *curre
0cb0: 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 20 72 75 6e nt-run-name* run
0cc0: 6e 61 6d 65 29 29 0a 0a 09 20 64 62 0a 09 20 22 name))... db.. "
0cd0: 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 SELECT runname F
0ce0: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 ROM runs WHERE i
0cf0: 64 3d 3f 3b 22 0a 09 20 72 75 6e 2d 69 64 29 29 d=?;".. run-id))
0d00: 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 . (setenv "MT
0d10: 5f 52 55 4e 4e 41 4d 45 22 20 2a 63 75 72 72 65 _RUNNAME" *curre
0d20: 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 29 0a 20 20 nt-run-name*).
0d30: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 (setenv "MT_RU
0d40: 4e 5f 41 52 45 41 5f 48 4f 4d 45 22 20 2a 74 6f N_AREA_HOME" *to
0d50: 70 70 61 74 68 2a 29 0a 20 20 20 20 29 29 0a 0a ppath*). ))..
0d60: 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 74 65 (define (set-ite
0d70: 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 6d 64 m-env-vars itemd
0d80: 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 68 20 at). (for-each
0d90: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 0a 09 (lambda (item)..
0da0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
0db0: 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 28 nt 2 "setenv " (
0dc0: 63 61 72 20 69 74 65 6d 29 20 22 20 22 20 28 63 car item) " " (c
0dd0: 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20 20 20 adr item))..
0de0: 20 20 28 73 65 74 65 6e 76 20 28 63 61 72 20 69 (setenv (car i
0df0: 74 65 6d 29 20 28 63 61 64 72 20 69 74 65 6d 29 tem) (cadr item)
0e00: 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61 74 29 )).. itemdat)
0e10: 29 0a 0a 28 64 65 66 69 6e 65 20 2a 6c 61 73 74 )..(define *last
0e20: 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 -num-running-tes
0e30: 74 73 2a 20 30 29 0a 28 64 65 66 69 6e 65 20 28 ts* 0).(define (
0e40: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
0e50: 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d e-tests db test-
0e60: 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74 2a 20 record). (let*
0e70: 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20 20 20 ((tconfig
0e80: 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 73 (tests
0e90: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
0ea0: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 estconfig test-r
0eb0: 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 ecord)).. (jobgr
0ec0: 6f 75 70 20 20 20 20 20 20 20 20 20 20 20 20 20 oup
0ed0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (config-looku
0ee0: 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69 p tconfig "requi
0ef0: 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f rements" "jobgro
0f00: 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e up")).. (num-run
0f10: 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 ning
0f20: 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 (db:get-count-t
0f30: 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 ests-running db)
0f40: 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 ).. (num-running
0f50: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 64 62 -in-jobgroup (db
0f60: 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 :get-count-tests
0f70: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 -running-in-jobg
0f80: 72 6f 75 70 20 64 62 20 6a 6f 62 67 72 6f 75 70 roup db jobgroup
0f90: 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 72 )).. (max-concur
0fa0: 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c rent-jobs (l
0fb0: 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e 66 69 67 et ((mcj (config
0fc0: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 -lookup *configd
0fd0: 61 74 2a 20 22 73 65 74 75 70 22 20 20 20 20 20 at* "setup"
0fe0: 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f "max_concurrent_
0ff0: 6a 6f 62 73 22 29 29 29 0a 09 09 09 09 20 20 20 jobs"))).....
1000: 20 28 69 66 20 28 61 6e 64 20 6d 63 6a 20 28 73 (if (and mcj (s
1010: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 tring->number mc
1020: 6a 29 29 0a 09 09 09 09 09 28 73 74 72 69 6e 67 j))......(string
1030: 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 0a 09 09 ->number mcj)...
1040: 09 09 09 23 66 29 29 29 0a 09 20 28 6a 6f 62 2d ...#f))).. (job-
1050: 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 group-limit
1060: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b (config-look
1070: 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 up *configdat* "
1080: 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 jobgroups" jobgr
1090: 6f 75 70 29 29 29 0a 20 20 20 20 28 69 66 20 28 oup))). (if (
10a0: 6e 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e not (eq? *last-n
10b0: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 um-running-tests
10c0: 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a * num-running)).
10d0: 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 .(begin.. (debu
10e0: 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 g:print 2 "max-c
10f0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 oncurrent-jobs:
1100: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
1110: 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e -jobs ", num-run
1120: 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e ning: " num-runn
1130: 69 6e 67 29 0a 09 20 20 28 73 65 74 21 20 2a 6c ing).. (set! *l
1140: 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d ast-num-running-
1150: 74 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 tests* num-runni
1160: 6e 67 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e ng))). (if (n
1170: 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 ot (eq? 0 *globa
1180: 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 lexitstatus*))..
1190: 28 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72 75 6e (list #f num-run
11a0: 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 ning num-running
11b0: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 -in-jobgroup max
11c0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
11d0: 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 job-group-limit
11e0: 29 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f )..(let ((can-no
11f0: 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 t-run-more (cond
1200: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d ..... ;; if max-
1210: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 concurrent-jobs
1220: 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e is set and the n
1230: 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 umber running is
1240: 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b greater ..... ;
1250: 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 ; than it than c
1260: 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a annot run more j
1270: 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d obs..... ((and m
1280: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
1290: 62 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 bs (>= num-runni
12a0: 6e 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e ng max-concurren
12b0: 74 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20 20 28 t-jobs))..... (
12c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
12d0: 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e ARNING: Max runn
12e0: 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 ing jobs exceede
12f0: 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 d, current numbe
1300: 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d r running: " num
1310: 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 -running ......
1320: 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e ", max_con
1330: 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 current_jobs: "
1340: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
1350: 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 obs)..... #t)..
1360: 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 ... ;; if job-gr
1370: 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 oup-limit is set
1380: 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a and number of j
1390: 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 obs in the group
13a0: 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 is greater.....
13b0: 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d ;; than the lim
13c0: 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 it then cannot r
13d0: 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 un more jobs of
13e0: 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 this kind..... (
13f0: 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c (and job-group-l
1400: 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 imit.....
1410: 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d (>= num-running-
1420: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d in-jobgroup job-
1430: 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 group-limit))...
1440: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
1450: 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 1 "WARNING: num
1460: 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 ber of jobs " nu
1470: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 m-running-in-job
1480: 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 group ......
1490: 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f " in " jobgro
14a0: 75 70 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 up " exceeded, w
14b0: 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 ill not run " (t
14c0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
14d0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
14e0: 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 -record)).....
14f0: 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 #t)..... (else #
1500: 66 29 29 29 29 0a 09 20 20 28 6c 69 73 74 20 28 f)))).. (list (
1510: 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d not can-not-run-
1520: 6d 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 6e more) num-runnin
1530: 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e g num-running-in
1540: 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f -jobgroup max-co
1550: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f ncurrent-jobs jo
1560: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 29 b-group-limit)))
1570: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ))..;;==========
1580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
15a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
15b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 ============.;;
15c0: 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e New methodology.
15d0: 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 These routines
15e0: 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 will replace the
15f0: 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 above in time.
1600: 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 For.;; now the c
1610: 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 ode is duplicate
1620: 64 2e 20 54 68 69 73 20 73 74 75 66 66 20 69 73 d. This stuff is
1630: 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 initially used
1640: 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b in the monitor.;
1650: 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b ; based code..;;
1660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
16a0: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 ======..;; regis
16b0: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 ter a test run w
16c0: 69 74 68 20 74 68 65 20 64 62 0a 28 64 65 66 69 ith the db.(defi
16d0: 6e 65 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 ne (runs:registe
16e0: 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 r-run db keys ke
16f0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 yvallst runname
1700: 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 state status use
1710: 72 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e r). (debug:prin
1720: 74 20 33 20 22 72 75 6e 73 3a 72 65 67 69 73 74 t 3 "runs:regist
1730: 65 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 er-run, keys: "
1740: 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 keys " keyvallst
1750: 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 : " keyvallst "
1760: 72 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 runname: " runna
1770: 6d 65 20 22 20 73 74 61 74 65 3a 20 22 20 73 74 me " state: " st
1780: 61 74 65 20 22 20 73 74 61 74 75 73 3a 20 22 20 ate " status: "
1790: 73 74 61 74 75 73 20 22 20 75 73 65 72 3a 20 22 status " user: "
17a0: 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 user). (let* (
17b0: 28 6b 65 79 73 74 72 20 20 20 20 28 6b 65 79 73 (keystr (keys
17c0: 2d 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 29 0a ->keystr keys)).
17d0: 09 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 . (comma (if
17e0: 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 (> (length keys
17f0: 29 20 30 29 20 22 2c 22 20 22 22 29 29 0a 09 20 ) 0) "," ""))..
1800: 28 61 6e 64 73 74 72 20 20 20 20 28 69 66 20 28 (andstr (if (
1810: 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 > (length keys)
1820: 30 29 20 22 20 41 4e 44 20 22 20 22 22 29 29 0a 0) " AND " "")).
1830: 09 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 . (valslots (ke
1840: 79 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 ys->valslots key
1850: 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e s)) ;; ?,?,? ...
1860: 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20 28 6d .. (keyvals (m
1870: 61 70 20 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 ap cadr keyvalls
1880: 74 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 t)).. (allvals
1890: 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 (append (list r
18a0: 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 unname state sta
18b0: 74 75 73 20 75 73 65 72 29 20 6b 65 79 76 61 6c tus user) keyval
18c0: 73 29 29 0a 09 20 28 71 72 79 76 61 6c 73 20 20 s)).. (qryvals
18d0: 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 (append (list r
18e0: 75 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 unname) keyvals)
18f0: 29 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 ).. (key=?str (
1900: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
1910: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 se (map (lambda
1920: 28 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 (k)(conc (key:ge
1930: 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 t-fieldname k) "
1940: 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 20 41 4e =?")) keys) " AN
1950: 44 20 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 D "))). (debu
1960: 67 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 73 3a g:print 3 "keys:
1970: 20 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c " keys " allval
1980: 73 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b s: " allvals " k
1990: 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c eyvals: " keyval
19a0: 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 s). (debug:pr
19b0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 int 2 "NOTE: usi
19c0: 6e 67 20 74 61 72 67 65 74 20 22 20 28 73 74 72 ng target " (str
19d0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
19e0: 6b 65 79 76 61 6c 73 20 22 2f 22 29 20 22 20 66 keyvals "/") " f
19f0: 6f 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 or this run").
1a00: 20 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 (if (and runna
1a10: 6d 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 me (null? (filte
1a20: 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f r (lambda (x)(no
1a30: 74 20 78 29 29 20 6b 65 79 76 61 6c 73 29 29 29 t x)) keyvals)))
1a40: 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 62 ;; there must b
1a50: 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20 74 e a better way t
1a60: 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 o "apply and"..(
1a70: 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a 09 let ((res #f))..
1a80: 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 (apply sqlite3
1a90: 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 6e :execute db (con
1aa0: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e c "INSERT OR IGN
1ab0: 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 ORE INTO runs (r
1ac0: 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 unname,state,sta
1ad0: 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f tus,owner,event_
1ae0: 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 time" comma keys
1af0: 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f 2c tr ") VALUES (?,
1b00: 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 ?,?,?,strftime('
1b10: 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d %s','now')" comm
1b20: 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 a valslots ");")
1b30: 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 ... allvals)..
1b40: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 (apply sqlite3:f
1b50: 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 or-each-row ..
1b60: 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 20 (lambda (id)..
1b70: 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69 64 (set! res id
1b80: 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 6c )).. db.. (l
1b90: 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 22 et ((qry (conc "
1ba0: 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 72 SELECT id FROM r
1bb0: 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e 61 uns WHERE (runna
1bc0: 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 me=? " andstr ke
1bd0: 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a 09 y=?str ");")))..
1be0: 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 69 ;(debug:pri
1bf0: 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 79 nt 4 "qry: " qry
1c00: 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 20 ) .. qry)..
1c10: 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 73 qryvals).. (s
1c20: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 qlite3:execute d
1c30: 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 53 b "UPDATE runs S
1c40: 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 ET state=?,statu
1c50: 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 s=? WHERE id=?;"
1c60: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 65 state status re
1c70: 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 65 s).. res) ..(be
1c80: 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 gin.. (debug:pr
1c90: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 int 0 "ERROR: Ca
1ca0: 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c 6c lled without all
1cb0: 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 22 necessary keys"
1cc0: 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 ).. #f))))..;;
1cd0: 54 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 This is a duplic
1ce0: 61 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 ate of run-tests
1cf0: 20 28 77 68 69 63 68 20 68 61 73 20 62 65 65 6e (which has been
1d00: 20 64 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 deprecated). Us
1d10: 65 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 e this one inste
1d20: 61 64 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e ad of run tests.
1d30: 0a 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 65 66 .;; keyvals.(def
1d40: 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 ine (runs:run-te
1d50: 73 74 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 sts target runna
1d60: 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 75 73 me test-patts us
1d70: 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 er flags). (let
1d80: 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 * ((db
1d90: 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20 #f).. (keys
1da0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
1db0: 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 se db:get-keys d
1dc0: 62 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 b)).. (keyvallst
1dd0: 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d (keys:target-
1de0: 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 >keyval keys tar
1df0: 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 get)).. (run-id
1e00: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
1e10: 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 73 74 lose runs:regist
1e20: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b er-run db keys k
1e30: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 eyvallst runname
1e40: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 "new" "n/a" use
1e50: 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 r)) ;; test-na
1e60: 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 me))).. (deferre
1e70: 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c d '()) ;; del
1e80: 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 ay running these
1e90: 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 since they have
1ea0: 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 a waiton clause
1eb0: 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 .. ;; keepgoing
1ec0: 69 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d is the defacto m
1ed0: 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c odality now, wil
1ee0: 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 l add hit-n-run
1ef0: 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b a bit later.. ;;
1f00: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 (keepgoing (h
1f10: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
1f20: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 fault flags "-ke
1f30: 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 epgoing" #f))..
1f40: 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 (test-names '()
1f50: 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 ).. (runconfigf
1f60: 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 (conc *toppat
1f70: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e h* "/runconfigs.
1f80: 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65 71 config")).. (req
1f90: 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29 29 uired-tests '())
1fa0: 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64 73 .. (test-records
1fb0: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c (make-hash-tabl
1fc0: 65 29 29 29 0a 0a 20 20 20 20 28 6f 70 65 6e 2d e))).. (open-
1fd0: 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d 65 run-close set-me
1fe0: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 gatest-env-vars
1ff0: 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 db run-id) ;; th
2000: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 ese may be neede
2010: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 d by the launchi
2020: 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 ng process..
2030: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 (if (file-exists
2040: 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 ? runconfigf)..(
2050: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 open-run-close s
2060: 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 etup-env-default
2070: 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 s db runconfigf
2080: 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d run-id *already-
2090: 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 seen-runconfig-i
20a0: 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 nfo* "pre-launch
20b0: 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 -env-vars")..(de
20c0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
20d0: 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 NING: You do not
20e0: 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 have a run conf
20f0: 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f ig file: " runco
2100: 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 nfigf)). .
2110: 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 ;; look up all
2120: 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 tests matching t
2130: 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 he comma separat
2140: 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 ed list of globs
2150: 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d in. ;; test-
2160: 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 patts (using % a
2170: 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 s wildcard).
2180: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
2190: 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 (lambda (patt).
21a0: 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 (let ((tes
21b0: 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a ts (glob (conc *
21c0: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
21d0: 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 /" (string-trans
21e0: 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a late patt "%" "*
21f0: 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 "))))).. (set! t
2200: 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 ests (filter (la
2210: 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 mbda (test)(file
2220: 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 -exists? (conc t
2230: 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 est "/testconfig
2240: 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 "))) tests)).. (
2250: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 set! test-names
2260: 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d (append test-nam
2270: 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 es ..... (map (
2280: 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 lambda (testp)..
2290: 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 .... (last (stri
22a0: 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 ng-split testp "
22b0: 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 /"))).....
22c0: 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 tests))))).
22d0: 20 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 (if test-patts
22e0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 (string-split te
22f0: 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 st-patts ",")(li
2300: 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 st "%")))..
2310: 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 ;; now remove du
2320: 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 plicates. (se
2330: 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 t! test-names (d
2340: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 elete-duplicates
2350: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 test-names))..
2360: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
2370: 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 0 "INFO: test na
2380: 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 mes " test-names
2390: 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 ).. ;; on the
23a0: 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 first pass or c
23b0: 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 all to run-tests
23c0: 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f set FAILS to NO
23d0: 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 T_STARTED if.
23e0: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 ;; -keepgoing i
23f0: 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 s specified.
2400: 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 (if (eq? *passnu
2410: 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 m* 0)..(begin..
2420: 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 ;; have to dele
2430: 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 te test records
2440: 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 where NOT_STARTE
2450: 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e D since they can
2460: 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e cause -keepgoin
2470: 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 g to .. ;; get
2480: 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 stuck due to bec
2490: 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 oming inaccessib
24a0: 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 le from a failed
24b0: 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 test. I.e. if t
24c0: 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 est B depends ..
24d0: 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 ;; on test A b
24e0: 75 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 ut test B reache
24f0: 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 d the point on b
2500: 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 eing registered
2510: 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 as NOT_STARTED a
2520: 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 nd test.. ;; A
2530: 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 failed for some
2540: 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 reason then on r
2550: 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 e-run using -kee
2560: 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 pgoing the run c
2570: 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 an never complet
2580: 65 2e 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d e... (open-run-
2590: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d close db:delete-
25a0: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 tests-in-state d
25b0: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 b run-id "NOT_ST
25c0: 41 52 54 45 44 22 29 0a 09 20 20 28 6f 70 65 6e ARTED").. (open
25d0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 65 -run-close db:se
25e0: 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 74 t-tests-state-st
25f0: 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 20 74 atus db run-id t
2600: 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 41 est-names #f "FA
2610: 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 IL" "NOT_STARTED
2620: 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 20 20 " "FAIL")))..
2630: 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 6f 6e ;; from here on
2640: 20 6f 75 74 20 74 68 65 20 64 62 20 77 69 6c 6c out the db will
2650: 20 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 20 63 be opened and c
2660: 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 20 63 losed on every c
2670: 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 65 73 all runs:run-tes
2680: 74 73 2d 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 ts-queue. ;;
2690: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
26a0: 65 21 20 64 62 29 20 0a 20 20 20 20 3b 3b 20 6e e! db) . ;; n
26b0: 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 ow add non-direc
26c0: 74 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 tly referenced d
26d0: 65 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 ependencies (i.e
26e0: 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 28 69 . waiton). (i
26f0: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 f (not (null? te
2700: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 st-names))..(let
2710: 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 loop ((hed (car
2720: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 test-names))...
2730: 20 20 20 28 74 61 6c 20 28 63 64 72 20 74 65 73 (tal (cdr tes
2740: 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20 20 t-names)))
2750: 20 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 ;; 'return-pr
2760: 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63 6f ocs tells the co
2770: 6e 66 69 67 20 72 65 61 64 65 72 20 74 6f 20 70 nfig reader to p
2780: 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 rep running syst
2790: 65 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61 20 em but return a
27a0: 70 72 6f 63 0a 09 20 20 28 64 65 62 75 67 3a 70 proc.. (debug:p
27b0: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 68 65 rint 4 "INFO: he
27c0: 64 3d 22 20 68 65 64 20 22 20 61 74 20 74 6f 70 d=" hed " at top
27d0: 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20 28 6c of loop").. (l
27e0: 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 74 et* ((config (t
27f0: 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e ests:get-testcon
2800: 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d fig hed 'return-
2810: 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74 procs))... (wait
2820: 6f 6e 73 20 28 69 66 20 63 6f 6e 66 69 67 20 28 ons (if config (
2830: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 6c 65 string-split (le
2840: 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c 6f t ((w (config-lo
2850: 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 okup config "req
2860: 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69 74 uirements" "wait
2870: 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20 20 20 on"))).......
2880: 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29 0a (if w w ""))).
2890: 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a ... (begin.
28a0: 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ....(debug:print
28b0: 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e 2d 65 0 "ERROR: non-e
28c0: 78 69 73 74 65 6e 74 20 72 65 71 75 69 72 65 64 xistent required
28d0: 20 74 65 73 74 20 5c 22 22 20 68 65 64 20 22 5c test \"" hed "\
28e0: 22 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 "").
28f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2900: 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c 69 (if db (sqli
2910: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 te3:finalize! db
2920: 29 29 0a 09 09 09 09 28 65 78 69 74 20 31 29 29 )).....(exit 1))
2930: 29 29 29 0a 09 20 20 20 20 3b 3b 20 63 68 65 63 ))).. ;; chec
2940: 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69 k for hed in wai
2950: 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75 tons => this wou
2960: 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20 ld be circular,
2970: 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73 remove it and is
2980: 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65 sue an.. ;; e
2990: 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d rror.. (if (m
29a0: 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e ember hed waiton
29b0: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 s)...(begin...
29c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
29d0: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65 ERROR: test " he
29e0: 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 d " has listed i
29f0: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f tself as a waito
2a00: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 n, please correc
2a10: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 t this!")... (s
2a20: 65 74 21 20 77 61 69 74 6f 6e 73 20 28 66 69 6c et! waitons (fil
2a30: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 ter (lambda (x)(
2a40: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 not (equal? x he
2a50: 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 d))) waitons))))
2a60: 0a 09 20 20 20 20 0a 09 20 20 20 20 3b 3b 20 28 .. .. ;; (
2a70: 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 items (items:g
2a80: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
2a90: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 nfig config)))..
2aa0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 (if (not (ha
2ab0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
2ac0: 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 64 ault test-record
2ad0: 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 61 s hed #f))...(ha
2ae0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 sh-table-set! te
2af0: 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 20 st-records.....
2b00: 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 64 20 hed (vector hed
2b10: 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 ;; 0......
2b20: 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a config ;; 1.
2b30: 09 09 09 09 09 20 20 20 20 20 77 61 69 74 6f 6e ..... waiton
2b40: 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 20 s ;; 2......
2b50: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
2b60: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d config "requirem
2b70: 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 22 ents" "priority"
2b80: 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 ) ;; priorit
2b90: 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 28 6c y 3...... (l
2ba0: 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 20 20 et ((items
2bb0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
2bc0: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 default config "
2bd0: 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 items" #f)) ;; i
2be0: 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20 20 tems 4.......
2bf0: 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61 73 (itemstable (has
2c00: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
2c10: 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d ult config "item
2c20: 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a 09 stable" #f))) ..
2c30: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 .... ;; if
2c40: 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f 72 either items or
2c50: 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73 20 items table is
2c60: 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69 74 a proc return it
2c70: 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 so test running
2c80: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 ...... ;;
2c90: 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 process can know
2ca0: 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 to call items:g
2cb0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
2cc0: 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 20 20 nfig......
2cd0: 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 73 ;; if either is
2ce0: 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 a list and none
2cf0: 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61 68 is a proc go ah
2d00: 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 ead and call get
2d10: 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20 20 -items......
2d20: 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 ;; otherwise
2d30: 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69 73 return #f - this
2d40: 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 is not an itera
2d50: 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 20 20 ted test......
2d60: 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 (cond......
2d70: 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 .((procedure? it
2d80: 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09 09 ems) ......
2d90: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
2da0: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73 "INFO: items is
2db0: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 a procedure, wi
2dc0: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a ll calc later").
2dd0: 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 20 20 ...... items)
2de0: 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 ;; calc
2df0: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 70 later.......((p
2e00: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 74 rocedure? itemst
2e10: 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 64 65 able)....... (de
2e20: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
2e30: 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 69 73 O: itemstable is
2e40: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 a procedure, wi
2e50: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a ll calc later").
2e60: 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62 6c ...... itemstabl
2e70: 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 e) ;; calc
2e80: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 66 later.......((f
2e90: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 ilter (lambda (x
2ea0: 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65 74 )........ (let
2eb0: 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29 29 ((val (car x)))
2ec0: 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69 66 ........ (if
2ed0: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61 6c (procedure? val
2ee0: 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09 09 ) val #f))).....
2ef0: 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66 20 ... (append (if
2f00: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 (list? items) it
2f10: 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09 09 ems '())........
2f20: 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 . (if (list? ite
2f30: 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74 61 mstable) itemsta
2f40: 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09 09 ble '())))......
2f50: 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 . 'have-procedur
2f60: 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28 6c e).......((or (l
2f70: 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 ist? items)(list
2f80: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 3b ? itemstable)) ;
2f90: 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 ; calc now......
2fa0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
2fb0: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e "INFO: items an
2fc0: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65 d itemstable are
2fd0: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 lists, calc now
2fe0: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20 \n"........
2ff0: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69 " items: " i
3000: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c tems " itemstabl
3010: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29 e: " itemstable)
3020: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67 ....... (items:g
3030: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
3040: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 nfig config))...
3050: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20 ....(else #f)))
3060: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3070: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 ;; not
3080: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20 iterated......
3090: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69 #f ;; i
30a0: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20 temsdat 5......
30b0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73 #f ;; s
30c0: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20 pare - used for
30d0: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20 item-path......
30e0: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f ))).. (fo
30f0: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c r-each .. (l
3100: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 ambda (waiton)..
3110: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 (if (and
3120: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d waiton (not (mem
3130: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d ber waiton test-
3140: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62 names)))... (b
3150: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74 egin... (set
3160: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 ! required-tests
3170: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 (cons waiton re
3180: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 quired-tests))..
3190: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 . (set! test
31a0: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 -names (cons wai
31b0: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 ton test-names))
31c0: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 ))) ;; was an ap
31d0: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 pend, now a cons
31e0: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a .. waitons).
31f0: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 . (let ((remt
3200: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70 ests (delete-dup
3210: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20 licates (append
3220: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a waitons tal)))).
3230: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 . (if (not
3240: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 (null? remtests)
3250: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 )... (loop (car
3260: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72 remtests)(cdr r
3270: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a emtests)))))))..
3280: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
3290: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73 ll? required-tes
32a0: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 ts))..(debug:pri
32b0: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 nt 1 "INFO: Addi
32c0: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 ng " required-te
32d0: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e sts " to the run
32e0: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b queue")). ;;
32f0: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 NOTE: these are
3300: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 all parent test
3310: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 s, items are not
3320: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 expanded yet..
3330: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
3340: 34 20 22 49 4e 46 4f 3a 20 74 65 73 74 2d 72 65 4 "INFO: test-re
3350: 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d 74 61 cords=" (hash-ta
3360: 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d ble->alist test-
3370: 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 28 72 records)). (r
3380: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 uns:run-tests-qu
3390: 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 eue run-id runna
33a0: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 me test-records
33b0: 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 29 keyvallst flags)
33c0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
33d0: 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 64 t 4 "INFO: All d
33e0: 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29 29 0a one by here"))).
33f0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 .(define (runs:c
3400: 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 alc-fails prereq
3410: 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 s-not-met). (fi
3420: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74 65 lter (lambda (te
3430: 73 74 29 0a 09 20 20 20 20 28 61 6e 64 20 28 76 st).. (and (v
3440: 65 63 74 6f 72 3f 20 74 65 73 74 29 20 3b 3b 20 ector? test) ;;
3450: 6e 6f 74 20 28 73 74 72 69 6e 67 3f 20 74 65 73 not (string? tes
3460: 74 29 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 28 t))... (equal? (
3470: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 db:test-get-stat
3480: 65 20 74 65 73 74 29 20 22 43 4f 4d 50 4c 45 54 e test) "COMPLET
3490: 45 44 22 29 0a 09 09 20 28 6e 6f 74 20 28 6d 65 ED")... (not (me
34a0: 6d 62 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 mber (db:test-ge
34b0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 t-status test)..
34c0: 09 09 20 20 20 20 20 20 27 28 22 50 41 53 53 22 .. '("PASS"
34d0: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 "WARN" "CHECK"
34e0: 22 57 41 49 56 45 44 22 29 29 29 29 29 0a 09 20 "WAIVED")))))..
34f0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
3500: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e ))..(define (run
3510: 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c s:calc-not-compl
3520: 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 eted prereqs-not
3530: 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 0a -met). (filter.
3540: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 20 (lambda (t).
3550: 20 20 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 (or (not (ve
3560: 63 74 6f 72 3f 20 74 29 29 0a 09 20 28 6e 6f 74 ctor? t)).. (not
3570: 20 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 (equal? "COMPLE
3580: 54 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67 65 TED" (db:test-ge
3590: 74 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a 20 t-state t))))).
35a0: 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 prereqs-not-me
35b0: 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 t))..(define (ru
35c0: 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 ns:pretty-string
35d0: 20 6c 73 74 29 0a 20 20 28 6d 61 70 20 28 6c 61 lst). (map (la
35e0: 6d 62 64 61 20 28 74 29 0a 09 20 28 69 66 20 28 mbda (t).. (if (
35f0: 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 not (vector? t))
3600: 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 74 29 0a .. (conc t).
3610: 09 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a . (conc (db:
3620: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
3630: 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 e t) ":" (db:tes
3640: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 t-get-state t) "
3650: 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d /" (db:test-get-
3660: 73 74 61 74 75 73 20 74 29 29 29 29 0a 20 20 20 status t)))).
3670: 20 20 20 20 6c 73 74 29 29 0a 0a 28 64 65 66 69 lst))..(defi
3680: 6e 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 ne (runs:make-fu
3690: 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 ll-test-name tes
36a0: 74 6e 61 6d 65 20 69 74 65 6d 70 61 74 68 29 0a tname itempath).
36b0: 20 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 (if (equal? it
36c0: 65 6d 70 61 74 68 20 22 22 29 20 74 65 73 74 6e empath "") testn
36d0: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 ame (conc testna
36e0: 6d 65 20 22 2f 22 20 69 74 65 6d 70 61 74 68 29 me "/" itempath)
36f0: 29 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f ))..;; test-reco
3700: 72 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 rds is a hash ta
3710: 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 ble testname:ite
3720: 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 m_path => vector
3730: 20 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 < testname test
3740: 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 config waitons p
3750: 72 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e riority items-in
3760: 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 fo ... >.(define
3770: 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 (runs:run-tests
3780: 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 -queue run-id ru
3790: 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 nname test-recor
37a0: 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 ds keyvallst fla
37b0: 67 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 gs). ;; At th
37c0: 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 is point the lis
37d0: 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 t of parent test
37e0: 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 s is expanded .
37f0: 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c ;; NB// Shoul
3800: 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 d expand items h
3810: 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 ere and then ins
3820: 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e ert into the run
3830: 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 queue.. (debug
3840: 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 :print 5 "test-r
3850: 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 ecords: " test-r
3860: 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c ecords ", keyval
3870: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 lst: " keyvallst
3880: 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 " flags: " (has
3890: 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 h-table->alist f
38a0: 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 lags)). (let ((
38b0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 sorted-test-name
38c0: 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 s (tests:sort-by
38d0: 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 -priority-and-wa
38e0: 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 iton test-record
38f0: 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74 73 s))..(item-patts
3900: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 (hash-ta
3910: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
3920: 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74 74 flags "-itempatt
3930: 22 20 23 66 29 29 0a 09 28 74 65 73 74 2d 72 65 " #f))..(test-re
3940: 67 69 73 74 65 72 79 20 20 20 20 28 6d 61 6b 65 gistery (make
3950: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 28 -hash-table))..(
3960: 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20 20 num-retries
3970: 20 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 0)..(max-retr
3980: 69 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66 69 ies (confi
3990: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
39a0: 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 dat* "setup" "ma
39b0: 78 72 65 74 72 69 65 73 22 29 29 29 0a 20 20 20 xretries"))).
39c0: 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72 69 (set! max-retri
39d0: 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78 2d es (if (and max-
39e0: 72 65 74 72 69 65 73 20 28 73 74 72 69 6e 67 2d retries (string-
39f0: 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 >number max-retr
3a00: 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e 75 ies))(string->nu
3a10: 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 mber max-retries
3a20: 29 20 31 30 30 29 29 0a 20 20 20 20 28 69 66 20 ) 100)). (if
3a30: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 (not (null? sort
3a40: 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a ed-test-names)).
3a50: 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 .(let loop ((hed
3a60: 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73 6f (car so
3a70: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 rted-test-names)
3a80: 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 20 )... (tal
3a90: 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d (cdr sorted-
3aa0: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 test-names))...
3ab0: 20 20 28 72 65 72 75 6e 73 20 20 20 20 20 20 27 (reruns '
3ac0: 28 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f 74 ())).. (if (not
3ad0: 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 (null? reruns))
3ae0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
3af0: 49 4e 46 4f 3a 20 72 65 72 75 6e 73 3d 22 20 72 INFO: reruns=" r
3b00: 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28 70 eruns)).. ;; (p
3b10: 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f 6f rint "Top of loo
3b20: 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22 2c 20 p, hed=" hed ",
3b30: 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65 72 tal=" tal " ,rer
3b40: 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a 09 20 uns=" reruns)..
3b50: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65 (let* ((test-re
3b60: 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65 cord (hash-table
3b70: 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64 -ref test-record
3b80: 73 20 68 65 64 29 29 0a 09 09 20 28 74 65 73 74 s hed))... (test
3b90: 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73 3a 74 -name (tests:t
3ba0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 estqueue-get-tes
3bb0: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 tname test-recor
3bc0: 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 d))... (tconfig
3bd0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
3be0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e ueue-get-testcon
3bf0: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 fig test-record)
3c00: 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20 )... (testmode
3c10: 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 (let ((m (conf
3c20: 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 ig-lookup tconfi
3c30: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 g "requirements"
3c40: 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28 "mode"))).....(
3c50: 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 if m (string->sy
3c60: 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 mbol m) 'normal)
3c70: 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20 ))... (waitons
3c80: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
3c90: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 eue-get-waitons
3ca0: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
3cb0: 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20 20 20 ... (priority
3cc0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
3cd0: 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20 e-get-priority
3ce0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
3cf0: 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 . (itemdat (
3d00: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
3d10: 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 get-itemdat t
3d20: 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 est-record)) ;;
3d30: 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61 itemdat can be a
3d40: 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 string, list or
3d50: 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20 #f... (items
3d60: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
3d70: 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 ueue-get-items
3d80: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 test-record)
3d90: 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20 )... (item-path
3da0: 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 (item-list->pa
3db0: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20 th itemdat))...
3dc0: 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28 61 70 (newtal (ap
3dd0: 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 pend tal (list h
3de0: 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20 ed)))).. ..
3df0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 (debug:print 6
3e00: 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 3a .... "test-name:
3e10: 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 09 " test-name....
3e20: 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20 "\n hed:
3e30: 20 20 20 22 20 68 65 64 0a 09 09 09 20 22 5c 6e " hed.... "\n
3e40: 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 itemdat: "
3e50: 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e itemdat.... "\n
3e60: 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20 22 items: "
3e70: 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 items.... "\n
3e80: 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22 20 69 item-path: " i
3e90: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e tem-path.... "\n
3ea0: 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20 20 22 waitons: "
3eb0: 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c 6e waitons.... "\n
3ec0: 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 22 num-retries: "
3ed0: 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 num-retries....
3ee0: 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20 20 "\n tal:
3ef0: 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22 5c 6e " tal.... "\n
3f00: 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 22 reruns: "
3f10: 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20 20 3b reruns)... ;
3f20: 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20 ; check for hed
3f30: 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 in waitons => th
3f40: 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63 is would be circ
3f50: 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 ular, remove it
3f60: 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20 and issue an..
3f70: 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 ;; error..
3f80: 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65 73 74 (if (member test
3f90: 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a 09 -name waitons)..
3fa0: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 .(begin... (deb
3fb0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
3fc0: 52 3a 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e R: test " test-n
3fd0: 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74 65 64 ame " has listed
3fe0: 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 itself as a wai
3ff0: 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 ton, please corr
4000: 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 ect this!")...
4010: 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69 (set! waiton (fi
4020: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 lter (lambda (x)
4030: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 (not (equal? x h
4040: 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 ed))) waitons)))
4050: 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b 3b )... (cond ;;
4060: 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20 20 20 OUTER COND..
4070: 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b ((not items) ;
4080: 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 ; when false the
4090: 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 test is ok to b
40a0: 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 e handed off to
40b0: 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 launch (but not
40c0: 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28 before).. (
40d0: 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 74 let* ((run-limit
40e0: 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20 20 28 s-info (
40f0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 open-run-close r
4100: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
4110: 2d 74 65 73 74 73 20 23 66 20 74 65 73 74 2d 72 -tests #f test-r
4120: 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 ecord)) ;; look
4130: 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67 at the test jobg
4140: 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 roup and tot job
4150: 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 s running...
4160: 20 28 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 (have-resources
4170: 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 72 (car r
4180: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 29 un-limits-info))
4190: 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e ... (num-run
41a0: 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 ning
41b0: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c (list-ref run-l
41c0: 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29 0a 09 imits-info 1))..
41d0: 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 . (num-runni
41e0: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 ng-in-jobgroup (
41f0: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d list-ref run-lim
4200: 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09 09 20 its-info 2))...
4210: 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 (max-concurr
4220: 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c 69 ent-jobs (li
4230: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 st-ref run-limit
4240: 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20 20 20 s-info 3))...
4250: 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d (job-group-lim
4260: 69 74 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 it (list
4270: 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d -ref run-limits-
4280: 69 6e 66 6f 20 34 29 29 0a 09 09 20 20 20 20 20 info 4))...
4290: 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 (prereqs-not-met
42a0: 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 (open-r
42b0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
42c0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 prereqs-not-met
42d0: 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e #f run-id waiton
42e0: 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 s item-path mode
42f0: 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 : testmode))...
4300: 20 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 (fails
4310: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 75 (ru
4320: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 ns:calc-fails pr
4330: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a ereqs-not-met)).
4340: 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 .. (non-comp
4350: 6c 65 74 65 64 20 20 20 20 20 20 20 20 20 20 20 leted
4360: 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 (runs:calc-not-c
4370: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 ompleted prereqs
4380: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 64 -not-met)))...(d
4390: 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49 4e ebug:print 8 "IN
43a0: 46 4f 3a 20 68 61 76 65 2d 72 65 73 6f 75 72 63 FO: have-resourc
43b0: 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f 75 es: " have-resou
43c0: 72 63 65 73 20 22 20 70 72 65 72 65 71 73 2d 6e rces " prereqs-n
43d0: 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20 20 ot-met: " ....
43e0: 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 (string-inter
43f0: 73 70 65 72 73 65 20 0a 09 09 09 20 20 20 20 20 sperse ....
4400: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 (map (lambda (t
4410: 29 0a 09 09 09 09 20 20 20 20 20 28 69 66 20 28 )..... (if (
4420: 76 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09 09 vector? t)......
4430: 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d (conc (db:test-
4440: 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 get-state t) "/"
4450: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
4460: 61 74 75 73 20 74 29 29 0a 09 09 09 09 09 20 28 atus t))...... (
4470: 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 conc " WARNING:
4480: 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f t is not a vecto
4490: 72 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20 20 r=" t ))).....
44a0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
44b0: 29 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a ) ", ") " fails:
44c0: 20 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65 62 " fails)...(deb
44d0: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f ug:print 4 "INFO
44e0: 3a 20 68 65 64 3d 22 20 68 65 64 29 0a 0a 09 09 : hed=" hed)....
44f0: 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 ;; Don't know at
4500: 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 68 this time if th
4510: 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65 6e e test have been
4520: 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d launched at som
4530: 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61 e time in the pa
4540: 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20 st...;; i.e. is
4550: 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 this a re-launch
4560: 3f 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ?...(debug:print
4570: 20 34 20 22 49 4e 46 4f 3a 20 72 75 6e 2d 6c 69 4 "INFO: run-li
4580: 6d 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20 72 75 mits-info = " ru
4590: 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 0a 09 n-limits-info)..
45a0: 09 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 .(cond ;; INNER
45b0: 43 4f 4e 44 20 23 31 20 66 6f 72 20 61 20 6c 61 COND #1 for a la
45c0: 75 6e 63 68 61 62 6c 65 20 74 65 73 74 0a 09 09 unchable test...
45d0: 20 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d 20 70 ;; Check item p
45e0: 61 74 68 20 61 67 61 69 6e 73 74 20 69 74 65 6d ath against item
45f0: 2d 70 61 74 74 73 0a 09 09 20 28 28 61 6e 64 20 -patts... ((and
4600: 28 6e 6f 74 20 28 70 61 74 74 2d 6c 69 73 74 2d (not (patt-list-
4610: 6d 61 74 63 68 20 69 74 65 6d 2d 70 61 74 68 20 match item-path
4620: 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09 09 20 item-patts))...
4630: 20 20 20 20 20 20 28 6e 6f 74 20 28 65 71 75 61 (not (equa
4640: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 l? item-path "")
4650: 29 29 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 ))... ;; else t
4660: 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c he run is stuck,
4670: 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 temporarily or
4680: 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 permanently...
4690: 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 ;; but should ch
46a0: 65 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 eck if it is due
46b0: 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f to lack of reso
46c0: 75 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 urces vs. prereq
46d0: 75 69 73 69 74 65 73 0a 09 09 20 20 28 64 65 62 uisites... (deb
46e0: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f ug:print 1 "INFO
46f0: 3a 20 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 : Skipping " (te
4700: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
4710: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d t-testname test-
4720: 72 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d record) " " item
4730: 2d 70 61 74 68 20 22 20 61 73 20 69 74 20 64 6f -path " as it do
4740: 65 73 6e 27 74 20 6d 61 74 63 68 20 22 20 69 74 esn't match " it
4750: 65 6d 2d 70 61 74 74 73 29 0a 09 09 20 20 28 74 em-patts)... (t
4760: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c hread-sleep! *gl
4770: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 obal-delta*)...
4780: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
4790: 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28 tal))... (
47a0: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 loop (car tal)(c
47b0: 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 dr tal) reruns))
47c0: 29 0a 09 09 20 28 28 61 6e 64 20 28 6e 6f 74 20 )... ((and (not
47d0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
47e0: 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 67 default test-reg
47f0: 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b istery (runs:mak
4800: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 e-full-test-name
4810: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
4820: 70 61 74 68 29 20 23 66 29 29 0a 09 09 20 20 20 path) #f))...
4830: 20 20 20 20 28 61 6e 64 20 6d 61 78 2d 63 6f 6e (and max-con
4840: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e 20 current-jobs (>
4850: 28 2d 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e (- max-concurren
4860: 74 2d 6a 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e 69 t-jobs num-runni
4870: 6e 67 29 20 35 29 29 29 0a 09 09 20 20 28 6f 70 ng) 5)))... (op
4880: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
4890: 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 tests-register-t
48a0: 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 74 65 est #f run-id te
48b0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
48c0: 68 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61 62 h)... (hash-tab
48d0: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 le-set! test-reg
48e0: 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b istery (runs:mak
48f0: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 e-full-test-name
4900: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
4910: 70 61 74 68 29 20 23 74 29 0a 09 09 20 20 28 74 path) #t)... (t
4920: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c hread-sleep! *gl
4930: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 obal-delta*)...
4940: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 (loop (car newt
4950: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 al)(cdr newtal)
4960: 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f reruns))... ((no
4970: 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 t have-resources
4980: 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 ) ;; simply try
4990: 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74 again after wait
49a0: 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 ing a second...
49b0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 (thread-sleep!
49c0: 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c (+ 1 *global-del
49d0: 74 61 2a 29 29 0a 09 09 20 20 28 64 65 62 75 67 ta*))... (debug
49e0: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 :print 1 "INFO:
49f0: 6e 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 no resources to
4a00: 72 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 run new tests, w
4a10: 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 aiting ...")...
4a20: 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 ;; could have d
4a30: 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 one hed tal here
4a40: 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 but doing car/c
4a50: 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 dr of newtal to
4a60: 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 rotate tests...
4a70: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 (loop (car newt
4a80: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 al)(cdr newtal)
4a90: 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61 6e reruns))... ((an
4aa0: 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 d have-resources
4ab0: 0a 09 09 20 20 20 20 20 20 20 28 6f 72 20 28 6e ... (or (n
4ac0: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 ull? prereqs-not
4ad0: 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e 64 -met).... (and
4ae0: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 (eq? testmode '
4af0: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e toplevel).....(n
4b00: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 ull? non-complet
4b10: 65 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e 3a ed))))... (run:
4b20: 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e test run-id runn
4b30: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 ame keyvallst te
4b40: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 st-record flags
4b50: 23 66 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d #f)... (thread-
4b60: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 sleep! *global-d
4b70: 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20 28 elta*)... (if (
4b80: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 not (null? tal))
4b90: 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 ... (loop (
4ba0: 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c car tal)(cdr tal
4bb0: 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 28 ) reruns)))... (
4bc0: 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 else ;; must be
4bd0: 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70 72 we have unmet pr
4be0: 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 erequisites...
4bf0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
4c00: 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 "FAILS: " fails
4c10: 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e )... ;; If on
4c20: 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 e or more of the
4c30: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
4c40: 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20 77 are FAIL then w
4c50: 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20 20 e can issue...
4c60: 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 61 ;; a message a
4c70: 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f 6d nd drop hed from
4c80: 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62 65 the items to be
4c90: 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 processed....
4ca0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 (if (null? fai
4cb0: 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 ls)....(begin...
4cc0: 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 . ;; couldn't r
4cd0: 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 un, take a breat
4ce0: 68 65 72 0a 09 09 09 20 20 28 64 65 62 75 67 3a her.... (debug:
4cf0: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 53 print 4 "INFO: S
4d00: 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20 houldn't really
4d10: 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 20 63 get here, race c
4d20: 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 ondition? Unable
4d30: 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20 to launch more
4d40: 74 65 73 74 73 20 61 74 20 74 68 69 73 20 6d 6f tests at this mo
4d50: 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 ment, killing ti
4d60: 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 28 74 me ...").... (t
4d70: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 hread-sleep! (+
4d80: 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 1 *global-delta*
4d90: 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 )) ;; long sleep
4da0: 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 here - no resou
4db0: 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c rces, may as wel
4dc0: 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 l be patient....
4dd0: 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 ;; we made new
4de0: 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 tal by sticking
4df0: 20 68 65 64 20 61 74 20 74 68 65 20 62 61 63 6b hed at the back
4e00: 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 of the list....
4e10: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 (loop (car new
4e20: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 tal)(cdr newtal)
4e30: 20 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 reruns))....;;
4e40: 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 the waiton is FA
4e50: 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 IL so no point i
4e60: 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 n trying to run
4e70: 68 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 hed ever again..
4e80: 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c ..(if (not (null
4e90: 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 ? tal)).... (
4ea0: 69 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 if (vector? hed)
4eb0: 0a 09 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 .....(begin (deb
4ec0: 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e ug:print 1 "WARN
4ed0: 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 : Dropping test
4ee0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 " (db:test-get-t
4ef0: 65 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 estname hed) "/"
4f00: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
4f10: 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 em-path hed)....
4f20: 09 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 ... " from th
4f30: 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 e launch list as
4f40: 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 it has prerequi
4f50: 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 stes that are FA
4f60: 49 4c 22 29 0a 09 09 09 09 20 20 20 20 20 20 20 IL").....
4f70: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a (thread-sleep! *
4f80: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 global-delta*)..
4f90: 09 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 ... (loop
4fa0: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 (car tal)(cdr ta
4fb0: 6c 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65 72 l) (cons hed rer
4fc0: 75 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67 69 uns))).....(begi
4fd0: 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 n..... (debug:p
4fe0: 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54 65 rint 1 "WARN: Te
4ff0: 73 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65 64 st not processed
5000: 20 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75 6c correctly. Coul
5010: 64 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e 64 d be a race cond
5020: 69 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74 65 ition in your te
5030: 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f st implementatio
5040: 6e 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22 20 n? " hed) ;; "
5050: 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 as it has prereq
5060: 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 uistes that are
5070: 46 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65 64 FAIL. (NOTE: hed
5080: 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 is not a vector
5090: 29 22 29 0a 09 09 09 09 20 20 28 74 68 72 65 61 )")..... (threa
50a0: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c d-sleep! *global
50b0: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 -delta*)..... (
50c0: 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 loop hed tal rer
50d0: 75 6e 73 29 29 29 29 29 29 29 29 29 20 3b 3b 20 uns))))))))) ;;
50e0: 45 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f 4e END OF INNER CON
50f0: 44 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b D.. .. ;
5100: 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 ; case where an
5110: 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 items came in as
5120: 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f a list been pro
5130: 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61 cessed.. ((a
5140: 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 nd (list? items)
5150: 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 ;; thus we
5160: 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 know our items a
5170: 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 re already calcu
5180: 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 lated... (not
5190: 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 itemdat)) ;; a
51a0: 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e nd not yet expan
51b0: 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 ded into the lis
51c0: 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 t of things to b
51d0: 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 e done.. (i
51e0: 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62 f (and (>= *verb
51f0: 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 osity* 1)...
5200: 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 (> (length it
5210: 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 ems) 0)...
5220: 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 (> (length (car
5230: 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 items)) 0))...
5240: 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 (pp items))..
5250: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 (for-each..
5260: 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d (lambda (m
5270: 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c y-itemdat)... (l
5280: 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 et* ((new-test-r
5290: 65 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 ecord (let ((new
52a0: 72 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a rec (make-tests:
52b0: 74 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 testqueue)))....
52c0: 09 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 .. (vector-cop
52d0: 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e y! test-record n
52e0: 65 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e ewrec)...... n
52f0: 65 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 ewrec))....(my-i
5300: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c tem-path (item-l
5310: 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 ist->path my-ite
5320: 6d 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 mdat)))... (if
5330: 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 (patt-list-matc
5340: 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 h my-item-path i
5350: 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 tem-patts)
5360: 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 ;; yes, we
5370: 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 want to process
5380: 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a this item, NOTE:
5390: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 Should not need
53a0: 20 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 this check here
53b0: 21 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 !... (let
53c0: 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 72 ((newtestname (r
53d0: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 uns:make-full-te
53e0: 73 74 2d 6e 61 6d 65 20 68 65 64 20 6d 79 2d 69 st-name hed my-i
53f0: 74 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b tem-path))) ;
5400: 3b 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 ; test names are
5410: 20 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e unique on testn
5420: 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 ame/item-path...
5430: 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 . (tests:testque
5440: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 ue-set-items!
5450: 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 new-test-recor
5460: 64 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 d #f).... (tests
5470: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 :testqueue-set-i
5480: 74 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 temdat! new-te
5490: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 st-record my-ite
54a0: 6d 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 mdat).... (tests
54b0: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 :testqueue-set-i
54c0: 74 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 tem_path! new-te
54d0: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 st-record my-ite
54e0: 6d 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 m-path).... (has
54f0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 h-table-set! tes
5500: 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 t-records newtes
5510: 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 tname new-test-r
5520: 65 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 ecord).... (set!
5530: 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 tal (cons newte
5540: 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 stname tal))))))
5550: 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 ;; since these
5560: 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 are itemized cre
5570: 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d ate new test nam
5580: 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d es testname/item
5590: 70 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 path.. ite
55a0: 6d 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ms).. (if (
55b0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 not (null? tal))
55c0: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 ... (begin...
55d0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 (thread-sleep!
55e0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 *global-delta*)
55f0: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
5600: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 45 6e 64 int 4 "INFO: End
5610: 20 6f 66 20 69 74 65 6d 73 20 6c 69 73 74 2c 20 of items list,
5620: 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20 6e 65 78 looping with nex
5630: 74 22 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 t")... (loop
5640: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 (car tal)(cdr ta
5650: 6c 29 20 72 65 72 75 6e 73 29 29 29 29 0a 0a 09 l) reruns))))...
5660: 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 ;; if items
5670: 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 is a proc then
5680: 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d need to run item
5690: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d s:get-items-from
56a0: 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 -config, get the
56b0: 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a list and loop .
56c0: 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75 . ;; - bu
56d0: 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 t only do that i
56e0: 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 73 f resources exis
56f0: 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 t to kick off th
5700: 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72 e job.. ((or
5710: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 (procedure? ite
5720: 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 ms)(eq? items 'h
5730: 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a ave-procedure)).
5740: 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 61 . (let ((ca
5750: 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28 6f n-run-more (o
5760: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 pen-run-close ru
5770: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
5780: 74 65 73 74 73 20 23 66 20 74 65 73 74 2d 72 65 tests #f test-re
5790: 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20 63 61 cord)))...(if ca
57a0: 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 20 20 20 n-run-more...
57b0: 20 28 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73 (let* ((prereqs
57c0: 2d 6e 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 -not-met (open-r
57d0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
57e0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 prereqs-not-met
57f0: 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e #f run-id waiton
5800: 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 s item-path mode
5810: 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 09 : testmode))....
5820: 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 (fails
5830: 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 (runs:calc-f
5840: 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 ails prereqs-not
5850: 2d 6d 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f -met)).... (no
5860: 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 72 n-completed (r
5870: 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d uns:calc-not-com
5880: 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e pleted prereqs-n
5890: 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 20 20 20 ot-met)))...
58a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 (debug:print 8
58b0: 20 22 49 4e 46 4f 3a 20 63 61 6e 2d 72 75 6e 2d "INFO: can-run-
58c0: 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d more: " can-run-
58d0: 6d 6f 72 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 more..... "\n
58e0: 74 65 73 74 6e 61 6d 65 3a 20 20 20 20 20 20 20 testname:
58f0: 20 22 20 68 65 64 0a 09 09 09 09 20 20 20 22 5c " hed..... "\
5900: 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 n prereqs-not-me
5910: 74 3a 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74 t: " (runs:prett
5920: 79 2d 73 74 72 69 6e 67 20 70 72 65 72 65 71 73 y-string prereqs
5930: 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 -not-met).....
5940: 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 "\n non-complet
5950: 65 64 3a 20 20 20 22 20 28 72 75 6e 73 3a 70 72 ed: " (runs:pr
5960: 65 74 74 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d etty-string non-
5970: 63 6f 6d 70 6c 65 74 65 64 29 20 0a 09 09 09 09 completed) .....
5980: 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 "\n fails:
5990: 20 20 20 20 20 20 20 20 22 20 28 72 75 6e 73 3a " (runs:
59a0: 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 66 61 pretty-string fa
59b0: 69 6c 73 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 ils)..... "\n
59c0: 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 testmode:
59d0: 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 09 " testmode.....
59e0: 20 20 20 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 "\n num-retri
59f0: 65 73 3a 20 20 20 20 20 22 20 6e 75 6d 2d 72 65 es: " num-re
5a00: 74 72 69 65 73 0a 09 09 09 09 20 20 20 22 5c 6e tries..... "\n
5a10: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 (eq? testmode '
5a20: 74 6f 70 6c 65 76 65 6c 29 3a 20 22 20 28 65 71 toplevel): " (eq
5a30: 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c ? testmode 'topl
5a40: 65 76 65 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e evel)..... "\n
5a50: 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 (null? non-comp
5a60: 6c 65 74 65 64 29 3a 20 20 20 20 22 20 28 6e 75 leted): " (nu
5a70: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 ll? non-complete
5a80: 64 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 72 65 d)..... "\n re
5a90: 72 75 6e 73 3a 20 22 20 72 65 72 75 6e 73 29 0a runs: " reruns).
5aa0: 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 3b ... (cond ;
5ab0: 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32 0a ; INNER COND #2.
5ac0: 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e .. ((or (n
5ad0: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 ull? prereqs-not
5ae0: 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 -met) ;; all pre
5af0: 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f reqs met, fire o
5b00: 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 20 ff the test....
5b10: 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 ;; or, if it
5b20: 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 is a 'toplevel t
5b30: 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 est and all prer
5b40: 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 eqs not met are
5b50: 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c COMPLETED then l
5b60: 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e aunch.... (an
5b70: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 d (eq? testmode
5b80: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 'toplevel).....
5b90: 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c (null? non-compl
5ba0: 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20 eted)))....(let
5bb0: 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 ((test-name (tes
5bc0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
5bd0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 -testname test-r
5be0: 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73 ecord))).... (s
5bf0: 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e etenv "MT_TEST_N
5c00: 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 AME" test-name)
5c10: 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76 ;; .... (setenv
5c20: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 "MT_RUNNAME"
5c30: 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 6f runname).... (o
5c40: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 pen-run-close se
5c50: 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 t-megatest-env-v
5c60: 61 72 73 20 23 66 20 72 75 6e 2d 69 64 29 20 3b ars #f run-id) ;
5c70: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e ; these may be n
5c80: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 eeded by the lau
5c90: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 nching process..
5ca0: 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 .. (let ((items
5cb0: 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 -list (items:get
5cc0: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 -items-from-conf
5cd0: 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 ig tconfig)))...
5ce0: 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 . (if (list?
5cf0: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 items-list).....
5d00: 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 (begin..... (te
5d10: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 sts:testqueue-se
5d20: 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 t-items! test-re
5d30: 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 cord items-list)
5d40: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 ..... (thread-s
5d50: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 leep! *global-de
5d60: 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f lta*)..... (loo
5d70: 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 p hed tal reruns
5d80: 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 )).....(begin...
5d90: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
5da0: 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 0 "ERROR: The p
5db0: 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 roc from reading
5dc0: 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20 6e the setup did n
5dd0: 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 ot yield a list
5de0: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 - please report
5df0: 74 68 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 this")..... (ex
5e00: 69 74 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 it 1))))))...
5e10: 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c ((null? fail
5e20: 73 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 s)....(debug:pri
5e30: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 66 61 69 6c nt 4 "INFO: fail
5e40: 73 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e s is null, movin
5e50: 67 20 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 75 g on in the queu
5e60: 65 20 62 75 74 20 6b 65 65 70 69 6e 67 20 22 20 e but keeping "
5e70: 68 65 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a hed " for now").
5e80: 09 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 ...(thread-sleep
5e90: 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a ! *global-delta*
5ea0: 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 )....(loop (car
5eb0: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 newtal)(cdr newt
5ec0: 61 6c 29 20 72 65 72 75 6e 73 29 29 20 3b 3b 20 al) reruns)) ;;
5ed0: 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 72 an issue with pr
5ee0: 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65 ereqs not yet me
5ef0: 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e t?... ((an
5f00: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 d (not (null? fa
5f10: 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f ils))(eq? testmo
5f20: 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 de 'normal))....
5f30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
5f40: 49 4e 46 4f 3a 20 74 65 73 74 20 22 20 20 68 65 INFO: test " he
5f50: 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 d " (mode=" test
5f60: 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c mode ") has fail
5f70: 65 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 ed prerequisite(
5f80: 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 s); "..... (
5f90: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
5fa0: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 se (map (lambda
5fb0: 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 (t)(conc (db:tes
5fc0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
5fd0: 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 ) ":" (db:test-g
5fe0: 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 et-state t)"/"(d
5ff0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 b:test-get-statu
6000: 73 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c s t))) fails) ",
6010: 20 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 ")..... ",
6020: 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d removing it from
6030: 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 to-do list")...
6040: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f .(if (not (null?
6050: 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 tal)).... (b
6060: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 74 egin.... (t
6070: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c hread-sleep! *gl
6080: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 obal-delta*)....
6090: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 (loop (car
60a0: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28 63 tal)(cdr tal)(c
60b0: 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 29 ons hed reruns))
60c0: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 6c )))... (el
60d0: 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 se....(debug:pri
60e0: 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20 nt 8 "ERROR: No
60f0: 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 73 handler for this
6100: 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09 condition.")...
6110: 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 .(thread-sleep!
6120: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a *global-delta*).
6130: 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 ...(loop (car ne
6140: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c wtal)(cdr newtal
6150: 29 20 72 65 72 75 6e 73 29 29 29 29 20 3b 3b 20 ) reruns)))) ;;
6160: 45 4e 44 20 4f 46 20 49 46 20 43 41 4e 20 52 55 END OF IF CAN RU
6170: 4e 20 4d 4f 52 45 0a 0a 09 09 20 20 20 20 3b 3b N MORE.... ;;
6180: 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f if can't run mo
6190: 72 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 re just loop wit
61a0: 68 20 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20 h next possible
61b0: 74 65 73 74 0a 09 09 20 20 20 20 28 62 65 67 69 test... (begi
61c0: 6e 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 n... (debug
61d0: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 :print 4 "INFO:
61e0: 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 63 processing the c
61f0: 61 73 65 20 77 69 74 68 20 61 20 6c 61 6d 62 64 ase with a lambd
6200: 61 20 66 6f 72 20 69 74 65 6d 73 20 6f 72 20 27 a for items or '
6210: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 2e 20 have-procedure.
6220: 4d 6f 76 69 6e 67 20 74 68 72 6f 75 67 68 20 74 Moving through t
6230: 68 65 20 71 75 65 75 65 20 77 69 74 68 6f 75 74 he queue without
6240: 20 64 72 6f 70 70 69 6e 67 20 22 20 68 65 64 29 dropping " hed)
6250: 0a 09 09 20 20 20 20 20 20 28 74 68 72 65 61 64 ... (thread
6260: 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c -sleep! (+ 1 *gl
6270: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 obal-delta*))...
6280: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 (loop (car
6290: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 newtal)(cdr new
62a0: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 29 tal) reruns)))))
62b0: 20 3b 3b 20 45 4e 44 20 4f 46 20 28 6f 72 20 28 ;; END OF (or (
62c0: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
62d0: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 )(eq? items 'hav
62e0: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 e-procedure))..
62f0: 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 68 .. ;; th
6300: 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e is case should n
6310: 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 ot happen, added
6320: 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 to help catch a
6330: 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 28 ny bugs.. ((
6340: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 and (list? items
6350: 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20 ) itemdat)..
6360: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
6370: 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 "ERROR: Should
6380: 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20 not have a list
6390: 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65 of items in a te
63a0: 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73 st and the items
63b0: 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73 path set - pleas
63c0: 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a e report this").
63d0: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 . (exit 1))
63e0: 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 .. ((not (nu
63f0: 6c 6c 3f 20 72 65 72 75 6e 73 29 29 0a 09 20 20 ll? reruns))..
6400: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 6c (let* ((newl
6410: 73 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f st (open-run-clo
6420: 73 65 20 74 65 73 74 73 3a 66 69 6c 74 65 72 2d se tests:filter-
6430: 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 23 66 20 non-runnable #f
6440: 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 2d run-id tal test-
6450: 72 65 63 6f 72 64 73 29 29 20 3b 3b 20 69 2e 65 records)) ;; i.e
6460: 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 . not FAIL, WAIV
6470: 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 ED, INCOMPLETE,
6480: 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 PASS, KILLED,...
6490: 20 20 20 20 20 28 6a 75 6e 6b 65 64 20 28 6c 73 (junked (ls
64a0: 65 74 2d 64 69 66 66 65 72 65 6e 63 65 20 65 71 et-difference eq
64b0: 75 61 6c 3f 20 74 61 6c 20 6e 65 77 6c 73 74 29 ual? tal newlst)
64c0: 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e ))...(debug:prin
64d0: 74 20 34 20 22 49 4e 46 4f 3a 20 66 75 6c 6c 20 t 4 "INFO: full
64e0: 64 72 6f 70 20 74 68 72 6f 75 67 68 2c 20 69 66 drop through, if
64f0: 20 72 65 72 75 6e 73 20 69 73 20 6c 65 73 73 20 reruns is less
6500: 74 68 61 6e 20 31 30 30 20 77 65 20 77 69 6c 6c than 100 we will
6510: 20 66 6f 72 63 65 20 72 65 74 72 79 20 74 68 65 force retry the
6520: 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 m, reruns=" reru
6530: 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c 29 ns ", tal=" tal)
6540: 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72 65 ...(if (< num-re
6550: 74 72 69 65 73 20 6d 61 78 2d 72 65 74 72 69 65 tries max-retrie
6560: 73 29 0a 09 09 20 20 20 20 28 73 65 74 21 20 6e s)... (set! n
6570: 65 77 6c 73 74 20 28 61 70 70 65 6e 64 20 72 65 ewlst (append re
6580: 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a 09 runs newlst)))..
6590: 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 .(set! num-retri
65a0: 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 es (+ num-retrie
65b0: 73 20 31 29 29 0a 09 09 28 74 68 72 65 61 64 2d s 1))...(thread-
65c0: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 sleep! *global-d
65d0: 65 6c 74 61 2a 29 0a 09 09 28 69 66 20 28 6e 6f elta*)...(if (no
65e0: 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 t (null? newlst)
65f0: 29 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e 63 65 )... ;; since
6600: 20 72 65 72 75 6e 73 20 68 61 76 65 20 62 65 65 reruns have bee
6610: 6e 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20 6e n tacked on to n
6620: 65 77 6c 73 74 20 63 72 65 61 74 65 20 6e 65 77 ewlst create new
6630: 20 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75 6e reruns from jun
6640: 6b 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 ked... (loop
6650: 28 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 (car newlst)(cdr
6660: 20 6e 65 77 6c 73 74 29 28 64 65 6c 65 74 65 2d newlst)(delete-
6670: 64 75 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b 65 duplicates junke
6680: 64 29 29 29 29 29 0a 09 20 20 20 20 20 28 28 6e d))))).. ((n
6690: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a ot (null? tal)).
66a0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
66b0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 49 27 6d int 4 "INFO: I'm
66c0: 20 70 72 65 74 74 79 20 73 75 72 65 20 49 20 73 pretty sure I s
66d0: 68 6f 75 6c 64 6e 27 74 20 67 65 74 20 68 65 72 houldn't get her
66e0: 65 2e 22 29 29 0a 09 20 20 20 20 20 28 65 6c 73 e.")).. (els
66f0: 65 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a e.. (debug:
6700: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 45 print 4 "INFO: E
6710: 78 69 74 69 6e 67 20 6c 6f 6f 70 20 77 69 74 68 xiting loop with
6720: 2e 2e 2e 5c 6e 20 20 68 65 64 3d 22 20 68 65 64 ...\n hed=" hed
6730: 20 22 5c 6e 20 20 74 61 6c 3d 22 20 74 61 6c 20 "\n tal=" tal
6740: 22 5c 6e 20 20 72 65 72 75 6e 73 3d 22 20 72 65 "\n reruns=" re
6750: 72 75 6e 73 29 29 0a 09 20 20 20 20 20 29 29 29 runs)).. )))
6760: 29 20 3b 3b 20 4c 45 54 2a 20 28 28 74 65 73 74 ) ;; LET* ((test
6770: 2d 72 65 63 6f 72 64 0a 0a 20 20 20 20 3b 3b 20 -record.. ;;
6780: 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22 we get here on "
6790: 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20 drop through" -
67a0: 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65 loop for next te
67b0: 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 20 20 st in queue.
67c0: 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54 48 49 ;; FIXME!!!! THI
67d0: 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 S SHOULD NOT REQ
67e0: 55 49 52 45 20 41 4e 20 45 58 49 54 21 21 21 21 UIRE AN EXIT!!!!
67f0: 21 21 21 0a 20 20 20 20 0a 20 20 20 20 28 64 65 !!!. . (de
6800: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 bug:print 1 "INF
6810: 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 O: All tests lau
6820: 6e 63 68 65 64 22 29 0a 20 20 20 20 28 74 68 72 nched"). (thr
6830: 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29 0a ead-sleep! 0.5).
6840: 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 20 54 68 ;; FIXME! Th
6850: 69 73 20 68 61 72 73 68 20 65 78 69 74 20 73 68 is harsh exit sh
6860: 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 ould not be nece
6870: 73 73 61 72 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b ssary..... ;;
6880: 20 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72 65 (if (not *runre
6890: 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b 3b mote*)(exit)) ;;
68a0: 20 0a 20 20 20 20 23 66 29 29 20 3b 3b 20 72 65 . #f)) ;; re
68b0: 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 68 turn a #f as a h
68c0: 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 20 int that we are
68d0: 64 6f 6e 65 0a 20 20 3b 3b 20 48 65 72 65 20 77 done. ;; Here w
68e0: 65 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 e need to check
68f0: 74 68 61 74 20 61 6c 6c 20 74 68 65 20 74 65 73 that all the tes
6900: 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 ts remaining to
6910: 62 65 20 72 75 6e 20 61 72 65 20 65 6c 69 67 69 be run are eligi
6920: 62 6c 65 20 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 ble to run. ;;
6930: 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f 63 and are not bloc
6940: 6b 65 64 20 62 79 20 66 61 69 6c 65 64 0a 20 20 ked by failed.
6950: 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 ..;; parent-test
6960: 20 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 is there as a p
6970: 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 laceholder for w
6980: 68 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 hen parent-tests
6990: 20 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 can be run as a
69a0: 20 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 setup step.(def
69b0: 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 72 75 ine (run:test ru
69c0: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 n-id runname key
69d0: 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f vallst test-reco
69e0: 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d rd flags parent-
69f0: 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 test). ;; All t
6a00: 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 hese vars might
6a10: 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 be referenced by
6a20: 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 the testconfig
6a30: 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c file reader. (l
6a40: 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 et* ((test-name
6a50: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
6a60: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 eue-get-testname
6a70: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
6a80: 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 .. (test-waitons
6a90: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
6aa0: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 e-get-waitons
6ab0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
6ac0: 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 (test-conf (
6ad0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
6ae0: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 get-testconfig t
6af0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 est-record)).. (
6b00: 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 itemdat (te
6b10: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
6b20: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 t-itemdat tes
6b30: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 t-record)).. (te
6b40: 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 st-path (conc
6b50: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
6b60: 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 ts/" test-name))
6b70: 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 ;; could use te
6b80: 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 sts:get-testconf
6b90: 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 ig here ..... (f
6ba0: 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73 orce (has
6bb0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
6bc0: 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 ult flags "-forc
6bd0: 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e e" #f)).. (rerun
6be0: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 (hash-ta
6bf0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
6c00: 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 flags "-rerun" #
6c10: 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 f)).. (keepgoing
6c20: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d (hash-table-
6c30: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 ref/default flag
6c40: 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 s "-keepgoing" #
6c50: 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 f)).. (item-path
6c60: 20 20 20 20 20 22 22 29 0a 09 20 28 64 62 20 20 "").. (db
6c70: 20 20 20 20 20 20 20 20 20 23 66 29 29 0a 20 20 #f)).
6c80: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
6c90: 0a 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 ... "test-config
6ca0: 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d : " (hash-table-
6cb0: 3e 61 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 >alist test-conf
6cc0: 29 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 )... "\n itemd
6cd0: 61 74 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 at: " itemdat...
6ce0: 20 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e ). ;; settin
6cf0: 67 20 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c g itemdat to a l
6d00: 69 73 74 20 69 66 20 69 74 20 69 73 20 23 66 0a ist if it is #f.
6d10: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 (if (not ite
6d20: 6d 64 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 mdat)(set! itemd
6d30: 61 74 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 at '())). (se
6d40: 74 21 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 t! item-path (it
6d50: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
6d60: 65 6d 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 emdat)). (deb
6d70: 75 67 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 ug:print 2 "Atte
6d80: 6d 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 mpting to launch
6d90: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d test " test-nam
6da0: 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 e (if (equal? it
6db0: 65 6d 2d 70 61 74 68 20 22 2f 22 29 20 22 2f 22 em-path "/") "/"
6dc0: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 item-path)).
6dd0: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 (setenv "MT_TES
6de0: 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d T_NAME" test-nam
6df0: 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 e) ;; . (sete
6e00: 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 nv "MT_RUNNAME"
6e10: 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 runname). (
6e20: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 open-run-close s
6e30: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
6e40: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 vars db run-id)
6e50: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 ;; these may be
6e60: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 needed by the la
6e70: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a unching process.
6e80: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 (change-dire
6e90: 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 ctory *toppath*)
6ea0: 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73 .. ;; Here is
6eb0: 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 5f where the test_
6ec0: 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 65 meta table is be
6ed0: 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 3b st updated. ;
6ee0: 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20 75 ; Yes, another u
6ef0: 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66 se of a global f
6f00: 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65 64 or caching. Need
6f10: 20 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a 20 a better way?.
6f20: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 (if (not (has
6f30: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
6f40: 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 ult *test-meta-u
6f50: 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d pdated* test-nam
6f60: 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 20 28 e #f)). (
6f70: 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68 2d begin.. (hash-
6f80: 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73 74 table-set! *test
6f90: 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 -meta-updated* t
6fa0: 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20 est-name #t).
6fb0: 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 (open-ru
6fc0: 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 75 70 64 n-close runs:upd
6fd0: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 ate-test_meta db
6fe0: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
6ff0: 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20 20 conf))). .
7000: 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65 ;; (lambda (ite
7010: 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 mdat) ;;; ((ripe
7020: 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 29 ness "overripe")
7030: 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 63 (temperature "c
7040: 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73 ool") (season "s
7050: 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c 65 ummer")). (le
7060: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 t* ((new-test-pa
7070: 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 th (string-inter
7080: 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73 sperse (cons tes
7090: 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 72 t-path (map cadr
70a0: 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29 itemdat)) "/"))
70b0: 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e .. (new-test-n
70c0: 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 ame (if (equal?
70d0: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65 item-path "") te
70e0: 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 st-name (conc te
70f0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d st-name "/" item
7100: 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 -path))) ;; just
7110: 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 75 need it to be u
7120: 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74 2d nique.. (test-
7130: 69 64 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 id (open-r
7140: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
7150: 74 65 73 74 2d 69 64 20 64 62 20 20 72 75 6e 2d test-id db run-
7160: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
7170: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 65 m-path)).. (te
7180: 73 74 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 stdat (ope
7190: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 n-run-close db:g
71a0: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d et-test-info-by-
71b0: 69 64 20 64 62 20 74 65 73 74 2d 69 64 29 29 29 id db test-id)))
71c0: 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 . (if (not
71d0: 74 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 testdat).. (beg
71e0: 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 in.. ;; ensur
71f0: 65 20 74 68 61 74 20 74 68 65 20 70 61 74 68 20 e that the path
7200: 65 78 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 exists before re
7210: 67 69 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 gistering the te
7220: 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a st.. ;; NOPE:
7230: 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b Cannot! Don't k
7240: 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20 64 69 now yet which di
7250: 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 sk area will be
7260: 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 assigned......
7270: 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f ;; (system (co
7280: 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e nc "mkdir -p " n
7290: 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 ew-test-path))..
72a0: 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 ;;.. ;; (
72b0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 open-run-close t
72c0: 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 ests:register-te
72d0: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 st db run-id tes
72e0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
72f0: 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b ).. ;;.. ;
7300: 3b 20 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 61 ; NB// for the a
7310: 62 6f 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e bove line. I wan
7320: 74 20 74 68 65 20 74 65 73 74 20 74 6f 20 62 65 t the test to be
7330: 20 72 65 67 69 73 74 65 72 65 64 20 6c 6f 6e 67 registered long
7340: 20 62 65 66 6f 72 65 20 74 68 69 73 20 72 6f 75 before this rou
7350: 74 69 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 64 tine gets called
7360: 21 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 28 !.. ;;.. (
7370: 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 set! test-id (op
7380: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
7390: 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 get-test-id db r
73a0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
73b0: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 item-path))..
73c0: 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 2d 69 (if (not test-i
73d0: 64 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 d)...(begin...
73e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
73f0: 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 WARN: Test not p
7400: 72 65 2d 63 72 65 61 74 65 64 3f 20 74 65 73 74 re-created? test
7410: 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d -name=" test-nam
7420: 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22 e ", item-path="
7430: 20 69 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 75 item-path ", ru
7440: 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09 n-id=" run-id)..
7450: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f . (open-run-clo
7460: 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69 se db:tests-regi
7470: 73 74 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e ster-test #f run
7480: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
7490: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73 65 em-path)... (se
74a0: 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e t! test-id (open
74b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 -run-close db:ge
74c0: 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e t-test-id db run
74d0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
74e0: 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20 20 em-path))))..
74f0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
7500: 22 49 4e 46 4f 3a 20 74 65 73 74 2d 69 64 3d 22 "INFO: test-id="
7510: 20 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d test-id ", run-
7520: 69 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 id=" run-id ", t
7530: 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d est-name=" test-
7540: 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 name ", item-pat
7550: 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 20 h=\"" item-path
7560: 22 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74 21 "\"").. (set!
7570: 20 74 65 73 74 64 61 74 20 28 6f 70 65 6e 2d 72 testdat (open-r
7580: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
7590: 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 test-info-by-id
75a0: 64 62 20 74 65 73 74 2d 69 64 29 29 29 29 0a 20 db test-id)))).
75b0: 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d (set! test-
75c0: 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d id (db:test-get-
75d0: 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 id testdat)).
75e0: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
75f0: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a tory test-path).
7600: 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20 (case (if
7610: 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 force ;; (args:g
7620: 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 et-arg "-force")
7630: 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a ...'NOT_STARTED.
7640: 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 ..(if testdat...
7650: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d (string->sym
7660: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 bol (test:get-st
7670: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
7680: 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 'failed-to-i
7690: 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 nsert))..((faile
76a0: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 d-to-insert).. (
76b0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
76c0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
76d0: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 insert the recor
76e0: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 d into the db"))
76f0: 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 ..((NOT_STARTED
7700: 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 6c 65 COMPLETED).. (le
7710: 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 t ((runflag #f))
7720: 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 .. (cond..
7730: 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e ;; -force, run n
7740: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 o matter what..
7750: 20 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 (force (set!
7760: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 runflag #t))..
7770: 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 ;; NOT_STARTED
7780: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 , run no matter
7790: 77 68 61 74 0a 09 20 20 20 20 28 28 65 71 75 61 what.. ((equa
77a0: 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 l? (test:get-sta
77b0: 74 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 te testdat) "NOT
77c0: 5f 53 54 41 52 54 45 44 22 29 28 73 65 74 21 20 _STARTED")(set!
77d0: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 runflag #t))..
77e0: 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 ;; not -rerun
77f0: 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f and PASS, WARN o
7800: 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 r CHECK, do no r
7810: 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f un.. ((and (o
7820: 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 r (not rerun)...
7830: 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 keepgoing)
7840: 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 ... ;; Require
7850: 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 to force re-run
7860: 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 for COMPLETED or
7870: 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 *anything* + PA
7880: 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b SS,WARN or CHECK
7890: 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 ... (or (member
78a0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
78b0: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 s testdat) '("PA
78c0: 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 SS" "WARN" "CHEC
78d0: 4b 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 K"))... (me
78e0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 mber (test:get-s
78f0: 74 61 74 65 20 20 74 65 73 74 64 61 74 29 20 27 tate testdat) '
7900: 28 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 ("COMPLETED"))))
7910: 20 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
7920: 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 rint 2 "INFO: ru
7930: 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 nning test " tes
7940: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d t-name "/" item-
7950: 70 61 74 68 20 22 20 73 75 70 70 72 65 73 73 65 path " suppresse
7960: 64 20 61 73 20 69 74 20 69 73 20 22 20 28 74 65 d as it is " (te
7970: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
7980: 74 64 61 74 29 20 22 20 61 6e 64 20 22 20 28 74 tdat) " and " (t
7990: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
79a0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 estdat)).. (
79b0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
79c0: 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e ).. ;; -rerun
79d0: 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f and status is o
79e0: 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 ne of the specif
79f0: 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 ed, run it..
7a00: 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 ((and rerun...
7a10: 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 (let* ((rerunlst
7a20: 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 (string-split
7a30: 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 rerun ","))....
7a40: 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 (must-rerun (me
7a50: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 mber (test:get-s
7a60: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 tatus testdat) r
7a70: 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 erunlst)))...
7a80: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 (debug:print 3
7a90: 22 49 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 "INFO: -rerun li
7aa0: 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74 st: " rerun ", t
7ab0: 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74 est-status: " (t
7ac0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
7ad0: 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 estdat)", must-r
7ae0: 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 erun: " must-rer
7af0: 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 un)... must-r
7b00: 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65 erun)).. (de
7b10: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 bug:print 2 "INF
7b20: 4f 3a 20 52 65 72 75 6e 20 66 6f 72 63 65 64 20 O: Rerun forced
7b30: 66 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 2d for test " test-
7b40: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
7b50: 74 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 th).. (set!
7b60: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 runflag #t))..
7b70: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c ;; -keepgoing,
7b80: 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 do not rerun FA
7b90: 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65 IL.. ((and ke
7ba0: 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d epgoing... (mem
7bb0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
7bc0: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 atus testdat) '(
7bd0: 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20 "FAIL")))..
7be0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
7bf0: 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e )).. ((and (n
7c00: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d ot rerun)... (m
7c10: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d ember (test:get-
7c20: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
7c30: 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 '("FAIL" "n/a"))
7c40: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 ).. (set! ru
7c50: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 nflag #t))..
7c60: 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66 (else (set! runf
7c70: 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64 lag #f))).. (d
7c80: 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55 ebug:print 6 "RU
7c90: 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 NNING => runflag
7ca0: 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54 : " runflag " ST
7cb0: 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74 ATE: " (test:get
7cc0: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 -state testdat)
7cd0: 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73 " STATUS: " (tes
7ce0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
7cf0: 74 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28 tdat)).. (if (
7d00: 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 not runflag)..
7d10: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61 (if (not pa
7d20: 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20 rent-test)...
7d30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
7d40: 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 NOTE: Not starti
7d50: 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 ng test " new-te
7d60: 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20 st-name " as it
7d70: 69 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65 is state \"" (te
7d80: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
7d90: 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61 tdat) ....."\" a
7da0: 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 nd status \"" (t
7db0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
7dc0: 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 estdat) "\", use
7dd0: 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73 -rerun \"" (tes
7de0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
7df0: 74 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20 tdat).
7e00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7e10: 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f "\" or -fo
7e20: 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 rce to override"
7e30: 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f )).. ;; NO
7e40: 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 TE: No longer be
7e50: 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71 checking prereq
7e60: 75 69 73 69 74 65 73 20 68 65 72 65 21 20 57 69 uisites here! Wi
7e70: 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 72 ll never get her
7e80: 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73 e unless prereqs
7e90: 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 are.. ;;
7ea0: 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65 already me
7eb0: 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 t... (if (
7ec0: 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 not (launch-test
7ed0: 20 23 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 #f run-id runna
7ee0: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 me test-conf key
7ef0: 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 vallst test-name
7f00: 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 test-path itemd
7f10: 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 at flags))...
7f20: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 (begin... (p
7f30: 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 rint "ERROR: Fai
7f40: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 led to launch th
7f50: 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 e test. Exiting
7f60: 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 as soon as possi
7f70: 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 ble")... (se
7f80: 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 t! *globalexitst
7f90: 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 atus* 1) ;; ...
7fa0: 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 (process-sig
7fb0: 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f nal (current-pro
7fc0: 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f cess-id) signal/
7fd0: 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 kill))))))..((KI
7fe0: 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a LLED) .. (debug:
7ff0: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 print 1 "NOTE: "
8000: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 new-test-name "
8010: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e is already runn
8020: 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 ing or was expli
8030: 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 ctly killed, use
8040: 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 -force to launc
8050: 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e h it."))..((LAUN
8060: 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 CHED REMOTEHOSTS
8070: 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a TART RUNNING) .
8080: 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 . (if (> (- (cur
8090: 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 rent-seconds)(+
80a0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 (db:test-get-eve
80b0: 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 nt_time testdat)
80c0: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62 3a ..... (db:
80d0: 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 test-get-run_dur
80e0: 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 ation testdat)))
80f0: 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 ...600) ;; i.e.
8100: 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f no update for mo
8110: 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f re than 600 seco
8120: 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e nds.. (begin
8130: 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
8140: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 print 0 "WARNING
8150: 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 : Test " test-na
8160: 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 me " appears to
8170: 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 be dead. Forcing
8180: 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 it to state INC
8190: 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 OMPLETE and stat
81a0: 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a us STUCK/DEAD").
81b0: 09 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 . (tests:t
81c0: 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 est-set-status!
81d0: 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c test-id "INCOMPL
81e0: 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 ETE" "STUCK/DEAD
81f0: 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63 6b " "Test is stuck
8200: 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a 09 or dead" #f))..
8210: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
8220: 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 t 2 "NOTE: " tes
8230: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 t-name " is alre
8240: 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a ady running"))).
8250: 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 65 .(else (de
8260: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
8270: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 OR: Failed to la
8280: 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d unch test " new-
8290: 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 test-name ". Unr
82a0: 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20 ecognised state
82b0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
82c0: 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 29 e testdat)))))))
82d0: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ..;;============
82e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
82f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8300: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8310: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e ==========.;; EN
8320: 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b D OF NEW STUFF.;
8330: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
8340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8370: 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 =======..(define
8380: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 (get-dir-up-n d
8390: 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 ir . params) .
83a0: 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28 (let ((dparts (
83b0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 string-split dir
83c0: 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 "/"))..(count
83d0: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 (if (null? para
83e0: 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d ms) 1 (car param
83f0: 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 s)))). (conc
8400: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 "/" (string-inte
8410: 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20 rsperse ..
8420: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d (take dparts (-
8430: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 (length dparts)
8440: 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20 count))..
8450: 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f "/")))).;; Remo
8460: 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 ve runs.;; field
8470: 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e s are passing in
8480: 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74 through .;; act
8490: 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f ion:.;; 'remo
84a0: 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73 ve-runs.;; 's
84b0: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 0a et-state-status.
84c0: 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c ;;.;; NB// shoul
84d0: 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a d pass in keys?.
84e0: 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 ;;.(define (runs
84f0: 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74 69 :operate-on acti
8500: 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 on runnamepatt t
8510: 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 estpatt itempatt
8520: 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 66 #!key (state #f
8530: 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 77 )(status #f)(new
8540: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66 -state-status #f
8550: 29 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 )). (let* ((db
8560: 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09 20 #f)..
8570: 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 28 6f (keys (o
8580: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
8590: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 :get-keys db))..
85a0: 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 20 28 (rundat (
85b0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 open-run-close r
85c0: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d uns:get-runs-by-
85d0: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e patt db keys run
85e0: 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 namepatt)).. (he
85f0: 61 64 65 72 20 20 20 20 20 20 20 28 76 65 63 74 ader (vect
8600: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 or-ref rundat 0)
8610: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 ).. (runs
8620: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 (vector-ref ru
8630: 6e 64 61 74 20 31 29 29 0a 09 20 28 73 74 61 74 ndat 1)).. (stat
8640: 65 73 20 20 20 20 20 20 20 28 69 66 20 73 74 61 es (if sta
8650: 74 65 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 te (string-spli
8660: 74 20 73 74 61 74 65 20 20 22 2c 22 29 20 27 28 t state ",") '(
8670: 29 29 29 0a 09 20 28 73 74 61 74 75 73 65 73 20 ))).. (statuses
8680: 20 20 20 20 28 69 66 20 73 74 61 74 75 73 20 28 (if status (
8690: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 string-split sta
86a0: 74 75 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09 tus ",") '()))..
86b0: 20 28 73 74 61 74 65 2d 73 74 61 74 75 73 20 28 (state-status (
86c0: 69 66 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d if (string? new-
86d0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 28 73 state-status) (s
86e0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d tring-split new-
86f0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22 state-status ","
8700: 29 20 27 28 23 66 20 23 66 29 29 29 29 0a 20 20 ) '(#f #f)))).
8710: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
8720: 20 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 "Header: " head
8730: 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 er " action: " a
8740: 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 ction " new-stat
8750: 65 2d 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d e-status: " new-
8760: 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 state-status).
8770: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 (for-each.
8780: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 (lambda (run).
8790: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e (let ((run
87a0: 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 key (string-inte
87b0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 rsperse (map (la
87c0: 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 mbda (k).......(
87d0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
87e0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
87f0: 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 r (vector-ref k
8800: 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0))) keys) "/"))
8810: 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d .. (dirs-to-
8820: 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 remove (make-has
8830: 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 h-table))).. (le
8840: 74 2a 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28 t* ((run-id (
8850: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
8860: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
8870: 72 20 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d r "id"))...(run-
8880: 73 74 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61 state (db:get-va
8890: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
88a0: 6e 20 68 65 61 64 65 72 20 22 73 74 61 74 65 22 n header "state"
88b0: 29 29 0a 09 09 28 74 65 73 74 73 20 20 20 20 20 ))...(tests
88c0: 28 69 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f (if (not (equal?
88d0: 20 72 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b run-state "lock
88e0: 65 64 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 ed"))....
88f0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
8900: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db:get-tests-for
8910: 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d -run db (db:get-
8920: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
8930: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 run header "id")
8940: 0a 09 09 09 09 09 09 20 20 20 20 20 20 74 65 73 ....... tes
8950: 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 73 tpatt itempatt s
8960: 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 tates statuses..
8970: 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 ..... not-i
8980: 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 n: #f.......
8990: 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 sort-by: (cas
89a0: 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 e action........
89b0: 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 . ((remove-runs)
89c0: 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 'rundir).......
89d0: 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 .. (else
89e0: 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 'event_time)))
89f0: 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29 29 .... '()))
8a00: 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f ...(lasttpath "/
8a10: 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 does/not/exist/I
8a20: 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 69 /hope"))... (i
8a30: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 f (not (null? te
8a40: 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 sts)).. (b
8a50: 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 egin... (case ac
8a60: 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f tion... ((remo
8a70: 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 ve-runs)... (
8a80: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 debug:print 1 "R
8a90: 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f emoving tests fo
8aa0: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 r run: " runkey
8ab0: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 " " (db:get-valu
8ac0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
8ad0: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 header "runname"
8ae0: 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 )))... ((set-s
8af0: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 tate-status)...
8b00: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8b10: 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 1 "Modifying sta
8b20: 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 te and staus for
8b30: 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 tests for run:
8b40: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
8b50: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
8b60: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
8b70: 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 "runname")))...
8b80: 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 70 (else... (p
8b90: 72 69 6e 74 20 22 49 4e 46 4f 3a 20 61 63 74 69 rint "INFO: acti
8ba0: 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 on not recognise
8bb0: 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 d " action)))...
8bc0: 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 (for-each... (
8bd0: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 lambda (test)...
8be0: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d (let* ((item
8bf0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
8c00: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
8c10: 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d t)).... (test-
8c20: 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 name (db:test-ge
8c30: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 t-testname test)
8c40: 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 ).... (run-dir
8c50: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
8c60: 72 75 6e 64 69 72 20 74 65 73 74 29 29 0a 09 09 rundir test))...
8c70: 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 28 . (test-id (
8c80: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
8c90: 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 3b est)))... ;
8ca0: 3b 20 20 20 28 74 64 62 20 20 20 20 20 20 20 28 ; (tdb (
8cb0: 64 62 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 db:open-test-db
8cc0: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 20 20 20 run-dir)))...
8cd0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8ce0: 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d 1 " " (db:test-
8cf0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
8d00: 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 t) " id: " (db:t
8d10: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 est-get-id test)
8d20: 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 " " item-path "
8d30: 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f action: " actio
8d40: 6e 29 0a 09 09 20 20 20 20 20 20 28 63 61 73 65 n)... (case
8d50: 20 61 63 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d action....((rem
8d60: 6f 76 65 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65 ove-runs) ;; the
8d70: 20 74 64 62 20 69 73 20 66 6f 72 20 66 75 74 75 tdb is for futu
8d80: 72 65 20 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09 re possible. ...
8d90: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 . (open-run-clos
8da0: 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 e db:delete-test
8db0: 2d 72 65 63 6f 72 64 73 20 64 62 20 23 66 20 28 -records db #f (
8dc0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
8dd0: 65 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67 est)).... (debug
8de0: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 :print 1 "INFO:
8df0: 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 Attempting to re
8e00: 6d 6f 76 65 20 64 69 72 20 22 20 72 75 6e 2d 64 move dir " run-d
8e10: 69 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64 ir).... (if (and
8e20: 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 (> (string-leng
8e30: 74 68 20 72 75 6e 2d 64 69 72 29 20 35 29 0a 09 th run-dir) 5)..
8e40: 09 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 ... (file-exist
8e50: 73 3f 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 s? run-dir)) ;;
8e60: 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 bad heuristic bu
8e70: 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 t should prevent
8e80: 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e /tmp /home etc.
8e90: 0a 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 .... (let* (
8ea0: 28 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c (realpath (resol
8eb0: 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d ve-pathname run-
8ec0: 64 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20 dir)))....
8ed0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
8ee0: 22 49 4e 46 4f 3a 20 52 65 61 6c 20 70 61 74 68 "INFO: Real path
8ef0: 20 6f 66 20 69 73 20 22 20 72 65 61 6c 70 61 74 of is " realpat
8f00: 68 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 h).... (if
8f10: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 (file-exists? r
8f20: 65 61 6c 70 61 74 68 29 0a 09 09 09 09 20 20 20 ealpath).....
8f30: 28 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28 (if (> (system (
8f40: 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72 conc "rm -rf " r
8f50: 65 61 6c 70 61 74 68 29 29 20 30 29 0a 09 09 09 ealpath)) 0)....
8f60: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
8f70: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 rint 0 "ERROR: T
8f80: 68 65 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c here was a probl
8f90: 65 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 em removing " re
8fa0: 61 6c 70 61 74 68 20 22 20 77 69 74 68 20 72 6d alpath " with rm
8fb0: 20 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28 64 -f"))..... (d
8fc0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
8fd0: 52 4e 49 4e 47 3a 20 74 65 73 74 20 72 75 6e 20 RNING: test run
8fe0: 64 69 72 20 22 20 72 65 61 6c 70 61 74 68 20 22 dir " realpath "
8ff0: 20 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 appears to not
9000: 65 78 69 73 74 22 29 29 0a 09 09 09 20 20 20 20 exist"))....
9010: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 (if (file-exi
9020: 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b sts? run-dir) ;;
9030: 20 74 68 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20 the link.....
9040: 20 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c (if (symbolic-l
9050: 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 ink? run-dir)...
9060: 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 .. (delete
9070: 2d 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09 -file run-dir)..
9080: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 64 ... (if (d
9090: 69 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 irectory? run-di
90a0: 72 29 0a 09 09 09 09 09 20 20 20 28 69 66 20 28 r)...... (if (
90b0: 3e 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c > (directory-fol
90c0: 64 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28 d (lambda (f x)(
90d0: 2b 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69 + 1 x)) 0 run-di
90e0: 72 29 20 30 29 0a 09 09 09 09 09 20 20 20 20 20 r) 0)......
90f0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
9100: 20 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 "WARNING: refus
9110: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 ing to remove "
9120: 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 run-dir " as it
9130: 69 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 is not empty")..
9140: 09 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 .... (dele
9150: 74 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e te-directory run
9160: 2d 64 69 72 29 29 20 3b 3b 20 69 74 20 73 68 6f -dir)) ;; it sho
9170: 75 6c 64 20 62 65 20 65 6d 70 74 79 20 62 79 20 uld be empty by
9180: 68 65 72 65 20 42 55 47 20 42 55 47 2c 20 61 64 here BUG BUG, ad
9190: 64 20 65 72 72 6f 72 20 63 61 74 63 68 0a 09 09 d error catch...
91a0: 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ... (debug:pri
91b0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 72 65 66 nt 0 "ERROR: ref
91c0: 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 using to remove
91d0: 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 " run-dir " as i
91e0: 74 20 69 73 20 6e 65 69 74 68 65 72 20 61 20 73 t is neither a s
91f0: 79 6d 6c 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72 ymlink nor a dir
9200: 65 63 74 6f 72 79 22 29 0a 09 09 09 09 09 20 20 ectory")......
9210: 20 29 29 29 29 0a 09 09 09 20 20 20 20 20 28 64 )))).... (d
9220: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
9230: 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 RNING: directory
9240: 20 61 6c 72 65 61 64 79 20 72 65 6d 6f 76 65 64 already removed
9250: 20 22 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 " run-dir)))...
9260: 09 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 .((set-state-sta
9270: 74 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a tus).... (debug:
9280: 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e print 2 "INFO: n
9290: 65 77 20 73 74 61 74 65 20 22 20 28 63 61 72 20 ew state " (car
92a0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c state-status) ",
92b0: 20 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 63 new status " (c
92c0: 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 adr state-status
92d0: 29 29 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e )).... (open-run
92e0: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 -close db:test-s
92f0: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d et-state-status-
9300: 62 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 by-id db (db:tes
9310: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 t-get-id test) (
9320: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 car state-status
9330: 29 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 )(cadr state-sta
9340: 74 75 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 tus) #f)))))...
9350: 20 74 65 73 74 73 29 29 29 0a 09 20 20 20 0a 09 tests))).. ..
9360: 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 ;; remove the
9370: 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 run if zero tes
9380: 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 ts remain.. (i
9390: 66 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 f (eq? action 'r
93a0: 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 emove-runs)..
93b0: 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 (let ((remte
93c0: 73 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c sts (open-run-cl
93d0: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 ose db:get-tests
93e0: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a -for-run db (db:
93f0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
9400: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
9410: 69 64 22 29 20 23 66 20 23 66 20 27 28 22 44 45 id") #f #f '("DE
9420: 4c 45 54 45 44 22 29 20 27 28 22 6e 2f 61 22 29 LETED") '("n/a")
9430: 20 6e 6f 74 2d 69 6e 3a 20 23 74 29 29 29 0a 09 not-in: #t)))..
9440: 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d . (if (null? rem
9450: 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 tests) ;; no mor
9460: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e e tests remainin
9470: 67 0a 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 g... (let* (
9480: 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 (dparts (string
9490: 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 -split lasttpath
94a0: 20 22 2f 22 29 29 0a 09 09 09 20 20 20 20 28 72 "/")).... (r
94b0: 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 unpath (conc "/"
94c0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
94d0: 65 72 73 65 20 0a 09 09 09 09 09 09 28 74 61 6b erse .......(tak
94e0: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e e dparts (- (len
94f0: 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29 0a gth dparts) 1)).
9500: 09 09 09 09 09 09 22 2f 22 29 29 29 29 0a 09 09 ......"/"))))...
9510: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
9520: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
9530: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 run: " runkey "
9540: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d " (db:get-value-
9550: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
9560: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 20 ader "runname")
9570: 22 20 61 6e 64 20 72 65 6c 61 74 65 64 20 72 65 " and related re
9580: 63 6f 72 64 22 29 0a 09 09 20 20 20 20 20 20 20 cord")...
9590: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
95a0: 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 db:delete-run db
95b0: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 run-id)...
95c0: 20 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20 70 ;; This is a p
95d0: 72 65 74 74 79 20 67 6f 6f 64 20 70 6c 61 63 65 retty good place
95e0: 20 74 6f 20 70 75 72 67 65 20 6f 6c 64 20 44 45 to purge old DE
95f0: 4c 45 54 45 44 20 74 65 73 74 73 0a 09 09 20 20 LETED tests...
9600: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
9610: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 lose db:delete-t
9620: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ests-for-run db
9630: 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20 run-id)...
9640: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
9650: 20 64 62 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 db:delete-old-d
9660: 65 6c 65 74 65 64 2d 74 65 73 74 2d 72 65 63 6f eleted-test-reco
9670: 72 64 73 20 64 62 29 0a 09 09 20 20 20 20 20 20 rds db)...
9680: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
9690: 20 64 62 3a 73 65 74 2d 76 61 72 20 64 62 20 22 db:set-var db "
96a0: 44 45 4c 45 54 45 44 5f 54 45 53 54 53 22 20 28 DELETED_TESTS" (
96b0: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 current-seconds)
96c0: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 6e 65 )... ;; ne
96d0: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 ed to figure out
96e0: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 the path to the
96f0: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d run dir and rem
9700: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a ove it if empty.
9710: 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 28 .. ;; (
9720: 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 if (null? (glob
9730: 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f (conc runpath "/
9740: 2a 22 29 29 29 0a 09 09 20 20 20 20 20 20 20 3b *")))... ;
9750: 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a ; (begin.
9760: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 64 .. ;; . (d
9770: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 ebug:print 1 "Re
9780: 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 moving run dir "
9790: 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 20 runpath)...
97a0: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 ;; . (system
97b0: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 (conc "rmdir -p
97c0: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 " runpath))))...
97d0: 20 20 20 20 20 20 20 29 29 29 29 29 0a 09 20 29 ))))).. )
97e0: 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a ). runs)))..
97f0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
9800: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9810: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9820: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9830: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 ========.;; Rout
9840: 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c ines for manipul
9850: 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d ating runs.;;===
9860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9870: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
98a0: 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 ===..;; Since ma
98b0: 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 ny calls to a ru
98c0: 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 n require pretty
98d0: 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 much the same s
98e0: 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 etup .;; this wr
98f0: 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f apper is used to
9900: 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c reduce the repl
9910: 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a ication of code.
9920: 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c (define (general
9930: 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 -run-call switch
9940: 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 name action-desc
9950: 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 proc). (let ((
9960: 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 runname (args:ge
9970: 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 t-arg ":runname"
9980: 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 ))..(target (if
9990: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
99a0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
99b0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
99c0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
99d0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
99e0: 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 -reqtarg")))..(t
99f0: 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 h1 #f)).
9a00: 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 (cond. ((not
9a10: 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 target). (
9a20: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
9a30: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 RROR: Missing re
9a40: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 quired parameter
9a50: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d for " switchnam
9a60: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 e ", you must sp
9a70: 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74 ecify the target
9a80: 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a with -target").
9a90: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a (exit 3)).
9aa0: 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 ((not runna
9ab0: 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 me). (debug
9ac0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
9ad0: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 Missing require
9ae0: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 d parameter for
9af0: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 " switchname ",
9b00: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 you must specify
9b10: 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 the run name wi
9b20: 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e th :runname runn
9b30: 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 ame"). (exi
9b40: 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 t 3)). (else
9b50: 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 . (let ((db
9b60: 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 #f).. (key
9b70: 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 s #f))..(if (not
9b80: 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 (setup-for-run)
9b90: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 ).. (begin ..
9ba0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
9bb0: 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 nt 0 "Failed to
9bc0: 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 setup, exiting")
9bd0: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
9be0: 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 ))..(if (args:ge
9bf0: 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 t-arg "-server")
9c00: 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d .. (open-run-
9c10: 63 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74 61 close server:sta
9c20: 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d rt db (args:get-
9c30: 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29 0a arg "-server")).
9c40: 20 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 . (if (not (
9c50: 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 or (args:get-arg
9c60: 20 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 "-runall")
9c70: 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 ;; runall and ru
9c80: 6e 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 ntests are allow
9c90: 65 64 20 74 6f 20 62 65 20 73 65 72 76 65 72 73 ed to be servers
9ca0: 0a 20 09 09 09 20 28 61 72 67 73 3a 67 65 74 2d . ... (args:get-
9cb0: 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 arg "-runtests")
9cc0: 29 29 0a 09 09 28 73 65 72 76 65 72 3a 63 6c 69 ))...(server:cli
9cd0: 65 6e 74 2d 73 65 74 75 70 29 29 29 0a 09 28 73 ent-setup)))..(s
9ce0: 65 74 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d 72 et! keys (open-r
9cf0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
9d00: 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 keys db))..;; ha
9d10: 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f ve enough to pro
9d20: 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 cess -target or
9d30: 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 -reqtarg here..(
9d40: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 if (args:get-arg
9d50: 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 "-reqtarg")..
9d60: 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e (let* ((runcon
9d70: 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 figf (conc *top
9d80: 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 path* "/runconfi
9d90: 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 gs.config")) ;;
9da0: 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 DO NOT EVALUATE
9db0: 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f ALL ... (runco
9dc0: 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 nfig (read-conf
9dd0: 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 ig runconfigf #f
9de0: 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 #f environ-patt
9df0: 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20 20 : #f))) ..
9e00: 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d (if (hash-table-
9e10: 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 ref/default runc
9e20: 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d onfig (args:get-
9e30: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 arg "-reqtarg")
9e40: 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 #f)... (keys:ta
9e50: 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 rget-set-args ke
9e60: 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 ys (args:get-arg
9e70: 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72 67 "-reqtarg") arg
9e80: 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20 s:arg-hash)...
9e90: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 (begin... (de
9ea0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
9eb0: 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74 OR: [" (args:get
9ec0: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 -arg "-reqtarg")
9ed0: 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e "] not found in
9ee0: 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 " runconfigf)..
9ef0: 09 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c . (if db (sql
9f00: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 ite3:finalize! d
9f10: 62 29 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 b))... (exit
9f20: 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 1)))).. (if (
9f30: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 args:get-arg "-t
9f40: 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a arget")...(keys:
9f50: 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 target-set-args
9f60: 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 keys (args:get-a
9f70: 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 rg "-target" arg
9f80: 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 s:arg-hash) args
9f90: 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 :arg-hash)))..(i
9fa0: 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e f (not (car *con
9fb0: 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 figinfo*))..
9fc0: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 (begin.. (d
9fd0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
9fe0: 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 ROR: Attempted t
9ff0: 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 o " action-desc
a000: 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 " but run area c
a010: 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 onfig file not f
a020: 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 ound").. (e
a030: 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 xit 1)).. ;;
a040: 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 Extract out stuf
a050: 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 f needed in most
a060: 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 or many calls..
a070: 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e ;; here then
a080: 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 call proc..
a090: 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 (let* ((keynames
a0a0: 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d (map key:get-
a0b0: 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 fieldname keys))
a0c0: 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 ... (keyvallst
a0d0: 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 (keys->vallist
a0e0: 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 keys #t)))..
a0f0: 20 20 20 28 70 72 6f 63 20 74 61 72 67 65 74 20 (proc target
a100: 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 runname keys key
a110: 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 names keyvallst)
a120: 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68 72 ))..(if th1 (thr
a130: 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a ead-join! th1)).
a140: 09 28 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 .(if db (sqlite3
a150: 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a :finalize! db)).
a160: 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 .(set! *didsomet
a170: 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a hing* #t))))))..
a180: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
a190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a1a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a1b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a1c0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b ========.;; Lock
a1d0: 2f 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d /unlock runs.;;=
a1e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a1f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a210: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a220: 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 =====..(define (
a230: 72 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b runs:handle-lock
a240: 69 6e 67 20 74 61 72 67 65 74 20 6b 65 79 73 20 ing target keys
a250: 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c runname lock unl
a260: 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65 74 ock user). (let
a270: 2a 20 28 28 64 62 20 20 20 20 20 20 20 23 66 29 * ((db #f)
a280: 0a 09 20 28 72 75 6e 64 61 74 20 20 20 28 6f 70 .. (rundat (op
a290: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e en-run-close run
a2a0: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 s:get-runs-by-pa
a2b0: 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 tt db keys runna
a2c0: 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 me)).. (header
a2d0: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e (vector-ref run
a2e0: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 dat 0)).. (runs
a2f0: 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 (vector-ref
a300: 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 rundat 1))).
a310: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
a320: 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20 28 a (run)...(let (
a330: 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d (run-id (db:get-
a340: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
a350: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 run header "id")
a360: 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20 6c ))... (if (or l
a370: 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75 6e ock.... (and un
a380: 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20 28 lock.... (
a390: 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69 6e begin..... (prin
a3a0: 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79 t "Do you really
a3b0: 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20 wish to unlock
a3c0: 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c run " run-id "?\
a3d0: 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09 n y/n: ").....
a3e0: 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72 65 (equal? "y" (re
a3f0: 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09 20 ad-line)))))...
a400: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
a410: 6c 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e 6c lose db:lock/unl
a420: 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 ock-run db run-i
a430: 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 d lock unlock us
a440: 65 72 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 er)... (deb
a450: 75 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f ug:print 0 "INFO
a460: 3a 20 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f : Skipping lock/
a470: 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d unlock on " run-
a480: 69 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75 id)))).. ru
a490: 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ns))).;;========
a4a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a4b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a4c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a4d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
a4e0: 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b ; Rollup runs.;;
a4f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a530: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 ======..;; Updat
a540: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 e the test_meta
a550: 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 table for this t
a560: 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e est.(define (run
a570: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 s:update-test_me
a580: 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 ta db test-name
a590: 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 test-conf). (le
a5a0: 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 t ((currrecord (
a5b0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
a5c0: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 b:testmeta-get-r
a5d0: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 ecord db test-na
a5e0: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e me))). (if (n
a5f0: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 ot currrecord)..
a600: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 (begin.. (set!
a610: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 currrecord (make
a620: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a -vector 10 #f)).
a630: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f . (open-run-clo
a640: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 se db:testmeta-a
a650: 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 dd-record db tes
a660: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66 t-name))). (f
a670: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
a680: 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20 ambda (key).
a690: 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28 (let* ((idx (
a6a0: 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20 cadr key))..
a6b0: 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79 (fld (car key
a6c0: 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28 )).. (val (
a6d0: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 config-lookup te
a6e0: 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 st-conf "test_me
a6f0: 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 ta" fld))).. ;;
a700: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 (debug:print 5 "
a710: 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64 idx: " idx " fld
a720: 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 : " fld " val: "
a730: 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 val).. (if (and
a740: 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c val (not (equal
a750: 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75 ? (vector-ref cu
a760: 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61 rrrecord idx) va
a770: 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69 l))).. (begi
a780: 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74 n.. (print
a790: 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73 "Updating " tes
a7a0: 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22 t-name " " fld "
a7b0: 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20 to " val)..
a7c0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
a7d0: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 se db:testmeta-u
a7e0: 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74 pdate-field db t
a7f0: 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c est-name fld val
a800: 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61 ))))). '(("a
a810: 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 uthor" 2)("owner
a820: 22 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f " 3)("descriptio
a830: 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22 n" 4)("reviewed"
a840: 20 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29 5)("tags" 9))))
a850: 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73 )..;; Update tes
a860: 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 t_meta for all t
a870: 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75 ests.(define (ru
a880: 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 ns:update-all-te
a890: 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c st_meta db). (l
a8a0: 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 et ((test-names
a8b0: 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 (get-all-legal-t
a8c0: 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72 ests))). (for
a8d0: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d -each . (lam
a8e0: 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a bda (test-name).
a8f0: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 (let* ((t
a900: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e est-path (con
a910: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 c *toppath* "/te
a920: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 sts/" test-name)
a930: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 ).. (test-c
a940: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 onfigf (conc tes
a950: 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e t-path "/testcon
a960: 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 74 fig")).. (t
a970: 65 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 estexists (and
a980: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 (file-exists? t
a990: 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c est-configf)(fil
a9a0: 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 e-read-access? t
a9b0: 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 est-configf)))..
a9c0: 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f ;; read co
a9d0: 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 63 6b nfigs with trick
a9e0: 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e s turned off (i.
a9f0: 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 e. no system)..
aa00: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 (test-conf
aa10: 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74 (if testexist
aa20: 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 s (read-config t
aa30: 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 est-configf #f #
aa40: 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 f)(make-hash-tab
aa50: 6c 65 29 29 29 29 0a 09 20 3b 3b 20 75 73 65 20 le)))).. ;; use
aa60: 74 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f the open-run-clo
aa70: 73 65 20 69 6e 73 74 65 61 64 20 6f 66 20 70 61 se instead of pa
aa80: 73 73 69 6e 67 20 69 6e 20 64 62 0a 09 20 28 72 ssing in db.. (r
aa90: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f uns:update-test_
aaa0: 6d 65 74 61 20 23 66 20 74 65 73 74 2d 6e 61 6d meta #f test-nam
aab0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 e test-conf))).
aac0: 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 test-names))
aad0: 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 )..;; This could
aae0: 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 probably be ref
aaf0: 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 actored into one
ab00: 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e complex query .
ab10: 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 ...(define (runs
ab20: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 73 :rollup-run keys
ab30: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 keyvallst runna
ab40: 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20 me user) ;; was
ab50: 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 target, now keyv
ab60: 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70 allst. (debug:p
ab70: 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c rint 4 "runs:rol
ab80: 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 lup-run, keys: "
ab90: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 keys " keyvalls
aba0: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 t: " keyvallst "
abb0: 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e :runname " runn
abc0: 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73 ame " user: " us
abd0: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 er). (let* ((db
abe0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 66 #f
abf0: 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 ) ;; (keyvalllst
ac00: 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67 (keys:targ
ac10: 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 et->keyval keys
ac20: 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d target)).. (new-
ac30: 72 75 6e 2d 69 64 20 20 20 20 20 20 28 6f 70 65 run-id (ope
ac40: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 n-run-close runs
ac50: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 :register-run db
ac60: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 keys keyvallst
ac70: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e runname "new" "n
ac80: 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 /a" user)).. (pr
ac90: 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f ev-tests (o
aca0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 pen-run-close te
acb0: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d st:get-matching-
acc0: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 previous-test-ru
acd0: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 n-records db new
ace0: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 -run-id "%" "%")
acf0: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 ).. (curr-tests
ad00: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
ad10: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 lose db:get-test
ad20: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 s-for-run db new
ad30: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 -run-id "%" "%"
ad40: 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 '() '())).. (cur
ad50: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 r-tests-hash (ma
ad60: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 ke-hash-table)))
ad70: 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 . (open-run-c
ad80: 6c 6f 73 65 20 64 62 3a 75 70 64 61 74 65 2d 72 lose db:update-r
ad90: 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 un-event_time db
ada0: 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 new-run-id).
adb0: 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c ;; index the al
adc0: 72 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74 ready saved test
add0: 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e s by testname an
ade0: 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 d itemdat in cur
adf0: 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 r-tests-hash.
ae00: 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 (for-each.
ae10: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 (lambda (testdat
ae20: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 ). (let* (
ae30: 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 (testname (db:t
ae40: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
ae50: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 testdat))..
ae60: 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 (item-path (db
ae70: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
ae80: 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 ath testdat))..
ae90: 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 (full-name
aea0: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 (conc testname "
aeb0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a /" item-path))).
aec0: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 . (hash-table-se
aed0: 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 t! curr-tests-ha
aee0: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 sh full-name tes
aef0: 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 tdat))). cur
af00: 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 r-tests). ;;
af10: 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 NOPE: Non-optima
af20: 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 l approach. Try
af30: 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 this instead..
af40: 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 ;; 1. tests
af50: 61 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 are received in
af60: 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 a list, most rec
af70: 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b ent first. ;;
af80: 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 2. replace th
af90: 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 e rollup test wi
afa0: 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 th the new *alwa
afb0: 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 ys*. (for-eac
afc0: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 h . (lambda
afd0: 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 (testdat).
afe0: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d (let* ((testnam
aff0: 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d e (db:test-get-
b000: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 testname testdat
b010: 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d )).. (item-
b020: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 path (db:test-ge
b030: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 t-item-path test
b040: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 dat)).. (fu
b050: 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 ll-name (conc te
b060: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d stname "/" item-
b070: 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 path)).. (p
b080: 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 rev-test-dat (ha
b090: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
b0a0: 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d ault curr-tests-
b0b0: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 hash full-name #
b0c0: 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 f)).. (test
b0d0: 2d 73 74 65 70 73 20 20 20 20 20 20 28 6f 70 65 -steps (ope
b0e0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 n-run-close db:g
b0f0: 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 et-steps-for-tes
b100: 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 t db (db:test-ge
b110: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a t-id testdat))).
b120: 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 . (new-test
b130: 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b -record #f)).. ;
b140: 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 ; replace these
b150: 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 with insert ...
b160: 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 select.. (apply
b170: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
b180: 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 ...db ...(conc "
b190: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 INSERT OR REPLAC
b1a0: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 E INTO tests (ru
b1b0: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 n_id,testname,st
b1c0: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 ate,status,event
b1d0: 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f _time,host,cpulo
b1e0: 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d ad,diskfree,unam
b1f0: 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 e,rundir,item_pa
b200: 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c th,run_duration,
b210: 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 final_logf,comme
b220: 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 nt) "... "V
b230: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f ALUES (?,?,?,?,?
b240: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
b250: 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e ,?);")...new-run
b260: 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 74 6f -id (cddr (vecto
b270: 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 r->list testdat)
b280: 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 )).. (set! new-t
b290: 65 73 74 64 61 74 20 28 63 61 72 20 28 6f 70 65 estdat (car (ope
b2a0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 n-run-close db:g
b2b0: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e et-tests-for-run
b2c0: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74 db new-run-id t
b2d0: 65 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 estname item-pat
b2e0: 68 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 28 h '() '()))).. (
b2f0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
b300: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 curr-tests-hash
b310: 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 full-name new-te
b320: 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 20 63 stdat) ;; this c
b330: 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 69 6e ould be confusin
b340: 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 64 20 g, which record
b350: 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 should go into t
b360: 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f he lookup table?
b370: 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 .. ;; Now duplic
b380: 61 74 65 20 74 68 65 20 74 65 73 74 20 73 74 65 ate the test ste
b390: 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e ps.. (debug:prin
b3a0: 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 t 4 "Copying rec
b3b0: 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 74 65 ords in test_ste
b3c0: 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d ps from test_id=
b3d0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
b3e0: 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 d testdat) " to
b3f0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
b400: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a d new-testdat)).
b410: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 . (open-run-clos
b420: 65 20 0a 09 20 20 28 6c 61 6d 62 64 61 20 28 29 e .. (lambda ()
b430: 0a 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 .. (sqlite3:e
b440: 78 65 63 75 74 65 20 0a 09 20 20 20 20 20 64 62 xecute .. db
b450: 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22 49 .. (conc "I
b460: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 NSERT OR REPLACE
b470: 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 73 INTO test_steps
b480: 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 (test_id,stepna
b490: 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c me,state,status,
b4a0: 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 event_time,comme
b4b0: 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c 45 nt) "... "SELE
b4c0: 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 CT " (db:test-ge
b4d0: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
b4e0: 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 ) ",stepname,sta
b4f0: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
b500: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f time,comment FRO
b510: 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 M test_steps WHE
b520: 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a RE test_id=?;").
b530: 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 . (db:test-g
b540: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a et-id testdat)).
b550: 09 20 20 20 20 3b 3b 20 4e 6f 77 20 64 75 70 6c . ;; Now dupl
b560: 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 64 icate the test d
b570: 61 74 61 0a 09 20 20 20 20 28 64 65 62 75 67 3a ata.. (debug:
b580: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 print 4 "Copying
b590: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 records in test
b5a0: 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f _data from test_
b5b0: 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 id=" (db:test-ge
b5c0: 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 t-id testdat) "
b5d0: 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 to " (db:test-ge
b5e0: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
b5f0: 29 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65 33 )).. (sqlite3
b600: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 20 20 :execute ..
b610: 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 db .. (conc
b620: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 "INSERT OR REPLA
b630: 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 CE INTO test_dat
b640: 61 20 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 a (test_id,categ
b650: 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c ory,variable,val
b660: 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c ue,expected,tol,
b670: 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 units,comment) "
b680: 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 ... "SELECT "
b690: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
b6a0: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 63 new-testdat) ",c
b6b0: 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 ategory,variable
b6c0: 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c ,value,expected,
b6d0: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e tol,units,commen
b6e0: 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 t FROM test_data
b6f0: 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f WHERE test_id=?
b700: 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74 65 ;").. (db:te
b710: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
b720: 74 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 t)))).. )).
b730: 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09 20 prev-tests)))..
b740: 0a 20 20 20 20 20 0a . .