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 20 44 45 4c 45 54 45 COMPLETED DELETE
7710: 44 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 D).. (let ((runf
7720: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f lag #f)).. (co
7730: 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 nd.. ;; -forc
7740: 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 e, run no matter
7750: 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 what.. (forc
7760: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 e (set! runflag
7770: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 #t)).. ;; NOT
7780: 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f _STARTED, run no
7790: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 matter what..
77a0: 20 20 28 28 6d 65 6d 62 65 72 20 28 74 65 73 74 ((member (test
77b0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
77c0: 61 74 29 20 27 28 22 44 45 4c 45 54 45 44 22 20 at) '("DELETED"
77d0: 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 29 28 "NOT_STARTED"))(
77e0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
77f0: 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 ).. ;; not -r
7800: 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 erun and PASS, W
7810: 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f ARN or CHECK, do
7820: 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 61 no run.. ((a
7830: 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 nd (or (not reru
7840: 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70 67 n)... keepg
7850: 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 oing)... ;; Req
7860: 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72 65 uire to force re
7870: 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 -run for COMPLET
7880: 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a ED or *anything*
7890: 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 + PASS,WARN or
78a0: 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d CHECK... (or (m
78b0: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d ember (test:get-
78c0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
78d0: 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 '("PASS" "WARN"
78e0: 22 43 48 45 43 4b 22 29 29 0a 09 09 20 20 20 20 "CHECK"))...
78f0: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a (member (test:
7900: 67 65 74 2d 73 74 61 74 65 20 20 74 65 73 74 64 get-state testd
7910: 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 at) '("COMPLETED
7920: 22 29 29 29 29 20 0a 09 20 20 20 20 20 28 64 65 ")))) .. (de
7930: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 bug:print 2 "INF
7940: 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 73 74 20 O: running test
7950: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 " test-name "/"
7960: 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70 70 item-path " supp
7970: 72 65 73 73 65 64 20 61 73 20 69 74 20 69 73 20 ressed as it is
7980: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
7990: 65 20 74 65 73 74 64 61 74 29 20 22 20 61 6e 64 e testdat) " and
79a0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
79b0: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 tus testdat))..
79c0: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 (set! runfla
79d0: 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d g #f)).. ;; -
79e0: 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 rerun and status
79f0: 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 is one of the s
7a00: 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a pecifed, run it.
7a10: 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e . ((and rerun
7a20: 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72 ... (let* ((rer
7a30: 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d unlst (string-
7a40: 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 split rerun ",")
7a50: 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75 ).... (must-reru
7a60: 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a n (member (test:
7a70: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
7a80: 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a at) rerunlst))).
7a90: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
7aa0: 6e 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 65 72 nt 3 "INFO: -rer
7ab0: 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e un list: " rerun
7ac0: 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a ", test-status:
7ad0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
7ae0: 74 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d tus testdat)", m
7af0: 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 ust-rerun: " mus
7b00: 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d t-rerun)... m
7b10: 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 ust-rerun))..
7b20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
7b30: 20 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 66 6f "INFO: Rerun fo
7b40: 72 63 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 rced for test "
7b50: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 test-name "/" it
7b60: 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 em-path).. (
7b70: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
7b80: 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 ).. ;; -keepg
7b90: 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 oing, do not rer
7ba0: 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 un FAIL.. ((a
7bb0: 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 nd keepgoing...
7bc0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
7bd0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
7be0: 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 t) '("FAIL")))..
7bf0: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c (set! runfl
7c00: 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 ag #f)).. ((a
7c10: 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 nd (not rerun)..
7c20: 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 . (member (test
7c30: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
7c40: 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e dat) '("FAIL" "n
7c50: 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 /a"))).. (se
7c60: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a t! runflag #t)).
7c70: 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 . (else (set!
7c80: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 runflag #f)))..
7c90: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
7ca0: 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6 "RUNNING => ru
7cb0: 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 nflag: " runflag
7cc0: 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 " STATE: " (tes
7cd0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
7ce0: 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 dat) " STATUS: "
7cf0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
7d00: 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 s testdat))..
7d10: 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 (if (not runflag
7d20: 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e ).. (if (n
7d30: 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a ot parent-test).
7d40: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e .. (debug:prin
7d50: 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 t 1 "NOTE: Not s
7d60: 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e tarting test " n
7d70: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 ew-test-name " a
7d80: 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 s it is state \"
7d90: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
7da0: 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 e testdat) .....
7db0: 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c "\" and status \
7dc0: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 "" (test:get-sta
7dd0: 74 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 tus testdat) "\"
7de0: 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 , use -rerun \""
7df0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
7e00: 73 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 s testdat).
7e10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7e20: 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f "\" o
7e30: 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 r -force to over
7e40: 72 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 ride"))..
7e50: 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 ;; NOTE: No long
7e60: 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 er be checking p
7e70: 72 65 72 65 71 75 69 73 69 74 65 73 20 68 65 72 rerequisites her
7e80: 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 e! Will never ge
7e90: 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 t here unless pr
7ea0: 65 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 ereqs are..
7eb0: 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 ;; alrea
7ec0: 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 dy met...
7ed0: 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 (if (not (launch
7ee0: 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 -test #f run-id
7ef0: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e runname test-con
7f00: 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 f keyvallst test
7f10: 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 -name test-path
7f20: 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a itemdat flags)).
7f30: 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 .. (begin...
7f40: 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 (print "ERROR
7f50: 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e : Failed to laun
7f60: 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 ch the test. Exi
7f70: 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 ting as soon as
7f80: 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 possible")...
7f90: 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 (set! *globale
7fa0: 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b xitstatus* 1) ;;
7fb0: 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 ... (proces
7fc0: 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e s-signal (curren
7fd0: 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 t-process-id) si
7fe0: 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a gnal/kill)))))).
7ff0: 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 .((KILLED) .. (d
8000: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f ebug:print 1 "NO
8010: 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e TE: " new-test-n
8020: 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 ame " is already
8030: 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 running or was
8040: 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 explictly killed
8050: 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 , use -force to
8060: 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 launch it."))..(
8070: 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 (LAUNCHED REMOTE
8080: 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e HOSTSTART RUNNIN
8090: 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d G) .. (if (> (-
80a0: 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 (current-second
80b0: 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 s)(+ (db:test-ge
80c0: 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 t-event_time tes
80d0: 74 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 tdat).....
80e0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 (db:test-get-ru
80f0: 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 n_duration testd
8100: 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 at)))...600) ;;
8110: 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 i.e. no update f
8120: 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 or more than 600
8130: 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 seconds.. (
8140: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 begin.. (d
8150: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
8160: 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 RNING: Test " te
8170: 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 st-name " appear
8180: 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f s to be dead. Fo
8190: 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 rcing it to stat
81a0: 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 e INCOMPLETE and
81b0: 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 status STUCK/DE
81c0: 41 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 AD").. (te
81d0: 73 74 73 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 sts:test-set-sta
81e0: 74 75 73 21 20 74 65 73 74 2d 69 64 20 22 49 4e tus! test-id "IN
81f0: 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b COMPLETE" "STUCK
8200: 2f 44 45 41 44 22 20 22 54 65 73 74 20 69 73 20 /DEAD" "Test is
8210: 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 stuck or dead" #
8220: 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 f)).. (debug
8230: 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 :print 2 "NOTE:
8240: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 " test-name " is
8250: 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 already running
8260: 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 ")))..(else
8270: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
8280: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 "ERROR: Failed
8290: 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 to launch test "
82a0: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 new-test-name "
82b0: 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 . Unrecognised s
82c0: 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 tate " (test:get
82d0: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 -state testdat))
82e0: 29 29 29 29 29 0a 0a 3b 3b 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 3d 3d 3d 3d 3d 3d ================
8320: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
8330: 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 ;; END OF NEW ST
8340: 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d UFF.;;==========
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 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 ============..(d
8390: 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 efine (get-dir-u
83a0: 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 p-n dir . params
83b0: 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 ) . (let ((dpar
83c0: 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ts (string-spli
83d0: 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f t dir "/"))..(co
83e0: 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f unt (if (null?
83f0: 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 params) 1 (car
8400: 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 params)))). (
8410: 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 conc "/" (string
8420: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 -intersperse ..
8430: 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 (take dpar
8440: 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 ts (- (length dp
8450: 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 arts) count))..
8460: 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b "/")))).;;
8470: 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 Remove runs.;;
8480: 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 fields are passi
8490: 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b ng in through .;
84a0: 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 ; action:.;;
84b0: 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 'remove-runs.;;
84c0: 20 20 20 27 73 65 74 2d 73 74 61 74 65 2d 73 74 'set-state-st
84d0: 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 atus.;;.;; NB//
84e0: 73 68 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 6b should pass in k
84f0: 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 eys?.;;.(define
8500: 28 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e (runs:operate-on
8510: 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 action runnamep
8520: 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 65 att testpatt ite
8530: 6d 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 61 mpatt #!key (sta
8540: 74 65 20 23 66 29 28 73 74 61 74 75 73 20 23 66 te #f)(status #f
8550: 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 )(new-state-stat
8560: 75 73 20 23 66 29 29 0a 20 20 28 6c 65 74 2a 20 us #f)). (let*
8570: 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23 ((db #
8580: 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20 f).. (keys
8590: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
85a0: 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 se db:get-keys d
85b0: 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 b)).. (rundat
85c0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
85d0: 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e ose runs:get-run
85e0: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 s-by-patt db key
85f0: 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a s runnamepatt)).
8600: 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20 20 . (header
8610: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
8620: 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 at 0)).. (runs
8630: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 (vector-r
8640: 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 ef rundat 1))..
8650: 28 73 74 61 74 65 73 20 20 20 20 20 20 20 28 69 (states (i
8660: 66 20 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 f state (string
8670: 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c -split state ",
8680: 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 ") '())).. (stat
8690: 75 73 65 73 20 20 20 20 20 28 69 66 20 73 74 61 uses (if sta
86a0: 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 tus (string-spli
86b0: 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 t status ",") '(
86c0: 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 ))).. (state-sta
86d0: 74 75 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f tus (if (string?
86e0: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 new-state-statu
86f0: 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 s) (string-split
8700: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 new-state-statu
8710: 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 s ",") '(#f #f))
8720: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
8730: 69 6e 74 20 32 20 22 48 65 61 64 65 72 3a 20 22 int 2 "Header: "
8740: 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e header " action
8750: 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 : " action " new
8760: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 -state-status: "
8770: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 new-state-statu
8780: 73 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 s). (for-each
8790: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 . (lambda (r
87a0: 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 un). (let
87b0: 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 ((runkey (string
87c0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 -intersperse (ma
87d0: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 p (lambda (k)...
87e0: 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 ....(db:get-valu
87f0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
8800: 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 header (vector-r
8810: 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 ef k 0))) keys)
8820: 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 "/")).. (dir
8830: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b s-to-remove (mak
8840: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
8850: 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 . (let* ((run-id
8860: 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 (db:get-valu
8870: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
8880: 68 65 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 header "id"))...
8890: 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 (run-state (db:g
88a0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
88b0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 er run header "s
88c0: 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 tate"))...(tests
88d0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 (if (not (e
88e0: 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 qual? run-state
88f0: 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 "locked"))....
8900: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
8910: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 lose db:get-test
8920: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 s-for-run db (db
8930: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
8940: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
8950: 22 69 64 22 29 0a 09 09 09 09 09 09 20 20 20 20 "id").......
8960: 20 20 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 testpatt itemp
8970: 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74 75 att states statu
8980: 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 20 20 ses.......
8990: 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09 not-in: #f.....
89a0: 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 79 3a .. sort-by:
89b0: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 (case action...
89c0: 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 65 2d ...... ((remove-
89d0: 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 0a 09 runs) 'rundir)..
89e0: 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 20 20 ....... (else
89f0: 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 74 69 'event_ti
8a00: 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 me)))....
8a10: 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61 '()))...(lasttpa
8a20: 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 th "/does/not/ex
8a30: 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09 ist/I/hope"))...
8a40: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c (if (not (nul
8a50: 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20 l? tests))..
8a60: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 61 (begin... (ca
8a70: 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 28 se action... (
8a80: 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 (remove-runs)...
8a90: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
8aa0: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 1 "Removing tes
8ab0: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 ts for run: " ru
8ac0: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 nkey " " (db:get
8ad0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
8ae0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e run header "run
8af0: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28 name")))... ((
8b00: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 set-state-status
8b10: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
8b20: 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 6e rint 1 "Modifyin
8b30: 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 75 g state and stau
8b40: 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 20 s for tests for
8b50: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 run: " runkey "
8b60: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d " (db:get-value-
8b70: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
8b80: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 ader "runname"))
8b90: 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09 20 )... (else...
8ba0: 20 20 20 28 70 72 69 6e 74 20 22 49 4e 46 4f 3a (print "INFO:
8bb0: 20 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f action not reco
8bc0: 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e 29 gnised " action)
8bd0: 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a ))... (for-each.
8be0: 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 .. (lambda (tes
8bf0: 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 t)... (let* (
8c00: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 (item-path (db:t
8c10: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 est-get-item-pat
8c20: 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 h test)).... (
8c30: 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 test-name (db:te
8c40: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
8c50: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75 test)).... (ru
8c60: 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74 n-dir (db:test
8c70: 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74 -get-rundir test
8c80: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 69 )).... (test-i
8c90: 64 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 d (db:test-get
8ca0: 2d 69 64 20 74 65 73 74 29 29 29 0a 09 09 20 20 -id test)))...
8cb0: 20 20 20 20 3b 3b 20 20 20 28 74 64 62 20 20 20 ;; (tdb
8cc0: 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73 (db:open-tes
8cd0: 74 2d 64 62 20 72 75 6e 2d 64 69 72 29 29 29 0a t-db run-dir))).
8ce0: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
8cf0: 72 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a rint 1 " " (db:
8d00: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
8d10: 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 e test) " id: "
8d20: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
8d30: 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 test) " " item-p
8d40: 61 74 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 ath " action: "
8d50: 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 action)...
8d60: 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 (case action....
8d70: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 3b ((remove-runs) ;
8d80: 3b 20 74 68 65 20 74 64 62 20 69 73 20 66 6f 72 ; the tdb is for
8d90: 20 66 75 74 75 72 65 20 70 6f 73 73 69 62 6c 65 future possible
8da0: 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e . .... (open-run
8db0: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 -close db:delete
8dc0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 -test-records db
8dd0: 20 23 66 20 28 64 62 3a 74 65 73 74 2d 67 65 74 #f (db:test-get
8de0: 2d 69 64 20 74 65 73 74 29 29 0a 09 09 09 20 28 -id test)).... (
8df0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 debug:print 1 "I
8e00: 4e 46 4f 3a 20 41 74 74 65 6d 70 74 69 6e 67 20 NFO: Attempting
8e10: 74 6f 20 72 65 6d 6f 76 65 20 64 69 72 20 22 20 to remove dir "
8e20: 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 66 run-dir).... (if
8e30: 20 28 61 6e 64 20 28 3e 20 28 73 74 72 69 6e 67 (and (> (string
8e40: 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 -length run-dir)
8e50: 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65 2d 5)..... (file-
8e60: 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 exists? run-dir)
8e70: 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 ) ;; bad heurist
8e80: 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 ic but should pr
8e90: 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 event /tmp /home
8ea0: 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28 6c etc..... (l
8eb0: 65 74 2a 20 28 28 72 65 61 6c 70 61 74 68 20 28 et* ((realpath (
8ec0: 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 resolve-pathname
8ed0: 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 run-dir)))....
8ee0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
8ef0: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 52 65 61 6c nt 1 "INFO: Real
8f00: 20 70 61 74 68 20 6f 66 20 69 73 20 22 20 72 65 path of is " re
8f10: 61 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 20 alpath)....
8f20: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 (if (file-exis
8f30: 74 73 3f 20 72 65 61 6c 70 61 74 68 29 0a 09 09 ts? realpath)...
8f40: 09 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 73 .. (if (> (sys
8f50: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 tem (conc "rm -r
8f60: 66 20 22 20 72 65 61 6c 70 61 74 68 29 29 20 30 f " realpath)) 0
8f70: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 )..... (de
8f80: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
8f90: 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 20 OR: There was a
8fa0: 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 problem removing
8fb0: 20 22 20 72 65 61 6c 70 61 74 68 20 22 20 77 69 " realpath " wi
8fc0: 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09 th rm -f")).....
8fd0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8fe0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74 0 "WARNING: test
8ff0: 20 72 75 6e 20 64 69 72 20 22 20 72 65 61 6c 70 run dir " realp
9000: 61 74 68 20 22 20 61 70 70 65 61 72 73 20 74 6f ath " appears to
9010: 20 6e 6f 74 20 65 78 69 73 74 22 29 29 0a 09 09 not exist"))...
9020: 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69 6c . (if (fil
9030: 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 e-exists? run-di
9040: 72 29 20 3b 3b 20 74 68 65 20 6c 69 6e 6b 0a 09 r) ;; the link..
9050: 09 09 09 20 20 20 28 69 66 20 28 73 79 6d 62 6f ... (if (symbo
9060: 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 lic-link? run-di
9070: 72 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 r)..... (d
9080: 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64 elete-file run-d
9090: 69 72 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 ir)..... (
90a0: 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72 if (directory? r
90b0: 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 20 un-dir)......
90c0: 28 69 66 20 28 3e 20 28 64 69 72 65 63 74 6f 72 (if (> (director
90d0: 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 y-fold (lambda (
90e0: 66 20 78 29 28 2b 20 31 20 78 29 29 20 30 20 72 f x)(+ 1 x)) 0 r
90f0: 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 09 09 09 un-dir) 0)......
9100: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
9110: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
9120: 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f refusing to remo
9130: 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 ve " run-dir " a
9140: 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 74 s it is not empt
9150: 79 22 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 y")......
9160: 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f 72 (delete-director
9170: 79 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 69 y run-dir)) ;; i
9180: 74 20 73 68 6f 75 6c 64 20 62 65 20 65 6d 70 74 t should be empt
9190: 79 20 62 79 20 68 65 72 65 20 42 55 47 20 42 55 y by here BUG BU
91a0: 47 2c 20 61 64 64 20 65 72 72 6f 72 20 63 61 74 G, add error cat
91b0: 63 68 0a 09 09 09 09 09 20 20 20 28 64 65 62 75 ch...... (debu
91c0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
91d0: 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 : refusing to re
91e0: 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 move " run-dir "
91f0: 20 61 73 20 69 74 20 69 73 20 6e 65 69 74 68 65 as it is neithe
9200: 72 20 61 20 73 79 6d 6c 69 6e 6b 20 6e 6f 72 20 r a symlink nor
9210: 61 20 64 69 72 65 63 74 6f 72 79 22 29 0a 09 09 a directory")...
9220: 09 09 09 20 20 20 29 29 29 29 0a 09 09 09 20 20 ... ))))....
9230: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
9240: 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 0 "WARNING: dire
9250: 63 74 6f 72 79 20 61 6c 72 65 61 64 79 20 72 65 ctory already re
9260: 6d 6f 76 65 64 20 22 20 72 75 6e 2d 64 69 72 29 moved " run-dir)
9270: 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74 ))....((set-stat
9280: 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 64 e-status).... (d
9290: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e ebug:print 2 "IN
92a0: 46 4f 3a 20 6e 65 77 20 73 74 61 74 65 20 22 20 FO: new state "
92b0: 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 (car state-statu
92c0: 73 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 s) ", new status
92d0: 20 22 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 " (cadr state-s
92e0: 74 61 74 75 73 29 29 0a 09 09 09 20 28 6f 70 65 tatus)).... (ope
92f0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 n-run-close db:t
9300: 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 est-set-state-st
9310: 61 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64 atus-by-id db (d
9320: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
9330: 73 74 29 20 28 63 61 72 20 73 74 61 74 65 2d 73 st) (car state-s
9340: 74 61 74 75 73 29 28 63 61 64 72 20 73 74 61 74 tatus)(cadr stat
9350: 65 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 29 e-status) #f))))
9360: 29 0a 09 09 20 20 74 65 73 74 73 29 29 29 0a 09 )... tests)))..
9370: 20 20 20 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 .. ;; remov
9380: 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 e the run if zer
9390: 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 o tests remain..
93a0: 20 20 20 28 69 66 20 28 65 71 3f 20 61 63 74 69 (if (eq? acti
93b0: 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 29 on 'remove-runs)
93c0: 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 .. (let ((
93d0: 72 65 6d 74 65 73 74 73 20 28 6f 70 65 6e 2d 72 remtests (open-r
93e0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
93f0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
9400: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
9410: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
9420: 64 65 72 20 22 69 64 22 29 20 23 66 20 23 66 20 der "id") #f #f
9430: 27 28 22 44 45 4c 45 54 45 44 22 29 20 27 28 22 '("DELETED") '("
9440: 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23 74 n/a") not-in: #t
9450: 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c )))... (if (null
9460: 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e ? remtests) ;; n
9470: 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d o more tests rem
9480: 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c aining... (l
9490: 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 et* ((dparts (s
94a0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 tring-split last
94b0: 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20 tpath "/"))....
94c0: 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e (runpath (con
94d0: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e c "/" (string-in
94e0: 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 tersperse ......
94f0: 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d .(take dparts (-
9500: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 (length dparts)
9510: 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29 1))......."/"))
9520: 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 ))... (deb
9530: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
9540: 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b ving run: " runk
9550: 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 ey " " (db:get-v
9560: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
9570: 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 un header "runna
9580: 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61 74 me") " and relat
9590: 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20 20 ed record")...
95a0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
95b0: 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 72 lose db:delete-r
95c0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 un db run-id)...
95d0: 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20 69 ;; This i
95e0: 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64 20 s a pretty good
95f0: 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20 6f place to purge o
9600: 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73 74 73 ld DELETED tests
9610: 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d ... (open-
9620: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c run-close db:del
9630: 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 ete-tests-for-ru
9640: 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 n db run-id)...
9650: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
9660: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d close db:delete-
9670: 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73 74 old-deleted-test
9680: 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09 20 -records db)...
9690: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
96a0: 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61 72 close db:set-var
96b0: 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45 53 db "DELETED_TES
96c0: 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65 63 TS" (current-sec
96d0: 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20 20 onds))...
96e0: 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 ;; need to figur
96f0: 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 e out the path t
9700: 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e o the run dir an
9710: 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 d remove it if e
9720: 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b mpty... ;;
9730: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 (if (null? (
9740: 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 glob (conc runpa
9750: 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 th "/*")))...
9760: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 ;; (b
9770: 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b egin... ;;
9780: 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
9790: 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 1 "Removing run
97a0: 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 dir " runpath)..
97b0: 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79 . ;; . (sy
97c0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 stem (conc "rmdi
97d0: 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 r -p " runpath))
97e0: 29 29 0a 09 09 20 20 20 20 20 20 20 29 29 29 29 ))... ))))
97f0: 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 ).. )). runs
9800: 29 29 29 0a 0a 3b 3b 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 3d 3d 3d 3d 3d 3d 3d 3d ================
9840: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
9850: 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 Routines for ma
9860: 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a nipulating runs.
9870: 3b 3b 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 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
98b0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e ========..;; Sin
98c0: 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f ce many calls to
98d0: 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 70 a run require p
98e0: 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 73 retty much the s
98f0: 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 ame setup .;; th
9900: 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75 73 is wrapper is us
9910: 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 65 ed to reduce the
9920: 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 replication of
9930: 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65 code.(define (ge
9940: 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 neral-run-call s
9950: 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e witchname action
9960: 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 6c -desc proc). (l
9970: 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 72 et ((runname (ar
9980: 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e gs:get-arg ":run
9990: 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65 74 name"))..(target
99a0: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d (if (args:get-
99b0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 arg "-target")..
99c0: 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d . (args:get-
99d0: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 arg "-target")..
99e0: 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d . (args:get-
99f0: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 29 arg "-reqtarg"))
9a00: 29 0a 09 28 74 68 31 20 20 20 20 20 23 66 29 29 )..(th1 #f))
9a10: 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 . (cond.
9a20: 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 20 ((not target).
9a30: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
9a40: 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 0 "ERROR: Missi
9a50: 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 ng required para
9a60: 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 meter for " swit
9a70: 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 chname ", you mu
9a80: 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 74 st specify the t
9a90: 61 72 67 65 74 20 77 69 74 68 20 2d 74 61 72 67 arget with -targ
9aa0: 65 74 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 et"). (exit
9ab0: 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 20 3)). ((not
9ac0: 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 28 runname). (
9ad0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
9ae0: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 RROR: Missing re
9af0: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 quired parameter
9b00: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d for " switchnam
9b10: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 e ", you must sp
9b20: 65 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e 61 ecify the run na
9b30: 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65 me with :runname
9b40: 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20 runname").
9b50: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 (exit 3)).
9b60: 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 74 (else. (let
9b70: 20 28 28 64 62 20 20 20 23 66 29 0a 09 20 20 20 ((db #f)..
9b80: 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28 69 66 (keys #f))..(if
9b90: 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 (not (setup-for
9ba0: 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67 -run)).. (beg
9bb0: 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 75 in .. (debu
9bc0: 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65 g:print 0 "Faile
9bd0: 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74 d to setup, exit
9be0: 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65 78 ing").. (ex
9bf0: 69 74 20 31 29 29 29 0a 09 28 69 66 20 28 61 72 it 1)))..(if (ar
9c00: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 gs:get-arg "-ser
9c10: 76 65 72 22 29 0a 09 20 20 20 20 28 6f 70 65 6e ver").. (open
9c20: 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 72 76 65 -run-close serve
9c30: 72 3a 73 74 61 72 74 20 64 62 20 28 61 72 67 73 r:start db (args
9c40: 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 :get-arg "-serve
9c50: 72 22 29 29 0a 20 09 20 20 20 20 28 69 66 20 28 r")). . (if (
9c60: 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65 not (or (args:ge
9c70: 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 t-arg "-runall")
9c80: 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 61 ;; runall a
9c90: 6e 64 20 72 75 6e 74 65 73 74 73 20 61 72 65 20 nd runtests are
9ca0: 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 73 65 allowed to be se
9cb0: 72 76 65 72 73 0a 20 09 09 09 20 28 61 72 67 73 rvers. ... (args
9cc0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 :get-arg "-runte
9cd0: 73 74 73 22 29 29 29 0a 09 09 28 73 65 72 76 65 sts")))...(serve
9ce0: 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70 29 29 r:client-setup))
9cf0: 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f )..(set! keys (o
9d00: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
9d10: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 :get-keys db))..
9d20: 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 ;; have enough t
9d30: 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 o process -targe
9d40: 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 t or -reqtarg he
9d50: 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 re..(if (args:ge
9d60: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
9d70: 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 ).. (let* ((r
9d80: 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 unconfigf (conc
9d90: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e *toppath* "/run
9da0: 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 configs.config")
9db0: 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c ) ;; DO NOT EVAL
9dc0: 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 UATE ALL ... (
9dd0: 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 runconfig (read
9de0: 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 -config runconfi
9df0: 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e gf #f #f environ
9e00: 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 -patt: #f))) ..
9e10: 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 (if (hash-t
9e20: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
9e30: 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 runconfig (args
9e40: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
9e50: 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 rg") #f)... (ke
9e60: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 ys:target-set-ar
9e70: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 gs keys (args:ge
9e80: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
9e90: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 ) args:arg-hash)
9ea0: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 ... (begin...
9eb0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
9ec0: 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 "ERROR: [" (arg
9ed0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
9ee0: 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 arg") "] not fou
9ef0: 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 nd in " runconfi
9f00: 67 66 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 gf)... (if db
9f10: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 (sqlite3:finali
9f20: 7a 65 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 ze! db))... (
9f30: 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 exit 1))))..
9f40: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (if (args:get-ar
9f50: 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 g "-target")...(
9f60: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d keys:target-set-
9f70: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a args keys (args:
9f80: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 get-arg "-target
9f90: 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 " args:arg-hash)
9fa0: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 args:arg-hash))
9fb0: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 )..(if (not (car
9fc0: 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a *configinfo*)).
9fd0: 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 . (begin..
9fe0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
9ff0: 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 0 "ERROR: Attemp
a000: 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d ted to " action-
a010: 64 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 desc " but run a
a020: 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 rea config file
a030: 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 not found")..
a040: 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 (exit 1))..
a050: 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 ;; Extract out
a060: 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e stuff needed in
a070: 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 most or many ca
a080: 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 lls.. ;; here
a090: 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a then call proc.
a0a0: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 . (let* ((key
a0b0: 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 names (map key
a0c0: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b :get-fieldname k
a0d0: 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 eys))... (keyv
a0e0: 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 allst (keys->va
a0f0: 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 llist keys #t)))
a100: 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 .. (proc ta
a110: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 rget runname key
a120: 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 s keynames keyva
a130: 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 llst)))..(if th1
a140: 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 (thread-join! t
a150: 68 31 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 h1))..(if db (sq
a160: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 lite3:finalize!
a170: 64 62 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 db))..(set! *did
a180: 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 something* #t)))
a190: 29 29 29 0a 0a 3b 3b 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 3d 3d 3d 3d 3d 3d 3d 3d ================
a1d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
a1e0: 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e Lock/unlock run
a1f0: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d s.;;============
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a230: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 ==========..(def
a240: 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 ine (runs:handle
a250: 2d 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 -locking target
a260: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 keys runname loc
a270: 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 k unlock user).
a280: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 (let* ((db
a290: 20 20 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 #f).. (rundat
a2a0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
a2b0: 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d e runs:get-runs-
a2c0: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 by-patt db keys
a2d0: 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 runname)).. (hea
a2e0: 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 der (vector-re
a2f0: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 f rundat 0)).. (
a300: 72 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 runs (vector
a310: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 -ref rundat 1)))
a320: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 . (for-each (
a330: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 lambda (run)...(
a340: 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 let ((run-id (db
a350: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
a360: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
a370: 22 69 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 "id")))... (if
a380: 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 (or lock.... (a
a390: 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 nd unlock....
a3a0: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 (begin.....
a3b0: 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 (print "Do you r
a3c0: 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e eally wish to un
a3d0: 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 lock run " run-i
a3e0: 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 d "?\n y/n: ")
a3f0: 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 ..... (equal? "y
a400: 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 " (read-line))))
a410: 29 0a 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d )... (open-
a420: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 run-close db:loc
a430: 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 k/unlock-run db
a440: 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f run-id lock unlo
a450: 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 ck user)...
a460: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
a470: 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 "INFO: Skipping
a480: 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 lock/unlock on "
a490: 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 run-id))))..
a4a0: 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d runs))).;;===
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 3d 3d ================
a4e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a4f0: 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 ===.;; Rollup ru
a500: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ns.;;===========
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 ===========..;;
a550: 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f Update the test_
a560: 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 meta table for t
a570: 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 his test.(define
a580: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 (runs:update-te
a590: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d st_meta db test-
a5a0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a name test-conf).
a5b0: 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 (let ((currrec
a5c0: 6f 72 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c ord (open-run-cl
a5d0: 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d ose db:testmeta-
a5e0: 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 get-record db te
a5f0: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 st-name))). (
a600: 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f if (not currreco
a610: 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 rd)..(begin.. (
a620: 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 set! currrecord
a630: 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 (make-vector 10
a640: 23 66 29 29 0a 09 20 20 28 6f 70 65 6e 2d 72 75 #f)).. (open-ru
a650: 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d n-close db:testm
a660: 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 eta-add-record d
a670: 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 b test-name))).
a680: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 (for-each .
a690: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 (lambda (key)
a6a0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 . (let* ((
a6b0: 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a idx (cadr key)).
a6c0: 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 . (fld (car
a6d0: 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 key)).. (
a6e0: 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b val (config-look
a6f0: 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 up test-conf "te
a700: 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a st_meta" fld))).
a710: 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e . ;; (debug:prin
a720: 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 t 5 "idx: " idx
a730: 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 " fld: " fld " v
a740: 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 al: " val).. (if
a750: 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 (and val (not (
a760: 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 equal? (vector-r
a770: 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 ef currrecord id
a780: 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 x) val)))..
a790: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 (begin.. (
a7a0: 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 print "Updating
a7b0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 " test-name " "
a7c0: 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a fld " to " val).
a7d0: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 . (open-ru
a7e0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d n-close db:testm
a7f0: 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 eta-update-field
a800: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c db test-name fl
a810: 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 d val))))).
a820: 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 '(("author" 2)("
a830: 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 owner" 3)("descr
a840: 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 iption" 4)("revi
a850: 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 ewed" 5)("tags"
a860: 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 9)))))..;; Updat
a870: 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 e test_meta for
a880: 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e all tests.(defin
a890: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 e (runs:update-a
a8a0: 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 ll-test_meta db)
a8b0: 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e . (let ((test-n
a8c0: 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 ames (get-all-le
a8d0: 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 gal-tests))).
a8e0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
a8f0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e (lambda (test-n
a900: 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 ame). (let
a910: 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 * ((test-path
a920: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
a930: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d "/tests/" test-
a940: 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 name)).. (t
a950: 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e est-configf (con
a960: 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 c test-path "/te
a970: 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 stconfig"))..
a980: 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 (testexists
a990: 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 (and (file-exis
a9a0: 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 ts? test-configf
a9b0: 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 )(file-read-acce
a9c0: 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 ss? test-configf
a9d0: 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 ))).. ;; re
a9e0: 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 ad configs with
a9f0: 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 tricks turned of
aa00: 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 f (i.e. no syste
aa10: 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d m).. (test-
aa20: 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 conf (if test
aa30: 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e exists (read-con
aa40: 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 fig test-configf
aa50: 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 #f #f)(make-has
aa60: 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b h-table)))).. ;;
aa70: 20 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 use the open-ru
aa80: 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 n-close instead
aa90: 6f 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62 of passing in db
aaa0: 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d .. (runs:update-
aab0: 74 65 73 74 5f 6d 65 74 61 20 23 66 20 74 65 73 test_meta #f tes
aac0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 t-name test-conf
aad0: 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 ))). test-na
aae0: 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 mes)))..;; This
aaf0: 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 could probably b
ab00: 65 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 e refactored int
ab10: 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 o one complex qu
ab20: 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 ery ....(define
ab30: 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e (runs:rollup-run
ab40: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 keys keyvallst
ab50: 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b runname user) ;;
ab60: 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 was target, now
ab70: 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 keyvallst. (de
ab80: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e bug:print 4 "run
ab90: 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 s:rollup-run, ke
aba0: 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 ys: " keys " key
abb0: 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c vallst: " keyval
abc0: 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 lst " :runname "
abd0: 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a runname " user:
abe0: 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a " user). (let*
abf0: 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20 ((db
ac00: 20 20 20 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 #f) ;; (keyva
ac10: 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 lllst (keys
ac20: 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 :target->keyval
ac30: 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 keys target))..
ac40: 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 (new-run-id
ac50: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
ac60: 20 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 runs:register-r
ac70: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 un db keys keyva
ac80: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 llst runname "ne
ac90: 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a w" "n/a" user)).
aca0: 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 . (prev-tests
acb0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
acc0: 73 65 20 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 se test:get-matc
acd0: 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 hing-previous-te
ace0: 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 st-run-records d
acf0: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 b new-run-id "%"
ad00: 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 "%")).. (curr-t
ad10: 65 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d ests (open-
ad20: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 run-close db:get
ad30: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 -tests-for-run d
ad40: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 b new-run-id "%"
ad50: 20 22 25 22 20 27 28 29 20 27 28 29 29 29 0a 09 "%" '() '()))..
ad60: 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 (curr-tests-has
ad70: 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 h (make-hash-tab
ad80: 6c 65 29 29 29 0a 20 20 20 20 28 6f 70 65 6e 2d le))). (open-
ad90: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75 70 64 run-close db:upd
ada0: 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 ate-run-event_ti
adb0: 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 me db new-run-id
adc0: 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 ). ;; index t
add0: 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65 64 he already saved
ade0: 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e 61 tests by testna
adf0: 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20 69 me and itemdat i
ae00: 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 n curr-tests-has
ae10: 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a h. (for-each.
ae20: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 (lambda (te
ae30: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c stdat). (l
ae40: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 et* ((testname
ae50: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
ae60: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a tname testdat)).
ae70: 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 . (item-pat
ae80: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 h (db:test-get-i
ae90: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 tem-path testdat
aea0: 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d )).. (full-
aeb0: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e name (conc testn
aec0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
aed0: 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 h))).. (hash-tab
aee0: 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 le-set! curr-tes
aef0: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d ts-hash full-nam
af00: 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20 20 e testdat))).
af10: 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20 20 curr-tests).
af20: 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f ;; NOPE: Non-o
af30: 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e ptimal approach.
af40: 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65 61 Try this instea
af50: 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 d.. ;; 1. t
af60: 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76 65 ests are receive
af70: 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 d in a list, mos
af80: 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a 20 t recent first.
af90: 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 ;; 2. repla
afa0: 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 ce the rollup te
afb0: 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 20 st with the new
afc0: 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 6f *always*. (fo
afd0: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 r-each . (la
afe0: 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 mbda (testdat).
aff0: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 (let* ((te
b000: 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 stname (db:test
b010: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
b020: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
b030: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 item-path (db:te
b040: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
b050: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 testdat))..
b060: 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f (full-name (co
b070: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 nc testname "/"
b080: 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 item-path))..
b090: 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64 61 (prev-test-da
b0a0: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 t (hash-table-re
b0b0: 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d 74 f/default curr-t
b0c0: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e ests-hash full-n
b0d0: 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20 20 ame #f))..
b0e0: 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20 20 (test-steps
b0f0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
b100: 20 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f db:get-steps-fo
b110: 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74 65 r-test db (db:te
b120: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
b130: 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65 77 t))).. (new
b140: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 -test-record #f)
b150: 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 ).. ;; replace t
b160: 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 72 74 hese with insert
b170: 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 ... select.. (a
b180: 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 pply sqlite3:exe
b190: 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28 63 cute ...db ...(c
b1a0: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 onc "INSERT OR R
b1b0: 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 EPLACE INTO test
b1c0: 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 s (run_id,testna
b1d0: 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c me,state,status,
b1e0: 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c event_time,host,
b1f0: 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 cpuload,diskfree
b200: 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 ,uname,rundir,it
b210: 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 em_path,run_dura
b220: 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c tion,final_logf,
b230: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 comment) "...
b240: 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c "VALUES (?,?,
b250: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
b260: 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 ?,?,?,?);")...ne
b270: 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 w-run-id (cddr (
b280: 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 vector->list tes
b290: 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 tdat))).. (set!
b2a0: 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 new-testdat (car
b2b0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
b2c0: 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f db:get-tests-fo
b2d0: 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e r-run db new-run
b2e0: 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 -id testname ite
b2f0: 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 29 m-path '() '()))
b300: 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d ).. (hash-table-
b310: 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d set! curr-tests-
b320: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e hash full-name n
b330: 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 ew-testdat) ;; t
b340: 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e his could be con
b350: 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 fusing, which re
b360: 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 cord should go i
b370: 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 nto the lookup t
b380: 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 able?.. ;; Now d
b390: 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 uplicate the tes
b3a0: 74 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 t steps.. (debug
b3b0: 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e :print 4 "Copyin
b3c0: 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 g records in tes
b3d0: 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 t_steps from tes
b3e0: 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d t_id=" (db:test-
b3f0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 get-id testdat)
b400: 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d " to " (db:test-
b410: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 get-id new-testd
b420: 61 74 29 29 0a 09 20 28 6f 70 65 6e 2d 72 75 6e at)).. (open-run
b430: 2d 63 6c 6f 73 65 20 0a 09 20 20 28 6c 61 6d 62 -close .. (lamb
b440: 64 61 20 28 29 0a 09 20 20 20 20 28 73 71 6c 69 da ().. (sqli
b450: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 te3:execute ..
b460: 20 20 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f db .. (co
b470: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 nc "INSERT OR RE
b480: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f PLACE INTO test_
b490: 73 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 steps (test_id,s
b4a0: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 tepname,state,st
b4b0: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c atus,event_time,
b4c0: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 comment) "...
b4d0: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 "SELECT " (db:te
b4e0: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
b4f0: 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d stdat) ",stepnam
b500: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 e,state,status,e
b510: 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e vent_time,commen
b520: 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 t FROM test_step
b530: 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d s WHERE test_id=
b540: 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74 ?;").. (db:t
b550: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
b560: 61 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 at)).. ;; Now
b570: 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 duplicate the t
b580: 65 73 74 20 64 61 74 61 0a 09 20 20 20 20 28 64 est data.. (d
b590: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f ebug:print 4 "Co
b5a0: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e pying records in
b5b0: 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 test_data from
b5c0: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 test_id=" (db:te
b5d0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
b5e0: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 t) " to " (db:te
b5f0: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
b600: 73 74 64 61 74 29 29 0a 09 20 20 20 20 28 73 71 stdat)).. (sq
b610: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 lite3:execute ..
b620: 20 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 28 db .. (
b630: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 conc "INSERT OR
b640: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 REPLACE INTO tes
b650: 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c t_data (test_id,
b660: 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c category,variabl
b670: 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 e,value,expected
b680: 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 ,tol,units,comme
b690: 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c 45 nt) "... "SELE
b6a0: 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 CT " (db:test-ge
b6b0: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
b6c0: 29 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 ) ",category,var
b6d0: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 iable,value,expe
b6e0: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 cted,tol,units,c
b6f0: 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 omment FROM test
b700: 5f 64 61 74 61 20 57 48 45 52 45 20 74 65 73 74 _data WHERE test
b710: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 _id=?;").. (
b720: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
b730: 65 73 74 64 61 74 29 29 29 29 0a 09 20 29 29 0a estdat)))).. )).
b740: 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 prev-tests)
b750: 29 29 0a 09 20 0a 20 20 20 20 20 0a )).. . .