0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30 .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77 06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53 r.;; greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72 .;; This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 RRANTY; without
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70 even the.;; imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 or FITNESS FOR
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20 A PARTICULAR.;;
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73 PURPOSE...;; s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25 trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77 Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a ','localtime')..
0180: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66 (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20 i-1 posix regex
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 29 0a 69 dot-locking).
01c0: 28 69 6d 70 6f 72 74 20 28 70 72 65 66 69 78 20 (import (prefix
01d0: 73 71 6c 69 74 65 33 20 73 71 6c 69 74 65 33 3a sqlite3 sqlite3:
01e0: 29 29 0a 0a 28 64 65 63 6c 61 72 65 20 28 75 6e ))..(declare (un
01f0: 69 74 20 72 75 6e 73 29 29 0a 28 64 65 63 6c 61 it runs)).(decla
0200: 72 65 20 28 75 73 65 73 20 64 62 29 29 0a 28 64 re (uses db)).(d
0210: 65 63 6c 61 72 65 20 28 75 73 65 73 20 63 6f 6d eclare (uses com
0220: 6d 6f 6e 29 29 0a 28 64 65 63 6c 61 72 65 20 28 mon)).(declare (
0230: 75 73 65 73 20 69 74 65 6d 73 29 29 0a 28 64 65 uses items)).(de
0240: 63 6c 61 72 65 20 28 75 73 65 73 20 72 75 6e 63 clare (uses runc
0250: 6f 6e 66 69 67 29 29 0a 0a 28 69 6e 63 6c 75 64 onfig))..(includ
0260: 65 20 22 63 6f 6d 6d 6f 6e 5f 72 65 63 6f 72 64 e "common_record
0270: 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 s.scm").(include
0280: 20 22 6b 65 79 5f 72 65 63 6f 72 64 73 2e 73 63 "key_records.sc
0290: 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 64 62 m").(include "db
02a0: 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 _records.scm").(
02b0: 69 6e 63 6c 75 64 65 20 22 72 75 6e 5f 72 65 63 include "run_rec
02c0: 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b 3b 20 72 ords.scm")..;; r
02d0: 65 67 69 73 74 65 72 20 61 20 74 65 73 74 20 72 egister a test r
02e0: 75 6e 20 77 69 74 68 20 74 68 65 20 64 62 0a 28 un with the db.(
02f0: 64 65 66 69 6e 65 20 28 72 65 67 69 73 74 65 72 define (register
0300: 2d 72 75 6e 20 64 62 20 6b 65 79 73 29 20 3b 3b -run db keys) ;;
0310: 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c test-name). (l
0320: 65 74 2a 20 28 28 6b 65 79 73 74 72 20 20 20 20 et* ((keystr
0330: 28 6b 65 79 73 2d 3e 6b 65 79 73 74 72 20 6b 65 (keys->keystr ke
0340: 79 73 29 29 0a 09 20 28 63 6f 6d 6d 61 20 20 20 ys)).. (comma
0350: 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 (if (> (length
0360: 20 6b 65 79 73 29 20 30 29 20 22 2c 22 20 22 22 keys) 0) "," ""
0370: 29 29 0a 09 20 28 61 6e 64 73 74 72 20 20 20 20 )).. (andstr
0380: 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b (if (> (length k
0390: 65 79 73 29 20 30 29 20 22 20 41 4e 44 20 22 20 eys) 0) " AND "
03a0: 22 22 29 29 0a 09 20 28 76 61 6c 73 6c 6f 74 73 "")).. (valslots
03b0: 20 20 28 6b 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 (keys->valslot
03c0: 73 20 6b 65 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c s keys)) ;; ?,?,
03d0: 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 76 61 6c 6c ? ..... (keyvall
03e0: 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 st (keys->vallis
03f0: 74 20 6b 65 79 73 29 29 20 3b 3b 20 65 78 74 72 t keys)) ;; extr
0400: 61 63 74 73 20 74 68 65 20 76 61 6c 75 65 73 20 acts the values
0410: 66 72 6f 6d 20 72 65 6d 61 69 6e 64 65 72 20 6f from remainder o
0420: 66 20 28 61 72 67 76 29 0a 09 20 28 72 75 6e 6e f (argv).. (runn
0430: 61 6d 65 20 20 20 28 67 65 74 2d 77 69 74 68 2d ame (get-with-
0440: 64 65 66 61 75 6c 74 20 22 3a 72 75 6e 6e 61 6d default ":runnam
0450: 65 22 20 23 66 29 29 0a 09 20 28 73 74 61 74 65 e" #f)).. (state
0460: 20 20 20 20 20 28 67 65 74 2d 77 69 74 68 2d 64 (get-with-d
0470: 65 66 61 75 6c 74 20 22 3a 73 74 61 74 65 22 20 efault ":state"
0480: 22 6e 6f 22 29 29 0a 09 20 28 73 74 61 74 75 73 "no")).. (status
0490: 20 20 20 20 28 67 65 74 2d 77 69 74 68 2d 64 65 (get-with-de
04a0: 66 61 75 6c 74 20 22 3a 73 74 61 74 75 73 22 20 fault ":status"
04b0: 22 6e 2f 61 22 29 29 0a 09 20 28 61 6c 6c 76 61 "n/a")).. (allva
04c0: 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 6c 69 ls (append (li
04d0: 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 st runname state
04e0: 20 73 74 61 74 75 73 20 75 73 65 72 29 20 6b 65 status user) ke
04f0: 79 76 61 6c 6c 73 74 29 29 0a 09 20 28 71 72 79 yvallst)).. (qry
0500: 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 20 28 vals (append (
0510: 6c 69 73 74 20 72 75 6e 6e 61 6d 65 29 20 6b 65 list runname) ke
0520: 79 76 61 6c 6c 73 74 29 29 0a 09 20 28 6b 65 79 yvallst)).. (key
0530: 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67 2d 69 =?str (string-i
0540: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 ntersperse (map
0550: 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f 6e 63 (lambda (k)(conc
0560: 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e (key:get-fieldn
0570: 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20 6b 65 ame k) "=?")) ke
0580: 79 73 29 20 22 20 41 4e 44 20 22 29 29 29 0a 20 ys) " AND "))).
0590: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
05a0: 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 3 "keys: " keys
05b0: 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61 6c 6c " allvals: " all
05c0: 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 vals " keyvallst
05d0: 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 29 0a 20 : " keyvallst).
05e0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
05f0: 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 6b 2 "NOTE: using k
0600: 65 79 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 ey " (string-int
0610: 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c 6c ersperse keyvall
0620: 73 74 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 st "/") " for th
0630: 69 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 is run"). (if
0640: 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e (and runname (n
0650: 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 ull? (filter (la
0660: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 mbda (x)(not x))
0670: 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 20 3b 3b keyvallst))) ;;
0680: 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 20 61 there must be a
0690: 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20 22 better way to "
06a0: 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 apply and"..(let
06b0: 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 20 28 ((res #f)).. (
06c0: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 apply sqlite3:ex
06d0: 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 20 22 ecute db (conc "
06e0: 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 INSERT OR IGNORE
06f0: 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e INTO runs (runn
0700: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
0710: 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d ,owner,event_tim
0720: 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 e" comma keystr
0730: 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f ") VALUES (?,?,?
0740: 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27 ,?,strftime('%s'
0750: 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 ,'now')" comma v
0760: 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 alslots ");")...
0770: 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 allvals).. (ap
0780: 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d ply sqlite3:for-
0790: 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c each-row .. (l
07a0: 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 20 20 ambda (id)..
07b0: 20 28 73 65 74 21 20 72 65 73 20 69 64 29 29 0a (set! res id)).
07c0: 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 74 20 . db.. (let
07d0: 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 45 4c ((qry (conc "SEL
07e0: 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 ECT id FROM runs
07f0: 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d WHERE (runname=
0800: 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f ? " andstr key=?
0810: 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 20 20 str ");")))..
0820: 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;(debug:print
0830: 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 20 0a 4 "qry: " qry) .
0840: 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 20 71 . qry).. q
0850: 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 ryvals).. (sqli
0860: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
0870: 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 54 20 UPDATE runs SET
0880: 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f state=?,status=?
0890: 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 WHERE id=?;" st
08a0: 61 74 65 20 73 74 61 74 75 73 20 72 65 73 29 0a ate status res).
08b0: 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 69 6e . res) ..(begin
08c0: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
08d0: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 0 "ERROR: Calle
08e0: 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 d without all ne
08f0: 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 0a 09 cessary keys")..
0900: 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 72 75 6e #f))))..;; run
0910: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 s:get-runs-by-pa
0920: 74 74 0a 3b 3b 20 67 65 74 20 72 75 6e 73 20 62 tt.;; get runs b
0930: 79 20 6c 69 73 74 20 6f 66 20 63 72 69 74 65 72 y list of criter
0940: 69 61 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 ia.;; register a
0950: 20 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 test run with t
0960: 68 65 20 64 62 0a 3b 3b 0a 3b 3b 20 55 73 65 3a he db.;;.;; Use:
0970: 20 28 64 62 2d 67 65 74 2d 76 61 6c 75 65 2d 62 (db-get-value-b
0980: 79 2d 68 65 61 64 65 72 20 28 64 62 3a 67 65 74 y-header (db:get
0990: 2d 68 65 61 64 65 72 20 72 75 6e 69 6e 66 6f 29 -header runinfo)
09a0: 28 64 62 3a 67 65 74 2d 72 6f 77 20 72 75 6e 69 (db:get-row runi
09b0: 6e 66 6f 29 29 0a 3b 3b 20 20 74 6f 20 65 78 74 nfo)).;; to ext
09c0: 72 61 63 74 20 69 6e 66 6f 20 66 72 6f 6d 20 74 ract info from t
09d0: 68 65 20 73 74 72 75 63 74 75 72 65 20 72 65 74 he structure ret
09e0: 75 72 6e 65 64 0a 3b 3b 0a 28 64 65 66 69 6e 65 urned.;;.(define
09f0: 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d (runs:get-runs-
0a00: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 by-patt db keys
0a10: 72 75 6e 6e 61 6d 65 70 61 74 74 20 2e 20 70 61 runnamepatt . pa
0a20: 72 61 6d 73 29 20 3b 3b 20 74 65 73 74 2d 6e 61 rams) ;; test-na
0a30: 6d 65 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 me). (let* ((ke
0a40: 79 76 61 6c 6c 73 74 20 28 6b 65 79 73 2d 3e 76 yvallst (keys->v
0a50: 61 6c 6c 69 73 74 20 6b 65 79 73 29 29 0a 09 20 allist keys))..
0a60: 28 74 6d 70 20 20 20 20 20 20 28 72 75 6e 73 3a (tmp (runs:
0a70: 67 65 74 2d 73 74 64 2d 72 75 6e 2d 66 69 65 6c get-std-run-fiel
0a80: 64 73 20 6b 65 79 73 20 27 28 22 69 64 22 20 22 ds keys '("id" "
0a90: 72 75 6e 6e 61 6d 65 22 20 22 73 74 61 74 65 22 runname" "state"
0aa0: 20 22 73 74 61 74 75 73 22 20 22 6f 77 6e 65 72 "status" "owner
0ab0: 22 20 22 65 76 65 6e 74 5f 74 69 6d 65 22 29 29 " "event_time"))
0ac0: 29 0a 09 20 28 6b 65 79 73 74 72 20 20 20 28 63 ).. (keystr (c
0ad0: 61 72 20 74 6d 70 29 29 0a 09 20 28 68 65 61 64 ar tmp)).. (head
0ae0: 65 72 20 20 20 28 63 61 64 72 20 74 6d 70 29 29 er (cadr tmp))
0af0: 0a 09 20 28 72 65 73 20 20 20 20 20 27 28 29 29 .. (res '())
0b00: 0a 09 20 28 6b 65 79 2d 70 61 74 74 20 22 22 29 .. (key-patt "")
0b10: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 ). (for-each
0b20: 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c 29 (lambda (keyval)
0b30: 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20 20 ...(let* ((key
0b40: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 65 (vector-ref ke
0b50: 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20 20 yval 0))...
0b60: 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63 20 (fulkey (conc
0b70: 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20 20 ":" key))...
0b80: 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67 73 (patt (args
0b90: 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79 29 :get-arg fulkey)
0ba0: 29 29 0a 09 09 20 20 28 69 66 20 70 61 74 74 0a ))... (if patt.
0bb0: 09 09 20 20 20 20 20 20 28 73 65 74 21 20 6b 65 .. (set! ke
0bc0: 79 2d 70 61 74 74 20 28 63 6f 6e 63 20 6b 65 79 y-patt (conc key
0bd0: 2d 70 61 74 74 20 22 20 41 4e 44 20 22 20 6b 65 -patt " AND " ke
0be0: 79 20 22 20 6c 69 6b 65 20 27 22 20 70 61 74 74 y " like '" patt
0bf0: 20 22 27 22 29 29 0a 09 09 20 20 20 20 20 20 28 "'"))... (
0c00: 62 65 67 69 6e 0a 09 09 09 28 64 65 62 75 67 3a begin....(debug:
0c10: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
0c20: 73 65 61 72 63 68 69 6e 67 20 66 6f 72 20 72 75 searching for ru
0c30: 6e 73 20 77 69 74 68 20 6e 6f 20 70 61 74 74 65 ns with no patte
0c40: 72 6e 20 73 65 74 20 66 6f 72 20 22 20 66 75 6c rn set for " ful
0c50: 6b 65 79 29 0a 09 09 09 28 65 78 69 74 20 36 29 key)....(exit 6)
0c60: 29 29 29 29 0a 09 20 20 20 20 20 20 6b 65 79 73 )))).. keys
0c70: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 ). (sqlite3:f
0c80: 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 or-each-row .
0c90: 20 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 (lambda (a . r
0ca0: 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 ). (set! r
0cb0: 65 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e es (cons (list->
0cc0: 76 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 vector (cons a r
0cd0: 29 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 )) res))). d
0ce0: 62 20 0a 20 20 20 20 20 28 63 6f 6e 63 20 22 53 b . (conc "S
0cf0: 45 4c 45 43 54 20 22 20 6b 65 79 73 74 72 20 22 ELECT " keystr "
0d00: 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 FROM runs WHERE
0d10: 20 72 75 6e 6e 61 6d 65 20 6c 69 6b 65 20 3f 20 runname like ?
0d20: 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22 29 0a " key-patt ";").
0d30: 20 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 runnamepatt
0d40: 29 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 ). (vector he
0d50: 61 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 ader res)))..(de
0d60: 66 69 6e 65 20 28 72 65 67 69 73 74 65 72 2d 74 fine (register-t
0d70: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 est db run-id te
0d80: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
0d90: 68 29 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d h). (let ((item
0da0: 2d 70 61 74 68 73 20 28 69 66 20 28 65 71 75 61 -paths (if (equa
0db0: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 l? item-path "")
0dc0: 0a 09 09 09 28 6c 69 73 74 20 69 74 65 6d 2d 70 ....(list item-p
0dd0: 61 74 68 29 0a 09 09 09 28 6c 69 73 74 20 69 74 ath)....(list it
0de0: 65 6d 2d 70 61 74 68 20 22 22 29 29 29 29 0a 20 em-path "")))).
0df0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 (for-each .
0e00: 20 20 20 28 6c 61 6d 62 64 61 20 28 70 74 68 29 (lambda (pth)
0e10: 0a 20 20 20 20 20 20 20 28 73 71 6c 69 74 65 33 . (sqlite3
0e20: 3a 65 78 65 63 75 74 65 20 64 62 20 22 49 4e 53 :execute db "INS
0e30: 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e ERT OR IGNORE IN
0e40: 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 TO tests (run_id
0e50: 2c 74 65 73 74 6e 61 6d 65 2c 65 76 65 6e 74 5f ,testname,event_
0e60: 74 69 6d 65 2c 69 74 65 6d 5f 70 61 74 68 2c 73 time,item_path,s
0e70: 74 61 74 65 2c 73 74 61 74 75 73 29 20 56 41 4c tate,status) VAL
0e80: 55 45 53 20 28 3f 2c 3f 2c 73 74 72 66 74 69 6d UES (?,?,strftim
0e90: 65 28 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f 2c e('%s','now'),?,
0ea0: 27 4e 4f 54 5f 53 54 41 52 54 45 44 27 2c 27 6e 'NOT_STARTED','n
0eb0: 2f 61 27 29 3b 22 20 0a 09 09 09 72 75 6e 2d 69 /a');" ....run-i
0ec0: 64 20 0a 09 09 09 74 65 73 74 2d 6e 61 6d 65 0a d ....test-name.
0ed0: 09 09 09 70 74 68 20 0a 09 09 09 3b 3b 20 28 63 ...pth ....;; (c
0ee0: 6f 6e 63 20 22 2c 22 20 28 73 74 72 69 6e 67 2d onc "," (string-
0ef0: 69 6e 74 65 72 73 70 65 72 73 65 20 74 61 67 73 intersperse tags
0f00: 20 22 2c 22 29 20 22 2c 22 29 0a 09 09 09 29 29 ",") ",")....))
0f10: 0a 20 20 20 20 20 69 74 65 6d 2d 70 61 74 68 73 . item-paths
0f20: 20 29 29 29 0a 0a 3b 3b 20 67 65 74 20 74 68 65 )))..;; get the
0f30: 20 70 72 65 76 69 6f 75 73 20 72 65 63 6f 72 64 previous record
0f40: 20 66 6f 72 20 77 68 65 6e 20 74 68 69 73 20 74 for when this t
0f50: 65 73 74 20 77 61 73 20 72 75 6e 20 77 68 65 72 est was run wher
0f60: 65 20 61 6c 6c 20 6b 65 79 73 20 6d 61 74 63 68 e all keys match
0f70: 20 62 75 74 20 72 75 6e 6e 61 6d 65 0a 3b 3b 20 but runname.;;
0f80: 72 65 74 75 72 6e 73 20 23 66 20 69 66 20 6e 6f returns #f if no
0f90: 20 73 75 63 68 20 74 65 73 74 20 66 6f 75 6e 64 such test found
0fa0: 2c 20 72 65 74 75 72 6e 73 20 61 20 73 69 6e 67 , returns a sing
0fb0: 6c 65 20 74 65 73 74 20 72 65 63 6f 72 64 20 69 le test record i
0fc0: 66 20 66 6f 75 6e 64 0a 28 64 65 66 69 6e 65 20 f found.(define
0fd0: 28 74 65 73 74 3a 67 65 74 2d 70 72 65 76 69 6f (test:get-previo
0fe0: 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f us-test-run-reco
0ff0: 72 64 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 rd db run-id tes
1000: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
1010: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 ). (let* ((keys
1020: 20 20 20 20 28 64 62 3a 67 65 74 2d 6b 65 79 73 (db:get-keys
1030: 20 64 62 29 29 0a 09 20 28 73 65 6c 73 74 72 20 db)).. (selstr
1040: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
1050: 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 erse (map (lambd
1060: 61 20 28 78 29 28 76 65 63 74 6f 72 2d 72 65 66 a (x)(vector-ref
1070: 20 78 20 30 29 29 20 6b 65 79 73 29 20 22 2c 22 x 0)) keys) ","
1080: 29 29 0a 09 20 28 71 72 79 73 74 72 20 20 28 73 )).. (qrystr (s
1090: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
10a0: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 e (map (lambda (
10b0: 78 29 28 63 6f 6e 63 20 28 76 65 63 74 6f 72 2d x)(conc (vector-
10c0: 72 65 66 20 78 20 30 29 20 22 3d 3f 22 29 29 20 ref x 0) "=?"))
10d0: 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 0a keys) " AND ")).
10e0: 09 20 28 6b 65 79 76 61 6c 73 20 23 66 29 29 0a . (keyvals #f)).
10f0: 20 20 20 20 3b 3b 20 66 69 72 73 74 20 6c 6f 6f ;; first loo
1100: 6b 20 75 70 20 74 68 65 20 6b 65 79 20 76 61 6c k up the key val
1110: 75 65 73 20 66 72 6f 6d 20 74 68 65 20 72 75 6e ues from the run
1120: 20 73 65 6c 65 63 74 65 64 20 62 79 20 72 75 6e selected by run
1130: 2d 69 64 0a 20 20 20 20 28 73 71 6c 69 74 65 33 -id. (sqlite3
1140: 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 :for-each-row .
1150: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 20 2e (lambda (a .
1160: 20 62 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 b). (set!
1170: 20 6b 65 79 76 61 6c 73 20 28 63 6f 6e 73 20 61 keyvals (cons a
1180: 20 62 29 29 29 0a 20 20 20 20 20 64 62 0a 20 20 b))). db.
1190: 20 20 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 (conc "SELECT
11a0: 20 22 20 73 65 6c 73 74 72 20 22 20 46 52 4f 4d " selstr " FROM
11b0: 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f runs WHERE id=?
11c0: 20 4f 52 44 45 52 20 42 59 20 65 76 65 6e 74 5f ORDER BY event_
11d0: 74 69 6d 65 20 44 45 53 43 3b 22 29 20 72 75 6e time DESC;") run
11e0: 2d 69 64 29 0a 20 20 20 20 28 69 66 20 28 6e 6f -id). (if (no
11f0: 74 20 6b 65 79 76 61 6c 73 29 0a 09 23 66 0a 09 t keyvals)..#f..
1200: 28 6c 65 74 20 28 28 70 72 65 76 2d 72 75 6e 2d (let ((prev-run-
1210: 69 64 73 20 27 28 29 29 29 0a 09 20 20 28 61 70 ids '())).. (ap
1220: 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d ply sqlite3:for-
1230: 65 61 63 68 2d 72 6f 77 0a 09 09 20 28 6c 61 6d each-row... (lam
1240: 62 64 61 20 28 69 64 29 0a 09 09 20 20 20 28 73 bda (id)... (s
1250: 65 74 21 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 et! prev-run-ids
1260: 20 28 63 6f 6e 73 20 69 64 20 70 72 65 76 2d 72 (cons id prev-r
1270: 75 6e 2d 69 64 73 29 29 29 0a 09 09 20 64 62 0a un-ids)))... db.
1280: 09 09 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 .. (conc "SELECT
1290: 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 id FROM runs WH
12a0: 45 52 45 20 22 20 71 72 79 73 74 72 20 22 20 41 ERE " qrystr " A
12b0: 4e 44 20 69 64 20 21 3d 20 3f 3b 22 29 20 28 61 ND id != ?;") (a
12c0: 70 70 65 6e 64 20 6b 65 79 76 61 6c 73 20 28 6c ppend keyvals (l
12d0: 69 73 74 20 72 75 6e 2d 69 64 29 29 29 0a 09 20 ist run-id)))..
12e0: 20 3b 3b 20 66 6f 72 20 65 61 63 68 20 72 75 6e ;; for each run
12f0: 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 74 starting with t
1300: 68 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 6c he most recent l
1310: 6f 6f 6b 20 74 6f 20 73 65 65 20 69 66 20 74 68 ook to see if th
1320: 65 72 65 20 69 73 20 61 20 6d 61 74 63 68 69 6e ere is a matchin
1330: 67 20 74 65 73 74 0a 09 20 20 3b 3b 20 69 66 20 g test.. ;; if
1340: 66 6f 75 6e 64 20 74 68 65 6e 20 72 65 74 75 72 found then retur
1350: 6e 20 74 68 61 74 20 6d 61 74 63 68 69 6e 67 20 n that matching
1360: 74 65 73 74 20 72 65 63 6f 72 64 0a 09 20 20 28 test record.. (
1370: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 73 debug:print 4 "s
1380: 65 6c 73 74 72 3a 20 22 20 73 65 6c 73 74 72 20 elstr: " selstr
1390: 22 2c 20 71 72 79 73 74 72 3a 20 22 20 71 72 79 ", qrystr: " qry
13a0: 73 74 72 20 22 2c 20 6b 65 79 76 61 6c 73 3a 20 str ", keyvals:
13b0: 22 20 6b 65 79 76 61 6c 73 20 22 2c 20 70 72 65 " keyvals ", pre
13c0: 76 69 6f 75 73 20 72 75 6e 20 69 64 73 20 66 6f vious run ids fo
13d0: 75 6e 64 3a 20 22 20 70 72 65 76 2d 72 75 6e 2d und: " prev-run-
13e0: 69 64 73 29 0a 09 20 20 28 69 66 20 28 6e 75 6c ids).. (if (nul
13f0: 6c 3f 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 29 l? prev-run-ids)
1400: 20 23 66 0a 09 20 20 20 20 20 20 28 6c 65 74 20 #f.. (let
1410: 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 20 loop ((hed (car
1420: 70 72 65 76 2d 72 75 6e 2d 69 64 73 29 29 0a 09 prev-run-ids))..
1430: 09 09 20 28 74 61 6c 20 28 63 64 72 20 70 72 65 .. (tal (cdr pre
1440: 76 2d 72 75 6e 2d 69 64 73 29 29 29 0a 09 09 28 v-run-ids)))...(
1450: 6c 65 74 20 28 28 72 65 73 75 6c 74 73 20 28 64 let ((results (d
1460: 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d b-get-tests-for-
1470: 72 75 6e 20 64 62 20 68 65 64 20 74 65 73 74 2d run db hed test-
1480: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 name item-path '
1490: 28 29 20 27 28 29 29 29 29 0a 09 09 20 20 28 64 () '())))... (d
14a0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 47 6f ebug:print 4 "Go
14b0: 74 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 2d t tests for run-
14c0: 69 64 20 22 20 72 75 6e 2d 69 64 20 22 2c 20 74 id " run-id ", t
14d0: 65 73 74 2d 6e 61 6d 65 20 22 20 74 65 73 74 2d est-name " test-
14e0: 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 name ", item-pat
14f0: 68 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 3a h " item-path ":
1500: 20 22 20 72 65 73 75 6c 74 73 29 0a 09 09 20 20 " results)...
1510: 28 69 66 20 28 61 6e 64 20 28 6e 75 6c 6c 3f 20 (if (and (null?
1520: 72 65 73 75 6c 74 73 29 0a 09 09 09 20 20 20 28 results).... (
1530: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 not (null? tal))
1540: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 )... (loop
1550: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 (car tal)(cdr ta
1560: 6c 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 20 l))... (if
1570: 28 6e 75 6c 6c 3f 20 72 65 73 75 6c 74 73 29 20 (null? results)
1580: 23 66 0a 09 09 09 20 20 28 63 61 72 20 72 65 73 #f.... (car res
1590: 75 6c 74 73 29 29 29 29 29 29 29 29 29 29 0a 20 ults)))))))))).
15a0: 20 20 20 0a 3b 3b 20 67 65 74 20 74 68 65 20 70 .;; get the p
15b0: 72 65 76 69 6f 75 73 20 72 65 63 6f 72 64 73 20 revious records
15c0: 66 6f 72 20 77 68 65 6e 20 74 68 65 73 65 20 74 for when these t
15d0: 65 73 74 73 20 77 65 72 65 20 72 75 6e 20 77 68 ests were run wh
15e0: 65 72 65 20 61 6c 6c 20 6b 65 79 73 20 6d 61 74 ere all keys mat
15f0: 63 68 20 62 75 74 20 72 75 6e 6e 61 6d 65 0a 3b ch but runname.;
1600: 3b 20 4e 42 2f 2f 20 4d 65 72 67 65 20 74 68 69 ; NB// Merge thi
1610: 73 20 77 69 74 68 20 74 65 73 74 3a 67 65 74 2d s with test:get-
1620: 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 previous-test-ru
1630: 6e 2d 72 65 63 6f 72 64 73 3f 20 54 68 69 73 20 n-records? This
1640: 6f 6e 65 20 6c 6f 6f 6b 73 20 66 6f 72 20 61 6c one looks for al
1650: 6c 20 6d 61 74 63 68 69 6e 67 20 74 65 73 74 73 l matching tests
1660: 0a 3b 3b 20 63 61 6e 20 75 73 65 20 77 69 6c 64 .;; can use wild
1670: 63 61 72 64 73 2e 20 0a 28 64 65 66 69 6e 65 20 cards. .(define
1680: 28 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 (test:get-matchi
1690: 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 ng-previous-test
16a0: 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 -run-records db
16b0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
16c0: 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 28 6c item-path). (l
16d0: 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 28 64 et* ((keys (d
16e0: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b:get-keys db)).
16f0: 09 20 28 73 65 6c 73 74 72 20 20 28 73 74 72 69 . (selstr (stri
1700: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
1710: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 78 29 28 map (lambda (x)(
1720: 76 65 63 74 6f 72 2d 72 65 66 20 78 20 30 29 29 vector-ref x 0))
1730: 20 6b 65 79 73 29 20 22 2c 22 29 29 0a 09 20 28 keys) ",")).. (
1740: 71 72 79 73 74 72 20 20 28 73 74 72 69 6e 67 2d qrystr (string-
1750: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 intersperse (map
1760: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 63 6f 6e (lambda (x)(con
1770: 63 20 28 76 65 63 74 6f 72 2d 72 65 66 20 78 20 c (vector-ref x
1780: 30 29 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 0) "=?")) keys)
1790: 22 20 41 4e 44 20 22 29 29 0a 09 20 28 6b 65 79 " AND ")).. (key
17a0: 76 61 6c 73 20 23 66 29 0a 09 20 28 74 65 73 74 vals #f).. (test
17b0: 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 s-hash (make-has
17c0: 68 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 3b h-table))). ;
17d0: 3b 20 66 69 72 73 74 20 6c 6f 6f 6b 20 75 70 20 ; first look up
17e0: 74 68 65 20 6b 65 79 20 76 61 6c 75 65 73 20 66 the key values f
17f0: 72 6f 6d 20 74 68 65 20 72 75 6e 20 73 65 6c 65 rom the run sele
1800: 63 74 65 64 20 62 79 20 72 75 6e 2d 69 64 0a 20 cted by run-id.
1810: 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d (sqlite3:for-
1820: 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20 20 28 each-row . (
1830: 6c 61 6d 62 64 61 20 28 61 20 2e 20 62 29 0a 20 lambda (a . b).
1840: 20 20 20 20 20 20 28 73 65 74 21 20 6b 65 79 76 (set! keyv
1850: 61 6c 73 20 28 63 6f 6e 73 20 61 20 62 29 29 29 als (cons a b)))
1860: 0a 20 20 20 20 20 64 62 0a 20 20 20 20 20 28 63 . db. (c
1870: 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 73 65 onc "SELECT " se
1880: 6c 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 lstr " FROM runs
1890: 20 57 48 45 52 45 20 69 64 3d 3f 20 4f 52 44 45 WHERE id=? ORDE
18a0: 52 20 42 59 20 65 76 65 6e 74 5f 74 69 6d 65 20 R BY event_time
18b0: 44 45 53 43 3b 22 29 20 72 75 6e 2d 69 64 29 0a DESC;") run-id).
18c0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 6b 65 79 (if (not key
18d0: 76 61 6c 73 29 0a 09 27 28 29 0a 09 28 6c 65 74 vals)..'()..(let
18e0: 20 28 28 70 72 65 76 2d 72 75 6e 2d 69 64 73 20 ((prev-run-ids
18f0: 27 28 29 29 29 0a 09 20 20 28 61 70 70 6c 79 20 '())).. (apply
1900: 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 sqlite3:for-each
1910: 2d 72 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 -row... (lambda
1920: 28 69 64 29 0a 09 09 20 20 20 28 73 65 74 21 20 (id)... (set!
1930: 70 72 65 76 2d 72 75 6e 2d 69 64 73 20 28 63 6f prev-run-ids (co
1940: 6e 73 20 69 64 20 70 72 65 76 2d 72 75 6e 2d 69 ns id prev-run-i
1950: 64 73 29 29 29 0a 09 09 20 64 62 0a 09 09 20 28 ds)))... db... (
1960: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 69 64 20 conc "SELECT id
1970: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 FROM runs WHERE
1980: 22 20 71 72 79 73 74 72 20 22 20 41 4e 44 20 69 " qrystr " AND i
1990: 64 20 21 3d 20 3f 3b 22 29 20 28 61 70 70 65 6e d != ?;") (appen
19a0: 64 20 6b 65 79 76 61 6c 73 20 28 6c 69 73 74 20 d keyvals (list
19b0: 72 75 6e 2d 69 64 29 29 29 0a 09 20 20 3b 3b 20 run-id))).. ;;
19c0: 63 6f 6c 6c 65 63 74 20 61 6c 6c 20 6d 61 74 63 collect all matc
19d0: 68 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 74 hing tests for t
19e0: 68 65 20 72 75 6e 73 20 74 68 65 6e 0a 09 20 20 he runs then..
19f0: 3b 3b 20 65 78 74 72 61 63 74 20 74 68 65 20 6d ;; extract the m
1a00: 6f 73 74 20 72 65 63 65 6e 74 20 74 65 73 74 20 ost recent test
1a10: 61 6e 64 20 72 65 74 75 72 6e 20 74 68 61 74 2e and return that.
1a20: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
1a30: 20 34 20 22 73 65 6c 73 74 72 3a 20 22 20 73 65 4 "selstr: " se
1a40: 6c 73 74 72 20 22 2c 20 71 72 79 73 74 72 3a 20 lstr ", qrystr:
1a50: 22 20 71 72 79 73 74 72 20 22 2c 20 6b 65 79 76 " qrystr ", keyv
1a60: 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 20 0a als: " keyvals .
1a70: 09 09 20 20 20 20 20 20 20 22 2c 20 70 72 65 76 .. ", prev
1a80: 69 6f 75 73 20 72 75 6e 20 69 64 73 20 66 6f 75 ious run ids fou
1a90: 6e 64 3a 20 22 20 70 72 65 76 2d 72 75 6e 2d 69 nd: " prev-run-i
1aa0: 64 73 29 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c ds).. (if (null
1ab0: 3f 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 29 20 ? prev-run-ids)
1ac0: 27 28 29 20 20 3b 3b 20 6e 6f 20 70 72 65 76 69 '() ;; no previ
1ad0: 6f 75 73 20 72 75 6e 73 3f 20 72 65 74 75 72 6e ous runs? return
1ae0: 20 6e 75 6c 6c 0a 09 20 20 20 20 20 20 28 6c 65 null.. (le
1af0: 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 t loop ((hed (ca
1b00: 72 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 29 29 r prev-run-ids))
1b10: 0a 09 09 09 20 28 74 61 6c 20 28 63 64 72 20 70 .... (tal (cdr p
1b20: 72 65 76 2d 72 75 6e 2d 69 64 73 29 29 29 0a 09 rev-run-ids)))..
1b30: 09 28 6c 65 74 20 28 28 72 65 73 75 6c 74 73 20 .(let ((results
1b40: 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f (db-get-tests-fo
1b50: 72 2d 72 75 6e 20 64 62 20 68 65 64 20 74 65 73 r-run db hed tes
1b60: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
1b70: 20 27 28 29 20 27 28 29 29 29 29 0a 09 09 20 20 '() '())))...
1b80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
1b90: 47 6f 74 20 74 65 73 74 73 20 66 6f 72 20 72 75 Got tests for ru
1ba0: 6e 2d 69 64 20 22 20 72 75 6e 2d 69 64 20 22 2c n-id " run-id ",
1bb0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 74 65 73 test-name " tes
1bc0: 74 2d 6e 61 6d 65 20 0a 09 09 09 20 20 20 20 20 t-name ....
1bd0: 20 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 20 22 ", item-path "
1be0: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 72 65 73 item-path " res
1bf0: 75 6c 74 73 3a 20 22 20 28 69 6e 74 65 72 73 70 ults: " (intersp
1c00: 65 72 73 65 20 72 65 73 75 6c 74 73 20 22 5c 6e erse results "\n
1c10: 22 29 29 0a 09 09 20 20 3b 3b 20 4b 65 65 70 20 "))... ;; Keep
1c20: 6f 6e 6c 79 20 74 68 65 20 79 6f 75 6e 67 65 73 only the younges
1c30: 74 20 6f 66 20 61 6e 79 20 74 65 73 74 2f 69 74 t of any test/it
1c40: 65 6d 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 0a 09 em combination..
1c50: 09 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 09 . (for-each ...
1c60: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 (lambda (test
1c70: 64 61 74 29 0a 09 09 20 20 20 20 20 28 6c 65 74 dat)... (let
1c80: 2a 20 28 28 66 75 6c 6c 2d 74 65 73 74 6e 61 6d * ((full-testnam
1c90: 65 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 e (conc (db:test
1ca0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
1cb0: 73 74 64 61 74 29 20 22 2f 22 20 28 64 62 3a 74 stdat) "/" (db:t
1cc0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 est-get-item-pat
1cd0: 68 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 09 h testdat)))....
1ce0: 20 20 20 20 28 73 74 6f 72 65 64 2d 74 65 73 74 (stored-test
1cf0: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
1d00: 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 73 ef/default tests
1d10: 2d 68 61 73 68 20 66 75 6c 6c 2d 74 65 73 74 6e -hash full-testn
1d20: 61 6d 65 20 23 66 29 29 29 0a 09 09 20 20 20 20 ame #f)))...
1d30: 20 20 20 28 69 66 20 28 6f 72 20 28 6e 6f 74 20 (if (or (not
1d40: 73 74 6f 72 65 64 2d 74 65 73 74 29 0a 09 09 09 stored-test)....
1d50: 20 20 20 20 20 20 20 28 61 6e 64 20 73 74 6f 72 (and stor
1d60: 65 64 2d 74 65 73 74 0a 09 09 09 09 20 20 20 20 ed-test.....
1d70: 28 3e 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (> (db:test-get-
1d80: 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 event_time testd
1d90: 61 74 29 28 64 62 3a 74 65 73 74 2d 67 65 74 2d at)(db:test-get-
1da0: 65 76 65 6e 74 5f 74 69 6d 65 20 73 74 6f 72 65 event_time store
1db0: 64 2d 74 65 73 74 29 29 29 29 0a 09 09 09 20 20 d-test))))....
1dc0: 20 3b 3b 20 74 68 69 73 20 74 65 73 74 20 69 73 ;; this test is
1dd0: 20 79 6f 75 6e 67 65 72 2c 20 73 74 6f 72 65 20 younger, store
1de0: 69 74 20 69 6e 20 74 68 65 20 68 61 73 68 0a 09 it in the hash..
1df0: 09 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 .. (hash-table
1e00: 2d 73 65 74 21 20 74 65 73 74 73 2d 68 61 73 68 -set! tests-hash
1e10: 20 66 75 6c 6c 2d 74 65 73 74 6e 61 6d 65 20 74 full-testname t
1e20: 65 73 74 64 61 74 29 29 29 29 0a 09 09 20 20 20 estdat))))...
1e30: 72 65 73 75 6c 74 73 29 0a 09 09 20 20 28 69 66 results)... (if
1e40: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 09 20 (null? tal)...
1e50: 20 20 20 20 20 28 6d 61 70 20 63 64 72 20 28 68 (map cdr (h
1e60: 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 ash-table->alist
1e70: 20 74 65 73 74 73 2d 68 61 73 68 29 29 20 3b 3b tests-hash)) ;;
1e80: 20 72 65 74 75 72 6e 20 61 20 6c 69 73 74 20 6f return a list o
1e90: 66 20 74 68 65 20 6d 6f 73 74 20 72 65 63 65 6e f the most recen
1ea0: 74 20 74 65 73 74 73 0a 09 09 20 20 20 20 20 20 t tests...
1eb0: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 (loop (car tal)(
1ec0: 63 64 72 20 74 61 6c 29 29 29 29 29 29 29 29 29 cdr tal)))))))))
1ed0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 )..(define (test
1ee0: 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 20 -set-status! db
1ef0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1f00: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 69 74 state status it
1f10: 65 6d 64 61 74 2d 6f 72 2d 70 61 74 68 20 63 6f emdat-or-path co
1f20: 6d 6d 65 6e 74 20 64 61 74 29 0a 20 20 28 6c 65 mment dat). (le
1f30: 74 2a 20 28 28 72 65 61 6c 2d 73 74 61 74 75 73 t* ((real-status
1f40: 20 73 74 61 74 75 73 29 0a 09 20 28 69 74 65 6d status).. (item
1f50: 2d 70 61 74 68 20 20 20 28 69 66 20 28 73 74 72 -path (if (str
1f60: 69 6e 67 3f 20 69 74 65 6d 64 61 74 2d 6f 72 2d ing? itemdat-or-
1f70: 70 61 74 68 29 20 69 74 65 6d 64 61 74 2d 6f 72 path) itemdat-or
1f80: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 -path (item-list
1f90: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 2d 6f ->path itemdat-o
1fa0: 72 2d 70 61 74 68 29 29 29 0a 09 20 28 74 65 73 r-path))).. (tes
1fb0: 74 64 61 74 20 20 20 20 20 28 64 62 3a 67 65 74 tdat (db:get
1fc0: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 -test-info db ru
1fd0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
1fe0: 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 28 74 65 tem-path)).. (te
1ff0: 73 74 2d 69 64 20 20 20 20 20 28 69 66 20 74 65 st-id (if te
2000: 73 74 64 61 74 20 28 64 62 3a 74 65 73 74 2d 67 stdat (db:test-g
2010: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 23 et-id testdat) #
2020: 66 29 29 0a 09 20 28 6f 74 68 65 72 64 61 74 20 f)).. (otherdat
2030: 20 20 20 28 69 66 20 64 61 74 20 64 61 74 20 28 (if dat dat (
2040: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
2050: 29 29 0a 09 20 3b 3b 20 62 65 66 6f 72 65 20 70 )).. ;; before p
2060: 72 6f 63 65 65 64 69 6e 67 20 77 65 20 6d 75 73 roceeding we mus
2070: 74 20 66 69 6e 64 20 6f 75 74 20 69 66 20 74 68 t find out if th
2080: 65 20 70 72 65 76 69 6f 75 73 20 74 65 73 74 20 e previous test
2090: 28 77 68 65 72 65 20 61 6c 6c 20 6b 65 79 73 20 (where all keys
20a0: 6d 61 74 63 68 65 64 20 65 78 63 65 70 74 20 72 matched except r
20b0: 75 6e 6e 61 6d 65 29 0a 09 20 3b 3b 20 77 61 73 unname).. ;; was
20c0: 20 57 41 49 56 45 44 20 69 66 20 74 68 69 73 20 WAIVED if this
20d0: 74 65 73 74 20 69 73 20 46 41 49 4c 0a 09 20 28 test is FAIL.. (
20e0: 77 61 69 76 65 64 20 20 20 28 69 66 20 28 65 71 waived (if (eq
20f0: 75 61 6c 3f 20 73 74 61 74 75 73 20 22 46 41 49 ual? status "FAI
2100: 4c 22 29 0a 09 09 20 20 20 20 20 20 20 28 6c 65 L")... (le
2110: 74 20 28 28 70 72 65 76 2d 74 65 73 74 20 28 74 t ((prev-test (t
2120: 65 73 74 3a 67 65 74 2d 70 72 65 76 69 6f 75 73 est:get-previous
2130: 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 -test-run-record
2140: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
2150: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 name item-path))
2160: 29 0a 09 09 09 20 28 69 66 20 70 72 65 76 2d 74 ).... (if prev-t
2170: 65 73 74 20 3b 3b 20 74 72 75 65 20 69 66 20 77 est ;; true if w
2180: 65 20 66 6f 75 6e 64 20 61 20 70 72 65 76 69 6f e found a previo
2190: 75 73 20 74 65 73 74 20 69 6e 20 74 68 69 73 20 us test in this
21a0: 72 75 6e 20 73 65 72 69 65 73 0a 09 09 09 20 20 run series....
21b0: 20 20 20 28 6c 65 74 20 28 28 70 72 65 76 2d 73 (let ((prev-s
21c0: 74 61 74 75 73 20 28 64 62 3a 74 65 73 74 2d 67 tatus (db:test-g
21d0: 65 74 2d 73 74 61 74 75 73 20 20 20 70 72 65 76 et-status prev
21e0: 2d 74 65 73 74 29 29 0a 09 09 09 09 20 20 20 28 -test))..... (
21f0: 70 72 65 76 2d 73 74 61 74 65 20 20 28 64 62 3a prev-state (db:
2200: 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 20 test-get-state
2210: 20 20 70 72 65 76 2d 74 65 73 74 29 29 0a 09 09 prev-test))...
2220: 09 09 20 20 20 28 70 72 65 76 2d 63 6f 6d 6d 65 .. (prev-comme
2230: 6e 74 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d nt (db:test-get-
2240: 63 6f 6d 6d 65 6e 74 20 70 72 65 76 2d 74 65 73 comment prev-tes
2250: 74 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 t))).... (
2260: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 70 debug:print 4 "p
2270: 72 65 76 2d 73 74 61 74 75 73 20 22 20 70 72 65 rev-status " pre
2280: 76 2d 73 74 61 74 75 73 20 22 2c 20 70 72 65 76 v-status ", prev
2290: 2d 73 74 61 74 65 20 22 20 70 72 65 76 2d 73 74 -state " prev-st
22a0: 61 74 65 20 22 2c 20 70 72 65 76 2d 63 6f 6d 6d ate ", prev-comm
22b0: 65 6e 74 20 22 20 70 72 65 76 2d 63 6f 6d 6d 65 ent " prev-comme
22c0: 6e 74 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 nt).... (i
22d0: 66 20 28 61 6e 64 20 28 65 71 75 61 6c 3f 20 70 f (and (equal? p
22e0: 72 65 76 2d 73 74 61 74 65 20 20 22 43 4f 4d 50 rev-state "COMP
22f0: 4c 45 54 45 44 22 29 0a 09 09 09 09 09 28 65 71 LETED")......(eq
2300: 75 61 6c 3f 20 70 72 65 76 2d 73 74 61 74 75 73 ual? prev-status
2310: 20 22 57 41 49 56 45 44 22 29 29 0a 09 09 09 09 "WAIVED")).....
2320: 20 20 20 70 72 65 76 2d 63 6f 6d 6d 65 6e 74 20 prev-comment
2330: 3b 3b 20 77 61 69 76 65 64 20 69 73 20 65 69 74 ;; waived is eit
2340: 68 65 72 20 74 68 65 20 63 6f 6d 6d 65 6e 74 20 her the comment
2350: 6f 72 20 23 66 0a 09 09 09 09 20 20 20 23 66 29 or #f..... #f)
2360: 29 0a 09 09 09 20 20 20 20 20 23 66 29 29 0a 09 ).... #f))..
2370: 09 20 20 20 20 20 20 20 23 66 29 29 29 0a 20 20 . #f))).
2380: 20 20 28 69 66 20 77 61 69 76 65 64 20 28 73 65 (if waived (se
2390: 74 21 20 72 65 61 6c 2d 73 74 61 74 75 73 20 22 t! real-status "
23a0: 57 41 49 56 45 44 22 29 29 0a 20 20 20 20 28 64 WAIVED")). (d
23b0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 65 ebug:print 4 "re
23c0: 61 6c 2d 73 74 61 74 75 73 20 22 20 72 65 61 6c al-status " real
23d0: 2d 73 74 61 74 75 73 20 22 2c 20 77 61 69 76 65 -status ", waive
23e0: 64 20 22 20 77 61 69 76 65 64 20 22 2c 20 73 74 d " waived ", st
23f0: 61 74 75 73 20 22 20 73 74 61 74 75 73 29 0a 0a atus " status)..
2400: 20 20 20 20 3b 3b 20 75 70 64 61 74 65 20 74 68 ;; update th
2410: 65 20 70 72 69 6d 61 72 79 20 72 65 63 6f 72 64 e primary record
2420: 20 49 46 20 73 74 61 74 65 20 41 4e 44 20 73 74 IF state AND st
2430: 61 74 75 73 20 61 72 65 20 64 65 66 69 6e 65 64 atus are defined
2440: 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 73 74 . (if (and st
2450: 61 74 65 20 73 74 61 74 75 73 29 0a 09 28 73 71 ate status)..(sq
2460: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
2470: 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 "UPDATE tests S
2480: 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 ET state=?,statu
2490: 73 3d 3f 2c 65 76 65 6e 74 5f 74 69 6d 65 3d 73 s=?,event_time=s
24a0: 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f trftime('%s','no
24b0: 77 27 29 20 57 48 45 52 45 20 72 75 6e 5f 69 64 w') WHERE run_id
24c0: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
24d0: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
24e0: 3f 3b 22 20 0a 09 09 09 20 73 74 61 74 65 20 72 ?;" .... state r
24f0: 65 61 6c 2d 73 74 61 74 75 73 20 72 75 6e 2d 69 eal-status run-i
2500: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
2510: 2d 70 61 74 68 29 29 0a 0a 20 20 20 20 3b 3b 20 -path)).. ;;
2520: 69 66 20 73 74 61 74 75 73 20 69 73 20 22 41 55 if status is "AU
2530: 54 4f 22 20 74 68 65 6e 20 63 61 6c 6c 20 72 6f TO" then call ro
2540: 6c 6c 75 70 0a 20 20 20 20 28 69 66 20 28 61 6e llup. (if (an
2550: 64 20 74 65 73 74 2d 69 64 20 73 74 61 74 65 20 d test-id state
2560: 73 74 61 74 75 73 20 28 65 71 75 61 6c 3f 20 73 status (equal? s
2570: 74 61 74 75 73 20 22 41 55 54 4f 22 29 29 20 0a tatus "AUTO")) .
2580: 09 28 64 62 3a 74 65 73 74 2d 64 61 74 61 2d 72 .(db:test-data-r
2590: 6f 6c 6c 75 70 20 64 62 20 74 65 73 74 2d 69 64 ollup db test-id
25a0: 29 29 0a 0a 20 20 20 20 3b 3b 20 61 64 64 20 6d )).. ;; add m
25b0: 65 74 61 64 61 74 61 20 28 6e 65 65 64 20 74 6f etadata (need to
25c0: 20 64 6f 20 74 68 69 73 20 77 61 79 20 74 6f 20 do this way to
25d0: 61 76 6f 69 64 20 53 51 4c 20 69 6e 6a 65 63 74 avoid SQL inject
25e0: 69 6f 6e 20 69 73 73 75 65 73 29 0a 0a 20 20 20 ion issues)..
25f0: 20 3b 3b 20 3a 66 69 72 73 74 5f 65 72 72 0a 20 ;; :first_err.
2600: 20 20 20 3b 3b 20 28 6c 65 74 20 28 28 76 61 6c ;; (let ((val
2610: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
2620: 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 64 61 /default otherda
2630: 74 20 22 3a 66 69 72 73 74 5f 65 72 72 22 20 23 t ":first_err" #
2640: 66 29 29 29 0a 20 20 20 20 3b 3b 20 20 20 28 69 f))). ;; (i
2650: 66 20 76 61 6c 0a 20 20 20 20 3b 3b 20 20 20 20 f val. ;;
2660: 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 (sqlite3:exec
2670: 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 ute db "UPDATE t
2680: 65 73 74 73 20 53 45 54 20 66 69 72 73 74 5f 65 ests SET first_e
2690: 72 72 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 rr=? WHERE run_i
26a0: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
26b0: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
26c0: 3d 3f 3b 22 20 76 61 6c 20 72 75 6e 2d 69 64 20 =?;" val run-id
26d0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
26e0: 61 74 68 29 29 29 0a 20 20 20 20 3b 3b 20 0a 20 ath))). ;; .
26f0: 20 20 20 3b 3b 20 3b 3b 20 3a 66 69 72 73 74 5f ;; ;; :first_
2700: 77 61 72 6e 0a 20 20 20 20 3b 3b 20 28 6c 65 74 warn. ;; (let
2710: 20 28 28 76 61 6c 20 28 68 61 73 68 2d 74 61 62 ((val (hash-tab
2720: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 6f le-ref/default o
2730: 74 68 65 72 64 61 74 20 22 3a 66 69 72 73 74 5f therdat ":first_
2740: 77 61 72 6e 22 20 23 66 29 29 29 0a 20 20 20 20 warn" #f))).
2750: 3b 3b 20 20 20 28 69 66 20 76 61 6c 0a 20 20 20 ;; (if val.
2760: 20 3b 3b 20 20 20 20 20 20 20 28 73 71 6c 69 74 ;; (sqlit
2770: 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 e3:execute db "U
2780: 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 20 PDATE tests SET
2790: 66 69 72 73 74 5f 77 61 72 6e 3d 3f 20 57 48 45 first_warn=? WHE
27a0: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
27b0: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
27c0: 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 20 76 61 6c tem_path=?;" val
27d0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
27e0: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 0a e item-path)))..
27f0: 20 20 20 20 28 6c 65 74 20 28 28 63 61 74 65 67 (let ((categ
2800: 6f 72 79 20 28 68 61 73 68 2d 74 61 62 6c 65 2d ory (hash-table-
2810: 72 65 66 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 ref/default othe
2820: 72 64 61 74 20 22 3a 63 61 74 65 67 6f 72 79 22 rdat ":category"
2830: 20 22 22 29 29 0a 09 20 20 28 76 61 72 69 61 62 "")).. (variab
2840: 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 le (hash-table-r
2850: 65 66 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 ef/default other
2860: 64 61 74 20 22 3a 76 61 72 69 61 62 6c 65 22 20 dat ":variable"
2870: 22 22 29 29 0a 09 20 20 28 76 61 6c 75 65 20 20 "")).. (value
2880: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
2890: 66 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 64 f/default otherd
28a0: 61 74 20 22 3a 76 61 6c 75 65 22 20 20 20 20 23 at ":value" #
28b0: 66 29 29 0a 09 20 20 28 65 78 70 65 63 74 65 64 f)).. (expected
28c0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
28d0: 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 64 61 /default otherda
28e0: 74 20 22 3a 65 78 70 65 63 74 65 64 22 20 23 66 t ":expected" #f
28f0: 29 29 0a 09 20 20 28 74 6f 6c 20 20 20 20 20 20 )).. (tol
2900: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
2910: 64 65 66 61 75 6c 74 20 6f 74 68 65 72 64 61 74 default otherdat
2920: 20 22 3a 74 6f 6c 22 20 20 20 20 20 20 23 66 29 ":tol" #f)
2930: 29 0a 09 20 20 28 75 6e 69 74 73 20 20 20 20 28 ).. (units (
2940: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
2950: 65 66 61 75 6c 74 20 6f 74 68 65 72 64 61 74 20 efault otherdat
2960: 22 3a 75 6e 69 74 73 22 20 20 20 20 22 22 29 29 ":units" ""))
2970: 0a 09 20 20 28 64 63 6f 6d 6d 65 6e 74 20 28 68 .. (dcomment (h
2980: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
2990: 66 61 75 6c 74 20 6f 74 68 65 72 64 61 74 20 22 fault otherdat "
29a0: 3a 63 6f 6d 6d 65 6e 74 22 20 20 22 22 29 29 29 :comment" "")))
29b0: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
29c0: 69 6e 74 20 34 20 0a 09 09 20 20 20 22 63 61 74 int 4 ... "cat
29d0: 65 67 6f 72 79 3a 20 22 20 63 61 74 65 67 6f 72 egory: " categor
29e0: 79 20 22 2c 20 76 61 72 69 61 62 6c 65 3a 20 22 y ", variable: "
29f0: 20 76 61 72 69 61 62 6c 65 20 22 2c 20 76 61 6c variable ", val
2a00: 75 65 3a 20 22 20 76 61 6c 75 65 0a 09 09 20 20 ue: " value...
2a10: 20 22 2c 20 65 78 70 65 63 74 65 64 3a 20 22 20 ", expected: "
2a20: 65 78 70 65 63 74 65 64 20 22 2c 20 74 6f 6c 3a expected ", tol:
2a30: 20 22 20 74 6f 6c 20 22 2c 20 75 6e 69 74 73 3a " tol ", units:
2a40: 20 22 20 75 6e 69 74 73 29 0a 20 20 20 20 20 20 " units).
2a50: 28 69 66 20 28 61 6e 64 20 76 61 6c 75 65 20 65 (if (and value e
2a60: 78 70 65 63 74 65 64 20 74 6f 6c 29 20 3b 3b 20 xpected tol) ;;
2a70: 61 6c 6c 20 74 68 72 65 65 20 72 65 71 75 69 72 all three requir
2a80: 65 64 0a 09 20 20 28 64 62 3a 63 73 76 2d 3e 74 ed.. (db:csv->t
2a90: 65 73 74 2d 64 61 74 61 20 64 62 20 74 65 73 74 est-data db test
2aa0: 2d 69 64 20 0a 09 09 09 20 20 20 20 20 28 63 6f -id .... (co
2ab0: 6e 63 20 63 61 74 65 67 6f 72 79 20 22 2c 22 0a nc category ",".
2ac0: 09 09 09 09 20 20 20 76 61 72 69 61 62 6c 65 20 .... variable
2ad0: 22 2c 22 0a 09 09 09 09 20 20 20 76 61 6c 75 65 ","..... value
2ae0: 20 20 20 20 22 2c 22 0a 09 09 09 09 20 20 20 65 ","..... e
2af0: 78 70 65 63 74 65 64 20 22 2c 22 0a 09 09 09 09 xpected ",".....
2b00: 20 20 20 74 6f 6c 20 20 20 20 20 20 22 2c 22 0a tol ",".
2b10: 09 09 09 09 20 20 20 75 6e 69 74 73 20 20 20 20 .... units
2b20: 22 2c 22 0a 09 09 09 09 20 20 20 64 63 6f 6d 6d ","..... dcomm
2b30: 65 6e 74 20 22 2c 22 29 29 29 29 0a 09 09 09 09 ent ",")))).....
2b40: 20 20 20 0a 20 20 20 20 3b 3b 20 6e 65 65 64 20 . ;; need
2b50: 74 6f 20 75 70 64 61 74 65 20 74 68 65 20 74 6f to update the to
2b60: 70 20 74 65 73 74 20 72 65 63 6f 72 64 20 69 66 p test record if
2b70: 20 50 41 53 53 20 6f 72 20 46 41 49 4c 20 61 6e PASS or FAIL an
2b80: 64 20 74 68 69 73 20 69 73 20 61 20 73 75 62 74 d this is a subt
2b90: 65 73 74 0a 20 20 20 20 28 69 66 20 28 61 6e 64 est. (if (and
2ba0: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 74 (not (equal? it
2bb0: 65 6d 2d 70 61 74 68 20 22 22 29 29 0a 09 20 20 em-path ""))..
2bc0: 20 20 20 28 6f 72 20 28 65 71 75 61 6c 3f 20 73 (or (equal? s
2bd0: 74 61 74 75 73 20 22 50 41 53 53 22 29 0a 09 09 tatus "PASS")...
2be0: 20 28 65 71 75 61 6c 3f 20 73 74 61 74 75 73 20 (equal? status
2bf0: 22 57 41 52 4e 22 29 0a 09 09 20 28 65 71 75 61 "WARN")... (equa
2c00: 6c 3f 20 73 74 61 74 75 73 20 22 46 41 49 4c 22 l? status "FAIL"
2c10: 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 73 74 61 )... (equal? sta
2c20: 74 75 73 20 22 57 41 49 56 45 44 22 29 0a 09 09 tus "WAIVED")...
2c30: 20 28 65 71 75 61 6c 3f 20 73 74 61 74 75 73 20 (equal? status
2c40: 22 52 55 4e 4e 49 4e 47 22 29 29 29 0a 09 28 62 "RUNNING")))..(b
2c50: 65 67 69 6e 0a 09 20 20 28 73 71 6c 69 74 65 33 egin.. (sqlite3
2c60: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 20 64 62 :execute .. db
2c70: 0a 09 20 20 20 22 55 50 44 41 54 45 20 74 65 73 .. "UPDATE tes
2c80: 74 73 20 0a 20 20 20 20 20 20 20 20 20 20 20 20 ts .
2c90: 20 53 45 54 20 66 61 69 6c 5f 63 6f 75 6e 74 3d SET fail_count=
2ca0: 28 53 45 4c 45 43 54 20 63 6f 75 6e 74 28 69 64 (SELECT count(id
2cb0: 29 20 46 52 4f 4d 20 74 65 73 74 73 20 57 48 45 ) FROM tests WHE
2cc0: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
2cd0: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
2ce0: 74 65 6d 5f 70 61 74 68 20 21 3d 20 27 27 20 41 tem_path != '' A
2cf0: 4e 44 20 73 74 61 74 75 73 3d 27 46 41 49 4c 27 ND status='FAIL'
2d00: 29 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ),.
2d10: 20 20 20 20 70 61 73 73 5f 63 6f 75 6e 74 3d 28 pass_count=(
2d20: 53 45 4c 45 43 54 20 63 6f 75 6e 74 28 69 64 29 SELECT count(id)
2d30: 20 46 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 FROM tests WHER
2d40: 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 E run_id=? AND t
2d50: 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 estname=? AND it
2d60: 65 6d 5f 70 61 74 68 20 21 3d 20 27 27 20 41 4e em_path != '' AN
2d70: 44 20 28 73 74 61 74 75 73 3d 27 50 41 53 53 27 D (status='PASS'
2d80: 20 4f 52 20 73 74 61 74 75 73 3d 27 57 41 52 4e OR status='WARN
2d90: 27 20 4f 52 20 73 74 61 74 75 73 3d 27 57 41 49 ' OR status='WAI
2da0: 56 45 44 27 29 29 0a 20 20 20 20 20 20 20 20 20 VED')).
2db0: 20 20 20 20 57 48 45 52 45 20 72 75 6e 5f 69 64 WHERE run_id
2dc0: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
2dd0: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
2de0: 27 27 3b 22 0a 09 20 20 20 72 75 6e 2d 69 64 20 '';".. run-id
2df0: 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d 69 64 test-name run-id
2e00: 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d 69 test-name run-i
2e10: 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a 09 20 20 d test-name)..
2e20: 28 69 66 20 28 65 71 75 61 6c 3f 20 73 74 61 74 (if (equal? stat
2e30: 75 73 20 22 52 55 4e 4e 49 4e 47 22 29 20 3b 3b us "RUNNING") ;;
2e40: 20 72 75 6e 6e 69 6e 67 20 74 61 6b 65 73 20 70 running takes p
2e50: 72 69 6f 72 69 74 79 20 6f 76 65 72 20 61 6c 6c riority over all
2e60: 20 6f 74 68 65 72 20 73 74 61 74 65 73 2c 20 66 other states, f
2e70: 6f 72 63 65 20 74 68 65 20 74 65 73 74 20 73 74 orce the test st
2e80: 61 74 65 20 74 6f 20 52 55 4e 4e 49 4e 47 0a 09 ate to RUNNING..
2e90: 20 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 (sqlite3:e
2ea0: 78 65 63 75 74 65 20 64 62 20 22 55 50 44 41 54 xecute db "UPDAT
2eb0: 45 20 74 65 73 74 73 20 53 45 54 20 73 74 61 74 E tests SET stat
2ec0: 65 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 e=? WHERE run_id
2ed0: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
2ee0: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
2ef0: 27 27 3b 22 20 72 75 6e 2d 69 64 20 74 65 73 74 '';" run-id test
2f00: 2d 6e 61 6d 65 29 0a 09 20 20 20 20 20 20 28 73 -name).. (s
2f10: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 0a 09 qlite3:execute..
2f20: 20 20 20 20 20 20 20 64 62 0a 09 20 20 20 20 20 db..
2f30: 20 20 22 55 50 44 41 54 45 20 74 65 73 74 73 0a "UPDATE tests.
2f40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2f50: 20 20 20 20 20 20 20 53 45 54 20 73 74 61 74 65 SET state
2f60: 3d 43 41 53 45 20 57 48 45 4e 20 28 53 45 4c 45 =CASE WHEN (SELE
2f70: 43 54 20 63 6f 75 6e 74 28 69 64 29 20 46 52 4f CT count(id) FRO
2f80: 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 M tests WHERE ru
2f90: 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e n_id=? AND testn
2fa0: 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 ame=? AND item_p
2fb0: 61 74 68 20 21 3d 20 27 27 20 41 4e 44 20 73 74 ath != '' AND st
2fc0: 61 74 65 20 69 6e 20 28 27 52 55 4e 4e 49 4e 47 ate in ('RUNNING
2fd0: 27 2c 27 4e 4f 54 5f 53 54 41 52 54 45 44 27 29 ','NOT_STARTED')
2fe0: 29 20 3e 20 30 20 54 48 45 4e 20 0a 20 20 20 20 ) > 0 THEN .
2ff0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3000: 20 20 20 20 20 20 27 52 55 4e 4e 49 4e 47 27 0a 'RUNNING'.
3010: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3020: 20 20 20 20 20 20 20 45 4c 53 45 20 27 43 4f 4d ELSE 'COM
3030: 50 4c 45 54 45 44 27 20 45 4e 44 2c 0a 20 20 20 PLETED' END,.
3040: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3050: 20 20 20 20 20 20 20 73 74 61 74 75 73 3d 43 41 status=CA
3060: 53 45 20 57 48 45 4e 20 66 61 69 6c 5f 63 6f 75 SE WHEN fail_cou
3070: 6e 74 20 3e 20 30 20 54 48 45 4e 20 27 46 41 49 nt > 0 THEN 'FAI
3080: 4c 27 20 57 48 45 4e 20 70 61 73 73 5f 63 6f 75 L' WHEN pass_cou
3090: 6e 74 20 3e 20 30 20 41 4e 44 20 66 61 69 6c 5f nt > 0 AND fail_
30a0: 63 6f 75 6e 74 3d 30 20 54 48 45 4e 20 27 50 41 count=0 THEN 'PA
30b0: 53 53 27 20 45 4c 53 45 20 27 55 4e 4b 4e 4f 57 SS' ELSE 'UNKNOW
30c0: 4e 27 20 45 4e 44 0a 20 20 20 20 20 20 20 20 20 N' END.
30d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 57 48 WH
30e0: 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 ERE run_id=? AND
30f0: 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 testname=? AND
3100: 69 74 65 6d 5f 70 61 74 68 3d 27 27 3b 22 0a 09 item_path='';"..
3110: 20 20 20 20 20 20 20 72 75 6e 2d 69 64 20 74 65 run-id te
3120: 73 74 2d 6e 61 6d 65 20 72 75 6e 2d 69 64 20 74 st-name run-id t
3130: 65 73 74 2d 6e 61 6d 65 29 29 29 29 0a 20 20 20 est-name)))).
3140: 20 28 69 66 20 28 6f 72 20 28 61 6e 64 20 28 73 (if (or (and (s
3150: 74 72 69 6e 67 3f 20 63 6f 6d 6d 65 6e 74 29 0a tring? comment).
3160: 09 09 20 28 73 74 72 69 6e 67 2d 6d 61 74 63 68 .. (string-match
3170: 20 28 72 65 67 65 78 70 20 22 5c 5c 53 2b 22 29 (regexp "\\S+")
3180: 20 63 6f 6d 6d 65 6e 74 29 29 0a 09 20 20 20 20 comment))..
3190: 77 61 69 76 65 64 29 0a 09 28 73 71 6c 69 74 65 waived)..(sqlite
31a0: 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 3:execute db "UP
31b0: 44 41 54 45 20 74 65 73 74 73 20 53 45 54 20 63 DATE tests SET c
31c0: 6f 6d 6d 65 6e 74 3d 3f 20 57 48 45 52 45 20 72 omment=? WHERE r
31d0: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
31e0: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
31f0: 70 61 74 68 3d 3f 3b 22 0a 09 09 09 20 28 69 66 path=?;".... (if
3200: 20 77 61 69 76 65 64 20 77 61 69 76 65 64 20 63 waived waived c
3210: 6f 6d 6d 65 6e 74 29 20 72 75 6e 2d 69 64 20 74 omment) run-id t
3220: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
3230: 74 68 29 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 th)). ))..(de
3240: 66 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 6c fine (test-set-l
3250: 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 og! db run-id te
3260: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 61 74 20 st-name itemdat
3270: 6c 6f 67 66 29 20 0a 20 20 28 6c 65 74 20 28 28 logf) . (let ((
3280: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d item-path (item-
3290: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 list->path itemd
32a0: 61 74 29 29 29 0a 20 20 20 20 28 73 71 6c 69 74 at))). (sqlit
32b0: 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 e3:execute db "U
32c0: 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 20 PDATE tests SET
32d0: 66 69 6e 61 6c 5f 6c 6f 67 66 3d 3f 20 57 48 45 final_logf=? WHE
32e0: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
32f0: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
3300: 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 20 0a 09 09 tem_path=?;" ...
3310: 20 20 20 20 20 6c 6f 67 66 20 72 75 6e 2d 69 64 logf run-id
3320: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
3330: 70 61 74 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 path)))..(define
3340: 20 28 74 65 73 74 2d 73 65 74 2d 74 6f 70 6c 6f (test-set-toplo
3350: 67 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 g! db run-id tes
3360: 74 2d 6e 61 6d 65 20 6c 6f 67 66 29 20 0a 20 20 t-name logf) .
3370: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 (sqlite3:execute
3380: 20 64 62 20 22 55 50 44 41 54 45 20 74 65 73 74 db "UPDATE test
3390: 73 20 53 45 54 20 66 69 6e 61 6c 5f 6c 6f 67 66 s SET final_logf
33a0: 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d =? WHERE run_id=
33b0: 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f ? AND testname=?
33c0: 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 27 AND item_path='
33d0: 27 3b 22 20 0a 09 09 20 20 20 6c 6f 67 66 20 72 ';" ... logf r
33e0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 un-id test-name)
33f0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 )..(define (test
3400: 73 3a 73 75 6d 6d 61 72 69 7a 65 2d 69 74 65 6d s:summarize-item
3410: 73 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 s db run-id test
3420: 2d 6e 61 6d 65 20 66 6f 72 63 65 29 0a 20 20 3b -name force). ;
3430: 3b 20 69 66 20 6e 6f 74 20 66 6f 72 63 65 20 74 ; if not force t
3440: 68 65 6e 20 6f 6e 6c 79 20 75 70 64 61 74 65 20 hen only update
3450: 74 68 65 20 72 65 63 6f 72 64 20 69 66 20 6f 6e the record if on
3460: 65 20 6f 66 20 74 68 65 73 65 20 69 73 20 74 72 e of these is tr
3470: 75 65 3a 0a 20 20 3b 3b 20 20 20 31 2e 20 6c 6f ue:. ;; 1. lo
3480: 67 66 20 69 73 20 22 6c 6f 67 2f 66 69 6e 61 6c gf is "log/final
3490: 2e 6c 6f 67 0a 20 20 3b 3b 20 20 20 32 2e 20 6c .log. ;; 2. l
34a0: 6f 67 66 20 69 73 20 73 61 6d 65 20 61 73 20 6f ogf is same as o
34b0: 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 0a 20 20 utputfilename.
34c0: 28 6c 65 74 20 28 28 6f 75 74 70 75 74 66 69 6c (let ((outputfil
34d0: 65 6e 61 6d 65 20 28 63 6f 6e 63 20 22 6d 65 67 ename (conc "meg
34e0: 61 74 65 73 74 2d 72 6f 6c 6c 75 70 2d 22 20 74 atest-rollup-" t
34f0: 65 73 74 2d 6e 61 6d 65 20 22 2e 68 74 6d 6c 22 est-name ".html"
3500: 29 29 0a 09 28 6f 72 69 67 2d 64 69 72 20 20 20 ))..(orig-dir
3510: 20 20 20 20 28 63 75 72 72 65 6e 74 2d 64 69 72 (current-dir
3520: 65 63 74 6f 72 79 29 29 0a 09 28 6c 6f 67 66 20 ectory))..(logf
3530: 20 20 20 20 20 20 20 20 20 20 23 66 29 29 0a 20 #f)).
3540: 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d (sqlite3:for-
3550: 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20 20 28 each-row . (
3560: 6c 61 6d 62 64 61 20 28 70 61 74 68 20 66 69 6e lambda (path fin
3570: 61 6c 5f 6c 6f 67 66 29 0a 20 20 20 20 20 20 20 al_logf).
3580: 28 73 65 74 21 20 6c 6f 67 66 20 66 69 6e 61 6c (set! logf final
3590: 5f 6c 6f 67 66 29 0a 20 20 20 20 20 20 20 28 69 _logf). (i
35a0: 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 70 61 f (directory? pa
35b0: 74 68 29 0a 09 20 20 20 28 62 65 67 69 6e 0a 09 th).. (begin..
35c0: 20 20 20 20 20 28 70 72 69 6e 74 20 22 46 6f 75 (print "Fou
35d0: 6e 64 20 70 61 74 68 3a 20 22 20 70 61 74 68 29 nd path: " path)
35e0: 0a 09 20 20 20 20 20 28 63 68 61 6e 67 65 2d 64 .. (change-d
35f0: 69 72 65 63 74 6f 72 79 20 70 61 74 68 29 29 0a irectory path)).
3600: 09 20 20 20 20 20 3b 3b 20 28 73 65 74 21 20 6f . ;; (set! o
3610: 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 20 28 63 utputfilename (c
3620: 6f 6e 63 20 70 61 74 68 20 22 2f 22 20 6f 75 74 onc path "/" out
3630: 70 75 74 66 69 6c 65 6e 61 6d 65 29 29 29 0a 09 putfilename)))..
3640: 20 20 20 28 70 72 69 6e 74 20 22 4e 6f 20 73 75 (print "No su
3650: 63 68 20 70 61 74 68 3a 20 22 20 70 61 74 68 29 ch path: " path)
3660: 29 29 0a 20 20 20 20 20 64 62 20 0a 20 20 20 20 )). db .
3670: 20 22 53 45 4c 45 43 54 20 72 75 6e 64 69 72 2c "SELECT rundir,
3680: 66 69 6e 61 6c 5f 6c 6f 67 66 20 46 52 4f 4d 20 final_logf FROM
3690: 74 65 73 74 73 20 57 48 45 52 45 20 72 75 6e 5f tests WHERE run_
36a0: 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d id=? AND testnam
36b0: 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 e=? AND item_pat
36c0: 68 3d 27 27 3b 22 0a 20 20 20 20 20 72 75 6e 2d h='';". run-
36d0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 id test-name).
36e0: 20 20 28 70 72 69 6e 74 20 22 73 75 6d 6d 61 72 (print "summar
36f0: 69 7a 65 2d 69 74 65 6d 73 20 77 69 74 68 20 6c ize-items with l
3700: 6f 67 66 20 22 20 6c 6f 67 66 29 0a 20 20 20 20 ogf " logf).
3710: 28 69 66 20 28 6f 72 20 28 65 71 75 61 6c 3f 20 (if (or (equal?
3720: 6c 6f 67 66 20 22 6c 6f 67 73 2f 66 69 6e 61 6c logf "logs/final
3730: 2e 6c 6f 67 22 29 0a 09 20 20 20 20 28 65 71 75 .log").. (equ
3740: 61 6c 3f 20 6c 6f 67 66 20 6f 75 74 70 75 74 66 al? logf outputf
3750: 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 20 66 6f ilename).. fo
3760: 72 63 65 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 rce)..(begin..
3770: 28 69 66 20 28 6f 62 74 61 69 6e 2d 64 6f 74 2d (if (obtain-dot-
3780: 6c 6f 63 6b 20 6f 75 74 70 75 74 66 69 6c 65 6e lock outputfilen
3790: 61 6d 65 20 31 20 32 30 20 33 30 29 20 3b 3b 20 ame 1 20 30) ;;
37a0: 72 65 74 72 79 20 65 76 65 72 79 20 73 65 63 6f retry every seco
37b0: 6e 64 20 66 6f 72 20 32 30 20 73 65 63 6f 6e 64 nd for 20 second
37c0: 73 2c 20 63 61 6c 6c 20 69 74 20 64 65 61 64 20 s, call it dead
37d0: 61 66 74 65 72 20 33 30 20 73 65 63 6f 6e 64 73 after 30 seconds
37e0: 20 61 6e 64 20 73 74 65 61 6c 20 74 68 65 20 6c and steal the l
37f0: 6f 63 6b 0a 09 20 20 20 20 20 20 28 70 72 69 6e ock.. (prin
3800: 74 20 22 4f 62 74 61 69 6e 65 64 20 6c 6f 63 6b t "Obtained lock
3810: 20 66 6f 72 20 22 20 6f 75 74 70 75 74 66 69 6c for " outputfil
3820: 65 6e 61 6d 65 29 0a 09 20 20 20 20 20 20 28 70 ename).. (p
3830: 72 69 6e 74 20 22 46 61 69 6c 65 64 20 74 6f 20 rint "Failed to
3840: 6f 62 74 61 69 6e 20 6c 6f 63 6b 20 66 6f 72 20 obtain lock for
3850: 22 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 " outputfilename
3860: 29 29 0a 09 20 20 28 6c 65 74 20 28 28 6f 75 70 )).. (let ((oup
3870: 20 20 20 20 28 6f 70 65 6e 2d 6f 75 74 70 75 74 (open-output
3880: 2d 66 69 6c 65 20 6f 75 74 70 75 74 66 69 6c 65 -file outputfile
3890: 6e 61 6d 65 29 29 0a 09 09 28 63 6f 75 6e 74 73 name))...(counts
38a0: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c (make-hash-tabl
38b0: 65 29 29 0a 09 09 28 73 74 61 74 65 63 6f 75 6e e))...(statecoun
38c0: 74 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 ts (make-hash-ta
38d0: 62 6c 65 29 29 0a 09 09 28 6f 75 74 74 78 74 20 ble))...(outtxt
38e0: 22 22 29 0a 09 09 28 74 6f 74 20 20 20 20 30 29 "")...(tot 0)
38f0: 29 0a 09 20 20 20 20 28 77 69 74 68 2d 6f 75 74 ).. (with-out
3900: 70 75 74 2d 74 6f 2d 70 6f 72 74 0a 09 09 6f 75 put-to-port...ou
3910: 70 0a 09 20 20 20 20 20 20 28 6c 61 6d 62 64 61 p.. (lambda
3920: 20 28 29 0a 09 09 28 73 65 74 21 20 6f 75 74 74 ()...(set! outt
3930: 78 74 20 28 63 6f 6e 63 20 6f 75 74 74 78 74 20 xt (conc outtxt
3940: 22 3c 68 74 6d 6c 3e 3c 74 69 74 6c 65 3e 53 75 "<html><title>Su
3950: 6d 6d 61 72 79 3a 20 22 20 74 65 73 74 2d 6e 61 mmary: " test-na
3960: 6d 65 20 0a 09 09 09 09 20 20 20 22 3c 2f 74 69 me ..... "</ti
3970: 74 6c 65 3e 3c 62 6f 64 79 3e 3c 68 32 3e 53 75 tle><body><h2>Su
3980: 6d 6d 61 72 79 20 66 6f 72 20 22 20 74 65 73 74 mmary for " test
3990: 2d 6e 61 6d 65 20 22 3c 2f 68 32 3e 22 29 29 0a -name "</h2>")).
39a0: 09 09 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 ..(sqlite3:for-e
39b0: 61 63 68 2d 72 6f 77 20 0a 09 09 20 28 6c 61 6d ach-row ... (lam
39c0: 62 64 61 20 28 69 64 20 69 74 65 6d 70 61 74 68 bda (id itempath
39d0: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 75 state status ru
39e0: 6e 5f 64 75 72 61 74 69 6f 6e 20 6c 6f 67 66 20 n_duration logf
39f0: 63 6f 6d 6d 65 6e 74 29 0a 09 09 20 20 20 28 68 comment)... (h
3a00: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 ash-table-set! c
3a10: 6f 75 6e 74 73 20 73 74 61 74 75 73 20 28 2b 20 ounts status (+
3a20: 31 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 1 (hash-table-re
3a30: 66 2f 64 65 66 61 75 6c 74 20 63 6f 75 6e 74 73 f/default counts
3a40: 20 73 74 61 74 75 73 20 30 29 29 29 0a 09 09 20 status 0)))...
3a50: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 (hash-table-se
3a60: 74 21 20 73 74 61 74 65 63 6f 75 6e 74 73 20 73 t! statecounts s
3a70: 74 61 74 65 20 28 2b 20 31 20 28 68 61 73 68 2d tate (+ 1 (hash-
3a80: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
3a90: 74 20 73 74 61 74 65 63 6f 75 6e 74 73 20 73 74 t statecounts st
3aa0: 61 74 65 20 30 29 29 29 0a 09 09 20 20 20 28 73 ate 0)))... (s
3ab0: 65 74 21 20 6f 75 74 74 78 74 20 28 63 6f 6e 63 et! outtxt (conc
3ac0: 20 6f 75 74 74 78 74 20 22 3c 74 72 3e 22 0a 09 outtxt "<tr>"..
3ad0: 09 09 09 20 20 20 20 20 20 22 3c 74 64 3e 3c 61 ... "<td><a
3ae0: 20 68 72 65 66 3d 5c 22 22 20 69 74 65 6d 70 61 href=\"" itempa
3af0: 74 68 20 22 2f 22 20 6c 6f 67 66 20 22 5c 22 3e th "/" logf "\">
3b00: 20 22 20 69 74 65 6d 70 61 74 68 20 22 3c 2f 61 " itempath "</a
3b10: 3e 3c 2f 74 64 3e 22 20 0a 09 09 09 09 20 20 20 ></td>" .....
3b20: 20 20 20 22 3c 74 64 3e 22 20 73 74 61 74 65 20 "<td>" state
3b30: 20 20 20 22 3c 2f 74 64 3e 22 20 0a 09 09 09 09 "</td>" .....
3b40: 20 20 20 20 20 20 22 3c 74 64 3e 3c 66 6f 6e 74 "<td><font
3b50: 20 63 6f 6c 6f 72 3d 22 20 28 63 6f 6d 6d 6f 6e color=" (common
3b60: 3a 67 65 74 2d 63 6f 6c 6f 72 2d 66 72 6f 6d 2d :get-color-from-
3b70: 73 74 61 74 75 73 20 73 74 61 74 75 73 29 0a 09 status status)..
3b80: 09 09 09 20 20 20 20 20 20 22 3e 22 20 20 20 73 ... ">" s
3b90: 74 61 74 75 73 20 20 20 22 3c 2f 66 6f 6e 74 3e tatus "</font>
3ba0: 3c 2f 74 64 3e 22 0a 09 09 09 09 20 20 20 20 20 </td>".....
3bb0: 20 22 3c 74 64 3e 22 20 28 69 66 20 28 65 71 75 "<td>" (if (equ
3bc0: 61 6c 3f 20 63 6f 6d 6d 65 6e 74 20 22 22 29 0a al? comment "").
3bd0: 09 09 09 09 09 09 20 22 26 6e 62 73 70 3b 22 0a ...... " ".
3be0: 09 09 09 09 09 09 20 63 6f 6d 6d 65 6e 74 29 20 ...... comment)
3bf0: 22 3c 2f 74 64 3e 22 0a 09 09 09 09 09 09 20 22 "</td>"....... "
3c00: 3c 2f 74 72 3e 22 29 29 29 0a 09 09 20 64 62 0a </tr>")))... db.
3c10: 09 09 20 22 53 45 4c 45 43 54 20 69 64 2c 69 74 .. "SELECT id,it
3c20: 65 6d 5f 70 61 74 68 2c 73 74 61 74 65 2c 73 74 em_path,state,st
3c30: 61 74 75 73 2c 72 75 6e 5f 64 75 72 61 74 69 6f atus,run_duratio
3c40: 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d n,final_logf,com
3c50: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 73 20 ment FROM tests
3c60: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
3c70: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
3c80: 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d 20 27 D item_path != '
3c90: 27 3b 22 0a 09 09 20 72 75 6e 2d 69 64 20 74 65 ';"... run-id te
3ca0: 73 74 2d 6e 61 6d 65 29 0a 0a 09 09 28 70 72 69 st-name)....(pri
3cb0: 6e 74 20 22 3c 74 61 62 6c 65 3e 3c 74 72 3e 3c nt "<table><tr><
3cc0: 74 64 20 76 61 6c 69 67 6e 3d 5c 22 74 6f 70 5c td valign=\"top\
3cd0: 22 3e 22 29 0a 09 09 3b 3b 20 50 72 69 6e 74 20 ">")...;; Print
3ce0: 6f 75 74 20 73 74 61 74 73 20 66 6f 72 20 73 74 out stats for st
3cf0: 61 74 75 73 0a 09 09 28 73 65 74 21 20 74 6f 74 atus...(set! tot
3d00: 20 30 29 0a 09 09 28 70 72 69 6e 74 20 22 3c 74 0)...(print "<t
3d10: 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e 67 able cellspacing
3d20: 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 3d 5c 22 =\"0\" border=\"
3d30: 31 5c 22 3e 3c 74 72 3e 3c 74 64 20 63 6f 6c 73 1\"><tr><td cols
3d40: 70 61 6e 3d 5c 22 32 5c 22 3e 3c 68 32 3e 53 74 pan=\"2\"><h2>St
3d50: 61 74 65 20 73 74 61 74 73 3c 2f 68 32 3e 3c 2f ate stats</h2></
3d60: 74 64 3e 3c 2f 74 72 3e 22 29 0a 09 09 28 66 6f td></tr>")...(fo
3d70: 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 r-each (lambda (
3d80: 73 74 61 74 65 29 0a 09 09 09 20 20 20 20 28 73 state).... (s
3d90: 65 74 21 20 74 6f 74 20 28 2b 20 74 6f 74 20 28 et! tot (+ tot (
3da0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 73 hash-table-ref s
3db0: 74 61 74 65 63 6f 75 6e 74 73 20 73 74 61 74 65 tatecounts state
3dc0: 29 29 29 0a 09 09 09 20 20 20 20 28 70 72 69 6e ))).... (prin
3dd0: 74 20 22 3c 74 72 3e 3c 74 64 3e 22 20 73 74 61 t "<tr><td>" sta
3de0: 74 65 20 22 3c 2f 74 64 3e 3c 74 64 3e 22 20 28 te "</td><td>" (
3df0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 73 hash-table-ref s
3e00: 74 61 74 65 63 6f 75 6e 74 73 20 73 74 61 74 65 tatecounts state
3e10: 29 20 22 3c 2f 74 64 3e 3c 2f 74 72 3e 22 29 29 ) "</td></tr>"))
3e20: 0a 09 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c .... (hash-tabl
3e30: 65 2d 6b 65 79 73 20 73 74 61 74 65 63 6f 75 6e e-keys statecoun
3e40: 74 73 29 29 0a 09 09 28 70 72 69 6e 74 20 22 3c ts))...(print "<
3e50: 74 72 3e 3c 74 64 3e 54 6f 74 61 6c 3c 2f 74 64 tr><td>Total</td
3e60: 3e 3c 74 64 3e 22 20 74 6f 74 20 22 3c 2f 74 64 ><td>" tot "</td
3e70: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 22 29 ></tr></table>")
3e80: 0a 09 09 28 70 72 69 6e 74 20 22 3c 2f 74 64 3e ...(print "</td>
3e90: 3c 74 64 20 76 61 6c 69 67 6e 3d 5c 22 74 6f 70 <td valign=\"top
3ea0: 5c 22 3e 22 29 0a 09 09 3b 3b 20 50 72 69 6e 74 \">")...;; Print
3eb0: 20 6f 75 74 20 73 74 61 74 73 20 66 6f 72 20 73 out stats for s
3ec0: 74 61 74 65 0a 09 09 28 73 65 74 21 20 74 6f 74 tate...(set! tot
3ed0: 20 30 29 0a 09 09 28 70 72 69 6e 74 20 22 3c 74 0)...(print "<t
3ee0: 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e 67 able cellspacing
3ef0: 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 3d 5c 22 =\"0\" border=\"
3f00: 31 5c 22 3e 3c 74 72 3e 3c 74 64 20 63 6f 6c 73 1\"><tr><td cols
3f10: 70 61 6e 3d 5c 22 32 5c 22 3e 3c 68 32 3e 53 74 pan=\"2\"><h2>St
3f20: 61 74 75 73 20 73 74 61 74 73 3c 2f 68 32 3e 3c atus stats</h2><
3f30: 2f 74 64 3e 3c 2f 74 72 3e 22 29 0a 09 09 28 66 /td></tr>")...(f
3f40: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
3f50: 28 73 74 61 74 75 73 29 0a 09 09 09 20 20 20 20 (status)....
3f60: 28 73 65 74 21 20 74 6f 74 20 28 2b 20 74 6f 74 (set! tot (+ tot
3f70: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
3f80: 20 63 6f 75 6e 74 73 20 73 74 61 74 75 73 29 29 counts status))
3f90: 29 0a 09 09 09 20 20 20 20 28 70 72 69 6e 74 20 ).... (print
3fa0: 22 3c 74 72 3e 3c 74 64 3e 3c 66 6f 6e 74 20 63 "<tr><td><font c
3fb0: 6f 6c 6f 72 3d 5c 22 22 20 28 63 6f 6d 6d 6f 6e olor=\"" (common
3fc0: 3a 67 65 74 2d 63 6f 6c 6f 72 2d 66 72 6f 6d 2d :get-color-from-
3fd0: 73 74 61 74 75 73 20 73 74 61 74 75 73 29 20 22 status status) "
3fe0: 5c 22 3e 22 20 73 74 61 74 75 73 0a 09 09 09 09 \">" status.....
3ff0: 20 20 20 22 3c 2f 66 6f 6e 74 3e 3c 2f 74 64 3e "</font></td>
4000: 3c 74 64 3e 22 20 28 68 61 73 68 2d 74 61 62 6c <td>" (hash-tabl
4010: 65 2d 72 65 66 20 63 6f 75 6e 74 73 20 73 74 61 e-ref counts sta
4020: 74 75 73 29 20 22 3c 2f 74 64 3e 3c 2f 74 72 3e tus) "</td></tr>
4030: 22 29 29 0a 09 09 09 20 20 28 68 61 73 68 2d 74 ")).... (hash-t
4040: 61 62 6c 65 2d 6b 65 79 73 20 63 6f 75 6e 74 73 able-keys counts
4050: 29 29 0a 09 09 28 70 72 69 6e 74 20 22 3c 74 72 ))...(print "<tr
4060: 3e 3c 74 64 3e 54 6f 74 61 6c 3c 2f 74 64 3e 3c ><td>Total</td><
4070: 74 64 3e 22 20 74 6f 74 20 22 3c 2f 74 64 3e 3c td>" tot "</td><
4080: 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 22 29 0a 09 /tr></table>")..
4090: 09 28 70 72 69 6e 74 20 22 3c 2f 74 64 3e 3c 2f .(print "</td></
40a0: 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e td></tr></table>
40b0: 22 29 0a 0a 09 09 28 70 72 69 6e 74 20 22 3c 74 ")....(print "<t
40c0: 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e 67 able cellspacing
40d0: 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 3d 5c 22 =\"0\" border=\"
40e0: 31 5c 22 3e 22 20 0a 09 09 20 20 20 20 20 20 20 1\">" ...
40f0: 22 3c 74 72 3e 3c 74 64 3e 49 74 65 6d 3c 2f 74 "<tr><td>Item</t
4100: 64 3e 3c 74 64 3e 53 74 61 74 65 3c 2f 74 64 3e d><td>State</td>
4110: 3c 74 64 3e 53 74 61 74 75 73 3c 2f 74 64 3e 3c <td>Status</td><
4120: 74 64 3e 43 6f 6d 6d 65 6e 74 3c 2f 74 64 3e 22 td>Comment</td>"
4130: 0a 09 09 20 20 20 20 20 20 20 6f 75 74 74 78 74 ... outtxt
4140: 20 22 3c 2f 74 61 62 6c 65 3e 3c 2f 62 6f 64 79 "</table></body
4150: 3e 3c 2f 68 74 6d 6c 3e 22 29 0a 09 09 28 72 65 ></html>")...(re
4160: 6c 65 61 73 65 2d 64 6f 74 2d 6c 6f 63 6b 20 6f lease-dot-lock o
4170: 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 29 29 utputfilename)))
4180: 0a 09 20 20 20 20 28 63 6c 6f 73 65 2d 6f 75 74 .. (close-out
4190: 70 75 74 2d 70 6f 72 74 20 6f 75 70 29 0a 09 20 put-port oup)..
41a0: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
41b0: 74 6f 72 79 20 6f 72 69 67 2d 64 69 72 29 0a 09 tory orig-dir)..
41c0: 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d 74 6f (test-set-to
41d0: 70 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 20 plog! db run-id
41e0: 74 65 73 74 2d 6e 61 6d 65 20 6f 75 74 70 75 74 test-name output
41f0: 66 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 20 29 filename).. )
4200: 29 29 29 29 0a 0a 3b 3b 20 3b 3b 20 54 4f 44 4f ))))..;; ;; TODO
4210: 3a 20 43 6f 6e 76 65 72 67 65 20 74 68 69 73 20 : Converge this
4220: 77 69 74 68 20 64 62 3a 67 65 74 2d 74 65 73 74 with db:get-test
4230: 2d 69 6e 66 6f 0a 3b 3b 20 28 64 65 66 69 6e 65 -info.;; (define
4240: 20 28 72 75 6e 73 3a 67 65 74 2d 74 65 73 74 2d (runs:get-test-
4250: 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 info db run-id t
4260: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
4270: 74 68 29 0a 3b 3b 20 20 20 28 6c 65 74 20 28 28 th).;; (let ((
4280: 72 65 73 20 23 66 29 29 20 3b 3b 20 28 76 65 63 res #f)) ;; (vec
4290: 74 6f 72 20 23 66 20 23 66 20 23 66 20 23 66 20 tor #f #f #f #f
42a0: 23 66 20 23 66 29 29 29 0a 3b 3b 20 20 20 20 20 #f #f))).;;
42b0: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 (sqlite3:for-eac
42c0: 68 2d 72 6f 77 20 0a 3b 3b 20 20 20 20 20 20 28 h-row .;; (
42d0: 6c 61 6d 62 64 61 20 28 69 64 20 72 75 6e 2d 69 lambda (id run-i
42e0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 d test-name stat
42f0: 65 20 73 74 61 74 75 73 29 0a 3b 3b 20 20 20 20 e status).;;
4300: 20 20 20 20 28 73 65 74 21 20 72 65 73 20 28 76 (set! res (v
4310: 65 63 74 6f 72 20 69 64 20 72 75 6e 2d 69 64 20 ector id run-id
4320: 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 test-name state
4330: 73 74 61 74 75 73 20 69 74 65 6d 2d 70 61 74 68 status item-path
4340: 29 29 29 0a 3b 3b 20 20 20 20 20 20 64 62 20 22 ))).;; db "
4350: 53 45 4c 45 43 54 20 69 64 2c 72 75 6e 5f 69 64 SELECT id,run_id
4360: 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c ,testname,state,
4370: 73 74 61 74 75 73 20 46 52 4f 4d 20 74 65 73 74 status FROM test
4380: 73 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f s WHERE run_id=?
4390: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
43a0: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
43b0: 22 0a 3b 3b 20 20 20 20 20 20 72 75 6e 2d 69 64 ".;; run-id
43c0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
43d0: 70 61 74 68 29 0a 3b 3b 20 20 20 20 20 72 65 73 path).;; res
43e0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e ))..(define (run
43f0: 73 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d s:test-get-full-
4400: 70 61 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 path test). (le
4410: 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 t* ((testname (d
4420: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
4430: 61 6d 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 ame test)).. (
4440: 69 74 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 itempath (db:tes
4450: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t-get-item-path
4460: 74 65 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e test))). (con
4470: 63 20 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 c testname (if (
4480: 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 equal? itempath
4490: 22 22 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 "") "" (conc "("
44a0: 20 69 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 itempath ")")))
44b0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 63 68 65 ))..(define (che
44c0: 63 6b 2d 76 61 6c 69 64 2d 69 74 65 6d 73 20 63 ck-valid-items c
44d0: 6c 61 73 73 20 69 74 65 6d 29 0a 20 20 28 6c 65 lass item). (le
44e0: 74 20 28 28 76 61 6c 69 64 2d 76 61 6c 75 65 73 t ((valid-values
44f0: 20 28 6c 65 74 20 28 28 73 20 28 63 6f 6e 66 69 (let ((s (confi
4500: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
4510: 64 61 74 2a 20 22 76 61 6c 69 64 76 61 6c 75 65 dat* "validvalue
4520: 73 22 20 63 6c 61 73 73 29 29 29 0a 09 09 09 28 s" class)))....(
4530: 69 66 20 73 20 28 73 74 72 69 6e 67 2d 73 70 6c if s (string-spl
4540: 69 74 20 73 29 20 23 66 29 29 29 29 0a 20 20 20 it s) #f)))).
4550: 20 28 69 66 20 76 61 6c 69 64 2d 76 61 6c 75 65 (if valid-value
4560: 73 0a 09 28 69 66 20 28 6d 65 6d 62 65 72 20 69 s..(if (member i
4570: 74 65 6d 20 76 61 6c 69 64 2d 76 61 6c 75 65 73 tem valid-values
4580: 29 0a 09 20 20 20 20 69 74 65 6d 20 23 66 29 0a ).. item #f).
4590: 09 69 74 65 6d 29 29 29 0a 0a 28 64 65 66 69 6e .item)))..(defin
45a0: 65 20 28 74 65 73 74 73 74 65 70 2d 73 65 74 2d e (teststep-set-
45b0: 73 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 status! db run-i
45c0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 d test-name test
45d0: 73 74 65 70 2d 6e 61 6d 65 20 73 74 61 74 65 2d step-name state-
45e0: 69 6e 20 73 74 61 74 75 73 2d 69 6e 20 69 74 65 in status-in ite
45f0: 6d 64 61 74 20 63 6f 6d 6d 65 6e 74 20 6c 6f 67 mdat comment log
4600: 66 69 6c 65 29 0a 20 20 28 64 65 62 75 67 3a 70 file). (debug:p
4610: 72 69 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 rint 4 "run-id:
4620: 22 20 72 75 6e 2d 69 64 20 22 20 74 65 73 74 2d " run-id " test-
4630: 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d name: " test-nam
4640: 65 29 0a 20 20 28 6c 65 74 2a 20 28 28 73 74 61 e). (let* ((sta
4650: 74 65 20 20 20 20 20 28 63 68 65 63 6b 2d 76 61 te (check-va
4660: 6c 69 64 2d 69 74 65 6d 73 20 22 73 74 61 74 65 lid-items "state
4670: 22 20 73 74 61 74 65 2d 69 6e 29 29 0a 09 20 28 " state-in)).. (
4680: 73 74 61 74 75 73 20 20 20 20 28 63 68 65 63 6b status (check
4690: 2d 76 61 6c 69 64 2d 69 74 65 6d 73 20 22 73 74 -valid-items "st
46a0: 61 74 75 73 22 20 73 74 61 74 75 73 2d 69 6e 29 atus" status-in)
46b0: 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20 28 ).. (item-path (
46c0: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
46d0: 69 74 65 6d 64 61 74 29 29 0a 09 20 28 74 65 73 itemdat)).. (tes
46e0: 74 64 61 74 20 20 20 28 64 62 3a 67 65 74 2d 74 tdat (db:get-t
46f0: 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d est-info db run-
4700: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
4710: 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 28 64 m-path))). (d
4720: 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65 ebug:print 5 "te
4730: 73 74 64 61 74 3a 20 22 20 74 65 73 74 64 61 74 stdat: " testdat
4740: 29 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 74 ). (if (and t
4750: 65 73 74 64 61 74 20 3b 3b 20 69 66 20 74 68 65 estdat ;; if the
4760: 20 73 65 63 74 69 6f 6e 20 65 78 69 73 74 73 20 section exists
4770: 74 68 65 6e 20 66 6f 72 63 65 20 73 70 65 63 69 then force speci
4780: 66 69 63 61 74 69 6f 6e 20 42 55 47 2c 20 49 20 fication BUG, I
4790: 64 6f 6e 27 74 20 6c 69 6b 65 20 68 6f 77 20 74 don't like how t
47a0: 68 69 73 20 77 6f 72 6b 73 2e 0a 09 20 20 20 20 his works...
47b0: 20 28 6f 72 20 28 6e 6f 74 20 73 74 61 74 65 29 (or (not state)
47c0: 28 6e 6f 74 20 73 74 61 74 75 73 29 29 29 0a 09 (not status)))..
47d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
47e0: 57 41 52 4e 49 4e 47 3a 20 49 6e 76 61 6c 69 64 WARNING: Invalid
47f0: 20 22 20 28 69 66 20 73 74 61 74 75 73 20 22 73 " (if status "s
4800: 74 61 74 75 73 22 20 22 73 74 61 74 65 22 29 0a tatus" "state").
4810: 09 20 20 20 20 20 20 20 22 20 76 61 6c 75 65 20 . " value
4820: 5c 22 22 20 28 69 66 20 73 74 61 74 75 73 20 73 \"" (if status s
4830: 74 61 74 65 2d 69 6e 20 73 74 61 74 75 73 2d 69 tate-in status-i
4840: 6e 29 20 22 5c 22 2c 20 75 70 64 61 74 65 20 79 n) "\", update y
4850: 6f 75 72 20 76 61 6c 69 64 76 61 6c 75 65 73 20 our validvalues
4860: 73 65 63 74 69 6f 6e 20 69 6e 20 6d 65 67 61 74 section in megat
4870: 65 73 74 2e 63 6f 6e 66 69 67 22 29 29 0a 20 20 est.config")).
4880: 20 20 28 69 66 20 74 65 73 74 64 61 74 0a 09 28 (if testdat..(
4890: 6c 65 74 20 28 28 74 65 73 74 2d 69 64 20 28 74 let ((test-id (t
48a0: 65 73 74 3a 67 65 74 2d 69 64 20 74 65 73 74 64 est:get-id testd
48b0: 61 74 29 29 29 0a 09 20 20 3b 3b 20 46 49 58 4d at))).. ;; FIXM
48c0: 45 20 2d 20 74 68 69 73 20 73 68 6f 75 6c 64 20 E - this should
48d0: 6e 6f 74 20 75 70 64 61 74 65 20 74 68 65 20 6c not update the l
48e0: 6f 67 66 69 6c 65 20 75 6e 6c 65 73 73 20 69 74 ogfile unless it
48f0: 20 69 73 20 73 70 65 63 69 66 69 65 64 2e 0a 09 is specified...
4900: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 (sqlite3:execu
4910: 74 65 20 64 62 20 0a 09 09 09 22 49 4e 53 45 52 te db ...."INSER
4920: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 69 6e 74 T OR REPLACE int
4930: 6f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 o test_steps (te
4940: 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 st_id,stepname,s
4950: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e tate,status,even
4960: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 2c 6c t_time,comment,l
4970: 6f 67 66 69 6c 65 29 20 56 41 4c 55 45 53 28 3f ogfile) VALUES(?
4980: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 ,?,?,?,strftime(
4990: 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f 2c 3f 29 '%s','now'),?,?)
49a0: 3b 22 0a 09 09 09 74 65 73 74 2d 69 64 20 74 65 ;"....test-id te
49b0: 73 74 73 74 65 70 2d 6e 61 6d 65 20 73 74 61 74 ststep-name stat
49c0: 65 2d 69 6e 20 73 74 61 74 75 73 2d 69 6e 20 28 e-in status-in (
49d0: 69 66 20 63 6f 6d 6d 65 6e 74 20 63 6f 6d 6d 65 if comment comme
49e0: 6e 74 20 22 22 29 20 28 69 66 20 6c 6f 67 66 69 nt "") (if logfi
49f0: 6c 65 20 6c 6f 67 66 69 6c 65 20 22 22 29 29 29 le logfile "")))
4a00: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 ..(debug:print 0
4a10: 20 22 45 52 52 4f 52 3a 20 43 61 6e 27 74 20 75 "ERROR: Can't u
4a20: 70 64 61 74 65 20 22 20 74 65 73 74 2d 6e 61 6d pdate " test-nam
4a30: 65 20 22 20 66 6f 72 20 72 75 6e 20 22 20 72 75 e " for run " ru
4a40: 6e 2d 69 64 20 22 20 2d 3e 20 6e 6f 20 73 75 63 n-id " -> no suc
4a50: 68 20 74 65 73 74 20 69 6e 20 64 62 22 29 29 29 h test in db")))
4a60: 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 )..(define (test
4a70: 2d 67 65 74 2d 6b 69 6c 6c 2d 72 65 71 75 65 73 -get-kill-reques
4a80: 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 t db run-id test
4a90: 2d 6e 61 6d 65 20 69 74 65 6d 64 61 74 29 0a 20 -name itemdat).
4aa0: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 (let* ((item-pa
4ab0: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 th (item-list->p
4ac0: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 20 ath itemdat))..
4ad0: 28 74 65 73 74 64 61 74 20 20 20 28 64 62 3a 67 (testdat (db:g
4ae0: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 et-test-info db
4af0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
4b00: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 item-path))).
4b10: 20 20 28 65 71 75 61 6c 3f 20 28 74 65 73 74 3a (equal? (test:
4b20: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
4b30: 74 29 20 22 4b 49 4c 4c 52 45 51 22 29 29 29 0a t) "KILLREQ"))).
4b40: 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 73 .(define (test-s
4b50: 65 74 2d 6d 65 74 61 2d 69 6e 66 6f 20 64 62 20 et-meta-info db
4b60: 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 run-id testname
4b70: 69 74 65 6d 64 61 74 29 0a 20 20 28 6c 65 74 20 itemdat). (let
4b80: 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 ((item-path (ite
4b90: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 m-list->path ite
4ba0: 6d 64 61 74 29 29 0a 09 28 63 70 75 6c 6f 61 64 mdat))..(cpuload
4bb0: 20 20 28 67 65 74 2d 63 70 75 2d 6c 6f 61 64 29 (get-cpu-load)
4bc0: 29 0a 09 28 68 6f 73 74 6e 61 6d 65 20 28 67 65 )..(hostname (ge
4bd0: 74 2d 68 6f 73 74 2d 6e 61 6d 65 29 29 0a 09 28 t-host-name))..(
4be0: 64 69 73 6b 66 72 65 65 20 28 67 65 74 2d 64 66 diskfree (get-df
4bf0: 20 28 63 75 72 72 65 6e 74 2d 64 69 72 65 63 74 (current-direct
4c00: 6f 72 79 29 29 29 0a 09 28 75 6e 61 6d 65 20 20 ory)))..(uname
4c10: 20 20 28 67 65 74 2d 75 6e 61 6d 65 20 22 2d 73 (get-uname "-s
4c20: 72 76 70 69 6f 22 29 29 0a 09 28 72 75 6e 70 61 rvpio"))..(runpa
4c30: 74 68 20 20 28 63 75 72 72 65 6e 74 2d 64 69 72 th (current-dir
4c40: 65 63 74 6f 72 79 29 29 29 0a 20 20 20 20 28 73 ectory))). (s
4c50: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 qlite3:execute d
4c60: 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 b "UPDATE tests
4c70: 53 45 54 20 68 6f 73 74 3d 3f 2c 63 70 75 6c 6f SET host=?,cpulo
4c80: 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 3d 3f 2c ad=?,diskfree=?,
4c90: 75 6e 61 6d 65 3d 3f 2c 72 75 6e 64 69 72 3d 3f uname=?,rundir=?
4ca0: 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 WHERE run_id=?
4cb0: 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 AND testname=? A
4cc0: 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 ND item_path=?;"
4cd0: 0a 09 09 20 20 68 6f 73 74 6e 61 6d 65 0a 09 09 ... hostname...
4ce0: 20 20 63 70 75 6c 6f 61 64 0a 09 09 20 20 64 69 cpuload... di
4cf0: 73 6b 66 72 65 65 0a 09 09 20 20 75 6e 61 6d 65 skfree... uname
4d00: 0a 09 09 20 20 72 75 6e 70 61 74 68 0a 09 09 20 ... runpath...
4d10: 20 72 75 6e 2d 69 64 0a 09 09 20 20 74 65 73 74 run-id... test
4d20: 6e 61 6d 65 0a 09 09 20 20 69 74 65 6d 2d 70 61 name... item-pa
4d30: 74 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 th)))..(define (
4d40: 74 65 73 74 2d 75 70 64 61 74 65 2d 6d 65 74 61 test-update-meta
4d50: 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 -info db run-id
4d60: 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 64 61 74 testname itemdat
4d70: 20 6d 69 6e 75 74 65 73 20 63 70 75 6c 6f 61 64 minutes cpuload
4d80: 20 64 69 73 6b 66 72 65 65 20 74 6d 70 66 72 65 diskfree tmpfre
4d90: 65 29 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d e). (let ((item
4da0: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 -path (item-list
4db0: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 ->path itemdat))
4dc0: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69 ). (if (not i
4dd0: 74 65 6d 2d 70 61 74 68 29 28 62 65 67 69 6e 20 tem-path)(begin
4de0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
4df0: 57 41 52 4e 49 4e 47 3a 20 49 54 45 4d 50 41 54 WARNING: ITEMPAT
4e00: 48 20 6e 6f 74 20 73 65 74 2e 22 29 20 20 20 28 H not set.") (
4e10: 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 22 set! item-path "
4e20: 22 29 29 29 0a 20 20 20 20 3b 3b 20 28 6c 65 74 "))). ;; (let
4e30: 20 28 28 74 65 73 74 69 6e 66 6f 20 28 64 62 3a ((testinfo (db:
4e40: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
4e50: 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 run-id testname
4e60: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 item-path))).
4e70: 20 20 3b 3b 20 20 20 28 69 66 20 28 61 6e 64 20 ;; (if (and
4e80: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 64 62 (not (equal? (db
4e90: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 :test-get-status
4ea0: 20 74 65 73 74 69 6e 66 6f 29 20 22 43 4f 4d 50 testinfo) "COMP
4eb0: 4c 45 54 45 44 22 29 29 0a 20 20 20 20 3b 3b 20 LETED")). ;;
4ec0: 20 20 20 20 20 20 20 20 20 20 20 28 6e 6f 74 20 (not
4ed0: 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 (equal? (db:test
4ee0: 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 -get-status test
4ef0: 69 6e 66 6f 29 20 22 4b 49 4c 4c 52 45 51 22 29 info) "KILLREQ")
4f00: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 ). (sqlite3:e
4f10: 78 65 63 75 74 65 0a 20 20 20 20 20 64 62 0a 20 xecute. db.
4f20: 20 20 20 20 22 55 50 44 41 54 45 20 74 65 73 74 "UPDATE test
4f30: 73 20 53 45 54 20 63 70 75 6c 6f 61 64 3d 3f 2c s SET cpuload=?,
4f40: 64 69 73 6b 66 72 65 65 3d 3f 2c 72 75 6e 5f 64 diskfree=?,run_d
4f50: 75 72 61 74 69 6f 6e 3d 3f 2c 73 74 61 74 65 3d uration=?,state=
4f60: 27 52 55 4e 4e 49 4e 47 27 20 57 48 45 52 45 20 'RUNNING' WHERE
4f70: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
4f80: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
4f90: 5f 70 61 74 68 3d 3f 20 41 4e 44 20 73 74 61 74 _path=? AND stat
4fa0: 65 20 4e 4f 54 20 49 4e 20 28 27 43 4f 4d 50 4c e NOT IN ('COMPL
4fb0: 45 54 45 44 27 2c 27 4b 49 4c 4c 52 45 51 27 2c ETED','KILLREQ',
4fc0: 27 4b 49 4c 4c 45 44 27 29 3b 22 0a 20 20 20 20 'KILLED');".
4fd0: 20 63 70 75 6c 6f 61 64 0a 20 20 20 20 20 64 69 cpuload. di
4fe0: 73 6b 66 72 65 65 0a 20 20 20 20 20 6d 69 6e 75 skfree. minu
4ff0: 74 65 73 0a 20 20 20 20 20 72 75 6e 2d 69 64 0a tes. run-id.
5000: 20 20 20 20 20 74 65 73 74 6e 61 6d 65 0a 20 20 testname.
5010: 20 20 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a item-path))).
5020: 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 6d 65 .(define (set-me
5030: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 gatest-env-vars
5040: 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c 65 db run-id). (le
5050: 74 20 28 28 6b 65 79 73 20 28 64 62 2d 67 65 74 t ((keys (db-get
5060: 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 20 20 20 -keys db))).
5070: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
5080: 61 20 28 6b 65 79 29 0a 09 09 28 73 71 6c 69 74 a (key)...(sqlit
5090: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a e3:for-each-row.
50a0: 09 09 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 29 .. (lambda (val)
50b0: 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ... (debug:pri
50c0: 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 28 nt 2 "setenv " (
50d0: 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d key:get-fieldnam
50e0: 65 20 6b 65 79 29 20 22 20 22 20 76 61 6c 29 0a e key) " " val).
50f0: 09 09 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65 .. (setenv (ke
5100: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 y:get-fieldname
5110: 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 20 64 62 key) val))... db
5120: 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 45 4c 45 ... (conc "SELE
5130: 43 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 CT " (key:get-fi
5140: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 46 eldname key) " F
5150: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 ROM runs WHERE i
5160: 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e 2d 69 64 d=?;")... run-id
5170: 29 29 0a 09 20 20 20 20 20 20 6b 65 79 73 29 29 )).. keys))
5180: 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d )..(define (set-
5190: 69 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 item-env-vars it
51a0: 65 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 emdat). (for-ea
51b0: 63 68 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d ch (lambda (item
51c0: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a ).. (debug:
51d0: 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 print 2 "setenv
51e0: 22 20 28 63 61 72 20 69 74 65 6d 29 20 22 20 22 " (car item) " "
51f0: 20 28 63 61 64 72 20 69 74 65 6d 29 29 0a 09 20 (cadr item))..
5200: 20 20 20 20 20 28 73 65 74 65 6e 76 20 28 63 61 (setenv (ca
5210: 72 20 69 74 65 6d 29 20 28 63 61 64 72 20 69 74 r item) (cadr it
5220: 65 6d 29 29 29 0a 09 20 20 20 20 69 74 65 6d 64 em))).. itemd
5230: 61 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 67 at))..(define (g
5240: 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 et-all-legal-tes
5250: 74 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 ts). (let* ((te
5260: 73 74 73 20 20 28 67 6c 6f 62 20 28 63 6f 6e 63 sts (glob (conc
5270: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
5280: 74 73 2f 2a 22 29 29 29 0a 09 20 28 72 65 73 20 ts/*"))).. (res
5290: 20 20 20 27 28 29 29 29 0a 20 20 20 20 28 64 65 '())). (de
52a0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
52b0: 4f 3a 20 4c 6f 6f 6b 69 6e 67 20 61 74 20 74 65 O: Looking at te
52c0: 73 74 73 20 22 20 28 73 74 72 69 6e 67 2d 69 6e sts " (string-in
52d0: 74 65 72 73 70 65 72 73 65 20 74 65 73 74 73 20 tersperse tests
52e0: 22 2c 22 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 ",")). (for-e
52f0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 74 65 73 ach (lambda (tes
5300: 74 70 61 74 68 29 0a 09 09 28 69 66 20 28 66 69 tpath)...(if (fi
5310: 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 le-exists? (conc
5320: 20 74 65 73 74 70 61 74 68 20 22 2f 74 65 73 74 testpath "/test
5330: 63 6f 6e 66 69 67 22 29 29 0a 09 09 20 20 20 20 config"))...
5340: 28 73 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 (set! res (cons
5350: 28 6c 61 73 74 20 28 73 74 72 69 6e 67 2d 73 70 (last (string-sp
5360: 6c 69 74 20 74 65 73 74 70 61 74 68 20 22 2f 22 lit testpath "/"
5370: 29 29 20 72 65 73 29 29 29 29 0a 09 20 20 20 20 )) res))))..
5380: 20 20 74 65 73 74 73 29 0a 20 20 20 20 72 65 73 tests). res
5390: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e ))..(define (run
53a0: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 s:can-run-more-t
53b0: 65 73 74 73 20 64 62 29 0a 20 20 28 6c 65 74 20 ests db). (let
53c0: 28 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 ((num-running (d
53d0: 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 b:get-count-test
53e0: 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 s-running db))..
53f0: 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d (max-concurrent-
5400: 6a 6f 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f jobs (config-loo
5410: 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 kup *configdat*
5420: 22 73 65 74 75 70 22 20 22 6d 61 78 5f 63 6f 6e "setup" "max_con
5430: 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 29 current_jobs")))
5440: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
5450: 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 75 72 72 t 2 "max-concurr
5460: 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 2d ent-jobs: " max-
5470: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 concurrent-jobs
5480: 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 ", num-running:
5490: 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a 20 " num-running).
54a0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71 3f (if (not (eq?
54b0: 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 0 *globalexitst
54c0: 61 74 75 73 2a 29 29 0a 09 23 66 0a 09 28 69 66 atus*))..#f..(if
54d0: 20 28 6f 72 20 28 6e 6f 74 20 6d 61 78 2d 63 6f (or (not max-co
54e0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 ncurrent-jobs)..
54f0: 09 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 .(and max-concur
5500: 72 65 6e 74 2d 6a 6f 62 73 0a 09 09 20 20 20 20 rent-jobs...
5510: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 (string->number
5520: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
5530: 6a 6f 62 73 29 0a 09 09 20 20 20 20 20 28 6e 6f jobs)... (no
5540: 74 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e t (>= num-runnin
5550: 67 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 g (string->numbe
5560: 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 r max-concurrent
5570: 2d 6a 6f 62 73 29 29 29 29 29 0a 09 20 20 20 20 -jobs)))))..
5580: 23 74 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a #t.. (begin .
5590: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
55a0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
55b0: 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 73 Max running jobs
55c0: 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72 65 exceeded, curre
55d0: 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e nt number runnin
55e0: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 g: " num-running
55f0: 20 0a 09 09 09 20 20 20 22 2c 20 6d 61 78 5f 63 .... ", max_c
5600: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 oncurrent_jobs:
5610: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
5620: 2d 6a 6f 62 73 29 0a 09 20 20 20 20 20 20 23 66 -jobs).. #f
5630: 29 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 )))))..(define (
5640: 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e test:get-testcon
5650: 66 69 67 20 74 65 73 74 2d 6e 61 6d 65 20 73 79 fig test-name sy
5660: 73 74 65 6d 2d 61 6c 6c 6f 77 65 64 29 0a 20 20 stem-allowed).
5670: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 (let* ((test-pat
5680: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 h (conc *topp
5690: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 ath* "/tests/" t
56a0: 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 28 74 65 est-name)).. (te
56b0: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 st-configf (conc
56c0: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 test-path "/tes
56d0: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 74 65 tconfig")).. (te
56e0: 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 stexists (and
56f0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 (file-exists? te
5700: 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 st-configf)(file
5710: 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 -read-access? te
5720: 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 29 0a 20 st-configf)))).
5730: 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74 (if testexist
5740: 73 0a 09 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 s..(read-config
5750: 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 test-configf #f
5760: 73 79 73 74 65 6d 2d 61 6c 6c 6f 77 65 64 20 65 system-allowed e
5770: 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 28 69 66 nviron-patt: (if
5780: 20 73 79 73 74 65 6d 2d 61 6c 6c 6f 77 65 64 0a system-allowed.
5790: 09 09 09 09 09 09 09 09 20 20 20 20 20 20 22 70 ........ "p
57a0: 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d 76 61 re-launch-env-va
57b0: 72 73 22 0a 09 09 09 09 09 09 09 09 20 20 20 20 rs".........
57c0: 20 20 23 66 29 29 0a 09 23 66 29 29 29 0a 20 20 #f))..#f))).
57d0: 0a 3b 3b 20 73 6f 72 74 20 74 65 73 74 73 20 62 .;; sort tests b
57e0: 79 20 70 72 69 6f 72 69 74 79 20 61 6e 64 20 77 y priority and w
57f0: 61 69 74 6f 6e 0a 3b 3b 20 4d 6f 76 65 20 74 65 aiton.;; Move te
5800: 73 74 20 73 70 65 63 69 66 69 63 20 73 74 75 66 st specific stuf
5810: 66 20 74 6f 20 61 20 74 65 73 74 20 75 6e 69 74 f to a test unit
5820: 20 46 49 58 4d 45 20 6f 6e 65 20 6f 66 20 74 68 FIXME one of th
5830: 65 73 65 20 64 61 79 73 0a 28 64 65 66 69 6e 65 ese days.(define
5840: 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d (tests:sort-by-
5850: 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69 priority-and-wai
5860: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a ton test-names).
5870: 20 20 28 6c 65 74 20 28 28 74 65 73 74 64 65 74 (let ((testdet
5880: 61 69 6c 73 20 20 20 28 6d 61 6b 65 2d 68 61 73 ails (make-has
5890: 68 2d 74 61 62 6c 65 29 29 0a 09 28 6d 75 6e 67 h-table))..(mung
58a0: 65 70 72 69 6f 72 69 74 79 20 28 6c 61 6d 62 64 epriority (lambd
58b0: 61 20 28 70 72 69 6f 72 69 74 79 29 0a 09 09 09 a (priority)....
58c0: 20 28 69 66 20 70 72 69 6f 72 69 74 79 0a 09 09 (if priority...
58d0: 09 20 20 20 20 20 28 6c 65 74 20 28 28 74 6d 70 . (let ((tmp
58e0: 20 28 61 6e 79 2d 3e 6e 75 6d 62 65 72 20 70 72 (any->number pr
58f0: 69 6f 72 69 74 79 29 29 29 0a 09 09 09 20 20 20 iority)))....
5900: 20 20 20 20 28 69 66 20 74 6d 70 20 74 6d 70 20 (if tmp tmp
5910: 28 62 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 (begin (debug:pr
5920: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 62 61 int 0 "ERROR: ba
5930: 64 20 70 72 69 6f 72 69 74 79 20 76 61 6c 75 65 d priority value
5940: 20 22 20 70 72 69 6f 72 69 74 79 20 22 2c 20 75 " priority ", u
5950: 73 69 6e 67 20 30 22 29 20 30 29 29 29 0a 09 09 sing 0") 0)))...
5960: 09 20 20 20 20 20 30 29 29 29 29 0a 20 20 20 20 . 0)))).
5970: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
5980: 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 09 09 a (test-name)...
5990: 28 6c 65 74 20 28 28 74 65 73 74 2d 63 6f 6e 66 (let ((test-conf
59a0: 69 67 20 28 74 65 73 74 3a 67 65 74 2d 74 65 73 ig (test:get-tes
59b0: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 6e 61 6d tconfig test-nam
59c0: 65 20 23 66 29 29 29 0a 09 09 20 20 28 69 66 20 e #f)))... (if
59d0: 74 65 73 74 2d 63 6f 6e 66 69 67 20 28 68 61 73 test-config (has
59e0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 h-table-set! tes
59f0: 74 64 65 74 61 69 6c 73 20 74 65 73 74 2d 6e 61 tdetails test-na
5a00: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 69 67 29 29 me test-config))
5a10: 29 29 0a 09 20 20 20 20 20 20 74 65 73 74 2d 6e )).. test-n
5a20: 61 6d 65 73 29 0a 20 20 20 20 28 73 6f 72 74 20 ames). (sort
5a30: 0a 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c . (hash-tabl
5a40: 65 2d 6b 65 79 73 20 74 65 73 74 64 65 74 61 69 e-keys testdetai
5a50: 6c 73 29 20 3b 3b 20 61 76 6f 69 64 20 64 65 61 ls) ;; avoid dea
5a60: 6c 69 6e 67 20 77 69 74 68 20 64 65 6c 65 74 65 ling with delete
5a70: 64 20 74 65 73 74 73 2c 20 6c 6f 6f 6b 20 61 74 d tests, look at
5a80: 20 74 68 65 20 68 61 73 68 20 74 61 62 6c 65 0a the hash table.
5a90: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 20 (lambda (a
5aa0: 62 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 b). (let*
5ab0: 28 28 74 63 6f 6e 66 2d 61 20 20 20 28 68 61 73 ((tconf-a (has
5ac0: 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73 74 h-table-ref test
5ad0: 64 65 74 61 69 6c 73 20 61 29 29 0a 09 20 20 20 details a))..
5ae0: 20 20 20 28 74 63 6f 6e 66 2d 62 20 20 20 28 68 (tconf-b (h
5af0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 ash-table-ref te
5b00: 73 74 64 65 74 61 69 6c 73 20 62 29 29 0a 09 20 stdetails b))..
5b10: 20 20 20 20 20 28 61 2d 77 61 69 74 6f 6e 20 20 (a-waiton
5b20: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
5b30: 74 63 6f 6e 66 2d 61 20 22 72 65 71 75 69 72 65 tconf-a "require
5b40: 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 29 ments" "waiton")
5b50: 29 0a 09 20 20 20 20 20 20 28 62 2d 77 61 69 74 ).. (b-wait
5b60: 6f 6e 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f on (config-loo
5b70: 6b 75 70 20 74 63 6f 6e 66 2d 62 20 22 72 65 71 kup tconf-b "req
5b80: 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69 74 uirements" "wait
5b90: 6f 6e 22 29 29 0a 09 20 20 20 20 20 20 28 61 2d on")).. (a-
5ba0: 70 72 69 6f 72 69 74 79 20 28 6d 75 6e 67 65 70 priority (mungep
5bb0: 72 69 6f 72 69 74 79 20 28 63 6f 6e 66 69 67 2d riority (config-
5bc0: 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 2d 61 20 22 lookup tconf-a "
5bd0: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70 requirements" "p
5be0: 72 69 6f 72 69 74 79 22 29 29 29 0a 09 20 20 20 riority")))..
5bf0: 20 20 20 28 62 2d 70 72 69 6f 72 69 74 79 20 28 (b-priority (
5c00: 6d 75 6e 67 65 70 72 69 6f 72 69 74 79 20 28 63 mungepriority (c
5c10: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f onfig-lookup tco
5c20: 6e 66 2d 62 20 22 72 65 71 75 69 72 65 6d 65 6e nf-b "requiremen
5c30: 74 73 22 20 22 70 72 69 6f 72 69 74 79 22 29 29 ts" "priority"))
5c40: 29 29 0a 09 20 28 69 66 20 28 61 6e 64 20 61 2d )).. (if (and a-
5c50: 77 61 69 74 6f 6e 20 28 65 71 75 61 6c 3f 20 61 waiton (equal? a
5c60: 2d 77 61 69 74 6f 6e 20 62 29 29 0a 09 20 20 20 -waiton b))..
5c70: 20 20 23 66 20 3b 3b 20 63 61 6e 6e 6f 74 20 68 #f ;; cannot h
5c80: 61 76 65 20 61 20 77 68 69 63 68 20 69 73 20 77 ave a which is w
5c90: 61 69 74 69 6e 67 20 6f 6e 20 62 20 68 61 70 70 aiting on b happ
5ca0: 65 6e 69 6e 67 20 62 65 66 6f 72 65 20 62 0a 09 ening before b..
5cb0: 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 62 2d (if (and b-
5cc0: 77 61 69 74 6f 6e 20 28 65 71 75 61 6c 3f 20 62 waiton (equal? b
5cd0: 2d 77 61 69 74 6f 6e 20 61 29 29 0a 09 09 20 23 -waiton a))... #
5ce0: 74 20 3b 3b 20 74 68 69 73 20 69 73 20 74 68 65 t ;; this is the
5cf0: 20 63 6f 72 72 65 63 74 20 6f 72 64 65 72 2c 20 correct order,
5d00: 62 20 69 73 20 77 61 69 74 69 6e 67 20 6f 6e 20 b is waiting on
5d10: 61 20 61 6e 64 20 62 20 69 73 20 62 65 66 6f 72 a and b is befor
5d20: 65 20 61 0a 09 09 20 28 69 66 20 28 3e 20 61 2d e a... (if (> a-
5d30: 70 72 69 6f 72 69 74 79 20 62 2d 70 72 69 6f 72 priority b-prior
5d40: 69 74 79 29 0a 09 09 20 20 20 20 20 23 74 20 3b ity)... #t ;
5d50: 3b 20 69 66 20 61 20 69 73 20 61 20 68 69 67 68 ; if a is a high
5d60: 65 72 20 70 72 69 6f 72 69 74 79 20 74 68 61 6e er priority than
5d70: 20 62 20 74 68 65 6e 20 77 65 20 61 72 65 20 67 b then we are g
5d80: 6f 6f 64 20 74 6f 20 67 6f 0a 09 09 20 20 20 20 ood to go...
5d90: 20 23 66 29 29 29 29 29 29 29 29 0a 0a 3b 3b 20 #f))))))))..;;
5da0: 54 68 69 73 20 69 73 20 6f 72 69 67 69 6e 61 6c This is original
5db0: 20 72 75 6e 2d 74 65 73 74 73 2c 20 74 68 69 73 run-tests, this
5dc0: 20 72 6f 75 74 69 6e 65 20 69 73 20 64 65 70 72 routine is depr
5dd0: 65 63 61 74 65 64 20 61 6e 64 20 77 65 20 77 69 ecated and we wi
5de0: 6c 6c 20 74 72 61 6e 73 69 74 69 6f 6e 20 74 6f ll transition to
5df0: 20 75 73 69 6e 67 20 72 75 6e 73 3a 72 75 6e 2d using runs:run-
5e00: 74 65 73 74 73 20 28 73 65 65 20 62 65 6c 6f 77 tests (see below
5e10: 29 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 ).;;.(define (ru
5e20: 6e 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d n-tests db test-
5e30: 6e 61 6d 65 73 29 0a 20 20 28 6c 65 74 2a 20 28 names). (let* (
5e40: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 62 (keys (db
5e50: 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 -get-keys db))..
5e60: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b (keyvallst (k
5e70: 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 eys->vallist key
5e80: 73 20 23 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 s #t)).. (run-id
5e90: 20 20 20 20 20 20 28 72 65 67 69 73 74 65 72 2d (register-
5ea0: 72 75 6e 20 64 62 20 6b 65 79 73 29 29 20 20 3b run db keys)) ;
5eb0: 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a ; test-name))).
5ec0: 09 20 28 64 65 66 65 72 72 65 64 20 20 20 20 27 . (deferred '
5ed0: 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e ()) ;; delay run
5ee0: 6e 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 65 ning these since
5ef0: 20 74 68 65 79 20 68 61 76 65 20 61 20 77 61 69 they have a wai
5f00: 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 28 72 75 ton clause.. (ru
5f10: 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 nconfigf (conc
5f20: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 *toppath* "/ru
5f30: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 nconfigs.config"
5f40: 29 29 29 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 ))). ;; on th
5f50: 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 e first pass or
5f60: 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 call to run-test
5f70: 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e s set FAILS to N
5f80: 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 OT_STARTED if.
5f90: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 ;; -keepgoing
5fa0: 69 73 20 73 70 65 63 69 66 69 65 64 0a 0a 20 20 is specified..
5fb0: 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d (set-megatest-
5fc0: 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d env-vars db run-
5fd0: 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 id) ;; these may
5fe0: 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 be needed by th
5ff0: 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 e launching proc
6000: 65 73 73 0a 20 20 20 20 0a 20 20 20 20 28 69 66 ess. . (if
6010: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 (file-exists? r
6020: 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 65 74 unconfigf)..(set
6030: 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 up-env-defaults
6040: 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 db runconfigf ru
6050: 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 n-id *already-se
6060: 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 en-runconfig-inf
6070: 6f 2a 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a o* environ-patt:
6080: 20 22 2e 2a 22 29 0a 09 28 64 65 62 75 67 3a 70 ".*")..(debug:p
6090: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
60a0: 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 You do not have
60b0: 20 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 a run config fi
60c0: 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 le: " runconfigf
60d0: 29 29 0a 0a 20 20 20 20 28 69 66 20 28 61 6e 64 )).. (if (and
60e0: 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 (eq? *passnum*
60f0: 30 29 0a 09 20 20 20 20 20 28 61 72 67 73 3a 67 0).. (args:g
6100: 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 et-arg "-keepgoi
6110: 6e 67 22 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 ng"))..(begin..
6120: 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 ;; have to dele
6130: 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 te test records
6140: 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 where NOT_STARTE
6150: 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e D since they can
6160: 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e cause -keepgoin
6170: 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 g to .. ;; get
6180: 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 stuck due to bec
6190: 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 oming inaccessib
61a0: 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 le from a failed
61b0: 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 test. I.e. if t
61c0: 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 est B depends ..
61d0: 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 ;; on test A b
61e0: 75 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 ut test B reache
61f0: 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 d the point on b
6200: 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 eing registered
6210: 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 as NOT_STARTED a
6220: 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 nd test.. ;; A
6230: 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 failed for some
6240: 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 reason then on r
6250: 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 e-run using -kee
6260: 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 pgoing the run c
6270: 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 an never complet
6280: 65 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 e... (db:delete
6290: 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 -tests-in-state
62a0: 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 db run-id "NOT_S
62b0: 54 41 52 54 45 44 22 29 0a 09 20 20 28 64 62 3a TARTED").. (db:
62c0: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d set-tests-state-
62d0: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 status db run-id
62e0: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 test-names #f "
62f0: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 FAIL" "NOT_START
6300: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 20 20 ED" "FAIL"))).
6310: 20 20 28 73 65 74 21 20 2a 70 61 73 73 6e 75 6d (set! *passnum
6320: 2a 20 28 2b 20 2a 70 61 73 73 6e 75 6d 2a 20 31 * (+ *passnum* 1
6330: 29 29 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 )). (let loop
6340: 20 28 28 6e 75 6d 74 69 6d 65 73 20 30 29 29 0a ((numtimes 0)).
6350: 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 (for-each
6360: 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 . (lambda
6370: 28 74 65 73 74 2d 6e 61 6d 65 29 0a 09 20 28 69 (test-name).. (i
6380: 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d f (runs:can-run-
6390: 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a 09 more-tests db)..
63a0: 20 20 20 20 20 28 72 75 6e 2d 6f 6e 65 2d 74 65 (run-one-te
63b0: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 st db run-id tes
63c0: 74 2d 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 t-name keyvallst
63d0: 29 0a 09 20 20 20 20 20 3b 3b 20 61 64 64 20 73 ).. ;; add s
63e0: 6f 6d 65 20 64 65 6c 61 79 20 0a 09 20 20 20 20 ome delay ..
63f0: 20 3b 28 73 6c 65 65 70 20 32 29 0a 09 20 20 20 ;(sleep 2)..
6400: 20 20 29 29 0a 20 20 20 20 20 20 20 28 74 65 73 )). (tes
6410: 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 ts:sort-by-prior
6420: 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 ity-and-waiton t
6430: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 20 20 20 20 est-names)).
6440: 20 20 3b 3b 20 28 72 75 6e 2d 77 61 69 74 69 6e ;; (run-waitin
6450: 67 2d 74 65 73 74 73 20 64 62 29 0a 20 20 20 20 g-tests db).
6460: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d (if (args:get-
6470: 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 arg "-keepgoing"
6480: 29 0a 09 20 20 28 6c 65 74 20 28 28 65 73 74 72 ).. (let ((estr
6490: 65 6d 20 28 64 62 3a 65 73 74 69 6d 61 74 65 64 em (db:estimated
64a0: 2d 74 65 73 74 73 2d 72 65 6d 61 69 6e 69 6e 67 -tests-remaining
64b0: 20 64 62 20 72 75 6e 2d 69 64 29 29 29 0a 09 20 db run-id)))..
64c0: 20 20 20 28 69 66 20 28 61 6e 64 20 28 3e 20 65 (if (and (> e
64d0: 73 74 72 65 6d 20 30 29 0a 09 09 20 20 20 20 20 strem 0)...
64e0: 28 65 71 3f 20 2a 67 6c 6f 62 61 6c 65 78 69 74 (eq? *globalexit
64f0: 73 74 61 74 75 73 2a 20 30 29 29 0a 09 09 28 62 status* 0))...(b
6500: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a egin... (debug:
6510: 70 72 69 6e 74 20 31 20 22 4b 65 65 70 20 67 6f print 1 "Keep go
6520: 69 6e 67 2c 20 65 73 74 69 6d 61 74 65 64 20 22 ing, estimated "
6530: 20 65 73 74 72 65 6d 20 22 20 74 65 73 74 73 20 estrem " tests
6540: 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 72 75 6e remaining to run
6550: 2c 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 , will continue
6560: 69 6e 20 33 20 73 65 63 6f 6e 64 73 20 2e 2e 2e in 3 seconds ...
6570: 22 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 ")... (thread-s
6580: 6c 65 65 70 21 20 33 29 0a 09 09 20 20 28 72 75 leep! 3)... (ru
6590: 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 73 20 n-waiting-tests
65a0: 64 62 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 2b db)... (loop (+
65b0: 20 6e 75 6d 74 69 6d 65 73 20 31 29 29 29 29 29 numtimes 1)))))
65c0: 29 29 29 29 0a 09 20 20 0a 3b 3b 20 56 45 52 59 )))).. .;; VERY
65d0: 20 49 4e 45 46 46 49 43 49 45 4e 54 21 20 4d 6f INEFFICIENT! Mo
65e0: 76 65 20 73 74 75 66 66 20 74 68 61 74 20 73 68 ve stuff that sh
65f0: 6f 75 6c 64 20 62 65 20 64 6f 6e 65 20 6f 6e 63 ould be done onc
6600: 65 20 75 70 20 74 6f 20 63 61 6c 6c 69 6e 67 20 e up to calling
6610: 70 72 6f 63 0a 28 64 65 66 69 6e 65 20 28 72 75 proc.(define (ru
6620: 6e 2d 6f 6e 65 2d 74 65 73 74 20 64 62 20 72 75 n-one-test db ru
6630: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 6b n-id test-name k
6640: 65 79 76 61 6c 6c 73 74 29 0a 20 20 28 64 65 62 eyvallst). (deb
6650: 75 67 3a 70 72 69 6e 74 20 31 20 22 4c 61 75 6e ug:print 1 "Laun
6660: 63 68 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 ching test " tes
6670: 74 2d 6e 61 6d 65 29 0a 20 20 3b 3b 20 41 6c 6c t-name). ;; All
6680: 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 these vars migh
6690: 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 t be referenced
66a0: 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 by the testconfi
66b0: 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 g file reader.
66c0: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 (setenv "MT_TEST
66d0: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 _NAME" test-name
66e0: 29 20 3b 3b 20 0a 20 20 28 73 65 74 65 6e 76 20 ) ;; . (setenv
66f0: 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 28 "MT_RUNNAME" (
6700: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 args:get-arg ":r
6710: 75 6e 6e 61 6d 65 22 29 29 0a 0a 20 20 3b 3b 20 unname")).. ;;
6720: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e (set-megatest-en
6730: 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 v-vars db run-id
6740: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 ) ;; these may b
6750: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 e needed by the
6760: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 launching proces
6770: 73 0a 0a 20 20 28 63 68 61 6e 67 65 2d 64 69 72 s.. (change-dir
6780: 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a ectory *toppath*
6790: 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 ). (let* ((test
67a0: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a -path (conc *
67b0: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
67c0: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b /" test-name)) ;
67d0: 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 ; could use test
67e0: 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 :get-testconfig
67f0: 68 65 72 65 20 2e 2e 2e 0a 09 20 28 74 65 73 74 here ..... (test
6800: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 -configf (conc t
6810: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 est-path "/testc
6820: 6f 6e 66 69 67 22 29 29 0a 09 20 28 74 65 73 74 onfig")).. (test
6830: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 exists (and (f
6840: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 ile-exists? test
6850: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 -configf)(file-r
6860: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 ead-access? test
6870: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 28 74 -configf))).. (t
6880: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 est-conf (if
6890: 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64 testexists (read
68a0: 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e -config test-con
68b0: 66 69 67 66 20 23 66 20 23 74 29 20 28 6d 61 6b figf #f #t) (mak
68c0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
68d0: 09 20 28 77 61 69 74 6f 6e 20 20 20 20 20 20 20 . (waiton
68e0: 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 (let ((w (config
68f0: 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e -lookup test-con
6900: 66 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 f "requirements"
6910: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 "waiton")))....
6920: 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 77 29 (if (string? w)
6930: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 77 29 (string-split w)
6940: 27 28 29 29 29 29 0a 09 20 28 74 61 67 73 20 20 '()))).. (tags
6950: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 20 (let ((t
6960: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 (config-lookup t
6970: 65 73 74 2d 63 6f 6e 66 20 22 73 65 74 75 70 22 est-conf "setup"
6980: 20 22 74 61 67 73 22 29 29 29 0a 09 09 09 20 3b "tags"))).... ;
6990: 3b 20 77 65 20 77 61 6e 74 20 6f 75 72 20 74 61 ; we want our ta
69a0: 67 73 20 74 6f 20 62 65 20 73 65 70 61 72 61 74 gs to be separat
69b0: 65 64 20 62 79 20 63 6f 6d 6d 61 73 20 61 6e 64 ed by commas and
69c0: 20 66 75 6c 6c 79 20 64 65 6c 69 6d 69 74 65 64 fully delimited
69d0: 20 62 79 20 63 6f 6d 6d 61 73 0a 09 09 09 20 3b by commas.... ;
69e0: 3b 20 73 6f 20 74 68 61 74 20 71 75 65 72 69 65 ; so that querie
69f0: 73 20 77 69 74 68 20 22 6c 69 6b 65 22 20 63 61 s with "like" ca
6a00: 6e 20 74 69 65 20 74 6f 20 74 68 65 20 63 6f 6d n tie to the com
6a10: 6d 61 73 20 61 74 20 65 69 74 68 65 72 20 65 6e mas at either en
6a20: 64 20 6f 66 20 65 61 63 68 20 74 61 67 0a 09 09 d of each tag...
6a30: 09 20 3b 3b 20 77 68 69 6c 65 20 61 6c 73 6f 20 . ;; while also
6a40: 61 6c 6c 6f 77 69 6e 67 20 74 68 65 20 65 6e 64 allowing the end
6a50: 20 75 73 65 72 20 74 6f 20 66 72 65 65 6c 79 20 user to freely
6a60: 75 73 65 20 73 70 61 63 65 73 20 61 6e 64 20 63 use spaces and c
6a70: 6f 6d 6d 61 73 20 74 6f 20 73 65 70 61 72 61 74 ommas to separat
6a80: 65 20 74 61 67 73 0a 09 09 09 20 28 69 66 20 28 e tags.... (if (
6a90: 73 74 72 69 6e 67 3f 20 74 29 28 73 74 72 69 6e string? t)(strin
6aa0: 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 72 65 g-substitute (re
6ab0: 67 65 78 70 20 22 5b 2c 5c 5c 73 5d 2b 22 29 20 gexp "[,\\s]+")
6ac0: 22 2c 22 20 28 63 6f 6e 63 20 22 2c 22 20 74 20 "," (conc "," t
6ad0: 22 2c 22 29 20 23 74 29 0a 09 09 09 20 20 20 20 ",") #t)....
6ae0: 20 27 28 29 29 29 29 29 0a 20 20 20 20 28 69 66 '())))). (if
6af0: 20 28 6e 6f 74 20 74 65 73 74 65 78 69 73 74 73 (not testexists
6b00: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 )..(begin.. (de
6b10: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
6b20: 4f 52 3a 20 43 61 6e 27 74 20 66 69 6e 64 20 63 OR: Can't find c
6b30: 6f 6e 66 69 67 20 66 69 6c 65 20 22 20 74 65 73 onfig file " tes
6b40: 74 2d 63 6f 6e 66 69 67 66 29 0a 09 20 20 28 65 t-configf).. (e
6b50: 78 69 74 20 32 29 29 0a 09 3b 3b 20 70 75 74 20 xit 2))..;; put
6b60: 74 6f 70 20 76 61 72 73 20 69 6e 74 6f 20 63 6f top vars into co
6b70: 6e 76 65 6e 69 65 6e 74 20 76 61 72 69 61 62 6c nvenient variabl
6b80: 65 73 20 61 6e 64 20 6f 70 65 6e 20 74 68 65 20 es and open the
6b90: 64 62 0a 09 28 6c 65 74 2a 20 28 3b 3b 20 64 62 db..(let* (;; db
6ba0: 20 69 73 20 61 6c 77 61 79 73 20 61 74 20 2a 74 is always at *t
6bb0: 6f 70 70 61 74 68 2a 2f 64 62 2f 6d 65 67 61 74 oppath*/db/megat
6bc0: 65 73 74 2e 64 62 0a 09 20 20 20 20 20 20 20 28 est.db.. (
6bd0: 69 74 65 6d 73 20 20 20 20 20 20 20 28 68 61 73 items (has
6be0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
6bf0: 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 69 ult test-conf "i
6c00: 74 65 6d 73 22 20 27 28 29 29 29 0a 09 20 20 20 tems" '()))..
6c10: 20 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 (itemstable
6c20: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
6c30: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 63 6f /default test-co
6c40: 6e 66 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 nf "itemstable"
6c50: 27 28 29 29 29 0a 09 20 20 20 20 20 20 20 28 61 '())).. (a
6c60: 6c 6c 69 74 65 6d 73 20 20 20 20 28 69 66 20 28 llitems (if (
6c70: 6f 72 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 or (not (null? i
6c80: 74 65 6d 73 29 29 28 6e 6f 74 20 28 6e 75 6c 6c tems))(not (null
6c90: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 0a ? itemstable))).
6ca0: 09 09 09 09 28 61 70 70 65 6e 64 20 28 69 74 65 ....(append (ite
6cb0: 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 m-assoc->item-li
6cc0: 73 74 20 69 74 65 6d 73 29 0a 09 09 09 09 09 28 st items)......(
6cd0: 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d item-table->item
6ce0: 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c 65 -list itemstable
6cf0: 29 29 0a 09 09 09 09 27 28 28 29 29 29 29 29 20 )).....'(()))))
6d00: 3b 3b 20 61 20 6c 69 73 74 20 77 69 74 68 20 6f ;; a list with o
6d10: 6e 65 20 6e 75 6c 6c 20 6c 69 73 74 20 69 73 20 ne null list is
6d20: 61 20 74 65 73 74 20 77 69 74 68 20 6e 6f 20 69 a test with no i
6d30: 74 65 6d 73 0a 3b 3b 20 09 20 20 28 72 75 6e 63 tems.;; . (runc
6d40: 6f 6e 66 69 67 66 20 20 28 63 6f 6e 63 20 20 2a onfigf (conc *
6d50: 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f toppath* "/runco
6d60: 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 29 nfigs.config")))
6d70: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
6d80: 20 31 20 22 69 74 65 6d 73 3a 20 22 29 0a 09 20 1 "items: ")..
6d90: 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 (if (>= *verbos
6da0: 69 74 79 2a 20 31 29 28 70 70 20 61 6c 6c 69 74 ity* 1)(pp allit
6db0: 65 6d 73 29 29 0a 09 20 20 28 69 66 20 28 3e 3d ems)).. (if (>=
6dc0: 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a *verbosity* 5).
6dd0: 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 . (begin...
6de0: 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 (print "items: "
6df0: 29 28 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63 )(pp (item-assoc
6e00: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d ->item-list item
6e10: 73 29 29 0a 09 09 28 70 72 69 6e 74 20 22 69 74 s))...(print "it
6e20: 65 73 74 61 62 6c 65 3a 20 22 29 28 70 70 20 28 estable: ")(pp (
6e30: 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d item-table->item
6e40: 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c 65 -list itemstable
6e50: 29 29 29 29 0a 09 20 20 28 69 66 20 28 61 72 67 )))).. (if (arg
6e60: 73 3a 67 65 74 2d 61 72 67 20 22 2d 6d 22 29 0a s:get-arg "-m").
6e70: 09 20 20 20 20 20 20 28 64 62 3a 73 65 74 2d 63 . (db:set-c
6e80: 6f 6d 6d 65 6e 74 2d 66 6f 72 2d 72 75 6e 20 64 omment-for-run d
6e90: 62 20 72 75 6e 2d 69 64 20 28 61 72 67 73 3a 67 b run-id (args:g
6ea0: 65 74 2d 61 72 67 20 22 2d 6d 22 29 29 29 0a 0a et-arg "-m")))..
6eb0: 09 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 . ;; Here is wh
6ec0: 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 ere the test_met
6ed0: 61 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 a table is best
6ee0: 75 70 64 61 74 65 64 0a 09 20 20 28 72 75 6e 73 updated.. (runs
6ef0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
6f00: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
6f10: 65 73 74 2d 63 6f 6e 66 29 0a 0a 09 20 20 3b 3b est-conf)... ;;
6f20: 20 62 72 61 69 6e 64 65 61 64 20 77 6f 72 6b 2d braindead work-
6f30: 61 72 6f 75 6e 64 20 66 6f 72 20 70 6f 6f 72 6c around for poorl
6f40: 79 20 73 70 65 63 69 66 69 65 64 20 61 6c 6c 69 y specified alli
6f50: 74 65 6d 73 20 6c 69 73 74 20 42 55 47 21 21 21 tems list BUG!!!
6f60: 20 46 49 58 4d 45 0a 09 20 20 28 69 66 20 28 6e FIXME.. (if (n
6f70: 75 6c 6c 3f 20 61 6c 6c 69 74 65 6d 73 29 28 73 ull? allitems)(s
6f80: 65 74 21 20 61 6c 6c 69 74 65 6d 73 20 27 28 28 et! allitems '((
6f90: 29 29 29 29 0a 09 20 20 28 6c 65 74 20 6c 6f 6f )))).. (let loo
6fa0: 70 20 28 28 69 74 65 6d 64 61 74 20 28 63 61 72 p ((itemdat (car
6fb0: 20 61 6c 6c 69 74 65 6d 73 29 29 0a 09 09 20 20 allitems))...
6fc0: 20 20 20 28 74 61 6c 20 20 20 20 20 28 63 64 72 (tal (cdr
6fd0: 20 61 6c 6c 69 74 65 6d 73 29 29 29 0a 09 20 20 allitems)))..
6fe0: 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 ;; (lambda (it
6ff0: 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 emdat) ;;; ((rip
7000: 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 eness "overripe"
7010: 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 ) (temperature "
7020: 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 cool") (season "
7030: 73 75 6d 6d 65 72 22 29 29 0a 09 20 20 20 20 3b summer")).. ;
7040: 3b 20 48 61 6e 64 6c 65 20 6c 69 73 74 73 20 6f ; Handle lists o
7050: 66 20 69 74 65 6d 73 0a 09 20 20 20 20 28 6c 65 f items.. (le
7060: 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 20 t* ((item-path
7070: 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 (item-list->p
7080: 61 74 68 20 69 74 65 6d 64 61 74 29 29 20 3b 3b ath itemdat)) ;;
7090: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
70a0: 65 72 73 65 20 28 6d 61 70 20 63 61 64 72 20 69 erse (map cadr i
70b0: 74 65 6d 64 61 74 29 20 22 2f 22 29 29 0a 09 09 temdat) "/"))...
70c0: 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 (new-test-pat
70d0: 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 h (string-inters
70e0: 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 perse (cons test
70f0: 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 -path (map cadr
7100: 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a itemdat)) "/")).
7110: 09 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e .. (new-test-n
7120: 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 ame (if (equal?
7130: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65 item-path "") te
7140: 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 st-name (conc te
7150: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d st-name "/" item
7160: 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 -path))) ;; just
7170: 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 75 need it to be u
7180: 6e 69 71 75 65 0a 09 09 20 20 20 28 74 65 73 74 nique... (test
7190: 64 61 74 20 20 20 23 66 29 0a 09 09 20 20 20 28 dat #f)... (
71a0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 62 3a num-running (db:
71b0: 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d get-count-tests-
71c0: 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 09 20 running db))...
71d0: 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e (max-concurren
71e0: 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 67 2d 6c t-jobs (config-l
71f0: 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 ookup *configdat
7200: 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78 5f 63 * "setup" "max_c
7210: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 oncurrent_jobs")
7220: 29 0a 09 09 20 20 20 28 70 61 72 65 6e 74 2d 74 )... (parent-t
7230: 65 73 74 20 28 61 6e 64 20 28 6e 6f 74 20 28 6e est (and (not (n
7240: 75 6c 6c 3f 20 69 74 65 6d 73 29 29 28 65 71 75 ull? items))(equ
7250: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 al? item-path ""
7260: 29 29 29 0a 09 09 20 20 20 28 73 69 6e 67 6c 65 )))... (single
7270: 2d 74 65 73 74 20 28 61 6e 64 20 28 6e 75 6c 6c -test (and (null
7280: 3f 20 69 74 65 6d 73 29 20 28 65 71 75 61 6c 3f ? items) (equal?
7290: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 item-path "")))
72a0: 0a 09 09 20 20 20 28 69 74 65 6d 2d 74 65 73 74 ... (item-test
72b0: 20 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 (not (equal?
72c0: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 0a item-path ""))).
72d0: 09 09 20 20 20 28 69 74 65 6d 2d 70 61 74 74 20 .. (item-patt
72e0: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 (args:get-arg
72f0: 22 2d 69 74 65 6d 70 61 74 74 22 29 29 0a 09 09 "-itempatt"))...
7300: 20 20 20 28 70 61 74 74 2d 6d 61 74 63 68 20 20 (patt-match
7310: 28 69 66 20 69 74 65 6d 2d 70 61 74 74 0a 09 09 (if item-patt...
7320: 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d 73 65 .. (string-se
7330: 61 72 63 68 20 28 67 6c 6f 62 2d 3e 72 65 67 65 arch (glob->rege
7340: 78 70 0a 09 09 09 09 09 09 20 20 20 28 73 74 72 xp....... (str
7350: 69 6e 67 2d 74 72 61 6e 73 6c 61 74 65 20 69 74 ing-translate it
7360: 65 6d 2d 70 61 74 74 20 22 25 22 20 22 2a 22 29 em-patt "%" "*")
7370: 29 0a 09 09 09 09 09 09 20 20 69 74 65 6d 2d 70 )....... item-p
7380: 61 74 68 29 0a 09 09 09 09 20 20 20 20 23 74 29 ath)..... #t)
7390: 29 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 )).. (debug
73a0: 3a 70 72 69 6e 74 20 33 20 22 6d 61 78 2d 63 6f :print 3 "max-co
73b0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 ncurrent-jobs: "
73c0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
73d0: 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e jobs ", num-runn
73e0: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 ing: " num-runni
73f0: 6e 67 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ng).. (if (
7400: 61 6e 64 20 70 61 74 74 2d 6d 61 74 63 68 20 28 and patt-match (
7410: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
7420: 65 2d 74 65 73 74 73 20 64 62 29 29 0a 09 09 20 e-tests db))...
7430: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 6c (begin... (l
7440: 65 74 20 6c 6f 6f 70 32 20 28 28 74 73 20 28 64 et loop2 ((ts (d
7450: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 b:get-test-info
7460: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
7470: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 20 ame item-path))
7480: 3b 3b 20 23 66 29 0a 09 09 09 09 28 63 74 20 30 ;; #f).....(ct 0
7490: 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 ))... (if (
74a0: 61 6e 64 20 28 6e 6f 74 20 74 73 29 0a 09 09 09 and (not ts)....
74b0: 20 20 20 20 20 20 20 28 3c 20 63 74 20 31 30 29 (< ct 10)
74c0: 29 0a 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 ).... (begin...
74d0: 09 20 20 20 20 28 72 65 67 69 73 74 65 72 2d 74 . (register-t
74e0: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 est db run-id te
74f0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
7500: 68 29 0a 09 09 09 20 20 20 20 28 64 62 3a 74 65 h).... (db:te
7510: 73 74 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 64 st-set-comment d
7520: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
7530: 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 me item-path "")
7540: 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 28 .... (loop2 (
7550: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f db:get-test-info
7560: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
7570: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a name item-path).
7580: 09 09 09 09 20 20 20 28 2b 20 63 74 20 31 29 29 .... (+ ct 1))
7590: 29 0a 09 09 09 20 20 28 69 66 20 74 73 0a 09 09 ).... (if ts...
75a0: 09 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 . (set! tes
75b0: 74 64 61 74 20 74 73 29 0a 09 09 09 20 20 20 20 tdat ts)....
75c0: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 (begin.....(de
75d0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
75e0: 4e 49 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 72 NING: Couldn't r
75f0: 65 67 69 73 74 65 72 20 74 65 73 74 20 22 20 74 egister test " t
7600: 65 73 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 20 est-name " with
7610: 69 74 65 6d 20 70 61 74 68 20 22 20 69 74 65 6d item path " item
7620: 2d 70 61 74 68 20 22 2c 20 73 6b 69 70 70 69 6e -path ", skippin
7630: 67 22 29 0a 09 09 09 09 28 69 66 20 28 6e 6f 74 g").....(if (not
7640: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 (null? tal))...
7650: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 .. (loop (car
7660: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 tal)(cdr tal)))
7670: 29 29 29 29 0a 09 09 20 20 20 20 28 63 68 61 6e ))))... (chan
7680: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 ge-directory tes
7690: 74 2d 70 61 74 68 29 0a 09 09 20 20 20 20 3b 3b t-path)... ;;
76a0: 20 74 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 68 this block is h
76b0: 65 72 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 6f ere only to info
76c0: 72 6d 20 74 68 65 20 75 73 65 72 20 65 61 72 6c rm the user earl
76d0: 79 20 6f 6e 0a 09 09 20 20 20 20 0a 09 09 20 20 y on... ...
76e0: 20 20 3b 3b 20 4e 42 2f 2f 20 4d 6f 76 69 6e 67 ;; NB// Moving
76f0: 20 74 68 65 20 73 65 74 74 69 6e 67 20 6f 66 20 the setting of
7700: 72 75 6e 63 6f 6e 66 69 67 2e 63 6f 6e 66 69 67 runconfig.config
7710: 20 76 61 72 73 20 74 6f 20 2a 62 65 66 6f 72 65 vars to *before
7720: 2a 20 74 68 65 20 0a 09 09 20 20 20 20 3b 3b 20 * the ... ;;
7730: 74 68 65 20 63 61 6c 6c 69 6e 67 20 6f 66 20 65 the calling of e
7740: 61 63 68 20 74 65 73 74 2e 0a 09 09 20 20 20 20 ach test....
7750: 3b 3b 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 ;; (if (file-exi
7760: 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 sts? runconfigf)
7770: 0a 09 09 20 20 20 20 3b 3b 20 20 20 20 20 28 73 ... ;; (s
7780: 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 etup-env-default
7790: 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 s db runconfigf
77a0: 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d run-id *already-
77b0: 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 seen-runconfig-i
77c0: 6e 66 6f 2a 29 0a 09 09 20 20 20 20 3b 3b 20 20 nfo*)... ;;
77d0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
77e0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 0 "WARNING: You
77f0: 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 do not have a ru
7800: 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 n config file: "
7810: 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a 09 09 runconfigf))...
7820: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
7830: 20 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 72 75 4 "run-id: " ru
7840: 6e 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 6d 65 n-id " test-name
7850: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 : " test-name "
7860: 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 item-path: " ite
7870: 6d 2d 70 61 74 68 20 22 20 74 65 73 74 64 61 74 m-path " testdat
7880: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 : " (test:get-st
7890: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 20 atus testdat) "
78a0: 74 65 73 74 2d 73 74 61 74 65 3a 20 22 20 28 74 test-state: " (t
78b0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
78c0: 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 28 63 stdat))... (c
78d0: 61 73 65 20 28 69 66 20 28 61 72 67 73 3a 67 65 ase (if (args:ge
78e0: 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a t-arg "-force").
78f0: 09 09 09 20 20 20 20 20 20 27 4e 4f 54 5f 53 54 ... 'NOT_ST
7900: 41 52 54 45 44 0a 09 09 09 20 20 20 20 20 20 28 ARTED.... (
7910: 69 66 20 74 65 73 74 64 61 74 0a 09 09 09 09 20 if testdat.....
7920: 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c (string->symbol
7930: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
7940: 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 09 20 testdat)).....
7950: 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 'failed-to-inse
7960: 72 74 29 29 0a 09 09 20 20 20 20 20 20 28 28 66 rt))... ((f
7970: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 ailed-to-insert)
7980: 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 ... (debug
7990: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
79a0: 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 Failed to inser
79b0: 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 t the record int
79c0: 6f 20 74 68 65 20 64 62 22 29 29 0a 09 09 20 20 o the db"))...
79d0: 20 20 20 20 28 28 4e 4f 54 5f 53 54 41 52 54 45 ((NOT_STARTE
79e0: 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09 09 20 D COMPLETED)...
79f0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
7a00: 6e 74 20 36 20 22 47 6f 74 20 68 65 72 65 2c 20 nt 6 "Got here,
7a10: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
7a20: 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 e testdat))...
7a30: 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 66 (let ((runf
7a40: 6c 61 67 20 23 66 29 29 0a 09 09 09 20 28 63 6f lag #f)).... (co
7a50: 6e 64 0a 09 09 09 20 20 3b 3b 20 69 2e 65 2e 20 nd.... ;; i.e.
7a60: 74 68 69 73 20 69 73 20 74 68 65 20 70 61 72 65 this is the pare
7a70: 6e 74 20 74 65 73 74 20 74 6f 20 61 20 73 75 69 nt test to a sui
7a80: 74 65 20 6f 66 20 69 74 65 6d 73 2c 20 6e 65 76 te of items, nev
7a90: 65 72 20 22 72 75 6e 22 20 69 74 0a 09 09 09 20 er "run" it....
7aa0: 20 28 70 61 72 65 6e 74 2d 74 65 73 74 0a 09 09 (parent-test...
7ab0: 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 . (set! runfla
7ac0: 67 20 23 66 29 29 0a 09 09 09 20 20 3b 3b 20 2d g #f)).... ;; -
7ad0: 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 force, run no ma
7ae0: 74 74 65 72 20 77 68 61 74 0a 09 09 09 20 20 28 tter what.... (
7af0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
7b00: 66 6f 72 63 65 22 29 28 73 65 74 21 20 72 75 6e force")(set! run
7b10: 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 20 3b flag #t)).... ;
7b20: 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 ; NOT_STARTED, r
7b30: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 un no matter wha
7b40: 74 0a 09 09 09 20 20 28 28 65 71 75 61 6c 3f 20 t.... ((equal?
7b50: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
7b60: 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 testdat) "NOT_ST
7b70: 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75 6e ARTED")(set! run
7b80: 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 20 3b flag #t)).... ;
7b90: 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 ; not -rerun and
7ba0: 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 PASS, WARN or C
7bb0: 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a HECK, do no run.
7bc0: 09 09 09 20 20 28 28 61 6e 64 20 28 6f 72 20 28 ... ((and (or (
7bd0: 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 2d 61 72 not (args:get-ar
7be0: 67 20 22 2d 72 65 72 75 6e 22 29 29 0a 09 09 09 g "-rerun"))....
7bf0: 09 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 . (args:get-a
7c00: 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 rg "-keepgoing")
7c10: 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 28 74 ).....(member (t
7c20: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
7c30: 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22 estdat) '("PASS"
7c40: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 "WARN" "CHECK")
7c50: 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 )).... (set! r
7c60: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 unflag #f))....
7c70: 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 ;; -rerun and s
7c80: 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 tatus is one of
7c90: 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 the specifed, ru
7ca0: 6e 20 69 74 0a 09 09 09 20 20 28 28 61 6e 64 20 n it.... ((and
7cb0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
7cc0: 72 65 72 75 6e 22 29 0a 09 09 09 09 28 6c 65 74 rerun").....(let
7cd0: 20 28 28 72 65 72 75 6e 6c 73 74 20 28 73 74 72 ((rerunlst (str
7ce0: 69 6e 67 2d 73 70 6c 69 74 20 28 61 72 67 73 3a ing-split (args:
7cf0: 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 get-arg "-rerun"
7d00: 29 20 22 2c 22 29 29 29 20 3b 3b 20 46 41 49 4c ) ","))) ;; FAIL
7d10: 2c 0a 09 09 09 09 20 20 28 6d 65 6d 62 65 72 20 ,..... (member
7d20: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
7d30: 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c testdat) rerunl
7d40: 73 74 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 st))).... (set
7d50: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
7d60: 09 09 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e .. ;; -keepgoin
7d70: 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 g, do not rerun
7d80: 46 41 49 4c 0a 09 09 09 20 20 28 28 61 6e 64 20 FAIL.... ((and
7d90: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
7da0: 6b 65 65 70 67 6f 69 6e 67 22 29 0a 09 09 09 09 keepgoing").....
7db0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
7dc0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
7dd0: 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 09 ) '("FAIL")))...
7de0: 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 . (set! runfla
7df0: 67 20 23 66 29 29 0a 09 09 09 20 20 28 28 61 6e g #f)).... ((an
7e00: 64 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 d (not (args:get
7e10: 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 29 29 0a -arg "-rerun")).
7e20: 09 09 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 ....(member (tes
7e30: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
7e40: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 tdat) '("FAIL" "
7e50: 6e 2f 61 22 29 29 29 0a 09 09 09 20 20 20 28 73 n/a"))).... (s
7e60: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
7e70: 0a 09 09 09 20 20 28 65 6c 73 65 20 28 73 65 74 .... (else (set
7e80: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a ! runflag #f))).
7e90: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
7ea0: 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 6 "RUNNING => r
7eb0: 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 unflag: " runfla
7ec0: 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 g " STATE: " (te
7ed0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
7ee0: 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 tdat) " STATUS:
7ef0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
7f00: 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 us testdat))....
7f10: 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 (if (not runfla
7f20: 67 29 0a 09 09 09 20 20 20 20 20 28 69 66 20 28 g).... (if (
7f30: 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 not parent-test)
7f40: 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 ..... (debug:pri
7f50: 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 nt 1 "NOTE: Not
7f60: 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 starting test "
7f70: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 new-test-name "
7f80: 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c as it is state \
7f90: 22 43 4f 4d 50 4c 45 54 45 44 5c 22 20 61 6e 64 "COMPLETED\" and
7fa0: 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 status \"" (tes
7fb0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
7fc0: 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d tdat) "\", use -
7fd0: 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 force to overrid
7fe0: 65 22 29 29 0a 09 09 09 20 20 20 20 20 28 6c 65 e")).... (le
7ff0: 74 2a 20 28 28 67 65 74 2d 70 72 65 72 65 71 73 t* ((get-prereqs
8000: 2d 63 6d 64 20 28 6c 61 6d 62 64 61 20 28 29 0a -cmd (lambda ().
8010: 09 09 09 09 09 09 20 20 20 20 20 20 20 28 64 62 ...... (db
8020: 2d 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 -get-prereqs-not
8030: 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 -met db run-id w
8040: 61 69 74 6f 6e 29 29 29 20 3b 3b 20 63 68 65 63 aiton))) ;; chec
8050: 6b 20 62 65 66 6f 72 65 20 72 75 6e 6e 69 6e 67 k before running
8060: 20 2e 2e 2e 2e 0a 09 09 09 09 20 20 20 20 28 6c ......... (l
8070: 61 75 6e 63 68 2d 63 6d 64 20 20 20 20 20 20 28 aunch-cmd (
8080: 6c 61 6d 62 64 61 20 28 29 0a 09 09 09 09 09 09 lambda ().......
8090: 20 20 20 20 20 20 20 28 6c 61 75 6e 63 68 2d 74 (launch-t
80a0: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 28 61 est db run-id (a
80b0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 rgs:get-arg ":ru
80c0: 6e 6e 61 6d 65 22 29 20 74 65 73 74 2d 63 6f 6e nname") test-con
80d0: 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 f keyvallst test
80e0: 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 -name test-path
80f0: 69 74 65 6d 64 61 74 20 61 72 67 73 3a 61 72 67 itemdat args:arg
8100: 2d 68 61 73 68 29 29 29 0a 09 09 09 09 20 20 20 -hash))).....
8110: 20 28 74 65 73 74 72 75 6e 64 61 74 20 20 20 20 (testrundat
8120: 20 20 28 6c 69 73 74 20 67 65 74 2d 70 72 65 72 (list get-prer
8130: 65 71 73 2d 63 6d 64 20 6c 61 75 6e 63 68 2d 63 eqs-cmd launch-c
8140: 6d 64 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 md)))....
8150: 28 69 66 20 28 6f 72 20 28 61 72 67 73 3a 67 65 (if (or (args:ge
8160: 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a t-arg "-force").
8170: 09 09 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 .... (let
8180: 28 28 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d ((preqs-not-yet-
8190: 6d 65 74 20 28 28 63 61 72 20 74 65 73 74 72 75 met ((car testru
81a0: 6e 64 61 74 29 29 29 29 0a 09 09 09 09 09 20 28 ndat))))...... (
81b0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 50 debug:print 2 "P
81c0: 72 65 71 72 65 71 75 65 73 69 74 65 73 20 66 6f reqrequesites fo
81d0: 72 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 3a r " test-name ":
81e0: 20 22 20 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 " preqs-not-yet
81f0: 2d 6d 65 74 29 0a 09 09 09 09 09 20 28 6e 75 6c -met)...... (nul
8200: 6c 3f 20 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 l? preqs-not-yet
8210: 2d 6d 65 74 29 29 29 20 3b 3b 20 61 72 65 20 74 -met))) ;; are t
8220: 68 65 72 65 20 61 6e 79 20 74 65 73 74 73 20 74 here any tests t
8230: 68 61 74 20 6d 75 73 74 20 62 65 20 72 75 6e 20 hat must be run
8240: 62 65 66 6f 72 65 20 74 68 69 73 20 6f 6e 65 2e before this one.
8250: 2e 2e 0a 09 09 09 09 20 20 20 28 69 66 20 28 6e ....... (if (n
8260: 6f 74 20 28 28 63 61 64 72 20 74 65 73 74 72 75 ot ((cadr testru
8270: 6e 64 61 74 29 29 29 20 3b 3b 20 74 68 69 73 20 ndat))) ;; this
8280: 69 73 20 74 68 65 20 6c 69 6e 65 20 74 68 61 74 is the line that
8290: 20 6c 61 75 6e 63 68 65 73 20 74 68 65 20 74 65 launches the te
82a0: 73 74 20 74 6f 20 74 68 65 20 72 65 6d 6f 74 65 st to the remote
82b0: 20 68 6f 73 74 0a 09 09 09 09 20 20 20 20 20 20 host.....
82c0: 20 28 62 65 67 69 6e 0a 09 09 09 09 09 20 28 70 (begin...... (p
82d0: 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 rint "ERROR: Fai
82e0: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 led to launch th
82f0: 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 e test. Exiting
8300: 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 as soon as possi
8310: 62 6c 65 22 29 0a 09 09 09 09 09 20 28 73 65 74 ble")...... (set
8320: 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 ! *globalexitsta
8330: 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 09 09 tus* 1) ;; .....
8340: 09 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 . (process-signa
8350: 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 l (current-proce
8360: 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 ss-id) signal/ki
8370: 6c 6c 29 0a 09 09 09 09 09 20 3b 28 65 78 69 74 ll)...... ;(exit
8380: 20 31 29 0a 09 09 09 09 09 20 29 29 0a 09 09 09 1)...... ))....
8390: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 61 72 . (if (not (ar
83a0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6b 65 65 gs:get-arg "-kee
83b0: 70 67 6f 69 6e 67 22 29 29 0a 09 09 09 09 20 20 pgoing")).....
83c0: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 (hash-table
83d0: 2d 73 65 74 21 20 2a 77 61 69 74 69 6e 67 2d 71 -set! *waiting-q
83e0: 75 65 75 65 2a 20 6e 65 77 2d 74 65 73 74 2d 6e ueue* new-test-n
83f0: 61 6d 65 20 74 65 73 74 72 75 6e 64 61 74 29 29 ame testrundat))
8400: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 28 )))))... ((
8410: 4b 49 4c 4c 45 44 29 20 0a 09 09 20 20 20 20 20 KILLED) ...
8420: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
8430: 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 "NOTE: " new-te
8440: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 st-name " is alr
8450: 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 eady running or
8460: 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 was explictly ki
8470: 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 lled, use -force
8480: 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 to launch it.")
8490: 29 0a 09 09 20 20 20 20 20 20 28 28 4c 41 55 4e )... ((LAUN
84a0: 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 CHED REMOTEHOSTS
84b0: 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a TART RUNNING) .
84c0: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 .. (if (>
84d0: 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f (- (current-seco
84e0: 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d nds)(+ (db:test-
84f0: 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 get-event_time t
8500: 65 73 74 64 61 74 29 0a 09 09 09 09 09 09 20 20 estdat).......
8510: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
8520: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 run_duration tes
8530: 74 64 61 74 29 29 29 0a 09 09 09 20 20 20 20 20 tdat)))....
8540: 20 31 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 100) ;; i.e. no
8550: 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 update for more
8560: 20 74 68 61 6e 20 31 30 30 20 73 65 63 6f 6e 64 than 100 second
8570: 73 0a 09 09 09 20 20 20 28 62 65 67 69 6e 0a 09 s.... (begin..
8580: 09 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 .. (debug:pr
8590: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
85a0: 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 Test " test-name
85b0: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 " appears to be
85c0: 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 dead. Forcing i
85d0: 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d t to state INCOM
85e0: 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 PLETE and status
85f0: 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 09 STUCK/DEAD")...
8600: 09 20 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d . (test-set-
8610: 73 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 status! db run-i
8620: 64 20 74 65 73 74 2d 6e 61 6d 65 20 22 49 4e 43 d test-name "INC
8630: 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f OMPLETE" "STUCK/
8640: 44 45 41 44 22 20 69 74 65 6d 64 61 74 20 22 54 DEAD" itemdat "T
8650: 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 est is stuck or
8660: 64 65 61 64 22 20 23 66 29 29 0a 09 09 09 20 20 dead" #f))....
8670: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
8680: 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 "NOTE: " test-na
8690: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
86a0: 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 09 20 20 running")))...
86b0: 20 20 20 20 28 65 6c 73 65 20 20 20 20 20 20 20 (else
86c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
86d0: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
86e0: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e launch test " n
86f0: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 ew-test-name ".
8700: 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 Unrecognised sta
8710: 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 te " (test:get-s
8720: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29 tate testdat))))
8730: 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e )).. (if (n
8740: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a ot (null? tal)).
8750: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 .. (loop (car t
8760: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 al)(cdr tal)))))
8770: 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 ))))..(define (r
8780: 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 73 un-waiting-tests
8790: 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 6e 75 db). (let ((nu
87a0: 6d 74 72 69 65 73 20 20 20 20 20 20 20 20 20 20 mtries
87b0: 20 30 29 0a 09 28 6c 61 73 74 2d 74 72 79 2d 74 0)..(last-try-t
87c0: 69 6d 65 20 20 20 20 20 20 28 63 75 72 72 65 6e ime (curren
87d0: 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 28 74 69 t-seconds))..(ti
87e0: 6d 65 73 20 20 20 20 20 20 20 20 20 20 20 20 20 mes
87f0: 20 28 6c 69 73 74 20 31 29 29 29 20 3b 3b 20 6d (list 1))) ;; m
8800: 69 6e 75 74 65 73 20 74 6f 20 77 61 69 74 20 62 inutes to wait b
8810: 65 66 6f 72 65 20 74 72 79 69 6e 67 20 61 67 61 efore trying aga
8820: 69 6e 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 72 in to kick off r
8830: 75 6e 73 0a 20 20 20 20 3b 3b 20 42 55 47 20 74 uns. ;; BUG t
8840: 68 69 73 20 68 61 63 6b 20 6f 66 20 62 72 75 74 his hack of brut
8850: 65 20 66 6f 72 63 65 20 72 65 74 72 79 69 6e 67 e force retrying
8860: 20 77 6f 72 6b 73 20 71 75 69 74 65 20 77 65 6c works quite wel
8870: 6c 20 66 6f 72 20 6d 61 6e 79 20 63 61 73 65 73 l for many cases
8880: 20 62 75 74 20 0a 20 20 20 20 3b 3b 20 20 20 20 but . ;;
8890: 20 77 68 61 74 20 69 73 20 6e 65 65 64 65 64 20 what is needed
88a0: 69 73 20 74 6f 20 63 68 65 63 6b 20 74 68 65 20 is to check the
88b0: 64 62 20 66 6f 72 20 74 65 73 74 73 20 74 68 61 db for tests tha
88c0: 74 20 68 61 76 65 20 66 61 69 6c 65 64 20 6c 65 t have failed le
88d0: 73 73 20 74 68 61 6e 0a 20 20 20 20 3b 3b 20 20 ss than. ;;
88e0: 20 20 20 4e 20 74 69 6d 65 73 20 6f 72 20 6e 65 N times or ne
88f0: 76 65 72 20 62 65 65 6e 20 73 74 61 72 74 65 64 ver been started
8900: 20 61 6e 64 20 6b 69 63 6b 20 74 68 65 6d 20 6f and kick them o
8910: 66 66 20 61 67 61 69 6e 0a 20 20 20 20 28 6c 65 ff again. (le
8920: 74 20 6c 6f 6f 70 20 28 28 77 61 69 74 69 6e 67 t loop ((waiting
8930: 2d 74 65 73 74 2d 6e 61 6d 65 73 20 28 68 61 73 -test-names (has
8940: 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 2a 77 61 h-table-keys *wa
8950: 69 74 69 6e 67 2d 71 75 65 75 65 2a 29 29 29 0a iting-queue*))).
8960: 20 20 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 (cond.
8970: 20 20 20 28 28 6e 6f 74 20 28 72 75 6e 73 3a 63 ((not (runs:c
8980: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
8990: 73 20 64 62 29 29 0a 09 28 74 68 72 65 61 64 2d s db))..(thread-
89a0: 73 6c 65 65 70 21 20 32 29 0a 09 28 6c 6f 6f 70 sleep! 2)..(loop
89b0: 20 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 waiting-test-na
89c0: 6d 65 73 29 29 0a 20 20 20 20 20 20 20 28 28 6e mes)). ((n
89d0: 75 6c 6c 3f 20 77 61 69 74 69 6e 67 2d 74 65 73 ull? waiting-tes
89e0: 74 2d 6e 61 6d 65 73 29 0a 09 28 64 65 62 75 67 t-names)..(debug
89f0: 3a 70 72 69 6e 74 20 31 20 22 41 6c 6c 20 74 65 :print 1 "All te
8a00: 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29 29 0a sts launched")).
8a10: 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 28 73 (else..(s
8a20: 65 74 21 20 6e 75 6d 74 72 69 65 73 20 28 2b 20 et! numtries (+
8a30: 6e 75 6d 74 72 69 65 73 20 31 29 29 0a 09 28 66 numtries 1))..(f
8a40: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
8a50: 28 74 65 73 74 6e 61 6d 65 29 0a 09 09 20 20 20 (testname)...
8a60: 20 28 69 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 (if (runs:can-r
8a70: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 un-more-tests db
8a80: 29 0a 09 09 09 28 6c 65 74 2a 20 28 28 74 65 73 )....(let* ((tes
8a90: 74 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 tdat (hash-table
8aa0: 2d 72 65 66 20 2a 77 61 69 74 69 6e 67 2d 71 75 -ref *waiting-qu
8ab0: 65 75 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 0a eue* testname)).
8ac0: 09 09 09 20 20 20 20 20 20 20 28 70 72 65 72 65 ... (prere
8ad0: 71 73 20 28 28 63 61 72 20 74 65 73 74 64 61 74 qs ((car testdat
8ae0: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6c ))).... (l
8af0: 64 62 20 20 20 20 20 28 69 66 20 64 62 20 64 62 db (if db db
8b00: 20 28 6f 70 65 6e 2d 64 62 29 29 29 29 0a 09 09 (open-db))))...
8b10: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
8b20: 32 20 22 70 72 65 72 65 71 73 20 72 65 6d 61 69 2 "prereqs remai
8b30: 6e 69 6e 67 3a 20 22 20 70 72 65 72 65 71 73 29 ning: " prereqs)
8b40: 0a 09 09 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f .... (if (null?
8b50: 20 70 72 65 72 65 71 73 29 0a 09 09 09 20 20 20 prereqs)....
8b60: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 (begin.....(d
8b70: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 50 72 ebug:print 2 "Pr
8b80: 65 72 65 71 75 69 73 69 74 65 73 20 6d 65 74 2c erequisites met,
8b90: 20 6c 61 75 6e 63 68 69 6e 67 20 22 20 74 65 73 launching " tes
8ba0: 74 6e 61 6d 65 29 0a 09 09 09 09 28 28 63 61 64 tname).....((cad
8bb0: 72 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 09 r testdat)).....
8bc0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 (hash-table-dele
8bd0: 74 65 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 te! *waiting-que
8be0: 75 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 29 0a ue* testname))).
8bf0: 09 09 09 20 20 28 69 66 20 28 6e 6f 74 20 64 62 ... (if (not db
8c00: 29 0a 09 09 09 20 20 20 20 20 20 28 73 71 6c 69 ).... (sqli
8c10: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 6c 64 te3:finalize! ld
8c20: 62 29 29 29 29 29 0a 09 09 20 20 77 61 69 74 69 b)))))... waiti
8c30: 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 73 29 0a 09 ng-test-names)..
8c40: 3b 3b 20 28 73 6c 65 65 70 20 31 30 29 20 3b 3b ;; (sleep 10) ;;
8c50: 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 72 75 73 no point in rus
8c60: 68 69 6e 67 20 74 68 69 6e 67 73 20 61 74 20 74 hing things at t
8c70: 68 69 73 20 73 74 61 67 65 3f 0a 09 28 6c 6f 6f his stage?..(loo
8c80: 70 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 p (hash-table-ke
8c90: 79 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 ys *waiting-queu
8ca0: 65 2a 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d e*)))))))..;;===
8cb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8cc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8cd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8ce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8cf0: 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d 65 74 68 6f ===.;; New metho
8d00: 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65 20 72 6f dology. These ro
8d10: 75 74 69 6e 65 73 20 77 69 6c 6c 20 72 65 70 6c utines will repl
8d20: 61 63 65 20 74 68 65 20 61 62 6f 76 65 20 69 6e ace the above in
8d30: 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b 20 6e 6f time. For.;; no
8d40: 77 20 74 68 65 20 63 6f 64 65 20 69 73 20 64 75 w the code is du
8d50: 70 6c 69 63 61 74 65 64 2e 20 54 68 69 73 20 73 plicated. This s
8d60: 74 75 66 66 20 69 73 20 69 6e 69 74 69 61 6c 6c tuff is initiall
8d70: 79 20 75 73 65 64 20 69 6e 20 74 68 65 20 6d 6f y used in the mo
8d80: 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65 64 20 63 nitor.;; based c
8d90: 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d ode..;;=========
8da0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8db0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8dc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8dd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b =============..;
8de0: 3b 20 72 65 67 69 73 74 65 72 20 61 20 74 65 73 ; register a tes
8df0: 74 20 72 75 6e 20 77 69 74 68 20 74 68 65 20 64 t run with the d
8e00: 62 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a b.(define (runs:
8e10: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 register-run db
8e20: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 keys keyvallst r
8e30: 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 unname state sta
8e40: 74 75 73 20 75 73 65 72 29 0a 20 20 28 64 65 62 tus user). (deb
8e50: 75 67 3a 70 72 69 6e 74 20 33 20 22 72 75 6e 73 ug:print 3 "runs
8e60: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 2c 20 6b :register-run, k
8e70: 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 eys: " keys " ke
8e80: 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 yvallst: " keyva
8e90: 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d 65 3a 20 llst " runname:
8ea0: 22 20 72 75 6e 6e 61 6d 65 20 22 20 73 74 61 74 " runname " stat
8eb0: 65 3a 20 22 20 73 74 61 74 65 20 22 20 73 74 61 e: " state " sta
8ec0: 74 75 73 3a 20 22 20 73 74 61 74 75 73 20 22 20 tus: " status "
8ed0: 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 user: " user).
8ee0: 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 72 20 20 (let* ((keystr
8ef0: 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74 72 20 (keys->keystr
8f00: 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d 61 20 keys)).. (comma
8f10: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 (if (> (leng
8f20: 74 68 20 6b 65 79 73 29 20 30 29 20 22 2c 22 20 th keys) 0) ","
8f30: 22 22 29 29 0a 09 20 28 61 6e 64 73 74 72 20 20 "")).. (andstr
8f40: 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 74 68 (if (> (length
8f50: 20 6b 65 79 73 29 20 30 29 20 22 20 41 4e 44 20 keys) 0) " AND
8f60: 22 20 22 22 29 29 0a 09 20 28 76 61 6c 73 6c 6f " "")).. (valslo
8f70: 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c 73 6c ts (keys->valsl
8f80: 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b 20 3f 2c ots keys)) ;; ?,
8f90: 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 76 61 ?,? ..... (keyva
8fa0: 6c 73 20 20 20 28 6d 61 70 20 63 61 64 72 20 6b ls (map cadr k
8fb0: 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 28 61 6c eyvallst)).. (al
8fc0: 6c 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 20 lvals (append
8fd0: 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 (list runname st
8fe0: 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29 ate status user)
8ff0: 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 71 72 keyvals)).. (qr
9000: 79 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 20 yvals (append
9010: 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 29 20 6b (list runname) k
9020: 65 79 76 61 6c 73 29 29 0a 09 20 28 6b 65 79 3d eyvals)).. (key=
9030: 3f 73 74 72 20 20 28 73 74 72 69 6e 67 2d 69 6e ?str (string-in
9040: 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 tersperse (map (
9050: 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f 6e 63 20 lambda (k)(conc
9060: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 (key:get-fieldna
9070: 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20 6b 65 79 me k) "=?")) key
9080: 73 29 20 22 20 41 4e 44 20 22 29 29 29 0a 20 20 s) " AND "))).
9090: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 (debug:print 3
90a0: 20 22 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 "keys: " keys "
90b0: 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61 6c 6c 76 allvals: " allv
90c0: 61 6c 73 20 22 20 6b 65 79 76 61 6c 73 3a 20 22 als " keyvals: "
90d0: 20 6b 65 79 76 61 6c 73 29 0a 20 20 20 20 28 64 keyvals). (d
90e0: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f ebug:print 2 "NO
90f0: 54 45 3a 20 75 73 69 6e 67 20 74 61 72 67 65 74 TE: using target
9100: 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 " (string-inter
9110: 73 70 65 72 73 65 20 6b 65 79 76 61 6c 73 20 22 sperse keyvals "
9120: 2f 22 29 20 22 20 66 6f 72 20 74 68 69 73 20 72 /") " for this r
9130: 75 6e 22 29 0a 20 20 20 20 28 69 66 20 28 61 6e un"). (if (an
9140: 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75 6c 6c 3f d runname (null?
9150: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 (filter (lambda
9160: 20 28 78 29 28 6e 6f 74 20 78 29 29 20 6b 65 79 (x)(not x)) key
9170: 76 61 6c 73 29 29 29 20 3b 3b 20 74 68 65 72 65 vals))) ;; there
9180: 20 6d 75 73 74 20 62 65 20 61 20 62 65 74 74 65 must be a bette
9190: 72 20 77 61 79 20 74 6f 20 22 61 70 70 6c 79 20 r way to "apply
91a0: 61 6e 64 22 0a 09 28 6c 65 74 20 28 28 72 65 73 and"..(let ((res
91b0: 20 23 66 29 29 0a 09 20 20 28 61 70 70 6c 79 20 #f)).. (apply
91c0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
91d0: 64 62 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 db (conc "INSERT
91e0: 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e 54 4f 20 OR IGNORE INTO
91f0: 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65 2c 73 74 runs (runname,st
9200: 61 74 65 2c 73 74 61 74 75 73 2c 6f 77 6e 65 72 ate,status,owner
9210: 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20 63 6f 6d ,event_time" com
9220: 6d 61 20 6b 65 79 73 74 72 20 22 29 20 56 41 4c ma keystr ") VAL
9230: 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 UES (?,?,?,?,str
9240: 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 ftime('%s','now'
9250: 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73 6c 6f 74 )" comma valslot
9260: 73 20 22 29 3b 22 29 0a 09 09 20 61 6c 6c 76 61 s ");")... allva
9270: 6c 73 29 0a 09 20 20 28 61 70 70 6c 79 20 73 71 ls).. (apply sq
9280: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
9290: 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 ow .. (lambda
92a0: 28 69 64 29 0a 09 20 20 20 20 20 28 73 65 74 21 (id).. (set!
92b0: 20 72 65 73 20 69 64 29 29 0a 09 20 20 20 64 62 res id)).. db
92c0: 0a 09 20 20 20 28 6c 65 74 20 28 28 71 72 79 20 .. (let ((qry
92d0: 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 69 64 (conc "SELECT id
92e0: 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 FROM runs WHERE
92f0: 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22 20 61 6e (runname=? " an
9300: 64 73 74 72 20 6b 65 79 3d 3f 73 74 72 20 22 29 dstr key=?str ")
9310: 3b 22 29 29 29 0a 09 20 20 20 20 20 3b 28 64 65 ;"))).. ;(de
9320: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 71 72 79 bug:print 4 "qry
9330: 3a 20 22 20 71 72 79 29 20 0a 09 20 20 20 20 20 : " qry) ..
9340: 71 72 79 29 0a 09 20 20 20 71 72 79 76 61 6c 73 qry).. qryvals
9350: 29 0a 09 20 20 28 73 71 6c 69 74 65 33 3a 65 78 ).. (sqlite3:ex
9360: 65 63 75 74 65 20 64 62 20 22 55 50 44 41 54 45 ecute db "UPDATE
9370: 20 72 75 6e 73 20 53 45 54 20 73 74 61 74 65 3d runs SET state=
9380: 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48 45 52 45 ?,status=? WHERE
9390: 20 69 64 3d 3f 3b 22 20 73 74 61 74 65 20 73 74 id=?;" state st
93a0: 61 74 75 73 20 72 65 73 29 0a 09 20 20 72 65 73 atus res).. res
93b0: 29 20 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 ) ..(begin.. (d
93c0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
93d0: 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77 69 74 68 ROR: Called with
93e0: 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73 73 61 72 out all necessar
93f0: 79 20 6b 65 79 73 22 29 0a 09 20 20 23 66 29 29 y keys").. #f))
9400: 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69 73 20 61 ))..;; This is a
9410: 20 64 75 70 6c 69 63 61 74 65 20 6f 66 20 72 75 duplicate of ru
9420: 6e 2d 74 65 73 74 73 20 28 77 68 69 63 68 20 68 n-tests (which h
9430: 61 73 20 62 65 65 6e 20 64 65 70 72 65 63 61 74 as been deprecat
9440: 65 64 29 2e 20 55 73 65 20 74 68 69 73 20 6f 6e ed). Use this on
9450: 65 20 69 6e 73 74 65 61 64 20 6f 66 20 72 75 6e e instead of run
9460: 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65 79 76 61 tests..;; keyva
9470: 6c 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 ls.(define (runs
9480: 3a 72 75 6e 2d 74 65 73 74 73 20 64 62 20 74 61 :run-tests db ta
9490: 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 65 73 rget runname tes
94a0: 74 2d 70 61 74 74 73 20 69 74 65 6d 2d 70 61 74 t-patts item-pat
94b0: 74 73 20 75 73 65 72 20 66 6c 61 67 73 29 0a 20 ts user flags).
94c0: 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 20 (let* ((keys
94d0: 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b 65 79 (db-get-key
94e0: 73 20 64 62 29 29 0a 09 20 28 6b 65 79 76 61 6c s db)).. (keyval
94f0: 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 lst (keys:targ
9500: 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 et->keyval keys
9510: 74 61 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d target)).. (run-
9520: 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 id (runs:re
9530: 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 gister-run db ke
9540: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
9550: 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 name "new" "n/a"
9560: 20 75 73 65 72 29 29 20 20 3b 3b 20 20 74 65 73 user)) ;; tes
9570: 74 2d 6e 61 6d 65 29 29 29 0a 09 20 28 64 65 66 t-name))).. (def
9580: 65 72 72 65 64 20 20 20 20 27 28 29 29 20 3b 3b erred '()) ;;
9590: 20 64 65 6c 61 79 20 72 75 6e 6e 69 6e 67 20 74 delay running t
95a0: 68 65 73 65 20 73 69 6e 63 65 20 74 68 65 79 20 hese since they
95b0: 68 61 76 65 20 61 20 77 61 69 74 6f 6e 20 63 6c have a waiton cl
95c0: 61 75 73 65 0a 09 20 28 6b 65 65 70 67 6f 69 6e ause.. (keepgoin
95d0: 67 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d g (hash-table-
95e0: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 ref/default flag
95f0: 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 s "-keepgoing" #
9600: 66 29 29 0a 09 20 28 74 65 73 74 2d 6e 61 6d 65 f)).. (test-name
9610: 73 20 20 27 28 29 29 0a 09 20 28 72 75 6e 63 6f s '()).. (runco
9620: 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 20 20 2a nfigf (conc *
9630: 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f toppath* "/runco
9640: 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 0a nfigs.config")).
9650: 09 20 28 72 65 71 75 69 72 65 64 2d 74 65 73 74 . (required-test
9660: 73 20 27 28 29 29 29 0a 0a 20 20 20 20 28 73 65 s '())).. (se
9670: 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 t-megatest-env-v
9680: 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b ars db run-id) ;
9690: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e ; these may be n
96a0: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 eeded by the lau
96b0: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a nching process..
96c0: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 (if (file-ex
96d0: 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 ists? runconfigf
96e0: 29 0a 09 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 )..(setup-env-de
96f0: 66 61 75 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e faults db runcon
9700: 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 figf run-id *alr
9710: 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e eady-seen-runcon
9720: 66 69 67 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c fig-info* "pre-l
9730: 61 75 6e 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 aunch-env-vars")
9740: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 ..(debug:print 0
9750: 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 "WARNING: You d
9760: 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 6e o not have a run
9770: 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 config file: "
9780: 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 runconfigf)).
9790: 20 0a 20 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 . ;; look up
97a0: 20 61 6c 6c 20 74 65 73 74 73 20 6d 61 74 63 68 all tests match
97b0: 69 6e 67 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 ing the comma se
97c0: 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f 66 20 parated list of
97d0: 67 6c 6f 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 globs in. ;;
97e0: 74 65 73 74 2d 70 61 74 74 73 20 28 75 73 69 6e test-patts (usin
97f0: 67 20 25 20 61 73 20 77 69 6c 64 63 61 72 64 29 g % as wildcard)
9800: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
9810: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 70 61 (lambda (pa
9820: 74 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 tt). (let
9830: 28 28 74 65 73 74 73 20 28 67 6c 6f 62 20 28 63 ((tests (glob (c
9840: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
9850: 74 65 73 74 73 2f 22 20 28 73 74 72 69 6e 67 2d tests/" (string-
9860: 74 72 61 6e 73 6c 61 74 65 20 70 61 74 74 20 22 translate patt "
9870: 25 22 20 22 2a 22 29 29 29 29 29 0a 09 20 28 73 %" "*"))))).. (s
9880: 65 74 21 20 74 65 73 74 73 20 28 66 69 6c 74 65 et! tests (filte
9890: 72 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 r (lambda (test)
98a0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 (file-exists? (c
98b0: 6f 6e 63 20 74 65 73 74 20 22 2f 74 65 73 74 63 onc test "/testc
98c0: 6f 6e 66 69 67 22 29 29 29 20 74 65 73 74 73 29 onfig"))) tests)
98d0: 29 0a 09 20 28 73 65 74 21 20 74 65 73 74 2d 6e ).. (set! test-n
98e0: 61 6d 65 73 20 28 61 70 70 65 6e 64 20 74 65 73 ames (append tes
98f0: 74 2d 6e 61 6d 65 73 20 0a 09 09 09 09 20 20 28 t-names ..... (
9900: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 65 73 map (lambda (tes
9910: 74 70 29 0a 09 09 09 09 09 20 28 6c 61 73 74 20 tp)...... (last
9920: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 (string-split te
9930: 73 74 70 20 22 2f 22 29 29 29 0a 09 09 09 09 20 stp "/"))).....
9940: 20 20 20 20 20 20 74 65 73 74 73 29 29 29 29 29 tests)))))
9950: 0a 20 20 20 20 20 28 73 74 72 69 6e 67 2d 73 70 . (string-sp
9960: 6c 69 74 20 74 65 73 74 2d 70 61 74 74 73 20 22 lit test-patts "
9970: 2c 22 29 29 0a 0a 20 20 20 20 20 3b 3b 20 6e 6f ,")).. ;; no
9980: 77 20 72 65 6d 6f 76 65 20 64 75 70 6c 69 63 61 w remove duplica
9990: 74 65 73 0a 20 20 20 20 28 73 65 74 21 20 74 65 tes. (set! te
99a0: 73 74 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 st-names (delete
99b0: 2d 64 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 -duplicates test
99c0: 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 -names)).. (d
99d0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 49 4e ebug:print 0 "IN
99e0: 46 4f 3a 20 74 65 73 74 20 6e 61 6d 65 73 20 22 FO: test names "
99f0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 test-names)..
9a00: 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f 6e ;; now add non
9a10: 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 65 -directly refere
9a20: 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 65 nced dependencie
9a30: 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 0a s (i.e. waiton).
9a40: 20 20 20 20 3b 3b 20 63 6f 75 6c 64 20 63 61 63 ;; could cac
9a50: 68 65 20 61 6c 6c 20 74 68 65 73 65 20 73 69 6e he all these sin
9a60: 63 65 20 74 68 65 79 20 6e 65 65 64 20 74 6f 20 ce they need to
9a70: 62 65 20 72 65 61 64 20 61 67 61 69 6e 20 2e 2e be read again ..
9a80: 2e 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 20 53 .. ;; FIXME S
9a90: 4f 4d 45 44 41 59 0a 20 20 20 20 28 69 66 20 28 OMEDAY. (if (
9aa0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 2d not (null? test-
9ab0: 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f names))..(let lo
9ac0: 6f 70 20 28 28 68 65 64 20 28 63 61 72 20 74 65 op ((hed (car te
9ad0: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 st-names))...
9ae0: 28 74 61 6c 20 28 63 64 72 20 74 65 73 74 2d 6e (tal (cdr test-n
9af0: 61 6d 65 73 29 29 29 0a 09 20 20 28 6c 65 74 2a ames))).. (let*
9b00: 20 28 28 63 6f 6e 66 69 67 20 20 28 74 65 73 74 ((config (test
9b10: 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 :get-testconfig
9b20: 68 65 64 20 23 66 29 29 0a 09 09 20 28 77 61 69 hed #f))... (wai
9b30: 74 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 6c tons (string-spl
9b40: 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e it (let ((w (con
9b50: 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 fig-lookup confi
9b60: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 g "requirements"
9b70: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 "waiton")))....
9b80: 09 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29 .. (if w w ""))
9b90: 29 29 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 ))).. (for-ea
9ba0: 63 68 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 ch .. (lambd
9bb0: 61 20 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 a (waiton)..
9bc0: 20 20 20 28 69 66 20 28 61 6e 64 20 77 61 69 74 (if (and wait
9bd0: 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 on (not (member
9be0: 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 waiton test-name
9bf0: 73 29 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e s)))... (begin
9c00: 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 72 65 ... (set! re
9c10: 71 75 69 72 65 64 2d 74 65 73 74 73 20 28 63 6f quired-tests (co
9c20: 6e 73 20 77 61 69 74 6f 6e 20 72 65 71 75 69 72 ns waiton requir
9c30: 65 64 2d 74 65 73 74 73 29 29 0a 09 09 20 20 20 ed-tests))...
9c40: 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d (set! test-nam
9c50: 65 73 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d es (append test-
9c60: 6e 61 6d 65 73 20 28 6c 69 73 74 20 77 61 69 74 names (list wait
9c70: 6f 6e 29 29 29 29 29 29 0a 09 20 20 20 20 20 77 on)))))).. w
9c80: 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c 65 aitons).. (le
9c90: 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 64 65 t ((remtests (de
9ca0: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 lete-duplicates
9cb0: 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 20 (append waitons
9cc0: 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20 28 tal)))).. (
9cd0: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 if (not (null? r
9ce0: 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28 6c emtests))... (l
9cf0: 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73 74 oop (car remtest
9d00: 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 73 29 s)(cdr remtests)
9d10: 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66 20 )))))).. (if
9d20: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 75 (not (null? requ
9d30: 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28 64 ired-tests))..(d
9d40: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e ebug:print 1 "IN
9d50: 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 65 71 FO: Adding " req
9d60: 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 74 6f uired-tests " to
9d70: 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 22 29 the run queue")
9d80: 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 ).. ;; on the
9d90: 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 first pass or c
9da0: 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 all to run-tests
9db0: 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f set FAILS to NO
9dc0: 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 T_STARTED if.
9dd0: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 ;; -keepgoing i
9de0: 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 s specified.
9df0: 28 69 66 20 28 61 6e 64 20 28 65 71 3f 20 2a 70 (if (and (eq? *p
9e00: 61 73 73 6e 75 6d 2a 20 30 29 0a 09 20 20 20 20 assnum* 0)..
9e10: 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 28 62 65 keepgoing)..(be
9e20: 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 gin.. ;; have t
9e30: 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 o delete test re
9e40: 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f cords where NOT_
9e50: 53 54 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 STARTED since th
9e60: 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 ey can cause -ke
9e70: 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b epgoing to .. ;
9e80: 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 ; get stuck due
9e90: 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 to becoming inac
9ea0: 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 cessible from a
9eb0: 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 failed test. I.e
9ec0: 2e 20 69 66 20 74 65 73 74 20 42 20 64 65 70 65 . if test B depe
9ed0: 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 nds .. ;; on te
9ee0: 73 74 20 41 20 62 75 74 20 74 65 73 74 20 42 20 st A but test B
9ef0: 72 65 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e reached the poin
9f00: 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 t on being regis
9f10: 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 tered as NOT_STA
9f20: 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 RTED and test..
9f30: 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 ;; A failed for
9f40: 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 some reason the
9f50: 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e n on re-run usin
9f60: 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 g -keepgoing the
9f70: 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 run can never c
9f80: 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 64 62 3a omplete... (db:
9f90: 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d delete-tests-in-
9fa0: 73 74 61 74 65 20 64 62 20 72 75 6e 2d 69 64 20 state db run-id
9fb0: 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 "NOT_STARTED")..
9fc0: 20 20 28 64 62 3a 73 65 74 2d 74 65 73 74 73 2d (db:set-tests-
9fd0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 20 state-status db
9fe0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
9ff0: 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 s #f "FAIL" "NOT
a000: 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 _STARTED" "FAIL"
a010: 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 2a 70 ))). (set! *p
a020: 61 73 73 6e 75 6d 2a 20 28 2b 20 2a 70 61 73 73 assnum* (+ *pass
a030: 6e 75 6d 2a 20 31 29 29 0a 20 20 20 20 28 6c 65 num* 1)). (le
a040: 74 20 6c 6f 6f 70 20 28 28 6e 75 6d 74 69 6d 65 t loop ((numtime
a050: 73 20 30 29 29 0a 20 20 20 20 20 20 28 66 6f 72 s 0)). (for
a060: 2d 65 61 63 68 20 0a 20 20 20 20 20 20 20 28 6c -each . (l
a070: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 ambda (test-name
a080: 29 0a 09 20 28 69 66 20 28 72 75 6e 73 3a 63 61 ).. (if (runs:ca
a090: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
a0a0: 20 64 62 29 0a 09 20 20 20 20 20 28 72 75 6e 3a db).. (run:
a0b0: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 test db run-id r
a0c0: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 6e 61 6d 65 unname test-name
a0d0: 20 6b 65 79 76 61 6c 6c 73 74 20 69 74 65 6d 2d keyvallst item-
a0e0: 70 61 74 74 73 20 66 6c 61 67 73 29 0a 09 20 20 patts flags)..
a0f0: 20 20 20 29 29 0a 20 20 20 20 20 20 20 28 74 65 )). (te
a100: 73 74 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f sts:sort-by-prio
a110: 72 69 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 rity-and-waiton
a120: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 20 20 20 test-names)).
a130: 20 20 20 3b 3b 20 28 72 75 6e 2d 77 61 69 74 69 ;; (run-waiti
a140: 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 20 20 20 ng-tests db).
a150: 20 20 20 28 69 66 20 6b 65 65 70 67 6f 69 6e 67 (if keepgoing
a160: 0a 09 20 20 28 6c 65 74 20 28 28 65 73 74 72 65 .. (let ((estre
a170: 6d 20 28 64 62 3a 65 73 74 69 6d 61 74 65 64 2d m (db:estimated-
a180: 74 65 73 74 73 2d 72 65 6d 61 69 6e 69 6e 67 20 tests-remaining
a190: 64 62 20 72 75 6e 2d 69 64 29 29 29 0a 09 20 20 db run-id)))..
a1a0: 20 20 28 69 66 20 28 61 6e 64 20 28 3e 20 65 73 (if (and (> es
a1b0: 74 72 65 6d 20 30 29 0a 09 09 20 20 20 20 20 28 trem 0)... (
a1c0: 65 71 3f 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 eq? *globalexits
a1d0: 74 61 74 75 73 2a 20 30 29 29 0a 09 09 28 62 65 tatus* 0))...(be
a1e0: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 gin... (debug:p
a1f0: 72 69 6e 74 20 31 20 22 4b 65 65 70 20 67 6f 69 rint 1 "Keep goi
a200: 6e 67 2c 20 65 73 74 69 6d 61 74 65 64 20 22 20 ng, estimated "
a210: 65 73 74 72 65 6d 20 22 20 74 65 73 74 73 20 72 estrem " tests r
a220: 65 6d 61 69 6e 69 6e 67 20 74 6f 20 72 75 6e 2c emaining to run,
a230: 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 69 will continue i
a240: 6e 20 33 20 73 65 63 6f 6e 64 73 20 2e 2e 2e 22 n 3 seconds ..."
a250: 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c )... (thread-sl
a260: 65 65 70 21 20 33 29 0a 09 09 20 20 28 72 75 6e eep! 3)... (run
a270: 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 73 20 64 -waiting-tests d
a280: 62 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 2b 20 b)... (loop (+
a290: 6e 75 6d 74 69 6d 65 73 20 31 29 29 29 29 29 29 numtimes 1))))))
a2a0: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 )))..(define (ru
a2b0: 6e 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 n:test db run-id
a2c0: 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 6e 61 runname test-na
a2d0: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 69 74 65 me keyvallst ite
a2e0: 6d 2d 70 61 74 74 73 20 66 6c 61 67 73 29 0a 20 m-patts flags).
a2f0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
a300: 22 4c 61 75 6e 63 68 69 6e 67 20 74 65 73 74 20 "Launching test
a310: 22 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 3b " test-name). ;
a320: 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 ; All these vars
a330: 20 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65 might be refere
a340: 6e 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74 nced by the test
a350: 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 config file read
a360: 65 72 0a 20 20 28 73 65 74 65 6e 76 20 22 4d 54 er. (setenv "MT
a370: 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 _TEST_NAME" test
a380: 2d 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 28 73 65 -name) ;; . (se
a390: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 tenv "MT_RUNNAME
a3a0: 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 28 " runname). (
a3b0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 set-megatest-env
a3c0: 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 -vars db run-id)
a3d0: 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 ;; these may be
a3e0: 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c needed by the l
a3f0: 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 aunching process
a400: 0a 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 . (change-direc
a410: 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a tory *toppath*).
a420: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 (let* ((test-p
a430: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f ath (conc *to
a440: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 ppath* "/tests/"
a450: 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 test-name)) ;;
a460: 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 3a 67 could use test:g
a470: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 et-testconfig he
a480: 72 65 20 2e 2e 2e 0a 09 20 28 74 65 73 74 2d 63 re ..... (test-c
a490: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 onfigf (conc tes
a4a0: 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e t-path "/testcon
a4b0: 66 69 67 22 29 29 0a 09 20 28 74 65 73 74 65 78 fig")).. (testex
a4c0: 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c ists (and (fil
a4d0: 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 e-exists? test-c
a4e0: 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 onfigf)(file-rea
a4f0: 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 d-access? test-c
a500: 6f 6e 66 69 67 66 29 29 29 0a 09 20 28 74 65 73 onfigf))).. (tes
a510: 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 t-conf (if te
a520: 73 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 stexists (read-c
a530: 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 onfig test-confi
a540: 67 66 20 23 66 20 23 74 29 20 28 6d 61 6b 65 2d gf #f #t) (make-
a550: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 hash-table)))..
a560: 28 77 61 69 74 6f 6e 20 20 20 20 20 20 20 28 6c (waiton (l
a570: 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c et ((w (config-l
a580: 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 ookup test-conf
a590: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 "requirements" "
a5a0: 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 20 28 waiton"))).... (
a5b0: 69 66 20 28 73 74 72 69 6e 67 3f 20 77 29 28 73 if (string? w)(s
a5c0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 77 29 27 28 tring-split w)'(
a5d0: 29 29 29 29 0a 09 20 28 66 6f 72 63 65 20 20 20 )))).. (force
a5e0: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 (hash-table
a5f0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 -ref/default fla
a600: 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29 gs "-force" #f))
a610: 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 20 .. (rerun
a620: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
a630: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 /default flags "
a640: 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28 -rerun" #f)).. (
a650: 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61 keepgoing (ha
a660: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
a670: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 ault flags "-kee
a680: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 3b pgoing" #f)).. ;
a690: 3b 20 41 72 65 20 74 68 65 73 65 20 74 61 67 73 ; Are these tags
a6a0: 20 73 74 69 6c 6c 20 75 73 65 64 3f 20 49 20 64 still used? I d
a6b0: 6f 6e 27 74 20 74 68 69 6e 6b 20 73 6f 2e 2e 2e on't think so...
a6c0: 0a 09 20 3b 3b 28 74 61 67 73 20 20 20 20 20 20 .. ;;(tags
a6d0: 20 20 20 28 6c 65 74 20 28 28 74 20 28 63 6f 6e (let ((t (con
a6e0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d fig-lookup test-
a6f0: 63 6f 6e 66 20 22 73 65 74 75 70 22 20 22 74 61 conf "setup" "ta
a700: 67 73 22 29 29 29 0a 09 20 3b 3b 20 20 20 20 20 gs"))).. ;;
a710: 20 20 09 20 3b 3b 20 77 65 20 77 61 6e 74 20 6f . ;; we want o
a720: 75 72 20 74 61 67 73 20 74 6f 20 62 65 20 73 65 ur tags to be se
a730: 70 61 72 61 74 65 64 20 62 79 20 63 6f 6d 6d 61 parated by comma
a740: 73 20 61 6e 64 20 66 75 6c 6c 79 20 64 65 6c 69 s and fully deli
a750: 6d 69 74 65 64 20 62 79 20 63 6f 6d 6d 61 73 0a mited by commas.
a760: 09 20 3b 3b 20 20 20 20 20 20 20 09 20 3b 3b 20 . ;; . ;;
a770: 73 6f 20 74 68 61 74 20 71 75 65 72 69 65 73 20 so that queries
a780: 77 69 74 68 20 22 6c 69 6b 65 22 20 63 61 6e 20 with "like" can
a790: 74 69 65 20 74 6f 20 74 68 65 20 63 6f 6d 6d 61 tie to the comma
a7a0: 73 20 61 74 20 65 69 74 68 65 72 20 65 6e 64 20 s at either end
a7b0: 6f 66 20 65 61 63 68 20 74 61 67 0a 09 20 3b 3b of each tag.. ;;
a7c0: 20 20 20 20 20 20 20 09 20 3b 3b 20 77 68 69 6c . ;; whil
a7d0: 65 20 61 6c 73 6f 20 61 6c 6c 6f 77 69 6e 67 20 e also allowing
a7e0: 74 68 65 20 65 6e 64 20 75 73 65 72 20 74 6f 20 the end user to
a7f0: 66 72 65 65 6c 79 20 75 73 65 20 73 70 61 63 65 freely use space
a800: 73 20 61 6e 64 20 63 6f 6d 6d 61 73 20 74 6f 20 s and commas to
a810: 73 65 70 61 72 61 74 65 20 74 61 67 73 0a 09 20 separate tags..
a820: 3b 3b 20 20 20 20 20 20 20 09 20 28 69 66 20 28 ;; . (if (
a830: 73 74 72 69 6e 67 3f 20 74 29 28 73 74 72 69 6e string? t)(strin
a840: 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 72 65 g-substitute (re
a850: 67 65 78 70 20 22 5b 2c 5c 5c 73 5d 2b 22 29 20 gexp "[,\\s]+")
a860: 22 2c 22 20 28 63 6f 6e 63 20 22 2c 22 20 74 20 "," (conc "," t
a870: 22 2c 22 29 20 23 74 29 0a 09 20 3b 3b 20 20 20 ",") #t).. ;;
a880: 20 20 20 20 09 20 20 20 20 20 27 28 29 29 29 29 . '())))
a890: 29 0a 09 20 29 0a 20 20 20 20 28 69 66 20 28 6e ).. ). (if (n
a8a0: 6f 74 20 74 65 73 74 65 78 69 73 74 73 29 0a 09 ot testexists)..
a8b0: 3b 3b 20 69 66 20 74 68 65 20 74 65 73 74 20 69 ;; if the test i
a8c0: 73 20 69 6c 6c 20 64 65 66 69 6e 65 64 20 73 70 s ill defined sp
a8d0: 69 74 20 6f 75 74 20 61 6e 20 65 72 72 6f 72 20 it out an error
a8e0: 62 75 74 20 6b 65 65 70 20 67 6f 69 6e 67 20 28 but keep going (
a8f0: 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 68 different from h
a900: 6f 77 20 64 6f 6e 65 20 70 72 65 76 69 6f 75 73 ow done previous
a910: 6c 79 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ly..(debug:print
a920: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6e 27 74 0 "ERROR: Can't
a930: 20 66 69 6e 64 20 63 6f 6e 66 69 67 20 66 69 6c find config fil
a940: 65 20 22 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 e " test-configf
a950: 29 0a 09 3b 3b 20 70 75 74 20 74 6f 70 20 76 61 )..;; put top va
a960: 72 73 20 69 6e 74 6f 20 63 6f 6e 76 65 6e 69 65 rs into convenie
a970: 6e 74 20 76 61 72 69 61 62 6c 65 73 20 61 6e 64 nt variables and
a980: 20 6f 70 65 6e 20 74 68 65 20 64 62 0a 09 28 6c open the db..(l
a990: 65 74 2a 20 28 3b 3b 20 64 62 20 69 73 20 61 6c et* (;; db is al
a9a0: 77 61 79 73 20 61 74 20 2a 74 6f 70 70 61 74 68 ways at *toppath
a9b0: 2a 2f 64 62 2f 6d 65 67 61 74 65 73 74 2e 64 62 */db/megatest.db
a9c0: 0a 09 20 20 20 20 20 20 20 28 69 74 65 6d 73 20 .. (items
a9d0: 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c (hash-tabl
a9e0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 e-ref/default te
a9f0: 73 74 2d 63 6f 6e 66 20 22 69 74 65 6d 73 22 20 st-conf "items"
aa00: 27 28 29 29 29 0a 09 20 20 20 20 20 20 20 28 69 '())).. (i
aa10: 74 65 6d 73 74 61 62 6c 65 20 20 28 68 61 73 68 temstable (hash
aa20: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
aa30: 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 69 74 lt test-conf "it
aa40: 65 6d 73 74 61 62 6c 65 22 20 27 28 29 29 29 0a emstable" '())).
aa50: 09 20 20 20 20 20 20 20 28 61 6c 6c 69 74 65 6d . (allitem
aa60: 73 20 20 20 20 28 69 66 20 28 6f 72 20 28 6e 6f s (if (or (no
aa70: 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 29 t (null? items))
aa80: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d (not (null? item
aa90: 73 74 61 62 6c 65 29 29 29 0a 09 09 09 09 28 61 stable))).....(a
aaa0: 70 70 65 6e 64 20 28 69 74 65 6d 2d 61 73 73 6f ppend (item-asso
aab0: 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 c->item-list ite
aac0: 6d 73 29 0a 09 09 09 09 09 28 69 74 65 6d 2d 74 ms)......(item-t
aad0: 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 able->item-list
aae0: 69 74 65 6d 73 74 61 62 6c 65 29 29 0a 09 09 09 itemstable))....
aaf0: 09 27 28 28 29 29 29 29 29 20 3b 3b 20 61 20 6c .'(())))) ;; a l
ab00: 69 73 74 20 77 69 74 68 20 6f 6e 65 20 6e 75 6c ist with one nul
ab10: 6c 20 6c 69 73 74 20 69 73 20 61 20 74 65 73 74 l list is a test
ab20: 20 77 69 74 68 20 6e 6f 20 69 74 65 6d 73 0a 09 with no items..
ab30: 20 20 3b 3b 20 28 72 75 6e 63 6f 6e 66 69 67 66 ;; (runconfigf
ab40: 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 (conc *toppat
ab50: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e h* "/runconfigs.
ab60: 63 6f 6e 66 69 67 22 29 29 29 0a 09 20 20 28 64 config"))).. (d
ab70: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 69 74 ebug:print 1 "it
ab80: 65 6d 73 3a 20 22 29 0a 09 20 20 28 69 66 20 28 ems: ").. (if (
ab90: 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 >= *verbosity* 1
aba0: 29 28 70 70 20 61 6c 6c 69 74 65 6d 73 29 29 0a )(pp allitems)).
abb0: 09 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 . (if (>= *verb
abc0: 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 20 20 osity* 5)..
abd0: 20 28 62 65 67 69 6e 0a 09 09 28 70 72 69 6e 74 (begin...(print
abe0: 20 22 69 74 65 6d 73 3a 20 22 29 28 70 70 20 28 "items: ")(pp (
abf0: 69 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d item-assoc->item
ac00: 2d 6c 69 73 74 20 69 74 65 6d 73 29 29 0a 09 09 -list items))...
ac10: 28 70 72 69 6e 74 20 22 69 74 65 6d 73 74 61 62 (print "itemstab
ac20: 6c 65 3a 20 22 29 28 70 70 20 28 69 74 65 6d 2d le: ")(pp (item-
ac30: 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 table->item-list
ac40: 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 29 0a itemstable)))).
ac50: 0a 09 20 20 3b 3b 20 43 6f 6d 6d 65 6e 74 73 20 .. ;; Comments
ac60: 61 72 65 20 6c 6f 61 64 65 64 20 62 79 20 74 68 are loaded by th
ac70: 65 20 74 65 73 74 20 72 75 6e 2c 20 6e 6f 74 20 e test run, not
ac80: 61 74 20 6c 61 75 6e 63 68 20 74 69 6d 65 20 28 at launch time (
ac90: 69 6e 20 67 65 6e 65 72 61 6c 29 0a 09 20 20 3b in general).. ;
aca0: 3b 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 ;(if (args:get-a
acb0: 72 67 20 22 2d 6d 22 29 0a 09 20 20 3b 3b 20 20 rg "-m").. ;;
acc0: 20 20 28 64 62 3a 73 65 74 2d 63 6f 6d 6d 65 6e (db:set-commen
acd0: 74 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e t-for-run db run
ace0: 2d 69 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 -id (args:get-ar
acf0: 67 20 22 2d 6d 22 29 29 29 0a 0a 09 20 20 3b 3b g "-m")))... ;;
ad00: 20 48 65 72 65 20 69 73 20 77 68 65 72 65 20 74 Here is where t
ad10: 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 he test_meta tab
ad20: 6c 65 20 69 73 20 62 65 73 74 20 75 70 64 61 74 le is best updat
ad30: 65 64 0a 09 20 20 28 72 75 6e 73 3a 75 70 64 61 ed.. (runs:upda
ad40: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
ad50: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
ad60: 6f 6e 66 29 0a 0a 09 20 20 3b 3b 20 62 72 61 69 onf)... ;; brai
ad70: 6e 64 65 61 64 20 77 6f 72 6b 2d 61 72 6f 75 6e ndead work-aroun
ad80: 64 20 66 6f 72 20 70 6f 6f 72 6c 79 20 73 70 65 d for poorly spe
ad90: 63 69 66 69 65 64 20 61 6c 6c 69 74 65 6d 73 20 cified allitems
ada0: 6c 69 73 74 20 42 55 47 21 21 21 20 46 49 58 4d list BUG!!! FIXM
adb0: 45 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 E.. (if (null?
adc0: 61 6c 6c 69 74 65 6d 73 29 28 73 65 74 21 20 61 allitems)(set! a
add0: 6c 6c 69 74 65 6d 73 20 27 28 28 29 29 29 29 0a llitems '(()))).
ade0: 09 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 69 . (let loop ((i
adf0: 74 65 6d 64 61 74 20 28 63 61 72 20 61 6c 6c 69 temdat (car alli
ae00: 74 65 6d 73 29 29 0a 09 09 20 20 20 20 20 28 74 tems))... (t
ae10: 61 6c 20 20 20 20 20 28 63 64 72 20 61 6c 6c 69 al (cdr alli
ae20: 74 65 6d 73 29 29 29 0a 09 20 20 20 20 3b 3b 20 tems))).. ;;
ae30: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 (lambda (itemdat
ae40: 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 ) ;;; ((ripeness
ae50: 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 "overripe") (te
ae60: 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 mperature "cool"
ae70: 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 ) (season "summe
ae80: 72 22 29 29 0a 09 20 20 20 20 3b 3b 20 48 61 6e r")).. ;; Han
ae90: 64 6c 65 20 6c 69 73 74 73 20 6f 66 20 69 74 65 dle lists of ite
aea0: 6d 73 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 ms.. (let* ((
aeb0: 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 28 69 item-path (i
aec0: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 tem-list->path i
aed0: 74 65 6d 64 61 74 29 29 20 3b 3b 20 28 73 74 72 temdat)) ;; (str
aee0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
aef0: 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 61 (map cadr itemda
af00: 74 29 20 22 2f 22 29 29 0a 09 09 20 20 20 28 6e t) "/"))... (n
af10: 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74 ew-test-path (st
af20: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
af30: 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 (cons test-path
af40: 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 (map cadr itemd
af50: 61 74 29 29 20 22 2f 22 29 29 0a 09 09 20 20 20 at)) "/"))...
af60: 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 (new-test-name (
af70: 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d if (equal? item-
af80: 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 path "") test-na
af90: 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 me (conc test-na
afa0: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 me "/" item-path
afb0: 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 ))) ;; just need
afc0: 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 it to be unique
afd0: 0a 09 09 20 20 20 28 74 65 73 74 64 61 74 20 20 ... (testdat
afe0: 20 23 66 29 0a 09 09 20 20 20 28 6e 75 6d 2d 72 #f)... (num-r
aff0: 75 6e 6e 69 6e 67 20 28 64 62 3a 67 65 74 2d 63 unning (db:get-c
b000: 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 ount-tests-runni
b010: 6e 67 20 64 62 29 29 0a 09 09 20 20 20 28 6d 61 ng db))... (ma
b020: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
b030: 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 s (config-lookup
b040: 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 *configdat* "se
b050: 74 75 70 22 20 22 6d 61 78 5f 63 6f 6e 63 75 72 tup" "max_concur
b060: 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 09 20 rent_jobs"))...
b070: 20 20 28 70 61 72 65 6e 74 2d 74 65 73 74 20 28 (parent-test (
b080: 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 and (not (null?
b090: 69 74 65 6d 73 29 29 28 65 71 75 61 6c 3f 20 69 items))(equal? i
b0a0: 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 0a 09 tem-path "")))..
b0b0: 09 20 20 20 28 73 69 6e 67 6c 65 2d 74 65 73 74 . (single-test
b0c0: 20 28 61 6e 64 20 28 6e 75 6c 6c 3f 20 69 74 65 (and (null? ite
b0d0: 6d 73 29 20 28 65 71 75 61 6c 3f 20 69 74 65 6d ms) (equal? item
b0e0: 2d 70 61 74 68 20 22 22 29 29 29 0a 09 09 20 20 -path "")))...
b0f0: 20 28 69 74 65 6d 2d 74 65 73 74 20 20 20 28 6e (item-test (n
b100: 6f 74 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d ot (equal? item-
b110: 70 61 74 68 20 22 22 29 29 29 0a 09 09 20 20 20 path "")))...
b120: 3b 3b 20 6c 6f 6f 6b 20 74 68 72 6f 75 67 68 20 ;; look through
b130: 61 6c 6c 20 74 68 65 20 69 74 65 6d 2d 70 61 74 all the item-pat
b140: 74 73 20 69 66 20 64 65 66 69 6e 65 64 2c 20 66 ts if defined, f
b150: 6f 72 6d 61 74 20 69 73 20 70 61 74 74 31 2c 70 ormat is patt1,p
b160: 61 74 74 32 2c 70 61 74 74 33 20 2e 2e 2e 20 77 att2,patt3 ... w
b170: 69 6c 64 63 61 72 64 20 69 73 20 25 0a 09 09 20 ildcard is %...
b180: 20 20 28 69 74 65 6d 2d 6d 61 74 63 68 65 73 20 (item-matches
b190: 28 69 66 20 69 74 65 6d 2d 70 61 74 74 73 0a 09 (if item-patts..
b1a0: 09 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 72 ... (let ((r
b1b0: 65 73 20 23 66 29 29 0a 09 09 09 09 20 20 20 20 es #f)).....
b1c0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 09 (for-each ...
b1d0: 09 09 09 28 6c 61 6d 62 64 61 20 28 70 61 74 74 ...(lambda (patt
b1e0: 29 0a 09 09 09 09 09 20 20 28 69 66 20 28 73 74 )...... (if (st
b1f0: 72 69 6e 67 2d 73 65 61 72 63 68 20 28 67 6c 6f ring-search (glo
b200: 62 2d 3e 72 65 67 65 78 70 0a 09 09 09 09 09 09 b->regexp.......
b210: 09 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 74 . (string-t
b220: 72 61 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25 ranslate patt "%
b230: 22 20 22 2a 22 29 29 0a 09 09 09 09 09 09 09 20 " "*"))........
b240: 20 20 20 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 item-path)..
b250: 09 09 09 09 20 20 20 20 20 20 28 73 65 74 21 20 .... (set!
b260: 72 65 73 20 23 74 29 29 29 0a 09 09 09 09 09 28 res #t)))......(
b270: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 string-split ite
b280: 6d 2d 70 61 74 74 73 20 22 2c 22 29 29 0a 09 09 m-patts ","))...
b290: 09 09 20 20 20 20 20 20 20 72 65 73 29 0a 09 09 .. res)...
b2a0: 09 09 20 20 20 20 20 23 74 29 29 29 0a 09 20 20 .. #t)))..
b2b0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
b2c0: 20 33 20 22 6d 61 78 2d 63 6f 6e 63 75 72 72 65 3 "max-concurre
b2d0: 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 nt-jobs: " max-c
b2e0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 22 oncurrent-jobs "
b2f0: 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 , num-running: "
b300: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a 09 20 num-running)..
b310: 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 69 74 (if (and it
b320: 65 6d 2d 6d 61 74 63 68 65 73 20 28 72 75 6e 73 em-matches (runs
b330: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
b340: 73 74 73 20 64 62 29 29 0a 09 09 20 20 28 62 65 sts db))... (be
b350: 67 69 6e 0a 09 09 20 20 20 20 28 6c 65 74 20 6c gin... (let l
b360: 6f 6f 70 32 20 28 28 74 73 20 28 64 62 3a 67 65 oop2 ((ts (db:ge
b370: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 t-test-info db r
b380: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
b390: 69 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 23 item-path)) ;; #
b3a0: 66 29 0a 09 09 09 09 28 63 74 20 30 29 29 0a 09 f).....(ct 0))..
b3b0: 09 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 . (if (and
b3c0: 28 6e 6f 74 20 74 73 29 0a 09 09 09 20 20 20 20 (not ts)....
b3d0: 20 20 20 28 3c 20 63 74 20 31 30 29 29 0a 09 09 (< ct 10))...
b3e0: 09 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 . (begin....
b3f0: 20 28 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 (register-test
b400: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
b410: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 ame item-path)..
b420: 09 09 20 20 20 20 3b 3b 20 57 68 79 20 64 69 64 .. ;; Why did
b430: 20 49 20 73 65 74 20 74 68 65 20 63 6f 6d 6d 65 I set the comme
b440: 6e 74 20 68 65 72 65 3f 21 3f 20 50 4f 53 53 49 nt here?!? POSSI
b450: 42 4c 45 20 42 55 47 20 42 55 54 20 49 27 4d 20 BLE BUG BUT I'M
b460: 52 45 4d 4f 56 49 4e 47 20 49 54 20 46 4f 52 20 REMOVING IT FOR
b470: 4e 4f 57 20 31 30 2f 32 33 2f 32 30 31 31 0a 09 NOW 10/23/2011..
b480: 09 09 20 20 20 20 3b 3b 20 28 64 62 3a 74 65 73 .. ;; (db:tes
b490: 74 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 64 62 t-set-comment db
b4a0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
b4b0: 65 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 0a e item-path "").
b4c0: 09 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 28 64 ... (loop2 (d
b4d0: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 b:get-test-info
b4e0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
b4f0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 ame item-path)..
b500: 09 09 09 20 20 20 28 2b 20 63 74 20 31 29 29 29 ... (+ ct 1)))
b510: 0a 09 09 09 20 20 28 69 66 20 74 73 0a 09 09 09 .... (if ts....
b520: 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 (set! test
b530: 64 61 74 20 74 73 29 0a 09 09 09 20 20 20 20 20 dat ts)....
b540: 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62 (begin.....(deb
b550: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
b560: 49 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 72 65 ING: Couldn't re
b570: 67 69 73 74 65 72 20 74 65 73 74 20 22 20 74 65 gister test " te
b580: 73 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 20 69 st-name " with i
b590: 74 65 6d 20 70 61 74 68 20 22 20 69 74 65 6d 2d tem path " item-
b5a0: 70 61 74 68 20 22 2c 20 73 6b 69 70 70 69 6e 67 path ", skipping
b5b0: 22 29 0a 09 09 09 09 28 69 66 20 28 6e 6f 74 20 ").....(if (not
b5c0: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 (null? tal))....
b5d0: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 . (loop (car
b5e0: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 tal)(cdr tal))))
b5f0: 29 29 29 0a 09 09 20 20 20 20 28 63 68 61 6e 67 )))... (chang
b600: 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 e-directory test
b610: 2d 70 61 74 68 29 0a 09 09 20 20 20 20 3b 3b 20 -path)... ;;
b620: 74 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 68 65 this block is he
b630: 72 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 6f 72 re only to infor
b640: 6d 20 74 68 65 20 75 73 65 72 20 65 61 72 6c 79 m the user early
b650: 20 6f 6e 0a 09 09 20 20 20 20 0a 09 09 20 20 20 on... ...
b660: 20 3b 3b 20 4d 6f 76 69 6e 67 20 74 68 69 73 20 ;; Moving this
b670: 74 6f 20 74 68 65 20 72 75 6e 20 63 61 6c 6c 69 to the run calli
b680: 6e 67 20 62 6c 6f 63 6b 0a 0a 09 09 20 20 20 20 ng block....
b690: 3b 3b 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 ;; (if (file-exi
b6a0: 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 sts? runconfigf)
b6b0: 0a 09 09 20 20 20 20 3b 3b 20 20 20 20 20 28 73 ... ;; (s
b6c0: 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 etup-env-default
b6d0: 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 s db runconfigf
b6e0: 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d run-id *already-
b6f0: 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 seen-runconfig-i
b700: 6e 66 6f 2a 29 0a 09 09 20 20 20 20 3b 3b 20 20 nfo*)... ;;
b710: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
b720: 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 0 "WARNING: You
b730: 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 do not have a ru
b740: 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 n config file: "
b750: 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a 09 09 runconfigf))...
b760: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
b770: 20 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 72 75 4 "run-id: " ru
b780: 6e 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 6d 65 n-id " test-name
b790: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 : " test-name "
b7a0: 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 item-path: " ite
b7b0: 6d 2d 70 61 74 68 20 22 20 74 65 73 74 64 61 74 m-path " testdat
b7c0: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 : " (test:get-st
b7d0: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 20 atus testdat) "
b7e0: 74 65 73 74 2d 73 74 61 74 65 3a 20 22 20 28 74 test-state: " (t
b7f0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
b800: 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 28 63 stdat))... (c
b810: 61 73 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b ase (if force ;;
b820: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
b830: 2d 66 6f 72 63 65 22 29 0a 09 09 09 20 20 20 20 -force")....
b840: 20 20 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 'NOT_STARTED..
b850: 09 09 20 20 20 20 20 20 28 69 66 20 74 65 73 74 .. (if test
b860: 64 61 74 0a 09 09 09 09 20 20 28 73 74 72 69 6e dat..... (strin
b870: 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a g->symbol (test:
b880: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
b890: 74 29 29 0a 09 09 09 09 20 20 27 66 61 69 6c 65 t))..... 'faile
b8a0: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 09 d-to-insert))...
b8b0: 20 20 20 20 20 20 28 28 66 61 69 6c 65 64 2d 74 ((failed-t
b8c0: 6f 2d 69 6e 73 65 72 74 29 0a 09 09 20 20 20 20 o-insert)...
b8d0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
b8e0: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 0 "ERROR: Failed
b8f0: 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 72 to insert the r
b900: 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 64 ecord into the d
b910: 62 22 29 29 0a 09 09 20 20 20 20 20 20 28 28 4e b"))... ((N
b920: 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c OT_STARTED COMPL
b930: 45 54 45 44 29 0a 09 09 20 20 20 20 20 20 20 28 ETED)... (
b940: 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 47 debug:print 6 "G
b950: 6f 74 20 68 65 72 65 2c 20 22 20 28 74 65 73 74 ot here, " (test
b960: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
b970: 61 74 29 29 0a 09 09 20 20 20 20 20 20 20 28 6c at))... (l
b980: 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 et ((runflag #f)
b990: 29 0a 09 09 09 20 28 63 6f 6e 64 0a 09 09 09 20 ).... (cond....
b9a0: 20 3b 3b 20 69 2e 65 2e 20 74 68 69 73 20 69 73 ;; i.e. this is
b9b0: 20 74 68 65 20 70 61 72 65 6e 74 20 74 65 73 74 the parent test
b9c0: 20 74 6f 20 61 20 73 75 69 74 65 20 6f 66 20 69 to a suite of i
b9d0: 74 65 6d 73 2c 20 6e 65 76 65 72 20 22 72 75 6e tems, never "run
b9e0: 22 20 69 74 0a 09 09 09 20 20 28 70 61 72 65 6e " it.... (paren
b9f0: 74 2d 74 65 73 74 0a 09 09 09 20 20 20 28 73 65 t-test.... (se
ba00: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a t! runflag #f)).
ba10: 09 09 09 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 ... ;; -force,
ba20: 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 run no matter wh
ba30: 61 74 0a 09 09 09 20 20 28 66 6f 72 63 65 20 28 at.... (force (
ba40: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
ba50: 29 0a 09 09 09 20 20 3b 3b 20 4e 4f 54 5f 53 54 ).... ;; NOT_ST
ba60: 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 ARTED, run no ma
ba70: 74 74 65 72 20 77 68 61 74 0a 09 09 09 20 20 28 tter what.... (
ba80: 28 65 71 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 (equal? (test:ge
ba90: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
baa0: 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 28 "NOT_STARTED")(
bab0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
bac0: 29 0a 09 09 09 20 20 3b 3b 20 6e 6f 74 20 2d 72 ).... ;; not -r
bad0: 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 erun and PASS, W
bae0: 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f ARN or CHECK, do
baf0: 20 6e 6f 20 72 75 6e 0a 09 09 09 20 20 28 28 61 no run.... ((a
bb00: 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 nd (or (not reru
bb10: 6e 29 0a 09 09 09 09 20 20 20 20 6b 65 65 70 67 n)..... keepg
bb20: 6f 69 6e 67 29 0a 09 09 09 09 28 6d 65 6d 62 65 oing).....(membe
bb30: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
bb40: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50 us testdat) '("P
bb50: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 ASS" "WARN" "CHE
bb60: 43 4b 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 CK"))).... (se
bb70: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a t! runflag #f)).
bb80: 09 09 09 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 ... ;; -rerun a
bb90: 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 nd status is one
bba0: 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64 of the specifed
bbb0: 2c 20 72 75 6e 20 69 74 0a 09 09 09 20 20 28 28 , run it.... ((
bbc0: 61 6e 64 20 72 65 72 75 6e 0a 09 09 09 09 28 6c and rerun.....(l
bbd0: 65 74 20 28 28 72 65 72 75 6e 6c 73 74 20 28 73 et ((rerunlst (s
bbe0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 tring-split reru
bbf0: 6e 20 22 2c 22 29 29 29 20 3b 3b 20 46 41 49 4c n ","))) ;; FAIL
bc00: 2c 0a 09 09 09 09 20 20 28 6d 65 6d 62 65 72 20 ,..... (member
bc10: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
bc20: 20 74 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c testdat) rerunl
bc30: 73 74 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 st))).... (set
bc40: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
bc50: 09 09 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e .. ;; -keepgoin
bc60: 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 g, do not rerun
bc70: 46 41 49 4c 0a 09 09 09 20 20 28 28 61 6e 64 20 FAIL.... ((and
bc80: 6b 65 65 70 67 6f 69 6e 67 0a 09 09 09 09 28 6d keepgoing.....(m
bc90: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d ember (test:get-
bca0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
bcb0: 27 28 22 46 41 49 4c 22 29 29 29 0a 09 09 09 20 '("FAIL")))....
bcc0: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 (set! runflag
bcd0: 23 66 29 29 0a 09 09 09 20 20 28 28 61 6e 64 20 #f)).... ((and
bce0: 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 09 09 (not rerun).....
bcf0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
bd00: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
bd10: 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 ) '("FAIL" "n/a"
bd20: 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 ))).... (set!
bd30: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 runflag #t))....
bd40: 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 (else (set! ru
bd50: 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 09 09 20 nflag #f)))....
bd60: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 (debug:print 6 "
bd70: 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c RUNNING => runfl
bd80: 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 ag: " runflag "
bd90: 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 STATE: " (test:g
bda0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
bdb0: 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 ) " STATUS: " (t
bdc0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
bdd0: 65 73 74 64 61 74 29 29 0a 09 09 09 20 28 69 66 estdat)).... (if
bde0: 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 (not runflag)..
bdf0: 09 09 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 .. (if (not
be00: 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 09 parent-test)....
be10: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
be20: 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 "NOTE: Not star
be30: 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d ting test " new-
be40: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 test-name " as i
be50: 74 20 69 73 20 73 74 61 74 65 20 5c 22 43 4f 4d t is state \"COM
be60: 50 4c 45 54 45 44 5c 22 20 61 6e 64 20 73 74 61 PLETED\" and sta
be70: 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 tus \"" (test:ge
be80: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
be90: 29 20 22 5c 22 2c 20 75 73 65 20 2d 66 6f 72 63 ) "\", use -forc
bea0: 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 e to override"))
beb0: 0a 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 .... (let* (
bec0: 28 67 65 74 2d 70 72 65 72 65 71 73 2d 63 6d 64 (get-prereqs-cmd
bed0: 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 09 09 (lambda ().....
bee0: 09 09 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 .. (db-get
bef0: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 -prereqs-not-met
bf00: 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f db run-id waito
bf10: 6e 29 29 29 20 3b 3b 20 63 68 65 63 6b 20 62 65 n))) ;; check be
bf20: 66 6f 72 65 20 72 75 6e 6e 69 6e 67 20 2e 2e 2e fore running ...
bf30: 2e 0a 09 09 09 09 20 20 20 20 28 6c 61 75 6e 63 ...... (launc
bf40: 68 2d 63 6d 64 20 20 20 20 20 20 28 6c 61 6d 62 h-cmd (lamb
bf50: 64 61 20 28 29 0a 09 09 09 09 09 09 20 20 20 20 da ().......
bf60: 20 20 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 (launch-test
bf70: 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d db run-id runnam
bf80: 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 e test-conf keyv
bf90: 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 allst test-name
bfa0: 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 test-path itemda
bfb0: 74 20 66 6c 61 67 73 29 29 29 0a 09 09 09 09 20 t flags))).....
bfc0: 20 20 20 28 74 65 73 74 72 75 6e 64 61 74 20 20 (testrundat
bfd0: 20 20 20 20 28 6c 69 73 74 20 67 65 74 2d 70 72 (list get-pr
bfe0: 65 72 65 71 73 2d 63 6d 64 20 6c 61 75 6e 63 68 ereqs-cmd launch
bff0: 2d 63 6d 64 29 29 29 0a 09 09 09 20 20 20 20 20 -cmd)))....
c000: 20 20 28 69 66 20 28 6f 72 20 66 6f 72 63 65 0a (if (or force.
c010: 09 09 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 .... (let
c020: 28 28 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d ((preqs-not-yet-
c030: 6d 65 74 20 28 28 63 61 72 20 74 65 73 74 72 75 met ((car testru
c040: 6e 64 61 74 29 29 29 29 0a 09 09 09 09 09 20 28 ndat))))...... (
c050: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 50 debug:print 2 "P
c060: 72 65 71 72 65 71 75 65 73 69 74 65 73 20 66 6f reqrequesites fo
c070: 72 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 3a r " test-name ":
c080: 20 22 20 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 " preqs-not-yet
c090: 2d 6d 65 74 29 0a 09 09 09 09 09 20 28 6e 75 6c -met)...... (nul
c0a0: 6c 3f 20 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 l? preqs-not-yet
c0b0: 2d 6d 65 74 29 29 29 20 3b 3b 20 61 72 65 20 74 -met))) ;; are t
c0c0: 68 65 72 65 20 61 6e 79 20 74 65 73 74 73 20 74 here any tests t
c0d0: 68 61 74 20 6d 75 73 74 20 62 65 20 72 75 6e 20 hat must be run
c0e0: 62 65 66 6f 72 65 20 74 68 69 73 20 6f 6e 65 2e before this one.
c0f0: 2e 2e 0a 09 09 09 09 20 20 20 28 69 66 20 28 6e ....... (if (n
c100: 6f 74 20 28 28 63 61 64 72 20 74 65 73 74 72 75 ot ((cadr testru
c110: 6e 64 61 74 29 29 29 20 3b 3b 20 74 68 69 73 20 ndat))) ;; this
c120: 69 73 20 74 68 65 20 6c 69 6e 65 20 74 68 61 74 is the line that
c130: 20 6c 61 75 6e 63 68 65 73 20 74 68 65 20 74 65 launches the te
c140: 73 74 20 74 6f 20 74 68 65 20 72 65 6d 6f 74 65 st to the remote
c150: 20 68 6f 73 74 0a 09 09 09 09 20 20 20 20 20 20 host.....
c160: 20 28 62 65 67 69 6e 0a 09 09 09 09 09 20 28 70 (begin...... (p
c170: 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 rint "ERROR: Fai
c180: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 led to launch th
c190: 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 e test. Exiting
c1a0: 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 as soon as possi
c1b0: 62 6c 65 22 29 0a 09 09 09 09 09 20 28 73 65 74 ble")...... (set
c1c0: 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 ! *globalexitsta
c1d0: 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 09 09 tus* 1) ;; .....
c1e0: 09 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 . (process-signa
c1f0: 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 l (current-proce
c200: 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 ss-id) signal/ki
c210: 6c 6c 29 0a 09 09 09 09 09 20 3b 28 65 78 69 74 ll)...... ;(exit
c220: 20 31 29 0a 09 09 09 09 09 20 29 29 0a 09 09 09 1)...... ))....
c230: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 6b 65 65 . (if (not kee
c240: 70 67 6f 69 6e 67 29 0a 09 09 09 09 20 20 20 20 pgoing).....
c250: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 (hash-table-s
c260: 65 74 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 et! *waiting-que
c270: 75 65 2a 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d ue* new-test-nam
c280: 65 20 74 65 73 74 72 75 6e 64 61 74 29 29 29 29 e testrundat))))
c290: 29 29 29 0a 09 09 20 20 20 20 20 20 28 28 4b 49 )))... ((KI
c2a0: 4c 4c 45 44 29 20 0a 09 09 20 20 20 20 20 20 20 LLED) ...
c2b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
c2c0: 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 NOTE: " new-test
c2d0: 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 -name " is alrea
c2e0: 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 dy running or wa
c2f0: 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c s explictly kill
c300: 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 ed, use -force t
c310: 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a o launch it.")).
c320: 09 09 20 20 20 20 20 20 28 28 4c 41 55 4e 43 48 .. ((LAUNCH
c330: 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 ED REMOTEHOSTSTA
c340: 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 09 RT RUNNING) ...
c350: 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 28 2d (if (> (-
c360: 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 (current-second
c370: 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 s)(+ (db:test-ge
c380: 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 t-event_time tes
c390: 74 64 61 74 29 0a 09 09 09 09 09 09 20 20 20 20 tdat).......
c3a0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 (db:test-get-ru
c3b0: 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 n_duration testd
c3c0: 61 74 29 29 29 0a 09 09 09 20 20 20 20 20 20 31 at))).... 1
c3d0: 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 00) ;; i.e. no u
c3e0: 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 pdate for more t
c3f0: 68 61 6e 20 31 30 30 20 73 65 63 6f 6e 64 73 0a han 100 seconds.
c400: 09 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 09 ... (begin....
c410: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
c420: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 t 0 "WARNING: Te
c430: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
c440: 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 appears to be d
c450: 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 ead. Forcing it
c460: 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c to state INCOMPL
c470: 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 ETE and status S
c480: 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 09 09 20 TUCK/DEAD")....
c490: 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d 73 74 (test-set-st
c4a0: 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 64 20 atus! db run-id
c4b0: 74 65 73 74 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d test-name "INCOM
c4c0: 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 PLETE" "STUCK/DE
c4d0: 41 44 22 20 69 74 65 6d 64 61 74 20 22 54 65 73 AD" itemdat "Tes
c4e0: 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 t is stuck or de
c4f0: 61 64 22 20 23 66 29 29 0a 09 09 09 20 20 20 28 ad" #f)).... (
c500: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e debug:print 2 "N
c510: 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 OTE: " test-name
c520: 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 " is already ru
c530: 6e 6e 69 6e 67 22 29 29 29 0a 09 09 20 20 20 20 nning")))...
c540: 20 20 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 (else (d
c550: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
c560: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c ROR: Failed to l
c570: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 aunch test " new
c580: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e -test-name ". Un
c590: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 recognised state
c5a0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
c5b0: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 te testdat))))))
c5c0: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 .. (if (not
c5d0: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 (null? tal))...
c5e0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c (loop (car tal
c5f0: 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 29 )(cdr tal)))))))
c600: 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ))..;;==========
c610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 ============.;;
c650: 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 END OF NEW STUFF
c660: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
c670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c6a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 =========..(defi
c6b0: 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e ne (get-dir-up-n
c6c0: 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a dir . params) .
c6d0: 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 (let ((dparts
c6e0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 (string-split d
c6f0: 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 ir "/"))..(count
c700: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 (if (null? pa
c710: 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 rams) 1 (car par
c720: 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e ams)))). (con
c730: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e c "/" (string-in
c740: 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 tersperse ..
c750: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 (take dparts
c760: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
c770: 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 s) count))..
c780: 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 "/")))).;; Re
c790: 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 move runs.;; fie
c7a0: 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 lds are passing
c7b0: 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 in through .(def
c7c0: 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 ine (runs:remove
c7d0: 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 -runs db runname
c7e0: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 patt testpatt it
c7f0: 65 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 empatt). (let*
c800: 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 ((keys (d
c810: 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b-get-keys db)).
c820: 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 28 . (rundat (
c830: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 runs:get-runs-by
c840: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 -patt db keys ru
c850: 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 nnamepatt)).. (h
c860: 65 61 64 65 72 20 20 20 20 20 20 28 76 65 63 74 eader (vect
c870: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 or-ref rundat 0)
c880: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 ).. (runs
c890: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e (vector-ref run
c8a0: 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 64 65 dat 1))). (de
c8b0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 bug:print 1 "Hea
c8c0: 64 65 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 der: " header).
c8d0: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 (for-each.
c8e0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a (lambda (run).
c8f0: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 (let ((ru
c900: 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 nkey (string-int
c910: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c ersperse (map (l
c920: 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 ambda (k).......
c930: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
c940: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
c950: 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b er (vector-ref k
c960: 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 0))) keys) "/")
c970: 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f ).. (dirs-to
c980: 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 -remove (make-ha
c990: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c sh-table))).. (l
c9a0: 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 28 64 62 et* ((run-id (db
c9b0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
c9c0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
c9d0: 22 69 64 22 29 20 29 0a 09 09 28 74 65 73 74 73 "id") )...(tests
c9e0: 20 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d (db-get-tests-
c9f0: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 for-run db (db:g
ca00: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
ca10: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 er run header "i
ca20: 64 22 29 20 74 65 73 74 70 61 74 74 20 69 74 65 d") testpatt ite
ca30: 6d 70 61 74 74 20 27 28 29 20 27 28 29 29 29 0a mpatt '() '())).
ca40: 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 ..(lasttpath "/d
ca50: 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f oes/not/exist/I/
ca60: 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 69 66 hope"))... (if
ca70: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 (not (null? tes
ca80: 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 ts)).. (be
ca90: 67 69 6e 0a 09 09 20 28 64 65 62 75 67 3a 70 72 gin... (debug:pr
caa0: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
cab0: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 tests for run: "
cac0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a runkey " " (db:
cad0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
cae0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
caf0: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 28 66 runname"))... (f
cb00: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d or-each... (lam
cb10: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 bda (test)...
cb20: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 (let* ((item-pa
cb30: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
cb40: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
cb50: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d .... (test-nam
cb60: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 e (db:test-get-t
cb70: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 estname test))..
cb80: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 .. (run-dir
cb90: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
cba0: 64 69 72 20 74 65 73 74 29 29 29 0a 09 09 20 20 dir test)))...
cbb0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
cbc0: 20 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 1 " " (db:test
cbd0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
cbe0: 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a st) " id: " (db:
cbf0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
cc00: 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 29 ) " " item-path)
cc10: 0a 09 09 20 20 20 20 20 20 28 64 62 3a 64 65 6c ... (db:del
cc20: 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 ete-test-records
cc30: 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 db (db:test-get
cc40: 2d 69 64 20 74 65 73 74 29 29 0a 09 09 20 20 20 -id test))...
cc50: 20 20 20 28 69 66 20 28 3e 20 28 73 74 72 69 6e (if (> (strin
cc60: 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 g-length run-dir
cc70: 29 20 35 29 20 3b 3b 20 62 61 64 20 68 65 75 72 ) 5) ;; bad heur
cc80: 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 istic but should
cc90: 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 prevent /tmp /h
cca0: 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 28 6c ome etc..... (l
ccb0: 65 74 20 28 28 66 75 6c 6c 70 61 74 68 20 72 75 et ((fullpath ru
ccc0: 6e 2d 64 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 n-dir)) ;; "/" (
ccd0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
cce0: 2d 70 61 74 68 20 74 65 73 74 29 29 29 29 0a 09 -path test))))..
ccf0: 09 09 20 20 20 20 28 73 65 74 21 20 6c 61 73 74 .. (set! last
cd00: 74 70 61 74 68 20 66 75 6c 6c 70 61 74 68 29 0a tpath fullpath).
cd10: 09 09 09 20 20 20 20 28 68 61 73 68 2d 74 61 62 ... (hash-tab
cd20: 6c 65 2d 73 65 74 21 20 64 69 72 73 2d 74 6f 2d le-set! dirs-to-
cd30: 72 65 6d 6f 76 65 20 66 75 6c 6c 70 61 74 68 20 remove fullpath
cd40: 23 74 29 0a 09 09 09 20 20 20 20 3b 3b 20 54 68 #t).... ;; Th
cd50: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77 61 73 20 e following was
cd60: 74 68 65 20 73 61 66 65 20 64 65 6c 65 74 65 20 the safe delete
cd70: 63 6f 64 65 20 62 75 74 20 69 74 20 77 61 73 20 code but it was
cd80: 6e 6f 74 20 62 65 69 6e 67 20 65 78 65 63 74 75 not being exectu
cd90: 74 65 64 2e 0a 09 09 09 20 20 20 20 3b 3b 20 28 ted..... ;; (
cda0: 6c 65 74 2a 20 28 28 64 69 72 73 2d 63 6f 75 6e let* ((dirs-coun
cdb0: 74 20 28 2b 20 31 20 28 6c 65 6e 67 74 68 20 6b t (+ 1 (length k
cdc0: 65 79 73 29 28 6c 65 6e 67 74 68 20 28 73 74 72 eys)(length (str
cdd0: 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 6d 2d 70 ing-split item-p
cde0: 61 74 68 20 22 2f 22 29 29 29 29 0a 09 09 09 20 ath "/"))))....
cdf0: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 64 69 ;; (di
ce00: 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 r-to-rem (get-di
ce10: 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 r-up-n fullpath
ce20: 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 dirs-count))....
ce30: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 72 ;; (r
ce40: 65 6d 61 69 6e 69 6e 67 64 20 28 73 74 72 69 6e emainingd (strin
ce50: 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 72 65 g-substitute (re
ce60: 67 65 78 70 20 28 63 6f 6e 63 20 22 5e 22 20 64 gexp (conc "^" d
ce70: 69 72 2d 74 6f 2d 72 65 6d 20 22 2f 22 29 29 20 ir-to-rem "/"))
ce80: 22 22 20 66 75 6c 6c 70 61 74 68 29 29 0a 09 09 "" fullpath))...
ce90: 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 . ;; (
cea0: 63 6d 64 20 28 63 6f 6e 63 20 22 63 64 20 22 20 cmd (conc "cd "
ceb0: 64 69 72 2d 74 6f 2d 72 65 6d 20 22 3b 20 72 6d dir-to-rem "; rm
cec0: 64 69 72 20 2d 70 20 22 20 72 65 6d 61 69 6e 69 dir -p " remaini
ced0: 6e 67 64 20 29 29 29 0a 09 09 09 20 20 20 20 3b ngd ))).... ;
cee0: 3b 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 ; (if (file-ex
cef0: 69 73 74 73 3f 20 66 75 6c 6c 70 61 74 68 29 0a ists? fullpath).
cf00: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
cf10: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 3b 3b (begin.... ;;
cf20: 20 20 20 20 20 20 20 20 20 28 64 65 62 75 67 3a (debug:
cf30: 70 72 69 6e 74 20 31 20 63 6d 64 29 0a 09 09 09 print 1 cmd)....
cf40: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 20 28 ;; (
cf50: 73 79 73 74 65 6d 20 63 6d 64 29 29 29 0a 09 09 system cmd)))...
cf60: 09 20 20 20 20 3b 3b 20 20 20 29 29 0a 09 09 09 . ;; ))....
cf70: 20 20 20 20 29 29 29 29 0a 09 09 20 20 20 20 74 ))))... t
cf80: 65 73 74 73 29 29 29 0a 0a 09 20 20 20 3b 3b 20 ests)))... ;;
cf90: 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 74 68 65 20 look though the
cfa0: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 dirs-to-remove f
cfb0: 6f 72 20 63 61 6e 64 69 64 61 74 65 73 20 66 6f or candidates fo
cfc0: 72 20 72 65 6d 6f 76 61 6c 2e 20 44 6f 20 74 68 r removal. Do th
cfd0: 69 73 20 61 66 74 65 72 20 64 65 6c 65 74 69 6e is after deletin
cfe0: 67 20 74 68 65 20 72 65 63 6f 72 64 73 0a 09 20 g the records..
cff0: 20 20 3b 3b 20 66 6f 72 20 65 61 63 68 20 74 65 ;; for each te
d000: 73 74 20 69 6e 20 63 61 73 65 20 77 65 20 67 65 st in case we ge
d010: 74 20 6b 69 6c 6c 65 64 2e 20 54 68 61 74 20 73 t killed. That s
d020: 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 7a 65 20 74 hould minimize t
d030: 68 65 20 64 65 74 72 69 74 75 73 20 6c 65 66 74 he detritus left
d040: 20 6f 6e 20 64 69 73 6b 0a 09 20 20 20 3b 3b 20 on disk.. ;;
d050: 70 72 6f 63 65 73 73 20 74 68 65 20 64 69 72 73 process the dirs
d060: 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 74 20 73 74 from longest st
d070: 72 69 6e 67 20 6c 65 6e 67 74 68 20 74 6f 20 73 ring length to s
d080: 68 6f 72 74 65 73 74 0a 09 20 20 20 28 66 6f 72 hortest.. (for
d090: 2d 65 61 63 68 20 0a 09 20 20 20 20 28 6c 61 6d -each .. (lam
d0a0: 62 64 61 20 28 64 69 72 2d 74 6f 2d 72 65 6d 6f bda (dir-to-remo
d0b0: 76 65 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ve).. (if (
d0c0: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 64 69 72 file-exists? dir
d0d0: 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 20 20 -to-remove)...
d0e0: 28 6c 65 74 20 28 28 64 69 72 2d 69 6e 2d 64 62 (let ((dir-in-db
d0f0: 20 27 28 29 29 29 0a 09 09 20 20 20 20 28 73 71 '()))... (sq
d100: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
d110: 6f 77 0a 09 09 20 20 20 20 20 28 6c 61 6d 62 64 ow... (lambd
d120: 61 20 28 64 69 72 29 0a 09 09 20 20 20 20 20 20 a (dir)...
d130: 20 28 73 65 74 21 20 64 69 72 2d 69 6e 2d 64 62 (set! dir-in-db
d140: 20 28 63 6f 6e 73 20 64 69 72 20 64 69 72 2d 69 (cons dir dir-i
d150: 6e 2d 64 62 29 29 29 0a 09 09 20 20 20 20 20 64 n-db)))... d
d160: 62 20 22 53 45 4c 45 43 54 20 72 75 6e 64 69 72 b "SELECT rundir
d170: 20 46 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 FROM tests WHER
d180: 45 20 72 75 6e 64 69 72 20 4c 49 4b 45 20 3f 3b E rundir LIKE ?;
d190: 22 20 0a 09 09 20 20 20 20 20 28 63 6f 6e 63 20 " ... (conc
d1a0: 22 25 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 "%" dir-to-remov
d1b0: 65 20 22 25 22 29 29 20 3b 3b 20 79 65 73 2c 20 e "%")) ;; yes,
d1c0: 49 27 6d 20 67 6f 69 6e 67 20 74 6f 20 62 61 69 I'm going to bai
d1d0: 6c 20 69 66 20 74 68 65 72 65 20 69 73 20 61 6e l if there is an
d1e0: 79 74 68 69 6e 67 20 6c 69 6b 65 20 74 68 69 73 ything like this
d1f0: 20 64 69 72 20 69 6e 20 74 68 65 20 64 62 0a 09 dir in the db..
d200: 09 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 . (if (null?
d210: 64 69 72 2d 69 6e 2d 64 62 29 0a 09 09 09 28 62 dir-in-db)....(b
d220: 65 67 69 6e 0a 09 09 09 20 20 28 64 65 62 75 67 egin.... (debug
d230: 3a 70 72 69 6e 74 20 32 20 22 52 65 6d 6f 76 69 :print 2 "Removi
d240: 6e 67 20 64 69 72 65 63 74 6f 72 79 20 77 69 74 ng directory wit
d250: 68 20 7a 65 72 6f 20 64 62 20 72 65 66 65 72 65 h zero db refere
d260: 6e 63 65 73 3a 20 22 20 64 69 72 2d 74 6f 2d 72 nces: " dir-to-r
d270: 65 6d 6f 76 65 29 0a 09 09 09 20 20 28 73 79 73 emove).... (sys
d280: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 tem (conc "rm -r
d290: 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 f " dir-to-remov
d2a0: 65 29 29 0a 09 09 09 20 20 28 68 61 73 68 2d 74 e)).... (hash-t
d2b0: 61 62 6c 65 2d 64 65 6c 65 74 65 21 20 64 69 72 able-delete! dir
d2c0: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 64 69 72 2d s-to-remove dir-
d2d0: 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 28 to-remove))....(
d2e0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 53 debug:print 2 "S
d2f0: 6b 69 70 70 69 6e 67 20 72 65 6d 6f 76 61 6c 20 kipping removal
d300: 6f 66 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f of " dir-to-remo
d310: 76 65 20 22 20 66 6f 72 20 6e 6f 77 20 61 73 20 ve " for now as
d320: 69 74 20 73 74 69 6c 6c 20 68 61 73 20 72 65 66 it still has ref
d330: 65 72 65 6e 63 65 73 20 69 6e 20 74 68 65 20 64 erences in the d
d340: 61 74 61 62 61 73 65 22 29 29 29 29 29 0a 09 20 atabase")))))..
d350: 20 20 20 28 73 6f 72 74 20 28 68 61 73 68 2d 74 (sort (hash-t
d360: 61 62 6c 65 2d 6b 65 79 73 20 64 69 72 73 2d 74 able-keys dirs-t
d370: 6f 2d 72 65 6d 6f 76 65 29 20 28 6c 61 6d 62 64 o-remove) (lambd
d380: 61 20 28 61 20 62 29 28 3e 20 28 73 74 72 69 6e a (a b)(> (strin
d390: 67 2d 6c 65 6e 67 74 68 20 61 29 28 73 74 72 69 g-length a)(stri
d3a0: 6e 67 2d 6c 65 6e 67 74 68 20 62 29 29 29 29 29 ng-length b)))))
d3b0: 0a 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 ... ;; remove
d3c0: 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 the run if zero
d3d0: 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 tests remain..
d3e0: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 (let ((remtests
d3f0: 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 (db-get-tests-f
d400: 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 or-run db (db:ge
d410: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
d420: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
d430: 22 29 20 23 66 20 23 66 20 27 28 29 20 27 28 29 ") #f #f '() '()
d440: 29 29 29 0a 09 20 20 20 20 20 28 69 66 20 28 6e ))).. (if (n
d450: 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b ull? remtests) ;
d460: 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 ; no more tests
d470: 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 28 6c 65 remaining... (le
d480: 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 74 t* ((dparts (st
d490: 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 ring-split lastt
d4a0: 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 28 72 path "/"))....(r
d4b0: 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 unpath (conc "/"
d4c0: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
d4d0: 65 72 73 65 20 0a 09 09 09 09 09 20 20 20 20 28 erse ...... (
d4e0: 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 take dparts (- (
d4f0: 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 length dparts) 1
d500: 29 29 0a 09 09 09 09 09 20 20 20 20 22 2f 22 29 ))...... "/")
d510: 29 29 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a )))... (debug:
d520: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e print 1 "Removin
d530: 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 g run: " runkey
d540: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 " " (db:get-valu
d550: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
d560: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 header "runname"
d570: 29 29 0a 09 09 20 20 20 28 64 62 3a 64 65 6c 65 ))... (db:dele
d580: 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 te-run db run-id
d590: 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 64 20 74 )... ;; need t
d5a0: 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 o figure out the
d5b0: 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e path to the run
d5c0: 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 dir and remove
d5d0: 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 it if empty...
d5e0: 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c ;; (if (null
d5f0: 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 ? (glob (conc ru
d600: 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 npath "/*")))...
d610: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 ;; (be
d620: 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 20 28 64 gin... ;; . (d
d630: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 ebug:print 1 "Re
d640: 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 moving run dir "
d650: 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 3b runpath)... ;
d660: 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e ; . (system (con
d670: 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 c "rmdir -p " ru
d680: 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 29 npath))))... )
d690: 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 ))).. )). ru
d6a0: 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d ns)))..;;=======
d6b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d6c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d6d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d6e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
d6f0: 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 ;; Routines for
d700: 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e manipulating run
d710: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d s.;;============
d720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d730: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 ==========..;; S
d760: 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 ince many calls
d770: 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 to a run require
d780: 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 pretty much the
d790: 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 same setup .;;
d7a0: 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20 this wrapper is
d7b0: 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 used to reduce t
d7c0: 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f he replication o
d7d0: 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 f code.(define (
d7e0: 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c general-run-call
d7f0: 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 switchname acti
d800: 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 on-desc proc).
d810: 28 69 66 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 (if (not (args:g
d820: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 et-arg ":runname
d830: 22 29 29 0a 20 20 20 20 20 20 28 62 65 67 69 6e ")). (begin
d840: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 ..(debug:print 0
d850: 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 "ERROR: Missing
d860: 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 required parame
d870: 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 ter for " switch
d880: 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 name ", you must
d890: 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e specify the run
d8a0: 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e name with :runn
d8b0: 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 09 28 ame runname")..(
d8c0: 65 78 69 74 20 32 29 29 0a 20 20 20 20 20 20 28 exit 2)). (
d8d0: 6c 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 let ((db #f)..
d8e0: 20 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 (keys #f))..
d8f0: 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d (if (not (setup-
d900: 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 for-run)).. (
d910: 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 begin .. (d
d920: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 ebug:print 0 "Fa
d930: 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 iled to setup, e
d940: 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 xiting")..
d950: 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 65 74 (exit 1)))..(set
d960: 21 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62 29 ! db (open-db)
d970: 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 64 )..(set! keys (d
d980: 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b-get-keys db)).
d990: 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 .;; have enough
d9a0: 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 to process -targ
d9b0: 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 et or -reqtarg h
d9c0: 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 ere..(if (args:g
d9d0: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 et-arg "-reqtarg
d9e0: 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 ").. (let* ((
d9f0: 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 runconfigf (conc
da00: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 *toppath* "/ru
da10: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 nconfigs.config"
da20: 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 )) ;; DO NOT EVA
da30: 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 LUATE ALL ...
da40: 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 (runconfig (rea
da50: 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 d-config runconf
da60: 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f igf #f #f enviro
da70: 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 n-patt: #f))) ..
da80: 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d (if (hash-
da90: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
daa0: 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 t runconfig (arg
dab0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
dac0: 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b arg") #f)... (k
dad0: 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 eys:target-set-a
dae0: 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 rgs keys (args:g
daf0: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 et-arg "-reqtarg
db00: 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 ") args:arg-hash
db10: 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 )... (begin...
db20: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
db30: 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 0 "ERROR: [" (ar
db40: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
db50: 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f targ") "] not fo
db60: 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 und in " runconf
db70: 69 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c 69 igf)... (sqli
db80: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 te3:finalize! db
db90: 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 29 )... (exit 1)
dba0: 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 72 ))).. (if (ar
dbb0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 gs:get-arg "-tar
dbc0: 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 get")...(keys:ta
dbd0: 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 rget-set-args ke
dbe0: 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 ys (args:get-arg
dbf0: 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a "-target" args:
dc00: 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61 arg-hash) args:a
dc10: 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20 rg-hash)))..(if
dc20: 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 (not (car *confi
dc30: 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 ginfo*)).. (b
dc40: 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62 egin.. (deb
dc50: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
dc60: 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20 R: Attempted to
dc70: 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 " action-desc "
dc80: 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e but run area con
dc90: 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 fig file not fou
dca0: 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 nd").. (exi
dcb0: 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 t 1)).. ;; Ex
dcc0: 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 20 tract out stuff
dcd0: 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f needed in most o
dce0: 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 r many calls..
dcf0: 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63 ;; here then c
dd00: 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c all proc.. (l
dd10: 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 et* ((keynames
dd20: 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 (map key:get-fi
dd30: 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 eldname keys))..
dd40: 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 . (keyvallst
dd50: 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b (keys->vallist k
dd60: 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 20 eys #t)))..
dd70: 20 28 70 72 6f 63 20 64 62 20 6b 65 79 73 20 6b (proc db keys k
dd80: 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 eynames keyvalls
dd90: 74 29 29 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 t)))..(sqlite3:f
dda0: 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 inalize! db)..(s
ddb0: 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e et! *didsomethin
ddc0: 67 2a 20 23 74 29 29 29 29 0a 0a 3b 3b 3d 3d 3d g* #t))))..;;===
ddd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
dde0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
ddf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
de00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
de10: 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 ===.;; Rollup ru
de20: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ns.;;===========
de30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
de40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
de50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
de60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 ===========..;;
de70: 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f Update the test_
de80: 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 meta table for t
de90: 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 his test.(define
dea0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 (runs:update-te
deb0: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d st_meta db test-
dec0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a name test-conf).
ded0: 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 (let ((currrec
dee0: 6f 72 64 20 28 64 62 3a 74 65 73 74 6d 65 74 61 ord (db:testmeta
def0: 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 -get-record db t
df00: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 est-name))).
df10: 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 (if (not currrec
df20: 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 ord)..(begin..
df30: 28 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 (set! currrecord
df40: 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 (make-vector 10
df50: 20 23 66 29 29 0a 09 20 20 28 64 62 3a 74 65 73 #f)).. (db:tes
df60: 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 tmeta-add-record
df70: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 db test-name)))
df80: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
df90: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 (lambda (ke
dfa0: 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 y). (let*
dfb0: 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 ((idx (cadr key)
dfc0: 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 ).. (fld (c
dfd0: 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 ar key))..
dfe0: 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f (val (config-lo
dff0: 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 okup test-conf "
e000: 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 test_meta" fld))
e010: 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c ).. (if (and val
e020: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 (not (equal? (v
e030: 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 ector-ref currre
e040: 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 cord idx) val)))
e050: 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 .. (begin..
e060: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 (print "Up
e070: 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 dating " test-na
e080: 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 me " " fld " to
e090: 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 " val).. (
e0a0: 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 db:testmeta-upda
e0b0: 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 te-field db test
e0c0: 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 -name fld val)))
e0d0: 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 )). '(("auth
e0e0: 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 or" 2)("owner" 3
e0f0: 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 )("description"
e100: 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29 4)("reviewed" 5)
e110: 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a ("tags" 9)))))..
e120: 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d ;; Update test_m
e130: 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 eta for all test
e140: 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a s.(define (runs:
e150: 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f update-all-test_
e160: 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 meta db). (let
e170: 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 ((test-names (ge
e180: 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 t-all-legal-test
e190: 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 s))). (for-ea
e1a0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
e1b0: 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 (test-name).
e1c0: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 (let* ((test
e1d0: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a -path (conc *
e1e0: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
e1f0: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 /" test-name))..
e200: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 (test-conf
e210: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 igf (conc test-p
e220: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 ath "/testconfig
e230: 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 ")).. (test
e240: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 exists (and (f
e250: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 ile-exists? test
e260: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 -configf)(file-r
e270: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 ead-access? test
e280: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 -configf)))..
e290: 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 ;; read confi
e2a0: 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 gs with tricks t
e2b0: 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 urned off (i.e.
e2c0: 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 no system)..
e2d0: 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 (test-conf
e2e0: 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 (if testexists (
e2f0: 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 read-config test
e300: 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 -configf #f #f)(
e310: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
e320: 29 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 ))).. (runs:upda
e330: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
e340: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
e350: 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 onf))). test
e360: 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 -names)))..;; Th
e370: 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c is could probabl
e380: 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 y be refactored
e390: 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 into one complex
e3a0: 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 query ....(defi
e3b0: 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d ne (runs:rollup-
e3c0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
e3d0: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 allst runname us
e3e0: 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 er) ;; was targe
e3f0: 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 t, now keyvallst
e400: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
e410: 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 4 "runs:rollup-r
e420: 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 un, keys: " keys
e430: 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 " keyvallst: "
e440: 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e keyvallst " :run
e450: 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 name " runname "
e460: 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 user: " user).
e470: 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 (let* (; (keyva
e480: 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 lllst (keys
e490: 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 :target->keyval
e4a0: 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 keys target))..
e4b0: 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 (new-run-id
e4c0: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d (runs:register-
e4d0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
e4e0: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
e4f0: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
e500: 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 .. (prev-tests
e510: 20 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 (test:get-ma
e520: 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d tching-previous-
e530: 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 test-run-records
e540: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 db new-run-id "
e550: 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 %" "%")).. (curr
e560: 2d 74 65 73 74 73 20 20 20 20 20 20 28 64 62 2d -tests (db-
e570: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 get-tests-for-ru
e580: 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 n db new-run-id
e590: 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29 29 "%" "%" '() '())
e5a0: 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d ).. (curr-tests-
e5b0: 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d hash (make-hash-
e5c0: 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 62 table))). (db
e5d0: 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e :update-run-even
e5e0: 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 t_time db new-ru
e5f0: 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 n-id). ;; ind
e600: 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 ex the already s
e610: 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65 aved tests by te
e620: 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 70 stname and itemp
e630: 61 74 68 20 69 6e 20 63 75 72 72 2d 74 65 73 74 ath in curr-test
e640: 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d s-hash. (for-
e650: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 each. (lambd
e660: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 a (testdat).
e670: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e (let* ((testn
e680: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ame (db:test-ge
e690: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 t-testname testd
e6a0: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 at)).. (ite
e6b0: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
e6c0: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
e6d0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
e6e0: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 full-name (conc
e6f0: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 testname "/" ite
e700: 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 m-path))).. (has
e710: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
e720: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
e730: 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 l-name testdat))
e740: 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 ). curr-test
e750: 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 s). ;; NOPE:
e760: 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 Non-optimal appr
e770: 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 oach. Try this i
e780: 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 nstead.. ;;
e790: 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 1. tests are re
e7a0: 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 ceived in a list
e7b0: 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 , most recent fi
e7c0: 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 rst. ;; 2.
e7d0: 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c replace the roll
e7e0: 75 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 up test with the
e7f0: 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 new *always*.
e800: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
e810: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 (lambda (testd
e820: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a at). (let*
e830: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 ((testname (db
e840: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
e850: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 me testdat))..
e860: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 (item-path (
e870: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
e880: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a -path testdat)).
e890: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d . (full-nam
e8a0: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 e (conc testname
e8b0: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
e8c0: 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 .. (prev-te
e8d0: 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 st-dat (hash-tab
e8e0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 le-ref/default c
e8f0: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 urr-tests-hash f
e900: 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 ull-name #f))..
e910: 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 (test-steps
e920: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 (db:get-st
e930: 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 eps-for-test db
e940: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
e950: 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 testdat)))..
e960: 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f (new-test-reco
e970: 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 rd #f)).. ;; rep
e980: 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 lace these with
e990: 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 insert ... selec
e9a0: 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 t.. (apply sqlit
e9b0: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 e3:execute ...db
e9c0: 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 ...(conc "INSER
e9d0: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
e9e0: 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c O tests (run_id,
e9f0: 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 testname,state,s
ea00: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 tatus,event_time
ea10: 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 ,host,cpuload,di
ea20: 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e skfree,uname,run
ea30: 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 dir,item_path,ru
ea40: 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c n_duration,final
ea50: 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 _logf,comment) "
ea60: 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 ... "VALUES
ea70: 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c (?,?,?,?,?,?,?,
ea80: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 ?,?,?,?,?,?,?);"
ea90: 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 )...new-run-id (
eaa0: 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 cddr (vector->li
eab0: 73 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 st testdat)))..
eac0: 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 (set! new-testda
ead0: 74 20 28 63 61 72 20 28 64 62 2d 67 65 74 2d 74 t (car (db-get-t
eae0: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ests-for-run db
eaf0: 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e new-run-id testn
eb00: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28 ame item-path '(
eb10: 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 ) '()))).. (hash
eb20: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 -table-set! curr
eb30: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c -tests-hash full
eb40: 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 -name new-testda
eb50: 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 t) ;; this could
eb60: 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 be confusing, w
eb70: 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 hich record shou
eb80: 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c ld go into the l
eb90: 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b ookup table?.. ;
eba0: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 ; Now duplicate
ebb0: 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 the test steps..
ebc0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
ebd0: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 "Copying records
ebe0: 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 in test_steps f
ebf0: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 rom test_id=" (d
ec00: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
ec10: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 stdat) " to " (d
ec20: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 b:test-get-id ne
ec30: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 w-testdat)).. (s
ec40: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a qlite3:execute .
ec50: 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 . db .. (conc
ec60: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 "INSERT OR REPLA
ec70: 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 CE INTO test_ste
ec80: 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 ps (test_id,step
ec90: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
eca0: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d s,event_time,com
ecb0: 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 ment) "..."SELEC
ecc0: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 T " (db:test-get
ecd0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
ece0: 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 ",stepname,stat
ecf0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 e,status,event_t
ed00: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d ime,comment FROM
ed10: 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 test_steps WHER
ed20: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 E test_id=?;")..
ed30: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 (db:test-get-i
ed40: 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b 3b d testdat)).. ;;
ed50: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 Now duplicate t
ed60: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 28 he test data.. (
ed70: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 debug:print 4 "C
ed80: 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 opying records i
ed90: 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d n test_data from
eda0: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 test_id=" (db:t
edb0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
edc0: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 at) " to " (db:t
edd0: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 est-get-id new-t
ede0: 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 estdat)).. (sqli
edf0: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 te3:execute ..
ee00: 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e db .. (conc "IN
ee10: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 SERT OR REPLACE
ee20: 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 INTO test_data (
ee30: 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 test_id,category
ee40: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c ,variable,value,
ee50: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 expected,tol,uni
ee60: 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 ts,comment) "...
ee70: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 "SELECT " (db:te
ee80: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
ee90: 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 stdat) ",categor
eea0: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 y,variable,value
eeb0: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e ,expected,tol,un
eec0: 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d its,comment FROM
eed0: 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 test_data WHERE
eee0: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 test_id=?;")..
eef0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
ef00: 20 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 0a testdat)).. )).
ef10: 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 prev-tests)
ef20: 29 29 0a 09 20 0a 20 20 20 20 20 0a )).. . .