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 0a 3b 3b 20 45 76 65 72 79 20 74 69 6d 0)..;; Every tim
0fc0: 65 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 e can-run-more-t
0fd0: 65 73 74 73 20 69 73 20 63 61 6c 6c 65 64 20 69 ests is called i
0fe0: 6e 63 72 65 6d 65 6e 74 20 74 68 65 20 64 65 6c ncrement the del
0ff0: 61 79 0a 3b 3b 20 69 66 20 74 68 65 20 63 6f 75 ay.;; if the cou
1000: 0a 28 64 65 66 69 6e 65 20 2a 72 75 6e 73 3a 63 .(define *runs:c
1010: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
1020: 73 2d 63 6f 75 6e 74 2a 20 30 29 0a 28 64 65 66 s-count* 0).(def
1030: 69 6e 65 20 28 72 75 6e 73 3a 73 68 72 69 6e 6b ine (runs:shrink
1040: 2d 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 -can-run-more-te
1050: 73 74 73 2d 63 6f 75 6e 74 29 0a 20 20 28 73 65 sts-count). (se
1060: 74 21 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e t! *runs:can-run
1070: 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e -more-tests-coun
1080: 74 2a 20 30 29 29 20 3b 3b 20 28 2f 20 2a 72 75 t* 0)) ;; (/ *ru
1090: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
10a0: 74 65 73 74 73 2d 63 6f 75 6e 74 2a 20 32 29 29 tests-count* 2))
10b0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 )..(define (runs
10c0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
10d0: 73 74 73 20 74 65 73 74 2d 72 65 63 6f 72 64 20 sts test-record
10e0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
10f0: 6f 62 73 29 0a 20 20 28 74 68 72 65 61 64 2d 73 obs). (thread-s
1100: 6c 65 65 70 21 20 28 63 6f 6e 64 0a 09 09 20 20 leep! (cond...
1110: 28 28 3e 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 ((> *runs:can-ru
1120: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 n-more-tests-cou
1130: 6e 74 2a 20 32 30 29 20 32 29 3b 3b 20 6f 62 76 nt* 20) 2);; obv
1140: 69 6f 75 73 6c 79 20 68 61 76 65 6e 27 74 20 68 iously haven't h
1150: 61 64 20 61 6e 79 20 77 6f 72 6b 20 74 6f 20 64 ad any work to d
1160: 6f 20 66 6f 72 20 61 20 77 68 69 6c 65 0a 09 09 o for a while...
1170: 20 20 28 65 6c 73 65 20 30 29 29 29 0a 20 20 28 (else 0))). (
1180: 6c 65 74 2a 20 28 28 74 63 6f 6e 66 69 67 20 20 let* ((tconfig
1190: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 (
11a0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
11b0: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 get-testconfig t
11c0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 est-record)).. (
11d0: 6a 6f 62 67 72 6f 75 70 20 20 20 20 20 20 20 20 jobgroup
11e0: 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d (config-
11f0: 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 lookup tconfig "
1200: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6a requirements" "j
1210: 6f 62 67 72 6f 75 70 22 29 29 0a 09 20 28 6e 75 obgroup")).. (nu
1220: 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 20 20 20 20 m-running
1230: 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f 74 (cdb:remot
1240: 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 63 6f 75 e-run db:get-cou
1250: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 nt-tests-running
1260: 20 23 66 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e #f)).. (num-run
1270: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 ning-in-jobgroup
1280: 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e (cdb:remote-run
1290: 20 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 db:get-count-te
12a0: 73 74 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a sts-running-in-j
12b0: 6f 62 67 72 6f 75 70 20 23 66 20 6a 6f 62 67 72 obgroup #f jobgr
12c0: 6f 75 70 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f oup)).. (job-gro
12d0: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 up-limit
12e0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
12f0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 *configdat* "job
1300: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 groups" jobgroup
1310: 29 29 29 0a 20 20 20 20 28 69 66 20 28 3e 20 28 ))). (if (> (
1320: 2b 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e 75 + num-running nu
1330: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 m-running-in-job
1340: 67 72 6f 75 70 29 20 30 29 0a 09 28 73 65 74 21 group) 0)..(set!
1350: 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d *runs:can-run-m
1360: 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 6e 74 2a ore-tests-count*
1370: 20 28 2b 20 2a 72 75 6e 73 3a 63 61 6e 2d 72 75 (+ *runs:can-ru
1380: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 2d 63 6f 75 n-more-tests-cou
1390: 6e 74 2a 20 31 29 29 29 0a 20 20 20 20 28 69 66 nt* 1))). (if
13a0: 20 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74 (not (eq? *last
13b0: 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 -num-running-tes
13c0: 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 ts* num-running)
13d0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 )..(begin.. (de
13e0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 bug:print 2 "max
13f0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
1400: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 : " max-concurre
1410: 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 nt-jobs ", num-r
1420: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 unning: " num-ru
1430: 6e 6e 69 6e 67 29 0a 09 20 20 28 73 65 74 21 20 nning).. (set!
1440: 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e *last-num-runnin
1450: 67 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e g-tests* num-run
1460: 6e 69 6e 67 29 29 29 0a 20 20 20 20 28 69 66 20 ning))). (if
1470: 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f (not (eq? 0 *glo
1480: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29 balexitstatus*))
1490: 0a 09 28 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72 ..(list #f num-r
14a0: 75 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 unning num-runni
14b0: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d ng-in-jobgroup m
14c0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
14d0: 62 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d bs job-group-lim
14e0: 69 74 29 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d it)..(let ((can-
14f0: 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f not-run-more (co
1500: 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 nd..... ;; if ma
1510: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
1520: 73 20 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 s is set and the
1530: 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 number running
1540: 69 73 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 is greater .....
1550: 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e ;; than it than
1560: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 cannot run more
1570: 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 jobs..... ((and
1580: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
1590: 6a 6f 62 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e jobs (>= num-run
15a0: 6e 69 6e 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72 ning max-concurr
15b0: 65 6e 74 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20 ent-jobs)).....
15c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
15d0: 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 "WARNING: Max ru
15e0: 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 nning jobs excee
15f0: 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d ded, current num
1600: 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e ber running: " n
1610: 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 um-running .....
1620: 09 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 . ", max_c
1630: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 oncurrent_jobs:
1640: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
1650: 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 -jobs)..... #t)
1660: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d ..... ;; if job-
1670: 67 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 group-limit is s
1680: 65 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 et and number of
1690: 20 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f jobs in the gro
16a0: 75 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 up is greater...
16b0: 09 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c .. ;; than the l
16c0: 69 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 imit then cannot
16d0: 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f run more jobs o
16e0: 66 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 f this kind.....
16f0: 20 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 ((and job-group
1700: 2d 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 -limit.....
1710: 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e (>= num-runnin
1720: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f g-in-jobgroup jo
1730: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a b-group-limit)).
1740: 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 .... (debug:pri
1750: 6e 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e nt 1 "WARNING: n
1760: 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 umber of jobs "
1770: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
1780: 6f 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 obgroup ......
1790: 20 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 " in " jobg
17a0: 72 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c roup " exceeded,
17b0: 20 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 will not run "
17c0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
17d0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
17e0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 st-record)).....
17f0: 20 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 #t)..... (else
1800: 20 23 66 29 29 29 29 0a 09 20 20 28 6c 69 73 74 #f)))).. (list
1810: 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 (not can-not-ru
1820: 6e 2d 6d 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e n-more) num-runn
1830: 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d ing num-running-
1840: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d in-jobgroup max-
1850: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 concurrent-jobs
1860: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 job-group-limit)
1870: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ))))..;;========
1880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
18a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
18b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
18c0: 3b 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 ; New methodolog
18d0: 79 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65 y. These routine
18e0: 73 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 s will replace t
18f0: 68 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 he above in time
1900: 2e 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 . For.;; now the
1910: 20 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61 code is duplica
1920: 74 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20 ted. This stuff
1930: 69 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 is initially use
1940: 64 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 d in the monitor
1950: 0a 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a .;; based code..
1960: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
1970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
19a0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 0a 3b 3b 20 54 68 ========...;; Th
19b0: 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 is is a duplicat
19c0: 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28 e of run-tests (
19d0: 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64 which has been d
19e0: 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20 eprecated). Use
19f0: 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 this one instead
1a00: 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b of run tests..;
1a10: 3b 20 6b 65 79 76 61 6c 73 2e 0a 3b 3b 0a 3b 3b ; keyvals..;;.;;
1a20: 20 20 74 65 73 74 2d 6e 61 6d 65 73 3a 20 43 6f test-names: Co
1a30: 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 70 61 mma separated pa
1a40: 74 74 65 72 6e 73 20 73 61 6d 65 20 61 73 20 74 tterns same as t
1a50: 65 73 74 2d 70 61 74 74 73 20 62 75 74 20 75 73 est-patts but us
1a60: 65 64 20 69 6e 20 73 65 6c 65 63 74 69 6f 6e 20 ed in selection
1a70: 0a 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 .;;
1a80: 20 6f 66 20 74 65 73 74 73 20 74 6f 20 72 75 6e of tests to run
1a90: 2e 20 54 68 65 20 69 74 65 6d 20 70 6f 72 74 69 . The item porti
1aa0: 6f 6e 73 20 61 72 65 20 6e 6f 74 20 72 65 73 70 ons are not resp
1ab0: 65 63 74 65 64 2e 0a 3b 3b 20 20 20 20 20 20 20 ected..;;
1ac0: 20 20 20 20 20 20 20 46 49 58 4d 45 3a 20 65 72 FIXME: er
1ad0: 72 6f 72 20 6f 75 74 20 69 66 20 2f 70 61 74 74 ror out if /patt
1ae0: 20 73 70 65 63 69 66 69 65 64 0a 3b 3b 20 20 20 specified.;;
1af0: 20 20 20 20 20 20 20 20 20 0a 28 64 65 66 69 6e .(defin
1b00: 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 e (runs:run-test
1b10: 73 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 s target runname
1b20: 20 74 65 73 74 2d 6e 61 6d 65 73 20 74 65 73 74 test-names test
1b30: 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c 61 67 -patts user flag
1b40: 73 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 s). (common:cle
1b50: 61 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c ar-caches) ;; cl
1b60: 65 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20 ear all caches.
1b70: 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 (let* ((db
1b80: 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73 #f).. (keys
1b90: 20 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d (cdb:rem
1ba0: 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 2d 6b ote-run db:get-k
1bb0: 65 79 73 20 23 66 29 29 0a 09 20 28 6b 65 79 76 eys #f)).. (keyv
1bc0: 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61 allst (keys:ta
1bd0: 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 rget->keyval key
1be0: 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 75 s target)).. (ru
1bf0: 6e 2d 69 64 20 20 20 20 20 20 28 63 64 62 3a 72 n-id (cdb:r
1c00: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 72 65 67 emote-run db:reg
1c10: 69 73 74 65 72 2d 72 75 6e 20 23 66 20 6b 65 79 ister-run #f key
1c20: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e s keyvallst runn
1c30: 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 ame "new" "n/a"
1c40: 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74 user)) ;; test
1c50: 2d 6e 61 6d 65 29 29 29 0a 09 20 28 6b 65 79 76 -name))).. (keyv
1c60: 61 6c 73 20 20 20 20 20 28 69 66 20 72 75 6e 2d als (if run-
1c70: 69 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 id (cdb:remote-r
1c80: 75 6e 20 64 62 3a 67 65 74 2d 6b 65 79 2d 76 61 un db:get-key-va
1c90: 6c 73 20 23 66 20 72 75 6e 2d 69 64 29 20 23 66 ls #f run-id) #f
1ca0: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 )).. (deferred
1cb0: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 '()) ;; delay
1cc0: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 running these si
1cd0: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20 nce they have a
1ce0: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 waiton clause..
1cf0: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 ;; keepgoing is
1d00: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 the defacto moda
1d10: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 lity now, will a
1d20: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 dd hit-n-run a b
1d30: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b it later.. ;; (k
1d40: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 eepgoing (hash
1d50: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
1d60: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 lt flags "-keepg
1d70: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 72 75 oing" #f)).. (ru
1d80: 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 nconfigf (conc
1d90: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 *toppath* "/ru
1da0: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 nconfigs.config"
1db0: 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 2d 74 )).. (required-t
1dc0: 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 65 73 ests '()).. (tes
1dd0: 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d t-records (make-
1de0: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20 hash-table)))..
1df0: 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 (set-megatest
1e00: 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 64 -env-vars run-id
1e10: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 ) ;; these may b
1e20: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 e needed by the
1e30: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 launching proces
1e40: 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 6c 65 s.. (if (file
1e50: 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 -exists? runconf
1e60: 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65 6e 76 igf)..(setup-env
1e70: 2d 64 65 66 61 75 6c 74 73 20 72 75 6e 63 6f 6e -defaults runcon
1e80: 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 figf run-id *alr
1e90: 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e eady-seen-runcon
1ea0: 66 69 67 2d 69 6e 66 6f 2a 20 6b 65 79 73 20 6b fig-info* keys k
1eb0: 65 79 76 61 6c 73 20 22 70 72 65 2d 6c 61 75 6e eyvals "pre-laun
1ec0: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 ch-env-vars")..(
1ed0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
1ee0: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e ARNING: You do n
1ef0: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f ot have a run co
1f00: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e nfig file: " run
1f10: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 configf)). .
1f20: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c ;; look up al
1f30: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 l tests matching
1f40: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 the comma separ
1f50: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f ated list of glo
1f60: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 bs in. ;; tes
1f70: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 t-patts (using %
1f80: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 0a 20 as wildcard)..
1f90: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 (set! test-na
1fa0: 6d 65 73 20 28 74 65 73 74 73 3a 67 65 74 2d 76 mes (tests:get-v
1fb0: 61 6c 69 64 2d 74 65 73 74 73 20 2a 74 6f 70 70 alid-tests *topp
1fc0: 61 74 68 2a 20 74 65 73 74 2d 6e 61 6d 65 73 29 ath* test-names)
1fd0: 29 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 ). (set! test
1fe0: 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64 -names (delete-d
1ff0: 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e uplicates test-n
2000: 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62 ames)).. (deb
2010: 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 ug:print-info 0
2020: 22 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74 65 "test names " te
2030: 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20 3b st-names).. ;
2040: 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70 ; on the first p
2050: 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72 ass or call to r
2060: 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 49 un-tests set FAI
2070: 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45 LS to NOT_STARTE
2080: 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 D if. ;; -kee
2090: 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 66 pgoing is specif
20a0: 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71 3f ied. (if (eq?
20b0: 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 28 *passnum* 0)..(
20c0: 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 begin.. ;; have
20d0: 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 to delete test
20e0: 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f records where NO
20f0: 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 20 T_STARTED since
2100: 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d they can cause -
2110: 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 keepgoing to ..
2120: 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75 ;; get stuck du
2130: 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e e to becoming in
2140: 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 accessible from
2150: 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49 a failed test. I
2160: 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 65 .e. if test B de
2170: 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 pends .. ;; on
2180: 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74 20 test A but test
2190: 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70 6f B reached the po
21a0: 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 int on being reg
21b0: 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 istered as NOT_S
21c0: 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a TARTED and test.
21d0: 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 . ;; A failed f
21e0: 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 or some reason t
21f0: 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 hen on re-run us
2200: 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 ing -keepgoing t
2210: 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 he run can never
2220: 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 63 complete... (c
2230: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d db:delete-tests-
2240: 69 6e 2d 73 74 61 74 65 20 2a 72 75 6e 72 65 6d in-state *runrem
2250: 6f 74 65 2a 20 72 75 6e 2d 69 64 20 22 4e 4f 54 ote* run-id "NOT
2260: 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 63 _STARTED").. (c
2270: 64 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 db:remote-run db
2280: 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 :set-tests-state
2290: 2d 73 74 61 74 75 73 20 23 66 20 72 75 6e 2d 69 -status #f run-i
22a0: 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 d test-names #f
22b0: 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 "FAIL" "NOT_STAR
22c0: 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a TED" "FAIL")))..
22d0: 20 20 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65 ;; from here
22e0: 20 6f 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77 on out the db w
22f0: 69 6c 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e ill be opened an
2300: 64 20 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72 d closed on ever
2310: 79 20 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d y call runs:run-
2320: 74 65 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20 tests-queue.
2330: 3b 3b 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 ;; (sqlite3:fina
2340: 6c 69 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b lize! db) . ;
2350: 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 ; now add non-di
2360: 72 65 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65 rectly reference
2370: 64 20 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 d dependencies (
2380: 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 i.e. waiton).
2390: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
23a0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 test-names))..(
23b0: 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 let loop ((hed (
23c0: 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 car test-names))
23d0: 0a 09 09 20 20 20 28 74 61 6c 20 28 63 64 72 20 ... (tal (cdr
23e0: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 test-names)))
23f0: 20 20 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e ;; 'return
2400: 2d 70 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 -procs tells the
2410: 20 63 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74 config reader t
2420: 6f 20 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 o prep running s
2430: 79 73 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e ystem but return
2440: 20 61 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75 a proc.. (debu
2450: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 g:print-info 4 "
2460: 68 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74 hed=" hed " at t
2470: 6f 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20 op of loop")..
2480: 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 (let* ((config
2490: 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 (tests:get-testc
24a0: 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 onfig hed 'retur
24b0: 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 n-procs))... (wa
24c0: 69 74 6f 6e 73 20 28 6c 65 74 20 28 28 69 6e 73 itons (let ((ins
24d0: 74 72 20 28 69 66 20 63 6f 6e 66 69 67 20 0a 09 tr (if config ..
24e0: 09 09 09 09 20 20 20 28 63 6f 6e 66 69 67 2d 6c .... (config-l
24f0: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 ookup config "re
2500: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69 quirements" "wai
2510: 74 6f 6e 22 29 0a 09 09 09 09 09 20 20 20 28 62 ton")...... (b
2520: 65 67 69 6e 20 3b 3b 20 4e 6f 20 63 6f 6e 66 69 egin ;; No confi
2530: 67 20 6d 65 61 6e 73 20 74 68 69 73 20 69 73 20 g means this is
2540: 61 20 6e 6f 6e 2d 65 78 69 73 74 61 6e 74 20 74 a non-existant t
2550: 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 28 64 est...... (d
2560: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
2570: 52 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e ROR: non-existen
2580: 74 20 72 65 71 75 69 72 65 64 20 74 65 73 74 20 t required test
2590: 5c 22 22 20 68 65 64 20 22 5c 22 22 29 0a 09 09 \"" hed "\"")...
25a0: 09 09 09 20 20 20 20 20 28 69 66 20 64 62 20 28 ... (if db (
25b0: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 sqlite3:finalize
25c0: 21 20 64 62 29 29 0a 09 09 09 09 09 20 20 20 20 ! db))......
25d0: 20 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 09 (exit 1)))))...
25e0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
25f0: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e t-info 8 "waiton
2600: 73 20 73 74 72 69 6e 67 20 69 73 20 22 20 69 6e s string is " in
2610: 73 74 72 29 0a 09 09 09 20 20 20 20 28 73 74 72 str).... (str
2620: 69 6e 67 2d 73 70 6c 69 74 20 28 63 6f 6e 64 0a ing-split (cond.
2630: 09 09 09 09 09 20 20 20 28 28 70 72 6f 63 65 64 ..... ((proced
2640: 75 72 65 3f 20 69 6e 73 74 72 29 0a 09 09 09 09 ure? instr).....
2650: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 20 . (let ((res
2660: 28 69 6e 73 74 72 29 29 29 0a 09 09 09 09 09 20 (instr)))......
2670: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
2680: 74 2d 69 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e t-info 8 "waiton
2690: 20 70 72 6f 63 65 64 75 72 65 20 72 65 73 75 6c procedure resul
26a0: 74 73 20 69 6e 20 73 74 72 69 6e 67 20 22 20 72 ts in string " r
26b0: 65 73 20 22 20 66 6f 72 20 74 65 73 74 20 22 20 es " for test "
26c0: 68 65 64 29 0a 09 09 09 09 09 20 20 20 20 20 20 hed)......
26d0: 72 65 73 29 29 0a 09 09 09 09 09 20 20 20 28 28 res))...... ((
26e0: 73 74 72 69 6e 67 3f 20 69 6e 73 74 72 29 20 20 string? instr)
26f0: 20 20 20 69 6e 73 74 72 29 0a 09 09 09 09 09 20 instr)......
2700: 20 20 28 65 6c 73 65 20 0a 09 09 09 09 09 20 20 (else ......
2710: 20 20 3b 3b 20 4e 4f 54 45 3a 20 54 68 69 73 20 ;; NOTE: This
2720: 69 73 20 61 63 74 75 61 6c 6c 79 20 74 68 65 20 is actually the
2730: 63 61 73 65 20 6f 66 20 2a 6e 6f 2a 20 77 61 69 case of *no* wai
2740: 74 6f 6e 73 21 20 3b 3b 20 28 64 65 62 75 67 3a tons! ;; (debug:
2750: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
2760: 73 6f 6d 65 74 68 69 6e 67 20 77 65 6e 74 20 77 something went w
2770: 72 6f 6e 67 20 69 6e 20 70 72 6f 63 65 73 73 69 rong in processi
2780: 6e 67 20 77 61 69 74 6f 6e 73 20 66 6f 72 20 74 ng waitons for t
2790: 65 73 74 20 22 20 68 65 64 29 0a 09 09 09 09 09 est " hed)......
27a0: 20 20 20 20 22 22 29 29 29 29 29 29 0a 09 20 20 ""))))))..
27b0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 (debug:print-i
27c0: 6e 66 6f 20 38 20 22 77 61 69 74 6f 6e 73 3a 20 nfo 8 "waitons:
27d0: 22 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 " waitons)..
27e0: 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 ;; check for hed
27f0: 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 in waitons => t
2800: 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 his would be cir
2810: 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 cular, remove it
2820: 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 and issue an..
2830: 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 ;; error..
2840: 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 65 64 (if (member hed
2850: 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 67 waitons)...(beg
2860: 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 in... (debug:pr
2870: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 65 int 0 "ERROR: te
2880: 73 74 20 22 20 68 65 64 20 22 20 68 61 73 20 6c st " hed " has l
2890: 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 73 20 isted itself as
28a0: 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 73 65 a waiton, please
28b0: 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 22 29 correct this!")
28c0: 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 74 6f ... (set! waito
28d0: 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 ns (filter (lamb
28e0: 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 75 61 da (x)(not (equa
28f0: 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 69 74 l? x hed))) wait
2900: 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a 09 20 ons)))).. ..
2910: 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 ;; (items (
2920: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d items:get-items-
2930: 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 from-config conf
2940: 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 ig))).. (if (
2950: 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d not (hash-table-
2960: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 ref/default test
2970: 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 66 29 -records hed #f)
2980: 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d )...(hash-table-
2990: 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 set! test-record
29a0: 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 63 74 s..... hed (vect
29b0: 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 30 0a or hed ;; 0.
29c0: 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 69 67 ..... config
29d0: 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 20 20 ;; 1......
29e0: 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 waitons ;; 2...
29f0: 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 67 2d ... (config-
2a00: 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 lookup config "r
2a10: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72 equirements" "pr
2a20: 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b 3b 20 iority") ;;
2a30: 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 09 09 priority 3......
2a40: 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d (let ((item
2a50: 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 s (hash-tab
2a60: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 le-ref/default c
2a70: 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 23 66 onfig "items" #f
2a80: 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 )) ;; items 4...
2a90: 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 61 62 .... (itemstab
2aa0: 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 le (hash-table-r
2ab0: 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 ef/default confi
2ac0: 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 23 g "itemstable" #
2ad0: 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 20 20 f))) ......
2ae0: 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 ;; if either i
2af0: 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 74 61 tems or items ta
2b00: 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 72 65 ble is a proc re
2b10: 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 74 20 turn it so test
2b20: 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 running......
2b30: 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 ;; process c
2b40: 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 an know to call
2b50: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d items:get-items-
2b60: 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 from-config.....
2b70: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 . ;; if ei
2b80: 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 20 61 ther is a list a
2b90: 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f nd none is a pro
2ba0: 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20 63 c go ahead and c
2bb0: 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 all get-items...
2bc0: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 ... ;; oth
2bd0: 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 23 66 erwise return #f
2be0: 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 - this is not a
2bf0: 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 74 0a n iterated test.
2c00: 09 09 09 09 09 20 20 20 20 20 20 20 28 63 6f 6e ..... (con
2c10: 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 d.......((proced
2c20: 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 20 20 ure? items)
2c30: 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a ....... (debug:
2c40: 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 print-info 4 "it
2c50: 65 6d 73 20 69 73 20 61 20 70 72 6f 63 65 64 75 ems is a procedu
2c60: 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 re, will calc la
2c70: 74 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 ter")....... ite
2c80: 6d 73 29 20 20 20 20 20 20 20 20 20 20 20 20 3b ms) ;
2c90: 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 ; calc later....
2ca0: 09 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 ...((procedure?
2cb0: 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 itemstable).....
2cc0: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d .. (debug:print-
2cd0: 69 6e 66 6f 20 34 20 22 69 74 65 6d 73 74 61 62 info 4 "itemstab
2ce0: 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 le is a procedur
2cf0: 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 e, will calc lat
2d00: 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d er")....... item
2d10: 73 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b stable) ;;
2d20: 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 calc later.....
2d30: 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 ..((filter (lamb
2d40: 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 20 20 da (x)........
2d50: 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72 (let ((val (car
2d60: 20 78 29 29 29 0a 09 09 09 09 09 09 09 20 20 20 x)))........
2d70: 20 20 28 69 66 20 28 70 72 6f 63 65 64 75 72 65 (if (procedure
2d80: 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29 ? val) val #f)))
2d90: 0a 09 09 09 09 09 09 09 20 28 61 70 70 65 6e 64 ........ (append
2da0: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d (if (list? item
2db0: 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09 s) items '())...
2dc0: 09 09 09 09 09 09 20 28 69 66 20 28 6c 69 73 74 ...... (if (list
2dd0: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74 ? itemstable) it
2de0: 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a emstable '()))).
2df0: 09 09 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f ...... 'have-pro
2e00: 63 65 64 75 72 65 29 0a 09 09 09 09 09 09 28 28 cedure).......((
2e10: 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 or (list? items)
2e20: 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c (list? itemstabl
2e30: 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a e)) ;; calc now.
2e40: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 ...... (debug:pr
2e50: 69 6e 74 2d 69 6e 66 6f 20 34 20 22 69 74 65 6d int-info 4 "item
2e60: 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 s and itemstable
2e70: 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 are lists, calc
2e80: 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 now\n"........
2e90: 20 20 20 20 20 22 20 20 20 20 69 74 65 6d 73 3a " items:
2ea0: 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d 73 " items " items
2eb0: 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 table: " itemsta
2ec0: 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74 65 ble)....... (ite
2ed0: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
2ee0: 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 m-config config)
2ef0: 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23 66 ).......(else #f
2f00: 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 )))
2f10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b ;;
2f20: 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09 09 not iterated...
2f30: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 ... #f
2f40: 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09 09 ;; itemsdat 5...
2f50: 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 20 ... #f
2f60: 3b 3b 20 73 70 61 72 65 20 2d 20 75 73 65 64 20 ;; spare - used
2f70: 66 6f 72 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 for item-path...
2f80: 09 09 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 ... )))..
2f90: 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 (for-each ..
2fa0: 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f (lambda (waito
2fb0: 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 n).. (if (
2fc0: 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 and waiton (not
2fd0: 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 (member waiton t
2fe0: 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 est-names)))...
2ff0: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 (begin...
3000: 28 73 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 (set! required-t
3010: 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f ests (cons waito
3020: 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 n required-tests
3030: 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 ))... (set!
3040: 74 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 test-names (cons
3050: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d waiton test-nam
3060: 65 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 es))))) ;; was a
3070: 6e 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 n append, now a
3080: 63 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f cons.. waito
3090: 6e 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 ns).. (let ((
30a0: 72 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 remtests (delete
30b0: 2d 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 -duplicates (app
30c0: 65 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 end waitons tal)
30d0: 29 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ))).. (if (
30e0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 not (null? remte
30f0: 73 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 sts))... (loop
3100: 28 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 (car remtests)(c
3110: 64 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 dr remtests)))))
3120: 29 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 )).. (if (not
3130: 20 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 (null? required
3140: 2d 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 -tests))..(debug
3150: 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 41 :print-info 1 "A
3160: 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 dding " required
3170: 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 -tests " to the
3180: 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 run queue")).
3190: 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 ;; NOTE: these
31a0: 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 are all parent t
31b0: 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 ests, items are
31c0: 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 not expanded yet
31d0: 2e 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
31e0: 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 2d nt-info 4 "test-
31f0: 72 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d records=" (hash-
3200: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 table->alist tes
3210: 74 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 t-records)).
3220: 28 6c 65 74 20 28 28 72 65 67 6c 65 6e 20 28 61 (let ((reglen (a
3230: 6e 79 2d 3e 6e 75 6d 62 65 72 20 20 28 63 6f 6e ny->number (con
3240: 66 69 67 66 3a 6c 6f 6f 6b 75 70 20 2a 63 6f 6e figf:lookup *con
3250: 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 figdat* "setup"
3260: 22 72 75 6e 71 75 65 75 65 22 29 29 29 29 0a 20 "runqueue")))).
3270: 20 20 20 20 20 28 69 66 20 72 65 67 6c 65 6e 0a (if reglen.
3280: 09 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 . (runs:run-tes
3290: 74 73 2d 71 75 65 75 65 2d 6e 65 77 20 72 75 6e ts-queue-new run
32a0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
32b0: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c -records keyvall
32c0: 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 st flags test-pa
32d0: 74 74 73 20 72 65 67 6c 65 6e 29 0a 09 20 20 28 tts reglen).. (
32e0: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 runs:run-tests-q
32f0: 75 65 75 65 2d 63 6c 61 73 73 69 63 20 72 75 6e ueue-classic run
3300: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
3310: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c -records keyvall
3320: 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 st flags test-pa
3330: 74 74 73 29 29 29 0a 20 20 20 20 28 64 65 62 75 tts))). (debu
3340: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 g:print-info 4 "
3350: 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65 All done by here
3360: 22 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 ")))..(define (r
3370: 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 uns:calc-fails p
3380: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a rereqs-not-met).
3390: 20 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 (filter (lambd
33a0: 61 20 28 74 65 73 74 29 0a 09 20 20 20 20 28 61 a (test).. (a
33b0: 6e 64 20 28 76 65 63 74 6f 72 3f 20 74 65 73 74 nd (vector? test
33c0: 29 20 3b 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 ) ;; not (string
33d0: 3f 20 74 65 73 74 29 29 0a 09 09 20 28 65 71 75 ? test))... (equ
33e0: 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 al? (db:test-get
33f0: 2d 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f -state test) "CO
3400: 4d 50 4c 45 54 45 44 22 29 0a 09 09 20 28 6e 6f MPLETED")... (no
3410: 74 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 t (member (db:te
3420: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 st-get-status te
3430: 73 74 29 0a 09 09 09 20 20 20 20 20 20 27 28 22 st).... '("
3440: 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 PASS" "WARN" "CH
3450: 45 43 4b 22 20 22 57 41 49 56 45 44 22 20 22 53 ECK" "WAIVED" "S
3460: 4b 49 50 22 29 29 29 29 29 0a 09 20 20 70 72 65 KIP"))))).. pre
3470: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 0a reqs-not-met))..
3480: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 (define (runs:ca
3490: 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 65 64 lc-not-completed
34a0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
34b0: 29 0a 20 20 28 66 69 6c 74 65 72 0a 20 20 20 28 ). (filter. (
34c0: 6c 61 6d 62 64 61 20 28 74 29 0a 20 20 20 20 20 lambda (t).
34d0: 28 6f 72 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 (or (not (vector
34e0: 3f 20 74 29 29 0a 09 20 28 6e 6f 74 20 28 65 71 ? t)).. (not (eq
34f0: 75 61 6c 3f 20 22 43 4f 4d 50 4c 45 54 45 44 22 ual? "COMPLETED"
3500: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 (db:test-get-st
3510: 61 74 65 20 74 29 29 29 29 29 0a 20 20 20 70 72 ate t))))). pr
3520: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a ereqs-not-met)).
3530: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 70 .(define (runs:p
3540: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6c 73 74 retty-string lst
3550: 29 0a 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 ). (map (lambda
3560: 20 28 74 29 0a 09 20 28 69 66 20 28 6e 6f 74 20 (t).. (if (not
3570: 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 20 (vector? t))..
3580: 20 20 20 28 63 6f 6e 63 20 74 29 0a 09 20 20 20 (conc t)..
3590: 20 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 (conc (db:test
35a0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 -get-testname t)
35b0: 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d 67 65 ":" (db:test-ge
35c0: 74 2d 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 t-state t) "/" (
35d0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 db:test-get-stat
35e0: 75 73 20 74 29 29 29 29 0a 20 20 20 20 20 20 20 us t)))).
35f0: 6c 73 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 lst))..(define (
3600: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 runs:make-full-t
3610: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 6e 61 6d est-name testnam
3620: 65 20 69 74 65 6d 70 61 74 68 29 0a 20 20 28 69 e itempath). (i
3630: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 f (equal? itempa
3640: 74 68 20 22 22 29 20 74 65 73 74 6e 61 6d 65 20 th "") testname
3650: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 (conc testname "
3660: 2f 22 20 69 74 65 6d 70 61 74 68 29 29 29 0a 0a /" itempath)))..
3670: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 71 75 (define (runs:qu
3680: 65 75 65 2d 6e 65 78 74 2d 68 65 64 20 74 61 6c eue-next-hed tal
3690: 20 72 65 67 20 6e 20 72 65 67 66 75 6c 29 0a 20 reg n regful).
36a0: 20 28 69 66 20 72 65 67 66 75 6c 0a 20 20 20 20 (if regful.
36b0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 67 (if (null? reg
36c0: 29 20 3b 3b 20 64 6f 65 73 6e 27 74 20 6d 61 6b ) ;; doesn't mak
36d0: 65 20 73 65 6e 73 65 2c 20 74 68 69 73 20 69 73 e sense, this is
36e0: 20 70 72 6f 62 61 62 6c 79 20 4e 4f 54 20 74 68 probably NOT th
36f0: 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 74 68 65 e problem of the
3700: 20 63 61 72 0a 09 20 20 28 63 61 72 20 74 61 6c car.. (car tal
3710: 29 0a 09 20 20 28 63 61 72 20 72 65 67 29 29 0a ).. (car reg)).
3720: 20 20 20 20 20 20 28 63 61 72 20 74 61 6c 29 29 (car tal))
3730: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 )..(define (runs
3740: 3a 71 75 65 75 65 2d 6e 65 78 74 2d 74 61 6c 20 :queue-next-tal
3750: 74 61 6c 20 72 65 67 20 6e 20 72 65 67 66 75 6c tal reg n regful
3760: 29 0a 20 20 28 69 66 20 72 65 67 66 75 6c 0a 20 ). (if regful.
3770: 20 20 20 20 20 74 61 6c 0a 20 20 20 20 20 20 28 tal. (
3780: 6c 65 74 20 28 28 6e 65 77 74 61 6c 20 28 63 64 let ((newtal (cd
3790: 72 20 74 61 6c 29 29 29 0a 09 28 69 66 20 28 6e r tal)))..(if (n
37a0: 75 6c 6c 3f 20 6e 65 77 74 61 6c 29 0a 09 20 20 ull? newtal)..
37b0: 20 20 72 65 67 0a 09 20 20 20 20 6e 65 77 74 61 reg.. newta
37c0: 6c 0a 09 20 20 20 20 29 29 29 29 0a 0a 28 64 65 l.. ))))..(de
37d0: 66 69 6e 65 20 28 72 75 6e 73 3a 71 75 65 75 65 fine (runs:queue
37e0: 2d 6e 65 78 74 2d 72 65 67 20 74 61 6c 20 72 65 -next-reg tal re
37f0: 67 20 6e 20 72 65 67 66 75 6c 29 0a 20 20 28 69 g n regful). (i
3800: 66 20 72 65 67 66 75 6c 0a 20 20 20 20 20 20 28 f regful. (
3810: 63 64 72 20 72 65 67 29 0a 20 20 20 20 20 20 28 cdr reg). (
3820: 69 66 20 28 65 71 3f 20 28 6c 65 6e 67 74 68 20 if (eq? (length
3830: 74 61 6c 29 20 31 29 0a 09 20 20 27 28 29 0a 09 tal) 1).. '()..
3840: 20 20 72 65 67 29 29 29 0a 0a 28 69 6e 63 6c 75 reg)))..(inclu
3850: 64 65 20 22 72 75 6e 2d 74 65 73 74 73 2d 71 75 de "run-tests-qu
3860: 65 75 65 2d 63 6c 61 73 73 69 63 2e 73 63 6d 22 eue-classic.scm"
3870: 29 0a 28 69 6e 63 6c 75 64 65 20 22 72 75 6e 2d ).(include "run-
3880: 74 65 73 74 73 2d 71 75 65 75 65 2d 6e 65 77 2e tests-queue-new.
3890: 73 63 6d 22 29 0a 0a 3b 3b 20 70 61 72 65 6e 74 scm")..;; parent
38a0: 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 20 61 -test is there a
38b0: 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 72 20 s a placeholder
38c0: 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e 74 2d for when parent-
38d0: 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 75 6e tests can be run
38e0: 20 61 73 20 61 20 73 65 74 75 70 20 73 74 65 70 as a setup step
38f0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a 74 65 .(define (run:te
3900: 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d st run-id runnam
3910: 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 e keyvallst test
3920: 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 70 61 -record flags pa
3930: 72 65 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 rent-test). ;;
3940: 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d All these vars m
3950: 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e 63 ight be referenc
3960: 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63 6f ed by the testco
3970: 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65 72 nfig file reader
3980: 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d . (let* ((test-
3990: 6e 61 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74 name (tests:t
39a0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 estqueue-get-tes
39b0: 74 6e 61 6d 65 20 20 20 74 65 73 74 2d 72 65 63 tname test-rec
39c0: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 77 61 ord)).. (test-wa
39d0: 69 74 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 73 itons (tests:tes
39e0: 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f tqueue-get-waito
39f0: 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 ns test-recor
3a00: 64 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 d)).. (test-conf
3a10: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
3a20: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e ueue-get-testcon
3a30: 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 fig test-record)
3a40: 29 0a 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 ).. (itemdat
3a50: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
3a60: 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 ue-get-itemdat
3a70: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
3a80: 09 20 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 . (test-path
3a90: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
3aa0: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
3ab0: 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 ame)) ;; could u
3ac0: 73 65 20 74 65 73 74 73 3a 67 65 74 2d 74 65 73 se tests:get-tes
3ad0: 74 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e tconfig here ...
3ae0: 0a 09 20 28 66 6f 72 63 65 20 20 20 20 20 20 20 .. (force
3af0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
3b00: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 /default flags "
3b10: 2d 66 6f 72 63 65 22 20 23 66 29 29 0a 09 20 28 -force" #f)).. (
3b20: 72 65 72 75 6e 20 20 20 20 20 20 20 20 28 68 61 rerun (ha
3b30: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
3b40: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 72 65 72 ault flags "-rer
3b50: 75 6e 22 20 23 66 29 29 0a 09 20 28 6b 65 65 70 un" #f)).. (keep
3b60: 67 6f 69 6e 67 20 20 20 20 28 68 61 73 68 2d 74 going (hash-t
3b70: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
3b80: 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 flags "-keepgoi
3b90: 6e 67 22 20 23 66 29 29 0a 09 20 28 69 74 65 6d ng" #f)).. (item
3ba0: 2d 70 61 74 68 20 20 20 20 20 22 22 29 0a 09 20 -path "")..
3bb0: 28 64 62 20 20 20 20 20 20 20 20 20 20 20 23 66 (db #f
3bc0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
3bd0: 69 6e 74 20 34 0a 09 09 20 22 74 65 73 74 2d 63 int 4... "test-c
3be0: 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74 onfig: " (hash-t
3bf0: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 able->alist test
3c00: 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 -conf)... "\n
3c10: 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 itemdat: " itemd
3c20: 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 at... ). ;; s
3c30: 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74 etting itemdat t
3c40: 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69 o a list if it i
3c50: 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f s #f. (if (no
3c60: 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20 t itemdat)(set!
3c70: 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20 itemdat '())).
3c80: 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74 (set! item-pat
3c90: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 h (item-list->pa
3ca0: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20 th itemdat)).
3cb0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
3cc0: 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c "Attempting to l
3cd0: 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73 aunch test " tes
3ce0: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 t-name (if (equa
3cf0: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 l? item-path "/"
3d00: 29 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 ) "/" item-path)
3d10: 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d ). (setenv "M
3d20: 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 T_TEST_NAME" tes
3d30: 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 t-name) ;; .
3d40: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e (setenv "MT_RUNN
3d50: 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a AME" runname).
3d60: 20 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 (set-megates
3d70: 74 2d 65 6e 76 2d 76 61 72 73 20 72 75 6e 2d 69 t-env-vars run-i
3d80: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 d) ;; these may
3d90: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 be needed by the
3da0: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 launching proce
3db0: 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 ss. (change-d
3dc0: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 irectory *toppat
3dd0: 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 h*).. ;; Here
3de0: 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65 is where the te
3df0: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 st_meta table is
3e00: 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 best updated.
3e10: 20 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 ;; Yes, anothe
3e20: 72 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 r use of a globa
3e30: 6c 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e l for caching. N
3e40: 65 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79 eed a better way
3e50: 3f 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ?. (if (not (
3e60: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
3e70: 65 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 efault *test-met
3e80: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d a-updated* test-
3e90: 6e 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 name #f)).
3ea0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 (begin.. (ha
3eb0: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 sh-table-set! *t
3ec0: 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 est-meta-updated
3ed0: 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a * test-name #t).
3ee0: 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 (runs
3ef0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
3f00: 61 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 a test-name test
3f10: 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20 -conf))). .
3f20: 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 ;; (lambda (it
3f30: 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 emdat) ;;; ((rip
3f40: 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 eness "overripe"
3f50: 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 ) (temperature "
3f60: 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 cool") (season "
3f70: 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c summer")). (l
3f80: 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 et* ((new-test-p
3f90: 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 ath (string-inte
3fa0: 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 rsperse (cons te
3fb0: 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 st-path (map cad
3fc0: 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 r itemdat)) "/")
3fd0: 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d ).. (new-test-
3fe0: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f name (if (equal?
3ff0: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 item-path "") t
4000: 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 est-name (conc t
4010: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 est-name "/" ite
4020: 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 m-path))) ;; jus
4030: 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 t need it to be
4040: 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74 unique.. (test
4050: 2d 69 64 20 20 20 20 20 20 20 28 63 64 62 3a 72 -id (cdb:r
4060: 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a 67 65 74 emote-run db:get
4070: 2d 74 65 73 74 2d 69 64 20 23 66 20 20 72 75 6e -test-id #f run
4080: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
4090: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 em-path)).. (t
40a0: 65 73 74 64 61 74 20 20 20 20 20 20 20 28 63 64 estdat (cd
40b0: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d b:get-test-info-
40c0: 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f 74 65 by-id *runremote
40d0: 2a 20 74 65 73 74 2d 69 64 29 29 29 0a 20 20 20 * test-id))).
40e0: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 (if (not test
40f0: 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 dat).. (begin..
4100: 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 ;; ensure th
4110: 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69 73 at the path exis
4120: 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 ts before regist
4130: 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 ering the test..
4140: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e ;; NOPE: Can
4150: 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 not! Don't know
4160: 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20 61 yet which disk a
4170: 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69 rea will be assi
4180: 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b gned...... ;;
4190: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 (system (conc "
41a0: 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 mkdir -p " new-t
41b0: 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 est-path))..
41c0: 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65 6e ;;.. ;; (open
41d0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 -run-close tests
41e0: 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 :register-test d
41f0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
4200: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 me item-path)..
4210: 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 ;;.. ;; NB
4220: 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f 76 65 // for the above
4230: 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20 74 68 line. I want th
4240: 65 20 74 65 73 74 20 74 6f 20 62 65 20 72 65 67 e test to be reg
4250: 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62 65 66 istered long bef
4260: 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69 6e 65 ore this routine
4270: 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a 09 20 gets called!..
4280: 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65 74 21 ;;.. (set!
4290: 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 test-id (open-r
42a0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
42b0: 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 test-id db run-i
42c0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
42d0: 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28 69 66 -path)).. (if
42e0: 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a 09 (not test-id)..
42f0: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 .(begin... (deb
4300: 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41 52 4e ug:print 2 "WARN
4310: 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65 2d 63 : Test not pre-c
4320: 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e 61 6d reated? test-nam
4330: 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c e=" test-name ",
4340: 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69 74 65 item-path=" ite
4350: 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d 69 64 m-path ", run-id
4360: 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 28 =" run-id)... (
4370: 63 64 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 cdb:tests-regist
4380: 65 72 2d 74 65 73 74 20 2a 72 75 6e 72 65 6d 6f er-test *runremo
4390: 74 65 2a 20 72 75 6e 2d 69 64 20 74 65 73 74 2d te* run-id test-
43a0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a name item-path).
43b0: 09 09 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 .. (set! test-i
43c0: 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 d (open-run-clos
43d0: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 64 e db:get-test-id
43e0: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
43f0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 name item-path))
4400: 29 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 )).. (debug:p
4410: 72 69 6e 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 rint-info 4 "tes
4420: 74 2d 69 64 3d 22 20 74 65 73 74 2d 69 64 20 22 t-id=" test-id "
4430: 2c 20 72 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 , run-id=" run-i
4440: 64 20 22 2c 20 74 65 73 74 2d 6e 61 6d 65 3d 22 d ", test-name="
4450: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c 20 69 74 test-name ", it
4460: 65 6d 2d 70 61 74 68 3d 5c 22 22 20 69 74 65 6d em-path=\"" item
4470: 2d 70 61 74 68 20 22 5c 22 22 29 0a 09 20 20 20 -path "\"")..
4480: 20 28 73 65 74 21 20 74 65 73 74 64 61 74 20 28 (set! testdat (
4490: 63 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 cdb:get-test-inf
44a0: 6f 2d 62 79 2d 69 64 20 2a 72 75 6e 72 65 6d 6f o-by-id *runremo
44b0: 74 65 2a 20 74 65 73 74 2d 69 64 29 29 29 29 0a te* test-id)))).
44c0: 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 (set! test
44d0: 2d 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 -id (db:test-get
44e0: 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 -id testdat)).
44f0: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 (change-dire
4500: 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 ctory test-path)
4510: 0a 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 . (case (if
4520: 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a force ;; (args:
4530: 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 get-arg "-force"
4540: 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 )...'NOT_STARTED
4550: 0a 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 ...(if testdat..
4560: 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 . (string->sy
4570: 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 mbol (test:get-s
4580: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 tate testdat))..
4590: 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d . 'failed-to-
45a0: 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c insert))..((fail
45b0: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 ed-to-insert)..
45c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
45d0: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
45e0: 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f insert the reco
45f0: 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 rd into the db")
4600: 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 )..((NOT_STARTED
4610: 20 43 4f 4d 50 4c 45 54 45 44 20 44 45 4c 45 54 COMPLETED DELET
4620: 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e ED).. (let ((run
4630: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 flag #f)).. (c
4640: 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 ond.. ;; -for
4650: 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 ce, run no matte
4660: 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 r what.. (for
4670: 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 ce (set! runflag
4680: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f #t)).. ;; NO
4690: 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e T_STARTED, run n
46a0: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 o matter what..
46b0: 20 20 20 28 28 6d 65 6d 62 65 72 20 28 74 65 73 ((member (tes
46c0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
46d0: 64 61 74 29 20 27 28 22 44 45 4c 45 54 45 44 22 dat) '("DELETED"
46e0: 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 29 "NOT_STARTED"))
46f0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
4700: 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d )).. ;; not -
4710: 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 rerun and PASS,
4720: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 WARN or CHECK, d
4730: 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 o no run.. ((
4740: 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 and (or (not rer
4750: 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70 un)... keep
4760: 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 going)... ;; Re
4770: 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72 quire to force r
4780: 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 e-run for COMPLE
4790: 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 TED or *anything
47a0: 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 * + PASS,WARN or
47b0: 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 CHECK... (or (
47c0: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 member (test:get
47d0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
47e0: 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 '("PASS" "WARN"
47f0: 20 22 43 48 45 43 4b 22 20 22 53 4b 49 50 22 29 "CHECK" "SKIP")
4800: 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 )... (membe
4810: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
4820: 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43 e testdat) '("C
4830: 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 OMPLETED")))) ..
4840: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
4850: 74 2d 69 6e 66 6f 20 32 20 22 72 75 6e 6e 69 6e t-info 2 "runnin
4860: 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 g test " test-na
4870: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 me "/" item-path
4880: 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61 73 " suppressed as
4890: 20 69 74 20 69 73 20 22 20 28 74 65 73 74 3a 67 it is " (test:g
48a0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
48b0: 29 20 22 20 61 6e 64 20 22 20 28 74 65 73 74 3a ) " and " (test:
48c0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
48d0: 61 74 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 at)).. (set!
48e0: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 runflag #f))..
48f0: 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 ;; -rerun and
4900: 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f status is one o
4910: 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 f the specifed,
4920: 72 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e run it.. ((an
4930: 64 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 d rerun... (let
4940: 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28 * ((rerunlst (
4950: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 string-split rer
4960: 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 un ",")).... (mu
4970: 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 st-rerun (member
4980: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
4990: 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e s testdat) rerun
49a0: 6c 73 74 29 29 29 0a 09 09 20 20 20 20 28 64 65 lst)))... (de
49b0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 33 bug:print-info 3
49c0: 20 22 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 "-rerun list: "
49d0: 20 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 rerun ", test-s
49e0: 74 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 tatus: " (test:g
49f0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
4a00: 74 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a t)", must-rerun:
4a10: 20 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 " must-rerun)..
4a20: 09 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 . must-rerun)
4a30: 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 ).. (debug:p
4a40: 72 69 6e 74 2d 69 6e 66 6f 20 32 20 22 52 65 72 rint-info 2 "Rer
4a50: 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 un forced for te
4a60: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
4a70: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 /" item-path)..
4a80: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 (set! runfla
4a90: 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d g #t)).. ;; -
4aa0: 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f keepgoing, do no
4ab0: 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 t rerun FAIL..
4ac0: 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e ((and keepgoin
4ad0: 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 g... (member (t
4ae0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
4af0: 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 estdat) '("FAIL"
4b00: 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 ))).. (set!
4b10: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 runflag #f))..
4b20: 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 ((and (not rer
4b30: 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 un)... (member
4b40: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
4b50: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 testdat) '("FAI
4b60: 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 L" "n/a")))..
4b70: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 (set! runflag
4b80: 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 #t)).. (else
4b90: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
4ba0: 29 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 ))).. (debug:p
4bb0: 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 rint 6 "RUNNING
4bc0: 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 => runflag: " ru
4bd0: 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 nflag " STATE: "
4be0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
4bf0: 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 testdat) " STAT
4c00: 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d US: " (test:get-
4c10: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 status testdat))
4c20: 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 .. (if (not ru
4c30: 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 nflag).. (
4c40: 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 if (not parent-t
4c50: 65 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 est)... (debug
4c60: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 :print 1 "NOTE:
4c70: 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 Not starting tes
4c80: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d t " new-test-nam
4c90: 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 e " as it is sta
4ca0: 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 te \"" (test:get
4cb0: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 -state testdat)
4cc0: 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 ....."\" and sta
4cd0: 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 tus \"" (test:ge
4ce0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
4cf0: 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 ) "\", use -reru
4d00: 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d n \"" (test:get-
4d10: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 0a status testdat).
4d20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4d30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4d40: 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f "\" or -force to
4d50: 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 override"))..
4d60: 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f ;; NOTE: No
4d70: 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b longer be check
4d80: 69 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 65 ing prerequisite
4d90: 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 s here! Will nev
4da0: 65 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 er get here unle
4db0: 73 73 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 ss prereqs are..
4dc0: 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ;;
4dd0: 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 already met...
4de0: 20 20 20 20 20 3b 3b 20 54 68 69 73 20 77 6f 75 ;; This wou
4df0: 6c 64 20 62 65 20 61 20 67 72 65 61 74 20 70 6c ld be a great pl
4e00: 61 63 65 20 74 6f 20 64 6f 20 74 68 65 20 70 72 ace to do the pr
4e10: 6f 63 65 73 73 2d 66 6f 72 6b 0a 09 20 20 20 20 ocess-fork..
4e20: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 (if (not (lau
4e30: 6e 63 68 2d 74 65 73 74 20 23 66 20 72 75 6e 2d nch-test #f run-
4e40: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
4e50: 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 conf keyvallst t
4e60: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 est-name test-pa
4e70: 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 th itemdat flags
4e80: 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 ))... (begin..
4e90: 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 . (print "ER
4ea0: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c ROR: Failed to l
4eb0: 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 aunch the test.
4ec0: 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 Exiting as soon
4ed0: 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 as possible")...
4ee0: 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 (set! *glob
4ef0: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 alexitstatus* 1)
4f00: 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f ;; ... (pro
4f10: 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 cess-signal (cur
4f20: 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 rent-process-id)
4f30: 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 signal/kill))))
4f40: 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 ))..((KILLED) ..
4f50: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
4f60: 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 "NOTE: " new-tes
4f70: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 t-name " is alre
4f80: 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 ady running or w
4f90: 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c as explictly kil
4fa0: 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 led, use -force
4fb0: 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 to launch it."))
4fc0: 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d ..((LAUNCHED REM
4fd0: 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e OTEHOSTSTART RUN
4fe0: 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e NING) .. (if (>
4ff0: 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 (- (current-sec
5000: 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 onds)(+ (db:test
5010: 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 -get-event_time
5020: 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 testdat).....
5030: 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 (db:test-get
5040: 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 -run_duration te
5050: 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 stdat)))...600)
5060: 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 ;; i.e. no updat
5070: 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 e for more than
5080: 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 600 seconds..
5090: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 (begin..
50a0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
50b0: 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 "WARNING: Test "
50c0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 test-name " app
50d0: 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e ears to be dead.
50e0: 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 Forcing it to s
50f0: 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 tate INCOMPLETE
5100: 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b and status STUCK
5110: 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 /DEAD")..
5120: 28 74 65 73 74 73 3a 74 65 73 74 2d 73 65 74 2d (tests:test-set-
5130: 73 74 61 74 75 73 21 20 74 65 73 74 2d 69 64 20 status! test-id
5140: 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 "INCOMPLETE" "ST
5150: 55 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20 UCK/DEAD" "Test
5160: 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 is stuck or dead
5170: 22 20 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 " #f)).. (de
5180: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 bug:print 2 "NOT
5190: 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 E: " test-name "
51a0: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e is already runn
51b0: 69 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 ing")))..(else
51c0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
51d0: 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c t 0 "ERROR: Fail
51e0: 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 ed to launch tes
51f0: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d t " new-test-nam
5200: 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 e ". Unrecognise
5210: 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74 3a d state " (test:
5220: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
5230: 74 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d t)))))))..;;====
5240: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5280: 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 ==.;; END OF NEW
5290: 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d STUFF.;;=======
52a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
52b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
52c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
52d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
52e0: 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 .(define (get-di
52f0: 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 r-up-n dir . par
5300: 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 ams) . (let ((d
5310: 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 parts (string-s
5320: 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 plit dir "/"))..
5330: 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 (count (if (nu
5340: 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 ll? params) 1 (c
5350: 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 ar params)))).
5360: 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 (conc "/" (str
5370: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
5380: 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 .. (take d
5390: 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 parts (- (length
53a0: 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 dparts) count))
53b0: 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 .. "/"))))
53c0: 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a .;; Remove runs.
53d0: 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 ;; fields are pa
53e0: 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 ssing in through
53f0: 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 .;; action:.;;
5400: 20 20 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 'remove-runs.
5410: 3b 3b 20 20 20 20 27 73 65 74 2d 73 74 61 74 65 ;; 'set-state
5420: 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 -status.;;.;; NB
5430: 2f 2f 20 73 68 6f 75 6c 64 20 70 61 73 73 20 69 // should pass i
5440: 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 n keys?.;;.(defi
5450: 6e 65 20 28 72 75 6e 73 3a 6f 70 65 72 61 74 65 ne (runs:operate
5460: 2d 6f 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 -on action runna
5470: 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74 20 mepatt testpatt
5480: 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 66 29 #!key (state #f)
5490: 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 77 2d (status #f)(new-
54a0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66 29 state-status #f)
54b0: 29 0a 20 20 28 63 6f 6d 6d 6f 6e 3a 63 6c 65 61 ). (common:clea
54c0: 72 2d 63 61 63 68 65 73 29 20 3b 3b 20 63 6c 65 r-caches) ;; cle
54d0: 61 72 20 61 6c 6c 20 63 61 63 68 65 73 0a 20 20 ar all caches.
54e0: 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 20 20 (let* ((db
54f0: 20 20 20 20 20 23 66 29 0a 09 20 28 6b 65 79 73 #f).. (keys
5500: 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 (open-r
5510: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
5520: 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e keys db)).. (run
5530: 64 61 74 20 20 20 20 20 20 20 28 6f 70 65 6e 2d dat (open-
5540: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 run-close runs:g
5550: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 et-runs-by-patt
5560: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 db keys runnamep
5570: 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 att)).. (header
5580: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 (vector-re
5590: 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 f rundat 0)).. (
55a0: 72 75 6e 73 20 20 20 20 20 20 20 20 20 28 76 65 runs (ve
55b0: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 ctor-ref rundat
55c0: 31 29 29 0a 09 20 28 73 74 61 74 65 73 20 20 20 1)).. (states
55d0: 20 20 20 20 28 69 66 20 73 74 61 74 65 20 20 28 (if state (
55e0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 string-split sta
55f0: 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 0a 09 te ",") '()))..
5600: 20 28 73 74 61 74 75 73 65 73 20 20 20 20 20 28 (statuses (
5610: 69 66 20 73 74 61 74 75 73 20 28 73 74 72 69 6e if status (strin
5620: 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20 22 g-split status "
5630: 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 ,") '())).. (sta
5640: 74 65 2d 73 74 61 74 75 73 20 28 69 66 20 28 73 te-status (if (s
5650: 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65 tring? new-state
5660: 2d 73 74 61 74 75 73 29 20 28 73 74 72 69 6e 67 -status) (string
5670: 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 61 74 65 -split new-state
5680: 2d 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 23 -status ",") '(#
5690: 66 20 23 66 29 29 29 29 0a 20 20 20 20 28 64 65 f #f)))). (de
56a0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 bug:print-info 4
56b0: 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f "runs:operate-o
56c0: 6e 20 3d 3e 20 48 65 61 64 65 72 3a 20 22 20 68 n => Header: " h
56d0: 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 eader " action:
56e0: 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 " action " new-s
56f0: 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 20 6e tate-status: " n
5700: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 ew-state-status)
5710: 0a 20 20 20 20 28 69 66 20 28 3e 20 32 20 28 6c . (if (> 2 (l
5720: 65 6e 67 74 68 20 73 74 61 74 65 2d 73 74 61 74 ength state-stat
5730: 75 73 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 us))..(begin..
5740: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
5750: 45 52 52 4f 52 3a 20 74 68 65 20 70 61 72 61 6d ERROR: the param
5760: 65 74 65 72 20 74 6f 20 2d 73 65 74 2d 73 74 61 eter to -set-sta
5770: 74 65 2d 73 74 61 74 75 73 20 69 73 20 61 20 63 te-status is a c
5780: 6f 6d 6d 61 20 64 65 6c 69 6d 69 74 65 64 20 73 omma delimited s
5790: 74 72 69 6e 67 2e 20 45 2e 67 2e 20 43 4f 4d 50 tring. E.g. COMP
57a0: 4c 45 54 45 44 2c 46 41 49 4c 22 29 0a 09 20 20 LETED,FAIL")..
57b0: 28 65 78 69 74 29 29 29 0a 20 20 20 20 28 66 6f (exit))). (fo
57c0: 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d r-each. (lam
57d0: 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 bda (run).
57e0: 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 (let ((runkey (
57f0: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
5800: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 se (map (lambda
5810: 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 (k).......(db:ge
5820: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
5830: 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 r run header (ve
5840: 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 ctor-ref k 0)))
5850: 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 keys) "/"))..
5860: 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 (dirs-to-remov
5870: 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 e (make-hash-tab
5880: 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 le))).. (let* ((
5890: 72 75 6e 2d 69 64 20 20 20 20 28 64 62 3a 67 65 run-id (db:ge
58a0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
58b0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
58c0: 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 61 74 65 "))...(run-state
58d0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
58e0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
58f0: 64 65 72 20 22 73 74 61 74 65 22 29 29 0a 09 09 der "state"))...
5900: 28 74 65 73 74 73 20 20 20 20 20 28 69 66 20 28 (tests (if (
5910: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d not (equal? run-
5920: 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 22 29 29 state "locked"))
5930: 0a 09 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e .... (open
5940: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 -run-close db:ge
5950: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
5960: 64 62 20 72 75 6e 2d 69 64 0a 09 09 09 09 09 09 db run-id.......
5970: 20 20 20 20 20 20 74 65 73 74 70 61 74 74 20 73 testpatt s
5980: 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 tates statuses..
5990: 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 ..... not-i
59a0: 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 n: #f.......
59b0: 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 sort-by: (cas
59c0: 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 e action........
59d0: 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 . ((remove-runs)
59e0: 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 'rundir).......
59f0: 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 .. (else
5a00: 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 'event_time)))
5a10: 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29 29 .... '()))
5a20: 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f ...(lasttpath "/
5a30: 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 does/not/exist/I
5a40: 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 28 64 65 /hope")).. (de
5a50: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 34 bug:print-info 4
5a60: 20 22 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f "runs:operate-o
5a70: 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 68 n run=" run ", h
5a80: 65 61 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a eader=" header).
5a90: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 . (if (not (nu
5aa0: 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 ll? tests))..
5ab0: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 (begin... (c
5ac0: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 ase action...
5ad0: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 ((remove-runs)..
5ae0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
5af0: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 t 1 "Removing te
5b00: 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 sts for run: " r
5b10: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 unkey " " (db:ge
5b20: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
5b30: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 r run header "ru
5b40: 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 nname")))... (
5b50: 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 (set-state-statu
5b60: 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a s)... (debug:
5b70: 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 print 1 "Modifyi
5b80: 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 ng state and sta
5b90: 75 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 us for tests for
5ba0: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 run: " runkey "
5bb0: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 " (db:get-value
5bc0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
5bd0: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 eader "runname")
5be0: 29 29 0a 09 09 20 20 20 28 28 70 72 69 6e 74 2d ))... ((print-
5bf0: 72 75 6e 29 0a 09 09 20 20 20 20 28 64 65 62 75 run)... (debu
5c00: 67 3a 70 72 69 6e 74 20 31 20 22 50 72 69 6e 74 g:print 1 "Print
5c10: 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72 75 6e ing info for run
5c20: 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 72 75 6e " runkey ", run
5c30: 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 74 73 3d =" run ", tests=
5c40: 22 20 74 65 73 74 73 20 22 2c 20 68 65 61 64 65 " tests ", heade
5c50: 72 3d 22 20 68 65 61 64 65 72 29 0a 09 09 20 20 r=" header)...
5c60: 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 28 action)... (
5c70: 65 6c 73 65 0a 09 09 20 20 20 20 28 64 65 62 75 else... (debu
5c80: 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 30 20 22 g:print-info 0 "
5c90: 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 action not recog
5ca0: 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e 29 29 nised " action))
5cb0: 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 )... (for-each..
5cc0: 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 . (lambda (test
5cd0: 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 )... (let* ((
5ce0: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 item-path (db:te
5cf0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
5d00: 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 test)).... (t
5d10: 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 est-name (db:tes
5d20: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
5d30: 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e est)).... (run
5d40: 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d -dir (db:test-
5d50: 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 get-rundir test)
5d60: 29 20 20 20 20 3b 3b 20 72 75 6e 20 64 69 72 20 ) ;; run dir
5d70: 69 73 20 66 72 6f 6d 20 74 68 65 20 6c 69 6e 6b is from the link
5d80: 20 74 72 65 65 0a 09 09 09 20 20 20 28 72 65 61 tree.... (rea
5d90: 6c 2d 64 69 72 20 20 28 69 66 20 28 66 69 6c 65 l-dir (if (file
5da0: 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 -exists? run-dir
5db0: 29 0a 09 09 09 09 09 20 20 28 72 65 73 6f 6c 76 )...... (resolv
5dc0: 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 e-pathname run-d
5dd0: 69 72 29 0a 09 09 09 09 09 20 20 23 66 29 29 0a ir)...... #f)).
5de0: 09 09 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 ... (test-id
5df0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
5e00: 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 test)))...
5e10: 20 3b 3b 20 20 20 28 74 64 62 20 20 20 20 20 20 ;; (tdb
5e20: 20 28 64 62 3a 6f 70 65 6e 2d 74 65 73 74 2d 64 (db:open-test-d
5e30: 62 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 20 b run-dir)))...
5e40: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
5e50: 74 2d 69 6e 66 6f 20 34 20 22 74 65 73 74 3d 22 t-info 4 "test="
5e60: 20 74 65 73 74 29 20 3b 3b 20 20 20 22 20 28 64 test) ;; " (d
5e70: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
5e80: 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 ame test) " id:
5e90: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
5ea0: 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65 6d d test) " " item
5eb0: 2d 70 61 74 68 20 22 20 61 63 74 69 6f 6e 3a 20 -path " action:
5ec0: 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 20 " action)...
5ed0: 20 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 (case action..
5ee0: 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 ..((remove-runs)
5ef0: 20 3b 3b 20 74 68 65 20 74 64 62 20 69 73 20 66 ;; the tdb is f
5f00: 6f 72 20 66 75 74 75 72 65 20 70 6f 73 73 69 62 or future possib
5f10: 6c 65 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d 72 le. .... (open-r
5f20: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 un-close db:dele
5f30: 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 te-test-records
5f40: 64 62 20 23 66 20 28 64 62 3a 74 65 73 74 2d 67 db #f (db:test-g
5f50: 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 09 et-id test))....
5f60: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e (debug:print-in
5f70: 66 6f 20 31 20 22 41 74 74 65 6d 70 74 69 6e 67 fo 1 "Attempting
5f80: 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 28 69 66 to remove " (if
5f90: 20 72 65 61 6c 2d 64 69 72 20 28 63 6f 6e 63 20 real-dir (conc
5fa0: 22 20 64 69 72 20 22 20 72 65 61 6c 2d 64 69 72 " dir " real-dir
5fb0: 20 22 20 61 6e 64 20 22 29 20 22 22 29 20 22 20 " and ") "") "
5fc0: 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a link " run-dir).
5fd0: 09 09 09 20 28 69 66 20 28 61 6e 64 20 72 65 61 ... (if (and rea
5fe0: 6c 2d 64 69 72 20 0a 09 09 09 09 20 20 28 3e 20 l-dir ..... (>
5ff0: 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 (string-length r
6000: 65 61 6c 2d 64 69 72 29 20 35 29 0a 09 09 09 09 eal-dir) 5).....
6010: 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 (file-exists?
6020: 72 65 61 6c 2d 64 69 72 29 29 20 3b 3b 20 62 61 real-dir)) ;; ba
6030: 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74 20 d heuristic but
6040: 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f should prevent /
6050: 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 tmp /home etc...
6060: 09 09 20 20 20 20 20 28 62 65 67 69 6e 20 3b 3b .. (begin ;;
6070: 20 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74 68 let* ((realpath
6080: 20 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 (resolve-pathna
6090: 6d 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 me run-dir)))...
60a0: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
60b0: 72 69 6e 74 2d 69 6e 66 6f 20 31 20 22 52 65 63 rint-info 1 "Rec
60c0: 75 72 73 69 76 65 6c 79 20 72 65 6d 6f 76 69 6e ursively removin
60d0: 67 20 22 20 72 65 61 6c 2d 64 69 72 29 0a 09 09 g " real-dir)...
60e0: 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69 6c . (if (fil
60f0: 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c 2d 64 e-exists? real-d
6100: 69 72 29 0a 09 09 09 09 20 20 20 28 69 66 20 28 ir)..... (if (
6110: 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 > (system (conc
6120: 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c 2d 64 "rm -rf " real-d
6130: 69 72 29 29 20 30 29 0a 09 09 09 09 20 20 20 20 ir)) 0).....
6140: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6150: 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 65 20 0 "ERROR: There
6160: 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 72 65 was a problem re
6170: 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 2d 64 69 moving " real-di
6180: 72 20 22 20 77 69 74 68 20 72 6d 20 2d 66 22 29 r " with rm -f")
6190: 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 67 3a )..... (debug:
61a0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 print 0 "WARNING
61b0: 3a 20 74 65 73 74 20 64 69 72 20 22 20 72 65 61 : test dir " rea
61c0: 6c 2d 64 69 72 20 22 20 61 70 70 65 61 72 73 20 l-dir " appears
61d0: 74 6f 20 6e 6f 74 20 65 78 69 73 74 20 6f 72 20 to not exist or
61e0: 69 73 20 6e 6f 74 20 72 65 61 64 61 62 6c 65 22 is not readable"
61f0: 29 29 29 0a 09 09 09 20 20 20 20 20 28 69 66 20 ))).... (if
6200: 72 65 61 6c 2d 64 69 72 20 0a 09 09 09 09 20 28 real-dir ..... (
6210: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
6220: 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 ARNING: director
6230: 79 20 22 20 72 65 61 6c 2d 64 69 72 20 22 20 64 y " real-dir " d
6240: 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 22 29 0a oes not exist").
6250: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e .... (debug:prin
6260: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 6e 6f t 0 "WARNING: no
6270: 20 72 65 61 6c 20 64 69 72 65 63 74 6f 72 79 20 real directory
6280: 63 6f 72 72 6f 73 70 6f 6e 64 69 6e 67 20 74 6f corrosponding to
6290: 20 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 20 link " run-dir
62a0: 22 2c 20 6e 6f 74 68 69 6e 67 20 64 6f 6e 65 22 ", nothing done"
62b0: 29 29 29 0a 09 09 09 20 28 69 66 20 28 73 79 6d ))).... (if (sym
62c0: 62 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d bolic-link? run-
62d0: 64 69 72 29 0a 09 09 09 20 20 20 20 20 28 62 65 dir).... (be
62e0: 67 69 6e 0a 09 09 09 20 20 20 20 20 20 20 28 64 gin.... (d
62f0: 65 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 ebug:print-info
6300: 31 20 22 52 65 6d 6f 76 69 6e 67 20 73 79 6d 6c 1 "Removing syml
6310: 69 6e 6b 20 22 20 72 75 6e 2d 64 69 72 29 0a 09 ink " run-dir)..
6320: 09 09 20 20 20 20 20 20 20 28 68 61 6e 64 6c 65 .. (handle
6330: 2d 65 78 63 65 70 74 69 6f 6e 73 0a 09 09 09 09 -exceptions.....
6340: 65 78 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70 exn.....(debug:p
6350: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 20 rint 0 "ERROR:
6360: 46 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 Failed to remove
6370: 20 73 79 6d 6c 69 6e 6b 20 22 20 72 75 6e 2d 64 symlink " run-d
6380: 69 72 20 28 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 ir ((condition-p
6390: 72 6f 70 65 72 74 79 2d 61 63 63 65 73 73 6f 72 roperty-accessor
63a0: 20 27 65 78 6e 20 27 6d 65 73 73 61 67 65 29 20 'exn 'message)
63b0: 65 78 6e 29 20 22 2c 20 61 74 74 65 6d 70 74 69 exn) ", attempti
63c0: 6e 67 20 74 6f 20 63 6f 6e 74 69 6e 75 65 22 29 ng to continue")
63d0: 0a 09 09 09 09 28 64 65 6c 65 74 65 2d 66 69 6c .....(delete-fil
63e0: 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 e run-dir)))....
63f0: 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74 (if (direct
6400: 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 ory? run-dir)...
6410: 09 09 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 .. (if (> (direc
6420: 74 6f 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 tory-fold (lambd
6430: 61 20 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 a (f x)(+ 1 x))
6440: 30 20 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 0 run-dir) 0)...
6450: 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 .. (debug:pr
6460: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
6470: 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f refusing to remo
6480: 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 ve " run-dir " a
6490: 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 74 s it is not empt
64a0: 79 22 29 0a 09 09 09 09 20 20 20 20 20 20 28 68 y")..... (h
64b0: 61 6e 64 6c 65 2d 65 78 63 65 70 74 69 6f 6e 73 andle-exceptions
64c0: 0a 09 09 09 09 20 20 20 20 20 20 20 65 78 6e 0a ..... exn.
64d0: 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62 75 .... (debu
64e0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
64f0: 3a 20 20 46 61 69 6c 65 64 20 74 6f 20 72 65 6d : Failed to rem
6500: 6f 76 65 20 64 69 72 65 63 74 6f 72 79 20 22 20 ove directory "
6510: 72 75 6e 2d 64 69 72 20 28 28 63 6f 6e 64 69 74 run-dir ((condit
6520: 69 6f 6e 2d 70 72 6f 70 65 72 74 79 2d 61 63 63 ion-property-acc
6530: 65 73 73 6f 72 20 27 65 78 6e 20 27 6d 65 73 73 essor 'exn 'mess
6540: 61 67 65 29 20 65 78 6e 29 20 22 2c 20 61 74 74 age) exn) ", att
6550: 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f 6e 74 69 empting to conti
6560: 6e 75 65 22 29 0a 09 09 09 09 20 20 20 20 20 20 nue").....
6570: 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f (delete-directo
6580: 72 79 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 ry run-dir)))...
6590: 09 09 20 28 69 66 20 72 75 6e 2d 64 69 72 0a 09 .. (if run-dir..
65a0: 09 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 ... (debug:p
65b0: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
65c0: 20 6e 6f 74 20 72 65 6d 6f 76 69 6e 67 20 22 20 not removing "
65d0: 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 run-dir " as it
65e0: 65 69 74 68 65 72 20 64 6f 65 73 6e 27 74 20 65 either doesn't e
65f0: 78 69 73 74 20 6f 72 20 69 73 20 6e 6f 74 20 61 xist or is not a
6600: 20 73 79 6d 6c 69 6e 6b 22 29 0a 09 09 09 09 20 symlink").....
6610: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
6620: 20 30 20 22 4e 4f 54 45 3a 20 74 68 65 20 72 75 0 "NOTE: the ru
6630: 6e 20 64 69 72 20 66 6f 72 20 74 68 69 73 20 74 n dir for this t
6640: 65 73 74 20 69 73 20 75 6e 64 65 66 69 6e 65 64 est is undefined
6650: 2e 20 54 65 73 74 20 6d 61 79 20 68 61 76 65 20 . Test may have
6660: 61 6c 72 65 61 64 79 20 62 65 65 6e 20 64 65 6c already been del
6670: 65 74 65 64 2e 22 29 29 0a 09 09 09 09 20 29 29 eted."))..... ))
6680: 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74 65 )....((set-state
6690: 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 64 65 -status).... (de
66a0: 62 75 67 3a 70 72 69 6e 74 2d 69 6e 66 6f 20 32 bug:print-info 2
66b0: 20 22 6e 65 77 20 73 74 61 74 65 20 22 20 28 63 "new state " (c
66c0: 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 ar state-status)
66d0: 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 20 22 ", new status "
66e0: 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 (cadr state-sta
66f0: 74 75 73 29 29 0a 09 09 09 20 28 6f 70 65 6e 2d tus)).... (open-
6700: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 run-close db:tes
6710: 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 t-set-state-stat
6720: 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64 62 3a us-by-id db (db:
6730: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
6740: 29 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 ) (car state-sta
6750: 74 75 73 29 28 63 61 64 72 20 73 74 61 74 65 2d tus)(cadr state-
6760: 73 74 61 74 75 73 29 20 23 66 29 29 29 29 29 0a status) #f))))).
6770: 09 09 20 20 28 73 6f 72 74 20 74 65 73 74 73 20 .. (sort tests
6780: 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 6c 65 (lambda (a b)(le
6790: 74 20 28 28 64 69 72 61 20 28 64 62 3a 74 65 73 t ((dira (db:tes
67a0: 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 61 29 29 t-get-rundir a))
67b0: 0a 09 09 09 09 09 09 20 28 64 69 72 62 20 28 64 ....... (dirb (d
67c0: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 b:test-get-rundi
67d0: 72 20 62 29 29 29 0a 09 09 09 09 09 20 20 20 20 r b)))......
67e0: 20 28 69 66 20 28 61 6e 64 20 28 73 74 72 69 6e (if (and (strin
67f0: 67 3f 20 64 69 72 61 29 28 73 74 72 69 6e 67 3f g? dira)(string?
6800: 20 64 69 72 62 29 29 0a 09 09 09 09 09 09 20 28 dirb))....... (
6810: 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 > (string-length
6820: 20 64 69 72 61 29 28 73 74 72 69 6e 67 2d 6c 65 dira)(string-le
6830: 6e 67 74 68 20 64 69 72 62 29 29 0a 09 09 09 09 ngth dirb)).....
6840: 09 09 20 23 66 29 29 29 29 29 29 29 0a 09 20 20 .. #f)))))))..
6850: 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 ;; remove the r
6860: 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 un if zero tests
6870: 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 remain.. (if
6880: 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d (eq? action 'rem
6890: 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 ove-runs)..
68a0: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 (let ((remtest
68b0: 73 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 s (open-run-clos
68c0: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 e db:get-tests-f
68d0: 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 or-run db (db:ge
68e0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
68f0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
6900: 22 29 20 23 66 20 27 28 22 44 45 4c 45 54 45 44 ") #f '("DELETED
6910: 22 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74 2d ") '("n/a") not-
6920: 69 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 69 66 in: #t)))... (if
6930: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 (null? remtests
6940: 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 ) ;; no more tes
6950: 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 ts remaining...
6960: 20 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61 72 (let* ((dpar
6970: 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ts (string-spli
6980: 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 t lasttpath "/")
6990: 29 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61 74 ).... (runpat
69a0: 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 h (conc "/" (str
69b0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
69c0: 0a 09 09 09 09 09 09 28 74 61 6b 65 20 64 70 61 .......(take dpa
69d0: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 rts (- (length d
69e0: 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 parts) 1))......
69f0: 09 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20 20 ."/"))))...
6a00: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
6a10: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 "Removing run:
6a20: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
6a30: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
6a40: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
6a50: 22 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e 64 "runname") " and
6a60: 20 72 65 6c 61 74 65 64 20 72 65 63 6f 72 64 22 related record"
6a70: 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e )... (open
6a80: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 -run-close db:de
6a90: 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d lete-run db run-
6aa0: 69 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 id)... ;;
6ab0: 54 68 69 73 20 69 73 20 61 20 70 72 65 74 74 79 This is a pretty
6ac0: 20 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20 70 good place to p
6ad0: 75 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 45 44 urge old DELETED
6ae0: 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 20 20 tests...
6af0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
6b00: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d db:delete-tests-
6b10: 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 for-run db run-i
6b20: 64 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 d)... (ope
6b30: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 n-run-close db:d
6b40: 65 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 elete-old-delete
6b50: 64 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 d-test-records d
6b60: 62 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 b)... (ope
6b70: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 n-run-close db:s
6b80: 65 74 2d 76 61 72 20 64 62 20 22 44 45 4c 45 54 et-var db "DELET
6b90: 45 44 5f 54 45 53 54 53 22 20 28 63 75 72 72 65 ED_TESTS" (curre
6ba0: 6e 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09 20 nt-seconds))...
6bb0: 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f ;; need to
6bc0: 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 figure out the
6bd0: 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 path to the run
6be0: 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 dir and remove i
6bf0: 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 t if empty...
6c00: 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e ;; (if (n
6c10: 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ull? (glob (conc
6c20: 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 runpath "/*")))
6c30: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 ... ;;
6c40: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 (begin...
6c50: 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a ;; . (debug:
6c60: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e print 1 "Removin
6c70: 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 g run dir " runp
6c80: 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b 3b ath)... ;;
6c90: 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 . (system (conc
6ca0: 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e "rmdir -p " run
6cb0: 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20 20 path))))...
6cc0: 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20 20 ))))).. )).
6cd0: 20 20 72 75 6e 73 29 29 0a 20 20 23 74 29 0a 0a runs)). #t)..
6ce0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
6cf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d20: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 ========.;; Rout
6d30: 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c ines for manipul
6d40: 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d ating runs.;;===
6d50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d90: 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 ===..;; Since ma
6da0: 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 ny calls to a ru
6db0: 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 n require pretty
6dc0: 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 much the same s
6dd0: 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 etup .;; this wr
6de0: 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f apper is used to
6df0: 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c reduce the repl
6e00: 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a ication of code.
6e10: 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c (define (general
6e20: 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 -run-call switch
6e30: 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 name action-desc
6e40: 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 proc). (let ((
6e50: 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 runname (args:ge
6e60: 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 t-arg ":runname"
6e70: 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 ))..(target (if
6e80: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6e90: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
6ea0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6eb0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
6ec0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6ed0: 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 -reqtarg")))..(t
6ee0: 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 h1 #f)).
6ef0: 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 (cond. ((not
6f00: 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 target). (
6f10: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
6f20: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 RROR: Missing re
6f30: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 quired parameter
6f40: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d for " switchnam
6f50: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 e ", you must sp
6f60: 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74 ecify the target
6f70: 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a with -target").
6f80: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a (exit 3)).
6f90: 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 ((not runna
6fa0: 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 me). (debug
6fb0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
6fc0: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 Missing require
6fd0: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 d parameter for
6fe0: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 " switchname ",
6ff0: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 you must specify
7000: 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 the run name wi
7010: 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e th :runname runn
7020: 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 ame"). (exi
7030: 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 t 3)). (else
7040: 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 . (let ((db
7050: 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 #f).. (key
7060: 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 s #f))..(if (not
7070: 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 (setup-for-run)
7080: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 ).. (begin ..
7090: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
70a0: 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 nt 0 "Failed to
70b0: 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 setup, exiting")
70c0: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
70d0: 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 ))..(if (args:ge
70e0: 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 t-arg "-server")
70f0: 0a 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d .. (open-run-
7100: 63 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74 61 close server:sta
7110: 72 74 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d rt db (args:get-
7120: 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 29 29 arg "-server")))
7130: 0a 20 09 20 20 20 20 3b 3b 20 28 69 66 20 28 6e . . ;; (if (n
7140: 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74 ot (or (args:get
7150: 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 20 -arg "-runall")
7160: 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 61 6e ;; runall an
7170: 64 20 72 75 6e 74 65 73 74 73 20 61 72 65 20 61 d runtests are a
7180: 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 73 65 72 llowed to be ser
7190: 76 65 72 73 0a 20 09 20 20 20 20 3b 3b 20 20 20 vers. . ;;
71a0: 20 20 09 20 28 61 72 67 73 3a 67 65 74 2d 61 72 . (args:get-ar
71b0: 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29 g "-runtests")))
71c0: 0a 09 20 20 20 20 3b 3b 20 20 20 20 20 28 63 6c .. ;; (cl
71d0: 69 65 6e 74 3a 73 65 74 75 70 29 20 3b 3b 20 54 ient:setup) ;; T
71e0: 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 his is a duplica
71f0: 74 65 20 73 74 61 72 74 75 70 21 21 21 3f 3f 3f te startup!!!???
7200: 20 42 55 47 3f 0a 09 20 20 20 20 3b 3b 20 20 20 BUG?.. ;;
7210: 20 20 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 ))..(set! keys
7220: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
7230: 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 db:get-keys db)
7240: 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 )..;; have enoug
7250: 68 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 h to process -ta
7260: 72 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 rget or -reqtarg
7270: 20 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 here..(if (args
7280: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
7290: 72 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 rg").. (let*
72a0: 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f ((runconfigf (co
72b0: 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f nc *toppath* "/
72c0: 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 runconfigs.confi
72d0: 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 g")) ;; DO NOT E
72e0: 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 VALUATE ALL ...
72f0: 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 (runconfig (r
7300: 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f ead-config runco
7310: 6e 66 69 67 66 20 23 66 20 23 74 20 65 6e 76 69 nfigf #f #t envi
7320: 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 ron-patt: #f)))
7330: 0a 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73 .. (if (has
7340: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
7350: 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 ult runconfig (a
7360: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
7370: 71 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 qtarg") #f)...
7380: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 (keys:target-set
7390: 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 -args keys (args
73a0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
73b0: 72 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 rg") args:arg-ha
73c0: 73 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 sh)... (begin..
73d0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
73e0: 74 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 t 0 "ERROR: [" (
73f0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 args:get-arg "-r
7400: 65 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 eqtarg") "] not
7410: 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f found in " runco
7420: 6e 66 69 67 66 29 0a 09 09 20 20 20 20 28 69 66 nfigf)... (if
7430: 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e db (sqlite3:fin
7440: 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 20 20 alize! db))...
7450: 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 (exit 1))))..
7460: 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 (if (args:get
7470: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a -arg "-target").
7480: 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 ..(keys:target-s
7490: 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 et-args keys (ar
74a0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 gs:get-arg "-tar
74b0: 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 get" args:arg-ha
74c0: 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 sh) args:arg-has
74d0: 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 h)))..(if (not (
74e0: 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a car *configinfo*
74f0: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 )).. (begin..
7500: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
7510: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 nt 0 "ERROR: Att
7520: 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 empted to " acti
7530: 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 on-desc " but ru
7540: 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 n area config fi
7550: 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 le not found")..
7560: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a (exit 1)).
7570: 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 . ;; Extract
7580: 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 out stuff needed
7590: 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 in most or many
75a0: 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 calls.. ;; h
75b0: 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 ere then call pr
75c0: 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 oc.. (let* ((
75d0: 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 keynames (map
75e0: 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d key:get-fieldnam
75f0: 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b e keys))... (k
7600: 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d eyvallst (keys-
7610: 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 >vallist keys #t
7620: 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 ))).. (proc
7630: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 target runname
7640: 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 keys keynames ke
7650: 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 yvallst)))..(if
7660: 74 68 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e th1 (thread-join
7670: 21 20 74 68 31 29 29 0a 09 28 69 66 20 64 62 20 ! th1))..(if db
7680: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
7690: 65 21 20 64 62 29 29 0a 09 28 73 65 74 21 20 2a e! db))..(set! *
76a0: 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 didsomething* #t
76b0: 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d ))))))..;;======
76c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
76d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
76e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
76f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7700: 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 .;; Lock/unlock
7710: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d runs.;;=========
7720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7730: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 =============..(
7760: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e define (runs:han
7770: 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 72 67 dle-locking targ
7780: 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 et keys runname
7790: 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 lock unlock user
77a0: 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 ). (let* ((db
77b0: 20 20 20 20 20 23 66 29 0a 09 20 28 72 75 6e 64 #f).. (rund
77c0: 61 74 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 at (open-run-c
77d0: 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 lose runs:get-ru
77e0: 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 ns-by-patt db ke
77f0: 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 ys runname)).. (
7800: 68 65 61 64 65 72 20 20 20 28 76 65 63 74 6f 72 header (vector
7810: 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a -ref rundat 0)).
7820: 09 20 28 72 75 6e 73 20 20 20 20 20 28 76 65 63 . (runs (vec
7830: 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 tor-ref rundat 1
7840: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 ))). (for-eac
7850: 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a h (lambda (run).
7860: 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 ..(let ((run-id
7870: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
7880: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
7890: 65 72 20 22 69 64 22 29 29 29 0a 09 09 20 20 28 er "id")))... (
78a0: 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 if (or lock....
78b0: 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 (and unlock....
78c0: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 (begin...
78d0: 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79 6f .. (print "Do yo
78e0: 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74 6f u really wish to
78f0: 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 unlock run " ru
7900: 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a n-id "?\n y/n:
7910: 20 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c 3f ")..... (equal?
7920: 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 "y" (read-line)
7930: 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 6f 70 ))))... (op
7940: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
7950: 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 lock/unlock-run
7960: 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 db run-id lock u
7970: 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20 nlock user)...
7980: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
7990: 2d 69 6e 66 6f 20 30 20 22 53 6b 69 70 70 69 6e -info 0 "Skippin
79a0: 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e g lock/unlock on
79b0: 20 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 " run-id))))..
79c0: 20 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d runs))).;;=
79d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
79e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
79f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a10: 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 =====.;; Rollup
7a20: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d runs.;;=========
7a30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b =============..;
7a70: 3b 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73 ; Update the tes
7a80: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 t_meta table for
7a90: 20 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 this test.(defi
7aa0: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d ne (runs:update-
7ab0: 74 65 73 74 5f 6d 65 74 61 20 74 65 73 74 2d 6e test_meta test-n
7ac0: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 ame test-conf).
7ad0: 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f (let ((currreco
7ae0: 72 64 20 28 63 64 62 3a 72 65 6d 6f 74 65 2d 72 rd (cdb:remote-r
7af0: 75 6e 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 un db:testmeta-g
7b00: 65 74 2d 72 65 63 6f 72 64 20 23 66 20 74 65 73 et-record #f tes
7b10: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 t-name))). (i
7b20: 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 f (not currrecor
7b30: 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 d)..(begin.. (s
7b40: 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 et! currrecord (
7b50: 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 make-vector 10 #
7b60: 66 29 29 0a 09 20 20 28 63 64 62 3a 72 65 6d 6f f)).. (cdb:remo
7b70: 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 te-run db:testme
7b80: 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 23 66 ta-add-record #f
7b90: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 test-name))).
7ba0: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
7bb0: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a (lambda (key).
7bc0: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 (let* ((i
7bd0: 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 dx (cadr key))..
7be0: 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 (fld (car
7bf0: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 key)).. (v
7c00: 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 al (config-looku
7c10: 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 p test-conf "tes
7c20: 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 t_meta" fld)))..
7c30: 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ;; (debug:print
7c40: 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 5 "idx: " idx "
7c50: 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 fld: " fld " va
7c60: 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 l: " val).. (if
7c70: 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 (and val (not (e
7c80: 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 qual? (vector-re
7c90: 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 f currrecord idx
7ca0: 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 ) val))).. (
7cb0: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 begin.. (p
7cc0: 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 rint "Updating "
7cd0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 test-name " " f
7ce0: 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 ld " to " val)..
7cf0: 20 20 20 20 20 20 20 28 63 64 62 3a 72 65 6d 6f (cdb:remo
7d00: 74 65 2d 72 75 6e 20 64 62 3a 74 65 73 74 6d 65 te-run db:testme
7d10: 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 ta-update-field
7d20: 23 66 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 #f test-name fld
7d30: 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 val))))). '
7d40: 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f (("author" 2)("o
7d50: 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69 wner" 3)("descri
7d60: 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 ption" 4)("revie
7d70: 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39 wed" 5)("tags" 9
7d80: 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 )))))..;; Update
7d90: 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 test_meta for a
7da0: 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 ll tests.(define
7db0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c (runs:update-al
7dc0: 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a l-test_meta db).
7dd0: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 (let ((test-na
7de0: 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 mes (get-all-leg
7df0: 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 al-tests))).
7e00: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
7e10: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 (lambda (test-na
7e20: 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a me). (let*
7e30: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 ((test-path
7e40: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
7e50: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
7e60: 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 ame)).. (te
7e70: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 st-configf (conc
7e80: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 test-path "/tes
7e90: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 tconfig"))..
7ea0: 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 (testexists
7eb0: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 (and (file-exist
7ec0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
7ed0: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 (file-read-acces
7ee0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
7ef0: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 )).. ;; rea
7f00: 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 d configs with t
7f10: 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 ricks turned off
7f20: 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d (i.e. no system
7f30: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 ).. (test-c
7f40: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 onf (if teste
7f50: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 xists (read-conf
7f60: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 ig test-configf
7f70: 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 #f #f)(make-hash
7f80: 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b 3b 20 -table)))).. ;;
7f90: 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 75 6e use the open-run
7fa0: 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 20 6f -close instead o
7fb0: 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64 62 0a f passing in db.
7fc0: 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 . (runs:update-t
7fd0: 65 73 74 5f 6d 65 74 61 20 74 65 73 74 2d 6e 61 est_meta test-na
7fe0: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a me test-conf))).
7ff0: 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 test-names)
8000: 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c ))..;; This coul
8010: 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 d probably be re
8020: 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e factored into on
8030: 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 e complex query
8040: 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e ....(define (run
8050: 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 s:rollup-run key
8060: 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e s keyvallst runn
8070: 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 ame user) ;; was
8080: 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 target, now key
8090: 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a vallst. (debug:
80a0: 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f print 4 "runs:ro
80b0: 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 llup-run, keys:
80c0: 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c " keys " keyvall
80d0: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 st: " keyvallst
80e0: 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e " :runname " run
80f0: 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 name " user: " u
8100: 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 ser). (let* ((d
8110: 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 b #
8120: 66 29 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 f) ;; (keyvallls
8130: 74 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 t (keys:tar
8140: 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 get->keyval keys
8150: 20 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 target)).. (new
8160: 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 63 64 -run-id (cd
8170: 62 3a 72 65 6d 6f 74 65 2d 72 75 6e 20 64 62 3a b:remote-run db:
8180: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 23 66 20 register-run #f
8190: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 keys keyvallst r
81a0: 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f unname "new" "n/
81b0: 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 a" user)).. (pre
81c0: 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70 v-tests (op
81d0: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 en-run-close tes
81e0: 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 t:get-matching-p
81f0: 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e revious-test-run
8200: 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d -records db new-
8210: 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 run-id "%" "%"))
8220: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20 .. (curr-tests
8230: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
8240: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 ose db:get-tests
8250: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d -for-run db new-
8260: 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28 29 run-id "%/%" '()
8270: 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d 74 '())).. (curr-t
8280: 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d ests-hash (make-
8290: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 20 hash-table))).
82a0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
82b0: 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d e db:update-run-
82c0: 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 event_time db ne
82d0: 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b w-run-id). ;;
82e0: 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61 index the alrea
82f0: 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20 62 dy saved tests b
8300: 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 y testname and i
8310: 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d 74 temdat in curr-t
8320: 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66 ests-hash. (f
8330: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 or-each. (la
8340: 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 mbda (testdat).
8350: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 (let* ((te
8360: 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 stname (db:test
8370: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
8380: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
8390: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 item-path (db:te
83a0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
83b0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 testdat))..
83c0: 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f (full-name (co
83d0: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 nc testname "/"
83e0: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 item-path))).. (
83f0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
8400: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 curr-tests-hash
8410: 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 full-name testda
8420: 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74 t))). curr-t
8430: 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 ests). ;; NOP
8440: 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 E: Non-optimal a
8450: 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69 pproach. Try thi
8460: 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b s instead.. ;
8470: 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72 65 ; 1. tests are
8480: 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c received in a l
8490: 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 ist, most recent
84a0: 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 first. ;;
84b0: 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20 72 2. replace the r
84c0: 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68 20 ollup test with
84d0: 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a the new *always*
84e0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
84f0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 (lambda (te
8500: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c stdat). (l
8510: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 et* ((testname
8520: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
8530: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a tname testdat)).
8540: 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 . (item-pat
8550: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 h (db:test-get-i
8560: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 tem-path testdat
8570: 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d )).. (full-
8580: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e name (conc testn
8590: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
85a0: 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65 76 h)).. (prev
85b0: 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d -test-dat (hash-
85c0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
85d0: 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 t curr-tests-has
85e0: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 h full-name #f))
85f0: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73 74 .. (test-st
8600: 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 eps (open-r
8610: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
8620: 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 steps-for-test d
8630: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 b (db:test-get-i
8640: 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 d testdat)))..
8650: 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 (new-test-re
8660: 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 cord #f)).. ;; r
8670: 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 eplace these wit
8680: 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c h insert ... sel
8690: 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c ect.. (apply sql
86a0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 ite3:execute ...
86b0: 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 db ...(conc "INS
86c0: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 ERT OR REPLACE I
86d0: 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 NTO tests (run_i
86e0: 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 d,testname,state
86f0: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
8700: 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c me,host,cpuload,
8710: 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 diskfree,uname,r
8720: 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c undir,item_path,
8730: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e run_duration,fin
8740: 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 al_logf,comment)
8750: 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 "... "VALU
8760: 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ES (?,?,?,?,?,?,
8770: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 ?,?,?,?,?,?,?,?)
8780: 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 ;")...new-run-id
8790: 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e (cddr (vector->
87a0: 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29 0a list testdat))).
87b0: 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 . (set! new-test
87c0: 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d 72 dat (car (open-r
87d0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
87e0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
87f0: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f 6e new-run-id (con
8800: 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 c testname "/" i
8810: 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27 28 tem-path) '() '(
8820: 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 )))).. (hash-tab
8830: 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 le-set! curr-tes
8840: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d ts-hash full-nam
8850: 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b e new-testdat) ;
8860: 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 ; this could be
8870: 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 confusing, which
8880: 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 record should g
8890: 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 o into the looku
88a0: 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f p table?.. ;; No
88b0: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 w duplicate the
88c0: 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 test steps.. (de
88d0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 bug:print 4 "Cop
88e0: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 ying records in
88f0: 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 test_steps from
8900: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 test_id=" (db:te
8910: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
8920: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 t) " to " (db:te
8930: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
8940: 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e 2d stdat)).. (open-
8950: 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28 6c run-close .. (l
8960: 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28 73 ambda ().. (s
8970: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a qlite3:execute .
8980: 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 . db ..
8990: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
89a0: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
89b0: 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 st_steps (test_i
89c0: 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 d,stepname,state
89d0: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
89e0: 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 me,comment) "...
89f0: 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 "SELECT " (db
8a00: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
8a10: 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70 -testdat) ",step
8a20: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
8a30: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d s,event_time,com
8a40: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 ment FROM test_s
8a50: 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f teps WHERE test_
8a60: 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 id=?;").. (d
8a70: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
8a80: 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b 20 stdat)).. ;;
8a90: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 Now duplicate th
8aa0: 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20 20 e test data..
8ab0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
8ac0: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 "Copying records
8ad0: 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 in test_data fr
8ae0: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 om test_id=" (db
8af0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
8b00: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 tdat) " to " (db
8b10: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
8b20: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 -testdat))..
8b30: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 (sqlite3:execute
8b40: 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 .. db ..
8b50: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 (conc "INSERT
8b60: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 OR REPLACE INTO
8b70: 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f test_data (test_
8b80: 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 id,category,vari
8b90: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 able,value,expec
8ba0: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f ted,tol,units,co
8bb0: 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 mment) "... "S
8bc0: 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 ELECT " (db:test
8bd0: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 -get-id new-test
8be0: 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c dat) ",category,
8bf0: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 variable,value,e
8c00: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 xpected,tol,unit
8c10: 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 s,comment FROM t
8c20: 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 est_data WHERE t
8c30: 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 est_id=?;")..
8c40: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 (db:test-get-i
8c50: 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09 20 d testdat))))..
8c60: 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 )). prev-tes
8c70: 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a ts))).. . .