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 28 2f 20 2a 72 75 6e 73 3a 63 61 lay* (/ *runs:ca
1040: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
1050: 2d 64 65 6c 61 79 2a 20 32 29 29 29 0a 0a 28 64 -delay* 2)))..(d
1060: 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6e 2d efine (runs:can-
1070: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 run-more-tests t
1080: 65 73 74 2d 72 65 63 6f 72 64 29 0a 20 20 28 74 est-record). (t
1090: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 72 75 hread-sleep! *ru
10a0: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
10b0: 74 65 73 74 73 2d 64 65 6c 61 79 2a 29 0a 20 20 tests-delay*).
10c0: 28 6c 65 74 2a 20 28 28 74 63 6f 6e 66 69 67 20 (let* ((tconfig
10d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10e0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
10f0: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 -get-testconfig
1100: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
1110: 28 6a 6f 62 67 72 6f 75 70 20 20 20 20 20 20 20 (jobgroup
1120: 20 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 (config
1130: 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 -lookup tconfig
1140: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 "requirements" "
1150: 6a 6f 62 67 72 6f 75 70 22 29 29 0a 09 20 3b 3b jobgroup")).. ;;
1160: 20 48 65 75 72 69 73 74 69 63 20 66 69 78 2e 20 Heuristic fix.
1170: 54 68 65 73 65 20 61 72 65 20 67 65 74 74 69 6e These are gettin
1180: 67 20 63 61 6c 6c 65 64 20 74 6f 6f 20 72 61 70 g called too rap
1190: 69 64 6c 79 20 77 68 65 6e 20 6a 6f 62 73 20 61 idly when jobs a
11a0: 72 65 20 72 75 6e 6e 69 6e 67 20 6f 72 20 73 74 re running or st
11b0: 75 63 6b 0a 09 20 3b 3b 20 73 6f 20 77 65 20 61 uck.. ;; so we a
11c0: 72 65 20 67 6f 69 6e 67 20 74 6f 20 69 6e 63 72 re going to incr
11d0: 65 6d 65 6e 74 20 61 20 67 6c 6f 62 61 6c 20 64 ement a global d
11e0: 65 6c 61 79 20 62 79 20 30 2e 31 20 73 65 63 6f elay by 0.1 seco
11f0: 6e 64 73 20 75 70 20 74 6f 20 31 30 20 73 65 63 nds up to 10 sec
1200: 6f 6e 64 73 0a 09 20 3b 3b 20 65 76 65 72 79 20 onds.. ;; every
1210: 74 69 6d 65 20 72 75 6e 73 3a 63 61 6e 2d 72 75 time runs:can-ru
1220: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 69 73 20 n-more-tests is
1230: 63 61 6c 6c 65 64 2e 0a 09 20 3b 3b 20 77 68 65 called... ;; whe
1240: 6e 20 61 20 74 65 73 74 20 69 73 20 6c 61 75 6e n a test is laun
1250: 63 68 65 64 20 6f 72 20 6f 74 68 65 72 20 61 63 ched or other ac
1260: 74 69 76 69 74 79 20 6f 63 63 75 72 73 20 64 69 tivity occurs di
1270: 76 69 64 65 20 74 68 65 20 64 65 6c 61 79 20 62 vide the delay b
1280: 79 20 32 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 y 2.. (num-runni
1290: 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 20 28 ng (
12a0: 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 cdb:remote-run d
12b0: 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 b:get-count-test
12c0: 73 2d 72 75 6e 6e 69 6e 67 20 23 66 29 29 0a 09 s-running #f))..
12d0: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e (num-running-in
12e0: 2d 6a 6f 62 67 72 6f 75 70 20 28 63 64 62 3a 72 -jobgroup (cdb:r
12f0: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 emote-run db:get
1300: 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e -count-tests-run
1310: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 ning-in-jobgroup
1320: 20 23 66 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 #f jobgroup))..
1330: 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 (max-concurrent
1340: 2d 6a 6f 62 73 20 20 20 20 20 28 6c 65 74 20 28 -jobs (let (
1350: 28 6d 63 6a 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f (mcj (config-loo
1360: 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 kup *configdat*
1370: 22 73 65 74 75 70 22 20 20 20 20 20 22 6d 61 78 "setup" "max
1380: 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 _concurrent_jobs
1390: 22 29 29 29 0a 09 09 09 09 20 20 20 20 28 69 66 ")))..... (if
13a0: 20 28 61 6e 64 20 6d 63 6a 20 28 73 74 72 69 6e (and mcj (strin
13b0: 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 29 0a g->number mcj)).
13c0: 09 09 09 09 09 28 73 74 72 69 6e 67 2d 3e 6e 75 .....(string->nu
13d0: 6d 62 65 72 20 6d 63 6a 29 0a 09 09 09 09 09 31 mber mcj)......1
13e0: 29 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f 75 70 ))).. (job-group
13f0: 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20 28 -limit (
1400: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 config-lookup *c
1410: 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 67 72 onfigdat* "jobgr
1420: 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 29 29 oups" jobgroup))
1430: 29 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 ). (if (and (
1440: 3e 20 28 2b 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 > (+ num-running
1450: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d num-running-in-
1460: 6a 6f 62 67 72 6f 75 70 29 20 30 29 0a 09 20 20 jobgroup) 0)..
1470: 20 20 20 28 3c 20 2a 72 75 6e 73 3a 63 61 6e 2d (< *runs:can-
1480: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 run-more-tests-d
1490: 65 6c 61 79 2a 20 31 30 29 29 0a 09 28 62 65 67 elay* 10))..(beg
14a0: 69 6e 0a 09 20 20 28 73 65 74 21 20 2a 72 75 6e in.. (set! *run
14b0: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 s:can-run-more-t
14c0: 65 73 74 73 2d 64 65 6c 61 79 2a 20 28 2b 20 2a ests-delay* (+ *
14d0: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
14e0: 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 2a 20 30 e-tests-delay* 0
14f0: 2e 31 29 29 0a 09 20 20 28 64 65 62 75 67 3a 70 .1)).. (debug:p
1500: 72 69 6e 74 2d 69 6e 66 6f 20 31 34 20 22 63 61 rint-info 14 "ca
1510: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
1520: 2d 64 65 6c 61 79 3a 20 22 20 2a 72 75 6e 73 3a -delay: " *runs:
1530: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
1540: 74 73 2d 64 65 6c 61 79 2a 29 29 29 0a 20 20 20 ts-delay*))).
1550: 20 28 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 2a (if (not (eq? *
1560: 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 last-num-running
1570: 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e -tests* num-runn
1580: 69 6e 67 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 ing))..(begin..
1590: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
15a0: 22 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d "max-concurrent-
15b0: 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 jobs: " max-conc
15c0: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e urrent-jobs ", n
15d0: 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 um-running: " nu
15e0: 6d 2d 72 75 6e 6e 69 6e 67 29 0a 09 20 20 28 73 m-running).. (s
15f0: 65 74 21 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 et! *last-num-ru
1600: 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 6e 75 6d nning-tests* num
1610: 2d 72 75 6e 6e 69 6e 67 29 29 29 0a 20 20 20 20 -running))).
1620: 28 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 (if (not (eq? 0
1630: 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 *globalexitstatu
1640: 73 2a 29 29 0a 09 28 6c 69 73 74 20 23 66 20 6e s*))..(list #f n
1650: 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 um-running num-r
1660: 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f unning-in-jobgro
1670: 75 70 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e up max-concurren
1680: 74 2d 6a 6f 62 73 20 6a 6f 62 2d 67 72 6f 75 70 t-jobs job-group
1690: 2d 6c 69 6d 69 74 29 0a 09 28 6c 65 74 20 28 28 -limit)..(let ((
16a0: 63 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 can-not-run-more
16b0: 20 28 63 6f 6e 64 0a 09 09 09 09 20 3b 3b 20 69 (cond..... ;; i
16c0: 66 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 f max-concurrent
16d0: 2d 6a 6f 62 73 20 69 73 20 73 65 74 20 61 6e 64 -jobs is set and
16e0: 20 74 68 65 20 6e 75 6d 62 65 72 20 72 75 6e 6e the number runn
16f0: 69 6e 67 20 69 73 20 67 72 65 61 74 65 72 20 0a ing is greater .
1700: 09 09 09 09 20 3b 3b 20 74 68 61 6e 20 69 74 20 .... ;; than it
1710: 74 68 61 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 than cannot run
1720: 6d 6f 72 65 20 6a 6f 62 73 0a 09 09 09 09 20 28 more jobs..... (
1730: 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 (and max-concurr
1740: 65 6e 74 2d 6a 6f 62 73 20 28 3e 3d 20 6e 75 6d ent-jobs (>= num
1750: 2d 72 75 6e 6e 69 6e 67 20 6d 61 78 2d 63 6f 6e -running max-con
1760: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29 0a 09 current-jobs))..
1770: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ... (debug:prin
1780: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 4d 61 t 0 "WARNING: Ma
1790: 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 x running jobs e
17a0: 78 63 65 65 64 65 64 2c 20 63 75 72 72 65 6e 74 xceeded, current
17b0: 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 3a number running:
17c0: 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a " num-running .
17d0: 09 09 09 09 09 20 20 20 20 20 20 20 22 2c 20 6d ..... ", m
17e0: 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f ax_concurrent_jo
17f0: 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 bs: " max-concur
1800: 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 09 09 20 rent-jobs).....
1810: 20 23 74 29 0a 09 09 09 09 20 3b 3b 20 69 66 20 #t)..... ;; if
1820: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 job-group-limit
1830: 69 73 20 73 65 74 20 61 6e 64 20 6e 75 6d 62 65 is set and numbe
1840: 72 20 6f 66 20 6a 6f 62 73 20 69 6e 20 74 68 65 r of jobs in the
1850: 20 67 72 6f 75 70 20 69 73 20 67 72 65 61 74 65 group is greate
1860: 72 0a 09 09 09 09 20 3b 3b 20 74 68 61 6e 20 74 r..... ;; than t
1870: 68 65 20 6c 69 6d 69 74 20 74 68 65 6e 20 63 61 he limit then ca
1880: 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f nnot run more jo
1890: 62 73 20 6f 66 20 74 68 69 73 20 6b 69 6e 64 0a bs of this kind.
18a0: 09 09 09 09 20 28 28 61 6e 64 20 6a 6f 62 2d 67 .... ((and job-g
18b0: 72 6f 75 70 2d 6c 69 6d 69 74 0a 09 09 09 09 20 roup-limit.....
18c0: 20 20 20 20 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 (>= num-ru
18d0: 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 nning-in-jobgrou
18e0: 70 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 p job-group-limi
18f0: 74 29 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 t))..... (debug
1900: 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 49 4e :print 1 "WARNIN
1910: 47 3a 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 G: number of job
1920: 73 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d s " num-running-
1930: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 0a 09 09 09 in-jobgroup ....
1940: 09 09 20 20 20 20 20 20 20 22 20 69 6e 20 22 20 .. " in "
1950: 6a 6f 62 67 72 6f 75 70 20 22 20 65 78 63 65 65 jobgroup " excee
1960: 64 65 64 2c 20 77 69 6c 6c 20 6e 6f 74 20 72 75 ded, will not ru
1970: 6e 20 22 20 28 74 65 73 74 73 3a 74 65 73 74 71 n " (tests:testq
1980: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d ueue-get-testnam
1990: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a e test-record)).
19a0: 09 09 09 09 20 20 23 74 29 0a 09 09 09 09 20 28 .... #t)..... (
19b0: 65 6c 73 65 20 23 66 29 29 29 29 0a 09 20 20 28 else #f)))).. (
19c0: 6c 69 73 74 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f list (not can-no
19d0: 74 2d 72 75 6e 2d 6d 6f 72 65 29 20 6e 75 6d 2d t-run-more) num-
19e0: 72 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e running num-runn
19f0: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 ing-in-jobgroup
1a00: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
1a10: 6f 62 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 obs job-group-li
1a20: 6d 69 74 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d mit)))))..;;====
1a30: 3d 3d 3d 3d 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 0a 3b 3b 20 4e 65 77 20 6d 65 74 68 6f 64 ==.;; New method
1a80: 6f 6c 6f 67 79 2e 20 54 68 65 73 65 20 72 6f 75 ology. These rou
1a90: 74 69 6e 65 73 20 77 69 6c 6c 20 72 65 70 6c 61 tines will repla
1aa0: 63 65 20 74 68 65 20 61 62 6f 76 65 20 69 6e 20 ce the above in
1ab0: 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 time. For.;; now
1ac0: 20 74 68 65 20 63 6f 64 65 20 69 73 20 64 75 70 the code is dup
1ad0: 6c 69 63 61 74 65 64 2e 20 54 68 69 73 20 73 74 licated. This st
1ae0: 75 66 66 20 69 73 20 69 6e 69 74 69 61 6c 6c 79 uff is initially
1af0: 20 75 73 65 64 20 69 6e 20 74 68 65 20 6d 6f 6e used in the mon
1b00: 69 74 6f 72 0a 3b 3b 20 62 61 73 65 64 20 63 6f itor.;; based co
1b10: 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d de..;;==========
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 0a 0a 3b 3b ============..;;
1b60: 20 72 65 67 69 73 74 65 72 20 61 20 74 65 73 74 register a test
1b70: 20 72 75 6e 20 77 69 74 68 20 74 68 65 20 64 62 run with the db
1b80: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 .(define (runs:r
1b90: 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b egister-run db k
1ba0: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 eys keyvallst ru
1bb0: 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 nname state stat
1bc0: 75 73 20 75 73 65 72 29 0a 20 20 28 64 65 62 75 us user). (debu
1bd0: 67 3a 70 72 69 6e 74 20 33 20 22 72 75 6e 73 3a g:print 3 "runs:
1be0: 72 65 67 69 73 74 65 72 2d 72 75 6e 2c 20 6b 65 register-run, ke
1bf0: 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 ys: " keys " key
1c00: 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c vallst: " keyval
1c10: 6c 73 74 20 22 20 72 75 6e 6e 61 6d 65 3a 20 22 lst " runname: "
1c20: 20 72 75 6e 6e 61 6d 65 20 22 20 73 74 61 74 65 runname " state
1c30: 3a 20 22 20 73 74 61 74 65 20 22 20 73 74 61 74 : " state " stat
1c40: 75 73 3a 20 22 20 73 74 61 74 75 73 20 22 20 75 us: " status " u
1c50: 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 28 ser: " user). (
1c60: 6c 65 74 2a 20 28 28 6b 65 79 73 74 72 20 20 20 let* ((keystr
1c70: 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74 72 20 6b (keys->keystr k
1c80: 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d 61 20 20 eys)).. (comma
1c90: 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 (if (> (lengt
1ca0: 68 20 6b 65 79 73 29 20 30 29 20 22 2c 22 20 22 h keys) 0) "," "
1cb0: 22 29 29 0a 09 20 28 61 6e 64 73 74 72 20 20 20 ")).. (andstr
1cc0: 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 (if (> (length
1cd0: 6b 65 79 73 29 20 30 29 20 22 20 41 4e 44 20 22 keys) 0) " AND "
1ce0: 20 22 22 29 29 0a 09 20 28 76 61 6c 73 6c 6f 74 "")).. (valslot
1cf0: 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f s (keys->valslo
1d00: 74 73 20 6b 65 79 73 29 29 20 3b 3b 20 3f 2c 3f ts keys)) ;; ?,?
1d10: 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 76 61 6c ,? ..... (keyval
1d20: 73 20 20 20 28 6d 61 70 20 63 61 64 72 20 6b 65 s (map cadr ke
1d30: 79 76 61 6c 6c 73 74 29 29 0a 09 20 28 61 6c 6c yvallst)).. (all
1d40: 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 vals (append (
1d50: 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 list runname sta
1d60: 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29 20 te status user)
1d70: 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 71 72 79 keyvals)).. (qry
1d80: 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 vals (append (
1d90: 6c 69 73 74 20 72 75 6e 6e 61 6d 65 29 20 6b 65 list runname) ke
1da0: 79 76 61 6c 73 29 29 0a 09 20 28 6b 65 79 3d 3f yvals)).. (key=?
1db0: 73 74 72 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 str (string-int
1dc0: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c ersperse (map (l
1dd0: 61 6d 62 64 61 20 28 6b 29 28 63 6f 6e 63 20 28 ambda (k)(conc (
1de0: 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d key:get-fieldnam
1df0: 65 20 6b 29 20 22 3d 3f 22 29 29 20 6b 65 79 73 e k) "=?")) keys
1e00: 29 20 22 20 41 4e 44 20 22 29 29 29 0a 20 20 20 ) " AND "))).
1e10: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 (debug:print 3
1e20: 22 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 "keys: " keys "
1e30: 61 6c 6c 76 61 6c 73 3a 20 22 20 61 6c 6c 76 61 allvals: " allva
1e40: 6c 73 20 22 20 6b 65 79 76 61 6c 73 3a 20 22 20 ls " keyvals: "
1e50: 6b 65 79 76 61 6c 73 29 0a 20 20 20 20 28 64 65 keyvals). (de
1e60: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 bug:print 2 "NOT
1e70: 45 3a 20 75 73 69 6e 67 20 74 61 72 67 65 74 20 E: using target
1e80: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 " (string-inters
1e90: 70 65 72 73 65 20 6b 65 79 76 61 6c 73 20 22 2f perse keyvals "/
1ea0: 22 29 20 22 20 66 6f 72 20 74 68 69 73 20 72 75 ") " for this ru
1eb0: 6e 22 29 0a 20 20 20 20 28 69 66 20 28 61 6e 64 n"). (if (and
1ec0: 20 72 75 6e 6e 61 6d 65 20 28 6e 75 6c 6c 3f 20 runname (null?
1ed0: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 (filter (lambda
1ee0: 28 78 29 28 6e 6f 74 20 78 29 29 20 6b 65 79 76 (x)(not x)) keyv
1ef0: 61 6c 73 29 29 29 20 3b 3b 20 74 68 65 72 65 20 als))) ;; there
1f00: 6d 75 73 74 20 62 65 20 61 20 62 65 74 74 65 72 must be a better
1f10: 20 77 61 79 20 74 6f 20 22 61 70 70 6c 79 20 61 way to "apply a
1f20: 6e 64 22 0a 09 28 6c 65 74 20 28 28 72 65 73 20 nd"..(let ((res
1f30: 23 66 29 29 0a 09 20 20 28 61 70 70 6c 79 20 73 #f)).. (apply s
1f40: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 qlite3:execute d
1f50: 62 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 b (conc "INSERT
1f60: 4f 52 20 49 47 4e 4f 52 45 20 49 4e 54 4f 20 72 OR IGNORE INTO r
1f70: 75 6e 73 20 28 72 75 6e 6e 61 6d 65 2c 73 74 61 uns (runname,sta
1f80: 74 65 2c 73 74 61 74 75 73 2c 6f 77 6e 65 72 2c te,status,owner,
1f90: 65 76 65 6e 74 5f 74 69 6d 65 22 20 63 6f 6d 6d event_time" comm
1fa0: 61 20 6b 65 79 73 74 72 20 22 29 20 56 41 4c 55 a keystr ") VALU
1fb0: 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 ES (?,?,?,?,strf
1fc0: 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 29 time('%s','now')
1fd0: 22 20 63 6f 6d 6d 61 20 76 61 6c 73 6c 6f 74 73 " comma valslots
1fe0: 20 22 29 3b 22 29 0a 09 09 20 61 6c 6c 76 61 6c ");")... allval
1ff0: 73 29 0a 09 20 20 28 61 70 70 6c 79 20 73 71 6c s).. (apply sql
2000: 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f ite3:for-each-ro
2010: 77 20 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 28 w .. (lambda (
2020: 69 64 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 id).. (set!
2030: 72 65 73 20 69 64 29 29 0a 09 20 20 20 64 62 0a res id)).. db.
2040: 09 20 20 20 28 6c 65 74 20 28 28 71 72 79 20 28 . (let ((qry (
2050: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 69 64 20 conc "SELECT id
2060: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 FROM runs WHERE
2070: 28 72 75 6e 6e 61 6d 65 3d 3f 20 22 20 61 6e 64 (runname=? " and
2080: 73 74 72 20 6b 65 79 3d 3f 73 74 72 20 22 29 3b str key=?str ");
2090: 22 29 29 29 0a 09 20 20 20 20 20 3b 28 64 65 62 "))).. ;(deb
20a0: 75 67 3a 70 72 69 6e 74 20 34 20 22 71 72 79 3a ug:print 4 "qry:
20b0: 20 22 20 71 72 79 29 20 0a 09 20 20 20 20 20 71 " qry) .. q
20c0: 72 79 29 0a 09 20 20 20 71 72 79 76 61 6c 73 29 ry).. qryvals)
20d0: 0a 09 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 .. (sqlite3:exe
20e0: 63 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 cute db "UPDATE
20f0: 72 75 6e 73 20 53 45 54 20 73 74 61 74 65 3d 3f runs SET state=?
2100: 2c 73 74 61 74 75 73 3d 3f 20 57 48 45 52 45 20 ,status=? WHERE
2110: 69 64 3d 3f 3b 22 20 73 74 61 74 65 20 73 74 61 id=?;" state sta
2120: 74 75 73 20 72 65 73 29 0a 09 20 20 72 65 73 29 tus res).. res)
2130: 20 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 ..(begin.. (de
2140: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
2150: 4f 52 3a 20 43 61 6c 6c 65 64 20 77 69 74 68 6f OR: Called witho
2160: 75 74 20 61 6c 6c 20 6e 65 63 65 73 73 61 72 79 ut all necessary
2170: 20 6b 65 79 73 22 29 0a 09 20 20 23 66 29 29 29 keys").. #f)))
2180: 29 0a 0a 3b 3b 20 54 68 69 73 20 69 73 20 61 20 )..;; This is a
2190: 64 75 70 6c 69 63 61 74 65 20 6f 66 20 72 75 6e duplicate of run
21a0: 2d 74 65 73 74 73 20 28 77 68 69 63 68 20 68 61 -tests (which ha
21b0: 73 20 62 65 65 6e 20 64 65 70 72 65 63 61 74 65 s been deprecate
21c0: 64 29 2e 20 55 73 65 20 74 68 69 73 20 6f 6e 65 d). Use this one
21d0: 20 69 6e 73 74 65 61 64 20 6f 66 20 72 75 6e 20 instead of run
21e0: 74 65 73 74 73 2e 0a 3b 3b 20 6b 65 79 76 61 6c tests..;; keyval
21f0: 73 2e 0a 3b 3b 0a 3b 3b 20 20 74 65 73 74 2d 6e s..;;.;; test-n
2200: 61 6d 65 73 3a 20 43 6f 6d 6d 61 20 73 65 70 61 ames: Comma sepa
2210: 72 61 74 65 64 20 70 61 74 74 65 72 6e 73 20 73 rated patterns s
2220: 61 6d 65 20 61 73 20 74 65 73 74 2d 70 61 74 74 ame as test-patt
2230: 73 20 62 75 74 20 75 73 65 64 20 69 6e 20 73 65 s but used in se
2240: 6c 65 63 74 69 6f 6e 20 0a 3b 3b 20 20 20 20 20 lection .;;
2250: 20 20 20 20 20 20 20 20 20 6f 66 20 74 65 73 74 of test
2260: 73 20 74 6f 20 72 75 6e 2e 20 54 68 65 20 69 74 s to run. The it
2270: 65 6d 20 70 6f 72 74 69 6f 6e 73 20 61 72 65 20 em portions are
2280: 6e 6f 74 20 72 65 73 70 65 63 74 65 64 2e 0a 3b not respected..;
2290: 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 46 ; F
22a0: 49 58 4d 45 3a 20 65 72 72 6f 72 20 6f 75 74 20 IXME: error out
22b0: 69 66 20 2f 70 61 74 74 20 73 70 65 63 69 66 69 if /patt specifi
22c0: 65 64 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 ed.;;
22d0: 20 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a .(define (runs:
22e0: 72 75 6e 2d 74 65 73 74 73 20 74 61 72 67 65 74 run-tests target
22f0: 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 6e 61 runname test-na
2300: 6d 65 73 20 74 65 73 74 2d 70 61 74 74 73 20 75 mes test-patts u
2310: 73 65 72 20 66 6c 61 67 73 29 0a 20 20 28 63 6f ser flags). (co
2320: 6d 6d 6f 6e 3a 63 6c 65 61 72 2d 63 61 63 68 65 mmon:clear-cache
2330: 73 29 20 3b 3b 20 63 6c 65 61 72 20 61 6c 6c 20 s) ;; clear all
2340: 63 61 63 68 65 73 0a 20 20 28 6c 65 74 2a 20 28 caches. (let* (
2350: 28 64 62 20 20 20 20 20 20 20 20 20 20 23 66 29 (db #f)
2360: 0a 09 20 28 6b 65 79 73 20 20 20 20 20 20 20 20 .. (keys
2370: 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 (cdb:remote-run
2380: 64 62 3a 67 65 74 2d 6b 65 79 73 20 23 66 29 29 db:get-keys #f))
2390: 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 .. (keyvallst
23a0: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 (keys:target->ke
23b0: 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 yval keys target
23c0: 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 )).. (run-id
23d0: 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 (cdb:remote-ru
23e0: 6e 20 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d n runs:register-
23f0: 72 75 6e 20 23 66 20 6b 65 79 73 20 6b 65 79 76 run #f keys keyv
2400: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
2410: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
2420: 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 ;; test-name)
2430: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 )).. (deferred
2440: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 '()) ;; delay
2450: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 running these si
2460: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20 nce they have a
2470: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 waiton clause..
2480: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 ;; keepgoing is
2490: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 the defacto moda
24a0: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 lity now, will a
24b0: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 dd hit-n-run a b
24c0: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b it later.. ;; (k
24d0: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 eepgoing (hash
24e0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
24f0: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 lt flags "-keepg
2500: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 72 75 oing" #f)).. (ru
2510: 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 nconfigf (conc
2520: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 *toppath* "/ru
2530: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 nconfigs.config"
2540: 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 2d 74 )).. (required-t
2550: 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 65 73 ests '()).. (tes
2560: 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d t-records (make-
2570: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20 hash-table)))..
2580: 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 (set-megatest
2590: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 -env-vars run-id
25a0: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 ) ;; these may b
25b0: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 e needed by the
25c0: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 launching proces
25d0: 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 6c 65 s.. (if (file
25e0: 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 -exists? runconf
25f0: 69 67 66 29 0a 09 28 6f 70 65 6e 2d 72 75 6e 2d igf)..(open-run-
2600: 63 6c 6f 73 65 20 73 65 74 75 70 2d 65 6e 76 2d close setup-env-
2610: 64 65 66 61 75 6c 74 73 20 64 62 20 72 75 6e 63 defaults db runc
2620: 6f 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 onfigf run-id *a
2630: 6c 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 lready-seen-runc
2640: 6f 6e 66 69 67 2d 69 6e 66 6f 2a 20 22 70 72 65 onfig-info* "pre
2650: 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d 76 61 72 73 -launch-env-vars
2660: 22 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ")..(debug:print
2670: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 0 "WARNING: You
2680: 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 72 do not have a r
2690: 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 un config file:
26a0: 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a 20 " runconfigf)).
26b0: 20 20 20 0a 20 20 20 20 3b 3b 20 6c 6f 6f 6b 20 . ;; look
26c0: 75 70 20 61 6c 6c 20 74 65 73 74 73 20 6d 61 74 up all tests mat
26d0: 63 68 69 6e 67 20 74 68 65 20 63 6f 6d 6d 61 20 ching the comma
26e0: 73 65 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f separated list o
26f0: 66 20 67 6c 6f 62 73 20 69 6e 0a 20 20 20 20 3b f globs in. ;
2700: 3b 20 74 65 73 74 2d 70 61 74 74 73 20 28 75 73 ; test-patts (us
2710: 69 6e 67 20 25 20 61 73 20 77 69 6c 64 63 61 72 ing % as wildcar
2720: 64 29 0a 0a 20 20 20 20 28 73 65 74 21 20 74 65 d).. (set! te
2730: 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a st-names (tests:
2740: 67 65 74 2d 76 61 6c 69 64 2d 74 65 73 74 73 20 get-valid-tests
2750: 2a 74 6f 70 70 61 74 68 2a 20 74 65 73 74 2d 6e *toppath* test-n
2760: 61 6d 65 73 29 29 0a 20 20 20 20 28 73 65 74 21 ames)). (set!
2770: 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 65 6c test-names (del
2780: 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 74 ete-duplicates t
2790: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 20 est-names))..
27a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
27b0: 66 6f 20 30 20 22 74 65 73 74 20 6e 61 6d 65 73 fo 0 "test names
27c0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a 0a " test-names)..
27d0: 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 ;; on the fi
27e0: 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 6c 6c rst pass or call
27f0: 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 73 65 to run-tests se
2800: 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 t FAILS to NOT_S
2810: 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 3b 3b TARTED if. ;;
2820: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 73 -keepgoing is s
2830: 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 69 66 pecified. (if
2840: 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 (eq? *passnum*
2850: 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 0)..(begin.. ;;
2860: 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74 65 20 have to delete
2870: 74 65 73 74 20 72 65 63 6f 72 64 73 20 77 68 65 test records whe
2880: 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 re NOT_STARTED s
2890: 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20 63 61 ince they can ca
28a0: 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 use -keepgoing t
28b0: 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 74 75 o .. ;; get stu
28c0: 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 ck due to becomi
28d0: 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c 65 20 ng inaccessible
28e0: 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 74 65 from a failed te
28f0: 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 73 74 st. I.e. if test
2900: 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20 20 3b B depends .. ;
2910: 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75 74 20 ; on test A but
2920: 74 65 73 74 20 42 20 72 65 61 63 68 65 64 20 74 test B reached t
2930: 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e he point on bein
2940: 67 20 72 65 67 69 73 74 65 72 65 64 20 61 73 20 g registered as
2950: 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e 64 20 NOT_STARTED and
2960: 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 test.. ;; A fai
2970: 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 led for some rea
2980: 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 son then on re-r
2990: 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f un using -keepgo
29a0: 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61 6e 20 ing the run can
29b0: 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a never complete..
29c0: 09 20 20 28 63 64 62 3a 64 65 6c 65 74 65 2d 74 . (cdb:delete-t
29d0: 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 2a 72 ests-in-state *r
29e0: 75 6e 72 65 6d 6f 74 65 2a 20 72 75 6e 2d 69 64 unremote* run-id
29f0: 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a "NOT_STARTED").
2a00: 09 20 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 . (cdb:remote-r
2a10: 75 6e 20 64 62 3a 73 65 74 2d 74 65 73 74 73 2d un db:set-tests-
2a20: 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66 20 state-status #f
2a30: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
2a40: 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 s #f "FAIL" "NOT
2a50: 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 _STARTED" "FAIL"
2a60: 29 29 29 0a 0a 20 20 20 20 3b 3b 20 66 72 6f 6d ))).. ;; from
2a70: 20 68 65 72 65 20 6f 6e 20 6f 75 74 20 74 68 65 here on out the
2a80: 20 64 62 20 77 69 6c 6c 20 62 65 20 6f 70 65 6e db will be open
2a90: 65 64 20 61 6e 64 20 63 6c 6f 73 65 64 20 6f 6e ed and closed on
2aa0: 20 65 76 65 72 79 20 63 61 6c 6c 20 72 75 6e 73 every call runs
2ab0: 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 :run-tests-queue
2ac0: 0a 20 20 20 20 3b 3b 20 28 73 71 6c 69 74 65 33 . ;; (sqlite3
2ad0: 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 20 0a :finalize! db) .
2ae0: 20 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e ;; now add n
2af0: 6f 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 on-directly refe
2b00: 72 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 renced dependenc
2b10: 69 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e ies (i.e. waiton
2b20: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ). (if (not (
2b30: 6e 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 null? test-names
2b40: 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 ))..(let loop ((
2b50: 68 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 hed (car test-na
2b60: 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 mes))... (tal
2b70: 28 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 (cdr test-names)
2b80: 29 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 )) ;; 'r
2b90: 65 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c eturn-procs tell
2ba0: 73 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 s the config rea
2bb0: 64 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e der to prep runn
2bc0: 69 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 ing system but r
2bd0: 65 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 eturn a proc..
2be0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
2bf0: 6f 20 34 20 22 68 65 64 3d 22 20 68 65 64 20 22 o 4 "hed=" hed "
2c00: 20 61 74 20 74 6f 70 20 6f 66 20 6c 6f 6f 70 22 at top of loop"
2c10: 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e ).. (let* ((con
2c20: 66 69 67 20 20 28 74 65 73 74 73 3a 67 65 74 2d fig (tests:get-
2c30: 74 65 73 74 63 6f 6e 66 69 67 20 68 65 64 20 27 testconfig hed '
2c40: 72 65 74 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 return-procs))..
2c50: 09 20 28 77 61 69 74 6f 6e 73 20 28 69 66 20 63 . (waitons (if c
2c60: 6f 6e 66 69 67 20 28 73 74 72 69 6e 67 2d 73 70 onfig (string-sp
2c70: 6c 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f lit (let ((w (co
2c80: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 nfig-lookup conf
2c90: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 ig "requirements
2ca0: 22 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 " "waiton")))...
2cb0: 09 09 09 09 20 20 20 20 20 28 69 66 20 77 20 77 .... (if w w
2cc0: 20 22 22 29 29 29 0a 09 09 09 20 20 20 20 20 20 "")))....
2cd0: 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62 75 (begin.....(debu
2ce0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
2cf0: 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 20 72 : non-existent r
2d00: 65 71 75 69 72 65 64 20 74 65 73 74 20 5c 22 22 equired test \""
2d10: 20 68 65 64 20 22 5c 22 22 29 0a 20 20 20 20 20 hed "\"").
2d20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2d30: 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 64 (if d
2d40: 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c b (sqlite3:final
2d50: 69 7a 65 21 20 64 62 29 29 0a 09 09 09 09 28 65 ize! db)).....(e
2d60: 78 69 74 20 31 29 29 29 29 29 0a 09 20 20 20 20 xit 1)))))..
2d70: 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 ;; check for hed
2d80: 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 in waitons => t
2d90: 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 his would be cir
2da0: 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 cular, remove it
2db0: 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 and issue an..
2dc0: 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 ;; error..
2dd0: 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65 64 (if (member hed
2de0: 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 waitons)...(beg
2df0: 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 in... (debug:pr
2e00: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65 int 0 "ERROR: te
2e10: 73 74 20 22 20 68 65 64 20 22 20 68 61 73 20 6c st " hed " has l
2e20: 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 20 isted itself as
2e30: 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 a waiton, please
2e40: 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 29 correct this!")
2e50: 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74 6f ... (set! waito
2e60: 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 ns (filter (lamb
2e70: 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61 da (x)(not (equa
2e80: 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74 l? x hed))) wait
2e90: 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a 09 20 ons)))).. ..
2ea0: 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 ;; (items (
2eb0: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d items:get-items-
2ec0: 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 from-config conf
2ed0: 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 ig))).. (if (
2ee0: 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d not (hash-table-
2ef0: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 ref/default test
2f00: 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 66 29 -records hed #f)
2f10: 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d )...(hash-table-
2f20: 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 set! test-record
2f30: 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 63 74 s..... hed (vect
2f40: 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 30 0a or hed ;; 0.
2f50: 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 69 67 ..... config
2f60: 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 20 20 ;; 1......
2f70: 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 waitons ;; 2...
2f80: 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 67 2d ... (config-
2f90: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 lookup config "r
2fa0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72 equirements" "pr
2fb0: 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b 3b 20 iority") ;;
2fc0: 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 09 09 priority 3......
2fd0: 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d (let ((item
2fe0: 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 s (hash-tab
2ff0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 le-ref/default c
3000: 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 23 66 onfig "items" #f
3010: 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 )) ;; items 4...
3020: 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 61 62 .... (itemstab
3030: 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 le (hash-table-r
3040: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 ef/default confi
3050: 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 23 g "itemstable" #
3060: 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 20 20 f))) ......
3070: 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 ;; if either i
3080: 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 74 61 tems or items ta
3090: 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 72 65 ble is a proc re
30a0: 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 74 20 turn it so test
30b0: 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 running......
30c0: 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 ;; process c
30d0: 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 an know to call
30e0: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d items:get-items-
30f0: 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 from-config.....
3100: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 . ;; if ei
3110: 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 20 61 ther is a list a
3120: 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f nd none is a pro
3130: 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20 63 c go ahead and c
3140: 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 all get-items...
3150: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 ... ;; oth
3160: 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 23 66 erwise return #f
3170: 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 - this is not a
3180: 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74 0a n iterated test.
3190: 09 09 09 09 09 20 20 20 20 20 20 20 28 63 6f 6e ..... (con
31a0: 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 d.......((proced
31b0: 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 20 20 ure? items)
31c0: 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a ....... (debug:
31d0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 print-info 4 "it
31e0: 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65 64 75 ems is a procedu
31f0: 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 re, will calc la
3200: 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 ter")....... ite
3210: 6d 73 29 20 20 20 20 20 20 20 20 20 20 20 20 3b ms) ;
3220: 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 ; calc later....
3230: 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 ...((procedure?
3240: 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 itemstable).....
3250: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d .. (debug:print-
3260: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 74 61 62 info 4 "itemstab
3270: 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 le is a procedur
3280: 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 e, will calc lat
3290: 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d er")....... item
32a0: 73 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b stable) ;;
32b0: 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 calc later.....
32c0: 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 ..((filter (lamb
32d0: 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 20 20 da (x)........
32e0: 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72 (let ((val (car
32f0: 20 78 29 29 29 0a 09 09 09 09 09 09 09 20 20 20 x)))........
3300: 20 20 28 69 66 20 28 70 72 6f 63 65 64 75 72 65 (if (procedure
3310: 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29 ? val) val #f)))
3320: 0a 09 09 09 09 09 09 09 20 28 61 70 70 65 6e 64 ........ (append
3330: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d (if (list? item
3340: 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09 s) items '())...
3350: 09 09 09 09 09 09 20 28 69 66 20 28 6c 69 73 74 ...... (if (list
3360: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74 ? itemstable) it
3370: 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a emstable '()))).
3380: 09 09 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f ...... 'have-pro
3390: 63 65 64 75 72 65 29 0a 09 09 09 09 09 09 28 28 cedure).......((
33a0: 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 or (list? items)
33b0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c (list? itemstabl
33c0: 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a e)) ;; calc now.
33d0: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 ...... (debug:pr
33e0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d int-info 4 "item
33f0: 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 s and itemstable
3400: 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 are lists, calc
3410: 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 now\n"........
3420: 20 20 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a " items:
3430: 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 " items " items
3440: 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 table: " itemsta
3450: 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 ble)....... (ite
3460: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
3470: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 m-config config)
3480: 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 ).......(else #f
3490: 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 )))
34a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b ;;
34b0: 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 not iterated...
34c0: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 ... #f
34d0: 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 ;; itemsdat 5...
34e0: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 ... #f
34f0: 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65 64 20 ;; spare - used
3500: 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 for item-path...
3510: 09 09 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 ... )))..
3520: 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 (for-each ..
3530: 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f (lambda (waito
3540: 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 n).. (if (
3550: 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 and waiton (not
3560: 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 (member waiton t
3570: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 est-names)))...
3580: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 (begin...
3590: 28 73 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 (set! required-t
35a0: 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f ests (cons waito
35b0: 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 n required-tests
35c0: 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 ))... (set!
35d0: 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 test-names (cons
35e0: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d waiton test-nam
35f0: 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 es))))) ;; was a
3600: 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 n append, now a
3610: 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f cons.. waito
3620: 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 ns).. (let ((
3630: 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 remtests (delete
3640: 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 -duplicates (app
3650: 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 end waitons tal)
3660: 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ))).. (if (
3670: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 not (null? remte
3680: 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 sts))... (loop
3690: 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 (car remtests)(c
36a0: 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 dr remtests)))))
36b0: 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 )).. (if (not
36c0: 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 (null? required
36d0: 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 -tests))..(debug
36e0: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 :print-info 1 "A
36f0: 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 dding " required
3700: 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 -tests " to the
3710: 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 run queue")).
3720: 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 ;; NOTE: these
3730: 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 are all parent t
3740: 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 ests, items are
3750: 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 not expanded yet
3760: 2e 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
3770: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d nt-info 4 "test-
3780: 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d records=" (hash-
3790: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 table->alist tes
37a0: 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 t-records)).
37b0: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
37c0: 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e queue run-id run
37d0: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
37e0: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
37f0: 73 20 74 65 73 74 2d 70 61 74 74 73 29 0a 20 20 s test-patts).
3800: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 (debug:print-i
3810: 6e 66 6f 20 34 20 22 41 6c 6c 20 64 6f 6e 65 20 nfo 4 "All done
3820: 62 79 20 68 65 72 65 22 29 29 29 0a 0a 28 64 65 by here")))..(de
3830: 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 6c 63 2d fine (runs:calc-
3840: 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f fails prereqs-no
3850: 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 t-met). (filter
3860: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a (lambda (test).
3870: 09 20 20 20 20 28 61 6e 64 20 28 76 65 63 74 6f . (and (vecto
3880: 72 3f 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 r? test) ;; not
3890: 28 73 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a (string? test)).
38a0: 09 09 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 .. (equal? (db:t
38b0: 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 65 est-get-state te
38c0: 73 74 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 st) "COMPLETED")
38d0: 0a 09 09 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 ... (not (member
38e0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
38f0: 61 74 75 73 20 74 65 73 74 29 0a 09 09 09 20 20 atus test)....
3900: 20 20 20 20 27 28 22 50 41 53 53 22 20 22 57 41 '("PASS" "WA
3910: 52 4e 22 20 22 43 48 45 43 4b 22 20 22 57 41 49 RN" "CHECK" "WAI
3920: 56 45 44 22 29 29 29 29 29 0a 09 20 20 70 72 65 VED"))))).. pre
3930: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a reqs-not-met))..
3940: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 (define (runs:ca
3950: 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 lc-not-completed
3960: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
3970: 29 0a 20 20 28 66 69 6c 74 65 72 0a 20 20 20 28 ). (filter. (
3980: 6c 61 6d 62 64 61 20 28 74 29 0a 20 20 20 20 20 lambda (t).
3990: 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 (or (not (vector
39a0: 3f 20 74 29 29 0a 09 20 28 6e 6f 74 20 28 65 71 ? t)).. (not (eq
39b0: 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22 ual? "COMPLETED"
39c0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
39d0: 61 74 65 20 74 29 29 29 29 29 0a 20 20 20 70 72 ate t))))). pr
39e0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a ereqs-not-met)).
39f0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 70 .(define (runs:p
3a00: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6c 73 74 retty-string lst
3a10: 29 0a 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 ). (map (lambda
3a20: 20 28 74 29 0a 09 20 28 69 66 20 28 6e 6f 74 20 (t).. (if (not
3a30: 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 20 (vector? t))..
3a40: 20 20 20 28 63 6f 6e 63 20 74 29 0a 09 20 20 20 (conc t)..
3a50: 20 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 (conc (db:test
3a60: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 -get-testname t)
3a70: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65 ":" (db:test-ge
3a80: 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 t-state t) "/" (
3a90: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 db:test-get-stat
3aa0: 75 73 20 74 29 29 29 29 0a 20 20 20 20 20 20 20 us t)))).
3ab0: 6c 73 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 lst))..(define (
3ac0: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 runs:make-full-t
3ad0: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d est-name testnam
3ae0: 65 20 69 74 65 6d 70 61 74 68 29 0a 20 20 28 69 e itempath). (i
3af0: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 f (equal? itempa
3b00: 74 68 20 22 22 29 20 74 65 73 74 6e 61 6d 65 20 th "") testname
3b10: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 (conc testname "
3b20: 2f 22 20 69 74 65 6d 70 61 74 68 29 29 29 0a 0a /" itempath)))..
3b30: 3b 3b 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 ;; test-records
3b40: 69 73 20 61 20 68 61 73 68 20 74 61 62 6c 65 20 is a hash table
3b50: 74 65 73 74 6e 61 6d 65 3a 69 74 65 6d 5f 70 61 testname:item_pa
3b60: 74 68 20 3d 3e 20 76 65 63 74 6f 72 20 3c 20 74 th => vector < t
3b70: 65 73 74 6e 61 6d 65 20 74 65 73 74 63 6f 6e 66 estname testconf
3b80: 69 67 20 77 61 69 74 6f 6e 73 20 70 72 69 6f 72 ig waitons prior
3b90: 69 74 79 20 69 74 65 6d 73 2d 69 6e 66 6f 20 2e ity items-info .
3ba0: 2e 2e 20 3e 0a 28 64 65 66 69 6e 65 20 28 72 75 .. >.(define (ru
3bb0: 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 ns:run-tests-que
3bc0: 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d ue run-id runnam
3bd0: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6b e test-records k
3be0: 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 20 74 eyvallst flags t
3bf0: 65 73 74 2d 70 61 74 74 73 29 0a 20 20 20 20 3b est-patts). ;
3c00: 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 ; At this point
3c10: 74 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 the list of pare
3c20: 6e 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 nt tests is expa
3c30: 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f nded . ;; NB/
3c40: 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 / Should expand
3c50: 69 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 items here and t
3c60: 68 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 hen insert into
3c70: 74 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 the run queue..
3c80: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 (debug:print 5
3c90: 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 "test-records: "
3ca0: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c test-records ",
3cb0: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 keyvallst: " ke
3cc0: 79 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a yvallst " flags:
3cd0: 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e " (hash-table->
3ce0: 61 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 alist flags)).
3cf0: 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 (let ((sorted-te
3d00: 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a st-names (tests:
3d10: 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 sort-by-priority
3d20: 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 -and-waiton test
3d30: 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 74 65 73 -records))..(tes
3d40: 74 2d 72 65 67 69 73 74 65 72 79 20 20 20 20 28 t-registery (
3d50: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
3d60: 29 0a 09 28 6e 75 6d 2d 72 65 74 72 69 65 73 20 )..(num-retries
3d70: 20 20 20 20 20 20 20 30 29 0a 09 28 6d 61 78 2d 0)..(max-
3d80: 72 65 74 72 69 65 73 20 20 20 20 20 20 20 28 63 retries (c
3d90: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f onfig-lookup *co
3da0: 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 nfigdat* "setup"
3db0: 20 22 6d 61 78 72 65 74 72 69 65 73 22 29 29 29 "maxretries")))
3dc0: 0a 20 20 20 20 28 73 65 74 21 20 6d 61 78 2d 72 . (set! max-r
3dd0: 65 74 72 69 65 73 20 28 69 66 20 28 61 6e 64 20 etries (if (and
3de0: 6d 61 78 2d 72 65 74 72 69 65 73 20 28 73 74 72 max-retries (str
3df0: 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d ing->number max-
3e00: 72 65 74 72 69 65 73 29 29 28 73 74 72 69 6e 67 retries))(string
3e10: 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 ->number max-ret
3e20: 72 69 65 73 29 20 31 30 30 29 29 0a 20 20 20 20 ries) 100)).
3e30: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
3e40: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 sorted-test-name
3e50: 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 s))..(let loop (
3e60: 28 68 65 64 20 20 20 20 20 20 20 20 20 28 63 61 (hed (ca
3e70: 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 r sorted-test-na
3e80: 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 mes))... (tal
3e90: 20 20 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 (cdr sor
3ea0: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 ted-test-names))
3eb0: 0a 09 09 20 20 20 28 72 65 72 75 6e 73 20 20 20 ... (reruns
3ec0: 20 20 20 27 28 29 29 29 0a 09 20 20 28 69 66 20 '())).. (if
3ed0: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 (not (null? reru
3ee0: 6e 73 29 29 28 64 65 62 75 67 3a 70 72 69 6e 74 ns))(debug:print
3ef0: 2d 69 6e 66 6f 20 34 20 22 72 65 72 75 6e 73 3d -info 4 "reruns=
3f00: 22 20 72 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b " reruns)).. ;;
3f10: 20 28 70 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 (print "Top of
3f20: 6c 6f 6f 70 2c 20 68 65 64 3d 22 20 68 65 64 20 loop, hed=" hed
3f30: 22 2c 20 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c ", tal=" tal " ,
3f40: 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 reruns=" reruns)
3f50: 0a 09 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 .. (let* ((test
3f60: 2d 72 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 -record (hash-ta
3f70: 62 6c 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 ble-ref test-rec
3f80: 6f 72 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 ords hed))... (t
3f90: 65 73 74 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 est-name (test
3fa0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
3fb0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 testname test-re
3fc0: 63 6f 72 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 cord))... (tconf
3fd0: 69 67 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 ig (tests:te
3fe0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 stqueue-get-test
3ff0: 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f config test-reco
4000: 72 64 29 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 rd))... (testmod
4010: 65 20 20 20 20 28 6c 65 74 20 28 28 6d 20 28 63 e (let ((m (c
4020: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f onfig-lookup tco
4030: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e nfig "requiremen
4040: 74 73 22 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 ts" "mode")))...
4050: 09 09 28 69 66 20 6d 20 28 73 74 72 69 6e 67 2d ..(if m (string-
4060: 3e 73 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d >symbol m) 'norm
4070: 61 6c 29 29 29 0a 09 09 20 28 77 61 69 74 6f 6e al)))... (waiton
4080: 73 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 s (tests:tes
4090: 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f tqueue-get-waito
40a0: 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 ns test-recor
40b0: 64 29 29 0a 09 09 20 28 70 72 69 6f 72 69 74 79 d))... (priority
40c0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
40d0: 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 ueue-get-priorit
40e0: 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 y test-record)
40f0: 29 0a 09 09 20 28 69 74 65 6d 64 61 74 20 20 20 )... (itemdat
4100: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
4110: 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 ue-get-itemdat
4120: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 test-record))
4130: 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 6e 20 62 ;; itemdat can b
4140: 65 20 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 e a string, list
4150: 20 6f 72 20 23 66 0a 09 09 20 28 69 74 65 6d 73 or #f... (items
4160: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 (tests:te
4170: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d stqueue-get-item
4180: 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f s test-reco
4190: 72 64 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 rd))... (item-pa
41a0: 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d th (item-list-
41b0: 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a >path itemdat)).
41c0: 09 09 20 28 6e 65 77 74 61 6c 20 20 20 20 20 20 .. (newtal
41d0: 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 (append tal (lis
41e0: 74 20 68 65 64 29 29 29 29 0a 09 20 20 20 20 0a t hed)))).. .
41f0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
4200: 74 20 36 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 t 6.... "test-na
4210: 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a me: " test-name.
4220: 09 09 09 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 ... "\n hed:
4230: 20 20 20 20 20 20 22 20 68 65 64 0a 09 09 09 20 " hed....
4240: 22 5c 6e 20 20 69 74 65 6d 64 61 74 3a 20 20 20 "\n itemdat:
4250: 20 20 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 " itemdat....
4260: 22 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 "\n items:
4270: 20 20 22 20 69 74 65 6d 73 0a 09 09 09 20 22 5c " items.... "\
4280: 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 n item-path:
4290: 22 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 " item-path....
42a0: 22 5c 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 "\n waitons:
42b0: 20 20 22 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 " waitons....
42c0: 22 5c 6e 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 "\n num-retries
42d0: 3a 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a : " num-retries.
42e0: 09 09 09 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 ... "\n tal:
42f0: 20 20 20 20 20 20 22 20 74 61 6c 0a 09 09 09 20 " tal....
4300: 22 5c 6e 20 20 72 65 72 75 6e 73 3a 20 20 20 20 "\n reruns:
4310: 20 20 22 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 " reruns)...
4320: 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 ;; check for h
4330: 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e ed in waitons =>
4340: 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 this would be c
4350: 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 ircular, remove
4360: 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a it and issue an.
4370: 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 . ;; error..
4380: 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 74 (if (member t
4390: 65 73 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 est-name waitons
43a0: 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 )...(begin... (
43b0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
43c0: 52 52 4f 52 3a 20 74 65 73 74 20 22 20 74 65 73 RROR: test " tes
43d0: 74 2d 6e 61 6d 65 20 22 20 68 61 73 20 6c 69 73 t-name " has lis
43e0: 74 65 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 ted itself as a
43f0: 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 waiton, please c
4400: 6f 72 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 orrect this!")..
4410: 09 20 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 . (set! waiton
4420: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 (filter (lambda
4430: 28 78 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 (x)(not (equal?
4440: 78 20 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 x hed))) waitons
4450: 29 29 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 ))))... (cond
4460: 20 3b 3b 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 ;; OUTER COND..
4470: 20 20 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 ((not items
4480: 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 ) ;; when false
4490: 74 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 the test is ok t
44a0: 6f 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 o be handed off
44b0: 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e to launch (but n
44c0: 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 ot before)..
44d0: 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 (let* ((run-li
44e0: 6d 69 74 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 mits-info
44f0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
4500: 65 20 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d e runs:can-run-m
4510: 6f 72 65 2d 74 65 73 74 73 20 74 65 73 74 2d 72 ore-tests test-r
4520: 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 ecord)) ;; look
4530: 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67 at the test jobg
4540: 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 roup and tot job
4550: 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20 20 20 s running...
4560: 20 28 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 (have-resources
4570: 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 72 (car r
4580: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 29 un-limits-info))
4590: 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e ... (num-run
45a0: 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 ning
45b0: 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c (list-ref run-l
45c0: 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29 0a 09 imits-info 1))..
45d0: 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 . (num-runni
45e0: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 ng-in-jobgroup (
45f0: 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d list-ref run-lim
4600: 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09 09 20 its-info 2))...
4610: 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 (max-concurr
4620: 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c 69 ent-jobs (li
4630: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 st-ref run-limit
4640: 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20 20 20 s-info 3))...
4650: 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d (job-group-lim
4660: 69 74 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 it (list
4670: 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d -ref run-limits-
4680: 69 6e 66 6f 20 34 29 29 0a 09 09 20 20 20 20 20 info 4))...
4690: 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 (prereqs-not-met
46a0: 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 (open-r
46b0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
46c0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 prereqs-not-met
46d0: 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e #f run-id waiton
46e0: 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 65 s item-path mode
46f0: 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 20 : testmode))...
4700: 20 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 (fails
4710: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 75 (ru
4720: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 ns:calc-fails pr
4730: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a ereqs-not-met)).
4740: 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 .. (non-comp
4750: 6c 65 74 65 64 20 20 20 20 20 20 20 20 20 20 20 leted
4760: 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 (runs:calc-not-c
4770: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 ompleted prereqs
4780: 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 64 -not-met)))...(d
4790: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
47a0: 38 20 22 68 61 76 65 2d 72 65 73 6f 75 72 63 65 8 "have-resource
47b0: 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f 75 72 s: " have-resour
47c0: 63 65 73 20 22 20 70 72 65 72 65 71 73 2d 6e 6f ces " prereqs-no
47d0: 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20 20 20 t-met: " ....
47e0: 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 (string-inters
47f0: 70 65 72 73 65 20 0a 09 09 09 20 20 20 20 20 20 perse ....
4800: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 (map (lambda (t)
4810: 0a 09 09 09 09 20 20 20 20 20 28 69 66 20 28 76 ..... (if (v
4820: 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09 09 20 ector? t)......
4830: 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 (conc (db:test-g
4840: 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 et-state t) "/"
4850: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 (db:test-get-sta
4860: 74 75 73 20 74 29 29 0a 09 09 09 09 09 20 28 63 tus t))...... (c
4870: 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a 20 74 onc " WARNING: t
4880: 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 is not a vector
4890: 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20 20 20 =" t ))).....
48a0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 prereqs-not-met)
48b0: 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73 3a 20 ", ") " fails:
48c0: 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65 62 75 " fails)...(debu
48d0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 g:print-info 4 "
48e0: 68 65 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 hed=" hed "\n t
48f0: 65 73 74 2d 72 65 63 6f 72 64 3d 22 20 74 65 73 est-record=" tes
4900: 74 2d 72 65 63 6f 72 64 20 22 5c 6e 20 20 74 65 t-record "\n te
4910: 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d st-name: " test-
4920: 6e 61 6d 65 20 22 5c 6e 20 20 69 74 65 6d 2d 70 name "\n item-p
4930: 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 ath: " item-path
4940: 20 22 5c 6e 20 20 74 65 73 74 2d 70 61 74 74 73 "\n test-patts
4950: 3a 20 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a : " test-patts).
4960: 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 ...;; Don't know
4970: 20 61 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 at this time if
4980: 20 74 68 65 20 74 65 73 74 20 68 61 76 65 20 62 the test have b
4990: 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 een launched at
49a0: 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 some time in the
49b0: 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 past...;; i.e.
49c0: 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75 is this a re-lau
49d0: 6e 63 68 3f 0a 09 09 28 64 65 62 75 67 3a 70 72 nch?...(debug:pr
49e0: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 72 75 6e 2d int-info 4 "run-
49f0: 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20 limits-info = "
4a00: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 run-limits-info)
4a10: 0a 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 ...(cond ;; INNE
4a20: 52 20 43 4f 4e 44 20 23 31 20 66 6f 72 20 61 20 R COND #1 for a
4a30: 6c 61 75 6e 63 68 61 62 6c 65 20 74 65 73 74 0a launchable test.
4a40: 09 09 20 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d .. ;; Check item
4a50: 20 70 61 74 68 20 61 67 61 69 6e 73 74 20 69 74 path against it
4a60: 65 6d 2d 70 61 74 74 73 0a 09 09 20 28 28 6e 6f em-patts... ((no
4a70: 74 20 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74 t (tests:match t
4a80: 65 73 74 2d 70 61 74 74 73 20 28 74 65 73 74 73 est-patts (tests
4a90: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
4aa0: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 estname test-rec
4ab0: 6f 72 64 29 20 69 74 65 6d 2d 70 61 74 68 29 29 ord) item-path))
4ac0: 20 3b 3b 20 54 68 69 73 20 74 65 73 74 2f 69 74 ;; This test/it
4ad0: 65 6d 70 61 74 68 20 69 73 20 6e 6f 74 20 74 6f empath is not to
4ae0: 20 62 65 20 72 75 6e 0a 09 09 20 20 3b 3b 20 65 be run... ;; e
4af0: 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 73 lse the run is s
4b00: 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 6c tuck, temporaril
4b10: 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c 79 y or permanently
4b20: 0a 09 09 20 20 3b 3b 20 62 75 74 20 73 68 6f 75 ... ;; but shou
4b30: 6c 64 20 63 68 65 63 6b 20 69 66 20 69 74 20 69 ld check if it i
4b40: 73 20 64 75 65 20 74 6f 20 6c 61 63 6b 20 6f 66 s due to lack of
4b50: 20 72 65 73 6f 75 72 63 65 73 20 76 73 2e 20 70 resources vs. p
4b60: 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 rerequisites...
4b70: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
4b80: 66 6f 20 31 20 22 53 6b 69 70 70 69 6e 67 20 22 fo 1 "Skipping "
4b90: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
4ba0: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 e-get-testname t
4bb0: 65 73 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20 est-record) " "
4bc0: 69 74 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69 item-path " as i
4bd0: 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 t doesn't match
4be0: 22 20 74 65 73 74 2d 70 61 74 74 73 29 0a 09 09 " test-patts)...
4bf0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 (thread-sleep!
4c00: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 *global-delta*)
4c10: 0a 09 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e ... (if (not (n
4c20: 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 ull? tal))...
4c30: 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 (loop (car ta
4c40: 6c 29 28 63 64 72 20 74 61 6c 29 20 72 65 72 75 l)(cdr tal) reru
4c50: 6e 73 29 29 29 0a 09 09 20 28 20 3b 3b 20 28 61 ns)))... ( ;; (a
4c60: 6e 64 0a 09 09 20 20 28 6e 6f 74 20 28 68 61 73 nd... (not (has
4c70: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
4c80: 75 6c 74 20 74 65 73 74 2d 72 65 67 69 73 74 65 ult test-registe
4c90: 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 ry (runs:make-fu
4ca0: 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 ll-test-name tes
4cb0: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
4cc0: 29 20 23 66 29 29 0a 09 09 20 20 20 20 20 20 3b ) #f))... ;
4cd0: 3b 20 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 ; (and max-concu
4ce0: 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e 20 28 2d rrent-jobs (> (-
4cf0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
4d00: 6a 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 jobs num-running
4d10: 29 20 35 29 29 29 0a 09 09 20 20 28 64 65 62 75 ) 5)))... (debu
4d20: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 g:print-info 4 "
4d30: 50 72 65 2d 72 65 67 69 73 74 65 72 69 6e 67 20 Pre-registering
4d40: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 test " test-name
4d50: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 "/" item-path "
4d60: 20 74 6f 20 63 72 65 61 74 65 20 70 6c 61 63 65 to create place
4d70: 68 6f 6c 64 65 72 22 20 29 0a 09 09 20 20 28 6f holder" )... (o
4d80: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
4d90: 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d :tests-register-
4da0: 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 74 test #f run-id t
4db0: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
4dc0: 74 68 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61 th)... (hash-ta
4dd0: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 ble-set! test-re
4de0: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 gistery (runs:ma
4df0: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d ke-full-test-nam
4e00: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d e test-name item
4e10: 2d 70 61 74 68 29 20 23 74 29 0a 09 09 20 20 28 -path) #t)... (
4e20: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
4e30: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 28 72 lobal-delta*).(r
4e40: 75 6e 73 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 uns:shrink-can-r
4e50: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 un-more-tests-de
4e60: 6c 61 79 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 lay)... (loop (
4e70: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 car newtal)(cdr
4e80: 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 newtal) reruns))
4e90: 0a 09 09 20 28 28 6e 6f 74 20 68 61 76 65 2d 72 ... ((not have-r
4ea0: 65 73 6f 75 72 63 65 73 29 20 3b 3b 20 73 69 6d esources) ;; sim
4eb0: 70 6c 79 20 74 72 79 20 61 67 61 69 6e 20 61 66 ply try again af
4ec0: 74 65 72 20 77 61 69 74 69 6e 67 20 61 20 73 65 ter waiting a se
4ed0: 63 6f 6e 64 0a 09 09 20 20 28 64 65 62 75 67 3a cond... (debug:
4ee0: 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 6e 6f print-info 1 "no
4ef0: 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72 75 resources to ru
4f00: 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61 69 n new tests, wai
4f10: 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20 28 ting ...")... (
4f20: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b thread-sleep! (+
4f30: 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2 *global-delta
4f40: 2a 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c 64 *))... ;; could
4f50: 20 68 61 76 65 20 64 6f 6e 65 20 68 65 64 20 74 have done hed t
4f60: 61 6c 20 68 65 72 65 20 62 75 74 20 64 6f 69 6e al here but doin
4f70: 67 20 63 61 72 2f 63 64 72 20 6f 66 20 6e 65 77 g car/cdr of new
4f80: 74 61 6c 20 74 6f 20 72 6f 74 61 74 65 20 74 65 tal to rotate te
4f90: 73 74 73 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 sts... (loop (c
4fa0: 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e ar newtal)(cdr n
4fb0: 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a ewtal) reruns)).
4fc0: 09 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 .. ((and have-re
4fd0: 73 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 sources...
4fe0: 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 70 72 65 72 (or (null? prer
4ff0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 eqs-not-met)....
5000: 20 20 20 28 61 6e 64 20 28 65 71 3f 20 74 65 73 (and (eq? tes
5010: 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 tmode 'toplevel)
5020: 0a 09 09 09 09 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d .....(null? non-
5030: 63 6f 6d 70 6c 65 74 65 64 29 29 29 29 0a 09 09 completed))))...
5040: 20 20 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d (run:test run-
5050: 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 id runname keyva
5060: 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 llst test-record
5070: 20 66 6c 61 67 73 20 23 66 29 0a 28 72 75 6e 73 flags #f).(runs
5080: 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d :shrink-can-run-
5090: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 more-tests-delay
50a0: 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c )... (thread-sl
50b0: 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c eep! *global-del
50c0: 74 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e 6f ta*)... (if (no
50d0: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 t (null? tal))..
50e0: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 . (loop (ca
50f0: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 r tal)(cdr tal)
5100: 72 65 72 75 6e 73 29 29 29 0a 09 09 20 28 65 6c reruns)))... (el
5110: 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 65 se ;; must be we
5120: 20 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65 72 have unmet prer
5130: 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 20 20 equisites...
5140: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
5150: 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 0a FAILS: " fails).
5160: 09 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 20 .. ;; If one
5170: 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 70 or more of the p
5180: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 61 rereqs-not-met a
5190: 72 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65 20 re FAIL then we
51a0: 63 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20 20 can issue...
51b0: 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e 64 ;; a message and
51c0: 20 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 74 drop hed from t
51d0: 68 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 he items to be p
51e0: 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20 20 rocessed....
51f0: 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 (if (null? fails
5200: 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 )....(begin....
5210: 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e ;; couldn't run
5220: 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 , take a breathe
5230: 72 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 r.... (debug:pr
5240: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 53 68 6f 75 int-info 4 "Shou
5250: 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20 67 65 74 ldn't really get
5260: 20 68 65 72 65 2c 20 72 61 63 65 20 63 6f 6e 64 here, race cond
5270: 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 74 6f ition? Unable to
5280: 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74 65 73 launch more tes
5290: 74 73 20 61 74 20 74 68 69 73 20 6d 6f 6d 65 6e ts at this momen
52a0: 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d 65 20 t, killing time
52b0: 2e 2e 2e 22 29 0a 09 09 09 20 20 28 74 68 72 65 ...").... (thre
52c0: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 ad-sleep! (+ 0.0
52d0: 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 1 *global-delta*
52e0: 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 )) ;; long sleep
52f0: 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 here - no resou
5300: 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c rces, may as wel
5310: 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 l be patient....
5320: 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 ;; we made new
5330: 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 tal by sticking
5340: 20 68 65 64 20 61 74 20 74 68 65 20 62 61 63 6b hed at the back
5350: 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 of the list....
5360: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 (loop (car new
5370: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 tal)(cdr newtal)
5380: 20 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 reruns))....;;
5390: 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 the waiton is FA
53a0: 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 IL so no point i
53b0: 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 n trying to run
53c0: 68 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 hed ever again..
53d0: 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c ..(if (not (null
53e0: 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 ? tal)).... (
53f0: 69 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 if (vector? hed)
5400: 0a 09 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 .....(begin (deb
5410: 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e ug:print 1 "WARN
5420: 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 : Dropping test
5430: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 " (db:test-get-t
5440: 65 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 estname hed) "/"
5450: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
5460: 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 em-path hed)....
5470: 09 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 ... " from th
5480: 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 e launch list as
5490: 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 it has prerequi
54a0: 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 stes that are FA
54b0: 49 4c 22 29 0a 28 72 75 6e 73 3a 73 68 72 69 6e IL").(runs:shrin
54c0: 6b 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 k-can-run-more-t
54d0: 65 73 74 73 2d 64 65 6c 61 79 29 0a 09 09 09 09 ests-delay).....
54e0: 20 20 20 20 20 20 20 28 74 68 72 65 61 64 2d 73 (thread-s
54f0: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 leep! *global-de
5500: 6c 74 61 2a 29 0a 09 09 09 09 20 20 20 20 20 20 lta*).....
5510: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 (loop (car tal)
5520: 28 63 64 72 20 74 61 6c 29 20 28 63 6f 6e 73 20 (cdr tal) (cons
5530: 68 65 64 20 72 65 72 75 6e 73 29 29 29 0a 09 09 hed reruns)))...
5540: 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 ..(begin..... (
5550: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 debug:print 1 "W
5560: 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 ARN: Test not pr
5570: 6f 63 65 73 73 65 64 20 63 6f 72 72 65 63 74 6c ocessed correctl
5580: 79 2e 20 43 6f 75 6c 64 20 62 65 20 61 20 72 61 y. Could be a ra
5590: 63 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 6e 20 ce condition in
55a0: 79 6f 75 72 20 74 65 73 74 20 69 6d 70 6c 65 6d your test implem
55b0: 65 6e 74 61 74 69 6f 6e 3f 20 22 20 68 65 64 29 entation? " hed)
55c0: 20 3b 3b 20 20 22 20 61 73 20 69 74 20 68 61 73 ;; " as it has
55d0: 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74 68 prerequistes th
55e0: 61 74 20 61 72 65 20 46 41 49 4c 2e 20 28 4e 4f at are FAIL. (NO
55f0: 54 45 3a 20 68 65 64 20 69 73 20 6e 6f 74 20 61 TE: hed is not a
5600: 20 76 65 63 74 6f 72 29 22 29 0a 28 72 75 6e 73 vector)").(runs
5610: 3a 73 68 72 69 6e 6b 2d 63 61 6e 2d 72 75 6e 2d :shrink-can-run-
5620: 6d 6f 72 65 2d 74 65 73 74 73 2d 64 65 6c 61 79 more-tests-delay
5630: 29 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d )..... (thread-
5640: 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 31 20 2a sleep! (+ 0.01 *
5650: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a global-delta*)).
5660: 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 64 20 .... (loop hed
5670: 74 61 6c 20 72 65 72 75 6e 73 29 29 29 29 29 29 tal reruns))))))
5680: 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 4e ))) ;; END OF IN
5690: 4e 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 0a NER COND.. .
56a0: 09 20 20 20 20 20 3b 3b 20 63 61 73 65 20 77 68 . ;; case wh
56b0: 65 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d ere an items cam
56c0: 65 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 e in as a list b
56d0: 65 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 een processed..
56e0: 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f ((and (list?
56f0: 20 69 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 items) ;; t
5700: 68 75 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 hus we know our
5710: 69 74 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 items are alread
5720: 79 20 63 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 y calculated...
5730: 20 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 (not itemdat
5740: 29 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 )) ;; and not ye
5750: 74 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 t expanded into
5760: 74 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e the list of thin
5770: 67 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 gs to be done..
5780: 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 64 (if (and (d
5790: 65 62 75 67 3a 64 65 62 75 67 2d 6d 6f 64 65 20 ebug:debug-mode
57a0: 31 29 20 3b 3b 20 28 3e 3d 20 2a 76 65 72 62 6f 1) ;; (>= *verbo
57b0: 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 sity* 1)...
57c0: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 (> (length ite
57d0: 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 ms) 0)...
57e0: 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 (> (length (car
57f0: 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 items)) 0))...
5800: 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 (pp items))..
5810: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 (for-each..
5820: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 (lambda (my
5830: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 -itemdat)... (le
5840: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 t* ((new-test-re
5850: 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 cord (let ((newr
5860: 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 ec (make-tests:t
5870: 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 estqueue))).....
5880: 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 . (vector-copy
5890: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 ! test-record ne
58a0: 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 wrec)...... ne
58b0: 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 wrec))....(my-it
58c0: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 em-path (item-li
58d0: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d st->path my-item
58e0: 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 dat)))... (if
58f0: 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 (tests:match tes
5900: 74 2d 70 61 74 74 73 20 68 65 64 20 6d 79 2d 69 t-patts hed my-i
5910: 74 65 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 tem-path) ;; (pa
5920: 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 tt-list-match my
5930: 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d -item-path item-
5940: 70 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20 patts)
5950: 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 ;; yes, we want
5960: 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 to process this
5970: 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f item, NOTE: Sho
5980: 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 uld not need thi
5990: 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 s check here!...
59a0: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 (let ((ne
59b0: 77 74 65 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a wtestname (runs:
59c0: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e make-full-test-n
59d0: 61 6d 65 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d ame hed my-item-
59e0: 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 path))) ;; te
59f0: 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 st names are uni
5a00: 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f que on testname/
5a10: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 item-path.... (t
5a20: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 ests:testqueue-s
5a30: 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 et-items! ne
5a40: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 w-test-record #f
5a50: 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 ).... (tests:tes
5a60: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 tqueue-set-itemd
5a70: 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 at! new-test-r
5a80: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 ecord my-itemdat
5a90: 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 ).... (tests:tes
5aa0: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f tqueue-set-item_
5ab0: 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 path! new-test-r
5ac0: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 ecord my-item-pa
5ad0: 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 th).... (hash-ta
5ae0: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 ble-set! test-re
5af0: 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d cords newtestnam
5b00: 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 e new-test-recor
5b10: 64 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c d).... (set! tal
5b20: 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 (cons newtestna
5b30: 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 me tal)))))) ;;
5b40: 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 since these are
5b50: 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 itemized create
5b60: 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 new test names t
5b70: 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 estname/itempath
5b80: 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a .. items).
5b90: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 . (if (not
5ba0: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 (null? tal))...
5bb0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 (begin... (d
5bc0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
5bd0: 34 20 22 45 6e 64 20 6f 66 20 69 74 65 6d 73 20 4 "End of items
5be0: 6c 69 73 74 2c 20 6c 6f 6f 70 69 6e 67 20 77 69 list, looping wi
5bf0: 74 68 20 6e 65 78 74 20 61 66 74 65 72 20 73 68 th next after sh
5c00: 6f 72 74 20 64 65 6c 61 79 22 29 0a 09 09 20 20 ort delay")...
5c10: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 (thread-sleep!
5c20: 20 28 2b 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c (+ 0.01 *global
5c30: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 -delta*))...
5c40: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 (loop (car tal)(
5c50: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 cdr tal) reruns)
5c60: 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b 20 69 66 )))... ;; if
5c70: 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 items is a proc
5c80: 20 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 then need to ru
5c90: 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d n items:get-item
5ca0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 s-from-config, g
5cb0: 65 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 et the list and
5cc0: 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b 3b 20 20 loop .. ;;
5cd0: 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 6f 20 - but only do
5ce0: 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 63 65 that if resource
5cf0: 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 6b 20 s exist to kick
5d00: 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 20 20 off the job..
5d10: 20 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72 ((or (procedur
5d20: 65 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 e? items)(eq? it
5d30: 65 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 ems 'have-proced
5d40: 75 72 65 29 29 0a 09 20 20 20 20 20 20 28 6c 65 ure)).. (le
5d50: 74 20 28 28 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 t ((can-run-more
5d60: 20 20 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 (runs:can-ru
5d70: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 74 65 73 n-more-tests tes
5d80: 74 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 28 69 t-record)))...(i
5d90: 66 20 28 61 6e 64 20 28 6c 69 73 74 3f 20 63 61 f (and (list? ca
5da0: 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a 09 09 09 20 n-run-more)....
5db0: 28 63 61 72 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 (car can-run-mor
5dc0: 65 29 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 e))... (let*
5dd0: 28 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 ((prereqs-not-me
5de0: 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 t (open-run-clos
5df0: 65 20 64 62 3a 67 65 74 2d 70 72 65 72 65 71 73 e db:get-prereqs
5e00: 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 75 6e 2d -not-met #f run-
5e10: 69 64 20 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d id waitons item-
5e20: 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 73 74 6d path mode: testm
5e30: 6f 64 65 29 29 0a 09 09 09 20 20 20 28 66 61 69 ode)).... (fai
5e40: 6c 73 20 20 20 20 20 20 20 20 20 20 20 28 72 75 ls (ru
5e50: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 ns:calc-fails pr
5e60: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a ereqs-not-met)).
5e70: 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c ... (non-compl
5e80: 65 74 65 64 20 20 20 28 72 75 6e 73 3a 63 61 6c eted (runs:cal
5e90: 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 20 c-not-completed
5ea0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 prereqs-not-met)
5eb0: 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 ))... (debu
5ec0: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 38 20 22 g:print-info 8 "
5ed0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 22 20 can-run-more: "
5ee0: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 09 can-run-more....
5ef0: 09 20 20 20 22 5c 6e 20 74 65 73 74 6e 61 6d 65 . "\n testname
5f00: 3a 20 20 20 20 20 20 20 20 22 20 68 65 64 0a 09 : " hed..
5f10: 09 09 09 20 20 20 22 5c 6e 20 70 72 65 72 65 71 ... "\n prereq
5f20: 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 20 28 72 75 s-not-met: " (ru
5f30: 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 ns:pretty-string
5f40: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
5f50: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e 6f 6e )..... "\n non
5f60: 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 20 20 22 20 -completed: "
5f70: 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 (runs:pretty-str
5f80: 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 ing non-complete
5f90: 64 29 20 0a 09 09 09 09 20 20 20 22 5c 6e 20 66 d) ..... "\n f
5fa0: 61 69 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20 ails:
5fb0: 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 " (runs:pretty-s
5fc0: 74 72 69 6e 67 20 66 61 69 6c 73 29 0a 09 09 09 tring fails)....
5fd0: 09 20 20 20 22 5c 6e 20 74 65 73 74 6d 6f 64 65 . "\n testmode
5fe0: 3a 20 20 20 20 20 20 20 20 22 20 74 65 73 74 6d : " testm
5ff0: 6f 64 65 0a 09 09 09 09 20 20 20 22 5c 6e 20 6e ode..... "\n n
6000: 75 6d 2d 72 65 74 72 69 65 73 3a 20 20 20 20 20 um-retries:
6010: 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 " num-retries...
6020: 09 09 20 20 20 22 5c 6e 20 28 65 71 3f 20 74 65 .. "\n (eq? te
6030: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c stmode 'toplevel
6040: 29 3a 20 22 20 28 65 71 3f 20 74 65 73 74 6d 6f ): " (eq? testmo
6050: 64 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 de 'toplevel)...
6060: 09 09 20 20 20 22 5c 6e 20 28 6e 75 6c 6c 3f 20 .. "\n (null?
6070: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 3a 20 non-completed):
6080: 20 20 20 22 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d " (null? non-
6090: 63 6f 6d 70 6c 65 74 65 64 29 0a 09 09 09 09 20 completed).....
60a0: 20 20 22 5c 6e 20 72 65 72 75 6e 73 3a 20 20 20 "\n reruns:
60b0: 20 20 20 20 20 20 20 22 20 72 65 72 75 6e 73 0a " reruns.
60c0: 09 09 09 09 20 20 20 22 5c 6e 20 69 74 65 6d 73 .... "\n items
60d0: 3a 20 20 20 20 20 20 20 20 20 20 20 22 20 69 74 : " it
60e0: 65 6d 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 63 ems..... "\n c
60f0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 3a 20 20 20 20 an-run-more:
6100: 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 29 0a " can-run-more).
6110: 09 09 20 20 20 20 20 20 3b 3b 20 28 74 68 72 65 .. ;; (thre
6120: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 30 2e 30 ad-sleep! (+ 0.0
6130: 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 1 *global-delta*
6140: 29 29 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 ))... (cond
6150: 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 ;; INNER COND #
6160: 32 0a 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 2... ((or
6170: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e (null? prereqs-n
6180: 6f 74 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 ot-met) ;; all p
6190: 72 65 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 rereqs met, fire
61a0: 20 6f 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 off the test...
61b0: 09 20 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 . ;; or, if i
61c0: 74 20 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c t is a 'toplevel
61d0: 20 74 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 test and all pr
61e0: 65 72 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 ereqs not met ar
61f0: 65 20 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e e COMPLETED then
6200: 20 6c 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 launch.... (
6210: 61 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 and (eq? testmod
6220: 65 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 e 'toplevel)....
6230: 09 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d . (null? non-com
6240: 70 6c 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 pleted)))....(le
6250: 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 t ((test-name (t
6260: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
6270: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
6280: 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 -record)))....
6290: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 (setenv "MT_TEST
62a0: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 _NAME" test-name
62b0: 29 20 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 ) ;; .... (sete
62c0: 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 nv "MT_RUNNAME"
62d0: 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 runname)....
62e0: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e (set-megatest-en
62f0: 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 29 20 3b v-vars run-id) ;
6300: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e ; these may be n
6310: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 eeded by the lau
6320: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 nching process..
6330: 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 .. (let ((items
6340: 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 -list (items:get
6350: 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 -items-from-conf
6360: 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 ig tconfig)))...
6370: 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 . (if (list?
6380: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 09 items-list).....
6390: 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74 65 (begin..... (te
63a0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 sts:testqueue-se
63b0: 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 t-items! test-re
63c0: 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 cord items-list)
63d0: 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d 73 ..... (thread-s
63e0: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 leep! *global-de
63f0: 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f 6f lta*)..... (loo
6400: 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e 73 p hed tal reruns
6410: 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 09 )).....(begin...
6420: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
6430: 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 0 "ERROR: The p
6440: 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 roc from reading
6450: 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20 6e the setup did n
6460: 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 ot yield a list
6470: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 - please report
6480: 74 68 69 73 22 29 0a 09 09 09 09 20 20 28 65 78 this")..... (ex
6490: 69 74 20 31 29 29 29 29 29 29 0a 09 09 20 20 20 it 1))))))...
64a0: 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 6c ((null? fail
64b0: 73 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 s)....(debug:pri
64c0: 6e 74 2d 69 6e 66 6f 20 34 20 22 66 61 69 6c 73 nt-info 4 "fails
64d0: 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 is null, moving
64e0: 20 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 75 65 on in the queue
64f0: 20 62 75 74 20 6b 65 65 70 69 6e 67 20 22 20 68 but keeping " h
6500: 65 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 ed " for now")..
6510: 09 09 3b 3b 20 6f 6e 6c 79 20 69 6e 63 72 65 6d ..;; only increm
6520: 65 6e 74 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 ent num-retries
6530: 77 68 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e when there are n
6540: 6f 20 74 65 73 74 73 20 72 75 6e 69 6e 67 0a 09 o tests runing..
6550: 09 09 28 69 66 20 28 65 71 3f 20 30 20 28 6c 69 ..(if (eq? 0 (li
6560: 73 74 2d 72 65 66 20 63 61 6e 2d 72 75 6e 2d 6d st-ref can-run-m
6570: 6f 72 65 20 31 29 29 0a 09 09 09 20 20 20 20 28 ore 1)).... (
6580: 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 begin.... (
6590: 69 66 20 28 3e 20 6e 75 6d 2d 72 65 74 72 69 65 if (> num-retrie
65a0: 73 20 31 30 30 29 20 3b 3b 20 66 69 72 73 74 20 s 100) ;; first
65b0: 31 30 30 20 72 65 74 72 69 65 73 20 61 72 65 20 100 retries are
65c0: 6c 6f 77 20 74 69 6d 65 20 63 6f 73 74 0a 09 09 low time cost...
65d0: 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 .. (thread-slee
65e0: 70 21 20 28 2b 20 32 20 2a 67 6c 6f 62 61 6c 2d p! (+ 2 *global-
65f0: 64 65 6c 74 61 2a 29 29 0a 09 09 09 09 20 20 28 delta*))..... (
6600: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b thread-sleep! (+
6610: 20 30 2e 30 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 0.01 *global-de
6620: 6c 74 61 2a 29 29 29 0a 09 09 09 20 20 20 20 20 lta*)))....
6630: 20 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 69 (set! num-retri
6640: 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 65 es (+ num-retrie
6650: 73 20 31 29 29 29 29 0a 09 09 09 28 69 66 20 28 s 1))))....(if (
6660: 3e 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 6d > num-retries m
6670: 61 78 2d 72 65 74 72 69 65 73 29 0a 09 09 09 20 ax-retries)....
6680: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c (if (not (nul
6690: 6c 3f 20 74 61 6c 29 29 0a 09 09 09 09 28 6c 6f l? tal)).....(lo
66a0: 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 op (car tal)(cdr
66b0: 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 0a 09 tal) reruns))..
66c0: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 .. (loop (car
66d0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 newtal)(cdr new
66e0: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 20 3b tal) reruns))) ;
66f0: 3b 20 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 ; an issue with
6700: 70 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 prereqs not yet
6710: 6d 65 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 met?... ((
6720: 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 and (not (null?
6730: 66 61 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 fails))(eq? test
6740: 6d 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 mode 'normal))..
6750: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 ..(debug:print-i
6760: 6e 66 6f 20 31 20 22 74 65 73 74 20 22 20 20 68 nfo 1 "test " h
6770: 65 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 ed " (mode=" tes
6780: 74 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 tmode ") has fai
6790: 6c 65 64 20 70 72 65 72 65 71 75 69 73 69 74 65 led prerequisite
67a0: 28 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 (s); ".....
67b0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
67c0: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 rse (map (lambda
67d0: 20 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 (t)(conc (db:te
67e0: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
67f0: 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d t) ":" (db:test-
6800: 67 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 get-state t)"/"(
6810: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 db:test-get-stat
6820: 75 73 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 us t))) fails) "
6830: 2c 20 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c , ")..... ",
6840: 20 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f removing it fro
6850: 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 m to-do list")..
6860: 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c ..(if (not (null
6870: 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 ? tal)).... (
6880: 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 begin.... (
6890: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
68a0: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
68b0: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 . (loop (ca
68c0: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28 r tal)(cdr tal)(
68d0: 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 cons hed reruns)
68e0: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 ))))... (e
68f0: 6c 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 lse....(debug:pr
6900: 69 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f int 8 "ERROR: No
6910: 20 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 handler for thi
6920: 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 s condition.")..
6930: 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 ..(thread-sleep!
6940: 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 (+ 1 *global-de
6950: 6c 74 61 2a 29 29 0a 09 09 09 28 6c 6f 6f 70 20 lta*))....(loop
6960: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 (car newtal)(cdr
6970: 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e 73 29 newtal) reruns)
6980: 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 20 49 46 ))) ;; END OF IF
6990: 20 43 41 4e 20 52 55 4e 20 4d 4f 52 45 0a 0a 09 CAN RUN MORE...
69a0: 09 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 . ;; if can't
69b0: 20 72 75 6e 20 6d 6f 72 65 20 6a 75 73 74 20 6c run more just l
69c0: 6f 6f 70 20 77 69 74 68 20 6e 65 78 74 20 70 6f oop with next po
69d0: 73 73 69 62 6c 65 20 74 65 73 74 0a 09 09 20 20 ssible test...
69e0: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 (begin...
69f0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
6a00: 66 6f 20 34 20 22 70 72 6f 63 65 73 73 69 6e 67 fo 4 "processing
6a10: 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20 61 the case with a
6a20: 20 6c 61 6d 62 64 61 20 66 6f 72 20 69 74 65 6d lambda for item
6a30: 73 20 6f 72 20 27 68 61 76 65 2d 70 72 6f 63 65 s or 'have-proce
6a40: 64 75 72 65 2e 20 4d 6f 76 69 6e 67 20 74 68 72 dure. Moving thr
6a50: 6f 75 67 68 20 74 68 65 20 71 75 65 75 65 20 77 ough the queue w
6a60: 69 74 68 6f 75 74 20 64 72 6f 70 70 69 6e 67 20 ithout dropping
6a70: 22 20 68 65 64 29 0a 09 09 20 20 20 20 20 20 28 " hed)... (
6a80: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b thread-sleep! (+
6a90: 20 32 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2 *global-delta
6aa0: 2a 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f *))... (loo
6ab0: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 p (car newtal)(c
6ac0: 64 72 20 6e 65 77 74 61 6c 29 20 72 65 72 75 6e dr newtal) rerun
6ad0: 73 29 29 29 29 29 20 3b 3b 20 45 4e 44 20 4f 46 s))))) ;; END OF
6ae0: 20 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f (or (procedure?
6af0: 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d items)(eq? item
6b00: 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 s 'have-procedur
6b10: 65 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20 20 e)).. ..
6b20: 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73 68 ;; this case sh
6b30: 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e 2c ould not happen,
6b40: 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20 63 added to help c
6b50: 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09 20 atch any bugs..
6b60: 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f ((and (list?
6b70: 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 items) itemdat)
6b80: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
6b90: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 rint 0 "ERROR: S
6ba0: 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 hould not have a
6bb0: 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 list of items i
6bc0: 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 n a test and the
6bd0: 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d itemspath set -
6be0: 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 please report t
6bf0: 68 69 73 22 29 0a 09 20 20 20 20 20 20 28 65 78 his").. (ex
6c00: 69 74 20 31 29 29 0a 09 20 20 20 20 20 28 28 6e it 1)).. ((n
6c10: 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 ot (null? reruns
6c20: 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a 20 )).. (let*
6c30: 28 28 6e 65 77 6c 73 74 20 28 74 65 73 74 73 3a ((newlst (tests:
6c40: 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 75 6e 6e 61 filter-non-runna
6c50: 62 6c 65 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 ble run-id tal t
6c60: 65 73 74 2d 72 65 63 6f 72 64 73 29 29 20 3b 3b est-records)) ;;
6c70: 20 69 2e 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 i.e. not FAIL,
6c80: 57 41 49 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 WAIVED, INCOMPLE
6c90: 54 45 2c 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 TE, PASS, KILLED
6ca0: 2c 0a 09 09 20 20 20 20 20 28 6a 75 6e 6b 65 64 ,... (junked
6cb0: 20 28 6c 73 65 74 2d 64 69 66 66 65 72 65 6e 63 (lset-differenc
6cc0: 65 20 65 71 75 61 6c 3f 20 74 61 6c 20 6e 65 77 e equal? tal new
6cd0: 6c 73 74 29 29 29 0a 09 09 28 64 65 62 75 67 3a lst)))...(debug:
6ce0: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 66 75 print-info 4 "fu
6cf0: 6c 6c 20 64 72 6f 70 20 74 68 72 6f 75 67 68 2c ll drop through,
6d00: 20 69 66 20 72 65 72 75 6e 73 20 69 73 20 6c 65 if reruns is le
6d10: 73 73 20 74 68 61 6e 20 31 30 30 20 77 65 20 77 ss than 100 we w
6d20: 69 6c 6c 20 66 6f 72 63 65 20 72 65 74 72 79 20 ill force retry
6d30: 74 68 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72 them, reruns=" r
6d40: 65 72 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74 eruns ", tal=" t
6d50: 61 6c 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d al)...(if (< num
6d60: 2d 72 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74 -retries max-ret
6d70: 72 69 65 73 29 0a 09 09 20 20 20 20 28 73 65 74 ries)... (set
6d80: 21 20 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64 ! newlst (append
6d90: 20 72 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 reruns newlst))
6da0: 29 0a 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 )...(set! num-re
6db0: 74 72 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 tries (+ num-ret
6dc0: 72 69 65 73 20 31 29 29 0a 09 09 28 74 68 72 65 ries 1))...(thre
6dd0: 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a ad-sleep! (+ 1 *
6de0: 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a global-delta*)).
6df0: 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c ..(if (not (null
6e00: 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 ? newlst))...
6e10: 20 3b 3b 20 73 69 6e 63 65 20 72 65 72 75 6e 73 ;; since reruns
6e20: 20 68 61 76 65 20 62 65 65 6e 20 74 61 63 6b 65 have been tacke
6e30: 64 20 6f 6e 20 74 6f 20 6e 65 77 6c 73 74 20 63 d on to newlst c
6e40: 72 65 61 74 65 20 6e 65 77 20 72 65 72 75 6e 73 reate new reruns
6e50: 20 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a 09 09 20 from junked...
6e60: 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 (loop (car ne
6e70: 77 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 wlst)(cdr newlst
6e80: 29 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 )(delete-duplica
6e90: 74 65 73 20 6a 75 6e 6b 65 64 29 29 29 29 29 0a tes junked))))).
6ea0: 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c . ((not (nul
6eb0: 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20 20 20 20 l? tal))..
6ec0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
6ed0: 6f 20 34 20 22 49 27 6d 20 70 72 65 74 74 79 20 o 4 "I'm pretty
6ee0: 73 75 72 65 20 49 20 73 68 6f 75 6c 64 6e 27 74 sure I shouldn't
6ef0: 20 67 65 74 20 68 65 72 65 2e 22 29 29 0a 09 20 get here."))..
6f00: 20 20 20 20 28 65 6c 73 65 0a 09 20 20 20 20 20 (else..
6f10: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
6f20: 66 6f 20 34 20 22 45 78 69 74 69 6e 67 20 6c 6f fo 4 "Exiting lo
6f30: 6f 70 20 77 69 74 68 2e 2e 2e 5c 6e 20 20 68 65 op with...\n he
6f40: 64 3d 22 20 68 65 64 20 22 5c 6e 20 20 74 61 6c d=" hed "\n tal
6f50: 3d 22 20 74 61 6c 20 22 5c 6e 20 20 72 65 72 75 =" tal "\n reru
6f60: 6e 73 3d 22 20 72 65 72 75 6e 73 29 29 0a 09 20 ns=" reruns))..
6f70: 20 20 20 20 29 29 29 29 20 3b 3b 20 4c 45 54 2a )))) ;; LET*
6f80: 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 0a 0a ((test-record..
6f90: 20 20 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 ;; we get he
6fa0: 72 65 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f re on "drop thro
6fb0: 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 ugh" - loop for
6fc0: 6e 65 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 next test in que
6fd0: 75 65 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 ue. ;; FIXME!
6fe0: 21 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44 20 !!! THIS SHOULD
6ff0: 4e 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20 45 NOT REQUIRE AN E
7000: 58 49 54 21 21 21 21 21 21 21 0a 20 20 20 20 0a XIT!!!!!!!. .
7010: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
7020: 2d 69 6e 66 6f 20 31 20 22 41 6c 6c 20 74 65 73 -info 1 "All tes
7030: 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a 20 20 ts launched").
7040: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 (thread-sleep!
7050: 20 30 2e 35 29 0a 20 20 20 20 3b 3b 20 46 49 58 0.5). ;; FIX
7060: 4d 45 21 20 54 68 69 73 20 68 61 72 73 68 20 65 ME! This harsh e
7070: 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 xit should not b
7080: 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e 2e 0a e necessary.....
7090: 20 20 20 20 3b 3b 20 28 69 66 20 28 6e 6f 74 20 ;; (if (not
70a0: 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 *runremote*)(exi
70b0: 74 29 29 20 3b 3b 20 0a 20 20 20 20 23 66 29 29 t)) ;; . #f))
70c0: 20 3b 3b 20 72 65 74 75 72 6e 20 61 20 23 66 20 ;; return a #f
70d0: 61 73 20 61 20 68 69 6e 74 20 74 68 61 74 20 77 as a hint that w
70e0: 65 20 61 72 65 20 64 6f 6e 65 0a 20 20 3b 3b 20 e are done. ;;
70f0: 48 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 Here we need to
7100: 63 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 check that all t
7110: 68 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 he tests remaini
7120: 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 ng to be run are
7130: 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e eligible to run
7140: 0a 20 20 3b 3b 20 61 6e 64 20 61 72 65 20 6e 6f . ;; and are no
7150: 74 20 62 6c 6f 63 6b 65 64 20 62 79 20 66 61 69 t blocked by fai
7160: 6c 65 64 0a 20 20 0a 0a 3b 3b 20 70 61 72 65 6e led. ..;; paren
7170: 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20 t-test is there
7180: 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 as a placeholder
7190: 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 for when parent
71a0: 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 -tests can be ru
71b0: 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65 n as a setup ste
71c0: 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 p.(define (run:t
71d0: 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 est run-id runna
71e0: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 me keyvallst tes
71f0: 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70 t-record flags p
7200: 61 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b arent-test). ;;
7210: 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20 All these vars
7220: 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e might be referen
7230: 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63 ced by the testc
7240: 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65 onfig file reade
7250: 72 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 r. (let* ((test
7260: 2d 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a -name (tests:
7270: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
7280: 73 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65 stname test-re
7290: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77 cord)).. (test-w
72a0: 61 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 aitons (tests:te
72b0: 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 stqueue-get-wait
72c0: 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f ons test-reco
72d0: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e rd)).. (test-con
72e0: 66 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 f (tests:test
72f0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f queue-get-testco
7300: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 nfig test-record
7310: 29 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20 )).. (itemdat
7320: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
7330: 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 eue-get-itemdat
7340: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
7350: 0a 09 20 28 74 65 73 74 2d 70 61 74 68 20 20 20 .. (test-path
7360: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
7370: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d "/tests/" test-
7380: 6e 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 name)) ;; could
7390: 75 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65 use tests:get-te
73a0: 73 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e stconfig here ..
73b0: 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20 20 ... (force
73c0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
73d0: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 f/default flags
73e0: 22 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20 "-force" #f))..
73f0: 28 72 65 72 75 6e 20 20 20 20 20 20 20 20 28 68 (rerun (h
7400: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
7410: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65 fault flags "-re
7420: 72 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65 run" #f)).. (kee
7430: 70 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d pgoing (hash-
7440: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
7450: 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f t flags "-keepgo
7460: 69 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74 65 ing" #f)).. (ite
7470: 6d 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a 09 m-path "")..
7480: 20 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23 (db #
7490: 66 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 f)). (debug:p
74a0: 72 69 6e 74 20 34 0a 09 09 20 22 74 65 73 74 2d rint 4... "test-
74b0: 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d config: " (hash-
74c0: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 table->alist tes
74d0: 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 t-conf)... "\n
74e0: 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d itemdat: " item
74f0: 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 dat... ). ;;
7500: 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 setting itemdat
7510: 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 to a list if it
7520: 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e is #f. (if (n
7530: 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 ot itemdat)(set!
7540: 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 itemdat '())).
7550: 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 (set! item-pa
7560: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 th (item-list->p
7570: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 ath itemdat)).
7580: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
7590: 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 "Attempting to
75a0: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 launch test " te
75b0: 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 st-name (if (equ
75c0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 2f al? item-path "/
75d0: 22 29 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 ") "/" item-path
75e0: 29 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 )). (setenv "
75f0: 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 MT_TEST_NAME" te
7600: 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20 st-name) ;; .
7610: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e (setenv "MT_RUN
7620: 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 NAME" runname)
7630: 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 . (set-megate
7640: 73 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d st-env-vars run-
7650: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 id) ;; these may
7660: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 be needed by th
7670: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 e launching proc
7680: 65 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d ess. (change-
7690: 64 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 directory *toppa
76a0: 74 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 th*).. ;; Her
76b0: 65 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 e is where the t
76c0: 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 est_meta table i
76d0: 73 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 s best updated.
76e0: 20 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 ;; Yes, anoth
76f0: 65 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 er use of a glob
7700: 61 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 al for caching.
7710: 4e 65 65 64 20 61 20 62 65 74 74 65 72 20 77 61 Need a better wa
7720: 79 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 y?. (if (not
7730: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
7740: 64 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 default *test-me
7750: 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 ta-updated* test
7760: 2d 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 -name #f)).
7770: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 (begin.. (h
7780: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a ash-table-set! *
7790: 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 test-meta-update
77a0: 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 d* test-name #t)
77b0: 0a 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 65 . (ope
77c0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 n-run-close runs
77d0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
77e0: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
77f0: 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 est-conf))).
7800: 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 . ;; (lambda
7810: 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 (itemdat) ;;; ((
7820: 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 ripeness "overri
7830: 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 pe") (temperatur
7840: 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f e "cool") (seaso
7850: 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 n "summer")).
7860: 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 (let* ((new-tes
7870: 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 t-path (string-i
7880: 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 ntersperse (cons
7890: 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 test-path (map
78a0: 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 cadr itemdat)) "
78b0: 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 /")).. (new-te
78c0: 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 st-name (if (equ
78d0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 al? item-path ""
78e0: 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e ) test-name (con
78f0: 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 c test-name "/"
7900: 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 item-path))) ;;
7910: 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 just need it to
7920: 62 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 be unique.. (t
7930: 65 73 74 2d 69 64 20 20 20 20 20 20 20 28 63 64 est-id (cd
7940: 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a b:remote-run db:
7950: 67 65 74 2d 74 65 73 74 2d 69 64 20 23 66 20 20 get-test-id #f
7960: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
7970: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 item-path))..
7980: 20 28 74 65 73 74 64 61 74 20 20 20 20 20 20 20 (testdat
7990: 28 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e (cdb:get-test-in
79a0: 66 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d fo-by-id *runrem
79b0: 6f 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29 0a ote* test-id))).
79c0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 (if (not t
79d0: 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 estdat).. (begi
79e0: 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 n.. ;; ensure
79f0: 20 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 that the path e
7a00: 78 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 xists before reg
7a10: 69 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 istering the tes
7a20: 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 t.. ;; NOPE:
7a30: 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e Cannot! Don't kn
7a40: 6f 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 ow yet which dis
7a50: 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 k area will be a
7a60: 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 ssigned......
7a70: 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e ;; (system (con
7a80: 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 c "mkdir -p " ne
7a90: 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 w-test-path))..
7aa0: 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f ;;.. ;; (o
7ab0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 pen-run-close te
7ac0: 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74 65 73 sts:register-tes
7ad0: 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 t db run-id test
7ae0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
7af0: 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b .. ;;.. ;;
7b00: 20 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 NB// for the ab
7b10: 6f 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 ove line. I want
7b20: 20 74 68 65 20 74 65 73 74 20 74 6f 20 62 65 20 the test to be
7b30: 72 65 67 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 registered long
7b40: 62 65 66 6f 72 65 20 74 68 69 73 20 72 6f 75 74 before this rout
7b50: 69 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 64 21 ine gets called!
7b60: 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 .. ;;.. (s
7b70: 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 et! test-id (ope
7b80: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 n-run-close db:g
7b90: 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 et-test-id db ru
7ba0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
7bb0: 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 tem-path))..
7bc0: 28 69 66 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 (if (not test-id
7bd0: 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 )...(begin... (
7be0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 57 debug:print 2 "W
7bf0: 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 ARN: Test not pr
7c00: 65 2d 63 72 65 61 74 65 64 3f 20 74 65 73 74 2d e-created? test-
7c10: 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 name=" test-name
7c20: 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 ", item-path="
7c30: 69 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e item-path ", run
7c40: 2d 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 -id=" run-id)...
7c50: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
7c60: 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 e db:tests-regis
7c70: 74 65 72 2d 74 65 73 74 20 23 66 20 72 75 6e 2d ter-test #f run-
7c80: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
7c90: 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73 65 74 m-path)... (set
7ca0: 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d ! test-id (open-
7cb0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 run-close db:get
7cc0: 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d -test-id db run-
7cd0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
7ce0: 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20 20 20 m-path))))..
7cf0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
7d00: 6f 20 34 20 22 74 65 73 74 2d 69 64 3d 22 20 74 o 4 "test-id=" t
7d10: 65 73 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64 est-id ", run-id
7d20: 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 =" run-id ", tes
7d30: 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 t-name=" test-na
7d40: 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d me ", item-path=
7d50: 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c \"" item-path "\
7d60: 22 22 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 "").. (set! t
7d70: 65 73 74 64 61 74 20 28 63 64 62 3a 67 65 74 2d estdat (cdb:get-
7d80: 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 test-info-by-id
7d90: 2a 72 75 6e 72 65 6d 6f 74 65 2a 20 74 65 73 74 *runremote* test
7da0: 2d 69 64 29 29 29 29 0a 20 20 20 20 20 20 28 73 -id)))). (s
7db0: 65 74 21 20 74 65 73 74 2d 69 64 20 28 64 62 3a et! test-id (db:
7dc0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
7dd0: 64 61 74 29 29 0a 20 20 20 20 20 20 28 63 68 61 dat)). (cha
7de0: 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 nge-directory te
7df0: 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 20 28 st-path). (
7e00: 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b case (if force ;
7e10: 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 ; (args:get-arg
7e20: 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 "-force")...'NOT
7e30: 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 20 74 _STARTED...(if t
7e40: 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 73 74 estdat... (st
7e50: 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 ring->symbol (te
7e60: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
7e70: 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 66 61 tdat))... 'fa
7e80: 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 iled-to-insert))
7e90: 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e ..((failed-to-in
7ea0: 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 3a 70 sert).. (debug:p
7eb0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 rint 0 "ERROR: F
7ec0: 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 ailed to insert
7ed0: 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 the record into
7ee0: 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 the db"))..((NOT
7ef0: 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 _STARTED COMPLET
7f00: 45 44 20 44 45 4c 45 54 45 44 29 0a 09 20 28 6c ED DELETED).. (l
7f10: 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 et ((runflag #f)
7f20: 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 ).. (cond..
7f30: 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 ;; -force, run
7f40: 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 no matter what..
7f50: 20 20 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 (force (set!
7f60: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 runflag #t))..
7f70: 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 ;; NOT_STARTE
7f80: 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 D, run no matter
7f90: 20 77 68 61 74 0a 09 20 20 20 20 28 28 6d 65 6d what.. ((mem
7fa0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
7fb0: 61 74 65 20 74 65 73 74 64 61 74 29 20 27 28 22 ate testdat) '("
7fc0: 44 45 4c 45 54 45 44 22 20 22 4e 4f 54 5f 53 54 DELETED" "NOT_ST
7fd0: 41 52 54 45 44 22 29 29 28 73 65 74 21 20 72 75 ARTED"))(set! ru
7fe0: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 nflag #t))..
7ff0: 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e ;; not -rerun an
8000: 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 d PASS, WARN or
8010: 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e CHECK, do no run
8020: 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 .. ((and (or
8030: 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 (not rerun)...
8040: 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 keepgoing)..
8050: 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f . ;; Require to
8060: 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f force re-run fo
8070: 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a r COMPLETED or *
8080: 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 anything* + PASS
8090: 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 ,WARN or CHECK..
80a0: 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 . (or (member (
80b0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
80c0: 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53 testdat) '("PASS
80d0: 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 " "WARN" "CHECK"
80e0: 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 ))... (memb
80f0: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
8100: 74 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 te testdat) '("
8110: 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a COMPLETED")))) .
8120: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
8130: 6e 74 2d 69 6e 66 6f 20 32 20 22 72 75 6e 6e 69 nt-info 2 "runni
8140: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e ng test " test-n
8150: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
8160: 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61 h " suppressed a
8170: 73 20 69 74 20 69 73 20 22 20 28 74 65 73 74 3a s it is " (test:
8180: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
8190: 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 t) " and " (test
81a0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
81b0: 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 dat)).. (set
81c0: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 ! runflag #f))..
81d0: 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e ;; -rerun an
81e0: 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 d status is one
81f0: 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c of the specifed,
8200: 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 run it.. ((a
8210: 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 nd rerun... (le
8220: 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 t* ((rerunlst
8230: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 (string-split re
8240: 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d run ",")).... (m
8250: 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 ust-rerun (membe
8260: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
8270: 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75 us testdat) reru
8280: 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 nlst)))... (d
8290: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
82a0: 33 20 22 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 3 "-rerun list:
82b0: 22 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d " rerun ", test-
82c0: 73 74 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a status: " (test:
82d0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
82e0: 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e at)", must-rerun
82f0: 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a : " must-rerun).
8300: 09 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e .. must-rerun
8310: 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a )).. (debug:
8320: 70 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 52 65 print-info 2 "Re
8330: 72 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 run forced for t
8340: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
8350: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 "/" item-path)..
8360: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c (set! runfl
8370: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
8380: 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e -keepgoing, do n
8390: 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 ot rerun FAIL..
83a0: 20 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 ((and keepgoi
83b0: 6e 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 ng... (member (
83c0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
83d0: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c testdat) '("FAIL
83e0: 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 "))).. (set!
83f0: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 runflag #f))..
8400: 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 ((and (not re
8410: 72 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 run)... (member
8420: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
8430: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 s testdat) '("FA
8440: 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 IL" "n/a")))..
8450: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
8460: 20 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 #t)).. (else
8470: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
8480: 66 29 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a f))).. (debug:
8490: 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 print 6 "RUNNING
84a0: 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 => runflag: " r
84b0: 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 unflag " STATE:
84c0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
84d0: 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 e testdat) " STA
84e0: 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 TUS: " (test:get
84f0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
8500: 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 ).. (if (not r
8510: 75 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 unflag)..
8520: 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d (if (not parent-
8530: 74 65 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 test)... (debu
8540: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a g:print 1 "NOTE:
8550: 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 Not starting te
8560: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 st " new-test-na
8570: 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 me " as it is st
8580: 61 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 ate \"" (test:ge
8590: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
85a0: 20 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 ....."\" and st
85b0: 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 atus \"" (test:g
85c0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
85d0: 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 t) "\", use -rer
85e0: 75 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 un \"" (test:get
85f0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
8600: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
8610: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8620: 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 "\" or -force t
8630: 6f 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 o override"))..
8640: 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e ;; NOTE: N
8650: 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 o longer be chec
8660: 6b 69 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 king prerequisit
8670: 65 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 es here! Will ne
8680: 76 65 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c ver get here unl
8690: 65 73 73 20 70 72 65 72 65 71 73 20 61 72 65 0a ess prereqs are.
86a0: 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 . ;;
86b0: 20 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 already met...
86c0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 (if (not (
86d0: 6c 61 75 6e 63 68 2d 74 65 73 74 20 23 66 20 72 launch-test #f r
86e0: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 un-id runname te
86f0: 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 st-conf keyvalls
8700: 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 t test-name test
8710: 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c -path itemdat fl
8720: 61 67 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 ags))... (begi
8730: 6e 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 n... (print
8740: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 "ERROR: Failed t
8750: 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 o launch the tes
8760: 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f t. Exiting as so
8770: 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 on as possible")
8780: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 ... (set! *g
8790: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a lobalexitstatus*
87a0: 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 1) ;; ... (
87b0: 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 process-signal (
87c0: 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d current-process-
87d0: 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 id) signal/kill)
87e0: 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 )))))..((KILLED)
87f0: 20 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
8800: 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 1 "NOTE: " new-
8810: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 test-name " is a
8820: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f lready running o
8830: 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 r was explictly
8840: 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 killed, use -for
8850: 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e ce to launch it.
8860: 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 "))..((LAUNCHED
8870: 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 REMOTEHOSTSTART
8880: 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 RUNNING) .. (if
8890: 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d (> (- (current-
88a0: 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 seconds)(+ (db:t
88b0: 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 est-get-event_ti
88c0: 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 me testdat).....
88d0: 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d (db:test-
88e0: 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e get-run_duration
88f0: 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 testdat)))...60
8900: 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 0) ;; i.e. no up
8910: 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 date for more th
8920: 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 an 600 seconds..
8930: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 (begin..
8940: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
8950: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 0 "WARNING: Tes
8960: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 t " test-name "
8970: 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 appears to be de
8980: 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 ad. Forcing it t
8990: 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 o state INCOMPLE
89a0: 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 TE and status ST
89b0: 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 UCK/DEAD")..
89c0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 2d 73 (tests:test-s
89d0: 65 74 2d 73 74 61 74 75 73 21 20 74 65 73 74 2d et-status! test-
89e0: 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 id "INCOMPLETE"
89f0: 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54 65 "STUCK/DEAD" "Te
8a00: 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 st is stuck or d
8a10: 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 20 20 ead" #f))..
8a20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
8a30: 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d NOTE: " test-nam
8a40: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 e " is already r
8a50: 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 unning")))..(els
8a60: 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 e (debug:p
8a70: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 rint 0 "ERROR: F
8a80: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 ailed to launch
8a90: 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d test " new-test-
8aa0: 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e name ". Unrecogn
8ab0: 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 ised state " (te
8ac0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
8ad0: 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d tdat)))))))..;;=
8ae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8b20: 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 =====.;; END OF
8b30: 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d NEW STUFF.;;====
8b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8b80: 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 ==..(define (get
8b90: 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 -dir-up-n dir .
8ba0: 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 params) . (let
8bb0: 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e ((dparts (strin
8bc0: 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 g-split dir "/")
8bd0: 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 )..(count (if
8be0: 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 (null? params) 1
8bf0: 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 (car params))))
8c00: 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 . (conc "/" (
8c10: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
8c20: 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b se .. (tak
8c30: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e e dparts (- (len
8c40: 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e gth dparts) coun
8c50: 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 t)).. "/")
8c60: 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 ))).;; Remove ru
8c70: 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 ns.;; fields are
8c80: 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f passing in thro
8c90: 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a ugh .;; action:.
8ca0: 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 ;; 'remove-ru
8cb0: 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 ns.;; 'set-st
8cc0: 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b ate-status.;;.;;
8cd0: 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 NB// should pas
8ce0: 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 s in keys?.;;.(d
8cf0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 efine (runs:oper
8d00: 61 74 65 2d 6f 6e 20 61 63 74 69 6f 6e 20 72 75 ate-on action ru
8d10: 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 nnamepatt testpa
8d20: 74 74 20 23 21 6b 65 79 20 28 73 74 61 74 65 20 tt #!key (state
8d30: 23 66 29 28 73 74 61 74 75 73 20 23 66 29 28 6e #f)(status #f)(n
8d40: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 ew-state-status
8d50: 23 66 29 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 #f)). (common:c
8d60: 6c 65 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 lear-caches) ;;
8d70: 63 6c 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 clear all caches
8d80: 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 . (let* ((db
8d90: 20 20 20 20 20 20 20 20 23 66 29 0a 09 20 28 6b #f).. (k
8da0: 65 79 73 20 20 20 20 20 20 20 20 20 28 6f 70 65 eys (ope
8db0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 n-run-close db:g
8dc0: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 et-keys db)).. (
8dd0: 72 75 6e 64 61 74 20 20 20 20 20 20 20 28 6f 70 rundat (op
8de0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e en-run-close run
8df0: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 s:get-runs-by-pa
8e00: 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 tt db keys runna
8e10: 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 mepatt)).. (head
8e20: 65 72 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 er (vector
8e30: 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a -ref rundat 0)).
8e40: 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 . (runs
8e50: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
8e60: 61 74 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 at 1)).. (states
8e70: 20 20 20 20 20 20 20 28 69 66 20 73 74 61 74 65 (if state
8e80: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 (string-split
8e90: 73 74 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 state ",") '())
8ea0: 29 0a 09 20 28 73 74 61 74 75 73 65 73 20 20 20 ).. (statuses
8eb0: 20 20 28 69 66 20 73 74 61 74 75 73 20 28 73 74 (if status (st
8ec0: 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 ring-split statu
8ed0: 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 s ",") '())).. (
8ee0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 state-status (if
8ef0: 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 (string? new-st
8f00: 61 74 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 ate-status) (str
8f10: 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 ing-split new-st
8f20: 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 ate-status ",")
8f30: 27 28 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 '(#f #f)))).
8f40: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
8f50: 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 o 4 "runs:operat
8f60: 65 2d 6f 6e 20 3d 3e 20 48 65 61 64 65 72 3a 20 e-on => Header:
8f70: 22 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f " header " actio
8f80: 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 n: " action " ne
8f90: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 w-state-status:
8fa0: 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 " new-state-stat
8fb0: 75 73 29 0a 20 20 20 20 28 69 66 20 28 3e 20 32 us). (if (> 2
8fc0: 20 28 6c 65 6e 67 74 68 20 73 74 61 74 65 2d 73 (length state-s
8fd0: 74 61 74 75 73 29 29 0a 09 28 62 65 67 69 6e 0a tatus))..(begin.
8fe0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
8ff0: 30 20 22 45 52 52 4f 52 3a 20 74 68 65 20 70 61 0 "ERROR: the pa
9000: 72 61 6d 65 74 65 72 20 74 6f 20 2d 73 65 74 2d rameter to -set-
9010: 73 74 61 74 65 2d 73 74 61 74 75 73 20 69 73 20 state-status is
9020: 61 20 63 6f 6d 6d 61 20 64 65 6c 69 6d 69 74 65 a comma delimite
9030: 64 20 73 74 72 69 6e 67 2e 20 45 2e 67 2e 20 43 d string. E.g. C
9040: 4f 4d 50 4c 45 54 45 44 2c 46 41 49 4c 22 29 0a OMPLETED,FAIL").
9050: 09 20 20 28 65 78 69 74 29 29 29 0a 20 20 20 20 . (exit))).
9060: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 (for-each. (
9070: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 lambda (run).
9080: 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 (let ((runke
9090: 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 y (string-inters
90a0: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 perse (map (lamb
90b0: 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 da (k).......(db
90c0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
90d0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
90e0: 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 (vector-ref k 0)
90f0: 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 )) keys) "/"))..
9100: 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 (dirs-to-re
9110: 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d move (make-hash-
9120: 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a table))).. (let*
9130: 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 ((run-id (db
9140: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
9150: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
9160: 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 "id"))...(run-st
9170: 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 ate (db:get-valu
9180: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
9190: 68 65 61 64 65 72 20 22 73 74 61 74 65 22 29 29 header "state"))
91a0: 0a 09 09 28 74 65 73 74 73 20 20 20 20 20 28 69 ...(tests (i
91b0: 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 f (not (equal? r
91c0: 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 un-state "locked
91d0: 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6f ")).... (o
91e0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
91f0: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
9200: 75 6e 20 64 62 20 72 75 6e 2d 69 64 0a 09 09 09 un db run-id....
9210: 09 09 09 20 20 20 20 20 20 74 65 73 74 70 61 74 ... testpat
9220: 74 20 73 74 61 74 65 73 20 73 74 61 74 75 73 65 t states statuse
9230: 73 0a 09 09 09 09 09 09 20 20 20 20 20 20 6e 6f s....... no
9240: 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 t-in: #f.......
9250: 20 20 20 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 sort-by: (
9260: 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 case action.....
9270: 09 09 09 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 .... ((remove-ru
9280: 6e 73 29 20 27 72 75 6e 64 69 72 29 0a 09 09 09 ns) 'rundir)....
9290: 09 09 09 09 09 20 28 65 6c 73 65 20 20 20 20 20 ..... (else
92a0: 20 20 20 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 'event_time
92b0: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 27 28 ))).... '(
92c0: 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 )))...(lasttpath
92d0: 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 "/does/not/exis
92e0: 74 2f 49 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 t/I/hope"))..
92f0: 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 (debug:print-inf
9300: 6f 20 34 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 o 4 "runs:operat
9310: 65 2d 6f 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 e-on run=" run "
9320: 2c 20 68 65 61 64 65 72 3d 22 20 68 65 61 64 65 , header=" heade
9330: 72 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 r).. (if (not
9340: 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 (null? tests))..
9350: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 (begin...
9360: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 (case action...
9370: 20 20 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 ((remove-runs
9380: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
9390: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 rint 1 "Removing
93a0: 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 tests for run:
93b0: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
93c0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
93d0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
93e0: 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 "runname")))...
93f0: 20 20 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 ((set-state-st
9400: 61 74 75 73 29 0a 09 09 20 20 20 20 28 64 65 62 atus)... (deb
9410: 75 67 3a 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 ug:print 1 "Modi
9420: 66 79 69 6e 67 20 73 74 61 74 65 20 61 6e 64 20 fying state and
9430: 73 74 61 75 73 20 66 6f 72 20 74 65 73 74 73 20 staus for tests
9440: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 for run: " runke
9450: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 y " " (db:get-va
9460: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
9470: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d n header "runnam
9480: 65 22 29 29 29 0a 09 09 20 20 20 28 28 70 72 69 e")))... ((pri
9490: 6e 74 2d 72 75 6e 29 0a 09 09 20 20 20 20 28 64 nt-run)... (d
94a0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 50 72 ebug:print 1 "Pr
94b0: 69 6e 74 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 inting info for
94c0: 72 75 6e 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 run " runkey ",
94d0: 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 run=" run ", tes
94e0: 74 73 3d 22 20 74 65 73 74 73 20 22 2c 20 68 65 ts=" tests ", he
94f0: 61 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a 09 ader=" header)..
9500: 09 20 20 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 . action)...
9510: 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 64 (else... (d
9520: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
9530: 30 20 22 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 0 "action not re
9540: 63 6f 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f cognised " actio
9550: 6e 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 n)))... (for-eac
9560: 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 h... (lambda (t
9570: 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a est)... (let*
9580: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 ((item-path (db
9590: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
95a0: 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 ath test))....
95b0: 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a (test-name (db:
95c0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
95d0: 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 e test)).... (
95e0: 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 run-dir (db:te
95f0: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 st-get-rundir te
9600: 73 74 29 29 20 20 20 20 3b 3b 20 72 75 6e 20 64 st)) ;; run d
9610: 69 72 20 69 73 20 66 72 6f 6d 20 74 68 65 20 6c ir is from the l
9620: 69 6e 6b 20 74 72 65 65 0a 09 09 09 20 20 20 28 ink tree.... (
9630: 72 65 61 6c 2d 64 69 72 20 20 28 69 66 20 28 66 real-dir (if (f
9640: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d ile-exists? run-
9650: 64 69 72 29 0a 09 09 09 09 09 20 20 28 72 65 73 dir)...... (res
9660: 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 olve-pathname ru
9670: 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 23 66 n-dir)...... #f
9680: 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d 69 )).... (test-i
9690: 64 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 d (db:test-get
96a0: 2d 69 64 20 74 65 73 74 29 29 29 0a 09 09 20 20 -id test)))...
96b0: 20 20 20 20 3b 3b 20 20 20 28 74 64 62 20 20 20 ;; (tdb
96c0: 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73 (db:open-tes
96d0: 74 2d 64 62 20 72 75 6e 2d 64 69 72 29 29 29 0a t-db run-dir))).
96e0: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
96f0: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 rint-info 4 "tes
9700: 74 3d 22 20 74 65 73 74 29 20 3b 3b 20 20 20 22 t=" test) ;; "
9710: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
9720: 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 stname test) " i
9730: 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 d: " (db:test-ge
9740: 74 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 69 t-id test) " " i
9750: 74 65 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f tem-path " actio
9760: 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 n: " action)...
9770: 20 20 20 20 20 28 63 61 73 65 20 61 63 74 69 6f (case actio
9780: 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 n....((remove-ru
9790: 6e 73 29 20 3b 3b 20 74 68 65 20 74 64 62 20 69 ns) ;; the tdb i
97a0: 73 20 66 6f 72 20 66 75 74 75 72 65 20 70 6f 73 s for future pos
97b0: 73 69 62 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65 sible. .... (ope
97c0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 n-run-close db:d
97d0: 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 elete-test-recor
97e0: 64 73 20 64 62 20 23 66 20 28 64 62 3a 74 65 73 ds db #f (db:tes
97f0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a t-get-id test)).
9800: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
9810: 2d 69 6e 66 6f 20 31 20 22 41 74 74 65 6d 70 74 -info 1 "Attempt
9820: 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 ing to remove "
9830: 28 69 66 20 72 65 61 6c 2d 64 69 72 20 28 63 6f (if real-dir (co
9840: 6e 63 20 22 20 64 69 72 20 22 20 72 65 61 6c 2d nc " dir " real-
9850: 64 69 72 20 22 20 61 6e 64 20 22 29 20 22 22 29 dir " and ") "")
9860: 20 22 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 " link " run-di
9870: 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 r).... (if (and
9880: 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 20 real-dir .....
9890: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 (> (string-lengt
98a0: 68 20 72 65 61 6c 2d 64 69 72 29 20 35 29 0a 09 h real-dir) 5)..
98b0: 09 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 ... (file-exist
98c0: 73 3f 20 72 65 61 6c 2d 64 69 72 29 29 20 3b 3b s? real-dir)) ;;
98d0: 20 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 bad heuristic b
98e0: 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e ut should preven
98f0: 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 t /tmp /home etc
9900: 2e 0a 09 09 09 20 20 20 20 20 28 62 65 67 69 6e ..... (begin
9910: 20 3b 3b 20 6c 65 74 2a 20 28 28 72 65 61 6c 70 ;; let* ((realp
9920: 61 74 68 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 ath (resolve-pat
9930: 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 hname run-dir)))
9940: 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 .... (debu
9950: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 g:print-info 1 "
9960: 52 65 63 75 72 73 69 76 65 6c 79 20 72 65 6d 6f Recursively remo
9970: 76 69 6e 67 20 22 20 72 65 61 6c 2d 64 69 72 29 ving " real-dir)
9980: 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 .... (if (
9990: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 file-exists? rea
99a0: 6c 2d 64 69 72 29 0a 09 09 09 09 20 20 20 28 69 l-dir)..... (i
99b0: 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f f (> (system (co
99c0: 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 nc "rm -rf " rea
99d0: 6c 2d 64 69 72 29 29 20 30 29 0a 09 09 09 09 20 l-dir)) 0).....
99e0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
99f0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 nt 0 "ERROR: The
9a00: 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d re was a problem
9a10: 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c removing " real
9a20: 2d 64 69 72 20 22 20 77 69 74 68 20 72 6d 20 2d -dir " with rm -
9a30: 66 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 f"))..... (deb
9a40: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
9a50: 49 4e 47 3a 20 74 65 73 74 20 64 69 72 20 22 20 ING: test dir "
9a60: 72 65 61 6c 2d 64 69 72 20 22 20 61 70 70 65 61 real-dir " appea
9a70: 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 73 74 20 rs to not exist
9a80: 6f 72 20 69 73 20 6e 6f 74 20 72 65 61 64 61 62 or is not readab
9a90: 6c 65 22 29 29 29 0a 09 09 09 20 20 20 20 20 28 le"))).... (
9aa0: 69 66 20 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 if real-dir ....
9ab0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 . (debug:print 0
9ac0: 20 22 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 "WARNING: direc
9ad0: 74 6f 72 79 20 22 20 72 65 61 6c 2d 64 69 72 20 tory " real-dir
9ae0: 22 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 " does not exist
9af0: 22 29 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 ")..... (debug:p
9b00: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
9b10: 20 6e 6f 20 72 65 61 6c 20 64 69 72 65 63 74 6f no real directo
9b20: 72 79 20 63 6f 72 72 6f 73 70 6f 6e 64 69 6e 67 ry corrosponding
9b30: 20 74 6f 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 to link " run-d
9b40: 69 72 20 22 2c 20 6e 6f 74 68 69 6e 67 20 64 6f ir ", nothing do
9b50: 6e 65 22 29 29 29 0a 09 09 09 20 28 69 66 20 28 ne"))).... (if (
9b60: 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 symbolic-link? r
9b70: 75 6e 2d 64 69 72 29 0a 09 09 09 20 20 20 20 20 un-dir)....
9b80: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 (begin....
9b90: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
9ba0: 66 6f 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 73 fo 1 "Removing s
9bb0: 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 ymlink " run-dir
9bc0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 6c ).... (del
9bd0: 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64 69 72 ete-file run-dir
9be0: 29 29 0a 09 09 09 20 20 20 20 20 28 69 66 20 28 )).... (if (
9bf0: 64 69 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 directory? run-d
9c00: 69 72 29 0a 09 09 09 09 20 28 69 66 20 28 3e 20 ir)..... (if (>
9c10: 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 (directory-fold
9c20: 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20 (lambda (f x)(+
9c30: 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29 1 x)) 0 run-dir)
9c40: 20 30 29 0a 09 09 09 09 20 20 20 20 20 28 64 65 0)..... (de
9c50: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
9c60: 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 20 74 NING: refusing t
9c70: 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 o remove " run-d
9c80: 69 72 20 22 20 61 73 20 69 74 20 69 73 20 6e 6f ir " as it is no
9c90: 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09 20 20 t empty").....
9ca0: 20 20 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 (delete-direc
9cb0: 74 6f 72 79 20 72 75 6e 2d 64 69 72 29 29 20 3b tory run-dir)) ;
9cc0: 3b 20 69 74 20 73 68 6f 75 6c 64 20 62 65 20 65 ; it should be e
9cd0: 6d 70 74 79 20 62 79 20 68 65 72 65 20 42 55 47 mpty by here BUG
9ce0: 20 42 55 47 2c 20 61 64 64 20 65 72 72 6f 72 20 BUG, add error
9cf0: 63 61 74 63 68 0a 09 09 09 09 20 28 69 66 20 72 catch..... (if r
9d00: 75 6e 2d 64 69 72 0a 09 09 09 09 20 20 20 20 20 un-dir.....
9d10: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
9d20: 57 41 52 4e 49 4e 47 3a 20 6e 6f 74 20 72 65 6d WARNING: not rem
9d30: 6f 76 69 6e 67 20 22 20 72 75 6e 2d 64 69 72 20 oving " run-dir
9d40: 22 20 61 73 20 69 74 20 65 69 74 68 65 72 20 64 " as it either d
9d50: 6f 65 73 6e 27 74 20 65 78 69 73 74 20 6f 72 20 oesn't exist or
9d60: 69 73 20 6e 6f 74 20 61 20 73 79 6d 6c 69 6e 6b is not a symlink
9d70: 22 29 0a 09 09 09 09 20 20 20 20 20 28 64 65 62 ")..... (deb
9d80: 75 67 3a 70 72 69 6e 74 20 30 20 22 4e 4f 54 45 ug:print 0 "NOTE
9d90: 3a 20 74 68 65 20 72 75 6e 20 64 69 72 20 66 6f : the run dir fo
9da0: 72 20 74 68 69 73 20 74 65 73 74 20 69 73 20 75 r this test is u
9db0: 6e 64 65 66 69 6e 65 64 2e 20 54 65 73 74 20 6d ndefined. Test m
9dc0: 61 79 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 ay have already
9dd0: 62 65 65 6e 20 64 65 6c 65 74 65 64 2e 22 29 29 been deleted."))
9de0: 0a 09 09 09 09 20 29 29 29 0a 09 09 09 28 28 73 ..... )))....((s
9df0: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 et-state-status)
9e00: 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e .... (debug:prin
9e10: 74 2d 69 6e 66 6f 20 32 20 22 6e 65 77 20 73 74 t-info 2 "new st
9e20: 61 74 65 20 22 20 28 63 61 72 20 73 74 61 74 65 ate " (car state
9e30: 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 77 20 -status) ", new
9e40: 73 74 61 74 75 73 20 22 20 28 63 61 64 72 20 73 status " (cadr s
9e50: 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a 09 09 tate-status))...
9e60: 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 . (open-run-clos
9e70: 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d 73 74 e db:test-set-st
9e80: 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d 69 64 ate-status-by-id
9e90: 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 db (db:test-get
9ea0: 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 20 73 -id test) (car s
9eb0: 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 61 64 tate-status)(cad
9ec0: 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 20 r state-status)
9ed0: 23 66 29 29 29 29 29 0a 09 09 20 20 28 73 6f 72 #f)))))... (sor
9ee0: 74 20 74 65 73 74 73 20 28 6c 61 6d 62 64 61 20 t tests (lambda
9ef0: 28 61 20 62 29 28 6c 65 74 20 28 28 64 69 72 61 (a b)(let ((dira
9f00: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 (db:test-get-ru
9f10: 6e 64 69 72 20 61 29 29 0a 09 09 09 09 09 09 20 ndir a)).......
9f20: 28 64 69 72 62 20 28 64 62 3a 74 65 73 74 2d 67 (dirb (db:test-g
9f30: 65 74 2d 72 75 6e 64 69 72 20 62 29 29 29 0a 09 et-rundir b)))..
9f40: 09 09 09 09 20 20 20 20 20 28 69 66 20 28 61 6e .... (if (an
9f50: 64 20 28 73 74 72 69 6e 67 3f 20 64 69 72 61 29 d (string? dira)
9f60: 28 73 74 72 69 6e 67 3f 20 64 69 72 62 29 29 0a (string? dirb)).
9f70: 09 09 09 09 09 09 20 28 3e 20 28 73 74 72 69 6e ...... (> (strin
9f80: 67 2d 6c 65 6e 67 74 68 20 64 69 72 61 29 28 73 g-length dira)(s
9f90: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 64 69 72 tring-length dir
9fa0: 62 29 29 0a 09 09 09 09 09 09 20 23 66 29 29 29 b))....... #f)))
9fb0: 29 29 29 29 0a 09 20 20 20 3b 3b 20 72 65 6d 6f )))).. ;; remo
9fc0: 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 ve the run if ze
9fd0: 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a ro tests remain.
9fe0: 09 20 20 20 28 69 66 20 28 65 71 3f 20 61 63 74 . (if (eq? act
9ff0: 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 ion 'remove-runs
a000: 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 ).. (let (
a010: 28 72 65 6d 74 65 73 74 73 20 28 6f 70 65 6e 2d (remtests (open-
a020: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 run-close db:get
a030: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 -tests-for-run d
a040: 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d b (db:get-value-
a050: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
a060: 61 64 65 72 20 22 69 64 22 29 20 23 66 20 27 28 ader "id") #f '(
a070: 22 44 45 4c 45 54 45 44 22 29 20 27 28 22 6e 2f "DELETED") '("n/
a080: 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23 74 29 29 a") not-in: #t))
a090: 29 0a 09 09 20 28 69 66 20 28 6e 75 6c 6c 3f 20 )... (if (null?
a0a0: 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 remtests) ;; no
a0b0: 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 more tests remai
a0c0: 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 6c 65 74 ning... (let
a0d0: 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 * ((dparts (str
a0e0: 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 ing-split lasttp
a0f0: 61 74 68 20 22 2f 22 29 29 0a 09 09 09 20 20 20 ath "/"))....
a100: 20 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 (runpath (conc
a110: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 "/" (string-inte
a120: 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 09 28 rsperse .......(
a130: 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 take dparts (- (
a140: 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 length dparts) 1
a150: 29 29 0a 09 09 09 09 09 09 22 2f 22 29 29 29 29 ))......."/"))))
a160: 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 ... (debug
a170: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 :print 1 "Removi
a180: 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 ng run: " runkey
a190: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c " " (db:get-val
a1a0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
a1b0: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 header "runname
a1c0: 22 29 20 22 20 61 6e 64 20 72 65 6c 61 74 65 64 ") " and related
a1d0: 20 72 65 63 6f 72 64 22 29 0a 09 09 20 20 20 20 record")...
a1e0: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
a1f0: 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e se db:delete-run
a200: 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 db run-id)...
a210: 20 20 20 20 20 3b 3b 20 54 68 69 73 20 69 73 20 ;; This is
a220: 61 20 70 72 65 74 74 79 20 67 6f 6f 64 20 70 6c a pretty good pl
a230: 61 63 65 20 74 6f 20 70 75 72 67 65 20 6f 6c 64 ace to purge old
a240: 20 44 45 4c 45 54 45 44 20 74 65 73 74 73 0a 09 DELETED tests..
a250: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 . (open-ru
a260: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 n-close db:delet
a270: 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 e-tests-for-run
a280: 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 db run-id)...
a290: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
a2a0: 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d 6f 6c ose db:delete-ol
a2b0: 64 2d 64 65 6c 65 74 65 64 2d 74 65 73 74 2d 72 d-deleted-test-r
a2c0: 65 63 6f 72 64 73 20 64 62 29 0a 09 09 20 20 20 ecords db)...
a2d0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
a2e0: 6f 73 65 20 64 62 3a 73 65 74 2d 76 61 72 20 64 ose db:set-var d
a2f0: 62 20 22 44 45 4c 45 54 45 44 5f 54 45 53 54 53 b "DELETED_TESTS
a300: 22 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e " (current-secon
a310: 64 73 29 29 0a 09 09 20 20 20 20 20 20 20 3b 3b ds))... ;;
a320: 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65 20 need to figure
a330: 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f 20 out the path to
a340: 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64 20 the run dir and
a350: 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d 70 remove it if emp
a360: 74 79 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 ty... ;;
a370: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c (if (null? (gl
a380: 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 ob (conc runpath
a390: 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 20 20 "/*")))...
a3a0: 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67 ;; (beg
a3b0: 69 6e 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 09 in... ;; .
a3c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
a3d0: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 "Removing run di
a3e0: 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 r " runpath)...
a3f0: 20 20 20 20 20 20 3b 3b 20 09 20 28 73 79 73 74 ;; . (syst
a400: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 em (conc "rmdir
a410: 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29 29 -p " runpath))))
a420: 0a 09 09 20 20 20 20 20 20 20 29 29 29 29 29 0a ... ))))).
a430: 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29 . )). runs))
a440: 0a 20 20 23 74 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d . #t)..;;======
a450: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a460: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a470: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a490: 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 .;; Routines for
a4a0: 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 manipulating ru
a4b0: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ns.;;===========
a4c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a4d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a4e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a4f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 ===========..;;
a500: 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 Since many calls
a510: 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 to a run requir
a520: 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 e pretty much th
a530: 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b e same setup .;;
a540: 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73 this wrapper is
a550: 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 used to reduce
a560: 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 the replication
a570: 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 of code.(define
a580: 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c (general-run-cal
a590: 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 l switchname act
a5a0: 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 ion-desc proc).
a5b0: 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 (let ((runname
a5c0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a (args:get-arg ":
a5d0: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 runname"))..(tar
a5e0: 67 65 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 get (if (args:g
a5f0: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 et-arg "-target"
a600: 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 )... (args:g
a610: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 et-arg "-target"
a620: 29 0a 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 )... (args:g
a630: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 et-arg "-reqtarg
a640: 22 29 29 29 0a 09 28 74 68 31 20 20 20 20 20 23 ")))..(th1 #
a650: 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 f)). (cond.
a660: 20 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 ((not target)
a670: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
a680: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 int 0 "ERROR: Mi
a690: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 ssing required p
a6a0: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 arameter for " s
a6b0: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 witchname ", you
a6c0: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 must specify th
a6d0: 65 20 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 e target with -t
a6e0: 61 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 arget"). (e
a6f0: 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e xit 3)). ((n
a700: 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 ot runname).
a710: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
a720: 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 "ERROR: Missing
a730: 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 required parame
a740: 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 ter for " switch
a750: 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 name ", you must
a760: 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e specify the run
a770: 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e name with :runn
a780: 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 ame runname").
a790: 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 (exit 3)).
a7a0: 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 (else. (
a7b0: 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 let ((db #f)..
a7c0: 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 (keys #f))..
a7d0: 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d (if (not (setup-
a7e0: 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 for-run)).. (
a7f0: 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 begin .. (d
a800: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 ebug:print 0 "Fa
a810: 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 iled to setup, e
a820: 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 xiting")..
a830: 28 65 78 69 74 20 31 29 29 29 0a 09 28 69 66 20 (exit 1)))..(if
a840: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
a850: 73 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 6f server").. (o
a860: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 pen-run-close se
a870: 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 rver:start db (a
a880: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 rgs:get-arg "-se
a890: 72 76 65 72 22 29 29 0a 20 09 20 20 20 20 28 69 rver")). . (i
a8a0: 66 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 f (not (or (args
a8b0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c :get-arg "-runal
a8c0: 6c 22 29 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c l") ;; runal
a8d0: 6c 20 61 6e 64 20 72 75 6e 74 65 73 74 73 20 61 l and runtests a
a8e0: 72 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 re allowed to be
a8f0: 20 73 65 72 76 65 72 73 0a 20 09 09 09 20 28 61 servers. ... (a
a900: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 rgs:get-arg "-ru
a910: 6e 74 65 73 74 73 22 29 29 29 0a 09 09 28 73 65 ntests")))...(se
a920: 72 76 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 rver:client-setu
a930: 70 29 20 3b 3b 20 54 68 69 73 20 69 73 20 61 20 p) ;; This is a
a940: 64 75 70 6c 69 63 61 74 65 20 73 74 61 72 74 75 duplicate startu
a950: 70 21 21 21 3f 3f 3f 20 42 55 47 3f 0a 09 09 29 p!!!??? BUG?...)
a960: 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 6f )..(set! keys (o
a970: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
a980: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 :get-keys db))..
a990: 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 ;; have enough t
a9a0: 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 o process -targe
a9b0: 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 t or -reqtarg he
a9c0: 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 re..(if (args:ge
a9d0: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
a9e0: 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 ).. (let* ((r
a9f0: 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 unconfigf (conc
aa00: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e *toppath* "/run
aa10: 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 configs.config")
aa20: 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c ) ;; DO NOT EVAL
aa30: 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 UATE ALL ... (
aa40: 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 runconfig (read
aa50: 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 -config runconfi
aa60: 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e gf #f #f environ
aa70: 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 -patt: #f))) ..
aa80: 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 (if (hash-t
aa90: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
aaa0: 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 runconfig (args
aab0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
aac0: 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 rg") #f)... (ke
aad0: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 ys:target-set-ar
aae0: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 gs keys (args:ge
aaf0: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
ab00: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 ) args:arg-hash)
ab10: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 ... (begin...
ab20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
ab30: 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 "ERROR: [" (arg
ab40: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
ab50: 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 arg") "] not fou
ab60: 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 nd in " runconfi
ab70: 67 66 29 0a 09 09 20 20 20 20 28 69 66 20 64 62 gf)... (if db
ab80: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 (sqlite3:finali
ab90: 7a 65 21 20 64 62 29 29 0a 09 09 20 20 20 20 28 ze! db))... (
aba0: 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 exit 1))))..
abb0: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (if (args:get-ar
abc0: 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 g "-target")...(
abd0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d keys:target-set-
abe0: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a args keys (args:
abf0: 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 get-arg "-target
ac00: 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 " args:arg-hash)
ac10: 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 args:arg-hash))
ac20: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 )..(if (not (car
ac30: 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a *configinfo*)).
ac40: 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 . (begin..
ac50: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
ac60: 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 0 "ERROR: Attemp
ac70: 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d ted to " action-
ac80: 64 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 desc " but run a
ac90: 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 rea config file
aca0: 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 not found")..
acb0: 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 (exit 1))..
acc0: 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 ;; Extract out
acd0: 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e stuff needed in
ace0: 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 most or many ca
acf0: 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 lls.. ;; here
ad00: 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a then call proc.
ad10: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 . (let* ((key
ad20: 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 names (map key
ad30: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b :get-fieldname k
ad40: 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 eys))... (keyv
ad50: 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 allst (keys->va
ad60: 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 llist keys #t)))
ad70: 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 74 61 .. (proc ta
ad80: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 rget runname key
ad90: 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 s keynames keyva
ada0: 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 31 llst)))..(if th1
adb0: 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 (thread-join! t
adc0: 68 31 29 29 0a 09 28 69 66 20 64 62 20 28 73 71 h1))..(if db (sq
add0: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 lite3:finalize!
ade0: 64 62 29 29 0a 09 28 73 65 74 21 20 2a 64 69 64 db))..(set! *did
adf0: 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 something* #t)))
ae00: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
ae10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ae20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ae30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ae40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
ae50: 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e Lock/unlock run
ae60: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d s.;;============
ae70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ae80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ae90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
aea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 ==========..(def
aeb0: 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 ine (runs:handle
aec0: 2d 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 20 -locking target
aed0: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f 63 keys runname loc
aee0: 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 20 k unlock user).
aef0: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 (let* ((db
af00: 20 20 23 66 29 0a 09 20 28 72 75 6e 64 61 74 20 #f).. (rundat
af10: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
af20: 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d e runs:get-runs-
af30: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 by-patt db keys
af40: 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 61 runname)).. (hea
af50: 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72 65 der (vector-re
af60: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 f rundat 0)).. (
af70: 72 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f 72 runs (vector
af80: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 -ref rundat 1)))
af90: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 . (for-each (
afa0: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 28 lambda (run)...(
afb0: 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64 62 let ((run-id (db
afc0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
afd0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
afe0: 22 69 64 22 29 29 29 0a 09 09 20 20 28 69 66 20 "id")))... (if
aff0: 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 61 (or lock.... (a
b000: 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 20 nd unlock....
b010: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 20 (begin.....
b020: 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 72 (print "Do you r
b030: 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 6e eally wish to un
b040: 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d 69 lock run " run-i
b050: 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 29 d "?\n y/n: ")
b060: 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22 79 ..... (equal? "y
b070: 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 29 " (read-line))))
b080: 29 0a 09 09 20 20 20 20 20 20 28 6f 70 65 6e 2d )... (open-
b090: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f 63 run-close db:loc
b0a0: 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 20 k/unlock-run db
b0b0: 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c 6f run-id lock unlo
b0c0: 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20 20 ck user)...
b0d0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
b0e0: 66 6f 20 30 20 22 53 6b 69 70 70 69 6e 67 20 6c fo 0 "Skipping l
b0f0: 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 22 20 ock/unlock on "
b100: 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 20 20 20 run-id))))..
b110: 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d 3d 3d runs))).;;====
b120: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b130: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b140: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b150: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b160: 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e ==.;; Rollup run
b170: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d s.;;============
b180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b1a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
b1b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 ==========..;; U
b1c0: 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d pdate the test_m
b1d0: 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 eta table for th
b1e0: 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 is test.(define
b1f0: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 (runs:update-tes
b200: 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e t_meta db test-n
b210: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 ame test-conf).
b220: 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f (let ((currreco
b230: 72 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f rd (open-run-clo
b240: 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 se db:testmeta-g
b250: 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 et-record db tes
b260: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 t-name))). (i
b270: 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 f (not currrecor
b280: 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 d)..(begin.. (s
b290: 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 et! currrecord (
b2a0: 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 make-vector 10 #
b2b0: 66 29 29 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e f)).. (open-run
b2c0: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 -close db:testme
b2d0: 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 ta-add-record db
b2e0: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 test-name))).
b2f0: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
b300: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a (lambda (key).
b310: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 (let* ((i
b320: 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 dx (cadr key))..
b330: 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 (fld (car
b340: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 key)).. (v
b350: 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 al (config-looku
b360: 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 p test-conf "tes
b370: 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 t_meta" fld)))..
b380: 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ;; (debug:print
b390: 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 5 "idx: " idx "
b3a0: 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 fld: " fld " va
b3b0: 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 l: " val).. (if
b3c0: 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 (and val (not (e
b3d0: 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 qual? (vector-re
b3e0: 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 f currrecord idx
b3f0: 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 ) val))).. (
b400: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 begin.. (p
b410: 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 rint "Updating "
b420: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 test-name " " f
b430: 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 ld " to " val)..
b440: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e (open-run
b450: 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 -close db:testme
b460: 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 ta-update-field
b470: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 db test-name fld
b480: 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 val))))). '
b490: 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f (("author" 2)("o
b4a0: 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69 wner" 3)("descri
b4b0: 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 ption" 4)("revie
b4c0: 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39 wed" 5)("tags" 9
b4d0: 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 )))))..;; Update
b4e0: 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 test_meta for a
b4f0: 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 ll tests.(define
b500: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c (runs:update-al
b510: 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a l-test_meta db).
b520: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 (let ((test-na
b530: 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 mes (get-all-leg
b540: 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 al-tests))).
b550: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
b560: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 (lambda (test-na
b570: 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a me). (let*
b580: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 ((test-path
b590: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
b5a0: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
b5b0: 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 ame)).. (te
b5c0: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 st-configf (conc
b5d0: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 test-path "/tes
b5e0: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 tconfig"))..
b5f0: 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 (testexists
b600: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 (and (file-exist
b610: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
b620: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 (file-read-acces
b630: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
b640: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 )).. ;; rea
b650: 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 d configs with t
b660: 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 ricks turned off
b670: 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d (i.e. no system
b680: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 ).. (test-c
b690: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 onf (if teste
b6a0: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 xists (read-conf
b6b0: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 ig test-configf
b6c0: 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 #f #f)(make-hash
b6d0: 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 -table)))).. ;;
b6e0: 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e use the open-run
b6f0: 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f -close instead o
b700: 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a f passing in db.
b710: 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 . (runs:update-t
b720: 65 73 74 5f 6d 65 74 61 20 23 66 20 74 65 73 74 est_meta #f test
b730: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 -name test-conf)
b740: 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d )). test-nam
b750: 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 es)))..;; This c
b760: 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 ould probably be
b770: 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f refactored into
b780: 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 one complex que
b790: 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 ry ....(define (
b7a0: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 runs:rollup-run
b7b0: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 keys keyvallst r
b7c0: 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 unname user) ;;
b7d0: 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 was target, now
b7e0: 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 keyvallst. (deb
b7f0: 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 ug:print 4 "runs
b800: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 :rollup-run, key
b810: 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 s: " keys " keyv
b820: 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c allst: " keyvall
b830: 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 st " :runname "
b840: 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 runname " user:
b850: 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 " user). (let*
b860: 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20 20 ((db
b870: 20 20 23 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c #f) ;; (keyval
b880: 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a llst (keys:
b890: 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b target->keyval k
b8a0: 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 eys target)).. (
b8b0: 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 new-run-id
b8c0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
b8d0: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 runs:register-ru
b8e0: 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c n db keys keyval
b8f0: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 lst runname "new
b900: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 " "n/a" user))..
b910: 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 20 (prev-tests
b920: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
b930: 65 20 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 e test:get-match
b940: 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 ing-previous-tes
b950: 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 t-run-records db
b960: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 new-run-id "%"
b970: 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 "%")).. (curr-te
b980: 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 sts (open-r
b990: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
b9a0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
b9b0: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 2f 25 new-run-id "%/%
b9c0: 22 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 " '() '())).. (c
b9d0: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 urr-tests-hash (
b9e0: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
b9f0: 29 29 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e )). (open-run
ba00: 2d 63 6c 6f 73 65 20 64 62 3a 75 70 64 61 74 65 -close db:update
ba10: 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 -run-event_time
ba20: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 db new-run-id).
ba30: 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 ;; index the
ba40: 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65 already saved te
ba50: 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 sts by testname
ba60: 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 and itemdat in c
ba70: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 urr-tests-hash.
ba80: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 (for-each.
ba90: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 (lambda (testd
baa0: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a at). (let*
bab0: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 ((testname (db
bac0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
bad0: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 me testdat))..
bae0: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 (item-path (
baf0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
bb00: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a -path testdat)).
bb10: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d . (full-nam
bb20: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 e (conc testname
bb30: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
bb40: 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d ).. (hash-table-
bb50: 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d set! curr-tests-
bb60: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 hash full-name t
bb70: 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 estdat))). c
bb80: 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b urr-tests). ;
bb90: 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 ; NOPE: Non-opti
bba0: 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 mal approach. Tr
bbb0: 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a y this instead..
bbc0: 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 ;; 1. test
bbd0: 73 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69 s are received i
bbe0: 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 n a list, most r
bbf0: 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 ecent first.
bc00: 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 ;; 2. replace
bc10: 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 the rollup test
bc20: 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c with the new *al
bc30: 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 ways*. (for-e
bc40: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 ach . (lambd
bc50: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 a (testdat).
bc60: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e (let* ((testn
bc70: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ame (db:test-ge
bc80: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 t-testname testd
bc90: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 at)).. (ite
bca0: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
bcb0: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
bcc0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
bcd0: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 full-name (conc
bce0: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 testname "/" ite
bcf0: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 m-path))..
bd00: 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 (prev-test-dat (
bd10: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
bd20: 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 efault curr-test
bd30: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 s-hash full-name
bd40: 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 #f)).. (te
bd50: 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 6f st-steps (o
bd60: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
bd70: 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 :get-steps-for-t
bd80: 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d est db (db:test-
bd90: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
bda0: 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 ).. (new-te
bdb0: 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 st-record #f))..
bdc0: 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 ;; replace thes
bdd0: 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e e with insert ..
bde0: 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c . select.. (appl
bdf0: 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 y sqlite3:execut
be00: 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 e ...db ...(conc
be10: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c "INSERT OR REPL
be20: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 ACE INTO tests (
be30: 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c run_id,testname,
be40: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 state,status,eve
be50: 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 nt_time,host,cpu
be60: 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e load,diskfree,un
be70: 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f ame,rundir,item_
be80: 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f path,run_duratio
be90: 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d n,final_logf,com
bea0: 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 ment) "...
beb0: 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f "VALUES (?,?,?,?
bec0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
bed0: 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 ,?,?);")...new-r
bee0: 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 un-id (cddr (vec
bef0: 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 tor->list testda
bf00: 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 t))).. (set! new
bf10: 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 28 6f -testdat (car (o
bf20: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
bf30: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
bf40: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
bf50: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
bf60: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 20 27 "/" item-path) '
bf70: 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 () '()))).. (has
bf80: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
bf90: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
bfa0: 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 l-name new-testd
bfb0: 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c at) ;; this coul
bfc0: 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 d be confusing,
bfd0: 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f which record sho
bfe0: 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 uld go into the
bff0: 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 lookup table?..
c000: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 ;; Now duplicate
c010: 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a the test steps.
c020: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
c030: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 "Copying record
c040: 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 s in test_steps
c050: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 from test_id=" (
c060: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
c070: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 estdat) " to " (
c080: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e db:test-get-id n
c090: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 ew-testdat)).. (
c0a0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 0a open-run-close .
c0b0: 09 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 20 . (lambda ()..
c0c0: 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 (sqlite3:exec
c0d0: 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 0a 09 ute .. db ..
c0e0: 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 (conc "INSE
c0f0: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e RT OR REPLACE IN
c100: 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 TO test_steps (t
c110: 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c est_id,stepname,
c120: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 state,status,eve
c130: 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 nt_time,comment)
c140: 20 22 0a 09 09 20 20 20 22 53 45 4c 45 43 54 20 "... "SELECT
c150: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
c160: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 d new-testdat) "
c170: 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c ,stepname,state,
c180: 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d status,event_tim
c190: 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 e,comment FROM t
c1a0: 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 20 est_steps WHERE
c1b0: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 test_id=?;")..
c1c0: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
c1d0: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 id testdat))..
c1e0: 20 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 ;; Now duplica
c1f0: 74 65 20 74 68 65 20 74 65 73 74 20 64 61 74 61 te the test data
c200: 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
c210: 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 nt 4 "Copying re
c220: 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 cords in test_da
c230: 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d ta from test_id=
c240: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
c250: 64 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 d testdat) " to
c260: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
c270: 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a d new-testdat)).
c280: 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 . (sqlite3:ex
c290: 65 63 75 74 65 20 0a 09 20 20 20 20 20 64 62 20 ecute .. db
c2a0: 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22 49 4e .. (conc "IN
c2b0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 SERT OR REPLACE
c2c0: 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 INTO test_data (
c2d0: 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 test_id,category
c2e0: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c ,variable,value,
c2f0: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 expected,tol,uni
c300: 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 ts,comment) "...
c310: 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 "SELECT " (db
c320: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
c330: 2d 74 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 -testdat) ",cate
c340: 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 gory,variable,va
c350: 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c lue,expected,tol
c360: 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 ,units,comment F
c370: 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 ROM test_data WH
c380: 45 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 ERE test_id=?;")
c390: 0a 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d .. (db:test-
c3a0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
c3b0: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 )).. )). pre
c3c0: 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 v-tests))).. .
c3d0: 20 20 20 0a .