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 3b 3b 20 72 65 67 69 73 74 65 ====..;; registe
1b70: 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 74 r a test run wit
1b80: 68 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e 65 h the db.(define
1b90: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d (runs:register-
1ba0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
1bb0: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 allst runname st
1bc0: 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29 ate status user)
1bd0: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
1be0: 33 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65 72 3 "runs:register
1bf0: 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 -run, keys: " ke
1c00: 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 ys " keyvallst:
1c10: 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72 75 " keyvallst " ru
1c20: 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65 nname: " runname
1c30: 20 22 20 73 74 61 74 65 3a 20 22 20 73 74 61 74 " state: " stat
1c40: 65 20 22 20 73 74 61 74 75 73 3a 20 22 20 73 74 e " status: " st
1c50: 61 74 75 73 20 22 20 75 73 65 72 3a 20 22 20 75 atus " user: " u
1c60: 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b ser). (let* ((k
1c70: 65 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d 3e eystr (keys->
1c80: 6b 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09 20 keystr keys))..
1c90: 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20 28 (comma (if (
1ca0: 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 > (length keys)
1cb0: 30 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28 61 0) "," "")).. (a
1cc0: 6e 64 73 74 72 20 20 20 20 28 69 66 20 28 3e 20 ndstr (if (>
1cd0: 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 (length keys) 0)
1ce0: 20 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09 20 " AND " ""))..
1cf0: 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73 (valslots (keys
1d00: 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29 ->valslots keys)
1d10: 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 ) ;; ?,?,? .....
1d20: 20 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61 70 (keyvals (map
1d30: 20 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74 29 cadr keyvallst)
1d40: 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20 28 ).. (allvals (
1d50: 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e append (list run
1d60: 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 name state statu
1d70: 73 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73 29 s user) keyvals)
1d80: 29 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20 28 ).. (qryvals (
1d90: 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e append (list run
1da0: 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29 0a name) keyvals)).
1db0: 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 . (key=?str (st
1dc0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
1dd0: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b (map (lambda (k
1de0: 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d )(conc (key:get-
1df0: 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f fieldname k) "=?
1e00: 22 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 ")) keys) " AND
1e10: 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a "))). (debug:
1e20: 70 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 print 3 "keys: "
1e30: 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a keys " allvals:
1e40: 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 " allvals " key
1e50: 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 29 vals: " keyvals)
1e60: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
1e70: 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 t 2 "NOTE: using
1e80: 20 74 61 72 67 65 74 20 22 20 28 73 74 72 69 6e target " (strin
1e90: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 g-intersperse ke
1ea0: 79 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f 72 yvals "/") " for
1eb0: 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 20 this run").
1ec0: 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 (if (and runname
1ed0: 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 (null? (filter
1ee0: 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 (lambda (x)(not
1ef0: 78 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20 3b x)) keyvals))) ;
1f00: 3b 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 20 ; there must be
1f10: 61 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20 a better way to
1f20: 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 "apply and"..(le
1f30: 74 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 20 t ((res #f))..
1f40: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 (apply sqlite3:e
1f50: 78 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 20 xecute db (conc
1f60: 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 "INSERT OR IGNOR
1f70: 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e E INTO runs (run
1f80: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
1f90: 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 s,owner,event_ti
1fa0: 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 me" comma keystr
1fb0: 20 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c ") VALUES (?,?,
1fc0: 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 ?,?,strftime('%s
1fd0: 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 ','now')" comma
1fe0: 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 valslots ");")..
1ff0: 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 . allvals).. (a
2000: 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 pply sqlite3:for
2010: 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 -each-row .. (
2020: 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 20 lambda (id)..
2030: 20 20 28 73 65 74 21 20 72 65 73 20 69 64 29 29 (set! res id))
2040: 0a 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 74 .. db.. (let
2050: 20 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 45 ((qry (conc "SE
2060: 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e LECT id FROM run
2070: 73 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 s WHERE (runname
2080: 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 3d =? " andstr key=
2090: 3f 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 20 ?str ");")))..
20a0: 20 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 ;(debug:print
20b0: 20 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 20 4 "qry: " qry)
20c0: 0a 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 20 .. qry)..
20d0: 71 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 6c qryvals).. (sql
20e0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 ite3:execute db
20f0: 22 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 54 "UPDATE runs SET
2100: 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d state=?,status=
2110: 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 ? WHERE id=?;" s
2120: 74 61 74 65 20 73 74 61 74 75 73 20 72 65 73 29 tate status res)
2130: 0a 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 69 .. res) ..(begi
2140: 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e n.. (debug:prin
2150: 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c t 0 "ERROR: Call
2160: 65 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e ed without all n
2170: 65 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 0a ecessary keys").
2180: 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68 . #f))))..;; Th
2190: 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 is is a duplicat
21a0: 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28 e of run-tests (
21b0: 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64 which has been d
21c0: 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20 eprecated). Use
21d0: 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 this one instead
21e0: 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b of run tests..;
21f0: 3b 20 6b 65 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b ; keyvals..;;.;;
2200: 20 20 74 65 73 74 2d 6e 61 6d 65 73 3a 20 43 6f test-names: Co
2210: 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 70 61 mma separated pa
2220: 74 74 65 72 6e 73 20 73 61 6d 65 20 61 73 20 74 tterns same as t
2230: 65 73 74 2d 70 61 74 74 73 20 62 75 74 20 75 73 est-patts but us
2240: 65 64 20 69 6e 20 73 65 6c 65 63 74 69 6f 6e 20 ed in selection
2250: 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 .;;
2260: 20 6f 66 20 74 65 73 74 73 20 74 6f 20 72 75 6e of tests to run
2270: 2e 20 54 68 65 20 69 74 65 6d 20 70 6f 72 74 69 . The item porti
2280: 6f 6e 73 20 61 72 65 20 6e 6f 74 20 72 65 73 70 ons are not resp
2290: 65 63 74 65 64 2e 0a 3b 3b 20 20 20 20 20 20 20 ected..;;
22a0: 20 20 20 20 20 20 20 46 49 58 4d 45 3a 20 65 72 FIXME: er
22b0: 72 6f 72 20 6f 75 74 20 69 66 20 2f 70 61 74 74 ror out if /patt
22c0: 20 73 70 65 63 69 66 69 65 64 0a 3b 3b 20 20 20 specified.;;
22d0: 20 20 20 20 20 20 20 20 20 0a 28 64 65 66 69 6e .(defin
22e0: 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 e (runs:run-test
22f0: 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 s target runname
2300: 20 74 65 73 74 2d 6e 61 6d 65 73 20 74 65 73 74 test-names test
2310: 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c 61 67 -patts user flag
2320: 73 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 s). (common:cle
2330: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c ar-caches) ;; cl
2340: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20 ear all caches.
2350: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 (let* ((db
2360: 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73 #f).. (keys
2370: 20 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d (cdb:rem
2380: 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b ote-run db:get-k
2390: 65 79 73 20 23 66 29 29 0a 09 20 28 6b 65 79 76 eys #f)).. (keyv
23a0: 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61 allst (keys:ta
23b0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 rget->keyval key
23c0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 75 s target)).. (ru
23d0: 6e 2d 69 64 20 20 20 20 20 20 28 63 64 62 3a 72 n-id (cdb:r
23e0: 65 6d 6f 74 65 2d 72 75 6e 20 72 75 6e 73 3a 72 emote-run runs:r
23f0: 65 67 69 73 74 65 72 2d 72 75 6e 20 23 66 20 6b egister-run #f k
2400: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 eys keyvallst ru
2410: 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 nname "new" "n/a
2420: 22 20 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65 " user)) ;; te
2430: 73 74 2d 6e 61 6d 65 29 29 29 0a 09 20 28 6b 65 st-name))).. (ke
2440: 79 76 61 6c 73 20 20 20 20 20 28 69 66 20 72 75 yvals (if ru
2450: 6e 2d 69 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 n-id (cdb:remote
2460: 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 2d -run db:get-key-
2470: 76 61 6c 73 20 23 66 20 72 75 6e 2d 69 64 29 20 vals #f run-id)
2480: 23 66 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 #f)).. (deferred
2490: 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 '()) ;; dela
24a0: 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 y running these
24b0: 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 since they have
24c0: 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a a waiton clause.
24d0: 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 . ;; keepgoing i
24e0: 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f s the defacto mo
24f0: 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c dality now, will
2500: 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 add hit-n-run a
2510: 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 bit later.. ;;
2520: 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 (keepgoing (ha
2530: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
2540: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 ault flags "-kee
2550: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 pgoing" #f)).. (
2560: 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f runconfigf (co
2570: 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f nc *toppath* "/
2580: 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 runconfigs.confi
2590: 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 g")).. (required
25a0: 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 -tests '()).. (t
25b0: 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b est-records (mak
25c0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
25d0: 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 . (set-megate
25e0: 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d st-env-vars run-
25f0: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 id) ;; these may
2600: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 be needed by th
2610: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 e launching proc
2620: 65 73 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 ess.. (if (fi
2630: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f le-exists? runco
2640: 6e 66 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65 nfigf)..(setup-e
2650: 6e 76 2d 64 65 66 61 75 6c 74 73 20 72 75 6e 63 nv-defaults runc
2660: 6f 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 onfigf run-id *a
2670: 6c 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 lready-seen-runc
2680: 6f 6e 66 69 67 2d 69 6e 66 6f 2a 20 6b 65 79 73 onfig-info* keys
2690: 20 6b 65 79 76 61 6c 73 20 22 70 72 65 2d 6c 61 keyvals "pre-la
26a0: 75 6e 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a unch-env-vars").
26b0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 .(debug:print 0
26c0: 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f "WARNING: You do
26d0: 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 not have a run
26e0: 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 config file: " r
26f0: 75 6e 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 unconfigf)).
2700: 0a 20 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 . ;; look up
2710: 61 6c 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 all tests matchi
2720: 6e 67 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 ng the comma sep
2730: 61 72 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 arated list of g
2740: 6c 6f 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 lobs in. ;; t
2750: 65 73 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 est-patts (using
2760: 20 25 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a % as wildcard).
2770: 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d . (set! test-
2780: 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 67 65 74 names (tests:get
2790: 2d 76 61 6c 69 64 2d 74 65 73 74 73 20 2a 74 6f -valid-tests *to
27a0: 70 70 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d 65 ppath* test-name
27b0: 73 29 29 0a 20 20 20 20 28 73 65 74 21 20 74 65 s)). (set! te
27c0: 73 74 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 st-names (delete
27d0: 2d 64 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 -duplicates test
27e0: 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 -names)).. (d
27f0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
2800: 30 20 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20 0 "test names "
2810: 74 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 test-names)..
2820: 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 ;; on the first
2830: 20 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f pass or call to
2840: 20 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 run-tests set F
2850: 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 AILS to NOT_STAR
2860: 54 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b TED if. ;; -k
2870: 65 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 eepgoing is spec
2880: 69 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 ified. (if (e
2890: 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a q? *passnum* 0).
28a0: 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 .(begin.. ;; ha
28b0: 76 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 ve to delete tes
28c0: 74 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 t records where
28d0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 NOT_STARTED sinc
28e0: 65 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 e they can cause
28f0: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a -keepgoing to .
2900: 09 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 . ;; get stuck
2910: 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 due to becoming
2920: 69 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f inaccessible fro
2930: 6d 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e m a failed test.
2940: 20 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 I.e. if test B
2950: 64 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f depends .. ;; o
2960: 6e 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73 n test A but tes
2970: 74 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20 t B reached the
2980: 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 point on being r
2990: 65 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 egistered as NOT
29a0: 5f 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 _STARTED and tes
29b0: 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 t.. ;; A failed
29c0: 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e for some reason
29d0: 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 then on re-run
29e0: 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 using -keepgoing
29f0: 20 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 the run can nev
2a00: 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 er complete...
2a10: 28 63 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 (cdb:delete-test
2a20: 73 2d 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72 s-in-state *runr
2a30: 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e emote* run-id "N
2a40: 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 OT_STARTED")..
2a50: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 (cdb:remote-run
2a60: 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 db:set-tests-sta
2a70: 74 65 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e te-status #f run
2a80: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 -id test-names #
2a90: 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 f "FAIL" "NOT_ST
2aa0: 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 ARTED" "FAIL")))
2ab0: 0a 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 .. ;; from he
2ac0: 72 65 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 re on out the db
2ad0: 20 77 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 will be opened
2ae0: 61 6e 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 and closed on ev
2af0: 65 72 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 ery call runs:ru
2b00: 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20 n-tests-queue.
2b10: 20 20 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69 ;; (sqlite3:fi
2b20: 6e 61 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20 nalize! db) .
2b30: 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d ;; now add non-
2b40: 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e directly referen
2b50: 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 ced dependencies
2b60: 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 (i.e. waiton).
2b70: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c (if (not (nul
2b80: 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a l? test-names)).
2b90: 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 .(let loop ((hed
2ba0: 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 (car test-names
2bb0: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64 ))... (tal (cd
2bc0: 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 r test-names)))
2bd0: 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75 ;; 'retu
2be0: 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 rn-procs tells t
2bf0: 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72 he config reader
2c00: 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 to prep running
2c10: 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 74 75 system but retu
2c20: 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65 rn a proc.. (de
2c30: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 bug:print-info 4
2c40: 20 22 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 "hed=" hed " at
2c50: 20 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 top of loop")..
2c60: 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 (let* ((config
2c70: 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 (tests:get-tes
2c80: 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 tconfig hed 'ret
2c90: 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 urn-procs))... (
2ca0: 77 61 69 74 6f 6e 73 20 28 6c 65 74 20 28 28 69 waitons (let ((i
2cb0: 6e 73 74 72 20 28 69 66 20 63 6f 6e 66 69 67 20 nstr (if config
2cc0: 0a 09 09 09 09 09 20 20 20 28 63 6f 6e 66 69 67 ...... (config
2cd0: 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 -lookup config "
2ce0: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 requirements" "w
2cf0: 61 69 74 6f 6e 22 29 0a 09 09 09 09 09 20 20 20 aiton")......
2d00: 28 62 65 67 69 6e 20 3b 3b 20 4e 6f 20 63 6f 6e (begin ;; No con
2d10: 66 69 67 20 6d 65 61 6e 73 20 74 68 69 73 20 69 fig means this i
2d20: 73 20 61 20 6e 6f 6e 2d 65 78 69 73 74 61 6e 74 s a non-existant
2d30: 20 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 test......
2d40: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
2d50: 45 52 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 ERROR: non-exist
2d60: 65 6e 74 20 72 65 71 75 69 72 65 64 20 74 65 73 ent required tes
2d70: 74 20 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a t \"" hed "\"").
2d80: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 64 62 ..... (if db
2d90: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 (sqlite3:finali
2da0: 7a 65 21 20 64 62 29 29 0a 09 09 09 09 09 20 20 ze! db))......
2db0: 20 20 20 28 65 78 69 74 20 31 29 29 29 29 29 0a (exit 1))))).
2dc0: 09 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
2dd0: 69 6e 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 int-info 8 "wait
2de0: 6f 6e 73 20 73 74 72 69 6e 67 20 69 73 20 22 20 ons string is "
2df0: 69 6e 73 74 72 29 0a 09 09 09 20 20 20 20 28 73 instr).... (s
2e00: 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 63 6f 6e tring-split (con
2e10: 64 0a 09 09 09 09 09 20 20 20 28 28 70 72 6f 63 d...... ((proc
2e20: 65 64 75 72 65 3f 20 69 6e 73 74 72 29 0a 09 09 edure? instr)...
2e30: 09 09 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 ... (let ((re
2e40: 73 20 28 69 6e 73 74 72 29 29 29 0a 09 09 09 09 s (instr))).....
2e50: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
2e60: 69 6e 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 int-info 8 "wait
2e70: 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 72 65 73 on procedure res
2e80: 75 6c 74 73 20 69 6e 20 73 74 72 69 6e 67 20 22 ults in string "
2e90: 20 72 65 73 20 22 20 66 6f 72 20 74 65 73 74 20 res " for test
2ea0: 22 20 68 65 64 29 0a 09 09 09 09 09 20 20 20 20 " hed)......
2eb0: 20 20 72 65 73 29 29 0a 09 09 09 09 09 20 20 20 res))......
2ec0: 28 28 73 74 72 69 6e 67 3f 20 69 6e 73 74 72 29 ((string? instr)
2ed0: 20 20 20 20 20 69 6e 73 74 72 29 0a 09 09 09 09 instr).....
2ee0: 09 20 20 20 28 65 6c 73 65 20 0a 09 09 09 09 09 . (else ......
2ef0: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 54 68 69 ;; NOTE: Thi
2f00: 73 20 69 73 20 61 63 74 75 61 6c 6c 79 20 74 68 s is actually th
2f10: 65 20 63 61 73 65 20 6f 66 20 2a 6e 6f 2a 20 77 e case of *no* w
2f20: 61 69 74 6f 6e 73 21 20 3b 3b 20 28 64 65 62 75 aitons! ;; (debu
2f30: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
2f40: 3a 20 73 6f 6d 65 74 68 69 6e 67 20 77 65 6e 74 : something went
2f50: 20 77 72 6f 6e 67 20 69 6e 20 70 72 6f 63 65 73 wrong in proces
2f60: 73 69 6e 67 20 77 61 69 74 6f 6e 73 20 66 6f 72 sing waitons for
2f70: 20 74 65 73 74 20 22 20 68 65 64 29 0a 09 09 09 test " hed)....
2f80: 09 09 20 20 20 20 22 22 29 29 29 29 29 29 0a 09 .. ""))))))..
2f90: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
2fa0: 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 -info 8 "waitons
2fb0: 3a 20 22 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 : " waitons)..
2fc0: 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 ;; check for h
2fd0: 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e ed in waitons =>
2fe0: 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 this would be c
2ff0: 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 ircular, remove
3000: 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a it and issue an.
3010: 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 . ;; error..
3020: 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 (if (member h
3030: 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 ed waitons)...(b
3040: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a egin... (debug:
3050: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
3060: 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73 test " hed " has
3070: 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 listed itself a
3080: 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 s a waiton, plea
3090: 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 se correct this!
30a0: 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 ")... (set! wai
30b0: 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 tons (filter (la
30c0: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 mbda (x)(not (eq
30d0: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 ual? x hed))) wa
30e0: 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a itons)))).. .
30f0: 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 . ;; (items
3100: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d (items:get-item
3110: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f s-from-config co
3120: 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 nfig))).. (if
3130: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c (not (hash-tabl
3140: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 e-ref/default te
3150: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 st-records hed #
3160: 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c f))...(hash-tabl
3170: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f e-set! test-reco
3180: 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 rds..... hed (ve
3190: 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 ctor hed ;;
31a0: 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 0...... conf
31b0: 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 ig ;; 1......
31c0: 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a waitons ;; 2.
31d0: 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 ..... (confi
31e0: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 g-lookup config
31f0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 "requirements" "
3200: 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b priority") ;
3210: 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 ; priority 3....
3220: 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 .. (let ((it
3230: 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 ems (hash-t
3240: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
3250: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 config "items"
3260: 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a #f)) ;; items 4.
3270: 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 ...... (itemst
3280: 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 able (hash-table
3290: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e -ref/default con
32a0: 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 fig "itemstable"
32b0: 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 #f))) ......
32c0: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 ;; if either
32d0: 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 items or items
32e0: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 table is a proc
32f0: 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 return it so tes
3300: 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 t running......
3310: 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 ;; process
3320: 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c can know to cal
3330: 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d l items:get-item
3340: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 s-from-config...
3350: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 ... ;; if
3360: 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 either is a list
3370: 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 and none is a p
3380: 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 roc go ahead and
3390: 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a call get-items.
33a0: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f ..... ;; o
33b0: 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 therwise return
33c0: 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 #f - this is not
33d0: 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 an iterated tes
33e0: 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63 t...... (c
33f0: 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 ond.......((proc
3400: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 edure? items)
3410: 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 ....... (debu
3420: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 g:print-info 4 "
3430: 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65 items is a proce
3440: 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 dure, will calc
3450: 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 later")....... i
3460: 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20 20 tems)
3470: 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 ;; calc later..
3480: 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 .....((procedure
3490: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 ? itemstable)...
34a0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e .... (debug:prin
34b0: 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 74 t-info 4 "itemst
34c0: 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64 able is a proced
34d0: 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c ure, will calc l
34e0: 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 ater")....... it
34f0: 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20 20 20 emstable)
3500: 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 ;; calc later...
3510: 09 09 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61 ....((filter (la
3520: 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 mbda (x)........
3530: 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63 (let ((val (c
3540: 61 72 20 78 29 29 29 0a 09 09 09 09 09 09 09 20 ar x)))........
3550: 20 20 20 20 28 69 66 20 28 70 72 6f 63 65 64 75 (if (procedu
3560: 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29 re? val) val #f)
3570: 29 29 0a 09 09 09 09 09 09 09 20 28 61 70 70 65 ))........ (appe
3580: 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 nd (if (list? it
3590: 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a ems) items '()).
35a0: 09 09 09 09 09 09 09 09 20 28 69 66 20 28 6c 69 ........ (if (li
35b0: 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20 st? itemstable)
35c0: 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29 itemstable '()))
35d0: 29 0a 09 09 09 09 09 09 20 27 68 61 76 65 2d 70 )....... 'have-p
35e0: 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09 09 09 rocedure).......
35f0: 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d ((or (list? item
3600: 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 s)(list? itemsta
3610: 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f ble)) ;; calc no
3620: 77 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a w....... (debug:
3630: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 print-info 4 "it
3640: 65 6d 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 ems and itemstab
3650: 6c 65 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 le are lists, ca
3660: 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 lc now\n".......
3670: 09 20 20 20 20 20 20 22 20 20 20 20 69 74 65 6d . " item
3680: 73 3a 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 s: " items " ite
3690: 6d 73 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 mstable: " items
36a0: 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 table)....... (i
36b0: 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 tems:get-items-f
36c0: 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 rom-config confi
36d0: 67 29 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 g)).......(else
36e0: 23 66 29 29 29 20 20 20 20 20 20 20 20 20 20 20 #f)))
36f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3700: 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a ;; not iterated.
3710: 09 09 09 09 09 20 20 20 20 20 23 66 20 20 20 20 ..... #f
3720: 20 20 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a ;; itemsdat 5.
3730: 09 09 09 09 09 20 20 20 20 20 23 66 20 20 20 20 ..... #f
3740: 20 20 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65 ;; spare - use
3750: 64 20 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a d for item-path.
3760: 09 09 09 09 09 20 20 20 20 20 29 29 29 0a 09 20 ..... )))..
3770: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 (for-each ..
3780: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 (lambda (wai
3790: 74 6f 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 ton).. (if
37a0: 20 28 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f (and waiton (no
37b0: 74 20 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e t (member waiton
37c0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 test-names)))..
37d0: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 . (begin...
37e0: 20 20 28 73 65 74 21 20 72 65 71 75 69 72 65 64 (set! required
37f0: 2d 74 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 -tests (cons wai
3800: 74 6f 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 ton required-tes
3810: 74 73 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 ts))... (set
3820: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f ! test-names (co
3830: 6e 73 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e ns waiton test-n
3840: 61 6d 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73 ames))))) ;; was
3850: 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 an append, now
3860: 61 20 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 a cons.. wai
3870: 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 tons).. (let
3880: 28 28 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 ((remtests (dele
3890: 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 te-duplicates (a
38a0: 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 ppend waitons ta
38b0: 6c 29 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 l)))).. (if
38c0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d (not (null? rem
38d0: 74 65 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f tests))... (loo
38e0: 70 20 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 p (car remtests)
38f0: 28 63 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 (cdr remtests)))
3900: 29 29 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e )))).. (if (n
3910: 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 ot (null? requir
3920: 65 64 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 ed-tests))..(deb
3930: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 ug:print-info 1
3940: 22 41 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 "Adding " requir
3950: 65 64 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 ed-tests " to th
3960: 65 20 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 e run queue")).
3970: 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 ;; NOTE: thes
3980: 65 20 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 e are all parent
3990: 20 74 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 tests, items ar
39a0: 65 20 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 e not expanded y
39b0: 65 74 2e 0a 20 20 20 20 28 64 65 62 75 67 3a 70 et.. (debug:p
39c0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 rint-info 4 "tes
39d0: 74 2d 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 t-records=" (has
39e0: 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 h-table->alist t
39f0: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 est-records)).
3a00: 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 (runs:run-test
3a10: 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 s-queue run-id r
3a20: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f unname test-reco
3a30: 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c rds keyvallst fl
3a40: 61 67 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a ags test-patts).
3a50: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
3a60: 2d 69 6e 66 6f 20 34 20 22 41 6c 6c 20 64 6f 6e -info 4 "All don
3a70: 65 20 62 79 20 68 65 72 65 22 29 29 29 0a 0a 28 e by here")))..(
3a80: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c define (runs:cal
3a90: 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d c-fails prereqs-
3aa0: 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 not-met). (filt
3ab0: 65 72 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 er (lambda (test
3ac0: 29 0a 09 20 20 20 20 28 61 6e 64 20 28 76 65 63 ).. (and (vec
3ad0: 74 6f 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f tor? test) ;; no
3ae0: 74 20 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 t (string? test)
3af0: 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 28 64 62 )... (equal? (db
3b00: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 :test-get-state
3b10: 74 65 73 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 test) "COMPLETED
3b20: 22 29 0a 09 09 20 28 6e 6f 74 20 28 6d 65 6d 62 ")... (not (memb
3b30: 65 72 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d er (db:test-get-
3b40: 73 74 61 74 75 73 20 74 65 73 74 29 0a 09 09 09 status test)....
3b50: 20 20 20 20 20 20 27 28 22 50 41 53 53 22 20 22 '("PASS" "
3b60: 57 41 52 4e 22 20 22 43 48 45 43 4b 22 20 22 57 WARN" "CHECK" "W
3b70: 41 49 56 45 44 22 20 22 53 4b 49 50 22 29 29 29 AIVED" "SKIP")))
3b80: 29 29 0a 09 20 20 70 72 65 72 65 71 73 2d 6e 6f )).. prereqs-no
3b90: 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 t-met))..(define
3ba0: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d (runs:calc-not-
3bb0: 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 completed prereq
3bc0: 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 s-not-met). (fi
3bd0: 6c 74 65 72 0a 20 20 20 28 6c 61 6d 62 64 61 20 lter. (lambda
3be0: 28 74 29 0a 20 20 20 20 20 28 6f 72 20 28 6e 6f (t). (or (no
3bf0: 74 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 t (vector? t))..
3c00: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22 43 (not (equal? "C
3c10: 4f 4d 50 4c 45 54 45 44 22 20 28 64 62 3a 74 65 OMPLETED" (db:te
3c20: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 29 st-get-state t))
3c30: 29 29 29 0a 20 20 20 70 72 65 72 65 71 73 2d 6e ))). prereqs-n
3c40: 6f 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e ot-met))..(defin
3c50: 65 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 e (runs:pretty-s
3c60: 74 72 69 6e 67 20 6c 73 74 29 0a 20 20 28 6d 61 tring lst). (ma
3c70: 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 20 p (lambda (t)..
3c80: 28 69 66 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 (if (not (vector
3c90: 3f 20 74 29 29 0a 09 20 20 20 20 20 28 63 6f 6e ? t)).. (con
3ca0: 63 20 74 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 c t).. (conc
3cb0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
3cc0: 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 stname t) ":" (d
3cd0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 b:test-get-state
3ce0: 20 74 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 t) "/" (db:test
3cf0: 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 -get-status t)))
3d00: 29 0a 20 20 20 20 20 20 20 6c 73 74 29 29 0a 0a ). lst))..
3d10: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6d 61 (define (runs:ma
3d20: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d ke-full-test-nam
3d30: 65 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 70 e testname itemp
3d40: 61 74 68 29 0a 20 20 28 69 66 20 28 65 71 75 61 ath). (if (equa
3d50: 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 l? itempath "")
3d60: 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 74 testname (conc t
3d70: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d estname "/" item
3d80: 70 61 74 68 29 29 29 0a 0a 3b 3b 20 74 65 73 74 path)))..;; test
3d90: 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 -records is a ha
3da0: 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d sh table testnam
3db0: 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 e:item_path => v
3dc0: 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 ector < testname
3dd0: 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 testconfig wait
3de0: 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 ons priority ite
3df0: 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 ms-info ... >.(d
3e00: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d efine (runs:run-
3e10: 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e 2d tests-queue run-
3e20: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
3e30: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 records keyvalls
3e40: 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 74 t flags test-pat
3e50: 74 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 ts). ;; At th
3e60: 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 is point the lis
3e70: 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 t of parent test
3e80: 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 s is expanded .
3e90: 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c ;; NB// Shoul
3ea0: 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 d expand items h
3eb0: 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 ere and then ins
3ec0: 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e ert into the run
3ed0: 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 queue.. (debug
3ee0: 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 :print 5 "test-r
3ef0: 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 ecords: " test-r
3f00: 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c ecords ", keyval
3f10: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 lst: " keyvallst
3f20: 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 " flags: " (has
3f30: 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 h-table->alist f
3f40: 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 lags)). (let ((
3f50: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 sorted-test-name
3f60: 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 s (tests:sort-by
3f70: 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 -priority-and-wa
3f80: 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 iton test-record
3f90: 73 29 29 0a 09 28 74 65 73 74 2d 72 65 67 69 73 s))..(test-regis
3fa0: 74 65 72 79 20 20 20 20 28 6d 61 6b 65 2d 68 61 tery (make-ha
3fb0: 73 68 2d 74 61 62 6c 65 29 29 0a 09 28 72 65 67 sh-table))..(reg
3fc0: 69 73 74 65 72 79 2d 6d 75 74 65 78 20 20 20 28 istery-mutex (
3fd0: 6d 61 6b 65 2d 6d 75 74 65 78 29 29 0a 09 28 6e make-mutex))..(n
3fe0: 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20 20 20 um-retries
3ff0: 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74 72 69 0)..(max-retri
4000: 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 es (config
4010: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 -lookup *configd
4020: 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78 at* "setup" "max
4030: 72 65 74 72 69 65 73 22 29 29 29 0a 20 20 20 20 retries"))).
4040: 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72 69 65 (set! max-retrie
4050: 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78 2d 72 s (if (and max-r
4060: 65 74 72 69 65 73 20 28 73 74 72 69 6e 67 2d 3e etries (string->
4070: 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 number max-retri
4080: 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e 75 6d es))(string->num
4090: 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 29 ber max-retries)
40a0: 20 31 30 30 29 29 0a 20 20 20 20 28 69 66 20 28 100)). (if (
40b0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65 not (null? sorte
40c0: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 d-test-names))..
40d0: 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 (let loop ((hed
40e0: 20 20 20 20 20 20 20 20 28 63 61 72 20 73 6f 72 (car sor
40f0: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 ted-test-names))
4100: 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 20 20 ... (tal
4110: 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74 (cdr sorted-t
4120: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 est-names))...
4130: 20 28 72 65 72 75 6e 73 20 20 20 20 20 20 27 28 (reruns '(
4140: 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f 74 20 ))).. (if (not
4150: 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 28 (null? reruns))(
4160: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f debug:print-info
4170: 20 34 20 22 72 65 72 75 6e 73 3d 22 20 72 65 72 4 "reruns=" rer
4180: 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28 70 72 69 uns)).. ;; (pri
4190: 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f 6f 70 2c nt "Top of loop,
41a0: 20 68 65 64 3d 22 20 68 65 64 20 22 2c 20 74 61 hed=" hed ", ta
41b0: 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65 72 75 6e l=" tal " ,rerun
41c0: 73 3d 22 20 72 65 72 75 6e 73 29 0a 09 20 20 28 s=" reruns).. (
41d0: 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65 63 6f let* ((test-reco
41e0: 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 rd (hash-table-r
41f0: 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 ef test-records
4200: 68 65 64 29 29 0a 09 09 20 28 74 65 73 74 2d 6e hed))... (test-n
4210: 61 6d 65 20 20 20 28 74 65 73 74 73 3a 74 65 73 ame (tests:tes
4220: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e tqueue-get-testn
4230: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 ame test-record)
4240: 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20 )... (tconfig
4250: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
4260: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ue-get-testconfi
4270: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a g test-record)).
4280: 09 09 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20 .. (testmode
4290: 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67 (let ((m (config
42a0: 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 -lookup tconfig
42b0: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 "requirements" "
42c0: 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 28 69 66 mode"))).....(if
42d0: 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 m (string->symb
42e0: 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29 ol m) 'normal)))
42f0: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20 ... (waitons
4300: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
4310: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 e-get-waitons
4320: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
4330: 09 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 . (priority (
4340: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
4350: 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 get-priority t
4360: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 est-record))...
4370: 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 (itemdat (te
4380: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
4390: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 t-itemdat tes
43a0: 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74 t-record)) ;; it
43b0: 65 6d 64 61 74 20 63 61 6e 20 62 65 20 61 20 73 emdat can be a s
43c0: 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23 tring, list or #
43d0: 66 0a 09 09 20 28 69 74 65 6d 73 20 20 20 20 20 f... (items
43e0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
43f0: 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20 ue-get-items
4400: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
4410: 09 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 .. (item-path
4420: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 (item-list->path
4430: 20 69 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e itemdat))... (n
4440: 65 77 74 61 6c 20 20 20 20 20 20 28 61 70 70 65 ewtal (appe
4450: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 nd tal (list hed
4460: 29 29 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 )))).. ..
4470: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 (debug:print 6..
4480: 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 3a 20 22 .. "test-name: "
4490: 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 09 20 22 test-name.... "
44a0: 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 20 20 20 \n hed:
44b0: 20 22 20 68 65 64 0a 09 09 09 20 22 5c 6e 20 20 " hed.... "\n
44c0: 69 74 65 6d 64 61 74 3a 20 20 20 20 20 22 20 69 itemdat: " i
44d0: 74 65 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20 20 temdat.... "\n
44e0: 69 74 65 6d 73 3a 20 20 20 20 20 20 20 22 20 69 items: " i
44f0: 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 tems.... "\n it
4500: 65 6d 2d 70 61 74 68 3a 20 20 20 22 20 69 74 65 em-path: " ite
4510: 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 m-path.... "\n
4520: 77 61 69 74 6f 6e 73 3a 20 20 20 20 20 22 20 77 waitons: " w
4530: 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c 6e 20 20 aitons.... "\n
4540: 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 22 20 6e num-retries: " n
4550: 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 09 20 22 um-retries.... "
4560: 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20 20 20 20 \n tal:
4570: 20 22 20 74 61 6c 0a 09 09 09 20 22 5c 6e 20 20 " tal.... "\n
4580: 72 65 72 75 6e 73 3a 20 20 20 20 20 20 22 20 72 reruns: " r
4590: 65 72 75 6e 73 29 0a 0a 09 20 20 20 20 3b 3b 20 eruns)... ;;
45a0: 63 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e check for hed in
45b0: 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 waitons => this
45c0: 20 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c would be circul
45d0: 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e ar, remove it an
45e0: 64 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 d issue an..
45f0: 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 ;; error.. (i
4600: 66 20 28 6d 65 6d 62 65 72 20 74 65 73 74 2d 6e f (member test-n
4610: 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 ame waitons)...(
4620: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 begin... (debug
4630: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
4640: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d test " test-nam
4650: 65 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 e " has listed i
4660: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f tself as a waito
4670: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 n, please correc
4680: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 t this!")... (s
4690: 65 74 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74 et! waiton (filt
46a0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e er (lambda (x)(n
46b0: 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64 ot (equal? x hed
46c0: 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a ))) waitons)))).
46d0: 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 4f .. (cond ;; O
46e0: 55 54 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 UTER COND..
46f0: 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 ((not items) ;;
4700: 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 when false the t
4710: 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 est is ok to be
4720: 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 handed off to la
4730: 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 unch (but not be
4740: 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65 fore).. (le
4750: 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 74 73 2d t* ((run-limits-
4760: 69 6e 66 6f 20 20 20 20 20 20 20 20 20 28 6f 70 info (op
4770: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e en-run-close run
4780: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 s:can-run-more-t
4790: 65 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64 ests test-record
47a0: 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 )) ;; look at th
47b0: 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 e test jobgroup
47c0: 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e and tot jobs run
47d0: 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 68 61 76 ning... (hav
47e0: 65 2d 72 65 73 6f 75 72 63 65 73 20 20 20 20 20 e-resources
47f0: 20 20 20 20 20 28 63 61 72 20 72 75 6e 2d 6c 69 (car run-li
4800: 6d 69 74 73 2d 69 6e 66 6f 29 29 0a 09 09 20 20 mits-info))...
4810: 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 (num-running
4820: 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 (lis
4830: 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 t-ref run-limits
4840: 2d 69 6e 66 6f 20 31 29 29 0a 09 09 20 20 20 20 -info 1))...
4850: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e (num-running-in
4860: 2d 6a 6f 62 67 72 6f 75 70 20 28 6c 69 73 74 2d -jobgroup (list-
4870: 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 ref run-limits-i
4880: 6e 66 6f 20 32 29 29 0a 09 09 20 20 20 20 20 28 nfo 2))... (
4890: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
48a0: 6f 62 73 20 20 20 20 20 28 6c 69 73 74 2d 72 65 obs (list-re
48b0: 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 f run-limits-inf
48c0: 6f 20 33 29 29 0a 09 09 20 20 20 20 20 28 6a 6f o 3))... (jo
48d0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 b-group-limit
48e0: 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 (list-ref
48f0: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 run-limits-info
4900: 34 29 29 0a 09 09 20 20 20 20 20 28 70 72 65 72 4))... (prer
4910: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 20 20 20 20 eqs-not-met
4920: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
4930: 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72 65 ose db:get-prere
4940: 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75 qs-not-met #f ru
4950: 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 n-id waitons ite
4960: 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 m-path mode: tes
4970: 74 6d 6f 64 65 29 29 0a 09 09 20 20 20 20 20 28 tmode))... (
4980: 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 fails
4990: 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 61 (runs:ca
49a0: 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 73 lc-fails prereqs
49b0: 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 20 -not-met))...
49c0: 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 (non-completed
49d0: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 (runs
49e0: 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 :calc-not-comple
49f0: 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d ted prereqs-not-
4a00: 6d 65 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a met)))...(debug:
4a10: 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 68 61 print-info 8 "ha
4a20: 76 65 2d 72 65 73 6f 75 72 63 65 73 3a 20 22 20 ve-resources: "
4a30: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 22 have-resources "
4a40: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
4a50: 3a 20 22 20 0a 09 09 09 20 20 20 20 20 28 73 74 : " .... (st
4a60: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
4a70: 20 0a 09 09 09 20 20 20 20 20 20 28 6d 61 70 20 .... (map
4a80: 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 09 09 (lambda (t).....
4a90: 20 20 20 20 20 28 69 66 20 28 76 65 63 74 6f 72 (if (vector
4aa0: 3f 20 74 29 0a 09 09 09 09 09 20 28 63 6f 6e 63 ? t)...... (conc
4ab0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
4ac0: 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 3a 74 ate t) "/" (db:t
4ad0: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 est-get-status t
4ae0: 29 29 0a 09 09 09 09 09 20 28 63 6f 6e 63 20 22 ))...... (conc "
4af0: 20 57 41 52 4e 49 4e 47 3a 20 74 20 69 73 20 6e WARNING: t is n
4b00: 6f 74 20 61 20 76 65 63 74 6f 72 3d 22 20 74 20 ot a vector=" t
4b10: 29 29 29 0a 09 09 09 09 20 20 20 70 72 65 72 65 )))..... prere
4b20: 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c 20 22 qs-not-met) ", "
4b30: 29 20 22 20 66 61 69 6c 73 3a 20 22 20 66 61 69 ) " fails: " fai
4b40: 6c 73 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 ls)...(debug:pri
4b50: 6e 74 2d 69 6e 66 6f 20 34 20 22 68 65 64 3d 22 nt-info 4 "hed="
4b60: 20 68 65 64 20 22 5c 6e 20 20 74 65 73 74 2d 72 hed "\n test-r
4b70: 65 63 6f 72 64 3d 22 20 74 65 73 74 2d 72 65 63 ecord=" test-rec
4b80: 6f 72 64 20 22 5c 6e 20 20 74 65 73 74 2d 6e 61 ord "\n test-na
4b90: 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 me: " test-name
4ba0: 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 "\n item-path:
4bb0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 6e 20 " item-path "\n
4bc0: 20 74 65 73 74 2d 70 61 74 74 73 3a 20 22 20 74 test-patts: " t
4bd0: 65 73 74 2d 70 61 74 74 73 29 0a 0a 09 09 3b 3b est-patts)....;;
4be0: 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 Don't know at t
4bf0: 68 69 73 20 74 69 6d 65 20 69 66 20 74 68 65 20 his time if the
4c00: 74 65 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c test have been l
4c10: 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20 aunched at some
4c20: 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74 time in the past
4c30: 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 ...;; i.e. is th
4c40: 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a is a re-launch?.
4c50: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 ..(debug:print-i
4c60: 6e 66 6f 20 34 20 22 72 75 6e 2d 6c 69 6d 69 74 nfo 4 "run-limit
4c70: 73 2d 69 6e 66 6f 20 3d 20 22 20 72 75 6e 2d 6c s-info = " run-l
4c80: 69 6d 69 74 73 2d 69 6e 66 6f 29 0a 09 09 28 63 imits-info)...(c
4c90: 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e ond ;; INNER CON
4ca0: 44 20 23 31 20 66 6f 72 20 61 20 6c 61 75 6e 63 D #1 for a launc
4cb0: 68 61 62 6c 65 20 74 65 73 74 0a 09 09 20 3b 3b hable test... ;;
4cc0: 20 43 68 65 63 6b 20 69 74 65 6d 20 70 61 74 68 Check item path
4cd0: 20 61 67 61 69 6e 73 74 20 69 74 65 6d 2d 70 61 against item-pa
4ce0: 74 74 73 0a 09 09 20 28 28 6e 6f 74 20 28 74 65 tts... ((not (te
4cf0: 73 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 sts:match test-p
4d00: 61 74 74 73 20 28 74 65 73 74 73 3a 74 65 73 74 atts (tests:test
4d10: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 queue-get-testna
4d20: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 me test-record)
4d30: 69 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 54 item-path)) ;; T
4d40: 68 69 73 20 74 65 73 74 2f 69 74 65 6d 70 61 74 his test/itempat
4d50: 68 20 69 73 20 6e 6f 74 20 74 6f 20 62 65 20 72 h is not to be r
4d60: 75 6e 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 un... ;; else t
4d70: 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c he run is stuck,
4d80: 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 temporarily or
4d90: 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 permanently...
4da0: 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 ;; but should ch
4db0: 65 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 eck if it is due
4dc0: 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f to lack of reso
4dd0: 75 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 urces vs. prereq
4de0: 75 69 73 69 74 65 73 0a 09 09 20 20 28 64 65 62 uisites... (deb
4df0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 ug:print-info 1
4e00: 22 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73 "Skipping " (tes
4e10: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
4e20: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 -testname test-r
4e30: 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d ecord) " " item-
4e40: 70 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65 path " as it doe
4e50: 73 6e 27 74 20 6d 61 74 63 68 20 22 20 74 65 73 sn't match " tes
4e60: 74 2d 70 61 74 74 73 29 0a 09 09 20 20 3b 3b 20 t-patts)... ;;
4e70: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a (thread-sleep! *
4e80: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 global-delta*)..
4e90: 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c . (if (not (nul
4ea0: 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 l? tal))...
4eb0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 (loop (car tal)
4ec0: 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 (cdr tal) reruns
4ed0: 29 29 29 0a 09 09 20 3b 3b 20 52 65 67 69 73 74 )))... ;; Regist
4ee0: 65 72 79 20 68 61 73 20 62 65 65 6e 20 73 74 61 ery has been sta
4ef0: 72 74 65 64 20 66 6f 72 20 74 68 69 73 20 74 65 rted for this te
4f00: 73 74 20 62 75 74 20 68 61 73 20 6e 6f 74 20 79 st but has not y
4f10: 65 74 20 63 6f 6d 70 6c 65 74 65 64 0a 09 09 20 et completed...
4f20: 3b 3b 20 74 68 69 73 20 73 68 6f 75 6c 64 20 62 ;; this should b
4f30: 65 20 72 61 72 65 2c 20 74 68 65 20 63 61 73 65 e rare, the case
4f40: 20 77 68 65 72 65 20 74 68 65 72 65 20 61 72 65 where there are
4f50: 20 6f 6e 6c 79 20 61 20 63 6f 75 70 6c 65 20 6f only a couple o
4f60: 66 20 74 65 73 74 73 20 61 6e 64 20 74 68 65 20 f tests and the
4f70: 64 62 20 69 73 20 73 6c 6f 77 0a 09 09 20 3b 3b db is slow... ;;
4f80: 20 64 65 6c 61 79 20 61 20 73 68 6f 72 74 20 77 delay a short w
4f90: 68 69 6c 65 20 61 6e 64 20 63 6f 6e 74 69 6e 75 hile and continu
4fa0: 65 0a 09 09 20 28 28 65 71 3f 20 28 68 61 73 68 e... ((eq? (hash
4fb0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
4fc0: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 lt test-register
4fd0: 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c y (runs:make-ful
4fe0: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 l-test-name test
4ff0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
5000: 20 23 66 29 20 27 73 74 61 72 74 29 0a 09 09 20 #f) 'start)...
5010: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 (thread-sleep!
5020: 30 2e 30 31 29 0a 09 09 20 20 28 6c 6f 6f 70 20 0.01)... (loop
5030: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 (car newtal)(cdr
5040: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 newtal) reruns)
5050: 29 0a 09 09 20 28 28 6e 6f 74 20 28 68 61 73 68 )... ((not (hash
5060: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
5070: 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 65 72 lt test-register
5080: 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c y (runs:make-ful
5090: 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 l-test-name test
50a0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
50b0: 20 23 66 29 29 0a 09 09 20 20 28 64 65 62 75 67 #f))... (debug
50c0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 50 :print-info 4 "P
50d0: 72 65 2d 72 65 67 69 73 74 65 72 69 6e 67 20 74 re-registering t
50e0: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
50f0: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 "/" item-path "
5100: 74 6f 20 63 72 65 61 74 65 20 70 6c 61 63 65 68 to create placeh
5110: 6f 6c 64 65 72 22 20 29 0a 09 09 20 20 3b 3b 20 older" )... ;;
5120: 4e 45 45 44 20 54 4f 20 54 48 52 45 41 44 49 46 NEED TO THREADIF
5130: 59 20 54 48 49 53 0a 09 09 20 20 3b 3b 20 28 6c Y THIS... ;; (l
5140: 65 74 20 28 28 74 68 20 28 6d 61 6b 65 2d 74 68 et ((th (make-th
5150: 72 65 61 64 20 28 6c 61 6d 62 64 61 20 28 29 0a read (lambda ().
5160: 09 09 20 20 3b 3b 20 20 20 20 20 20 20 09 09 20 .. ;; ..
5170: 20 20 28 70 72 69 6e 74 20 22 47 6f 74 20 68 65 (print "Got he
5180: 72 65 21 20 41 41 22 29 0a 09 09 20 20 3b 3b 20 re! AA")... ;;
5190: 20 20 20 20 20 20 09 09 20 20 20 28 6d 75 74 65 .. (mute
51a0: 78 2d 6c 6f 63 6b 21 20 72 65 67 69 73 74 65 72 x-lock! register
51b0: 79 2d 6d 75 74 65 78 29 0a 09 09 20 20 3b 3b 20 y-mutex)... ;;
51c0: 20 20 20 20 20 20 09 09 20 20 20 28 68 61 73 68 .. (hash
51d0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 -table-set! test
51e0: 2d 72 65 67 69 73 74 65 72 79 20 28 72 75 6e 73 -registery (runs
51f0: 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d :make-full-test-
5200: 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 name test-name i
5210: 74 65 6d 2d 70 61 74 68 29 20 27 73 74 61 72 74 tem-path) 'start
5220: 29 0a 09 09 20 20 3b 3b 20 20 20 20 20 20 20 09 )... ;; .
5230: 09 20 20 20 28 6d 75 74 65 78 2d 75 6e 6c 6f 63 . (mutex-unloc
5240: 6b 21 20 72 65 67 69 73 74 65 72 79 2d 6d 75 74 k! registery-mut
5250: 65 78 29 0a 09 09 20 20 20 20 20 20 20 20 20 09 ex)... .
5260: 09 20 20 20 28 63 64 62 3a 74 65 73 74 73 2d 72 . (cdb:tests-r
5270: 65 67 69 73 74 65 72 2d 74 65 73 74 20 23 66 20 egister-test #f
5280: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
5290: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 item-path)...
52a0: 3b 3b 20 20 20 20 20 20 20 09 09 20 20 20 28 70 ;; .. (p
52b0: 72 69 6e 74 20 22 47 6f 74 20 68 65 72 65 21 20 rint "Got here!
52c0: 41 42 22 29 0a 09 09 20 20 3b 3b 20 20 20 20 20 AB")... ;;
52d0: 20 20 09 09 20 20 20 28 6d 75 74 65 78 2d 6c 6f .. (mutex-lo
52e0: 63 6b 21 20 72 65 67 69 73 74 65 72 79 2d 6d 75 ck! registery-mu
52f0: 74 65 78 29 0a 09 09 20 20 20 20 20 20 20 20 20 tex)...
5300: 09 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 .. (hash-table
5310: 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 69 73 -set! test-regis
5320: 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d tery (runs:make-
5330: 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 full-test-name t
5340: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
5350: 74 68 29 20 27 64 6f 6e 65 29 0a 09 09 20 20 3b th) 'done)... ;
5360: 3b 20 20 20 20 20 20 20 09 09 20 20 20 28 6d 75 ; .. (mu
5370: 74 65 78 2d 75 6e 6c 6f 63 6b 21 20 72 65 67 69 tex-unlock! regi
5380: 73 74 65 72 79 2d 6d 75 74 65 78 29 29 0a 09 09 stery-mutex))...
5390: 20 20 3b 3b 20 20 20 20 20 20 20 09 09 20 28 63 ;; .. (c
53a0: 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f onc test-name "/
53b0: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a " item-path)))).
53c0: 09 09 20 20 3b 3b 20 20 20 28 74 68 72 65 61 64 .. ;; (thread
53d0: 2d 73 74 61 72 74 21 20 74 68 29 29 0a 09 09 20 -start! th))...
53e0: 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 ;; (thread-slee
53f0: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 p! *global-delta
5400: 2a 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d *).(runs:shrink-
5410: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
5420: 74 73 2d 64 65 6c 61 79 29 0a 09 09 20 20 28 6c ts-delay)... (l
5430: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 oop (car newtal)
5440: 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 (cdr newtal) rer
5450: 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74 20 68 uns))... ((not h
5460: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29 20 3b ave-resources) ;
5470: 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61 67 61 ; simply try aga
5480: 69 6e 20 61 66 74 65 72 20 77 61 69 74 69 6e 67 in after waiting
5490: 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20 28 64 a second... (d
54a0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
54b0: 31 20 22 6e 6f 20 72 65 73 6f 75 72 63 65 73 20 1 "no resources
54c0: 74 6f 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73 to run new tests
54d0: 2c 20 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a , waiting ...").
54e0: 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 .. ;; (thread-s
54f0: 6c 65 65 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 leep! (+ 2 *glob
5500: 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 al-delta*))...
5510: 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f ;; could have do
5520: 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 20 ne hed tal here
5530: 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64 but doing car/cd
5540: 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72 r of newtal to r
5550: 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 20 otate tests...
5560: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 (loop (car newta
5570: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 l)(cdr newtal) r
5580: 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61 6e 64 eruns))... ((and
5590: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 0a have-resources.
55a0: 09 09 20 20 20 20 20 20 20 28 6f 72 20 28 6e 75 .. (or (nu
55b0: 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d ll? prereqs-not-
55c0: 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e 64 20 met).... (and
55d0: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 (eq? testmode 't
55e0: 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e 75 oplevel).....(nu
55f0: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 ll? non-complete
5600: 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e 3a 74 d))))... (run:t
5610: 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 est run-id runna
5620: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 me keyvallst tes
5630: 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 23 t-record flags #
5640: 66 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d f).(runs:shrink-
5650: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
5660: 74 73 2d 64 65 6c 61 79 29 0a 09 09 20 20 3b 3b ts-delay)... ;;
5670: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 (thread-sleep!
5680: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a *global-delta*).
5690: 09 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 .. (if (not (nu
56a0: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 ll? tal))...
56b0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c (loop (car tal
56c0: 29 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e )(cdr tal) rerun
56d0: 73 29 29 29 0a 09 09 20 28 65 6c 73 65 20 3b 3b s)))... (else ;;
56e0: 20 6d 75 73 74 20 62 65 20 77 65 20 68 61 76 65 must be we have
56f0: 20 75 6e 6d 65 74 20 70 72 65 72 65 71 75 69 73 unmet prerequis
5700: 69 74 65 73 0a 09 09 20 20 20 20 28 64 65 62 75 ites... (debu
5710: 67 3a 70 72 69 6e 74 20 34 20 22 46 41 49 4c 53 g:print 4 "FAILS
5720: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 20 20 20 : " fails)...
5730: 20 3b 3b 20 49 66 20 6f 6e 65 20 6f 72 20 6d 6f ;; If one or mo
5740: 72 65 20 6f 66 20 74 68 65 20 70 72 65 72 65 71 re of the prereq
5750: 73 2d 6e 6f 74 2d 6d 65 74 20 61 72 65 20 46 41 s-not-met are FA
5760: 49 4c 20 74 68 65 6e 20 77 65 20 63 61 6e 20 69 IL then we can i
5770: 73 73 75 65 0a 09 09 20 20 20 20 3b 3b 20 61 20 ssue... ;; a
5780: 6d 65 73 73 61 67 65 20 61 6e 64 20 64 72 6f 70 message and drop
5790: 20 68 65 64 20 66 72 6f 6d 20 74 68 65 20 69 74 hed from the it
57a0: 65 6d 73 20 74 6f 20 62 65 20 70 72 6f 63 65 73 ems to be proces
57b0: 73 65 64 2e 0a 09 09 20 20 20 20 28 69 66 20 28 sed.... (if (
57c0: 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 null? fails)....
57d0: 28 62 65 67 69 6e 0a 09 09 09 20 20 3b 3b 20 63 (begin.... ;; c
57e0: 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b ouldn't run, tak
57f0: 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 09 e a breather....
5800: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 (debug:print-i
5810: 6e 66 6f 20 34 20 22 53 68 6f 75 6c 64 6e 27 74 nfo 4 "Shouldn't
5820: 20 72 65 61 6c 6c 79 20 67 65 74 20 68 65 72 65 really get here
5830: 2c 20 72 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e , race condition
5840: 3f 20 55 6e 61 62 6c 65 20 74 6f 20 6c 61 75 6e ? Unable to laun
5850: 63 68 20 6d 6f 72 65 20 74 65 73 74 73 20 61 74 ch more tests at
5860: 20 74 68 69 73 20 6d 6f 6d 65 6e 74 2c 20 6b 69 this moment, ki
5870: 6c 6c 69 6e 67 20 74 69 6d 65 20 2e 2e 2e 22 29 lling time ...")
5880: 0a 09 09 09 20 20 3b 3b 20 28 74 68 72 65 61 64 .... ;; (thread
5890: 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 -sleep! (+ 0.01
58a0: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 *global-delta*))
58b0: 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20 68 ;; long sleep h
58c0: 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72 63 ere - no resourc
58d0: 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c 20 es, may as well
58e0: 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20 20 be patient....
58f0: 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20 74 ;; we made new t
5900: 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20 68 al by sticking h
5910: 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20 6f ed at the back o
5920: 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20 20 f the list....
5930: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 (loop (car newta
5940: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 l)(cdr newtal) r
5950: 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74 68 eruns))....;; th
5960: 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 4c e waiton is FAIL
5970: 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 so no point in
5980: 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 65 trying to run he
5990: 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 09 d ever again....
59a0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
59b0: 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69 66 tal)).... (if
59c0: 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a 09 (vector? hed)..
59d0: 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 75 67 ...(begin (debug
59e0: 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 :print 1 "WARN:
59f0: 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22 20 Dropping test "
5a00: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
5a10: 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28 tname hed) "/" (
5a20: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
5a30: 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09 09 -path hed)......
5a40: 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65 20 . " from the
5a50: 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20 69 launch list as i
5a60: 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73 74 t has prerequist
5a70: 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49 4c es that are FAIL
5a80: 22 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e 6b 2d ").(runs:shrink-
5a90: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
5aa0: 74 73 2d 64 65 6c 61 79 29 0a 09 09 09 09 20 20 ts-delay).....
5ab0: 20 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d ;; (thread-
5ac0: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 sleep! *global-d
5ad0: 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 20 20 20 elta*).....
5ae0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c (loop (car tal
5af0: 29 28 63 64 72 20 74 61 6c 29 20 28 63 6f 6e 73 )(cdr tal) (cons
5b00: 20 68 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09 hed reruns)))..
5b10: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 ...(begin.....
5b20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
5b30: 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 WARN: Test not p
5b40: 72 6f 63 65 73 73 65 64 20 63 6f 72 72 65 63 74 rocessed correct
5b50: 6c 79 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72 ly. Could be a r
5b60: 61 63 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e ace condition in
5b70: 20 79 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65 your test imple
5b80: 6d 65 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 mentation? " hed
5b90: 29 20 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61 ) ;; " as it ha
5ba0: 73 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74 s prerequistes t
5bb0: 68 61 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e hat are FAIL. (N
5bc0: 4f 54 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 OTE: hed is not
5bd0: 61 20 76 65 63 74 6f 72 29 22 29 0a 28 72 75 6e a vector)").(run
5be0: 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e s:shrink-can-run
5bf0: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 -more-tests-dela
5c00: 79 29 0a 09 09 09 09 20 20 3b 3b 20 28 74 68 72 y)..... ;; (thr
5c10: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e ead-sleep! (+ 0.
5c20: 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 01 *global-delta
5c30: 2a 29 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 *))..... (loop
5c40: 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29 hed tal reruns))
5c50: 29 29 29 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f ))))))) ;; END O
5c60: 46 20 49 4e 4e 45 52 20 43 4f 4e 44 0a 09 20 20 F INNER COND..
5c70: 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61 73 .. ;; cas
5c80: 65 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d 73 e where an items
5c90: 20 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c 69 came in as a li
5ca0: 73 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 65 st been processe
5cb0: 64 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c d.. ((and (l
5cc0: 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20 ist? items)
5cd0: 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20 ;; thus we know
5ce0: 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c our items are al
5cf0: 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64 ready calculated
5d00: 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74 65 ... (not ite
5d10: 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e 6f mdat)) ;; and no
5d20: 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 20 69 t yet expanded i
5d30: 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20 nto the list of
5d40: 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f 6e things to be don
5d50: 65 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 6e e.. (if (an
5d60: 64 20 28 64 65 62 75 67 3a 64 65 62 75 67 2d 6d d (debug:debug-m
5d70: 6f 64 65 20 31 29 20 3b 3b 20 28 3e 3d 20 2a 76 ode 1) ;; (>= *v
5d80: 65 72 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 erbosity* 1)...
5d90: 20 20 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 (> (length
5da0: 20 69 74 65 6d 73 29 20 30 29 0a 09 09 20 20 20 items) 0)...
5db0: 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 (> (length (
5dc0: 63 61 72 20 69 74 65 6d 73 29 29 20 30 29 29 0a car items)) 0)).
5dd0: 09 09 20 20 28 70 70 20 69 74 65 6d 73 29 29 0a .. (pp items)).
5de0: 09 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 . (for-each
5df0: 0a 09 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 .. (lambda
5e00: 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 (my-itemdat)...
5e10: 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 (let* ((new-tes
5e20: 74 2d 72 65 63 6f 72 64 20 28 6c 65 74 20 28 28 t-record (let ((
5e30: 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d 74 65 73 newrec (make-tes
5e40: 74 73 3a 74 65 73 74 71 75 65 75 65 29 29 29 0a ts:testqueue))).
5e50: 09 09 09 09 09 20 20 20 28 76 65 63 74 6f 72 2d ..... (vector-
5e60: 63 6f 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72 copy! test-recor
5e70: 64 20 6e 65 77 72 65 63 29 0a 09 09 09 09 09 20 d newrec)......
5e80: 20 20 6e 65 77 72 65 63 29 29 0a 09 09 09 28 6d newrec))....(m
5e90: 79 2d 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 y-item-path (ite
5ea0: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d m-list->path my-
5eb0: 69 74 65 6d 64 61 74 29 29 29 0a 09 09 20 20 20 itemdat)))...
5ec0: 28 69 66 20 28 74 65 73 74 73 3a 6d 61 74 63 68 (if (tests:match
5ed0: 20 74 65 73 74 2d 70 61 74 74 73 20 68 65 64 20 test-patts hed
5ee0: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 20 3b 3b my-item-path) ;;
5ef0: 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 (patt-list-matc
5f00: 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 h my-item-path i
5f10: 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 tem-patts)
5f20: 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 ;; yes, we
5f30: 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 want to process
5f40: 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a this item, NOTE:
5f50: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 Should not need
5f60: 20 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 this check here
5f70: 21 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 !... (let
5f80: 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 72 ((newtestname (r
5f90: 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 uns:make-full-te
5fa0: 73 74 2d 6e 61 6d 65 20 68 65 64 20 6d 79 2d 69 st-name hed my-i
5fb0: 74 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b tem-path))) ;
5fc0: 3b 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 ; test names are
5fd0: 20 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e unique on testn
5fe0: 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 ame/item-path...
5ff0: 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 . (tests:testque
6000: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 ue-set-items!
6010: 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 new-test-recor
6020: 64 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 d #f).... (tests
6030: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 :testqueue-set-i
6040: 74 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 temdat! new-te
6050: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 st-record my-ite
6060: 6d 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 mdat).... (tests
6070: 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 :testqueue-set-i
6080: 74 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 tem_path! new-te
6090: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 st-record my-ite
60a0: 6d 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 m-path).... (has
60b0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 h-table-set! tes
60c0: 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 t-records newtes
60d0: 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 tname new-test-r
60e0: 65 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 ecord).... (set!
60f0: 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 tal (cons newte
6100: 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 stname tal))))))
6110: 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 ;; since these
6120: 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 are itemized cre
6130: 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d ate new test nam
6140: 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d es testname/item
6150: 70 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 path.. ite
6160: 6d 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ms).. (if (
6170: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 not (null? tal))
6180: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 ... (begin...
6190: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 (debug:print-i
61a0: 6e 66 6f 20 34 20 22 45 6e 64 20 6f 66 20 69 74 nfo 4 "End of it
61b0: 65 6d 73 20 6c 69 73 74 2c 20 6c 6f 6f 70 69 6e ems list, loopin
61c0: 67 20 77 69 74 68 20 6e 65 78 74 20 61 66 74 65 g with next afte
61d0: 72 20 73 68 6f 72 74 20 64 65 6c 61 79 22 29 0a r short delay").
61e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
61f0: 20 20 20 20 3b 3b 20 28 74 68 72 65 61 64 2d 73 ;; (thread-s
6200: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 leep! (+ 0.01 *g
6210: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 lobal-delta*))..
6220: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 . (loop (car
6230: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65 tal)(cdr tal) re
6240: 72 75 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 20 runs))))...
6250: 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20 61 ;; if items is a
6260: 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 20 proc then need
6270: 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 74 to run items:get
6280: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 -items-from-conf
6290: 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74 ig, get the list
62a0: 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 20 20 20 and loop ..
62b0: 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c ;; - but onl
62c0: 79 20 64 6f 20 74 68 61 74 20 69 66 20 72 65 73 y do that if res
62d0: 6f 75 72 63 65 73 20 65 78 69 73 74 20 74 6f 20 ources exist to
62e0: 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62 kick off the job
62f0: 0a 09 20 20 20 20 20 28 28 6f 72 20 28 70 72 6f .. ((or (pro
6300: 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65 cedure? items)(e
6310: 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70 q? items 'have-p
6320: 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20 20 rocedure))..
6330: 20 20 28 6c 65 74 20 28 28 63 61 6e 2d 72 75 6e (let ((can-run
6340: 2d 6d 6f 72 65 20 20 20 20 28 72 75 6e 73 3a 63 -more (runs:c
6350: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
6360: 73 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 s test-record)))
6370: 0a 09 09 28 69 66 20 28 61 6e 64 20 28 6c 69 73 ...(if (and (lis
6380: 74 3f 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 t? can-run-more)
6390: 0a 09 09 09 20 28 63 61 72 20 63 61 6e 2d 72 75 .... (car can-ru
63a0: 6e 2d 6d 6f 72 65 29 29 0a 09 09 20 20 20 20 28 n-more))... (
63b0: 6c 65 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e let* ((prereqs-n
63c0: 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e ot-met (open-run
63d0: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 -close db:get-pr
63e0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 ereqs-not-met #f
63f0: 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 run-id waitons
6400: 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 item-path mode:
6410: 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20 testmode))....
6420: 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 (fails
6430: 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 (runs:calc-fai
6440: 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d ls prereqs-not-m
6450: 65 74 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d et)).... (non-
6460: 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e completed (run
6470: 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c s:calc-not-compl
6480: 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 eted prereqs-not
6490: 2d 6d 65 74 29 29 29 0a 09 09 20 20 20 20 20 20 -met)))...
64a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
64b0: 6f 20 38 20 22 63 61 6e 2d 72 75 6e 2d 6d 6f 72 o 8 "can-run-mor
64c0: 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 e: " can-run-mor
64d0: 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 e..... "\n tes
64e0: 74 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20 tname: "
64f0: 68 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70 hed..... "\n p
6500: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 rereqs-not-met:
6510: 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 " (runs:pretty-s
6520: 74 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f tring prereqs-no
6530: 74 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c t-met)..... "\
6540: 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a n non-completed:
6550: 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74 " (runs:prett
6560: 79 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d y-string non-com
6570: 70 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20 pleted) .....
6580: 22 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 "\n fails:
6590: 20 20 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 " (runs:pre
65a0: 74 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73 tty-string fails
65b0: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 )..... "\n tes
65c0: 74 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20 tmode: "
65d0: 74 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20 testmode.....
65e0: 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a "\n num-retries:
65f0: 20 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69 " num-retri
6600: 65 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65 es..... "\n (e
6610: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 q? testmode 'top
6620: 6c 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74 level): " (eq? t
6630: 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 estmode 'topleve
6640: 6c 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e l)..... "\n (n
6650: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 ull? non-complet
6660: 65 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f ed): " (null?
6670: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a non-completed).
6680: 09 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e .... "\n rerun
6690: 73 3a 20 20 20 20 20 20 20 20 20 20 22 20 72 65 s: " re
66a0: 72 75 6e 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 runs..... "\n
66b0: 69 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20 items:
66c0: 20 22 20 69 74 65 6d 73 0a 09 09 09 09 20 20 20 " items.....
66d0: 22 5c 6e 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 "\n can-run-more
66e0: 3a 20 20 20 20 22 20 63 61 6e 2d 72 75 6e 2d 6d : " can-run-m
66f0: 6f 72 65 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 ore)... ;;
6700: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 (thread-sleep! (
6710: 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 + 0.01 *global-d
6720: 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20 elta*))...
6730: 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 (cond ;; INNER C
6740: 4f 4e 44 20 23 32 0a 09 09 20 20 20 20 20 20 20 OND #2...
6750: 28 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 ((or (null? prer
6760: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 3b 3b 20 eqs-not-met) ;;
6770: 61 6c 6c 20 70 72 65 72 65 71 73 20 6d 65 74 2c all prereqs met,
6780: 20 66 69 72 65 20 6f 66 66 20 74 68 65 20 74 65 fire off the te
6790: 73 74 0a 09 09 09 20 20 20 20 3b 3b 20 6f 72 2c st.... ;; or,
67a0: 20 69 66 20 69 74 20 69 73 20 61 20 27 74 6f 70 if it is a 'top
67b0: 6c 65 76 65 6c 20 74 65 73 74 20 61 6e 64 20 61 level test and a
67c0: 6c 6c 20 70 72 65 72 65 71 73 20 6e 6f 74 20 6d ll prereqs not m
67d0: 65 74 20 61 72 65 20 43 4f 4d 50 4c 45 54 45 44 et are COMPLETED
67e0: 20 74 68 65 6e 20 6c 61 75 6e 63 68 0a 09 09 09 then launch....
67f0: 20 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 (and (eq? te
6800: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c stmode 'toplevel
6810: 29 0a 09 09 09 09 20 28 6e 75 6c 6c 3f 20 6e 6f )..... (null? no
6820: 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 29 29 0a 09 n-completed)))..
6830: 09 09 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 ..(let ((test-na
6840: 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 me (tests:testqu
6850: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 eue-get-testname
6860: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a test-record))).
6870: 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54 ... (setenv "MT
6880: 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 _TEST_NAME" test
6890: 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 09 20 20 -name) ;; ....
68a0: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e (setenv "MT_RUNN
68b0: 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a AME" runname).
68c0: 09 09 09 20 20 28 73 65 74 2d 6d 65 67 61 74 65 ... (set-megate
68d0: 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d st-env-vars run-
68e0: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 id) ;; these may
68f0: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 be needed by th
6900: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 e launching proc
6910: 65 73 73 0a 09 09 09 20 20 28 6c 65 74 20 28 28 ess.... (let ((
6920: 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d items-list (item
6930: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d s:get-items-from
6940: 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29 -config tconfig)
6950: 29 29 0a 09 09 09 20 20 20 20 28 69 66 20 28 6c )).... (if (l
6960: 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 ist? items-list)
6970: 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 .....(begin.....
6980: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
6990: 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 ue-set-items! te
69a0: 73 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d st-record items-
69b0: 6c 69 73 74 29 0a 09 09 09 09 20 20 3b 3b 20 28 list)..... ;; (
69c0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
69d0: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
69e0: 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 .. (loop hed ta
69f0: 6c 20 72 65 72 75 6e 73 29 29 0a 09 09 09 09 28 l reruns)).....(
6a00: 62 65 67 69 6e 0a 09 09 09 09 20 20 28 64 65 62 begin..... (deb
6a10: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
6a20: 52 3a 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d R: The proc from
6a30: 20 72 65 61 64 69 6e 67 20 74 68 65 20 73 65 74 reading the set
6a40: 75 70 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 up did not yield
6a50: 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 a list - please
6a60: 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 report this")..
6a70: 09 09 09 20 20 28 65 78 69 74 20 31 29 29 29 29 ... (exit 1))))
6a80: 29 29 0a 09 09 20 20 20 20 20 20 20 28 28 6e 75 ))... ((nu
6a90: 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 09 09 28 64 ll? fails)....(d
6aa0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
6ab0: 34 20 22 66 61 69 6c 73 20 69 73 20 6e 75 6c 6c 4 "fails is null
6ac0: 2c 20 6d 6f 76 69 6e 67 20 6f 6e 20 69 6e 20 74 , moving on in t
6ad0: 68 65 20 71 75 65 75 65 20 62 75 74 20 6b 65 65 he queue but kee
6ae0: 70 69 6e 67 20 22 20 68 65 64 20 22 20 66 6f 72 ping " hed " for
6af0: 20 6e 6f 77 22 29 0a 09 09 09 3b 3b 20 6f 6e 6c now")....;; onl
6b00: 79 20 69 6e 63 72 65 6d 65 6e 74 20 6e 75 6d 2d y increment num-
6b10: 72 65 74 72 69 65 73 20 77 68 65 6e 20 74 68 65 retries when the
6b20: 72 65 20 61 72 65 20 6e 6f 20 74 65 73 74 73 20 re are no tests
6b30: 72 75 6e 69 6e 67 0a 09 09 09 28 69 66 20 28 65 runing....(if (e
6b40: 71 3f 20 30 20 28 6c 69 73 74 2d 72 65 66 20 63 q? 0 (list-ref c
6b50: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 31 29 29 0a an-run-more 1)).
6b60: 09 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 ... (begin...
6b70: 09 20 20 20 20 20 20 28 69 66 20 28 3e 20 6e 75 . (if (> nu
6b80: 6d 2d 72 65 74 72 69 65 73 20 31 30 30 29 20 3b m-retries 100) ;
6b90: 3b 20 66 69 72 73 74 20 31 30 30 20 72 65 74 72 ; first 100 retr
6ba0: 69 65 73 20 61 72 65 20 6c 6f 77 20 74 69 6d 65 ies are low time
6bb0: 20 63 6f 73 74 0a 09 09 09 09 20 20 28 74 68 72 cost..... (thr
6bc0: 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 32 20 ead-sleep! (+ 2
6bd0: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 *global-delta*))
6be0: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 ..... (thread-s
6bf0: 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a 67 leep! (+ 0.01 *g
6c00: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 29 0a lobal-delta*))).
6c10: 09 09 09 20 20 20 20 20 20 28 73 65 74 21 20 6e ... (set! n
6c20: 75 6d 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75 um-retries (+ nu
6c30: 6d 2d 72 65 74 72 69 65 73 20 31 29 29 29 29 0a m-retries 1)))).
6c40: 09 09 09 28 69 66 20 28 3e 20 6e 75 6d 2d 72 65 ...(if (> num-re
6c50: 74 72 69 65 73 20 20 6d 61 78 2d 72 65 74 72 69 tries max-retri
6c60: 65 73 29 0a 09 09 09 20 20 20 20 28 69 66 20 28 es).... (if (
6c70: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 not (null? tal))
6c80: 0a 09 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 .....(loop (car
6c90: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65 tal)(cdr tal) re
6ca0: 72 75 6e 73 29 29 0a 09 09 09 20 20 20 20 28 6c runs)).... (l
6cb0: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 oop (car newtal)
6cc0: 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 (cdr newtal) rer
6cd0: 75 6e 73 29 29 29 20 3b 3b 20 61 6e 20 69 73 73 uns))) ;; an iss
6ce0: 75 65 20 77 69 74 68 20 70 72 65 72 65 71 73 20 ue with prereqs
6cf0: 6e 6f 74 20 79 65 74 20 6d 65 74 3f 0a 09 09 20 not yet met?...
6d00: 20 20 20 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 ((and (not
6d10: 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 29 28 (null? fails))(
6d20: 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 6e 6f eq? testmode 'no
6d30: 72 6d 61 6c 29 29 0a 09 09 09 28 64 65 62 75 67 rmal))....(debug
6d40: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 74 :print-info 1 "t
6d50: 65 73 74 20 22 20 20 68 65 64 20 22 20 28 6d 6f est " hed " (mo
6d60: 64 65 3d 22 20 74 65 73 74 6d 6f 64 65 20 22 29 de=" testmode ")
6d70: 20 68 61 73 20 66 61 69 6c 65 64 20 70 72 65 72 has failed prer
6d80: 65 71 75 69 73 69 74 65 28 73 29 3b 20 22 0a 09 equisite(s); "..
6d90: 09 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d ... (string-
6da0: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 intersperse (map
6db0: 20 28 6c 61 6d 62 64 61 20 28 74 29 28 63 6f 6e (lambda (t)(con
6dc0: 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 c (db:test-get-t
6dd0: 65 73 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 estname t) ":" (
6de0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 db:test-get-stat
6df0: 65 20 74 29 22 2f 22 28 64 62 3a 74 65 73 74 2d e t)"/"(db:test-
6e00: 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 20 get-status t)))
6e10: 66 61 69 6c 73 29 20 22 2c 20 22 29 0a 09 09 09 fails) ", ")....
6e20: 09 20 20 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e . ", removin
6e30: 67 20 69 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 g it from to-do
6e40: 6c 69 73 74 22 29 0a 09 09 09 28 69 66 20 28 6e list")....(if (n
6e50: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a ot (null? tal)).
6e60: 09 09 09 20 20 20 20 28 62 65 67 69 6e 0a 20 20 ... (begin.
6e70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6e80: 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 28 ;; (
6e90: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
6ea0: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
6eb0: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 . (loop (ca
6ec0: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28 r tal)(cdr tal)(
6ed0: 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 cons hed reruns)
6ee0: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 ))))... (e
6ef0: 6c 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 lse....(debug:pr
6f00: 69 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f int 8 "ERROR: No
6f10: 20 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 handler for thi
6f20: 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 s condition.")..
6f30: 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 ..(thread-sleep!
6f40: 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 (+ 1 *global-de
6f50: 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20 lta*))....(loop
6f60: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 (car newtal)(cdr
6f70: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 newtal) reruns)
6f80: 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 46 ))) ;; END OF IF
6f90: 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a 09 CAN RUN MORE...
6fa0: 09 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 . ;; if can't
6fb0: 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c run more just l
6fc0: 6f 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f oop with next po
6fd0: 73 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 ssible test...
6fe0: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 (begin...
6ff0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
7000: 66 6f 20 34 20 22 70 72 6f 63 65 73 73 69 6e 67 fo 4 "processing
7010: 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20 61 the case with a
7020: 20 6c 61 6d 62 64 61 20 66 6f 72 20 69 74 65 6d lambda for item
7030: 73 20 6f 72 20 27 68 61 76 65 2d 70 72 6f 63 65 s or 'have-proce
7040: 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68 72 dure. Moving thr
7050: 6f 75 67 68 20 74 68 65 20 71 75 65 75 65 20 77 ough the queue w
7060: 69 74 68 6f 75 74 20 64 72 6f 70 70 69 6e 67 20 ithout dropping
7070: 22 20 68 65 64 29 0a 09 09 20 20 20 20 20 20 3b " hed)... ;
7080: 3b 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 ; (thread-sleep!
7090: 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65 (+ 2 *global-de
70a0: 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 20 20 28 lta*))... (
70b0: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c loop (car newtal
70c0: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 )(cdr newtal) re
70d0: 72 75 6e 73 29 29 29 29 29 20 3b 3b 20 45 4e 44 runs))))) ;; END
70e0: 20 4f 46 20 28 6f 72 20 28 70 72 6f 63 65 64 75 OF (or (procedu
70f0: 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 re? items)(eq? i
7100: 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 tems 'have-proce
7110: 64 75 72 65 29 29 0a 09 20 20 20 20 20 0a 09 20 dure)).. ..
7120: 20 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 ;; this case
7130: 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 should not happ
7140: 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c en, added to hel
7150: 70 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 p catch any bugs
7160: 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 .. ((and (li
7170: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 st? items) itemd
7180: 61 74 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 at).. (debu
7190: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
71a0: 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 : Should not hav
71b0: 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d e a list of item
71c0: 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 s in a test and
71d0: 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 the itemspath se
71e0: 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 t - please repor
71f0: 74 20 74 68 69 73 22 29 0a 09 20 20 20 20 20 20 t this")..
7200: 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 20 (exit 1))..
7210: 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 ((not (null? rer
7220: 75 6e 73 29 29 0a 09 20 20 20 20 20 20 28 6c 65 uns)).. (le
7230: 74 2a 20 28 28 6e 65 77 6c 73 74 20 28 74 65 73 t* ((newlst (tes
7240: 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 ts:filter-non-ru
7250: 6e 6e 61 62 6c 65 20 72 75 6e 2d 69 64 20 74 61 nnable run-id ta
7260: 6c 20 74 65 73 74 2d 72 65 63 6f 72 64 73 29 29 l test-records))
7270: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 ;; i.e. not FAI
7280: 4c 2c 20 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d L, WAIVED, INCOM
7290: 50 4c 45 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c PLETE, PASS, KIL
72a0: 4c 45 44 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e LED,... (jun
72b0: 6b 65 64 20 28 6c 73 65 74 2d 64 69 66 66 65 72 ked (lset-differ
72c0: 65 6e 63 65 20 65 71 75 61 6c 3f 20 74 61 6c 20 ence equal? tal
72d0: 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 64 65 62 newlst)))...(deb
72e0: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 ug:print-info 4
72f0: 22 66 75 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75 "full drop throu
7300: 67 68 2c 20 69 66 20 72 65 72 75 6e 73 20 69 73 gh, if reruns is
7310: 20 6c 65 73 73 20 74 68 61 6e 20 31 30 30 20 77 less than 100 w
7320: 65 20 77 69 6c 6c 20 66 6f 72 63 65 20 72 65 74 e will force ret
7330: 72 79 20 74 68 65 6d 2c 20 72 65 72 75 6e 73 3d ry them, reruns=
7340: 22 20 72 65 72 75 6e 73 20 22 2c 20 74 61 6c 3d " reruns ", tal=
7350: 22 20 74 61 6c 29 0a 09 09 28 69 66 20 28 3c 20 " tal)...(if (<
7360: 6e 75 6d 2d 72 65 74 72 69 65 73 20 6d 61 78 2d num-retries max-
7370: 72 65 74 72 69 65 73 29 0a 09 09 20 20 20 20 28 retries)... (
7380: 73 65 74 21 20 6e 65 77 6c 73 74 20 28 61 70 70 set! newlst (app
7390: 65 6e 64 20 72 65 72 75 6e 73 20 6e 65 77 6c 73 end reruns newls
73a0: 74 29 29 29 0a 09 09 28 73 65 74 21 20 6e 75 6d t)))...(set! num
73b0: 2d 72 65 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d -retries (+ num-
73c0: 72 65 74 72 69 65 73 20 31 29 29 0a 09 09 3b 3b retries 1))...;;
73d0: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 (thread-sleep!
73e0: 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c (+ 1 *global-del
73f0: 74 61 2a 29 29 0a 09 09 28 69 66 20 28 6e 6f 74 ta*))...(if (not
7400: 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 (null? newlst))
7410: 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e 63 65 20 ... ;; since
7420: 72 65 72 75 6e 73 20 68 61 76 65 20 62 65 65 6e reruns have been
7430: 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20 6e 65 tacked on to ne
7440: 77 6c 73 74 20 63 72 65 61 74 65 20 6e 65 77 20 wlst create new
7450: 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75 6e 6b reruns from junk
7460: 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 ed... (loop (
7470: 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 72 20 car newlst)(cdr
7480: 6e 65 77 6c 73 74 29 28 64 65 6c 65 74 65 2d 64 newlst)(delete-d
7490: 75 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b 65 64 uplicates junked
74a0: 29 29 29 29 29 0a 09 20 20 20 20 20 28 28 6e 6f ))))).. ((no
74b0: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 t (null? tal))..
74c0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
74d0: 6e 74 2d 69 6e 66 6f 20 34 20 22 49 27 6d 20 70 nt-info 4 "I'm p
74e0: 72 65 74 74 79 20 73 75 72 65 20 49 20 73 68 6f retty sure I sho
74f0: 75 6c 64 6e 27 74 20 67 65 74 20 68 65 72 65 2e uldn't get here.
7500: 22 29 29 0a 09 20 20 20 20 20 28 65 6c 73 65 0a ")).. (else.
7510: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
7520: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 45 78 69 74 int-info 4 "Exit
7530: 69 6e 67 20 6c 6f 6f 70 20 77 69 74 68 2e 2e 2e ing loop with...
7540: 5c 6e 20 20 68 65 64 3d 22 20 68 65 64 20 22 5c \n hed=" hed "\
7550: 6e 20 20 74 61 6c 3d 22 20 74 61 6c 20 22 5c 6e n tal=" tal "\n
7560: 20 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e reruns=" rerun
7570: 73 29 29 0a 09 20 20 20 20 20 29 29 29 29 20 3b s)).. )))) ;
7580: 3b 20 4c 45 54 2a 20 28 28 74 65 73 74 2d 72 65 ; LET* ((test-re
7590: 63 6f 72 64 0a 0a 20 20 20 20 3b 3b 20 77 65 20 cord.. ;; we
75a0: 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f get here on "dro
75b0: 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f p through" - loo
75c0: 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 p for next test
75d0: 69 6e 20 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 in queue. ;;
75e0: 46 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 FIXME!!!! THIS S
75f0: 48 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 HOULD NOT REQUIR
7600: 45 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 E AN EXIT!!!!!!!
7610: 0a 20 20 20 20 0a 20 20 20 20 28 64 65 62 75 67 . . (debug
7620: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 :print-info 1 "A
7630: 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 ll tests launche
7640: 64 22 29 0a 20 20 20 20 28 74 68 72 65 61 64 2d d"). (thread-
7650: 73 6c 65 65 70 21 20 30 2e 35 29 0a 20 20 20 20 sleep! 0.5).
7660: 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20 68 ;; FIXME! This h
7670: 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c 64 arsh exit should
7680: 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72 not be necessar
7690: 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20 28 69 66 y..... ;; (if
76a0: 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 (not *runremote
76b0: 2a 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 20 20 *)(exit)) ;; .
76c0: 20 20 23 66 29 29 20 3b 3b 20 72 65 74 75 72 6e #f)) ;; return
76d0: 20 61 20 23 66 20 61 73 20 61 20 68 69 6e 74 20 a #f as a hint
76e0: 74 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65 that we are done
76f0: 0a 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65 . ;; Here we ne
7700: 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74 ed to check that
7710: 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72 all the tests r
7720: 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72 emaining to be r
7730: 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20 un are eligible
7740: 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 61 6e 64 20 to run. ;; and
7750: 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 are not blocked
7760: 62 79 20 66 61 69 6c 65 64 0a 20 20 0a 0a 3b 3b by failed. ..;;
7770: 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20 parent-test is
7780: 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65 there as a place
7790: 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20 holder for when
77a0: 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e parent-tests can
77b0: 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74 be run as a set
77c0: 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20 up step.(define
77d0: 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 (run:test run-id
77e0: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c runname keyvall
77f0: 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 st test-record f
7800: 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 lags parent-test
7810: 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 ). ;; All these
7820: 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 vars might be r
7830: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 eferenced by the
7840: 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 testconfig file
7850: 20 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 reader. (let*
7860: 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 ((test-name (
7870: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
7880: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 get-testname t
7890: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 est-record)).. (
78a0: 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 test-waitons (te
78b0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
78c0: 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 t-waitons tes
78d0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 t-record)).. (te
78e0: 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 st-conf (test
78f0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
7900: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d testconfig test-
7910: 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d record)).. (item
7920: 64 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a dat (tests:
7930: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 testqueue-get-it
7940: 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 emdat test-re
7950: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 cord)).. (test-p
7960: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f ath (conc *to
7970: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 ppath* "/tests/"
7980: 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 test-name)) ;;
7990: 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a could use tests:
79a0: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 get-testconfig h
79b0: 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 ere ..... (force
79c0: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 (hash-ta
79d0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
79e0: 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 flags "-force" #
79f0: 66 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 f)).. (rerun
7a00: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d (hash-table-
7a10: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 ref/default flag
7a20: 73 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a s "-rerun" #f)).
7a30: 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 . (keepgoing
7a40: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
7a50: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d default flags "-
7a60: 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a keepgoing" #f)).
7a70: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 . (item-path
7a80: 20 22 22 29 0a 09 20 28 64 62 20 20 20 20 20 20 "").. (db
7a90: 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 64 #f)). (d
7aa0: 65 62 75 67 3a 70 72 69 6e 74 20 34 0a 09 09 20 ebug:print 4...
7ab0: 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 "test-config: "
7ac0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 (hash-table->ali
7ad0: 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 st test-conf)...
7ae0: 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 "\n itemdat:
7af0: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 " itemdat... ).
7b00: 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 ;; setting it
7b10: 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 emdat to a list
7b20: 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 if it is #f.
7b30: 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 (if (not itemdat
7b40: 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 )(set! itemdat '
7b50: 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 ())). (set! i
7b60: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c tem-path (item-l
7b70: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
7b80: 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 t)). (debug:p
7b90: 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69 rint 2 "Attempti
7ba0: 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 ng to launch tes
7bb0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 28 69 t " test-name (i
7bc0: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 f (equal? item-p
7bd0: 61 74 68 20 22 2f 22 29 20 22 2f 22 20 69 74 65 ath "/") "/" ite
7be0: 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 28 73 65 m-path)). (se
7bf0: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 tenv "MT_TEST_NA
7c00: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b ME" test-name) ;
7c10: 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 ; . (setenv "
7c20: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 MT_RUNNAME" ru
7c30: 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d nname). (set-
7c40: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 megatest-env-var
7c50: 73 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 s run-id) ;; the
7c60: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 se may be needed
7c70: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e by the launchin
7c80: 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63 g process. (c
7c90: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 hange-directory
7ca0: 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 *toppath*)..
7cb0: 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65 ;; Here is where
7cc0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 the test_meta t
7cd0: 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64 able is best upd
7ce0: 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 2c ated. ;; Yes,
7cf0: 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 20 another use of
7d00: 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 63 a global for cac
7d10: 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 74 hing. Need a bet
7d20: 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 66 ter way?. (if
7d30: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c (not (hash-tabl
7d40: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a 74 e-ref/default *t
7d50: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 est-meta-updated
7d60: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29 * test-name #f))
7d70: 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a . (begin.
7d80: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d . (hash-table-
7d90: 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 2d set! *test-meta-
7da0: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 updated* test-na
7db0: 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 20 me #t).
7dc0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
7dd0: 65 20 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 e runs:update-te
7de0: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d st_meta db test-
7df0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 name test-conf))
7e00: 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c ). . ;; (l
7e10: 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 20 ambda (itemdat)
7e20: 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22 ;;; ((ripeness "
7e30: 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 6d 70 overripe") (temp
7e40: 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 erature "cool")
7e50: 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 (season "summer"
7e60: 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e )). (let* ((n
7e70: 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74 ew-test-path (st
7e80: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
7e90: 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 (cons test-path
7ea0: 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 (map cadr itemd
7eb0: 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28 at)) "/")).. (
7ec0: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 new-test-name (i
7ed0: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 f (equal? item-p
7ee0: 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d ath "") test-nam
7ef0: 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d e (conc test-nam
7f00: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 e "/" item-path)
7f10: 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 )) ;; just need
7f20: 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a it to be unique.
7f30: 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 20 20 . (test-id
7f40: 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 (cdb:remote-r
7f50: 75 6e 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 un db:get-test-i
7f60: 64 20 23 66 20 20 72 75 6e 2d 69 64 20 74 65 73 d #f run-id tes
7f70: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
7f80: 29 29 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 )).. (testdat
7f90: 20 20 20 20 20 20 28 63 64 62 3a 67 65 74 2d 74 (cdb:get-t
7fa0: 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 2a est-info-by-id *
7fb0: 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 2d runremote* test-
7fc0: 69 64 29 29 29 0a 20 20 20 20 20 20 28 69 66 20 id))). (if
7fd0: 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20 (not testdat)..
7fe0: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 (begin.. ;;
7ff0: 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20 ensure that the
8000: 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66 6f path exists befo
8010: 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 74 re registering t
8020: 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 he test.. ;;
8030: 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f NOPE: Cannot! Do
8040: 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 n't know yet whi
8050: 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c ch disk area wil
8060: 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e l be assigned...
8070: 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65 ... ;; (syste
8080: 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d m (conc "mkdir -
8090: 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 p " new-test-pat
80a0: 68 29 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 h)).. ;;..
80b0: 20 3b 3b 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c ;; (open-run-cl
80c0: 6f 73 65 20 74 65 73 74 73 3a 72 65 67 69 73 74 ose tests:regist
80d0: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 er-test db run-i
80e0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
80f0: 2d 70 61 74 68 29 0a 09 20 20 20 20 3b 3b 0a 09 -path).. ;;..
8100: 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 66 6f 72 20 ;; NB// for
8110: 74 68 65 20 61 62 6f 76 65 20 6c 69 6e 65 2e 20 the above line.
8120: 49 20 77 61 6e 74 20 74 68 65 20 74 65 73 74 20 I want the test
8130: 74 6f 20 62 65 20 72 65 67 69 73 74 65 72 65 64 to be registered
8140: 20 6c 6f 6e 67 20 62 65 66 6f 72 65 20 74 68 69 long before thi
8150: 73 20 72 6f 75 74 69 6e 65 20 67 65 74 73 20 63 s routine gets c
8160: 61 6c 6c 65 64 21 0a 09 20 20 20 20 3b 3b 0a 09 alled!.. ;;..
8170: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 (set! test-i
8180: 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 d (open-run-clos
8190: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 e db:get-test-id
81a0: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
81b0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 name item-path))
81c0: 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 .. (if (not t
81d0: 65 73 74 2d 69 64 29 0a 09 09 28 62 65 67 69 6e est-id)...(begin
81e0: 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ... (debug:prin
81f0: 74 20 32 20 22 57 41 52 4e 3a 20 54 65 73 74 20 t 2 "WARN: Test
8200: 6e 6f 74 20 70 72 65 2d 63 72 65 61 74 65 64 3f not pre-created?
8210: 20 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 test-name=" tes
8220: 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 t-name ", item-p
8230: 61 74 68 3d 22 20 69 74 65 6d 2d 70 61 74 68 20 ath=" item-path
8240: 22 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d ", run-id=" run-
8250: 69 64 29 0a 09 09 20 20 28 63 64 62 3a 74 65 73 id)... (cdb:tes
8260: 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65 73 74 ts-register-test
8270: 20 23 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d #f run-id test-
8280: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a name item-path).
8290: 09 09 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 .. (set! test-i
82a0: 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 d (open-run-clos
82b0: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 e db:get-test-id
82c0: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
82d0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 name item-path))
82e0: 29 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 )).. (debug:p
82f0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 rint-info 4 "tes
8300: 74 2d 69 64 3d 22 20 74 65 73 74 2d 69 64 20 22 t-id=" test-id "
8310: 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 , run-id=" run-i
8320: 64 20 22 2c 20 74 65 73 74 2d 6e 61 6d 65 3d 22 d ", test-name="
8330: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 test-name ", it
8340: 65 6d 2d 70 61 74 68 3d 5c 22 22 20 69 74 65 6d em-path=\"" item
8350: 2d 70 61 74 68 20 22 5c 22 22 29 0a 09 20 20 20 -path "\"")..
8360: 20 28 73 65 74 21 20 74 65 73 74 64 61 74 20 28 (set! testdat (
8370: 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 cdb:get-test-inf
8380: 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f o-by-id *runremo
8390: 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29 29 0a te* test-id)))).
83a0: 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 (set! test
83b0: 2d 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 -id (db:test-get
83c0: 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 -id testdat)).
83d0: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 (change-dire
83e0: 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 ctory test-path)
83f0: 0a 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 . (case (if
8400: 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a force ;; (args:
8410: 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 get-arg "-force"
8420: 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 )...'NOT_STARTED
8430: 0a 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 ...(if testdat..
8440: 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 . (string->sy
8450: 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 mbol (test:get-s
8460: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 tate testdat))..
8470: 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d . 'failed-to-
8480: 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c insert))..((fail
8490: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 ed-to-insert)..
84a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
84b0: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
84c0: 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f insert the reco
84d0: 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 rd into the db")
84e0: 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 )..((NOT_STARTED
84f0: 20 43 4f 4d 50 4c 45 54 45 44 20 44 45 4c 45 54 COMPLETED DELET
8500: 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e ED).. (let ((run
8510: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 flag #f)).. (c
8520: 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 ond.. ;; -for
8530: 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 ce, run no matte
8540: 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 r what.. (for
8550: 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 ce (set! runflag
8560: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f #t)).. ;; NO
8570: 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e T_STARTED, run n
8580: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 o matter what..
8590: 20 20 20 28 28 6d 65 6d 62 65 72 20 28 74 65 73 ((member (tes
85a0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
85b0: 64 61 74 29 20 27 28 22 44 45 4c 45 54 45 44 22 dat) '("DELETED"
85c0: 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 29 "NOT_STARTED"))
85d0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
85e0: 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d )).. ;; not -
85f0: 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 rerun and PASS,
8600: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 WARN or CHECK, d
8610: 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 o no run.. ((
8620: 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 and (or (not rer
8630: 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70 un)... keep
8640: 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 going)... ;; Re
8650: 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72 quire to force r
8660: 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 e-run for COMPLE
8670: 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 TED or *anything
8680: 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 * + PASS,WARN or
8690: 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 CHECK... (or (
86a0: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 member (test:get
86b0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
86c0: 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 '("PASS" "WARN"
86d0: 20 22 43 48 45 43 4b 22 20 22 53 4b 49 50 22 29 "CHECK" "SKIP")
86e0: 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 )... (membe
86f0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
8700: 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43 e testdat) '("C
8710: 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 OMPLETED")))) ..
8720: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
8730: 74 2d 69 6e 66 6f 20 32 20 22 72 75 6e 6e 69 6e t-info 2 "runnin
8740: 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 g test " test-na
8750: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 me "/" item-path
8760: 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61 73 " suppressed as
8770: 20 69 74 20 69 73 20 22 20 28 74 65 73 74 3a 67 it is " (test:g
8780: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
8790: 29 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 3a ) " and " (test:
87a0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
87b0: 61 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 at)).. (set!
87c0: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 runflag #f))..
87d0: 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 ;; -rerun and
87e0: 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f status is one o
87f0: 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 f the specifed,
8800: 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e run it.. ((an
8810: 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 d rerun... (let
8820: 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28 * ((rerunlst (
8830: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 string-split rer
8840: 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 un ",")).... (mu
8850: 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 st-rerun (member
8860: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
8870: 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e s testdat) rerun
8880: 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 65 lst)))... (de
8890: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 33 bug:print-info 3
88a0: 20 22 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 "-rerun list: "
88b0: 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 rerun ", test-s
88c0: 74 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 tatus: " (test:g
88d0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
88e0: 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a t)", must-rerun:
88f0: 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 " must-rerun)..
8900: 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 . must-rerun)
8910: 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 ).. (debug:p
8920: 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 52 65 72 rint-info 2 "Rer
8930: 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 un forced for te
8940: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
8950: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 /" item-path)..
8960: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 (set! runfla
8970: 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d g #t)).. ;; -
8980: 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f keepgoing, do no
8990: 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 t rerun FAIL..
89a0: 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e ((and keepgoin
89b0: 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 g... (member (t
89c0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
89d0: 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 estdat) '("FAIL"
89e0: 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 ))).. (set!
89f0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 runflag #f))..
8a00: 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 ((and (not rer
8a10: 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 un)... (member
8a20: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
8a30: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 testdat) '("FAI
8a40: 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 L" "n/a")))..
8a50: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 (set! runflag
8a60: 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 #t)).. (else
8a70: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
8a80: 29 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 ))).. (debug:p
8a90: 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 rint 6 "RUNNING
8aa0: 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 => runflag: " ru
8ab0: 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 nflag " STATE: "
8ac0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
8ad0: 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 testdat) " STAT
8ae0: 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d US: " (test:get-
8af0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 status testdat))
8b00: 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 .. (if (not ru
8b10: 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 nflag).. (
8b20: 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 if (not parent-t
8b30: 65 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 est)... (debug
8b40: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 :print 1 "NOTE:
8b50: 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 Not starting tes
8b60: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d t " new-test-nam
8b70: 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 e " as it is sta
8b80: 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 te \"" (test:get
8b90: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 -state testdat)
8ba0: 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 ....."\" and sta
8bb0: 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 tus \"" (test:ge
8bc0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
8bd0: 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 ) "\", use -reru
8be0: 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d n \"" (test:get-
8bf0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 0a status testdat).
8c00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8c10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8c20: 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f "\" or -force to
8c30: 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 override"))..
8c40: 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f ;; NOTE: No
8c50: 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b longer be check
8c60: 69 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 65 ing prerequisite
8c70: 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 s here! Will nev
8c80: 65 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 er get here unle
8c90: 73 73 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 ss prereqs are..
8ca0: 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ;;
8cb0: 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 already met...
8cc0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c (if (not (l
8cd0: 61 75 6e 63 68 2d 74 65 73 74 20 23 66 20 72 75 aunch-test #f ru
8ce0: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 n-id runname tes
8cf0: 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 t-conf keyvallst
8d00: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
8d10: 70 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 path itemdat fla
8d20: 67 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e gs))... (begin
8d30: 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 ... (print "
8d40: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
8d50: 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 launch the test
8d60: 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f . Exiting as soo
8d70: 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a n as possible").
8d80: 09 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c .. (set! *gl
8d90: 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 obalexitstatus*
8da0: 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 1) ;; ... (p
8db0: 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 rocess-signal (c
8dc0: 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 urrent-process-i
8dd0: 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 d) signal/kill))
8de0: 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 ))))..((KILLED)
8df0: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
8e00: 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 1 "NOTE: " new-t
8e10: 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c est-name " is al
8e20: 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 ready running or
8e30: 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b was explictly k
8e40: 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 illed, use -forc
8e50: 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 e to launch it."
8e60: 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 ))..((LAUNCHED R
8e70: 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 EMOTEHOSTSTART R
8e80: 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 UNNING) .. (if
8e90: 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 (> (- (current-s
8ea0: 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 econds)(+ (db:te
8eb0: 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d st-get-event_tim
8ec0: 65 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 e testdat).....
8ed0: 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 (db:test-g
8ee0: 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 et-run_duration
8ef0: 74 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 testdat)))...600
8f00: 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 ) ;; i.e. no upd
8f10: 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 ate for more tha
8f20: 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 n 600 seconds..
8f30: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 (begin..
8f40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8f50: 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 0 "WARNING: Test
8f60: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 " test-name " a
8f70: 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 ppears to be dea
8f80: 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f d. Forcing it to
8f90: 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 state INCOMPLET
8fa0: 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 E and status STU
8fb0: 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 CK/DEAD")..
8fc0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 2d 73 65 (tests:test-se
8fd0: 74 2d 73 74 61 74 75 73 21 20 74 65 73 74 2d 69 t-status! test-i
8fe0: 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 d "INCOMPLETE" "
8ff0: 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73 STUCK/DEAD" "Tes
9000: 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 t is stuck or de
9010: 61 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 28 ad" #f)).. (
9020: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e debug:print 2 "N
9030: 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 OTE: " test-name
9040: 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 " is already ru
9050: 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 nning")))..(else
9060: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
9070: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 int 0 "ERROR: Fa
9080: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 iled to launch t
9090: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e est " new-test-n
90a0: 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 ame ". Unrecogni
90b0: 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 sed state " (tes
90c0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
90d0: 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d dat)))))))..;;==
90e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
90f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9100: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9110: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9120: 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e ====.;; END OF N
9130: 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d EW STUFF.;;=====
9140: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9150: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9160: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9180: 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d =..(define (get-
9190: 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 dir-up-n dir . p
91a0: 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 arams) . (let (
91b0: 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 (dparts (string
91c0: 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 -split dir "/"))
91d0: 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 ..(count (if (
91e0: 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 null? params) 1
91f0: 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a (car params)))).
9200: 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 (conc "/" (s
9210: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
9220: 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 e .. (take
9230: 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 dparts (- (leng
9240: 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 th dparts) count
9250: 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 )).. "/"))
9260: 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e )).;; Remove run
9270: 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 s.;; fields are
9280: 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 passing in throu
9290: 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b gh .;; action:.;
92a0: 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e ; 'remove-run
92b0: 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61 s.;; 'set-sta
92c0: 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 te-status.;;.;;
92d0: 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 NB// should pass
92e0: 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 in keys?.;;.(de
92f0: 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 fine (runs:opera
9300: 74 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 72 75 6e te-on action run
9310: 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 namepatt testpat
9320: 74 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 t #!key (state #
9330: 66 29 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 f)(status #f)(ne
9340: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 w-state-status #
9350: 66 29 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c f)). (common:cl
9360: 65 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 ear-caches) ;; c
9370: 6c 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a lear all caches.
9380: 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 (let* ((db
9390: 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 #f).. (ke
93a0: 79 73 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e ys (open
93b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 -run-close db:ge
93c0: 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 t-keys db)).. (r
93d0: 75 6e 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 undat (ope
93e0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 n-run-close runs
93f0: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 :get-runs-by-pat
9400: 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d t db keys runnam
9410: 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 epatt)).. (heade
9420: 72 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d r (vector-
9430: 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 ref rundat 0))..
9440: 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 (runs (
9450: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
9460: 74 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 t 1)).. (states
9470: 20 20 20 20 20 20 28 69 66 20 73 74 61 74 65 20 (if state
9480: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 (string-split s
9490: 74 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 tate ",") '()))
94a0: 0a 09 20 28 73 74 61 74 75 73 65 73 20 20 20 20 .. (statuses
94b0: 20 28 69 66 20 73 74 61 74 75 73 20 28 73 74 72 (if status (str
94c0: 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 ing-split status
94d0: 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 ",") '())).. (s
94e0: 74 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 tate-status (if
94f0: 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 (string? new-sta
9500: 74 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 te-status) (stri
9510: 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 ng-split new-sta
9520: 74 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 te-status ",") '
9530: 28 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 (#f #f)))). (
9540: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f debug:print-info
9550: 20 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 4 "runs:operate
9560: 2d 6f 6e 20 3d 3e 20 48 65 61 64 65 72 3a 20 22 -on => Header: "
9570: 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e header " action
9580: 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 : " action " new
9590: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 -state-status: "
95a0: 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 new-state-statu
95b0: 73 29 0a 20 20 20 20 28 69 66 20 28 3e 20 32 20 s). (if (> 2
95c0: 28 6c 65 6e 67 74 68 20 73 74 61 74 65 2d 73 74 (length state-st
95d0: 61 74 75 73 29 29 0a 09 28 62 65 67 69 6e 0a 09 atus))..(begin..
95e0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
95f0: 20 22 45 52 52 4f 52 3a 20 74 68 65 20 70 61 72 "ERROR: the par
9600: 61 6d 65 74 65 72 20 74 6f 20 2d 73 65 74 2d 73 ameter to -set-s
9610: 74 61 74 65 2d 73 74 61 74 75 73 20 69 73 20 61 tate-status is a
9620: 20 63 6f 6d 6d 61 20 64 65 6c 69 6d 69 74 65 64 comma delimited
9630: 20 73 74 72 69 6e 67 2e 20 45 2e 67 2e 20 43 4f string. E.g. CO
9640: 4d 50 4c 45 54 45 44 2c 46 41 49 4c 22 29 0a 09 MPLETED,FAIL")..
9650: 20 20 28 65 78 69 74 29 29 29 0a 20 20 20 20 28 (exit))). (
9660: 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c for-each. (l
9670: 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 ambda (run).
9680: 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 (let ((runkey
9690: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
96a0: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 erse (map (lambd
96b0: 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a a (k).......(db:
96c0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
96d0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 der run header (
96e0: 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 vector-ref k 0))
96f0: 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 ) keys) "/"))..
9700: 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d (dirs-to-rem
9710: 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 ove (make-hash-t
9720: 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 able))).. (let*
9730: 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a ((run-id (db:
9740: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
9750: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
9760: 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 id"))...(run-sta
9770: 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 te (db:get-value
9780: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
9790: 65 61 64 65 72 20 22 73 74 61 74 65 22 29 29 0a eader "state")).
97a0: 09 09 28 74 65 73 74 73 20 20 20 20 20 28 69 66 ..(tests (if
97b0: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 (not (equal? ru
97c0: 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 n-state "locked"
97d0: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6f 70 )).... (op
97e0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
97f0: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 get-tests-for-ru
9800: 6e 20 64 62 20 72 75 6e 2d 69 64 0a 09 09 09 09 n db run-id.....
9810: 09 09 20 20 20 20 20 20 74 65 73 74 70 61 74 74 .. testpatt
9820: 20 73 74 61 74 65 73 20 73 74 61 74 75 73 65 73 states statuses
9830: 0a 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 ....... not
9840: 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 -in: #f.......
9850: 20 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 sort-by: (c
9860: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 ase action......
9870: 09 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e ... ((remove-run
9880: 73 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 s) 'rundir).....
9890: 09 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 .... (else
98a0: 20 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 'event_time)
98b0: 29 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 )).... '()
98c0: 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 ))...(lasttpath
98d0: 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 "/does/not/exist
98e0: 2f 49 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 28 /I/hope")).. (
98f0: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f debug:print-info
9900: 20 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 4 "runs:operate
9910: 2d 6f 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c -on run=" run ",
9920: 20 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 72 header=" header
9930: 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ).. (if (not (
9940: 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 null? tests))..
9950: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 (begin...
9960: 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 (case action...
9970: 20 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 ((remove-runs)
9980: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
9990: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
99a0: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 tests for run: "
99b0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a runkey " " (db:
99c0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
99d0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
99e0: 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 runname")))...
99f0: 20 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 ((set-state-sta
9a00: 74 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 tus)... (debu
9a10: 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 g:print 1 "Modif
9a20: 79 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73 ying state and s
9a30: 74 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 66 taus for tests f
9a40: 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 or run: " runkey
9a50: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c " " (db:get-val
9a60: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
9a70: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 header "runname
9a80: 22 29 29 29 0a 09 09 20 20 20 28 28 70 72 69 6e ")))... ((prin
9a90: 74 2d 72 75 6e 29 0a 09 09 20 20 20 20 28 64 65 t-run)... (de
9aa0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 50 72 69 bug:print 1 "Pri
9ab0: 6e 74 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72 nting info for r
9ac0: 75 6e 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 72 un " runkey ", r
9ad0: 75 6e 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 74 un=" run ", test
9ae0: 73 3d 22 20 74 65 73 74 73 20 22 2c 20 68 65 61 s=" tests ", hea
9af0: 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09 09 der=" header)...
9b00: 20 20 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 action)...
9b10: 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 64 65 (else... (de
9b20: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 bug:print-info 0
9b30: 20 22 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 "action not rec
9b40: 6f 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e ognised " action
9b50: 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 )))... (for-each
9b60: 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 ... (lambda (te
9b70: 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 st)... (let*
9b80: 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a ((item-path (db:
9b90: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
9ba0: 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 th test))....
9bb0: 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 (test-name (db:t
9bc0: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
9bd0: 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 test)).... (r
9be0: 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 un-dir (db:tes
9bf0: 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 t-get-rundir tes
9c00: 74 29 29 20 20 20 20 3b 3b 20 72 75 6e 20 64 69 t)) ;; run di
9c10: 72 20 69 73 20 66 72 6f 6d 20 74 68 65 20 6c 69 r is from the li
9c20: 6e 6b 20 74 72 65 65 0a 09 09 09 20 20 20 28 72 nk tree.... (r
9c30: 65 61 6c 2d 64 69 72 20 20 28 69 66 20 28 66 69 eal-dir (if (fi
9c40: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 le-exists? run-d
9c50: 69 72 29 0a 09 09 09 09 09 20 20 28 72 65 73 6f ir)...... (reso
9c60: 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e lve-pathname run
9c70: 2d 64 69 72 29 0a 09 09 09 09 09 20 20 23 66 29 -dir)...... #f)
9c80: 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 69 64 ).... (test-id
9c90: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
9ca0: 69 64 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 id test)))...
9cb0: 20 20 20 3b 3b 20 20 20 28 74 64 62 20 20 20 20 ;; (tdb
9cc0: 20 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73 74 (db:open-test
9cd0: 2d 64 62 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 -db run-dir)))..
9ce0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
9cf0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 int-info 4 "test
9d00: 3d 22 20 74 65 73 74 29 20 3b 3b 20 20 20 22 20 =" test) ;; "
9d10: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
9d20: 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 tname test) " id
9d30: 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 : " (db:test-get
9d40: 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74 -id test) " " it
9d50: 65 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f 6e em-path " action
9d60: 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 : " action)...
9d70: 20 20 20 20 28 63 61 73 65 20 61 63 74 69 6f 6e (case action
9d80: 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e ....((remove-run
9d90: 73 29 20 3b 3b 20 74 68 65 20 74 64 62 20 69 73 s) ;; the tdb is
9da0: 20 66 6f 72 20 66 75 74 75 72 65 20 70 6f 73 73 for future poss
9db0: 69 62 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65 6e ible. .... (open
9dc0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 -run-close db:de
9dd0: 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 lete-test-record
9de0: 73 20 64 62 20 23 66 20 28 64 62 3a 74 65 73 74 s db #f (db:test
9df0: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 -get-id test))..
9e00: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d .. (debug:print-
9e10: 69 6e 66 6f 20 31 20 22 41 74 74 65 6d 70 74 69 info 1 "Attempti
9e20: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 28 ng to remove " (
9e30: 69 66 20 72 65 61 6c 2d 64 69 72 20 28 63 6f 6e if real-dir (con
9e40: 63 20 22 20 64 69 72 20 22 20 72 65 61 6c 2d 64 c " dir " real-d
9e50: 69 72 20 22 20 61 6e 64 20 22 29 20 22 22 29 20 ir " and ") "")
9e60: 22 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 " link " run-dir
9e70: 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 72 ).... (if (and r
9e80: 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 20 28 eal-dir ..... (
9e90: 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 > (string-length
9ea0: 20 72 65 61 6c 2d 64 69 72 29 20 35 29 0a 09 09 real-dir) 5)...
9eb0: 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 .. (file-exists
9ec0: 3f 20 72 65 61 6c 2d 64 69 72 29 29 20 3b 3b 20 ? real-dir)) ;;
9ed0: 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 bad heuristic bu
9ee0: 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 t should prevent
9ef0: 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e /tmp /home etc.
9f00: 0a 09 09 09 20 20 20 20 20 28 62 65 67 69 6e 20 .... (begin
9f10: 3b 3b 20 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 ;; let* ((realpa
9f20: 74 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 th (resolve-path
9f30: 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 0a name run-dir))).
9f40: 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 ... (debug
9f50: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 :print-info 1 "R
9f60: 65 63 75 72 73 69 76 65 6c 79 20 72 65 6d 6f 76 ecursively remov
9f70: 69 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 29 0a ing " real-dir).
9f80: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 ... (if (f
9f90: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c ile-exists? real
9fa0: 2d 64 69 72 29 0a 09 09 09 09 20 20 20 28 69 66 -dir)..... (if
9fb0: 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e (> (system (con
9fc0: 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c c "rm -rf " real
9fd0: 2d 64 69 72 29 29 20 30 29 0a 09 09 09 09 20 20 -dir)) 0).....
9fe0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
9ff0: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 t 0 "ERROR: Ther
a000: 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 e was a problem
a010: 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d removing " real-
a020: 64 69 72 20 22 20 77 69 74 68 20 72 6d 20 2d 66 dir " with rm -f
a030: 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 "))..... (debu
a040: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
a050: 4e 47 3a 20 74 65 73 74 20 64 69 72 20 22 20 72 NG: test dir " r
a060: 65 61 6c 2d 64 69 72 20 22 20 61 70 70 65 61 72 eal-dir " appear
a070: 73 20 74 6f 20 6e 6f 74 20 65 78 69 73 74 20 6f s to not exist o
a080: 72 20 69 73 20 6e 6f 74 20 72 65 61 64 61 62 6c r is not readabl
a090: 65 22 29 29 29 0a 09 09 09 20 20 20 20 20 28 69 e"))).... (i
a0a0: 66 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 f real-dir .....
a0b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
a0c0: 22 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 "WARNING: direct
a0d0: 6f 72 79 20 22 20 72 65 61 6c 2d 64 69 72 20 22 ory " real-dir "
a0e0: 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 22 does not exist"
a0f0: 29 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 )..... (debug:pr
a100: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
a110: 6e 6f 20 72 65 61 6c 20 64 69 72 65 63 74 6f 72 no real director
a120: 79 20 63 6f 72 72 6f 73 70 6f 6e 64 69 6e 67 20 y corrosponding
a130: 74 6f 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 to link " run-di
a140: 72 20 22 2c 20 6e 6f 74 68 69 6e 67 20 64 6f 6e r ", nothing don
a150: 65 22 29 29 29 0a 09 09 09 20 28 69 66 20 28 73 e"))).... (if (s
a160: 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 ymbolic-link? ru
a170: 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 28 n-dir).... (
a180: 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 20 begin....
a190: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
a1a0: 6f 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 73 79 o 1 "Removing sy
a1b0: 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 mlink " run-dir)
a1c0: 0a 09 09 09 20 20 20 20 20 20 20 28 68 61 6e 64 .... (hand
a1d0: 6c 65 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 le-exceptions...
a1e0: 09 09 65 78 6e 0a 09 09 09 09 28 64 65 62 75 67 ..exn.....(debug
a1f0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
a200: 20 20 46 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f Failed to remo
a210: 76 65 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e ve symlink " run
a220: 2d 64 69 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e -dir ((condition
a230: 2d 70 72 6f 70 65 72 74 79 2d 61 63 63 65 73 73 -property-access
a240: 6f 72 20 27 65 78 6e 20 27 6d 65 73 73 61 67 65 or 'exn 'message
a250: 29 20 65 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 ) exn) ", attemp
a260: 74 69 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 ting to continue
a270: 22 29 0a 09 09 09 09 28 64 65 6c 65 74 65 2d 66 ").....(delete-f
a280: 69 6c 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 ile run-dir)))..
a290: 09 09 20 20 20 20 20 28 69 66 20 28 64 69 72 65 .. (if (dire
a2a0: 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a ctory? run-dir).
a2b0: 09 09 09 09 20 28 69 66 20 28 3e 20 28 64 69 72 .... (if (> (dir
a2c0: 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d ectory-fold (lam
a2d0: 62 64 61 20 28 66 20 78 29 28 2b 20 31 20 78 29 bda (f x)(+ 1 x)
a2e0: 29 20 30 20 72 75 6e 2d 64 69 72 29 20 30 29 0a ) 0 run-dir) 0).
a2f0: 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a .... (debug:
a300: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 print 0 "WARNING
a310: 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 : refusing to re
a320: 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 move " run-dir "
a330: 20 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d as it is not em
a340: 70 74 79 22 29 0a 09 09 09 09 20 20 20 20 20 20 pty").....
a350: 28 68 61 6e 64 6c 65 2d 65 78 63 65 70 74 69 6f (handle-exceptio
a360: 6e 73 0a 09 09 09 09 20 20 20 20 20 20 20 65 78 ns..... ex
a370: 6e 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 n..... (de
a380: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
a390: 4f 52 3a 20 20 46 61 69 6c 65 64 20 74 6f 20 72 OR: Failed to r
a3a0: 65 6d 6f 76 65 20 64 69 72 65 63 74 6f 72 79 20 emove directory
a3b0: 22 20 72 75 6e 2d 64 69 72 20 28 28 63 6f 6e 64 " run-dir ((cond
a3c0: 69 74 69 6f 6e 2d 70 72 6f 70 65 72 74 79 2d 61 ition-property-a
a3d0: 63 63 65 73 73 6f 72 20 27 65 78 6e 20 27 6d 65 ccessor 'exn 'me
a3e0: 73 73 61 67 65 29 20 65 78 6e 29 20 22 2c 20 61 ssage) exn) ", a
a3f0: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f 6e ttempting to con
a400: 74 69 6e 75 65 22 29 0a 09 09 09 09 20 20 20 20 tinue").....
a410: 20 20 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 (delete-direc
a420: 74 6f 72 79 20 72 75 6e 2d 64 69 72 29 29 29 0a tory run-dir))).
a430: 09 09 09 09 20 28 69 66 20 72 75 6e 2d 64 69 72 .... (if run-dir
a440: 0a 09 09 09 09 20 20 20 20 20 28 64 65 62 75 67 ..... (debug
a450: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e :print 0 "WARNIN
a460: 47 3a 20 6e 6f 74 20 72 65 6d 6f 76 69 6e 67 20 G: not removing
a470: 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 " run-dir " as i
a480: 74 20 65 69 74 68 65 72 20 64 6f 65 73 6e 27 74 t either doesn't
a490: 20 65 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 exist or is not
a4a0: 20 61 20 73 79 6d 6c 69 6e 6b 22 29 0a 09 09 09 a symlink")....
a4b0: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
a4c0: 6e 74 20 30 20 22 4e 4f 54 45 3a 20 74 68 65 20 nt 0 "NOTE: the
a4d0: 72 75 6e 20 64 69 72 20 66 6f 72 20 74 68 69 73 run dir for this
a4e0: 20 74 65 73 74 20 69 73 20 75 6e 64 65 66 69 6e test is undefin
a4f0: 65 64 2e 20 54 65 73 74 20 6d 61 79 20 68 61 76 ed. Test may hav
a500: 65 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 64 e already been d
a510: 65 6c 65 74 65 64 2e 22 29 29 0a 09 09 09 09 20 eleted.")).....
a520: 29 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 )))....((set-sta
a530: 74 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 te-status).... (
a540: 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f debug:print-info
a550: 20 32 20 22 6e 65 77 20 73 74 61 74 65 20 22 20 2 "new state "
a560: 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 (car state-statu
a570: 73 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 s) ", new status
a580: 20 22 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 " (cadr state-s
a590: 74 61 74 75 73 29 29 0a 09 09 09 20 28 6f 70 65 tatus)).... (ope
a5a0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 n-run-close db:t
a5b0: 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 est-set-state-st
a5c0: 61 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64 atus-by-id db (d
a5d0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
a5e0: 73 74 29 20 28 63 61 72 20 73 74 61 74 65 2d 73 st) (car state-s
a5f0: 74 61 74 75 73 29 28 63 61 64 72 20 73 74 61 74 tatus)(cadr stat
a600: 65 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 29 e-status) #f))))
a610: 29 0a 09 09 20 20 28 73 6f 72 74 20 74 65 73 74 )... (sort test
a620: 73 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 s (lambda (a b)(
a630: 6c 65 74 20 28 28 64 69 72 61 20 28 64 62 3a 74 let ((dira (db:t
a640: 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 61 est-get-rundir a
a650: 29 29 0a 09 09 09 09 09 09 20 28 64 69 72 62 20 ))....... (dirb
a660: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
a670: 64 69 72 20 62 29 29 29 0a 09 09 09 09 09 20 20 dir b)))......
a680: 20 20 20 28 69 66 20 28 61 6e 64 20 28 73 74 72 (if (and (str
a690: 69 6e 67 3f 20 64 69 72 61 29 28 73 74 72 69 6e ing? dira)(strin
a6a0: 67 3f 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 g? dirb)).......
a6b0: 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 (> (string-leng
a6c0: 74 68 20 64 69 72 61 29 28 73 74 72 69 6e 67 2d th dira)(string-
a6d0: 6c 65 6e 67 74 68 20 64 69 72 62 29 29 0a 09 09 length dirb))...
a6e0: 09 09 09 09 20 23 66 29 29 29 29 29 29 29 0a 09 .... #f)))))))..
a6f0: 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 ;; remove the
a700: 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 run if zero tes
a710: 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 ts remain.. (i
a720: 66 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 f (eq? action 'r
a730: 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 emove-runs)..
a740: 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 (let ((remte
a750: 73 74 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c sts (open-run-cl
a760: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 ose db:get-tests
a770: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a -for-run db (db:
a780: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
a790: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
a7a0: 69 64 22 29 20 23 66 20 27 28 22 44 45 4c 45 54 id") #f '("DELET
a7b0: 45 44 22 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f ED") '("n/a") no
a7c0: 74 2d 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 t-in: #t)))... (
a7d0: 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 if (null? remtes
a7e0: 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 ts) ;; no more t
a7f0: 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 ests remaining..
a800: 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 . (let* ((dp
a810: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 arts (string-sp
a820: 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f lit lasttpath "/
a830: 22 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 ")).... (runp
a840: 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 ath (conc "/" (s
a850: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
a860: 65 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 e .......(take d
a870: 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 parts (- (length
a880: 20 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 dparts) 1))....
a890: 09 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 ..."/"))))...
a8a0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
a8b0: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 1 "Removing run
a8c0: 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 : " runkey " " (
a8d0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
a8e0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
a8f0: 72 20 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 r "runname") " a
a900: 6e 64 20 72 65 6c 61 74 65 64 20 72 65 63 6f 72 nd related recor
a910: 64 22 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 d")... (op
a920: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
a930: 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 delete-run db ru
a940: 6e 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b n-id)... ;
a950: 3b 20 54 68 69 73 20 69 73 20 61 20 70 72 65 74 ; This is a pret
a960: 74 79 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f ty good place to
a970: 20 70 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 purge old DELET
a980: 45 44 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 ED tests...
a990: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
a9a0: 65 20 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 e db:delete-test
a9b0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e s-for-run db run
a9c0: 2d 69 64 29 0a 09 09 20 20 20 20 20 20 20 28 6f -id)... (o
a9d0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
a9e0: 3a 64 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 :delete-old-dele
a9f0: 74 65 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 ted-test-records
aa00: 20 64 62 29 0a 09 09 20 20 20 20 20 20 20 28 6f db)... (o
aa10: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
aa20: 3a 73 65 74 2d 76 61 72 20 64 62 20 22 44 45 4c :set-var db "DEL
aa30: 45 54 45 44 5f 54 45 53 54 53 22 20 28 63 75 72 ETED_TESTS" (cur
aa40: 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 rent-seconds))..
aa50: 09 20 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 . ;; need
aa60: 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 to figure out th
aa70: 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 e path to the ru
aa80: 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 n dir and remove
aa90: 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 it if empty...
aaa0: 20 20 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 ;; (if
aab0: 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f (null? (glob (co
aac0: 6e 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 nc runpath "/*")
aad0: 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 ))... ;;
aae0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 (begin...
aaf0: 20 20 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 ;; . (debu
ab00: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 g:print 1 "Remov
ab10: 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 ing run dir " ru
ab20: 6e 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 npath)...
ab30: 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f ;; . (system (co
ab40: 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 nc "rmdir -p " r
ab50: 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 unpath))))...
ab60: 20 20 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 ))))).. )).
ab70: 20 20 20 20 72 75 6e 73 29 29 0a 20 20 23 74 29 runs)). #t)
ab80: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ..;;============
ab90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
aba0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
abb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
abc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f ==========.;; Ro
abd0: 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 utines for manip
abe0: 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d ulating runs.;;=
abf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ac00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ac10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ac20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ac30: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 =====..;; Since
ac40: 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 many calls to a
ac50: 72 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 run require pret
ac60: 74 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 ty much the same
ac70: 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 setup .;; this
ac80: 77 72 61 70 70 65 72 20 69 73 20 75 73 65 64 20 wrapper is used
ac90: 74 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 65 to reduce the re
aca0: 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 plication of cod
acb0: 65 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 e.(define (gener
acc0: 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 al-run-call swit
acd0: 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 chname action-de
ace0: 73 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 sc proc). (let
acf0: 28 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a ((runname (args:
ad00: 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d get-arg ":runnam
ad10: 65 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 e"))..(target (
ad20: 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 if (args:get-arg
ad30: 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 "-target")...
ad40: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 (args:get-arg
ad50: 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 "-target")...
ad60: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 (args:get-arg
ad70: 20 22 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 "-reqtarg")))..
ad80: 28 74 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 (th1 #f)).
ad90: 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e (cond. ((n
ada0: 6f 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 ot target).
adb0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
adc0: 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 "ERROR: Missing
add0: 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 required paramet
ade0: 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e er for " switchn
adf0: 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 ame ", you must
ae00: 73 70 65 63 69 66 79 20 74 68 65 20 74 61 72 67 specify the targ
ae10: 65 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 et with -target"
ae20: 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 ). (exit 3)
ae30: 29 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e ). ((not run
ae40: 6e 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 name). (deb
ae50: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
ae60: 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 R: Missing requi
ae70: 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f red parameter fo
ae80: 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 r " switchname "
ae90: 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 , you must speci
aea0: 66 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 fy the run name
aeb0: 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 with :runname ru
aec0: 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 nname"). (e
aed0: 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c xit 3)). (el
aee0: 73 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 se. (let ((
aef0: 64 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b db #f).. (k
af00: 65 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e eys #f))..(if (n
af10: 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 ot (setup-for-ru
af20: 6e 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 n)).. (begin
af30: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
af40: 72 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 rint 0 "Failed t
af50: 6f 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 o setup, exiting
af60: 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 ").. (exit
af70: 31 29 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 1)))..(if (args:
af80: 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 get-arg "-server
af90: 22 29 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 ").. (open-ru
afa0: 6e 2d 63 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 n-close server:s
afb0: 74 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 tart db (args:ge
afc0: 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 t-arg "-server")
afd0: 29 29 0a 20 09 20 20 20 20 3b 3b 20 28 69 66 20 )). . ;; (if
afe0: 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 (not (or (args:g
aff0: 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 et-arg "-runall"
b000: 29 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 ) ;; runall
b010: 61 6e 64 20 72 75 6e 74 65 73 74 73 20 61 72 65 and runtests are
b020: 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 73 allowed to be s
b030: 65 72 76 65 72 73 0a 20 09 20 20 20 20 3b 3b 20 ervers. . ;;
b040: 20 20 20 20 09 20 28 61 72 67 73 3a 67 65 74 2d . (args:get-
b050: 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 arg "-runtests")
b060: 29 29 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 28 )).. ;; (
b070: 63 6c 69 65 6e 74 3a 73 65 74 75 70 29 20 3b 3b client:setup) ;;
b080: 20 54 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 This is a dupli
b090: 63 61 74 65 20 73 74 61 72 74 75 70 21 21 21 3f cate startup!!!?
b0a0: 3f 3f 20 42 55 47 3f 0a 09 20 20 20 20 3b 3b 20 ?? BUG?.. ;;
b0b0: 20 20 20 20 29 29 0a 09 28 73 65 74 21 20 6b 65 ))..(set! ke
b0c0: 79 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f ys (open-run-clo
b0d0: 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 se db:get-keys d
b0e0: 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f b))..;; have eno
b0f0: 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d ugh to process -
b100: 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 target or -reqta
b110: 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 rg here..(if (ar
b120: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
b130: 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 targ").. (let
b140: 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 * ((runconfigf (
b150: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 conc *toppath*
b160: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e "/runconfigs.con
b170: 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 fig")) ;; DO NOT
b180: 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 EVALUATE ALL ..
b190: 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 . (runconfig
b1a0: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e (read-config run
b1b0: 63 6f 6e 66 69 67 66 20 23 66 20 23 74 20 65 6e configf #f #t en
b1c0: 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 viron-patt: #f))
b1d0: 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 ) .. (if (h
b1e0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
b1f0: 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 fault runconfig
b200: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
b210: 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 reqtarg") #f)...
b220: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 (keys:target-s
b230: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 et-args keys (ar
b240: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
b250: 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d targ") args:arg-
b260: 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e hash)... (begin
b270: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
b280: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 int 0 "ERROR: ["
b290: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
b2a0: 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f -reqtarg") "] no
b2b0: 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e t found in " run
b2c0: 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 configf)... (
b2d0: 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 if db (sqlite3:f
b2e0: 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 inalize! db))...
b2f0: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a (exit 1)))).
b300: 09 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 . (if (args:g
b310: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 et-arg "-target"
b320: 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 )...(keys:target
b330: 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 -set-args keys (
b340: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 args:get-arg "-t
b350: 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d arget" args:arg-
b360: 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 hash) args:arg-h
b370: 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 ash)))..(if (not
b380: 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 (car *configinf
b390: 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e o*)).. (begin
b3a0: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
b3b0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 rint 0 "ERROR: A
b3c0: 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 ttempted to " ac
b3d0: 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 tion-desc " but
b3e0: 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 run area config
b3f0: 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 file not found")
b400: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
b410: 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 ).. ;; Extrac
b420: 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 t out stuff need
b430: 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 ed in most or ma
b440: 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b ny calls.. ;;
b450: 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 here then call
b460: 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 proc.. (let*
b470: 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 ((keynames (ma
b480: 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e p key:get-fieldn
b490: 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 ame keys))...
b4a0: 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 (keyvallst (key
b4b0: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 s->vallist keys
b4c0: 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 #t))).. (pr
b4d0: 6f 63 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d oc target runnam
b4e0: 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 e keys keynames
b4f0: 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 keyvallst)))..(i
b500: 66 20 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f f th1 (thread-jo
b510: 69 6e 21 20 74 68 31 29 29 0a 09 28 69 66 20 64 in! th1))..(if d
b520: 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c b (sqlite3:final
b530: 69 7a 65 21 20 64 62 29 29 0a 09 28 73 65 74 21 ize! db))..(set!
b540: 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 *didsomething*
b550: 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d #t))))))..;;====
b560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b5a0: 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 ==.;; Lock/unloc
b5b0: 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d k runs.;;=======
b5c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b5d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b5e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b5f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
b600: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 68 .(define (runs:h
b610: 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 andle-locking ta
b620: 72 67 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d rget keys runnam
b630: 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 e lock unlock us
b640: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 er). (let* ((db
b650: 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 72 75 #f).. (ru
b660: 6e 64 61 74 20 20 20 28 6f 70 65 6e 2d 72 75 6e ndat (open-run
b670: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d -close runs:get-
b680: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 runs-by-patt db
b690: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 keys runname))..
b6a0: 20 28 68 65 61 64 65 72 20 20 20 28 76 65 63 74 (header (vect
b6b0: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 or-ref rundat 0)
b6c0: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 76 ).. (runs (v
b6d0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 ector-ref rundat
b6e0: 20 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 1))). (for-e
b6f0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e ach (lambda (run
b700: 29 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 )...(let ((run-i
b710: 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d d (db:get-value-
b720: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
b730: 61 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 20 ader "id")))...
b740: 20 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 (if (or lock...
b750: 09 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 . (and unlock..
b760: 09 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a .. (begin.
b770: 09 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20 .... (print "Do
b780: 79 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20 you really wish
b790: 74 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 to unlock run "
b7a0: 72 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f run-id "?\n y/
b7b0: 6e 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 61 n: ")..... (equa
b7c0: 6c 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e l? "y" (read-lin
b7d0: 65 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 e)))))... (
b7e0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
b7f0: 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 b:lock/unlock-ru
b800: 6e 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b n db run-id lock
b810: 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 unlock user)...
b820: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
b830: 6e 74 2d 69 6e 66 6f 20 30 20 22 53 6b 69 70 70 nt-info 0 "Skipp
b840: 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 ing lock/unlock
b850: 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a on " run-id)))).
b860: 09 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b . runs))).;
b870: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
b880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b8a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b8b0: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 =======.;; Rollu
b8c0: 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d p runs.;;=======
b8d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b8e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b8f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b900: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
b910: 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 .;; Update the t
b920: 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 est_meta table f
b930: 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 or this test.(de
b940: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 fine (runs:updat
b950: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 e-test_meta db t
b960: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f est-name test-co
b970: 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 72 nf). (let ((cur
b980: 72 72 65 63 6f 72 64 20 28 6f 70 65 6e 2d 72 75 rrecord (open-ru
b990: 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d n-close db:testm
b9a0: 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 eta-get-record d
b9b0: 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 b test-name))).
b9c0: 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 72 72 (if (not curr
b9d0: 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a record)..(begin.
b9e0: 09 20 20 28 73 65 74 21 20 63 75 72 72 72 65 63 . (set! currrec
b9f0: 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 ord (make-vector
ba00: 20 31 30 20 23 66 29 29 0a 09 20 20 28 6f 70 65 10 #f)).. (ope
ba10: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 n-run-close db:t
ba20: 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f estmeta-add-reco
ba30: 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 rd db test-name)
ba40: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
ba50: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
ba60: 6b 65 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 key). (let
ba70: 2a 20 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 * ((idx (cadr ke
ba80: 79 29 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 y)).. (fld
ba90: 28 63 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 (car key))..
baa0: 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d (val (config-
bab0: 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 lookup test-conf
bac0: 20 22 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 "test_meta" fld
bad0: 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a ))).. ;; (debug:
bae0: 70 72 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 print 5 "idx: "
baf0: 69 64 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 idx " fld: " fld
bb00: 20 22 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 " val: " val)..
bb10: 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e (if (and val (n
bb20: 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 ot (equal? (vect
bb30: 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 or-ref currrecor
bb40: 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 d idx) val)))..
bb50: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 (begin..
bb60: 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 (print "Updat
bb70: 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 ing " test-name
bb80: 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 " " fld " to " v
bb90: 61 6c 29 0a 09 20 20 20 20 20 20 20 28 6f 70 65 al).. (ope
bba0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 n-run-close db:t
bbb0: 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 estmeta-update-f
bbc0: 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d ield db test-nam
bbd0: 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 e fld val))))).
bbe0: 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 20 '(("author"
bbf0: 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64 2)("owner" 3)("d
bc00: 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22 escription" 4)("
bc10: 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74 61 reviewed" 5)("ta
bc20: 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 gs" 9)))))..;; U
bc30: 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20 pdate test_meta
bc40: 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 for all tests.(d
bc50: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 efine (runs:upda
bc60: 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 te-all-test_meta
bc70: 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65 db). (let ((te
bc80: 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c st-names (get-al
bc90: 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29 l-legal-tests)))
bca0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
bcb0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 (lambda (te
bcc0: 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 st-name).
bcd0: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 (let* ((test-pat
bce0: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 h (conc *topp
bcf0: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 ath* "/tests/" t
bd00: 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 est-name))..
bd10: 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 (test-configf
bd20: 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 (conc test-path
bd30: 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a "/testconfig")).
bd40: 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69 73 . (testexis
bd50: 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d ts (and (file-
bd60: 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e exists? test-con
bd70: 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d figf)(file-read-
bd80: 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e access? test-con
bd90: 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b figf))).. ;
bda0: 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77 ; read configs w
bdb0: 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65 ith tricks turne
bdc0: 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 d off (i.e. no s
bdd0: 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74 ystem).. (t
bde0: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 est-conf (if
bdf0: 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64 testexists (read
be00: 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e -config test-con
be10: 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65 figf #f #f)(make
be20: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a -hash-table)))).
be30: 09 20 3b 3b 20 75 73 65 20 74 68 65 20 6f 70 65 . ;; use the ope
be40: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 n-run-close inst
be50: 65 61 64 20 6f 66 20 70 61 73 73 69 6e 67 20 69 ead of passing i
be60: 6e 20 64 62 0a 09 20 28 72 75 6e 73 3a 75 70 64 n db.. (runs:upd
be70: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 23 66 ate-test_meta #f
be80: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
be90: 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 conf))). tes
bea0: 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 t-names)))..;; T
beb0: 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 his could probab
bec0: 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 ly be refactored
bed0: 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 into one comple
bee0: 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 x query ....(def
bef0: 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 ine (runs:rollup
bf00: 2d 72 75 6e 20 6b 65 79 73 20 6b 65 79 76 61 6c -run keys keyval
bf10: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 lst runname user
bf20: 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 2c ) ;; was target,
bf30: 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 now keyvallst.
bf40: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
bf50: 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e "runs:rollup-run
bf60: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 , keys: " keys "
bf70: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 keyvallst: " ke
bf80: 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 yvallst " :runna
bf90: 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 me " runname " u
bfa0: 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 ser: " user). (
bfb0: 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 let* ((db
bfc0: 20 20 20 20 20 20 20 23 66 29 20 3b 3b 20 28 6b #f) ;; (k
bfd0: 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 eyvalllst (
bfe0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 keys:target->key
bff0: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 val keys target)
c000: 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 ).. (new-run-id
c010: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
c020: 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 73 74 lose runs:regist
c030: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b er-run db keys k
c040: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 eyvallst runname
c050: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 "new" "n/a" use
c060: 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 r)).. (prev-test
c070: 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e s (open-run
c080: 2d 63 6c 6f 73 65 20 74 65 73 74 3a 67 65 74 2d -close test:get-
c090: 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 matching-previou
c0a0: 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 s-test-run-recor
c0b0: 64 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 ds db new-run-id
c0c0: 20 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 "%" "%")).. (cu
c0d0: 72 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f rr-tests (o
c0e0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
c0f0: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
c100: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
c110: 20 22 25 2f 25 22 20 27 28 29 20 27 28 29 29 29 "%/%" '() '()))
c120: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 .. (curr-tests-h
c130: 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 ash (make-hash-t
c140: 61 62 6c 65 29 29 29 0a 20 20 20 20 28 6f 70 65 able))). (ope
c150: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75 n-run-close db:u
c160: 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f pdate-run-event_
c170: 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d time db new-run-
c180: 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 id). ;; index
c190: 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 the already sav
c1a0: 65 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74 ed tests by test
c1b0: 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 name and itemdat
c1c0: 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 in curr-tests-h
c1d0: 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 ash. (for-eac
c1e0: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 h. (lambda (
c1f0: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 testdat).
c200: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 (let* ((testname
c210: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 (db:test-get-t
c220: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 estname testdat)
c230: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 ).. (item-p
c240: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ath (db:test-get
c250: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 -item-path testd
c260: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c at)).. (ful
c270: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 l-name (conc tes
c280: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 tname "/" item-p
c290: 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 ath))).. (hash-t
c2a0: 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 able-set! curr-t
c2b0: 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e ests-hash full-n
c2c0: 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 ame testdat))).
c2d0: 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a curr-tests).
c2e0: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e ;; NOPE: Non
c2f0: 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 -optimal approac
c300: 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 h. Try this inst
c310: 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e ead.. ;; 1.
c320: 20 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69 tests are recei
c330: 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d ved in a list, m
c340: 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 ost recent first
c350: 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 . ;; 2. rep
c360: 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 lace the rollup
c370: 74 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 test with the ne
c380: 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 w *always*. (
c390: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 for-each . (
c3a0: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 lambda (testdat)
c3b0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 . (let* ((
c3c0: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 testname (db:te
c3d0: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
c3e0: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 testdat))..
c3f0: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a (item-path (db:
c400: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
c410: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 th testdat))..
c420: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 (full-name (
c430: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f conc testname "/
c440: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 " item-path))..
c450: 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d (prev-test-
c460: 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d dat (hash-table-
c470: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 ref/default curr
c480: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c -tests-hash full
c490: 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 -name #f))..
c4a0: 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 (test-steps
c4b0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
c4c0: 73 65 20 64 62 3a 67 65 74 2d 73 74 65 70 73 2d se db:get-steps-
c4d0: 66 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a for-test db (db:
c4e0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
c4f0: 64 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e dat))).. (n
c500: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 ew-test-record #
c510: 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 f)).. ;; replace
c520: 20 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 these with inse
c530: 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 rt ... select..
c540: 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 (apply sqlite3:e
c550: 78 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 xecute ...db ...
c560: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
c570: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
c580: 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 sts (run_id,test
c590: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
c5a0: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 s,event_time,hos
c5b0: 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 t,cpuload,diskfr
c5c0: 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c ee,uname,rundir,
c5d0: 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 item_path,run_du
c5e0: 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 ration,final_log
c5f0: 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 f,comment) "...
c600: 20 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c "VALUES (?,
c610: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
c620: 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 ?,?,?,?,?);")...
c630: 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 new-run-id (cddr
c640: 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 (vector->list t
c650: 65 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 estdat))).. (set
c660: 21 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 ! new-testdat (c
c670: 61 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f ar (open-run-clo
c680: 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d se db:get-tests-
c690: 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 for-run db new-r
c6a0: 75 6e 2d 69 64 20 28 63 6f 6e 63 20 74 65 73 74 un-id (conc test
c6b0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
c6c0: 74 68 29 20 27 28 29 20 27 28 29 29 29 29 0a 09 th) '() '())))..
c6d0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
c6e0: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 ! curr-tests-has
c6f0: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d h full-name new-
c700: 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 testdat) ;; this
c710: 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 could be confus
c720: 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 ing, which recor
c730: 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f d should go into
c740: 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c the lookup tabl
c750: 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c e?.. ;; Now dupl
c760: 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73 icate the test s
c770: 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 teps.. (debug:pr
c780: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 int 4 "Copying r
c790: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 ecords in test_s
c7a0: 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 teps from test_i
c7b0: 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 d=" (db:test-get
c7c0: 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 -id testdat) " t
c7d0: 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 o " (db:test-get
c7e0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
c7f0: 29 0a 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c ).. (open-run-cl
c800: 6f 73 65 20 0a 09 20 20 28 6c 61 6d 62 64 61 20 ose .. (lambda
c810: 28 29 0a 09 20 20 20 20 28 73 71 6c 69 74 65 33 ().. (sqlite3
c820: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 20 20 :execute ..
c830: 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 db .. (conc
c840: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 "INSERT OR REPLA
c850: 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 CE INTO test_ste
c860: 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 ps (test_id,step
c870: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
c880: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d s,event_time,com
c890: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45 ment) "... "SE
c8a0: 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d LECT " (db:test-
c8b0: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 get-id new-testd
c8c0: 61 74 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 at) ",stepname,s
c8d0: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e tate,status,even
c8e0: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 t_time,comment F
c8f0: 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 ROM test_steps W
c900: 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 HERE test_id=?;"
c910: 29 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 ).. (db:test
c920: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 -get-id testdat)
c930: 29 0a 09 20 20 20 20 3b 3b 20 4e 6f 77 20 64 75 ).. ;; Now du
c940: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 plicate the test
c950: 20 64 61 74 61 0a 09 20 20 20 20 28 64 65 62 75 data.. (debu
c960: 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 g:print 4 "Copyi
c970: 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 ng records in te
c980: 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 st_data from tes
c990: 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d t_id=" (db:test-
c9a0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 get-id testdat)
c9b0: 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d " to " (db:test-
c9c0: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 get-id new-testd
c9d0: 61 74 29 29 0a 09 20 20 20 20 28 73 71 6c 69 74 at)).. (sqlit
c9e0: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 e3:execute ..
c9f0: 20 20 64 62 20 0a 09 20 20 20 20 20 28 63 6f 6e db .. (con
ca00: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 c "INSERT OR REP
ca10: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 64 LACE INTO test_d
ca20: 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 74 ata (test_id,cat
ca30: 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 egory,variable,v
ca40: 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f alue,expected,to
ca50: 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 l,units,comment)
ca60: 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 "... "SELECT
ca70: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
ca80: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 d new-testdat) "
ca90: 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 ,category,variab
caa0: 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 le,value,expecte
cab0: 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d d,tol,units,comm
cac0: 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 ent FROM test_da
cad0: 74 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 ta WHERE test_id
cae0: 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a =?;").. (db:
caf0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
cb00: 64 61 74 29 29 29 29 0a 09 20 29 29 0a 20 20 20 dat)))).. )).
cb10: 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a prev-tests))).
cb20: 09 20 0a 20 20 20 20 20 0a . . .