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 6c 65 74 2a 20 a proc.. (let*
2430: 28 28 63 6f 6e 66 69 67 20 20 28 74 65 73 74 73 ((config (tests
2440: 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 :get-testconfig
2450: 68 65 64 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 hed 'return-proc
2460: 73 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 s))... (waitons
2470: 28 69 66 20 63 6f 6e 66 69 67 20 28 73 74 72 69 (if config (stri
2480: 6e 67 2d 73 70 6c 69 74 20 28 6c 65 74 20 28 28 ng-split (let ((
2490: 77 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 w (config-lookup
24a0: 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 config "require
24b0: 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 29 ments" "waiton")
24c0: 29 29 0a 09 09 09 09 09 09 20 20 20 20 20 28 69 ))....... (i
24d0: 66 20 77 20 77 20 22 22 29 29 29 0a 09 09 09 20 f w w "")))....
24e0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 (begin.....
24f0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
2500: 45 52 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 ERROR: non-exist
2510: 65 6e 74 20 72 65 71 75 69 72 65 64 20 74 65 73 ent required tes
2520: 74 20 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a t \"" hed "\"").
2530: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2540: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2550: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
2560: 65 21 20 64 62 29 0a 09 09 09 09 28 65 78 69 74 e! db).....(exit
2570: 20 31 29 29 29 29 29 0a 09 20 20 20 20 3b 3b 20 1))))).. ;;
2580: 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e check for hed in
2590: 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 waitons => this
25a0: 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c would be circul
25b0: 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e ar, remove it an
25c0: 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 d issue an..
25d0: 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 ;; error.. (i
25e0: 66 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 f (member hed wa
25f0: 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a itons)...(begin.
2600: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
2610: 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 0 "ERROR: test
2620: 22 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 " hed " has list
2630: 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 ed itself as a w
2640: 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f aiton, please co
2650: 72 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 rrect this!")...
2660: 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20 (set! waitons
2670: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 (filter (lambda
2680: 28 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 (x)(not (equal?
2690: 78 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 x hed))) waitons
26a0: 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 )))).. ..
26b0: 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74 65 ;; (items (ite
26c0: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
26d0: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 m-config config)
26e0: 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 )).. (if (not
26f0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
2700: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 /default test-re
2710: 63 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a 09 cords hed #f))..
2720: 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 .(hash-table-set
2730: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 ! test-records..
2740: 09 09 09 20 68 65 64 20 28 76 65 63 74 6f 72 20 ... hed (vector
2750: 68 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 hed ;; 0....
2760: 09 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b .. config ;
2770: 3b 20 31 0a 09 09 09 09 09 20 20 20 20 20 77 61 ; 1...... wa
2780: 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 itons ;; 2......
2790: 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f (config-loo
27a0: 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 kup config "requ
27b0: 69 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 irements" "prior
27c0: 69 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69 ity") ;; pri
27d0: 6f 72 69 74 79 20 33 0a 09 09 09 09 09 20 20 20 ority 3......
27e0: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20 (let ((items
27f0: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d (hash-table-
2800: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 ref/default conf
2810: 69 67 20 22 69 74 65 6d 73 22 20 23 66 29 29 20 ig "items" #f))
2820: 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09 ;; items 4......
2830: 09 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 . (itemstable
2840: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
2850: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 default config "
2860: 69 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29 itemstable" #f))
2870: 29 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b ) ...... ;
2880: 3b 20 69 66 20 65 69 74 68 65 72 20 69 74 65 6d ; if either item
2890: 73 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65 s or items table
28a0: 20 69 73 20 61 20 70 72 6f 63 20 72 65 74 75 72 is a proc retur
28b0: 6e 20 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e n it so test run
28c0: 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20 ning......
28d0: 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20 ;; process can
28e0: 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 know to call ite
28f0: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
2900: 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 m-config......
2910: 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 ;; if eithe
2920: 72 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20 r is a list and
2930: 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67 none is a proc g
2940: 6f 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c o ahead and call
2950: 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 get-items......
2960: 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 ;; otherw
2970: 69 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20 ise return #f -
2980: 74 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 this is not an i
2990: 74 65 72 61 74 65 64 20 74 65 73 74 0a 09 09 09 terated test....
29a0: 09 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 .. (cond..
29b0: 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 .....((procedure
29c0: 3f 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09 ? items) ..
29d0: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 ..... (debug:pri
29e0: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d nt 4 "INFO: item
29f0: 73 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 s is a procedure
2a00: 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 , will calc late
2a10: 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 r")....... items
2a20: 29 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 ) ;;
2a30: 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 calc later......
2a40: 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 .((procedure? it
2a50: 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 emstable).......
2a60: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
2a70: 22 49 4e 46 4f 3a 20 69 74 65 6d 73 74 61 62 6c "INFO: itemstabl
2a80: 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 e is a procedure
2a90: 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 , will calc late
2aa0: 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 r")....... items
2ab0: 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 table) ;;
2ac0: 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 calc later......
2ad0: 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 .((filter (lambd
2ae0: 61 20 28 78 29 0a 09 09 09 09 09 09 09 20 20 20 a (x)........
2af0: 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72 20 (let ((val (car
2b00: 78 29 29 29 0a 09 09 09 09 09 09 09 20 20 20 20 x)))........
2b10: 20 28 69 66 20 28 70 72 6f 63 65 64 75 72 65 3f (if (procedure?
2b20: 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29 0a val) val #f))).
2b30: 09 09 09 09 09 09 09 20 28 61 70 70 65 6e 64 20 ....... (append
2b40: 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 (if (list? items
2b50: 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09 09 ) items '())....
2b60: 09 09 09 09 09 20 28 69 66 20 28 6c 69 73 74 3f ..... (if (list?
2b70: 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74 65 itemstable) ite
2b80: 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a 09 mstable '())))..
2b90: 09 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f 63 ..... 'have-proc
2ba0: 65 64 75 72 65 29 0a 09 09 09 09 09 09 28 28 6f edure).......((o
2bb0: 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 r (list? items)(
2bc0: 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 list? itemstable
2bd0: 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 )) ;; calc now..
2be0: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 ..... (debug:pri
2bf0: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d nt 4 "INFO: item
2c00: 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 s and itemstable
2c10: 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 are lists, calc
2c20: 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 now\n"........
2c30: 20 20 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a " items:
2c40: 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 " items " items
2c50: 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 table: " itemsta
2c60: 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 ble)....... (ite
2c70: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
2c80: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 m-config config)
2c90: 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 ).......(else #f
2ca0: 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 )))
2cb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b ;;
2cc0: 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 not iterated...
2cd0: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 ... #f
2ce0: 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 ;; itemsdat 5...
2cf0: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 ... #f
2d00: 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65 64 20 ;; spare - used
2d10: 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 for item-path...
2d20: 09 09 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 ... )))..
2d30: 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 (for-each ..
2d40: 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f (lambda (waito
2d50: 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 n).. (if (
2d60: 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 and waiton (not
2d70: 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 (member waiton t
2d80: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 est-names)))...
2d90: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 (begin...
2da0: 28 73 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 (set! required-t
2db0: 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f ests (cons waito
2dc0: 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 n required-tests
2dd0: 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 ))... (set!
2de0: 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 test-names (cons
2df0: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d waiton test-nam
2e00: 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 es))))) ;; was a
2e10: 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 n append, now a
2e20: 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f cons.. waito
2e30: 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 ns).. (let ((
2e40: 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 remtests (delete
2e50: 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 -duplicates (app
2e60: 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 end waitons tal)
2e70: 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ))).. (if (
2e80: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 not (null? remte
2e90: 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 sts))... (loop
2ea0: 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 (car remtests)(c
2eb0: 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 dr remtests)))))
2ec0: 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 )).. (if (not
2ed0: 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 (null? required
2ee0: 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 -tests))..(debug
2ef0: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 :print 1 "INFO:
2f00: 41 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 Adding " require
2f10: 64 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 d-tests " to the
2f20: 20 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 run queue")).
2f30: 20 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 ;; NOTE: these
2f40: 20 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 are all parent
2f50: 74 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 tests, items are
2f60: 20 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 not expanded ye
2f70: 74 2e 0a 20 20 20 20 28 72 75 6e 73 3a 72 75 6e t.. (runs:run
2f80: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e -tests-queue run
2f90: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
2fa0: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c -records keyvall
2fb0: 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 28 64 st flags). (d
2fc0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
2fd0: 46 4f 3a 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20 FO: All done by
2fe0: 68 65 72 65 22 29 29 29 0a 0a 0a 3b 3b 20 74 65 here")))...;; te
2ff0: 73 74 6e 61 6d 65 20 69 73 20 68 65 64 20 61 6e stname is hed an
3000: 64 20 72 65 6d 74 65 73 74 73 20 69 73 20 74 61 d remtests is ta
3010: 6c 2c 20 63 61 6e 20 62 65 20 74 65 73 74 6e 61 l, can be testna
3020: 6d 65 20 73 74 72 69 6e 67 73 20 6f 72 20 74 65 me strings or te
3030: 73 74 71 75 65 75 65 20 76 65 63 74 6f 72 73 0a stqueue vectors.
3040: 3b 3b 20 72 65 6d 61 69 6e 69 6e 67 2d 69 74 65 ;; remaining-ite
3050: 6d 73 20 61 72 65 20 6f 74 68 65 72 20 69 74 65 ms are other ite
3060: 6d 73 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 ms for the curre
3070: 6e 74 20 74 65 73 74 20 74 68 61 74 20 68 61 76 nt test that hav
3080: 65 20 6e 6f 74 20 62 65 65 6e 20 72 75 6e 20 79 e not been run y
3090: 65 74 0a 3b 3b 20 74 68 69 73 20 69 73 20 75 73 et.;; this is us
30a0: 65 64 20 69 6e 20 63 61 6c 63 75 6c 61 74 69 6e ed in calculatin
30b0: 67 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 74 g the state of t
30c0: 6f 70 6c 65 76 65 6c 20 74 65 73 74 73 2e 20 54 oplevel tests. T
30d0: 68 65 79 20 61 72 65 20 4e 4f 54 20 43 4f 4d 50 hey are NOT COMP
30e0: 4c 45 54 45 44 0a 3b 3b 20 75 6e 74 69 6c 20 61 LETED.;; until a
30f0: 6c 6c 20 69 74 65 6d 73 20 61 72 65 20 43 4f 4d ll items are COM
3100: 50 4c 45 54 45 44 20 61 6e 64 20 74 68 75 73 20 PLETED and thus
3110: 6e 6f 74 20 69 6e 20 74 68 69 73 20 6c 69 73 74 not in this list
3120: 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
3130: 72 65 6d 61 69 6e 69 6e 67 2d 69 74 65 6d 73 20 remaining-items
3140: 74 65 73 74 64 61 74 20 72 65 6d 74 65 73 74 73 testdat remtests
3150: 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 ). (let* ((test
3160: 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74 name (tests:t
3170: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 estqueue-get-tes
3180: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 20 tname testdat))
3190: 3b 3b 20 65 78 74 72 61 63 74 20 74 68 65 20 6e ;; extract the n
31a0: 61 6d 65 20 6f 66 20 74 68 65 20 74 65 73 74 20 ame of the test
31b0: 28 6d 61 79 20 68 61 76 65 20 76 65 63 74 6f 72 (may have vector
31c0: 20 72 65 63 6f 72 64 29 0a 09 20 28 69 74 65 6d record).. (item
31d0: 70 61 74 68 20 20 20 20 28 74 65 73 74 73 3a 74 path (tests:t
31e0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 estqueue-get-ite
31f0: 6d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a mpath testdat)).
3200: 09 20 28 74 6f 70 74 65 73 74 6e 61 6d 65 20 28 . (toptestname (
3210: 69 66 20 28 73 74 72 69 6e 67 3f 20 74 65 73 74 if (string? test
3220: 6e 61 6d 65 29 0a 09 09 09 20 20 28 63 61 72 20 name).... (car
3230: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 (string-split te
3240: 73 74 6e 61 6d 65 20 22 2f 22 29 29 0a 09 09 09 stname "/"))....
3250: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 (begin....
3260: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
3270: 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 68 61 ERROR: Should ha
3280: 76 65 20 61 20 73 74 72 69 6e 67 20 74 65 73 74 ve a string test
3290: 6e 61 6d 65 20 68 65 72 65 21 20 50 6c 65 61 73 name here! Pleas
32a0: 65 20 72 65 70 6f 72 74 20 74 68 69 73 20 61 73 e report this as
32b0: 20 61 20 62 75 67 20 3a 28 22 29 0a 09 09 09 20 a bug :(")....
32c0: 20 20 20 74 65 73 74 6e 61 6d 65 29 29 29 29 0a testname)))).
32d0: 20 20 20 20 28 66 69 6c 74 65 72 20 28 6c 61 6d (filter (lam
32e0: 62 64 61 20 28 74 65 73 74 29 0a 09 20 20 20 20 bda (test)..
32f0: 20 20 28 6c 65 74 20 28 28 74 6e 61 6d 65 20 28 (let ((tname (
3300: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
3310: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
3320: 74 29 29 0a 09 09 20 20 20 20 28 69 70 61 74 68 t))... (ipath
3330: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
3340: 65 2d 67 65 74 2d 69 74 65 6d 70 61 74 68 20 74 e-get-itempath t
3350: 65 73 74 29 29 29 0a 09 09 28 61 6e 64 20 28 65 est)))...(and (e
3360: 71 75 61 6c 3f 20 74 6e 61 6d 65 20 74 65 73 74 qual? tname test
3370: 6e 61 6d 65 29 0a 09 09 20 20 20 20 20 28 61 6e name)... (an
3380: 64 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 d (not (equal? i
3390: 70 61 74 68 20 22 22 29 29 0a 09 09 09 20 20 28 path "")).... (
33a0: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 70 61 74 not (equal? ipat
33b0: 68 20 69 74 65 6d 70 61 74 68 29 29 29 29 29 29 h itempath))))))
33c0: 0a 09 20 20 20 20 72 65 6d 74 65 73 74 73 29 29 .. remtests))
33d0: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72 )..;; test-recor
33e0: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62 ds is a hash tab
33f0: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d le testname:item
3400: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20 _path => vector
3410: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63 < testname testc
3420: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72 onfig waitons pr
3430: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66 iority items-inf
3440: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20 o ... >.(define
3450: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
3460: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e queue run-id run
3470: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
3480: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
3490: 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 s). ;; At thi
34a0: 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 s point the list
34b0: 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 of parent tests
34c0: 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 is expanded .
34d0: 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 ;; NB// Should
34e0: 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 expand items he
34f0: 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 re and then inse
3500: 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 rt into the run
3510: 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a queue.. (debug:
3520: 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65 print 5 "test-re
3530: 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65 cords: " test-re
3540: 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c cords ", keyvall
3550: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 st: " keyvallst
3560: 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 68 " flags: " (hash
3570: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 6c -table->alist fl
3580: 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 73 ags)). (let ((s
3590: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 orted-test-names
35a0: 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d (tests:sort-by-
35b0: 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69 priority-and-wai
35c0: 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 73 ton test-records
35d0: 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74 73 20 ))..(item-patts
35e0: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
35f0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
3600: 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74 74 22 lags "-itempatt"
3610: 20 23 66 29 29 29 0a 20 20 20 20 28 69 66 20 28 #f))). (if (
3620: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65 not (null? sorte
3630: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 d-test-names))..
3640: 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 (let loop ((hed
3650: 20 20 20 20 20 20 20 20 28 63 61 72 20 73 6f 72 (car sor
3660: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 ted-test-names))
3670: 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 20 20 ... (tal
3680: 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74 (cdr sorted-t
3690: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 20 20 est-names)))..
36a0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a (thread-sleep! *
36b0: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 20 3b global-delta*) ;
36c0: 3b 20 67 69 76 65 20 6f 74 68 65 72 20 61 70 70 ; give other app
36d0: 6c 69 63 61 74 69 6f 6e 73 20 73 6f 6d 65 20 74 lications some t
36e0: 69 6d 65 20 77 69 74 68 20 74 68 65 20 64 62 0a ime with the db.
36f0: 09 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d . (let* ((test-
3700: 72 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 record (hash-tab
3710: 6c 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f le-ref test-reco
3720: 72 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 63 rds hed))... (tc
3730: 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 73 onfig (tests
3740: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
3750: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 estconfig test-r
3760: 65 63 6f 72 64 29 29 0a 09 09 20 28 74 65 73 74 ecord))... (test
3770: 6d 6f 64 65 20 20 20 20 28 6c 65 74 20 28 28 6d mode (let ((m
3780: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
3790: 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 tconfig "require
37a0: 6d 65 6e 74 73 22 20 22 6d 6f 64 65 22 29 29 29 ments" "mode")))
37b0: 0a 09 09 09 09 28 69 66 20 6d 20 28 73 74 72 69 .....(if m (stri
37c0: 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20 27 6e ng->symbol m) 'n
37d0: 6f 72 6d 61 6c 29 29 29 0a 09 09 20 28 77 61 69 ormal)))... (wai
37e0: 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a tons (tests:
37f0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 testqueue-get-wa
3800: 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 itons test-re
3810: 63 6f 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72 cord))... (prior
3820: 69 74 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 ity (tests:te
3830: 73 74 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f stqueue-get-prio
3840: 72 69 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f rity test-reco
3850: 72 64 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74 rd))... (itemdat
3860: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 (tests:test
3870: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 queue-get-itemda
3880: 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 t test-record
3890: 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 )) ;; itemdat ca
38a0: 6e 20 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c n be a string, l
38b0: 69 73 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74 ist or #f... (it
38c0: 65 6d 73 20 20 20 20 20 20 20 28 74 65 73 74 73 ems (tests
38d0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 :testqueue-get-i
38e0: 74 65 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 tems test-r
38f0: 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d ecord))... (item
3900: 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 -path (item-li
3910: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 st->path itemdat
3920: 29 29 0a 09 09 20 28 6e 65 77 74 61 6c 20 20 20 ))... (newtal
3930: 20 20 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 (append tal (
3940: 6c 69 73 74 20 68 65 64 29 29 29 0a 09 09 20 28 list hed)))... (
3950: 63 61 6c 63 2d 66 61 69 6c 73 20 20 28 6c 61 6d calc-fails (lam
3960: 62 64 61 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 bda (prereqs-not
3970: 2d 6d 65 74 29 0a 09 09 09 09 28 66 69 6c 74 65 -met).....(filte
3980: 72 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 r (lambda (test)
3990: 0a 09 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 ...... (debug:p
39a0: 72 69 6e 74 20 39 20 22 74 65 73 74 3a 20 22 20 rint 9 "test: "
39b0: 74 65 73 74 29 0a 09 09 09 09 09 20 20 28 61 6e test)...... (an
39c0: 64 20 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29 d (vector? test)
39d0: 20 3b 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f ;; not (string?
39e0: 20 74 65 73 74 29 29 0a 09 09 09 09 09 20 20 20 test))......
39f0: 20 20 20 20 28 65 71 75 61 6c 3f 20 28 64 62 3a (equal? (db:
3a00: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 test-get-state t
3a10: 65 73 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 est) "COMPLETED"
3a20: 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 6e )...... (n
3a30: 6f 74 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 ot (member (db:t
3a40: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 est-get-status t
3a50: 65 73 74 29 0a 09 09 09 09 09 09 09 20 20 20 20 est)........
3a60: 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 '("PASS" "WARN"
3a70: 22 43 48 45 43 4b 22 20 22 57 41 49 56 45 44 22 "CHECK" "WAIVED"
3a80: 29 29 29 29 29 0a 09 09 09 09 09 70 72 65 72 65 )))))......prere
3a90: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 qs-not-met)))...
3aa0: 20 28 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c (calc-not-compl
3ab0: 65 74 65 64 20 28 6c 61 6d 62 64 61 20 28 70 72 eted (lambda (pr
3ac0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 ereqs-not-met)..
3ad0: 09 09 09 20 20 20 20 20 20 20 28 66 69 6c 74 65 ... (filte
3ae0: 72 0a 09 09 09 09 09 28 6c 61 6d 62 64 61 20 28 r......(lambda (
3af0: 74 29 0a 09 09 09 09 09 20 20 28 6f 72 20 28 6e t)...... (or (n
3b00: 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a ot (vector? t)).
3b10: 09 09 09 09 09 20 20 20 20 20 20 28 6e 6f 74 20 ..... (not
3b20: 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 (equal? "COMPLET
3b30: 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ED" (db:test-get
3b40: 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a 09 09 -state t)))))...
3b50: 09 09 09 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d ...prereqs-not-m
3b60: 65 74 29 29 29 0a 09 09 20 28 70 72 65 74 74 79 et)))... (pretty
3b70: 2d 73 74 72 69 6e 67 20 28 6c 61 6d 62 64 61 20 -string (lambda
3b80: 28 6c 73 74 29 0a 09 09 09 09 20 20 28 6d 61 70 (lst)..... (map
3b90: 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 (lambda (t)....
3ba0: 09 09 20 28 69 66 20 28 6e 6f 74 20 28 76 65 63 .. (if (not (vec
3bb0: 74 6f 72 3f 20 74 29 29 0a 09 09 09 09 09 20 20 tor? t))......
3bc0: 20 20 20 28 63 6f 6e 63 20 74 29 0a 09 09 09 09 (conc t).....
3bd0: 09 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a . (conc (db:
3be0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
3bf0: 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 e t) ":" (db:tes
3c00: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 t-get-state t) "
3c10: 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d /" (db:test-get-
3c20: 73 74 61 74 75 73 20 74 29 29 29 29 0a 09 09 09 status t))))....
3c30: 09 20 20 20 20 20 20 20 6c 73 74 29 29 29 29 0a . lst)))).
3c40: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
3c50: 74 20 36 0a 09 09 09 20 22 69 74 65 6d 64 61 74 t 6.... "itemdat
3c60: 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 74 0a : " itemdat.
3c70: 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20 ... "\n items:
3c80: 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 09 20 " items....
3c90: 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 "\n item-path:
3ca0: 22 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 " item-path....
3cb0: 22 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 "\n waitons:
3cc0: 22 20 77 61 69 74 6f 6e 73 29 0a 0a 09 20 20 20 " waitons)...
3cd0: 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 ;; check for he
3ce0: 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 d in waitons =>
3cf0: 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 this would be ci
3d00: 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 rcular, remove i
3d10: 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 t and issue an..
3d20: 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 ;; error..
3d30: 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65 (if (member he
3d40: 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 d waitons)...(be
3d50: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 gin... (debug:p
3d60: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 rint 0 "ERROR: t
3d70: 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73 20 est " hed " has
3d80: 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 listed itself as
3d90: 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 a waiton, pleas
3da0: 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 e correct this!"
3db0: 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74 )... (set! wait
3dc0: 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 on (filter (lamb
3dd0: 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61 da (x)(not (equa
3de0: 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74 l? x hed))) wait
3df0: 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 28 63 ons))))... (c
3e00: 6f 6e 64 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 ond.. ((not
3e10: 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66 items) ;; when f
3e20: 61 6c 73 65 20 74 68 65 20 74 65 73 74 20 69 73 alse the test is
3e30: 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64 65 64 ok to be handed
3e40: 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68 20 28 off to launch (
3e50: 62 75 74 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a but not before).
3e60: 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 68 . (let* ((h
3e70: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 28 ave-resources (
3e80: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 open-run-close r
3e90: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
3ea0: 2d 74 65 73 74 73 20 23 66 20 74 65 73 74 2d 72 -tests #f test-r
3eb0: 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 ecord)) ;; look
3ec0: 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67 at the test jobg
3ed0: 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 roup and tot job
3ee0: 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 s running...
3ef0: 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 (prereqs-not-me
3f00: 74 20 28 64 62 3a 67 65 74 2d 70 72 65 72 65 71 t (db:get-prereq
3f10: 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e s-not-met #f run
3f20: 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d -id waitons item
3f30: 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 -path mode: test
3f40: 6d 6f 64 65 29 29 0a 09 09 20 20 20 20 20 28 66 mode))... (f
3f50: 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 28 ails (
3f60: 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 calc-fails prere
3f70: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 qs-not-met))...
3f80: 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 (non-complet
3f90: 65 64 20 20 20 28 63 61 6c 63 2d 6e 6f 74 2d 63 ed (calc-not-c
3fa0: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 ompleted prereqs
3fb0: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 64 -not-met)))...(d
3fc0: 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49 4e ebug:print 8 "IN
3fd0: 46 4f 3a 20 68 61 76 65 2d 72 65 73 6f 75 72 63 FO: have-resourc
3fe0: 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f 75 es: " have-resou
3ff0: 72 63 65 73 20 22 20 70 72 65 72 65 71 73 2d 6e rces " prereqs-n
4000: 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20 20 ot-met: " ....
4010: 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 (string-inter
4020: 73 70 65 72 73 65 20 0a 09 09 09 20 20 20 20 20 sperse ....
4030: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 (map (lambda (t
4040: 29 0a 09 09 09 09 20 20 20 20 20 28 69 66 20 28 )..... (if (
4050: 76 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09 09 vector? t)......
4060: 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d (conc (db:test-
4070: 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 get-state t) "/"
4080: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
4090: 61 74 75 73 20 74 29 29 0a 09 09 09 09 09 20 28 atus t))...... (
40a0: 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 conc " WARNING:
40b0: 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f t is not a vecto
40c0: 72 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20 20 r=" t ))).....
40d0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
40e0: 29 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a ) ", ") " fails:
40f0: 20 22 20 66 61 69 6c 73 29 0a 09 09 3b 3b 20 44 " fails)...;; D
4100: 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 on't know at thi
4110: 73 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 s time if the te
4120: 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 st have been lau
4130: 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 nched at some ti
4140: 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 me in the past..
4150: 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73 .;; i.e. is this
4160: 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 a re-launch?...
4170: 28 63 6f 6e 64 0a 09 09 20 28 28 61 6e 64 20 68 (cond... ((and h
4180: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 ave-resources...
4190: 20 20 20 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c (or (null
41a0: 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 ? prereqs-not-me
41b0: 74 29 0a 09 09 09 20 20 20 28 61 6e 64 20 28 65 t).... (and (e
41c0: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 q? testmode 'top
41d0: 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e 75 6c 6c level).....(null
41e0: 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 ? non-completed)
41f0: 29 29 29 0a 09 09 20 20 3b 3b 20 6e 6f 20 6c 6f )))... ;; no lo
4200: 6f 70 20 68 65 72 65 2c 20 6a 75 73 74 20 64 72 op here, just dr
4210: 6f 70 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 op though and us
4220: 65 20 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 e the loop at th
4230: 65 20 62 6f 74 74 6f 6d 20 0a 09 09 20 20 28 69 e bottom ... (i
4240: 66 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 f (patt-list-mat
4250: 63 68 20 69 74 65 6d 2d 70 61 74 68 20 69 74 65 ch item-path ite
4260: 6d 2d 70 61 74 74 73 29 0a 09 09 20 20 20 20 20 m-patts)...
4270: 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 (run:test run-i
4280: 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c d runname keyval
4290: 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 lst test-record
42a0: 66 6c 61 67 73 20 23 66 29 0a 09 09 20 20 20 20 flags #f)...
42b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
42c0: 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 "INFO: Skipping
42d0: 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 " (tests:testqu
42e0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 eue-get-testname
42f0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20 test-record) "
4300: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73 " item-path " as
4310: 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 it doesn't matc
4320: 68 20 22 20 69 74 65 6d 2d 70 61 74 74 73 29 29 h " item-patts))
4330: 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 ... ;; else the
4340: 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 run is stuck, t
4350: 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 emporarily or pe
4360: 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b rmanently... ;;
4370: 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 65 63 but should chec
4380: 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 20 74 k if it is due t
4390: 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 o lack of resour
43a0: 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 75 69 ces vs. prerequi
43b0: 73 69 74 65 73 0a 09 09 20 20 29 0a 09 09 20 28 sites... )... (
43c0: 28 6e 6f 74 20 68 61 76 65 2d 72 65 73 6f 75 72 (not have-resour
43d0: 63 65 73 29 0a 09 09 20 20 3b 3b 20 73 69 6d 70 ces)... ;; simp
43e0: 6c 79 20 74 72 79 20 61 67 61 69 6e 20 61 66 74 ly try again aft
43f0: 65 72 20 77 61 69 74 69 6e 67 20 61 20 73 65 63 er waiting a sec
4400: 6f 6e 64 2c 20 62 75 74 20 72 65 67 69 73 74 65 ond, but registe
4410: 72 20 74 68 65 20 74 65 73 74 0a 09 09 20 20 3b r the test... ;
4420: 3b 20 73 6f 20 74 68 65 20 69 74 65 6d 69 7a 65 ; so the itemize
4430: 64 20 74 65 73 74 73 20 68 61 76 65 20 70 6c 61 d tests have pla
4440: 63 65 20 68 6f 6c 64 65 72 73 0a 09 09 20 20 28 ce holders... (
4450: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 open-run-close t
4460: 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 ests:register-te
4470: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 28 74 65 st db run-id (te
4480: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
4490: 74 2d 74 65 73 74 6e 61 6d 65 20 68 65 64 29 20 t-testname hed)
44a0: 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 item-path)... (
44b0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b thread-sleep! (+
44c0: 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 1 *global-delta
44d0: 2a 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70 *))... (debug:p
44e0: 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 6e 6f rint 1 "INFO: no
44f0: 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72 75 resources to ru
4500: 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61 69 n new tests, wai
4510: 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20 3b ting ...")... ;
4520: 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f 6e ; could have don
4530: 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 20 62 e hed tal here b
4540: 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64 72 ut doing car/cdr
4550: 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72 6f of newtal to ro
4560: 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 20 28 tate tests... (
4570: 6c 6f 6f 70 20 68 65 64 20 74 61 6c 29 29 20 3b loop hed tal)) ;
4580: 3b 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 ; (car newtal)(c
4590: 64 72 20 6e 65 77 74 61 6c 29 29 29 20 57 48 59 dr newtal))) WHY
45a0: 20 44 49 44 20 49 20 52 45 4f 52 44 45 52 21 21 DID I REORDER!!
45b0: 3f 20 0a 09 09 20 28 65 6c 73 65 20 3b 3b 20 6d ? ... (else ;; m
45c0: 75 73 74 20 62 65 20 77 65 20 68 61 76 65 20 75 ust be we have u
45d0: 6e 6d 65 74 20 70 72 65 72 65 71 75 69 73 69 74 nmet prerequisit
45e0: 65 73 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a es... (debug:
45f0: 70 72 69 6e 74 20 34 20 22 46 41 49 4c 53 3a 20 print 4 "FAILS:
4600: 22 20 66 61 69 6c 73 29 0a 09 09 20 20 20 20 3b " fails)... ;
4610: 3b 20 49 66 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 ; If one or more
4620: 20 6f 66 20 74 68 65 20 70 72 65 72 65 71 73 2d of the prereqs-
4630: 6e 6f 74 2d 6d 65 74 20 61 72 65 20 46 41 49 4c not-met are FAIL
4640: 20 74 68 65 6e 20 77 65 20 63 61 6e 20 69 73 73 then we can iss
4650: 75 65 0a 09 09 20 20 20 20 3b 3b 20 61 20 6d 65 ue... ;; a me
4660: 73 73 61 67 65 20 61 6e 64 20 64 72 6f 70 20 68 ssage and drop h
4670: 65 64 20 66 72 6f 6d 20 74 68 65 20 69 74 65 6d ed from the item
4680: 73 20 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 s to be processe
4690: 64 2e 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 d.... (if (nu
46a0: 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 62 ll? fails)....(b
46b0: 65 67 69 6e 0a 09 09 09 20 20 3b 3b 20 63 6f 75 egin.... ;; cou
46c0: 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 ldn't run, take
46d0: 61 20 62 72 65 61 74 68 65 72 0a 09 09 09 20 20 a breather....
46e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
46f0: 49 4e 46 4f 3a 20 53 68 6f 75 6c 64 6e 27 74 20 INFO: Shouldn't
4700: 72 65 61 6c 6c 79 20 67 65 74 20 68 65 72 65 2c really get here,
4710: 20 72 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 3f race condition?
4720: 20 55 6e 61 62 6c 65 20 74 6f 20 6c 61 75 6e 63 Unable to launc
4730: 68 20 6d 6f 72 65 20 74 65 73 74 73 20 61 74 20 h more tests at
4740: 74 68 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b 69 6c this moment, kil
4750: 6c 69 6e 67 20 74 69 6d 65 20 2e 2e 2e 22 29 0a ling time ...").
4760: 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 ... (thread-sle
4770: 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c ep! (+ 1 *global
4780: 2d 64 65 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f 6e -delta*)) ;; lon
4790: 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e g sleep here - n
47a0: 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 o resources, may
47b0: 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69 as well be pati
47c0: 65 6e 74 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d ent.... ;; we m
47d0: 61 64 65 20 6e 65 77 20 74 61 6c 20 62 79 20 73 ade new tal by s
47e0: 74 69 63 6b 69 6e 67 20 68 65 64 20 61 74 20 74 ticking hed at t
47f0: 68 65 20 62 61 63 6b 20 6f 66 20 74 68 65 20 6c he back of the l
4800: 69 73 74 2e 20 42 55 54 20 57 48 59 3f 0a 09 09 ist. BUT WHY?...
4810: 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c . (loop hed tal
4820: 29 29 20 3b 3b 20 28 63 61 72 20 6e 65 77 74 61 )) ;; (car newta
4830: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29 l)(cdr newtal)))
4840: 0a 09 09 09 3b 3b 20 74 68 65 20 77 61 69 74 6f ....;; the waito
4850: 6e 20 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20 n is FAIL so no
4860: 70 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 20 point in trying
4870: 74 6f 20 72 75 6e 20 68 65 64 20 65 76 65 72 20 to run hed ever
4880: 61 67 61 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f again....(if (no
4890: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 t (null? tal))..
48a0: 09 09 20 20 20 20 28 69 66 20 28 76 65 63 74 6f .. (if (vecto
48b0: 72 3f 20 68 65 64 29 0a 09 09 09 09 28 62 65 67 r? hed).....(beg
48c0: 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 in (debug:print
48d0: 31 20 22 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e 1 "WARN: Droppin
48e0: 67 20 74 65 73 74 20 22 20 28 64 62 3a 74 65 73 g test " (db:tes
48f0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 68 t-get-testname h
4900: 65 64 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 ed) "/" (db:test
4910: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 68 -get-item-path h
4920: 65 64 29 0a 09 09 09 09 09 09 20 20 20 20 22 20 ed)....... "
4930: 66 72 6f 6d 20 74 68 65 20 6c 61 75 6e 63 68 20 from the launch
4940: 6c 69 73 74 20 61 73 20 69 74 20 68 61 73 20 70 list as it has p
4950: 72 65 72 65 71 75 69 73 74 65 73 20 74 68 61 74 rerequistes that
4960: 20 61 72 65 20 46 41 49 4c 22 29 0a 09 09 09 09 are FAIL").....
4970: 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 (loop (ca
4980: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 r tal)(cdr tal))
4990: 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 ).....(begin....
49a0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
49b0: 31 20 22 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 1 "WARN: Test no
49c0: 74 20 70 72 6f 63 65 73 73 65 64 20 63 6f 72 72 t processed corr
49d0: 65 63 74 6c 79 2e 20 43 6f 75 6c 64 20 62 65 20 ectly. Could be
49e0: 61 20 72 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e a race condition
49f0: 20 69 6e 20 79 6f 75 72 20 74 65 73 74 20 69 6d in your test im
4a00: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 3f 20 22 20 plementation? "
4a10: 68 65 64 29 20 3b 3b 20 20 22 20 61 73 20 69 74 hed) ;; " as it
4a20: 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74 65 has prerequiste
4a30: 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c 2e s that are FAIL.
4a40: 20 28 4e 4f 54 45 3a 20 68 65 64 20 69 73 20 6e (NOTE: hed is n
4a50: 6f 74 20 61 20 76 65 63 74 6f 72 29 22 29 0a 09 ot a vector)")..
4a60: 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 ... (loop hed t
4a70: 61 6c 29 29 29 29 29 29 29 29 29 0a 09 20 20 20 al)))))))))..
4a80: 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61 73 65 .. ;; case
4a90: 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d 73 20 where an items
4aa0: 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c 69 73 came in as a lis
4ab0: 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 65 64 t been processed
4ac0: 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 .. ((and (li
4ad0: 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20 3b st? items) ;
4ae0: 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20 6f ; thus we know o
4af0: 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c 72 ur items are alr
4b00: 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64 0a eady calculated.
4b10: 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74 65 6d .. (not item
4b20: 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 dat)) ;; and not
4b30: 20 79 65 74 20 65 78 70 61 6e 64 65 64 20 69 6e yet expanded in
4b40: 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20 74 to the list of t
4b50: 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f 6e 65 hings to be done
4b60: 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 .. (if (and
4b70: 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a (>= *verbosity*
4b80: 20 31 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 1)... (>
4b90: 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 20 30 (length items) 0
4ba0: 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c )... (> (l
4bb0: 65 6e 67 74 68 20 28 63 61 72 20 69 74 65 6d 73 ength (car items
4bc0: 29 29 20 30 29 29 0a 09 09 20 20 28 70 70 20 69 )) 0))... (pp i
4bd0: 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 3b 3b tems)).. ;;
4be0: 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 (if (>= *verbos
4bf0: 69 74 79 2a 20 35 29 0a 09 20 20 20 20 20 20 3b ity* 5).. ;
4c00: 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 ; (begin..
4c10: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 ;; (pr
4c20: 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 20 20 int "items: ")
4c30: 20 20 20 28 70 70 20 28 69 74 65 6d 2d 61 73 73 (pp (item-ass
4c40: 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 oc->item-list it
4c50: 65 6d 73 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 ems)).. ;;
4c60: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 69 74 (print "it
4c70: 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70 70 20 emstable: ")(pp
4c80: 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 (item-table->ite
4c90: 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c m-list itemstabl
4ca0: 65 29 29 29 29 0a 09 20 20 20 20 20 20 28 66 6f e)))).. (fo
4cb0: 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20 20 28 r-each.. (
4cc0: 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 6d 64 lambda (my-itemd
4cd0: 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28 28 6e at)... (let* ((n
4ce0: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 28 ew-test-record (
4cf0: 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28 6d 61 let ((newrec (ma
4d00: 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71 75 65 ke-tests:testque
4d10: 75 65 29 29 29 0a 09 09 09 09 09 20 20 20 28 76 ue)))...... (v
4d20: 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74 ector-copy! test
4d30: 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 0a -record newrec).
4d40: 09 09 09 09 09 20 20 20 6e 65 77 72 65 63 29 29 ..... newrec))
4d50: 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70 61 74 ....(my-item-pat
4d60: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 h (item-list->pa
4d70: 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 29 29 th my-itemdat)))
4d80: 0a 09 09 20 20 20 28 69 66 20 28 70 61 74 74 2d ... (if (patt-
4d90: 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74 list-match my-it
4da0: 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74 em-path item-pat
4db0: 74 73 29 20 20 20 20 20 20 20 20 20 20 20 3b 3b ts) ;;
4dc0: 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74 6f yes, we want to
4dd0: 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 69 74 process this it
4de0: 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64 em, NOTE: Should
4df0: 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20 63 not need this c
4e00: 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 20 20 heck here!...
4e10: 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 65 (let ((newte
4e20: 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 68 65 64 stname (conc hed
4e30: 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70 61 74 "/" my-item-pat
4e40: 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 74 20 h))) ;; test
4e50: 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 75 65 names are unique
4e60: 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 on testname/ite
4e70: 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 73 74 m-path.... (test
4e80: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d s:testqueue-set-
4e90: 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 2d 74 items! new-t
4ea0: 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 est-record #f)..
4eb0: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 .. (tests:testqu
4ec0: 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 eue-set-itemdat!
4ed0: 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f new-test-reco
4ee0: 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 rd my-itemdat)..
4ef0: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 .. (tests:testqu
4f00: 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74 eue-set-item_pat
4f10: 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f h! new-test-reco
4f20: 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 rd my-item-path)
4f30: 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 6c 65 .... (hash-table
4f40: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 -set! test-recor
4f50: 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e ds newtestname n
4f60: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 29 0a ew-test-record).
4f70: 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 28 63 ... (set! tal (c
4f80: 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 ons newtestname
4f90: 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e tal)))))) ;; sin
4fa0: 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65 ce these are ite
4fb0: 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77 mized create new
4fc0: 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74 test names test
4fd0: 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 name/itempath..
4fe0: 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 20 20 items)..
4ff0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
5000: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28 6c ll? tal))... (l
5010: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 oop (car tal)(cd
5020: 72 20 74 61 6c 29 29 29 29 0a 0a 09 20 20 20 20 r tal))))...
5030: 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20 ;; if items is
5040: 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 a proc then need
5050: 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 to run items:ge
5060: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e t-items-from-con
5070: 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73 fig, get the lis
5080: 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 20 20 t and loop ..
5090: 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e ;; - but on
50a0: 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20 72 65 ly do that if re
50b0: 73 6f 75 72 63 65 73 20 65 78 69 73 74 20 74 6f sources exist to
50c0: 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f kick off the jo
50d0: 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28 70 72 b.. ((or (pr
50e0: 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 ocedure? items)(
50f0: 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d eq? items 'have-
5100: 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20 procedure))..
5110: 20 20 20 28 6c 65 74 20 28 28 63 61 6e 2d 72 75 (let ((can-ru
5120: 6e 2d 6d 6f 72 65 20 20 20 20 28 6f 70 65 6e 2d n-more (open-
5130: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 63 run-close runs:c
5140: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
5150: 73 20 23 66 20 74 65 73 74 2d 72 65 63 6f 72 64 s #f test-record
5160: 29 29 29 0a 09 09 28 69 66 20 63 61 6e 2d 72 75 )))...(if can-ru
5170: 6e 2d 6d 6f 72 65 0a 09 09 20 20 20 20 28 6c 65 n-more... (le
5180: 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e 6f 74 t* ((prereqs-not
5190: 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 -met (open-run-c
51a0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72 lose db:get-prer
51b0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 eqs-not-met #f r
51c0: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 un-id waitons it
51d0: 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 em-path mode: te
51e0: 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20 20 28 stmode)).... (
51f0: 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 fails
5200: 28 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 (calc-fails prer
5210: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 eqs-not-met))...
5220: 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 . (non-complet
5230: 65 64 20 20 20 28 63 61 6c 63 2d 6e 6f 74 2d 63 ed (calc-not-c
5240: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 ompleted prereqs
5250: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 20 -not-met)))...
5260: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5270: 20 38 20 22 49 4e 46 4f 3a 20 63 61 6e 2d 72 75 8 "INFO: can-ru
5280: 6e 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75 n-more: " can-ru
5290: 6e 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20 22 5c n-more..... "\
52a0: 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 n prereqs-not-me
52b0: 74 3a 20 22 20 28 70 72 65 74 74 79 2d 73 74 72 t: " (pretty-str
52c0: 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d ing prereqs-not-
52d0: 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 met)..... "\n
52e0: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20 non-completed:
52f0: 20 22 20 28 70 72 65 74 74 79 2d 73 74 72 69 6e " (pretty-strin
5300: 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 g non-completed)
5310: 20 0a 09 09 09 09 20 20 20 22 5c 6e 20 66 61 69 ..... "\n fai
5320: 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 ls: "
5330: 28 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 66 (pretty-string f
5340: 61 69 6c 73 29 0a 09 09 09 09 20 20 20 22 5c 6e ails)..... "\n
5350: 20 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 testmode:
5360: 20 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 " testmode....
5370: 09 20 20 20 22 5c 6e 20 28 65 71 3f 20 74 65 73 . "\n (eq? tes
5380: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 tmode 'toplevel)
5390: 20 22 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 " (eq? testmode
53a0: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 'toplevel).....
53b0: 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f "\n (null? no
53c0: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 20 20 20 n-completed)
53d0: 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d " (null? non-com
53e0: 70 6c 65 74 65 64 29 29 0a 09 09 20 20 20 20 20 pleted))...
53f0: 20 28 63 6f 6e 64 20 0a 09 09 20 20 20 20 20 20 (cond ...
5400: 20 28 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 ((or (null? pre
5410: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b reqs-not-met) ;;
5420: 20 61 6c 6c 20 70 72 65 72 65 71 73 20 6d 65 74 all prereqs met
5430: 2c 20 66 69 72 65 20 6f 66 66 20 74 68 65 20 74 , fire off the t
5440: 65 73 74 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 est.... ;; or
5450: 2c 20 69 66 20 69 74 20 69 73 20 61 20 27 74 6f , if it is a 'to
5460: 70 6c 65 76 65 6c 20 74 65 73 74 20 61 6e 64 20 plevel test and
5470: 61 6c 6c 20 70 72 65 72 65 71 73 20 6e 6f 74 20 all prereqs not
5480: 6d 65 74 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 met are COMPLETE
5490: 44 20 74 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 D then launch...
54a0: 09 20 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 . (and (eq? t
54b0: 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 estmode 'topleve
54c0: 6c 29 0a 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e l)..... (null? n
54d0: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a on-completed))).
54e0: 09 09 09 28 6c 65 74 20 28 28 74 65 73 74 2d 6e ...(let ((test-n
54f0: 61 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 ame (tests:testq
5500: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d ueue-get-testnam
5510: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 e test-record)))
5520: 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d .... (setenv "M
5530: 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 T_TEST_NAME" tes
5540: 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 t-name) ;; ....
5550: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e (setenv "MT_RUN
5560: 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 NAME" runname)
5570: 0a 09 09 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d .... (open-run-
5580: 63 6c 6f 73 65 2d 6d 65 61 73 75 72 65 20 73 65 close-measure se
5590: 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 t-megatest-env-v
55a0: 61 72 73 20 23 66 20 72 75 6e 2d 69 64 29 20 3b ars #f run-id) ;
55b0: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e ; these may be n
55c0: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 eeded by the lau
55d0: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 nching process..
55e0: 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 .. (let ((items
55f0: 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 -list (items:get
5600: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 -items-from-conf
5610: 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 ig tconfig)))...
5620: 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 . (if (list?
5630: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 items-list).....
5640: 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 (begin..... (te
5650: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 sts:testqueue-se
5660: 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 t-items! test-re
5670: 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 cord items-list)
5680: 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 ..... (loop hed
5690: 20 74 61 6c 29 29 0a 09 09 09 09 28 62 65 67 69 tal)).....(begi
56a0: 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 n..... (debug:p
56b0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 rint 0 "ERROR: T
56c0: 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 he proc from rea
56d0: 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 20 64 ding the setup d
56e0: 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c id not yield a l
56f0: 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 ist - please rep
5700: 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 09 20 ort this").....
5710: 20 28 65 78 69 74 20 31 29 29 29 29 29 29 0a 09 (exit 1))))))..
5720: 09 20 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 . ((null?
5730: 66 61 69 6c 73 29 20 3b 3b 20 41 47 41 49 4e 2c fails) ;; AGAIN,
5740: 20 57 48 59 20 44 49 44 20 49 20 54 52 59 20 54 WHY DID I TRY T
5750: 4f 20 52 4f 54 41 54 45 20 54 48 45 20 54 45 53 O ROTATE THE TES
5760: 54 53 20 48 45 52 45 3f 0a 09 09 09 28 6c 6f 6f TS HERE?....(loo
5770: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 p (car newtal)(c
5780: 64 72 20 6e 65 77 74 61 6c 29 29 29 20 3b 3b 20 dr newtal))) ;;
5790: 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 72 an issue with pr
57a0: 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d 65 ereqs not yet me
57b0: 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 6e t?... ((an
57c0: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 d (not (null? fa
57d0: 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d 6f ils))(eq? testmo
57e0: 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 de 'normal))....
57f0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
5800: 49 4e 46 4f 3a 20 74 65 73 74 20 22 20 20 68 65 INFO: test " he
5810: 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 d " (mode=" test
5820: 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c mode ") has fail
5830: 65 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 ed prerequisite(
5840: 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 s); "..... (
5850: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
5860: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 se (map (lambda
5870: 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 (t)(conc (db:tes
5880: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
5890: 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 ) ":" (db:test-g
58a0: 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 et-state t)"/"(d
58b0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 b:test-get-statu
58c0: 73 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c s t))) fails) ",
58d0: 20 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 ")..... ",
58e0: 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d removing it from
58f0: 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 to-do list")...
5900: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f .(if (not (null?
5910: 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 6c tal)).... (l
5920: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 oop (car tal)(cd
5930: 72 20 74 61 6c 29 29 29 29 0a 09 09 20 20 20 20 r tal))))...
5940: 20 20 20 28 65 6c 73 65 0a 09 09 09 28 64 65 62 (else....(deb
5950: 75 67 3a 70 72 69 6e 74 20 38 20 22 45 52 52 4f ug:print 8 "ERRO
5960: 52 3a 20 4e 6f 20 68 61 6e 64 6c 65 72 20 66 6f R: No handler fo
5970: 72 20 74 68 69 73 20 63 6f 6e 64 69 74 69 6f 6e r this condition
5980: 2e 22 29 0a 09 09 09 3b 3b 20 09 20 20 20 20 20 .")....;; .
5990: 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20 20 "\n hed:
59a0: 20 20 20 20 20 22 20 68 65 64 20 0a 09 09 09 3b " hed ....;
59b0: 3b 20 09 20 20 20 20 20 22 5c 6e 20 66 61 69 6c ; . "\n fail
59c0: 73 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 28 s: " (
59d0: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
59e0: 73 65 20 28 6d 61 70 20 64 62 3a 74 65 73 74 2d se (map db:test-
59f0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 66 61 69 get-testname fai
5a00: 6c 73 29 20 22 2c 22 29 0a 09 09 09 3b 3b 20 09 ls) ",")....;; .
5a10: 20 20 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 "\n testmod
5a20: 65 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74 e: " test
5a30: 6d 6f 64 65 0a 09 09 09 3b 3b 20 09 20 20 20 20 mode....;; .
5a40: 20 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 "\n prereqs-not
5a50: 2d 6d 65 74 3a 20 22 20 28 70 72 65 74 74 79 2d -met: " (pretty-
5a60: 73 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e string prereqs-n
5a70: 6f 74 2d 6d 65 74 29 0a 09 09 09 3b 3b 20 09 20 ot-met)....;; .
5a80: 20 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 "\n items:
5a90: 20 20 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 " items
5aa0: 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 )....(loop (car
5ab0: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 newtal)(cdr newt
5ac0: 61 6c 29 29 29 29 29 0a 09 09 20 20 20 20 3b 3b al)))))... ;;
5ad0: 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f if can't run mo
5ae0: 72 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 re just loop wit
5af0: 68 20 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20 h next possible
5b00: 74 65 73 74 0a 09 09 20 20 20 20 28 6c 6f 6f 70 test... (loop
5b10: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 (car newtal)(cd
5b20: 72 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 09 20 r newtal)))))..
5b30: 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 68 .. ;; th
5b40: 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e is case should n
5b50: 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 ot happen, added
5b60: 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 to help catch a
5b70: 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 28 ny bugs.. ((
5b80: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 and (list? items
5b90: 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20 ) itemdat)..
5ba0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
5bb0: 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 "ERROR: Should
5bc0: 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20 not have a list
5bd0: 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65 of items in a te
5be0: 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73 st and the items
5bf0: 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73 path set - pleas
5c00: 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a e report this").
5c10: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 . (exit 1))
5c20: 29 29 0a 09 20 20 0a 09 20 20 3b 3b 20 77 65 20 )).. .. ;; we
5c30: 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f get here on "dro
5c40: 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f p through" - loo
5c50: 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 p for next test
5c60: 69 6e 20 71 75 65 75 65 0a 09 20 20 28 69 66 20 in queue.. (if
5c70: 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 20 (null? tal)..
5c80: 20 20 20 28 62 65 67 69 6e 0a 09 09 3b 3b 20 46 (begin...;; F
5c90: 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 IXME!!!! THIS SH
5ca0: 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 OULD NOT REQUIRE
5cb0: 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a AN EXIT!!!!!!!.
5cc0: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 ..(debug:print 1
5cd0: 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 73 74 "INFO: All test
5ce0: 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 09 09 28 s launched")...(
5cf0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e thread-sleep! 0.
5d00: 35 29 0a 09 09 3b 3b 20 46 49 58 4d 45 21 20 54 5)...;; FIXME! T
5d10: 68 69 73 20 68 61 72 73 68 20 65 78 69 74 20 73 his harsh exit s
5d20: 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 hould not be nec
5d30: 65 73 73 61 72 79 2e 2e 2e 2e 0a 09 09 28 69 66 essary.......(if
5d40: 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 (not *runremote
5d50: 2a 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 09 09 *)(exit)) ;; ...
5d60: 23 66 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 #f) ;; return a
5d70: 23 66 20 61 73 20 61 20 68 69 6e 74 20 74 68 61 #f as a hint tha
5d80: 74 20 77 65 20 61 72 65 20 64 6f 6e 65 0a 09 20 t we are done..
5d90: 20 20 20 20 20 3b 3b 20 48 65 72 65 20 77 65 20 ;; Here we
5da0: 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 need to check th
5db0: 61 74 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 at all the tests
5dc0: 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 remaining to be
5dd0: 20 72 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c run are eligibl
5de0: 65 20 74 6f 20 72 75 6e 0a 09 20 20 20 20 20 20 e to run..
5df0: 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 ;; and are not b
5e00: 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 locked by failed
5e10: 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e .. (let ((n
5e20: 65 77 6c 73 74 20 28 6f 70 65 6e 2d 72 75 6e 2d ewlst (open-run-
5e30: 63 6c 6f 73 65 20 74 65 73 74 73 3a 66 69 6c 74 close tests:filt
5e40: 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 er-non-runnable
5e50: 23 66 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 #f run-id tal te
5e60: 73 74 2d 72 65 63 6f 72 64 73 29 29 29 20 3b 3b st-records))) ;;
5e70: 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 i.e. not FAIL,
5e80: 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 WAIVED, INCOMPLE
5e90: 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 TE, PASS, KILLED
5ea0: 2c 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 ,...(thread-slee
5eb0: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 p! *global-delta
5ec0: 2a 29 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e *)...(if (not (n
5ed0: 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 ull? newlst))...
5ee0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e (loop (car n
5ef0: 65 77 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 ewlst)(cdr newls
5f00: 74 29 29 29 29 29 29 29 29 29 0a 0a 3b 3b 20 70 t)))))))))..;; p
5f10: 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20 74 68 arent-test is th
5f20: 65 72 65 20 61 73 20 61 20 70 6c 61 63 65 68 6f ere as a placeho
5f30: 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20 70 61 lder for when pa
5f40: 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e 20 62 rent-tests can b
5f50: 65 20 72 75 6e 20 61 73 20 61 20 73 65 74 75 70 e run as a setup
5f60: 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20 28 72 step.(define (r
5f70: 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 72 un:test run-id r
5f80: 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 unname keyvallst
5f90: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 test-record fla
5fa0: 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a gs parent-test).
5fb0: 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 ;; All these v
5fc0: 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 ars might be ref
5fd0: 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 erenced by the t
5fe0: 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 estconfig file r
5ff0: 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 eader. (let* ((
6000: 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 test-name (te
6010: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
6020: 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 t-testname tes
6030: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 t-record)).. (te
6040: 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74 st-waitons (test
6050: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
6060: 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d waitons test-
6070: 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 record)).. (test
6080: 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a -conf (tests:
6090: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
60a0: 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 stconfig test-re
60b0: 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61 cord)).. (itemda
60c0: 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 t (tests:te
60d0: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d stqueue-get-item
60e0: 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f dat test-reco
60f0: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74 rd)).. (test-pat
6100: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 h (conc *topp
6110: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 ath* "/tests/" t
6120: 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f est-name)) ;; co
6130: 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 65 uld use tests:ge
6140: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72 t-testconfig her
6150: 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 e ..... (force
6160: 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c (hash-tabl
6170: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c e-ref/default fl
6180: 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 ags "-force" #f)
6190: 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 ).. (rerun
61a0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
61b0: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 f/default flags
61c0: 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 "-rerun" #f))..
61d0: 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 (keepgoing (h
61e0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
61f0: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 fault flags "-ke
6200: 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 epgoing" #f))..
6210: 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22 (item-path "
6220: 22 29 0a 09 20 28 64 62 20 20 20 20 20 20 20 20 ").. (db
6230: 20 20 20 23 66 29 29 0a 20 20 20 20 28 64 65 62 #f)). (deb
6240: 75 67 3a 70 72 69 6e 74 20 35 0a 09 09 20 22 74 ug:print 5... "t
6250: 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 est-config: " (h
6260: 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 ash-table->alist
6270: 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 test-conf)... "
6280: 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 22 20 \n itemdat: "
6290: 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 itemdat... ).
62a0: 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 65 6d ;; setting item
62b0: 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 69 66 dat to a list if
62c0: 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 28 69 it is #f. (i
62d0: 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 f (not itemdat)(
62e0: 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 28 29 set! itemdat '()
62f0: 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 74 65 )). (set! ite
6300: 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 m-path (item-lis
6310: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 t->path itemdat)
6320: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 ). (debug:pri
6330: 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69 6e 67 nt 2 "Attempting
6340: 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 to launch test
6350: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 " test-name "/"
6360: 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 20 20 28 item-path). (
6370: 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f setenv "MT_TEST_
6380: 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 NAME" test-name)
6390: 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76 ;; . (setenv
63a0: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 "MT_RUNNAME"
63b0: 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 6f 70 runname). (op
63c0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 2d 6d 65 61 en-run-close-mea
63d0: 73 75 72 65 20 73 65 74 2d 6d 65 67 61 74 65 73 sure set-megates
63e0: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 t-env-vars db ru
63f0: 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d n-id) ;; these m
6400: 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 ay be needed by
6410: 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 the launching pr
6420: 6f 63 65 73 73 0a 20 20 20 20 28 63 68 61 6e 67 ocess. (chang
6430: 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 e-directory *top
6440: 70 61 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 path*).. ;; H
6450: 65 72 65 20 69 73 20 77 68 65 72 65 20 74 68 65 ere is where the
6460: 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 test_meta table
6470: 20 69 73 20 62 65 73 74 20 75 70 64 61 74 65 64 is best updated
6480: 0a 20 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f . ;; Yes, ano
6490: 74 68 65 72 20 75 73 65 20 6f 66 20 61 20 67 6c ther use of a gl
64a0: 6f 62 61 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 obal for caching
64b0: 2e 20 4e 65 65 64 20 61 20 62 65 74 74 65 72 20 . Need a better
64c0: 77 61 79 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f way?. (if (no
64d0: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 t (hash-table-re
64e0: 66 2f 64 65 66 61 75 6c 74 20 2a 74 65 73 74 2d f/default *test-
64f0: 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 meta-updated* te
6500: 73 74 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 st-name #f)).
6510: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 (begin..
6520: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 (hash-table-set!
6530: 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 *test-meta-upda
6540: 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 ted* test-name #
6550: 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6f t). (o
6560: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 pen-run-close ru
6570: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
6580: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eta db test-name
6590: 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 test-conf))).
65a0: 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 . ;; (lambd
65b0: 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 a (itemdat) ;;;
65c0: 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 ((ripeness "over
65d0: 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 ripe") (temperat
65e0: 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 ure "cool") (sea
65f0: 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 son "summer")).
6600: 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 (let* ((new-t
6610: 65 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 est-path (string
6620: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f -intersperse (co
6630: 6e 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 ns test-path (ma
6640: 70 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 p cadr itemdat))
6650: 20 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 2d "/")).. (new-
6660: 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 test-name (if (e
6670: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
6680: 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 "") test-name (c
6690: 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f onc test-name "/
66a0: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b " item-path))) ;
66b0: 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 ; just need it t
66c0: 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20 20 o be unique..
66d0: 28 74 65 73 74 2d 69 64 20 20 20 20 20 20 20 28 (test-id (
66e0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
66f0: 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 b:get-test-id db
6700: 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 run-id test-na
6710: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 me item-path))..
6720: 20 20 20 28 74 65 73 74 64 61 74 20 20 20 20 20 (testdat
6730: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
6740: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e e db:get-test-in
6750: 66 6f 2d 62 79 2d 69 64 20 64 62 20 74 65 73 74 fo-by-id db test
6760: 2d 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 66 -id))). (if
6770: 20 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 (not testdat)..
6780: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b (begin.. ;;
6790: 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 ensure that the
67a0: 20 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66 path exists bef
67b0: 6f 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 ore registering
67c0: 74 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b the test.. ;;
67d0: 20 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 NOPE: Cannot! D
67e0: 6f 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 on't know yet wh
67f0: 69 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 ich disk area wi
6800: 6c 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e ll be assigned..
6810: 2e 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 .... ;; (syst
6820: 65 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 em (conc "mkdir
6830: 2d 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 -p " new-test-pa
6840: 74 68 29 29 0a 09 20 20 20 20 28 6f 70 65 6e 2d th)).. (open-
6850: 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 3a run-close tests:
6860: 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62 register-test db
6870: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
6880: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 e item-path)..
6890: 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 (set! test-id
68a0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
68b0: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 db:get-test-id d
68c0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
68d0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 me item-path))..
68e0: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 64 61 (set! testda
68f0: 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 t (open-run-clos
6900: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e e db:get-test-in
6910: 66 6f 2d 62 79 2d 69 64 20 64 62 20 74 65 73 74 fo-by-id db test
6920: 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20 28 73 -id)))). (s
6930: 65 74 21 20 74 65 73 74 2d 69 64 20 28 64 62 3a et! test-id (db:
6940: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
6950: 64 61 74 29 29 0a 20 20 20 20 20 20 28 63 68 61 dat)). (cha
6960: 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 nge-directory te
6970: 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 20 28 st-path). (
6980: 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b case (if force ;
6990: 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 ; (args:get-arg
69a0: 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 "-force")...'NOT
69b0: 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 _STARTED...(if t
69c0: 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 estdat... (st
69d0: 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 ring->symbol (te
69e0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
69f0: 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 tdat))... 'fa
6a00: 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 iled-to-insert))
6a10: 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e ..((failed-to-in
6a20: 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 sert).. (debug:p
6a30: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 rint 0 "ERROR: F
6a40: 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 ailed to insert
6a50: 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 the record into
6a60: 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 the db"))..((NOT
6a70: 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 _STARTED COMPLET
6a80: 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e ED).. (let ((run
6a90: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 flag #f)).. (c
6aa0: 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 ond.. ;; -for
6ab0: 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 ce, run no matte
6ac0: 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 r what.. (for
6ad0: 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 ce (set! runflag
6ae0: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f #t)).. ;; NO
6af0: 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e T_STARTED, run n
6b00: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 o matter what..
6b10: 20 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 ((equal? (tes
6b20: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
6b30: 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 dat) "NOT_STARTE
6b40: 44 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 D")(set! runflag
6b50: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f #t)).. ;; no
6b60: 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 t -rerun and PAS
6b70: 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b S, WARN or CHECK
6b80: 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 , do no run..
6b90: 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 ((and (or (not
6ba0: 72 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b rerun)... k
6bb0: 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b eepgoing)... ;;
6bc0: 20 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 Require to forc
6bd0: 65 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d e re-run for COM
6be0: 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 PLETED or *anyth
6bf0: 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e ing* + PASS,WARN
6c00: 20 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f or CHECK... (o
6c10: 72 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a r (member (test:
6c20: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
6c30: 61 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41 at) '("PASS" "WA
6c40: 52 4e 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 RN" "CHECK"))...
6c50: 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 (member (t
6c60: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 est:get-state t
6c70: 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c estdat) '("COMPL
6c80: 45 54 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 ETED")))) ..
6c90: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
6ca0: 22 49 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 "INFO: running t
6cb0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
6cc0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 "/" item-path "
6cd0: 73 75 70 70 72 65 73 73 65 64 20 61 73 20 69 74 suppressed as it
6ce0: 20 69 73 20 22 20 28 74 65 73 74 3a 67 65 74 2d is " (test:get-
6cf0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 state testdat) "
6d00: 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65 74 and " (test:get
6d10: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
6d20: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 ).. (set! ru
6d30: 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 nflag #f))..
6d40: 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 ;; -rerun and st
6d50: 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 atus is one of t
6d60: 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e he specifed, run
6d70: 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72 it.. ((and r
6d80: 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 erun... (let* (
6d90: 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72 (rerunlst (str
6da0: 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 ing-split rerun
6db0: 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d ",")).... (must-
6dc0: 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 rerun (member (t
6dd0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
6de0: 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 estdat) rerunlst
6df0: 29 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 )))... (debug
6e00: 3a 70 72 69 6e 74 20 33 20 22 49 4e 46 4f 3a 20 :print 3 "INFO:
6e10: 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 -rerun list: " r
6e20: 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 erun ", test-sta
6e30: 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 tus: " (test:get
6e40: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
6e50: 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 ", must-rerun: "
6e60: 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 must-rerun)...
6e70: 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a must-rerun)).
6e80: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
6e90: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 52 65 72 75 nt 2 "INFO: Reru
6ea0: 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73 n forced for tes
6eb0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f t " test-name "/
6ec0: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 " item-path)..
6ed0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
6ee0: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b #t)).. ;; -k
6ef0: 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 eepgoing, do not
6f00: 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 rerun FAIL..
6f10: 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 ((and keepgoing
6f20: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 ... (member (te
6f30: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
6f40: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 stdat) '("FAIL")
6f50: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 )).. (set! r
6f60: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 unflag #f))..
6f70: 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 ((and (not reru
6f80: 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 n)... (member (
6f90: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
6fa0: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c testdat) '("FAIL
6fb0: 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 " "n/a")))..
6fc0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
6fd0: 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 t)).. (else (
6fe0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
6ff0: 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 )).. (debug:pr
7000: 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d int 6 "RUNNING =
7010: 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e > runflag: " run
7020: 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 flag " STATE: "
7030: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
7040: 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55 testdat) " STATU
7050: 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 S: " (test:get-s
7060: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a tatus testdat)).
7070: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e . (if (not run
7080: 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 flag).. (i
7090: 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 f (not parent-te
70a0: 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a st)... (debug:
70b0: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e print 1 "NOTE: N
70c0: 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 ot starting test
70d0: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 " new-test-name
70e0: 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74 " as it is stat
70f0: 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d e \"" (test:get-
7100: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 0a state testdat) .
7110: 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 ...."\" and stat
7120: 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 us \"" (test:get
7130: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
7140: 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e "\", use -rerun
7150: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 \"" (test:get-s
7160: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 0a 20 tatus testdat).
7170: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7180: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
7190: 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 \" or -force to
71a0: 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 override"))..
71b0: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 ;; NOTE: No
71c0: 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 longer be checki
71d0: 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 65 73 ng prerequisites
71e0: 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 here! Will neve
71f0: 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 r get here unles
7200: 73 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 s prereqs are..
7210: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 ;; a
7220: 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 lready met...
7230: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 (if (not (la
7240: 75 6e 63 68 2d 74 65 73 74 20 23 66 20 72 75 6e unch-test #f run
7250: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
7260: 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 -conf keyvallst
7270: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 test-name test-p
7280: 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 ath itemdat flag
7290: 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a s))... (begin.
72a0: 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 .. (print "E
72b0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
72c0: 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e launch the test.
72d0: 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e Exiting as soon
72e0: 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 as possible")..
72f0: 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f . (set! *glo
7300: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 balexitstatus* 1
7310: 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 ) ;; ... (pr
7320: 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 ocess-signal (cu
7330: 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 rrent-process-id
7340: 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 ) signal/kill)))
7350: 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a )))..((KILLED) .
7360: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
7370: 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 "NOTE: " new-te
7380: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 st-name " is alr
7390: 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 eady running or
73a0: 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 was explictly ki
73b0: 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 lled, use -force
73c0: 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 to launch it.")
73d0: 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 )..((LAUNCHED RE
73e0: 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 MOTEHOSTSTART RU
73f0: 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 NNING) .. (if (
7400: 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 > (- (current-se
7410: 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 conds)(+ (db:tes
7420: 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 t-get-event_time
7430: 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 testdat).....
7440: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 (db:test-ge
7450: 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 t-run_duration t
7460: 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 estdat)))...600)
7470: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 ;; i.e. no upda
7480: 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e te for more than
7490: 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 600 seconds..
74a0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 (begin..
74b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
74c0: 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 "WARNING: Test
74d0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 " test-name " ap
74e0: 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 pears to be dead
74f0: 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 . Forcing it to
7500: 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 state INCOMPLETE
7510: 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 and status STUC
7520: 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 K/DEAD")..
7530: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
7540: 20 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 test-set-status
7550: 21 20 64 62 20 74 65 73 74 2d 69 64 20 22 49 4e ! db test-id "IN
7560: 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b COMPLETE" "STUCK
7570: 2f 44 45 41 44 22 20 22 54 65 73 74 20 69 73 20 /DEAD" "Test is
7580: 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 stuck or dead" #
7590: 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 f)).. (debug
75a0: 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 :print 2 "NOTE:
75b0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 " test-name " is
75c0: 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 already running
75d0: 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 ")))..(else
75e0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
75f0: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 "ERROR: Failed
7600: 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 to launch test "
7610: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 new-test-name "
7620: 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 . Unrecognised s
7630: 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 tate " (test:get
7640: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 -state testdat))
7650: 29 29 29 29 29 0a 0a 3b 3b 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 3d 3d 3d 3d 3d 3d ================
7690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
76a0: 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 ;; END OF NEW ST
76b0: 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d UFF.;;==========
76c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
76d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
76e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
76f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 ============..(d
7700: 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 efine (get-dir-u
7710: 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 p-n dir . params
7720: 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 ) . (let ((dpar
7730: 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ts (string-spli
7740: 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f t dir "/"))..(co
7750: 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f unt (if (null?
7760: 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 params) 1 (car
7770: 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 params)))). (
7780: 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 conc "/" (string
7790: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 -intersperse ..
77a0: 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 (take dpar
77b0: 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 ts (- (length dp
77c0: 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 arts) count))..
77d0: 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b "/")))).;;
77e0: 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 Remove runs.;;
77f0: 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 fields are passi
7800: 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 3b ng in through .;
7810: 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 ; action:.;;
7820: 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 'remove-runs.;;
7830: 20 20 20 27 73 65 74 2d 73 74 61 74 65 2d 73 74 'set-state-st
7840: 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 atus.;;.;; NB//
7850: 73 68 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 6b should pass in k
7860: 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 eys?.;;.(define
7870: 28 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f 6e (runs:operate-on
7880: 20 64 62 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 db action runna
7890: 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74 20 mepatt testpatt
78a0: 69 74 65 6d 70 61 74 74 20 23 21 6b 65 79 20 28 itempatt #!key (
78b0: 73 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73 state #f)(status
78c0: 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 #f)(new-state-s
78d0: 74 61 74 75 73 20 23 66 29 29 0a 20 20 28 6c 65 tatus #f)). (le
78e0: 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 t* ((keys
78f0: 20 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 (rdb:get-keys
7900: 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 db)).. (rundat
7910: 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 (runs:get-r
7920: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
7930: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 eys runnamepatt)
7940: 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 ).. (header
7950: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 (vector-ref ru
7960: 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 ndat 0)).. (runs
7970: 20 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 (vector
7980: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a -ref rundat 1)).
7990: 09 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20 . (states
79a0: 28 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69 (if state (stri
79b0: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 ng-split state
79c0: 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 ",") '())).. (st
79d0: 61 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73 atuses (if s
79e0: 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 tatus (string-sp
79f0: 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 lit status ",")
7a00: 27 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 '())).. (state-s
7a10: 74 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e tatus (if (strin
7a20: 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 g? new-state-sta
7a30: 74 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c tus) (string-spl
7a40: 69 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 it new-state-sta
7a50: 74 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 tus ",") '(#f #f
7a60: 29 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a )))). (debug:
7a70: 70 72 69 6e 74 20 32 20 22 48 65 61 64 65 72 3a print 2 "Header:
7a80: 20 22 20 68 65 61 64 65 72 20 22 20 61 63 74 69 " header " acti
7a90: 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e on: " action " n
7aa0: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a ew-state-status:
7ab0: 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 " new-state-sta
7ac0: 74 75 73 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 tus). (for-ea
7ad0: 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ch. (lambda
7ae0: 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 (run). (le
7af0: 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 t ((runkey (stri
7b00: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
7b10: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a map (lambda (k).
7b20: 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 ......(db:get-va
7b30: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
7b40: 6e 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 n header (vector
7b50: 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 -ref k 0))) keys
7b60: 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 ) "/")).. (d
7b70: 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d irs-to-remove (m
7b80: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
7b90: 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d ).. (let* ((run-
7ba0: 69 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 id (db:get-va
7bb0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
7bc0: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a n header "id")).
7bd0: 09 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 ..(run-state (db
7be0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
7bf0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
7c00: 22 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 "state"))...(tes
7c10: 74 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 ts (if (not
7c20: 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 (equal? run-stat
7c30: 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 e "locked"))....
7c40: 20 20 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d (rdb:get-
7c50: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
7c60: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
7c70: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
7c80: 64 65 72 20 22 69 64 22 29 0a 09 09 09 09 09 09 der "id").......
7c90: 20 20 20 20 20 20 74 65 73 74 70 61 74 74 20 69 testpatt i
7ca0: 74 65 6d 70 61 74 74 20 73 74 61 74 65 73 20 73 tempatt states s
7cb0: 74 61 74 75 73 65 73 0a 09 09 09 09 09 09 20 20 tatuses.......
7cc0: 20 20 20 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a not-in: #f.
7cd0: 09 09 09 09 09 09 20 20 20 20 20 20 73 6f 72 74 ...... sort
7ce0: 2d 62 79 3a 20 28 63 61 73 65 20 61 63 74 69 6f -by: (case actio
7cf0: 6e 0a 09 09 09 09 09 09 09 09 20 28 28 72 65 6d n......... ((rem
7d00: 6f 76 65 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 ove-runs) 'rundi
7d10: 72 29 0a 09 09 09 09 09 09 09 09 20 28 65 6c 73 r)......... (els
7d20: 65 20 20 20 20 20 20 20 20 20 20 27 65 76 65 6e e 'even
7d30: 74 5f 74 69 6d 65 29 29 29 0a 09 09 09 20 20 20 t_time)))....
7d40: 20 20 20 20 27 28 29 29 29 0a 09 09 28 6c 61 73 '()))...(las
7d50: 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f ttpath "/does/no
7d60: 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 t/exist/I/hope")
7d70: 29 0a 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 )... (if (not
7d80: 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 (null? tests))..
7d90: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 (begin...
7da0: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 (case action...
7db0: 20 20 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 ((remove-runs
7dc0: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
7dd0: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 rint 1 "Removing
7de0: 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 tests for run:
7df0: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
7e00: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
7e10: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
7e20: 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 "runname")))...
7e30: 20 20 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 ((set-state-st
7e40: 61 74 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 atus)... (deb
7e50: 75 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 ug:print 1 "Modi
7e60: 66 79 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 fying state and
7e70: 73 74 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 staus for tests
7e80: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 for run: " runke
7e90: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 y " " (db:get-va
7ea0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
7eb0: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d n header "runnam
7ec0: 65 22 29 29 29 0a 09 09 20 20 20 28 65 6c 73 65 e")))... (else
7ed0: 0a 09 09 20 20 20 20 28 70 72 69 6e 74 20 22 49 ... (print "I
7ee0: 4e 46 4f 3a 20 61 63 74 69 6f 6e 20 6e 6f 74 20 NFO: action not
7ef0: 72 65 63 6f 67 6e 69 73 65 64 20 22 20 61 63 74 recognised " act
7f00: 69 6f 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 ion)))... (for-e
7f10: 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 ach... (lambda
7f20: 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 (test)... (le
7f30: 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 t* ((item-path (
7f40: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
7f50: 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 -path test))....
7f60: 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 (test-name (d
7f70: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
7f80: 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 ame test))....
7f90: 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a (run-dir (db:
7fa0: 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 test-get-rundir
7fb0: 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 test)))...
7fc0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
7fd0: 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 " (db:test-get
7fe0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 -testname test)
7ff0: 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 " id: " (db:test
8000: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 -get-id test) "
8010: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63 " item-path " ac
8020: 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a tion: " action).
8030: 09 09 20 20 20 20 20 20 28 63 61 73 65 20 61 63 .. (case ac
8040: 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 tion....((remove
8050: 2d 72 75 6e 73 29 0a 09 09 09 20 28 72 64 62 3a -runs).... (rdb:
8060: 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f delete-test-reco
8070: 72 64 73 20 64 62 20 28 64 62 3a 74 65 73 74 2d rds db (db:test-
8080: 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 get-id test))...
8090: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
80a0: 20 22 49 4e 46 4f 3a 20 41 74 74 65 6d 70 74 69 "INFO: Attempti
80b0: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72 ng to remove dir
80c0: 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 " run-dir)....
80d0: 28 69 66 20 28 61 6e 64 20 28 3e 20 28 73 74 72 (if (and (> (str
80e0: 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 ing-length run-d
80f0: 69 72 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 ir) 5)..... (fi
8100: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 le-exists? run-d
8110: 69 72 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 ir)) ;; bad heur
8120: 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 istic but should
8130: 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 prevent /tmp /h
8140: 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 ome etc.....
8150: 20 28 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74 (let* ((realpat
8160: 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e h (resolve-pathn
8170: 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 ame run-dir)))..
8180: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
8190: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 52 print 1 "INFO: R
81a0: 65 61 6c 20 70 61 74 68 20 6f 66 20 69 73 20 22 eal path of is "
81b0: 20 72 65 61 6c 70 61 74 68 29 0a 09 09 09 20 20 realpath)....
81c0: 20 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 (if (file-e
81d0: 78 69 73 74 73 3f 20 72 65 61 6c 70 61 74 68 29 xists? realpath)
81e0: 0a 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 ..... (if (> (
81f0: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d system (conc "rm
8200: 20 2d 72 66 20 22 20 72 65 61 6c 70 61 74 68 29 -rf " realpath)
8210: 29 20 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 ) 0).....
8220: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
8230: 45 52 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 ERROR: There was
8240: 20 61 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 a problem remov
8250: 69 6e 67 20 22 20 72 65 61 6c 70 61 74 68 20 22 ing " realpath "
8260: 20 77 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 with rm -f"))..
8270: 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ... (debug:pri
8280: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 nt 0 "WARNING: t
8290: 65 73 74 20 72 75 6e 20 64 69 72 20 22 20 72 65 est run dir " re
82a0: 61 6c 70 61 74 68 20 22 20 61 70 70 65 61 72 73 alpath " appears
82b0: 20 74 6f 20 6e 6f 74 20 65 78 69 73 74 22 29 29 to not exist"))
82c0: 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 .... (if (
82d0: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e file-exists? run
82e0: 2d 64 69 72 29 20 3b 3b 20 74 68 65 20 6c 69 6e -dir) ;; the lin
82f0: 6b 0a 09 09 09 09 20 20 20 28 69 66 20 28 73 79 k..... (if (sy
8300: 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e mbolic-link? run
8310: 2d 64 69 72 29 0a 09 09 09 09 20 20 20 20 20 20 -dir).....
8320: 20 28 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 (delete-file ru
8330: 6e 2d 64 69 72 29 0a 09 09 09 09 20 20 20 20 20 n-dir).....
8340: 20 20 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 (if (directory
8350: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 ? run-dir)......
8360: 20 20 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 (if (> (direc
8370: 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 tory-fold (lambd
8380: 61 20 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 a (f x)(+ 1 x))
8390: 30 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 0 run-dir) 0)...
83a0: 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 ... (debug
83b0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e :print 0 "WARNIN
83c0: 47 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 G: refusing to r
83d0: 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 emove " run-dir
83e0: 22 20 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 " as it is not e
83f0: 6d 70 74 79 22 29 0a 09 09 09 09 09 20 20 20 20 mpty")......
8400: 20 20 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 (delete-direc
8410: 74 6f 72 79 20 72 75 6e 2d 64 69 72 29 29 20 3b tory run-dir)) ;
8420: 3b 20 69 74 20 73 68 6f 75 6c 64 20 62 65 20 65 ; it should be e
8430: 6d 70 74 79 20 62 79 20 68 65 72 65 20 42 55 47 mpty by here BUG
8440: 20 42 55 47 2c 20 61 64 64 20 65 72 72 6f 72 20 BUG, add error
8450: 63 61 74 63 68 0a 09 09 09 09 09 20 20 20 28 64 catch...... (d
8460: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
8470: 52 4f 52 3a 20 72 65 66 75 73 69 6e 67 20 74 6f ROR: refusing to
8480: 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 remove " run-di
8490: 72 20 22 20 61 73 20 69 74 20 69 73 20 6e 65 69 r " as it is nei
84a0: 74 68 65 72 20 61 20 73 79 6d 6c 69 6e 6b 20 6e ther a symlink n
84b0: 6f 72 20 61 20 64 69 72 65 63 74 6f 72 79 22 29 or a directory")
84c0: 0a 09 09 09 09 09 20 20 20 29 29 29 29 0a 09 09 ...... ))))...
84d0: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
84e0: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 nt 0 "WARNING: d
84f0: 69 72 65 63 74 6f 72 79 20 61 6c 72 65 61 64 79 irectory already
8500: 20 72 65 6d 6f 76 65 64 20 22 20 72 75 6e 2d 64 removed " run-d
8510: 69 72 29 29 29 0a 09 09 09 28 28 73 65 74 2d 73 ir)))....((set-s
8520: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 09 tate-status)....
8530: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
8540: 22 49 4e 46 4f 3a 20 6e 65 77 20 73 74 61 74 65 "INFO: new state
8550: 20 22 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 " (car state-st
8560: 61 74 75 73 29 20 22 2c 20 6e 65 77 20 73 74 61 atus) ", new sta
8570: 74 75 73 20 22 20 28 63 61 64 72 20 73 74 61 74 tus " (cadr stat
8580: 65 2d 73 74 61 74 75 73 29 29 0a 09 09 09 20 28 e-status)).... (
8590: 64 62 3a 74 65 73 74 2d 73 65 74 2d 73 74 61 74 db:test-set-stat
85a0: 65 2d 73 74 61 74 75 73 2d 62 79 2d 69 64 20 64 e-status-by-id d
85b0: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 b (db:test-get-i
85c0: 64 20 74 65 73 74 29 20 28 63 61 72 20 73 74 61 d test) (car sta
85d0: 74 65 2d 73 74 61 74 75 73 29 28 63 61 64 72 20 te-status)(cadr
85e0: 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 23 66 state-status) #f
85f0: 29 29 29 29 29 0a 09 09 20 20 74 65 73 74 73 29 )))))... tests)
8600: 29 29 0a 09 20 20 20 0a 09 20 20 20 3b 3b 20 72 )).. .. ;; r
8610: 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 emove the run if
8620: 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 zero tests rema
8630: 69 6e 0a 09 20 20 20 28 69 66 20 28 65 71 3f 20 in.. (if (eq?
8640: 61 63 74 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 action 'remove-r
8650: 75 6e 73 29 0a 09 20 20 20 20 20 20 20 28 6c 65 uns).. (le
8660: 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 72 64 t ((remtests (rd
8670: 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d b:get-tests-for-
8680: 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 run db (db:get-v
8690: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
86a0: 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20 un header "id")
86b0: 23 66 20 23 66 20 27 28 29 20 27 28 29 29 29 29 #f #f '() '())))
86c0: 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 ... (if (null? r
86d0: 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d emtests) ;; no m
86e0: 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e ore tests remain
86f0: 69 6e 67 0a 09 09 20 20 20 20 20 28 6c 65 74 2a ing... (let*
8700: 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 ((dparts (stri
8710: 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 ng-split lasttpa
8720: 74 68 20 22 2f 22 29 29 0a 09 09 09 20 20 20 20 th "/"))....
8730: 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 (runpath (conc "
8740: 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 /" (string-inter
8750: 73 70 65 72 73 65 20 0a 09 09 09 09 09 09 28 74 sperse .......(t
8760: 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c ake dparts (- (l
8770: 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 29 ength dparts) 1)
8780: 29 0a 09 09 09 09 09 09 22 2f 22 29 29 29 29 0a )......."/")))).
8790: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
87a0: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e print 1 "Removin
87b0: 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 g run: " runkey
87c0: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 " " (db:get-valu
87d0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
87e0: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 header "runname"
87f0: 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 62 3a ))... (db:
8800: 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 delete-run db ru
8810: 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b n-id)... ;
8820: 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65 ; need to figure
8830: 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f out the path to
8840: 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64 the run dir and
8850: 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d remove it if em
8860: 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 pty... ;;
8870: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 (if (null? (g
8880: 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 lob (conc runpat
8890: 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 20 h "/*")))...
88a0: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 ;; (be
88b0: 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 gin... ;;
88c0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
88d0: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 "Removing run d
88e0: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 ir " runpath)...
88f0: 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79 73 ;; . (sys
8900: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 tem (conc "rmdir
8910: 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29 -p " runpath)))
8920: 29 0a 09 09 20 20 20 20 20 20 20 29 29 29 29 29 )... )))))
8930: 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29 .. )). runs)
8940: 29 29 0a 0a 3b 3b 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 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 ============.;;
8990: 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e Routines for man
89a0: 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b ipulating runs.;
89b0: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
89c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
89d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
89e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
89f0: 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 =======..;; Sinc
8a00: 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 e many calls to
8a10: 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 70 72 a run require pr
8a20: 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 73 61 etty much the sa
8a30: 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 me setup .;; thi
8a40: 73 20 77 72 61 70 70 65 72 20 69 73 20 75 73 65 s wrapper is use
8a50: 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 65 20 d to reduce the
8a60: 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 replication of c
8a70: 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65 6e ode.(define (gen
8a80: 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 eral-run-call sw
8a90: 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d itchname action-
8aa0: 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 desc proc). (le
8ab0: 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 t ((runname (arg
8ac0: 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e s:get-arg ":runn
8ad0: 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65 74 20 ame"))..(target
8ae0: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 (if (args:get-a
8af0: 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 rg "-target")...
8b00: 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 (args:get-a
8b10: 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 rg "-target")...
8b20: 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 (args:get-a
8b30: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 29 29 rg "-reqtarg")))
8b40: 0a 09 28 74 68 31 20 20 20 20 20 23 66 29 29 0a ..(th1 #f)).
8b50: 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 (cond. (
8b60: 28 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 20 20 (not target).
8b70: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8b80: 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 0 "ERROR: Missin
8b90: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d g required param
8ba0: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 eter for " switc
8bb0: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 hname ", you mus
8bc0: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 74 61 t specify the ta
8bd0: 72 67 65 74 20 77 69 74 68 20 2d 74 61 72 67 65 rget with -targe
8be0: 74 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 t"). (exit
8bf0: 33 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 3)). ((not r
8c00: 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 28 64 unname). (d
8c10: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
8c20: 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 ROR: Missing req
8c30: 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 uired parameter
8c40: 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 for " switchname
8c50: 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 ", you must spe
8c60: 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e 61 6d cify the run nam
8c70: 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 e with :runname
8c80: 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 runname").
8c90: 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 (exit 3)). (
8ca0: 65 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 74 20 else. (let
8cb0: 28 28 64 62 20 20 20 23 66 29 0a 09 20 20 20 20 ((db #f)..
8cc0: 28 6b 65 79 73 20 23 66 29 29 0a 09 28 69 66 20 (keys #f))..(if
8cd0: 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 2d (not (setup-for-
8ce0: 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67 69 run)).. (begi
8cf0: 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 n .. (debug
8d00: 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65 64 :print 0 "Failed
8d10: 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74 69 to setup, exiti
8d20: 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 ng").. (exi
8d30: 74 20 31 29 29 29 0a 09 28 73 65 74 21 20 64 62 t 1)))..(set! db
8d40: 20 20 20 28 6f 70 65 6e 2d 64 62 29 29 0a 09 28 (open-db))..(
8d50: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 if (args:get-arg
8d60: 20 22 2d 73 65 72 76 65 72 22 29 0a 09 20 20 20 "-server")..
8d70: 20 28 73 65 72 76 65 72 3a 73 74 61 72 74 20 64 (server:start d
8d80: 62 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 b (args:get-arg
8d90: 22 2d 73 65 72 76 65 72 22 29 29 0a 09 20 20 20 "-server"))..
8da0: 20 28 69 66 20 28 6e 6f 74 20 28 6f 72 20 28 61 (if (not (or (a
8db0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 rgs:get-arg "-ru
8dc0: 6e 61 6c 6c 22 29 0a 09 09 09 20 20 28 61 72 67 nall").... (arg
8dd0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 s:get-arg "-runt
8de0: 65 73 74 73 22 29 29 29 0a 09 09 28 73 65 72 76 ests")))...(serv
8df0: 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70 20 er:client-setup
8e00: 64 62 29 29 29 0a 09 28 73 65 74 21 20 6b 65 79 db)))..(set! key
8e10: 73 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 s (rdb:get-keys
8e20: 64 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e db))..;; have en
8e30: 6f 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 ough to process
8e40: 2d 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 -target or -reqt
8e50: 61 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 arg here..(if (a
8e60: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
8e70: 71 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 qtarg").. (le
8e80: 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 t* ((runconfigf
8e90: 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
8ea0: 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f "/runconfigs.co
8eb0: 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f nfig")) ;; DO NO
8ec0: 54 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a T EVALUATE ALL .
8ed0: 09 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 .. (runconfig
8ee0: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 (read-config ru
8ef0: 6e 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 nconfigf #f #f e
8f00: 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 nviron-patt: #f)
8f10: 29 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 )) .. (if (
8f20: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
8f30: 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 efault runconfig
8f40: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
8f50: 2d 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 -reqtarg") #f)..
8f60: 09 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d . (keys:target-
8f70: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 set-args keys (a
8f80: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
8f90: 71 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 qtarg") args:arg
8fa0: 2d 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 -hash)... (begi
8fb0: 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 n... (debug:p
8fc0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b rint 0 "ERROR: [
8fd0: 22 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 " (args:get-arg
8fe0: 22 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e "-reqtarg") "] n
8ff0: 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 ot found in " ru
9000: 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 nconfigf)...
9010: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
9020: 65 21 20 64 62 29 0a 09 09 20 20 20 20 28 65 78 e! db)... (ex
9030: 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 it 1)))).. (i
9040: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 f (args:get-arg
9050: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 "-target")...(ke
9060: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 ys:target-set-ar
9070: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 gs keys (args:ge
9080: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 t-arg "-target"
9090: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 args:arg-hash) a
90a0: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a rgs:arg-hash))).
90b0: 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a .(if (not (car *
90c0: 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 configinfo*))..
90d0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 (begin..
90e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
90f0: 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 "ERROR: Attempte
9100: 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 d to " action-de
9110: 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 sc " but run are
9120: 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f a config file no
9130: 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 t found")..
9140: 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 (exit 1))..
9150: 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 ;; Extract out s
9160: 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d tuff needed in m
9170: 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c ost or many call
9180: 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 s.. ;; here t
9190: 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 hen call proc..
91a0: 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 (let* ((keyna
91b0: 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 mes (map key:g
91c0: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 et-fieldname key
91d0: 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c s))... (keyval
91e0: 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c lst (keys->vall
91f0: 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 ist keys #t)))..
9200: 20 20 20 20 20 20 28 70 72 6f 63 20 64 62 20 74 (proc db t
9210: 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 arget runname ke
9220: 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 ys keynames keyv
9230: 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 allst)))..(if th
9240: 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 1 (thread-join!
9250: 74 68 31 29 29 0a 09 28 73 71 6c 69 74 65 33 3a th1))..(sqlite3:
9260: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 28 finalize! db)..(
9270: 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 set! *didsomethi
9280: 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b ng* #t))))))..;;
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
92d0: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 ======.;; Lock/u
92e0: 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d nlock runs.;;===
92f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9300: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9310: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9320: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9330: 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 ===..(define (ru
9340: 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e ns:handle-lockin
9350: 67 20 64 62 20 74 61 72 67 65 74 20 6b 65 79 73 g db target keys
9360: 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e runname lock un
9370: 6c 6f 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65 lock user). (le
9380: 74 2a 20 28 28 72 75 6e 64 61 74 20 20 20 28 72 t* ((rundat (r
9390: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d uns:get-runs-by-
93a0: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e patt db keys run
93b0: 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 64 65 72 name)).. (header
93c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 (vector-ref r
93d0: 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e undat 0)).. (run
93e0: 73 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 s (vector-re
93f0: 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 f rundat 1))).
9400: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d (for-each (lam
9410: 62 64 61 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 bda (run)...(let
9420: 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 ((run-id (db:ge
9430: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
9440: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
9450: 22 29 29 29 0a 09 09 20 20 28 69 66 20 28 6f 72 ")))... (if (or
9460: 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 lock.... (and
9470: 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 unlock....
9480: 20 28 62 65 67 69 6e 0a 09 09 09 09 20 28 70 72 (begin..... (pr
9490: 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 65 61 6c int "Do you real
94a0: 6c 79 20 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 ly wish to unloc
94b0: 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 k run " run-id "
94c0: 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 ?\n y/n: ")...
94d0: 09 09 20 28 65 71 75 61 6c 3f 20 22 79 22 20 28 .. (equal? "y" (
94e0: 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 read-line)))))..
94f0: 09 20 20 20 20 20 20 28 64 62 3a 6c 6f 63 6b 2f . (db:lock/
9500: 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 72 75 unlock-run db ru
9510: 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b n-id lock unlock
9520: 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 20 28 user)... (
9530: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 49 debug:print 0 "I
9540: 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 6c 6f NFO: Skipping lo
9550: 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 ck/unlock on " r
9560: 75 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 20 un-id))))..
9570: 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d runs))).;;=====
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 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
95b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
95c0: 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 =.;; Rollup runs
95d0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
95e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
95f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 =========..;; Up
9620: 64 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 date the test_me
9630: 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 ta table for thi
9640: 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 s test.(define (
9650: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 runs:update-test
9660: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 _meta db test-na
9670: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 me test-conf).
9680: 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 (let ((currrecor
9690: 64 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 d (db:testmeta-g
96a0: 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 et-record db tes
96b0: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 t-name))). (i
96c0: 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 f (not currrecor
96d0: 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 d)..(begin.. (s
96e0: 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 et! currrecord (
96f0: 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 make-vector 10 #
9700: 66 29 29 0a 09 20 20 28 64 62 3a 74 65 73 74 6d f)).. (db:testm
9710: 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 eta-add-record d
9720: 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 b test-name))).
9730: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 (for-each .
9740: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 (lambda (key)
9750: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 . (let* ((
9760: 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a idx (cadr key)).
9770: 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 . (fld (car
9780: 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 key)).. (
9790: 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b val (config-look
97a0: 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 up test-conf "te
97b0: 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a st_meta" fld))).
97c0: 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e . ;; (debug:prin
97d0: 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 t 5 "idx: " idx
97e0: 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 " fld: " fld " v
97f0: 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 al: " val).. (if
9800: 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 (and val (not (
9810: 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 equal? (vector-r
9820: 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 ef currrecord id
9830: 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 x) val)))..
9840: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 (begin.. (
9850: 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 print "Updating
9860: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 " test-name " "
9870: 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a fld " to " val).
9880: 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 . (db:test
9890: 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c meta-update-fiel
98a0: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 d db test-name f
98b0: 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 ld val))))).
98c0: 20 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 '(("author" 2)(
98d0: 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 "owner" 3)("desc
98e0: 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 ription" 4)("rev
98f0: 69 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22 iewed" 5)("tags"
9900: 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 9)))))..;; Upda
9910: 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 te test_meta for
9920: 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 all tests.(defi
9930: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d ne (runs:update-
9940: 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 all-test_meta db
9950: 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d ). (let ((test-
9960: 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c names (get-all-l
9970: 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 egal-tests))).
9980: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
9990: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d (lambda (test-
99a0: 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 name). (le
99b0: 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 t* ((test-path
99c0: 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 (conc *toppath
99d0: 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 * "/tests/" test
99e0: 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 -name)).. (
99f0: 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f test-configf (co
9a00: 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 nc test-path "/t
9a10: 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 estconfig"))..
9a20: 20 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20 (testexists
9a30: 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 (and (file-exi
9a40: 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 sts? test-config
9a50: 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 f)(file-read-acc
9a60: 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 ess? test-config
9a70: 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 f))).. ;; r
9a80: 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 ead configs with
9a90: 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f tricks turned o
9aa0: 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 ff (i.e. no syst
9ab0: 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 em).. (test
9ac0: 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 -conf (if tes
9ad0: 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f texists (read-co
9ae0: 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 nfig test-config
9af0: 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 f #f #f)(make-ha
9b00: 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28 sh-table)))).. (
9b10: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 runs:update-test
9b20: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 _meta db test-na
9b30: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a me test-conf))).
9b40: 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 test-names)
9b50: 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c ))..;; This coul
9b60: 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 d probably be re
9b70: 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e factored into on
9b80: 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 e complex query
9b90: 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e ....(define (run
9ba0: 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20 s:rollup-run db
9bb0: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 keys keyvallst r
9bc0: 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 unname user) ;;
9bd0: 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 was target, now
9be0: 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 keyvallst. (deb
9bf0: 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 ug:print 4 "runs
9c00: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 :rollup-run, key
9c10: 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 s: " keys " keyv
9c20: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c allst: " keyvall
9c30: 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 st " :runname "
9c40: 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 runname " user:
9c50: 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 " user). (let*
9c60: 28 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 (; (keyvalllst
9c70: 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 (keys:target
9c80: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 ->keyval keys ta
9c90: 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 rget)).. (new-ru
9ca0: 6e 2d 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a n-id (runs:
9cb0: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 register-run db
9cc0: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 keys keyvallst r
9cd0: 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f unname "new" "n/
9ce0: 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 a" user)).. (pre
9cf0: 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 74 65 v-tests (te
9d00: 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d st:get-matching-
9d10: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 previous-test-ru
9d20: 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 n-records db new
9d30: 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 -run-id "%" "%")
9d40: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 ).. (curr-tests
9d50: 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 (rdb:get-te
9d60: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e sts-for-run db n
9d70: 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 ew-run-id "%" "%
9d80: 22 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 " '() '())).. (c
9d90: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 urr-tests-hash (
9da0: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
9db0: 29 29 0a 20 20 20 20 28 64 62 3a 75 70 64 61 74 )). (db:updat
9dc0: 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 e-run-event_time
9dd0: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a db new-run-id).
9de0: 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 ;; index the
9df0: 20 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 already saved t
9e00: 65 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 ests by testname
9e10: 20 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 and itemdat in
9e20: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a curr-tests-hash.
9e30: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 (for-each.
9e40: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 (lambda (test
9e50: 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 dat). (let
9e60: 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 * ((testname (d
9e70: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
9e80: 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 ame testdat))..
9e90: 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 (item-path
9ea0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 (db:test-get-ite
9eb0: 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 m-path testdat))
9ec0: 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 .. (full-na
9ed0: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d me (conc testnam
9ee0: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 e "/" item-path)
9ef0: 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 )).. (hash-table
9f00: 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 -set! curr-tests
9f10: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 -hash full-name
9f20: 74 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 testdat))).
9f30: 63 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 curr-tests).
9f40: 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 ;; NOPE: Non-opt
9f50: 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 imal approach. T
9f60: 72 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e ry this instead.
9f70: 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 . ;; 1. tes
9f80: 74 73 20 61 72 65 20 72 65 63 65 69 76 65 64 20 ts are received
9f90: 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 in a list, most
9fa0: 72 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 recent first.
9fb0: 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 ;; 2. replace
9fc0: 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 the rollup test
9fd0: 20 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 with the new *a
9fe0: 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d lways*. (for-
9ff0: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 each . (lamb
a000: 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 da (testdat).
a010: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 (let* ((test
a020: 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 name (db:test-g
a030: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
a040: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 dat)).. (it
a050: 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 em-path (db:test
a060: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
a070: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 estdat))..
a080: 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 (full-name (conc
a090: 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 testname "/" it
a0a0: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 em-path))..
a0b0: 20 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 (prev-test-dat
a0c0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
a0d0: 64 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 default curr-tes
a0e0: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d ts-hash full-nam
a0f0: 65 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 e #f)).. (t
a100: 65 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 est-steps (
a110: 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 db:get-steps-for
a120: 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 -test db (db:tes
a130: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 t-get-id testdat
a140: 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d ))).. (new-
a150: 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 test-record #f))
a160: 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 .. ;; replace th
a170: 65 73 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 ese with insert
a180: 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 ... select.. (ap
a190: 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 ply sqlite3:exec
a1a0: 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f ute ...db ...(co
a1b0: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 nc "INSERT OR RE
a1c0: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 PLACE INTO tests
a1d0: 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d (run_id,testnam
a1e0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 e,state,status,e
a1f0: 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 vent_time,host,c
a200: 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c puload,diskfree,
a210: 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 uname,rundir,ite
a220: 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 m_path,run_durat
a230: 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 ion,final_logf,c
a240: 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 omment) "...
a250: 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f "VALUES (?,?,?
a260: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
a270: 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 ,?,?,?);")...new
a280: 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 -run-id (cddr (v
a290: 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 ector->list test
a2a0: 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e dat))).. (set! n
a2b0: 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 ew-testdat (car
a2c0: 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 (rdb:get-tests-f
a2d0: 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 or-run db new-ru
a2e0: 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 n-id testname it
a2f0: 65 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 em-path '() '())
a300: 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 )).. (hash-table
a310: 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 -set! curr-tests
a320: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 -hash full-name
a330: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 new-testdat) ;;
a340: 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f this could be co
a350: 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 nfusing, which r
a360: 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 ecord should go
a370: 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 into the lookup
a380: 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 table?.. ;; Now
a390: 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 duplicate the te
a3a0: 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 st steps.. (debu
a3b0: 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 g:print 4 "Copyi
a3c0: 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 ng records in te
a3d0: 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 st_steps from te
a3e0: 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 st_id=" (db:test
a3f0: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 -get-id testdat)
a400: 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 " to " (db:test
a410: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 -get-id new-test
a420: 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 dat)).. (sqlite3
a430: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 :execute .. db
a440: 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 .. (conc "INSER
a450: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
a460: 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 O test_steps (te
a470: 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 st_id,stepname,s
a480: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e tate,status,even
a490: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 t_time,comment)
a4a0: 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 "..."SELECT " (d
a4b0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 b:test-get-id ne
a4c0: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 w-testdat) ",ste
a4d0: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 pname,state,stat
a4e0: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f us,event_time,co
a4f0: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f mment FROM test_
a500: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 steps WHERE test
a510: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a _id=?;").. (db:
a520: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
a530: 64 61 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 dat)).. ;; Now d
a540: 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 uplicate the tes
a550: 74 20 64 61 74 61 0a 09 20 28 64 65 62 75 67 3a t data.. (debug:
a560: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 print 4 "Copying
a570: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 records in test
a580: 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f _data from test_
a590: 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 id=" (db:test-ge
a5a0: 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 t-id testdat) "
a5b0: 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 to " (db:test-ge
a5c0: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
a5d0: 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 )).. (sqlite3:ex
a5e0: 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 ecute .. db ..
a5f0: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f (conc "INSERT O
a600: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 R REPLACE INTO t
a610: 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 est_data (test_i
a620: 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 d,category,varia
a630: 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 ble,value,expect
a640: 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d ed,tol,units,com
a650: 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 ment) "..."SELEC
a660: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 T " (db:test-get
a670: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
a680: 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 ",category,vari
a690: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 able,value,expec
a6a0: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f ted,tol,units,co
a6b0: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f mment FROM test_
a6c0: 64 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f data WHERE test_
a6d0: 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 id=?;").. (db:t
a6e0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
a6f0: 61 74 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 at)).. )). p
a700: 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a rev-tests))).. .
a710: 20 20 20 20 20 0a .