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 28 64 65 66 69 6e 65 20 28 73 65 74 2d 6d ..(define (set-m
0870: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
0880: 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c db run-id). (l
0890: 65 74 20 28 28 6b 65 79 73 20 28 64 62 3a 67 65 et ((keys (db:ge
08a0: 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 20 20 t-keys db))).
08b0: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 (for-each (lamb
08c0: 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71 6c 69 da (key)...(sqli
08d0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
08e0: 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76 61 6c ... (lambda (val
08f0: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 )... (debug:pr
0900: 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 int 2 "setenv "
0910: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 (key:get-fieldna
0920: 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61 6c 29 me key) " " val)
0930: 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20 28 6b ... (setenv (k
0940: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 ey:get-fieldname
0950: 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 20 64 key) val))... d
0960: 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 45 4c b ... (conc "SEL
0970: 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 ECT " (key:get-f
0980: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 ieldname key) "
0990: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 FROM runs WHERE
09a0: 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e 2d 69 id=?;")... run-i
09b0: 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79 73 29 d)).. keys)
09c0: 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65 6e 76 . (alist->env
09d0: 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61 62 6c -vars (hash-tabl
09e0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 63 e-ref/default *c
09f0: 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76 2d 6f onfigdat* "env-o
0a00: 76 65 72 72 69 64 65 22 20 27 28 29 29 29 0a 20 verride" '())).
0a10: 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65 20 74 ;; Lets use t
0a20: 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f 72 74 his as an opport
0a30: 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d 54 5f unity to put MT_
0a40: 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65 20 65 RUNNAME in the e
0a50: 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 20 28 nvironment. (
0a60: 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 sqlite3:for-each
0a70: 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 -row. (lambd
0a80: 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 a (runname).
0a90: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 (setenv "MT_R
0aa0: 55 4e 4e 41 4d 45 22 20 72 75 6e 6e 61 6d 65 29 UNNAME" runname)
0ab0: 29 0a 20 20 20 20 20 64 62 0a 20 20 20 20 20 22 ). db. "
0ac0: 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 SELECT runname F
0ad0: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 ROM runs WHERE i
0ae0: 64 3d 3f 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 d=?;". run-i
0af0: 64 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66 69 d). ))..(defi
0b00: 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76 ne (set-item-env
0b10: 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a 20 -vars itemdat).
0b20: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 (for-each (lamb
0b30: 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20 20 da (item)..
0b40: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
0b50: 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20 69 "setenv " (car i
0b60: 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20 69 tem) " " (cadr i
0b70: 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73 65 tem)).. (se
0b80: 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29 20 tenv (car item)
0b90: 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09 20 (cadr item)))..
0ba0: 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28 64 itemdat))..(d
0bb0: 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d 2d efine *last-num-
0bc0: 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 30 running-tests* 0
0bd0: 29 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ).(define (runs:
0be0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
0bf0: 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 ts db test-recor
0c00: 64 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f d). (let* ((tco
0c10: 6e 66 69 67 20 20 20 20 20 20 20 20 20 20 20 20 nfig
0c20: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 (tests:test
0c30: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f queue-get-testco
0c40: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 nfig test-record
0c50: 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 )).. (jobgroup
0c60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 (c
0c70: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f onfig-lookup tco
0c80: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e nfig "requiremen
0c90: 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 ts" "jobgroup"))
0ca0: 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 .. (num-running
0cb0: 20 20 20 20 20 20 20 20 20 20 20 20 28 64 62 3a (db:
0cc0: 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d get-count-tests-
0cd0: 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 running db)).. (
0ce0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
0cf0: 6f 62 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d obgroup (db:get-
0d00: 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e count-tests-runn
0d10: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 ing-in-jobgroup
0d20: 64 62 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 db jobgroup))..
0d30: 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d (max-concurrent-
0d40: 6a 6f 62 73 20 20 20 20 20 28 63 6f 6e 66 69 67 jobs (config
0d50: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 -lookup *configd
0d60: 61 74 2a 20 22 73 65 74 75 70 22 20 20 20 20 20 at* "setup"
0d70: 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f "max_concurrent_
0d80: 6a 6f 62 73 22 29 29 0a 09 20 28 6a 6f 62 2d 67 jobs")).. (job-g
0d90: 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 roup-limit
0da0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (config-looku
0db0: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a p *configdat* "j
0dc0: 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f obgroups" jobgro
0dd0: 75 70 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e up))). (if (n
0de0: 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e 75 ot (eq? *last-nu
0df0: 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a m-running-tests*
0e00: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a 09 num-running))..
0e10: 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 (begin.. (debug
0e20: 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f :print 2 "max-co
0e30: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 ncurrent-jobs: "
0e40: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
0e50: 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e jobs ", num-runn
0e60: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 ing: " num-runni
0e70: 6e 67 29 0a 09 20 20 28 73 65 74 21 20 2a 6c 61 ng).. (set! *la
0e80: 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 st-num-running-t
0e90: 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e ests* num-runnin
0ea0: 67 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f g))). (if (no
0eb0: 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c t (eq? 0 *global
0ec0: 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 23 exitstatus*))..#
0ed0: 66 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f f..(let ((can-no
0ee0: 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 t-run-more (cond
0ef0: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d ..... ;; if max-
0f00: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 concurrent-jobs
0f10: 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e is set and the n
0f20: 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 umber running is
0f30: 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b greater ..... ;
0f40: 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 ; than it than c
0f50: 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a annot run more j
0f60: 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d obs..... ((and m
0f70: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0f80: 62 73 0a 09 09 09 09 20 20 20 20 20 20 20 28 73 bs..... (s
0f90: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 tring->number ma
0fa0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
0fb0: 73 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e s)..... (>
0fc0: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 = num-running (s
0fd0: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 tring->number ma
0fe0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
0ff0: 73 29 29 29 0a 09 09 09 09 20 20 28 64 65 62 75 s)))..... (debu
1000: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
1010: 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 NG: Max running
1020: 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20 63 jobs exceeded, c
1030: 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 urrent number ru
1040: 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e nning: " num-run
1050: 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20 20 20 ning ......
1060: 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 ", max_concurr
1070: 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d ent_jobs: " max-
1080: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 concurrent-jobs)
1090: 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 09 20 ..... #t).....
10a0: 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d ;; if job-group-
10b0: 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61 6e 64 limit is set and
10c0: 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 number of jobs
10d0: 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69 73 20 in the group is
10e0: 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 greater..... ;;
10f0: 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 than the limit t
1100: 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d hen cannot run m
1110: 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 ore jobs of this
1120: 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 kind..... ((and
1130: 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 job-group-limit
1140: 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 ..... (>=
1150: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
1160: 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 obgroup job-grou
1170: 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09 20 20 p-limit)).....
1180: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
1190: 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 WARNING: number
11a0: 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 of jobs " num-ru
11b0: 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 nning-in-jobgrou
11c0: 70 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 p ...... "
11d0: 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 in " jobgroup "
11e0: 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 exceeded, will
11f0: 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73 74 73 not run " (tests
1200: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
1210: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 estname test-rec
1220: 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74 29 0a ord))..... #t).
1230: 09 09 09 09 20 28 65 6c 73 65 20 23 66 29 29 29 .... (else #f)))
1240: 29 0a 09 20 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f ).. (not can-no
1250: 74 2d 72 75 6e 2d 6d 6f 72 65 29 29 29 29 29 0a t-run-more))))).
1260: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
1270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1290: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 =========.;; New
12b0: 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 methodology. Th
12c0: 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69 6c ese routines wil
12d0: 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61 62 l replace the ab
12e0: 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 ove in time. For
12f0: 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 .;; now the code
1300: 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e 20 is duplicated.
1310: 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69 6e This stuff is in
1320: 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 itially used in
1330: 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 the monitor.;; b
1340: 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d ased code..;;===
1350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1390: 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 ===..;; register
13a0: 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 74 68 a test run with
13b0: 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e 65 20 the db.(define
13c0: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 (runs:register-r
13d0: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 un db keys keyva
13e0: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 llst runname sta
13f0: 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29 0a te status user).
1400: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 (debug:print 3
1410: 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d "runs:register-
1420: 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 run, keys: " key
1430: 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 s " keyvallst: "
1440: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72 75 6e keyvallst " run
1450: 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 name: " runname
1460: 22 20 73 74 61 74 65 3a 20 22 20 73 74 61 74 65 " state: " state
1470: 20 22 20 73 74 61 74 75 73 3a 20 22 20 73 74 61 " status: " sta
1480: 74 75 73 20 22 20 75 73 65 72 3a 20 22 20 75 73 tus " user: " us
1490: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 er). (let* ((ke
14a0: 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b ystr (keys->k
14b0: 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09 20 28 eystr keys)).. (
14c0: 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20 28 3e comma (if (>
14d0: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 (length keys) 0
14e0: 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28 61 6e ) "," "")).. (an
14f0: 64 73 74 72 20 20 20 20 28 69 66 20 28 3e 20 28 dstr (if (> (
1500: 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 length keys) 0)
1510: 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09 20 28 " AND " "")).. (
1520: 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d valslots (keys-
1530: 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 >valslots keys))
1540: 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 ;; ?,?,? .....
1550: 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61 70 20 (keyvals (map
1560: 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 cadr keyvallst))
1570: 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 .. (allvals (a
1580: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e ppend (list runn
1590: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 ame state status
15a0: 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73 29 29 user) keyvals))
15b0: 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20 28 61 .. (qryvals (a
15c0: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e ppend (list runn
15d0: 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 ame) keyvals))..
15e0: 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 (key=?str (str
15f0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
1600: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 (map (lambda (k)
1610: 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 (conc (key:get-f
1620: 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 ieldname k) "=?"
1630: 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 )) keys) " AND "
1640: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ))). (debug:p
1650: 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 rint 3 "keys: "
1660: 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 keys " allvals:
1670: 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 " allvals " keyv
1680: 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a als: " keyvals).
1690: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
16a0: 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 2 "NOTE: using
16b0: 74 61 72 67 65 74 20 22 20 28 73 74 72 69 6e 67 target " (string
16c0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 -intersperse key
16d0: 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f 72 20 vals "/") " for
16e0: 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 20 28 this run"). (
16f0: 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 if (and runname
1700: 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 (null? (filter (
1710: 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 78 lambda (x)(not x
1720: 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b )) keyvals))) ;;
1730: 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 20 61 there must be a
1740: 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20 22 better way to "
1750: 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 apply and"..(let
1760: 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 20 28 ((res #f)).. (
1770: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 apply sqlite3:ex
1780: 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 20 22 ecute db (conc "
1790: 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 INSERT OR IGNORE
17a0: 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e INTO runs (runn
17b0: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
17c0: 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d ,owner,event_tim
17d0: 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 e" comma keystr
17e0: 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f ") VALUES (?,?,?
17f0: 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27 ,?,strftime('%s'
1800: 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 ,'now')" comma v
1810: 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 alslots ");")...
1820: 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 allvals).. (ap
1830: 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d ply sqlite3:for-
1840: 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c each-row .. (l
1850: 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 20 20 ambda (id)..
1860: 20 28 73 65 74 21 20 72 65 73 20 69 64 29 29 0a (set! res id)).
1870: 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 74 20 . db.. (let
1880: 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 45 4c ((qry (conc "SEL
1890: 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 ECT id FROM runs
18a0: 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d WHERE (runname=
18b0: 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f ? " andstr key=?
18c0: 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 20 20 str ");")))..
18d0: 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;(debug:print
18e0: 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 20 0a 4 "qry: " qry) .
18f0: 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 20 71 . qry).. q
1900: 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 ryvals).. (sqli
1910: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
1920: 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 54 20 UPDATE runs SET
1930: 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f state=?,status=?
1940: 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 WHERE id=?;" st
1950: 61 74 65 20 73 74 61 74 75 73 20 72 65 73 29 0a ate status res).
1960: 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 69 6e . res) ..(begin
1970: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
1980: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 0 "ERROR: Calle
1990: 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 d without all ne
19a0: 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 0a 09 cessary keys")..
19b0: 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 #f))))..;; Thi
19c0: 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 65 s is a duplicate
19d0: 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28 77 of run-tests (w
19e0: 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64 65 hich has been de
19f0: 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20 74 precated). Use t
1a00: 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 his one instead
1a10: 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b of run tests..;;
1a20: 20 6b 65 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 keyvals.(define
1a30: 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 (runs:run-tests
1a40: 20 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61 db target runna
1a50: 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 75 73 me test-patts us
1a60: 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 er flags). (let
1a70: 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 * ((keys
1a80: 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 (rdb:get-keys db
1a90: 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 )).. (keyvallst
1aa0: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e (keys:target->
1ab0: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 keyval keys targ
1ac0: 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 et)).. (run-id
1ad0: 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74 (runs:regist
1ae0: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b er-run db keys k
1af0: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 eyvallst runname
1b00: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 "new" "n/a" use
1b10: 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 r)) ;; test-na
1b20: 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 me))).. (deferre
1b30: 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c d '()) ;; del
1b40: 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 ay running these
1b50: 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 since they have
1b60: 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 a waiton clause
1b70: 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 .. ;; keepgoing
1b80: 69 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d is the defacto m
1b90: 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c odality now, wil
1ba0: 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 l add hit-n-run
1bb0: 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b a bit later.. ;;
1bc0: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 (keepgoing (h
1bd0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
1be0: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 fault flags "-ke
1bf0: 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 epgoing" #f))..
1c00: 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 (test-names '()
1c10: 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 ).. (runconfigf
1c20: 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 (conc *toppat
1c30: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e h* "/runconfigs.
1c40: 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65 71 config")).. (req
1c50: 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29 29 uired-tests '())
1c60: 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64 73 .. (test-records
1c70: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c (make-hash-tabl
1c80: 65 29 29 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d e))).. (set-m
1c90: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
1ca0: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 db run-id) ;; t
1cb0: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 hese may be need
1cc0: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 ed by the launch
1cd0: 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 ing process..
1ce0: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 (if (file-exist
1cf0: 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 s? runconfigf)..
1d00: 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 (setup-env-defau
1d10: 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 lts db runconfig
1d20: 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 f run-id *alread
1d30: 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 y-seen-runconfig
1d40: 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e -info* "pre-laun
1d50: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 ch-env-vars")..(
1d60: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
1d70: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e ARNING: You do n
1d80: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f ot have a run co
1d90: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e nfig file: " run
1da0: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 configf)). .
1db0: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c ;; look up al
1dc0: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 l tests matching
1dd0: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 the comma separ
1de0: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f ated list of glo
1df0: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 bs in. ;; tes
1e00: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 t-patts (using %
1e10: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 as wildcard).
1e20: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
1e30: 20 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 (lambda (patt)
1e40: 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 . (let ((t
1e50: 65 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ests (glob (conc
1e60: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
1e70: 74 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 ts/" (string-tra
1e80: 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 nslate patt "%"
1e90: 22 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 "*"))))).. (set!
1ea0: 20 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 tests (filter (
1eb0: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 lambda (test)(fi
1ec0: 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 le-exists? (conc
1ed0: 20 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 test "/testconf
1ee0: 69 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 ig"))) tests))..
1ef0: 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 (set! test-name
1f00: 73 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e s (append test-n
1f10: 61 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 ames ..... (map
1f20: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 (lambda (testp)
1f30: 0a 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 ...... (last (st
1f40: 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 ring-split testp
1f50: 20 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 "/"))).....
1f60: 20 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 tests))))).
1f70: 20 20 20 28 69 66 20 74 65 73 74 2d 70 61 74 74 (if test-patt
1f80: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 s (string-split
1f90: 74 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28 test-patts ",")(
1fa0: 6c 69 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20 list "%")))..
1fb0: 20 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 ;; now remove
1fc0: 64 75 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 duplicates. (
1fd0: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 set! test-names
1fe0: 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 (delete-duplicat
1ff0: 65 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a es test-names)).
2000: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
2010: 74 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 t 0 "INFO: test
2020: 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d names " test-nam
2030: 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 es).. ;; on t
2040: 68 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 he first pass or
2050: 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 call to run-tes
2060: 74 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 ts set FAILS to
2070: 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 NOT_STARTED if.
2080: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 ;; -keepgoing
2090: 20 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 is specified.
20a0: 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 (if (eq? *pass
20b0: 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a num* 0)..(begin.
20c0: 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 . ;; have to de
20d0: 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 lete test record
20e0: 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 s where NOT_STAR
20f0: 54 45 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 TED since they c
2100: 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f an cause -keepgo
2110: 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 ing to .. ;; ge
2120: 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 t stuck due to b
2130: 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 ecoming inaccess
2140: 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c ible from a fail
2150: 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 ed test. I.e. if
2160: 20 74 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 test B depends
2170: 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 .. ;; on test A
2180: 20 62 75 74 20 74 65 73 74 20 42 20 72 65 61 63 but test B reac
2190: 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e hed the point on
21a0: 20 62 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 being registere
21b0: 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 d as NOT_STARTED
21c0: 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 and test.. ;;
21d0: 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d A failed for som
21e0: 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e e reason then on
21f0: 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b re-run using -k
2200: 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e eepgoing the run
2210: 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c can never compl
2220: 65 74 65 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 ete... (db:dele
2230: 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 te-tests-in-stat
2240: 65 20 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 e db run-id "NOT
2250: 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 72 _STARTED").. (r
2260: 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 db:set-tests-sta
2270: 74 65 2d 73 74 61 74 75 73 20 64 62 20 72 75 6e te-status db run
2280: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 -id test-names #
2290: 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 f "FAIL" "NOT_ST
22a0: 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 ARTED" "FAIL")))
22b0: 0a 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 .. ;; from he
22c0: 72 65 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 re on out the db
22d0: 20 77 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 will be opened
22e0: 61 6e 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 and closed on ev
22f0: 65 72 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 ery call runs:ru
2300: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20 n-tests-queue.
2310: 20 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c (sqlite3:final
2320: 69 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b 3b ize! db) . ;;
2330: 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 now add non-dir
2340: 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65 64 ectly referenced
2350: 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 69 dependencies (i
2360: 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 .e. waiton).
2370: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
2380: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c test-names))..(l
2390: 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 et loop ((hed (c
23a0: 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a ar test-names)).
23b0: 09 09 20 20 20 28 74 61 6c 20 28 63 64 72 20 74 .. (tal (cdr t
23c0: 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 est-names)))
23d0: 20 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d ;; 'return-
23e0: 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 20 procs tells the
23f0: 63 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74 6f config reader to
2400: 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 prep running sy
2410: 73 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e 20 stem but return
2420: 61 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75 67 a proc.. (debug
2430: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 :print 4 "INFO:
2440: 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74 hed=" hed " at t
2450: 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20 op of loop")..
2460: 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 (let* ((config
2470: 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 (tests:get-testc
2480: 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 onfig hed 'retur
2490: 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 n-procs))... (wa
24a0: 69 74 6f 6e 73 20 28 69 66 20 63 6f 6e 66 69 67 itons (if config
24b0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 (string-split (
24c0: 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d let ((w (config-
24d0: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 lookup config "r
24e0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 equirements" "wa
24f0: 69 74 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20 iton"))).......
2500: 20 20 20 20 28 69 66 20 77 20 77 20 22 22 29 29 (if w w ""))
2510: 29 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 ).... (begi
2520: 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 n.....(debug:pri
2530: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e nt 0 "ERROR: non
2540: 2d 65 78 69 73 74 65 6e 74 20 72 65 71 75 69 72 -existent requir
2550: 65 64 20 74 65 73 74 20 5c 22 22 20 68 65 64 20 ed test \"" hed
2560: 22 5c 22 22 29 0a 20 20 20 20 20 20 20 20 20 20 "\"").
2570: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2580: 20 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 (sqlite3:f
2590: 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 09 inalize! db)....
25a0: 09 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 .(exit 1)))))..
25b0: 20 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 ;; check for
25c0: 68 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d hed in waitons =
25d0: 3e 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 > this would be
25e0: 63 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 circular, remove
25f0: 20 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e it and issue an
2600: 0a 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 .. ;; error..
2610: 20 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 (if (member
2620: 68 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 hed waitons)...(
2630: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 begin... (debug
2640: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
2650: 20 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61 test " hed " ha
2660: 73 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 s listed itself
2670: 61 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 as a waiton, ple
2680: 61 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 ase correct this
2690: 21 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 !")... (set! wa
26a0: 69 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c itons (filter (l
26b0: 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 ambda (x)(not (e
26c0: 71 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 qual? x hed))) w
26d0: 61 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 aitons))))..
26e0: 0a 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 .. ;; (items
26f0: 20 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 (items:get-ite
2700: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 ms-from-config c
2710: 6f 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 onfig))).. (i
2720: 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 f (not (hash-tab
2730: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 le-ref/default t
2740: 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 est-records hed
2750: 23 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 #f))...(hash-tab
2760: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 le-set! test-rec
2770: 6f 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 ords..... hed (v
2780: 65 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b ector hed ;;
2790: 20 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 0...... con
27a0: 66 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 fig ;; 1......
27b0: 20 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 waitons ;; 2
27c0: 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 ...... (conf
27d0: 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 ig-lookup config
27e0: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 "requirements"
27f0: 22 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 "priority")
2800: 3b 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 ;; priority 3...
2810: 09 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 ... (let ((i
2820: 74 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d tems (hash-
2830: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
2840: 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 t config "items"
2850: 20 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 #f)) ;; items 4
2860: 0a 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 ....... (items
2870: 74 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c table (hash-tabl
2880: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f e-ref/default co
2890: 6e 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 nfig "itemstable
28a0: 22 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 " #f))) ......
28b0: 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 ;; if eithe
28c0: 72 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 r items or items
28d0: 20 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 table is a proc
28e0: 20 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 return it so te
28f0: 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 st running......
2900: 20 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 ;; proces
2910: 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 s can know to ca
2920: 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 ll items:get-ite
2930: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 ms-from-config..
2940: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 .... ;; if
2950: 20 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 either is a lis
2960: 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 t and none is a
2970: 70 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e proc go ahead an
2980: 64 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 d call get-items
2990: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 ...... ;;
29a0: 6f 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e otherwise return
29b0: 20 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f #f - this is no
29c0: 74 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 t an iterated te
29d0: 73 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 st...... (
29e0: 63 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f cond.......((pro
29f0: 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 cedure? items)
2a00: 20 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 ....... (deb
2a10: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f ug:print 4 "INFO
2a20: 3a 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f : items is a pro
2a30: 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c cedure, will cal
2a40: 63 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 c later").......
2a50: 20 69 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 items)
2a60: 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 ;; calc later
2a70: 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 .......((procedu
2a80: 72 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a re? itemstable).
2a90: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 ...... (debug:pr
2aa0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 int 4 "INFO: ite
2ab0: 6d 73 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f mstable is a pro
2ac0: 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c cedure, will cal
2ad0: 63 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 c later").......
2ae0: 20 69 74 65 6d 73 74 61 62 6c 65 29 20 20 20 20 itemstable)
2af0: 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 ;; calc later
2b00: 0a 09 09 09 09 09 09 28 28 66 69 6c 74 65 72 20 .......((filter
2b10: 28 6c 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 (lambda (x).....
2b20: 09 09 09 20 20 20 28 6c 65 74 20 28 28 76 61 6c ... (let ((val
2b30: 20 28 63 61 72 20 78 29 29 29 0a 09 09 09 09 09 (car x)))......
2b40: 09 09 20 20 20 20 20 28 69 66 20 28 70 72 6f 63 .. (if (proc
2b50: 65 64 75 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 edure? val) val
2b60: 23 66 29 29 29 0a 09 09 09 09 09 09 09 20 28 61 #f)))........ (a
2b70: 70 70 65 6e 64 20 28 69 66 20 28 6c 69 73 74 3f ppend (if (list?
2b80: 20 69 74 65 6d 73 29 20 69 74 65 6d 73 20 27 28 items) items '(
2b90: 29 29 0a 09 09 09 09 09 09 09 09 20 28 69 66 20 ))......... (if
2ba0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c (list? itemstabl
2bb0: 65 29 20 69 74 65 6d 73 74 61 62 6c 65 20 27 28 e) itemstable '(
2bc0: 29 29 29 29 0a 09 09 09 09 09 09 20 27 68 61 76 ))))....... 'hav
2bd0: 65 2d 70 72 6f 63 65 64 75 72 65 29 0a 09 09 09 e-procedure)....
2be0: 09 09 09 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 ...((or (list? i
2bf0: 74 65 6d 73 29 28 6c 69 73 74 3f 20 69 74 65 6d tems)(list? item
2c00: 73 74 61 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 stable)) ;; calc
2c10: 20 6e 6f 77 0a 09 09 09 09 09 09 20 28 64 65 62 now....... (deb
2c20: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f ug:print 4 "INFO
2c30: 3a 20 69 74 65 6d 73 20 61 6e 64 20 69 74 65 6d : items and item
2c40: 73 74 61 62 6c 65 20 61 72 65 20 6c 69 73 74 73 stable are lists
2c50: 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 , calc now\n"...
2c60: 09 09 09 09 09 20 20 20 20 20 20 22 20 20 20 20 ..... "
2c70: 69 74 65 6d 73 3a 20 22 20 69 74 65 6d 73 20 22 items: " items "
2c80: 20 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 20 69 itemstable: " i
2c90: 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 temstable)......
2ca0: 09 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 . (items:get-ite
2cb0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 ms-from-config c
2cc0: 6f 6e 66 69 67 29 29 0a 09 09 09 09 09 09 28 65 onfig)).......(e
2cd0: 6c 73 65 20 23 66 29 29 29 20 20 20 20 20 20 20 lse #f)))
2ce0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2cf0: 20 20 20 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 ;; not itera
2d00: 74 65 64 0a 09 09 09 09 09 20 20 20 20 20 23 66 ted...... #f
2d10: 20 20 20 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 ;; itemsda
2d20: 74 20 35 0a 09 09 09 09 09 20 20 20 20 20 23 66 t 5...... #f
2d30: 20 20 20 20 20 20 3b 3b 20 73 70 61 72 65 20 2d ;; spare -
2d40: 20 75 73 65 64 20 66 6f 72 20 69 74 65 6d 2d 70 used for item-p
2d50: 61 74 68 0a 09 09 09 09 09 20 20 20 20 20 29 29 ath...... ))
2d60: 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 ).. (for-each
2d70: 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 .. (lambda
2d80: 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 (waiton)..
2d90: 20 28 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e (if (and waiton
2da0: 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 (not (member wa
2db0: 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 iton test-names)
2dc0: 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 ))... (begin..
2dd0: 09 20 20 20 20 20 28 73 65 74 21 20 72 65 71 75 . (set! requ
2de0: 69 72 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 ired-tests (cons
2df0: 20 77 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64 waiton required
2e00: 2d 74 65 73 74 73 29 29 0a 09 09 20 20 20 20 20 -tests))...
2e10: 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 (set! test-names
2e20: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 (cons waiton te
2e30: 73 74 2d 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b st-names))))) ;;
2e40: 20 77 61 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 was an append,
2e50: 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 now a cons..
2e60: 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 waitons).. (
2e70: 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 let ((remtests (
2e80: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 delete-duplicate
2e90: 73 20 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e s (append waiton
2ea0: 73 20 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 s tal))))..
2eb0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
2ec0: 20 72 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 remtests))...
2ed0: 28 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 (loop (car remte
2ee0: 73 74 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 sts)(cdr remtest
2ef0: 73 29 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 s))))))).. (i
2f00: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 f (not (null? re
2f10: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 quired-tests))..
2f20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
2f30: 49 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 INFO: Adding " r
2f40: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 equired-tests "
2f50: 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 to the run queue
2f60: 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45 3a ")). ;; NOTE:
2f70: 20 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20 70 these are all p
2f80: 61 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74 65 arent tests, ite
2f90: 6d 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61 6e ms are not expan
2fa0: 64 65 64 20 79 65 74 2e 0a 20 20 20 20 28 64 65 ded yet.. (de
2fb0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
2fc0: 4f 3a 20 74 65 73 74 2d 72 65 63 6f 72 64 73 3d O: test-records=
2fd0: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 " (hash-table->a
2fe0: 6c 69 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 list test-record
2ff0: 73 29 29 0a 20 20 20 20 28 72 75 6e 73 3a 72 75 s)). (runs:ru
3000: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 n-tests-queue ru
3010: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 n-id runname tes
3020: 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c t-records keyval
3030: 6c 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 28 lst flags). (
3040: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 debug:print 4 "I
3050: 4e 46 4f 3a 20 41 6c 6c 20 64 6f 6e 65 20 62 79 NFO: All done by
3060: 20 68 65 72 65 22 29 29 29 0a 0a 3b 3b 20 74 65 here")))..;; te
3070: 73 74 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 st-records is a
3080: 68 61 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e hash table testn
3090: 61 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e ame:item_path =>
30a0: 20 76 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 vector < testna
30b0: 6d 65 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 me testconfig wa
30c0: 69 74 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 itons priority i
30d0: 74 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a tems-info ... >.
30e0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 (define (runs:ru
30f0: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 n-tests-queue ru
3100: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 n-id runname tes
3110: 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c t-records keyval
3120: 6c 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 3b lst flags). ;
3130: 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 ; At this point
3140: 74 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 the list of pare
3150: 6e 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 nt tests is expa
3160: 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f nded . ;; NB/
3170: 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 / Should expand
3180: 69 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 items here and t
3190: 68 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 hen insert into
31a0: 74 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 the run queue..
31b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 (debug:print 5
31c0: 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 "test-records: "
31d0: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c test-records ",
31e0: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 keyvallst: " ke
31f0: 79 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a yvallst " flags:
3200: 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e " (hash-table->
3210: 61 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 alist flags)).
3220: 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 (let ((sorted-te
3230: 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a st-names (tests:
3240: 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 sort-by-priority
3250: 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 -and-waiton test
3260: 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 69 74 65 -records))..(ite
3270: 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 20 28 m-patts (
3280: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
3290: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 69 efault flags "-i
32a0: 74 65 6d 70 61 74 74 22 20 23 66 29 29 0a 09 28 tempatt" #f))..(
32b0: 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 20 test-registery
32c0: 20 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 (make-hash-tab
32d0: 6c 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e le))). (if (n
32e0: 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65 64 ot (null? sorted
32f0: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 -test-names))..(
3300: 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 20 let loop ((hed
3310: 20 20 20 20 20 20 20 28 63 61 72 20 73 6f 72 74 (car sort
3320: 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a ed-test-names)).
3330: 09 09 20 20 20 28 74 61 6c 20 20 20 20 20 20 20 .. (tal
3340: 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74 65 (cdr sorted-te
3350: 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 20 20 28 st-names))).. (
3360: 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65 63 6f let* ((test-reco
3370: 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 rd (hash-table-r
3380: 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 ef test-records
3390: 68 65 64 29 29 0a 09 09 20 28 74 65 73 74 2d 6e hed))... (test-n
33a0: 61 6d 65 20 20 20 28 74 65 73 74 73 3a 74 65 73 ame (tests:tes
33b0: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e tqueue-get-testn
33c0: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 ame test-record)
33d0: 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20 )... (tconfig
33e0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
33f0: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ue-get-testconfi
3400: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a g test-record)).
3410: 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20 .. (testmode
3420: 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67 (let ((m (config
3430: 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 -lookup tconfig
3440: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 "requirements" "
3450: 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28 69 66 mode"))).....(if
3460: 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 m (string->symb
3470: 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29 ol m) 'normal)))
3480: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20 ... (waitons
3490: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
34a0: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 e-get-waitons
34b0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
34c0: 09 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 . (priority (
34d0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
34e0: 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 get-priority t
34f0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 est-record))...
3500: 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 (itemdat (te
3510: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3520: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 t-itemdat tes
3530: 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74 t-record)) ;; it
3540: 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20 73 emdat can be a s
3550: 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23 tring, list or #
3560: 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20 20 20 f... (items
3570: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
3580: 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20 ue-get-items
3590: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
35a0: 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 .. (item-path
35b0: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 (item-list->path
35c0: 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e itemdat))... (n
35d0: 65 77 74 61 6c 20 20 20 20 20 20 28 61 70 70 65 ewtal (appe
35e0: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 nd tal (list hed
35f0: 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 66 61 69 )))... (calc-fai
3600: 6c 73 20 20 28 6c 61 6d 62 64 61 20 28 70 72 65 ls (lambda (pre
3610: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 reqs-not-met)...
3620: 09 09 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 ..(filter (lambd
3630: 61 20 28 74 65 73 74 29 0a 09 09 09 09 09 20 20 a (test)......
3640: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 39 20 22 (debug:print 9 "
3650: 74 65 73 74 3a 20 22 20 74 65 73 74 29 0a 09 09 test: " test)...
3660: 09 09 09 20 20 28 61 6e 64 20 28 76 65 63 74 6f ... (and (vecto
3670: 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 r? test) ;; not
3680: 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a (string? test)).
3690: 09 09 09 09 09 20 20 20 20 20 20 20 28 65 71 75 ..... (equ
36a0: 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 al? (db:test-get
36b0: 2d 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f -state test) "CO
36c0: 4d 50 4c 45 54 45 44 22 29 0a 09 09 09 09 09 20 MPLETED")......
36d0: 20 20 20 20 20 20 28 6e 6f 74 20 28 6d 65 6d 62 (not (memb
36e0: 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d er (db:test-get-
36f0: 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09 09 status test)....
3700: 09 09 09 09 20 20 20 20 27 28 22 50 41 53 53 22 .... '("PASS"
3710: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 "WARN" "CHECK"
3720: 22 57 41 49 56 45 44 22 29 29 29 29 29 0a 09 09 "WAIVED")))))...
3730: 09 09 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d ...prereqs-not-m
3740: 65 74 29 29 29 0a 09 09 20 28 63 61 6c 63 2d 6e et)))... (calc-n
3750: 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 28 6c 61 ot-completed (la
3760: 6d 62 64 61 20 28 70 72 65 72 65 71 73 2d 6e 6f mbda (prereqs-no
3770: 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 20 20 t-met).....
3780: 20 20 28 66 69 6c 74 65 72 0a 09 09 09 09 09 28 (filter......(
3790: 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 09 lambda (t)......
37a0: 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 74 (or (not (vect
37b0: 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20 20 20 or? t))......
37c0: 20 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 (not (equal?
37d0: 22 43 4f 4d 50 4c 45 54 45 44 22 20 28 64 62 3a "COMPLETED" (db:
37e0: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 test-get-state t
37f0: 29 29 29 29 29 0a 09 09 09 09 09 70 72 65 72 65 )))))......prere
3800: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 qs-not-met)))...
3810: 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 (pretty-string
3820: 28 6c 61 6d 62 64 61 20 28 6c 73 74 29 0a 09 09 (lambda (lst)...
3830: 09 09 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 .. (map (lambda
3840: 20 28 74 29 0a 09 09 09 09 09 20 28 69 66 20 28 (t)...... (if (
3850: 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 not (vector? t))
3860: 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 63 ...... (conc
3870: 20 74 29 0a 09 09 09 09 09 20 20 20 20 20 28 63 t)...... (c
3880: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 onc (db:test-get
3890: 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 -testname t) ":"
38a0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
38b0: 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74 ate t) "/" (db:t
38c0: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 est-get-status t
38d0: 29 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 )))).....
38e0: 6c 73 74 29 29 29 29 0a 09 20 20 20 20 0a 09 20 lst)))).. ..
38f0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
3900: 36 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 6.... "test-name
3910: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 : " test-name...
3920: 09 20 22 5c 6e 20 20 68 65 64 3a 20 22 20 68 65 . "\n hed: " he
3930: 64 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 64 d.... "\n itemd
3940: 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 at: " itemda
3950: 74 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 t.... "\n items
3960: 3a 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 : " items...
3970: 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 . "\n item-path
3980: 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 : " item-path...
3990: 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20 . "\n waitons:
39a0: 20 20 22 20 77 61 69 74 6f 6e 73 29 0a 0a 09 20 " waitons)...
39b0: 20 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 ;; check for
39c0: 68 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d hed in waitons =
39d0: 3e 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 > this would be
39e0: 63 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 circular, remove
39f0: 20 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e it and issue an
3a00: 0a 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 .. ;; error..
3a10: 20 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 (if (member
3a20: 74 65 73 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e test-name waiton
3a30: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 s)...(begin...
3a40: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
3a50: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 74 65 ERROR: test " te
3a60: 73 74 2d 6e 61 6d 65 20 22 20 68 61 73 20 6c 69 st-name " has li
3a70: 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 sted itself as a
3a80: 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 waiton, please
3a90: 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 29 0a correct this!").
3aa0: 09 09 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e .. (set! waiton
3ab0: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 (filter (lambda
3ac0: 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f (x)(not (equal?
3ad0: 20 78 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e x hed))) waiton
3ae0: 73 29 29 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e s))))... (con
3af0: 64 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 69 74 d.. ((not it
3b00: 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c ems) ;; when fal
3b10: 73 65 20 74 68 65 20 74 65 73 74 20 69 73 20 6f se the test is o
3b20: 6b 20 74 6f 20 62 65 20 68 61 6e 64 65 64 20 6f k to be handed o
3b30: 66 66 20 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 ff to launch (bu
3b40: 74 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 t not before)..
3b50: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 68 61 76 (let* ((hav
3b60: 65 2d 72 65 73 6f 75 72 63 65 73 20 20 28 6f 70 e-resources (op
3b70: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e en-run-close run
3b80: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 s:can-run-more-t
3b90: 65 73 74 73 20 23 66 20 74 65 73 74 2d 72 65 63 ests #f test-rec
3ba0: 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 ord)) ;; look at
3bb0: 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f the test jobgro
3bc0: 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 up and tot jobs
3bd0: 72 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 running... (
3be0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 prereqs-not-met
3bf0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
3c00: 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e db:get-prereqs-n
3c10: 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 ot-met #f run-id
3c20: 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 waitons item-pa
3c30: 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 th mode: testmod
3c40: 65 29 29 0a 09 09 20 20 20 20 20 28 66 61 69 6c e))... (fail
3c50: 73 20 20 20 20 20 20 20 20 20 20 20 28 63 61 6c s (cal
3c60: 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d c-fails prereqs-
3c70: 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 20 20 not-met))...
3c80: 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 (non-completed
3c90: 20 20 28 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 (calc-not-comp
3ca0: 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f leted prereqs-no
3cb0: 74 2d 6d 65 74 29 29 29 0a 09 09 28 64 65 62 75 t-met)))...(debu
3cc0: 67 3a 70 72 69 6e 74 20 38 20 22 49 4e 46 4f 3a g:print 8 "INFO:
3cd0: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 3a have-resources:
3ce0: 20 22 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 " have-resource
3cf0: 73 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d s " prereqs-not-
3d00: 6d 65 74 3a 20 22 20 0a 09 09 09 20 20 20 20 20 met: " ....
3d10: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
3d20: 72 73 65 20 0a 09 09 09 20 20 20 20 20 20 28 6d rse .... (m
3d30: 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 ap (lambda (t)..
3d40: 09 09 09 20 20 20 20 20 28 69 66 20 28 76 65 63 ... (if (vec
3d50: 74 6f 72 3f 20 74 29 0a 09 09 09 09 09 20 28 63 tor? t)...... (c
3d60: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 onc (db:test-get
3d70: 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 -state t) "/" (d
3d80: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 b:test-get-statu
3d90: 73 20 74 29 29 0a 09 09 09 09 09 20 28 63 6f 6e s t))...... (con
3da0: 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 74 20 69 c " WARNING: t i
3db0: 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 3d 22 s not a vector="
3dc0: 20 74 20 29 29 29 0a 09 09 09 09 20 20 20 70 72 t )))..... pr
3dd0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 ereqs-not-met) "
3de0: 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22 20 , ") " fails: "
3df0: 66 61 69 6c 73 29 0a 09 09 28 64 65 62 75 67 3a fails)...(debug:
3e00: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 68 print 4 "INFO: h
3e10: 65 64 3d 22 20 68 65 64 29 0a 09 09 3b 3b 20 44 ed=" hed)...;; D
3e20: 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 on't know at thi
3e30: 73 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 s time if the te
3e40: 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 st have been lau
3e50: 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 nched at some ti
3e60: 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 me in the past..
3e70: 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73 .;; i.e. is this
3e80: 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 a re-launch?...
3e90: 28 63 6f 6e 64 0a 09 09 20 28 28 6e 6f 74 20 28 (cond... ((not (
3ea0: 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 patt-list-match
3eb0: 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 item-path item-p
3ec0: 61 74 74 73 29 29 0a 09 09 20 20 3b 3b 20 65 6c atts))... ;; el
3ed0: 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 73 74 se the run is st
3ee0: 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79 uck, temporarily
3ef0: 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a or permanently.
3f00: 09 09 20 20 3b 3b 20 62 75 74 20 73 68 6f 75 6c .. ;; but shoul
3f10: 64 20 63 68 65 63 6b 20 69 66 20 69 74 20 69 73 d check if it is
3f20: 20 64 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66 20 due to lack of
3f30: 72 65 73 6f 75 72 63 65 73 20 76 73 2e 20 70 72 resources vs. pr
3f40: 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 erequisites...
3f50: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
3f60: 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 22 INFO: Skipping "
3f70: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
3f80: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 e-get-testname t
3f90: 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20 est-record) " "
3fa0: 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69 item-path " as i
3fb0: 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 t doesn't match
3fc0: 22 20 69 74 65 6d 2d 70 61 74 74 73 29 0a 09 09 " item-patts)...
3fd0: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c (if (not (null
3fe0: 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 ? tal))...
3ff0: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 (loop (car tal)(
4000: 63 64 72 20 74 61 6c 29 29 29 29 0a 09 09 20 28 cdr tal))))... (
4010: 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 (not (hash-table
4020: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 -ref/default tes
4030: 74 2d 72 65 67 69 73 74 65 72 79 20 28 63 6f 6e t-registery (con
4040: 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 c test-name "/"
4050: 69 74 65 6d 2d 70 61 74 68 29 20 23 66 29 29 0a item-path) #f)).
4060: 09 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c .. (open-run-cl
4070: 6f 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67 ose db:tests-reg
4080: 69 73 74 65 72 2d 74 65 73 74 20 23 66 20 72 75 ister-test #f ru
4090: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
40a0: 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 68 tem-path)... (h
40b0: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 ash-table-set! t
40c0: 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 63 est-registery (c
40d0: 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f onc test-name "/
40e0: 22 20 69 74 65 6d 2d 70 61 74 68 29 20 23 74 29 " item-path) #t)
40f0: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 ... (loop (car
4100: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 newtal)(cdr newt
4110: 61 6c 29 29 29 0a 09 09 20 28 28 6e 6f 74 20 68 al)))... ((not h
4120: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29 20 3b ave-resources) ;
4130: 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61 67 61 ; simply try aga
4140: 69 6e 20 61 66 74 65 72 20 77 61 69 74 69 6e 67 in after waiting
4150: 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20 28 74 a second... (t
4160: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 hread-sleep! (+
4170: 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 1 *global-delta*
4180: 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 ))... (debug:pr
4190: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 6e 6f 20 int 1 "INFO: no
41a0: 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72 75 6e resources to run
41b0: 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61 69 74 new tests, wait
41c0: 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20 3b 3b ing ...")... ;;
41d0: 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f 6e 65 could have done
41e0: 20 68 65 64 20 74 61 6c 20 68 65 72 65 20 62 75 hed tal here bu
41f0: 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64 72 20 t doing car/cdr
4200: 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72 6f 74 of newtal to rot
4210: 61 74 65 20 74 65 73 74 73 0a 09 09 20 20 28 6c ate tests... (l
4220: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 oop (car newtal)
4230: 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29 0a 09 (cdr newtal)))..
4240: 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 73 . ((and have-res
4250: 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 20 ources...
4260: 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 (or (null? prere
4270: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 20 qs-not-met)....
4280: 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 74 (and (eq? test
4290: 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a mode 'toplevel).
42a0: 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 ....(null? non-c
42b0: 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09 20 ompleted))))...
42c0: 20 3b 3b 20 6e 6f 20 6c 6f 6f 70 20 68 65 72 65 ;; no loop here
42d0: 2c 20 6a 75 73 74 20 64 72 6f 70 20 74 68 6f 75 , just drop thou
42e0: 67 68 20 61 6e 64 20 75 73 65 20 74 68 65 20 6c gh and use the l
42f0: 6f 6f 70 20 61 74 20 74 68 65 20 62 6f 74 74 6f oop at the botto
4300: 6d 20 0a 09 09 20 20 28 72 75 6e 3a 74 65 73 74 m ... (run:test
4310: 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 run-id runname
4320: 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 keyvallst test-r
4330: 65 63 6f 72 64 20 66 6c 61 67 73 20 23 66 29 29 ecord flags #f))
4340: 0a 09 09 20 28 65 6c 73 65 20 3b 3b 20 6d 75 73 ... (else ;; mus
4350: 74 20 62 65 20 77 65 20 68 61 76 65 20 75 6e 6d t be we have unm
4360: 65 74 20 70 72 65 72 65 71 75 69 73 69 74 65 73 et prerequisites
4370: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
4380: 69 6e 74 20 34 20 22 46 41 49 4c 53 3a 20 22 20 int 4 "FAILS: "
4390: 66 61 69 6c 73 29 0a 09 09 20 20 20 20 3b 3b 20 fails)... ;;
43a0: 49 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f If one or more o
43b0: 66 20 74 68 65 20 70 72 65 72 65 71 73 2d 6e 6f f the prereqs-no
43c0: 74 2d 6d 65 74 20 61 72 65 20 46 41 49 4c 20 74 t-met are FAIL t
43d0: 68 65 6e 20 77 65 20 63 61 6e 20 69 73 73 75 65 hen we can issue
43e0: 0a 09 09 20 20 20 20 3b 3b 20 61 20 6d 65 73 73 ... ;; a mess
43f0: 61 67 65 20 61 6e 64 20 64 72 6f 70 20 68 65 64 age and drop hed
4400: 20 66 72 6f 6d 20 74 68 65 20 69 74 65 6d 73 20 from the items
4410: 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64 2e to be processed.
4420: 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c ... (if (null
4430: 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 62 65 67 ? fails)....(beg
4440: 69 6e 0a 09 09 09 20 20 3b 3b 20 63 6f 75 6c 64 in.... ;; could
4450: 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61 20 n't run, take a
4460: 62 72 65 61 74 68 65 72 0a 09 09 09 20 20 28 64 breather.... (d
4470: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
4480: 46 4f 3a 20 53 68 6f 75 6c 64 6e 27 74 20 72 65 FO: Shouldn't re
4490: 61 6c 6c 79 20 67 65 74 20 68 65 72 65 2c 20 72 ally get here, r
44a0: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 ace condition? U
44b0: 6e 61 62 6c 65 20 74 6f 20 6c 61 75 6e 63 68 20 nable to launch
44c0: 6d 6f 72 65 20 74 65 73 74 73 20 61 74 20 74 68 more tests at th
44d0: 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 is moment, killi
44e0: 6e 67 20 74 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 ng time ...")...
44f0: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 . (thread-sleep
4500: 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 ! (+ 1 *global-d
4510: 65 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 elta*)) ;; long
4520: 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 sleep here - no
4530: 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 resources, may a
4540: 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e s well be patien
4550: 74 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 t.... ;; we mad
4560: 65 20 6e 65 77 20 74 61 6c 20 62 79 20 73 74 69 e new tal by sti
4570: 63 6b 69 6e 67 20 68 65 64 20 61 74 20 74 68 65 cking hed at the
4580: 20 62 61 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 back of the lis
4590: 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 t.... (loop (ca
45a0: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 r newtal)(cdr ne
45b0: 77 74 61 6c 29 29 29 0a 09 09 09 3b 3b 20 74 68 wtal)))....;; th
45c0: 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c e waiton is FAIL
45d0: 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 so no point in
45e0: 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65 trying to run he
45f0: 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09 d ever again....
4600: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
4610: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69 66 tal)).... (if
4620: 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a 09 (vector? hed)..
4630: 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 75 67 ...(begin (debug
4640: 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 :print 1 "WARN:
4650: 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22 20 Dropping test "
4660: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
4670: 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28 tname hed) "/" (
4680: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
4690: 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09 09 -path hed)......
46a0: 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65 20 . " from the
46b0: 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20 69 launch list as i
46c0: 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74 t has prerequist
46d0: 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c es that are FAIL
46e0: 22 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 6c ")..... (l
46f0: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 oop (car tal)(cd
4700: 72 20 74 61 6c 29 29 29 0a 09 09 09 09 28 62 65 r tal))).....(be
4710: 67 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 gin..... (debug
4720: 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 :print 1 "WARN:
4730: 54 65 73 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 Test not process
4740: 65 64 20 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f ed correctly. Co
4750: 75 6c 64 20 62 65 20 61 20 72 61 63 65 20 63 6f uld be a race co
4760: 6e 64 69 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 ndition in your
4770: 74 65 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 test implementat
4780: 69 6f 6e 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 ion? " hed) ;;
4790: 22 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 " as it has prer
47a0: 65 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 equistes that ar
47b0: 65 20 46 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 e FAIL. (NOTE: h
47c0: 65 64 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 ed is not a vect
47d0: 6f 72 29 22 29 0a 09 09 09 09 20 20 28 6c 6f 6f or)")..... (loo
47e0: 70 20 68 65 64 20 74 61 6c 29 29 29 29 29 29 29 p hed tal)))))))
47f0: 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 )).. ..
4800: 3b 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e ;; case where an
4810: 20 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 items came in a
4820: 73 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 s a list been pr
4830: 6f 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 ocessed.. ((
4840: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 and (list? items
4850: 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 ) ;; thus we
4860: 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 know our items
4870: 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 are already calc
4880: 75 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 ulated... (not
4890: 20 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 itemdat)) ;;
48a0: 61 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 and not yet expa
48b0: 6e 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 nded into the li
48c0: 73 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 st of things to
48d0: 62 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 be done.. (
48e0: 69 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 if (and (>= *ver
48f0: 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 bosity* 1)...
4900: 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 (> (length i
4910: 74 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 tems) 0)...
4920: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 (> (length (ca
4930: 72 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 r items)) 0))...
4940: 20 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 (pp items))..
4950: 20 20 20 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 ;; (if (>=
4960: 2a 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 *verbosity* 5)..
4970: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 28 62 65 ;; (be
4980: 67 69 6e 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 gin.. ;;
4990: 20 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d (print "item
49a0: 73 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 69 s: ") (pp (i
49b0: 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d tem-assoc->item-
49c0: 6c 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 list items))..
49d0: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 ;; (pr
49e0: 69 6e 74 20 22 69 74 65 6d 73 74 61 62 6c 65 3a int "itemstable:
49f0: 20 22 29 28 70 70 20 28 69 74 65 6d 2d 74 61 62 ")(pp (item-tab
4a00: 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 le->item-list it
4a10: 65 6d 73 74 61 62 6c 65 29 29 29 29 0a 09 20 20 emstable))))..
4a20: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 (for-each..
4a30: 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d (lambda (m
4a40: 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c y-itemdat)... (l
4a50: 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 et* ((new-test-r
4a60: 65 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 ecord (let ((new
4a70: 72 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a rec (make-tests:
4a80: 74 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 testqueue)))....
4a90: 09 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 .. (vector-cop
4aa0: 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e y! test-record n
4ab0: 65 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e ewrec)...... n
4ac0: 65 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 ewrec))....(my-i
4ad0: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c tem-path (item-l
4ae0: 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 ist->path my-ite
4af0: 6d 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 mdat)))... (if
4b00: 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 (patt-list-matc
4b10: 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 h my-item-path i
4b20: 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 tem-patts)
4b30: 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 ;; yes, we
4b40: 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 want to process
4b50: 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a this item, NOTE:
4b60: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 Should not need
4b70: 20 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 this check here
4b80: 21 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 !... (let
4b90: 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63 ((newtestname (c
4ba0: 6f 6e 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 onc hed "/" my-i
4bb0: 74 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b tem-path))) ;
4bc0: 3b 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 ; test names are
4bd0: 20 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e unique on testn
4be0: 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 ame/item-path...
4bf0: 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 . (tests:testque
4c00: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 ue-set-items!
4c10: 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 new-test-recor
4c20: 64 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 d #f).... (tests
4c30: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 :testqueue-set-i
4c40: 74 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 temdat! new-te
4c50: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 st-record my-ite
4c60: 6d 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 mdat).... (tests
4c70: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 :testqueue-set-i
4c80: 74 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 tem_path! new-te
4c90: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 st-record my-ite
4ca0: 6d 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 m-path).... (has
4cb0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 h-table-set! tes
4cc0: 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 t-records newtes
4cd0: 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 tname new-test-r
4ce0: 65 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 ecord).... (set!
4cf0: 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 tal (cons newte
4d00: 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 stname tal))))))
4d10: 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 ;; since these
4d20: 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 are itemized cre
4d30: 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d ate new test nam
4d40: 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d es testname/item
4d50: 70 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 path.. ite
4d60: 6d 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ms).. (if (
4d70: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 not (null? tal))
4d80: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 ... (loop (car
4d90: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 tal)(cdr tal))))
4da0: 0a 0a 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 ... ;; if it
4db0: 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 ems is a proc th
4dc0: 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 en need to run i
4dd0: 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 tems:get-items-f
4de0: 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 rom-config, get
4df0: 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f the list and loo
4e00: 70 20 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d p .. ;; -
4e10: 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 but only do tha
4e20: 74 20 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 t if resources e
4e30: 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 xist to kick off
4e40: 20 74 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 the job.. (
4e50: 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 (or (procedure?
4e60: 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 items)(eq? items
4e70: 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 'have-procedure
4e80: 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 )).. (let (
4e90: 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 (can-run-more
4ea0: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
4eb0: 20 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f runs:can-run-mo
4ec0: 72 65 2d 74 65 73 74 73 20 23 66 20 74 65 73 74 re-tests #f test
4ed0: 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66 -record)))...(if
4ee0: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 can-run-more...
4ef0: 20 20 20 20 28 6c 65 74 2a 20 28 28 70 72 65 72 (let* ((prer
4f00: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 6f 70 65 eqs-not-met (ope
4f10: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 n-run-close db:g
4f20: 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d et-prereqs-not-m
4f30: 65 74 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 et #f run-id wai
4f40: 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d tons item-path m
4f50: 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a ode: testmode)).
4f60: 09 09 09 20 20 20 28 66 61 69 6c 73 20 20 20 20 ... (fails
4f70: 20 20 20 20 20 20 20 28 63 61 6c 63 2d 66 61 69 (calc-fai
4f80: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d ls prereqs-not-m
4f90: 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d et)).... (non-
4fa0: 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 63 61 6c completed (cal
4fb0: 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 c-not-completed
4fc0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 prereqs-not-met)
4fd0: 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 ))... (debu
4fe0: 67 3a 70 72 69 6e 74 20 38 20 22 49 4e 46 4f 3a g:print 8 "INFO:
4ff0: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 can-run-more: "
5000: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 can-run-more...
5010: 09 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71 73 .. "\n prereqs
5020: 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 70 72 65 -not-met: " (pre
5030: 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72 65 tty-string prere
5040: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 qs-not-met).....
5050: 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c "\n non-compl
5060: 65 74 65 64 3a 20 20 20 22 20 28 70 72 65 74 74 eted: " (prett
5070: 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d y-string non-com
5080: 70 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20 pleted) .....
5090: 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 "\n fails:
50a0: 20 20 20 20 20 22 20 28 70 72 65 74 74 79 2d 73 " (pretty-s
50b0: 74 72 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09 tring fails)....
50c0: 09 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 . "\n testmode
50d0: 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74 6d : " testm
50e0: 6f 64 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 ode..... "\n (
50f0: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f eq? testmode 'to
5100: 70 6c 65 76 65 6c 29 20 22 20 28 65 71 3f 20 74 plevel) " (eq? t
5110: 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 estmode 'topleve
5120: 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e l)..... "\n (n
5130: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 ull? non-complet
5140: 65 64 29 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20 ed) " (null?
5150: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 0a non-completed)).
5160: 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 0a 09 .. (cond ..
5170: 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75 . ((or (nu
5180: 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d ll? prereqs-not-
5190: 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 met) ;; all prer
51a0: 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 eqs met, fire of
51b0: 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 20 20 f the test....
51c0: 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 ;; or, if it i
51d0: 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 s a 'toplevel te
51e0: 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 st and all prere
51f0: 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 qs not met are C
5200: 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 OMPLETED then la
5210: 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64 unch.... (and
5220: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 (eq? testmode '
5230: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 toplevel)..... (
5240: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 null? non-comple
5250: 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28 ted)))....(let (
5260: 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 (test-name (test
5270: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
5280: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 testname test-re
5290: 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73 65 cord))).... (se
52a0: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 tenv "MT_TEST_NA
52b0: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b ME" test-name) ;
52c0: 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 ; .... (setenv
52d0: 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 "MT_RUNNAME" r
52e0: 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 6f 70 unname).... (op
52f0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 2d 6d 65 61 en-run-close-mea
5300: 73 75 72 65 20 73 65 74 2d 6d 65 67 61 74 65 73 sure set-megates
5310: 74 2d 65 6e 76 2d 76 61 72 73 20 23 66 20 72 75 t-env-vars #f ru
5320: 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d n-id) ;; these m
5330: 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 ay be needed by
5340: 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 the launching pr
5350: 6f 63 65 73 73 0a 09 09 09 20 20 28 6c 65 74 20 ocess.... (let
5360: 28 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 ((items-list (it
5370: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 ems:get-items-fr
5380: 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 om-config tconfi
5390: 67 29 29 29 0a 09 09 09 20 20 20 20 28 69 66 20 g))).... (if
53a0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73 (list? items-lis
53b0: 74 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 t).....(begin...
53c0: 09 09 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 .. (tests:testq
53d0: 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 ueue-set-items!
53e0: 74 65 73 74 2d 72 65 63 6f 72 64 20 69 74 65 6d test-record item
53f0: 73 2d 6c 69 73 74 29 0a 09 09 09 09 20 20 28 6c s-list)..... (l
5400: 6f 6f 70 20 68 65 64 20 74 61 6c 29 29 0a 09 09 oop hed tal))...
5410: 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 ..(begin..... (
5420: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
5430: 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 66 RROR: The proc f
5440: 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 20 rom reading the
5450: 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 69 setup did not yi
5460: 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 eld a list - ple
5470: 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 ase report this"
5480: 29 0a 09 09 09 09 20 20 28 65 78 69 74 20 31 29 )..... (exit 1)
5490: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 )))))... (
54a0: 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 (null? fails)...
54b0: 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 .(loop (car newt
54c0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 al)(cdr newtal))
54d0: 29 20 3b 3b 20 61 6e 20 69 73 73 75 65 20 77 69 ) ;; an issue wi
54e0: 74 68 20 70 72 65 72 65 71 73 20 6e 6f 74 20 79 th prereqs not y
54f0: 65 74 20 6d 65 74 3f 0a 09 09 20 20 20 20 20 20 et met?...
5500: 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c ((and (not (nul
5510: 6c 3f 20 66 61 69 6c 73 29 29 28 65 71 3f 20 74 l? fails))(eq? t
5520: 65 73 74 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 estmode 'normal)
5530: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e )....(debug:prin
5540: 74 20 31 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 t 1 "INFO: test
5550: 22 20 20 68 65 64 20 22 20 28 6d 6f 64 65 3d 22 " hed " (mode="
5560: 20 74 65 73 74 6d 6f 64 65 20 22 29 20 68 61 73 testmode ") has
5570: 20 66 61 69 6c 65 64 20 70 72 65 72 65 71 75 69 failed prerequi
5580: 73 69 74 65 28 73 29 3b 20 22 0a 09 09 09 09 20 site(s); ".....
5590: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 (string-inte
55a0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 rsperse (map (la
55b0: 6d 62 64 61 20 28 74 29 28 63 6f 6e 63 20 28 64 mbda (t)(conc (d
55c0: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
55d0: 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 ame t) ":" (db:t
55e0: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 est-get-state t)
55f0: 22 2f 22 28 64 62 3a 74 65 73 74 2d 67 65 74 2d "/"(db:test-get-
5600: 73 74 61 74 75 73 20 74 29 29 29 20 66 61 69 6c status t))) fail
5610: 73 29 20 22 2c 20 22 29 0a 09 09 09 09 20 20 20 s) ", ").....
5620: 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 74 ", removing it
5630: 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 from to-do list
5640: 22 29 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 28 ")....(if (not (
5650: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 null? tal))....
5660: 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 (loop (car ta
5670: 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 0a 09 l)(cdr tal))))..
5680: 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 09 . (else...
5690: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 .(debug:print 8
56a0: 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64 6c "ERROR: No handl
56b0: 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 64 er for this cond
56c0: 69 74 69 6f 6e 2e 22 29 0a 09 09 09 3b 3b 20 09 ition.")....;; .
56d0: 20 20 20 20 20 22 5c 6e 20 20 68 65 64 3a 20 20 "\n hed:
56e0: 20 20 20 20 20 20 20 20 20 20 22 20 68 65 64 20 " hed
56f0: 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e ....;; . "\n
5700: 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20 20 20 fails:
5710: 20 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 " (string-inte
5720: 72 73 70 65 72 73 65 20 28 6d 61 70 20 64 62 3a rsperse (map db:
5730: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
5740: 65 20 66 61 69 6c 73 29 20 22 2c 22 29 0a 09 09 e fails) ",")...
5750: 09 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20 74 65 .;; . "\n te
5760: 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 stmode: "
5770: 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 3b 3b 20 testmode....;;
5780: 09 20 20 20 20 20 22 5c 6e 20 70 72 65 72 65 71 . "\n prereq
5790: 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 70 72 s-not-met: " (pr
57a0: 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72 etty-string prer
57b0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 eqs-not-met)....
57c0: 3b 3b 20 09 20 20 20 20 20 22 5c 6e 20 69 74 65 ;; . "\n ite
57d0: 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 ms: "
57e0: 69 74 65 6d 73 29 0a 09 09 09 28 6c 6f 6f 70 20 items)....(loop
57f0: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 (car newtal)(cdr
5800: 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 09 09 20 newtal)))))...
5810: 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20 72 ;; if can't r
5820: 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c 6f 6f un more just loo
5830: 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f 73 73 p with next poss
5840: 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 20 20 ible test...
5850: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 (loop (car newta
5860: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29 l)(cdr newtal)))
5870: 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 )).. ..
5880: 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 6f ;; this case sho
5890: 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c 20 uld not happen,
58a0: 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 61 added to help ca
58b0: 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 20 tch any bugs..
58c0: 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 ((and (list?
58d0: 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a items) itemdat).
58e0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
58f0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 68 int 0 "ERROR: Sh
5900: 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 20 ould not have a
5910: 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 6e list of items in
5920: 20 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 20 a test and the
5930: 69 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d 20 itemspath set -
5940: 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 please report th
5950: 69 73 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 is").. (exi
5960: 74 20 31 29 29 29 29 0a 09 20 20 0a 09 20 20 3b t 1)))).. .. ;
5970: 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e ; we get here on
5980: 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 "drop through"
5990: 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 - loop for next
59a0: 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a 09 20 test in queue..
59b0: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 (if (null? tal)
59c0: 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 .. (begin..
59d0: 09 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54 48 .;; FIXME!!!! TH
59e0: 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45 IS SHOULD NOT RE
59f0: 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 21 21 QUIRE AN EXIT!!!
5a00: 21 21 21 21 0a 09 09 28 64 65 62 75 67 3a 70 72 !!!!...(debug:pr
5a10: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 6c 6c int 1 "INFO: All
5a20: 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64 22 tests launched"
5a30: 29 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 )...(thread-slee
5a40: 70 21 20 30 2e 35 29 0a 09 09 3b 3b 20 46 49 58 p! 0.5)...;; FIX
5a50: 4d 45 21 20 54 68 69 73 20 68 61 72 73 68 20 65 ME! This harsh e
5a60: 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 xit should not b
5a70: 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a e necessary.....
5a80: 09 09 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72 ..(if (not *runr
5a90: 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b emote*)(exit)) ;
5aa0: 3b 20 0a 09 09 23 66 29 20 3b 3b 20 72 65 74 75 ; ...#f) ;; retu
5ab0: 72 6e 20 61 20 23 66 20 61 73 20 61 20 68 69 6e rn a #f as a hin
5ac0: 74 20 74 68 61 74 20 77 65 20 61 72 65 20 64 6f t that we are do
5ad0: 6e 65 0a 09 20 20 20 20 20 20 3b 3b 20 48 65 72 ne.. ;; Her
5ae0: 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 e we need to che
5af0: 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 ck that all the
5b00: 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 tests remaining
5b10: 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c to be run are el
5b20: 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 09 20 igible to run..
5b30: 20 20 20 20 20 3b 3b 20 61 6e 64 20 61 72 65 20 ;; and are
5b40: 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 20 66 not blocked by f
5b50: 61 69 6c 65 64 0a 09 20 20 20 20 20 20 28 6c 65 ailed.. (le
5b60: 74 20 28 28 6e 65 77 6c 73 74 20 28 6f 70 65 6e t ((newlst (open
5b70: 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 -run-close tests
5b80: 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e :filter-non-runn
5b90: 61 62 6c 65 20 23 66 20 72 75 6e 2d 69 64 20 74 able #f run-id t
5ba0: 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29 al test-records)
5bb0: 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 )) ;; i.e. not F
5bc0: 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43 AIL, WAIVED, INC
5bd0: 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b OMPLETE, PASS, K
5be0: 49 4c 4c 45 44 2c 0a 09 09 28 74 68 72 65 61 64 ILLED,...(thread
5bf0: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d -sleep! *global-
5c00: 64 65 6c 74 61 2a 29 0a 09 09 28 69 66 20 28 6e delta*)...(if (n
5c10: 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 ot (null? newlst
5c20: 29 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 ))... (loop (
5c30: 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20 car newlst)(cdr
5c40: 6e 65 77 6c 73 74 29 29 29 29 29 29 29 29 29 0a newlst))))))))).
5c50: 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 .;; parent-test
5c60: 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c is there as a pl
5c70: 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 aceholder for wh
5c80: 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 en parent-tests
5c90: 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 can be run as a
5ca0: 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 setup step.(defi
5cb0: 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e ne (run:test run
5cc0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 -id runname keyv
5cd0: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 allst test-recor
5ce0: 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 d flags parent-t
5cf0: 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 est). ;; All th
5d00: 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 ese vars might b
5d10: 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 e referenced by
5d20: 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 the testconfig f
5d30: 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c 65 ile reader. (le
5d40: 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 t* ((test-name
5d50: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
5d60: 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 ue-get-testname
5d70: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
5d80: 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 . (test-waitons
5d90: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
5da0: 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 -get-waitons
5db0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
5dc0: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 (test-conf (t
5dd0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
5de0: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 et-testconfig te
5df0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 69 st-record)).. (i
5e00: 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 73 temdat (tes
5e10: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
5e20: 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 -itemdat test
5e30: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 -record)).. (tes
5e40: 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 t-path (conc
5e50: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 *toppath* "/test
5e60: 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 s/" test-name))
5e70: 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73 ;; could use tes
5e80: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ts:get-testconfi
5e90: 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f g here ..... (fo
5ea0: 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73 68 rce (hash
5eb0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
5ec0: 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 lt flags "-force
5ed0: 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20 " #f)).. (rerun
5ee0: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
5ef0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
5f00: 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66 lags "-rerun" #f
5f10: 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 )).. (keepgoing
5f20: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
5f30: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 ef/default flags
5f40: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 "-keepgoing" #f
5f50: 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20 )).. (item-path
5f60: 20 20 20 20 22 22 29 0a 09 20 28 64 62 20 20 20 "").. (db
5f70: 20 20 20 20 20 20 20 20 23 66 29 29 0a 20 20 20 #f)).
5f80: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 0a (debug:print 4.
5f90: 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a .. "test-config:
5fa0: 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e " (hash-table->
5fb0: 61 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 alist test-conf)
5fc0: 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 ... "\n itemda
5fd0: 74 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 t: " itemdat...
5fe0: 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 ). ;; setting
5ff0: 20 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 itemdat to a li
6000: 73 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 st if it is #f.
6010: 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d (if (not item
6020: 64 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 dat)(set! itemda
6030: 74 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 t '())). (set
6040: 21 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 ! item-path (ite
6050: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 m-list->path ite
6060: 6d 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 mdat)). (debu
6070: 67 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d g:print 2 "Attem
6080: 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 pting to launch
6090: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 test " test-name
60a0: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
60b0: 6d 2d 70 61 74 68 20 22 2f 22 29 20 22 2f 22 20 m-path "/") "/"
60c0: 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 item-path)).
60d0: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 (setenv "MT_TEST
60e0: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 _NAME" test-name
60f0: 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e ) ;; . (seten
6100: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 v "MT_RUNNAME"
6110: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 6f runname). (o
6120: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 2d 6d 65 pen-run-close-me
6130: 61 73 75 72 65 20 73 65 74 2d 6d 65 67 61 74 65 asure set-megate
6140: 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 st-env-vars db r
6150: 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 un-id) ;; these
6160: 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 may be needed by
6170: 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 the launching p
6180: 72 6f 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e rocess. (chan
6190: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f ge-directory *to
61a0: 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 ppath*).. ;;
61b0: 48 65 72 65 20 69 73 20 77 68 65 72 65 20 74 68 Here is where th
61c0: 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c e test_meta tabl
61d0: 65 20 69 73 20 62 65 73 74 20 75 70 64 61 74 65 e is best update
61e0: 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e d. ;; Yes, an
61f0: 6f 74 68 65 72 20 75 73 65 20 6f 66 20 61 20 67 other use of a g
6200: 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e lobal for cachin
6210: 67 2e 20 4e 65 65 64 20 61 20 62 65 74 74 65 72 g. Need a better
6220: 20 77 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e way?. (if (n
6230: 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 ot (hash-table-r
6240: 65 66 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74 ef/default *test
6250: 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 -meta-updated* t
6260: 65 73 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20 est-name #f)).
6270: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 (begin..
6280: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
6290: 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 ! *test-meta-upd
62a0: 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 ated* test-name
62b0: 23 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 #t). (
62c0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 open-run-close r
62d0: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f uns:update-test_
62e0: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d meta db test-nam
62f0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 e test-conf))).
6300: 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 . ;; (lamb
6310: 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b da (itemdat) ;;;
6320: 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 ((ripeness "ove
6330: 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 rripe") (tempera
6340: 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 ture "cool") (se
6350: 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a ason "summer")).
6360: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d (let* ((new-
6370: 74 65 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e test-path (strin
6380: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 g-intersperse (c
6390: 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d ons test-path (m
63a0: 61 70 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 ap cadr itemdat)
63b0: 29 20 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 ) "/")).. (new
63c0: 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 -test-name (if (
63d0: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
63e0: 20 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 "") test-name (
63f0: 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 conc test-name "
6400: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 /" item-path)))
6410: 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 ;; just need it
6420: 74 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20 to be unique..
6430: 20 28 74 65 73 74 2d 69 64 20 20 20 20 20 20 20 (test-id
6440: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
6450: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 db:get-test-id d
6460: 62 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e b run-id test-n
6470: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a ame item-path)).
6480: 09 20 20 20 28 74 65 73 74 64 61 74 20 20 20 20 . (testdat
6490: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
64a0: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 se db:get-test-i
64b0: 6e 66 6f 2d 62 79 2d 69 64 20 64 62 20 74 65 73 nfo-by-id db tes
64c0: 74 2d 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 t-id))). (i
64d0: 66 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a f (not testdat).
64e0: 09 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b . (begin.. ;
64f0: 3b 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 ; ensure that th
6500: 65 20 70 61 74 68 20 65 78 69 73 74 73 20 62 65 e path exists be
6510: 66 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 fore registering
6520: 20 74 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b the test.. ;
6530: 3b 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 ; NOPE: Cannot!
6540: 44 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 Don't know yet w
6550: 68 69 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 hich disk area w
6560: 69 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e ill be assigned.
6570: 2e 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 ..... ;; (sys
6580: 74 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 tem (conc "mkdir
6590: 20 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 -p " new-test-p
65a0: 61 74 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09 20 ath)).. ;;..
65b0: 20 20 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e 2d ;; (open-run-
65c0: 63 6c 6f 73 65 20 74 65 73 74 73 3a 72 65 67 69 close tests:regi
65d0: 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e ster-test db run
65e0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
65f0: 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 3b 3b em-path).. ;;
6600: 0a 09 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66 6f .. ;; NB// fo
6610: 72 20 74 68 65 20 61 62 6f 76 65 20 6c 69 6e 65 r the above line
6620: 2e 20 49 20 77 61 6e 74 20 74 68 65 20 74 65 73 . I want the tes
6630: 74 20 74 6f 20 62 65 20 72 65 67 69 73 74 65 72 t to be register
6640: 65 64 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20 74 ed long before t
6650: 68 69 73 20 72 6f 75 74 69 6e 65 20 67 65 74 73 his routine gets
6660: 20 63 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b 3b called!.. ;;
6670: 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74 .. (set! test
6680: 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c -id (open-run-cl
6690: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d ose db:get-test-
66a0: 69 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 id db run-id tes
66b0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
66c0: 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 )).. (if (not
66d0: 20 74 65 73 74 2d 69 64 29 0a 09 09 28 62 65 67 test-id)...(beg
66e0: 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 in... (debug:pr
66f0: 69 6e 74 20 32 20 22 57 41 52 4e 3a 20 54 65 73 int 2 "WARN: Tes
6700: 74 20 6e 6f 74 20 70 72 65 2d 63 72 65 61 74 65 t not pre-create
6710: 64 3f 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 d? test-name=" t
6720: 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d est-name ", item
6730: 2d 70 61 74 68 3d 22 20 69 74 65 6d 2d 70 61 74 -path=" item-pat
6740: 68 20 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 h ", run-id=" ru
6750: 6e 2d 69 64 29 0a 09 09 20 20 28 6f 70 65 6e 2d n-id)... (open-
6760: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 run-close db:tes
6770: 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73 74 ts-register-test
6780: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
6790: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a name item-path).
67a0: 09 09 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 .. (set! test-i
67b0: 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 d (open-run-clos
67c0: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 e db:get-test-id
67d0: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
67e0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 name item-path))
67f0: 29 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 )).. (debug:p
6800: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 74 65 rint 4 "INFO: te
6810: 73 74 2d 69 64 3d 22 20 74 65 73 74 2d 69 64 20 st-id=" test-id
6820: 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d ", run-id=" run-
6830: 69 64 20 22 2c 20 74 65 73 74 2d 6e 61 6d 65 3d id ", test-name=
6840: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 " test-name ", i
6850: 74 65 6d 2d 70 61 74 68 3d 5c 22 22 20 69 74 65 tem-path=\"" ite
6860: 6d 2d 70 61 74 68 20 22 5c 22 22 29 0a 09 20 20 m-path "\"")..
6870: 20 20 28 73 65 74 21 20 74 65 73 74 64 61 74 20 (set! testdat
6880: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
6890: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f db:get-test-info
68a0: 2d 62 79 2d 69 64 20 64 62 20 74 65 73 74 2d 69 -by-id db test-i
68b0: 64 29 29 29 29 0a 20 20 20 20 20 20 28 73 65 74 d)))). (set
68c0: 21 20 74 65 73 74 2d 69 64 20 28 64 62 3a 74 65 ! test-id (db:te
68d0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
68e0: 74 29 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67 t)). (chang
68f0: 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 e-directory test
6900: 2d 70 61 74 68 29 0a 20 20 20 20 20 20 28 63 61 -path). (ca
6910: 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 se (if force ;;
6920: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
6930: 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 force")...'NOT_S
6940: 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 65 73 TARTED...(if tes
6950: 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 72 69 tdat... (stri
6960: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 ng->symbol (test
6970: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
6980: 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c at))... 'fail
6990: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 ed-to-insert))..
69a0: 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 ((failed-to-inse
69b0: 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69 rt).. (debug:pri
69c0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 nt 0 "ERROR: Fai
69d0: 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68 led to insert th
69e0: 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 e record into th
69f0: 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 e db"))..((NOT_S
6a00: 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 TARTED COMPLETED
6a10: 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 6c ).. (let ((runfl
6a20: 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f 6e ag #f)).. (con
6a30: 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 d.. ;; -force
6a40: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 , run no matter
6a50: 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 65 what.. (force
6a60: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
6a70: 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f t)).. ;; NOT_
6a80: 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 STARTED, run no
6a90: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 matter what..
6aa0: 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 3a ((equal? (test:
6ab0: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
6ac0: 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 t) "NOT_STARTED"
6ad0: 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 )(set! runflag #
6ae0: 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 t)).. ;; not
6af0: 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c -rerun and PASS,
6b00: 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 WARN or CHECK,
6b10: 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 do no run.. (
6b20: 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 (and (or (not re
6b30: 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 run)... kee
6b40: 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 pgoing)... ;; R
6b50: 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 equire to force
6b60: 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c re-run for COMPL
6b70: 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e ETED or *anythin
6b80: 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f g* + PASS,WARN o
6b90: 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 r CHECK... (or
6ba0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
6bb0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
6bc0: 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e ) '("PASS" "WARN
6bd0: 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 20 " "CHECK"))...
6be0: 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 (member (tes
6bf0: 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73 t:get-state tes
6c00: 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 tdat) '("COMPLET
6c10: 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28 ED")))) .. (
6c20: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 debug:print 2 "I
6c30: 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 73 NFO: running tes
6c40: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f t " test-name "/
6c50: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 " item-path " su
6c60: 70 70 72 65 73 73 65 64 20 61 73 20 69 74 20 69 ppressed as it i
6c70: 73 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 s " (test:get-st
6c80: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 20 61 ate testdat) " a
6c90: 6e 64 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 nd " (test:get-s
6ca0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a tatus testdat)).
6cb0: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 . (set! runf
6cc0: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b lag #f)).. ;;
6cd0: 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 -rerun and stat
6ce0: 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 us is one of the
6cf0: 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 specifed, run i
6d00: 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 t.. ((and rer
6d10: 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 un... (let* ((r
6d20: 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e erunlst (strin
6d30: 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c g-split rerun ",
6d40: 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 ")).... (must-re
6d50: 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 run (member (tes
6d60: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
6d70: 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 tdat) rerunlst))
6d80: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
6d90: 72 69 6e 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 rint 3 "INFO: -r
6da0: 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 erun list: " rer
6db0: 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75 un ", test-statu
6dc0: 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 s: " (test:get-s
6dd0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 22 2c tatus testdat)",
6de0: 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d must-rerun: " m
6df0: 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 ust-rerun)...
6e00: 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 must-rerun))..
6e10: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
6e20: 20 32 20 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 2 "INFO: Rerun
6e30: 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20 forced for test
6e40: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 " test-name "/"
6e50: 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 item-path)..
6e60: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
6e70: 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 t)).. ;; -kee
6e80: 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 pgoing, do not r
6e90: 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 erun FAIL.. (
6ea0: 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 (and keepgoing..
6eb0: 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 . (member (test
6ec0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
6ed0: 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 dat) '("FAIL")))
6ee0: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e .. (set! run
6ef0: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 flag #f)).. (
6f00: 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 (and (not rerun)
6f10: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 ... (member (te
6f20: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
6f30: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 stdat) '("FAIL"
6f40: 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 "n/a"))).. (
6f50: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
6f60: 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 ).. (else (se
6f70: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 t! runflag #f)))
6f80: 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e .. (debug:prin
6f90: 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 t 6 "RUNNING =>
6fa0: 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c runflag: " runfl
6fb0: 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 ag " STATE: " (t
6fc0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
6fd0: 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a stdat) " STATUS:
6fe0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
6ff0: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 tus testdat))..
7000: 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c (if (not runfl
7010: 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 ag).. (if
7020: 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 (not parent-test
7030: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 )... (debug:pr
7040: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 int 1 "NOTE: Not
7050: 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 starting test "
7060: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 new-test-name "
7070: 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20 as it is state
7080: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 \"" (test:get-st
7090: 61 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 ate testdat) ...
70a0: 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 .."\" and status
70b0: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 \"" (test:get-s
70c0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 tatus testdat) "
70d0: 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c \", use -rerun \
70e0: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 "" (test:get-sta
70f0: 74 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20 tus testdat).
7100: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7110: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 "\"
7120: 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 or -force to ov
7130: 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20 erride"))..
7140: 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f ;; NOTE: No lo
7150: 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67 nger be checking
7160: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68 prerequisites h
7170: 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 ere! Will never
7180: 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20 get here unless
7190: 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20 prereqs are..
71a0: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 ;; alr
71b0: 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 eady met...
71c0: 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e (if (not (laun
71d0: 63 68 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 ch-test #f run-i
71e0: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 d runname test-c
71f0: 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 onf keyvallst te
7200: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 st-name test-pat
7210: 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29 h itemdat flags)
7220: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 )... (begin...
7230: 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 (print "ERR
7240: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 OR: Failed to la
7250: 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 unch the test. E
7260: 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 xiting as soon a
7270: 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 s possible")...
7280: 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 (set! *globa
7290: 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 lexitstatus* 1)
72a0: 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63 ;; ... (proc
72b0: 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 ess-signal (curr
72c0: 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 ent-process-id)
72d0: 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 signal/kill)))))
72e0: 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 )..((KILLED) ..
72f0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
7300: 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 NOTE: " new-test
7310: 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 -name " is alrea
7320: 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 dy running or wa
7330: 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c s explictly kill
7340: 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 ed, use -force t
7350: 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a o launch it.")).
7360: 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f .((LAUNCHED REMO
7370: 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e TEHOSTSTART RUNN
7380: 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20 ING) .. (if (>
7390: 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f (- (current-seco
73a0: 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d nds)(+ (db:test-
73b0: 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 get-event_time t
73c0: 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20 estdat).....
73d0: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
73e0: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 run_duration tes
73f0: 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b tdat)))...600) ;
7400: 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 ; i.e. no update
7410: 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 for more than 6
7420: 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 00 seconds..
7430: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 (begin..
7440: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
7450: 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 WARNING: Test "
7460: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 test-name " appe
7470: 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 ars to be dead.
7480: 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 Forcing it to st
7490: 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 ate INCOMPLETE a
74a0: 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f nd status STUCK/
74b0: 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28 DEAD").. (
74c0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 open-run-close t
74d0: 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 est-set-status!
74e0: 64 62 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f db test-id "INCO
74f0: 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 MPLETE" "STUCK/D
7500: 45 41 44 22 20 22 54 65 73 74 20 69 73 20 73 74 EAD" "Test is st
7510: 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 uck or dead" #f)
7520: 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 ).. (debug:p
7530: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 rint 2 "NOTE: "
7540: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 test-name " is a
7550: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 lready running")
7560: 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 ))..(else
7570: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
7580: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
7590: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e launch test " n
75a0: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 ew-test-name ".
75b0: 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 Unrecognised sta
75c0: 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 te " (test:get-s
75d0: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29 tate testdat))))
75e0: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
75f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
7630: 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 END OF NEW STUF
7640: 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d F.;;============
7650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 ==========..(def
7690: 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d ine (get-dir-up-
76a0: 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 n dir . params)
76b0: 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 . (let ((dparts
76c0: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 (string-split
76d0: 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e dir "/"))..(coun
76e0: 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 t (if (null? p
76f0: 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 arams) 1 (car pa
7700: 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f rams)))). (co
7710: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 nc "/" (string-i
7720: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 ntersperse ..
7730: 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 (take dparts
7740: 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 (- (length dpar
7750: 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 ts) count))..
7760: 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 "/")))).;; R
7770: 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 emove runs.;; fi
7780: 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 elds are passing
7790: 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 in through .;;
77a0: 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 action:.;; 'r
77b0: 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 emove-runs.;;
77c0: 20 27 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 'set-state-stat
77d0: 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 us.;;.;; NB// sh
77e0: 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 ould pass in key
77f0: 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 s?.;;.(define (r
7800: 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 64 uns:operate-on d
7810: 62 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 b action runname
7820: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 patt testpatt it
7830: 65 6d 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 empatt #!key (st
7840: 61 74 65 20 23 66 29 28 73 74 61 74 75 73 20 23 ate #f)(status #
7850: 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 f)(new-state-sta
7860: 74 75 73 20 23 66 29 29 0a 20 20 28 6c 65 74 2a tus #f)). (let*
7870: 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 ((keys
7880: 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 (rdb:get-keys db
7890: 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 )).. (rundat
78a0: 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e (runs:get-run
78b0: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 s-by-patt db key
78c0: 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a s runnamepatt)).
78d0: 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20 20 . (header
78e0: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
78f0: 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 at 0)).. (runs
7900: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 (vector-r
7910: 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 ef rundat 1))..
7920: 28 73 74 61 74 65 73 20 20 20 20 20 20 20 28 69 (states (i
7930: 66 20 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 f state (string
7940: 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c -split state ",
7950: 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 ") '())).. (stat
7960: 75 73 65 73 20 20 20 20 20 28 69 66 20 73 74 61 uses (if sta
7970: 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 tus (string-spli
7980: 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 t status ",") '(
7990: 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 ))).. (state-sta
79a0: 74 75 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f tus (if (string?
79b0: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 new-state-statu
79c0: 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 s) (string-split
79d0: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 new-state-statu
79e0: 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 s ",") '(#f #f))
79f0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
7a00: 69 6e 74 20 32 20 22 48 65 61 64 65 72 3a 20 22 int 2 "Header: "
7a10: 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e header " action
7a20: 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 : " action " new
7a30: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 -state-status: "
7a40: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 new-state-statu
7a50: 73 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 s). (for-each
7a60: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 . (lambda (r
7a70: 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 un). (let
7a80: 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 ((runkey (string
7a90: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 -intersperse (ma
7aa0: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 p (lambda (k)...
7ab0: 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 ....(db:get-valu
7ac0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
7ad0: 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 header (vector-r
7ae0: 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 ef k 0))) keys)
7af0: 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 "/")).. (dir
7b00: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b s-to-remove (mak
7b10: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
7b20: 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 . (let* ((run-id
7b30: 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 (db:get-valu
7b40: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
7b50: 68 65 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 header "id"))...
7b60: 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 (run-state (db:g
7b70: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
7b80: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 er run header "s
7b90: 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 tate"))...(tests
7ba0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 (if (not (e
7bb0: 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 qual? run-state
7bc0: 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 "locked"))....
7bd0: 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 (rdb:get-te
7be0: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 sts-for-run db (
7bf0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
7c00: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
7c10: 72 20 22 69 64 22 29 0a 09 09 09 09 09 09 20 20 r "id").......
7c20: 20 20 20 20 74 65 73 74 70 61 74 74 20 69 74 65 testpatt ite
7c30: 6d 70 61 74 74 20 73 74 61 74 65 73 20 73 74 61 mpatt states sta
7c40: 74 75 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 tuses.......
7c50: 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 not-in: #f...
7c60: 09 09 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 .... sort-b
7c70: 79 3a 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a y: (case action.
7c80: 09 09 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 ........ ((remov
7c90: 65 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 e-runs) 'rundir)
7ca0: 0a 09 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 ......... (else
7cb0: 20 20 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 'event_
7cc0: 74 69 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 time)))....
7cd0: 20 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 '()))...(lastt
7ce0: 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f path "/does/not/
7cf0: 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a exist/I/hope")).
7d00: 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e .. (if (not (n
7d10: 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 ull? tests))..
7d20: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 (begin... (
7d30: 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 case action...
7d40: 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a ((remove-runs).
7d50: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
7d60: 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 nt 1 "Removing t
7d70: 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 ests for run: "
7d80: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 runkey " " (db:g
7d90: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
7da0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 er run header "r
7db0: 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 unname")))...
7dc0: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 ((set-state-stat
7dd0: 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 us)... (debug
7de0: 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 :print 1 "Modify
7df0: 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 ing state and st
7e00: 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f aus for tests fo
7e10: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 r run: " runkey
7e20: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 " " (db:get-valu
7e30: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
7e40: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 header "runname"
7e50: 29 29 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 )))... (else..
7e60: 09 20 20 20 20 28 70 72 69 6e 74 20 22 49 4e 46 . (print "INF
7e70: 4f 3a 20 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 O: action not re
7e80: 63 6f 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f cognised " actio
7e90: 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 n)))... (for-eac
7ea0: 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 h... (lambda (t
7eb0: 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a est)... (let*
7ec0: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 ((item-path (db
7ed0: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
7ee0: 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 ath test))....
7ef0: 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a (test-name (db:
7f00: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
7f10: 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 e test)).... (
7f20: 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 run-dir (db:te
7f30: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 st-get-rundir te
7f40: 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 st)))... (d
7f50: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 20 20 ebug:print 1 "
7f60: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 " (db:test-get-t
7f70: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 estname test) "
7f80: 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 id: " (db:test-g
7f90: 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 et-id test) " "
7fa0: 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63 74 69 item-path " acti
7fb0: 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 on: " action)...
7fc0: 20 20 20 20 20 20 28 63 61 73 65 20 61 63 74 69 (case acti
7fd0: 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 on....((remove-r
7fe0: 75 6e 73 29 0a 09 09 09 20 28 72 64 62 3a 64 65 uns).... (rdb:de
7ff0: 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 lete-test-record
8000: 73 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 s db (db:test-ge
8010: 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 09 20 t-id test))....
8020: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
8030: 49 4e 46 4f 3a 20 41 74 74 65 6d 70 74 69 6e 67 INFO: Attempting
8040: 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72 20 22 to remove dir "
8050: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 run-dir).... (i
8060: 66 20 28 61 6e 64 20 28 3e 20 28 73 74 72 69 6e f (and (> (strin
8070: 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 g-length run-dir
8080: 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65 ) 5)..... (file
8090: 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 -exists? run-dir
80a0: 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 )) ;; bad heuris
80b0: 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 tic but should p
80c0: 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d revent /tmp /hom
80d0: 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28 e etc..... (
80e0: 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74 68 20 let* ((realpath
80f0: 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d (resolve-pathnam
8100: 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 e run-dir)))....
8110: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
8120: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 52 65 61 int 1 "INFO: Rea
8130: 6c 20 70 61 74 68 20 6f 66 20 69 73 20 22 20 72 l path of is " r
8140: 65 61 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 ealpath)....
8150: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 (if (file-exi
8160: 73 74 73 3f 20 72 65 61 6c 70 61 74 68 29 0a 09 sts? realpath)..
8170: 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 ... (if (> (sy
8180: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d stem (conc "rm -
8190: 72 66 20 22 20 72 65 61 6c 70 61 74 68 29 29 20 rf " realpath))
81a0: 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 0)..... (d
81b0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
81c0: 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 ROR: There was a
81d0: 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e problem removin
81e0: 67 20 22 20 72 65 61 6c 70 61 74 68 20 22 20 77 g " realpath " w
81f0: 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 ith rm -f"))....
8200: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 . (debug:print
8210: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 0 "WARNING: tes
8220: 74 20 72 75 6e 20 64 69 72 20 22 20 72 65 61 6c t run dir " real
8230: 70 61 74 68 20 22 20 61 70 70 65 61 72 73 20 74 path " appears t
8240: 6f 20 6e 6f 74 20 65 78 69 73 74 22 29 29 0a 09 o not exist"))..
8250: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69 .. (if (fi
8260: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 le-exists? run-d
8270: 69 72 29 20 3b 3b 20 74 68 65 20 6c 69 6e 6b 0a ir) ;; the link.
8280: 09 09 09 09 20 20 20 28 69 66 20 28 73 79 6d 62 .... (if (symb
8290: 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 olic-link? run-d
82a0: 69 72 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 ir)..... (
82b0: 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d delete-file run-
82c0: 64 69 72 29 0a 09 09 09 09 20 20 20 20 20 20 20 dir).....
82d0: 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 (if (directory?
82e0: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 run-dir)......
82f0: 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 74 6f (if (> (directo
8300: 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 ry-fold (lambda
8310: 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 30 20 (f x)(+ 1 x)) 0
8320: 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 09 09 run-dir) 0).....
8330: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
8340: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
8350: 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d refusing to rem
8360: 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 ove " run-dir "
8370: 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 as it is not emp
8380: 74 79 22 29 0a 09 09 09 09 09 20 20 20 20 20 20 ty")......
8390: 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f (delete-directo
83a0: 72 79 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 ry run-dir)) ;;
83b0: 69 74 20 73 68 6f 75 6c 64 20 62 65 20 65 6d 70 it should be emp
83c0: 74 79 20 62 79 20 68 65 72 65 20 42 55 47 20 42 ty by here BUG B
83d0: 55 47 2c 20 61 64 64 20 65 72 72 6f 72 20 63 61 UG, add error ca
83e0: 74 63 68 0a 09 09 09 09 09 20 20 20 28 64 65 62 tch...... (deb
83f0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
8400: 52 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 R: refusing to r
8410: 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 emove " run-dir
8420: 22 20 61 73 20 69 74 20 69 73 20 6e 65 69 74 68 " as it is neith
8430: 65 72 20 61 20 73 79 6d 6c 69 6e 6b 20 6e 6f 72 er a symlink nor
8440: 20 61 20 64 69 72 65 63 74 6f 72 79 22 29 0a 09 a directory")..
8450: 09 09 09 09 20 20 20 29 29 29 29 0a 09 09 09 20 .... ))))....
8460: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
8470: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 69 72 0 "WARNING: dir
8480: 65 63 74 6f 72 79 20 61 6c 72 65 61 64 79 20 72 ectory already r
8490: 65 6d 6f 76 65 64 20 22 20 72 75 6e 2d 64 69 72 emoved " run-dir
84a0: 29 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 )))....((set-sta
84b0: 74 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 te-status).... (
84c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 debug:print 2 "I
84d0: 4e 46 4f 3a 20 6e 65 77 20 73 74 61 74 65 20 22 NFO: new state "
84e0: 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 (car state-stat
84f0: 75 73 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 us) ", new statu
8500: 73 20 22 20 28 63 61 64 72 20 73 74 61 74 65 2d s " (cadr state-
8510: 73 74 61 74 75 73 29 29 0a 09 09 09 20 28 64 62 status)).... (db
8520: 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d :test-set-state-
8530: 73 74 61 74 75 73 2d 62 79 2d 69 64 20 64 62 20 status-by-id db
8540: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
8550: 74 65 73 74 29 20 28 63 61 72 20 73 74 61 74 65 test) (car state
8560: 2d 73 74 61 74 75 73 29 28 63 61 64 72 20 73 74 -status)(cadr st
8570: 61 74 65 2d 73 74 61 74 75 73 29 20 23 66 29 29 ate-status) #f))
8580: 29 29 29 0a 09 09 20 20 74 65 73 74 73 29 29 29 )))... tests)))
8590: 0a 09 20 20 20 0a 09 20 20 20 3b 3b 20 72 65 6d .. .. ;; rem
85a0: 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a ove the run if z
85b0: 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e ero tests remain
85c0: 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20 61 63 .. (if (eq? ac
85d0: 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e tion 'remove-run
85e0: 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20 s).. (let
85f0: 28 28 72 65 6d 74 65 73 74 73 20 28 72 64 62 3a ((remtests (rdb:
8600: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 get-tests-for-ru
8610: 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c n db (db:get-val
8620: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
8630: 20 68 65 61 64 65 72 20 22 69 64 22 29 20 23 66 header "id") #f
8640: 20 23 66 20 27 28 29 20 27 28 29 29 29 29 0a 09 #f '() '())))..
8650: 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d . (if (null? rem
8660: 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 tests) ;; no mor
8670: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e e tests remainin
8680: 67 0a 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 g... (let* (
8690: 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 (dparts (string
86a0: 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 -split lasttpath
86b0: 20 22 2f 22 29 29 0a 09 09 09 20 20 20 20 28 72 "/")).... (r
86c0: 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 unpath (conc "/"
86d0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
86e0: 65 72 73 65 20 0a 09 09 09 09 09 09 28 74 61 6b erse .......(tak
86f0: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e e dparts (- (len
8700: 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29 0a gth dparts) 1)).
8710: 09 09 09 09 09 09 22 2f 22 29 29 29 29 0a 09 09 ......"/"))))...
8720: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
8730: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
8740: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 run: " runkey "
8750: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d " (db:get-value-
8760: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
8770: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 ader "runname"))
8780: 0a 09 09 20 20 20 20 20 20 20 28 64 62 3a 64 65 ... (db:de
8790: 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d lete-run db run-
87a0: 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 id)... ;;
87b0: 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f need to figure o
87c0: 75 74 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 ut the path to t
87d0: 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 he run dir and r
87e0: 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 emove it if empt
87f0: 79 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 y... ;;
8800: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f (if (null? (glo
8810: 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 b (conc runpath
8820: 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 20 20 20 "/*")))...
8830: 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 ;; (begi
8840: 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 n... ;; .
8850: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
8860: 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 Removing run dir
8870: 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 " runpath)...
8880: 20 20 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 ;; . (syste
8890: 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d m (conc "rmdir -
88a0: 70 20 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a p " runpath)))).
88b0: 09 09 20 20 20 20 20 20 20 29 29 29 29 29 0a 09 .. )))))..
88c0: 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 )). runs)))
88d0: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ..;;============
88e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
88f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8900: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8910: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f ==========.;; Ro
8920: 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 utines for manip
8930: 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d ulating runs.;;=
8940: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8950: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8980: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 =====..;; Since
8990: 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 many calls to a
89a0: 72 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 run require pret
89b0: 74 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 ty much the same
89c0: 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 setup .;; this
89d0: 77 72 61 70 70 65 72 20 69 73 20 75 73 65 64 20 wrapper is used
89e0: 74 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 65 to reduce the re
89f0: 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 plication of cod
8a00: 65 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 e.(define (gener
8a10: 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 al-run-call swit
8a20: 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 chname action-de
8a30: 73 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 sc proc). (let
8a40: 28 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a ((runname (args:
8a50: 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d get-arg ":runnam
8a60: 65 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 e"))..(target (
8a70: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 if (args:get-arg
8a80: 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 "-target")...
8a90: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 (args:get-arg
8aa0: 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 "-target")...
8ab0: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 (args:get-arg
8ac0: 20 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 "-reqtarg")))..
8ad0: 28 74 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 (th1 #f)).
8ae0: 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e (cond. ((n
8af0: 6f 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 ot target).
8b00: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
8b10: 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 "ERROR: Missing
8b20: 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 required paramet
8b30: 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e er for " switchn
8b40: 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 ame ", you must
8b50: 73 70 65 63 69 66 79 20 74 68 65 20 74 61 72 67 specify the targ
8b60: 65 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 et with -target"
8b70: 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 ). (exit 3)
8b80: 29 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e ). ((not run
8b90: 6e 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 name). (deb
8ba0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
8bb0: 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 R: Missing requi
8bc0: 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f red parameter fo
8bd0: 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 r " switchname "
8be0: 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 , you must speci
8bf0: 66 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 fy the run name
8c00: 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 with :runname ru
8c10: 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 nname"). (e
8c20: 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c xit 3)). (el
8c30: 73 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 se. (let ((
8c40: 64 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b db #f).. (k
8c50: 65 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e eys #f))..(if (n
8c60: 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 ot (setup-for-ru
8c70: 6e 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 n)).. (begin
8c80: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
8c90: 72 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 rint 0 "Failed t
8ca0: 6f 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 o setup, exiting
8cb0: 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 ").. (exit
8cc0: 31 29 29 29 0a 09 28 73 65 74 21 20 64 62 20 20 1)))..(set! db
8cd0: 20 28 6f 70 65 6e 2d 64 62 29 29 0a 09 28 69 66 (open-db))..(if
8ce0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
8cf0: 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 -server").. (
8d00: 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 server:start db
8d10: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
8d20: 73 65 72 76 65 72 22 29 29 0a 09 20 20 20 20 28 server")).. (
8d30: 69 66 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 if (not (or (arg
8d40: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 s:get-arg "-runa
8d50: 6c 6c 22 29 0a 09 09 09 20 20 28 61 72 67 73 3a ll").... (args:
8d60: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 get-arg "-runtes
8d70: 74 73 22 29 29 29 0a 09 09 28 73 65 72 76 65 72 ts")))...(server
8d80: 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70 20 64 62 :client-setup db
8d90: 29 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 )))..(set! keys
8da0: 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 (rdb:get-keys db
8db0: 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 ))..;; have enou
8dc0: 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 gh to process -t
8dd0: 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 arget or -reqtar
8de0: 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 g here..(if (arg
8df0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
8e00: 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a arg").. (let*
8e10: 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 ((runconfigf (c
8e20: 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 onc *toppath* "
8e30: 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 /runconfigs.conf
8e40: 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 ig")) ;; DO NOT
8e50: 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 EVALUATE ALL ...
8e60: 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 (runconfig (
8e70: 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 read-config runc
8e80: 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 onfigf #f #f env
8e90: 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 iron-patt: #f)))
8ea0: 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 61 .. (if (ha
8eb0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
8ec0: 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 ault runconfig (
8ed0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 args:get-arg "-r
8ee0: 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 eqtarg") #f)...
8ef0: 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 (keys:target-se
8f00: 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 t-args keys (arg
8f10: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
8f20: 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 arg") args:arg-h
8f30: 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a ash)... (begin.
8f40: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
8f50: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 nt 0 "ERROR: ["
8f60: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
8f70: 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 reqtarg") "] not
8f80: 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 found in " runc
8f90: 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 73 onfigf)... (s
8fa0: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 qlite3:finalize!
8fb0: 20 64 62 29 0a 09 09 20 20 20 20 28 65 78 69 74 db)... (exit
8fc0: 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 1)))).. (if
8fd0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
8fe0: 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 target")...(keys
8ff0: 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 :target-set-args
9000: 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d keys (args:get-
9010: 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 arg "-target" ar
9020: 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 gs:arg-hash) arg
9030: 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 s:arg-hash)))..(
9040: 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f if (not (car *co
9050: 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 nfiginfo*))..
9060: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 (begin.. (
9070: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
9080: 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 RROR: Attempted
9090: 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 to " action-desc
90a0: 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 " but run area
90b0: 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 config file not
90c0: 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 found").. (
90d0: 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b exit 1)).. ;;
90e0: 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 Extract out stu
90f0: 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 ff needed in mos
9100: 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a t or many calls.
9110: 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 . ;; here the
9120: 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 n call proc..
9130: 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 (let* ((keyname
9140: 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 s (map key:get
9150: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 -fieldname keys)
9160: 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 )... (keyvalls
9170: 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 t (keys->vallis
9180: 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 t keys #t)))..
9190: 20 20 20 20 28 70 72 6f 63 20 64 62 20 74 61 72 (proc db tar
91a0: 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 get runname keys
91b0: 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c keynames keyval
91c0: 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 lst)))..(if th1
91d0: 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 (thread-join! th
91e0: 31 29 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 1))..(sqlite3:fi
91f0: 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 65 nalize! db)..(se
9200: 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 t! *didsomething
9210: 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d * #t))))))..;;==
9220: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9230: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9240: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9260: 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c ====.;; Lock/unl
9270: 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d ock runs.;;=====
9280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9290: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
92a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
92b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
92c0: 3d 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 =..(define (runs
92d0: 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 :handle-locking
92e0: 64 62 20 74 61 72 67 65 74 20 6b 65 79 73 20 72 db target keys r
92f0: 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f unname lock unlo
9300: 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a ck user). (let*
9310: 20 28 28 72 75 6e 64 61 74 20 20 20 28 72 75 6e ((rundat (run
9320: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 s:get-runs-by-pa
9330: 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 tt db keys runna
9340: 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 me)).. (header
9350: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e (vector-ref run
9360: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 dat 0)).. (runs
9370: 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 (vector-ref
9380: 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 rundat 1))).
9390: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
93a0: 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20 28 a (run)...(let (
93b0: 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d (run-id (db:get-
93c0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
93d0: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 run header "id")
93e0: 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20 6c ))... (if (or l
93f0: 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75 6e ock.... (and un
9400: 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20 28 lock.... (
9410: 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69 6e begin..... (prin
9420: 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79 t "Do you really
9430: 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20 wish to unlock
9440: 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c run " run-id "?\
9450: 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09 n y/n: ").....
9460: 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72 65 (equal? "y" (re
9470: 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09 20 ad-line)))))...
9480: 20 20 20 20 20 28 64 62 3a 6c 6f 63 6b 2f 75 6e (db:lock/un
9490: 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d lock-run db run-
94a0: 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 id lock unlock u
94b0: 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 64 65 ser)... (de
94c0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 bug:print 0 "INF
94d0: 4f 3a 20 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b O: Skipping lock
94e0: 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e /unlock on " run
94f0: 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 -id)))).. r
9500: 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d uns))).;;=======
9510: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
9550: 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b ;; Rollup runs.;
9560: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
9570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
95a0: 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 =======..;; Upda
95b0: 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 te the test_meta
95c0: 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 table for this
95d0: 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 test.(define (ru
95e0: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
95f0: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eta db test-name
9600: 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c test-conf). (l
9610: 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 et ((currrecord
9620: 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 (db:testmeta-get
9630: 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d -record db test-
9640: 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 name))). (if
9650: 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 (not currrecord)
9660: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 ..(begin.. (set
9670: 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 ! currrecord (ma
9680: 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 ke-vector 10 #f)
9690: 29 0a 09 20 20 28 64 62 3a 74 65 73 74 6d 65 74 ).. (db:testmet
96a0: 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 a-add-record db
96b0: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 test-name))).
96c0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
96d0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 (lambda (key).
96e0: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 (let* ((id
96f0: 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 x (cadr key))..
9700: 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 (fld (car
9710: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 key)).. (va
9720: 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 l (config-lookup
9730: 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 test-conf "test
9740: 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 _meta" fld)))..
9750: 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;; (debug:print
9760: 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 5 "idx: " idx "
9770: 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c fld: " fld " val
9780: 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 : " val).. (if (
9790: 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 and val (not (eq
97a0: 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 ual? (vector-ref
97b0: 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 currrecord idx)
97c0: 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 val))).. (b
97d0: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 egin.. (pr
97e0: 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 int "Updating "
97f0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c test-name " " fl
9800: 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 d " to " val)..
9810: 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 6d 65 (db:testme
9820: 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 ta-update-field
9830: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 db test-name fld
9840: 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 val))))). '
9850: 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f (("author" 2)("o
9860: 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69 wner" 3)("descri
9870: 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 ption" 4)("revie
9880: 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39 wed" 5)("tags" 9
9890: 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 )))))..;; Update
98a0: 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 test_meta for a
98b0: 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 ll tests.(define
98c0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c (runs:update-al
98d0: 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a l-test_meta db).
98e0: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 (let ((test-na
98f0: 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 mes (get-all-leg
9900: 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 al-tests))).
9910: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
9920: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 (lambda (test-na
9930: 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a me). (let*
9940: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 ((test-path
9950: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
9960: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
9970: 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 ame)).. (te
9980: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 st-configf (conc
9990: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 test-path "/tes
99a0: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 tconfig"))..
99b0: 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 (testexists
99c0: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 (and (file-exist
99d0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
99e0: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 (file-read-acces
99f0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
9a00: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 )).. ;; rea
9a10: 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 d configs with t
9a20: 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 ricks turned off
9a30: 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d (i.e. no system
9a40: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 ).. (test-c
9a50: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 onf (if teste
9a60: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 xists (read-conf
9a70: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 ig test-configf
9a80: 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 #f #f)(make-hash
9a90: 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28 72 75 -table)))).. (ru
9aa0: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
9ab0: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eta db test-name
9ac0: 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 test-conf))).
9ad0: 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 test-names)))
9ae0: 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 ..;; This could
9af0: 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 probably be refa
9b00: 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 ctored into one
9b10: 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e complex query ..
9b20: 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
9b30: 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 rollup-run db ke
9b40: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
9b50: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 name user) ;; wa
9b60: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 s target, now ke
9b70: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 yvallst. (debug
9b80: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 :print 4 "runs:r
9b90: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a ollup-run, keys:
9ba0: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c " keys " keyval
9bb0: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 lst: " keyvallst
9bc0: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 " :runname " ru
9bd0: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 nname " user: "
9be0: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 3b user). (let* (;
9bf0: 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 (keyvalllst
9c00: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e (keys:target->
9c10: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 keyval keys targ
9c20: 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d et)).. (new-run-
9c30: 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 id (runs:re
9c40: 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 gister-run db ke
9c50: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
9c60: 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 name "new" "n/a"
9c70: 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d user)).. (prev-
9c80: 74 65 73 74 73 20 20 20 20 20 20 28 74 65 73 74 tests (test
9c90: 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 :get-matching-pr
9ca0: 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d evious-test-run-
9cb0: 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 records db new-r
9cc0: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a un-id "%" "%")).
9cd0: 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20 20 . (curr-tests
9ce0: 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 (rdb:get-test
9cf0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 s-for-run db new
9d00: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 -run-id "%" "%"
9d10: 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 '() '())).. (cur
9d20: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 r-tests-hash (ma
9d30: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 ke-hash-table)))
9d40: 0a 20 20 20 20 28 64 62 3a 75 70 64 61 74 65 2d . (db:update-
9d50: 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 run-event_time d
9d60: 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 b new-run-id).
9d70: 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 ;; index the a
9d80: 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65 73 lready saved tes
9d90: 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 ts by testname a
9da0: 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 nd itemdat in cu
9db0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 rr-tests-hash.
9dc0: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 (for-each.
9dd0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 (lambda (testda
9de0: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 t). (let*
9df0: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a ((testname (db:
9e00: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
9e10: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 e testdat))..
9e20: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 (item-path (d
9e30: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
9e40: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 path testdat))..
9e50: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 (full-name
9e60: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
9e70: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 "/" item-path)))
9e80: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 .. (hash-table-s
9e90: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 et! curr-tests-h
9ea0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 ash full-name te
9eb0: 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 stdat))). cu
9ec0: 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b rr-tests). ;;
9ed0: 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d NOPE: Non-optim
9ee0: 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 al approach. Try
9ef0: 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 this instead..
9f00: 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 ;; 1. tests
9f10: 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69 6e are received in
9f20: 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 a list, most re
9f30: 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b cent first. ;
9f40: 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 ; 2. replace t
9f50: 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 he rollup test w
9f60: 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 ith the new *alw
9f70: 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 ays*. (for-ea
9f80: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
9f90: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 (testdat).
9fa0: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 (let* ((testna
9fb0: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 me (db:test-get
9fc0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 -testname testda
9fd0: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d t)).. (item
9fe0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
9ff0: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
a000: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 tdat)).. (f
a010: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 ull-name (conc t
a020: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d estname "/" item
a030: 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 -path)).. (
a040: 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 prev-test-dat (h
a050: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
a060: 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 fault curr-tests
a070: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 -hash full-name
a080: 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 #f)).. (tes
a090: 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 64 62 t-steps (db
a0a0: 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 :get-steps-for-t
a0b0: 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d est db (db:test-
a0c0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
a0d0: 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 ).. (new-te
a0e0: 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 st-record #f))..
a0f0: 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 ;; replace thes
a100: 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e e with insert ..
a110: 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c . select.. (appl
a120: 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 y sqlite3:execut
a130: 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 e ...db ...(conc
a140: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c "INSERT OR REPL
a150: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 ACE INTO tests (
a160: 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c run_id,testname,
a170: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 state,status,eve
a180: 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 nt_time,host,cpu
a190: 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e load,diskfree,un
a1a0: 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f ame,rundir,item_
a1b0: 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f path,run_duratio
a1c0: 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d n,final_logf,com
a1d0: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 ment) "...
a1e0: 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f "VALUES (?,?,?,?
a1f0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
a200: 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 ,?,?);")...new-r
a210: 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 un-id (cddr (vec
a220: 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 tor->list testda
a230: 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 t))).. (set! new
a240: 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 28 72 -testdat (car (r
a250: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db:get-tests-for
a260: 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d -run db new-run-
a270: 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d id testname item
a280: 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 29 29 -path '() '())))
a290: 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 .. (hash-table-s
a2a0: 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 et! curr-tests-h
a2b0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 ash full-name ne
a2c0: 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 w-testdat) ;; th
a2d0: 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 is could be conf
a2e0: 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 using, which rec
a2f0: 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e ord should go in
a300: 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 to the lookup ta
a310: 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 ble?.. ;; Now du
a320: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 plicate the test
a330: 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a steps.. (debug:
a340: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 print 4 "Copying
a350: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 records in test
a360: 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 _steps from test
a370: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 _id=" (db:test-g
a380: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 et-id testdat) "
a390: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 to " (db:test-g
a3a0: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
a3b0: 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 t)).. (sqlite3:e
a3c0: 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 xecute .. db ..
a3d0: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 (conc "INSERT
a3e0: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 OR REPLACE INTO
a3f0: 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 test_steps (test
a400: 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 _id,stepname,sta
a410: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
a420: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a time,comment) ".
a430: 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a .."SELECT " (db:
a440: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d test-get-id new-
a450: 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e testdat) ",stepn
a460: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
a470: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d ,event_time,comm
a480: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 ent FROM test_st
a490: 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 eps WHERE test_i
a4a0: 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 d=?;").. (db:te
a4b0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
a4c0: 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 t)).. ;; Now dup
a4d0: 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 licate the test
a4e0: 64 61 74 61 0a 09 20 28 64 65 62 75 67 3a 70 72 data.. (debug:pr
a4f0: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 int 4 "Copying r
a500: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 ecords in test_d
a510: 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 ata from test_id
a520: 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d =" (db:test-get-
a530: 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f id testdat) " to
a540: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
a550: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 id new-testdat))
a560: 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 .. (sqlite3:exec
a570: 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 ute .. db .. (
a580: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 conc "INSERT OR
a590: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 REPLACE INTO tes
a5a0: 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c t_data (test_id,
a5b0: 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c category,variabl
a5c0: 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 e,value,expected
a5d0: 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 ,tol,units,comme
a5e0: 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 nt) "..."SELECT
a5f0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
a600: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 d new-testdat) "
a610: 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 ,category,variab
a620: 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 le,value,expecte
a630: 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d d,tol,units,comm
a640: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 ent FROM test_da
a650: 74 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 ta WHERE test_id
a660: 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 =?;").. (db:tes
a670: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 t-get-id testdat
a680: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 )).. )). pre
a690: 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 v-tests))).. .
a6a0: 20 20 20 0a .