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 63 rent-jobs (c
0fb0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f onfig-lookup *co
0fc0: 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 nfigdat* "setup"
0fd0: 20 20 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 "max_concur
0fe0: 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 20 28 rent_jobs")).. (
0ff0: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 job-group-limit
1000: 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d (config-
1010: 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 lookup *configda
1020: 74 2a 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a t* "jobgroups" j
1030: 6f 62 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 obgroup))). (
1040: 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61 if (not (eq? *la
1050: 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 st-num-running-t
1060: 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e ests* num-runnin
1070: 67 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 g))..(begin.. (
1080: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d debug:print 2 "m
1090: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
10a0: 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 bs: " max-concur
10b0: 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d rent-jobs ", num
10c0: 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d -running: " num-
10d0: 72 75 6e 6e 69 6e 67 29 0a 09 20 20 28 73 65 74 running).. (set
10e0: 21 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e ! *last-num-runn
10f0: 69 6e 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72 ing-tests* num-r
1100: 75 6e 6e 69 6e 67 29 29 29 0a 20 20 20 20 28 69 unning))). (i
1110: 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 f (not (eq? 0 *g
1120: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a lobalexitstatus*
1130: 29 29 0a 09 23 66 0a 09 28 6c 65 74 20 28 28 63 ))..#f..(let ((c
1140: 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 an-not-run-more
1150: 28 63 6f 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 (cond..... ;; if
1160: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
1170: 6a 6f 62 73 20 69 73 20 73 65 74 20 61 6e 64 20 jobs is set and
1180: 74 68 65 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 the number runni
1190: 6e 67 20 69 73 20 67 72 65 61 74 65 72 20 0a 09 ng is greater ..
11a0: 09 09 09 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 ... ;; than it t
11b0: 68 61 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d han cannot run m
11c0: 6f 72 65 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 ore jobs..... ((
11d0: 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 and max-concurre
11e0: 6e 74 2d 6a 6f 62 73 0a 09 09 09 09 20 20 20 20 nt-jobs.....
11f0: 20 20 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 (string->numb
1200: 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e er max-concurren
1210: 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 20 20 t-jobs).....
1220: 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 (>= num-runni
1230: 6e 67 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 ng (string->numb
1240: 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e er max-concurren
1250: 74 2d 6a 6f 62 73 29 29 29 0a 09 09 09 09 20 20 t-jobs))).....
1260: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
1270: 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e WARNING: Max run
1280: 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64 ning jobs exceed
1290: 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 ed, current numb
12a0: 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 er running: " nu
12b0: 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 m-running ......
12c0: 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f ", max_co
12d0: 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 ncurrent_jobs: "
12e0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
12f0: 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a jobs)..... #t).
1300: 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 .... ;; if job-g
1310: 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 roup-limit is se
1320: 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 t and number of
1330: 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75 jobs in the grou
1340: 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 09 p is greater....
1350: 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 . ;; than the li
1360: 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 mit then cannot
1370: 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 run more jobs of
1380: 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 this kind.....
1390: 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d ((and job-group-
13a0: 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20 limit.....
13b0: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 (>= num-running
13c0: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 -in-jobgroup job
13d0: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 -group-limit))..
13e0: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ... (debug:prin
13f0: 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 t 1 "WARNING: nu
1400: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e mber of jobs " n
1410: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f um-running-in-jo
1420: 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20 bgroup ......
1430: 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 " in " jobgr
1440: 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c 20 oup " exceeded,
1450: 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 will not run " (
1460: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
1470: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
1480: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20 t-record)).....
1490: 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20 #t)..... (else
14a0: 23 66 29 29 29 29 0a 09 20 20 28 6e 6f 74 20 63 #f)))).. (not c
14b0: 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29 an-not-run-more)
14c0: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ))))..;;========
14d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
14e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
14f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
1510: 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 ; New methodolog
1520: 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65 y. These routine
1530: 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 s will replace t
1540: 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 he above in time
1550: 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 . For.;; now the
1560: 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61 code is duplica
1570: 74 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20 ted. This stuff
1580: 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 is initially use
1590: 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 d in the monitor
15a0: 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a .;; based code..
15b0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
15c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
15d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
15e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
15f0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 ========..;; reg
1600: 69 73 74 65 72 20 61 20 74 65 73 74 20 72 75 6e ister a test run
1610: 20 77 69 74 68 20 74 68 65 20 64 62 0a 28 64 65 with the db.(de
1620: 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 67 69 73 fine (runs:regis
1630: 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 ter-run db keys
1640: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d keyvallst runnam
1650: 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 e state status u
1660: 73 65 72 29 0a 20 20 28 64 65 62 75 67 3a 70 72 ser). (debug:pr
1670: 69 6e 74 20 33 20 22 72 75 6e 73 3a 72 65 67 69 int 3 "runs:regi
1680: 73 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 ster-run, keys:
1690: 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c " keys " keyvall
16a0: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 st: " keyvallst
16b0: 22 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e " runname: " run
16c0: 6e 61 6d 65 20 22 20 73 74 61 74 65 3a 20 22 20 name " state: "
16d0: 73 74 61 74 65 20 22 20 73 74 61 74 75 73 3a 20 state " status:
16e0: 22 20 73 74 61 74 75 73 20 22 20 75 73 65 72 3a " status " user:
16f0: 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a " user). (let*
1700: 20 28 28 6b 65 79 73 74 72 20 20 20 20 28 6b 65 ((keystr (ke
1710: 79 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 ys->keystr keys)
1720: 29 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 ).. (comma (
1730: 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 if (> (length ke
1740: 79 73 29 20 30 29 20 22 2c 22 20 22 22 29 29 0a ys) 0) "," "")).
1750: 09 20 28 61 6e 64 73 74 72 20 20 20 20 28 69 66 . (andstr (if
1760: 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 (> (length keys
1770: 29 20 30 29 20 22 20 41 4e 44 20 22 20 22 22 29 ) 0) " AND " "")
1780: 29 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 ).. (valslots (
1790: 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b keys->valslots k
17a0: 65 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e eys)) ;; ?,?,? .
17b0: 2e 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20 .... (keyvals
17c0: 28 6d 61 70 20 63 61 64 72 20 6b 65 79 76 61 6c (map cadr keyval
17d0: 6c 73 74 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 lst)).. (allvals
17e0: 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 (append (list
17f0: 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 runname state s
1800: 74 61 74 75 73 20 75 73 65 72 29 20 6b 65 79 76 tatus user) keyv
1810: 61 6c 73 29 29 0a 09 20 28 71 72 79 76 61 6c 73 als)).. (qryvals
1820: 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 (append (list
1830: 20 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c runname) keyval
1840: 73 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 s)).. (key=?str
1850: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
1860: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 erse (map (lambd
1870: 61 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a a (k)(conc (key:
1880: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 get-fieldname k)
1890: 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 20 "=?")) keys) "
18a0: 41 4e 44 20 22 29 29 29 0a 20 20 20 20 28 64 65 AND "))). (de
18b0: 62 75 67 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 bug:print 3 "key
18c0: 73 3a 20 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 s: " keys " allv
18d0: 61 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 als: " allvals "
18e0: 20 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 keyvals: " keyv
18f0: 61 6c 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a als). (debug:
1900: 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 print 2 "NOTE: u
1910: 73 69 6e 67 20 74 61 72 67 65 74 20 22 20 28 73 sing target " (s
1920: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
1930: 65 20 6b 65 79 76 61 6c 73 20 22 2f 22 29 20 22 e keyvals "/") "
1940: 20 66 6f 72 20 74 68 69 73 20 72 75 6e 22 29 0a for this run").
1950: 20 20 20 20 28 69 66 20 28 61 6e 64 20 72 75 6e (if (and run
1960: 6e 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c name (null? (fil
1970: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 ter (lambda (x)(
1980: 6e 6f 74 20 78 29 29 20 6b 65 79 76 61 6c 73 29 not x)) keyvals)
1990: 29 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 )) ;; there must
19a0: 20 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 be a better way
19b0: 20 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a to "apply and".
19c0: 09 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 .(let ((res #f))
19d0: 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 .. (apply sqlit
19e0: 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 e3:execute db (c
19f0: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 onc "INSERT OR I
1a00: 47 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 GNORE INTO runs
1a10: 28 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 (runname,state,s
1a20: 74 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e tatus,owner,even
1a30: 74 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 t_time" comma ke
1a40: 79 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 ystr ") VALUES (
1a50: 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 ?,?,?,?,strftime
1a60: 28 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f ('%s','now')" co
1a70: 6d 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b mma valslots ");
1a80: 22 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 ")... allvals)..
1a90: 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 (apply sqlite3
1aa0: 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 :for-each-row ..
1ab0: 20 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a (lambda (id).
1ac0: 09 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 . (set! res
1ad0: 69 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 id)).. db..
1ae0: 28 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 (let ((qry (conc
1af0: 20 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d "SELECT id FROM
1b00: 20 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e runs WHERE (run
1b10: 6e 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 name=? " andstr
1b20: 6b 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 key=?str ");")))
1b30: 0a 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 .. ;(debug:p
1b40: 72 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 rint 4 "qry: " q
1b50: 72 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a ry) .. qry).
1b60: 09 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 . qryvals)..
1b70: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 (sqlite3:execute
1b80: 20 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 db "UPDATE runs
1b90: 20 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 SET state=?,sta
1ba0: 74 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f tus=? WHERE id=?
1bb0: 3b 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 ;" state status
1bc0: 72 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 res).. res) ..(
1bd0: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a begin.. (debug:
1be0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
1bf0: 43 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 Called without a
1c00: 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 ll necessary key
1c10: 73 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b s").. #f))))..;
1c20: 3b 20 54 68 69 73 20 69 73 20 61 20 64 75 70 6c ; This is a dupl
1c30: 69 63 61 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 icate of run-tes
1c40: 74 73 20 28 77 68 69 63 68 20 68 61 73 20 62 65 ts (which has be
1c50: 65 6e 20 64 65 70 72 65 63 61 74 65 64 29 2e 20 en deprecated).
1c60: 55 73 65 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 Use this one ins
1c70: 74 65 61 64 20 6f 66 20 72 75 6e 20 74 65 73 74 tead of run test
1c80: 73 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 s..;; keyvals.(d
1c90: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d efine (runs:run-
1ca0: 74 65 73 74 73 20 74 61 72 67 65 74 20 72 75 6e tests target run
1cb0: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 name test-patts
1cc0: 75 73 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c user flags). (l
1cd0: 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 et* ((db
1ce0: 20 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 #f).. (keys
1cf0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
1d00: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 lose db:get-keys
1d10: 20 64 62 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c db)).. (keyvall
1d20: 73 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 st (keys:targe
1d30: 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 t->keyval keys t
1d40: 61 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 arget)).. (run-i
1d50: 64 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e d (open-run
1d60: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 -close runs:regi
1d70: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
1d80: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 keyvallst runna
1d90: 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 me "new" "n/a" u
1da0: 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d ser)) ;; test-
1db0: 6e 61 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72 name))).. (defer
1dc0: 72 65 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64 red '()) ;; d
1dd0: 65 6c 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 elay running the
1de0: 73 65 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 se since they ha
1df0: 76 65 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 ve a waiton clau
1e00: 73 65 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e se.. ;; keepgoin
1e10: 67 20 69 73 20 74 68 65 20 64 65 66 61 63 74 6f g is the defacto
1e20: 20 6d 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 modality now, w
1e30: 69 6c 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 ill add hit-n-ru
1e40: 6e 20 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20 n a bit later..
1e50: 3b 3b 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 ;; (keepgoing
1e60: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
1e70: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d default flags "-
1e80: 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a keepgoing" #f)).
1e90: 09 20 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 . (test-names '
1ea0: 28 29 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 ()).. (runconfig
1eb0: 66 20 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 f (conc *topp
1ec0: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 ath* "/runconfig
1ed0: 73 2e 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 s.config")).. (r
1ee0: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 equired-tests '(
1ef0: 29 29 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 )).. (test-recor
1f00: 64 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 ds (make-hash-ta
1f10: 62 6c 65 29 29 29 0a 0a 20 20 20 20 28 6f 70 65 ble))).. (ope
1f20: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d n-run-close set-
1f30: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 megatest-env-var
1f40: 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 s db run-id) ;;
1f50: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 these may be nee
1f60: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 ded by the launc
1f70: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 hing process..
1f80: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 (if (file-exis
1f90: 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a ts? runconfigf).
1fa0: 09 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 .(open-run-close
1fb0: 20 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 setup-env-defau
1fc0: 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 lts db runconfig
1fd0: 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 f run-id *alread
1fe0: 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 y-seen-runconfig
1ff0: 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e -info* "pre-laun
2000: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 ch-env-vars")..(
2010: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
2020: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e ARNING: You do n
2030: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f ot have a run co
2040: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e nfig file: " run
2050: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 configf)). .
2060: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c ;; look up al
2070: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 l tests matching
2080: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 the comma separ
2090: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f ated list of glo
20a0: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 bs in. ;; tes
20b0: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 t-patts (using %
20c0: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 as wildcard).
20d0: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
20e0: 20 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 (lambda (patt)
20f0: 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 . (let ((t
2100: 65 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ests (glob (conc
2110: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
2120: 74 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 ts/" (string-tra
2130: 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 nslate patt "%"
2140: 22 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 "*"))))).. (set!
2150: 20 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 tests (filter (
2160: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 lambda (test)(fi
2170: 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 le-exists? (conc
2180: 20 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 test "/testconf
2190: 69 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 ig"))) tests))..
21a0: 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 (set! test-name
21b0: 73 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e s (append test-n
21c0: 61 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 ames ..... (map
21d0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 (lambda (testp)
21e0: 0a 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 ...... (last (st
21f0: 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 ring-split testp
2200: 20 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 "/"))).....
2210: 20 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 tests))))).
2220: 20 20 20 28 69 66 20 74 65 73 74 2d 70 61 74 74 (if test-patt
2230: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 s (string-split
2240: 74 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28 test-patts ",")(
2250: 6c 69 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20 list "%")))..
2260: 20 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 ;; now remove
2270: 64 75 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 duplicates. (
2280: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 set! test-names
2290: 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 (delete-duplicat
22a0: 65 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a es test-names)).
22b0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
22c0: 74 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 t 0 "INFO: test
22d0: 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d names " test-nam
22e0: 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 es).. ;; on t
22f0: 68 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 he first pass or
2300: 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 call to run-tes
2310: 74 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 ts set FAILS to
2320: 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 NOT_STARTED if.
2330: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 ;; -keepgoing
2340: 20 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 is specified.
2350: 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 (if (eq? *pass
2360: 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a num* 0)..(begin.
2370: 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 . ;; have to de
2380: 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 lete test record
2390: 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 s where NOT_STAR
23a0: 54 45 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 TED since they c
23b0: 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f an cause -keepgo
23c0: 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 ing to .. ;; ge
23d0: 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 t stuck due to b
23e0: 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 ecoming inaccess
23f0: 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c ible from a fail
2400: 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 ed test. I.e. if
2410: 20 74 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 test B depends
2420: 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 .. ;; on test A
2430: 20 62 75 74 20 74 65 73 74 20 42 20 72 65 61 63 but test B reac
2440: 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e hed the point on
2450: 20 62 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 being registere
2460: 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 d as NOT_STARTED
2470: 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 and test.. ;;
2480: 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d A failed for som
2490: 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e e reason then on
24a0: 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b re-run using -k
24b0: 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e eepgoing the run
24c0: 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c can never compl
24d0: 65 74 65 2e 0a 09 20 20 28 6f 70 65 6e 2d 72 75 ete... (open-ru
24e0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 n-close db:delet
24f0: 65 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 e-tests-in-state
2500: 20 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f db run-id "NOT_
2510: 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 6f 70 STARTED").. (op
2520: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
2530: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d set-tests-state-
2540: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 status db run-id
2550: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 test-names #f "
2560: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 FAIL" "NOT_START
2570: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 ED" "FAIL")))..
2580: 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 ;; from here
2590: 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77 69 on out the db wi
25a0: 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 ll be opened and
25b0: 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 closed on every
25c0: 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 call runs:run-t
25d0: 65 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20 3b ests-queue. ;
25e0: 3b 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c ; (sqlite3:final
25f0: 69 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b 3b ize! db) . ;;
2600: 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 now add non-dir
2610: 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65 64 ectly referenced
2620: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 69 dependencies (i
2630: 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 .e. waiton).
2640: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
2650: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c test-names))..(l
2660: 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 et loop ((hed (c
2670: 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a ar test-names)).
2680: 09 09 20 20 20 28 74 61 6c 20 28 63 64 72 20 74 .. (tal (cdr t
2690: 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 est-names)))
26a0: 20 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d ;; 'return-
26b0: 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 20 procs tells the
26c0: 63 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74 6f config reader to
26d0: 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 prep running sy
26e0: 73 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e 20 stem but return
26f0: 61 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75 67 a proc.. (debug
2700: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 :print 4 "INFO:
2710: 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74 hed=" hed " at t
2720: 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20 op of loop")..
2730: 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 (let* ((config
2740: 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 (tests:get-testc
2750: 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 onfig hed 'retur
2760: 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 n-procs))... (wa
2770: 69 74 6f 6e 73 20 28 69 66 20 63 6f 6e 66 69 67 itons (if config
2780: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 (string-split (
2790: 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d let ((w (config-
27a0: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 lookup config "r
27b0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 equirements" "wa
27c0: 69 74 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20 iton"))).......
27d0: 20 20 20 20 28 69 66 20 77 20 77 20 22 22 29 29 (if w w ""))
27e0: 29 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 ).... (begi
27f0: 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 n.....(debug:pri
2800: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e nt 0 "ERROR: non
2810: 2d 65 78 69 73 74 65 6e 74 20 72 65 71 75 69 72 -existent requir
2820: 65 64 20 74 65 73 74 20 5c 22 22 20 68 65 64 20 ed test \"" hed
2830: 22 5c 22 22 29 0a 20 20 20 20 20 20 20 20 20 20 "\"").
2840: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2850: 20 20 20 20 20 20 28 69 66 20 64 62 20 28 73 71 (if db (sq
2860: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 lite3:finalize!
2870: 64 62 29 29 0a 09 09 09 09 28 65 78 69 74 20 31 db)).....(exit 1
2880: 29 29 29 29 29 0a 09 20 20 20 20 3b 3b 20 63 68 ))))).. ;; ch
2890: 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 eck for hed in w
28a0: 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 aitons => this w
28b0: 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 ould be circular
28c0: 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 , remove it and
28d0: 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b issue an.. ;;
28e0: 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 error.. (if
28f0: 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 (member hed wait
2900: 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 ons)...(begin...
2910: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
2920: 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 "ERROR: test "
2930: 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 hed " has listed
2940: 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 itself as a wai
2950: 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 ton, please corr
2960: 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 ect this!")...
2970: 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20 28 66 (set! waitons (f
2980: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 ilter (lambda (x
2990: 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 )(not (equal? x
29a0: 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 hed))) waitons))
29b0: 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 3b 3b )).. .. ;;
29c0: 20 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 (items (items
29d0: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d :get-items-from-
29e0: 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 config config)))
29f0: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 .. (if (not (
2a00: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
2a10: 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f efault test-reco
2a20: 72 64 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 rds hed #f))...(
2a30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
2a40: 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 test-records....
2a50: 09 20 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 . hed (vector he
2a60: 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 d ;; 0......
2a70: 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 config ;;
2a80: 31 0a 09 09 09 09 09 20 20 20 20 20 77 61 69 74 1...... wait
2a90: 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 ons ;; 2......
2aa0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (config-looku
2ab0: 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 p config "requir
2ac0: 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 ements" "priorit
2ad0: 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 y") ;; prior
2ae0: 69 74 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 ity 3......
2af0: 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 (let ((items
2b00: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
2b10: 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 f/default config
2b20: 20 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b "items" #f)) ;;
2b30: 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 items 4.......
2b40: 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 (itemstable (h
2b50: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
2b60: 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 fault config "it
2b70: 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 emstable" #f)))
2b80: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 ...... ;;
2b90: 69 66 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 if either items
2ba0: 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 or items table i
2bb0: 73 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 s a proc return
2bc0: 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 it so test runni
2bd0: 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b ng...... ;
2be0: 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e ; process can kn
2bf0: 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 ow to call items
2c00: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d :get-items-from-
2c10: 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 config......
2c20: 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 ;; if either
2c30: 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f is a list and no
2c40: 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 ne is a proc go
2c50: 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 ahead and call g
2c60: 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 et-items......
2c70: 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 ;; otherwis
2c80: 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 e return #f - th
2c90: 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 is is not an ite
2ca0: 72 61 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 rated test......
2cb0: 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 (cond....
2cc0: 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 ...((procedure?
2cd0: 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 items) ....
2ce0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
2cf0: 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 4 "INFO: items
2d00: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 is a procedure,
2d10: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 will calc later"
2d20: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 )....... items)
2d30: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 ;; ca
2d40: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 lc later.......(
2d50: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d (procedure? item
2d60: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 stable)....... (
2d70: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 debug:print 4 "I
2d80: 4e 46 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 NFO: itemstable
2d90: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 is a procedure,
2da0: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 will calc later"
2db0: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 )....... itemsta
2dc0: 62 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 ble) ;; ca
2dd0: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 lc later.......(
2de0: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 (filter (lambda
2df0: 28 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c (x)........ (l
2e00: 65 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 et ((val (car x)
2e10: 29 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 ))........ (
2e20: 69 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 if (procedure? v
2e30: 61 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 al) val #f)))...
2e40: 09 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 ..... (append (i
2e50: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 f (list? items)
2e60: 69 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 items '())......
2e70: 09 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 ... (if (list? i
2e80: 74 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 temstable) items
2e90: 74 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 table '())))....
2ea0: 09 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 ... 'have-proced
2eb0: 75 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 ure).......((or
2ec0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 (list? items)(li
2ed0: 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 st? itemstable))
2ee0: 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 ;; calc now....
2ef0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
2f00: 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 4 "INFO: items
2f10: 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 and itemstable a
2f20: 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e re lists, calc n
2f30: 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 ow\n"........
2f40: 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 " items: "
2f50: 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 items " itemsta
2f60: 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c ble: " itemstabl
2f70: 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 e)....... (items
2f80: 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d :get-items-from-
2f90: 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a config config)).
2fa0: 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 ......(else #f))
2fb0: 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 )
2fc0: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e ;; n
2fd0: 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 ot iterated.....
2fe0: 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b . #f ;;
2ff0: 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 itemsdat 5.....
3000: 09 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b . #f ;;
3010: 20 73 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f spare - used fo
3020: 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 r item-path.....
3030: 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 . ))).. (
3040: 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 for-each ..
3050: 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 (lambda (waiton)
3060: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 61 6e .. (if (an
3070: 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d d waiton (not (m
3080: 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 ember waiton tes
3090: 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 t-names)))...
30a0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 (begin... (s
30b0: 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 et! required-tes
30c0: 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 ts (cons waiton
30d0: 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 required-tests))
30e0: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 74 65 ... (set! te
30f0: 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 st-names (cons w
3100: 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 aiton test-names
3110: 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 ))))) ;; was an
3120: 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f append, now a co
3130: 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 ns.. waitons
3140: 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 ).. (let ((re
3150: 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 mtests (delete-d
3160: 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e uplicates (appen
3170: 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 d waitons tal)))
3180: 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f ).. (if (no
3190: 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 t (null? remtest
31a0: 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 s))... (loop (c
31b0: 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 ar remtests)(cdr
31c0: 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 remtests)))))))
31d0: 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 .. (if (not (
31e0: 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 null? required-t
31f0: 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 ests))..(debug:p
3200: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 rint 1 "INFO: Ad
3210: 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d ding " required-
3220: 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 tests " to the r
3230: 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 un queue")).
3240: 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 ;; NOTE: these a
3250: 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 re all parent te
3260: 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e sts, items are n
3270: 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e ot expanded yet.
3280: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
3290: 74 20 34 20 22 49 4e 46 4f 3a 20 74 65 73 74 2d t 4 "INFO: test-
32a0: 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d records=" (hash-
32b0: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 table->alist tes
32c0: 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 t-records)).
32d0: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
32e0: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e queue run-id run
32f0: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
3300: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
3310: 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 s). (debug:pr
3320: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 72 75 6e int 1 "INFO: run
3330: 6e 69 6e 67 20 71 75 65 75 65 20 6f 6e 65 20 6d ning queue one m
3340: 6f 72 65 20 74 69 6d 65 20 74 6f 20 63 61 74 63 ore time to catc
3350: 68 20 61 6e 79 20 63 68 61 6e 67 65 64 20 74 65 h any changed te
3360: 73 74 20 73 74 61 74 65 73 22 29 0a 20 20 20 20 st states").
3370: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
3380: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e queue run-id run
3390: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
33a0: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
33b0: 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 s). (debug:pr
33c0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c int 4 "INFO: All
33d0: 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29 done by here"))
33e0: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72 )..;; test-recor
33f0: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62 ds is a hash tab
3400: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d le testname:item
3410: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20 _path => vector
3420: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63 < testname testc
3430: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72 onfig waitons pr
3440: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66 iority items-inf
3450: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20 o ... >.(define
3460: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
3470: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e queue run-id run
3480: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
3490: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
34a0: 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 s). ;; At thi
34b0: 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 s point the list
34c0: 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 of parent tests
34d0: 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 is expanded .
34e0: 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 ;; NB// Should
34f0: 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 expand items he
3500: 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 re and then inse
3510: 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 rt into the run
3520: 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a queue.. (debug:
3530: 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65 print 5 "test-re
3540: 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65 cords: " test-re
3550: 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c cords ", keyvall
3560: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 st: " keyvallst
3570: 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 68 " flags: " (hash
3580: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 6c -table->alist fl
3590: 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 73 ags)). (let ((s
35a0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 orted-test-names
35b0: 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d (tests:sort-by-
35c0: 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69 priority-and-wai
35d0: 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 73 ton test-records
35e0: 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74 73 20 ))..(item-patts
35f0: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
3600: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
3610: 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74 74 22 lags "-itempatt"
3620: 20 23 66 29 29 0a 09 28 74 65 73 74 2d 72 65 67 #f))..(test-reg
3630: 69 73 74 65 72 79 20 20 20 20 28 6d 61 6b 65 2d istery (make-
3640: 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 28 6e hash-table))..(n
3650: 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20 20 20 um-retries
3660: 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 69 0)..(max-retri
3670: 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 es (config
3680: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 -lookup *configd
3690: 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78 at* "setup" "max
36a0: 72 65 74 72 69 65 73 22 29 29 29 0a 20 20 20 20 retries"))).
36b0: 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72 69 65 (set! max-retrie
36c0: 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78 2d 72 s (if (and max-r
36d0: 65 74 72 69 65 73 20 28 73 74 72 69 6e 67 2d 3e etries (string->
36e0: 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 number max-retri
36f0: 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e 75 6d es))(string->num
3700: 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 29 ber max-retries)
3710: 20 31 30 30 29 29 0a 20 20 20 20 28 69 66 20 28 100)). (if (
3720: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65 not (null? sorte
3730: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 d-test-names))..
3740: 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 (let loop ((hed
3750: 20 20 20 20 20 20 20 20 28 63 61 72 20 73 6f 72 (car sor
3760: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 ted-test-names))
3770: 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 20 20 ... (tal
3780: 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74 (cdr sorted-t
3790: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 est-names))...
37a0: 20 28 72 65 72 75 6e 73 20 20 20 20 20 20 27 28 (reruns '(
37b0: 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f 74 20 ))).. (if (not
37c0: 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 28 (null? reruns))(
37d0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 debug:print 4 "I
37e0: 4e 46 4f 3a 20 72 65 72 75 6e 73 3d 22 20 72 65 NFO: reruns=" re
37f0: 72 75 6e 73 29 29 0a 09 20 20 28 6c 65 74 2a 20 runs)).. (let*
3800: 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 ((test-record (h
3810: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 ash-table-ref te
3820: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 st-records hed))
3830: 0a 09 09 20 28 74 65 73 74 2d 6e 61 6d 65 20 20 ... (test-name
3840: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
3850: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 e-get-testname t
3860: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 est-record))...
3870: 28 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65 (tconfig (te
3880: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3890: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 t-testconfig tes
38a0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 74 t-record))... (t
38b0: 65 73 74 6d 6f 64 65 20 20 20 20 28 6c 65 74 20 estmode (let
38c0: 28 28 6d 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b ((m (config-look
38d0: 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 up tconfig "requ
38e0: 69 72 65 6d 65 6e 74 73 22 20 22 6d 6f 64 65 22 irements" "mode"
38f0: 29 29 29 0a 09 09 09 09 28 69 66 20 6d 20 28 73 ))).....(if m (s
3900: 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 tring->symbol m)
3910: 20 27 6e 6f 72 6d 61 6c 29 29 29 0a 09 09 20 28 'normal)))... (
3920: 77 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73 waitons (tes
3930: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3940: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 -waitons test
3950: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 70 72 -record))... (pr
3960: 69 6f 72 69 74 79 20 20 20 20 28 74 65 73 74 73 iority (tests
3970: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 70 :testqueue-get-p
3980: 72 69 6f 72 69 74 79 20 20 20 74 65 73 74 2d 72 riority test-r
3990: 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d ecord))... (item
39a0: 64 61 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 dat (tests:t
39b0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 estqueue-get-ite
39c0: 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 mdat test-rec
39d0: 6f 72 64 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 ord)) ;; itemdat
39e0: 20 63 61 6e 20 62 65 20 61 20 73 74 72 69 6e 67 can be a string
39f0: 2c 20 6c 69 73 74 20 6f 72 20 23 66 0a 09 09 20 , list or #f...
3a00: 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 74 65 (items (te
3a10: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3a20: 74 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65 73 t-items tes
3a30: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 t-record))... (i
3a40: 74 65 6d 2d 70 61 74 68 20 20 20 28 69 74 65 6d tem-path (item
3a50: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d -list->path item
3a60: 64 61 74 29 29 0a 09 09 20 28 6e 65 77 74 61 6c dat))... (newtal
3a70: 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 74 61 (append ta
3a80: 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29 0a 09 l (list hed)))..
3a90: 09 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 20 28 . (calc-fails (
3aa0: 6c 61 6d 62 64 61 20 28 70 72 65 72 65 71 73 2d lambda (prereqs-
3ab0: 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 28 66 69 not-met).....(fi
3ac0: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74 65 lter (lambda (te
3ad0: 73 74 29 0a 09 09 09 09 09 20 20 28 61 6e 64 20 st)...... (and
3ae0: 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29 20 3b (vector? test) ;
3af0: 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f 20 74 ; not (string? t
3b00: 65 73 74 29 29 0a 09 09 09 09 09 20 20 20 20 20 est))......
3b10: 20 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 (equal? (db:te
3b20: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65 73 st-get-state tes
3b30: 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a t) "COMPLETED").
3b40: 09 09 09 09 09 20 20 20 20 20 20 20 28 6e 6f 74 ..... (not
3b50: 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 73 (member (db:tes
3b60: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t-get-status tes
3b70: 74 29 0a 09 09 09 09 09 09 09 20 20 20 20 27 28 t)........ '(
3b80: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 "PASS" "WARN" "C
3b90: 48 45 43 4b 22 20 22 57 41 49 56 45 44 22 29 29 HECK" "WAIVED"))
3ba0: 29 29 29 0a 09 09 09 09 09 70 72 65 72 65 71 73 )))......prereqs
3bb0: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 28 -not-met)))... (
3bc0: 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 calc-not-complet
3bd0: 65 64 20 28 6c 61 6d 62 64 61 20 28 70 72 65 72 ed (lambda (prer
3be0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 eqs-not-met)....
3bf0: 09 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 0a . (filter.
3c00: 09 09 09 09 09 28 6c 61 6d 62 64 61 20 28 74 29 .....(lambda (t)
3c10: 0a 09 09 09 09 09 20 20 28 6f 72 20 28 6e 6f 74 ...... (or (not
3c20: 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 09 (vector? t))...
3c30: 09 09 09 20 20 20 20 20 20 28 6e 6f 74 20 28 65 ... (not (e
3c40: 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44 qual? "COMPLETED
3c50: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 " (db:test-get-s
3c60: 74 61 74 65 20 74 29 29 29 29 29 0a 09 09 09 09 tate t))))).....
3c70: 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 .prereqs-not-met
3c80: 29 29 29 0a 09 09 20 28 70 72 65 74 74 79 2d 73 )))... (pretty-s
3c90: 74 72 69 6e 67 20 28 6c 61 6d 62 64 61 20 28 6c tring (lambda (l
3ca0: 73 74 29 0a 09 09 09 09 20 20 28 6d 61 70 20 28 st)..... (map (
3cb0: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 09 lambda (t)......
3cc0: 20 28 69 66 20 28 6e 6f 74 20 28 76 65 63 74 6f (if (not (vecto
3cd0: 72 3f 20 74 29 29 0a 09 09 09 09 09 20 20 20 20 r? t))......
3ce0: 20 28 63 6f 6e 63 20 74 29 0a 09 09 09 09 09 20 (conc t)......
3cf0: 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 (conc (db:te
3d00: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
3d10: 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d t) ":" (db:test-
3d20: 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 get-state t) "/"
3d30: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
3d40: 61 74 75 73 20 74 29 29 29 29 0a 09 09 09 09 20 atus t)))).....
3d50: 20 20 20 20 20 20 6c 73 74 29 29 29 29 0a 09 20 lst))))..
3d60: 20 20 20 0a 09 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
3d70: 70 72 69 6e 74 20 36 0a 09 09 09 20 22 74 65 73 print 6.... "tes
3d80: 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e t-name: " test-n
3d90: 61 6d 65 0a 09 09 09 20 22 5c 6e 20 20 68 65 64 ame.... "\n hed
3da0: 3a 20 20 20 20 20 20 20 20 20 22 20 68 65 64 0a : " hed.
3db0: 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 64 61 74 ... "\n itemdat
3dc0: 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 74 0a : " itemdat.
3dd0: 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20 ... "\n items:
3de0: 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 " items...
3df0: 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 . "\n item-path
3e00: 3a 20 20 20 22 20 69 74 65 6d 2d 70 61 74 68 0a : " item-path.
3e10: 09 09 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e 73 ... "\n waitons
3e20: 3a 20 20 20 20 20 22 20 77 61 69 74 6f 6e 73 0a : " waitons.
3e30: 09 09 09 20 22 5c 6e 20 20 6e 75 6d 2d 72 65 74 ... "\n num-ret
3e40: 72 69 65 73 3a 20 22 20 6e 75 6d 2d 72 65 74 72 ries: " num-retr
3e50: 69 65 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68 ies)... ;; ch
3e60: 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 eck for hed in w
3e70: 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 aitons => this w
3e80: 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 ould be circular
3e90: 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 , remove it and
3ea0: 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b issue an.. ;;
3eb0: 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 error.. (if
3ec0: 28 6d 65 6d 62 65 72 20 74 65 73 74 2d 6e 61 6d (member test-nam
3ed0: 65 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 e waitons)...(be
3ee0: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 gin... (debug:p
3ef0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 rint 0 "ERROR: t
3f00: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
3f10: 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 74 73 " has listed its
3f20: 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f 6e 2c elf as a waiton,
3f30: 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 74 20 please correct
3f40: 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 65 74 this!")... (set
3f50: 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74 65 72 ! waiton (filter
3f60: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 (lambda (x)(not
3f70: 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64 29 29 (equal? x hed))
3f80: 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a 0a 09 ) waitons))))...
3f90: 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 20 (cond..
3fa0: 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 ((not items) ;;
3fb0: 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 when false the t
3fc0: 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 est is ok to be
3fd0: 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 handed off to la
3fe0: 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 unch (but not be
3ff0: 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65 fore).. (le
4000: 74 2a 20 28 28 68 61 76 65 2d 72 65 73 6f 75 72 t* ((have-resour
4010: 63 65 73 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 ces (open-run-c
4020: 6c 6f 73 65 20 72 75 6e 73 3a 63 61 6e 2d 72 75 lose runs:can-ru
4030: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 23 66 20 n-more-tests #f
4040: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b test-record)) ;;
4050: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73 look at the tes
4060: 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 t jobgroup and t
4070: 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a ot jobs running.
4080: 09 09 20 20 20 20 20 28 70 72 65 72 65 71 73 2d .. (prereqs-
4090: 6e 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 not-met (open-ru
40a0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 n-close db:get-p
40b0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 rereqs-not-met #
40c0: 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 f run-id waitons
40d0: 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a item-path mode:
40e0: 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 20 testmode))...
40f0: 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 (fails
4100: 20 20 20 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 (calc-fails
4110: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 prereqs-not-met)
4120: 29 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f )... (non-co
4130: 6d 70 6c 65 74 65 64 20 20 20 28 63 61 6c 63 2d mpleted (calc-
4140: 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 not-completed pr
4150: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 ereqs-not-met)))
4160: 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ...(debug:print
4170: 38 20 22 49 4e 46 4f 3a 20 68 61 76 65 2d 72 65 8 "INFO: have-re
4180: 73 6f 75 72 63 65 73 3a 20 22 20 68 61 76 65 2d sources: " have-
4190: 72 65 73 6f 75 72 63 65 73 20 22 20 70 72 65 72 resources " prer
41a0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a eqs-not-met: " .
41b0: 09 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d ... (string-
41c0: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 intersperse ....
41d0: 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 (map (lamb
41e0: 64 61 20 28 74 29 0a 09 09 09 09 20 20 20 20 20 da (t).....
41f0: 28 69 66 20 28 76 65 63 74 6f 72 3f 20 74 29 0a (if (vector? t).
4200: 09 09 09 09 09 20 28 63 6f 6e 63 20 28 64 62 3a ..... (conc (db:
4210: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 test-get-state t
4220: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 ) "/" (db:test-g
4230: 65 74 2d 73 74 61 74 75 73 20 74 29 29 0a 09 09 et-status t))...
4240: 09 09 09 20 28 63 6f 6e 63 20 22 20 57 41 52 4e ... (conc " WARN
4250: 49 4e 47 3a 20 74 20 69 73 20 6e 6f 74 20 61 20 ING: t is not a
4260: 76 65 63 74 6f 72 3d 22 20 74 20 29 29 29 0a 09 vector=" t )))..
4270: 09 09 09 20 20 20 70 72 65 72 65 71 73 2d 6e 6f ... prereqs-no
4280: 74 2d 6d 65 74 29 20 22 2c 20 22 29 20 22 20 66 t-met) ", ") " f
4290: 61 69 6c 73 3a 20 22 20 66 61 69 6c 73 29 0a 09 ails: " fails)..
42a0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 .(debug:print 4
42b0: 22 49 4e 46 4f 3a 20 68 65 64 3d 22 20 68 65 64 "INFO: hed=" hed
42c0: 29 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f )...;; Don't kno
42d0: 77 20 61 74 20 74 68 69 73 20 74 69 6d 65 20 69 w at this time i
42e0: 66 20 74 68 65 20 74 65 73 74 20 68 61 76 65 20 f the test have
42f0: 62 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 been launched at
4300: 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 some time in th
4310: 65 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e e past...;; i.e.
4320: 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61 is this a re-la
4330: 75 6e 63 68 3f 0a 09 09 28 63 6f 6e 64 0a 09 09 unch?...(cond...
4340: 20 28 28 6e 6f 74 20 28 70 61 74 74 2d 6c 69 73 ((not (patt-lis
4350: 74 2d 6d 61 74 63 68 20 69 74 65 6d 2d 70 61 74 t-match item-pat
4360: 68 20 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09 h item-patts))..
4370: 09 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 . ;; else the r
4380: 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d un is stuck, tem
4390: 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d porarily or perm
43a0: 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62 anently... ;; b
43b0: 75 74 20 73 68 6f 75 6c 64 20 63 68 65 63 6b 20 ut should check
43c0: 69 66 20 69 74 20 69 73 20 64 75 65 20 74 6f 20 if it is due to
43d0: 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 63 65 lack of resource
43e0: 73 20 76 73 2e 20 70 72 65 72 65 71 75 69 73 69 s vs. prerequisi
43f0: 74 65 73 0a 09 09 20 20 28 64 65 62 75 67 3a 70 tes... (debug:p
4400: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 53 6b rint 1 "INFO: Sk
4410: 69 70 70 69 6e 67 20 22 20 28 74 65 73 74 73 3a ipping " (tests:
4420: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
4430: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f stname test-reco
4440: 72 64 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 rd) " " item-pat
4450: 68 20 22 20 61 73 20 69 74 20 64 6f 65 73 6e 27 h " as it doesn'
4460: 74 20 6d 61 74 63 68 20 22 20 69 74 65 6d 2d 70 t match " item-p
4470: 61 74 74 73 29 0a 09 09 20 20 28 69 66 20 28 6e atts)... (if (n
4480: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a ot (null? tal)).
4490: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 .. (loop (c
44a0: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 ar tal)(cdr tal)
44b0: 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 28 28 reruns)))... ((
44c0: 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d not (hash-table-
44d0: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 ref/default test
44e0: 2d 72 65 67 69 73 74 65 72 79 20 28 63 6f 6e 63 -registery (conc
44f0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 test-name "/" i
4500: 74 65 6d 2d 70 61 74 68 29 20 23 66 29 29 0a 09 tem-path) #f))..
4510: 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f . (open-run-clo
4520: 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69 se db:tests-regi
4530: 73 74 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e ster-test #f run
4540: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
4550: 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 68 61 em-path)... (ha
4560: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 sh-table-set! te
4570: 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 63 6f st-registery (co
4580: 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 nc test-name "/"
4590: 20 69 74 65 6d 2d 70 61 74 68 29 20 23 74 29 0a item-path) #t).
45a0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e .. (loop (car n
45b0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 ewtal)(cdr newta
45c0: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28 l) reruns))... (
45d0: 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f 75 72 (not have-resour
45e0: 63 65 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 ces) ;; simply t
45f0: 72 79 20 61 67 61 69 6e 20 61 66 74 65 72 20 77 ry again after w
4600: 61 69 74 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a aiting a second.
4610: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 .. (thread-slee
4620: 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d p! (+ 1 *global-
4630: 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 28 64 65 delta*))... (de
4640: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 bug:print 1 "INF
4650: 4f 3a 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 20 O: no resources
4660: 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73 to run new tests
4670: 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a , waiting ...").
4680: 09 09 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 .. ;; could hav
4690: 65 20 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 e done hed tal h
46a0: 65 72 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61 ere but doing ca
46b0: 72 2f 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 r/cdr of newtal
46c0: 74 6f 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a to rotate tests.
46d0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e .. (loop (car n
46e0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 ewtal)(cdr newta
46f0: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28 l) reruns))... (
4700: 28 61 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 (and have-resour
4710: 63 65 73 0a 09 09 20 20 20 20 20 20 20 28 6f 72 ces... (or
4720: 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d (null? prereqs-
4730: 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 not-met).... (
4740: 61 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 and (eq? testmod
4750: 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 e 'toplevel)....
4760: 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 .(null? non-comp
4770: 6c 65 74 65 64 29 29 29 29 0a 09 09 20 20 3b 3b leted))))... ;;
4780: 20 6e 6f 20 6c 6f 6f 70 20 68 65 72 65 2c 20 6a no loop here, j
4790: 75 73 74 20 64 72 6f 70 20 74 68 6f 75 67 68 20 ust drop though
47a0: 61 6e 64 20 75 73 65 20 74 68 65 20 6c 6f 6f 70 and use the loop
47b0: 20 61 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 0a at the bottom .
47c0: 09 09 20 20 28 72 75 6e 3a 74 65 73 74 20 72 75 .. (run:test ru
47d0: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 n-id runname key
47e0: 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f vallst test-reco
47f0: 72 64 20 66 6c 61 67 73 20 23 66 29 29 0a 09 09 rd flags #f))...
4800: 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 (else ;; must b
4810: 65 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20 e we have unmet
4820: 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 prerequisites...
4830: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
4840: 20 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69 4 "FAILS: " fai
4850: 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 ls)... ;; If
4860: 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 one or more of t
4870: 68 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d he prereqs-not-m
4880: 65 74 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e et are FAIL then
4890: 20 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09 we can issue...
48a0: 20 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 ;; a message
48b0: 20 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72 and drop hed fr
48c0: 6f 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20 om the items to
48d0: 62 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 be processed....
48e0: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 (if (null? f
48f0: 61 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a ails)....(begin.
4900: 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 ... ;; couldn't
4910: 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 run, take a bre
4920: 61 74 68 65 72 0a 09 09 09 20 20 28 64 65 62 75 ather.... (debu
4930: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a g:print 4 "INFO:
4940: 20 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c Shouldn't reall
4950: 79 20 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 y get here, race
4960: 20 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 condition? Unab
4970: 6c 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 le to launch mor
4980: 65 20 74 65 73 74 73 20 61 74 20 74 68 69 73 20 e tests at this
4990: 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 moment, killing
49a0: 74 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 time ...")....
49b0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 (thread-sleep! (
49c0: 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 + 1 *global-delt
49d0: 61 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 a*)) ;; long sle
49e0: 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 ep here - no res
49f0: 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77 ources, may as w
4a00: 65 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09 ell be patient..
4a10: 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e .. ;; we made n
4a20: 65 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69 ew tal by sticki
4a30: 6e 67 20 68 65 64 20 61 74 20 74 68 65 20 62 61 ng hed at the ba
4a40: 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 ck of the list..
4a50: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e .. (loop (car n
4a60: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 ewtal)(cdr newta
4a70: 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09 3b l) reruns))....;
4a80: 3b 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20 ; the waiton is
4a90: 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 FAIL so no point
4aa0: 20 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75 in trying to ru
4ab0: 6e 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e n hed ever again
4ac0: 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 ....(if (not (nu
4ad0: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 ll? tal))....
4ae0: 20 28 69 66 20 28 76 65 63 74 6f 72 3f 20 68 65 (if (vector? he
4af0: 64 29 0a 09 09 09 09 28 62 65 67 69 6e 20 28 64 d).....(begin (d
4b00: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 ebug:print 1 "WA
4b10: 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 RN: Dropping tes
4b20: 74 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 t " (db:test-get
4b30: 2d 74 65 73 74 6e 61 6d 65 20 68 65 64 29 20 22 -testname hed) "
4b40: 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d /" (db:test-get-
4b50: 69 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 item-path hed)..
4b60: 09 09 09 09 09 20 20 20 20 22 20 66 72 6f 6d 20 ..... " from
4b70: 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 the launch list
4b80: 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 as it has prereq
4b90: 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 uistes that are
4ba0: 46 41 49 4c 22 29 0a 09 09 09 09 20 20 20 20 20 FAIL").....
4bb0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c (loop (car tal
4bc0: 29 28 63 64 72 20 74 61 6c 29 20 28 63 6f 6e 73 )(cdr tal) (cons
4bd0: 20 68 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09 hed reruns)))..
4be0: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 ...(begin.....
4bf0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
4c00: 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 WARN: Test not p
4c10: 72 6f 63 65 73 73 65 64 20 63 6f 72 72 65 63 74 rocessed correct
4c20: 6c 79 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72 ly. Could be a r
4c30: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e ace condition in
4c40: 20 79 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65 your test imple
4c50: 6d 65 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 mentation? " hed
4c60: 29 20 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61 ) ;; " as it ha
4c70: 73 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74 s prerequistes t
4c80: 68 61 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e hat are FAIL. (N
4c90: 4f 54 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 OTE: hed is not
4ca0: 61 20 76 65 63 74 6f 72 29 22 29 0a 09 09 09 09 a vector)").....
4cb0: 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 (loop hed tal
4cc0: 72 65 72 75 6e 73 29 29 29 29 29 29 29 29 29 0a reruns))))))))).
4cd0: 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 . .. ;;
4ce0: 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 74 case where an it
4cf0: 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61 ems came in as a
4d00: 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65 list been proce
4d10: 73 73 65 64 0a 09 20 20 20 20 20 28 28 61 6e 64 ssed.. ((and
4d20: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20 (list? items)
4d30: 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e ;; thus we kn
4d40: 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65 ow our items are
4d50: 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61 already calcula
4d60: 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 ted... (not
4d70: 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 itemdat)) ;; and
4d80: 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 not yet expande
4d90: 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 d into the list
4da0: 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 of things to be
4db0: 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 66 20 done.. (if
4dc0: 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f 73 (and (>= *verbos
4dd0: 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 ity* 1)...
4de0: 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d (> (length item
4df0: 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 s) 0)... (
4e00: 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 > (length (car i
4e10: 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 tems)) 0))... (
4e20: 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 pp items))..
4e30: 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65 ;; (if (>= *ve
4e40: 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 rbosity* 5)..
4e50: 20 20 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e ;; (begin
4e60: 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 .. ;;
4e70: 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 (print "items:
4e80: 22 29 20 20 20 20 20 28 70 70 20 28 69 74 65 6d ") (pp (item
4e90: 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 -assoc->item-lis
4ea0: 74 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 t items))..
4eb0: 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 ;; (print
4ec0: 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 "itemstable: ")
4ed0: 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d (pp (item-table-
4ee0: 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 >item-list items
4ef0: 74 61 62 6c 65 29 29 29 29 0a 09 20 20 20 20 20 table))))..
4f00: 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 (for-each..
4f10: 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 (lambda (my-i
4f20: 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a temdat)... (let*
4f30: 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f ((new-test-reco
4f40: 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 rd (let ((newrec
4f50: 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 (make-tests:tes
4f60: 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 tqueue)))......
4f70: 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 (vector-copy!
4f80: 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 test-record newr
4f90: 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 ec)...... newr
4fa0: 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d ec))....(my-item
4fb0: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 -path (item-list
4fc0: 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 ->path my-itemda
4fd0: 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 70 t)))... (if (p
4fe0: 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d att-list-match m
4ff0: 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d y-item-path item
5000: 2d 70 61 74 74 73 29 20 20 20 20 20 20 20 20 20 -patts)
5010: 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e ;; yes, we wan
5020: 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 t to process thi
5030: 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 s item, NOTE: Sh
5040: 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 ould not need th
5050: 69 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 is check here!..
5060: 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e . (let ((n
5070: 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 ewtestname (conc
5080: 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d hed "/" my-item
5090: 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 -path))) ;; t
50a0: 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e est names are un
50b0: 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 ique on testname
50c0: 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 /item-path.... (
50d0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
50e0: 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e set-items! n
50f0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 ew-test-record #
5100: 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 f).... (tests:te
5110: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d stqueue-set-item
5120: 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d dat! new-test-
5130: 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 record my-itemda
5140: 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 t).... (tests:te
5150: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d stqueue-set-item
5160: 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d _path! new-test-
5170: 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 record my-item-p
5180: 61 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 ath).... (hash-t
5190: 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 able-set! test-r
51a0: 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 ecords newtestna
51b0: 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f me new-test-reco
51c0: 72 64 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 rd).... (set! ta
51d0: 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e l (cons newtestn
51e0: 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b ame tal)))))) ;;
51f0: 20 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 since these are
5200: 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 itemized create
5210: 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 new test names
5220: 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 testname/itempat
5230: 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 h.. items)
5240: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 .. (if (not
5250: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 (null? tal))...
5260: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c (loop (car tal
5270: 29 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e )(cdr tal) rerun
5280: 73 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69 s)))... ;; i
5290: 66 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f f items is a pro
52a0: 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 c then need to r
52b0: 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 un items:get-ite
52c0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 ms-from-config,
52d0: 67 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64 get the list and
52e0: 20 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20 loop .. ;;
52f0: 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f - but only do
5300: 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 63 that if resourc
5310: 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b es exist to kick
5320: 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 off the job..
5330: 20 20 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75 ((or (procedu
5340: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 re? items)(eq? i
5350: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 tems 'have-proce
5360: 64 75 72 65 29 29 0a 09 20 20 20 20 20 20 28 6c dure)).. (l
5370: 65 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 et ((can-run-mor
5380: 65 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 e (open-run-c
5390: 6c 6f 73 65 20 72 75 6e 73 3a 63 61 6e 2d 72 75 lose runs:can-ru
53a0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 23 66 20 n-more-tests #f
53b0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 test-record)))..
53c0: 09 28 69 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 .(if can-run-mor
53d0: 65 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 e... (let* ((
53e0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 prereqs-not-met
53f0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
5400: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e db:get-prereqs-n
5410: 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 ot-met #f run-id
5420: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 waitons item-pa
5430: 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 th mode: testmod
5440: 65 29 29 0a 09 09 09 20 20 20 28 66 61 69 6c 73 e)).... (fails
5450: 20 20 20 20 20 20 20 20 20 20 20 28 63 61 6c 63 (calc
5460: 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e -fails prereqs-n
5470: 6f 74 2d 6d 65 74 29 29 0a 09 09 09 20 20 20 28 ot-met)).... (
5480: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 non-completed
5490: 28 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 (calc-not-comple
54a0: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d ted prereqs-not-
54b0: 6d 65 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 met)))... (
54c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49 debug:print 8 "I
54d0: 4e 46 4f 3a 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 NFO: can-run-mor
54e0: 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 e: " can-run-mor
54f0: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 e..... "\n tes
5500: 74 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20 tname: "
5510: 68 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70 hed..... "\n p
5520: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 rereqs-not-met:
5530: 22 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 " (pretty-string
5540: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
5550: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f 6e )..... "\n non
5560: 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22 20 -completed: "
5570: 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6e (pretty-string n
5580: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a 09 on-completed) ..
5590: 09 09 09 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a ... "\n fails:
55a0: 20 20 20 20 20 20 20 20 20 20 20 22 20 28 70 72 " (pr
55b0: 65 74 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c etty-string fail
55c0: 73 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 s)..... "\n te
55d0: 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 stmode: "
55e0: 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 testmode.....
55f0: 20 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 "\n num-retries
5600: 3a 20 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 : " num-retr
5610: 69 65 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 ies..... "\n (
5620: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f eq? testmode 'to
5630: 70 6c 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 plevel): " (eq?
5640: 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 testmode 'toplev
5650: 65 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 el)..... "\n (
5660: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 null? non-comple
5670: 74 65 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c ted): " (null
5680: 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 ? non-completed)
5690: 0a 09 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75 ..... "\n reru
56a0: 6e 73 3a 20 22 20 72 65 72 75 6e 73 29 0a 09 09 ns: " reruns)...
56b0: 20 20 20 20 20 20 28 63 6f 6e 64 20 0a 09 09 20 (cond ...
56c0: 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c ((or (null
56d0: 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 ? prereqs-not-me
56e0: 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71 t) ;; all prereq
56f0: 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66 20 s met, fire off
5700: 74 68 65 20 74 65 73 74 0a 09 09 09 20 20 20 20 the test....
5710: 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73 20 ;; or, if it is
5720: 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73 74 a 'toplevel test
5730: 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71 73 and all prereqs
5740: 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f 4d not met are COM
5750: 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75 6e PLETED then laun
5760: 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20 28 ch.... (and (
5770: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f eq? testmode 'to
5780: 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e 75 plevel)..... (nu
5790: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 ll? non-complete
57a0: 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28 74 d)))....(let ((t
57b0: 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a est-name (tests:
57c0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
57d0: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f stname test-reco
57e0: 72 64 29 29 29 0a 09 09 09 20 20 28 73 65 74 65 rd))).... (sete
57f0: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 nv "MT_TEST_NAME
5800: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 " test-name) ;;
5810: 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d .... (setenv "M
5820: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e T_RUNNAME" run
5830: 6e 61 6d 65 29 0a 09 09 09 20 20 28 6f 70 65 6e name).... (open
5840: 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d -run-close set-m
5850: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
5860: 20 23 66 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 #f run-id) ;; t
5870: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 hese may be need
5880: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 ed by the launch
5890: 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09 20 ing process....
58a0: 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 (let ((items-li
58b0: 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 st (items:get-it
58c0: 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 ems-from-config
58d0: 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20 20 tconfig)))....
58e0: 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 (if (list? ite
58f0: 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62 65 ms-list).....(be
5900: 67 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74 73 gin..... (tests
5910: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 :testqueue-set-i
5920: 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 tems! test-recor
5930: 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 d items-list)...
5940: 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 .. (loop hed ta
5950: 6c 20 72 65 72 75 6e 73 29 29 0a 09 09 09 09 28 l reruns)).....(
5960: 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64 65 62 begin..... (deb
5970: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
5980: 52 3a 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d R: The proc from
5990: 20 72 65 61 64 69 6e 67 20 74 68 65 20 73 65 74 reading the set
59a0: 75 70 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 up did not yield
59b0: 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 a list - please
59c0: 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 report this")..
59d0: 09 09 09 20 20 28 65 78 69 74 20 31 29 29 29 29 ... (exit 1))))
59e0: 29 29 0a 09 09 20 20 20 20 20 20 20 28 28 6e 75 ))... ((nu
59f0: 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 64 ll? fails)....(d
5a00: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
5a10: 46 4f 3a 20 66 61 69 6c 73 20 69 73 20 6e 75 6c FO: fails is nul
5a20: 6c 2c 20 6d 6f 76 69 6e 67 20 6f 6e 20 69 6e 20 l, moving on in
5a30: 74 68 65 20 71 75 65 75 65 20 62 75 74 20 6b 65 the queue but ke
5a40: 65 70 69 6e 67 20 22 20 68 65 64 20 22 20 66 6f eping " hed " fo
5a50: 72 20 6e 6f 77 22 29 0a 09 09 09 28 6c 6f 6f 70 r now")....(loop
5a60: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 (car newtal)(cd
5a70: 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 r newtal) reruns
5a80: 29 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 )) ;; an issue w
5a90: 69 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20 ith prereqs not
5aa0: 79 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 yet met?...
5ab0: 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 ((and (not (nu
5ac0: 6c 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20 ll? fails))(eq?
5ad0: 74 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c testmode 'normal
5ae0: 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 ))....(debug:pri
5af0: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 74 65 73 74 nt 1 "INFO: test
5b00: 20 22 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d " hed " (mode=
5b10: 22 20 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61 " testmode ") ha
5b20: 73 20 66 61 69 6c 65 64 20 70 72 65 72 65 71 75 s failed prerequ
5b30: 69 73 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09 isite(s); ".....
5b40: 20 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 (string-int
5b50: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c ersperse (map (l
5b60: 61 6d 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28 ambda (t)(conc (
5b70: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
5b80: 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a name t) ":" (db:
5b90: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 test-get-state t
5ba0: 29 22 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74 )"/"(db:test-get
5bb0: 2d 73 74 61 74 75 73 20 74 29 29 29 20 66 61 69 -status t))) fai
5bc0: 6c 73 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20 ls) ", ").....
5bd0: 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 ", removing i
5be0: 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 t from to-do lis
5bf0: 74 22 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 t")....(if (not
5c00: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 (null? tal))....
5c10: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 (loop (car t
5c20: 61 6c 29 28 63 64 72 20 74 61 6c 29 28 63 6f 6e al)(cdr tal)(con
5c30: 73 20 68 65 64 20 72 65 72 75 6e 73 29 29 29 29 s hed reruns))))
5c40: 0a 09 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a ... (else.
5c50: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ...(debug:print
5c60: 38 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 8 "ERROR: No han
5c70: 64 6c 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f dler for this co
5c80: 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09 3b 3b ndition.")....;;
5c90: 20 09 20 20 20 20 20 22 5c 6e 20 20 68 65 64 3a . "\n hed:
5ca0: 20 20 20 20 20 20 20 20 20 20 20 20 22 20 68 65 " he
5cb0: 64 20 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22 d ....;; . "
5cc0: 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20 \n fails:
5cd0: 20 20 20 20 22 20 28 73 74 72 69 6e 67 2d 69 6e " (string-in
5ce0: 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 64 tersperse (map d
5cf0: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
5d00: 61 6d 65 20 66 61 69 6c 73 29 20 22 2c 22 29 0a ame fails) ",").
5d10: 09 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20 ...;; . "\n
5d20: 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 testmode:
5d30: 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 3b " testmode....;
5d40: 3b 20 09 20 20 20 20 20 22 5c 6e 20 70 72 65 72 ; . "\n prer
5d50: 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 eqs-not-met: " (
5d60: 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 pretty-string pr
5d70: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 ereqs-not-met)..
5d80: 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20 69 ..;; . "\n i
5d90: 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20 tems:
5da0: 22 20 69 74 65 6d 73 29 0a 09 09 09 28 6c 6f 6f " items)....(loo
5db0: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 p (car newtal)(c
5dc0: 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e dr newtal) rerun
5dd0: 73 29 29 29 29 0a 09 09 20 20 20 20 3b 3b 20 69 s))))... ;; i
5de0: 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 f can't run more
5df0: 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20 just loop with
5e00: 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65 next possible te
5e10: 73 74 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a st... (begin.
5e20: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
5e30: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 70 72 rint 4 "INFO: pr
5e40: 6f 63 65 73 73 69 6e 67 20 74 68 65 20 63 61 73 ocessing the cas
5e50: 65 20 77 69 74 68 20 61 20 6c 61 6d 62 64 61 20 e with a lambda
5e60: 66 6f 72 20 69 74 65 6d 73 20 6f 72 20 27 68 61 for items or 'ha
5e70: 76 65 2d 70 72 6f 63 65 64 75 72 65 2e 20 4d 6f ve-procedure. Mo
5e80: 76 69 6e 67 20 74 68 72 6f 75 67 68 20 74 68 65 ving through the
5e90: 20 71 75 65 75 65 20 77 69 74 68 6f 75 74 20 64 queue without d
5ea0: 72 6f 70 70 69 6e 67 20 22 20 68 65 64 29 0a 09 ropping " hed)..
5eb0: 09 20 20 20 20 20 20 28 74 68 72 65 61 64 2d 73 . (thread-s
5ec0: 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 leep! (+ 1 *glob
5ed0: 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 al-delta*))...
5ee0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e (loop (car n
5ef0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 ewtal)(cdr newta
5f00: 6c 29 20 72 65 72 75 6e 73 29 29 29 29 29 0a 09 l) reruns)))))..
5f10: 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 .. ;; t
5f20: 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 his case should
5f30: 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 not happen, adde
5f40: 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 d to help catch
5f50: 61 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 any bugs.. (
5f60: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d (and (list? item
5f70: 73 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 s) itemdat)..
5f80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
5f90: 30 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 0 "ERROR: Should
5fa0: 20 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 not have a list
5fb0: 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 of items in a t
5fc0: 65 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d est and the item
5fd0: 73 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 spath set - plea
5fe0: 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 se report this")
5ff0: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
6000: 29 29 29 0a 09 20 20 0a 09 20 20 3b 3b 20 77 65 ))).. .. ;; we
6010: 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 get here on "dr
6020: 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f op through" - lo
6030: 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 op for next test
6040: 20 69 6e 20 71 75 65 75 65 0a 09 20 20 28 69 66 in queue.. (if
6050: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 (null? tal)..
6060: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 3b 3b 20 (begin...;;
6070: 46 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 FIXME!!!! THIS S
6080: 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 HOULD NOT REQUIR
6090: 45 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 E AN EXIT!!!!!!!
60a0: 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ...(debug:print
60b0: 31 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 73 1 "INFO: All tes
60c0: 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 09 09 ts launched")...
60d0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 (thread-sleep! 0
60e0: 2e 35 29 0a 09 09 3b 3b 20 46 49 58 4d 45 21 20 .5)...;; FIXME!
60f0: 54 68 69 73 20 68 61 72 73 68 20 65 78 69 74 20 This harsh exit
6100: 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 should not be ne
6110: 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 09 09 28 69 cessary.......(i
6120: 66 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 f (not *runremot
6130: 65 2a 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 09 e*)(exit)) ;; ..
6140: 09 23 66 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 .#f) ;; return a
6150: 20 23 66 20 61 73 20 61 20 68 69 6e 74 20 74 68 #f as a hint th
6160: 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65 0a 09 at we are done..
6170: 20 20 20 20 20 20 3b 3b 20 48 65 72 65 20 77 65 ;; Here we
6180: 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74 need to check t
6190: 68 61 74 20 61 6c 6c 20 74 68 65 20 74 65 73 74 hat all the test
61a0: 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 s remaining to b
61b0: 65 20 72 75 6e 20 61 72 65 20 65 6c 69 67 69 62 e run are eligib
61c0: 6c 65 20 74 6f 20 72 75 6e 0a 09 20 20 20 20 20 le to run..
61d0: 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 ;; and are not
61e0: 62 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65 blocked by faile
61f0: 64 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 d.. (let* (
6200: 28 6e 65 77 6c 73 74 20 28 6f 70 65 6e 2d 72 75 (newlst (open-ru
6210: 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a 66 69 n-close tests:fi
6220: 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c lter-non-runnabl
6230: 65 20 23 66 20 72 75 6e 2d 69 64 20 74 61 6c 20 e #f run-id tal
6240: 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29 20 3b test-records)) ;
6250: 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c ; i.e. not FAIL,
6260: 20 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c WAIVED, INCOMPL
6270: 45 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 ETE, PASS, KILLE
6280: 44 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e 6b 65 D,... (junke
6290: 64 20 28 6c 73 65 74 2d 64 69 66 66 65 72 65 6e d (lset-differen
62a0: 63 65 20 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65 ce equal? tal ne
62b0: 77 6c 73 74 29 29 29 0a 09 09 28 64 65 62 75 67 wlst)))...(debug
62c0: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 :print 4 "INFO:
62d0: 66 75 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75 67 full drop throug
62e0: 68 2c 20 69 66 20 72 65 72 75 6e 73 20 69 73 20 h, if reruns is
62f0: 6c 65 73 73 20 74 68 61 6e 20 31 30 30 20 77 65 less than 100 we
6300: 20 77 69 6c 6c 20 66 6f 72 63 65 20 72 65 74 72 will force retr
6310: 79 20 74 68 65 6d 3a 20 22 20 72 65 72 75 6e 73 y them: " reruns
6320: 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72 )...(if (< num-r
6330: 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74 72 69 etries max-retri
6340: 65 73 29 0a 09 09 20 20 20 20 28 73 65 74 21 20 es)... (set!
6350: 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64 20 72 newlst (append r
6360: 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a eruns newlst))).
6370: 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 ..(set! num-retr
6380: 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 ies (+ num-retri
6390: 65 73 20 31 29 29 0a 09 09 28 74 68 72 65 61 64 es 1))...(thread
63a0: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d -sleep! *global-
63b0: 64 65 6c 74 61 2a 29 0a 09 09 28 69 66 20 28 6e delta*)...(if (n
63c0: 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 ot (null? newlst
63d0: 29 29 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e 63 ))... ;; sinc
63e0: 65 20 72 65 72 75 6e 73 20 68 61 76 65 20 62 65 e reruns have be
63f0: 65 6e 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20 en tacked on to
6400: 6e 65 77 6c 73 74 20 63 72 65 61 74 65 20 6e 65 newlst create ne
6410: 77 20 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75 w reruns from ju
6420: 6e 6b 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70 nked... (loop
6430: 20 28 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 (car newlst)(cd
6440: 72 20 6e 65 77 6c 73 74 29 28 64 65 6c 65 74 65 r newlst)(delete
6450: 2d 64 75 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b -duplicates junk
6460: 65 64 29 29 29 29 29 29 29 29 29 0a 0a 3b 3b 20 ed)))))))))..;;
6470: 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20 74 parent-test is t
6480: 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65 68 here as a placeh
6490: 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20 70 older for when p
64a0: 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e 20 arent-tests can
64b0: 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74 75 be run as a setu
64c0: 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20 28 p step.(define (
64d0: 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 run:test run-id
64e0: 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 runname keyvalls
64f0: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c t test-record fl
6500: 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 ags parent-test)
6510: 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 . ;; All these
6520: 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 vars might be re
6530: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 ferenced by the
6540: 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 testconfig file
6550: 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 reader. (let* (
6560: 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 (test-name (t
6570: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
6580: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 et-testname te
6590: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 st-record)).. (t
65a0: 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 est-waitons (tes
65b0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
65c0: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 -waitons test
65d0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 -record)).. (tes
65e0: 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 t-conf (tests
65f0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
6600: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 estconfig test-r
6610: 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 ecord)).. (itemd
6620: 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 at (tests:t
6630: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 estqueue-get-ite
6640: 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 mdat test-rec
6650: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 ord)).. (test-pa
6660: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 th (conc *top
6670: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 path* "/tests/"
6680: 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 test-name)) ;; c
6690: 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 ould use tests:g
66a0: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 et-testconfig he
66b0: 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 re ..... (force
66c0: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
66d0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
66e0: 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 lags "-force" #f
66f0: 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 )).. (rerun
6700: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
6710: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 ef/default flags
6720: 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 "-rerun" #f))..
6730: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 (keepgoing (
6740: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
6750: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b efault flags "-k
6760: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 eepgoing" #f))..
6770: 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 (item-path
6780: 22 22 29 0a 09 20 28 64 62 20 20 20 20 20 20 20 "").. (db
6790: 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 64 65 #f)). (de
67a0: 62 75 67 3a 70 72 69 6e 74 20 34 0a 09 09 20 22 bug:print 4... "
67b0: 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 28 test-config: " (
67c0: 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 hash-table->alis
67d0: 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 20 t test-conf)...
67e0: 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 22 "\n itemdat: "
67f0: 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 20 itemdat... ).
6800: 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 65 ;; setting ite
6810: 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 69 mdat to a list i
6820: 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 28 f it is #f. (
6830: 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 29 if (not itemdat)
6840: 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 28 (set! itemdat '(
6850: 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 74 ))). (set! it
6860: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 em-path (item-li
6870: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 st->path itemdat
6880: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
6890: 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69 6e int 2 "Attemptin
68a0: 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 g to launch test
68b0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 " test-name (if
68c0: 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 (equal? item-pa
68d0: 74 68 20 22 2f 22 29 20 22 2f 22 20 69 74 65 6d th "/") "/" item
68e0: 2d 70 61 74 68 29 29 0a 20 20 20 20 28 73 65 74 -path)). (set
68f0: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d env "MT_TEST_NAM
6900: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b E" test-name) ;;
6910: 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d . (setenv "M
6920: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e T_RUNNAME" run
6930: 6e 61 6d 65 29 0a 20 20 20 20 28 6f 70 65 6e 2d name). (open-
6940: 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d 65 run-close set-me
6950: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 gatest-env-vars
6960: 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 db run-id) ;; th
6970: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 ese may be neede
6980: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 d by the launchi
6990: 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 ng process. (
69a0: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 change-directory
69b0: 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 *toppath*)..
69c0: 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 ;; Here is wher
69d0: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 e the test_meta
69e0: 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 table is best up
69f0: 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 dated. ;; Yes
6a00: 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 , another use of
6a10: 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 a global for ca
6a20: 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 ching. Need a be
6a30: 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 tter way?. (i
6a40: 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 f (not (hash-tab
6a50: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a le-ref/default *
6a60: 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 test-meta-update
6a70: 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 d* test-name #f)
6a80: 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e ). (begin
6a90: 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 .. (hash-table
6aa0: 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 -set! *test-meta
6ab0: 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e -updated* test-n
6ac0: 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 ame #t).
6ad0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
6ae0: 73 65 20 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 se runs:update-t
6af0: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 est_meta db test
6b00: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 -name test-conf)
6b10: 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 )). . ;; (
6b20: 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 lambda (itemdat)
6b30: 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 ;;; ((ripeness
6b40: 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d "overripe") (tem
6b50: 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 perature "cool")
6b60: 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 (season "summer
6b70: 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 ")). (let* ((
6b80: 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 new-test-path (s
6b90: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
6ba0: 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 e (cons test-pat
6bb0: 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d h (map cadr item
6bc0: 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 dat)) "/"))..
6bd0: 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 (new-test-name (
6be0: 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d if (equal? item-
6bf0: 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 path "") test-na
6c00: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 me (conc test-na
6c10: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 me "/" item-path
6c20: 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 ))) ;; just need
6c30: 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 it to be unique
6c40: 0a 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 .. (test-id
6c50: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
6c60: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d ose db:get-test-
6c70: 69 64 20 64 62 20 20 72 75 6e 2d 69 64 20 74 65 id db run-id te
6c80: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
6c90: 68 29 29 0a 09 20 20 20 28 74 65 73 74 64 61 74 h)).. (testdat
6ca0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e (open-run
6cb0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 -close db:get-te
6cc0: 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62 st-info-by-id db
6cd0: 20 74 65 73 74 2d 69 64 29 29 29 0a 20 20 20 20 test-id))).
6ce0: 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 64 (if (not testd
6cf0: 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 at).. (begin..
6d00: 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 ;; ensure tha
6d10: 74 20 74 68 65 20 70 61 74 68 20 65 78 69 73 74 t the path exist
6d20: 73 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65 s before registe
6d30: 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 20 ring the test..
6d40: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e ;; NOPE: Cann
6d50: 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 ot! Don't know y
6d60: 65 74 20 77 68 69 63 68 20 64 69 73 6b 20 61 72 et which disk ar
6d70: 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69 67 ea will be assig
6d80: 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 ned...... ;;
6d90: 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 6d (system (conc "m
6da0: 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 65 kdir -p " new-te
6db0: 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 3b st-path)).. ;
6dc0: 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65 6e 2d ;.. ;; (open-
6dd0: 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a run-close tests:
6de0: 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62 register-test db
6df0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
6e00: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 e item-path)..
6e10: 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 2f ;;.. ;; NB/
6e20: 2f 20 66 6f 72 20 74 68 65 20 61 62 6f 76 65 20 / for the above
6e30: 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20 74 68 65 line. I want the
6e40: 20 74 65 73 74 20 74 6f 20 62 65 20 72 65 67 69 test to be regi
6e50: 73 74 65 72 65 64 20 6c 6f 6e 67 20 62 65 66 6f stered long befo
6e60: 72 65 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 re this routine
6e70: 67 65 74 73 20 63 61 6c 6c 65 64 21 0a 09 20 20 gets called!..
6e80: 20 20 3b 3b 0a 09 20 20 20 20 28 73 65 74 21 20 ;;.. (set!
6e90: 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 test-id (open-ru
6ea0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 n-close db:get-t
6eb0: 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 est-id db run-id
6ec0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
6ed0: 70 61 74 68 29 29 0a 09 20 20 20 20 28 69 66 20 path)).. (if
6ee0: 28 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a 09 09 (not test-id)...
6ef0: 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 (begin... (debu
6f00: 67 3a 70 72 69 6e 74 20 32 20 22 57 41 52 4e 3a g:print 2 "WARN:
6f10: 20 54 65 73 74 20 6e 6f 74 20 70 72 65 2d 63 72 Test not pre-cr
6f20: 65 61 74 65 64 3f 20 74 65 73 74 2d 6e 61 6d 65 eated? test-name
6f30: 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 =" test-name ",
6f40: 69 74 65 6d 2d 70 61 74 68 3d 22 20 69 74 65 6d item-path=" item
6f50: 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d 69 64 3d -path ", run-id=
6f60: 22 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 28 6f " run-id)... (o
6f70: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
6f80: 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d :tests-register-
6f90: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 test db run-id t
6fa0: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
6fb0: 74 68 29 0a 09 09 20 20 28 73 65 74 21 20 74 65 th)... (set! te
6fc0: 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d st-id (open-run-
6fd0: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 close db:get-tes
6fe0: 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 20 74 t-id db run-id t
6ff0: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
7000: 74 68 29 29 29 29 0a 09 20 20 20 20 28 64 65 62 th)))).. (deb
7010: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f ug:print 4 "INFO
7020: 3a 20 74 65 73 74 2d 69 64 3d 22 20 74 65 73 74 : test-id=" test
7030: 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 -id ", run-id="
7040: 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d 6e run-id ", test-n
7050: 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 ame=" test-name
7060: 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 5c 22 22 ", item-path=\""
7070: 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 22 22 29 item-path "\"")
7080: 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74 .. (set! test
7090: 64 61 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c dat (open-run-cl
70a0: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d ose db:get-test-
70b0: 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62 20 74 65 info-by-id db te
70c0: 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20 st-id)))).
70d0: 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 64 (set! test-id (d
70e0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
70f0: 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 63 stdat)). (c
7100: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 hange-directory
7110: 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 test-path).
7120: 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 (case (if force
7130: 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 ;; (args:get-ar
7140: 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e g "-force")...'N
7150: 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 OT_STARTED...(if
7160: 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 testdat... (
7170: 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 string->symbol (
7180: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
7190: 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 estdat))... '
71a0: 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 failed-to-insert
71b0: 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d ))..((failed-to-
71c0: 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 insert).. (debug
71d0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
71e0: 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 Failed to inser
71f0: 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 t the record int
7200: 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e o the db"))..((N
7210: 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c OT_STARTED COMPL
7220: 45 54 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72 ETED).. (let ((r
7230: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 unflag #f))..
7240: 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 (cond.. ;; -f
7250: 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 orce, run no mat
7260: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 ter what.. (f
7270: 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c orce (set! runfl
7280: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
7290: 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e NOT_STARTED, run
72a0: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a no matter what.
72b0: 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20 28 74 . ((equal? (t
72c0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
72d0: 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 stdat) "NOT_STAR
72e0: 54 45 44 22 29 28 73 65 74 21 20 72 75 6e 66 6c TED")(set! runfl
72f0: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
7300: 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 not -rerun and P
7310: 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 ASS, WARN or CHE
7320: 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 CK, do no run..
7330: 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f ((and (or (no
7340: 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20 20 t rerun)...
7350: 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 keepgoing)...
7360: 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66 6f ;; Require to fo
7370: 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 rce re-run for C
7380: 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 OMPLETED or *any
7390: 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 thing* + PASS,WA
73a0: 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 RN or CHECK...
73b0: 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65 73 (or (member (tes
73c0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
73d0: 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20 22 tdat) '("PASS" "
73e0: 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 0a WARN" "CHECK")).
73f0: 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20 .. (member
7400: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
7410: 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d testdat) '("COM
7420: 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20 20 PLETED")))) ..
7430: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
7440: 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 2 "INFO: running
7450: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d test " test-nam
7460: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 e "/" item-path
7470: 22 20 73 75 70 70 72 65 73 73 65 64 20 61 73 20 " suppressed as
7480: 69 74 20 69 73 20 22 20 28 74 65 73 74 3a 67 65 it is " (test:ge
7490: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
74a0: 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67 " and " (test:g
74b0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
74c0: 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 t)).. (set!
74d0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 runflag #f))..
74e0: 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 ;; -rerun and
74f0: 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 status is one of
7500: 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 the specifed, r
7510: 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 un it.. ((and
7520: 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a rerun... (let*
7530: 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73 ((rerunlst (s
7540: 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 tring-split reru
7550: 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 n ",")).... (mus
7560: 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 t-rerun (member
7570: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
7580: 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c testdat) rerunl
7590: 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 65 62 st)))... (deb
75a0: 75 67 3a 70 72 69 6e 74 20 33 20 22 49 4e 46 4f ug:print 3 "INFO
75b0: 3a 20 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 : -rerun list: "
75c0: 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 rerun ", test-s
75d0: 74 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 tatus: " (test:g
75e0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
75f0: 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a t)", must-rerun:
7600: 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 " must-rerun)..
7610: 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 . must-rerun)
7620: 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 ).. (debug:p
7630: 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 52 65 rint 2 "INFO: Re
7640: 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 run forced for t
7650: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
7660: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 "/" item-path)..
7670: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c (set! runfl
7680: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
7690: 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e -keepgoing, do n
76a0: 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 ot rerun FAIL..
76b0: 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 ((and keepgoi
76c0: 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 ng... (member (
76d0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
76e0: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c testdat) '("FAIL
76f0: 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 "))).. (set!
7700: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 runflag #f))..
7710: 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 ((and (not re
7720: 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 run)... (member
7730: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
7740: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 s testdat) '("FA
7750: 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 IL" "n/a")))..
7760: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
7770: 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 #t)).. (else
7780: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
7790: 66 29 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a f))).. (debug:
77a0: 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 print 6 "RUNNING
77b0: 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 => runflag: " r
77c0: 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 unflag " STATE:
77d0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
77e0: 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 e testdat) " STA
77f0: 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 TUS: " (test:get
7800: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
7810: 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 ).. (if (not r
7820: 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 unflag)..
7830: 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d (if (not parent-
7840: 74 65 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 test)... (debu
7850: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a g:print 1 "NOTE:
7860: 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 Not starting te
7870: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 st " new-test-na
7880: 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 me " as it is st
7890: 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 ate \"" (test:ge
78a0: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
78b0: 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 ....."\" and st
78c0: 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 atus \"" (test:g
78d0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
78e0: 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 t) "\", use -rer
78f0: 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 un \"" (test:get
7900: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
7910: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
7920: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7930: 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 "\" or -force t
7940: 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 o override"))..
7950: 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e ;; NOTE: N
7960: 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 o longer be chec
7970: 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 king prerequisit
7980: 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 es here! Will ne
7990: 76 65 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c ver get here unl
79a0: 65 73 73 20 70 72 65 72 65 71 73 20 61 72 65 0a ess prereqs are.
79b0: 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 . ;;
79c0: 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 already met...
79d0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 (if (not (
79e0: 6c 61 75 6e 63 68 2d 74 65 73 74 20 23 66 20 72 launch-test #f r
79f0: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 un-id runname te
7a00: 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 st-conf keyvalls
7a10: 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 t test-name test
7a20: 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c -path itemdat fl
7a30: 61 67 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 ags))... (begi
7a40: 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 n... (print
7a50: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 "ERROR: Failed t
7a60: 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 o launch the tes
7a70: 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f t. Exiting as so
7a80: 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 on as possible")
7a90: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 ... (set! *g
7aa0: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a lobalexitstatus*
7ab0: 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 1) ;; ... (
7ac0: 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 process-signal (
7ad0: 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d current-process-
7ae0: 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 id) signal/kill)
7af0: 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 )))))..((KILLED)
7b00: 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
7b10: 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 1 "NOTE: " new-
7b20: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 test-name " is a
7b30: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f lready running o
7b40: 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 r was explictly
7b50: 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 killed, use -for
7b60: 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e ce to launch it.
7b70: 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 "))..((LAUNCHED
7b80: 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 REMOTEHOSTSTART
7b90: 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 RUNNING) .. (if
7ba0: 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d (> (- (current-
7bb0: 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 seconds)(+ (db:t
7bc0: 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 est-get-event_ti
7bd0: 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 me testdat).....
7be0: 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d (db:test-
7bf0: 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e get-run_duration
7c00: 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 testdat)))...60
7c10: 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 0) ;; i.e. no up
7c20: 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 date for more th
7c30: 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 an 600 seconds..
7c40: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 (begin..
7c50: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
7c60: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 0 "WARNING: Tes
7c70: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 t " test-name "
7c80: 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 appears to be de
7c90: 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 ad. Forcing it t
7ca0: 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 o state INCOMPLE
7cb0: 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 TE and status ST
7cc0: 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 UCK/DEAD")..
7cd0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
7ce0: 73 65 20 74 65 73 74 73 3a 74 65 73 74 2d 73 65 se tests:test-se
7cf0: 74 2d 73 74 61 74 75 73 21 20 64 62 20 74 65 73 t-status! db tes
7d00: 74 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 t-id "INCOMPLETE
7d10: 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22 " "STUCK/DEAD" "
7d20: 54 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 Test is stuck or
7d30: 20 64 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 dead" #f))..
7d40: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
7d50: 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e "NOTE: " test-n
7d60: 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 ame " is already
7d70: 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 running")))..(e
7d80: 6c 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67 lse (debug
7d90: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
7da0: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 Failed to launc
7db0: 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 h test " new-tes
7dc0: 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f t-name ". Unreco
7dd0: 67 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28 gnised state " (
7de0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
7df0: 65 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b estdat)))))))..;
7e00: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
7e10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7e20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7e30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7e40: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f =======.;; END O
7e50: 46 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d F NEW STUFF.;;==
7e60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7e70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7e80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7ea0: 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 ====..(define (g
7eb0: 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 et-dir-up-n dir
7ec0: 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 . params) . (le
7ed0: 74 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 t ((dparts (str
7ee0: 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f ing-split dir "/
7ef0: 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 "))..(count (i
7f00: 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 f (null? params)
7f10: 20 31 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 1 (car params))
7f20: 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 )). (conc "/"
7f30: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
7f40: 65 72 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 erse .. (t
7f50: 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c ake dparts (- (l
7f60: 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 63 6f ength dparts) co
7f70: 75 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f unt)).. "/
7f80: 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 ")))).;; Remove
7f90: 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 runs.;; fields a
7fa0: 72 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 re passing in th
7fb0: 72 6f 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e rough .;; action
7fc0: 3a 0a 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d :.;; 'remove-
7fd0: 72 75 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d runs.;; 'set-
7fe0: 73 74 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a state-status.;;.
7ff0: 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 ;; NB// should p
8000: 61 73 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a ass in keys?.;;.
8010: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 (define (runs:op
8020: 65 72 61 74 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 erate-on action
8030: 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 runnamepatt test
8040: 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 23 21 patt itempatt #!
8050: 6b 65 79 20 28 73 74 61 74 65 20 23 66 29 28 73 key (state #f)(s
8060: 74 61 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74 tatus #f)(new-st
8070: 61 74 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a ate-status #f)).
8080: 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 (let* ((db
8090: 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 #f).. (ke
80a0: 79 73 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e ys (open
80b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 -run-close db:ge
80c0: 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 t-keys db)).. (r
80d0: 75 6e 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 undat (ope
80e0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 n-run-close runs
80f0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 :get-runs-by-pat
8100: 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d t db keys runnam
8110: 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 epatt)).. (heade
8120: 72 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d r (vector-
8130: 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 ref rundat 0))..
8140: 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 (runs (
8150: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
8160: 74 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 t 1)).. (states
8170: 20 20 20 20 20 20 28 69 66 20 73 74 61 74 65 20 (if state
8180: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 (string-split s
8190: 74 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 tate ",") '()))
81a0: 0a 09 20 28 73 74 61 74 75 73 65 73 20 20 20 20 .. (statuses
81b0: 20 28 69 66 20 73 74 61 74 75 73 20 28 73 74 72 (if status (str
81c0: 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 ing-split status
81d0: 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 ",") '())).. (s
81e0: 74 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 tate-status (if
81f0: 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 (string? new-sta
8200: 74 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 te-status) (stri
8210: 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 ng-split new-sta
8220: 74 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 te-status ",") '
8230: 28 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 (#f #f)))). (
8240: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 48 debug:print 2 "H
8250: 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 eader: " header
8260: 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 " action: " acti
8270: 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 on " new-state-s
8280: 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 tatus: " new-sta
8290: 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 te-status). (
82a0: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c for-each. (l
82b0: 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 ambda (run).
82c0: 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 (let ((runkey
82d0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
82e0: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 erse (map (lambd
82f0: 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a a (k).......(db:
8300: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
8310: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 der run header (
8320: 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 vector-ref k 0))
8330: 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 ) keys) "/"))..
8340: 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d (dirs-to-rem
8350: 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 ove (make-hash-t
8360: 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 able))).. (let*
8370: 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a ((run-id (db:
8380: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
8390: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
83a0: 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 id"))...(run-sta
83b0: 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 te (db:get-value
83c0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
83d0: 65 61 64 65 72 20 22 73 74 61 74 65 22 29 29 0a eader "state")).
83e0: 09 09 28 74 65 73 74 73 20 20 20 20 20 28 69 66 ..(tests (if
83f0: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 (not (equal? ru
8400: 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 n-state "locked"
8410: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6f 70 )).... (op
8420: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
8430: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 get-tests-for-ru
8440: 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c n db (db:get-val
8450: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
8460: 20 68 65 61 64 65 72 20 22 69 64 22 29 0a 09 09 header "id")...
8470: 09 09 09 09 20 20 20 20 20 20 74 65 73 74 70 61 .... testpa
8480: 74 74 20 69 74 65 6d 70 61 74 74 20 73 74 61 74 tt itempatt stat
8490: 65 73 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 es statuses.....
84a0: 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 .. not-in:
84b0: 20 23 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 #f.......
84c0: 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 sort-by: (case a
84d0: 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 ction......... (
84e0: 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 (remove-runs) 'r
84f0: 75 6e 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 undir).........
8500: 28 65 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 (else '
8510: 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 event_time)))...
8520: 09 20 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 . '()))...
8530: 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 (lasttpath "/doe
8540: 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f s/not/exist/I/ho
8550: 70 65 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28 pe"))... (if (
8560: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 not (null? tests
8570: 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 )).. (begi
8580: 6e 0a 09 09 20 28 63 61 73 65 20 61 63 74 69 6f n... (case actio
8590: 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d n... ((remove-
85a0: 72 75 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62 runs)... (deb
85b0: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
85c0: 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 ving tests for r
85d0: 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 un: " runkey " "
85e0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
85f0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
8600: 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 der "runname")))
8610: 0a 09 09 20 20 20 28 28 73 65 74 2d 73 74 61 74 ... ((set-stat
8620: 65 2d 73 74 61 74 75 73 29 0a 09 09 20 20 20 20 e-status)...
8630: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
8640: 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 74 65 20 Modifying state
8650: 61 6e 64 20 73 74 61 75 73 20 66 6f 72 20 74 65 and staus for te
8660: 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 sts for run: " r
8670: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 unkey " " (db:ge
8680: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
8690: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 r run header "ru
86a0: 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 nname")))... (
86b0: 65 6c 73 65 0a 09 09 20 20 20 20 28 70 72 69 6e else... (prin
86c0: 74 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f 6e 20 t "INFO: action
86d0: 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22 not recognised "
86e0: 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 action)))... (f
86f0: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d or-each... (lam
8700: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 bda (test)...
8710: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 (let* ((item-pa
8720: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
8730: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
8740: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d .... (test-nam
8750: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 e (db:test-get-t
8760: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 estname test))..
8770: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 .. (run-dir
8780: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
8790: 64 69 72 20 74 65 73 74 29 29 0a 09 09 09 20 20 dir test))....
87a0: 20 28 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a (test-id (db:
87b0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
87c0: 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 )))... ;;
87d0: 20 28 74 64 62 20 20 20 20 20 20 20 28 64 62 3a (tdb (db:
87e0: 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e open-test-db run
87f0: 2d 64 69 72 29 29 29 0a 09 09 20 20 20 20 20 20 -dir)))...
8800: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
8810: 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 " (db:test-get
8820: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 -testname test)
8830: 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 " id: " (db:test
8840: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 -get-id test) "
8850: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63 " item-path " ac
8860: 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a tion: " action).
8870: 09 09 20 20 20 20 20 20 28 63 61 73 65 20 61 63 .. (case ac
8880: 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 tion....((remove
8890: 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65 20 74 64 -runs) ;; the td
88a0: 62 20 69 73 20 66 6f 72 20 66 75 74 75 72 65 20 b is for future
88b0: 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09 09 20 28 possible. .... (
88c0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
88d0: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 b:delete-test-re
88e0: 63 6f 72 64 73 20 64 62 20 23 66 20 28 64 62 3a cords db #f (db:
88f0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
8900: 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 )).... (debug:pr
8910: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 74 74 int 1 "INFO: Att
8920: 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 empting to remov
8930: 65 20 64 69 72 20 22 20 72 75 6e 2d 64 69 72 29 e dir " run-dir)
8940: 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 28 3e .... (if (and (>
8950: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 (string-length
8960: 72 75 6e 2d 64 69 72 29 20 35 29 0a 09 09 09 09 run-dir) 5).....
8970: 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 (file-exists?
8980: 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 run-dir)) ;; bad
8990: 20 68 65 75 72 69 73 74 69 63 20 62 75 74 20 73 heuristic but s
89a0: 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 hould prevent /t
89b0: 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 mp /home etc....
89c0: 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72 65 . (let* ((re
89d0: 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d alpath (resolve-
89e0: 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 pathname run-dir
89f0: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 ))).... (d
8a00: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e ebug:print 1 "IN
8a10: 46 4f 3a 20 52 65 61 6c 20 70 61 74 68 20 6f 66 FO: Real path of
8a20: 20 69 73 20 22 20 72 65 61 6c 70 61 74 68 29 0a is " realpath).
8a30: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 ... (if (f
8a40: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c ile-exists? real
8a50: 70 61 74 68 29 0a 09 09 09 09 20 20 20 28 69 66 path)..... (if
8a60: 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e (> (system (con
8a70: 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c c "rm -rf " real
8a80: 70 61 74 68 29 29 20 30 29 0a 09 09 09 09 20 20 path)) 0).....
8a90: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
8aa0: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 t 0 "ERROR: Ther
8ab0: 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 e was a problem
8ac0: 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 70 removing " realp
8ad0: 61 74 68 20 22 20 77 69 74 68 20 72 6d 20 2d 66 ath " with rm -f
8ae0: 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 "))..... (debu
8af0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
8b00: 4e 47 3a 20 74 65 73 74 20 72 75 6e 20 64 69 72 NG: test run dir
8b10: 20 22 20 72 65 61 6c 70 61 74 68 20 22 20 61 70 " realpath " ap
8b20: 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 pears to not exi
8b30: 73 74 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 st"))....
8b40: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 (if (file-exists
8b50: 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b 20 74 68 ? run-dir) ;; th
8b60: 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20 20 28 69 e link..... (i
8b70: 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b f (symbolic-link
8b80: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 ? run-dir).....
8b90: 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 66 69 (delete-fi
8ba0: 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 le run-dir).....
8bb0: 20 20 20 20 20 20 20 28 69 66 20 28 64 69 72 65 (if (dire
8bc0: 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a ctory? run-dir).
8bd0: 09 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 ..... (if (> (
8be0: 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 directory-fold (
8bf0: 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31 lambda (f x)(+ 1
8c00: 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20 x)) 0 run-dir)
8c10: 30 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 0)...... (
8c20: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
8c30: 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 ARNING: refusing
8c40: 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e to remove " run
8c50: 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73 20 -dir " as it is
8c60: 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09 not empty").....
8c70: 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d . (delete-
8c80: 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 directory run-di
8c90: 72 29 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64 r)) ;; it should
8ca0: 20 62 65 20 65 6d 70 74 79 20 62 79 20 68 65 72 be empty by her
8cb0: 65 20 42 55 47 20 42 55 47 2c 20 61 64 64 20 65 e BUG BUG, add e
8cc0: 72 72 6f 72 20 63 61 74 63 68 0a 09 09 09 09 09 rror catch......
8cd0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8ce0: 30 20 22 45 52 52 4f 52 3a 20 72 65 66 75 73 69 0 "ERROR: refusi
8cf0: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 ng to remove " r
8d00: 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 un-dir " as it i
8d10: 73 20 6e 65 69 74 68 65 72 20 61 20 73 79 6d 6c s neither a syml
8d20: 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72 65 63 74 ink nor a direct
8d30: 6f 72 79 22 29 0a 09 09 09 09 09 20 20 20 29 29 ory")...... ))
8d40: 29 29 0a 09 09 09 20 20 20 20 20 28 64 65 62 75 )).... (debu
8d50: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
8d60: 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20 61 6c NG: directory al
8d70: 72 65 61 64 79 20 72 65 6d 6f 76 65 64 20 22 20 ready removed "
8d80: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 28 28 run-dir)))....((
8d90: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 set-state-status
8da0: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 ).... (debug:pri
8db0: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77 20 nt 2 "INFO: new
8dc0: 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74 61 state " (car sta
8dd0: 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 te-status) ", ne
8de0: 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64 72 w status " (cadr
8df0: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a state-status)).
8e00: 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c ... (open-run-cl
8e10: 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d ose db:test-set-
8e20: 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d state-status-by-
8e30: 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 id db (db:test-g
8e40: 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 et-id test) (car
8e50: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 state-status)(c
8e60: 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 adr state-status
8e70: 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 74 65 ) #f)))))... te
8e80: 73 74 73 29 29 29 0a 09 20 20 20 0a 09 20 20 20 sts))).. ..
8e90: 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 ;; remove the ru
8ea0: 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 n if zero tests
8eb0: 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28 remain.. (if (
8ec0: 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f eq? action 'remo
8ed0: 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20 ve-runs)..
8ee0: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 (let ((remtests
8ef0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
8f00: 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f db:get-tests-fo
8f10: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 r-run db (db:get
8f20: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
8f30: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 run header "id"
8f40: 29 20 23 66 20 23 66 20 27 28 22 44 45 4c 45 54 ) #f #f '("DELET
8f50: 45 44 22 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f ED") '("n/a") no
8f60: 74 2d 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 t-in: #t)))... (
8f70: 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 if (null? remtes
8f80: 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 ts) ;; no more t
8f90: 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 ests remaining..
8fa0: 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 . (let* ((dp
8fb0: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 arts (string-sp
8fc0: 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f lit lasttpath "/
8fd0: 22 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 ")).... (runp
8fe0: 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 ath (conc "/" (s
8ff0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
9000: 65 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 e .......(take d
9010: 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 parts (- (length
9020: 20 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 dparts) 1))....
9030: 09 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 ..."/"))))...
9040: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
9050: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 1 "Removing run
9060: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 : " runkey " " (
9070: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
9080: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
9090: 72 20 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 r "runname") " a
90a0: 6e 64 20 72 65 6c 61 74 65 64 20 72 65 63 6f 72 nd related recor
90b0: 64 22 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 d")... (op
90c0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
90d0: 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 delete-run db ru
90e0: 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b n-id)... ;
90f0: 3b 20 54 68 69 73 20 69 73 20 61 20 70 72 65 74 ; This is a pret
9100: 74 79 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f ty good place to
9110: 20 70 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 purge old DELET
9120: 45 44 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 ED tests...
9130: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
9140: 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 e db:delete-test
9150: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e s-for-run db run
9160: 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 28 6f -id)... (o
9170: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
9180: 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 :delete-old-dele
9190: 74 65 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 ted-test-records
91a0: 20 64 62 29 0a 09 09 20 20 20 20 20 20 20 28 6f db)... (o
91b0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
91c0: 3a 73 65 74 2d 76 61 72 20 64 62 20 22 44 45 4c :set-var db "DEL
91d0: 45 54 45 44 5f 54 45 53 54 53 22 20 28 63 75 72 ETED_TESTS" (cur
91e0: 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 rent-seconds))..
91f0: 09 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 . ;; need
9200: 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 to figure out th
9210: 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 e path to the ru
9220: 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 n dir and remove
9230: 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 it if empty...
9240: 20 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 ;; (if
9250: 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f (null? (glob (co
9260: 6e 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 nc runpath "/*")
9270: 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 ))... ;;
9280: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 (begin...
9290: 20 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 ;; . (debu
92a0: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 g:print 1 "Remov
92b0: 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 ing run dir " ru
92c0: 6e 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 npath)...
92d0: 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f ;; . (system (co
92e0: 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 nc "rmdir -p " r
92f0: 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 unpath))))...
9300: 20 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 ))))).. )).
9310: 20 20 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d runs)))..;;=
9320: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9330: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9360: 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 =====.;; Routine
9370: 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 s for manipulati
9380: 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d ng runs.;;======
9390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
93a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
93b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
93c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
93d0: 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 ..;; Since many
93e0: 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 calls to a run r
93f0: 65 71 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 equire pretty mu
9400: 63 68 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 ch the same setu
9410: 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 p .;; this wrapp
9420: 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 er is used to re
9430: 64 75 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 duce the replica
9440: 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 tion of code.(de
9450: 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 fine (general-ru
9460: 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d n-call switchnam
9470: 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 e action-desc pr
9480: 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e oc). (let ((run
9490: 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 name (args:get-a
94a0: 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a rg ":runname")).
94b0: 09 28 74 61 72 67 65 74 20 20 28 69 66 20 28 61 .(target (if (a
94c0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
94d0: 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 rget")... (a
94e0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
94f0: 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 rget")... (a
9500: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
9510: 71 74 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 qtarg")))..(th1
9520: 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f #f)). (co
9530: 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 nd. ((not ta
9540: 72 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 rget). (deb
9550: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
9560: 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 R: Missing requi
9570: 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f red parameter fo
9580: 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 r " switchname "
9590: 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 , you must speci
95a0: 66 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69 fy the target wi
95b0: 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 th -target").
95c0: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 (exit 3)).
95d0: 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 ((not runname)
95e0: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
95f0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 int 0 "ERROR: Mi
9600: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 ssing required p
9610: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 arameter for " s
9620: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 witchname ", you
9630: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 must specify th
9640: 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 e run name with
9650: 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 :runname runname
9660: 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 "). (exit 3
9670: 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 )). (else.
9680: 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 (let ((db
9690: 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 #f).. (keys #
96a0: 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 f))..(if (not (s
96b0: 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 etup-for-run))..
96c0: 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 (begin ..
96d0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
96e0: 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 0 "Failed to set
96f0: 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 up, exiting")..
9700: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a (exit 1))).
9710: 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 .(if (args:get-a
9720: 72 67 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 rg "-server")..
9730: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
9740: 73 65 20 73 65 72 76 65 72 3a 73 74 61 72 74 20 se server:start
9750: 64 62 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 db (args:get-arg
9760: 20 22 2d 73 65 72 76 65 72 22 29 29 0a 09 20 20 "-server"))..
9770: 20 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20 28 (if (not (or (
9780: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 args:get-arg "-r
9790: 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20 72 unall") ;; r
97a0: 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65 73 unall and runtes
97b0: 74 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 74 ts are allowed t
97c0: 6f 20 62 65 20 73 65 72 76 65 72 73 0a 09 09 09 o be servers....
97d0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
97e0: 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a 09 09 -runtests")))...
97f0: 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73 (server:client-s
9800: 65 74 75 70 29 29 29 0a 09 28 73 65 74 21 20 6b etup)))..(set! k
9810: 65 79 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c eys (open-run-cl
9820: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 ose db:get-keys
9830: 64 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e db))..;; have en
9840: 6f 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 ough to process
9850: 2d 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 -target or -reqt
9860: 61 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 arg here..(if (a
9870: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
9880: 71 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 qtarg").. (le
9890: 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 t* ((runconfigf
98a0: 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
98b0: 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f "/runconfigs.co
98c0: 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f nfig")) ;; DO NO
98d0: 54 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a T EVALUATE ALL .
98e0: 09 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 .. (runconfig
98f0: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 (read-config ru
9900: 6e 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 nconfigf #f #f e
9910: 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 nviron-patt: #f)
9920: 29 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 )) .. (if (
9930: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
9940: 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 efault runconfig
9950: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
9960: 2d 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 -reqtarg") #f)..
9970: 09 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d . (keys:target-
9980: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 set-args keys (a
9990: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
99a0: 71 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 qtarg") args:arg
99b0: 2d 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 -hash)... (begi
99c0: 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 n... (debug:p
99d0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b rint 0 "ERROR: [
99e0: 22 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 " (args:get-arg
99f0: 22 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e "-reqtarg") "] n
9a00: 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 ot found in " ru
9a10: 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 nconfigf)...
9a20: 28 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a (if db (sqlite3:
9a30: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 finalize! db))..
9a40: 09 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 . (exit 1))))
9a50: 0a 09 20 20 20 20 28 69 66 20 28 61 72 67 73 3a .. (if (args:
9a60: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 get-arg "-target
9a70: 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 ")...(keys:targe
9a80: 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 t-set-args keys
9a90: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
9aa0: 74 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 target" args:arg
9ab0: 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d -hash) args:arg-
9ac0: 68 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f hash)))..(if (no
9ad0: 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e t (car *configin
9ae0: 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 fo*)).. (begi
9af0: 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a n.. (debug:
9b00: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
9b10: 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 Attempted to " a
9b20: 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 ction-desc " but
9b30: 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 run area config
9b40: 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 file not found"
9b50: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 ).. (exit 1
9b60: 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 )).. ;; Extra
9b70: 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 ct out stuff nee
9b80: 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d ded in most or m
9b90: 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b any calls.. ;
9ba0: 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c ; here then call
9bb0: 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a proc.. (let*
9bc0: 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d ((keynames (m
9bd0: 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 ap key:get-field
9be0: 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 name keys))...
9bf0: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 (keyvallst (ke
9c00: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 ys->vallist keys
9c10: 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 #t))).. (p
9c20: 72 6f 63 20 74 61 72 67 65 74 20 72 75 6e 6e 61 roc target runna
9c30: 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 me keys keynames
9c40: 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 keyvallst)))..(
9c50: 69 66 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a if th1 (thread-j
9c60: 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 69 66 20 oin! th1))..(if
9c70: 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 db (sqlite3:fina
9c80: 6c 69 7a 65 21 20 64 62 29 29 0a 09 28 73 65 74 lize! db))..(set
9c90: 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a ! *didsomething*
9ca0: 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d #t))))))..;;===
9cb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9cc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9cd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9ce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9cf0: 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f ===.;; Lock/unlo
9d00: 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d ck runs.;;======
9d10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9d20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9d30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9d40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9d50: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
9d60: 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 handle-locking t
9d70: 61 72 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 arget keys runna
9d80: 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 me lock unlock u
9d90: 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 ser). (let* ((d
9da0: 62 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 72 b #f).. (r
9db0: 75 6e 64 61 74 20 20 20 28 6f 70 65 6e 2d 72 75 undat (open-ru
9dc0: 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 n-close runs:get
9dd0: 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 -runs-by-patt db
9de0: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a keys runname)).
9df0: 09 20 28 68 65 61 64 65 72 20 20 20 28 76 65 63 . (header (vec
9e00: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 tor-ref rundat 0
9e10: 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 )).. (runs (
9e20: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
9e30: 74 20 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d t 1))). (for-
9e40: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 each (lambda (ru
9e50: 6e 29 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d n)...(let ((run-
9e60: 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 id (db:get-value
9e70: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
9e80: 65 61 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 eader "id")))...
9e90: 20 20 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 (if (or lock..
9ea0: 09 09 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a .. (and unlock.
9eb0: 09 09 09 20 20 20 20 20 20 20 28 62 65 67 69 6e ... (begin
9ec0: 0a 09 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f ..... (print "Do
9ed0: 20 79 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 you really wish
9ee0: 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 to unlock run "
9ef0: 20 72 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 run-id "?\n y
9f00: 2f 6e 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 /n: ")..... (equ
9f10: 61 6c 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 al? "y" (read-li
9f20: 6e 65 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 ne)))))...
9f30: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
9f40: 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 db:lock/unlock-r
9f50: 75 6e 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 un db run-id loc
9f60: 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 k unlock user)..
9f70: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
9f80: 69 6e 74 20 30 20 22 49 4e 46 4f 3a 20 53 6b 69 int 0 "INFO: Ski
9f90: 70 70 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 pping lock/unloc
9fa0: 6b 20 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 k on " run-id)))
9fb0: 29 0a 09 20 20 20 20 20 20 72 75 6e 73 29 29 29 ).. runs)))
9fc0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
9fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9fe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9ff0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a000: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c =========.;; Rol
a010: 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d lup runs.;;=====
a020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a060: 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 =..;; Update the
a070: 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 test_meta table
a080: 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 for this test.(
a090: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 define (runs:upd
a0a0: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 ate-test_meta db
a0b0: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
a0c0: 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 conf). (let ((c
a0d0: 75 72 72 72 65 63 6f 72 64 20 28 6f 70 65 6e 2d urrrecord (open-
a0e0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 run-close db:tes
a0f0: 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 tmeta-get-record
a100: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 db test-name)))
a110: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 . (if (not cu
a120: 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 rrrecord)..(begi
a130: 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 n.. (set! currr
a140: 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 ecord (make-vect
a150: 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 6f or 10 #f)).. (o
a160: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
a170: 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 :testmeta-add-re
a180: 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d cord db test-nam
a190: 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 e))). (for-ea
a1a0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
a1b0: 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c (key). (l
a1c0: 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 et* ((idx (cadr
a1d0: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c key)).. (fl
a1e0: 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 d (car key))..
a1f0: 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 (val (confi
a200: 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f g-lookup test-co
a210: 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 nf "test_meta" f
a220: 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 ld))).. ;; (debu
a230: 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20 g:print 5 "idx:
a240: 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66 " idx " fld: " f
a250: 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 ld " val: " val)
a260: 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 .. (if (and val
a270: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 (not (equal? (ve
a280: 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 ctor-ref currrec
a290: 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a ord idx) val))).
a2a0: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 . (begin..
a2b0: 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 (print "Upd
a2c0: 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d ating " test-nam
a2d0: 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 e " " fld " to "
a2e0: 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 6f val).. (o
a2f0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
a300: 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 :testmeta-update
a310: 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e -field db test-n
a320: 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 ame fld val)))))
a330: 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 . '(("author
a340: 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 " 2)("owner" 3)(
a350: 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 "description" 4)
a360: 28 22 72 65 76 69 65 77 65 64 22 20 35 29 28 22 ("reviewed" 5)("
a370: 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b tags" 9)))))..;;
a380: 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 Update test_met
a390: 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a a for all tests.
a3a0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 (define (runs:up
a3b0: 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 date-all-test_me
a3c0: 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 ta db). (let ((
a3d0: 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d test-names (get-
a3e0: 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 all-legal-tests)
a3f0: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
a400: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
a410: 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 test-name).
a420: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 (let* ((test-p
a430: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f ath (conc *to
a440: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 ppath* "/tests/"
a450: 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 test-name))..
a460: 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 (test-config
a470: 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 f (conc test-pat
a480: 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 h "/testconfig")
a490: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 65 78 ).. (testex
a4a0: 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c ists (and (fil
a4b0: 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 e-exists? test-c
a4c0: 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 onfigf)(file-rea
a4d0: 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 d-access? test-c
a4e0: 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 onfigf)))..
a4f0: 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 ;; read configs
a500: 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 with tricks tur
a510: 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f ned off (i.e. no
a520: 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 system)..
a530: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 (test-conf (i
a540: 66 20 74 65 73 74 65 78 69 73 74 73 20 28 72 65 f testexists (re
a550: 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 ad-config test-c
a560: 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 onfigf #f #f)(ma
a570: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 ke-hash-table)))
a580: 29 0a 09 20 3b 3b 20 75 73 65 20 74 68 65 20 6f ).. ;; use the o
a590: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 69 6e pen-run-close in
a5a0: 73 74 65 61 64 20 6f 66 20 70 61 73 73 69 6e 67 stead of passing
a5b0: 20 69 6e 20 64 62 0a 09 20 28 72 75 6e 73 3a 75 in db.. (runs:u
a5c0: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 pdate-test_meta
a5d0: 23 66 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 #f test-name tes
a5e0: 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 t-conf))). t
a5f0: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b est-names)))..;;
a600: 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 This could prob
a610: 61 62 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 ably be refactor
a620: 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 ed into one comp
a630: 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 lex query ....(d
a640: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c efine (runs:roll
a650: 75 70 2d 72 75 6e 20 6b 65 79 73 20 6b 65 79 76 up-run keys keyv
a660: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 allst runname us
a670: 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 er) ;; was targe
a680: 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 t, now keyvallst
a690: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
a6a0: 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 4 "runs:rollup-r
a6b0: 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 un, keys: " keys
a6c0: 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 " keyvallst: "
a6d0: 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e keyvallst " :run
a6e0: 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 name " runname "
a6f0: 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 user: " user).
a700: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 (let* ((db
a710: 20 20 20 20 20 20 20 20 20 23 66 29 20 3b 3b 20 #f) ;;
a720: 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 (keyvalllst
a730: 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b (keys:target->k
a740: 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 eyval keys targe
a750: 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 t)).. (new-run-i
a760: 64 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e d (open-run
a770: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 -close runs:regi
a780: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
a790: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 keyvallst runna
a7a0: 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 me "new" "n/a" u
a7b0: 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 ser)).. (prev-te
a7c0: 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 sts (open-r
a7d0: 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 3a 67 65 un-close test:ge
a7e0: 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69 t-matching-previ
a7f0: 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 ous-test-run-rec
a800: 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d ords db new-run-
a810: 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 28 id "%" "%")).. (
a820: 63 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 20 curr-tests
a830: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
a840: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db:get-tests-for
a850: 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d -run db new-run-
a860: 69 64 20 22 25 22 20 22 25 22 20 27 28 29 20 27 id "%" "%" '() '
a870: 28 29 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 ())).. (curr-tes
a880: 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 ts-hash (make-ha
a890: 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 sh-table))).
a8a0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
a8b0: 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 db:update-run-ev
a8c0: 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d ent_time db new-
a8d0: 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 run-id). ;; i
a8e0: 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 ndex the already
a8f0: 20 73 61 76 65 64 20 74 65 73 74 73 20 62 79 20 saved tests by
a900: 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 testname and ite
a910: 6d 64 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 mdat in curr-tes
a920: 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 ts-hash. (for
a930: 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 -each. (lamb
a940: 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 da (testdat).
a950: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 (let* ((test
a960: 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 name (db:test-g
a970: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
a980: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 dat)).. (it
a990: 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 em-path (db:test
a9a0: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
a9b0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 estdat))..
a9c0: 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 (full-name (conc
a9d0: 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 testname "/" it
a9e0: 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 em-path))).. (ha
a9f0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 sh-table-set! cu
aa00: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 rr-tests-hash fu
aa10: 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 ll-name testdat)
aa20: 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 )). curr-tes
aa30: 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a ts). ;; NOPE:
aa40: 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 Non-optimal app
aa50: 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 roach. Try this
aa60: 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 instead.. ;;
aa70: 20 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 1. tests are r
aa80: 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 eceived in a lis
aa90: 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 t, most recent f
aaa0: 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e irst. ;; 2.
aab0: 20 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c replace the rol
aac0: 6c 75 70 20 74 65 73 74 20 77 69 74 68 20 74 68 lup test with th
aad0: 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 e new *always*.
aae0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 (for-each .
aaf0: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 (lambda (test
ab00: 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 dat). (let
ab10: 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 * ((testname (d
ab20: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
ab30: 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 ame testdat))..
ab40: 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 (item-path
ab50: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 (db:test-get-ite
ab60: 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 m-path testdat))
ab70: 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 .. (full-na
ab80: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d me (conc testnam
ab90: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 e "/" item-path)
aba0: 29 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 ).. (prev-t
abb0: 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 est-dat (hash-ta
abc0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
abd0: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 curr-tests-hash
abe0: 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 full-name #f))..
abf0: 20 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 (test-step
ac00: 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e s (open-run
ac10: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 73 74 -close db:get-st
ac20: 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 eps-for-test db
ac30: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
ac40: 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 testdat)))..
ac50: 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f (new-test-reco
ac60: 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 rd #f)).. ;; rep
ac70: 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 lace these with
ac80: 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 insert ... selec
ac90: 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 t.. (apply sqlit
aca0: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 e3:execute ...db
acb0: 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 ...(conc "INSER
acc0: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
acd0: 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c O tests (run_id,
ace0: 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 testname,state,s
acf0: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 tatus,event_time
ad00: 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 ,host,cpuload,di
ad10: 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e skfree,uname,run
ad20: 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 dir,item_path,ru
ad30: 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c n_duration,final
ad40: 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 _logf,comment) "
ad50: 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 ... "VALUES
ad60: 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c (?,?,?,?,?,?,?,
ad70: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 ?,?,?,?,?,?,?);"
ad80: 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 )...new-run-id (
ad90: 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 cddr (vector->li
ada0: 73 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 st testdat)))..
adb0: 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 (set! new-testda
adc0: 74 20 28 63 61 72 20 28 6f 70 65 6e 2d 72 75 6e t (car (open-run
add0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 -close db:get-te
ade0: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e sts-for-run db n
adf0: 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 ew-run-id testna
ae00: 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28 29 me item-path '()
ae10: 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d '()))).. (hash-
ae20: 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d table-set! curr-
ae30: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d tests-hash full-
ae40: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 name new-testdat
ae50: 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 ) ;; this could
ae60: 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 be confusing, wh
ae70: 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c ich record shoul
ae80: 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f d go into the lo
ae90: 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b okup table?.. ;;
aea0: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 Now duplicate t
aeb0: 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 he test steps..
aec0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
aed0: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 Copying records
aee0: 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 in test_steps fr
aef0: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 om test_id=" (db
af00: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
af10: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 tdat) " to " (db
af20: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
af30: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 -testdat)).. (op
af40: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 en-run-close ..
af50: 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 (lambda ()..
af60: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
af70: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 e .. db ..
af80: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 (conc "INSERT
af90: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f OR REPLACE INTO
afa0: 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 test_steps (tes
afb0: 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 t_id,stepname,st
afc0: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 ate,status,event
afd0: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 _time,comment) "
afe0: 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 ... "SELECT "
aff0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
b000: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 new-testdat) ",s
b010: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 tepname,state,st
b020: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c atus,event_time,
b030: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 comment FROM tes
b040: 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 74 65 t_steps WHERE te
b050: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 st_id=?;")..
b060: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
b070: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 testdat))..
b080: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 ;; Now duplicate
b090: 20 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 the test data..
b0a0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
b0b0: 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 4 "Copying reco
b0c0: 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 rds in test_data
b0d0: 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 from test_id="
b0e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
b0f0: 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 testdat) " to "
b100: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
b110: 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 new-testdat))..
b120: 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 (sqlite3:exec
b130: 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 ute .. db ..
b140: 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 (conc "INSE
b150: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e RT OR REPLACE IN
b160: 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 TO test_data (te
b170: 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 st_id,category,v
b180: 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 ariable,value,ex
b190: 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 pected,tol,units
b1a0: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 ,comment) "...
b1b0: 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 "SELECT " (db:t
b1c0: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 est-get-id new-t
b1d0: 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f estdat) ",catego
b1e0: 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 ry,variable,valu
b1f0: 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 e,expected,tol,u
b200: 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f nits,comment FRO
b210: 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 M test_data WHER
b220: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 E test_id=?;")..
b230: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 (db:test-ge
b240: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 29 t-id testdat))))
b250: 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d .. )). prev-
b260: 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 tests))).. .
b270: 20 0a .