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 29 0a system-allowed).
5770: 09 23 66 29 29 29 0a 20 20 0a 3b 3b 20 73 6f 72 .#f))). .;; sor
5780: 74 20 74 65 73 74 73 20 62 79 20 70 72 69 6f 72 t tests by prior
5790: 69 74 79 20 61 6e 64 20 77 61 69 74 6f 6e 0a 3b ity and waiton.;
57a0: 3b 20 4d 6f 76 65 20 74 65 73 74 20 73 70 65 63 ; Move test spec
57b0: 69 66 69 63 20 73 74 75 66 66 20 74 6f 20 61 20 ific stuff to a
57c0: 74 65 73 74 20 75 6e 69 74 20 46 49 58 4d 45 20 test unit FIXME
57d0: 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 64 61 79 one of these day
57e0: 73 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 73 s.(define (tests
57f0: 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 :sort-by-priorit
5800: 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 y-and-waiton tes
5810: 74 2d 6e 61 6d 65 73 29 0a 20 20 28 6c 65 74 20 t-names). (let
5820: 28 28 74 65 73 74 64 65 74 61 69 6c 73 20 20 20 ((testdetails
5830: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 (make-hash-table
5840: 29 29 0a 09 28 6d 75 6e 67 65 70 72 69 6f 72 69 ))..(mungepriori
5850: 74 79 20 28 6c 61 6d 62 64 61 20 28 70 72 69 6f ty (lambda (prio
5860: 72 69 74 79 29 0a 09 09 09 20 28 69 66 20 70 72 rity).... (if pr
5870: 69 6f 72 69 74 79 0a 09 09 09 20 20 20 20 20 28 iority.... (
5880: 6c 65 74 20 28 28 74 6d 70 20 28 61 6e 79 2d 3e let ((tmp (any->
5890: 6e 75 6d 62 65 72 20 70 72 69 6f 72 69 74 79 29 number priority)
58a0: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 )).... (if
58b0: 20 74 6d 70 20 74 6d 70 20 28 62 65 67 69 6e 20 tmp tmp (begin
58c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
58d0: 45 52 52 4f 52 3a 20 62 61 64 20 70 72 69 6f 72 ERROR: bad prior
58e0: 69 74 79 20 76 61 6c 75 65 20 22 20 70 72 69 6f ity value " prio
58f0: 72 69 74 79 20 22 2c 20 75 73 69 6e 67 20 30 22 rity ", using 0"
5900: 29 20 30 29 29 29 0a 09 09 09 20 20 20 20 20 30 ) 0))).... 0
5910: 29 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 )))). (for-ea
5920: 63 68 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 ch (lambda (test
5930: 2d 6e 61 6d 65 29 0a 09 09 28 6c 65 74 20 28 28 -name)...(let ((
5940: 74 65 73 74 2d 63 6f 6e 66 69 67 20 28 74 65 73 test-config (tes
5950: 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 t:get-testconfig
5960: 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 29 29 test-name #f)))
5970: 0a 09 09 20 20 28 69 66 20 74 65 73 74 2d 63 6f ... (if test-co
5980: 6e 66 69 67 20 28 68 61 73 68 2d 74 61 62 6c 65 nfig (hash-table
5990: 2d 73 65 74 21 20 74 65 73 74 64 65 74 61 69 6c -set! testdetail
59a0: 73 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 s test-name test
59b0: 2d 63 6f 6e 66 69 67 29 29 29 29 0a 09 20 20 20 -config))))..
59c0: 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a 20 test-names).
59d0: 20 20 20 28 73 6f 72 74 20 0a 20 20 20 20 20 28 (sort . (
59e0: 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 hash-table-keys
59f0: 74 65 73 74 64 65 74 61 69 6c 73 29 20 3b 3b 20 testdetails) ;;
5a00: 61 76 6f 69 64 20 64 65 61 6c 69 6e 67 20 77 69 avoid dealing wi
5a10: 74 68 20 64 65 6c 65 74 65 64 20 74 65 73 74 73 th deleted tests
5a20: 2c 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 68 61 , look at the ha
5a30: 73 68 20 74 61 62 6c 65 0a 20 20 20 20 20 28 6c sh table. (l
5a40: 61 6d 62 64 61 20 28 61 20 62 29 0a 20 20 20 20 ambda (a b).
5a50: 20 20 20 28 6c 65 74 2a 20 28 28 74 63 6f 6e 66 (let* ((tconf
5a60: 2d 61 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 -a (hash-table
5a70: 2d 72 65 66 20 74 65 73 74 64 65 74 61 69 6c 73 -ref testdetails
5a80: 20 61 29 29 0a 09 20 20 20 20 20 20 28 74 63 6f a)).. (tco
5a90: 6e 66 2d 62 20 20 20 28 68 61 73 68 2d 74 61 62 nf-b (hash-tab
5aa0: 6c 65 2d 72 65 66 20 74 65 73 74 64 65 74 61 69 le-ref testdetai
5ab0: 6c 73 20 62 29 29 0a 09 20 20 20 20 20 20 28 61 ls b)).. (a
5ac0: 2d 77 61 69 74 6f 6e 20 20 20 28 63 6f 6e 66 69 -waiton (confi
5ad0: 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 2d 61 g-lookup tconf-a
5ae0: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 "requirements"
5af0: 22 77 61 69 74 6f 6e 22 29 29 0a 09 20 20 20 20 "waiton"))..
5b00: 20 20 28 62 2d 77 61 69 74 6f 6e 20 20 20 28 63 (b-waiton (c
5b10: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f onfig-lookup tco
5b20: 6e 66 2d 62 20 22 72 65 71 75 69 72 65 6d 65 6e nf-b "requiremen
5b30: 74 73 22 20 22 77 61 69 74 6f 6e 22 29 29 0a 09 ts" "waiton"))..
5b40: 20 20 20 20 20 20 28 61 2d 70 72 69 6f 72 69 74 (a-priorit
5b50: 79 20 28 6d 75 6e 67 65 70 72 69 6f 72 69 74 79 y (mungepriority
5b60: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
5b70: 74 63 6f 6e 66 2d 61 20 22 72 65 71 75 69 72 65 tconf-a "require
5b80: 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 ments" "priority
5b90: 22 29 29 29 0a 09 20 20 20 20 20 20 28 62 2d 70 "))).. (b-p
5ba0: 72 69 6f 72 69 74 79 20 28 6d 75 6e 67 65 70 72 riority (mungepr
5bb0: 69 6f 72 69 74 79 20 28 63 6f 6e 66 69 67 2d 6c iority (config-l
5bc0: 6f 6f 6b 75 70 20 74 63 6f 6e 66 2d 62 20 22 72 ookup tconf-b "r
5bd0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72 equirements" "pr
5be0: 69 6f 72 69 74 79 22 29 29 29 29 0a 09 20 28 69 iority")))).. (i
5bf0: 66 20 28 61 6e 64 20 61 2d 77 61 69 74 6f 6e 20 f (and a-waiton
5c00: 28 65 71 75 61 6c 3f 20 61 2d 77 61 69 74 6f 6e (equal? a-waiton
5c10: 20 62 29 29 0a 09 20 20 20 20 20 23 66 20 3b 3b b)).. #f ;;
5c20: 20 63 61 6e 6e 6f 74 20 68 61 76 65 20 61 20 77 cannot have a w
5c30: 68 69 63 68 20 69 73 20 77 61 69 74 69 6e 67 20 hich is waiting
5c40: 6f 6e 20 62 20 68 61 70 70 65 6e 69 6e 67 20 62 on b happening b
5c50: 65 66 6f 72 65 20 62 0a 09 20 20 20 20 20 28 69 efore b.. (i
5c60: 66 20 28 61 6e 64 20 62 2d 77 61 69 74 6f 6e 20 f (and b-waiton
5c70: 28 65 71 75 61 6c 3f 20 62 2d 77 61 69 74 6f 6e (equal? b-waiton
5c80: 20 61 29 29 0a 09 09 20 23 74 20 3b 3b 20 74 68 a))... #t ;; th
5c90: 69 73 20 69 73 20 74 68 65 20 63 6f 72 72 65 63 is is the correc
5ca0: 74 20 6f 72 64 65 72 2c 20 62 20 69 73 20 77 61 t order, b is wa
5cb0: 69 74 69 6e 67 20 6f 6e 20 61 20 61 6e 64 20 62 iting on a and b
5cc0: 20 69 73 20 62 65 66 6f 72 65 20 61 0a 09 09 20 is before a...
5cd0: 28 69 66 20 28 3e 20 61 2d 70 72 69 6f 72 69 74 (if (> a-priorit
5ce0: 79 20 62 2d 70 72 69 6f 72 69 74 79 29 0a 09 09 y b-priority)...
5cf0: 20 20 20 20 20 23 74 20 3b 3b 20 69 66 20 61 20 #t ;; if a
5d00: 69 73 20 61 20 68 69 67 68 65 72 20 70 72 69 6f is a higher prio
5d10: 72 69 74 79 20 74 68 61 6e 20 62 20 74 68 65 6e rity than b then
5d20: 20 77 65 20 61 72 65 20 67 6f 6f 64 20 74 6f 20 we are good to
5d30: 67 6f 0a 09 09 20 20 20 20 20 23 66 29 29 29 29 go... #f))))
5d40: 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69 73 ))))..;; This is
5d50: 20 6f 72 69 67 69 6e 61 6c 20 72 75 6e 2d 74 65 original run-te
5d60: 73 74 73 2c 20 74 68 69 73 20 72 6f 75 74 69 6e sts, this routin
5d70: 65 20 69 73 20 64 65 70 72 65 63 61 74 65 64 20 e is deprecated
5d80: 61 6e 64 20 77 65 20 77 69 6c 6c 20 74 72 61 6e and we will tran
5d90: 73 69 74 69 6f 6e 20 74 6f 20 75 73 69 6e 67 20 sition to using
5da0: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 28 runs:run-tests (
5db0: 73 65 65 20 62 65 6c 6f 77 29 0a 3b 3b 0a 28 64 see below).;;.(d
5dc0: 65 66 69 6e 65 20 28 72 75 6e 2d 74 65 73 74 73 efine (run-tests
5dd0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a db test-names).
5de0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 (let* ((keys
5df0: 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b 65 (db-get-ke
5e00: 79 73 20 64 62 29 29 0a 09 20 28 6b 65 79 76 61 ys db)).. (keyva
5e10: 6c 6c 73 74 20 20 20 28 6b 65 79 73 2d 3e 76 61 llst (keys->va
5e20: 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 0a llist keys #t)).
5e30: 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20 28 . (run-id (
5e40: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 register-run db
5e50: 6b 65 79 73 29 29 20 20 3b 3b 20 20 74 65 73 74 keys)) ;; test
5e60: 2d 6e 61 6d 65 29 29 29 0a 09 20 28 64 65 66 65 -name))).. (defe
5e70: 72 72 65 64 20 20 20 20 27 28 29 29 20 3b 3b 20 rred '()) ;;
5e80: 64 65 6c 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 delay running th
5e90: 65 73 65 20 73 69 6e 63 65 20 74 68 65 79 20 68 ese since they h
5ea0: 61 76 65 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 ave a waiton cla
5eb0: 75 73 65 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 use.. (runconfig
5ec0: 66 20 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 f (conc *topp
5ed0: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 ath* "/runconfig
5ee0: 73 2e 63 6f 6e 66 69 67 22 29 29 29 0a 20 20 20 s.config"))).
5ef0: 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 ;; on the first
5f00: 20 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f pass or call to
5f10: 20 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 run-tests set F
5f20: 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 AILS to NOT_STAR
5f30: 54 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b TED if. ;; -k
5f40: 65 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 eepgoing is spec
5f50: 69 66 69 65 64 0a 0a 20 20 20 20 28 69 66 20 28 ified.. (if (
5f60: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e file-exists? run
5f70: 63 6f 6e 66 69 67 66 29 0a 09 28 73 65 74 75 70 configf)..(setup
5f80: 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 64 62 -env-defaults db
5f90: 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d runconfigf run-
5fa0: 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e id *already-seen
5fb0: 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a -runconfig-info*
5fc0: 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 )..(debug:print
5fd0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 0 "WARNING: You
5fe0: 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 72 75 do not have a ru
5ff0: 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 n config file: "
6000: 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a 0a 20 runconfigf))..
6010: 20 20 20 28 69 66 20 28 61 6e 64 20 28 65 71 3f (if (and (eq?
6020: 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 20 *passnum* 0)..
6030: 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (args:get-ar
6040: 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 29 g "-keepgoing"))
6050: 0a 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 ..(begin.. ;; h
6060: 61 76 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 ave to delete te
6070: 73 74 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 st records where
6080: 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e NOT_STARTED sin
6090: 63 65 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 ce they can caus
60a0: 65 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 e -keepgoing to
60b0: 0a 09 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b .. ;; get stuck
60c0: 20 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 due to becoming
60d0: 20 69 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 inaccessible fr
60e0: 6f 6d 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 om a failed test
60f0: 2e 20 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 . I.e. if test B
6100: 20 64 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 depends .. ;;
6110: 6f 6e 20 74 65 73 74 20 41 20 62 75 74 20 74 65 on test A but te
6120: 73 74 20 42 20 72 65 61 63 68 65 64 20 74 68 65 st B reached the
6130: 20 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 point on being
6140: 72 65 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f registered as NO
6150: 54 5f 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 T_STARTED and te
6160: 73 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 st.. ;; A faile
6170: 64 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f d for some reaso
6180: 6e 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e n then on re-run
6190: 20 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e using -keepgoin
61a0: 67 20 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 g the run can ne
61b0: 76 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 ver complete...
61c0: 20 28 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 (db:delete-test
61d0: 73 2d 69 6e 2d 73 74 61 74 65 20 64 62 20 72 75 s-in-state db ru
61e0: 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 41 52 54 45 n-id "NOT_STARTE
61f0: 44 22 29 0a 09 20 20 28 64 62 3a 73 65 74 2d 74 D").. (db:set-t
6200: 65 73 74 73 2d 73 74 61 74 65 2d 73 74 61 74 75 ests-state-statu
6210: 73 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 s db run-id test
6220: 2d 6e 61 6d 65 73 20 23 66 20 22 46 41 49 4c 22 -names #f "FAIL"
6230: 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 20 22 "NOT_STARTED" "
6240: 46 41 49 4c 22 29 29 29 0a 20 20 20 20 28 73 65 FAIL"))). (se
6250: 74 21 20 2a 70 61 73 73 6e 75 6d 2a 20 28 2b 20 t! *passnum* (+
6260: 2a 70 61 73 73 6e 75 6d 2a 20 31 29 29 0a 20 20 *passnum* 1)).
6270: 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 6e 75 (let loop ((nu
6280: 6d 74 69 6d 65 73 20 30 29 29 0a 20 20 20 20 20 mtimes 0)).
6290: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
62a0: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 (lambda (test
62b0: 2d 6e 61 6d 65 29 0a 09 20 28 69 66 20 28 72 75 -name).. (if (ru
62c0: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
62d0: 74 65 73 74 73 20 64 62 29 0a 09 20 20 20 20 20 tests db)..
62e0: 28 72 75 6e 2d 6f 6e 65 2d 74 65 73 74 20 64 62 (run-one-test db
62f0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
6300: 65 20 6b 65 79 76 61 6c 6c 73 74 29 0a 09 20 20 e keyvallst)..
6310: 20 20 20 3b 3b 20 61 64 64 20 73 6f 6d 65 20 64 ;; add some d
6320: 65 6c 61 79 20 0a 09 20 20 20 20 20 3b 28 73 6c elay .. ;(sl
6330: 65 65 70 20 32 29 0a 09 20 20 20 20 20 29 29 0a eep 2).. )).
6340: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 73 6f (tests:so
6350: 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 rt-by-priority-a
6360: 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e nd-waiton test-n
6370: 61 6d 65 73 29 29 0a 20 20 20 20 20 20 3b 3b 20 ames)). ;;
6380: 28 72 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 (run-waiting-tes
6390: 74 73 20 64 62 29 0a 20 20 20 20 20 20 28 69 66 ts db). (if
63a0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
63b0: 2d 6b 65 65 70 67 6f 69 6e 67 22 29 0a 09 20 20 -keepgoing")..
63c0: 28 6c 65 74 20 28 28 65 73 74 72 65 6d 20 28 64 (let ((estrem (d
63d0: 62 3a 65 73 74 69 6d 61 74 65 64 2d 74 65 73 74 b:estimated-test
63e0: 73 2d 72 65 6d 61 69 6e 69 6e 67 20 64 62 20 72 s-remaining db r
63f0: 75 6e 2d 69 64 29 29 29 0a 09 20 20 20 20 28 69 un-id))).. (i
6400: 66 20 28 61 6e 64 20 28 3e 20 65 73 74 72 65 6d f (and (> estrem
6410: 20 30 29 0a 09 09 20 20 20 20 20 28 65 71 3f 20 0)... (eq?
6420: 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 *globalexitstatu
6430: 73 2a 20 30 29 29 0a 09 09 28 62 65 67 69 6e 0a s* 0))...(begin.
6440: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
6450: 20 31 20 22 4b 65 65 70 20 67 6f 69 6e 67 2c 20 1 "Keep going,
6460: 65 73 74 69 6d 61 74 65 64 20 22 20 65 73 74 72 estimated " estr
6470: 65 6d 20 22 20 74 65 73 74 73 20 72 65 6d 61 69 em " tests remai
6480: 6e 69 6e 67 20 74 6f 20 72 75 6e 2c 20 77 69 6c ning to run, wil
6490: 6c 20 63 6f 6e 74 69 6e 75 65 20 69 6e 20 33 20 l continue in 3
64a0: 73 65 63 6f 6e 64 73 20 2e 2e 2e 22 29 0a 09 09 seconds ...")...
64b0: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 (thread-sleep!
64c0: 20 33 29 0a 09 09 20 20 28 72 75 6e 2d 77 61 69 3)... (run-wai
64d0: 74 69 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 09 ting-tests db)..
64e0: 09 20 20 28 6c 6f 6f 70 20 28 2b 20 6e 75 6d 74 . (loop (+ numt
64f0: 69 6d 65 73 20 31 29 29 29 29 29 29 29 29 29 0a imes 1))))))))).
6500: 09 20 20 0a 3b 3b 20 56 45 52 59 20 49 4e 45 46 . .;; VERY INEF
6510: 46 49 43 49 45 4e 54 21 20 4d 6f 76 65 20 73 74 FICIENT! Move st
6520: 75 66 66 20 74 68 61 74 20 73 68 6f 75 6c 64 20 uff that should
6530: 62 65 20 64 6f 6e 65 20 6f 6e 63 65 20 75 70 20 be done once up
6540: 74 6f 20 63 61 6c 6c 69 6e 67 20 70 72 6f 63 0a to calling proc.
6550: 28 64 65 66 69 6e 65 20 28 72 75 6e 2d 6f 6e 65 (define (run-one
6560: 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 -test db run-id
6570: 74 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 61 6c test-name keyval
6580: 6c 73 74 29 0a 20 20 28 64 65 62 75 67 3a 70 72 lst). (debug:pr
6590: 69 6e 74 20 31 20 22 4c 61 75 6e 63 68 69 6e 67 int 1 "Launching
65a0: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d test " test-nam
65b0: 65 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 e). ;; All thes
65c0: 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 e vars might be
65d0: 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 referenced by th
65e0: 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c e testconfig fil
65f0: 65 20 72 65 61 64 65 72 0a 20 20 28 73 65 74 65 e reader. (sete
6600: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 nv "MT_TEST_NAME
6610: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 " test-name) ;;
6620: 0a 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 . (setenv "MT_R
6630: 55 4e 4e 41 4d 45 22 20 20 20 28 61 72 67 73 3a UNNAME" (args:
6640: 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d get-arg ":runnam
6650: 65 22 29 29 0a 20 20 28 73 65 74 2d 6d 65 67 61 e")). (set-mega
6660: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 test-env-vars db
6670: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 run-id) ;; thes
6680: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 e may be needed
6690: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 by the launching
66a0: 20 70 72 6f 63 65 73 73 0a 20 20 28 63 68 61 6e process. (chan
66b0: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f ge-directory *to
66c0: 70 70 61 74 68 2a 29 0a 20 20 28 6c 65 74 2a 20 ppath*). (let*
66d0: 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 ((test-path (
66e0: 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 conc *toppath* "
66f0: 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 /tests/" test-na
6700: 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 me)) ;; could us
6710: 65 20 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 e test:get-testc
6720: 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 onfig here .....
6730: 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 (test-configf (
6740: 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 conc test-path "
6750: 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 /testconfig"))..
6760: 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 (testexists (
6770: 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 and (file-exists
6780: 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 ? test-configf)(
6790: 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 file-read-access
67a0: 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 ? test-configf))
67b0: 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 ).. (test-conf
67c0: 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74 73 (if testexists
67d0: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 (read-config te
67e0: 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 74 st-configf #f #t
67f0: 29 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 ) (make-hash-tab
6800: 6c 65 29 29 29 0a 09 20 28 77 61 69 74 6f 6e 20 le))).. (waiton
6810: 20 20 20 20 20 20 28 6c 65 74 20 28 28 77 20 28 (let ((w (
6820: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 config-lookup te
6830: 73 74 2d 63 6f 6e 66 20 22 72 65 71 75 69 72 65 st-conf "require
6840: 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 29 ments" "waiton")
6850: 29 29 0a 09 09 09 20 28 69 66 20 28 73 74 72 69 )).... (if (stri
6860: 6e 67 3f 20 77 29 28 73 74 72 69 6e 67 2d 73 70 ng? w)(string-sp
6870: 6c 69 74 20 77 29 27 28 29 29 29 29 0a 09 20 28 lit w)'()))).. (
6880: 74 61 67 73 20 20 20 20 20 20 20 20 20 28 6c 65 tags (le
6890: 74 20 28 28 74 20 28 63 6f 6e 66 69 67 2d 6c 6f t ((t (config-lo
68a0: 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 okup test-conf "
68b0: 73 65 74 75 70 22 20 22 74 61 67 73 22 29 29 29 setup" "tags")))
68c0: 0a 09 09 09 20 3b 3b 20 77 65 20 77 61 6e 74 20 .... ;; we want
68d0: 6f 75 72 20 74 61 67 73 20 74 6f 20 62 65 20 73 our tags to be s
68e0: 65 70 61 72 61 74 65 64 20 62 79 20 63 6f 6d 6d eparated by comm
68f0: 61 73 20 61 6e 64 20 66 75 6c 6c 79 20 64 65 6c as and fully del
6900: 69 6d 69 74 65 64 20 62 79 20 63 6f 6d 6d 61 73 imited by commas
6910: 0a 09 09 09 20 3b 3b 20 73 6f 20 74 68 61 74 20 .... ;; so that
6920: 71 75 65 72 69 65 73 20 77 69 74 68 20 22 6c 69 queries with "li
6930: 6b 65 22 20 63 61 6e 20 74 69 65 20 74 6f 20 74 ke" can tie to t
6940: 68 65 20 63 6f 6d 6d 61 73 20 61 74 20 65 69 74 he commas at eit
6950: 68 65 72 20 65 6e 64 20 6f 66 20 65 61 63 68 20 her end of each
6960: 74 61 67 0a 09 09 09 20 3b 3b 20 77 68 69 6c 65 tag.... ;; while
6970: 20 61 6c 73 6f 20 61 6c 6c 6f 77 69 6e 67 20 74 also allowing t
6980: 68 65 20 65 6e 64 20 75 73 65 72 20 74 6f 20 66 he end user to f
6990: 72 65 65 6c 79 20 75 73 65 20 73 70 61 63 65 73 reely use spaces
69a0: 20 61 6e 64 20 63 6f 6d 6d 61 73 20 74 6f 20 73 and commas to s
69b0: 65 70 61 72 61 74 65 20 74 61 67 73 0a 09 09 09 eparate tags....
69c0: 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 74 29 (if (string? t)
69d0: 28 73 74 72 69 6e 67 2d 73 75 62 73 74 69 74 75 (string-substitu
69e0: 74 65 20 28 72 65 67 65 78 70 20 22 5b 2c 5c 5c te (regexp "[,\\
69f0: 73 5d 2b 22 29 20 22 2c 22 20 28 63 6f 6e 63 20 s]+") "," (conc
6a00: 22 2c 22 20 74 20 22 2c 22 29 20 23 74 29 0a 09 "," t ",") #t)..
6a10: 09 09 20 20 20 20 20 27 28 29 29 29 29 29 0a 20 .. '())))).
6a20: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 (if (not test
6a30: 65 78 69 73 74 73 29 0a 09 28 62 65 67 69 6e 0a exists)..(begin.
6a40: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
6a50: 30 20 22 45 52 52 4f 52 3a 20 43 61 6e 27 74 20 0 "ERROR: Can't
6a60: 66 69 6e 64 20 63 6f 6e 66 69 67 20 66 69 6c 65 find config file
6a70: 20 22 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 " test-configf)
6a80: 0a 09 20 20 28 65 78 69 74 20 32 29 29 0a 09 3b .. (exit 2))..;
6a90: 3b 20 70 75 74 20 74 6f 70 20 76 61 72 73 20 69 ; put top vars i
6aa0: 6e 74 6f 20 63 6f 6e 76 65 6e 69 65 6e 74 20 76 nto convenient v
6ab0: 61 72 69 61 62 6c 65 73 20 61 6e 64 20 6f 70 65 ariables and ope
6ac0: 6e 20 74 68 65 20 64 62 0a 09 28 6c 65 74 2a 20 n the db..(let*
6ad0: 28 3b 3b 20 64 62 20 69 73 20 61 6c 77 61 79 73 (;; db is always
6ae0: 20 61 74 20 2a 74 6f 70 70 61 74 68 2a 2f 64 62 at *toppath*/db
6af0: 2f 6d 65 67 61 74 65 73 74 2e 64 62 0a 09 20 20 /megatest.db..
6b00: 20 20 20 20 20 28 69 74 65 6d 73 20 20 20 20 20 (items
6b10: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
6b20: 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 63 f/default test-c
6b30: 6f 6e 66 20 22 69 74 65 6d 73 22 20 27 28 29 29 onf "items" '())
6b40: 29 0a 09 20 20 20 20 20 20 20 28 69 74 65 6d 73 ).. (items
6b50: 74 61 62 6c 65 20 20 28 68 61 73 68 2d 74 61 62 table (hash-tab
6b60: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 le-ref/default t
6b70: 65 73 74 2d 63 6f 6e 66 20 22 69 74 65 6d 73 74 est-conf "itemst
6b80: 61 62 6c 65 22 20 27 28 29 29 29 0a 09 20 20 20 able" '()))..
6b90: 20 20 20 20 28 61 6c 6c 69 74 65 6d 73 20 20 20 (allitems
6ba0: 20 28 69 66 20 28 6f 72 20 28 6e 6f 74 20 28 6e (if (or (not (n
6bb0: 75 6c 6c 3f 20 69 74 65 6d 73 29 29 28 6e 6f 74 ull? items))(not
6bc0: 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 74 61 62 (null? itemstab
6bd0: 6c 65 29 29 29 0a 09 09 09 09 28 61 70 70 65 6e le))).....(appen
6be0: 64 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 d (item-assoc->i
6bf0: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 29 0a tem-list items).
6c00: 09 09 09 09 09 28 69 74 65 6d 2d 74 61 62 6c 65 .....(item-table
6c10: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d ->item-list item
6c20: 73 74 61 62 6c 65 29 29 0a 09 09 09 09 27 28 28 stable)).....'((
6c30: 29 29 29 29 29 20 3b 3b 20 61 20 6c 69 73 74 20 ))))) ;; a list
6c40: 77 69 74 68 20 6f 6e 65 20 6e 75 6c 6c 20 6c 69 with one null li
6c50: 73 74 20 69 73 20 61 20 74 65 73 74 20 77 69 74 st is a test wit
6c60: 68 20 6e 6f 20 69 74 65 6d 73 0a 3b 3b 20 09 20 h no items.;; .
6c70: 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 28 63 (runconfigf (c
6c80: 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 onc *toppath* "
6c90: 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 /runconfigs.conf
6ca0: 69 67 22 29 29 29 0a 09 20 20 28 64 65 62 75 67 ig"))).. (debug
6cb0: 3a 70 72 69 6e 74 20 31 20 22 69 74 65 6d 73 3a :print 1 "items:
6cc0: 20 22 29 0a 09 20 20 28 69 66 20 28 3e 3d 20 2a ").. (if (>= *
6cd0: 76 65 72 62 6f 73 69 74 79 2a 20 31 29 28 70 70 verbosity* 1)(pp
6ce0: 20 61 6c 6c 69 74 65 6d 73 29 29 0a 09 20 20 28 allitems)).. (
6cf0: 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 if (>= *verbosit
6d00: 79 2a 20 35 29 0a 09 20 20 20 20 20 20 28 62 65 y* 5).. (be
6d10: 67 69 6e 0a 09 09 28 70 72 69 6e 74 20 22 69 74 gin...(print "it
6d20: 65 6d 73 3a 20 22 29 28 70 70 20 28 69 74 65 6d ems: ")(pp (item
6d30: 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 -assoc->item-lis
6d40: 74 20 69 74 65 6d 73 29 29 0a 09 09 28 70 72 69 t items))...(pri
6d50: 6e 74 20 22 69 74 65 73 74 61 62 6c 65 3a 20 22 nt "itestable: "
6d60: 29 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 )(pp (item-table
6d70: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d ->item-list item
6d80: 73 74 61 62 6c 65 29 29 29 29 0a 09 20 20 28 69 stable)))).. (i
6d90: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 f (args:get-arg
6da0: 22 2d 6d 22 29 0a 09 20 20 20 20 20 20 28 64 62 "-m").. (db
6db0: 3a 73 65 74 2d 63 6f 6d 6d 65 6e 74 2d 66 6f 72 :set-comment-for
6dc0: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 20 28 -run db run-id (
6dd0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6d args:get-arg "-m
6de0: 22 29 29 29 0a 0a 09 20 20 3b 3b 20 48 65 72 65 ")))... ;; Here
6df0: 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65 is where the te
6e00: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 st_meta table is
6e10: 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 09 20 best updated..
6e20: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 (runs:update-te
6e30: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d st_meta db test-
6e40: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a name test-conf).
6e50: 0a 09 20 20 3b 3b 20 62 72 61 69 6e 64 65 61 64 .. ;; braindead
6e60: 20 77 6f 72 6b 2d 61 72 6f 75 6e 64 20 66 6f 72 work-around for
6e70: 20 70 6f 6f 72 6c 79 20 73 70 65 63 69 66 69 65 poorly specifie
6e80: 64 20 61 6c 6c 69 74 65 6d 73 20 6c 69 73 74 20 d allitems list
6e90: 42 55 47 21 21 21 20 46 49 58 4d 45 0a 09 20 20 BUG!!! FIXME..
6ea0: 28 69 66 20 28 6e 75 6c 6c 3f 20 61 6c 6c 69 74 (if (null? allit
6eb0: 65 6d 73 29 28 73 65 74 21 20 61 6c 6c 69 74 65 ems)(set! allite
6ec0: 6d 73 20 27 28 28 29 29 29 29 0a 09 20 20 28 6c ms '(()))).. (l
6ed0: 65 74 20 6c 6f 6f 70 20 28 28 69 74 65 6d 64 61 et loop ((itemda
6ee0: 74 20 28 63 61 72 20 61 6c 6c 69 74 65 6d 73 29 t (car allitems)
6ef0: 29 0a 09 09 20 20 20 20 20 28 74 61 6c 20 20 20 )... (tal
6f00: 20 20 28 63 64 72 20 61 6c 6c 69 74 65 6d 73 29 (cdr allitems)
6f10: 29 29 0a 09 20 20 20 20 3b 3b 20 28 6c 61 6d 62 )).. ;; (lamb
6f20: 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b da (itemdat) ;;;
6f30: 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 ((ripeness "ove
6f40: 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 rripe") (tempera
6f50: 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 ture "cool") (se
6f60: 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a ason "summer")).
6f70: 09 20 20 20 20 3b 3b 20 48 61 6e 64 6c 65 20 6c . ;; Handle l
6f80: 69 73 74 73 20 6f 66 20 69 74 65 6d 73 0a 09 20 ists of items..
6f90: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d (let* ((item-
6fa0: 70 61 74 68 20 20 20 20 20 28 69 74 65 6d 2d 6c path (item-l
6fb0: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
6fc0: 74 29 29 20 3b 3b 20 28 73 74 72 69 6e 67 2d 69 t)) ;; (string-i
6fd0: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 ntersperse (map
6fe0: 63 61 64 72 20 69 74 65 6d 64 61 74 29 20 22 2f cadr itemdat) "/
6ff0: 22 29 29 0a 09 09 20 20 20 28 6e 65 77 2d 74 65 "))... (new-te
7000: 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d st-path (string-
7010: 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e intersperse (con
7020: 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 s test-path (map
7030: 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 cadr itemdat))
7040: 22 2f 22 29 29 0a 09 09 20 20 20 28 6e 65 77 2d "/"))... (new-
7050: 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 test-name (if (e
7060: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
7070: 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 "") test-name (c
7080: 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f onc test-name "/
7090: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b " item-path))) ;
70a0: 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 ; just need it t
70b0: 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 09 20 20 o be unique...
70c0: 20 28 74 65 73 74 64 61 74 20 20 20 23 66 29 0a (testdat #f).
70d0: 09 09 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e .. (num-runnin
70e0: 67 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d g (db:get-count-
70f0: 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 tests-running db
7100: 29 29 0a 09 09 20 20 20 28 6d 61 78 2d 63 6f 6e ))... (max-con
7110: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f current-jobs (co
7120: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e nfig-lookup *con
7130: 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 figdat* "setup"
7140: 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f "max_concurrent_
7150: 6a 6f 62 73 22 29 29 0a 09 09 20 20 20 28 70 61 jobs"))... (pa
7160: 72 65 6e 74 2d 74 65 73 74 20 28 61 6e 64 20 28 rent-test (and (
7170: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 not (null? items
7180: 29 29 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 ))(equal? item-p
7190: 61 74 68 20 22 22 29 29 29 0a 09 09 20 20 20 28 ath "")))... (
71a0: 73 69 6e 67 6c 65 2d 74 65 73 74 20 28 61 6e 64 single-test (and
71b0: 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 20 28 (null? items) (
71c0: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
71d0: 20 22 22 29 29 29 0a 09 09 20 20 20 28 69 74 65 "")))... (ite
71e0: 6d 2d 74 65 73 74 20 20 20 28 6e 6f 74 20 28 65 m-test (not (e
71f0: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
7200: 22 22 29 29 29 0a 09 09 20 20 20 28 69 74 65 6d "")))... (item
7210: 2d 70 61 74 74 20 20 20 28 61 72 67 73 3a 67 65 -patt (args:ge
7220: 74 2d 61 72 67 20 22 2d 69 74 65 6d 70 61 74 74 t-arg "-itempatt
7230: 22 29 29 0a 09 09 20 20 20 28 70 61 74 74 2d 6d "))... (patt-m
7240: 61 74 63 68 20 20 28 69 66 20 69 74 65 6d 2d 70 atch (if item-p
7250: 61 74 74 0a 09 09 09 09 20 20 20 20 28 73 74 72 att..... (str
7260: 69 6e 67 2d 73 65 61 72 63 68 20 28 67 6c 6f 62 ing-search (glob
7270: 2d 3e 72 65 67 65 78 70 0a 09 09 09 09 09 09 20 ->regexp.......
7280: 20 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c (string-transl
7290: 61 74 65 20 69 74 65 6d 2d 70 61 74 74 20 22 25 ate item-patt "%
72a0: 22 20 22 2a 22 29 29 0a 09 09 09 09 09 09 20 20 " "*")).......
72b0: 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 09 09 20 item-path).....
72c0: 20 20 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 #t)))..
72d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 (debug:print 3 "
72e0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
72f0: 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 obs: " max-concu
7300: 72 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 rrent-jobs ", nu
7310: 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d m-running: " num
7320: 2d 72 75 6e 6e 69 6e 67 29 0a 09 20 20 20 20 20 -running)..
7330: 20 28 69 66 20 28 61 6e 64 20 70 61 74 74 2d 6d (if (and patt-m
7340: 61 74 63 68 20 28 72 75 6e 73 3a 63 61 6e 2d 72 atch (runs:can-r
7350: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 un-more-tests db
7360: 29 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 ))... (begin...
7370: 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 32 20 28 (let loop2 (
7380: 28 74 73 20 28 64 62 3a 67 65 74 2d 74 65 73 74 (ts (db:get-test
7390: 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 -info db run-id
73a0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
73b0: 61 74 68 29 29 20 3b 3b 20 23 66 29 0a 09 09 09 ath)) ;; #f)....
73c0: 09 28 63 74 20 30 29 29 0a 09 09 20 20 20 20 20 .(ct 0))...
73d0: 20 28 69 66 20 28 61 6e 64 20 28 6e 6f 74 20 74 (if (and (not t
73e0: 73 29 0a 09 09 09 20 20 20 20 20 20 20 28 3c 20 s).... (<
73f0: 63 74 20 31 30 29 29 0a 09 09 09 20 20 28 62 65 ct 10)).... (be
7400: 67 69 6e 0a 09 09 09 20 20 20 20 28 72 65 67 69 gin.... (regi
7410: 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e ster-test db run
7420: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
7430: 65 6d 2d 70 61 74 68 29 0a 09 09 09 20 20 20 20 em-path)....
7440: 28 64 62 3a 74 65 73 74 2d 73 65 74 2d 63 6f 6d (db:test-set-com
7450: 6d 65 6e 74 20 64 62 20 72 75 6e 2d 69 64 20 74 ment db run-id t
7460: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
7470: 74 68 20 22 22 29 0a 09 09 09 20 20 20 20 28 6c th "").... (l
7480: 6f 6f 70 32 20 28 64 62 3a 67 65 74 2d 74 65 73 oop2 (db:get-tes
7490: 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 t-info db run-id
74a0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
74b0: 70 61 74 68 29 0a 09 09 09 09 20 20 20 28 2b 20 path)..... (+
74c0: 63 74 20 31 29 29 29 0a 09 09 09 20 20 28 69 66 ct 1))).... (if
74d0: 20 74 73 0a 09 09 09 20 20 20 20 20 20 28 73 65 ts.... (se
74e0: 74 21 20 74 65 73 74 64 61 74 20 74 73 29 0a 09 t! testdat ts)..
74f0: 09 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 .. (begin..
7500: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ...(debug:print
7510: 30 20 22 57 41 52 4e 49 4e 47 3a 20 43 6f 75 6c 0 "WARNING: Coul
7520: 64 6e 27 74 20 72 65 67 69 73 74 65 72 20 74 65 dn't register te
7530: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
7540: 20 77 69 74 68 20 69 74 65 6d 20 70 61 74 68 20 with item path
7550: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 2c 20 73 " item-path ", s
7560: 6b 69 70 70 69 6e 67 22 29 0a 09 09 09 09 28 69 kipping").....(i
7570: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 f (not (null? ta
7580: 6c 29 29 0a 09 09 09 09 20 20 20 20 28 6c 6f 6f l))..... (loo
7590: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 p (car tal)(cdr
75a0: 74 61 6c 29 29 29 29 29 29 29 0a 09 09 20 20 20 tal)))))))...
75b0: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f (change-directo
75c0: 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 09 09 ry test-path)...
75d0: 20 20 20 20 3b 3b 20 74 68 69 73 20 62 6c 6f 63 ;; this bloc
75e0: 6b 20 69 73 20 68 65 72 65 20 6f 6e 6c 79 20 74 k is here only t
75f0: 6f 20 69 6e 66 6f 72 6d 20 74 68 65 20 75 73 65 o inform the use
7600: 72 20 65 61 72 6c 79 20 6f 6e 0a 09 09 20 20 20 r early on...
7610: 20 0a 09 09 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 ... ;; NB//
7620: 4d 6f 76 69 6e 67 20 74 68 65 20 73 65 74 74 69 Moving the setti
7630: 6e 67 20 6f 66 20 72 75 6e 63 6f 6e 66 69 67 2e ng of runconfig.
7640: 63 6f 6e 66 69 67 20 76 61 72 73 20 74 6f 20 2a config vars to *
7650: 62 65 66 6f 72 65 2a 20 74 68 65 20 0a 09 09 20 before* the ...
7660: 20 20 20 3b 3b 20 74 68 65 20 63 61 6c 6c 69 6e ;; the callin
7670: 67 20 6f 66 20 65 61 63 68 20 74 65 73 74 2e 0a g of each test..
7680: 09 09 20 20 20 20 3b 3b 20 28 69 66 20 28 66 69 .. ;; (if (fi
7690: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f le-exists? runco
76a0: 6e 66 69 67 66 29 0a 09 09 20 20 20 20 3b 3b 20 nfigf)... ;;
76b0: 20 20 20 20 28 73 65 74 75 70 2d 65 6e 76 2d 64 (setup-env-d
76c0: 65 66 61 75 6c 74 73 20 64 62 20 72 75 6e 63 6f efaults db runco
76d0: 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c nfigf run-id *al
76e0: 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f ready-seen-runco
76f0: 6e 66 69 67 2d 69 6e 66 6f 2a 29 0a 09 09 20 20 nfig-info*)...
7700: 20 20 3b 3b 20 20 20 20 20 28 64 65 62 75 67 3a ;; (debug:
7710: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 print 0 "WARNING
7720: 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 : You do not hav
7730: 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 e a run config f
7740: 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 ile: " runconfig
7750: 66 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 f))... (debug
7760: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 2d 69 64 :print 4 "run-id
7770: 3a 20 22 20 72 75 6e 2d 69 64 20 22 20 74 65 73 : " run-id " tes
7780: 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e t-name: " test-n
7790: 61 6d 65 20 22 20 69 74 65 6d 2d 70 61 74 68 3a ame " item-path:
77a0: 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 74 " item-path " t
77b0: 65 73 74 64 61 74 3a 20 22 20 28 74 65 73 74 3a estdat: " (test:
77c0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
77d0: 61 74 29 20 22 20 74 65 73 74 2d 73 74 61 74 65 at) " test-state
77e0: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 : " (test:get-st
77f0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
7800: 20 20 20 20 28 63 61 73 65 20 28 69 66 20 28 61 (case (if (a
7810: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f rgs:get-arg "-fo
7820: 72 63 65 22 29 0a 09 09 09 20 20 20 20 20 20 27 rce").... '
7830: 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 09 20 NOT_STARTED....
7840: 20 20 20 20 20 28 69 66 20 74 65 73 74 64 61 74 (if testdat
7850: 0a 09 09 09 09 20 20 28 73 74 72 69 6e 67 2d 3e ..... (string->
7860: 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 symbol (test:get
7870: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 -state testdat))
7880: 0a 09 09 09 09 20 20 27 66 61 69 6c 65 64 2d 74 ..... 'failed-t
7890: 6f 2d 69 6e 73 65 72 74 29 29 0a 09 09 20 20 20 o-insert))...
78a0: 20 20 20 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 ((failed-to-i
78b0: 6e 73 65 72 74 29 0a 09 09 20 20 20 20 20 20 20 nsert)...
78c0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
78d0: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
78e0: 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f insert the reco
78f0: 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 rd into the db")
7900: 29 0a 09 09 20 20 20 20 20 20 28 28 4e 4f 54 5f )... ((NOT_
7910: 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 STARTED COMPLETE
7920: 44 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 D)... (deb
7930: 75 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 20 ug:print 6 "Got
7940: 68 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67 65 here, " (test:ge
7950: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
7960: 29 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 )... (let
7970: 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 ((runflag #f))..
7980: 09 09 20 28 63 6f 6e 64 0a 09 09 09 20 20 3b 3b .. (cond.... ;;
7990: 20 69 2e 65 2e 20 74 68 69 73 20 69 73 20 74 68 i.e. this is th
79a0: 65 20 70 61 72 65 6e 74 20 74 65 73 74 20 74 6f e parent test to
79b0: 20 61 20 73 75 69 74 65 20 6f 66 20 69 74 65 6d a suite of item
79c0: 73 2c 20 6e 65 76 65 72 20 22 72 75 6e 22 20 69 s, never "run" i
79d0: 74 0a 09 09 09 20 20 28 70 61 72 65 6e 74 2d 74 t.... (parent-t
79e0: 65 73 74 0a 09 09 09 20 20 20 28 73 65 74 21 20 est.... (set!
79f0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 runflag #f))....
7a00: 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e ;; -force, run
7a10: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a no matter what.
7a20: 09 09 09 20 20 28 28 61 72 67 73 3a 67 65 74 2d ... ((args:get-
7a30: 61 72 67 20 22 2d 66 6f 72 63 65 22 29 28 73 65 arg "-force")(se
7a40: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a t! runflag #t)).
7a50: 09 09 09 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 ... ;; NOT_STAR
7a60: 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 TED, run no matt
7a70: 65 72 20 77 68 61 74 0a 09 09 09 20 20 28 28 65 er what.... ((e
7a80: 71 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d qual? (test:get-
7a90: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 state testdat) "
7aa0: 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 28 73 65 NOT_STARTED")(se
7ab0: 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a t! runflag #t)).
7ac0: 09 09 09 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 ... ;; not -rer
7ad0: 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 un and PASS, WAR
7ae0: 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e N or CHECK, do n
7af0: 6f 20 72 75 6e 0a 09 09 09 20 20 28 28 61 6e 64 o run.... ((and
7b00: 20 28 6f 72 20 28 6e 6f 74 20 28 61 72 67 73 3a (or (not (args:
7b10: 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 get-arg "-rerun"
7b20: 29 29 0a 09 09 09 09 20 20 20 20 28 61 72 67 73 ))..... (args
7b30: 3a 67 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 :get-arg "-keepg
7b40: 6f 69 6e 67 22 29 29 0a 09 09 09 09 28 6d 65 6d oing")).....(mem
7b50: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
7b60: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 atus testdat) '(
7b70: 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 "PASS" "WARN" "C
7b80: 48 45 43 4b 22 29 29 29 0a 09 09 09 20 20 20 28 HECK"))).... (
7b90: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
7ba0: 29 0a 09 09 09 20 20 3b 3b 20 2d 72 65 72 75 6e ).... ;; -rerun
7bb0: 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f and status is o
7bc0: 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 ne of the specif
7bd0: 65 64 2c 20 72 75 6e 20 69 74 0a 09 09 09 20 20 ed, run it....
7be0: 28 28 61 6e 64 20 28 61 72 67 73 3a 67 65 74 2d ((and (args:get-
7bf0: 61 72 67 20 22 2d 72 65 72 75 6e 22 29 0a 09 09 arg "-rerun")...
7c00: 09 09 28 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 ..(let ((rerunls
7c10: 74 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 t (string-split
7c20: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
7c30: 72 65 72 75 6e 22 29 20 22 2c 22 29 29 29 20 3b rerun") ","))) ;
7c40: 3b 20 46 41 49 4c 2c 0a 09 09 09 09 20 20 28 6d ; FAIL,..... (m
7c50: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d ember (test:get-
7c60: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
7c70: 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 09 20 rerunlst)))....
7c80: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 (set! runflag
7c90: 23 74 29 29 0a 09 09 09 20 20 3b 3b 20 2d 6b 65 #t)).... ;; -ke
7ca0: 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 epgoing, do not
7cb0: 72 65 72 75 6e 20 46 41 49 4c 0a 09 09 09 20 20 rerun FAIL....
7cc0: 28 28 61 6e 64 20 28 61 72 67 73 3a 67 65 74 2d ((and (args:get-
7cd0: 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 arg "-keepgoing"
7ce0: 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 28 74 ).....(member (t
7cf0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
7d00: 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 estdat) '("FAIL"
7d10: 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 ))).... (set!
7d20: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 runflag #f))....
7d30: 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 61 72 ((and (not (ar
7d40: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 gs:get-arg "-rer
7d50: 75 6e 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 un")).....(membe
7d60: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
7d70: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 us testdat) '("F
7d80: 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 09 AIL" "n/a")))...
7d90: 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 . (set! runfla
7da0: 67 20 23 74 29 29 0a 09 09 09 20 20 28 65 6c 73 g #t)).... (els
7db0: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 e (set! runflag
7dc0: 23 66 29 29 29 0a 09 09 09 20 28 64 65 62 75 67 #f))).... (debug
7dd0: 3a 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e :print 6 "RUNNIN
7de0: 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 G => runflag: "
7df0: 72 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a runflag " STATE:
7e00: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
7e10: 74 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54 te testdat) " ST
7e20: 41 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 ATUS: " (test:ge
7e30: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
7e40: 29 29 0a 09 09 09 20 28 69 66 20 28 6e 6f 74 20 )).... (if (not
7e50: 72 75 6e 66 6c 61 67 29 0a 09 09 09 20 20 20 20 runflag)....
7e60: 20 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 (if (not parent
7e70: 2d 74 65 73 74 29 0a 09 09 09 09 20 28 64 65 62 -test)..... (deb
7e80: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 ug:print 1 "NOTE
7e90: 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 : Not starting t
7ea0: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e est " new-test-n
7eb0: 61 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73 ame " as it is s
7ec0: 74 61 74 65 20 5c 22 43 4f 4d 50 4c 45 54 45 44 tate \"COMPLETED
7ed0: 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 \" and status \"
7ee0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
7ef0: 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c us testdat) "\",
7f00: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6f use -force to o
7f10: 76 65 72 72 69 64 65 22 29 29 0a 09 09 09 20 20 verride"))....
7f20: 20 20 20 28 6c 65 74 2a 20 28 28 67 65 74 2d 70 (let* ((get-p
7f30: 72 65 72 65 71 73 2d 63 6d 64 20 28 6c 61 6d 62 rereqs-cmd (lamb
7f40: 64 61 20 28 29 0a 09 09 09 09 09 09 20 20 20 20 da ().......
7f50: 20 20 20 28 64 62 2d 67 65 74 2d 70 72 65 72 65 (db-get-prere
7f60: 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 qs-not-met db ru
7f70: 6e 2d 69 64 20 77 61 69 74 6f 6e 29 29 29 20 3b n-id waiton))) ;
7f80: 3b 20 63 68 65 63 6b 20 62 65 66 6f 72 65 20 72 ; check before r
7f90: 75 6e 6e 69 6e 67 20 2e 2e 2e 2e 0a 09 09 09 09 unning .........
7fa0: 20 20 20 20 28 6c 61 75 6e 63 68 2d 63 6d 64 20 (launch-cmd
7fb0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a (lambda ().
7fc0: 09 09 09 09 09 09 20 20 20 20 20 20 20 28 6c 61 ...... (la
7fd0: 75 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e unch-test db run
7fe0: 2d 69 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 -id (args:get-ar
7ff0: 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 20 74 65 g ":runname") te
8000: 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 st-conf keyvalls
8010: 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 t test-name test
8020: 2d 70 61 74 68 20 69 74 65 6d 64 61 74 20 61 72 -path itemdat ar
8030: 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a 09 gs:arg-hash)))..
8040: 09 09 09 20 20 20 20 28 74 65 73 74 72 75 6e 64 ... (testrund
8050: 61 74 20 20 20 20 20 20 28 6c 69 73 74 20 67 65 at (list ge
8060: 74 2d 70 72 65 72 65 71 73 2d 63 6d 64 20 6c 61 t-prereqs-cmd la
8070: 75 6e 63 68 2d 63 6d 64 29 29 29 0a 09 09 09 20 unch-cmd)))....
8080: 20 20 20 20 20 20 28 69 66 20 28 6f 72 20 28 61 (if (or (a
8090: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f rgs:get-arg "-fo
80a0: 72 63 65 22 29 0a 09 09 09 09 20 20 20 20 20 20 rce").....
80b0: 20 28 6c 65 74 20 28 28 70 72 65 71 73 2d 6e 6f (let ((preqs-no
80c0: 74 2d 79 65 74 2d 6d 65 74 20 28 28 63 61 72 20 t-yet-met ((car
80d0: 74 65 73 74 72 75 6e 64 61 74 29 29 29 29 0a 09 testrundat))))..
80e0: 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e .... (debug:prin
80f0: 74 20 32 20 22 50 72 65 71 72 65 71 75 65 73 69 t 2 "Preqrequesi
8100: 74 65 73 20 66 6f 72 20 22 20 74 65 73 74 2d 6e tes for " test-n
8110: 61 6d 65 20 22 3a 20 22 20 70 72 65 71 73 2d 6e ame ": " preqs-n
8120: 6f 74 2d 79 65 74 2d 6d 65 74 29 0a 09 09 09 09 ot-yet-met).....
8130: 09 20 28 6e 75 6c 6c 3f 20 70 72 65 71 73 2d 6e . (null? preqs-n
8140: 6f 74 2d 79 65 74 2d 6d 65 74 29 29 29 20 3b 3b ot-yet-met))) ;;
8150: 20 61 72 65 20 74 68 65 72 65 20 61 6e 79 20 74 are there any t
8160: 65 73 74 73 20 74 68 61 74 20 6d 75 73 74 20 62 ests that must b
8170: 65 20 72 75 6e 20 62 65 66 6f 72 65 20 74 68 69 e run before thi
8180: 73 20 6f 6e 65 2e 2e 2e 0a 09 09 09 09 20 20 20 s one........
8190: 28 69 66 20 28 6e 6f 74 20 28 28 63 61 64 72 20 (if (not ((cadr
81a0: 74 65 73 74 72 75 6e 64 61 74 29 29 29 20 3b 3b testrundat))) ;;
81b0: 20 74 68 69 73 20 69 73 20 74 68 65 20 6c 69 6e this is the lin
81c0: 65 20 74 68 61 74 20 6c 61 75 6e 63 68 65 73 20 e that launches
81d0: 74 68 65 20 74 65 73 74 20 74 6f 20 74 68 65 20 the test to the
81e0: 72 65 6d 6f 74 65 20 68 6f 73 74 0a 09 09 09 09 remote host.....
81f0: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 (begin...
8200: 09 09 09 20 28 70 72 69 6e 74 20 22 45 52 52 4f ... (print "ERRO
8210: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 R: Failed to lau
8220: 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 nch the test. Ex
8230: 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 iting as soon as
8240: 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 09 09 possible").....
8250: 09 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 . (set! *globale
8260: 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b xitstatus* 1) ;;
8270: 20 0a 09 09 09 09 09 20 28 70 72 6f 63 65 73 73 ...... (process
8280: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 -signal (current
8290: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 -process-id) sig
82a0: 6e 61 6c 2f 6b 69 6c 6c 29 0a 09 09 09 09 09 20 nal/kill)......
82b0: 3b 28 65 78 69 74 20 31 29 0a 09 09 09 09 09 20 ;(exit 1)......
82c0: 29 29 0a 09 09 09 09 20 20 20 28 69 66 20 28 6e ))..... (if (n
82d0: 6f 74 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 ot (args:get-arg
82e0: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 29 0a "-keepgoing")).
82f0: 09 09 09 09 20 20 20 20 20 20 20 28 68 61 73 68 .... (hash
8300: 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 77 61 69 -table-set! *wai
8310: 74 69 6e 67 2d 71 75 65 75 65 2a 20 6e 65 77 2d ting-queue* new-
8320: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 72 75 test-name testru
8330: 6e 64 61 74 29 29 29 29 29 29 29 0a 09 09 20 20 ndat)))))))...
8340: 20 20 20 20 28 28 4b 49 4c 4c 45 44 29 20 0a 09 ((KILLED) ..
8350: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
8360: 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 rint 1 "NOTE: "
8370: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 new-test-name "
8380: 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 is already runni
8390: 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 ng or was explic
83a0: 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 tly killed, use
83b0: 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 -force to launch
83c0: 20 69 74 2e 22 29 29 0a 09 09 20 20 20 20 20 20 it."))...
83d0: 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 ((LAUNCHED REMOT
83e0: 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 EHOSTSTART RUNNI
83f0: 4e 47 29 20 20 0a 09 09 20 20 20 20 20 20 20 28 NG) ... (
8400: 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e if (> (- (curren
8410: 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 t-seconds)(+ (db
8420: 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f :test-get-event_
8430: 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 time testdat)...
8440: 09 09 09 09 20 20 20 20 20 28 64 62 3a 74 65 73 .... (db:tes
8450: 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 t-get-run_durati
8460: 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 on testdat)))...
8470: 09 20 20 20 20 20 20 31 30 30 29 20 3b 3b 20 69 . 100) ;; i
8480: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f .e. no update fo
8490: 72 20 6d 6f 72 65 20 74 68 61 6e 20 31 30 30 20 r more than 100
84a0: 73 65 63 6f 6e 64 73 0a 09 09 09 20 20 20 28 62 seconds.... (b
84b0: 65 67 69 6e 0a 09 09 09 20 20 20 20 20 28 64 65 egin.... (de
84c0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
84d0: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 NING: Test " tes
84e0: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 t-name " appears
84f0: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 to be dead. For
8500: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 cing it to state
8510: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 INCOMPLETE and
8520: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 status STUCK/DEA
8530: 44 22 29 0a 09 09 09 20 20 20 20 20 28 74 65 73 D").... (tes
8540: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 t-set-status! db
8550: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
8560: 65 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 e "INCOMPLETE" "
8570: 53 54 55 43 4b 2f 44 45 41 44 22 20 69 74 65 6d STUCK/DEAD" item
8580: 64 61 74 20 22 54 65 73 74 20 69 73 20 73 74 75 dat "Test is stu
8590: 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 ck or dead" #f))
85a0: 0a 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 .... (debug:pr
85b0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 int 2 "NOTE: " t
85c0: 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c est-name " is al
85d0: 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 ready running"))
85e0: 29 0a 09 09 20 20 20 20 20 20 28 65 6c 73 65 20 )... (else
85f0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
8600: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 nt 0 "ERROR: Fai
8610: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 led to launch te
8620: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 st " new-test-na
8630: 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 me ". Unrecognis
8640: 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74 ed state " (test
8650: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
8660: 61 74 29 29 29 29 29 29 0a 09 20 20 20 20 20 20 at))))))..
8670: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
8680: 74 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 tal))... (loop
8690: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 (car tal)(cdr ta
86a0: 6c 29 29 29 29 29 29 29 29 29 0a 0a 28 64 65 66 l)))))))))..(def
86b0: 69 6e 65 20 28 72 75 6e 2d 77 61 69 74 69 6e 67 ine (run-waiting
86c0: 2d 74 65 73 74 73 20 64 62 29 0a 20 20 28 6c 65 -tests db). (le
86d0: 74 20 28 28 6e 75 6d 74 72 69 65 73 20 20 20 20 t ((numtries
86e0: 20 20 20 20 20 20 20 30 29 0a 09 28 6c 61 73 74 0)..(last
86f0: 2d 74 72 79 2d 74 69 6d 65 20 20 20 20 20 20 28 -try-time (
8700: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 current-seconds)
8710: 29 0a 09 28 74 69 6d 65 73 20 20 20 20 20 20 20 )..(times
8720: 20 20 20 20 20 20 20 28 6c 69 73 74 20 31 29 29 (list 1))
8730: 29 20 3b 3b 20 6d 69 6e 75 74 65 73 20 74 6f 20 ) ;; minutes to
8740: 77 61 69 74 20 62 65 66 6f 72 65 20 74 72 79 69 wait before tryi
8750: 6e 67 20 61 67 61 69 6e 20 74 6f 20 6b 69 63 6b ng again to kick
8760: 20 6f 66 66 20 72 75 6e 73 0a 20 20 20 20 3b 3b off runs. ;;
8770: 20 42 55 47 20 74 68 69 73 20 68 61 63 6b 20 6f BUG this hack o
8780: 66 20 62 72 75 74 65 20 66 6f 72 63 65 20 72 65 f brute force re
8790: 74 72 79 69 6e 67 20 77 6f 72 6b 73 20 71 75 69 trying works qui
87a0: 74 65 20 77 65 6c 6c 20 66 6f 72 20 6d 61 6e 79 te well for many
87b0: 20 63 61 73 65 73 20 62 75 74 20 0a 20 20 20 20 cases but .
87c0: 3b 3b 20 20 20 20 20 77 68 61 74 20 69 73 20 6e ;; what is n
87d0: 65 65 64 65 64 20 69 73 20 74 6f 20 63 68 65 63 eeded is to chec
87e0: 6b 20 74 68 65 20 64 62 20 66 6f 72 20 74 65 73 k the db for tes
87f0: 74 73 20 74 68 61 74 20 68 61 76 65 20 66 61 69 ts that have fai
8800: 6c 65 64 20 6c 65 73 73 20 74 68 61 6e 0a 20 20 led less than.
8810: 20 20 3b 3b 20 20 20 20 20 4e 20 74 69 6d 65 73 ;; N times
8820: 20 6f 72 20 6e 65 76 65 72 20 62 65 65 6e 20 73 or never been s
8830: 74 61 72 74 65 64 20 61 6e 64 20 6b 69 63 6b 20 tarted and kick
8840: 74 68 65 6d 20 6f 66 66 20 61 67 61 69 6e 0a 20 them off again.
8850: 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 77 (let loop ((w
8860: 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 aiting-test-name
8870: 73 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 s (hash-table-ke
8880: 79 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 ys *waiting-queu
8890: 65 2a 29 29 29 0a 20 20 20 20 20 20 28 63 6f 6e e*))). (con
88a0: 64 0a 20 20 20 20 20 20 20 28 28 6e 6f 74 20 28 d. ((not (
88b0: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
88c0: 65 2d 74 65 73 74 73 20 64 62 29 29 0a 09 28 74 e-tests db))..(t
88d0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 32 29 0a hread-sleep! 2).
88e0: 09 28 6c 6f 6f 70 20 77 61 69 74 69 6e 67 2d 74 .(loop waiting-t
88f0: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 20 20 20 20 est-names)).
8900: 20 20 20 28 28 6e 75 6c 6c 3f 20 77 61 69 74 69 ((null? waiti
8910: 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 73 29 0a 09 ng-test-names)..
8920: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
8930: 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 All tests launch
8940: 65 64 22 29 29 0a 20 20 20 20 20 20 20 28 65 6c ed")). (el
8950: 73 65 0a 09 28 73 65 74 21 20 6e 75 6d 74 72 69 se..(set! numtri
8960: 65 73 20 28 2b 20 6e 75 6d 74 72 69 65 73 20 31 es (+ numtries 1
8970: 29 29 0a 09 28 66 6f 72 2d 65 61 63 68 20 28 6c ))..(for-each (l
8980: 61 6d 62 64 61 20 28 74 65 73 74 6e 61 6d 65 29 ambda (testname)
8990: 0a 09 09 20 20 20 20 28 69 66 20 28 72 75 6e 73 ... (if (runs
89a0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
89b0: 73 74 73 20 64 62 29 0a 09 09 09 28 6c 65 74 2a sts db)....(let*
89c0: 20 28 28 74 65 73 74 64 61 74 20 28 68 61 73 68 ((testdat (hash
89d0: 2d 74 61 62 6c 65 2d 72 65 66 20 2a 77 61 69 74 -table-ref *wait
89e0: 69 6e 67 2d 71 75 65 75 65 2a 20 74 65 73 74 6e ing-queue* testn
89f0: 61 6d 65 29 29 0a 09 09 09 20 20 20 20 20 20 20 ame))....
8a00: 28 70 72 65 72 65 71 73 20 28 28 63 61 72 20 74 (prereqs ((car t
8a10: 65 73 74 64 61 74 29 29 29 0a 09 09 09 20 20 20 estdat)))....
8a20: 20 20 20 20 28 6c 64 62 20 20 20 20 20 28 69 66 (ldb (if
8a30: 20 64 62 20 64 62 20 28 6f 70 65 6e 2d 64 62 29 db db (open-db)
8a40: 29 29 29 0a 09 09 09 20 20 28 64 65 62 75 67 3a ))).... (debug:
8a50: 70 72 69 6e 74 20 32 20 22 70 72 65 72 65 71 73 print 2 "prereqs
8a60: 20 72 65 6d 61 69 6e 69 6e 67 3a 20 22 20 70 72 remaining: " pr
8a70: 65 72 65 71 73 29 0a 09 09 09 20 20 28 69 66 20 ereqs).... (if
8a80: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 29 0a (null? prereqs).
8a90: 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a ... (begin.
8aa0: 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ....(debug:print
8ab0: 20 32 20 22 50 72 65 72 65 71 75 69 73 69 74 65 2 "Prerequisite
8ac0: 73 20 6d 65 74 2c 20 6c 61 75 6e 63 68 69 6e 67 s met, launching
8ad0: 20 22 20 74 65 73 74 6e 61 6d 65 29 0a 09 09 09 " testname)....
8ae0: 09 28 28 63 61 64 72 20 74 65 73 74 64 61 74 29 .((cadr testdat)
8af0: 29 0a 09 09 09 09 28 68 61 73 68 2d 74 61 62 6c ).....(hash-tabl
8b00: 65 2d 64 65 6c 65 74 65 21 20 2a 77 61 69 74 69 e-delete! *waiti
8b10: 6e 67 2d 71 75 65 75 65 2a 20 74 65 73 74 6e 61 ng-queue* testna
8b20: 6d 65 29 29 29 0a 09 09 09 20 20 28 69 66 20 28 me))).... (if (
8b30: 6e 6f 74 20 64 62 29 0a 09 09 09 20 20 20 20 20 not db)....
8b40: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 (sqlite3:finali
8b50: 7a 65 21 20 6c 64 62 29 29 29 29 29 0a 09 09 20 ze! ldb)))))...
8b60: 20 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 waiting-test-na
8b70: 6d 65 73 29 0a 09 3b 3b 20 28 73 6c 65 65 70 20 mes)..;; (sleep
8b80: 31 30 29 20 3b 3b 20 6e 6f 20 70 6f 69 6e 74 20 10) ;; no point
8b90: 69 6e 20 72 75 73 68 69 6e 67 20 74 68 69 6e 67 in rushing thing
8ba0: 73 20 61 74 20 74 68 69 73 20 73 74 61 67 65 3f s at this stage?
8bb0: 0a 09 28 6c 6f 6f 70 20 28 68 61 73 68 2d 74 61 ..(loop (hash-ta
8bc0: 62 6c 65 2d 6b 65 79 73 20 2a 77 61 69 74 69 6e ble-keys *waitin
8bd0: 67 2d 71 75 65 75 65 2a 29 29 29 29 29 29 29 0a g-queue*))))))).
8be0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
8bf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8c00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8c10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8c20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 =========.;; New
8c30: 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 methodology. Th
8c40: 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69 6c ese routines wil
8c50: 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61 62 l replace the ab
8c60: 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 ove in time. For
8c70: 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 .;; now the code
8c80: 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e 20 is duplicated.
8c90: 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69 6e This stuff is in
8ca0: 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 itially used in
8cb0: 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 the monitor.;; b
8cc0: 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d ased code..;;===
8cd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8ce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8cf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8d00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8d10: 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 ===..;; register
8d20: 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 74 68 a test run with
8d30: 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e 65 20 the db.(define
8d40: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 (runs:register-r
8d50: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 un db keys keyva
8d60: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 llst runname sta
8d70: 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29 0a te status user).
8d80: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 (debug:print 3
8d90: 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d "runs:register-
8da0: 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 run, keys: " key
8db0: 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 s " keyvallst: "
8dc0: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72 75 6e keyvallst " run
8dd0: 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 name: " runname
8de0: 22 20 73 74 61 74 65 3a 20 22 20 73 74 61 74 65 " state: " state
8df0: 20 22 20 73 74 61 74 75 73 3a 20 22 20 73 74 61 " status: " sta
8e00: 74 75 73 20 22 20 75 73 65 72 3a 20 22 20 75 73 tus " user: " us
8e10: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 er). (let* ((ke
8e20: 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b ystr (keys->k
8e30: 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09 20 28 eystr keys)).. (
8e40: 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20 28 3e comma (if (>
8e50: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 (length keys) 0
8e60: 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28 61 6e ) "," "")).. (an
8e70: 64 73 74 72 20 20 20 20 28 69 66 20 28 3e 20 28 dstr (if (> (
8e80: 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 length keys) 0)
8e90: 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09 20 28 " AND " "")).. (
8ea0: 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d valslots (keys-
8eb0: 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 >valslots keys))
8ec0: 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 ;; ?,?,? .....
8ed0: 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61 70 20 (keyvals (map
8ee0: 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 cadr keyvallst))
8ef0: 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 .. (allvals (a
8f00: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e ppend (list runn
8f10: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 ame state status
8f20: 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73 29 29 user) keyvals))
8f30: 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20 28 61 .. (qryvals (a
8f40: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e ppend (list runn
8f50: 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 ame) keyvals))..
8f60: 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 (key=?str (str
8f70: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
8f80: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 (map (lambda (k)
8f90: 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 (conc (key:get-f
8fa0: 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 ieldname k) "=?"
8fb0: 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 )) keys) " AND "
8fc0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ))). (debug:p
8fd0: 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 rint 3 "keys: "
8fe0: 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 keys " allvals:
8ff0: 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 " allvals " keyv
9000: 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a als: " keyvals).
9010: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
9020: 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 2 "NOTE: using
9030: 74 61 72 67 65 74 20 22 20 28 73 74 72 69 6e 67 target " (string
9040: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 -intersperse key
9050: 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f 72 20 vals "/") " for
9060: 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 20 28 this run"). (
9070: 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 if (and runname
9080: 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 (null? (filter (
9090: 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 78 lambda (x)(not x
90a0: 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b )) keyvals))) ;;
90b0: 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 20 61 there must be a
90c0: 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20 22 better way to "
90d0: 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 apply and"..(let
90e0: 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 20 28 ((res #f)).. (
90f0: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 apply sqlite3:ex
9100: 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 20 22 ecute db (conc "
9110: 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 INSERT OR IGNORE
9120: 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e INTO runs (runn
9130: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
9140: 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d ,owner,event_tim
9150: 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 e" comma keystr
9160: 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f ") VALUES (?,?,?
9170: 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27 ,?,strftime('%s'
9180: 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 ,'now')" comma v
9190: 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 alslots ");")...
91a0: 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 allvals).. (ap
91b0: 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d ply sqlite3:for-
91c0: 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c each-row .. (l
91d0: 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 20 20 ambda (id)..
91e0: 20 28 73 65 74 21 20 72 65 73 20 69 64 29 29 0a (set! res id)).
91f0: 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 74 20 . db.. (let
9200: 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 45 4c ((qry (conc "SEL
9210: 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 ECT id FROM runs
9220: 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d WHERE (runname=
9230: 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f ? " andstr key=?
9240: 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 20 20 str ");")))..
9250: 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;(debug:print
9260: 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 20 0a 4 "qry: " qry) .
9270: 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 20 71 . qry).. q
9280: 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 ryvals).. (sqli
9290: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
92a0: 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 54 20 UPDATE runs SET
92b0: 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f state=?,status=?
92c0: 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 WHERE id=?;" st
92d0: 61 74 65 20 73 74 61 74 75 73 20 72 65 73 29 0a ate status res).
92e0: 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 69 6e . res) ..(begin
92f0: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
9300: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 0 "ERROR: Calle
9310: 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 d without all ne
9320: 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 0a 09 cessary keys")..
9330: 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 #f))))..;; Thi
9340: 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 65 s is a duplicate
9350: 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28 77 of run-tests (w
9360: 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64 65 hich has been de
9370: 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20 74 precated). Use t
9380: 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 his one instead
9390: 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b of run tests..;;
93a0: 20 6b 65 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 keyvals.(define
93b0: 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 (runs:run-tests
93c0: 20 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61 db target runna
93d0: 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 69 74 me test-patts it
93e0: 65 6d 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c em-patts user fl
93f0: 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b ags). (let* ((k
9400: 65 79 73 20 20 20 20 20 20 20 20 28 64 62 2d 67 eys (db-g
9410: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 et-keys db)).. (
9420: 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b 65 79 keyvallst (key
9430: 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c s:target->keyval
9440: 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 keys target))..
9450: 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20 28 72 (run-id (r
9460: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e uns:register-run
9470: 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c db keys keyvall
9480: 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 st runname "new"
9490: 20 22 6e 2f 61 22 20 75 73 65 72 29 29 20 20 3b "n/a" user)) ;
94a0: 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a ; test-name))).
94b0: 09 20 28 64 65 66 65 72 72 65 64 20 20 20 20 27 . (deferred '
94c0: 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e ()) ;; delay run
94d0: 6e 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 65 ning these since
94e0: 20 74 68 65 79 20 68 61 76 65 20 61 20 77 61 69 they have a wai
94f0: 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 28 6b 65 ton clause.. (ke
9500: 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 2d epgoing (hash-
9510: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
9520: 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f t flags "-keepgo
9530: 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65 73 ing" #f)).. (tes
9540: 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09 20 t-names '())..
9550: 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 (runconfigf (c
9560: 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 onc *toppath* "
9570: 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 /runconfigs.conf
9580: 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 65 ig")).. (require
9590: 64 2d 74 65 73 74 73 20 27 28 29 29 29 0a 0a 20 d-tests '()))..
95a0: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 (if (file-exi
95b0: 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 sts? runconfigf)
95c0: 0a 09 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 ..(setup-env-def
95d0: 61 75 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 aults db runconf
95e0: 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 igf run-id *alre
95f0: 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 ady-seen-runconf
9600: 69 67 2d 69 6e 66 6f 2a 29 0a 09 28 64 65 62 75 ig-info*)..(debu
9610: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
9620: 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68 NG: You do not h
9630: 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 67 ave a run config
9640: 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66 file: " runconf
9650: 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 3b igf)). . ;
9660: 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65 ; look up all te
9670: 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 65 sts matching the
9680: 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 64 comma separated
9690: 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 69 list of globs i
96a0: 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 61 n. ;; test-pa
96b0: 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 20 tts (using % as
96c0: 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 28 66 wildcard). (f
96d0: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
96e0: 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 20 20 ambda (patt).
96f0: 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74 73 (let ((tests
9700: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74 6f (glob (conc *to
9710: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 ppath* "/tests/"
9720: 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c 61 (string-transla
9730: 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22 29 te patt "%" "*")
9740: 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 65 73 )))).. (set! tes
9750: 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 ts (filter (lamb
9760: 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 2d 65 da (test)(file-e
9770: 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65 73 xists? (conc tes
9780: 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 t "/testconfig")
9790: 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 73 65 )) tests)).. (se
97a0: 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 61 t! test-names (a
97b0: 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65 73 ppend test-names
97c0: 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 6c 61 ..... (map (la
97d0: 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 09 09 mbda (testp)....
97e0: 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 6e 67 .. (last (string
97f0: 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 2f 22 -split testp "/"
9800: 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 74 )))..... t
9810: 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 20 28 ests))))). (
9820: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 string-split tes
9830: 74 2d 70 61 74 74 73 20 22 2c 22 29 29 0a 0a 20 t-patts ","))..
9840: 20 20 20 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 ;; now remov
9850: 65 20 64 75 70 6c 69 63 61 74 65 73 0a 20 20 20 e duplicates.
9860: 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 (set! test-name
9870: 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 s (delete-duplic
9880: 61 74 65 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 ates test-names)
9890: 29 0a 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 ).. (debug:pr
98a0: 69 6e 74 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 int 0 "INFO: tes
98b0: 74 20 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e t names " test-n
98c0: 61 6d 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6e 6f ames).. ;; no
98d0: 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 74 w add non-direct
98e0: 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 65 ly referenced de
98f0: 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 2e pendencies (i.e.
9900: 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 3b 3b 20 waiton). ;;
9910: 63 6f 75 6c 64 20 63 61 63 68 65 20 61 6c 6c 20 could cache all
9920: 74 68 65 73 65 20 73 69 6e 63 65 20 74 68 65 79 these since they
9930: 20 6e 65 65 64 20 74 6f 20 62 65 20 72 65 61 64 need to be read
9940: 20 61 67 61 69 6e 20 2e 2e 2e 0a 20 20 20 20 3b again .... ;
9950: 3b 20 46 49 58 4d 45 20 53 4f 4d 45 44 41 59 0a ; FIXME SOMEDAY.
9960: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
9970: 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 ll? test-names))
9980: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 ..(let loop ((he
9990: 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d 65 d (car test-name
99a0: 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 63 s))... (tal (c
99b0: 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 dr test-names)))
99c0: 0a 09 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 .. (let* ((conf
99d0: 69 67 20 20 28 74 65 73 74 3a 67 65 74 2d 74 65 ig (test:get-te
99e0: 73 74 63 6f 6e 66 69 67 20 68 65 64 20 23 66 29 stconfig hed #f)
99f0: 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 28 73 )... (waitons (s
9a00: 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 6c 65 74 tring-split (let
9a10: 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f ((w (config-loo
9a20: 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 kup config "requ
9a30: 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f irements" "waito
9a40: 6e 22 29 29 29 0a 09 09 09 09 09 20 20 28 69 66 n")))...... (if
9a50: 20 77 20 77 20 22 22 29 29 29 29 29 0a 09 20 20 w w "")))))..
9a60: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 (for-each ..
9a70: 20 20 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 (lambda (wait
9a80: 6f 6e 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 on).. (if
9a90: 28 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 (and waiton (not
9aa0: 20 28 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 (member waiton
9ab0: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 test-names)))...
9ac0: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 (begin...
9ad0: 20 28 73 65 74 21 20 72 65 71 75 69 72 65 64 2d (set! required-
9ae0: 74 65 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 tests (cons wait
9af0: 6f 6e 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 on required-test
9b00: 73 29 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 s))... (set!
9b10: 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 61 70 70 test-names (app
9b20: 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 end test-names (
9b30: 6c 69 73 74 20 77 61 69 74 6f 6e 29 29 29 29 29 list waiton)))))
9b40: 29 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 ).. waitons)
9b50: 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d .. (let ((rem
9b60: 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 tests (delete-du
9b70: 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 plicates (append
9b80: 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 waitons tal))))
9b90: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 .. (if (not
9ba0: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 (null? remtests
9bb0: 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 ))... (loop (ca
9bc0: 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 r remtests)(cdr
9bd0: 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a remtests))))))).
9be0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
9bf0: 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 ull? required-te
9c00: 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 sts))..(debug:pr
9c10: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 int 1 "INFO: Add
9c20: 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 ing " required-t
9c30: 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 ests " to the ru
9c40: 6e 20 71 75 65 75 65 22 29 29 0a 0a 20 20 20 20 n queue"))..
9c50: 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 ;; on the first
9c60: 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 pass or call to
9c70: 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 run-tests set FA
9c80: 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 ILS to NOT_START
9c90: 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 ED if. ;; -ke
9ca0: 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 epgoing is speci
9cb0: 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 61 6e fied. (if (an
9cc0: 64 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d 2a d (eq? *passnum*
9cd0: 20 30 29 0a 09 20 20 20 20 20 6b 65 65 70 67 6f 0).. keepgo
9ce0: 69 6e 67 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 ing)..(begin..
9cf0: 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74 ;; have to delet
9d00: 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77 e test records w
9d10: 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 here NOT_STARTED
9d20: 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20 since they can
9d30: 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 cause -keepgoing
9d40: 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 to .. ;; get s
9d50: 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f tuck due to beco
9d60: 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c ming inaccessibl
9d70: 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 e from a failed
9d80: 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 test. I.e. if te
9d90: 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20 st B depends ..
9da0: 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75 ;; on test A bu
9db0: 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64 t test B reached
9dc0: 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 the point on be
9dd0: 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61 ing registered a
9de0: 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e s NOT_STARTED an
9df0: 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 d test.. ;; A f
9e00: 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 ailed for some r
9e10: 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 eason then on re
9e20: 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 -run using -keep
9e30: 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61 going the run ca
9e40: 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 n never complete
9e50: 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d ... (db:delete-
9e60: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 tests-in-state d
9e70: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 b run-id "NOT_ST
9e80: 41 52 54 45 44 22 29 0a 09 20 20 28 64 62 3a 73 ARTED").. (db:s
9e90: 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 et-tests-state-s
9ea0: 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 20 tatus db run-id
9eb0: 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 test-names #f "F
9ec0: 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 AIL" "NOT_STARTE
9ed0: 44 22 20 22 46 41 49 4c 22 29 29 29 0a 20 20 20 D" "FAIL"))).
9ee0: 20 28 73 65 74 21 20 2a 70 61 73 73 6e 75 6d 2a (set! *passnum*
9ef0: 20 28 2b 20 2a 70 61 73 73 6e 75 6d 2a 20 31 29 (+ *passnum* 1)
9f00: 29 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 ). (let loop
9f10: 28 28 6e 75 6d 74 69 6d 65 73 20 30 29 29 0a 20 ((numtimes 0)).
9f20: 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a (for-each .
9f30: 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 (lambda (
9f40: 74 65 73 74 2d 6e 61 6d 65 29 0a 09 20 28 69 66 test-name).. (if
9f50: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d (runs:can-run-m
9f60: 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a 09 20 ore-tests db)..
9f70: 20 20 20 20 28 72 75 6e 3a 74 65 73 74 20 64 62 (run:test db
9f80: 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 run-id runname
9f90: 74 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 61 6c test-name keyval
9fa0: 6c 73 74 20 69 74 65 6d 2d 70 61 74 74 73 20 66 lst item-patts f
9fb0: 6c 61 67 73 29 0a 09 20 20 20 20 20 29 29 0a 20 lags).. )).
9fc0: 20 20 20 20 20 20 28 74 65 73 74 73 3a 73 6f 72 (tests:sor
9fd0: 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e t-by-priority-an
9fe0: 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 d-waiton test-na
9ff0: 6d 65 73 29 29 0a 20 20 20 20 20 20 3b 3b 20 28 mes)). ;; (
a000: 72 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 run-waiting-test
a010: 73 20 64 62 29 0a 20 20 20 20 20 20 28 69 66 20 s db). (if
a020: 6b 65 65 70 67 6f 69 6e 67 0a 09 20 20 28 6c 65 keepgoing.. (le
a030: 74 20 28 28 65 73 74 72 65 6d 20 28 64 62 3a 65 t ((estrem (db:e
a040: 73 74 69 6d 61 74 65 64 2d 74 65 73 74 73 2d 72 stimated-tests-r
a050: 65 6d 61 69 6e 69 6e 67 20 64 62 20 72 75 6e 2d emaining db run-
a060: 69 64 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 id))).. (if (
a070: 61 6e 64 20 28 3e 20 65 73 74 72 65 6d 20 30 29 and (> estrem 0)
a080: 0a 09 09 20 20 20 20 20 28 65 71 3f 20 2a 67 6c ... (eq? *gl
a090: 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 obalexitstatus*
a0a0: 30 29 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 0))...(begin...
a0b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
a0c0: 22 4b 65 65 70 20 67 6f 69 6e 67 2c 20 65 73 74 "Keep going, est
a0d0: 69 6d 61 74 65 64 20 22 20 65 73 74 72 65 6d 20 imated " estrem
a0e0: 22 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e " tests remainin
a0f0: 67 20 74 6f 20 72 75 6e 2c 20 77 69 6c 6c 20 63 g to run, will c
a100: 6f 6e 74 69 6e 75 65 20 69 6e 20 33 20 73 65 63 ontinue in 3 sec
a110: 6f 6e 64 73 20 2e 2e 2e 22 29 0a 09 09 20 20 28 onds ...")... (
a120: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 33 29 thread-sleep! 3)
a130: 0a 09 09 20 20 28 72 75 6e 2d 77 61 69 74 69 6e ... (run-waitin
a140: 67 2d 74 65 73 74 73 20 64 62 29 0a 09 09 20 20 g-tests db)...
a150: 28 6c 6f 6f 70 20 28 2b 20 6e 75 6d 74 69 6d 65 (loop (+ numtime
a160: 73 20 31 29 29 29 29 29 29 29 29 29 0a 0a 28 64 s 1)))))))))..(d
a170: 65 66 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 efine (run:test
a180: 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d db run-id runnam
a190: 65 20 74 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 e test-name keyv
a1a0: 61 6c 6c 73 74 20 69 74 65 6d 2d 70 61 74 74 73 allst item-patts
a1b0: 20 66 6c 61 67 73 29 0a 20 20 28 64 65 62 75 67 flags). (debug
a1c0: 3a 70 72 69 6e 74 20 31 20 22 4c 61 75 6e 63 68 :print 1 "Launch
a1d0: 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d ing test " test-
a1e0: 6e 61 6d 65 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 name). ;; All t
a1f0: 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 hese vars might
a200: 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 be referenced by
a210: 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 the testconfig
a220: 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 73 file reader. (s
a230: 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e etenv "MT_TEST_N
a240: 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 AME" test-name)
a250: 3b 3b 20 0a 20 20 28 73 65 74 65 6e 76 20 22 4d ;; . (setenv "M
a260: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e T_RUNNAME" run
a270: 6e 61 6d 65 29 0a 20 20 28 73 65 74 2d 6d 65 67 name). (set-meg
a280: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 atest-env-vars d
a290: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 b run-id) ;; the
a2a0: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 se may be needed
a2b0: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e by the launchin
a2c0: 67 20 70 72 6f 63 65 73 73 0a 20 20 28 63 68 61 g process. (cha
a2d0: 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 nge-directory *t
a2e0: 6f 70 70 61 74 68 2a 29 0a 20 20 28 6c 65 74 2a oppath*). (let*
a2f0: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 ((test-path
a300: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
a310: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
a320: 61 6d 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 ame)) ;; could u
a330: 73 65 20 74 65 73 74 3a 67 65 74 2d 74 65 73 74 se test:get-test
a340: 63 6f 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a config here ....
a350: 09 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 . (test-configf
a360: 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 (conc test-path
a370: 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a "/testconfig")).
a380: 09 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 . (testexists
a390: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 (and (file-exist
a3a0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
a3b0: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 (file-read-acces
a3c0: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
a3d0: 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 )).. (test-conf
a3e0: 20 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74 (if testexist
a3f0: 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 s (read-config t
a400: 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 est-configf #f #
a410: 74 29 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 t) (make-hash-ta
a420: 62 6c 65 29 29 29 0a 09 20 28 77 61 69 74 6f 6e ble))).. (waiton
a430: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 77 20 (let ((w
a440: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 (config-lookup t
a450: 65 73 74 2d 63 6f 6e 66 20 22 72 65 71 75 69 72 est-conf "requir
a460: 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 ements" "waiton"
a470: 29 29 29 0a 09 09 09 20 28 69 66 20 28 73 74 72 ))).... (if (str
a480: 69 6e 67 3f 20 77 29 28 73 74 72 69 6e 67 2d 73 ing? w)(string-s
a490: 70 6c 69 74 20 77 29 27 28 29 29 29 29 0a 09 20 plit w)'())))..
a4a0: 28 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 (force (h
a4b0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
a4c0: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f fault flags "-fo
a4d0: 72 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 rce" #f)).. (rer
a4e0: 75 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d un (hash-
a4f0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
a500: 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 t flags "-rerun"
a510: 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 #f)).. (keepgoi
a520: 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c ng (hash-tabl
a530: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c e-ref/default fl
a540: 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 ags "-keepgoing"
a550: 20 23 66 29 29 0a 09 20 3b 3b 20 41 72 65 20 74 #f)).. ;; Are t
a560: 68 65 73 65 20 74 61 67 73 20 73 74 69 6c 6c 20 hese tags still
a570: 75 73 65 64 3f 20 49 20 64 6f 6e 27 74 20 74 68 used? I don't th
a580: 69 6e 6b 20 73 6f 2e 2e 2e 0a 09 20 3b 3b 28 74 ink so..... ;;(t
a590: 61 67 73 20 20 20 20 20 20 20 20 20 28 6c 65 74 ags (let
a5a0: 20 28 28 74 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f ((t (config-loo
a5b0: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 73 kup test-conf "s
a5c0: 65 74 75 70 22 20 22 74 61 67 73 22 29 29 29 0a etup" "tags"))).
a5d0: 09 20 3b 3b 20 20 20 20 20 20 20 09 20 3b 3b 20 . ;; . ;;
a5e0: 77 65 20 77 61 6e 74 20 6f 75 72 20 74 61 67 73 we want our tags
a5f0: 20 74 6f 20 62 65 20 73 65 70 61 72 61 74 65 64 to be separated
a600: 20 62 79 20 63 6f 6d 6d 61 73 20 61 6e 64 20 66 by commas and f
a610: 75 6c 6c 79 20 64 65 6c 69 6d 69 74 65 64 20 62 ully delimited b
a620: 79 20 63 6f 6d 6d 61 73 0a 09 20 3b 3b 20 20 20 y commas.. ;;
a630: 20 20 20 20 09 20 3b 3b 20 73 6f 20 74 68 61 74 . ;; so that
a640: 20 71 75 65 72 69 65 73 20 77 69 74 68 20 22 6c queries with "l
a650: 69 6b 65 22 20 63 61 6e 20 74 69 65 20 74 6f 20 ike" can tie to
a660: 74 68 65 20 63 6f 6d 6d 61 73 20 61 74 20 65 69 the commas at ei
a670: 74 68 65 72 20 65 6e 64 20 6f 66 20 65 61 63 68 ther end of each
a680: 20 74 61 67 0a 09 20 3b 3b 20 20 20 20 20 20 20 tag.. ;;
a690: 09 20 3b 3b 20 77 68 69 6c 65 20 61 6c 73 6f 20 . ;; while also
a6a0: 61 6c 6c 6f 77 69 6e 67 20 74 68 65 20 65 6e 64 allowing the end
a6b0: 20 75 73 65 72 20 74 6f 20 66 72 65 65 6c 79 20 user to freely
a6c0: 75 73 65 20 73 70 61 63 65 73 20 61 6e 64 20 63 use spaces and c
a6d0: 6f 6d 6d 61 73 20 74 6f 20 73 65 70 61 72 61 74 ommas to separat
a6e0: 65 20 74 61 67 73 0a 09 20 3b 3b 20 20 20 20 20 e tags.. ;;
a6f0: 20 20 09 20 28 69 66 20 28 73 74 72 69 6e 67 3f . (if (string?
a700: 20 74 29 28 73 74 72 69 6e 67 2d 73 75 62 73 74 t)(string-subst
a710: 69 74 75 74 65 20 28 72 65 67 65 78 70 20 22 5b itute (regexp "[
a720: 2c 5c 5c 73 5d 2b 22 29 20 22 2c 22 20 28 63 6f ,\\s]+") "," (co
a730: 6e 63 20 22 2c 22 20 74 20 22 2c 22 29 20 23 74 nc "," t ",") #t
a740: 29 0a 09 20 3b 3b 20 20 20 20 20 20 20 09 20 20 ).. ;; .
a750: 20 20 20 27 28 29 29 29 29 29 0a 09 20 29 0a 20 '())))).. ).
a760: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 (if (not test
a770: 65 78 69 73 74 73 29 0a 09 3b 3b 20 69 66 20 74 exists)..;; if t
a780: 68 65 20 74 65 73 74 20 69 73 20 69 6c 6c 20 64 he test is ill d
a790: 65 66 69 6e 65 64 20 73 70 69 74 20 6f 75 74 20 efined spit out
a7a0: 61 6e 20 65 72 72 6f 72 20 62 75 74 20 6b 65 65 an error but kee
a7b0: 70 20 67 6f 69 6e 67 20 28 64 69 66 66 65 72 65 p going (differe
a7c0: 6e 74 20 66 72 6f 6d 20 68 6f 77 20 64 6f 6e 65 nt from how done
a7d0: 20 70 72 65 76 69 6f 75 73 6c 79 0a 09 28 64 65 previously..(de
a7e0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
a7f0: 4f 52 3a 20 43 61 6e 27 74 20 66 69 6e 64 20 63 OR: Can't find c
a800: 6f 6e 66 69 67 20 66 69 6c 65 20 22 20 74 65 73 onfig file " tes
a810: 74 2d 63 6f 6e 66 69 67 66 29 0a 09 3b 3b 20 70 t-configf)..;; p
a820: 75 74 20 74 6f 70 20 76 61 72 73 20 69 6e 74 6f ut top vars into
a830: 20 63 6f 6e 76 65 6e 69 65 6e 74 20 76 61 72 69 convenient vari
a840: 61 62 6c 65 73 20 61 6e 64 20 6f 70 65 6e 20 74 ables and open t
a850: 68 65 20 64 62 0a 09 28 6c 65 74 2a 20 28 3b 3b he db..(let* (;;
a860: 20 64 62 20 69 73 20 61 6c 77 61 79 73 20 61 74 db is always at
a870: 20 2a 74 6f 70 70 61 74 68 2a 2f 64 62 2f 6d 65 *toppath*/db/me
a880: 67 61 74 65 73 74 2e 64 62 0a 09 20 20 20 20 20 gatest.db..
a890: 20 20 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 (items (
a8a0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
a8b0: 65 66 61 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 efault test-conf
a8c0: 20 22 69 74 65 6d 73 22 20 27 28 29 29 29 0a 09 "items" '()))..
a8d0: 20 20 20 20 20 20 20 28 69 74 65 6d 73 74 61 62 (itemstab
a8e0: 6c 65 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d le (hash-table-
a8f0: 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 ref/default test
a900: 2d 63 6f 6e 66 20 22 69 74 65 6d 73 74 61 62 6c -conf "itemstabl
a910: 65 22 20 27 28 29 29 29 0a 09 20 20 20 20 20 20 e" '()))..
a920: 20 28 61 6c 6c 69 74 65 6d 73 20 20 20 20 28 69 (allitems (i
a930: 66 20 28 6f 72 20 28 6e 6f 74 20 28 6e 75 6c 6c f (or (not (null
a940: 3f 20 69 74 65 6d 73 29 29 28 6e 6f 74 20 28 6e ? items))(not (n
a950: 75 6c 6c 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 ull? itemstable)
a960: 29 29 0a 09 09 09 09 28 61 70 70 65 6e 64 20 28 )).....(append (
a970: 69 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d item-assoc->item
a980: 2d 6c 69 73 74 20 69 74 65 6d 73 29 0a 09 09 09 -list items)....
a990: 09 09 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 ..(item-table->i
a9a0: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 tem-list itemsta
a9b0: 62 6c 65 29 29 0a 09 09 09 09 27 28 28 29 29 29 ble)).....'(()))
a9c0: 29 29 20 3b 3b 20 61 20 6c 69 73 74 20 77 69 74 )) ;; a list wit
a9d0: 68 20 6f 6e 65 20 6e 75 6c 6c 20 6c 69 73 74 20 h one null list
a9e0: 69 73 20 61 20 74 65 73 74 20 77 69 74 68 20 6e is a test with n
a9f0: 6f 20 69 74 65 6d 73 0a 09 20 20 3b 3b 20 28 72 o items.. ;; (r
aa00: 75 6e 63 6f 6e 66 69 67 66 20 20 28 63 6f 6e 63 unconfigf (conc
aa10: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 *toppath* "/ru
aa20: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 nconfigs.config"
aa30: 29 29 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 ))).. (debug:pr
aa40: 69 6e 74 20 31 20 22 69 74 65 6d 73 3a 20 22 29 int 1 "items: ")
aa50: 0a 09 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 .. (if (>= *ver
aa60: 62 6f 73 69 74 79 2a 20 31 29 28 70 70 20 61 6c bosity* 1)(pp al
aa70: 6c 69 74 65 6d 73 29 29 0a 09 20 20 28 69 66 20 litems)).. (if
aa80: 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 (>= *verbosity*
aa90: 35 29 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e 5).. (begin
aaa0: 0a 09 09 28 70 72 69 6e 74 20 22 69 74 65 6d 73 ...(print "items
aab0: 3a 20 22 29 28 70 70 20 28 69 74 65 6d 2d 61 73 : ")(pp (item-as
aac0: 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 soc->item-list i
aad0: 74 65 6d 73 29 29 0a 09 09 28 70 72 69 6e 74 20 tems))...(print
aae0: 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 "itemstable: ")(
aaf0: 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e pp (item-table->
ab00: 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 item-list itemst
ab10: 61 62 6c 65 29 29 29 29 0a 0a 09 20 20 3b 3b 20 able))))... ;;
ab20: 43 6f 6d 6d 65 6e 74 73 20 61 72 65 20 6c 6f 61 Comments are loa
ab30: 64 65 64 20 62 79 20 74 68 65 20 74 65 73 74 20 ded by the test
ab40: 72 75 6e 2c 20 6e 6f 74 20 61 74 20 6c 61 75 6e run, not at laun
ab50: 63 68 20 74 69 6d 65 20 28 69 6e 20 67 65 6e 65 ch time (in gene
ab60: 72 61 6c 29 0a 09 20 20 3b 3b 28 69 66 20 28 61 ral).. ;;(if (a
ab70: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6d 22 rgs:get-arg "-m"
ab80: 29 0a 09 20 20 3b 3b 20 20 20 20 28 64 62 3a 73 ).. ;; (db:s
ab90: 65 74 2d 63 6f 6d 6d 65 6e 74 2d 66 6f 72 2d 72 et-comment-for-r
aba0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 20 28 61 72 un db run-id (ar
abb0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6d 22 29 gs:get-arg "-m")
abc0: 29 29 0a 0a 09 20 20 3b 3b 20 48 65 72 65 20 69 ))... ;; Here i
abd0: 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 s where the test
abe0: 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 _meta table is b
abf0: 65 73 74 20 75 70 64 61 74 65 64 0a 09 20 20 28 est updated.. (
ac00: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 runs:update-test
ac10: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 _meta db test-na
ac20: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 0a 09 me test-conf)...
ac30: 20 20 3b 3b 20 62 72 61 69 6e 64 65 61 64 20 77 ;; braindead w
ac40: 6f 72 6b 2d 61 72 6f 75 6e 64 20 66 6f 72 20 70 ork-around for p
ac50: 6f 6f 72 6c 79 20 73 70 65 63 69 66 69 65 64 20 oorly specified
ac60: 61 6c 6c 69 74 65 6d 73 20 6c 69 73 74 20 42 55 allitems list BU
ac70: 47 21 21 21 20 46 49 58 4d 45 0a 09 20 20 28 69 G!!! FIXME.. (i
ac80: 66 20 28 6e 75 6c 6c 3f 20 61 6c 6c 69 74 65 6d f (null? allitem
ac90: 73 29 28 73 65 74 21 20 61 6c 6c 69 74 65 6d 73 s)(set! allitems
aca0: 20 27 28 28 29 29 29 29 0a 09 20 20 28 6c 65 74 '(()))).. (let
acb0: 20 6c 6f 6f 70 20 28 28 69 74 65 6d 64 61 74 20 loop ((itemdat
acc0: 28 63 61 72 20 61 6c 6c 69 74 65 6d 73 29 29 0a (car allitems)).
acd0: 09 09 20 20 20 20 20 28 74 61 6c 20 20 20 20 20 .. (tal
ace0: 28 63 64 72 20 61 6c 6c 69 74 65 6d 73 29 29 29 (cdr allitems)))
acf0: 0a 09 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 .. ;; (lambda
ad00: 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 (itemdat) ;;; (
ad10: 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 (ripeness "overr
ad20: 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 ipe") (temperatu
ad30: 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 re "cool") (seas
ad40: 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 09 20 on "summer"))..
ad50: 20 20 20 3b 3b 20 48 61 6e 64 6c 65 20 6c 69 73 ;; Handle lis
ad60: 74 73 20 6f 66 20 69 74 65 6d 73 0a 09 20 20 20 ts of items..
ad70: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 (let* ((item-pa
ad80: 74 68 20 20 20 20 20 28 69 74 65 6d 2d 6c 69 73 th (item-lis
ad90: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 t->path itemdat)
ada0: 29 20 3b 3b 20 28 73 74 72 69 6e 67 2d 69 6e 74 ) ;; (string-int
adb0: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 63 61 ersperse (map ca
adc0: 64 72 20 69 74 65 6d 64 61 74 29 20 22 2f 22 29 dr itemdat) "/")
add0: 29 0a 09 09 20 20 20 28 6e 65 77 2d 74 65 73 74 )... (new-test
ade0: 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e -path (string-in
adf0: 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 tersperse (cons
ae00: 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 test-path (map c
ae10: 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f adr itemdat)) "/
ae20: 22 29 29 0a 09 09 20 20 20 28 6e 65 77 2d 74 65 "))... (new-te
ae30: 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 st-name (if (equ
ae40: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 al? item-path ""
ae50: 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e ) test-name (con
ae60: 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 c test-name "/"
ae70: 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 item-path))) ;;
ae80: 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 just need it to
ae90: 62 65 20 75 6e 69 71 75 65 0a 09 09 20 20 20 28 be unique... (
aea0: 74 65 73 74 64 61 74 20 20 20 23 66 29 0a 09 09 testdat #f)...
aeb0: 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 (num-running
aec0: 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 (db:get-count-te
aed0: 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 sts-running db))
aee0: 0a 09 09 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 ... (max-concu
aef0: 72 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 rrent-jobs (conf
af00: 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 ig-lookup *confi
af10: 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d gdat* "setup" "m
af20: 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f ax_concurrent_jo
af30: 62 73 22 29 29 0a 09 09 20 20 20 28 70 61 72 65 bs"))... (pare
af40: 6e 74 2d 74 65 73 74 20 28 61 6e 64 20 28 6e 6f nt-test (and (no
af50: 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 29 t (null? items))
af60: 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 (equal? item-pat
af70: 68 20 22 22 29 29 29 0a 09 09 20 20 20 28 73 69 h "")))... (si
af80: 6e 67 6c 65 2d 74 65 73 74 20 28 61 6e 64 20 28 ngle-test (and (
af90: 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 20 28 65 71 null? items) (eq
afa0: 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 ual? item-path "
afb0: 22 29 29 29 0a 09 09 20 20 20 28 69 74 65 6d 2d ")))... (item-
afc0: 74 65 73 74 20 20 20 28 6e 6f 74 20 28 65 71 75 test (not (equ
afd0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 al? item-path ""
afe0: 29 29 29 0a 09 09 20 20 20 3b 3b 20 6c 6f 6f 6b )))... ;; look
aff0: 20 74 68 72 6f 75 67 68 20 61 6c 6c 20 74 68 65 through all the
b000: 20 69 74 65 6d 2d 70 61 74 74 73 20 69 66 20 64 item-patts if d
b010: 65 66 69 6e 65 64 2c 20 66 6f 72 6d 61 74 20 69 efined, format i
b020: 73 20 70 61 74 74 31 2c 70 61 74 74 32 2c 70 61 s patt1,patt2,pa
b030: 74 74 33 20 2e 2e 2e 20 77 69 6c 64 63 61 72 64 tt3 ... wildcard
b040: 20 69 73 20 25 0a 09 09 20 20 20 28 69 74 65 6d is %... (item
b050: 2d 6d 61 74 63 68 65 73 20 28 69 66 20 69 74 65 -matches (if ite
b060: 6d 2d 70 61 74 74 73 0a 09 09 09 09 20 20 20 20 m-patts.....
b070: 20 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 (let ((res #f))
b080: 0a 09 09 09 09 20 20 20 20 20 20 20 28 66 6f 72 ..... (for
b090: 2d 65 61 63 68 20 0a 09 09 09 09 09 28 6c 61 6d -each ......(lam
b0a0: 62 64 61 20 28 70 61 74 74 29 0a 09 09 09 09 09 bda (patt)......
b0b0: 20 20 28 69 66 20 28 73 74 72 69 6e 67 2d 73 65 (if (string-se
b0c0: 61 72 63 68 20 28 67 6c 6f 62 2d 3e 72 65 67 65 arch (glob->rege
b0d0: 78 70 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 xp........
b0e0: 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c 61 74 (string-translat
b0f0: 65 20 70 61 74 74 20 22 25 22 20 22 2a 22 29 29 e patt "%" "*"))
b100: 0a 09 09 09 09 09 09 09 20 20 20 20 20 69 74 65 ........ ite
b110: 6d 2d 70 61 74 68 29 0a 09 09 09 09 09 20 20 20 m-path)......
b120: 20 20 20 28 73 65 74 21 20 72 65 73 20 23 74 29 (set! res #t)
b130: 29 29 0a 09 09 09 09 09 28 73 74 72 69 6e 67 2d ))......(string-
b140: 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 74 73 split item-patts
b150: 20 22 2c 22 29 29 0a 09 09 09 09 20 20 20 20 20 ",")).....
b160: 20 20 72 65 73 29 0a 09 09 09 09 20 20 20 20 20 res).....
b170: 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 64 65 #t))).. (de
b180: 62 75 67 3a 70 72 69 6e 74 20 33 20 22 6d 61 78 bug:print 3 "max
b190: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
b1a0: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 : " max-concurre
b1b0: 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 nt-jobs ", num-r
b1c0: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 unning: " num-ru
b1d0: 6e 6e 69 6e 67 29 0a 09 20 20 20 20 20 20 28 69 nning).. (i
b1e0: 66 20 28 61 6e 64 20 69 74 65 6d 2d 6d 61 74 63 f (and item-matc
b1f0: 68 65 73 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 hes (runs:can-ru
b200: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 n-more-tests db)
b210: 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 )... (begin...
b220: 20 20 20 28 6c 65 74 20 6c 6f 6f 70 32 20 28 28 (let loop2 ((
b230: 74 73 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d ts (db:get-test-
b240: 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 info db run-id t
b250: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
b260: 74 68 29 29 20 3b 3b 20 23 66 29 0a 09 09 09 09 th)) ;; #f).....
b270: 28 63 74 20 30 29 29 0a 09 09 20 20 20 20 20 20 (ct 0))...
b280: 28 69 66 20 28 61 6e 64 20 28 6e 6f 74 20 74 73 (if (and (not ts
b290: 29 0a 09 09 09 20 20 20 20 20 20 20 28 3c 20 63 ).... (< c
b2a0: 74 20 31 30 29 29 0a 09 09 09 20 20 28 62 65 67 t 10)).... (beg
b2b0: 69 6e 0a 09 09 09 20 20 20 20 28 72 65 67 69 73 in.... (regis
b2c0: 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d ter-test db run-
b2d0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
b2e0: 6d 2d 70 61 74 68 29 0a 09 09 09 20 20 20 20 3b m-path).... ;
b2f0: 3b 20 57 68 79 20 64 69 64 20 49 20 73 65 74 20 ; Why did I set
b300: 74 68 65 20 63 6f 6d 6d 65 6e 74 20 68 65 72 65 the comment here
b310: 3f 21 3f 20 50 4f 53 53 49 42 4c 45 20 42 55 47 ?!? POSSIBLE BUG
b320: 20 42 55 54 20 49 27 4d 20 52 45 4d 4f 56 49 4e BUT I'M REMOVIN
b330: 47 20 49 54 20 46 4f 52 20 4e 4f 57 20 31 30 2f G IT FOR NOW 10/
b340: 32 33 2f 32 30 31 31 0a 09 09 09 20 20 20 20 3b 23/2011.... ;
b350: 3b 20 28 64 62 3a 74 65 73 74 2d 73 65 74 2d 63 ; (db:test-set-c
b360: 6f 6d 6d 65 6e 74 20 64 62 20 72 75 6e 2d 69 64 omment db run-id
b370: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
b380: 70 61 74 68 20 22 22 29 0a 09 09 09 20 20 20 20 path "")....
b390: 28 6c 6f 6f 70 32 20 28 64 62 3a 67 65 74 2d 74 (loop2 (db:get-t
b3a0: 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d est-info db run-
b3b0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
b3c0: 6d 2d 70 61 74 68 29 0a 09 09 09 09 20 20 20 28 m-path)..... (
b3d0: 2b 20 63 74 20 31 29 29 29 0a 09 09 09 20 20 28 + ct 1))).... (
b3e0: 69 66 20 74 73 0a 09 09 09 20 20 20 20 20 20 28 if ts.... (
b3f0: 73 65 74 21 20 74 65 73 74 64 61 74 20 74 73 29 set! testdat ts)
b400: 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e .... (begin
b410: 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e .....(debug:prin
b420: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 43 6f t 0 "WARNING: Co
b430: 75 6c 64 6e 27 74 20 72 65 67 69 73 74 65 72 20 uldn't register
b440: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 test " test-name
b450: 20 22 20 77 69 74 68 20 69 74 65 6d 20 70 61 74 " with item pat
b460: 68 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 2c h " item-path ",
b470: 20 73 6b 69 70 70 69 6e 67 22 29 0a 09 09 09 09 skipping").....
b480: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
b490: 74 61 6c 29 29 0a 09 09 09 09 20 20 20 20 28 6c tal))..... (l
b4a0: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 oop (car tal)(cd
b4b0: 72 20 74 61 6c 29 29 29 29 29 29 29 0a 09 09 20 r tal)))))))...
b4c0: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
b4d0: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a tory test-path).
b4e0: 09 09 20 20 20 20 3b 3b 20 74 68 69 73 20 62 6c .. ;; this bl
b4f0: 6f 63 6b 20 69 73 20 68 65 72 65 20 6f 6e 6c 79 ock is here only
b500: 20 74 6f 20 69 6e 66 6f 72 6d 20 74 68 65 20 75 to inform the u
b510: 73 65 72 20 65 61 72 6c 79 20 6f 6e 0a 09 09 20 ser early on...
b520: 20 20 20 0a 09 09 20 20 20 20 3b 3b 20 4d 6f 76 ... ;; Mov
b530: 69 6e 67 20 74 68 69 73 20 74 6f 20 74 68 65 20 ing this to the
b540: 72 75 6e 20 63 61 6c 6c 69 6e 67 20 62 6c 6f 63 run calling bloc
b550: 6b 0a 0a 09 09 20 20 20 20 3b 3b 20 28 69 66 20 k.... ;; (if
b560: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 (file-exists? ru
b570: 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 nconfigf)...
b580: 3b 3b 20 20 20 20 20 28 73 65 74 75 70 2d 65 6e ;; (setup-en
b590: 76 2d 64 65 66 61 75 6c 74 73 20 64 62 20 72 75 v-defaults db ru
b5a0: 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 nconfigf run-id
b5b0: 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 *already-seen-ru
b5c0: 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a 29 0a 09 nconfig-info*)..
b5d0: 09 20 20 20 20 3b 3b 20 20 20 20 20 28 64 65 62 . ;; (deb
b5e0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
b5f0: 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 ING: You do not
b600: 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 have a run confi
b610: 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e g file: " runcon
b620: 66 69 67 66 29 29 0a 09 09 20 20 20 20 28 64 65 figf))... (de
b630: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e bug:print 4 "run
b640: 2d 69 64 3a 20 22 20 72 75 6e 2d 69 64 20 22 20 -id: " run-id "
b650: 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 test-name: " tes
b660: 74 2d 6e 61 6d 65 20 22 20 69 74 65 6d 2d 70 61 t-name " item-pa
b670: 74 68 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 20 th: " item-path
b680: 22 20 74 65 73 74 64 61 74 3a 20 22 20 28 74 65 " testdat: " (te
b690: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
b6a0: 73 74 64 61 74 29 20 22 20 74 65 73 74 2d 73 74 stdat) " test-st
b6b0: 61 74 65 3a 20 22 20 28 74 65 73 74 3a 67 65 74 ate: " (test:get
b6c0: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 -state testdat))
b6d0: 0a 09 09 20 20 20 20 28 63 61 73 65 20 28 69 66 ... (case (if
b6e0: 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a force ;; (args:
b6f0: 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 get-arg "-force"
b700: 29 0a 09 09 09 20 20 20 20 20 20 27 4e 4f 54 5f ).... 'NOT_
b710: 53 54 41 52 54 45 44 0a 09 09 09 20 20 20 20 20 STARTED....
b720: 20 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 09 (if testdat....
b730: 09 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 . (string->symb
b740: 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 ol (test:get-sta
b750: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 te testdat))....
b760: 09 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e . 'failed-to-in
b770: 73 65 72 74 29 29 0a 09 09 20 20 20 20 20 20 28 sert))... (
b780: 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 (failed-to-inser
b790: 74 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 t)... (deb
b7a0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
b7b0: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 R: Failed to ins
b7c0: 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 ert the record i
b7d0: 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 09 nto the db"))...
b7e0: 20 20 20 20 20 20 28 28 4e 4f 54 5f 53 54 41 52 ((NOT_STAR
b7f0: 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09 TED COMPLETED)..
b800: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
b810: 72 69 6e 74 20 36 20 22 47 6f 74 20 68 65 72 65 rint 6 "Got here
b820: 2c 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 , " (test:get-st
b830: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
b840: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 (let ((ru
b850: 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 28 nflag #f)).... (
b860: 63 6f 6e 64 0a 09 09 09 20 20 3b 3b 20 69 2e 65 cond.... ;; i.e
b870: 2e 20 74 68 69 73 20 69 73 20 74 68 65 20 70 61 . this is the pa
b880: 72 65 6e 74 20 74 65 73 74 20 74 6f 20 61 20 73 rent test to a s
b890: 75 69 74 65 20 6f 66 20 69 74 65 6d 73 2c 20 6e uite of items, n
b8a0: 65 76 65 72 20 22 72 75 6e 22 20 69 74 0a 09 09 ever "run" it...
b8b0: 09 20 20 28 70 61 72 65 6e 74 2d 74 65 73 74 0a . (parent-test.
b8c0: 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 ... (set! runf
b8d0: 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 3b 3b lag #f)).... ;;
b8e0: 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 -force, run no
b8f0: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 09 09 20 matter what....
b900: 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 (force (set! ru
b910: 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 20 nflag #t))....
b920: 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 ;; NOT_STARTED,
b930: 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 run no matter wh
b940: 61 74 0a 09 09 09 20 20 28 28 65 71 75 61 6c 3f at.... ((equal?
b950: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
b960: 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 testdat) "NOT_S
b970: 54 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75 TARTED")(set! ru
b980: 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 20 nflag #t))....
b990: 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e ;; not -rerun an
b9a0: 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 d PASS, WARN or
b9b0: 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e CHECK, do no run
b9c0: 0a 09 09 09 20 20 28 28 61 6e 64 20 28 6f 72 20 .... ((and (or
b9d0: 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 09 09 (not rerun).....
b9e0: 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 keepgoing)..
b9f0: 09 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 74 ...(member (test
ba00: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
ba10: 64 61 74 29 20 27 28 22 50 41 53 53 22 20 22 57 dat) '("PASS" "W
ba20: 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 29 0a ARN" "CHECK"))).
ba30: 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 ... (set! runf
ba40: 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 3b 3b lag #f)).... ;;
ba50: 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 -rerun and stat
ba60: 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 us is one of the
ba70: 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 specifed, run i
ba80: 74 0a 09 09 09 20 20 28 28 61 6e 64 20 72 65 72 t.... ((and rer
ba90: 75 6e 0a 09 09 09 09 28 6c 65 74 20 28 28 72 65 un.....(let ((re
baa0: 72 75 6e 6c 73 74 20 28 73 74 72 69 6e 67 2d 73 runlst (string-s
bab0: 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 plit rerun ","))
bac0: 29 20 3b 3b 20 46 41 49 4c 2c 0a 09 09 09 09 20 ) ;; FAIL,.....
bad0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
bae0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
baf0: 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 t) rerunlst)))..
bb00: 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c .. (set! runfl
bb10: 61 67 20 23 74 29 29 0a 09 09 09 20 20 3b 3b 20 ag #t)).... ;;
bb20: 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e -keepgoing, do n
bb30: 6f 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 09 ot rerun FAIL...
bb40: 09 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 . ((and keepgoi
bb50: 6e 67 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 28 ng.....(member (
bb60: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
bb70: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c testdat) '("FAIL
bb80: 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 "))).... (set!
bb90: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 runflag #f))...
bba0: 09 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 . ((and (not re
bbb0: 72 75 6e 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 run).....(member
bbc0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
bbd0: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 s testdat) '("FA
bbe0: 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 09 09 IL" "n/a")))....
bbf0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
bc00: 20 23 74 29 29 0a 09 09 09 20 20 28 65 6c 73 65 #t)).... (else
bc10: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
bc20: 66 29 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a f))).... (debug:
bc30: 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 print 6 "RUNNING
bc40: 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 => runflag: " r
bc50: 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 unflag " STATE:
bc60: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
bc70: 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 e testdat) " STA
bc80: 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 TUS: " (test:get
bc90: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
bca0: 29 0a 09 09 09 20 28 69 66 20 28 6e 6f 74 20 72 ).... (if (not r
bcb0: 75 6e 66 6c 61 67 29 0a 09 09 09 20 20 20 20 20 unflag)....
bcc0: 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d (if (not parent-
bcd0: 74 65 73 74 29 0a 09 09 09 09 20 28 64 65 62 75 test)..... (debu
bce0: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a g:print 1 "NOTE:
bcf0: 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 Not starting te
bd00: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 st " new-test-na
bd10: 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 me " as it is st
bd20: 61 74 65 20 5c 22 43 4f 4d 50 4c 45 54 45 44 5c ate \"COMPLETED\
bd30: 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 " and status \""
bd40: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
bd50: 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 s testdat) "\",
bd60: 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 use -force to ov
bd70: 65 72 72 69 64 65 22 29 29 0a 09 09 09 20 20 20 erride"))....
bd80: 20 20 28 6c 65 74 2a 20 28 28 67 65 74 2d 70 72 (let* ((get-pr
bd90: 65 72 65 71 73 2d 63 6d 64 20 28 6c 61 6d 62 64 ereqs-cmd (lambd
bda0: 61 20 28 29 0a 09 09 09 09 09 09 20 20 20 20 20 a ().......
bdb0: 20 20 28 64 62 2d 67 65 74 2d 70 72 65 72 65 71 (db-get-prereq
bdc0: 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e s-not-met db run
bdd0: 2d 69 64 20 77 61 69 74 6f 6e 29 29 29 20 3b 3b -id waiton))) ;;
bde0: 20 63 68 65 63 6b 20 62 65 66 6f 72 65 20 72 75 check before ru
bdf0: 6e 6e 69 6e 67 20 2e 2e 2e 2e 0a 09 09 09 09 20 nning .........
be00: 20 20 20 28 6c 61 75 6e 63 68 2d 63 6d 64 20 20 (launch-cmd
be10: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 (lambda ()..
be20: 09 09 09 09 09 20 20 20 20 20 20 20 28 6c 61 75 ..... (lau
be30: 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d nch-test db run-
be40: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
be50: 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 conf keyvallst t
be60: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 est-name test-pa
be70: 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 th itemdat flags
be80: 29 29 29 0a 09 09 09 09 20 20 20 20 28 74 65 73 )))..... (tes
be90: 74 72 75 6e 64 61 74 20 20 20 20 20 20 28 6c 69 trundat (li
bea0: 73 74 20 67 65 74 2d 70 72 65 72 65 71 73 2d 63 st get-prereqs-c
beb0: 6d 64 20 6c 61 75 6e 63 68 2d 63 6d 64 29 29 29 md launch-cmd)))
bec0: 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 .... (if (
bed0: 6f 72 20 66 6f 72 63 65 0a 09 09 09 09 20 20 20 or force.....
bee0: 20 20 20 20 28 6c 65 74 20 28 28 70 72 65 71 73 (let ((preqs
bef0: 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 20 28 28 63 -not-yet-met ((c
bf00: 61 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 29 ar testrundat)))
bf10: 29 0a 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 )...... (debug:p
bf20: 72 69 6e 74 20 32 20 22 50 72 65 71 72 65 71 75 rint 2 "Preqrequ
bf30: 65 73 69 74 65 73 20 66 6f 72 20 22 20 74 65 73 esites for " tes
bf40: 74 2d 6e 61 6d 65 20 22 3a 20 22 20 70 72 65 71 t-name ": " preq
bf50: 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 29 0a 09 s-not-yet-met)..
bf60: 09 09 09 09 20 28 6e 75 6c 6c 3f 20 70 72 65 71 .... (null? preq
bf70: 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 29 29 29 s-not-yet-met)))
bf80: 20 3b 3b 20 61 72 65 20 74 68 65 72 65 20 61 6e ;; are there an
bf90: 79 20 74 65 73 74 73 20 74 68 61 74 20 6d 75 73 y tests that mus
bfa0: 74 20 62 65 20 72 75 6e 20 62 65 66 6f 72 65 20 t be run before
bfb0: 74 68 69 73 20 6f 6e 65 2e 2e 2e 0a 09 09 09 09 this one........
bfc0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 28 63 61 (if (not ((ca
bfd0: 64 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 29 dr testrundat)))
bfe0: 20 3b 3b 20 74 68 69 73 20 69 73 20 74 68 65 20 ;; this is the
bff0: 6c 69 6e 65 20 74 68 61 74 20 6c 61 75 6e 63 68 line that launch
c000: 65 73 20 74 68 65 20 74 65 73 74 20 74 6f 20 74 es the test to t
c010: 68 65 20 72 65 6d 6f 74 65 20 68 6f 73 74 0a 09 he remote host..
c020: 09 09 09 20 20 20 20 20 20 20 28 62 65 67 69 6e ... (begin
c030: 0a 09 09 09 09 09 20 28 70 72 69 6e 74 20 22 45 ...... (print "E
c040: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
c050: 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e launch the test.
c060: 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e Exiting as soon
c070: 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 as possible")..
c080: 09 09 09 09 20 28 73 65 74 21 20 2a 67 6c 6f 62 .... (set! *glob
c090: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 alexitstatus* 1)
c0a0: 20 3b 3b 20 0a 09 09 09 09 09 20 28 70 72 6f 63 ;; ...... (proc
c0b0: 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 ess-signal (curr
c0c0: 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 ent-process-id)
c0d0: 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 0a 09 09 09 signal/kill)....
c0e0: 09 09 20 3b 28 65 78 69 74 20 31 29 0a 09 09 09 .. ;(exit 1)....
c0f0: 09 09 20 29 29 0a 09 09 09 09 20 20 20 28 69 66 .. ))..... (if
c100: 20 28 6e 6f 74 20 6b 65 65 70 67 6f 69 6e 67 29 (not keepgoing)
c110: 0a 09 09 09 09 20 20 20 20 20 20 20 28 68 61 73 ..... (has
c120: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 77 61 h-table-set! *wa
c130: 69 74 69 6e 67 2d 71 75 65 75 65 2a 20 6e 65 77 iting-queue* new
c140: 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 72 -test-name testr
c150: 75 6e 64 61 74 29 29 29 29 29 29 29 0a 09 09 20 undat)))))))...
c160: 20 20 20 20 20 28 28 4b 49 4c 4c 45 44 29 20 0a ((KILLED) .
c170: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
c180: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 print 1 "NOTE: "
c190: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 new-test-name "
c1a0: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e is already runn
c1b0: 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 ing or was expli
c1c0: 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 ctly killed, use
c1d0: 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 -force to launc
c1e0: 68 20 69 74 2e 22 29 29 0a 09 09 20 20 20 20 20 h it."))...
c1f0: 20 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f ((LAUNCHED REMO
c200: 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e TEHOSTSTART RUNN
c210: 49 4e 47 29 20 20 0a 09 09 20 20 20 20 20 20 20 ING) ...
c220: 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 (if (> (- (curre
c230: 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 nt-seconds)(+ (d
c240: 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 b:test-get-event
c250: 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 _time testdat)..
c260: 09 09 09 09 09 20 20 20 20 20 28 64 62 3a 74 65 ..... (db:te
c270: 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 st-get-run_durat
c280: 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 ion testdat)))..
c290: 09 09 20 20 20 20 20 20 31 30 30 29 20 3b 3b 20 .. 100) ;;
c2a0: 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 i.e. no update f
c2b0: 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 31 30 30 or more than 100
c2c0: 20 73 65 63 6f 6e 64 73 0a 09 09 09 20 20 20 28 seconds.... (
c2d0: 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 28 64 begin.... (d
c2e0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
c2f0: 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 RNING: Test " te
c300: 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 st-name " appear
c310: 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f s to be dead. Fo
c320: 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 rcing it to stat
c330: 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 e INCOMPLETE and
c340: 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 status STUCK/DE
c350: 41 44 22 29 0a 09 09 09 20 20 20 20 20 28 74 65 AD").... (te
c360: 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 st-set-status! d
c370: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
c380: 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 me "INCOMPLETE"
c390: 22 53 54 55 43 4b 2f 44 45 41 44 22 20 69 74 65 "STUCK/DEAD" ite
c3a0: 6d 64 61 74 20 22 54 65 73 74 20 69 73 20 73 74 mdat "Test is st
c3b0: 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 uck or dead" #f)
c3c0: 29 0a 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 ).... (debug:p
c3d0: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 rint 2 "NOTE: "
c3e0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 test-name " is a
c3f0: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 lready running")
c400: 29 29 0a 09 09 20 20 20 20 20 20 28 65 6c 73 65 ))... (else
c410: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
c420: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 int 0 "ERROR: Fa
c430: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 iled to launch t
c440: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e est " new-test-n
c450: 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 ame ". Unrecogni
c460: 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 sed state " (tes
c470: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
c480: 64 61 74 29 29 29 29 29 29 0a 09 20 20 20 20 20 dat))))))..
c490: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
c4a0: 20 74 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f 70 tal))... (loop
c4b0: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 (car tal)(cdr t
c4c0: 61 6c 29 29 29 29 29 29 29 29 29 0a 0a 3b 3b 3d al)))))))))..;;=
c4d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c4e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c4f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c500: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c510: 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 =====.;; END OF
c520: 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d NEW STUFF.;;====
c530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
c570: 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 ==..(define (get
c580: 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 -dir-up-n dir .
c590: 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 params) . (let
c5a0: 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e ((dparts (strin
c5b0: 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 g-split dir "/")
c5c0: 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 )..(count (if
c5d0: 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 (null? params) 1
c5e0: 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 (car params))))
c5f0: 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 . (conc "/" (
c600: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
c610: 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b se .. (tak
c620: 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e e dparts (- (len
c630: 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e gth dparts) coun
c640: 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 t)).. "/")
c650: 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 ))).;; Remove ru
c660: 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 ns.;; fields are
c670: 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f passing in thro
c680: 75 67 68 20 0a 28 64 65 66 69 6e 65 20 28 72 75 ugh .(define (ru
c690: 6e 73 3a 72 65 6d 6f 76 65 2d 72 75 6e 73 20 64 ns:remove-runs d
c6a0: 62 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 b runnamepatt te
c6b0: 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 29 stpatt itempatt)
c6c0: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 . (let* ((keys
c6d0: 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b (db-get-k
c6e0: 65 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64 eys db)).. (rund
c6f0: 61 74 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 at (runs:ge
c700: 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 t-runs-by-patt d
c710: 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 b keys runnamepa
c720: 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 tt)).. (header
c730: 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 (vector-ref
c740: 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 rundat 0)).. (ru
c750: 6e 73 20 20 20 20 20 20 20 20 28 76 65 63 74 6f ns (vecto
c760: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 r-ref rundat 1))
c770: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 ). (debug:pri
c780: 6e 74 20 31 20 22 48 65 61 64 65 72 3a 20 22 20 nt 1 "Header: "
c790: 68 65 61 64 65 72 29 0a 20 20 20 20 28 66 6f 72 header). (for
c7a0: 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 -each. (lamb
c7b0: 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 20 da (run).
c7c0: 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 73 (let ((runkey (s
c7d0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
c7e0: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 e (map (lambda (
c7f0: 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 74 k).......(db:get
c800: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
c810: 20 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 63 run header (vec
c820: 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 6b tor-ref k 0))) k
c830: 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 20 eys) "/"))..
c840: 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 (dirs-to-remove
c850: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c (make-hash-tabl
c860: 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 e))).. (let* ((r
c870: 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 61 un-id (db:get-va
c880: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
c890: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20 29 n header "id") )
c8a0: 0a 09 09 28 74 65 73 74 73 20 20 28 64 62 2d 67 ...(tests (db-g
c8b0: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e et-tests-for-run
c8c0: 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 db (db:get-valu
c8d0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
c8e0: 68 65 61 64 65 72 20 22 69 64 22 29 20 74 65 73 header "id") tes
c8f0: 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 27 tpatt itempatt '
c900: 28 29 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74 () '()))...(last
c910: 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 tpath "/does/not
c920: 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 /exist/I/hope"))
c930: 0a 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ... (if (not (
c940: 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 null? tests))..
c950: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 (begin...
c960: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
c970: 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 Removing tests f
c980: 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 or run: " runkey
c990: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c " " (db:get-val
c9a0: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
c9b0: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 header "runname
c9c0: 22 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 "))... (for-each
c9d0: 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 ... (lambda (te
c9e0: 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 st)... (let*
c9f0: 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a ((item-path (db:
ca00: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
ca10: 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 th test))....
ca20: 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 (test-name (db:t
ca30: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
ca40: 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 test)).... (r
ca50: 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 un-dir (db:tes
ca60: 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 t-get-rundir tes
ca70: 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 t)))... (de
ca80: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 20 20 22 bug:print 1 " "
ca90: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
caa0: 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 stname test) " i
cab0: 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 d: " (db:test-ge
cac0: 74 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 69 t-id test) " " i
cad0: 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 20 20 tem-path)...
cae0: 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 (db:delete-tes
caf0: 74 2d 72 65 63 6f 72 64 73 20 64 62 20 28 64 62 t-records db (db
cb00: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
cb10: 74 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 20 t))... (if
cb20: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 (> (string-lengt
cb30: 68 20 72 75 6e 2d 64 69 72 29 20 35 29 20 3b 3b h run-dir) 5) ;;
cb40: 20 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 bad heuristic b
cb50: 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e ut should preven
cb60: 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 t /tmp /home etc
cb70: 2e 0a 09 09 09 20 20 28 6c 65 74 20 28 28 66 75 ..... (let ((fu
cb80: 6c 6c 70 61 74 68 20 72 75 6e 2d 64 69 72 29 29 llpath run-dir))
cb90: 20 3b 3b 20 22 2f 22 20 28 64 62 3a 74 65 73 74 ;; "/" (db:test
cba0: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
cbb0: 65 73 74 29 29 29 29 0a 09 09 09 20 20 20 20 28 est)))).... (
cbc0: 73 65 74 21 20 6c 61 73 74 74 70 61 74 68 20 66 set! lasttpath f
cbd0: 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 ullpath)....
cbe0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 (hash-table-set!
cbf0: 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 dirs-to-remove
cc00: 66 75 6c 6c 70 61 74 68 20 23 74 29 0a 09 09 09 fullpath #t)....
cc10: 20 20 20 20 3b 3b 20 54 68 65 20 66 6f 6c 6c 6f ;; The follo
cc20: 77 69 6e 67 20 77 61 73 20 74 68 65 20 73 61 66 wing was the saf
cc30: 65 20 64 65 6c 65 74 65 20 63 6f 64 65 20 62 75 e delete code bu
cc40: 74 20 69 74 20 77 61 73 20 6e 6f 74 20 62 65 69 t it was not bei
cc50: 6e 67 20 65 78 65 63 74 75 74 65 64 2e 0a 09 09 ng exectuted....
cc60: 09 20 20 20 20 3b 3b 20 28 6c 65 74 2a 20 28 28 . ;; (let* ((
cc70: 64 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 dirs-count (+ 1
cc80: 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 (length keys)(le
cc90: 6e 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c ngth (string-spl
cca0: 69 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 it item-path "/"
ccb0: 29 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 )))).... ;;
ccc0: 20 20 20 20 20 20 28 64 69 72 2d 74 6f 2d 72 65 (dir-to-re
ccd0: 6d 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 m (get-dir-up-n
cce0: 66 75 6c 6c 70 61 74 68 20 64 69 72 73 2d 63 6f fullpath dirs-co
ccf0: 75 6e 74 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 unt)).... ;;
cd00: 20 20 20 20 20 20 20 28 72 65 6d 61 69 6e 69 6e (remainin
cd10: 67 64 20 28 73 74 72 69 6e 67 2d 73 75 62 73 74 gd (string-subst
cd20: 69 74 75 74 65 20 28 72 65 67 65 78 70 20 28 63 itute (regexp (c
cd30: 6f 6e 63 20 22 5e 22 20 64 69 72 2d 74 6f 2d 72 onc "^" dir-to-r
cd40: 65 6d 20 22 2f 22 29 29 20 22 22 20 66 75 6c 6c em "/")) "" full
cd50: 70 61 74 68 29 29 0a 09 09 09 20 20 20 20 3b 3b path)).... ;;
cd60: 20 20 20 20 20 20 20 20 28 63 6d 64 20 28 63 6f (cmd (co
cd70: 6e 63 20 22 63 64 20 22 20 64 69 72 2d 74 6f 2d nc "cd " dir-to-
cd80: 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d 70 20 rem "; rmdir -p
cd90: 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 29 29 " remainingd )))
cda0: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 28 69 66 .... ;; (if
cdb0: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 (file-exists? f
cdc0: 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 ullpath)....
cdd0: 3b 3b 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a ;; (begin.
cde0: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
cdf0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
ce00: 20 63 6d 64 29 0a 09 09 09 20 20 20 20 3b 3b 20 cmd).... ;;
ce10: 20 20 20 20 20 20 20 20 28 73 79 73 74 65 6d 20 (system
ce20: 63 6d 64 29 29 29 0a 09 09 09 20 20 20 20 3b 3b cmd))).... ;;
ce30: 20 20 20 29 29 0a 09 09 09 20 20 20 20 29 29 29 )).... )))
ce40: 29 0a 09 09 20 20 20 20 74 65 73 74 73 29 29 29 )... tests)))
ce50: 0a 0a 09 20 20 20 3b 3b 20 6c 6f 6f 6b 20 74 68 ... ;; look th
ce60: 6f 75 67 68 20 74 68 65 20 64 69 72 73 2d 74 6f ough the dirs-to
ce70: 2d 72 65 6d 6f 76 65 20 66 6f 72 20 63 61 6e 64 -remove for cand
ce80: 69 64 61 74 65 73 20 66 6f 72 20 72 65 6d 6f 76 idates for remov
ce90: 61 6c 2e 20 44 6f 20 74 68 69 73 20 61 66 74 65 al. Do this afte
cea0: 72 20 64 65 6c 65 74 69 6e 67 20 74 68 65 20 72 r deleting the r
ceb0: 65 63 6f 72 64 73 0a 09 20 20 20 3b 3b 20 66 6f ecords.. ;; fo
cec0: 72 20 65 61 63 68 20 74 65 73 74 20 69 6e 20 63 r each test in c
ced0: 61 73 65 20 77 65 20 67 65 74 20 6b 69 6c 6c 65 ase we get kille
cee0: 64 2e 20 54 68 61 74 20 73 68 6f 75 6c 64 20 6d d. That should m
cef0: 69 6e 69 6d 69 7a 65 20 74 68 65 20 64 65 74 72 inimize the detr
cf00: 69 74 75 73 20 6c 65 66 74 20 6f 6e 20 64 69 73 itus left on dis
cf10: 6b 0a 09 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 k.. ;; process
cf20: 20 74 68 65 20 64 69 72 73 20 66 72 6f 6d 20 6c the dirs from l
cf30: 6f 6e 67 65 73 74 20 73 74 72 69 6e 67 20 6c 65 ongest string le
cf40: 6e 67 74 68 20 74 6f 20 73 68 6f 72 74 65 73 74 ngth to shortest
cf50: 0a 09 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a .. (for-each .
cf60: 09 20 20 20 20 28 6c 61 6d 62 64 61 20 28 64 69 . (lambda (di
cf70: 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 20 20 r-to-remove)..
cf80: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 (if (file-ex
cf90: 69 73 74 73 3f 20 64 69 72 2d 74 6f 2d 72 65 6d ists? dir-to-rem
cfa0: 6f 76 65 29 0a 09 09 20 20 28 6c 65 74 20 28 28 ove)... (let ((
cfb0: 64 69 72 2d 69 6e 2d 64 62 20 27 28 29 29 29 0a dir-in-db '())).
cfc0: 09 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 .. (sqlite3:f
cfd0: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 20 or-each-row...
cfe0: 20 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 29 (lambda (dir)
cff0: 0a 09 09 20 20 20 20 20 20 20 28 73 65 74 21 20 ... (set!
d000: 64 69 72 2d 69 6e 2d 64 62 20 28 63 6f 6e 73 20 dir-in-db (cons
d010: 64 69 72 20 64 69 72 2d 69 6e 2d 64 62 29 29 29 dir dir-in-db)))
d020: 0a 09 09 20 20 20 20 20 64 62 20 22 53 45 4c 45 ... db "SELE
d030: 43 54 20 72 75 6e 64 69 72 20 46 52 4f 4d 20 74 CT rundir FROM t
d040: 65 73 74 73 20 57 48 45 52 45 20 72 75 6e 64 69 ests WHERE rundi
d050: 72 20 4c 49 4b 45 20 3f 3b 22 20 0a 09 09 20 20 r LIKE ?;" ...
d060: 20 20 20 28 63 6f 6e 63 20 22 25 22 20 64 69 72 (conc "%" dir
d070: 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 25 22 29 29 -to-remove "%"))
d080: 20 3b 3b 20 79 65 73 2c 20 49 27 6d 20 67 6f 69 ;; yes, I'm goi
d090: 6e 67 20 74 6f 20 62 61 69 6c 20 69 66 20 74 68 ng to bail if th
d0a0: 65 72 65 20 69 73 20 61 6e 79 74 68 69 6e 67 20 ere is anything
d0b0: 6c 69 6b 65 20 74 68 69 73 20 64 69 72 20 69 6e like this dir in
d0c0: 20 74 68 65 20 64 62 0a 09 09 20 20 20 20 28 69 the db... (i
d0d0: 66 20 28 6e 75 6c 6c 3f 20 64 69 72 2d 69 6e 2d f (null? dir-in-
d0e0: 64 62 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 db)....(begin...
d0f0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
d100: 32 20 22 52 65 6d 6f 76 69 6e 67 20 64 69 72 65 2 "Removing dire
d110: 63 74 6f 72 79 20 77 69 74 68 20 7a 65 72 6f 20 ctory with zero
d120: 64 62 20 72 65 66 65 72 65 6e 63 65 73 3a 20 22 db references: "
d130: 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a dir-to-remove).
d140: 09 09 09 20 20 28 73 79 73 74 65 6d 20 28 63 6f ... (system (co
d150: 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 64 69 72 nc "rm -rf " dir
d160: 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 -to-remove))....
d170: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 (hash-table-de
d180: 6c 65 74 65 21 20 64 69 72 73 2d 74 6f 2d 72 65 lete! dirs-to-re
d190: 6d 6f 76 65 20 64 69 72 2d 74 6f 2d 72 65 6d 6f move dir-to-remo
d1a0: 76 65 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 ve))....(debug:p
d1b0: 72 69 6e 74 20 32 20 22 53 6b 69 70 70 69 6e 67 rint 2 "Skipping
d1c0: 20 72 65 6d 6f 76 61 6c 20 6f 66 20 22 20 64 69 removal of " di
d1d0: 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 20 66 6f r-to-remove " fo
d1e0: 72 20 6e 6f 77 20 61 73 20 69 74 20 73 74 69 6c r now as it stil
d1f0: 6c 20 68 61 73 20 72 65 66 65 72 65 6e 63 65 73 l has references
d200: 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 65 in the database
d210: 22 29 29 29 29 29 0a 09 20 20 20 20 28 73 6f 72 "))))).. (sor
d220: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 t (hash-table-ke
d230: 79 73 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 ys dirs-to-remov
d240: 65 29 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 e) (lambda (a b)
d250: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 (> (string-lengt
d260: 68 20 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 h a)(string-leng
d270: 74 68 20 62 29 29 29 29 29 0a 0a 09 20 20 20 3b th b)))))... ;
d280: 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e ; remove the run
d290: 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72 if zero tests r
d2a0: 65 6d 61 69 6e 0a 09 20 20 20 28 6c 65 74 20 28 emain.. (let (
d2b0: 28 72 65 6d 74 65 73 74 73 20 28 64 62 2d 67 65 (remtests (db-ge
d2c0: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
d2d0: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 db (db:get-value
d2e0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
d2f0: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 23 eader "id") #f #
d300: 66 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 20 f '() '())))..
d310: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 (if (null? re
d320: 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f mtests) ;; no mo
d330: 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 re tests remaini
d340: 6e 67 0a 09 09 20 28 6c 65 74 2a 20 28 28 64 70 ng... (let* ((dp
d350: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 arts (string-sp
d360: 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f lit lasttpath "/
d370: 22 29 29 0a 09 09 09 28 72 75 6e 70 61 74 68 20 "))....(runpath
d380: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e (conc "/" (strin
d390: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 g-intersperse ..
d3a0: 09 09 09 09 20 20 20 20 28 74 61 6b 65 20 64 70 .... (take dp
d3b0: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 arts (- (length
d3c0: 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 dparts) 1)).....
d3d0: 09 20 20 20 20 22 2f 22 29 29 29 29 0a 09 09 20 . "/"))))...
d3e0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
d3f0: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 "Removing run:
d400: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
d410: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
d420: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
d430: 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 "runname"))...
d440: 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 (db:delete-run
d450: 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 db run-id)...
d460: 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 ;; need to figur
d470: 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 e out the path t
d480: 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e o the run dir an
d490: 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 d remove it if e
d4a0: 6d 70 74 79 0a 09 09 20 20 20 3b 3b 20 20 20 20 mpty... ;;
d4b0: 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 (if (null? (glob
d4c0: 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 (conc runpath "
d4d0: 2f 2a 22 29 29 29 0a 09 09 20 20 20 3b 3b 20 20 /*")))... ;;
d4e0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 (begin...
d4f0: 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 ;; . (debug:pr
d500: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
d510: 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 run dir " runpat
d520: 68 29 0a 09 09 20 20 20 3b 3b 20 09 20 28 73 79 h)... ;; . (sy
d530: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 stem (conc "rmdi
d540: 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 r -p " runpath))
d550: 29 29 0a 09 09 20 20 20 29 29 29 29 0a 09 20 29 ))... )))).. )
d560: 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a ). runs)))..
d570: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
d580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d5a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d5b0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 ========.;; Rout
d5c0: 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c ines for manipul
d5d0: 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d ating runs.;;===
d5e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d5f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
d620: 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 ===..;; Since ma
d630: 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 ny calls to a ru
d640: 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 n require pretty
d650: 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 much the same s
d660: 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 etup .;; this wr
d670: 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f apper is used to
d680: 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c reduce the repl
d690: 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a ication of code.
d6a0: 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c (define (general
d6b0: 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 -run-call switch
d6c0: 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 name action-desc
d6d0: 20 70 72 6f 63 29 0a 20 20 28 69 66 20 28 6e 6f proc). (if (no
d6e0: 74 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 t (args:get-arg
d6f0: 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 20 20 20 ":runname")).
d700: 20 20 20 28 62 65 67 69 6e 0a 09 28 64 65 62 75 (begin..(debu
d710: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
d720: 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 : Missing requir
d730: 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 ed parameter for
d740: 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c " switchname ",
d750: 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 you must specif
d760: 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 y the run name w
d770: 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e ith :runname run
d780: 6e 61 6d 65 22 29 0a 09 28 65 78 69 74 20 32 29 name")..(exit 2)
d790: 29 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 ). (let ((d
d7a0: 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 b #f).. (ke
d7b0: 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f ys #f))..(if (no
d7c0: 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e t (setup-for-run
d7d0: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a )).. (begin .
d7e0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
d7f0: 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f int 0 "Failed to
d800: 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 setup, exiting"
d810: 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 ).. (exit 1
d820: 29 29 29 0a 09 28 73 65 74 21 20 64 62 20 20 20 )))..(set! db
d830: 28 6f 70 65 6e 2d 64 62 29 29 0a 09 28 73 65 74 (open-db))..(set
d840: 21 20 6b 65 79 73 20 28 64 62 2d 67 65 74 2d 6b ! keys (db-get-k
d850: 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 eys db))..;; hav
d860: 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 e enough to proc
d870: 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d ess -target or -
d880: 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 reqtarg here..(i
d890: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 f (args:get-arg
d8a0: 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 "-reqtarg")..
d8b0: 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 (let* ((runconf
d8c0: 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 igf (conc *topp
d8d0: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 ath* "/runconfig
d8e0: 73 2e 63 6f 6e 66 69 67 22 29 29 0a 09 09 20 20 s.config"))...
d8f0: 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 (runconfig (re
d900: 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e ad-config runcon
d910: 66 69 67 66 20 23 66 20 23 66 29 29 29 0a 09 20 figf #f #f)))..
d920: 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 (if (hash-t
d930: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
d940: 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 runconfig (args
d950: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
d960: 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 rg") #f)... (ke
d970: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 ys:target-set-ar
d980: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 gs keys (args:ge
d990: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
d9a0: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 ) args:arg-hash)
d9b0: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 ... (begin...
d9c0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
d9d0: 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 "ERROR: [" (arg
d9e0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
d9f0: 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 arg") "] not fou
da00: 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 nd in " runconfi
da10: 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c 69 74 gf)... (sqlit
da20: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 e3:finalize! db)
da30: 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 29 29 ... (exit 1))
da40: 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 72 67 )).. (if (arg
da50: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
da60: 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 et")...(keys:tar
da70: 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 get-set-args key
da80: 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 s (args:get-arg
da90: 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a 61 "-target" args:a
daa0: 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72 rg-hash) args:ar
dab0: 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20 28 g-hash)))..(if (
dac0: 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 not (car *config
dad0: 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 info*)).. (be
dae0: 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75 gin.. (debu
daf0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
db00: 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22 : Attempted to "
db10: 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 action-desc " b
db20: 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 ut run area conf
db30: 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e ig file not foun
db40: 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 d").. (exit
db50: 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 1)).. ;; Ext
db60: 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e ract out stuff n
db70: 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 eeded in most or
db80: 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 many calls..
db90: 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61 ;; here then ca
dba0: 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 ll proc.. (le
dbb0: 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 t* ((keynames
dbc0: 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 (map key:get-fie
dbd0: 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 ldname keys))...
dbe0: 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 (keyvallst (
dbf0: 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 keys->vallist ke
dc00: 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 ys #t)))..
dc10: 28 70 72 6f 63 20 64 62 20 6b 65 79 73 20 6b 65 (proc db keys ke
dc20: 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 ynames keyvallst
dc30: 29 29 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 )))..(sqlite3:fi
dc40: 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 65 nalize! db)..(se
dc50: 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 t! *didsomething
dc60: 2a 20 23 74 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d * #t))))..;;====
dc70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
dc80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
dc90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
dca0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
dcb0: 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e ==.;; Rollup run
dcc0: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d s.;;============
dcd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
dce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
dcf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
dd00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 ==========..;; U
dd10: 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d pdate the test_m
dd20: 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 eta table for th
dd30: 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 is test.(define
dd40: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 (runs:update-tes
dd50: 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e t_meta db test-n
dd60: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 ame test-conf).
dd70: 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f (let ((currreco
dd80: 72 64 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d rd (db:testmeta-
dd90: 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 get-record db te
dda0: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 st-name))). (
ddb0: 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f if (not currreco
ddc0: 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 rd)..(begin.. (
ddd0: 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 set! currrecord
dde0: 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 (make-vector 10
ddf0: 23 66 29 29 0a 09 20 20 28 64 62 3a 74 65 73 74 #f)).. (db:test
de00: 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 meta-add-record
de10: 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a db test-name))).
de20: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 (for-each .
de30: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 (lambda (key
de40: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 ). (let* (
de50: 28 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 (idx (cadr key))
de60: 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 .. (fld (ca
de70: 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 r key))..
de80: 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f (val (config-loo
de90: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 kup test-conf "t
dea0: 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 est_meta" fld)))
deb0: 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 .. (if (and val
dec0: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 (not (equal? (ve
ded0: 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 ctor-ref currrec
dee0: 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a ord idx) val))).
def0: 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 . (begin..
df00: 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 (print "Upd
df10: 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d ating " test-nam
df20: 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 e " " fld " to "
df30: 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 64 val).. (d
df40: 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74 b:testmeta-updat
df50: 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d e-field db test-
df60: 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29 name fld val))))
df70: 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 6f ). '(("autho
df80: 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29 r" 2)("owner" 3)
df90: 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34 ("description" 4
dfa0: 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29 28 )("reviewed" 5)(
dfb0: 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b "tags" 9)))))..;
dfc0: 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65 ; Update test_me
dfd0: 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 ta for all tests
dfe0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 .(define (runs:u
dff0: 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d pdate-all-test_m
e000: 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28 eta db). (let (
e010: 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 (test-names (get
e020: 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 -all-legal-tests
e030: 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 ))). (for-eac
e040: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 h . (lambda
e050: 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 (test-name).
e060: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d (let* ((test-
e070: 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 path (conc *t
e080: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f oppath* "/tests/
e090: 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 " test-name))..
e0a0: 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 (test-confi
e0b0: 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 gf (conc test-pa
e0c0: 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 th "/testconfig"
e0d0: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 65 )).. (teste
e0e0: 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 xists (and (fi
e0f0: 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d le-exists? test-
e100: 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 configf)(file-re
e110: 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d ad-access? test-
e120: 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20 configf)))..
e130: 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 ;; read config
e140: 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 75 s with tricks tu
e150: 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e rned off (i.e. n
e160: 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20 o system)..
e170: 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 (test-conf (
e180: 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 72 if testexists (r
e190: 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d ead-config test-
e1a0: 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d configf #f #f)(m
e1b0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
e1c0: 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 )).. (runs:updat
e1d0: 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 e-test_meta db t
e1e0: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f est-name test-co
e1f0: 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d nf))). test-
e200: 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 names)))..;; Thi
e210: 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 s could probably
e220: 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 69 be refactored i
e230: 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 nto one complex
e240: 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e query ....(defin
e250: 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 e (runs:rollup-r
e260: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 un db keys keyva
e270: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 65 llst runname use
e280: 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 74 r) ;; was target
e290: 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 0a , now keyvallst.
e2a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
e2b0: 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 "runs:rollup-ru
e2c0: 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 n, keys: " keys
e2d0: 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b " keyvallst: " k
e2e0: 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e 6e eyvallst " :runn
e2f0: 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 ame " runname "
e300: 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 20 user: " user).
e310: 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 6c (let* (; (keyval
e320: 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 3a llst (keys:
e330: 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b target->keyval k
e340: 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 eys target)).. (
e350: 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 new-run-id
e360: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 (runs:register-r
e370: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 un db keys keyva
e380: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 llst runname "ne
e390: 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 0a w" "n/a" user)).
e3a0: 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 20 . (prev-tests
e3b0: 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 74 (test:get-mat
e3c0: 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 ching-previous-t
e3d0: 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 est-run-records
e3e0: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 db new-run-id "%
e3f0: 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d " "%")).. (curr-
e400: 74 65 73 74 73 20 20 20 20 20 20 28 64 62 2d 67 tests (db-g
e410: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e et-tests-for-run
e420: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 db new-run-id "
e430: 25 22 20 22 25 22 20 27 28 29 20 27 28 29 29 29 %" "%" '() '()))
e440: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 .. (curr-tests-h
e450: 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 ash (make-hash-t
e460: 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 62 3a able))). (db:
e470: 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 update-run-event
e480: 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e _time db new-run
e490: 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 -id). ;; inde
e4a0: 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 x the already sa
e4b0: 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65 73 ved tests by tes
e4c0: 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 70 61 tname and itempa
e4d0: 74 68 20 69 6e 20 63 75 72 72 2d 74 65 73 74 73 th in curr-tests
e4e0: 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 -hash. (for-e
e4f0: 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ach. (lambda
e500: 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 (testdat).
e510: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 (let* ((testna
e520: 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 me (db:test-get
e530: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 -testname testda
e540: 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d t)).. (item
e550: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
e560: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
e570: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 tdat)).. (f
e580: 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 ull-name (conc t
e590: 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d estname "/" item
e5a0: 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 68 -path))).. (hash
e5b0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 -table-set! curr
e5c0: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c -tests-hash full
e5d0: 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 -name testdat)))
e5e0: 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 73 . curr-tests
e5f0: 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e ). ;; NOPE: N
e600: 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f on-optimal appro
e610: 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 6e ach. Try this in
e620: 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 stead.. ;;
e630: 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 63 1. tests are rec
e640: 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 2c eived in a list,
e650: 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 72 most recent fir
e660: 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 st. ;; 2. r
e670: 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 eplace the rollu
e680: 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 20 p test with the
e690: 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 new *always*.
e6a0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
e6b0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 (lambda (testda
e6c0: 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 t). (let*
e6d0: 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a ((testname (db:
e6e0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
e6f0: 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 e testdat))..
e700: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 (item-path (d
e710: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
e720: 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 path testdat))..
e730: 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 (full-name
e740: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
e750: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a "/" item-path)).
e760: 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 73 . (prev-tes
e770: 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c t-dat (hash-tabl
e780: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 75 e-ref/default cu
e790: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 rr-tests-hash fu
e7a0: 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 ll-name #f))..
e7b0: 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 20 (test-steps
e7c0: 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 65 (db:get-ste
e7d0: 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 28 ps-for-test db (
e7e0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
e7f0: 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 20 estdat)))..
e800: 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 (new-test-recor
e810: 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 6c d #f)).. ;; repl
e820: 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 69 ace these with i
e830: 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 74 nsert ... select
e840: 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 .. (apply sqlite
e850: 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 20 3:execute ...db
e860: 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 ...(conc "INSERT
e870: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f OR REPLACE INTO
e880: 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c 74 tests (run_id,t
e890: 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 estname,state,st
e8a0: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c atus,event_time,
e8b0: 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 73 host,cpuload,dis
e8c0: 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 kfree,uname,rund
e8d0: 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 6e ir,item_path,run
e8e0: 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f _duration,final_
e8f0: 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a logf,comment) ".
e900: 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 20 .. "VALUES
e910: 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f (?,?,?,?,?,?,?,?
e920: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 ,?,?,?,?,?,?);")
e930: 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 ...new-run-id (c
e940: 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 73 ddr (vector->lis
e950: 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 28 t testdat))).. (
e960: 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 74 set! new-testdat
e970: 20 28 63 61 72 20 28 64 62 2d 67 65 74 2d 74 65 (car (db-get-te
e980: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e sts-for-run db n
e990: 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 ew-run-id testna
e9a0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28 29 me item-path '()
e9b0: 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 2d '()))).. (hash-
e9c0: 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d table-set! curr-
e9d0: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d tests-hash full-
e9e0: 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 74 name new-testdat
e9f0: 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 ) ;; this could
ea00: 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 be confusing, wh
ea10: 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 6c ich record shoul
ea20: 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f d go into the lo
ea30: 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b okup table?.. ;;
ea40: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 Now duplicate t
ea50: 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 20 he test steps..
ea60: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
ea70: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 Copying records
ea80: 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 72 in test_steps fr
ea90: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 om test_id=" (db
eaa0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
eab0: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 tdat) " to " (db
eac0: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
ead0: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 -testdat)).. (sq
eae0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 lite3:execute ..
eaf0: 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 db .. (conc "
eb00: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 INSERT OR REPLAC
eb10: 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 70 E INTO test_step
eb20: 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e s (test_id,stepn
eb30: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
eb40: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d ,event_time,comm
eb50: 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 ent) "..."SELECT
eb60: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
eb70: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 id new-testdat)
eb80: 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 ",stepname,state
eb90: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
eba0: 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 me,comment FROM
ebb0: 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 45 test_steps WHERE
ebc0: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 test_id=?;")..
ebd0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
ebe0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b 3b 20 testdat)).. ;;
ebf0: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 Now duplicate th
ec00: 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 28 64 e test data.. (d
ec10: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f ebug:print 4 "Co
ec20: 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e pying records in
ec30: 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d 20 test_data from
ec40: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 test_id=" (db:te
ec50: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
ec60: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 t) " to " (db:te
ec70: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
ec80: 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 stdat)).. (sqlit
ec90: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 e3:execute .. d
eca0: 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 b .. (conc "INS
ecb0: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 ERT OR REPLACE I
ecc0: 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 74 NTO test_data (t
ecd0: 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 2c est_id,category,
ece0: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 variable,value,e
ecf0: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 xpected,tol,unit
ed00: 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 22 s,comment) "..."
ed10: 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 SELECT " (db:tes
ed20: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 t-get-id new-tes
ed30: 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 tdat) ",category
ed40: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c ,variable,value,
ed50: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 expected,tol,uni
ed60: 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 ts,comment FROM
ed70: 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 test_data WHERE
ed80: 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 test_id=?;")..
ed90: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
eda0: 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 0a 20 testdat)).. )).
edb0: 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 prev-tests))
edc0: 29 0a 09 20 0a 20 20 20 20 20 0a ).. . .