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 32 2c 20 4d 61 74 74 68 65 77 06-2012, 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: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70 st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74 ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65 atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20 vent_time")))..
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74 (keystr (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 mp)).. (header
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28 (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28 res '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28 key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20 runwildtype (if
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78 (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29 ) "like" "glob")
0580: 29 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66 ).. (qry-str #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20 )...(let* ((key
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20 eyval 0))...
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63 (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20 ":" key))...
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67 (patt (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79 s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c ))... (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74 dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70 ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61 b")))... (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21 tt... (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20 key-patt (conc
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22 key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70 key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29 e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e )... (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63 0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69 hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65 th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20 . keys).
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28 (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 s WHERE runname
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20 " runwildtype "
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22 ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
07b0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 73 int-info 4 "runs
07c0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 :get-runs-by-pat
07d0: 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72 20 t qry=" qry-str
07e0: 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 " " runnamepatt)
07f0: 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f . (sqlite3:fo
0800: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20 r-each-row .
0810: 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 29 (lambda (a . r)
0820: 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65 . (set! re
0830: 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e 76 s (cons (list->v
0840: 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 29 ector (cons a r)
0850: 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 62 ) res))). db
0860: 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a 20 . qry-str.
0870: 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 runnamepatt)
0880: 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 61 . (vector hea
0890: 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 66 der res)))..(def
08a0: 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67 ine (runs:test-g
08b0: 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73 et-full-path tes
08c0: 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 t). (let* ((tes
08d0: 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 tname (db:test-g
08e0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 et-testname te
08f0: 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68 st)).. (itempath
0900: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
0910: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a em-path test))).
0920: 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 (conc testna
0930: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 me (if (equal? i
0940: 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 28 tempath "") "" (
0950: 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74 conc "(" itempat
0960: 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 65 66 h ")")))))..(def
0970: 69 6e 65 20 28 64 62 3a 67 65 74 2d 72 75 6e 2d ine (db:get-run-
0980: 6b 65 79 2d 76 61 6c 20 64 62 20 72 75 6e 2d 69 key-val db run-i
0990: 64 20 6b 65 79 29 0a 20 20 28 6c 65 74 20 28 28 d key). (let ((
09a0: 72 65 73 20 23 66 29 29 0a 20 20 20 20 28 73 71 res #f)). (sq
09b0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
09c0: 6f 77 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ow. (lambda
09d0: 28 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 (val). (se
09e0: 74 21 20 72 65 73 20 76 61 6c 29 29 0a 20 20 20 t! res val)).
09f0: 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e 63 db . (conc
0a00: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a "SELECT " (key:
0a10: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
0a20: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 y) " FROM runs W
0a30: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 20 20 20 HERE id=?;").
0a40: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 72 65 run-id). re
0a50: 73 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 64 62 s))..(define (db
0a60: 3a 67 65 74 2d 72 75 6e 2d 6e 61 6d 65 2d 66 72 :get-run-name-fr
0a70: 6f 6d 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 29 om-id db run-id)
0a80: 0a 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66 . (let ((res #f
0a90: 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a )). (sqlite3:
0aa0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20 for-each-row.
0ab0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61 (lambda (runna
0ac0: 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 me). (set!
0ad0: 20 72 65 73 20 72 75 6e 6e 61 6d 65 29 29 0a 20 res runname)).
0ae0: 20 20 20 20 64 62 0a 20 20 20 20 20 22 53 45 4c db. "SEL
0af0: 45 43 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d ECT runname FROM
0b00: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f runs WHERE id=?
0b10: 3b 22 0a 20 20 20 20 20 72 75 6e 2d 69 64 29 0a ;". run-id).
0b20: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 res))..(defi
0b30: 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 ne (set-megatest
0b40: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 -env-vars run-id
0b50: 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 ). (let ((keys
0b60: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 (cdb:remote-run
0b70: 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29 db:get-keys #f))
0b80: 0a 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61 ..(vals (hash-ta
0b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
0ba0: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e *env-vars-by-run
0bb0: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29 -id* run-id #f))
0bc0: 29 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65 ). ;; get the
0bd0: 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64 info from the d
0be0: 62 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20 b and put it in
0bf0: 74 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69 the cache. (i
0c00: 66 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c f (not vals)..(l
0c10: 65 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61 et ((ht (make-ha
0c20: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28 sh-table))).. (
0c30: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
0c40: 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e *env-vars-by-run
0c50: 2d 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a -id* run-id ht).
0c60: 09 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74 . (set! vals ht
0c70: 29 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 ).. (for-each..
0c80: 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 (lambda (key)
0c90: 0a 09 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 .. (hash-tab
0ca0: 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b 65 79 le-set! vals key
0cb0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e (cdb:remote-run
0cc0: 20 64 62 3a 67 65 74 2d 72 75 6e 2d 6b 65 79 2d db:get-run-key-
0cd0: 76 61 6c 20 23 66 20 72 75 6e 2d 69 64 20 6b 65 val #f run-id ke
0ce0: 79 29 29 29 0a 09 20 20 20 6b 65 79 73 29 29 29 y))).. keys)))
0cf0: 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 68 65 . ;; from the
0d00: 20 63 61 63 68 65 64 20 64 61 74 61 20 73 65 74 cached data set
0d10: 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 28 68 the vars. (h
0d20: 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d 65 61 ash-table-for-ea
0d30: 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 20 20 ch. vals.
0d40: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 20 76 (lambda (key v
0d50: 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 62 75 al). (debu
0d60: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e g:print 2 "seten
0d70: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 v " (key:get-fie
0d80: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 ldname key) " "
0d90: 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74 val). (set
0da0: 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 env (key:get-fie
0db0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29 ldname key) val)
0dc0: 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65 )). (alist->e
0dd0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61 nv-vars (hash-ta
0de0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
0df0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76 *configdat* "env
0e00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29 -override" '()))
0e10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65 . ;; Lets use
0e20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f this as an oppo
0e30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d rtunity to put M
0e40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65 T_RUNNAME in the
0e50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 environment.
0e60: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e (setenv "MT_RUN
0e70: 4e 41 4d 45 22 20 28 63 64 62 3a 72 65 6d 6f 74 NAME" (cdb:remot
0e80: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 72 75 6e e-run db:get-run
0e90: 2d 6e 61 6d 65 2d 66 72 6f 6d 2d 69 64 20 23 66 -name-from-id #f
0ea0: 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 28 73 run-id)). (s
0eb0: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52 etenv "MT_RUN_AR
0ec0: 45 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74 EA_HOME" *toppat
0ed0: 68 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66 h*). ))..(def
0ee0: 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e ine (set-item-en
0ef0: 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a v-vars itemdat).
0f00: 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d (for-each (lam
0f10: 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20 bda (item)..
0f20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
0f30: 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20 "setenv " (car
0f40: 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20 item) " " (cadr
0f50: 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73 item)).. (s
0f60: 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29 etenv (car item)
0f70: 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09 (cadr item)))..
0f80: 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28 itemdat))..(
0f90: 64 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d define *last-num
0fa0: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 -running-tests*
0fb0: 30 29 0a 28 64 65 66 69 6e 65 20 2a 72 75 6e 73 0).(define *runs
0fc0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
0fd0: 73 74 73 2d 64 65 6c 61 79 2a 20 30 29 0a 28 64 sts-delay* 0).(d
0fe0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69 efine (runs:shri
0ff0: 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d nk-can-run-more-
1000: 74 65 73 74 73 2d 64 65 6c 61 79 29 0a 20 20 28 tests-delay). (
1010: 73 65 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 set! *runs:can-r
1020: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 un-more-tests-de
1030: 6c 61 79 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a lay* 0)) ;; (/ *
1040: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
1050: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 32 e-tests-delay* 2
1060: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 )))..(define (ru
1070: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
1080: 74 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 tests test-recor
1090: 64 29 0a 20 20 28 74 68 72 65 61 64 2d 73 6c 65 d). (thread-sle
10a0: 65 70 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 ep! *runs:can-ru
10b0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c n-more-tests-del
10c0: 61 79 2a 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 ay*). (let* ((t
10d0: 63 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20 20 config
10e0: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 (tests:te
10f0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 stqueue-get-test
1100: 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f config test-reco
1110: 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70 rd)).. (jobgroup
1120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1130: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 (config-lookup t
1140: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d config "requirem
1150: 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22 ents" "jobgroup"
1160: 29 29 0a 09 20 3b 3b 20 48 65 75 72 69 73 74 69 )).. ;; Heuristi
1170: 63 20 66 69 78 2e 20 54 68 65 73 65 20 61 72 65 c fix. These are
1180: 20 67 65 74 74 69 6e 67 20 63 61 6c 6c 65 64 20 getting called
1190: 74 6f 6f 20 72 61 70 69 64 6c 79 20 77 68 65 6e too rapidly when
11a0: 20 6a 6f 62 73 20 61 72 65 20 72 75 6e 6e 69 6e jobs are runnin
11b0: 67 20 6f 72 20 73 74 75 63 6b 0a 09 20 3b 3b 20 g or stuck.. ;;
11c0: 73 6f 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20 so we are going
11d0: 74 6f 20 69 6e 63 72 65 6d 65 6e 74 20 61 20 67 to increment a g
11e0: 6c 6f 62 61 6c 20 64 65 6c 61 79 20 62 79 20 30 lobal delay by 0
11f0: 2e 31 20 73 65 63 6f 6e 64 73 20 75 70 20 74 6f .1 seconds up to
1200: 20 31 30 20 73 65 63 6f 6e 64 73 0a 09 20 3b 3b 10 seconds.. ;;
1210: 20 65 76 65 72 79 20 74 69 6d 65 20 72 75 6e 73 every time runs
1220: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
1230: 73 74 73 20 69 73 20 63 61 6c 6c 65 64 2e 0a 09 sts is called...
1240: 20 3b 3b 20 77 68 65 6e 20 61 20 74 65 73 74 20 ;; when a test
1250: 69 73 20 6c 61 75 6e 63 68 65 64 20 6f 72 20 6f is launched or o
1260: 74 68 65 72 20 61 63 74 69 76 69 74 79 20 6f 63 ther activity oc
1270: 63 75 72 73 20 64 69 76 69 64 65 20 74 68 65 20 curs divide the
1280: 64 65 6c 61 79 20 62 79 20 32 0a 09 20 28 6e 75 delay by 2.. (nu
1290: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 m-running
12a0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 (cdb:remot
12b0: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75 e-run db:get-cou
12c0: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 nt-tests-running
12d0: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e #f)).. (num-run
12e0: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 ning-in-jobgroup
12f0: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e (cdb:remote-run
1300: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 db:get-count-te
1310: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a sts-running-in-j
1320: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72 obgroup #f jobgr
1330: 6f 75 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e oup)).. (max-con
1340: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 current-jobs
1350: 20 28 6c 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e (let ((mcj (con
1360: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 fig-lookup *conf
1370: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 20 igdat* "setup"
1380: 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 "max_concurre
1390: 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 09 09 09 09 nt_jobs"))).....
13a0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 6d 63 6a (if (and mcj
13b0: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 (string->number
13c0: 20 6d 63 6a 29 29 0a 09 09 09 09 09 28 73 74 72 mcj))......(str
13d0: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 ing->number mcj)
13e0: 0a 09 09 09 09 09 31 29 29 29 0a 09 20 28 6a 6f ......1))).. (jo
13f0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 b-group-limit
1400: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f (config-lo
1410: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a okup *configdat*
1420: 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 "jobgroups" job
1430: 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 69 66 group))). (if
1440: 20 28 61 6e 64 20 28 3e 20 28 2b 20 6e 75 6d 2d (and (> (+ num-
1450: 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e running num-runn
1460: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 29 ing-in-jobgroup)
1470: 20 30 29 0a 09 20 20 20 20 20 28 3c 20 2a 72 75 0).. (< *ru
1480: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
1490: 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 31 29 29 tests-delay* 1))
14a0: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 ..(begin.. (set
14b0: 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d ! *runs:can-run-
14c0: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 more-tests-delay
14d0: 2a 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 * (+ *runs:can-r
14e0: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 un-more-tests-de
14f0: 6c 61 79 2a 20 30 2e 30 30 39 29 29 0a 09 20 20 lay* 0.009))..
1500: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
1510: 6f 20 31 34 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f o 14 "can-run-mo
1520: 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 3a 20 re-tests-delay:
1530: 22 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d " *runs:can-run-
1540: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 more-tests-delay
1550: 2a 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f *))). (if (no
1560: 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d 6e 75 6d t (eq? *last-num
1570: 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 -running-tests*
1580: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 0a 09 28 num-running))..(
1590: 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a begin.. (debug:
15a0: 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e print 2 "max-con
15b0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 current-jobs: "
15c0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
15d0: 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 obs ", num-runni
15e0: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e ng: " num-runnin
15f0: 67 29 0a 09 20 20 28 73 65 74 21 20 2a 6c 61 73 g).. (set! *las
1600: 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 t-num-running-te
1610: 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 sts* num-running
1620: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 ))). (if (not
1630: 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 (eq? 0 *globale
1640: 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 28 6c xitstatus*))..(l
1650: 69 73 74 20 23 66 20 6e 75 6d 2d 72 75 6e 6e 69 ist #f num-runni
1660: 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 ng num-running-i
1670: 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 n-jobgroup max-c
1680: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a oncurrent-jobs j
1690: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 0a ob-group-limit).
16a0: 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d .(let ((can-not-
16b0: 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 run-more (cond..
16c0: 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f ... ;; if max-co
16d0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 ncurrent-jobs is
16e0: 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d set and the num
16f0: 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 ber running is g
1700: 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 reater ..... ;;
1710: 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e than it than can
1720: 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 not run more job
1730: 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78 s..... ((and max
1740: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
1750: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 (>= num-running
1760: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
1770: 6a 6f 62 73 29 29 0a 09 09 09 09 20 20 28 64 65 jobs))..... (de
1780: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
1790: 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e NING: Max runnin
17a0: 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c g jobs exceeded,
17b0: 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 current number
17c0: 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 running: " num-r
17d0: 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20 unning ......
17e0: 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 ", max_concu
17f0: 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 rrent_jobs: " ma
1800: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
1810: 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 s)..... #t)....
1820: 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75 . ;; if job-grou
1830: 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61 p-limit is set a
1840: 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 nd number of job
1850: 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69 s in the group i
1860: 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b s greater..... ;
1870: 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74 ; than the limit
1880: 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e then cannot run
1890: 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68 more jobs of th
18a0: 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61 is kind..... ((a
18b0: 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d nd job-group-lim
18c0: 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e it..... (>
18d0: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e = num-running-in
18e0: 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72 -jobgroup job-gr
18f0: 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09 oup-limit)).....
1900: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
1910: 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 "WARNING: numbe
1920: 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d r of jobs " num-
1930: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 running-in-jobgr
1940: 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 20 20 oup ......
1950: 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70 " in " jobgroup
1960: 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c " exceeded, wil
1970: 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73 l not run " (tes
1980: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
1990: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 -testname test-r
19a0: 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74 ecord))..... #t
19b0: 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66 29 )..... (else #f)
19c0: 29 29 29 0a 09 20 20 28 6c 69 73 74 20 28 6e 6f ))).. (list (no
19d0: 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f t can-not-run-mo
19e0: 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 re) num-running
19f0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
1a00: 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63 obgroup max-conc
1a10: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d urrent-jobs job-
1a20: 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 29 29 29 group-limit)))))
1a30: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ..;;============
1a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 ==========.;; Ne
1a80: 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 w methodology. T
1a90: 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69 hese routines wi
1aa0: 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61 ll replace the a
1ab0: 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f bove in time. Fo
1ac0: 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64 r.;; now the cod
1ad0: 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e e is duplicated.
1ae0: 20 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69 This stuff is i
1af0: 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e nitially used in
1b00: 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 the monitor.;;
1b10: 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d based code..;;==
1b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1b60: 3d 3d 3d 3d 0a 0a 0a 3b 3b 20 54 68 69 73 20 69 ====...;; This i
1b70: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66 s a duplicate of
1b80: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63 run-tests (whic
1b90: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65 h has been depre
1ba0: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73 cated). Use this
1bb0: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20 one instead of
1bc0: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65 run tests..;; ke
1bd0: 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b 20 20 74 65 yvals..;;.;; te
1be0: 73 74 2d 6e 61 6d 65 73 3a 20 43 6f 6d 6d 61 20 st-names: Comma
1bf0: 73 65 70 61 72 61 74 65 64 20 70 61 74 74 65 72 separated patter
1c00: 6e 73 20 73 61 6d 65 20 61 73 20 74 65 73 74 2d ns same as test-
1c10: 70 61 74 74 73 20 62 75 74 20 75 73 65 64 20 69 patts but used i
1c20: 6e 20 73 65 6c 65 63 74 69 6f 6e 20 0a 3b 3b 20 n selection .;;
1c30: 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20 of
1c40: 74 65 73 74 73 20 74 6f 20 72 75 6e 2e 20 54 68 tests to run. Th
1c50: 65 20 69 74 65 6d 20 70 6f 72 74 69 6f 6e 73 20 e item portions
1c60: 61 72 65 20 6e 6f 74 20 72 65 73 70 65 63 74 65 are not respecte
1c70: 64 2e 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 d..;;
1c80: 20 20 20 46 49 58 4d 45 3a 20 65 72 72 6f 72 20 FIXME: error
1c90: 6f 75 74 20 69 66 20 2f 70 61 74 74 20 73 70 65 out if /patt spe
1ca0: 63 69 66 69 65 64 0a 3b 3b 20 20 20 20 20 20 20 cified.;;
1cb0: 20 20 20 20 20 0a 28 64 65 66 69 6e 65 20 28 72 .(define (r
1cc0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 74 61 uns:run-tests ta
1cd0: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 65 73 rget runname tes
1ce0: 74 2d 6e 61 6d 65 73 20 74 65 73 74 2d 70 61 74 t-names test-pat
1cf0: 74 73 20 75 73 65 72 20 66 6c 61 67 73 29 0a 20 ts user flags).
1d00: 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 (common:clear-c
1d10: 61 63 68 65 73 29 20 3b 3b 20 63 6c 65 61 72 20 aches) ;; clear
1d20: 61 6c 6c 20 63 61 63 68 65 73 0a 20 20 28 6c 65 all caches. (le
1d30: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 t* ((db
1d40: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 #f).. (keys
1d50: 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d (cdb:remote-
1d60: 72 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 run db:get-keys
1d70: 23 66 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 #f)).. (keyvalls
1d80: 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 t (keys:target
1d90: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 ->keyval keys ta
1da0: 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 rget)).. (run-id
1db0: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 (cdb:remot
1dc0: 65 2d 72 75 6e 20 64 62 3a 72 65 67 69 73 74 65 e-run db:registe
1dd0: 72 2d 72 75 6e 20 23 66 20 6b 65 79 73 20 6b 65 r-run #f keys ke
1de0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 yvallst runname
1df0: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 "new" "n/a" user
1e00: 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d )) ;; test-nam
1e10: 65 29 29 29 0a 09 20 28 6b 65 79 76 61 6c 73 20 e))).. (keyvals
1e20: 20 20 20 20 28 69 66 20 72 75 6e 2d 69 64 20 28 (if run-id (
1e30: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 cdb:remote-run d
1e40: 62 3a 67 65 74 2d 6b 65 79 2d 76 61 6c 73 20 23 b:get-key-vals #
1e50: 66 20 72 75 6e 2d 69 64 29 20 23 66 29 29 0a 09 f run-id) #f))..
1e60: 20 28 64 65 66 65 72 72 65 64 20 20 20 20 27 28 (deferred '(
1e70: 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e 6e )) ;; delay runn
1e80: 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 65 20 ing these since
1e90: 74 68 65 79 20 68 61 76 65 20 61 20 77 61 69 74 they have a wait
1ea0: 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b 20 6b on clause.. ;; k
1eb0: 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68 65 20 eepgoing is the
1ec0: 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69 74 79 defacto modality
1ed0: 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64 20 68 now, will add h
1ee0: 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74 20 6c it-n-run a bit l
1ef0: 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65 70 67 ater.. ;; (keepg
1f00: 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74 61 62 oing (hash-tab
1f10: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
1f20: 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 lags "-keepgoing
1f30: 22 20 23 66 29 29 0a 09 20 28 72 75 6e 63 6f 6e " #f)).. (runcon
1f40: 66 69 67 66 20 20 20 28 63 6f 6e 63 20 20 2a 74 figf (conc *t
1f50: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e oppath* "/runcon
1f60: 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 0a 09 figs.config"))..
1f70: 20 28 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 (required-tests
1f80: 20 27 28 29 29 0a 09 20 28 74 65 73 74 2d 72 65 '()).. (test-re
1f90: 63 6f 72 64 73 20 28 6d 61 6b 65 2d 68 61 73 68 cords (make-hash
1fa0: 2d 74 61 62 6c 65 29 29 29 0a 0a 20 20 20 20 28 -table))).. (
1fb0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 set-megatest-env
1fc0: 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b -vars run-id) ;;
1fd0: 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 these may be ne
1fe0: 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e eded by the laun
1ff0: 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 ching process..
2000: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 (if (file-exi
2010: 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 sts? runconfigf)
2020: 0a 09 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 ..(setup-env-def
2030: 61 75 6c 74 73 20 72 75 6e 63 6f 6e 66 69 67 66 aults runconfigf
2040: 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 run-id *already
2050: 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d -seen-runconfig-
2060: 69 6e 66 6f 2a 20 6b 65 79 73 20 6b 65 79 76 61 info* keys keyva
2070: 6c 73 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d 65 ls "pre-launch-e
2080: 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 75 nv-vars")..(debu
2090: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
20a0: 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68 NG: You do not h
20b0: 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 67 ave a run config
20c0: 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66 file: " runconf
20d0: 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 3b igf)). . ;
20e0: 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65 ; look up all te
20f0: 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 65 sts matching the
2100: 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 64 comma separated
2110: 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 69 list of globs i
2120: 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 61 n. ;; test-pa
2130: 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 20 tts (using % as
2140: 77 69 6c 64 63 61 72 64 29 0a 0a 20 20 20 20 28 wildcard).. (
2150: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 set! test-names
2160: 28 74 65 73 74 73 3a 67 65 74 2d 76 61 6c 69 64 (tests:get-valid
2170: 2d 74 65 73 74 73 20 2a 74 6f 70 70 61 74 68 2a -tests *toppath*
2180: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 20 20 test-names)).
2190: 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d (set! test-nam
21a0: 65 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 es (delete-dupli
21b0: 63 61 74 65 73 20 74 65 73 74 2d 6e 61 6d 65 73 cates test-names
21c0: 29 29 0a 0a 20 20 20 20 28 64 65 62 75 67 3a 70 )).. (debug:p
21d0: 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 74 65 73 rint-info 0 "tes
21e0: 74 20 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e t names " test-n
21f0: 61 6d 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e ames).. ;; on
2200: 20 74 68 65 20 66 69 72 73 74 20 70 61 73 73 20 the first pass
2210: 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 or call to run-t
2220: 65 73 74 73 20 73 65 74 20 46 41 49 4c 53 20 74 ests set FAILS t
2230: 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66 o NOT_STARTED if
2240: 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 . ;; -keepgoi
2250: 6e 67 20 69 73 20 73 70 65 63 69 66 69 65 64 0a ng is specified.
2260: 20 20 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61 (if (eq? *pa
2270: 73 73 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 ssnum* 0)..(begi
2280: 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 n.. ;; have to
2290: 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f delete test reco
22a0: 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 rds where NOT_ST
22b0: 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 65 79 ARTED since they
22c0: 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 can cause -keep
22d0: 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 going to .. ;;
22e0: 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f get stuck due to
22f0: 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 becoming inacce
2300: 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 ssible from a fa
2310: 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 iled test. I.e.
2320: 69 66 20 74 65 73 74 20 42 20 64 65 70 65 6e 64 if test B depend
2330: 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 s .. ;; on test
2340: 20 41 20 62 75 74 20 74 65 73 74 20 42 20 72 65 A but test B re
2350: 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20 ached the point
2360: 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 74 65 on being registe
2370: 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 red as NOT_START
2380: 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b ED and test.. ;
2390: 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73 ; A failed for s
23a0: 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 ome reason then
23b0: 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 on re-run using
23c0: 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72 -keepgoing the r
23d0: 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d un can never com
23e0: 70 6c 65 74 65 2e 0a 09 20 20 28 63 64 62 3a 64 plete... (cdb:d
23f0: 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73 elete-tests-in-s
2400: 74 61 74 65 20 2a 72 75 6e 72 65 6d 6f 74 65 2a tate *runremote*
2410: 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 41 run-id "NOT_STA
2420: 52 54 45 44 22 29 0a 09 20 20 28 63 64 62 3a 72 RTED").. (cdb:r
2430: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 73 65 74 emote-run db:set
2440: 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 74 61 -tests-state-sta
2450: 74 75 73 20 23 66 20 72 75 6e 2d 69 64 20 74 65 tus #f run-id te
2460: 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 41 49 st-names #f "FAI
2470: 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 L" "NOT_STARTED"
2480: 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 20 20 20 "FAIL")))..
2490: 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 6f 6e 20 ;; from here on
24a0: 6f 75 74 20 74 68 65 20 64 62 20 77 69 6c 6c 20 out the db will
24b0: 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 20 63 6c be opened and cl
24c0: 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 20 63 61 osed on every ca
24d0: 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 ll runs:run-test
24e0: 73 2d 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 28 s-queue. ;; (
24f0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 sqlite3:finalize
2500: 21 20 64 62 29 20 0a 20 20 20 20 3b 3b 20 6e 6f ! db) . ;; no
2510: 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 74 w add non-direct
2520: 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 65 ly referenced de
2530: 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 2e pendencies (i.e.
2540: 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 28 69 66 waiton). (if
2550: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 (not (null? tes
2560: 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 t-names))..(let
2570: 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 20 loop ((hed (car
2580: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 test-names))...
2590: 20 20 28 74 61 6c 20 28 63 64 72 20 74 65 73 74 (tal (cdr test
25a0: 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20 20 20 -names)))
25b0: 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 6f ;; 'return-pro
25c0: 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63 6f 6e cs tells the con
25d0: 66 69 67 20 72 65 61 64 65 72 20 74 6f 20 70 72 fig reader to pr
25e0: 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 65 ep running syste
25f0: 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61 20 70 m but return a p
2600: 72 6f 63 0a 09 20 20 28 64 65 62 75 67 3a 70 72 roc.. (debug:pr
2610: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65 64 3d int-info 4 "hed=
2620: 22 20 68 65 64 20 22 20 61 74 20 74 6f 70 20 6f " hed " at top o
2630: 66 20 6c 6f 6f 70 22 29 0a 09 20 20 28 6c 65 74 f loop").. (let
2640: 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 74 65 73 * ((config (tes
2650: 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ts:get-testconfi
2660: 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d 70 72 g hed 'return-pr
2670: 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74 6f 6e ocs))... (waiton
2680: 73 20 28 6c 65 74 20 28 28 69 6e 73 74 72 20 28 s (let ((instr (
2690: 69 66 20 63 6f 6e 66 69 67 20 0a 09 09 09 09 09 if config ......
26a0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (config-looku
26b0: 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 p config "requir
26c0: 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 ements" "waiton"
26d0: 29 0a 09 09 09 09 09 20 20 20 28 62 65 67 69 6e )...... (begin
26e0: 20 3b 3b 20 4e 6f 20 63 6f 6e 66 69 67 20 6d 65 ;; No config me
26f0: 61 6e 73 20 74 68 69 73 20 69 73 20 61 20 6e 6f ans this is a no
2700: 6e 2d 65 78 69 73 74 61 6e 74 20 74 65 73 74 0a n-existant test.
2710: 09 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67 ..... (debug
2720: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
2730: 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 65 non-existent re
2740: 71 75 69 72 65 64 20 74 65 73 74 20 5c 22 22 20 quired test \""
2750: 68 65 64 20 22 5c 22 22 29 0a 09 09 09 09 09 20 hed "\"")......
2760: 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c 69 (if db (sqli
2770: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 te3:finalize! db
2780: 29 29 0a 09 09 09 09 09 20 20 20 20 20 28 65 78 ))...... (ex
2790: 69 74 20 31 29 29 29 29 29 0a 09 09 09 20 20 20 it 1)))))....
27a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
27b0: 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 20 73 74 fo 8 "waitons st
27c0: 72 69 6e 67 20 69 73 20 22 20 69 6e 73 74 72 29 ring is " instr)
27d0: 0a 09 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d .... (string-
27e0: 73 70 6c 69 74 20 28 63 6f 6e 64 0a 09 09 09 09 split (cond.....
27f0: 09 20 20 20 28 28 70 72 6f 63 65 64 75 72 65 3f . ((procedure?
2800: 20 69 6e 73 74 72 29 0a 09 09 09 09 09 20 20 20 instr)......
2810: 20 28 6c 65 74 20 28 28 72 65 73 20 28 69 6e 73 (let ((res (ins
2820: 74 72 29 29 29 0a 09 09 09 09 09 20 20 20 20 20 tr)))......
2830: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
2840: 66 6f 20 38 20 22 77 61 69 74 6f 6e 20 70 72 6f fo 8 "waiton pro
2850: 63 65 64 75 72 65 20 72 65 73 75 6c 74 73 20 69 cedure results i
2860: 6e 20 73 74 72 69 6e 67 20 22 20 72 65 73 20 22 n string " res "
2870: 20 66 6f 72 20 74 65 73 74 20 22 20 68 65 64 29 for test " hed)
2880: 0a 09 09 09 09 09 20 20 20 20 20 20 72 65 73 29 ...... res)
2890: 29 0a 09 09 09 09 09 20 20 20 28 28 73 74 72 69 )...... ((stri
28a0: 6e 67 3f 20 69 6e 73 74 72 29 20 20 20 20 20 69 ng? instr) i
28b0: 6e 73 74 72 29 0a 09 09 09 09 09 20 20 20 28 65 nstr)...... (e
28c0: 6c 73 65 20 0a 09 09 09 09 09 20 20 20 20 3b 3b lse ...... ;;
28d0: 20 4e 4f 54 45 3a 20 54 68 69 73 20 69 73 20 61 NOTE: This is a
28e0: 63 74 75 61 6c 6c 79 20 74 68 65 20 63 61 73 65 ctually the case
28f0: 20 6f 66 20 2a 6e 6f 2a 20 77 61 69 74 6f 6e 73 of *no* waitons
2900: 21 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e ! ;; (debug:prin
2910: 74 20 30 20 22 45 52 52 4f 52 3a 20 73 6f 6d 65 t 0 "ERROR: some
2920: 74 68 69 6e 67 20 77 65 6e 74 20 77 72 6f 6e 67 thing went wrong
2930: 20 69 6e 20 70 72 6f 63 65 73 73 69 6e 67 20 77 in processing w
2940: 61 69 74 6f 6e 73 20 66 6f 72 20 74 65 73 74 20 aitons for test
2950: 22 20 68 65 64 29 0a 09 09 09 09 09 20 20 20 20 " hed)......
2960: 22 22 29 29 29 29 29 29 0a 09 20 20 20 20 28 64 "")))))).. (d
2970: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
2980: 38 20 22 77 61 69 74 6f 6e 73 3a 20 22 20 77 61 8 "waitons: " wa
2990: 69 74 6f 6e 73 29 0a 09 20 20 20 20 3b 3b 20 63 itons).. ;; c
29a0: 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 heck for hed in
29b0: 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 waitons => this
29c0: 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 would be circula
29d0: 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 r, remove it and
29e0: 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b issue an.. ;
29f0: 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 ; error.. (if
2a00: 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69 (member hed wai
2a10: 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 tons)...(begin..
2a20: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
2a30: 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22 0 "ERROR: test "
2a40: 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 65 hed " has liste
2a50: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 d itself as a wa
2a60: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 iton, please cor
2a70: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 rect this!")...
2a80: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 73 20 28 (set! waitons (
2a90: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 filter (lambda (
2aa0: 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 x)(not (equal? x
2ab0: 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 hed))) waitons)
2ac0: 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 3b ))).. .. ;
2ad0: 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d ; (items (item
2ae0: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d s:get-items-from
2af0: 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 -config config))
2b00: 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 ).. (if (not
2b10: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
2b20: 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63 default test-rec
2b30: 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a 09 09 ords hed #f))...
2b40: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 (hash-table-set!
2b50: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 test-records...
2b60: 09 09 20 68 65 64 20 28 76 65 63 74 6f 72 20 68 .. hed (vector h
2b70: 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 ed ;; 0.....
2b80: 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b . config ;;
2b90: 20 31 0a 09 09 09 09 09 20 20 20 20 20 77 61 69 1...... wai
2ba0: 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 tons ;; 2......
2bb0: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b (config-look
2bc0: 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 up config "requi
2bd0: 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69 rements" "priori
2be0: 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f ty") ;; prio
2bf0: 72 69 74 79 20 33 0a 09 09 09 09 09 20 20 20 20 rity 3......
2c00: 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20 (let ((items
2c10: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
2c20: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 ef/default confi
2c30: 67 20 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b g "items" #f)) ;
2c40: 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09 ; items 4.......
2c50: 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28 (itemstable (
2c60: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
2c70: 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 efault config "i
2c80: 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29 temstable" #f)))
2c90: 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b ...... ;;
2ca0: 20 69 66 20 65 69 74 68 65 72 20 69 74 65 6d 73 if either items
2cb0: 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20 or items table
2cc0: 69 73 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e is a proc return
2cd0: 20 69 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e it so test runn
2ce0: 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 ing......
2cf0: 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b ;; process can k
2d00: 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d now to call item
2d10: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d s:get-items-from
2d20: 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20 -config......
2d30: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 ;; if either
2d40: 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e is a list and n
2d50: 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f one is a proc go
2d60: 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 ahead and call
2d70: 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 get-items......
2d80: 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 ;; otherwi
2d90: 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74 se return #f - t
2da0: 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 his is not an it
2db0: 65 72 61 74 65 64 20 74 65 73 74 0a 09 09 09 09 erated test.....
2dc0: 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 . (cond...
2dd0: 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f ....((procedure?
2de0: 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09 items) ...
2df0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e .... (debug:prin
2e00: 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20 t-info 4 "items
2e10: 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 is a procedure,
2e20: 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 will calc later"
2e30: 29 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 )....... items)
2e40: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 ;; ca
2e50: 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 lc later.......(
2e60: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d (procedure? item
2e70: 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 stable)....... (
2e80: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f debug:print-info
2e90: 20 34 20 22 69 74 65 6d 73 74 61 62 6c 65 20 69 4 "itemstable i
2ea0: 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 s a procedure, w
2eb0: 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 ill calc later")
2ec0: 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62 ....... itemstab
2ed0: 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c le) ;; cal
2ee0: 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 c later.......((
2ef0: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 filter (lambda (
2f00: 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65 x)........ (le
2f10: 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29 t ((val (car x))
2f20: 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69 )........ (i
2f30: 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61 f (procedure? va
2f40: 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09 l) val #f)))....
2f50: 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66 .... (append (if
2f60: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 (list? items) i
2f70: 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09 tems '()).......
2f80: 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 .. (if (list? it
2f90: 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74 emstable) itemst
2fa0: 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09 able '()))).....
2fb0: 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 .. 'have-procedu
2fc0: 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28 re).......((or (
2fd0: 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 list? items)(lis
2fe0: 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 t? itemstable))
2ff0: 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 ;; calc now.....
3000: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d .. (debug:print-
3010: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 20 61 6e info 4 "items an
3020: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65 d itemstable are
3030: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 lists, calc now
3040: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20 \n"........
3050: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69 " items: " i
3060: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c tems " itemstabl
3070: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29 e: " itemstable)
3080: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67 ....... (items:g
3090: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
30a0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 nfig config))...
30b0: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20 ....(else #f)))
30c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
30d0: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 ;; not
30e0: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20 iterated......
30f0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69 #f ;; i
3100: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20 temsdat 5......
3110: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73 #f ;; s
3120: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20 pare - used for
3130: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20 item-path......
3140: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f ))).. (fo
3150: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c r-each .. (l
3160: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 ambda (waiton)..
3170: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 (if (and
3180: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d waiton (not (mem
3190: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d ber waiton test-
31a0: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62 names)))... (b
31b0: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74 egin... (set
31c0: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 ! required-tests
31d0: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 (cons waiton re
31e0: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 quired-tests))..
31f0: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 . (set! test
3200: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 -names (cons wai
3210: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 ton test-names))
3220: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 ))) ;; was an ap
3230: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 pend, now a cons
3240: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a .. waitons).
3250: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 . (let ((remt
3260: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70 ests (delete-dup
3270: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20 licates (append
3280: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a waitons tal)))).
3290: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 . (if (not
32a0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 (null? remtests)
32b0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 )... (loop (car
32c0: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72 remtests)(cdr r
32d0: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a emtests)))))))..
32e0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
32f0: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73 ll? required-tes
3300: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 ts))..(debug:pri
3310: 6e 74 2d 69 6e 66 6f 20 31 20 22 41 64 64 69 6e nt-info 1 "Addin
3320: 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 73 g " required-tes
3330: 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20 ts " to the run
3340: 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20 queue")). ;;
3350: 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 20 NOTE: these are
3360: 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73 all parent tests
3370: 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20 , items are not
3380: 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20 expanded yet..
3390: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 (debug:print-i
33a0: 6e 66 6f 20 34 20 22 74 65 73 74 2d 72 65 63 6f nfo 4 "test-reco
33b0: 72 64 73 3d 22 20 28 68 61 73 68 2d 74 61 62 6c rds=" (hash-tabl
33c0: 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 72 65 e->alist test-re
33d0: 63 6f 72 64 73 29 29 0a 20 20 20 20 28 72 75 6e cords)). (run
33e0: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 s:run-tests-queu
33f0: 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 e run-id runname
3400: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 test-records ke
3410: 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 65 yvallst flags te
3420: 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 28 64 st-patts). (d
3430: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
3440: 34 20 22 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 4 "All done by h
3450: 65 72 65 22 29 29 29 0a 0a 28 64 65 66 69 6e 65 ere")))..(define
3460: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c (runs:calc-fail
3470: 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 s prereqs-not-me
3480: 74 29 0a 20 20 28 66 69 6c 74 65 72 20 28 6c 61 t). (filter (la
3490: 6d 62 64 61 20 28 74 65 73 74 29 0a 09 20 20 20 mbda (test)..
34a0: 20 28 61 6e 64 20 28 76 65 63 74 6f 72 3f 20 74 (and (vector? t
34b0: 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73 74 72 est) ;; not (str
34c0: 69 6e 67 3f 20 74 65 73 74 29 29 0a 09 09 20 28 ing? test))... (
34d0: 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d equal? (db:test-
34e0: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 29 20 get-state test)
34f0: 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a 09 09 20 "COMPLETED")...
3500: 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 28 64 62 (not (member (db
3510: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 :test-get-status
3520: 20 74 65 73 74 29 0a 09 09 09 20 20 20 20 20 20 test)....
3530: 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 '("PASS" "WARN"
3540: 22 43 48 45 43 4b 22 20 22 57 41 49 56 45 44 22 "CHECK" "WAIVED"
3550: 20 22 53 4b 49 50 22 29 29 29 29 29 0a 09 20 20 "SKIP")))))..
3560: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 prereqs-not-met)
3570: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 )..(define (runs
3580: 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 :calc-not-comple
3590: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d ted prereqs-not-
35a0: 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 0a 20 met). (filter.
35b0: 20 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 20 20 (lambda (t).
35c0: 20 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 (or (not (vec
35d0: 74 6f 72 3f 20 74 29 29 0a 09 20 28 6e 6f 74 20 tor? t)).. (not
35e0: 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 (equal? "COMPLET
35f0: 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ED" (db:test-get
3600: 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a 20 20 -state t))))).
3610: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
3620: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e ))..(define (run
3630: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 s:pretty-string
3640: 6c 73 74 29 0a 20 20 28 6d 61 70 20 28 6c 61 6d lst). (map (lam
3650: 62 64 61 20 28 74 29 0a 09 20 28 69 66 20 28 6e bda (t).. (if (n
3660: 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a ot (vector? t)).
3670: 09 20 20 20 20 20 28 63 6f 6e 63 20 74 29 0a 09 . (conc t)..
3680: 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62 3a 74 (conc (db:t
3690: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
36a0: 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 t) ":" (db:test
36b0: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f -get-state t) "/
36c0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 " (db:test-get-s
36d0: 74 61 74 75 73 20 74 29 29 29 29 0a 20 20 20 20 tatus t)))).
36e0: 20 20 20 6c 73 74 29 29 0a 0a 28 64 65 66 69 6e lst))..(defin
36f0: 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c e (runs:make-ful
3700: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 l-test-name test
3710: 6e 61 6d 65 20 69 74 65 6d 70 61 74 68 29 0a 20 name itempath).
3720: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
3730: 6d 70 61 74 68 20 22 22 29 20 74 65 73 74 6e 61 mpath "") testna
3740: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d me (conc testnam
3750: 65 20 22 2f 22 20 69 74 65 6d 70 61 74 68 29 29 e "/" itempath))
3760: 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72 )..;; test-recor
3770: 64 73 20 69 73 20 61 20 68 61 73 68 20 74 61 62 ds is a hash tab
3780: 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d le testname:item
3790: 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f 72 20 _path => vector
37a0: 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 74 63 < testname testc
37b0: 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 70 72 onfig waitons pr
37c0: 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 6e 66 iority items-inf
37d0: 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20 o ... >.(define
37e0: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
37f0: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e queue run-id run
3800: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
3810: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
3820: 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20 s test-patts).
3830: 20 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69 ;; At this poi
3840: 6e 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70 nt the list of p
3850: 61 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65 arent tests is e
3860: 78 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 xpanded . ;;
3870: 4e 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 NB// Should expa
3880: 6e 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e nd items here an
3890: 64 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e d then insert in
38a0: 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 to the run queue
38b0: 2e 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
38c0: 20 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 5 "test-records
38d0: 3a 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73 : " test-records
38e0: 20 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 ", keyvallst: "
38f0: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61 keyvallst " fla
3900: 67 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c gs: " (hash-tabl
3910: 65 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29 e->alist flags))
3920: 0a 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 . (let ((sorted
3930: 2d 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 -test-names (tes
3940: 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 ts:sort-by-prior
3950: 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 ity-and-waiton t
3960: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 est-records))..(
3970: 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 20 20 test-registery
3980: 20 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 (make-hash-tab
3990: 6c 65 29 29 0a 09 28 72 65 67 69 73 74 65 72 79 le))..(registery
39a0: 2d 6d 75 74 65 78 20 20 20 28 6d 61 6b 65 2d 6d -mutex (make-m
39b0: 75 74 65 78 29 29 0a 09 28 6e 75 6d 2d 72 65 74 utex))..(num-ret
39c0: 72 69 65 73 20 20 20 20 20 20 20 20 30 29 0a 09 ries 0)..
39d0: 28 6d 61 78 2d 72 65 74 72 69 65 73 20 20 20 20 (max-retries
39e0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (config-looku
39f0: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 p *configdat* "s
3a00: 65 74 75 70 22 20 22 6d 61 78 72 65 74 72 69 65 etup" "maxretrie
3a10: 73 22 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 s"))). (set!
3a20: 6d 61 78 2d 72 65 74 72 69 65 73 20 28 69 66 20 max-retries (if
3a30: 28 61 6e 64 20 6d 61 78 2d 72 65 74 72 69 65 73 (and max-retries
3a40: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 (string->number
3a50: 20 6d 61 78 2d 72 65 74 72 69 65 73 29 29 28 73 max-retries))(s
3a60: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 tring->number ma
3a70: 78 2d 72 65 74 72 69 65 73 29 20 31 30 30 29 29 x-retries) 100))
3a80: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
3a90: 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 ull? sorted-test
3aa0: 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c -names))..(let l
3ab0: 6f 6f 70 20 28 28 68 65 64 20 20 20 20 20 20 20 oop ((hed
3ac0: 20 20 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65 (car sorted-te
3ad0: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 st-names))...
3ae0: 28 74 61 6c 20 20 20 20 20 20 20 20 20 28 63 64 (tal (cd
3af0: 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 r sorted-test-na
3b00: 6d 65 73 29 29 0a 09 09 20 20 20 28 72 65 72 75 mes))... (reru
3b10: 6e 73 20 20 20 20 20 20 27 28 29 29 29 0a 09 20 ns '()))..
3b20: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
3b30: 20 72 65 72 75 6e 73 29 29 28 64 65 62 75 67 3a reruns))(debug:
3b40: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 65 print-info 4 "re
3b50: 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a runs=" reruns)).
3b60: 09 20 20 3b 3b 20 28 70 72 69 6e 74 20 22 54 6f . ;; (print "To
3b70: 70 20 6f 66 20 6c 6f 6f 70 2c 20 68 65 64 3d 22 p of loop, hed="
3b80: 20 68 65 64 20 22 2c 20 74 61 6c 3d 22 20 74 61 hed ", tal=" ta
3b90: 6c 20 22 20 2c 72 65 72 75 6e 73 3d 22 20 72 65 l " ,reruns=" re
3ba0: 72 75 6e 73 29 0a 09 20 20 28 6c 65 74 2a 20 28 runs).. (let* (
3bb0: 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61 (test-record (ha
3bc0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73 sh-table-ref tes
3bd0: 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a t-records hed)).
3be0: 09 09 20 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 .. (test-name
3bf0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3c00: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
3c10: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 st-record))... (
3c20: 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73 tconfig (tes
3c30: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3c40: 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 -testconfig test
3c50: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 74 65 -record))... (te
3c60: 73 74 6d 6f 64 65 20 20 20 20 28 6c 65 74 20 28 stmode (let (
3c70: 28 6d 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (m (config-looku
3c80: 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69 p tconfig "requi
3c90: 72 65 6d 65 6e 74 73 22 20 22 6d 6f 64 65 22 29 rements" "mode")
3ca0: 29 29 0a 09 09 09 09 28 69 66 20 6d 20 28 73 74 )).....(if m (st
3cb0: 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 6d 29 20 ring->symbol m)
3cc0: 27 6e 6f 72 6d 61 6c 29 29 29 0a 09 09 20 28 77 'normal)))... (w
3cd0: 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74 aitons (test
3ce0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
3cf0: 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d waitons test-
3d00: 72 65 63 6f 72 64 29 29 0a 09 09 20 28 70 72 69 record))... (pri
3d10: 6f 72 69 74 79 20 20 20 20 28 74 65 73 74 73 3a ority (tests:
3d20: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 70 72 testqueue-get-pr
3d30: 69 6f 72 69 74 79 20 20 20 74 65 73 74 2d 72 65 iority test-re
3d40: 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 64 cord))... (itemd
3d50: 61 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 at (tests:te
3d60: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d stqueue-get-item
3d70: 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f dat test-reco
3d80: 72 64 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 20 rd)) ;; itemdat
3d90: 63 61 6e 20 62 65 20 61 20 73 74 72 69 6e 67 2c can be a string,
3da0: 20 6c 69 73 74 20 6f 72 20 23 66 0a 09 09 20 28 list or #f... (
3db0: 69 74 65 6d 73 20 20 20 20 20 20 20 28 74 65 73 items (tes
3dc0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3dd0: 2d 69 74 65 6d 73 20 20 20 20 20 20 74 65 73 74 -items test
3de0: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 -record))... (it
3df0: 65 6d 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d em-path (item-
3e00: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 list->path itemd
3e10: 61 74 29 29 0a 09 09 20 28 6e 65 77 74 61 6c 20 at))... (newtal
3e20: 20 20 20 20 20 28 61 70 70 65 6e 64 20 74 61 6c (append tal
3e30: 20 28 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 (list hed))))..
3e40: 20 20 20 20 0a 09 20 20 20 20 28 64 65 62 75 67 .. (debug
3e50: 3a 70 72 69 6e 74 20 36 0a 09 09 09 20 22 74 65 :print 6.... "te
3e60: 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d st-name: " test-
3e70: 6e 61 6d 65 0a 09 09 09 20 22 5c 6e 20 20 68 65 name.... "\n he
3e80: 64 3a 20 20 20 20 20 20 20 20 20 22 20 68 65 64 d: " hed
3e90: 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 64 61 .... "\n itemda
3ea0: 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 74 t: " itemdat
3eb0: 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 3a .... "\n items:
3ec0: 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 " items..
3ed0: 09 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 .. "\n item-pat
3ee0: 68 3a 20 20 20 22 20 69 74 65 6d 2d 70 61 74 68 h: " item-path
3ef0: 0a 09 09 09 20 22 5c 6e 20 20 77 61 69 74 6f 6e .... "\n waiton
3f00: 73 3a 20 20 20 20 20 22 20 77 61 69 74 6f 6e 73 s: " waitons
3f10: 0a 09 09 09 20 22 5c 6e 20 20 6e 75 6d 2d 72 65 .... "\n num-re
3f20: 74 72 69 65 73 3a 20 22 20 6e 75 6d 2d 72 65 74 tries: " num-ret
3f30: 72 69 65 73 0a 09 09 09 20 22 5c 6e 20 20 74 61 ries.... "\n ta
3f40: 6c 3a 20 20 20 20 20 20 20 20 20 22 20 74 61 6c l: " tal
3f50: 0a 09 09 09 20 22 5c 6e 20 20 72 65 72 75 6e 73 .... "\n reruns
3f60: 3a 20 20 20 20 20 20 22 20 72 65 72 75 6e 73 29 : " reruns)
3f70: 0a 0a 09 20 20 20 20 3b 3b 20 63 68 65 63 6b 20 ... ;; check
3f80: 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69 74 6f for hed in waito
3f90: 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75 6c 64 ns => this would
3fa0: 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20 72 65 be circular, re
3fb0: 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73 73 75 move it and issu
3fc0: 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65 72 72 e an.. ;; err
3fd0: 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d 65 6d or.. (if (mem
3fe0: 62 65 72 20 74 65 73 74 2d 6e 61 6d 65 20 77 61 ber test-name wa
3ff0: 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a itons)...(begin.
4000: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
4010: 20 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 0 "ERROR: test
4020: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 68 61 " test-name " ha
4030: 73 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 s listed itself
4040: 61 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 as a waiton, ple
4050: 61 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 ase correct this
4060: 21 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 !")... (set! wa
4070: 69 74 6f 6e 20 28 66 69 6c 74 65 72 20 28 6c 61 iton (filter (la
4080: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 mbda (x)(not (eq
4090: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 ual? x hed))) wa
40a0: 69 74 6f 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 itons))))...
40b0: 28 63 6f 6e 64 20 3b 3b 20 4f 55 54 45 52 20 43 (cond ;; OUTER C
40c0: 4f 4e 44 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 OND.. ((not
40d0: 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66 items) ;; when f
40e0: 61 6c 73 65 20 74 68 65 20 74 65 73 74 20 69 73 alse the test is
40f0: 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64 65 64 ok to be handed
4100: 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68 20 28 off to launch (
4110: 62 75 74 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a but not before).
4120: 09 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72 . (let* ((r
4130: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 20 un-limits-info
4140: 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6e (runs:can
4150: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 -run-more-tests
4160: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b test-record)) ;;
4170: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73 look at the tes
4180: 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 t jobgroup and t
4190: 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a ot jobs running.
41a0: 09 09 20 20 20 20 20 28 68 61 76 65 2d 72 65 73 .. (have-res
41b0: 6f 75 72 63 65 73 20 20 20 20 20 20 20 20 20 20 ources
41c0: 28 63 61 72 20 72 75 6e 2d 6c 69 6d 69 74 73 2d (car run-limits-
41d0: 69 6e 66 6f 29 29 0a 09 09 20 20 20 20 20 28 6e info))... (n
41e0: 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 um-running
41f0: 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 (list-ref
4200: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f run-limits-info
4210: 20 31 29 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 1))... (num
4220: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 -running-in-jobg
4230: 72 6f 75 70 20 28 6c 69 73 74 2d 72 65 66 20 72 roup (list-ref r
4240: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 32 un-limits-info 2
4250: 29 29 0a 09 09 20 20 20 20 20 28 6d 61 78 2d 63 ))... (max-c
4260: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 20 oncurrent-jobs
4270: 20 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e (list-ref run
4280: 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 33 29 29 -limits-info 3))
4290: 0a 09 09 20 20 20 20 20 28 6a 6f 62 2d 67 72 6f ... (job-gro
42a0: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 up-limit
42b0: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c (list-ref run-l
42c0: 69 6d 69 74 73 2d 69 6e 66 6f 20 34 29 29 0a 09 imits-info 4))..
42d0: 09 20 20 20 20 20 28 70 72 65 72 65 71 73 2d 6e . (prereqs-n
42e0: 6f 74 2d 6d 65 74 20 20 20 20 20 20 20 20 20 28 ot-met (
42f0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 cdb:remote-run d
4300: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f b:get-prereqs-no
4310: 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 20 t-met #f run-id
4320: 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 waitons item-pat
4330: 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 h mode: testmode
4340: 29 29 0a 09 09 20 20 20 20 20 28 66 61 69 6c 73 ))... (fails
4350: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4360: 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 (runs:calc-fa
4370: 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d ils prereqs-not-
4380: 6d 65 74 29 29 0a 09 09 20 20 20 20 20 28 6e 6f met))... (no
4390: 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 20 20 n-completed
43a0: 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 (runs:calc
43b0: 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 -not-completed p
43c0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 rereqs-not-met))
43d0: 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 )...(debug:print
43e0: 2d 69 6e 66 6f 20 38 20 22 68 61 76 65 2d 72 65 -info 8 "have-re
43f0: 73 6f 75 72 63 65 73 3a 20 22 20 68 61 76 65 2d sources: " have-
4400: 72 65 73 6f 75 72 63 65 73 20 22 20 70 72 65 72 resources " prer
4410: 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a eqs-not-met: " .
4420: 09 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d ... (string-
4430: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 intersperse ....
4440: 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 (map (lamb
4450: 64 61 20 28 74 29 0a 09 09 09 09 20 20 20 20 20 da (t).....
4460: 28 69 66 20 28 76 65 63 74 6f 72 3f 20 74 29 0a (if (vector? t).
4470: 09 09 09 09 09 20 28 63 6f 6e 63 20 28 64 62 3a ..... (conc (db:
4480: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 test-get-state t
4490: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 ) "/" (db:test-g
44a0: 65 74 2d 73 74 61 74 75 73 20 74 29 29 0a 09 09 et-status t))...
44b0: 09 09 09 20 28 63 6f 6e 63 20 22 20 57 41 52 4e ... (conc " WARN
44c0: 49 4e 47 3a 20 74 20 69 73 20 6e 6f 74 20 61 20 ING: t is not a
44d0: 76 65 63 74 6f 72 3d 22 20 74 20 29 29 29 0a 09 vector=" t )))..
44e0: 09 09 09 20 20 20 70 72 65 72 65 71 73 2d 6e 6f ... prereqs-no
44f0: 74 2d 6d 65 74 29 20 22 2c 20 22 29 20 22 20 66 t-met) ", ") " f
4500: 61 69 6c 73 3a 20 22 20 66 61 69 6c 73 29 0a 09 ails: " fails)..
4510: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e .(debug:print-in
4520: 66 6f 20 34 20 22 68 65 64 3d 22 20 68 65 64 20 fo 4 "hed=" hed
4530: 22 5c 6e 20 20 74 65 73 74 2d 72 65 63 6f 72 64 "\n test-record
4540: 3d 22 20 74 65 73 74 2d 72 65 63 6f 72 64 20 22 =" test-record "
4550: 5c 6e 20 20 74 65 73 74 2d 6e 61 6d 65 3a 20 22 \n test-name: "
4560: 20 74 65 73 74 2d 6e 61 6d 65 20 22 5c 6e 20 20 test-name "\n
4570: 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 item-path: " ite
4580: 6d 2d 70 61 74 68 20 22 5c 6e 20 20 74 65 73 74 m-path "\n test
4590: 2d 70 61 74 74 73 3a 20 22 20 74 65 73 74 2d 70 -patts: " test-p
45a0: 61 74 74 73 29 0a 0a 09 09 3b 3b 20 44 6f 6e 27 atts)....;; Don'
45b0: 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74 t know at this t
45c0: 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 74 20 ime if the test
45d0: 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68 have been launch
45e0: 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20 ed at some time
45f0: 69 6e 20 74 68 65 20 70 61 73 74 0a 09 09 3b 3b in the past...;;
4600: 20 69 2e 65 2e 20 69 73 20 74 68 69 73 20 61 20 i.e. is this a
4610: 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 28 64 65 re-launch?...(de
4620: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 bug:print-info 4
4630: 20 22 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 "run-limits-inf
4640: 6f 20 3d 20 22 20 72 75 6e 2d 6c 69 6d 69 74 73 o = " run-limits
4650: 2d 69 6e 66 6f 29 0a 09 09 28 63 6f 6e 64 20 3b -info)...(cond ;
4660: 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 31 20 ; INNER COND #1
4670: 66 6f 72 20 61 20 6c 61 75 6e 63 68 61 62 6c 65 for a launchable
4680: 20 74 65 73 74 0a 09 09 20 3b 3b 20 43 68 65 63 test... ;; Chec
4690: 6b 20 69 74 65 6d 20 70 61 74 68 20 61 67 61 69 k item path agai
46a0: 6e 73 74 20 69 74 65 6d 2d 70 61 74 74 73 0a 09 nst item-patts..
46b0: 09 20 28 28 6e 6f 74 20 28 74 65 73 74 73 3a 6d . ((not (tests:m
46c0: 61 74 63 68 20 74 65 73 74 2d 70 61 74 74 73 20 atch test-patts
46d0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
46e0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
46f0: 73 74 2d 72 65 63 6f 72 64 29 20 69 74 65 6d 2d st-record) item-
4700: 70 61 74 68 29 29 20 3b 3b 20 54 68 69 73 20 74 path)) ;; This t
4710: 65 73 74 2f 69 74 65 6d 70 61 74 68 20 69 73 20 est/itempath is
4720: 6e 6f 74 20 74 6f 20 62 65 20 72 75 6e 0a 09 09 not to be run...
4730: 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 75 ;; else the ru
4740: 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d 70 n is stuck, temp
4750: 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d 61 orarily or perma
4760: 6e 65 6e 74 6c 79 0a 09 09 20 20 3b 3b 20 62 75 nently... ;; bu
4770: 74 20 73 68 6f 75 6c 64 20 63 68 65 63 6b 20 69 t should check i
4780: 66 20 69 74 20 69 73 20 64 75 65 20 74 6f 20 6c f it is due to l
4790: 61 63 6b 20 6f 66 20 72 65 73 6f 75 72 63 65 73 ack of resources
47a0: 20 76 73 2e 20 70 72 65 72 65 71 75 69 73 69 74 vs. prerequisit
47b0: 65 73 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 es... (debug:pr
47c0: 69 6e 74 2d 69 6e 66 6f 20 31 20 22 53 6b 69 70 int-info 1 "Skip
47d0: 70 69 6e 67 20 22 20 28 74 65 73 74 73 3a 74 65 ping " (tests:te
47e0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 stqueue-get-test
47f0: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
4800: 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 20 ) " " item-path
4810: 22 20 61 73 20 69 74 20 64 6f 65 73 6e 27 74 20 " as it doesn't
4820: 6d 61 74 63 68 20 22 20 74 65 73 74 2d 70 61 74 match " test-pat
4830: 74 73 29 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 ts)... ;; (thre
4840: 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 ad-sleep! *globa
4850: 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 l-delta*)... (i
4860: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 f (not (null? ta
4870: 6c 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f l))... (loo
4880: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 p (car tal)(cdr
4890: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 tal) reruns)))..
48a0: 09 20 3b 3b 20 52 65 67 69 73 74 65 72 79 20 68 . ;; Registery h
48b0: 61 73 20 62 65 65 6e 20 73 74 61 72 74 65 64 20 as been started
48c0: 66 6f 72 20 74 68 69 73 20 74 65 73 74 20 62 75 for this test bu
48d0: 74 20 68 61 73 20 6e 6f 74 20 79 65 74 20 63 6f t has not yet co
48e0: 6d 70 6c 65 74 65 64 0a 09 09 20 3b 3b 20 74 68 mpleted... ;; th
48f0: 69 73 20 73 68 6f 75 6c 64 20 62 65 20 72 61 72 is should be rar
4900: 65 2c 20 74 68 65 20 63 61 73 65 20 77 68 65 72 e, the case wher
4910: 65 20 74 68 65 72 65 20 61 72 65 20 6f 6e 6c 79 e there are only
4920: 20 61 20 63 6f 75 70 6c 65 20 6f 66 20 74 65 73 a couple of tes
4930: 74 73 20 61 6e 64 20 74 68 65 20 64 62 20 69 73 ts and the db is
4940: 20 73 6c 6f 77 0a 09 09 20 3b 3b 20 64 65 6c 61 slow... ;; dela
4950: 79 20 61 20 73 68 6f 72 74 20 77 68 69 6c 65 20 y a short while
4960: 61 6e 64 20 63 6f 6e 74 69 6e 75 65 0a 09 09 20 and continue...
4970: 28 28 65 71 3f 20 28 68 61 73 68 2d 74 61 62 6c ((eq? (hash-tabl
4980: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 e-ref/default te
4990: 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 st-registery (ru
49a0: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 ns:make-full-tes
49b0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 t-name test-name
49c0: 20 69 74 65 6d 2d 70 61 74 68 29 20 23 66 29 20 item-path) #f)
49d0: 27 73 74 61 72 74 29 0a 09 09 20 20 28 74 68 72 'start)... (thr
49e0: 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 30 31 29 ead-sleep! 0.01)
49f0: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 ... (loop (car
4a00: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 newtal)(cdr newt
4a10: 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 20 al) reruns))...
4a20: 28 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c ((not (hash-tabl
4a30: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 e-ref/default te
4a40: 73 74 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 st-registery (ru
4a50: 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 ns:make-full-tes
4a60: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 t-name test-name
4a70: 20 69 74 65 6d 2d 70 61 74 68 29 20 23 66 29 29 item-path) #f))
4a80: 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ... (debug:prin
4a90: 74 2d 69 6e 66 6f 20 34 20 22 50 72 65 2d 72 65 t-info 4 "Pre-re
4aa0: 67 69 73 74 65 72 69 6e 67 20 74 65 73 74 20 22 gistering test "
4ab0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 test-name "/" i
4ac0: 74 65 6d 2d 70 61 74 68 20 22 20 74 6f 20 63 72 tem-path " to cr
4ad0: 65 61 74 65 20 70 6c 61 63 65 68 6f 6c 64 65 72 eate placeholder
4ae0: 22 20 29 0a 09 09 20 20 3b 3b 20 4e 45 45 44 20 " )... ;; NEED
4af0: 54 4f 20 54 48 52 45 41 44 49 46 59 20 54 48 49 TO THREADIFY THI
4b00: 53 0a 09 09 20 20 28 6c 65 74 20 28 28 74 68 20 S... (let ((th
4b10: 28 6d 61 6b 65 2d 74 68 72 65 61 64 20 28 6c 61 (make-thread (la
4b20: 6d 62 64 61 20 28 29 0a 09 09 20 20 20 20 20 20 mbda ()...
4b30: 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f .. (mutex-lo
4b40: 63 6b 21 20 72 65 67 69 73 74 65 72 79 2d 6d 75 ck! registery-mu
4b50: 74 65 78 29 0a 09 09 20 20 20 20 20 20 20 20 09 tex)... .
4b60: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d . (hash-table-
4b70: 73 65 74 21 20 74 65 73 74 2d 72 65 67 69 73 74 set! test-regist
4b80: 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 ery (runs:make-f
4b90: 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 ull-test-name te
4ba0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
4bb0: 68 29 20 27 73 74 61 72 74 29 0a 09 09 20 20 20 h) 'start)...
4bc0: 20 20 20 20 20 09 09 20 20 20 28 6d 75 74 65 78 .. (mutex
4bd0: 2d 75 6e 6c 6f 63 6b 21 20 72 65 67 69 73 74 65 -unlock! registe
4be0: 72 79 2d 6d 75 74 65 78 29 0a 09 09 20 20 20 20 ry-mutex)...
4bf0: 20 20 09 09 20 20 20 28 63 64 62 3a 74 65 73 74 .. (cdb:test
4c00: 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 s-register-test
4c10: 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 72 75 6e 2d *runremote* run-
4c20: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
4c30: 6d 2d 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 m-path)...
4c40: 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f .. (mutex-lo
4c50: 63 6b 21 20 72 65 67 69 73 74 65 72 79 2d 6d 75 ck! registery-mu
4c60: 74 65 78 29 0a 09 09 20 20 20 20 20 20 09 09 20 tex)... ..
4c70: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 (hash-table-se
4c80: 74 21 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 t! test-register
4c90: 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c y (runs:make-ful
4ca0: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 l-test-name test
4cb0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
4cc0: 20 27 64 6f 6e 65 29 0a 09 09 20 20 20 20 20 20 'done)...
4cd0: 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d 75 6e .. (mutex-un
4ce0: 6c 6f 63 6b 21 20 72 65 67 69 73 74 65 72 79 2d lock! registery-
4cf0: 6d 75 74 65 78 29 29 0a 09 09 20 20 20 20 20 20 mutex))...
4d00: 20 20 09 09 20 28 63 6f 6e 63 20 74 65 73 74 2d .. (conc test-
4d10: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
4d20: 74 68 29 29 29 29 0a 09 09 20 20 20 20 28 74 68 th))))... (th
4d30: 72 65 61 64 2d 73 74 61 72 74 21 20 74 68 29 29 read-start! th))
4d40: 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 ... (thread-sle
4d50: 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 ep! *global-delt
4d60: 61 2a 29 0a 09 09 20 20 28 72 75 6e 73 3a 73 68 a*)... (runs:sh
4d70: 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 rink-can-run-mor
4d80: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 20 20 e-tests-delay)
4d90: 20 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b 45 ;; DELAY TWEAKE
4da0: 52 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64 3f R (still needed?
4db0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 )... (loop (car
4dc0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 newtal)(cdr new
4dd0: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 tal) reruns))...
4de0: 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e ;; At this poin
4df0: 74 20 2a 61 6c 6c 2a 20 74 65 73 74 20 72 65 67 t *all* test reg
4e00: 69 73 74 72 61 74 69 6f 6e 73 20 6d 75 73 74 20 istrations must
4e10: 62 65 20 63 6f 6d 70 6c 65 74 65 64 2e 0a 09 09 be completed....
4e20: 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 28 66 ((not (null? (f
4e30: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 ilter (lambda (x
4e40: 29 28 6e 6f 74 20 28 65 71 3f 20 27 64 6f 6e 65 )(not (eq? 'done
4e50: 20 78 29 29 29 20 28 68 61 73 68 2d 74 61 62 6c x))) (hash-tabl
4e60: 65 2d 76 61 6c 75 65 73 20 74 65 73 74 2d 72 65 e-values test-re
4e70: 67 69 73 74 65 72 79 29 29 29 29 0a 09 09 20 20 gistery))))...
4e80: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
4e90: 6f 20 30 20 22 57 61 69 74 69 6e 67 20 6f 6e 20 o 0 "Waiting on
4ea0: 74 65 73 74 20 72 65 67 69 73 74 72 61 74 69 6f test registratio
4eb0: 6e 73 3a 20 22 20 28 73 74 72 69 6e 67 2d 69 6e ns: " (string-in
4ec0: 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 tersperse ......
4ed0: 09 09 09 09 20 28 66 69 6c 74 65 72 20 28 6c 61 .... (filter (la
4ee0: 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 mbda (x)........
4ef0: 09 09 09 20 20 20 28 6e 6f 74 20 28 65 71 3f 20 ... (not (eq?
4f00: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
4f10: 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 67 default test-reg
4f20: 69 73 74 65 72 79 20 78 20 23 66 29 20 27 64 6f istery x #f) 'do
4f30: 6e 65 29 29 29 0a 09 09 09 09 09 09 09 09 09 09 ne)))...........
4f40: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 (hash-table-key
4f50: 73 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 79 s test-registery
4f60: 29 29 0a 09 09 09 09 09 09 09 09 09 20 22 2c 20 )).......... ",
4f70: 22 29 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d "))... (thread-
4f80: 73 6c 65 65 70 21 20 30 2e 31 29 0a 09 09 20 20 sleep! 0.1)...
4f90: 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 (loop hed tal re
4fa0: 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74 20 runs))... ((not
4fb0: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29 20 have-resources)
4fc0: 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61 67 ;; simply try ag
4fd0: 61 69 6e 20 61 66 74 65 72 20 77 61 69 74 69 6e ain after waitin
4fe0: 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20 28 g a second... (
4ff0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f debug:print-info
5000: 20 31 20 22 6e 6f 20 72 65 73 6f 75 72 63 65 73 1 "no resources
5010: 20 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74 to run new test
5020: 73 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 s, waiting ...")
5030: 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d ... ;; (thread-
5040: 73 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f sleep! (+ 2 *glo
5050: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 bal-delta*))...
5060: 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 ;; could have d
5070: 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 one hed tal here
5080: 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 but doing car/c
5090: 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 dr of newtal to
50a0: 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 rotate tests...
50b0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 (loop (car newt
50c0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 al)(cdr newtal)
50d0: 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61 6e reruns))... ((an
50e0: 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 d have-resources
50f0: 0a 09 09 20 20 20 20 20 20 20 28 6f 72 20 28 6e ... (or (n
5100: 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 ull? prereqs-not
5110: 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e 64 -met).... (and
5120: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 (eq? testmode '
5130: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e toplevel).....(n
5140: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 ull? non-complet
5150: 65 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e 3a ed))))... (run:
5160: 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e test run-id runn
5170: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 ame keyvallst te
5180: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 st-record flags
5190: 23 66 29 0a 09 09 20 20 28 72 75 6e 73 3a 73 68 #f)... (runs:sh
51a0: 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 rink-can-run-mor
51b0: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 20 20 e-tests-delay)
51c0: 3b 3b 20 44 45 4c 41 59 20 54 57 45 41 4b 45 52 ;; DELAY TWEAKER
51d0: 20 28 73 74 69 6c 6c 20 6e 65 65 64 65 64 3f 29 (still needed?)
51e0: 0a 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d ... ;; (thread-
51f0: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 sleep! *global-d
5200: 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20 28 elta*)... (if (
5210: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 not (null? tal))
5220: 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 ... (loop (
5230: 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c car tal)(cdr tal
5240: 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 28 ) reruns)))... (
5250: 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 else ;; must be
5260: 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70 72 we have unmet pr
5270: 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 erequisites...
5280: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
5290: 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 "FAILS: " fails
52a0: 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e )... ;; If on
52b0: 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 e or more of the
52c0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
52d0: 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20 77 are FAIL then w
52e0: 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20 20 e can issue...
52f0: 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 61 ;; a message a
5300: 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f 6d nd drop hed from
5310: 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62 65 the items to be
5320: 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 processed....
5330: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 (if (null? fai
5340: 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 ls)....(begin...
5350: 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 . ;; couldn't r
5360: 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 un, take a breat
5370: 68 65 72 0a 09 09 09 20 20 28 64 65 62 75 67 3a her.... (debug:
5380: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 53 68 print-info 4 "Sh
5390: 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20 67 ouldn't really g
53a0: 65 74 20 68 65 72 65 2c 20 72 61 63 65 20 63 6f et here, race co
53b0: 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 ndition? Unable
53c0: 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74 to launch more t
53d0: 65 73 74 73 20 61 74 20 74 68 69 73 20 6d 6f 6d ests at this mom
53e0: 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d ent, killing tim
53f0: 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 3b 3b 20 e ...").... ;;
5400: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 (thread-sleep! (
5410: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 + 0.01 *global-d
5420: 65 6c 74 61 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 elta*)) ;; long
5430: 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 sleep here - no
5440: 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 resources, may a
5450: 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e s well be patien
5460: 74 0a 09 09 09 20 20 3b 3b 20 77 65 20 6d 61 64 t.... ;; we mad
5470: 65 20 6e 65 77 20 74 61 6c 20 62 79 20 73 74 69 e new tal by sti
5480: 63 6b 69 6e 67 20 68 65 64 20 61 74 20 74 68 65 cking hed at the
5490: 20 62 61 63 6b 20 6f 66 20 74 68 65 20 6c 69 73 back of the lis
54a0: 74 0a 09 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 t.... (loop (ca
54b0: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 r newtal)(cdr ne
54c0: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 wtal) reruns))..
54d0: 09 09 3b 3b 20 74 68 65 20 77 61 69 74 6f 6e 20 ..;; the waiton
54e0: 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f 20 70 6f is FAIL so no po
54f0: 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 20 74 6f int in trying to
5500: 20 72 75 6e 20 68 65 64 20 65 76 65 72 20 61 67 run hed ever ag
5510: 61 69 6e 0a 09 09 09 28 69 66 20 28 6e 6f 74 20 ain....(if (not
5520: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 (null? tal))....
5530: 20 20 20 20 28 69 66 20 28 76 65 63 74 6f 72 3f (if (vector?
5540: 20 68 65 64 29 0a 09 09 09 09 28 62 65 67 69 6e hed).....(begin
5550: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5560: 22 57 41 52 4e 3a 20 44 72 6f 70 70 69 6e 67 20 "WARN: Dropping
5570: 74 65 73 74 20 22 20 28 64 62 3a 74 65 73 74 2d test " (db:test-
5580: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 68 65 64 get-testname hed
5590: 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 ) "/" (db:test-g
55a0: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 68 65 64 et-item-path hed
55b0: 29 0a 09 09 09 09 09 09 20 20 20 20 22 20 66 72 )....... " fr
55c0: 6f 6d 20 74 68 65 20 6c 61 75 6e 63 68 20 6c 69 om the launch li
55d0: 73 74 20 61 73 20 69 74 20 68 61 73 20 70 72 65 st as it has pre
55e0: 72 65 71 75 69 73 74 65 73 20 74 68 61 74 20 61 requistes that a
55f0: 72 65 20 46 41 49 4c 22 29 0a 28 72 75 6e 73 3a re FAIL").(runs:
5600: 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d 6d shrink-can-run-m
5610: 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 29 ore-tests-delay)
5620: 0a 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 28 ..... ;; (
5630: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
5640: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
5650: 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 .. (loop (
5660: 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c car tal)(cdr tal
5670: 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75 ) (cons hed reru
5680: 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67 69 6e ns))).....(begin
5690: 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 ..... (debug:pr
56a0: 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54 65 73 int 1 "WARN: Tes
56b0: 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65 64 20 t not processed
56c0: 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75 6c 64 correctly. Could
56d0: 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e 64 69 be a race condi
56e0: 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74 65 73 tion in your tes
56f0: 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e t implementation
5700: 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22 20 61 ? " hed) ;; " a
5710: 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75 s it has prerequ
5720: 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46 istes that are F
5730: 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65 64 20 AIL. (NOTE: hed
5740: 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 29 is not a vector)
5750: 22 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d ").(runs:shrink-
5760: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
5770: 74 73 2d 64 65 6c 61 79 29 0a 09 09 09 09 20 20 ts-delay).....
5780: 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 ;; (thread-sleep
5790: 21 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 ! (+ 0.01 *globa
57a0: 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 l-delta*)).....
57b0: 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 (loop hed tal r
57c0: 65 72 75 6e 73 29 29 29 29 29 29 29 29 29 20 3b eruns))))))))) ;
57d0: 3b 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 ; END OF INNER C
57e0: 4f 4e 44 0a 09 20 20 20 20 20 0a 09 20 20 20 20 OND.. ..
57f0: 20 3b 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 ;; case where a
5800: 6e 20 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 n items came in
5810: 61 73 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 as a list been p
5820: 72 6f 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 rocessed.. (
5830: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d (and (list? item
5840: 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 s) ;; thus w
5850: 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 e know our items
5860: 20 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c are already cal
5870: 63 75 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f culated... (no
5880: 74 20 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b t itemdat)) ;;
5890: 20 61 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 and not yet exp
58a0: 61 6e 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c anded into the l
58b0: 69 73 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f ist of things to
58c0: 20 62 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 be done..
58d0: 28 69 66 20 28 61 6e 64 20 28 64 65 62 75 67 3a (if (and (debug:
58e0: 64 65 62 75 67 2d 6d 6f 64 65 20 31 29 20 3b 3b debug-mode 1) ;;
58f0: 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a (>= *verbosity*
5900: 20 31 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 1)... (>
5910: 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 20 30 (length items) 0
5920: 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c )... (> (l
5930: 65 6e 67 74 68 20 28 63 61 72 20 69 74 65 6d 73 ength (car items
5940: 29 29 20 30 29 29 0a 09 09 20 20 28 70 70 20 69 )) 0))... (pp i
5950: 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 28 66 tems)).. (f
5960: 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20 20 or-each..
5970: 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 6d (lambda (my-item
5980: 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28 28 dat)... (let* ((
5990: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 new-test-record
59a0: 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28 6d (let ((newrec (m
59b0: 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71 75 ake-tests:testqu
59c0: 65 75 65 29 29 29 0a 09 09 09 09 09 20 20 20 28 eue)))...... (
59d0: 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 vector-copy! tes
59e0: 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 t-record newrec)
59f0: 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65 63 29 ...... newrec)
5a00: 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70 61 )....(my-item-pa
5a10: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 th (item-list->p
5a20: 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 29 ath my-itemdat))
5a30: 29 0a 09 09 20 20 20 28 69 66 20 28 74 65 73 74 )... (if (test
5a40: 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61 74 s:match test-pat
5a50: 74 73 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d 70 ts hed my-item-p
5a60: 61 74 68 29 20 3b 3b 20 28 70 61 74 74 2d 6c 69 ath) ;; (patt-li
5a70: 73 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74 65 6d st-match my-item
5a80: 2d 70 61 74 68 20 69 74 65 6d 2d 70 61 74 74 73 -path item-patts
5a90: 29 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 79 ) ;; y
5aa0: 65 73 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 es, we want to p
5ab0: 72 6f 63 65 73 73 20 74 68 69 73 20 69 74 65 6d rocess this item
5ac0: 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64 20 6e , NOTE: Should n
5ad0: 6f 74 20 6e 65 65 64 20 74 68 69 73 20 63 68 65 ot need this che
5ae0: 63 6b 20 68 65 72 65 21 0a 09 09 20 20 20 20 20 ck here!...
5af0: 20 20 28 6c 65 74 20 28 28 6e 65 77 74 65 73 74 (let ((newtest
5b00: 6e 61 6d 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d name (runs:make-
5b10: 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 68 full-test-name h
5b20: 65 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 ed my-item-path)
5b30: 29 29 20 20 20 20 3b 3b 20 74 65 73 74 20 6e 61 )) ;; test na
5b40: 6d 65 73 20 61 72 65 20 75 6e 69 71 75 65 20 6f mes are unique o
5b50: 6e 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 2d n testname/item-
5b60: 70 61 74 68 0a 09 09 09 20 28 74 65 73 74 73 3a path.... (tests:
5b70: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 testqueue-set-it
5b80: 65 6d 73 21 20 20 20 20 20 6e 65 77 2d 74 65 73 ems! new-tes
5b90: 74 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 09 09 t-record #f)....
5ba0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
5bb0: 65 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 20 e-set-itemdat!
5bc0: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 new-test-record
5bd0: 20 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 09 my-itemdat)....
5be0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
5bf0: 65 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74 68 21 e-set-item_path!
5c00: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 new-test-record
5c10: 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 0a 09 my-item-path)..
5c20: 09 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 .. (hash-table-s
5c30: 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 et! test-records
5c40: 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 newtestname new
5c50: 2d 74 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 -test-record)...
5c60: 09 20 28 73 65 74 21 20 74 61 6c 20 28 63 6f 6e . (set! tal (con
5c70: 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 74 61 s newtestname ta
5c80: 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e 63 65 l)))))) ;; since
5c90: 20 74 68 65 73 65 20 61 72 65 20 69 74 65 6d 69 these are itemi
5ca0: 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77 20 74 zed create new t
5cb0: 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74 6e 61 est names testna
5cc0: 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 20 20 me/itempath..
5cd0: 20 20 20 20 69 74 65 6d 73 29 0a 09 20 20 20 20 items)..
5ce0: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c (if (not (null
5cf0: 3f 20 74 61 6c 29 29 0a 09 09 20 20 28 62 65 67 ? tal))... (beg
5d00: 69 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a in... (debug:
5d10: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45 6e print-info 4 "En
5d20: 64 20 6f 66 20 69 74 65 6d 73 20 6c 69 73 74 2c d of items list,
5d30: 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20 6e 65 looping with ne
5d40: 78 74 20 61 66 74 65 72 20 73 68 6f 72 74 20 64 xt after short d
5d50: 65 6c 61 79 22 29 0a 20 20 20 20 20 20 20 20 20 elay").
5d60: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 28 74 ;; (t
5d70: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 hread-sleep! (+
5d80: 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 0.01 *global-del
5d90: 74 61 2a 29 29 0a 09 09 20 20 20 20 28 6c 6f 6f ta*))... (loo
5da0: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 p (car tal)(cdr
5db0: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 0a tal) reruns)))).
5dc0: 0a 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 .. ;; if ite
5dd0: 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 ms is a proc the
5de0: 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 n need to run it
5df0: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 ems:get-items-fr
5e00: 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 om-config, get t
5e10: 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 he list and loop
5e20: 20 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 .. ;; -
5e30: 62 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 but only do that
5e40: 20 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 if resources ex
5e50: 69 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 ist to kick off
5e60: 74 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 the job.. ((
5e70: 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 or (procedure? i
5e80: 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 tems)(eq? items
5e90: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 'have-procedure)
5ea0: 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 ).. (let ((
5eb0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 can-run-more
5ec0: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f (runs:can-run-mo
5ed0: 72 65 2d 74 65 73 74 73 20 74 65 73 74 2d 72 65 re-tests test-re
5ee0: 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20 28 61 cord)))...(if (a
5ef0: 6e 64 20 28 6c 69 73 74 3f 20 63 61 6e 2d 72 75 nd (list? can-ru
5f00: 6e 2d 6d 6f 72 65 29 0a 09 09 09 20 28 63 61 72 n-more).... (car
5f10: 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 29 0a can-run-more)).
5f20: 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 70 72 .. (let* ((pr
5f30: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 6f ereqs-not-met (o
5f40: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
5f50: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 :get-prereqs-not
5f60: 2d 6d 65 74 20 23 66 20 72 75 6e 2d 69 64 20 77 -met #f run-id w
5f70: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 aitons item-path
5f80: 20 6d 6f 64 65 3a 20 74 65 73 74 6d 6f 64 65 29 mode: testmode)
5f90: 29 0a 09 09 09 20 20 20 28 66 61 69 6c 73 20 20 ).... (fails
5fa0: 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 (runs:c
5fb0: 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 alc-fails prereq
5fc0: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 09 20 s-not-met))....
5fd0: 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 (non-completed
5fe0: 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f (runs:calc-no
5ff0: 74 2d 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 t-completed prer
6000: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 eqs-not-met)))..
6010: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
6020: 69 6e 74 2d 69 6e 66 6f 20 38 20 22 63 61 6e 2d int-info 8 "can-
6030: 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d run-more: " can-
6040: 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20 run-more.....
6050: 22 5c 6e 20 74 65 73 74 6e 61 6d 65 3a 20 20 20 "\n testname:
6060: 20 20 20 20 20 22 20 68 65 64 0a 09 09 09 09 20 " hed.....
6070: 20 20 22 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f "\n prereqs-no
6080: 74 2d 6d 65 74 3a 20 22 20 28 72 75 6e 73 3a 70 t-met: " (runs:p
6090: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 70 72 65 retty-string pre
60a0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 reqs-not-met)...
60b0: 09 09 20 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d .. "\n non-com
60c0: 70 6c 65 74 65 64 3a 20 20 20 22 20 28 72 75 6e pleted: " (run
60d0: 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 s:pretty-string
60e0: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a non-completed) .
60f0: 09 09 09 09 20 20 20 22 5c 6e 20 66 61 69 6c 73 .... "\n fails
6100: 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 28 72 : " (r
6110: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e uns:pretty-strin
6120: 67 20 66 61 69 6c 73 29 0a 09 09 09 09 20 20 20 g fails).....
6130: 22 5c 6e 20 74 65 73 74 6d 6f 64 65 3a 20 20 20 "\n testmode:
6140: 20 20 20 20 20 22 20 74 65 73 74 6d 6f 64 65 0a " testmode.
6150: 09 09 09 09 20 20 20 22 5c 6e 20 6e 75 6d 2d 72 .... "\n num-r
6160: 65 74 72 69 65 73 3a 20 20 20 20 20 22 20 6e 75 etries: " nu
6170: 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 09 20 20 m-retries.....
6180: 20 22 5c 6e 20 28 65 71 3f 20 74 65 73 74 6d 6f "\n (eq? testmo
6190: 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 3a 20 22 de 'toplevel): "
61a0: 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 (eq? testmode '
61b0: 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 20 toplevel).....
61c0: 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d "\n (null? non-
61d0: 63 6f 6d 70 6c 65 74 65 64 29 3a 20 20 20 20 22 completed): "
61e0: 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 (null? non-comp
61f0: 6c 65 74 65 64 29 0a 09 09 09 09 20 20 20 22 5c leted)..... "\
6200: 6e 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 20 n reruns:
6210: 20 20 20 22 20 72 65 72 75 6e 73 0a 09 09 09 09 " reruns.....
6220: 20 20 20 22 5c 6e 20 69 74 65 6d 73 3a 20 20 20 "\n items:
6230: 20 20 20 20 20 20 20 20 22 20 69 74 65 6d 73 0a " items.
6240: 09 09 09 09 20 20 20 22 5c 6e 20 63 61 6e 2d 72 .... "\n can-r
6250: 75 6e 2d 6d 6f 72 65 3a 20 20 20 20 22 20 63 61 un-more: " ca
6260: 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 20 20 n-run-more)...
6270: 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 ;; (thread-s
6280: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 leep! (+ 0.01 *g
6290: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 lobal-delta*))..
62a0: 09 20 20 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 . (cond ;;
62b0: 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32 0a 09 09 INNER COND #2...
62c0: 20 20 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c ((or (nul
62d0: 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d l? prereqs-not-m
62e0: 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65 et) ;; all prere
62f0: 71 73 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66 qs met, fire off
6300: 20 74 68 65 20 74 65 73 74 0a 09 09 09 20 20 20 the test....
6310: 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73 ;; or, if it is
6320: 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73 a 'toplevel tes
6330: 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71 t and all prereq
6340: 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f s not met are CO
6350: 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75 MPLETED then lau
6360: 6e 63 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20 nch.... (and
6370: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 (eq? testmode 't
6380: 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e oplevel)..... (n
6390: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 ull? non-complet
63a0: 65 64 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28 ed)))....(let ((
63b0: 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 test-name (tests
63c0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
63d0: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 estname test-rec
63e0: 6f 72 64 29 29 29 0a 09 09 09 20 20 28 73 65 74 ord))).... (set
63f0: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d env "MT_TEST_NAM
6400: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b E" test-name) ;;
6410: 20 0a 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 .... (setenv "
6420: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 MT_RUNNAME" ru
6430: 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 73 65 74 nname).... (set
6440: 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 -megatest-env-va
6450: 72 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 rs run-id) ;; th
6460: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 ese may be neede
6470: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 d by the launchi
6480: 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09 20 20 ng process....
6490: 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 (let ((items-lis
64a0: 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 t (items:get-ite
64b0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 ms-from-config t
64c0: 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20 20 20 config)))....
64d0: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d (if (list? item
64e0: 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62 65 67 s-list).....(beg
64f0: 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74 73 3a in..... (tests:
6500: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 testqueue-set-it
6510: 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 ems! test-record
6520: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 items-list)....
6530: 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c . ;; (thread-sl
6540: 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c eep! *global-del
6550: 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 ta*)..... (loop
6560: 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 hed tal reruns)
6570: 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 ).....(begin....
6580: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
6590: 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72 0 "ERROR: The pr
65a0: 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 oc from reading
65b0: 74 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f the setup did no
65c0: 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d t yield a list -
65d0: 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 please report t
65e0: 68 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 69 his")..... (exi
65f0: 74 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 20 t 1))))))...
6600: 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 ((null? fails
6610: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e )....(debug:prin
6620: 74 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c 73 20 t-info 4 "fails
6630: 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 is null, moving
6640: 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 75 65 20 on in the queue
6650: 62 75 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65 but keeping " he
6660: 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09 d " for now")...
6670: 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65 6d 65 .;; only increme
6680: 6e 74 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 77 nt num-retries w
6690: 68 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e 6f hen there are no
66a0: 20 74 65 73 74 73 20 72 75 6e 69 6e 67 0a 09 09 tests runing...
66b0: 09 28 69 66 20 28 65 71 3f 20 30 20 28 6c 69 73 .(if (eq? 0 (lis
66c0: 74 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d 6d 6f t-ref can-run-mo
66d0: 72 65 20 31 29 29 0a 09 09 09 20 20 20 20 28 62 re 1)).... (b
66e0: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 69 egin.... (i
66f0: 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 f (> num-retries
6700: 20 31 30 30 29 20 3b 3b 20 66 69 72 73 74 20 31 100) ;; first 1
6710: 30 30 20 72 65 74 72 69 65 73 20 61 72 65 20 6c 00 retries are l
6720: 6f 77 20 74 69 6d 65 20 63 6f 73 74 0a 09 09 09 ow time cost....
6730: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 . (thread-sleep
6740: 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 ! (+ 2 *global-d
6750: 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 74 elta*))..... (t
6760: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 hread-sleep! (+
6770: 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 0.01 *global-del
6780: 74 61 2a 29 29 29 0a 09 09 09 20 20 20 20 20 20 ta*)))....
6790: 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 (set! num-retrie
67a0: 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 s (+ num-retries
67b0: 20 31 29 29 29 29 0a 09 09 09 28 69 66 20 28 3e 1))))....(if (>
67c0: 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 6d 61 num-retries ma
67d0: 78 2d 72 65 74 72 69 65 73 29 0a 09 09 09 20 20 x-retries)....
67e0: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c (if (not (null
67f0: 3f 20 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f 6f ? tal)).....(loo
6800: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 p (car tal)(cdr
6810: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 09 tal) reruns))...
6820: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 . (loop (car
6830: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 newtal)(cdr newt
6840: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 20 3b 3b al) reruns))) ;;
6850: 20 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 an issue with p
6860: 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d rereqs not yet m
6870: 65 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 et?... ((a
6880: 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 nd (not (null? f
6890: 61 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d ails))(eq? testm
68a0: 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 ode 'normal))...
68b0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e .(debug:print-in
68c0: 66 6f 20 31 20 22 74 65 73 74 20 22 20 20 68 65 fo 1 "test " he
68d0: 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 74 d " (mode=" test
68e0: 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 6c mode ") has fail
68f0: 65 64 20 70 72 65 72 65 71 75 69 73 69 74 65 28 ed prerequisite(
6900: 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 28 s); "..... (
6910: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
6920: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 se (map (lambda
6930: 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 (t)(conc (db:tes
6940: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
6950: 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 ) ":" (db:test-g
6960: 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 64 et-state t)"/"(d
6970: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 b:test-get-statu
6980: 73 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 2c s t))) fails) ",
6990: 20 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c 20 ")..... ",
69a0: 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f 6d removing it from
69b0: 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 09 to-do list")...
69c0: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f .(if (not (null?
69d0: 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 62 tal)).... (b
69e0: 65 67 69 6e 0a 20 20 20 20 20 20 20 20 20 20 20 egin.
69f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6a00: 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c ;; (thread-sl
6a10: 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c eep! *global-del
6a20: 74 61 2a 29 0a 09 09 09 20 20 20 20 20 20 28 6c ta*).... (l
6a30: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 oop (car tal)(cd
6a40: 72 20 74 61 6c 29 28 63 6f 6e 73 20 68 65 64 20 r tal)(cons hed
6a50: 72 65 72 75 6e 73 29 29 29 29 29 0a 09 09 20 20 reruns)))))...
6a60: 20 20 20 20 20 28 65 6c 73 65 0a 09 09 09 28 64 (else....(d
6a70: 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 45 52 ebug:print 8 "ER
6a80: 52 4f 52 3a 20 4e 6f 20 68 61 6e 64 6c 65 72 20 ROR: No handler
6a90: 66 6f 72 20 74 68 69 73 20 63 6f 6e 64 69 74 69 for this conditi
6aa0: 6f 6e 2e 22 29 0a 09 09 09 28 74 68 72 65 61 64 on.")....(thread
6ab0: 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c -sleep! (+ 1 *gl
6ac0: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 obal-delta*))...
6ad0: 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 .(loop (car newt
6ae0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 al)(cdr newtal)
6af0: 72 65 72 75 6e 73 29 29 29 29 20 3b 3b 20 45 4e reruns)))) ;; EN
6b00: 44 20 4f 46 20 49 46 20 43 41 4e 20 52 55 4e 20 D OF IF CAN RUN
6b10: 4d 4f 52 45 0a 0a 09 09 20 20 20 20 3b 3b 20 69 MORE.... ;; i
6b20: 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 f can't run more
6b30: 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20 just loop with
6b40: 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65 next possible te
6b50: 73 74 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a st... (begin.
6b60: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
6b70: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 70 72 6f rint-info 4 "pro
6b80: 63 65 73 73 69 6e 67 20 74 68 65 20 63 61 73 65 cessing the case
6b90: 20 77 69 74 68 20 61 20 6c 61 6d 62 64 61 20 66 with a lambda f
6ba0: 6f 72 20 69 74 65 6d 73 20 6f 72 20 27 68 61 76 or items or 'hav
6bb0: 65 2d 70 72 6f 63 65 64 75 72 65 2e 20 4d 6f 76 e-procedure. Mov
6bc0: 69 6e 67 20 74 68 72 6f 75 67 68 20 74 68 65 20 ing through the
6bd0: 71 75 65 75 65 20 77 69 74 68 6f 75 74 20 64 72 queue without dr
6be0: 6f 70 70 69 6e 67 20 22 20 68 65 64 29 0a 09 09 opping " hed)...
6bf0: 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 ;; (thread
6c00: 2d 73 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c -sleep! (+ 2 *gl
6c10: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 obal-delta*))...
6c20: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 (loop (car
6c30: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 newtal)(cdr new
6c40: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 29 tal) reruns)))))
6c50: 20 3b 3b 20 45 4e 44 20 4f 46 20 28 6f 72 20 28 ;; END OF (or (
6c60: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
6c70: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 )(eq? items 'hav
6c80: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 e-procedure))..
6c90: 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 68 .. ;; th
6ca0: 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e is case should n
6cb0: 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 ot happen, added
6cc0: 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 to help catch a
6cd0: 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 28 ny bugs.. ((
6ce0: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 and (list? items
6cf0: 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20 ) itemdat)..
6d00: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
6d10: 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 "ERROR: Should
6d20: 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20 not have a list
6d30: 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65 of items in a te
6d40: 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73 st and the items
6d50: 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73 path set - pleas
6d60: 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a e report this").
6d70: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 . (exit 1))
6d80: 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 .. ((not (nu
6d90: 6c 6c 3f 20 72 65 72 75 6e 73 29 29 0a 09 20 20 ll? reruns))..
6da0: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 6c (let* ((newl
6db0: 73 74 20 28 74 65 73 74 73 3a 66 69 6c 74 65 72 st (tests:filter
6dc0: 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 72 75 -non-runnable ru
6dd0: 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 2d 72 65 n-id tal test-re
6de0: 63 6f 72 64 73 29 29 20 3b 3b 20 69 2e 65 2e 20 cords)) ;; i.e.
6df0: 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44 not FAIL, WAIVED
6e00: 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 , INCOMPLETE, PA
6e10: 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 20 20 SS, KILLED,...
6e20: 20 20 20 28 6a 75 6e 6b 65 64 20 28 6c 73 65 74 (junked (lset
6e30: 2d 64 69 66 66 65 72 65 6e 63 65 20 65 71 75 61 -difference equa
6e40: 6c 3f 20 74 61 6c 20 6e 65 77 6c 73 74 29 29 29 l? tal newlst)))
6e50: 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d ...(debug:print-
6e60: 69 6e 66 6f 20 34 20 22 66 75 6c 6c 20 64 72 6f info 4 "full dro
6e70: 70 20 74 68 72 6f 75 67 68 2c 20 69 66 20 72 65 p through, if re
6e80: 72 75 6e 73 20 69 73 20 6c 65 73 73 20 74 68 61 runs is less tha
6e90: 6e 20 31 30 30 20 77 65 20 77 69 6c 6c 20 66 6f n 100 we will fo
6ea0: 72 63 65 20 72 65 74 72 79 20 74 68 65 6d 2c 20 rce retry them,
6eb0: 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 20 reruns=" reruns
6ec0: 22 2c 20 74 61 6c 3d 22 20 74 61 6c 29 0a 09 09 ", tal=" tal)...
6ed0: 28 69 66 20 28 3c 20 6e 75 6d 2d 72 65 74 72 69 (if (< num-retri
6ee0: 65 73 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a es max-retries).
6ef0: 09 09 20 20 20 20 28 73 65 74 21 20 6e 65 77 6c .. (set! newl
6f00: 73 74 20 28 61 70 70 65 6e 64 20 72 65 72 75 6e st (append rerun
6f10: 73 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 73 s newlst)))...(s
6f20: 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 et! num-retries
6f30: 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 31 (+ num-retries 1
6f40: 29 29 0a 09 09 3b 3b 20 28 74 68 72 65 61 64 2d ))...;; (thread-
6f50: 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f sleep! (+ 1 *glo
6f60: 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 28 bal-delta*))...(
6f70: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 6e if (not (null? n
6f80: 65 77 6c 73 74 29 29 0a 09 09 20 20 20 20 3b 3b ewlst))... ;;
6f90: 20 73 69 6e 63 65 20 72 65 72 75 6e 73 20 68 61 since reruns ha
6fa0: 76 65 20 62 65 65 6e 20 74 61 63 6b 65 64 20 6f ve been tacked o
6fb0: 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63 72 65 61 n to newlst crea
6fc0: 74 65 20 6e 65 77 20 72 65 72 75 6e 73 20 66 72 te new reruns fr
6fd0: 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 20 20 20 om junked...
6fe0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c 73 (loop (car newls
6ff0: 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 28 64 t)(cdr newlst)(d
7000: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 elete-duplicates
7010: 20 6a 75 6e 6b 65 64 29 29 29 29 29 0a 09 20 20 junked)))))..
7020: 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 ((not (null?
7030: 74 61 6c 29 29 0a 09 20 20 20 20 20 20 28 64 65 tal)).. (de
7040: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 bug:print-info 4
7050: 20 22 49 27 6d 20 70 72 65 74 74 79 20 73 75 72 "I'm pretty sur
7060: 65 20 49 20 73 68 6f 75 6c 64 6e 27 74 20 67 65 e I shouldn't ge
7070: 74 20 68 65 72 65 2e 22 29 29 0a 09 20 20 20 20 t here."))..
7080: 20 28 65 6c 73 65 0a 09 20 20 20 20 20 20 28 64 (else.. (d
7090: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
70a0: 34 20 22 45 78 69 74 69 6e 67 20 6c 6f 6f 70 20 4 "Exiting loop
70b0: 77 69 74 68 2e 2e 2e 5c 6e 20 20 68 65 64 3d 22 with...\n hed="
70c0: 20 68 65 64 20 22 5c 6e 20 20 74 61 6c 3d 22 20 hed "\n tal="
70d0: 74 61 6c 20 22 5c 6e 20 20 72 65 72 75 6e 73 3d tal "\n reruns=
70e0: 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20 20 20 " reruns))..
70f0: 20 29 29 29 29 20 3b 3b 20 4c 45 54 2a 20 28 28 )))) ;; LET* ((
7100: 74 65 73 74 2d 72 65 63 6f 72 64 0a 0a 20 20 20 test-record..
7110: 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 ;; we get here
7120: 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 on "drop through
7130: 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 " - loop for nex
7140: 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a t test in queue.
7150: 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 ;; FIXME!!!!
7160: 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 THIS SHOULD NOT
7170: 20 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 REQUIRE AN EXIT
7180: 21 21 21 21 21 21 21 0a 20 20 20 20 0a 20 20 20 !!!!!!!. .
7190: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
71a0: 66 6f 20 31 20 22 41 6c 6c 20 74 65 73 74 73 20 fo 1 "All tests
71b0: 6c 61 75 6e 63 68 65 64 22 29 0a 20 20 20 20 28 launched"). (
71c0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e thread-sleep! 0.
71d0: 35 29 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 5). ;; FIXME!
71e0: 20 54 68 69 73 20 68 61 72 73 68 20 65 78 69 74 This harsh exit
71f0: 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e should not be n
7200: 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a 20 20 20 ecessary.....
7210: 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 2a 72 75 ;; (if (not *ru
7220: 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 nremote*)(exit))
7230: 20 3b 3b 20 0a 20 20 20 20 23 66 29 29 20 3b 3b ;; . #f)) ;;
7240: 20 72 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 return a #f as
7250: 61 20 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 a hint that we a
7260: 72 65 20 64 6f 6e 65 0a 20 20 3b 3b 20 48 65 72 re done. ;; Her
7270: 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 e we need to che
7280: 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 ck that all the
7290: 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 tests remaining
72a0: 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c to be run are el
72b0: 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a 20 20 igible to run.
72c0: 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 ;; and are not b
72d0: 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 locked by failed
72e0: 0a 20 20 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 . ..;; parent-t
72f0: 65 73 74 20 69 73 20 74 68 65 72 65 20 61 73 20 est is there as
7300: 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f a placeholder fo
7310: 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d 74 65 r when parent-te
7320: 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e 20 61 sts can be run a
7330: 73 20 61 20 73 65 74 75 70 20 73 74 65 70 0a 28 s a setup step.(
7340: 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 define (run:test
7350: 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 run-id runname
7360: 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 keyvallst test-r
7370: 65 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 ecord flags pare
7380: 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c nt-test). ;; Al
7390: 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 l these vars mig
73a0: 68 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 ht be referenced
73b0: 20 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 by the testconf
73c0: 69 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 ig file reader.
73d0: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 (let* ((test-na
73e0: 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 me (tests:tes
73f0: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e tqueue-get-testn
7400: 61 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 ame test-recor
7410: 64 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 d)).. (test-wait
7420: 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 ons (tests:testq
7430: 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 ueue-get-waitons
7440: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 test-record)
7450: 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 ).. (test-conf
7460: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
7470: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ue-get-testconfi
7480: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a g test-record)).
7490: 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 . (itemdat
74a0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
74b0: 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 -get-itemdat
74c0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
74d0: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 (test-path (c
74e0: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
74f0: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d tests/" test-nam
7500: 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 e)) ;; could use
7510: 20 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 tests:get-testc
7520: 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 onfig here .....
7530: 20 28 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 (force (
7540: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
7550: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 efault flags "-f
7560: 6f 72 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 orce" #f)).. (re
7570: 72 75 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 run (hash
7580: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
7590: 6c 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e lt flags "-rerun
75a0: 22 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f " #f)).. (keepgo
75b0: 69 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 ing (hash-tab
75c0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
75d0: 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 lags "-keepgoing
75e0: 22 20 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 " #f)).. (item-p
75f0: 61 74 68 20 20 20 20 20 22 22 29 0a 09 20 28 64 ath "").. (d
7600: 62 20 20 20 20 20 20 20 20 20 20 20 23 66 29 29 b #f))
7610: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
7620: 74 20 34 0a 09 09 20 22 74 65 73 74 2d 63 6f 6e t 4... "test-con
7630: 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74 61 62 fig: " (hash-tab
7640: 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 63 le->alist test-c
7650: 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 69 74 onf)... "\n it
7660: 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 61 74 emdat: " itemdat
7670: 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 65 74 ... ). ;; set
7680: 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74 6f 20 ting itemdat to
7690: 61 20 6c 69 73 74 20 69 66 20 69 74 20 69 73 20 a list if it is
76a0: 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 #f. (if (not
76b0: 69 74 65 6d 64 61 74 29 28 73 65 74 21 20 69 74 itemdat)(set! it
76c0: 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20 20 20 emdat '())).
76d0: 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 (set! item-path
76e0: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 (item-list->path
76f0: 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20 20 28 itemdat)). (
7700: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 41 debug:print 2 "A
7710: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61 75 ttempting to lau
7720: 6e 63 68 20 74 65 73 74 20 22 20 74 65 73 74 2d nch test " test-
7730: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f name (if (equal?
7740: 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 20 item-path "/")
7750: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a "/" item-path)).
7760: 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f (setenv "MT_
7770: 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d TEST_NAME" test-
7780: 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 name) ;; . (s
7790: 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d etenv "MT_RUNNAM
77a0: 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 E" runname).
77b0: 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d (set-megatest-
77c0: 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 env-vars run-id)
77d0: 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 ;; these may be
77e0: 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c needed by the l
77f0: 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 aunching process
7800: 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 . (change-dir
7810: 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a ectory *toppath*
7820: 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 ).. ;; Here i
7830: 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 s where the test
7840: 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 _meta table is b
7850: 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 est updated.
7860: 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20 ;; Yes, another
7870: 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20 use of a global
7880: 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65 for caching. Nee
7890: 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a d a better way?.
78a0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 (if (not (ha
78b0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
78c0: 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d ault *test-meta-
78d0: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 updated* test-na
78e0: 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 20 me #f)).
78f0: 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68 (begin.. (hash
7900: 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73 -table-set! *tes
7910: 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 t-meta-updated*
7920: 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20 test-name #t).
7930: 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 (open-r
7940: 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 75 70 un-close runs:up
7950: 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 date-test_meta d
7960: 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 b test-name test
7970: 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20 -conf))). .
7980: 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 ;; (lambda (it
7990: 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 emdat) ;;; ((rip
79a0: 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 eness "overripe"
79b0: 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 ) (temperature "
79c0: 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 cool") (season "
79d0: 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c summer")). (l
79e0: 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 et* ((new-test-p
79f0: 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 ath (string-inte
7a00: 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 rsperse (cons te
7a10: 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 st-path (map cad
7a20: 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 r itemdat)) "/")
7a30: 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d ).. (new-test-
7a40: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f name (if (equal?
7a50: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 item-path "") t
7a60: 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 est-name (conc t
7a70: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 est-name "/" ite
7a80: 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 m-path))) ;; jus
7a90: 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 t need it to be
7aa0: 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74 unique.. (test
7ab0: 2d 69 64 20 20 20 20 20 20 20 28 63 64 62 3a 72 -id (cdb:r
7ac0: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 emote-run db:get
7ad0: 2d 74 65 73 74 2d 69 64 20 23 66 20 20 72 75 6e -test-id #f run
7ae0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
7af0: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 em-path)).. (t
7b00: 65 73 74 64 61 74 20 20 20 20 20 20 20 28 63 64 estdat (cd
7b10: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d b:get-test-info-
7b20: 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 by-id *runremote
7b30: 2a 20 74 65 73 74 2d 69 64 29 29 29 0a 20 20 20 * test-id))).
7b40: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 (if (not test
7b50: 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 dat).. (begin..
7b60: 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 ;; ensure th
7b70: 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69 73 at the path exis
7b80: 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 ts before regist
7b90: 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 ering the test..
7ba0: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e ;; NOPE: Can
7bb0: 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 not! Don't know
7bc0: 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20 61 yet which disk a
7bd0: 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69 rea will be assi
7be0: 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b gned...... ;;
7bf0: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 (system (conc "
7c00: 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 mkdir -p " new-t
7c10: 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 est-path))..
7c20: 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65 6e ;;.. ;; (open
7c30: 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 -run-close tests
7c40: 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 :register-test d
7c50: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
7c60: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 me item-path)..
7c70: 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 ;;.. ;; NB
7c80: 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f 76 65 // for the above
7c90: 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20 74 68 line. I want th
7ca0: 65 20 74 65 73 74 20 74 6f 20 62 65 20 72 65 67 e test to be reg
7cb0: 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62 65 66 istered long bef
7cc0: 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69 6e 65 ore this routine
7cd0: 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a 09 20 gets called!..
7ce0: 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65 74 21 ;;.. (set!
7cf0: 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 test-id (open-r
7d00: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
7d10: 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 test-id db run-i
7d20: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
7d30: 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28 69 66 -path)).. (if
7d40: 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a 09 (not test-id)..
7d50: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 .(begin... (deb
7d60: 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41 52 4e ug:print 2 "WARN
7d70: 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65 2d 63 : Test not pre-c
7d80: 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e 61 6d reated? test-nam
7d90: 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c e=" test-name ",
7da0: 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69 74 65 item-path=" ite
7db0: 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d 69 64 m-path ", run-id
7dc0: 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 28 =" run-id)... (
7dd0: 63 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 cdb:tests-regist
7de0: 65 72 2d 74 65 73 74 20 2a 72 75 6e 2d 72 65 6d er-test *run-rem
7df0: 6f 74 65 2a 20 72 75 6e 2d 69 64 20 74 65 73 74 ote* run-id test
7e00: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
7e10: 0a 09 09 20 20 28 73 65 74 21 20 74 65 73 74 2d ... (set! test-
7e20: 69 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f id (open-run-clo
7e30: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 se db:get-test-i
7e40: 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 d db run-id test
7e50: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
7e60: 29 29 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a ))).. (debug:
7e70: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 print-info 4 "te
7e80: 73 74 2d 69 64 3d 22 20 74 65 73 74 2d 69 64 20 st-id=" test-id
7e90: 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d ", run-id=" run-
7ea0: 69 64 20 22 2c 20 74 65 73 74 2d 6e 61 6d 65 3d id ", test-name=
7eb0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 " test-name ", i
7ec0: 74 65 6d 2d 70 61 74 68 3d 5c 22 22 20 69 74 65 tem-path=\"" ite
7ed0: 6d 2d 70 61 74 68 20 22 5c 22 22 29 0a 09 20 20 m-path "\"")..
7ee0: 20 20 28 73 65 74 21 20 74 65 73 74 64 61 74 20 (set! testdat
7ef0: 28 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e (cdb:get-test-in
7f00: 66 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d fo-by-id *runrem
7f10: 6f 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29 29 ote* test-id))))
7f20: 0a 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 . (set! tes
7f30: 74 2d 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 t-id (db:test-ge
7f40: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 t-id testdat)).
7f50: 20 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 (change-dir
7f60: 65 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 ectory test-path
7f70: 29 0a 20 20 20 20 20 20 28 63 61 73 65 20 28 69 ). (case (i
7f80: 66 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 f force ;; (args
7f90: 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 :get-arg "-force
7fa0: 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 ")...'NOT_STARTE
7fb0: 44 0a 09 09 28 69 66 20 74 65 73 74 64 61 74 0a D...(if testdat.
7fc0: 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 .. (string->s
7fd0: 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d ymbol (test:get-
7fe0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a state testdat)).
7ff0: 09 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f .. 'failed-to
8000: 2d 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 -insert))..((fai
8010: 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 led-to-insert)..
8020: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
8030: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 "ERROR: Failed t
8040: 6f 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 o insert the rec
8050: 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 ord into the db"
8060: 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 ))..((NOT_STARTE
8070: 44 20 43 4f 4d 50 4c 45 54 45 44 20 44 45 4c 45 D COMPLETED DELE
8080: 54 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72 75 TED).. (let ((ru
8090: 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 nflag #f)).. (
80a0: 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f cond.. ;; -fo
80b0: 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 rce, run no matt
80c0: 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f er what.. (fo
80d0: 72 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 rce (set! runfla
80e0: 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e g #t)).. ;; N
80f0: 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 OT_STARTED, run
8100: 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 no matter what..
8110: 20 20 20 20 28 28 6d 65 6d 62 65 72 20 28 74 65 ((member (te
8120: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
8130: 74 64 61 74 29 20 27 28 22 44 45 4c 45 54 45 44 tdat) '("DELETED
8140: 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 " "NOT_STARTED")
8150: 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 )(set! runflag #
8160: 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 t)).. ;; not
8170: 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c -rerun and PASS,
8180: 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 WARN or CHECK,
8190: 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 do no run.. (
81a0: 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 (and (or (not re
81b0: 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 run)... kee
81c0: 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 pgoing)... ;; R
81d0: 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 equire to force
81e0: 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c re-run for COMPL
81f0: 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e ETED or *anythin
8200: 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f g* + PASS,WARN o
8210: 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 r CHECK... (or
8220: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
8230: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
8240: 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e ) '("PASS" "WARN
8250: 22 20 22 43 48 45 43 4b 22 20 22 53 4b 49 50 22 " "CHECK" "SKIP"
8260: 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 ))... (memb
8270: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
8280: 74 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 te testdat) '("
8290: 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a COMPLETED")))) .
82a0: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
82b0: 6e 74 2d 69 6e 66 6f 20 32 20 22 72 75 6e 6e 69 nt-info 2 "runni
82c0: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e ng test " test-n
82d0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
82e0: 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61 h " suppressed a
82f0: 73 20 69 74 20 69 73 20 22 20 28 74 65 73 74 3a s it is " (test:
8300: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
8310: 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 t) " and " (test
8320: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
8330: 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 dat)).. (set
8340: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 ! runflag #f))..
8350: 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e ;; -rerun an
8360: 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 d status is one
8370: 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c of the specifed,
8380: 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 run it.. ((a
8390: 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 nd rerun... (le
83a0: 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 t* ((rerunlst
83b0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 (string-split re
83c0: 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d run ",")).... (m
83d0: 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 ust-rerun (membe
83e0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
83f0: 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75 us testdat) reru
8400: 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 nlst)))... (d
8410: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
8420: 33 20 22 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 3 "-rerun list:
8430: 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d " rerun ", test-
8440: 73 74 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a status: " (test:
8450: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
8460: 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e at)", must-rerun
8470: 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a : " must-rerun).
8480: 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e .. must-rerun
8490: 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a )).. (debug:
84a0: 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 52 65 print-info 2 "Re
84b0: 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 run forced for t
84c0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
84d0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 "/" item-path)..
84e0: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c (set! runfl
84f0: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
8500: 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e -keepgoing, do n
8510: 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 ot rerun FAIL..
8520: 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 ((and keepgoi
8530: 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 ng... (member (
8540: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
8550: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c testdat) '("FAIL
8560: 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 "))).. (set!
8570: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 runflag #f))..
8580: 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 ((and (not re
8590: 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 run)... (member
85a0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
85b0: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 s testdat) '("FA
85c0: 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 IL" "n/a")))..
85d0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
85e0: 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 #t)).. (else
85f0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
8600: 66 29 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a f))).. (debug:
8610: 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 print 6 "RUNNING
8620: 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 => runflag: " r
8630: 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 unflag " STATE:
8640: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
8650: 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 e testdat) " STA
8660: 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 TUS: " (test:get
8670: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
8680: 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 ).. (if (not r
8690: 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 unflag)..
86a0: 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d (if (not parent-
86b0: 74 65 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 test)... (debu
86c0: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a g:print 1 "NOTE:
86d0: 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 Not starting te
86e0: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 st " new-test-na
86f0: 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 me " as it is st
8700: 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 ate \"" (test:ge
8710: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
8720: 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 ....."\" and st
8730: 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 atus \"" (test:g
8740: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
8750: 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 t) "\", use -rer
8760: 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 un \"" (test:get
8770: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
8780: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
8790: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
87a0: 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 "\" or -force t
87b0: 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 o override"))..
87c0: 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e ;; NOTE: N
87d0: 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 o longer be chec
87e0: 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 king prerequisit
87f0: 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 es here! Will ne
8800: 76 65 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c ver get here unl
8810: 65 73 73 20 70 72 65 72 65 71 73 20 61 72 65 0a ess prereqs are.
8820: 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 . ;;
8830: 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 already met...
8840: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 (if (not (
8850: 6c 61 75 6e 63 68 2d 74 65 73 74 20 23 66 20 72 launch-test #f r
8860: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 un-id runname te
8870: 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 st-conf keyvalls
8880: 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 t test-name test
8890: 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c -path itemdat fl
88a0: 61 67 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 ags))... (begi
88b0: 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 n... (print
88c0: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 "ERROR: Failed t
88d0: 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 o launch the tes
88e0: 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f t. Exiting as so
88f0: 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 on as possible")
8900: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 ... (set! *g
8910: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a lobalexitstatus*
8920: 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 1) ;; ... (
8930: 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 process-signal (
8940: 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d current-process-
8950: 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 id) signal/kill)
8960: 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 )))))..((KILLED)
8970: 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
8980: 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 1 "NOTE: " new-
8990: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 test-name " is a
89a0: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f lready running o
89b0: 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 r was explictly
89c0: 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 killed, use -for
89d0: 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e ce to launch it.
89e0: 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 "))..((LAUNCHED
89f0: 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 REMOTEHOSTSTART
8a00: 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 RUNNING) .. (if
8a10: 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d (> (- (current-
8a20: 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 seconds)(+ (db:t
8a30: 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 est-get-event_ti
8a40: 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 me testdat).....
8a50: 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d (db:test-
8a60: 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e get-run_duration
8a70: 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 testdat)))...60
8a80: 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 0) ;; i.e. no up
8a90: 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 date for more th
8aa0: 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 an 600 seconds..
8ab0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 (begin..
8ac0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
8ad0: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 0 "WARNING: Tes
8ae0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 t " test-name "
8af0: 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 appears to be de
8b00: 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 ad. Forcing it t
8b10: 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 o state INCOMPLE
8b20: 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 TE and status ST
8b30: 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 UCK/DEAD")..
8b40: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 2d 73 (tests:test-s
8b50: 65 74 2d 73 74 61 74 75 73 21 20 74 65 73 74 2d et-status! test-
8b60: 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 id "INCOMPLETE"
8b70: 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 "STUCK/DEAD" "Te
8b80: 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 st is stuck or d
8b90: 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 ead" #f))..
8ba0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
8bb0: 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d NOTE: " test-nam
8bc0: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 e " is already r
8bd0: 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 unning")))..(els
8be0: 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 e (debug:p
8bf0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 rint 0 "ERROR: F
8c00: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 ailed to launch
8c10: 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d test " new-test-
8c20: 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e name ". Unrecogn
8c30: 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 ised state " (te
8c40: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
8c50: 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d tdat)))))))..;;=
8c60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8c70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8c80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8c90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8ca0: 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 =====.;; END OF
8cb0: 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d NEW STUFF.;;====
8cc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8cd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8ce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8cf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8d00: 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 ==..(define (get
8d10: 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 -dir-up-n dir .
8d20: 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 params) . (let
8d30: 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e ((dparts (strin
8d40: 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 g-split dir "/")
8d50: 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 )..(count (if
8d60: 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 (null? params) 1
8d70: 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 (car params))))
8d80: 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 . (conc "/" (
8d90: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
8da0: 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b se .. (tak
8db0: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e e dparts (- (len
8dc0: 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e gth dparts) coun
8dd0: 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 t)).. "/")
8de0: 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 ))).;; Remove ru
8df0: 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 ns.;; fields are
8e00: 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f passing in thro
8e10: 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a ugh .;; action:.
8e20: 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 ;; 'remove-ru
8e30: 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 ns.;; 'set-st
8e40: 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b ate-status.;;.;;
8e50: 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 NB// should pas
8e60: 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 s in keys?.;;.(d
8e70: 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 efine (runs:oper
8e80: 61 74 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 72 75 ate-on action ru
8e90: 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 nnamepatt testpa
8ea0: 74 74 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 tt #!key (state
8eb0: 23 66 29 28 73 74 61 74 75 73 20 23 66 29 28 6e #f)(status #f)(n
8ec0: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 ew-state-status
8ed0: 23 66 29 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 #f)). (common:c
8ee0: 6c 65 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 lear-caches) ;;
8ef0: 63 6c 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 clear all caches
8f00: 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 . (let* ((db
8f10: 20 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 6b #f).. (k
8f20: 65 79 73 20 20 20 20 20 20 20 20 20 28 6f 70 65 eys (ope
8f30: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 n-run-close db:g
8f40: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 et-keys db)).. (
8f50: 72 75 6e 64 61 74 20 20 20 20 20 20 20 28 6f 70 rundat (op
8f60: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e en-run-close run
8f70: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 s:get-runs-by-pa
8f80: 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 tt db keys runna
8f90: 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 mepatt)).. (head
8fa0: 65 72 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 er (vector
8fb0: 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a -ref rundat 0)).
8fc0: 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 . (runs
8fd0: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
8fe0: 61 74 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 at 1)).. (states
8ff0: 20 20 20 20 20 20 20 28 69 66 20 73 74 61 74 65 (if state
9000: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 (string-split
9010: 73 74 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 state ",") '())
9020: 29 0a 09 20 28 73 74 61 74 75 73 65 73 20 20 20 ).. (statuses
9030: 20 20 28 69 66 20 73 74 61 74 75 73 20 28 73 74 (if status (st
9040: 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 ring-split statu
9050: 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 s ",") '())).. (
9060: 73 74 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 state-status (if
9070: 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 (string? new-st
9080: 61 74 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 ate-status) (str
9090: 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 ing-split new-st
90a0: 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 ate-status ",")
90b0: 27 28 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 '(#f #f)))).
90c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
90d0: 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 o 4 "runs:operat
90e0: 65 2d 6f 6e 20 3d 3e 20 48 65 61 64 65 72 3a 20 e-on => Header:
90f0: 22 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f " header " actio
9100: 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 n: " action " ne
9110: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 w-state-status:
9120: 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 " new-state-stat
9130: 75 73 29 0a 20 20 20 20 28 69 66 20 28 3e 20 32 us). (if (> 2
9140: 20 28 6c 65 6e 67 74 68 20 73 74 61 74 65 2d 73 (length state-s
9150: 74 61 74 75 73 29 29 0a 09 28 62 65 67 69 6e 0a tatus))..(begin.
9160: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
9170: 30 20 22 45 52 52 4f 52 3a 20 74 68 65 20 70 61 0 "ERROR: the pa
9180: 72 61 6d 65 74 65 72 20 74 6f 20 2d 73 65 74 2d rameter to -set-
9190: 73 74 61 74 65 2d 73 74 61 74 75 73 20 69 73 20 state-status is
91a0: 61 20 63 6f 6d 6d 61 20 64 65 6c 69 6d 69 74 65 a comma delimite
91b0: 64 20 73 74 72 69 6e 67 2e 20 45 2e 67 2e 20 43 d string. E.g. C
91c0: 4f 4d 50 4c 45 54 45 44 2c 46 41 49 4c 22 29 0a OMPLETED,FAIL").
91d0: 09 20 20 28 65 78 69 74 29 29 29 0a 20 20 20 20 . (exit))).
91e0: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 (for-each. (
91f0: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 lambda (run).
9200: 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 (let ((runke
9210: 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 y (string-inters
9220: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 perse (map (lamb
9230: 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 da (k).......(db
9240: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
9250: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
9260: 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 (vector-ref k 0)
9270: 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 )) keys) "/"))..
9280: 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 (dirs-to-re
9290: 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d move (make-hash-
92a0: 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a table))).. (let*
92b0: 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 ((run-id (db
92c0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
92d0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
92e0: 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 "id"))...(run-st
92f0: 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 ate (db:get-valu
9300: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
9310: 68 65 61 64 65 72 20 22 73 74 61 74 65 22 29 29 header "state"))
9320: 0a 09 09 28 74 65 73 74 73 20 20 20 20 20 28 69 ...(tests (i
9330: 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 f (not (equal? r
9340: 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 un-state "locked
9350: 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6f ")).... (o
9360: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
9370: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
9380: 75 6e 20 64 62 20 72 75 6e 2d 69 64 0a 09 09 09 un db run-id....
9390: 09 09 09 20 20 20 20 20 20 74 65 73 74 70 61 74 ... testpat
93a0: 74 20 73 74 61 74 65 73 20 73 74 61 74 75 73 65 t states statuse
93b0: 73 0a 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f s....... no
93c0: 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 t-in: #f.......
93d0: 20 20 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 sort-by: (
93e0: 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 case action.....
93f0: 09 09 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 .... ((remove-ru
9400: 6e 73 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 ns) 'rundir)....
9410: 09 09 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 ..... (else
9420: 20 20 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 'event_time
9430: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 ))).... '(
9440: 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 )))...(lasttpath
9450: 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 "/does/not/exis
9460: 74 2f 49 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 t/I/hope"))..
9470: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
9480: 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 o 4 "runs:operat
9490: 65 2d 6f 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 e-on run=" run "
94a0: 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 , header=" heade
94b0: 72 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 r).. (if (not
94c0: 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 (null? tests))..
94d0: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 (begin...
94e0: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 (case action...
94f0: 20 20 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 ((remove-runs
9500: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
9510: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 rint 1 "Removing
9520: 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 tests for run:
9530: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
9540: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
9550: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
9560: 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 "runname")))...
9570: 20 20 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 ((set-state-st
9580: 61 74 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 atus)... (deb
9590: 75 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 ug:print 1 "Modi
95a0: 66 79 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 fying state and
95b0: 73 74 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 staus for tests
95c0: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 for run: " runke
95d0: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 y " " (db:get-va
95e0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
95f0: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d n header "runnam
9600: 65 22 29 29 29 0a 09 09 20 20 20 28 28 70 72 69 e")))... ((pri
9610: 6e 74 2d 72 75 6e 29 0a 09 09 20 20 20 20 28 64 nt-run)... (d
9620: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 50 72 ebug:print 1 "Pr
9630: 69 6e 74 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 inting info for
9640: 72 75 6e 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 run " runkey ",
9650: 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 run=" run ", tes
9660: 74 73 3d 22 20 74 65 73 74 73 20 22 2c 20 68 65 ts=" tests ", he
9670: 61 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09 ader=" header)..
9680: 09 20 20 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 . action)...
9690: 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 64 (else... (d
96a0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
96b0: 30 20 22 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 0 "action not re
96c0: 63 6f 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f cognised " actio
96d0: 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 n)))... (for-eac
96e0: 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 h... (lambda (t
96f0: 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a est)... (let*
9700: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 ((item-path (db
9710: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
9720: 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 ath test))....
9730: 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a (test-name (db:
9740: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
9750: 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 e test)).... (
9760: 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 run-dir (db:te
9770: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 st-get-rundir te
9780: 73 74 29 29 20 20 20 20 3b 3b 20 72 75 6e 20 64 st)) ;; run d
9790: 69 72 20 69 73 20 66 72 6f 6d 20 74 68 65 20 6c ir is from the l
97a0: 69 6e 6b 20 74 72 65 65 0a 09 09 09 20 20 20 28 ink tree.... (
97b0: 72 65 61 6c 2d 64 69 72 20 20 28 69 66 20 28 66 real-dir (if (f
97c0: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d ile-exists? run-
97d0: 64 69 72 29 0a 09 09 09 09 09 20 20 28 72 65 73 dir)...... (res
97e0: 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 olve-pathname ru
97f0: 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 23 66 n-dir)...... #f
9800: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 69 )).... (test-i
9810: 64 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 d (db:test-get
9820: 2d 69 64 20 74 65 73 74 29 29 29 0a 09 09 20 20 -id test)))...
9830: 20 20 20 20 3b 3b 20 20 20 28 74 64 62 20 20 20 ;; (tdb
9840: 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73 (db:open-tes
9850: 74 2d 64 62 20 72 75 6e 2d 64 69 72 29 29 29 0a t-db run-dir))).
9860: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
9870: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 rint-info 4 "tes
9880: 74 3d 22 20 74 65 73 74 29 20 3b 3b 20 20 20 22 t=" test) ;; "
9890: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
98a0: 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 stname test) " i
98b0: 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 d: " (db:test-ge
98c0: 74 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 69 t-id test) " " i
98d0: 74 65 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f tem-path " actio
98e0: 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 n: " action)...
98f0: 20 20 20 20 20 28 63 61 73 65 20 61 63 74 69 6f (case actio
9900: 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 n....((remove-ru
9910: 6e 73 29 20 3b 3b 20 74 68 65 20 74 64 62 20 69 ns) ;; the tdb i
9920: 73 20 66 6f 72 20 66 75 74 75 72 65 20 70 6f 73 s for future pos
9930: 73 69 62 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65 sible. .... (ope
9940: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 n-run-close db:d
9950: 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 elete-test-recor
9960: 64 73 20 64 62 20 23 66 20 28 64 62 3a 74 65 73 ds db #f (db:tes
9970: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a t-get-id test)).
9980: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
9990: 2d 69 6e 66 6f 20 31 20 22 41 74 74 65 6d 70 74 -info 1 "Attempt
99a0: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 ing to remove "
99b0: 28 69 66 20 72 65 61 6c 2d 64 69 72 20 28 63 6f (if real-dir (co
99c0: 6e 63 20 22 20 64 69 72 20 22 20 72 65 61 6c 2d nc " dir " real-
99d0: 64 69 72 20 22 20 61 6e 64 20 22 29 20 22 22 29 dir " and ") "")
99e0: 20 22 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 " link " run-di
99f0: 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 r).... (if (and
9a00: 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 20 real-dir .....
9a10: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 (> (string-lengt
9a20: 68 20 72 65 61 6c 2d 64 69 72 29 20 35 29 0a 09 h real-dir) 5)..
9a30: 09 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 ... (file-exist
9a40: 73 3f 20 72 65 61 6c 2d 64 69 72 29 29 20 3b 3b s? real-dir)) ;;
9a50: 20 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 bad heuristic b
9a60: 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e ut should preven
9a70: 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 t /tmp /home etc
9a80: 2e 0a 09 09 09 20 20 20 20 20 28 62 65 67 69 6e ..... (begin
9a90: 20 3b 3b 20 6c 65 74 2a 20 28 28 72 65 61 6c 70 ;; let* ((realp
9aa0: 61 74 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 ath (resolve-pat
9ab0: 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 hname run-dir)))
9ac0: 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 .... (debu
9ad0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 g:print-info 1 "
9ae0: 52 65 63 75 72 73 69 76 65 6c 79 20 72 65 6d 6f Recursively remo
9af0: 76 69 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 29 ving " real-dir)
9b00: 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 .... (if (
9b10: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 file-exists? rea
9b20: 6c 2d 64 69 72 29 0a 09 09 09 09 20 20 20 28 69 l-dir)..... (i
9b30: 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f f (> (system (co
9b40: 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 nc "rm -rf " rea
9b50: 6c 2d 64 69 72 29 29 20 30 29 0a 09 09 09 09 20 l-dir)) 0).....
9b60: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
9b70: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 nt 0 "ERROR: The
9b80: 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d re was a problem
9b90: 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c removing " real
9ba0: 2d 64 69 72 20 22 20 77 69 74 68 20 72 6d 20 2d -dir " with rm -
9bb0: 66 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 f"))..... (deb
9bc0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
9bd0: 49 4e 47 3a 20 74 65 73 74 20 64 69 72 20 22 20 ING: test dir "
9be0: 72 65 61 6c 2d 64 69 72 20 22 20 61 70 70 65 61 real-dir " appea
9bf0: 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 73 74 20 rs to not exist
9c00: 6f 72 20 69 73 20 6e 6f 74 20 72 65 61 64 61 62 or is not readab
9c10: 6c 65 22 29 29 29 0a 09 09 09 20 20 20 20 20 28 le"))).... (
9c20: 69 66 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 if real-dir ....
9c30: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 . (debug:print 0
9c40: 20 22 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 "WARNING: direc
9c50: 74 6f 72 79 20 22 20 72 65 61 6c 2d 64 69 72 20 tory " real-dir
9c60: 22 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 " does not exist
9c70: 22 29 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 ")..... (debug:p
9c80: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
9c90: 20 6e 6f 20 72 65 61 6c 20 64 69 72 65 63 74 6f no real directo
9ca0: 72 79 20 63 6f 72 72 6f 73 70 6f 6e 64 69 6e 67 ry corrosponding
9cb0: 20 74 6f 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 to link " run-d
9cc0: 69 72 20 22 2c 20 6e 6f 74 68 69 6e 67 20 64 6f ir ", nothing do
9cd0: 6e 65 22 29 29 29 0a 09 09 09 20 28 69 66 20 28 ne"))).... (if (
9ce0: 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 symbolic-link? r
9cf0: 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 un-dir)....
9d00: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 (begin....
9d10: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
9d20: 66 6f 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 73 fo 1 "Removing s
9d30: 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 ymlink " run-dir
9d40: 29 0a 09 09 09 20 20 20 20 20 20 20 28 68 61 6e ).... (han
9d50: 64 6c 65 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 dle-exceptions..
9d60: 09 09 09 65 78 6e 0a 09 09 09 09 28 64 65 62 75 ...exn.....(debu
9d70: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
9d80: 3a 20 20 46 61 69 6c 65 64 20 74 6f 20 72 65 6d : Failed to rem
9d90: 6f 76 65 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 ove symlink " ru
9da0: 6e 2d 64 69 72 20 28 28 63 6f 6e 64 69 74 69 6f n-dir ((conditio
9db0: 6e 2d 70 72 6f 70 65 72 74 79 2d 61 63 63 65 73 n-property-acces
9dc0: 73 6f 72 20 27 65 78 6e 20 27 6d 65 73 73 61 67 sor 'exn 'messag
9dd0: 65 29 20 65 78 6e 29 20 22 2c 20 61 74 74 65 6d e) exn) ", attem
9de0: 70 74 69 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 pting to continu
9df0: 65 22 29 0a 09 09 09 09 28 64 65 6c 65 74 65 2d e").....(delete-
9e00: 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 29 29 0a file run-dir))).
9e10: 09 09 09 20 20 20 20 20 28 69 66 20 28 64 69 72 ... (if (dir
9e20: 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 ectory? run-dir)
9e30: 0a 09 09 09 09 20 28 69 66 20 28 3e 20 28 64 69 ..... (if (> (di
9e40: 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 rectory-fold (la
9e50: 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31 20 78 mbda (f x)(+ 1 x
9e60: 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20 30 29 )) 0 run-dir) 0)
9e70: 0a 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67 ..... (debug
9e80: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e :print 0 "WARNIN
9e90: 47 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 G: refusing to r
9ea0: 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 emove " run-dir
9eb0: 22 20 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 " as it is not e
9ec0: 6d 70 74 79 22 29 0a 09 09 09 09 20 20 20 20 20 mpty").....
9ed0: 20 28 68 61 6e 64 6c 65 2d 65 78 63 65 70 74 69 (handle-excepti
9ee0: 6f 6e 73 0a 09 09 09 09 20 20 20 20 20 20 20 65 ons..... e
9ef0: 78 6e 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 xn..... (d
9f00: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
9f10: 52 4f 52 3a 20 20 46 61 69 6c 65 64 20 74 6f 20 ROR: Failed to
9f20: 72 65 6d 6f 76 65 20 64 69 72 65 63 74 6f 72 79 remove directory
9f30: 20 22 20 72 75 6e 2d 64 69 72 20 28 28 63 6f 6e " run-dir ((con
9f40: 64 69 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79 2d dition-property-
9f50: 61 63 63 65 73 73 6f 72 20 27 65 78 6e 20 27 6d accessor 'exn 'm
9f60: 65 73 73 61 67 65 29 20 65 78 6e 29 20 22 2c 20 essage) exn) ",
9f70: 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f attempting to co
9f80: 6e 74 69 6e 75 65 22 29 0a 09 09 09 09 20 20 20 ntinue").....
9f90: 20 20 20 20 28 64 65 6c 65 74 65 2d 64 69 72 65 (delete-dire
9fa0: 63 74 6f 72 79 20 72 75 6e 2d 64 69 72 29 29 29 ctory run-dir)))
9fb0: 0a 09 09 09 09 20 28 69 66 20 72 75 6e 2d 64 69 ..... (if run-di
9fc0: 72 0a 09 09 09 09 20 20 20 20 20 28 64 65 62 75 r..... (debu
9fd0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
9fe0: 4e 47 3a 20 6e 6f 74 20 72 65 6d 6f 76 69 6e 67 NG: not removing
9ff0: 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 " run-dir " as
a000: 69 74 20 65 69 74 68 65 72 20 64 6f 65 73 6e 27 it either doesn'
a010: 74 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f t exist or is no
a020: 74 20 61 20 73 79 6d 6c 69 6e 6b 22 29 0a 09 09 t a symlink")...
a030: 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 .. (debug:pr
a040: 69 6e 74 20 30 20 22 4e 4f 54 45 3a 20 74 68 65 int 0 "NOTE: the
a050: 20 72 75 6e 20 64 69 72 20 66 6f 72 20 74 68 69 run dir for thi
a060: 73 20 74 65 73 74 20 69 73 20 75 6e 64 65 66 69 s test is undefi
a070: 6e 65 64 2e 20 54 65 73 74 20 6d 61 79 20 68 61 ned. Test may ha
a080: 76 65 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 ve already been
a090: 64 65 6c 65 74 65 64 2e 22 29 29 0a 09 09 09 09 deleted.")).....
a0a0: 20 29 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 )))....((set-st
a0b0: 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 ate-status)....
a0c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
a0d0: 6f 20 32 20 22 6e 65 77 20 73 74 61 74 65 20 22 o 2 "new state "
a0e0: 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 (car state-stat
a0f0: 75 73 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 us) ", new statu
a100: 73 20 22 20 28 63 61 64 72 20 73 74 61 74 65 2d s " (cadr state-
a110: 73 74 61 74 75 73 29 29 0a 09 09 09 20 28 6f 70 status)).... (op
a120: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
a130: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 test-set-state-s
a140: 74 61 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 tatus-by-id db (
a150: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
a160: 65 73 74 29 20 28 63 61 72 20 73 74 61 74 65 2d est) (car state-
a170: 73 74 61 74 75 73 29 28 63 61 64 72 20 73 74 61 status)(cadr sta
a180: 74 65 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 te-status) #f)))
a190: 29 29 0a 09 09 20 20 28 73 6f 72 74 20 74 65 73 ))... (sort tes
a1a0: 74 73 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 ts (lambda (a b)
a1b0: 28 6c 65 74 20 28 28 64 69 72 61 20 28 64 62 3a (let ((dira (db:
a1c0: 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 test-get-rundir
a1d0: 61 29 29 0a 09 09 09 09 09 09 20 28 64 69 72 62 a))....... (dirb
a1e0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 (db:test-get-ru
a1f0: 6e 64 69 72 20 62 29 29 29 0a 09 09 09 09 09 20 ndir b)))......
a200: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 73 74 (if (and (st
a210: 72 69 6e 67 3f 20 64 69 72 61 29 28 73 74 72 69 ring? dira)(stri
a220: 6e 67 3f 20 64 69 72 62 29 29 0a 09 09 09 09 09 ng? dirb))......
a230: 09 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e . (> (string-len
a240: 67 74 68 20 64 69 72 61 29 28 73 74 72 69 6e 67 gth dira)(string
a250: 2d 6c 65 6e 67 74 68 20 64 69 72 62 29 29 0a 09 -length dirb))..
a260: 09 09 09 09 09 20 23 66 29 29 29 29 29 29 29 0a ..... #f))))))).
a270: 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 . ;; remove th
a280: 65 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 e run if zero te
a290: 73 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 sts remain.. (
a2a0: 69 66 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 if (eq? action '
a2b0: 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 remove-runs)..
a2c0: 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 (let ((remt
a2d0: 65 73 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 ests (open-run-c
a2e0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 lose db:get-test
a2f0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 s-for-run db (db
a300: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
a310: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
a320: 22 69 64 22 29 20 23 66 20 27 28 22 44 45 4c 45 "id") #f '("DELE
a330: 54 45 44 22 29 20 27 28 22 6e 2f 61 22 29 20 6e TED") '("n/a") n
a340: 6f 74 2d 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 ot-in: #t)))...
a350: 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 (if (null? remte
a360: 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 sts) ;; no more
a370: 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a tests remaining.
a380: 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64 .. (let* ((d
a390: 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 parts (string-s
a3a0: 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 plit lasttpath "
a3b0: 2f 22 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e /")).... (run
a3c0: 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 path (conc "/" (
a3d0: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
a3e0: 73 65 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20 se .......(take
a3f0: 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 dparts (- (lengt
a400: 68 20 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 h dparts) 1))...
a410: 09 09 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20 ...."/"))))...
a420: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
a430: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 t 1 "Removing ru
a440: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 n: " runkey " "
a450: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
a460: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
a470: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 er "runname") "
a480: 61 6e 64 20 72 65 6c 61 74 65 64 20 72 65 63 6f and related reco
a490: 72 64 22 29 0a 09 09 20 20 20 20 20 20 20 28 6f rd")... (o
a4a0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
a4b0: 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 :delete-run db r
a4c0: 75 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 un-id)...
a4d0: 3b 3b 20 54 68 69 73 20 69 73 20 61 20 70 72 65 ;; This is a pre
a4e0: 74 74 79 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 tty good place t
a4f0: 6f 20 70 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 o purge old DELE
a500: 54 45 44 20 74 65 73 74 73 0a 09 09 20 20 20 20 TED tests...
a510: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
a520: 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 se db:delete-tes
a530: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 ts-for-run db ru
a540: 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 28 n-id)... (
a550: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
a560: 62 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c b:delete-old-del
a570: 65 74 65 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 eted-test-record
a580: 73 20 64 62 29 0a 09 09 20 20 20 20 20 20 20 28 s db)... (
a590: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
a5a0: 62 3a 73 65 74 2d 76 61 72 20 64 62 20 22 44 45 b:set-var db "DE
a5b0: 4c 45 54 45 44 5f 54 45 53 54 53 22 20 28 63 75 LETED_TESTS" (cu
a5c0: 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a rrent-seconds)).
a5d0: 09 09 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 .. ;; need
a5e0: 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 to figure out t
a5f0: 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 he path to the r
a600: 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 un dir and remov
a610: 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 e it if empty...
a620: 20 20 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 ;; (if
a630: 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 (null? (glob (c
a640: 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 onc runpath "/*"
a650: 29 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 )))... ;;
a660: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 (begin...
a670: 20 20 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 ;; . (deb
a680: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
a690: 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 ving run dir " r
a6a0: 75 6e 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 unpath)...
a6b0: 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 ;; . (system (c
a6c0: 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 onc "rmdir -p "
a6d0: 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 runpath))))...
a6e0: 20 20 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a ))))).. )).
a6f0: 20 20 20 20 20 72 75 6e 73 29 29 0a 20 20 23 74 runs)). #t
a700: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d )..;;===========
a710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a730: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 ===========.;; R
a750: 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 outines for mani
a760: 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b pulating runs.;;
a770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a7a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a7b0: 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 ======..;; Since
a7c0: 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 many calls to a
a7d0: 20 72 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 run require pre
a7e0: 74 74 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d tty much the sam
a7f0: 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 e setup .;; this
a800: 20 77 72 61 70 70 65 72 20 69 73 20 75 73 65 64 wrapper is used
a810: 20 74 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 to reduce the r
a820: 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f eplication of co
a830: 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 de.(define (gene
a840: 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 ral-run-call swi
a850: 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 tchname action-d
a860: 65 73 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 esc proc). (let
a870: 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 ((runname (args
a880: 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 :get-arg ":runna
a890: 6d 65 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 me"))..(target
a8a0: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (if (args:get-ar
a8b0: 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 g "-target")...
a8c0: 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (args:get-ar
a8d0: 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 g "-target")...
a8e0: 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (args:get-ar
a8f0: 67 20 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a g "-reqtarg"))).
a900: 09 28 74 68 31 20 20 20 20 20 23 66 29 29 0a 20 .(th1 #f)).
a910: 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 (cond. ((
a920: 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 not target).
a930: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
a940: 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 "ERROR: Missing
a950: 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 required parame
a960: 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 ter for " switch
a970: 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 name ", you must
a980: 20 73 70 65 63 69 66 79 20 74 68 65 20 74 61 72 specify the tar
a990: 67 65 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 get with -target
a9a0: 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 "). (exit 3
a9b0: 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 )). ((not ru
a9c0: 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 nname). (de
a9d0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
a9e0: 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 OR: Missing requ
a9f0: 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 ired parameter f
aa00: 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 or " switchname
aa10: 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 ", you must spec
aa20: 69 66 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 ify the run name
aa30: 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 with :runname r
aa40: 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 unname"). (
aa50: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 exit 3)). (e
aa60: 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 lse. (let (
aa70: 28 64 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 (db #f).. (
aa80: 6b 65 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 keys #f))..(if (
aa90: 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 not (setup-for-r
aaa0: 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e un)).. (begin
aab0: 20 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
aac0: 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 print 0 "Failed
aad0: 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e to setup, exitin
aae0: 67 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 g").. (exit
aaf0: 20 31 29 29 29 0a 09 28 69 66 20 28 61 72 67 73 1)))..(if (args
ab00: 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 :get-arg "-serve
ab10: 72 22 29 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 r").. (open-r
ab20: 75 6e 2d 63 6c 6f 73 65 20 73 65 72 76 65 72 3a un-close server:
ab30: 73 74 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 start db (args:g
ab40: 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 et-arg "-server"
ab50: 29 29 29 0a 20 09 20 20 20 20 3b 3b 20 28 69 66 ))). . ;; (if
ab60: 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a (not (or (args:
ab70: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c get-arg "-runall
ab80: 22 29 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c ") ;; runall
ab90: 20 61 6e 64 20 72 75 6e 74 65 73 74 73 20 61 72 and runtests ar
aba0: 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 e allowed to be
abb0: 73 65 72 76 65 72 73 0a 20 09 20 20 20 20 3b 3b servers. . ;;
abc0: 20 20 20 20 20 09 20 28 61 72 67 73 3a 67 65 74 . (args:get
abd0: 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22 -arg "-runtests"
abe0: 29 29 29 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 ))).. ;;
abf0: 28 63 6c 69 65 6e 74 3a 73 65 74 75 70 29 20 3b (client:setup) ;
ac00: 3b 20 54 68 69 73 20 69 73 20 61 20 64 75 70 6c ; This is a dupl
ac10: 69 63 61 74 65 20 73 74 61 72 74 75 70 21 21 21 icate startup!!!
ac20: 3f 3f 3f 20 42 55 47 3f 0a 09 20 20 20 20 3b 3b ??? BUG?.. ;;
ac30: 20 20 20 20 20 29 29 0a 09 28 73 65 74 21 20 6b ))..(set! k
ac40: 65 79 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c eys (open-run-cl
ac50: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 ose db:get-keys
ac60: 64 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e db))..;; have en
ac70: 6f 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 ough to process
ac80: 2d 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 -target or -reqt
ac90: 61 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 arg here..(if (a
aca0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
acb0: 71 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 qtarg").. (le
acc0: 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 t* ((runconfigf
acd0: 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
ace0: 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f "/runconfigs.co
acf0: 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f nfig")) ;; DO NO
ad00: 54 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a T EVALUATE ALL .
ad10: 09 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 .. (runconfig
ad20: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 (read-config ru
ad30: 6e 63 6f 6e 66 69 67 66 20 23 66 20 23 74 20 65 nconfigf #f #t e
ad40: 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 nviron-patt: #f)
ad50: 29 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 )) .. (if (
ad60: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
ad70: 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 efault runconfig
ad80: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
ad90: 2d 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 -reqtarg") #f)..
ada0: 09 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d . (keys:target-
adb0: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 set-args keys (a
adc0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
add0: 71 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 qtarg") args:arg
ade0: 2d 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 -hash)... (begi
adf0: 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 n... (debug:p
ae00: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b rint 0 "ERROR: [
ae10: 22 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 " (args:get-arg
ae20: 22 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e "-reqtarg") "] n
ae30: 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 ot found in " ru
ae40: 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 nconfigf)...
ae50: 28 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a (if db (sqlite3:
ae60: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 finalize! db))..
ae70: 09 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 . (exit 1))))
ae80: 0a 09 20 20 20 20 28 69 66 20 28 61 72 67 73 3a .. (if (args:
ae90: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 get-arg "-target
aea0: 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 ")...(keys:targe
aeb0: 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 t-set-args keys
aec0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
aed0: 74 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 target" args:arg
aee0: 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d -hash) args:arg-
aef0: 68 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f hash)))..(if (no
af00: 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e t (car *configin
af10: 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 fo*)).. (begi
af20: 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a n.. (debug:
af30: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
af40: 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 Attempted to " a
af50: 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 ction-desc " but
af60: 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 run area config
af70: 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 file not found"
af80: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 ).. (exit 1
af90: 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 )).. ;; Extra
afa0: 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 ct out stuff nee
afb0: 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d ded in most or m
afc0: 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b any calls.. ;
afd0: 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c ; here then call
afe0: 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a proc.. (let*
aff0: 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d ((keynames (m
b000: 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 ap key:get-field
b010: 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 name keys))...
b020: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 (keyvallst (ke
b030: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 ys->vallist keys
b040: 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 #t))).. (p
b050: 72 6f 63 20 74 61 72 67 65 74 20 72 75 6e 6e 61 roc target runna
b060: 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 me keys keynames
b070: 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 keyvallst)))..(
b080: 69 66 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a if th1 (thread-j
b090: 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 69 66 20 oin! th1))..(if
b0a0: 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 db (sqlite3:fina
b0b0: 6c 69 7a 65 21 20 64 62 29 29 0a 09 28 73 65 74 lize! db))..(set
b0c0: 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a ! *didsomething*
b0d0: 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d #t))))))..;;===
b0e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b0f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b100: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b110: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b120: 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f ===.;; Lock/unlo
b130: 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d ck runs.;;======
b140: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b150: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b160: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b180: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
b190: 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 handle-locking t
b1a0: 61 72 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 arget keys runna
b1b0: 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 me lock unlock u
b1c0: 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 ser). (let* ((d
b1d0: 62 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 72 b #f).. (r
b1e0: 75 6e 64 61 74 20 20 20 28 6f 70 65 6e 2d 72 75 undat (open-ru
b1f0: 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 n-close runs:get
b200: 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 -runs-by-patt db
b210: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a keys runname)).
b220: 09 20 28 68 65 61 64 65 72 20 20 20 28 76 65 63 . (header (vec
b230: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 tor-ref rundat 0
b240: 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 )).. (runs (
b250: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
b260: 74 20 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d t 1))). (for-
b270: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 each (lambda (ru
b280: 6e 29 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d n)...(let ((run-
b290: 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 id (db:get-value
b2a0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
b2b0: 65 61 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 eader "id")))...
b2c0: 20 20 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 (if (or lock..
b2d0: 09 09 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a .. (and unlock.
b2e0: 09 09 09 20 20 20 20 20 20 20 28 62 65 67 69 6e ... (begin
b2f0: 0a 09 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f ..... (print "Do
b300: 20 79 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 you really wish
b310: 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 to unlock run "
b320: 20 72 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 run-id "?\n y
b330: 2f 6e 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 /n: ")..... (equ
b340: 61 6c 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 al? "y" (read-li
b350: 6e 65 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 ne)))))...
b360: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
b370: 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 db:lock/unlock-r
b380: 75 6e 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 un db run-id loc
b390: 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 k unlock user)..
b3a0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
b3b0: 69 6e 74 2d 69 6e 66 6f 20 30 20 22 53 6b 69 70 int-info 0 "Skip
b3c0: 70 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b ping lock/unlock
b3d0: 20 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 on " run-id))))
b3e0: 0a 09 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a .. runs))).
b3f0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
b400: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b420: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b430: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c ========.;; Roll
b440: 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d up runs.;;======
b450: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b460: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b470: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b490: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 ..;; Update the
b4a0: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 test_meta table
b4b0: 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 for this test.(d
b4c0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 efine (runs:upda
b4d0: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
b4e0: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
b4f0: 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 onf). (let ((cu
b500: 72 72 72 65 63 6f 72 64 20 28 63 64 62 3a 72 65 rrrecord (cdb:re
b510: 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 mote-run db:test
b520: 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 meta-get-record
b530: 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a db test-name))).
b540: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 (if (not cur
b550: 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e rrecord)..(begin
b560: 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 65 .. (set! currre
b570: 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f cord (make-vecto
b580: 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 63 64 r 10 #f)).. (cd
b590: 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a b:remote-run db:
b5a0: 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 testmeta-add-rec
b5b0: 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 ord db test-name
b5c0: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 ))). (for-eac
b5d0: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 h . (lambda
b5e0: 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 (key). (le
b5f0: 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 6b t* ((idx (cadr k
b600: 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 ey)).. (fld
b610: 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 (car key))..
b620: 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 (val (config
b630: 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e -lookup test-con
b640: 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c f "test_meta" fl
b650: 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 d))).. ;; (debug
b660: 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 :print 5 "idx: "
b670: 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c idx " fld: " fl
b680: 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a d " val: " val).
b690: 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 . (if (and val (
b6a0: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 not (equal? (vec
b6b0: 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f tor-ref currreco
b6c0: 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 rd idx) val)))..
b6d0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 (begin..
b6e0: 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 (print "Upda
b6f0: 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 ting " test-name
b700: 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 " " fld " to "
b710: 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 63 64 val).. (cd
b720: 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a b:remote-run db:
b730: 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d testmeta-update-
b740: 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 field db test-na
b750: 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a me fld val))))).
b760: 20 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 '(("author"
b770: 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 2)("owner" 3)("
b780: 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 description" 4)(
b790: 22 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74 "reviewed" 5)("t
b7a0: 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 ags" 9)))))..;;
b7b0: 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 Update test_meta
b7c0: 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 for all tests.(
b7d0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 define (runs:upd
b7e0: 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 ate-all-test_met
b7f0: 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 a db). (let ((t
b800: 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 est-names (get-a
b810: 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 ll-legal-tests))
b820: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 ). (for-each
b830: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 . (lambda (t
b840: 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 est-name).
b850: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 (let* ((test-pa
b860: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 th (conc *top
b870: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 path* "/tests/"
b880: 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 test-name))..
b890: 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 (test-configf
b8a0: 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 (conc test-path
b8b0: 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 "/testconfig"))
b8c0: 0a 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69 .. (testexi
b8d0: 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 sts (and (file
b8e0: 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f -exists? test-co
b8f0: 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 nfigf)(file-read
b900: 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f -access? test-co
b910: 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 nfigf)))..
b920: 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 ;; read configs
b930: 77 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e with tricks turn
b940: 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 ed off (i.e. no
b950: 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 system).. (
b960: 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 test-conf (if
b970: 20 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 testexists (rea
b980: 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f d-config test-co
b990: 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b nfigf #f #f)(mak
b9a0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 e-hash-table))))
b9b0: 0a 09 20 3b 3b 20 75 73 65 20 74 68 65 20 6f 70 .. ;; use the op
b9c0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 69 6e 73 en-run-close ins
b9d0: 74 65 61 64 20 6f 66 20 70 61 73 73 69 6e 67 20 tead of passing
b9e0: 69 6e 20 64 62 0a 09 20 28 72 75 6e 73 3a 75 70 in db.. (runs:up
b9f0: 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 23 date-test_meta #
ba00: 66 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 f test-name test
ba10: 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 -conf))). te
ba20: 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 st-names)))..;;
ba30: 54 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 This could proba
ba40: 62 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 bly be refactore
ba50: 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c d into one compl
ba60: 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 ex query ....(de
ba70: 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 fine (runs:rollu
ba80: 70 2d 72 75 6e 20 6b 65 79 73 20 6b 65 79 76 61 p-run keys keyva
ba90: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 llst runname use
baa0: 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 r) ;; was target
bab0: 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a , now keyvallst.
bac0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
bad0: 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 "runs:rollup-ru
bae0: 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 n, keys: " keys
baf0: 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b " keyvallst: " k
bb00: 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e eyvallst " :runn
bb10: 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 ame " runname "
bb20: 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 user: " user).
bb30: 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 (let* ((db
bb40: 20 20 20 20 20 20 20 20 23 66 29 20 3b 3b 20 28 #f) ;; (
bb50: 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 keyvalllst
bb60: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 (keys:target->ke
bb70: 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 yval keys target
bb80: 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 )).. (new-run-id
bb90: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 (cdb:remot
bba0: 65 2d 72 75 6e 20 64 62 3a 72 65 67 69 73 74 65 e-run db:registe
bbb0: 72 2d 72 75 6e 20 23 66 20 6b 65 79 73 20 6b 65 r-run #f keys ke
bbc0: 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 yvallst runname
bbd0: 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 "new" "n/a" user
bbe0: 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 )).. (prev-tests
bbf0: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
bc00: 63 6c 6f 73 65 20 74 65 73 74 3a 67 65 74 2d 6d close test:get-m
bc10: 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 atching-previous
bc20: 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 -test-run-record
bc30: 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 s db new-run-id
bc40: 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 "%" "%")).. (cur
bc50: 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70 r-tests (op
bc60: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
bc70: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 get-tests-for-ru
bc80: 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 n db new-run-id
bc90: 22 25 2f 25 22 20 27 28 29 20 27 28 29 29 29 0a "%/%" '() '())).
bca0: 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 . (curr-tests-ha
bcb0: 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 sh (make-hash-ta
bcc0: 62 6c 65 29 29 29 0a 20 20 20 20 28 6f 70 65 6e ble))). (open
bcd0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75 70 -run-close db:up
bce0: 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 date-run-event_t
bcf0: 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 ime db new-run-i
bd00: 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 d). ;; index
bd10: 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65 the already save
bd20: 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e d tests by testn
bd30: 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20 ame and itemdat
bd40: 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 in curr-tests-ha
bd50: 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 sh. (for-each
bd60: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 . (lambda (t
bd70: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 estdat). (
bd80: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 let* ((testname
bd90: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
bda0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 stname testdat))
bdb0: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 .. (item-pa
bdc0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
bdd0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 item-path testda
bde0: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c t)).. (full
bdf0: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 -name (conc test
be00: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
be10: 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 th))).. (hash-ta
be20: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 ble-set! curr-te
be30: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 sts-hash full-na
be40: 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20 me testdat))).
be50: 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20 curr-tests).
be60: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d ;; NOPE: Non-
be70: 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 optimal approach
be80: 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65 . Try this inste
be90: 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 ad.. ;; 1.
bea0: 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76 tests are receiv
beb0: 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f ed in a list, mo
bec0: 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a st recent first.
bed0: 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c ;; 2. repl
bee0: 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 ace the rollup t
bef0: 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 est with the new
bf00: 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 *always*. (f
bf10: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
bf20: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a ambda (testdat).
bf30: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 (let* ((t
bf40: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 estname (db:tes
bf50: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
bf60: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 estdat))..
bf70: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 (item-path (db:t
bf80: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 est-get-item-pat
bf90: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 h testdat))..
bfa0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 (full-name (c
bfb0: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 onc testname "/"
bfc0: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 item-path))..
bfd0: 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64 (prev-test-d
bfe0: 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 at (hash-table-r
bff0: 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d ef/default curr-
c000: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d tests-hash full-
c010: 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20 name #f))..
c020: 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20 (test-steps
c030: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
c040: 65 20 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 e db:get-steps-f
c050: 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74 or-test db (db:t
c060: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
c070: 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65 at))).. (ne
c080: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 w-test-record #f
c090: 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 )).. ;; replace
c0a0: 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 72 these with inser
c0b0: 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 t ... select.. (
c0c0: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 apply sqlite3:ex
c0d0: 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28 ecute ...db ...(
c0e0: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 conc "INSERT OR
c0f0: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 REPLACE INTO tes
c100: 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e ts (run_id,testn
c110: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
c120: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 ,event_time,host
c130: 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 ,cpuload,diskfre
c140: 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 e,uname,rundir,i
c150: 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 tem_path,run_dur
c160: 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 ation,final_logf
c170: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 ,comment) "...
c180: 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f "VALUES (?,?
c190: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
c1a0: 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e ,?,?,?,?);")...n
c1b0: 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 ew-run-id (cddr
c1c0: 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 (vector->list te
c1d0: 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 stdat))).. (set!
c1e0: 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 new-testdat (ca
c1f0: 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 r (open-run-clos
c200: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 e db:get-tests-f
c210: 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 or-run db new-ru
c220: 6e 2d 69 64 20 28 63 6f 6e 63 20 74 65 73 74 6e n-id (conc testn
c230: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
c240: 68 29 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 h) '() '())))..
c250: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 (hash-table-set!
c260: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 curr-tests-hash
c270: 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 full-name new-t
c280: 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 20 estdat) ;; this
c290: 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 69 could be confusi
c2a0: 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 64 ng, which record
c2b0: 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20 should go into
c2c0: 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 the lookup table
c2d0: 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 ?.. ;; Now dupli
c2e0: 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73 74 cate the test st
c2f0: 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 69 eps.. (debug:pri
c300: 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 nt 4 "Copying re
c310: 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 74 cords in test_st
c320: 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 eps from test_id
c330: 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d =" (db:test-get-
c340: 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f id testdat) " to
c350: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
c360: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 id new-testdat))
c370: 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f .. (open-run-clo
c380: 73 65 20 0a 09 20 20 28 6c 61 6d 62 64 61 20 28 se .. (lambda (
c390: 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a ).. (sqlite3:
c3a0: 65 78 65 63 75 74 65 20 0a 09 20 20 20 20 20 64 execute .. d
c3b0: 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22 b .. (conc "
c3c0: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 INSERT OR REPLAC
c3d0: 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 E INTO test_step
c3e0: 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e s (test_id,stepn
c3f0: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
c400: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d ,event_time,comm
c410: 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c ent) "... "SEL
c420: 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 ECT " (db:test-g
c430: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
c440: 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 t) ",stepname,st
c450: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 ate,status,event
c460: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 _time,comment FR
c470: 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 OM test_steps WH
c480: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 ERE test_id=?;")
c490: 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d .. (db:test-
c4a0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
c4b0: 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20 64 75 70 .. ;; Now dup
c4c0: 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 licate the test
c4d0: 64 61 74 61 0a 09 20 20 20 20 28 64 65 62 75 67 data.. (debug
c4e0: 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e :print 4 "Copyin
c4f0: 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 g records in tes
c500: 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74 t_data from test
c510: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 _id=" (db:test-g
c520: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 et-id testdat) "
c530: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 to " (db:test-g
c540: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
c550: 74 29 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65 t)).. (sqlite
c560: 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 20 3:execute ..
c570: 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 db .. (conc
c580: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c "INSERT OR REPL
c590: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 ACE INTO test_da
c5a0: 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 74 65 ta (test_id,cate
c5b0: 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 gory,variable,va
c5c0: 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c lue,expected,tol
c5d0: 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 ,units,comment)
c5e0: 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 22 "... "SELECT "
c5f0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
c600: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c new-testdat) ",
c610: 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c category,variabl
c620: 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 e,value,expected
c630: 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 ,tol,units,comme
c640: 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 74 nt FROM test_dat
c650: 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d a WHERE test_id=
c660: 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a 74 ?;").. (db:t
c670: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
c680: 61 74 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 at)))).. )).
c690: 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09 prev-tests)))..
c6a0: 20 0a 20 20 20 20 20 0a . .