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 74 65 73 74 73 3a 74 65 73 74 2d 73 (tests:test-s
7ce0: 65 74 2d 73 74 61 74 75 73 21 20 74 65 73 74 2d et-status! test-
7cf0: 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 id "INCOMPLETE"
7d00: 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 "STUCK/DEAD" "Te
7d10: 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 st is stuck or d
7d20: 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 ead" #f))..
7d30: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
7d40: 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d NOTE: " test-nam
7d50: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 e " is already r
7d60: 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 unning")))..(els
7d70: 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 e (debug:p
7d80: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 rint 0 "ERROR: F
7d90: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 ailed to launch
7da0: 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d test " new-test-
7db0: 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e name ". Unrecogn
7dc0: 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 ised state " (te
7dd0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
7de0: 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d tdat)))))))..;;=
7df0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7e00: 3d 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 0a 3b 3b 20 45 4e 44 20 4f 46 20 =====.;; END OF
7e40: 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d NEW STUFF.;;====
7e50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 ==..(define (get
7ea0: 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 -dir-up-n dir .
7eb0: 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 params) . (let
7ec0: 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e ((dparts (strin
7ed0: 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 g-split dir "/")
7ee0: 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 )..(count (if
7ef0: 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 (null? params) 1
7f00: 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 (car params))))
7f10: 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 . (conc "/" (
7f20: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
7f30: 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b se .. (tak
7f40: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e e dparts (- (len
7f50: 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e gth dparts) coun
7f60: 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 t)).. "/")
7f70: 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 ))).;; Remove ru
7f80: 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 ns.;; fields are
7f90: 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f passing in thro
7fa0: 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a ugh .;; action:.
7fb0: 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 ;; 'remove-ru
7fc0: 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 ns.;; 'set-st
7fd0: 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b ate-status.;;.;;
7fe0: 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 NB// should pas
7ff0: 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 s in keys?.;;.(d
8000: 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 efine (runs:oper
8010: 61 74 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 72 75 ate-on action ru
8020: 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 nnamepatt testpa
8030: 74 74 20 69 74 65 6d 70 61 74 74 20 23 21 6b 65 tt itempatt #!ke
8040: 79 20 28 73 74 61 74 65 20 23 66 29 28 73 74 61 y (state #f)(sta
8050: 74 75 73 20 23 66 29 28 6e 65 77 2d 73 74 61 74 tus #f)(new-stat
8060: 65 2d 73 74 61 74 75 73 20 23 66 29 29 0a 20 20 e-status #f)).
8070: 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 (let* ((db
8080: 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73 #f).. (keys
8090: 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 (open-r
80a0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
80b0: 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e keys db)).. (run
80c0: 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 6e 2d dat (open-
80d0: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 run-close runs:g
80e0: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 et-runs-by-patt
80f0: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 db keys runnamep
8100: 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 att)).. (header
8110: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 (vector-re
8120: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 f rundat 0)).. (
8130: 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 76 65 runs (ve
8140: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 ctor-ref rundat
8150: 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 20 20 1)).. (states
8160: 20 20 20 20 28 69 66 20 73 74 61 74 65 20 20 28 (if state (
8170: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 string-split sta
8180: 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a 09 te ",") '()))..
8190: 20 28 73 74 61 74 75 73 65 73 20 20 20 20 20 28 (statuses (
81a0: 69 66 20 73 74 61 74 75 73 20 28 73 74 72 69 6e if status (strin
81b0: 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20 22 g-split status "
81c0: 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 ,") '())).. (sta
81d0: 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 28 73 te-status (if (s
81e0: 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65 tring? new-state
81f0: 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 6e 67 -status) (string
8200: 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74 65 -split new-state
8210: 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 23 -status ",") '(#
8220: 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 64 65 f #f)))). (de
8230: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 48 65 61 bug:print 2 "Hea
8240: 64 65 72 3a 20 22 20 68 65 61 64 65 72 20 22 20 der: " header "
8250: 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e action: " action
8260: 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 " new-state-sta
8270: 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 61 74 65 tus: " new-state
8280: 2d 73 74 61 74 75 73 29 0a 20 20 20 20 28 66 6f -status). (fo
8290: 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d r-each. (lam
82a0: 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 bda (run).
82b0: 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 (let ((runkey (
82c0: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
82d0: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 se (map (lambda
82e0: 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 (k).......(db:ge
82f0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
8300: 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 r run header (ve
8310: 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 ctor-ref k 0)))
8320: 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 keys) "/"))..
8330: 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 (dirs-to-remov
8340: 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 e (make-hash-tab
8350: 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 le))).. (let* ((
8360: 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67 65 run-id (db:ge
8370: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
8380: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
8390: 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74 65 "))...(run-state
83a0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
83b0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
83c0: 64 65 72 20 22 73 74 61 74 65 22 29 29 0a 09 09 der "state"))...
83d0: 28 74 65 73 74 73 20 20 20 20 20 28 69 66 20 28 (tests (if (
83e0: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d not (equal? run-
83f0: 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29 29 state "locked"))
8400: 0a 09 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e .... (open
8410: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 -run-close db:ge
8420: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
8430: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 db (db:get-value
8440: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
8450: 65 61 64 65 72 20 22 69 64 22 29 0a 09 09 09 09 eader "id").....
8460: 09 09 20 20 20 20 20 20 74 65 73 74 70 61 74 74 .. testpatt
8470: 20 69 74 65 6d 70 61 74 74 20 73 74 61 74 65 73 itempatt states
8480: 20 73 74 61 74 75 73 65 73 0a 09 09 09 09 09 09 statuses.......
8490: 20 20 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 not-in: #
84a0: 66 0a 09 09 09 09 09 09 20 20 20 20 20 20 73 6f f....... so
84b0: 72 74 2d 62 79 3a 20 28 63 61 73 65 20 61 63 74 rt-by: (case act
84c0: 69 6f 6e 0a 09 09 09 09 09 09 09 09 20 28 28 72 ion......... ((r
84d0: 65 6d 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 6e emove-runs) 'run
84e0: 64 69 72 29 0a 09 09 09 09 09 09 09 09 20 28 65 dir)......... (e
84f0: 6c 73 65 20 20 20 20 20 20 20 20 20 20 27 65 76 lse 'ev
8500: 65 6e 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 ent_time)))....
8510: 20 20 20 20 20 20 27 28 29 29 29 0a 09 09 28 6c '()))...(l
8520: 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f asttpath "/does/
8530: 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 not/exist/I/hope
8540: 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28 6e 6f "))... (if (no
8550: 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 t (null? tests))
8560: 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a .. (begin.
8570: 09 09 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a .. (case action.
8580: 09 09 20 20 20 28 28 72 65 6d 6f 76 65 2d 72 75 .. ((remove-ru
8590: 6e 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 ns)... (debug
85a0: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 :print 1 "Removi
85b0: 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e ng tests for run
85c0: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 : " runkey " " (
85d0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
85e0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
85f0: 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 r "runname")))..
8600: 09 20 20 20 28 28 73 65 74 2d 73 74 61 74 65 2d . ((set-state-
8610: 73 74 61 74 75 73 29 0a 09 09 20 20 20 20 28 64 status)... (d
8620: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f ebug:print 1 "Mo
8630: 64 69 66 79 69 6e 67 20 73 74 61 74 65 20 61 6e difying state an
8640: 64 20 73 74 61 75 73 20 66 6f 72 20 74 65 73 74 d staus for test
8650: 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e s for run: " run
8660: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d key " " (db:get-
8670: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
8680: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e run header "runn
8690: 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 65 6c ame")))... (el
86a0: 73 65 0a 09 09 20 20 20 20 28 70 72 69 6e 74 20 se... (print
86b0: 22 49 4e 46 4f 3a 20 61 63 74 69 6f 6e 20 6e 6f "INFO: action no
86c0: 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22 20 61 t recognised " a
86d0: 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f 72 ction)))... (for
86e0: 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 -each... (lambd
86f0: 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 a (test)... (
8700: 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 let* ((item-path
8710: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
8720: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 em-path test))..
8730: 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 .. (test-name
8740: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
8750: 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 tname test))....
8760: 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 (run-dir (d
8770: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 b:test-get-rundi
8780: 72 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 r test)).... (
8790: 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a 74 65 test-id (db:te
87a0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 st-get-id test))
87b0: 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 20 28 )... ;; (
87c0: 74 64 62 20 20 20 20 20 20 20 28 64 62 3a 6f 70 tdb (db:op
87d0: 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e 2d 64 en-test-db run-d
87e0: 69 72 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 ir)))... (d
87f0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 20 20 ebug:print 1 "
8800: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 " (db:test-get-t
8810: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 estname test) "
8820: 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 id: " (db:test-g
8830: 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 et-id test) " "
8840: 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63 74 69 item-path " acti
8850: 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 on: " action)...
8860: 20 20 20 20 20 20 28 63 61 73 65 20 61 63 74 69 (case acti
8870: 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 on....((remove-r
8880: 75 6e 73 29 20 3b 3b 20 74 68 65 20 74 64 62 20 uns) ;; the tdb
8890: 69 73 20 66 6f 72 20 66 75 74 75 72 65 20 70 6f is for future po
88a0: 73 73 69 62 6c 65 2e 20 0a 09 09 09 20 28 6f 70 ssible. .... (op
88b0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
88c0: 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f delete-test-reco
88d0: 72 64 73 20 64 62 20 23 66 20 28 64 62 3a 74 65 rds db #f (db:te
88e0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 st-get-id test))
88f0: 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e .... (debug:prin
8900: 74 20 31 20 22 49 4e 46 4f 3a 20 41 74 74 65 6d t 1 "INFO: Attem
8910: 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 pting to remove
8920: 64 69 72 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 dir " run-dir)..
8930: 09 09 20 28 69 66 20 28 61 6e 64 20 28 3e 20 28 .. (if (and (> (
8940: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75 string-length ru
8950: 6e 2d 64 69 72 29 20 35 29 0a 09 09 09 09 20 20 n-dir) 5).....
8960: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 (file-exists? ru
8970: 6e 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 20 68 n-dir)) ;; bad h
8980: 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68 6f euristic but sho
8990: 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 uld prevent /tmp
89a0: 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 /home etc.....
89b0: 20 20 20 20 28 6c 65 74 2a 20 28 28 72 65 61 6c (let* ((real
89c0: 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 path (resolve-pa
89d0: 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 thname run-dir))
89e0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 62 ).... (deb
89f0: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f ug:print 1 "INFO
8a00: 3a 20 52 65 61 6c 20 70 61 74 68 20 6f 66 20 69 : Real path of i
8a10: 73 20 22 20 72 65 61 6c 70 61 74 68 29 0a 09 09 s " realpath)...
8a20: 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69 6c . (if (fil
8a30: 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 70 61 e-exists? realpa
8a40: 74 68 29 0a 09 09 09 09 20 20 20 28 69 66 20 28 th)..... (if (
8a50: 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 > (system (conc
8a60: 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 70 61 "rm -rf " realpa
8a70: 74 68 29 29 20 30 29 0a 09 09 09 09 20 20 20 20 th)) 0).....
8a80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8a90: 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65 20 0 "ERROR: There
8aa0: 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72 65 was a problem re
8ab0: 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 70 61 74 moving " realpat
8ac0: 68 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22 29 h " with rm -f")
8ad0: 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 67 3a )..... (debug:
8ae0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 print 0 "WARNING
8af0: 3a 20 74 65 73 74 20 72 75 6e 20 64 69 72 20 22 : test run dir "
8b00: 20 72 65 61 6c 70 61 74 68 20 22 20 61 70 70 65 realpath " appe
8b10: 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 73 74 ars to not exist
8b20: 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 ")).... (i
8b30: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
8b40: 72 75 6e 2d 64 69 72 29 20 3b 3b 20 74 68 65 20 run-dir) ;; the
8b50: 6c 69 6e 6b 0a 09 09 09 09 20 20 20 28 69 66 20 link..... (if
8b60: 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 (symbolic-link?
8b70: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 20 20 run-dir).....
8b80: 20 20 20 20 28 64 65 6c 65 74 65 2d 66 69 6c 65 (delete-file
8b90: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 20 run-dir).....
8ba0: 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74 (if (direct
8bb0: 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 ory? run-dir)...
8bc0: 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 64 69 ... (if (> (di
8bd0: 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 rectory-fold (la
8be0: 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31 20 78 mbda (f x)(+ 1 x
8bf0: 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20 30 29 )) 0 run-dir) 0)
8c00: 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 64 65 ...... (de
8c10: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
8c20: 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 20 74 NING: refusing t
8c30: 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 o remove " run-d
8c40: 69 72 20 22 20 61 73 20 69 74 20 69 73 20 6e 6f ir " as it is no
8c50: 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09 09 20 t empty")......
8c60: 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 64 69 (delete-di
8c70: 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 72 29 rectory run-dir)
8c80: 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64 20 62 ) ;; it should b
8c90: 65 20 65 6d 70 74 79 20 62 79 20 68 65 72 65 20 e empty by here
8ca0: 42 55 47 20 42 55 47 2c 20 61 64 64 20 65 72 72 BUG BUG, add err
8cb0: 6f 72 20 63 61 74 63 68 0a 09 09 09 09 09 20 20 or catch......
8cc0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
8cd0: 22 45 52 52 4f 52 3a 20 72 65 66 75 73 69 6e 67 "ERROR: refusing
8ce0: 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e to remove " run
8cf0: 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73 20 -dir " as it is
8d00: 6e 65 69 74 68 65 72 20 61 20 73 79 6d 6c 69 6e neither a symlin
8d10: 6b 20 6e 6f 72 20 61 20 64 69 72 65 63 74 6f 72 k nor a director
8d20: 79 22 29 0a 09 09 09 09 09 20 20 20 29 29 29 29 y")...... ))))
8d30: 0a 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a .... (debug:
8d40: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 print 0 "WARNING
8d50: 3a 20 64 69 72 65 63 74 6f 72 79 20 61 6c 72 65 : directory alre
8d60: 61 64 79 20 72 65 6d 6f 76 65 64 20 22 20 72 75 ady removed " ru
8d70: 6e 2d 64 69 72 29 29 29 0a 09 09 09 28 28 73 65 n-dir)))....((se
8d80: 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 0a t-state-status).
8d90: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
8da0: 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77 20 73 74 2 "INFO: new st
8db0: 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74 65 ate " (car state
8dc0: 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77 20 -status) ", new
8dd0: 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20 73 status " (cadr s
8de0: 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 09 tate-status))...
8df0: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 . (open-run-clos
8e00: 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d 73 74 e db:test-set-st
8e10: 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d 69 64 ate-status-by-id
8e20: 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 db (db:test-get
8e30: 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 20 73 -id test) (car s
8e40: 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 61 64 tate-status)(cad
8e50: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 r state-status)
8e60: 23 66 29 29 29 29 29 0a 09 09 20 20 74 65 73 74 #f)))))... test
8e70: 73 29 29 29 0a 09 20 20 20 0a 09 20 20 20 3b 3b s))).. .. ;;
8e80: 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 remove the run
8e90: 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 if zero tests re
8ea0: 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71 main.. (if (eq
8eb0: 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 ? action 'remove
8ec0: 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28 -runs).. (
8ed0: 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 let ((remtests (
8ee0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
8ef0: 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d b:get-tests-for-
8f00: 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 run db (db:get-v
8f10: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
8f20: 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20 un header "id")
8f30: 23 66 20 23 66 20 27 28 22 44 45 4c 45 54 45 44 #f #f '("DELETED
8f40: 22 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74 2d ") '("n/a") not-
8f50: 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 69 66 in: #t)))... (if
8f60: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 (null? remtests
8f70: 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 ) ;; no more tes
8f80: 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 ts remaining...
8f90: 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61 72 (let* ((dpar
8fa0: 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ts (string-spli
8fb0: 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 t lasttpath "/")
8fc0: 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61 74 ).... (runpat
8fd0: 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 h (conc "/" (str
8fe0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
8ff0: 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 70 61 .......(take dpa
9000: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 rts (- (length d
9010: 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 parts) 1))......
9020: 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20 20 ."/"))))...
9030: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
9040: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 "Removing run:
9050: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
9060: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
9070: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
9080: 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e 64 "runname") " and
9090: 20 72 65 6c 61 74 65 64 20 72 65 63 6f 72 64 22 related record"
90a0: 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e )... (open
90b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 -run-close db:de
90c0: 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d lete-run db run-
90d0: 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 id)... ;;
90e0: 54 68 69 73 20 69 73 20 61 20 70 72 65 74 74 79 This is a pretty
90f0: 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20 70 good place to p
9100: 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 45 44 urge old DELETED
9110: 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 20 20 tests...
9120: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
9130: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d db:delete-tests-
9140: 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 for-run db run-i
9150: 64 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 d)... (ope
9160: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 n-run-close db:d
9170: 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 elete-old-delete
9180: 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 d-test-records d
9190: 62 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 b)... (ope
91a0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 n-run-close db:s
91b0: 65 74 2d 76 61 72 20 64 62 20 22 44 45 4c 45 54 et-var db "DELET
91c0: 45 44 5f 54 45 53 54 53 22 20 28 63 75 72 72 65 ED_TESTS" (curre
91d0: 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09 20 nt-seconds))...
91e0: 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f ;; need to
91f0: 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 figure out the
9200: 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 path to the run
9210: 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 dir and remove i
9220: 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 t if empty...
9230: 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e ;; (if (n
9240: 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ull? (glob (conc
9250: 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 runpath "/*")))
9260: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 ... ;;
9270: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 (begin...
9280: 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a ;; . (debug:
9290: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e print 1 "Removin
92a0: 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 g run dir " runp
92b0: 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b 3b ath)... ;;
92c0: 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 . (system (conc
92d0: 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e "rmdir -p " run
92e0: 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20 20 path))))...
92f0: 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20 20 ))))).. )).
9300: 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d runs)))..;;===
9310: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 ===.;; Routines
9360: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 for manipulating
9370: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d runs.;;========
9380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a 0a ==============..
93c0: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 ;; Since many ca
93d0: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 lls to a run req
93e0: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 uire pretty much
93f0: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 the same setup
9400: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 .;; this wrapper
9410: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 is used to redu
9420: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 ce the replicati
9430: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 on of code.(defi
9440: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d ne (general-run-
9450: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 call switchname
9460: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 action-desc proc
9470: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 ). (let ((runna
9480: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 me (args:get-arg
9490: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 ":runname"))..(
94a0: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67 target (if (arg
94b0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
94c0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 et")... (arg
94d0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
94e0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 et")... (arg
94f0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
9500: 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 arg")))..(th1
9510: 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 #f)). (cond
9520: 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 . ((not targ
9530: 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 et). (debug
9540: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
9550: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 Missing require
9560: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 d parameter for
9570: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 " switchname ",
9580: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 you must specify
9590: 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68 the target with
95a0: 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 -target").
95b0: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 (exit 3)).
95c0: 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 ((not runname).
95d0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
95e0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 t 0 "ERROR: Miss
95f0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 ing required par
9600: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 ameter for " swi
9610: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d tchname ", you m
9620: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 ust specify the
9630: 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 run name with :r
9640: 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 unname runname")
9650: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 . (exit 3))
9660: 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 . (else.
9670: 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 (let ((db #f
9680: 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 ).. (keys #f)
9690: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 )..(if (not (set
96a0: 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 up-for-run))..
96b0: 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 (begin ..
96c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
96d0: 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 "Failed to setup
96e0: 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 , exiting")..
96f0: 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 (exit 1)))..(
9700: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 if (args:get-arg
9710: 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20 "-server")..
9720: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
9730: 20 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 62 server:start db
9740: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
9750: 2d 73 65 72 76 65 72 22 29 29 0a 09 20 20 20 20 -server"))..
9760: 28 69 66 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 (if (not (or (ar
9770: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e gs:get-arg "-run
9780: 61 6c 6c 22 29 20 20 20 20 20 3b 3b 20 72 75 6e all") ;; run
9790: 61 6c 6c 20 61 6e 64 20 72 75 6e 74 65 73 74 73 all and runtests
97a0: 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 are allowed to
97b0: 62 65 20 73 65 72 76 65 72 73 0a 09 09 09 20 28 be servers.... (
97c0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 args:get-arg "-r
97d0: 75 6e 74 65 73 74 73 22 29 29 29 0a 09 09 28 73 untests")))...(s
97e0: 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 erver:client-set
97f0: 75 70 29 29 29 0a 09 28 73 65 74 21 20 6b 65 79 up)))..(set! key
9800: 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 s (open-run-clos
9810: 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 e db:get-keys db
9820: 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 ))..;; have enou
9830: 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 gh to process -t
9840: 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 arget or -reqtar
9850: 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 g here..(if (arg
9860: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
9870: 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a arg").. (let*
9880: 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 ((runconfigf (c
9890: 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 onc *toppath* "
98a0: 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 /runconfigs.conf
98b0: 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 ig")) ;; DO NOT
98c0: 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 EVALUATE ALL ...
98d0: 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 (runconfig (
98e0: 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 read-config runc
98f0: 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 onfigf #f #f env
9900: 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 iron-patt: #f)))
9910: 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 61 .. (if (ha
9920: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
9930: 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 ault runconfig (
9940: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 args:get-arg "-r
9950: 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 eqtarg") #f)...
9960: 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 (keys:target-se
9970: 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 t-args keys (arg
9980: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
9990: 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 arg") args:arg-h
99a0: 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a ash)... (begin.
99b0: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
99c0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 nt 0 "ERROR: ["
99d0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
99e0: 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 reqtarg") "] not
99f0: 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 found in " runc
9a00: 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 69 onfigf)... (i
9a10: 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 f db (sqlite3:fi
9a20: 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 20 nalize! db))...
9a30: 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 (exit 1))))..
9a40: 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 (if (args:ge
9a50: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 t-arg "-target")
9a60: 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d ...(keys:target-
9a70: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 set-args keys (a
9a80: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
9a90: 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 rget" args:arg-h
9aa0: 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 ash) args:arg-ha
9ab0: 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 sh)))..(if (not
9ac0: 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f (car *configinfo
9ad0: 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a *)).. (begin.
9ae0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
9af0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 int 0 "ERROR: At
9b00: 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 tempted to " act
9b10: 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 ion-desc " but r
9b20: 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 un area config f
9b30: 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a ile not found").
9b40: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 . (exit 1))
9b50: 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 .. ;; Extract
9b60: 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 out stuff neede
9b70: 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e d in most or man
9b80: 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 y calls.. ;;
9b90: 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 here then call p
9ba0: 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 roc.. (let* (
9bb0: 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 (keynames (map
9bc0: 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 key:get-fieldna
9bd0: 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 me keys))... (
9be0: 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 keyvallst (keys
9bf0: 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 ->vallist keys #
9c00: 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f t))).. (pro
9c10: 63 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 c target runname
9c20: 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b keys keynames k
9c30: 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 eyvallst)))..(if
9c40: 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 th1 (thread-joi
9c50: 6e 21 20 74 68 31 29 29 0a 09 28 69 66 20 64 62 n! th1))..(if db
9c60: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 (sqlite3:finali
9c70: 7a 65 21 20 64 62 29 29 0a 09 28 73 65 74 21 20 ze! db))..(set!
9c80: 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 *didsomething* #
9c90: 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d t))))))..;;=====
9ca0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b =.;; Lock/unlock
9cf0: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d runs.;;========
9d00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a 0a ==============..
9d40: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 68 61 (define (runs:ha
9d50: 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 72 ndle-locking tar
9d60: 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 get keys runname
9d70: 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 lock unlock use
9d80: 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 r). (let* ((db
9d90: 20 20 20 20 20 20 23 66 29 0a 09 20 28 72 75 6e #f).. (run
9da0: 64 61 74 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d dat (open-run-
9db0: 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 close runs:get-r
9dc0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
9dd0: 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 eys runname))..
9de0: 28 68 65 61 64 65 72 20 20 20 28 76 65 63 74 6f (header (vecto
9df0: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 r-ref rundat 0))
9e00: 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 76 65 .. (runs (ve
9e10: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 ctor-ref rundat
9e20: 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 1))). (for-ea
9e30: 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 ch (lambda (run)
9e40: 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 ...(let ((run-id
9e50: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
9e60: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
9e70: 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 20 20 der "id")))...
9e80: 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 (if (or lock....
9e90: 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 (and unlock...
9ea0: 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 . (begin..
9eb0: 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79 ... (print "Do y
9ec0: 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74 ou really wish t
9ed0: 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 o unlock run " r
9ee0: 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e un-id "?\n y/n
9ef0: 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c : ")..... (equal
9f00: 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 ? "y" (read-line
9f10: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 6f )))))... (o
9f20: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
9f30: 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e :lock/unlock-run
9f40: 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 db run-id lock
9f50: 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 unlock user)...
9f60: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
9f70: 74 20 30 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 t 0 "INFO: Skipp
9f80: 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 ing lock/unlock
9f90: 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a on " run-id)))).
9fa0: 09 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b . runs))).;
9fb0: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
9fc0: 3d 3d 3d 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 0a 3b 3b 20 52 6f 6c 6c 75 =======.;; Rollu
a000: 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d p runs.;;=======
a010: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
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 0a ===============.
a050: 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 .;; Update the t
a060: 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 est_meta table f
a070: 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 or this test.(de
a080: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 fine (runs:updat
a090: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 e-test_meta db t
a0a0: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f est-name test-co
a0b0: 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 nf). (let ((cur
a0c0: 72 72 65 63 6f 72 64 20 28 6f 70 65 6e 2d 72 75 rrecord (open-ru
a0d0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d n-close db:testm
a0e0: 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 eta-get-record d
a0f0: 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 b test-name))).
a100: 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 (if (not curr
a110: 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a record)..(begin.
a120: 09 20 20 28 73 65 74 21 20 63 75 72 72 72 65 63 . (set! currrec
a130: 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 ord (make-vector
a140: 20 31 30 20 23 66 29 29 0a 09 20 20 28 6f 70 65 10 #f)).. (ope
a150: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 n-run-close db:t
a160: 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f estmeta-add-reco
a170: 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 rd db test-name)
a180: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
a190: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
a1a0: 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 key). (let
a1b0: 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 * ((idx (cadr ke
a1c0: 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 y)).. (fld
a1d0: 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 (car key))..
a1e0: 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d (val (config-
a1f0: 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 lookup test-conf
a200: 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 "test_meta" fld
a210: 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a ))).. ;; (debug:
a220: 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 print 5 "idx: "
a230: 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 idx " fld: " fld
a240: 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 " val: " val)..
a250: 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e (if (and val (n
a260: 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 ot (equal? (vect
a270: 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 or-ref currrecor
a280: 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 d idx) val)))..
a290: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 (begin..
a2a0: 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 (print "Updat
a2b0: 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 ing " test-name
a2c0: 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 " " fld " to " v
a2d0: 61 6c 29 0a 09 20 20 20 20 20 20 20 28 6f 70 65 al).. (ope
a2e0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 n-run-close db:t
a2f0: 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 estmeta-update-f
a300: 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d ield db test-nam
a310: 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 e fld val))))).
a320: 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 20 '(("author"
a330: 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64 2)("owner" 3)("d
a340: 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22 escription" 4)("
a350: 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74 61 reviewed" 5)("ta
a360: 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 gs" 9)))))..;; U
a370: 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20 pdate test_meta
a380: 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 for all tests.(d
a390: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 efine (runs:upda
a3a0: 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 te-all-test_meta
a3b0: 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65 db). (let ((te
a3c0: 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c st-names (get-al
a3d0: 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29 l-legal-tests)))
a3e0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
a3f0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 (lambda (te
a400: 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 st-name).
a410: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 (let* ((test-pat
a420: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 h (conc *topp
a430: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 ath* "/tests/" t
a440: 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 est-name))..
a450: 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 (test-configf
a460: 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 (conc test-path
a470: 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a "/testconfig")).
a480: 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69 73 . (testexis
a490: 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d ts (and (file-
a4a0: 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e exists? test-con
a4b0: 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d figf)(file-read-
a4c0: 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e access? test-con
a4d0: 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b figf))).. ;
a4e0: 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77 ; read configs w
a4f0: 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65 ith tricks turne
a500: 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 d off (i.e. no s
a510: 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74 ystem).. (t
a520: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 est-conf (if
a530: 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64 testexists (read
a540: 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e -config test-con
a550: 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65 figf #f #f)(make
a560: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a -hash-table)))).
a570: 09 20 3b 3b 20 75 73 65 20 74 68 65 20 6f 70 65 . ;; use the ope
a580: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 n-run-close inst
a590: 65 61 64 20 6f 66 20 70 61 73 73 69 6e 67 20 69 ead of passing i
a5a0: 6e 20 64 62 0a 09 20 28 72 75 6e 73 3a 75 70 64 n db.. (runs:upd
a5b0: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 23 66 ate-test_meta #f
a5c0: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
a5d0: 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 conf))). tes
a5e0: 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 t-names)))..;; T
a5f0: 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 his could probab
a600: 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 ly be refactored
a610: 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 into one comple
a620: 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 x query ....(def
a630: 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 ine (runs:rollup
a640: 2d 72 75 6e 20 6b 65 79 73 20 6b 65 79 76 61 6c -run keys keyval
a650: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 lst runname user
a660: 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c ) ;; was target,
a670: 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 now keyvallst.
a680: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
a690: 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e "runs:rollup-run
a6a0: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 , keys: " keys "
a6b0: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 keyvallst: " ke
a6c0: 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 yvallst " :runna
a6d0: 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 me " runname " u
a6e0: 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 ser: " user). (
a6f0: 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 let* ((db
a700: 20 20 20 20 20 20 20 23 66 29 20 3b 3b 20 28 6b #f) ;; (k
a710: 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 eyvalllst (
a720: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 keys:target->key
a730: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 val keys target)
a740: 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 ).. (new-run-id
a750: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
a760: 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 73 74 lose runs:regist
a770: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b er-run db keys k
a780: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 eyvallst runname
a790: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 "new" "n/a" use
a7a0: 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 r)).. (prev-test
a7b0: 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e s (open-run
a7c0: 2d 63 6c 6f 73 65 20 74 65 73 74 3a 67 65 74 2d -close test:get-
a7d0: 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 matching-previou
a7e0: 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 s-test-run-recor
a7f0: 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 ds db new-run-id
a800: 20 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 "%" "%")).. (cu
a810: 72 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f rr-tests (o
a820: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
a830: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
a840: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
a850: 20 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29 "%" "%" '() '()
a860: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 )).. (curr-tests
a870: 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 -hash (make-hash
a880: 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 6f -table))). (o
a890: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
a8a0: 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e :update-run-even
a8b0: 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 t_time db new-ru
a8c0: 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 n-id). ;; ind
a8d0: 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 ex the already s
a8e0: 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65 aved tests by te
a8f0: 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 stname and itemd
a900: 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 at in curr-tests
a910: 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 -hash. (for-e
a920: 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ach. (lambda
a930: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 (testdat).
a940: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 (let* ((testna
a950: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 me (db:test-get
a960: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 -testname testda
a970: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d t)).. (item
a980: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
a990: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
a9a0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 tdat)).. (f
a9b0: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 ull-name (conc t
a9c0: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d estname "/" item
a9d0: 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 -path))).. (hash
a9e0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 -table-set! curr
a9f0: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c -tests-hash full
aa00: 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 -name testdat)))
aa10: 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 . curr-tests
aa20: 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e ). ;; NOPE: N
aa30: 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f on-optimal appro
aa40: 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e ach. Try this in
aa50: 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 stead.. ;;
aa60: 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63 1. tests are rec
aa70: 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c eived in a list,
aa80: 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 most recent fir
aa90: 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 st. ;; 2. r
aaa0: 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 eplace the rollu
aab0: 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20 p test with the
aac0: 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 new *always*.
aad0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
aae0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 (lambda (testda
aaf0: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 t). (let*
ab00: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a ((testname (db:
ab10: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
ab20: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 e testdat))..
ab30: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 (item-path (d
ab40: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
ab50: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 path testdat))..
ab60: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 (full-name
ab70: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
ab80: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a "/" item-path)).
ab90: 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 . (prev-tes
aba0: 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c t-dat (hash-tabl
abb0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 e-ref/default cu
abc0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 rr-tests-hash fu
abd0: 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 ll-name #f))..
abe0: 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 (test-steps
abf0: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
ac00: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 73 74 65 70 lose db:get-step
ac10: 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 s-for-test db (d
ac20: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
ac30: 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 stdat)))..
ac40: 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 (new-test-record
ac50: 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 #f)).. ;; repla
ac60: 63 65 20 74 68 65 73 65 20 77 69 74 68 20 69 6e ce these with in
ac70: 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a sert ... select.
ac80: 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 . (apply sqlite3
ac90: 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a :execute ...db .
aca0: 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 ..(conc "INSERT
acb0: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 OR REPLACE INTO
acc0: 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 tests (run_id,te
acd0: 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 stname,state,sta
ace0: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 tus,event_time,h
acf0: 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b ost,cpuload,disk
ad00: 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 free,uname,rundi
ad10: 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f r,item_path,run_
ad20: 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c duration,final_l
ad30: 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 ogf,comment) "..
ad40: 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 . "VALUES (
ad50: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
ad60: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a ?,?,?,?,?,?);").
ad70: 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 ..new-run-id (cd
ad80: 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 dr (vector->list
ad90: 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 testdat))).. (s
ada0: 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 et! new-testdat
adb0: 28 63 61 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (car (open-run-c
adc0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 lose db:get-test
add0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 s-for-run db new
ade0: 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 -run-id testname
adf0: 20 69 74 65 6d 2d 70 61 74 68 20 27 28 29 20 27 item-path '() '
ae00: 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 ()))).. (hash-ta
ae10: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 ble-set! curr-te
ae20: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 sts-hash full-na
ae30: 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 me new-testdat)
ae40: 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 ;; this could be
ae50: 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 confusing, whic
ae60: 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 h record should
ae70: 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b go into the look
ae80: 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e up table?.. ;; N
ae90: 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 ow duplicate the
aea0: 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 test steps.. (d
aeb0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f ebug:print 4 "Co
aec0: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e pying records in
aed0: 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d test_steps from
aee0: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 test_id=" (db:t
aef0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
af00: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 at) " to " (db:t
af10: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 est-get-id new-t
af20: 65 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e estdat)).. (open
af30: 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28 -run-close .. (
af40: 6c 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28 lambda ().. (
af50: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
af60: 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20 .. db ..
af70: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f (conc "INSERT O
af80: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 R REPLACE INTO t
af90: 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f est_steps (test_
afa0: 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 id,stepname,stat
afb0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 e,status,event_t
afc0: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 ime,comment) "..
afd0: 09 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 . "SELECT " (d
afe0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 b:test-get-id ne
aff0: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 w-testdat) ",ste
b000: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 pname,state,stat
b010: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f us,event_time,co
b020: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f mment FROM test_
b030: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 steps WHERE test
b040: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 _id=?;").. (
b050: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
b060: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b estdat)).. ;;
b070: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 Now duplicate t
b080: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20 he test data..
b090: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
b0a0: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 "Copying record
b0b0: 73 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 s in test_data f
b0c0: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 rom test_id=" (d
b0d0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
b0e0: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 stdat) " to " (d
b0f0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 b:test-get-id ne
b100: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 w-testdat))..
b110: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
b120: 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 e .. db ..
b130: 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 (conc "INSERT
b140: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f OR REPLACE INTO
b150: 20 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 test_data (test
b160: 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 _id,category,var
b170: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 iable,value,expe
b180: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 cted,tol,units,c
b190: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 omment) "... "
b1a0: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 SELECT " (db:tes
b1b0: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 t-get-id new-tes
b1c0: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 tdat) ",category
b1d0: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c ,variable,value,
b1e0: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 expected,tol,uni
b1f0: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 ts,comment FROM
b200: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 test_data WHERE
b210: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 test_id=?;")..
b220: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
b230: 69 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09 id testdat))))..
b240: 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 )). prev-te
b250: 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a sts))).. . .