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: 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 74 65 ;; register a te
0190: 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 65 20 st run with the
01a0: 64 62 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 db.(define (regi
01b0: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
01c0: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a ) ;; test-name).
01d0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 72 (let* ((keystr
01e0: 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74 (keys->keyst
01f0: 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d r keys)).. (comm
0200: 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 a (if (> (le
0210: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 2c ngth keys) 0) ",
0220: 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 72 " "")).. (andstr
0230: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 (if (> (leng
0240: 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 4e th keys) 0) " AN
0250: 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c 73 D " "")).. (vals
0260: 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c lots (keys->val
0270: 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b 20 slots keys)) ;;
0280: 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 ?,?,? ..... (key
0290: 76 61 6c 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 vallst (keys->va
02a0: 6c 6c 69 73 74 20 6b 65 79 73 29 29 20 3b 3b 20 llist keys)) ;;
02b0: 65 78 74 72 61 63 74 73 20 74 68 65 20 76 61 6c extracts the val
02c0: 75 65 73 20 66 72 6f 6d 20 72 65 6d 61 69 6e 64 ues from remaind
02d0: 65 72 20 6f 66 20 28 61 72 67 76 29 0a 09 20 28 er of (argv).. (
02e0: 72 75 6e 6e 61 6d 65 20 20 20 28 67 65 74 2d 77 runname (get-w
02f0: 69 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 72 75 ith-default ":ru
0300: 6e 6e 61 6d 65 22 20 23 66 29 29 0a 09 20 28 73 nname" #f)).. (s
0310: 74 61 74 65 20 20 20 20 20 28 67 65 74 2d 77 69 tate (get-wi
0320: 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 th-default ":sta
0330: 74 65 22 20 22 6e 6f 22 29 29 0a 09 20 28 73 74 te" "no")).. (st
0340: 61 74 75 73 20 20 20 20 28 67 65 74 2d 77 69 74 atus (get-wit
0350: 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 74 h-default ":stat
0360: 75 73 22 20 22 6e 2f 61 22 29 29 0a 09 20 28 61 us" "n/a")).. (a
0370: 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 llvals (append
0380: 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20 73 (list runname s
0390: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 tate status user
03a0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03b0: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 (qryvals (appe
03c0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
03d0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03e0: 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 (key=?str (stri
03f0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
0400: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 map (lambda (k)(
0410: 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 conc (key:get-fi
0420: 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 eldname k) "=?")
0430: 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 ) keys) " AND ")
0440: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
0450: 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b int 3 "keys: " k
0460: 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 eys " allvals: "
0470: 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 allvals " keyva
0480: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 llst: " keyvalls
0490: 74 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 t). (debug:pr
04a0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 int 2 "NOTE: usi
04b0: 6e 67 20 6b 65 79 20 22 20 28 73 74 72 69 6e 67 ng key " (string
04c0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 -intersperse key
04d0: 76 61 6c 6c 73 74 20 22 2f 22 29 20 22 20 66 6f vallst "/") " fo
04e0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 r this run").
04f0: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d (if (and runnam
0500: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 e (null? (filter
0510: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 (lambda (x)(not
0520: 20 78 29 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 x)) keyvallst))
0530: 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 ) ;; there must
0540: 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20 be a better way
0550: 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 to "apply and"..
0560: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a (let ((res #f)).
0570: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 . (apply sqlite
0580: 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 3:execute db (co
0590: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 nc "INSERT OR IG
05a0: 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 NORE INTO runs (
05b0: 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 runname,state,st
05c0: 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 atus,owner,event
05d0: 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 _time" comma key
05e0: 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f str ") VALUES (?
05f0: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 ,?,?,?,strftime(
0600: 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d '%s','now')" com
0610: 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 ma valslots ");"
0620: 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 )... allvals)..
0630: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
0640: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 for-each-row ..
0650: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 (lambda (id)..
0660: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69 (set! res i
0670: 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 d)).. db.. (
0680: 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 let ((qry (conc
0690: 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 "SELECT id FROM
06a0: 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e runs WHERE (runn
06b0: 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b ame=? " andstr k
06c0: 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a ey=?str ");"))).
06d0: 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 . ;(debug:pr
06e0: 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 int 4 "qry: " qr
06f0: 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 y) .. qry)..
0700: 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 qryvals).. (
0710: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
0720: 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 db "UPDATE runs
0730: 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 SET state=?,stat
0740: 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b us=? WHERE id=?;
0750: 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 " state status r
0760: 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 es).. res) ..(b
0770: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 egin.. (debug:p
0780: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 rint 0 "ERROR: C
0790: 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c alled without al
07a0: 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 l necessary keys
07b0: 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b ").. #f))))..;;
07c0: 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 runs:get-runs-b
07d0: 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72 75 y-patt.;; get ru
07e0: 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63 72 ns by list of cr
07f0: 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73 74 iteria.;; regist
0800: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 er a test run wi
0810: 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b 20 th the db.;;.;;
0820: 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61 6c Use: (db-get-val
0830: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64 62 ue-by-header (db
0840: 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e 69 :get-header runi
0850: 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77 20 nfo)(db:get-row
0860: 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74 6f runinfo)).;; to
0870: 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66 72 extract info fr
0880: 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 65 om the structure
0890: 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64 65 returned.;;.(de
08a0: 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d 72 fine (runs:get-r
08b0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
08c0: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 eys runnamepatt
08d0: 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65 73 . params) ;; tes
08e0: 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 t-name). (let*
08f0: 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65 79 ((keyvallst (key
0900: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 29 s->vallist keys)
0910: 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28 72 ).. (tmp (r
0920: 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e 2d uns:get-std-run-
0930: 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22 69 fields keys '("i
0940: 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73 74 d" "runname" "st
0950: 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22 6f ate" "status" "o
0960: 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69 6d wner" "event_tim
0970: 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72 20 e"))).. (keystr
0980: 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20 28 (car tmp)).. (
0990: 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20 74 header (cadr t
09a0: 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20 20 mp)).. (res
09b0: 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74 74 '()).. (key-patt
09c0: 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 "")). (for-e
09d0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 ach (lambda (key
09e0: 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b val)...(let* ((k
09f0: 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 ey (vector-re
0a00: 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09 20 f keyval 0))...
0a10: 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28 63 (fulkey (c
0a20: 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 onc ":" key))...
0a30: 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20 28 (patt (
0a40: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75 6c args:get-arg ful
0a50: 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20 70 key)))... (if p
0a60: 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 att... (set
0a70: 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 ! key-patt (conc
0a80: 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 key-patt " AND
0a90: 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22 20 " key " like '"
0aa0: 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20 20 patt "'"))...
0ab0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64 65 (begin....(de
0ac0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
0ad0: 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66 6f OR: searching fo
0ae0: 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20 70 r runs with no p
0af0: 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20 22 attern set for "
0b00: 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78 69 fulkey)....(exi
0b10: 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20 20 t 6)))))..
0b20: 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69 74 keys). (sqlit
0b30: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 e3:for-each-row
0b40: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 . (lambda (a
0b50: 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73 65 . r). (se
0b60: 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c 69 t! res (cons (li
0b70: 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e 73 st->vector (cons
0b80: 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20 20 a r)) res))).
0b90: 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e db . (con
0ba0: 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79 73 c "SELECT " keys
0bb0: 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 tr " FROM runs W
0bc0: 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69 6b HERE runname lik
0bd0: 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 e ? " key-patt "
0be0: 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d 65 ;"). runname
0bf0: 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74 6f patt). (vecto
0c00: 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29 0a r header res))).
0c10: 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 73 74 .(define (regist
0c20: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 er-test db run-i
0c30: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
0c40: 2d 70 61 74 68 29 0a 20 20 28 6c 65 74 20 28 28 -path). (let ((
0c50: 69 74 65 6d 2d 70 61 74 68 73 20 28 69 66 20 28 item-paths (if (
0c60: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
0c70: 20 22 22 29 0a 09 09 09 28 6c 69 73 74 20 69 74 "")....(list it
0c80: 65 6d 2d 70 61 74 68 29 0a 09 09 09 28 6c 69 73 em-path)....(lis
0c90: 74 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 t item-path ""))
0ca0: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
0cb0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
0cc0: 70 74 68 29 0a 20 20 20 20 20 20 20 28 73 71 6c pth). (sql
0cd0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 ite3:execute db
0ce0: 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 "INSERT OR IGNOR
0cf0: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 E INTO tests (ru
0d00: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 65 76 n_id,testname,ev
0d10: 65 6e 74 5f 74 69 6d 65 2c 69 74 65 6d 5f 70 61 ent_time,item_pa
0d20: 74 68 2c 73 74 61 74 65 2c 73 74 61 74 75 73 29 th,state,status)
0d30: 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 73 74 72 VALUES (?,?,str
0d40: 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 ftime('%s','now'
0d50: 29 2c 3f 2c 27 4e 4f 54 5f 53 54 41 52 54 45 44 ),?,'NOT_STARTED
0d60: 27 2c 27 6e 2f 61 27 29 3b 22 20 0a 09 09 09 72 ','n/a');" ....r
0d70: 75 6e 2d 69 64 20 0a 09 09 09 74 65 73 74 2d 6e un-id ....test-n
0d80: 61 6d 65 0a 09 09 09 70 74 68 20 0a 09 09 09 3b ame....pth ....;
0d90: 3b 20 28 63 6f 6e 63 20 22 2c 22 20 28 73 74 72 ; (conc "," (str
0da0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
0db0: 74 61 67 73 20 22 2c 22 29 20 22 2c 22 29 0a 09 tags ",") ",")..
0dc0: 09 09 29 29 0a 20 20 20 20 20 69 74 65 6d 2d 70 ..)). item-p
0dd0: 61 74 68 73 20 29 29 29 0a 0a 3b 3b 20 67 65 74 aths )))..;; get
0de0: 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 72 65 the previous re
0df0: 63 6f 72 64 20 66 6f 72 20 77 68 65 6e 20 74 68 cord for when th
0e00: 69 73 20 74 65 73 74 20 77 61 73 20 72 75 6e 20 is test was run
0e10: 77 68 65 72 65 20 61 6c 6c 20 6b 65 79 73 20 6d where all keys m
0e20: 61 74 63 68 20 62 75 74 20 72 75 6e 6e 61 6d 65 atch but runname
0e30: 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 3a 67 .(define (test:g
0e40: 65 74 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 et-previous-test
0e50: 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 -run-records db
0e60: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
0e70: 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 28 6c item-path). (l
0e80: 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 28 64 et* ((keys (d
0e90: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b:get-keys db)).
0ea0: 09 20 28 73 65 6c 73 74 72 20 20 28 73 74 72 69 . (selstr (stri
0eb0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
0ec0: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 78 29 28 map (lambda (x)(
0ed0: 76 65 63 74 6f 72 2d 72 65 66 20 78 20 30 29 29 vector-ref x 0))
0ee0: 20 6b 65 79 73 29 20 22 2c 22 29 29 0a 09 20 28 keys) ",")).. (
0ef0: 71 72 79 73 74 72 20 20 28 73 74 72 69 6e 67 2d qrystr (string-
0f00: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 intersperse (map
0f10: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 63 6f 6e (lambda (x)(con
0f20: 63 20 28 76 65 63 74 6f 72 2d 72 65 66 20 78 20 c (vector-ref x
0f30: 30 29 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 0) "=?")) keys)
0f40: 22 20 41 4e 44 20 22 29 29 0a 09 20 28 6b 65 79 " AND ")).. (key
0f50: 76 61 6c 73 20 23 66 29 29 0a 20 20 20 20 3b 3b vals #f)). ;;
0f60: 20 66 69 72 73 74 20 6c 6f 6f 6b 20 75 70 20 74 first look up t
0f70: 68 65 20 6b 65 79 20 76 61 6c 75 65 73 20 66 72 he key values fr
0f80: 6f 6d 20 74 68 65 20 72 75 6e 20 73 65 6c 65 63 om the run selec
0f90: 74 65 64 20 62 79 20 72 75 6e 2d 69 64 0a 20 20 ted by run-id.
0fa0: 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 (sqlite3:for-e
0fb0: 61 63 68 2d 72 6f 77 20 0a 20 20 20 20 20 28 6c ach-row . (l
0fc0: 61 6d 62 64 61 20 28 61 20 2e 20 62 29 0a 20 20 ambda (a . b).
0fd0: 20 20 20 20 20 28 73 65 74 21 20 6b 65 79 76 61 (set! keyva
0fe0: 6c 73 20 28 63 6f 6e 73 20 61 20 62 29 29 29 0a ls (cons a b))).
0ff0: 20 20 20 20 20 64 62 0a 20 20 20 20 20 28 63 6f db. (co
1000: 6e 63 20 22 53 45 4c 45 43 54 20 22 20 73 65 6c nc "SELECT " sel
1010: 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 str " FROM runs
1020: 57 48 45 52 45 20 69 64 3d 3f 20 4f 52 44 45 52 WHERE id=? ORDER
1030: 20 42 59 20 65 76 65 6e 74 5f 74 69 6d 65 20 44 BY event_time D
1040: 45 53 43 3b 22 29 20 72 75 6e 2d 69 64 29 0a 20 ESC;") run-id).
1050: 20 20 20 28 69 66 20 28 6e 6f 74 20 6b 65 79 76 (if (not keyv
1060: 61 6c 73 29 0a 09 23 66 0a 09 28 6c 65 74 20 28 als)..#f..(let (
1070: 28 70 72 65 76 2d 72 75 6e 2d 69 64 73 20 27 28 (prev-run-ids '(
1080: 29 29 29 0a 09 20 20 28 61 70 70 6c 79 20 73 71 ))).. (apply sq
1090: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
10a0: 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 69 ow... (lambda (i
10b0: 64 29 0a 09 09 20 20 20 28 73 65 74 21 20 70 72 d)... (set! pr
10c0: 65 76 2d 72 75 6e 2d 69 64 73 20 28 63 6f 6e 73 ev-run-ids (cons
10d0: 20 69 64 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 id prev-run-ids
10e0: 29 29 29 0a 09 09 20 64 62 0a 09 09 20 28 63 6f )))... db... (co
10f0: 6e 63 20 22 53 45 4c 45 43 54 20 69 64 20 46 52 nc "SELECT id FR
1100: 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 22 20 OM runs WHERE "
1110: 71 72 79 73 74 72 20 22 20 41 4e 44 20 69 64 20 qrystr " AND id
1120: 21 3d 20 3f 3b 22 29 20 28 61 70 70 65 6e 64 20 != ?;") (append
1130: 6b 65 79 76 61 6c 73 20 28 6c 69 73 74 20 72 75 keyvals (list ru
1140: 6e 2d 69 64 29 29 29 0a 09 20 20 3b 3b 20 66 6f n-id))).. ;; fo
1150: 72 20 65 61 63 68 20 72 75 6e 20 73 74 61 72 74 r each run start
1160: 69 6e 67 20 77 69 74 68 20 74 68 65 20 6d 6f 73 ing with the mos
1170: 74 20 72 65 63 65 6e 74 20 6c 6f 6f 6b 20 74 6f t recent look to
1180: 20 73 65 65 20 69 66 20 74 68 65 72 65 20 69 73 see if there is
1190: 20 61 20 6d 61 74 63 68 69 6e 67 20 74 65 73 74 a matching test
11a0: 0a 09 20 20 3b 3b 20 69 66 20 66 6f 75 6e 64 20 .. ;; if found
11b0: 74 68 65 6e 20 72 65 74 75 72 6e 20 74 68 61 74 then return that
11c0: 20 6d 61 74 63 68 69 6e 67 20 74 65 73 74 20 72 matching test r
11d0: 65 63 6f 72 64 0a 09 20 20 28 64 65 62 75 67 3a ecord.. (debug:
11e0: 70 72 69 6e 74 20 34 20 22 73 65 6c 73 74 72 3a print 4 "selstr:
11f0: 20 22 20 73 65 6c 73 74 72 20 22 2c 20 71 72 79 " selstr ", qry
1200: 73 74 72 3a 20 22 20 71 72 79 73 74 72 20 22 2c str: " qrystr ",
1210: 20 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 keyvals: " keyv
1220: 61 6c 73 20 22 2c 20 70 72 65 76 69 6f 75 73 20 als ", previous
1230: 72 75 6e 20 69 64 73 20 66 6f 75 6e 64 3a 20 22 run ids found: "
1240: 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 29 0a 09 prev-run-ids)..
1250: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 72 65 (if (null? pre
1260: 76 2d 72 75 6e 2d 69 64 73 29 20 23 66 0a 09 20 v-run-ids) #f..
1270: 20 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 (let loop (
1280: 28 68 65 64 20 28 63 61 72 20 70 72 65 76 2d 72 (hed (car prev-r
1290: 75 6e 2d 69 64 73 29 29 0a 09 09 09 20 28 74 61 un-ids)).... (ta
12a0: 6c 20 28 63 64 72 20 70 72 65 76 2d 72 75 6e 2d l (cdr prev-run-
12b0: 69 64 73 29 29 29 0a 09 09 28 6c 65 74 20 28 28 ids)))...(let ((
12c0: 72 65 73 75 6c 74 73 20 28 64 62 2d 67 65 74 2d results (db-get-
12d0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
12e0: 20 68 65 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 hed test-name i
12f0: 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 09 20 20 tem-path)))...
1300: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
1310: 47 6f 74 20 74 65 73 74 73 20 66 6f 72 20 72 75 Got tests for ru
1320: 6e 2d 69 64 20 22 20 72 75 6e 2d 69 64 20 22 2c n-id " run-id ",
1330: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 74 65 73 test-name " tes
1340: 74 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 t-name ", item-p
1350: 61 74 68 20 22 20 69 74 65 6d 2d 70 61 74 68 20 ath " item-path
1360: 22 3a 20 22 20 72 65 73 75 6c 74 73 29 0a 09 09 ": " results)...
1370: 20 20 28 69 66 20 28 61 6e 64 20 28 6e 75 6c 6c (if (and (null
1380: 3f 20 72 65 73 75 6c 74 73 29 0a 09 09 09 20 20 ? results)....
1390: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c (not (null? tal
13a0: 29 29 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f )))... (loo
13b0: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 p (car tal)(cdr
13c0: 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28 63 tal))... (c
13d0: 61 72 20 72 65 73 75 6c 74 73 29 29 29 29 29 29 ar results))))))
13e0: 29 29 29 0a 20 20 20 20 0a 0a 28 64 65 66 69 6e ))). ..(defin
13f0: 65 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 e (test-set-stat
1400: 75 73 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 us! db run-id te
1410: 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 74 st-name state st
1420: 61 74 75 73 20 69 74 65 6d 64 61 74 2d 6f 72 2d atus itemdat-or-
1430: 70 61 74 68 20 63 6f 6d 6d 65 6e 74 20 64 61 74 path comment dat
1440: 29 0a 20 20 28 6c 65 74 2a 20 28 28 72 65 61 6c ). (let* ((real
1450: 2d 73 74 61 74 75 73 20 73 74 61 74 75 73 29 0a -status status).
1460: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28 . (item-path (
1470: 69 66 20 28 73 74 72 69 6e 67 3f 20 69 74 65 6d if (string? item
1480: 64 61 74 2d 6f 72 2d 70 61 74 68 29 20 69 74 65 dat-or-path) ite
1490: 6d 64 61 74 2d 6f 72 2d 70 61 74 68 20 28 69 74 mdat-or-path (it
14a0: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
14b0: 65 6d 64 61 74 2d 6f 72 2d 70 61 74 68 29 29 29 emdat-or-path)))
14c0: 0a 09 20 28 6f 74 68 65 72 64 61 74 20 20 20 20 .. (otherdat
14d0: 28 69 66 20 64 61 74 20 64 61 74 20 28 6d 61 6b (if dat dat (mak
14e0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
14f0: 09 20 3b 3b 20 62 65 66 6f 72 65 20 70 72 6f 63 . ;; before proc
1500: 65 65 64 69 6e 67 20 77 65 20 6d 75 73 74 20 66 eeding we must f
1510: 69 6e 64 20 6f 75 74 20 69 66 20 74 68 65 20 70 ind out if the p
1520: 72 65 76 69 6f 75 73 20 74 65 73 74 20 28 77 68 revious test (wh
1530: 65 72 65 20 61 6c 6c 20 6b 65 79 73 20 6d 61 74 ere all keys mat
1540: 63 68 65 64 20 65 78 63 65 70 74 20 72 75 6e 6e ched except runn
1550: 61 6d 65 29 0a 09 20 3b 3b 20 77 61 73 20 57 41 ame).. ;; was WA
1560: 49 56 45 44 20 69 66 20 74 68 69 73 20 74 65 73 IVED if this tes
1570: 74 20 69 73 20 46 41 49 4c 0a 09 20 28 77 61 69 t is FAIL.. (wai
1580: 76 65 64 20 20 20 28 69 66 20 28 65 71 75 61 6c ved (if (equal
1590: 3f 20 73 74 61 74 75 73 20 22 46 41 49 4c 22 29 ? status "FAIL")
15a0: 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 ... (let (
15b0: 28 70 72 65 76 2d 74 65 73 74 20 28 74 65 73 74 (prev-test (test
15c0: 3a 67 65 74 2d 70 72 65 76 69 6f 75 73 2d 74 65 :get-previous-te
15d0: 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 st-run-records d
15e0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
15f0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a me item-path))).
1600: 09 09 09 20 28 69 66 20 70 72 65 76 2d 74 65 73 ... (if prev-tes
1610: 74 20 3b 3b 20 74 72 75 65 20 69 66 20 77 65 20 t ;; true if we
1620: 66 6f 75 6e 64 20 61 20 70 72 65 76 69 6f 75 73 found a previous
1630: 20 74 65 73 74 20 69 6e 20 74 68 69 73 20 72 75 test in this ru
1640: 6e 20 73 65 72 69 65 73 0a 09 09 09 20 20 20 20 n series....
1650: 20 28 6c 65 74 20 28 28 70 72 65 76 2d 73 74 61 (let ((prev-sta
1660: 74 75 73 20 28 64 62 3a 74 65 73 74 2d 67 65 74 tus (db:test-get
1670: 2d 73 74 61 74 75 73 20 20 20 70 72 65 76 2d 74 -status prev-t
1680: 65 73 74 29 29 0a 09 09 09 09 20 20 20 28 70 72 est))..... (pr
1690: 65 76 2d 73 74 61 74 65 20 20 28 64 62 3a 74 65 ev-state (db:te
16a0: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 20 20 20 st-get-state
16b0: 70 72 65 76 2d 74 65 73 74 29 29 0a 09 09 09 09 prev-test)).....
16c0: 20 20 20 28 70 72 65 76 2d 63 6f 6d 6d 65 6e 74 (prev-comment
16d0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 63 6f (db:test-get-co
16e0: 6d 6d 65 6e 74 20 70 72 65 76 2d 74 65 73 74 29 mment prev-test)
16f0: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 65 )).... (de
1700: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 70 72 65 bug:print 4 "pre
1710: 76 2d 73 74 61 74 75 73 20 22 20 70 72 65 76 2d v-status " prev-
1720: 73 74 61 74 75 73 20 22 2c 20 70 72 65 76 2d 73 status ", prev-s
1730: 74 61 74 65 20 22 20 70 72 65 76 2d 73 74 61 74 tate " prev-stat
1740: 65 20 22 2c 20 70 72 65 76 2d 63 6f 6d 6d 65 6e e ", prev-commen
1750: 74 20 22 20 70 72 65 76 2d 63 6f 6d 6d 65 6e 74 t " prev-comment
1760: 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 ).... (if
1770: 28 61 6e 64 20 28 65 71 75 61 6c 3f 20 70 72 65 (and (equal? pre
1780: 76 2d 73 74 61 74 65 20 20 22 43 4f 4d 50 4c 45 v-state "COMPLE
1790: 54 45 44 22 29 0a 09 09 09 09 09 28 65 71 75 61 TED")......(equa
17a0: 6c 3f 20 70 72 65 76 2d 73 74 61 74 75 73 20 22 l? prev-status "
17b0: 57 41 49 56 45 44 22 29 29 0a 09 09 09 09 20 20 WAIVED")).....
17c0: 20 70 72 65 76 2d 63 6f 6d 6d 65 6e 74 20 3b 3b prev-comment ;;
17d0: 20 77 61 69 76 65 64 20 69 73 20 65 69 74 68 65 waived is eithe
17e0: 72 20 74 68 65 20 63 6f 6d 6d 65 6e 74 20 6f 72 r the comment or
17f0: 20 23 66 0a 09 09 09 09 20 20 20 23 66 29 29 0a #f..... #f)).
1800: 09 09 09 20 20 20 20 20 23 66 29 29 0a 09 09 20 ... #f))...
1810: 20 20 20 20 20 20 23 66 29 29 29 0a 20 20 20 20 #f))).
1820: 28 69 66 20 77 61 69 76 65 64 20 28 73 65 74 21 (if waived (set!
1830: 20 72 65 61 6c 2d 73 74 61 74 75 73 20 22 57 41 real-status "WA
1840: 49 56 45 44 22 29 29 0a 20 20 20 20 28 64 65 62 IVED")). (deb
1850: 75 67 3a 70 72 69 6e 74 20 34 20 22 72 65 61 6c ug:print 4 "real
1860: 2d 73 74 61 74 75 73 20 22 20 72 65 61 6c 2d 73 -status " real-s
1870: 74 61 74 75 73 20 22 2c 20 77 61 69 76 65 64 20 tatus ", waived
1880: 22 20 77 61 69 76 65 64 20 22 2c 20 73 74 61 74 " waived ", stat
1890: 75 73 20 22 20 73 74 61 74 75 73 29 0a 0a 20 20 us " status)..
18a0: 20 20 3b 3b 20 75 70 64 61 74 65 20 74 68 65 20 ;; update the
18b0: 70 72 69 6d 61 72 79 20 72 65 63 6f 72 64 20 49 primary record I
18c0: 46 20 73 74 61 74 65 20 41 4e 44 20 73 74 61 74 F state AND stat
18d0: 75 73 20 61 72 65 20 64 65 66 69 6e 65 64 0a 20 us are defined.
18e0: 20 20 20 28 69 66 20 28 61 6e 64 20 73 74 61 74 (if (and stat
18f0: 65 20 73 74 61 74 75 73 29 0a 09 28 73 71 6c 69 e status)..(sqli
1900: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
1910: 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 UPDATE tests SET
1920: 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d state=?,status=
1930: 3f 2c 65 76 65 6e 74 5f 74 69 6d 65 3d 73 74 72 ?,event_time=str
1940: 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 ftime('%s','now'
1950: 29 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f ) WHERE run_id=?
1960: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
1970: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
1980: 22 20 0a 09 09 09 20 73 74 61 74 65 20 72 65 61 " .... state rea
1990: 6c 2d 73 74 61 74 75 73 20 72 75 6e 2d 69 64 20 l-status run-id
19a0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
19b0: 61 74 68 29 29 0a 20 20 20 20 3b 3b 20 61 64 64 ath)). ;; add
19c0: 20 6d 65 74 61 64 61 74 61 20 28 6e 65 65 64 20 metadata (need
19d0: 74 6f 20 64 6f 20 74 68 69 73 20 77 61 79 20 74 to do this way t
19e0: 6f 20 61 76 6f 69 64 20 53 51 4c 20 69 6e 6a 65 o avoid SQL inje
19f0: 63 74 69 6f 6e 20 69 73 73 75 65 73 29 0a 20 20 ction issues).
1a00: 20 20 3b 3b 20 3a 76 61 6c 75 65 0a 20 20 20 20 ;; :value.
1a10: 28 6c 65 74 20 28 28 76 61 6c 20 28 68 61 73 68 (let ((val (hash
1a20: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
1a30: 6c 74 20 6f 74 68 65 72 64 61 74 20 22 3a 76 61 lt otherdat ":va
1a40: 6c 75 65 22 20 23 66 29 29 29 0a 20 20 20 20 20 lue" #f))).
1a50: 20 28 69 66 20 76 61 6c 0a 09 20 20 28 73 71 6c (if val.. (sql
1a60: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 ite3:execute db
1a70: 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 "UPDATE tests SE
1a80: 54 20 76 61 6c 75 65 3d 3f 20 57 48 45 52 45 20 T value=? WHERE
1a90: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
1aa0: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
1ab0: 5f 70 61 74 68 3d 3f 3b 22 20 76 61 6c 20 72 75 _path=?;" val ru
1ac0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
1ad0: 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 tem-path))).
1ae0: 3b 3b 20 3a 65 78 70 65 63 74 65 64 5f 76 61 6c ;; :expected_val
1af0: 75 65 0a 20 20 20 20 28 6c 65 74 20 28 28 76 61 ue. (let ((va
1b00: 6c 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 l (hash-table-re
1b10: 66 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 64 f/default otherd
1b20: 61 74 20 22 3a 65 78 70 65 63 74 65 64 5f 76 61 at ":expected_va
1b30: 6c 75 65 22 20 23 66 29 29 29 0a 20 20 20 20 20 lue" #f))).
1b40: 20 28 69 66 20 76 61 6c 0a 09 20 20 28 73 71 6c (if val.. (sql
1b50: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 ite3:execute db
1b60: 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 "UPDATE tests SE
1b70: 54 20 65 78 70 65 63 74 65 64 5f 76 61 6c 75 65 T expected_value
1b80: 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d =? WHERE run_id=
1b90: 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f ? AND testname=?
1ba0: 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f AND item_path=?
1bb0: 3b 22 20 76 61 6c 20 72 75 6e 2d 69 64 20 74 65 ;" val run-id te
1bc0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
1bd0: 68 29 29 29 0a 20 20 20 20 3b 3b 20 3a 74 6f 6c h))). ;; :tol
1be0: 0a 20 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 . (let ((val
1bf0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
1c00: 64 65 66 61 75 6c 74 20 6f 74 68 65 72 64 61 74 default otherdat
1c10: 20 22 3a 74 6f 6c 22 20 23 66 29 29 29 0a 20 20 ":tol" #f))).
1c20: 20 20 20 20 28 69 66 20 76 61 6c 0a 09 20 20 28 (if val.. (
1c30: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
1c40: 64 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 db "UPDATE tests
1c50: 20 53 45 54 20 74 6f 6c 3d 3f 20 57 48 45 52 45 SET tol=? WHERE
1c60: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
1c70: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
1c80: 6d 5f 70 61 74 68 3d 3f 3b 22 20 76 61 6c 20 72 m_path=?;" val r
1c90: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
1ca0: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 item-path))).
1cb0: 20 3b 3b 20 3a 66 69 72 73 74 5f 65 72 72 0a 20 ;; :first_err.
1cc0: 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 68 (let ((val (h
1cd0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
1ce0: 66 61 75 6c 74 20 6f 74 68 65 72 64 61 74 20 22 fault otherdat "
1cf0: 3a 66 69 72 73 74 5f 65 72 72 22 20 23 66 29 29 :first_err" #f))
1d00: 29 0a 20 20 20 20 20 20 28 69 66 20 76 61 6c 0a ). (if val.
1d10: 09 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 . (sqlite3:exec
1d20: 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 ute db "UPDATE t
1d30: 65 73 74 73 20 53 45 54 20 66 69 72 73 74 5f 65 ests SET first_e
1d40: 72 72 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 rr=? WHERE run_i
1d50: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
1d60: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
1d70: 3d 3f 3b 22 20 76 61 6c 20 72 75 6e 2d 69 64 20 =?;" val run-id
1d80: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
1d90: 61 74 68 29 29 29 0a 20 20 20 20 3b 3b 20 3a 66 ath))). ;; :f
1da0: 69 72 73 74 5f 77 61 72 6e 0a 20 20 20 20 28 6c irst_warn. (l
1db0: 65 74 20 28 28 76 61 6c 20 28 68 61 73 68 2d 74 et ((val (hash-t
1dc0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
1dd0: 20 6f 74 68 65 72 64 61 74 20 22 3a 66 69 72 73 otherdat ":firs
1de0: 74 5f 77 61 72 6e 22 20 23 66 29 29 29 0a 20 20 t_warn" #f))).
1df0: 20 20 20 20 28 69 66 20 76 61 6c 0a 09 20 20 28 (if val.. (
1e00: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
1e10: 64 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 db "UPDATE tests
1e20: 20 53 45 54 20 66 69 72 73 74 5f 77 61 72 6e 3d SET first_warn=
1e30: 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f ? WHERE run_id=?
1e40: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
1e50: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
1e60: 22 20 76 61 6c 20 72 75 6e 2d 69 64 20 74 65 73 " val run-id tes
1e70: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
1e80: 29 29 29 0a 20 20 20 20 28 6c 65 74 20 28 28 76 ))). (let ((v
1e90: 61 6c 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 al (hash-table-r
1ea0: 65 66 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 ef/default other
1eb0: 64 61 74 20 22 3a 75 6e 69 74 73 22 20 23 66 29 dat ":units" #f)
1ec0: 29 29 0a 20 20 20 20 20 20 28 69 66 20 76 61 6c )). (if val
1ed0: 0a 09 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 .. (sqlite3:exe
1ee0: 63 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 cute db "UPDATE
1ef0: 74 65 73 74 73 20 53 45 54 20 75 6e 69 74 73 3d tests SET units=
1f00: 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f ? WHERE run_id=?
1f10: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
1f20: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
1f30: 22 20 76 61 6c 20 72 75 6e 2d 69 64 20 74 65 73 " val run-id tes
1f40: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
1f50: 29 29 29 0a 20 20 20 20 3b 3b 20 3a 74 6f 6c 5f ))). ;; :tol_
1f60: 70 65 72 63 0a 20 20 20 20 28 6c 65 74 20 28 28 perc. (let ((
1f70: 76 61 6c 20 28 68 61 73 68 2d 74 61 62 6c 65 2d val (hash-table-
1f80: 72 65 66 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 ref/default othe
1f90: 72 64 61 74 20 22 3a 74 6f 6c 5f 70 65 72 63 22 rdat ":tol_perc"
1fa0: 20 23 66 29 29 29 0a 20 20 20 20 20 20 28 69 66 #f))). (if
1fb0: 20 76 61 6c 0a 09 20 20 28 73 71 6c 69 74 65 33 val.. (sqlite3
1fc0: 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 :execute db "UPD
1fd0: 41 54 45 20 74 65 73 74 73 20 53 45 54 20 74 6f ATE tests SET to
1fe0: 6c 5f 70 65 72 63 3d 3f 20 57 48 45 52 45 20 72 l_perc=? WHERE r
1ff0: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
2000: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
2010: 70 61 74 68 3d 3f 3b 22 20 76 61 6c 20 72 75 6e path=?;" val run
2020: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
2030: 65 6d 2d 70 61 74 68 29 29 29 0a 0a 20 20 20 20 em-path)))..
2040: 3b 3b 20 6e 65 65 64 20 74 6f 20 75 70 64 61 74 ;; need to updat
2050: 65 20 74 68 65 20 74 6f 70 20 74 65 73 74 20 72 e the top test r
2060: 65 63 6f 72 64 20 69 66 20 50 41 53 53 20 6f 72 ecord if PASS or
2070: 20 46 41 49 4c 20 61 6e 64 20 74 68 69 73 20 69 FAIL and this i
2080: 73 20 61 20 73 75 62 74 65 73 74 0a 20 20 20 20 s a subtest.
2090: 28 69 66 20 28 61 6e 64 20 28 6e 6f 74 20 28 65 (if (and (not (e
20a0: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
20b0: 22 22 29 29 0a 09 20 20 20 20 20 28 6f 72 20 28 "")).. (or (
20c0: 65 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 50 equal? status "P
20d0: 41 53 53 22 29 0a 09 09 20 28 65 71 75 61 6c 3f ASS")... (equal?
20e0: 20 73 74 61 74 75 73 20 22 57 41 52 4e 22 29 0a status "WARN").
20f0: 09 09 20 28 65 71 75 61 6c 3f 20 73 74 61 74 75 .. (equal? statu
2100: 73 20 22 46 41 49 4c 22 29 0a 09 09 20 28 65 71 s "FAIL")... (eq
2110: 75 61 6c 3f 20 73 74 61 74 75 73 20 22 57 41 49 ual? status "WAI
2120: 56 45 44 22 29 29 29 0a 09 28 62 65 67 69 6e 0a VED")))..(begin.
2130: 09 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 . (sqlite3:exec
2140: 75 74 65 20 0a 09 20 20 20 64 62 0a 09 20 20 20 ute .. db..
2150: 22 55 50 44 41 54 45 20 74 65 73 74 73 20 0a 20 "UPDATE tests .
2160: 20 20 20 20 20 20 20 20 20 20 20 20 53 45 54 20 SET
2170: 66 61 69 6c 5f 63 6f 75 6e 74 3d 28 53 45 4c 45 fail_count=(SELE
2180: 43 54 20 63 6f 75 6e 74 28 69 64 29 20 46 52 4f CT count(id) FRO
2190: 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 M tests WHERE ru
21a0: 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e n_id=? AND testn
21b0: 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 ame=? AND item_p
21c0: 61 74 68 20 21 3d 20 27 27 20 41 4e 44 20 73 74 ath != '' AND st
21d0: 61 74 75 73 3d 27 46 41 49 4c 27 29 2c 0a 20 20 atus='FAIL'),.
21e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 p
21f0: 61 73 73 5f 63 6f 75 6e 74 3d 28 53 45 4c 45 43 ass_count=(SELEC
2200: 54 20 63 6f 75 6e 74 28 69 64 29 20 46 52 4f 4d T count(id) FROM
2210: 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 6e tests WHERE run
2220: 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 _id=? AND testna
2230: 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 me=? AND item_pa
2240: 74 68 20 21 3d 20 27 27 20 41 4e 44 20 28 73 74 th != '' AND (st
2250: 61 74 75 73 3d 27 50 41 53 53 27 20 4f 52 20 73 atus='PASS' OR s
2260: 74 61 74 75 73 3d 27 57 41 52 4e 27 20 4f 52 20 tatus='WARN' OR
2270: 73 74 61 74 75 73 3d 27 57 41 49 56 45 44 27 29 status='WAIVED')
2280: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 57 ). W
2290: 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e HERE run_id=? AN
22a0: 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 D testname=? AND
22b0: 20 69 74 65 6d 5f 70 61 74 68 3d 27 27 3b 22 0a item_path='';".
22c0: 09 20 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d . run-id test-
22d0: 6e 61 6d 65 20 72 75 6e 2d 69 64 20 74 65 73 74 name run-id test
22e0: 2d 6e 61 6d 65 20 72 75 6e 2d 69 64 20 74 65 73 -name run-id tes
22f0: 74 2d 6e 61 6d 65 29 0a 09 20 20 28 73 71 6c 69 t-name).. (sqli
2300: 74 65 33 3a 65 78 65 63 75 74 65 0a 09 20 20 20 te3:execute..
2310: 64 62 0a 09 20 20 20 22 55 50 44 41 54 45 20 74 db.. "UPDATE t
2320: 65 73 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 ests.
2330: 20 20 53 45 54 20 73 74 61 74 65 3d 43 41 53 45 SET state=CASE
2340: 20 57 48 45 4e 20 28 53 45 4c 45 43 54 20 63 6f WHEN (SELECT co
2350: 75 6e 74 28 69 64 29 20 46 52 4f 4d 20 74 65 73 unt(id) FROM tes
2360: 74 73 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d ts WHERE run_id=
2370: 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f ? AND testname=?
2380: 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 20 21 AND item_path !
2390: 3d 20 27 27 20 41 4e 44 20 73 74 61 74 65 20 69 = '' AND state i
23a0: 6e 20 28 27 52 55 4e 4e 49 4e 47 27 2c 27 4e 4f n ('RUNNING','NO
23b0: 54 5f 53 54 41 52 54 45 44 27 29 29 20 3e 20 30 T_STARTED')) > 0
23c0: 20 54 48 45 4e 20 0a 20 20 20 20 20 20 20 20 20 THEN .
23d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23e0: 20 27 52 55 4e 4e 49 4e 47 27 0a 20 20 20 20 20 'RUNNING'.
23f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2400: 20 20 45 4c 53 45 20 27 43 4f 4d 50 4c 45 54 45 ELSE 'COMPLETE
2410: 44 27 20 45 4e 44 2c 0a 20 20 20 20 20 20 20 20 D' END,.
2420: 20 20 20 20 20 20 20 20 73 74 61 74 75 73 3d 43 status=C
2430: 41 53 45 20 57 48 45 4e 20 66 61 69 6c 5f 63 6f ASE WHEN fail_co
2440: 75 6e 74 20 3e 20 30 20 54 48 45 4e 20 27 46 41 unt > 0 THEN 'FA
2450: 49 4c 27 20 57 48 45 4e 20 70 61 73 73 5f 63 6f IL' WHEN pass_co
2460: 75 6e 74 20 3e 20 30 20 41 4e 44 20 66 61 69 6c unt > 0 AND fail
2470: 5f 63 6f 75 6e 74 3d 30 20 54 48 45 4e 20 27 50 _count=0 THEN 'P
2480: 41 53 53 27 20 45 4c 53 45 20 27 55 4e 4b 4e 4f ASS' ELSE 'UNKNO
2490: 57 4e 27 20 45 4e 44 0a 20 20 20 20 20 20 20 20 WN' END.
24a0: 20 20 20 20 20 57 48 45 52 45 20 72 75 6e 5f 69 WHERE run_i
24b0: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
24c0: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
24d0: 3d 27 27 3b 22 0a 09 20 20 20 72 75 6e 2d 69 64 ='';".. run-id
24e0: 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d 69 test-name run-i
24f0: 64 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 d test-name))).
2500: 20 20 20 28 69 66 20 28 6f 72 20 28 61 6e 64 20 (if (or (and
2510: 28 73 74 72 69 6e 67 3f 20 63 6f 6d 6d 65 6e 74 (string? comment
2520: 29 0a 09 09 20 28 73 74 72 69 6e 67 2d 6d 61 74 )... (string-mat
2530: 63 68 20 28 72 65 67 65 78 70 20 22 5c 5c 53 2b ch (regexp "\\S+
2540: 22 29 20 63 6f 6d 6d 65 6e 74 29 29 0a 09 20 20 ") comment))..
2550: 20 20 77 61 69 76 65 64 29 0a 09 28 73 71 6c 69 waived)..(sqli
2560: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
2570: 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 UPDATE tests SET
2580: 20 63 6f 6d 6d 65 6e 74 3d 3f 20 57 48 45 52 45 comment=? WHERE
2590: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
25a0: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
25b0: 6d 5f 70 61 74 68 3d 3f 3b 22 0a 09 09 09 20 28 m_path=?;".... (
25c0: 69 66 20 77 61 69 76 65 64 20 77 61 69 76 65 64 if waived waived
25d0: 20 63 6f 6d 6d 65 6e 74 29 20 72 75 6e 2d 69 64 comment) run-id
25e0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
25f0: 70 61 74 68 29 29 0a 20 20 20 20 29 29 0a 0a 28 path)). ))..(
2600: 64 65 66 69 6e 65 20 28 74 65 73 74 2d 73 65 74 define (test-set
2610: 2d 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 20 -log! db run-id
2620: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 61 test-name itemda
2630: 74 20 6c 6f 67 66 29 20 0a 20 20 28 6c 65 74 20 t logf) . (let
2640: 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 ((item-path (ite
2650: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 m-list->path ite
2660: 6d 64 61 74 29 29 29 0a 20 20 20 20 28 73 71 6c mdat))). (sql
2670: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 ite3:execute db
2680: 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 "UPDATE tests SE
2690: 54 20 66 69 6e 61 6c 5f 6c 6f 67 66 3d 3f 20 57 T final_logf=? W
26a0: 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e HERE run_id=? AN
26b0: 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 D testname=? AND
26c0: 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 20 0a item_path=?;" .
26d0: 09 09 20 20 20 20 20 6c 6f 67 66 20 72 75 6e 2d .. logf run-
26e0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
26f0: 6d 2d 70 61 74 68 29 29 29 0a 0a 28 64 65 66 69 m-path)))..(defi
2700: 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 74 6f 70 ne (test-set-top
2710: 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 20 74 log! db run-id t
2720: 65 73 74 2d 6e 61 6d 65 20 6c 6f 67 66 29 20 0a est-name logf) .
2730: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 (sqlite3:execu
2740: 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 65 te db "UPDATE te
2750: 73 74 73 20 53 45 54 20 66 69 6e 61 6c 5f 6c 6f sts SET final_lo
2760: 67 66 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 gf=? WHERE run_i
2770: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
2780: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
2790: 3d 27 27 3b 22 20 0a 09 09 20 20 20 6c 6f 67 66 ='';" ... logf
27a0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
27b0: 65 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 e))..(define (te
27c0: 73 74 73 3a 73 75 6d 6d 61 72 69 7a 65 2d 69 74 sts:summarize-it
27d0: 65 6d 73 20 64 62 20 72 75 6e 2d 69 64 20 74 65 ems db run-id te
27e0: 73 74 2d 6e 61 6d 65 20 66 6f 72 63 65 29 0a 20 st-name force).
27f0: 20 3b 3b 20 69 66 20 6e 6f 74 20 66 6f 72 63 65 ;; if not force
2800: 20 74 68 65 6e 20 6f 6e 6c 79 20 75 70 64 61 74 then only updat
2810: 65 20 74 68 65 20 72 65 63 6f 72 64 20 69 66 20 e the record if
2820: 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 69 73 20 one of these is
2830: 74 72 75 65 3a 0a 20 20 3b 3b 20 20 20 31 2e 20 true:. ;; 1.
2840: 6c 6f 67 66 20 69 73 20 22 6c 6f 67 2f 66 69 6e logf is "log/fin
2850: 61 6c 2e 6c 6f 67 0a 20 20 3b 3b 20 20 20 32 2e al.log. ;; 2.
2860: 20 6c 6f 67 66 20 69 73 20 73 61 6d 65 20 61 73 logf is same as
2870: 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 0a outputfilename.
2880: 20 20 28 6c 65 74 20 28 28 6f 75 74 70 75 74 66 (let ((outputf
2890: 69 6c 65 6e 61 6d 65 20 28 63 6f 6e 63 20 22 6d ilename (conc "m
28a0: 65 67 61 74 65 73 74 2d 72 6f 6c 6c 75 70 2d 22 egatest-rollup-"
28b0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2e 68 74 6d test-name ".htm
28c0: 6c 22 29 29 0a 09 28 6f 72 69 67 2d 64 69 72 20 l"))..(orig-dir
28d0: 20 20 20 20 20 20 28 63 75 72 72 65 6e 74 2d 64 (current-d
28e0: 69 72 65 63 74 6f 72 79 29 29 0a 09 28 6c 6f 67 irectory))..(log
28f0: 66 20 20 20 20 20 20 20 20 20 20 20 23 66 29 29 f #f))
2900: 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f . (sqlite3:fo
2910: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 20 r-each-row .
2920: 20 28 6c 61 6d 62 64 61 20 28 70 61 74 68 20 66 (lambda (path f
2930: 69 6e 61 6c 5f 6c 6f 67 66 29 0a 20 20 20 20 20 inal_logf).
2940: 20 20 28 73 65 74 21 20 6c 6f 67 66 20 66 69 6e (set! logf fin
2950: 61 6c 5f 6c 6f 67 66 29 0a 20 20 20 20 20 20 20 al_logf).
2960: 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 (if (directory?
2970: 70 61 74 68 29 0a 09 20 20 20 28 62 65 67 69 6e path).. (begin
2980: 0a 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 46 .. (print "F
2990: 6f 75 6e 64 20 70 61 74 68 3a 20 22 20 70 61 74 ound path: " pat
29a0: 68 29 0a 09 20 20 20 20 20 28 63 68 61 6e 67 65 h).. (change
29b0: 2d 64 69 72 65 63 74 6f 72 79 20 70 61 74 68 29 -directory path)
29c0: 29 0a 09 20 20 20 20 20 3b 3b 20 28 73 65 74 21 ).. ;; (set!
29d0: 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 20 outputfilename
29e0: 28 63 6f 6e 63 20 70 61 74 68 20 22 2f 22 20 6f (conc path "/" o
29f0: 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 29 29 utputfilename)))
2a00: 0a 09 20 20 20 28 70 72 69 6e 74 20 22 4e 6f 20 .. (print "No
2a10: 73 75 63 68 20 70 61 74 68 3a 20 22 20 70 61 74 such path: " pat
2a20: 68 29 29 29 0a 20 20 20 20 20 64 62 20 0a 20 20 h))). db .
2a30: 20 20 20 22 53 45 4c 45 43 54 20 72 75 6e 64 69 "SELECT rundi
2a40: 72 2c 66 69 6e 61 6c 5f 6c 6f 67 66 20 46 52 4f r,final_logf FRO
2a50: 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 M tests WHERE ru
2a60: 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e n_id=? AND testn
2a70: 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 ame=? AND item_p
2a80: 61 74 68 3d 27 27 3b 22 0a 20 20 20 20 20 72 75 ath='';". ru
2a90: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a n-id test-name).
2aa0: 20 20 20 20 28 70 72 69 6e 74 20 22 73 75 6d 6d (print "summ
2ab0: 61 72 69 7a 65 2d 69 74 65 6d 73 20 77 69 74 68 arize-items with
2ac0: 20 6c 6f 67 66 20 22 20 6c 6f 67 66 29 0a 20 20 logf " logf).
2ad0: 20 20 28 69 66 20 28 6f 72 20 28 65 71 75 61 6c (if (or (equal
2ae0: 3f 20 6c 6f 67 66 20 22 6c 6f 67 73 2f 66 69 6e ? logf "logs/fin
2af0: 61 6c 2e 6c 6f 67 22 29 0a 09 20 20 20 20 28 65 al.log").. (e
2b00: 71 75 61 6c 3f 20 6c 6f 67 66 20 6f 75 74 70 75 qual? logf outpu
2b10: 74 66 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 20 tfilename)..
2b20: 66 6f 72 63 65 29 0a 09 28 62 65 67 69 6e 0a 09 force)..(begin..
2b30: 20 20 28 69 66 20 28 6f 62 74 61 69 6e 2d 64 6f (if (obtain-do
2b40: 74 2d 6c 6f 63 6b 20 6f 75 74 70 75 74 66 69 6c t-lock outputfil
2b50: 65 6e 61 6d 65 20 31 20 32 30 20 33 30 29 20 3b ename 1 20 30) ;
2b60: 3b 20 72 65 74 72 79 20 65 76 65 72 79 20 73 65 ; retry every se
2b70: 63 6f 6e 64 20 66 6f 72 20 32 30 20 73 65 63 6f cond for 20 seco
2b80: 6e 64 73 2c 20 63 61 6c 6c 20 69 74 20 64 65 61 nds, call it dea
2b90: 64 20 61 66 74 65 72 20 33 30 20 73 65 63 6f 6e d after 30 secon
2ba0: 64 73 20 61 6e 64 20 73 74 65 61 6c 20 74 68 65 ds and steal the
2bb0: 20 6c 6f 63 6b 0a 09 20 20 20 20 20 20 28 70 72 lock.. (pr
2bc0: 69 6e 74 20 22 4f 62 74 61 69 6e 65 64 20 6c 6f int "Obtained lo
2bd0: 63 6b 20 66 6f 72 20 22 20 6f 75 74 70 75 74 66 ck for " outputf
2be0: 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 20 20 20 ilename)..
2bf0: 28 70 72 69 6e 74 20 22 46 61 69 6c 65 64 20 74 (print "Failed t
2c00: 6f 20 6f 62 74 61 69 6e 20 6c 6f 63 6b 20 66 6f o obtain lock fo
2c10: 72 20 22 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 r " outputfilena
2c20: 6d 65 29 29 0a 09 20 20 28 6c 65 74 20 28 28 6f me)).. (let ((o
2c30: 75 70 20 20 20 20 28 6f 70 65 6e 2d 6f 75 74 70 up (open-outp
2c40: 75 74 2d 66 69 6c 65 20 6f 75 74 70 75 74 66 69 ut-file outputfi
2c50: 6c 65 6e 61 6d 65 29 29 0a 09 09 28 63 6f 75 6e lename))...(coun
2c60: 74 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 ts (make-hash-ta
2c70: 62 6c 65 29 29 0a 09 09 28 73 74 61 74 65 63 6f ble))...(stateco
2c80: 75 6e 74 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d unts (make-hash-
2c90: 74 61 62 6c 65 29 29 0a 09 09 28 6f 75 74 74 78 table))...(outtx
2ca0: 74 20 22 22 29 0a 09 09 28 74 6f 74 20 20 20 20 t "")...(tot
2cb0: 30 29 29 0a 09 20 20 20 20 28 77 69 74 68 2d 6f 0)).. (with-o
2cc0: 75 74 70 75 74 2d 74 6f 2d 70 6f 72 74 0a 09 09 utput-to-port...
2cd0: 6f 75 70 0a 09 20 20 20 20 20 20 28 6c 61 6d 62 oup.. (lamb
2ce0: 64 61 20 28 29 0a 09 09 28 73 65 74 21 20 6f 75 da ()...(set! ou
2cf0: 74 74 78 74 20 28 63 6f 6e 63 20 6f 75 74 74 78 ttxt (conc outtx
2d00: 74 20 22 3c 68 74 6d 6c 3e 3c 74 69 74 6c 65 3e t "<html><title>
2d10: 53 75 6d 6d 61 72 79 3a 20 22 20 74 65 73 74 2d Summary: " test-
2d20: 6e 61 6d 65 20 0a 09 09 09 09 20 20 20 22 3c 2f name ..... "</
2d30: 74 69 74 6c 65 3e 3c 62 6f 64 79 3e 3c 68 32 3e title><body><h2>
2d40: 53 75 6d 6d 61 72 79 20 66 6f 72 20 22 20 74 65 Summary for " te
2d50: 73 74 2d 6e 61 6d 65 20 22 3c 2f 68 32 3e 22 29 st-name "</h2>")
2d60: 29 0a 09 09 28 73 71 6c 69 74 65 33 3a 66 6f 72 )...(sqlite3:for
2d70: 2d 65 61 63 68 2d 72 6f 77 20 0a 09 09 20 28 6c -each-row ... (l
2d80: 61 6d 62 64 61 20 28 69 64 20 69 74 65 6d 70 61 ambda (id itempa
2d90: 74 68 20 73 74 61 74 65 20 73 74 61 74 75 73 20 th state status
2da0: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 6c 6f 67 run_duration log
2db0: 66 20 63 6f 6d 6d 65 6e 74 29 0a 09 09 20 20 20 f comment)...
2dc0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 (hash-table-set!
2dd0: 20 63 6f 75 6e 74 73 20 73 74 61 74 75 73 20 28 counts status (
2de0: 2b 20 31 20 28 68 61 73 68 2d 74 61 62 6c 65 2d + 1 (hash-table-
2df0: 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 75 6e ref/default coun
2e00: 74 73 20 73 74 61 74 75 73 20 30 29 29 29 0a 09 ts status 0)))..
2e10: 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d . (hash-table-
2e20: 73 65 74 21 20 73 74 61 74 65 63 6f 75 6e 74 73 set! statecounts
2e30: 20 73 74 61 74 65 20 28 2b 20 31 20 28 68 61 73 state (+ 1 (has
2e40: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
2e50: 75 6c 74 20 73 74 61 74 65 63 6f 75 6e 74 73 20 ult statecounts
2e60: 73 74 61 74 65 20 30 29 29 29 0a 09 09 20 20 20 state 0)))...
2e70: 28 73 65 74 21 20 6f 75 74 74 78 74 20 28 63 6f (set! outtxt (co
2e80: 6e 63 20 6f 75 74 74 78 74 20 22 3c 74 72 3e 22 nc outtxt "<tr>"
2e90: 0a 09 09 09 09 20 20 20 20 20 20 22 3c 74 64 3e ..... "<td>
2ea0: 3c 61 20 68 72 65 66 3d 5c 22 22 20 69 74 65 6d <a href=\"" item
2eb0: 70 61 74 68 20 22 2f 22 20 6c 6f 67 66 20 22 5c path "/" logf "\
2ec0: 22 3e 20 22 20 69 74 65 6d 70 61 74 68 20 22 3c "> " itempath "<
2ed0: 2f 61 3e 3c 2f 74 64 3e 22 20 0a 09 09 09 09 20 /a></td>" .....
2ee0: 20 20 20 20 20 22 3c 74 64 3e 22 20 73 74 61 74 "<td>" stat
2ef0: 65 20 20 20 20 22 3c 2f 74 64 3e 22 20 0a 09 09 e "</td>" ...
2f00: 09 09 20 20 20 20 20 20 22 3c 74 64 3e 3c 66 6f .. "<td><fo
2f10: 6e 74 20 63 6f 6c 6f 72 3d 22 20 28 63 6f 6d 6d nt color=" (comm
2f20: 6f 6e 3a 67 65 74 2d 63 6f 6c 6f 72 2d 66 72 6f on:get-color-fro
2f30: 6d 2d 73 74 61 74 75 73 20 73 74 61 74 75 73 29 m-status status)
2f40: 0a 09 09 09 09 20 20 20 20 20 20 22 3e 22 20 20 ..... ">"
2f50: 20 73 74 61 74 75 73 20 20 20 22 3c 2f 66 6f 6e status "</fon
2f60: 74 3e 3c 2f 74 64 3e 22 0a 09 09 09 09 20 20 20 t></td>".....
2f70: 20 20 20 22 3c 74 64 3e 22 20 28 69 66 20 28 65 "<td>" (if (e
2f80: 71 75 61 6c 3f 20 63 6f 6d 6d 65 6e 74 20 22 22 qual? comment ""
2f90: 29 0a 09 09 09 09 09 09 20 22 26 6e 62 73 70 3b )....... "
2fa0: 22 0a 09 09 09 09 09 09 20 63 6f 6d 6d 65 6e 74 "....... comment
2fb0: 29 20 22 3c 2f 74 64 3e 22 0a 09 09 09 09 09 09 ) "</td>".......
2fc0: 20 22 3c 2f 74 72 3e 22 29 29 29 0a 09 09 20 64 "</tr>")))... d
2fd0: 62 0a 09 09 20 22 53 45 4c 45 43 54 20 69 64 2c b... "SELECT id,
2fe0: 69 74 65 6d 5f 70 61 74 68 2c 73 74 61 74 65 2c item_path,state,
2ff0: 73 74 61 74 75 73 2c 72 75 6e 5f 64 75 72 61 74 status,run_durat
3000: 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 ion,final_logf,c
3010: 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 omment FROM test
3020: 73 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f s WHERE run_id=?
3030: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
3040: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d AND item_path !=
3050: 20 27 27 3b 22 0a 09 09 20 72 75 6e 2d 69 64 20 '';"... run-id
3060: 74 65 73 74 2d 6e 61 6d 65 29 0a 0a 09 09 28 70 test-name)....(p
3070: 72 69 6e 74 20 22 3c 74 61 62 6c 65 3e 3c 74 72 rint "<table><tr
3080: 3e 3c 74 64 20 76 61 6c 69 67 6e 3d 5c 22 74 6f ><td valign=\"to
3090: 70 5c 22 3e 22 29 0a 09 09 3b 3b 20 50 72 69 6e p\">")...;; Prin
30a0: 74 20 6f 75 74 20 73 74 61 74 73 20 66 6f 72 20 t out stats for
30b0: 73 74 61 74 75 73 0a 09 09 28 73 65 74 21 20 74 status...(set! t
30c0: 6f 74 20 30 29 0a 09 09 28 70 72 69 6e 74 20 22 ot 0)...(print "
30d0: 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 <table cellspaci
30e0: 6e 67 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 3d ng=\"0\" border=
30f0: 5c 22 31 5c 22 3e 3c 74 72 3e 3c 74 64 20 63 6f \"1\"><tr><td co
3100: 6c 73 70 61 6e 3d 5c 22 32 5c 22 3e 3c 68 32 3e lspan=\"2\"><h2>
3110: 53 74 61 74 65 20 73 74 61 74 73 3c 2f 68 32 3e State stats</h2>
3120: 3c 2f 74 64 3e 3c 2f 74 72 3e 22 29 0a 09 09 28 </td></tr>")...(
3130: 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 for-each (lambda
3140: 20 28 73 74 61 74 65 29 0a 09 09 09 20 20 20 20 (state)....
3150: 28 73 65 74 21 20 74 6f 74 20 28 2b 20 74 6f 74 (set! tot (+ tot
3160: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
3170: 20 73 74 61 74 65 63 6f 75 6e 74 73 20 73 74 61 statecounts sta
3180: 74 65 29 29 29 0a 09 09 09 20 20 20 20 28 70 72 te))).... (pr
3190: 69 6e 74 20 22 3c 74 72 3e 3c 74 64 3e 22 20 73 int "<tr><td>" s
31a0: 74 61 74 65 20 22 3c 2f 74 64 3e 3c 74 64 3e 22 tate "</td><td>"
31b0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
31c0: 20 73 74 61 74 65 63 6f 75 6e 74 73 20 73 74 61 statecounts sta
31d0: 74 65 29 20 22 3c 2f 74 64 3e 3c 2f 74 72 3e 22 te) "</td></tr>"
31e0: 29 29 0a 09 09 09 20 20 28 68 61 73 68 2d 74 61 )).... (hash-ta
31f0: 62 6c 65 2d 6b 65 79 73 20 73 74 61 74 65 63 6f ble-keys stateco
3200: 75 6e 74 73 29 29 0a 09 09 28 70 72 69 6e 74 20 unts))...(print
3210: 22 3c 74 72 3e 3c 74 64 3e 54 6f 74 61 6c 3c 2f "<tr><td>Total</
3220: 74 64 3e 3c 74 64 3e 22 20 74 6f 74 20 22 3c 2f td><td>" tot "</
3230: 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e td></tr></table>
3240: 22 29 0a 09 09 28 70 72 69 6e 74 20 22 3c 2f 74 ")...(print "</t
3250: 64 3e 3c 74 64 20 76 61 6c 69 67 6e 3d 5c 22 74 d><td valign=\"t
3260: 6f 70 5c 22 3e 22 29 0a 09 09 3b 3b 20 50 72 69 op\">")...;; Pri
3270: 6e 74 20 6f 75 74 20 73 74 61 74 73 20 66 6f 72 nt out stats for
3280: 20 73 74 61 74 65 0a 09 09 28 73 65 74 21 20 74 state...(set! t
3290: 6f 74 20 30 29 0a 09 09 28 70 72 69 6e 74 20 22 ot 0)...(print "
32a0: 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 <table cellspaci
32b0: 6e 67 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 3d ng=\"0\" border=
32c0: 5c 22 31 5c 22 3e 3c 74 72 3e 3c 74 64 20 63 6f \"1\"><tr><td co
32d0: 6c 73 70 61 6e 3d 5c 22 32 5c 22 3e 3c 68 32 3e lspan=\"2\"><h2>
32e0: 53 74 61 74 75 73 20 73 74 61 74 73 3c 2f 68 32 Status stats</h2
32f0: 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 22 29 0a 09 09 ></td></tr>")...
3300: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
3310: 61 20 28 73 74 61 74 75 73 29 0a 09 09 09 20 20 a (status)....
3320: 20 20 28 73 65 74 21 20 74 6f 74 20 28 2b 20 74 (set! tot (+ t
3330: 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 ot (hash-table-r
3340: 65 66 20 63 6f 75 6e 74 73 20 73 74 61 74 75 73 ef counts status
3350: 29 29 29 0a 09 09 09 20 20 20 20 28 70 72 69 6e ))).... (prin
3360: 74 20 22 3c 74 72 3e 3c 74 64 3e 3c 66 6f 6e 74 t "<tr><td><font
3370: 20 63 6f 6c 6f 72 3d 5c 22 22 20 28 63 6f 6d 6d color=\"" (comm
3380: 6f 6e 3a 67 65 74 2d 63 6f 6c 6f 72 2d 66 72 6f on:get-color-fro
3390: 6d 2d 73 74 61 74 75 73 20 73 74 61 74 75 73 29 m-status status)
33a0: 20 22 5c 22 3e 22 20 73 74 61 74 75 73 0a 09 09 "\">" status...
33b0: 09 09 20 20 20 22 3c 2f 66 6f 6e 74 3e 3c 2f 74 .. "</font></t
33c0: 64 3e 3c 74 64 3e 22 20 28 68 61 73 68 2d 74 61 d><td>" (hash-ta
33d0: 62 6c 65 2d 72 65 66 20 63 6f 75 6e 74 73 20 73 ble-ref counts s
33e0: 74 61 74 75 73 29 20 22 3c 2f 74 64 3e 3c 2f 74 tatus) "</td></t
33f0: 72 3e 22 29 29 0a 09 09 09 20 20 28 68 61 73 68 r>")).... (hash
3400: 2d 74 61 62 6c 65 2d 6b 65 79 73 20 63 6f 75 6e -table-keys coun
3410: 74 73 29 29 0a 09 09 28 70 72 69 6e 74 20 22 3c ts))...(print "<
3420: 74 72 3e 3c 74 64 3e 54 6f 74 61 6c 3c 2f 74 64 tr><td>Total</td
3430: 3e 3c 74 64 3e 22 20 74 6f 74 20 22 3c 2f 74 64 ><td>" tot "</td
3440: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 22 29 ></tr></table>")
3450: 0a 09 09 28 70 72 69 6e 74 20 22 3c 2f 74 64 3e ...(print "</td>
3460: 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c </td></tr></tabl
3470: 65 3e 22 29 0a 0a 09 09 28 70 72 69 6e 74 20 22 e>")....(print "
3480: 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 <table cellspaci
3490: 6e 67 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 3d ng=\"0\" border=
34a0: 5c 22 31 5c 22 3e 22 20 0a 09 09 20 20 20 20 20 \"1\">" ...
34b0: 20 20 22 3c 74 72 3e 3c 74 64 3e 49 74 65 6d 3c "<tr><td>Item<
34c0: 2f 74 64 3e 3c 74 64 3e 53 74 61 74 65 3c 2f 74 /td><td>State</t
34d0: 64 3e 3c 74 64 3e 53 74 61 74 75 73 3c 2f 74 64 d><td>Status</td
34e0: 3e 3c 74 64 3e 43 6f 6d 6d 65 6e 74 3c 2f 74 64 ><td>Comment</td
34f0: 3e 22 0a 09 09 20 20 20 20 20 20 20 6f 75 74 74 >"... outt
3500: 78 74 20 22 3c 2f 74 61 62 6c 65 3e 3c 2f 62 6f xt "</table></bo
3510: 64 79 3e 3c 2f 68 74 6d 6c 3e 22 29 0a 09 09 28 dy></html>")...(
3520: 72 65 6c 65 61 73 65 2d 64 6f 74 2d 6c 6f 63 6b release-dot-lock
3530: 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 outputfilename)
3540: 29 29 0a 09 20 20 20 20 28 63 6c 6f 73 65 2d 6f )).. (close-o
3550: 75 74 70 75 74 2d 70 6f 72 74 20 6f 75 70 29 0a utput-port oup).
3560: 09 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 . (change-dir
3570: 65 63 74 6f 72 79 20 6f 72 69 67 2d 64 69 72 29 ectory orig-dir)
3580: 0a 09 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d .. (test-set-
3590: 74 6f 70 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 toplog! db run-i
35a0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 6f 75 74 70 d test-name outp
35b0: 75 74 66 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 utfilename)..
35c0: 20 29 29 29 29 29 0a 0a 3b 3b 20 3b 3b 20 54 4f )))))..;; ;; TO
35d0: 44 4f 3a 20 43 6f 6e 76 65 72 67 65 20 74 68 69 DO: Converge thi
35e0: 73 20 77 69 74 68 20 64 62 3a 67 65 74 2d 74 65 s with db:get-te
35f0: 73 74 2d 69 6e 66 6f 0a 3b 3b 20 28 64 65 66 69 st-info.;; (defi
3600: 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d 74 65 73 ne (runs:get-tes
3610: 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 t-info db run-id
3620: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
3630: 70 61 74 68 29 0a 3b 3b 20 20 20 28 6c 65 74 20 path).;; (let
3640: 28 28 72 65 73 20 23 66 29 29 20 3b 3b 20 28 76 ((res #f)) ;; (v
3650: 65 63 74 6f 72 20 23 66 20 23 66 20 23 66 20 23 ector #f #f #f #
3660: 66 20 23 66 20 23 66 29 29 29 0a 3b 3b 20 20 20 f #f #f))).;;
3670: 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 (sqlite3:for-e
3680: 61 63 68 2d 72 6f 77 20 0a 3b 3b 20 20 20 20 20 ach-row .;;
3690: 20 28 6c 61 6d 62 64 61 20 28 69 64 20 72 75 6e (lambda (id run
36a0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 -id test-name st
36b0: 61 74 65 20 73 74 61 74 75 73 29 0a 3b 3b 20 20 ate status).;;
36c0: 20 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 (set! res
36d0: 28 76 65 63 74 6f 72 20 69 64 20 72 75 6e 2d 69 (vector id run-i
36e0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 d test-name stat
36f0: 65 20 73 74 61 74 75 73 20 69 74 65 6d 2d 70 61 e status item-pa
3700: 74 68 29 29 29 0a 3b 3b 20 20 20 20 20 20 64 62 th))).;; db
3710: 20 22 53 45 4c 45 43 54 20 69 64 2c 72 75 6e 5f "SELECT id,run_
3720: 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 id,testname,stat
3730: 65 2c 73 74 61 74 75 73 20 46 52 4f 4d 20 74 65 e,status FROM te
3740: 73 74 73 20 57 48 45 52 45 20 72 75 6e 5f 69 64 sts WHERE run_id
3750: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
3760: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
3770: 3f 3b 22 0a 3b 3b 20 20 20 20 20 20 72 75 6e 2d ?;".;; run-
3780: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
3790: 6d 2d 70 61 74 68 29 0a 3b 3b 20 20 20 20 20 72 m-path).;; r
37a0: 65 73 29 29 0a 0a 28 64 65 66 69 6e 65 2d 69 6e es))..(define-in
37b0: 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d 69 line (test:get-i
37c0: 64 20 76 65 63 29 20 20 20 20 20 20 20 28 76 65 d vec) (ve
37d0: 63 74 6f 72 2d 72 65 66 20 76 65 63 20 30 29 29 ctor-ref vec 0))
37e0: 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 .(define-inline
37f0: 28 74 65 73 74 3a 67 65 74 2d 72 75 6e 5f 69 64 (test:get-run_id
3800: 20 76 65 63 29 20 20 20 28 76 65 63 74 6f 72 2d vec) (vector-
3810: 72 65 66 20 76 65 63 20 31 29 29 0a 28 64 65 66 ref vec 1)).(def
3820: 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 ine-inline (test
3830: 3a 67 65 74 2d 74 65 73 74 2d 6e 61 6d 65 20 76 :get-test-name v
3840: 65 63 29 28 76 65 63 74 6f 72 2d 72 65 66 20 76 ec)(vector-ref v
3850: 65 63 20 32 29 29 0a 28 64 65 66 69 6e 65 2d 69 ec 2)).(define-i
3860: 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d nline (test:get-
3870: 73 74 61 74 65 20 76 65 63 29 20 20 20 20 28 76 state vec) (v
3880: 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 33 29 ector-ref vec 3)
3890: 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 ).(define-inline
38a0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
38b0: 73 20 76 65 63 29 20 20 20 28 76 65 63 74 6f 72 s vec) (vector
38c0: 2d 72 65 66 20 76 65 63 20 34 29 29 0a 28 64 65 -ref vec 4)).(de
38d0: 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 fine-inline (tes
38e0: 74 3a 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t:get-item-path
38f0: 76 65 63 29 28 76 65 63 74 6f 72 2d 72 65 66 20 vec)(vector-ref
3900: 76 65 63 20 35 29 29 0a 0a 28 64 65 66 69 6e 65 vec 5))..(define
3910: 20 28 72 75 6e 73 3a 74 65 73 74 2d 67 65 74 2d (runs:test-get-
3920: 66 75 6c 6c 2d 70 61 74 68 20 74 65 73 74 29 0a full-path test).
3930: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 (let* ((testna
3940: 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d me (db:test-get-
3950: 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74 29 testname test)
3960: 29 0a 09 20 28 69 74 65 6d 70 61 74 68 20 28 64 ).. (itempath (d
3970: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
3980: 70 61 74 68 20 74 65 73 74 29 29 29 0a 20 20 20 path test))).
3990: 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 (conc testname
39a0: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
39b0: 70 61 74 68 20 22 22 29 20 22 22 20 28 63 6f 6e path "") "" (con
39c0: 63 20 22 28 22 20 69 74 65 6d 70 61 74 68 20 22 c "(" itempath "
39d0: 29 22 29 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 )")))))..(define
39e0: 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 74 65 -inline (test:te
39f0: 73 74 2d 67 65 74 2d 66 75 6c 6c 6e 61 6d 65 20 st-get-fullname
3a00: 74 65 73 74 29 0a 20 20 20 28 63 6f 6e 63 20 28 test). (conc (
3a10: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
3a20: 6e 61 6d 65 20 74 65 73 74 29 0a 09 20 28 69 66 name test).. (if
3a30: 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 (equal? (db:tes
3a40: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t-get-item-path
3a50: 74 65 73 74 29 20 22 22 29 0a 09 20 20 20 20 20 test) "")..
3a60: 22 22 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22 "".. (conc "
3a70: 28 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (" (db:test-get-
3a80: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 20 item-path test)
3a90: 22 29 22 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 ")"))))..(define
3aa0: 20 28 63 68 65 63 6b 2d 76 61 6c 69 64 2d 69 74 (check-valid-it
3ab0: 65 6d 73 20 63 6c 61 73 73 20 69 74 65 6d 29 0a ems class item).
3ac0: 20 20 28 6c 65 74 20 28 28 76 61 6c 69 64 2d 76 (let ((valid-v
3ad0: 61 6c 75 65 73 20 28 6c 65 74 20 28 28 73 20 28 alues (let ((s (
3ae0: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 config-lookup *c
3af0: 6f 6e 66 69 67 64 61 74 2a 20 22 76 61 6c 69 64 onfigdat* "valid
3b00: 76 61 6c 75 65 73 22 20 63 6c 61 73 73 29 29 29 values" class)))
3b10: 0a 09 09 09 28 69 66 20 73 20 28 73 74 72 69 6e ....(if s (strin
3b20: 67 2d 73 70 6c 69 74 20 73 29 20 23 66 29 29 29 g-split s) #f)))
3b30: 29 0a 20 20 20 20 28 69 66 20 76 61 6c 69 64 2d ). (if valid-
3b40: 76 61 6c 75 65 73 0a 09 28 69 66 20 28 6d 65 6d values..(if (mem
3b50: 62 65 72 20 69 74 65 6d 20 76 61 6c 69 64 2d 76 ber item valid-v
3b60: 61 6c 75 65 73 29 0a 09 20 20 20 20 69 74 65 6d alues).. item
3b70: 20 23 66 29 0a 09 69 74 65 6d 29 29 29 0a 0a 28 #f)..item)))..(
3b80: 64 65 66 69 6e 65 20 28 74 65 73 74 73 74 65 70 define (teststep
3b90: 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 20 -set-status! db
3ba0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
3bb0: 20 74 65 73 74 73 74 65 70 2d 6e 61 6d 65 20 73 teststep-name s
3bc0: 74 61 74 65 2d 69 6e 20 73 74 61 74 75 73 2d 69 tate-in status-i
3bd0: 6e 20 69 74 65 6d 64 61 74 20 63 6f 6d 6d 65 6e n itemdat commen
3be0: 74 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e t). (debug:prin
3bf0: 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 72 t 4 "run-id: " r
3c00: 75 6e 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 6d un-id " test-nam
3c10: 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 29 0a e: " test-name).
3c20: 20 20 28 6c 65 74 2a 20 28 28 73 74 61 74 65 20 (let* ((state
3c30: 20 20 20 20 28 63 68 65 63 6b 2d 76 61 6c 69 64 (check-valid
3c40: 2d 69 74 65 6d 73 20 22 73 74 61 74 65 22 20 73 -items "state" s
3c50: 74 61 74 65 2d 69 6e 29 29 0a 09 20 28 73 74 61 tate-in)).. (sta
3c60: 74 75 73 20 20 20 20 28 63 68 65 63 6b 2d 76 61 tus (check-va
3c70: 6c 69 64 2d 69 74 65 6d 73 20 22 73 74 61 74 75 lid-items "statu
3c80: 73 22 20 73 74 61 74 75 73 2d 69 6e 29 29 0a 09 s" status-in))..
3c90: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 (item-path (ite
3ca0: 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 m-list->path ite
3cb0: 6d 64 61 74 29 29 0a 09 20 28 74 65 73 74 64 61 mdat)).. (testda
3cc0: 74 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73 74 t (db:get-test
3cd0: 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 -info db run-id
3ce0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
3cf0: 61 74 68 29 29 29 0a 20 20 20 20 28 64 65 62 75 ath))). (debu
3d00: 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 64 g:print 5 "testd
3d10: 61 74 3a 20 22 20 74 65 73 74 64 61 74 29 0a 20 at: " testdat).
3d20: 20 20 20 28 69 66 20 28 61 6e 64 20 74 65 73 74 (if (and test
3d30: 64 61 74 20 3b 3b 20 69 66 20 74 68 65 20 73 65 dat ;; if the se
3d40: 63 74 69 6f 6e 20 65 78 69 73 74 73 20 74 68 65 ction exists the
3d50: 6e 20 66 6f 72 63 65 20 73 70 65 63 69 66 69 63 n force specific
3d60: 61 74 69 6f 6e 20 42 55 47 2c 20 49 20 64 6f 6e ation BUG, I don
3d70: 27 74 20 6c 69 6b 65 20 68 6f 77 20 74 68 69 73 't like how this
3d80: 20 77 6f 72 6b 73 2e 0a 09 20 20 20 20 20 28 6f works... (o
3d90: 72 20 28 6e 6f 74 20 73 74 61 74 65 29 28 6e 6f r (not state)(no
3da0: 74 20 73 74 61 74 75 73 29 29 29 0a 09 28 64 65 t status)))..(de
3db0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
3dc0: 4e 49 4e 47 3a 20 49 6e 76 61 6c 69 64 20 22 20 NING: Invalid "
3dd0: 28 69 66 20 73 74 61 74 75 73 20 22 73 74 61 74 (if status "stat
3de0: 75 73 22 20 22 73 74 61 74 65 22 29 0a 09 20 20 us" "state")..
3df0: 20 20 20 20 20 22 20 76 61 6c 75 65 20 5c 22 22 " value \""
3e00: 20 28 69 66 20 73 74 61 74 75 73 20 73 74 61 74 (if status stat
3e10: 75 73 2d 69 6e 20 73 74 61 74 65 2d 69 6e 29 20 us-in state-in)
3e20: 22 5c 22 2c 20 75 70 64 61 74 65 20 79 6f 75 72 "\", update your
3e30: 20 76 61 6c 69 64 73 74 61 74 65 73 20 73 65 63 validstates sec
3e40: 74 69 6f 6e 20 69 6e 20 6d 65 67 61 74 65 73 74 tion in megatest
3e50: 2e 63 6f 6e 66 69 67 22 29 29 0a 20 20 20 20 28 .config")). (
3e60: 69 66 20 74 65 73 74 64 61 74 0a 09 28 6c 65 74 if testdat..(let
3e70: 20 28 28 74 65 73 74 2d 69 64 20 28 74 65 73 74 ((test-id (test
3e80: 3a 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 :get-id testdat)
3e90: 29 29 0a 09 20 20 28 73 71 6c 69 74 65 33 3a 65 )).. (sqlite3:e
3ea0: 78 65 63 75 74 65 20 64 62 20 0a 09 09 09 22 49 xecute db ...."I
3eb0: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 NSERT OR REPLACE
3ec0: 20 69 6e 74 6f 20 74 65 73 74 5f 73 74 65 70 73 into test_steps
3ed0: 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 (test_id,stepna
3ee0: 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c me,state,status,
3ef0: 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 event_time,comme
3f00: 6e 74 29 20 56 41 4c 55 45 53 28 3f 2c 3f 2c 3f nt) VALUES(?,?,?
3f10: 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27 ,?,strftime('%s'
3f20: 2c 27 6e 6f 77 27 29 2c 3f 29 3b 22 0a 09 09 09 ,'now'),?);"....
3f30: 74 65 73 74 2d 69 64 20 74 65 73 74 73 74 65 70 test-id teststep
3f40: 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 -name state stat
3f50: 75 73 20 28 69 66 20 63 6f 6d 6d 65 6e 74 20 63 us (if comment c
3f60: 6f 6d 6d 65 6e 74 20 22 22 29 29 29 0a 09 28 64 omment "")))..(d
3f70: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
3f80: 52 4f 52 3a 20 43 61 6e 27 74 20 75 70 64 61 74 ROR: Can't updat
3f90: 65 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 e " test-name "
3fa0: 66 6f 72 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 for run " run-id
3fb0: 20 22 20 2d 3e 20 6e 6f 20 73 75 63 68 20 74 65 " -> no such te
3fc0: 73 74 20 69 6e 20 64 62 22 29 29 29 29 0a 0a 28 st in db"))))..(
3fd0: 64 65 66 69 6e 65 20 28 74 65 73 74 2d 67 65 74 define (test-get
3fe0: 2d 6b 69 6c 6c 2d 72 65 71 75 65 73 74 20 64 62 -kill-request db
3ff0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
4000: 65 20 69 74 65 6d 64 61 74 29 0a 20 20 28 6c 65 e itemdat). (le
4010: 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 t* ((item-path (
4020: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
4030: 69 74 65 6d 64 61 74 29 29 0a 09 20 28 74 65 73 itemdat)).. (tes
4040: 74 64 61 74 20 20 20 28 64 62 3a 67 65 74 2d 74 tdat (db:get-t
4050: 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d est-info db run-
4060: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
4070: 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 28 65 m-path))). (e
4080: 71 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d qual? (test:get-
4090: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 state testdat) "
40a0: 4b 49 4c 4c 52 45 51 22 29 29 29 0a 0a 28 64 65 KILLREQ")))..(de
40b0: 66 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 6d fine (test-set-m
40c0: 65 74 61 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d eta-info db run-
40d0: 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d id testname item
40e0: 64 61 74 29 0a 20 20 28 6c 65 74 20 28 28 69 74 dat). (let ((it
40f0: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 em-path (item-li
4100: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 st->path itemdat
4110: 29 29 0a 09 28 63 70 75 6c 6f 61 64 20 20 28 67 ))..(cpuload (g
4120: 65 74 2d 63 70 75 2d 6c 6f 61 64 29 29 0a 09 28 et-cpu-load))..(
4130: 68 6f 73 74 6e 61 6d 65 20 28 67 65 74 2d 68 6f hostname (get-ho
4140: 73 74 2d 6e 61 6d 65 29 29 0a 09 28 64 69 73 6b st-name))..(disk
4150: 66 72 65 65 20 28 67 65 74 2d 64 66 20 28 63 75 free (get-df (cu
4160: 72 72 65 6e 74 2d 64 69 72 65 63 74 6f 72 79 29 rrent-directory)
4170: 29 29 0a 09 28 75 6e 61 6d 65 20 20 20 20 28 67 ))..(uname (g
4180: 65 74 2d 75 6e 61 6d 65 20 22 2d 73 72 76 70 69 et-uname "-srvpi
4190: 6f 22 29 29 0a 09 28 72 75 6e 70 61 74 68 20 20 o"))..(runpath
41a0: 28 63 75 72 72 65 6e 74 2d 64 69 72 65 63 74 6f (current-directo
41b0: 72 79 29 29 29 0a 20 20 20 20 28 73 71 6c 69 74 ry))). (sqlit
41c0: 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 e3:execute db "U
41d0: 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 20 PDATE tests SET
41e0: 68 6f 73 74 3d 3f 2c 63 70 75 6c 6f 61 64 3d 3f host=?,cpuload=?
41f0: 2c 64 69 73 6b 66 72 65 65 3d 3f 2c 75 6e 61 6d ,diskfree=?,unam
4200: 65 3d 3f 2c 72 75 6e 64 69 72 3d 3f 20 57 48 45 e=?,rundir=? WHE
4210: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
4220: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
4230: 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 0a 09 09 20 tem_path=?;"...
4240: 20 68 6f 73 74 6e 61 6d 65 0a 09 09 20 20 63 70 hostname... cp
4250: 75 6c 6f 61 64 0a 09 09 20 20 64 69 73 6b 66 72 uload... diskfr
4260: 65 65 0a 09 09 20 20 75 6e 61 6d 65 0a 09 09 20 ee... uname...
4270: 20 72 75 6e 70 61 74 68 0a 09 09 20 20 72 75 6e runpath... run
4280: 2d 69 64 0a 09 09 20 20 74 65 73 74 6e 61 6d 65 -id... testname
4290: 0a 09 09 20 20 69 74 65 6d 2d 70 61 74 68 29 29 ... item-path))
42a0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 )..(define (test
42b0: 2d 75 70 64 61 74 65 2d 6d 65 74 61 2d 69 6e 66 -update-meta-inf
42c0: 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 o db run-id test
42d0: 6e 61 6d 65 20 69 74 65 6d 64 61 74 20 6d 69 6e name itemdat min
42e0: 75 74 65 73 29 0a 20 20 28 6c 65 74 20 28 28 69 utes). (let ((i
42f0: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c tem-path (item-l
4300: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
4310: 74 29 29 0a 09 28 63 70 75 6c 6f 61 64 20 20 28 t))..(cpuload (
4320: 67 65 74 2d 63 70 75 2d 6c 6f 61 64 29 29 0a 09 get-cpu-load))..
4330: 28 64 69 73 6b 66 72 65 65 20 28 67 65 74 2d 64 (diskfree (get-d
4340: 66 20 28 63 75 72 72 65 6e 74 2d 64 69 72 65 63 f (current-direc
4350: 74 6f 72 79 29 29 29 29 0a 20 20 20 20 28 69 66 tory)))). (if
4360: 20 28 6e 6f 74 20 63 70 75 6c 6f 61 64 29 20 20 (not cpuload)
4370: 28 62 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 (begin (debug:pr
4380: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
4390: 43 50 55 4c 4f 41 44 20 6e 6f 74 20 66 6f 75 6e CPULOAD not foun
43a0: 64 2e 22 29 20 20 28 73 65 74 21 20 63 70 75 6c d.") (set! cpul
43b0: 6f 61 64 20 22 6e 2f 61 22 29 29 29 0a 20 20 20 oad "n/a"))).
43c0: 20 28 69 66 20 28 6e 6f 74 20 64 69 73 6b 66 72 (if (not diskfr
43d0: 65 65 29 20 28 62 65 67 69 6e 20 28 64 65 62 75 ee) (begin (debu
43e0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
43f0: 4e 47 3a 20 44 49 53 4b 46 52 45 45 20 6e 6f 74 NG: DISKFREE not
4400: 20 66 6f 75 6e 64 2e 22 29 20 28 73 65 74 21 20 found.") (set!
4410: 64 69 73 6b 66 72 65 65 20 22 6e 2f 61 22 29 29 diskfree "n/a"))
4420: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69 ). (if (not i
4430: 74 65 6d 2d 70 61 74 68 29 28 62 65 67 69 6e 20 tem-path)(begin
4440: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
4450: 57 41 52 4e 49 4e 47 3a 20 49 54 45 4d 50 41 54 WARNING: ITEMPAT
4460: 48 20 6e 6f 74 20 73 65 74 2e 22 29 20 20 20 28 H not set.") (
4470: 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 22 set! item-path "
4480: 22 29 29 29 0a 20 20 20 20 3b 3b 20 28 6c 65 74 "))). ;; (let
4490: 20 28 28 74 65 73 74 69 6e 66 6f 20 28 64 62 3a ((testinfo (db:
44a0: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
44b0: 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 run-id testname
44c0: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 item-path))).
44d0: 20 20 3b 3b 20 20 20 28 69 66 20 28 61 6e 64 20 ;; (if (and
44e0: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 64 62 (not (equal? (db
44f0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 :test-get-status
4500: 20 74 65 73 74 69 6e 66 6f 29 20 22 43 4f 4d 50 testinfo) "COMP
4510: 4c 45 54 45 44 22 29 29 0a 20 20 20 20 3b 3b 20 LETED")). ;;
4520: 20 20 20 20 20 20 20 20 20 20 20 28 6e 6f 74 20 (not
4530: 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 (equal? (db:test
4540: 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 -get-status test
4550: 69 6e 66 6f 29 20 22 4b 49 4c 4c 52 45 51 22 29 info) "KILLREQ")
4560: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 ). (sqlite3:e
4570: 78 65 63 75 74 65 0a 20 20 20 20 20 64 62 0a 20 xecute. db.
4580: 20 20 20 20 22 55 50 44 41 54 45 20 74 65 73 74 "UPDATE test
4590: 73 20 53 45 54 20 63 70 75 6c 6f 61 64 3d 3f 2c s SET cpuload=?,
45a0: 64 69 73 6b 66 72 65 65 3d 3f 2c 72 75 6e 5f 64 diskfree=?,run_d
45b0: 75 72 61 74 69 6f 6e 3d 3f 2c 73 74 61 74 65 3d uration=?,state=
45c0: 27 52 55 4e 4e 49 4e 47 27 20 57 48 45 52 45 20 'RUNNING' WHERE
45d0: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
45e0: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
45f0: 5f 70 61 74 68 3d 3f 20 41 4e 44 20 73 74 61 74 _path=? AND stat
4600: 65 20 4e 4f 54 20 49 4e 20 28 27 43 4f 4d 50 4c e NOT IN ('COMPL
4610: 45 54 45 44 27 2c 27 4b 49 4c 4c 52 45 51 27 2c ETED','KILLREQ',
4620: 27 4b 49 4c 4c 45 44 27 29 3b 22 0a 20 20 20 20 'KILLED');".
4630: 20 63 70 75 6c 6f 61 64 0a 20 20 20 20 20 64 69 cpuload. di
4640: 73 6b 66 72 65 65 0a 20 20 20 20 20 6d 69 6e 75 skfree. minu
4650: 74 65 73 0a 20 20 20 20 20 72 75 6e 2d 69 64 0a tes. run-id.
4660: 20 20 20 20 20 74 65 73 74 6e 61 6d 65 0a 20 20 testname.
4670: 20 20 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a item-path))).
4680: 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 6d 65 .(define (set-me
4690: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 gatest-env-vars
46a0: 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c 65 db run-id). (le
46b0: 74 20 28 28 6b 65 79 73 20 28 64 62 2d 67 65 74 t ((keys (db-get
46c0: 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 20 20 20 -keys db))).
46d0: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
46e0: 61 20 28 6b 65 79 29 0a 09 09 28 73 71 6c 69 74 a (key)...(sqlit
46f0: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a e3:for-each-row.
4700: 09 09 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 29 .. (lambda (val)
4710: 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ... (debug:pri
4720: 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 28 nt 2 "setenv " (
4730: 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d key:get-fieldnam
4740: 65 20 6b 65 79 29 20 22 20 22 20 76 61 6c 29 0a e key) " " val).
4750: 09 09 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65 .. (setenv (ke
4760: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 y:get-fieldname
4770: 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 20 64 62 key) val))... db
4780: 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 45 4c 45 ... (conc "SELE
4790: 43 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 CT " (key:get-fi
47a0: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 46 eldname key) " F
47b0: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 ROM runs WHERE i
47c0: 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e 2d 69 64 d=?;")... run-id
47d0: 29 29 0a 09 20 20 20 20 20 20 6b 65 79 73 29 29 )).. keys))
47e0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d )..(define (set-
47f0: 69 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 item-env-vars it
4800: 65 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 emdat). (for-ea
4810: 63 68 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d ch (lambda (item
4820: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a ).. (debug:
4830: 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 print 2 "setenv
4840: 22 20 28 63 61 72 20 69 74 65 6d 29 20 22 20 22 " (car item) " "
4850: 20 28 63 61 64 72 20 69 74 65 6d 29 29 0a 09 20 (cadr item))..
4860: 20 20 20 20 20 28 73 65 74 65 6e 76 20 28 63 61 (setenv (ca
4870: 72 20 69 74 65 6d 29 20 28 63 61 64 72 20 69 74 r item) (cadr it
4880: 65 6d 29 29 29 0a 09 20 20 20 20 69 74 65 6d 64 em))).. itemd
4890: 61 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 67 at))..(define (g
48a0: 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 et-all-legal-tes
48b0: 74 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 ts). (let* ((te
48c0: 73 74 73 20 20 28 67 6c 6f 62 20 28 63 6f 6e 63 sts (glob (conc
48d0: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
48e0: 74 73 2f 2a 22 29 29 29 0a 09 20 28 72 65 73 20 ts/*"))).. (res
48f0: 20 20 20 27 28 29 29 29 0a 20 20 20 20 28 64 65 '())). (de
4900: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
4910: 4f 3a 20 4c 6f 6f 6b 69 6e 67 20 61 74 20 74 65 O: Looking at te
4920: 73 74 73 20 22 20 28 73 74 72 69 6e 67 2d 69 6e sts " (string-in
4930: 74 65 72 73 70 65 72 73 65 20 74 65 73 74 73 20 tersperse tests
4940: 22 2c 22 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 ",")). (for-e
4950: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 74 65 73 ach (lambda (tes
4960: 74 70 61 74 68 29 0a 09 09 28 69 66 20 28 66 69 tpath)...(if (fi
4970: 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 le-exists? (conc
4980: 20 74 65 73 74 70 61 74 68 20 22 2f 74 65 73 74 testpath "/test
4990: 63 6f 6e 66 69 67 22 29 29 0a 09 09 20 20 20 20 config"))...
49a0: 28 73 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 (set! res (cons
49b0: 28 6c 61 73 74 20 28 73 74 72 69 6e 67 2d 73 70 (last (string-sp
49c0: 6c 69 74 20 74 65 73 74 70 61 74 68 20 22 2f 22 lit testpath "/"
49d0: 29 29 20 72 65 73 29 29 29 29 0a 09 20 20 20 20 )) res))))..
49e0: 20 20 74 65 73 74 73 29 0a 20 20 20 20 72 65 73 tests). res
49f0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e ))..(define (run
4a00: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 s:can-run-more-t
4a10: 65 73 74 73 20 64 62 29 0a 20 20 28 6c 65 74 20 ests db). (let
4a20: 28 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 ((num-running (d
4a30: 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 b:get-count-test
4a40: 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 s-running db))..
4a50: 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d (max-concurrent-
4a60: 6a 6f 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f jobs (config-loo
4a70: 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 kup *configdat*
4a80: 22 73 65 74 75 70 22 20 22 6d 61 78 5f 63 6f 6e "setup" "max_con
4a90: 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 29 current_jobs")))
4aa0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
4ab0: 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 75 72 72 t 2 "max-concurr
4ac0: 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 2d ent-jobs: " max-
4ad0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 concurrent-jobs
4ae0: 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 ", num-running:
4af0: 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a 20 " num-running).
4b00: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71 3f (if (not (eq?
4b10: 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 0 *globalexitst
4b20: 61 74 75 73 2a 29 29 0a 09 23 66 0a 09 28 69 66 atus*))..#f..(if
4b30: 20 28 6f 72 20 28 6e 6f 74 20 6d 61 78 2d 63 6f (or (not max-co
4b40: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 ncurrent-jobs)..
4b50: 09 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 .(and max-concur
4b60: 72 65 6e 74 2d 6a 6f 62 73 0a 09 09 20 20 20 20 rent-jobs...
4b70: 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 (string->number
4b80: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
4b90: 6a 6f 62 73 29 0a 09 09 20 20 20 20 20 28 6e 6f jobs)... (no
4ba0: 74 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e t (>= num-runnin
4bb0: 67 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 g (string->numbe
4bc0: 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 r max-concurrent
4bd0: 2d 6a 6f 62 73 29 29 29 29 29 0a 09 20 20 20 20 -jobs)))))..
4be0: 23 74 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a #t.. (begin .
4bf0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
4c00: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
4c10: 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 73 Max running jobs
4c20: 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72 65 exceeded, curre
4c30: 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e nt number runnin
4c40: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 g: " num-running
4c50: 20 0a 09 09 09 20 20 20 22 2c 20 6d 61 78 5f 63 .... ", max_c
4c60: 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 oncurrent_jobs:
4c70: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
4c80: 2d 6a 6f 62 73 29 0a 09 20 20 20 20 20 20 23 66 -jobs).. #f
4c90: 29 29 29 29 29 0a 20 20 0a 28 64 65 66 69 6e 65 ))))). .(define
4ca0: 20 28 72 75 6e 2d 74 65 73 74 73 20 64 62 20 74 (run-tests db t
4cb0: 65 73 74 2d 6e 61 6d 65 73 29 0a 20 20 28 6c 65 est-names). (le
4cc0: 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 t* ((keys
4cd0: 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 (db-get-keys db
4ce0: 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 )).. (keyvallst
4cf0: 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 (keys->vallist
4d00: 20 6b 65 79 73 20 23 74 29 29 0a 09 20 28 72 75 keys #t)).. (ru
4d10: 6e 2d 69 64 20 20 20 20 20 20 28 72 65 67 69 73 n-id (regis
4d20: 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 29 ter-run db keys)
4d30: 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 ) ;; test-name
4d40: 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 ))).. (deferred
4d50: 20 20 20 27 28 29 29 29 20 3b 3b 20 64 65 6c 61 '())) ;; dela
4d60: 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 y running these
4d70: 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 since they have
4d80: 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a a waiton clause.
4d90: 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 ;; on the fi
4da0: 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 6c 6c rst pass or call
4db0: 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 73 65 to run-tests se
4dc0: 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 t FAILS to NOT_S
4dd0: 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 3b 3b TARTED if. ;;
4de0: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 73 -keepgoing is s
4df0: 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 69 66 pecified. (if
4e00: 20 28 61 6e 64 20 28 65 71 3f 20 2a 70 61 73 73 (and (eq? *pass
4e10: 6e 75 6d 2a 20 30 29 0a 09 20 20 20 20 20 28 61 num* 0).. (a
4e20: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6b 65 rgs:get-arg "-ke
4e30: 65 70 67 6f 69 6e 67 22 29 29 0a 09 28 62 65 67 epgoing"))..(beg
4e40: 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 6f in.. ;; have to
4e50: 20 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 63 delete test rec
4e60: 6f 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 ords where NOT_S
4e70: 54 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 65 TARTED since the
4e80: 79 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 y can cause -kee
4e90: 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b pgoing to .. ;;
4ea0: 20 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 74 get stuck due t
4eb0: 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 o becoming inacc
4ec0: 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 essible from a f
4ed0: 61 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 2e ailed test. I.e.
4ee0: 20 69 66 20 74 65 73 74 20 42 20 64 65 70 65 6e if test B depen
4ef0: 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 ds .. ;; on tes
4f00: 74 20 41 20 62 75 74 20 74 65 73 74 20 42 20 72 t A but test B r
4f10: 65 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e 74 eached the point
4f20: 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 74 on being regist
4f30: 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 ered as NOT_STAR
4f40: 54 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 20 TED and test..
4f50: 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 20 ;; A failed for
4f60: 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 6e some reason then
4f70: 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 on re-run using
4f80: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 20 -keepgoing the
4f90: 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 6f run can never co
4fa0: 6d 70 6c 65 74 65 2e 0a 09 20 20 28 64 62 3a 64 mplete... (db:d
4fb0: 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73 elete-tests-in-s
4fc0: 74 61 74 65 20 64 62 20 72 75 6e 2d 69 64 20 22 tate db run-id "
4fd0: 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20 NOT_STARTED")..
4fe0: 20 28 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 (db:set-tests-s
4ff0: 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 20 72 tate-status db r
5000: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 un-id test-names
5010: 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f #f "FAIL" "NOT_
5020: 53 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 STARTED" "FAIL")
5030: 29 29 0a 20 20 20 20 28 73 65 74 21 20 2a 70 61 )). (set! *pa
5040: 73 73 6e 75 6d 2a 20 28 2b 20 2a 70 61 73 73 6e ssnum* (+ *passn
5050: 75 6d 2a 20 31 29 29 0a 20 20 20 20 28 6c 65 74 um* 1)). (let
5060: 20 6c 6f 6f 70 20 28 28 6e 75 6d 74 69 6d 65 73 loop ((numtimes
5070: 20 30 29 29 0a 20 20 20 20 20 20 28 66 6f 72 2d 0)). (for-
5080: 65 61 63 68 20 0a 20 20 20 20 20 20 20 28 6c 61 each . (la
5090: 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 mbda (test-name)
50a0: 0a 09 20 28 69 66 20 28 72 75 6e 73 3a 63 61 6e .. (if (runs:can
50b0: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 -run-more-tests
50c0: 64 62 29 0a 09 20 20 20 20 20 28 72 75 6e 2d 6f db).. (run-o
50d0: 6e 65 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 ne-test db run-i
50e0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 d test-name keyv
50f0: 61 6c 6c 73 74 29 0a 09 20 20 20 20 20 3b 3b 20 allst).. ;;
5100: 61 64 64 20 73 6f 6d 65 20 64 65 6c 61 79 20 0a add some delay .
5110: 09 20 20 20 20 20 3b 28 73 6c 65 65 70 20 32 29 . ;(sleep 2)
5120: 0a 09 20 20 20 20 20 29 29 0a 20 20 20 20 20 20 .. )).
5130: 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a 20 20 20 test-names).
5140: 20 20 20 3b 3b 20 28 72 75 6e 2d 77 61 69 74 69 ;; (run-waiti
5150: 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 20 20 20 ng-tests db).
5160: 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 (if (args:get
5170: 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 -arg "-keepgoing
5180: 22 29 0a 09 20 20 28 6c 65 74 20 28 28 65 73 74 ").. (let ((est
5190: 72 65 6d 20 28 64 62 3a 65 73 74 69 6d 61 74 65 rem (db:estimate
51a0: 64 2d 74 65 73 74 73 2d 72 65 6d 61 69 6e 69 6e d-tests-remainin
51b0: 67 20 64 62 20 72 75 6e 2d 69 64 29 29 29 0a 09 g db run-id)))..
51c0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 3e 20 (if (and (>
51d0: 65 73 74 72 65 6d 20 30 29 0a 09 09 20 20 20 20 estrem 0)...
51e0: 20 28 65 71 3f 20 2a 67 6c 6f 62 61 6c 65 78 69 (eq? *globalexi
51f0: 74 73 74 61 74 75 73 2a 20 30 29 29 0a 09 09 28 tstatus* 0))...(
5200: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 begin... (debug
5210: 3a 70 72 69 6e 74 20 31 20 22 4b 65 65 70 20 67 :print 1 "Keep g
5220: 6f 69 6e 67 2c 20 65 73 74 69 6d 61 74 65 64 20 oing, estimated
5230: 22 20 65 73 74 72 65 6d 20 22 20 74 65 73 74 73 " estrem " tests
5240: 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 72 75 remaining to ru
5250: 6e 2c 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 n, will continue
5260: 20 69 6e 20 33 20 73 65 63 6f 6e 64 73 20 2e 2e in 3 seconds ..
5270: 2e 22 29 0a 09 09 20 20 28 73 6c 65 65 70 20 33 .")... (sleep 3
5280: 29 0a 09 09 20 20 28 72 75 6e 2d 77 61 69 74 69 )... (run-waiti
5290: 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 09 09 20 ng-tests db)...
52a0: 20 28 6c 6f 6f 70 20 28 2b 20 6e 75 6d 74 69 6d (loop (+ numtim
52b0: 65 73 20 31 29 29 29 29 29 29 29 29 29 0a 09 20 es 1)))))))))..
52c0: 20 20 0a 3b 3b 20 56 45 52 59 20 49 4e 45 46 46 .;; VERY INEFF
52d0: 49 43 49 45 4e 54 21 20 4d 6f 76 65 20 73 74 75 ICIENT! Move stu
52e0: 66 66 20 74 68 61 74 20 73 68 6f 75 6c 64 20 62 ff that should b
52f0: 65 20 64 6f 6e 65 20 6f 6e 63 65 20 75 70 20 74 e done once up t
5300: 6f 20 63 61 6c 6c 69 6e 67 20 70 72 6f 63 0a 28 o calling proc.(
5310: 64 65 66 69 6e 65 20 28 72 75 6e 2d 6f 6e 65 2d define (run-one-
5320: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 test db run-id t
5330: 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 61 6c 6c est-name keyvall
5340: 73 74 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 st). (debug:pri
5350: 6e 74 20 31 20 22 4c 61 75 6e 63 68 69 6e 67 20 nt 1 "Launching
5360: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 test " test-name
5370: 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 ). ;; All these
5380: 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 vars might be r
5390: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 eferenced by the
53a0: 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 testconfig file
53b0: 20 72 65 61 64 65 72 0a 20 20 28 73 65 74 65 6e reader. (seten
53c0: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 v "MT_TEST_NAME"
53d0: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a test-name) ;; .
53e0: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 (setenv "MT_RU
53f0: 4e 4e 41 4d 45 22 20 20 20 28 61 72 67 73 3a 67 NNAME" (args:g
5400: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 et-arg ":runname
5410: 22 29 29 0a 20 20 28 73 65 74 2d 6d 65 67 61 74 ")). (set-megat
5420: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 est-env-vars db
5430: 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 run-id) ;; these
5440: 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 may be needed b
5450: 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 y the launching
5460: 70 72 6f 63 65 73 73 0a 20 20 28 63 68 61 6e 67 process. (chang
5470: 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 e-directory *top
5480: 70 61 74 68 2a 29 0a 20 20 28 6c 65 74 2a 20 28 path*). (let* (
5490: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 (test-path (c
54a0: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
54b0: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d tests/" test-nam
54c0: 65 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 e)).. (test-conf
54d0: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 igf (conc test-p
54e0: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 ath "/testconfig
54f0: 22 29 29 0a 09 20 28 74 65 73 74 65 78 69 73 74 ")).. (testexist
5500: 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 s (and (file-e
5510: 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 xists? test-conf
5520: 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 igf)(file-read-a
5530: 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 ccess? test-conf
5540: 69 67 66 29 29 29 0a 09 20 28 74 65 73 74 2d 63 igf))).. (test-c
5550: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 onf (if teste
5560: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 xists (read-conf
5570: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 ig test-configf
5580: 23 66 20 23 74 29 20 28 6d 61 6b 65 2d 68 61 73 #f #t) (make-has
5590: 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 77 61 h-table))).. (wa
55a0: 69 74 6f 6e 20 20 20 20 20 20 20 28 6c 65 74 20 iton (let
55b0: 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b ((w (config-look
55c0: 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 72 65 up test-conf "re
55d0: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69 quirements" "wai
55e0: 74 6f 6e 22 29 29 29 0a 09 09 09 20 28 69 66 20 ton"))).... (if
55f0: 28 73 74 72 69 6e 67 3f 20 77 29 28 73 74 72 69 (string? w)(stri
5600: 6e 67 2d 73 70 6c 69 74 20 77 29 27 28 29 29 29 ng-split w)'()))
5610: 29 0a 09 20 28 74 61 67 73 20 20 20 20 20 20 20 ).. (tags
5620: 20 20 28 6c 65 74 20 28 28 74 20 28 63 6f 6e 66 (let ((t (conf
5630: 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 ig-lookup test-c
5640: 6f 6e 66 20 22 73 65 74 75 70 22 20 22 74 61 67 onf "setup" "tag
5650: 73 22 29 29 29 0a 09 09 09 20 3b 3b 20 77 65 20 s"))).... ;; we
5660: 77 61 6e 74 20 6f 75 72 20 74 61 67 73 20 74 6f want our tags to
5670: 20 62 65 20 73 65 70 61 72 61 74 65 64 20 62 79 be separated by
5680: 20 63 6f 6d 6d 61 73 20 61 6e 64 20 66 75 6c 6c commas and full
5690: 79 20 64 65 6c 69 6d 69 74 65 64 20 62 79 20 63 y delimited by c
56a0: 6f 6d 6d 61 73 0a 09 09 09 20 3b 3b 20 73 6f 20 ommas.... ;; so
56b0: 74 68 61 74 20 71 75 65 72 69 65 73 20 77 69 74 that queries wit
56c0: 68 20 22 6c 69 6b 65 22 20 63 61 6e 20 74 69 65 h "like" can tie
56d0: 20 74 6f 20 74 68 65 20 63 6f 6d 6d 61 73 20 61 to the commas a
56e0: 74 20 65 69 74 68 65 72 20 65 6e 64 20 6f 66 20 t either end of
56f0: 65 61 63 68 20 74 61 67 0a 09 09 09 20 3b 3b 20 each tag.... ;;
5700: 77 68 69 6c 65 20 61 6c 73 6f 20 61 6c 6c 6f 77 while also allow
5710: 69 6e 67 20 74 68 65 20 65 6e 64 20 75 73 65 72 ing the end user
5720: 20 74 6f 20 66 72 65 65 6c 79 20 75 73 65 20 73 to freely use s
5730: 70 61 63 65 73 20 61 6e 64 20 63 6f 6d 6d 61 73 paces and commas
5740: 20 74 6f 20 73 65 70 61 72 61 74 65 20 74 61 67 to separate tag
5750: 73 0a 09 09 09 20 28 69 66 20 28 73 74 72 69 6e s.... (if (strin
5760: 67 3f 20 74 29 28 73 74 72 69 6e 67 2d 73 75 62 g? t)(string-sub
5770: 73 74 69 74 75 74 65 20 28 72 65 67 65 78 70 20 stitute (regexp
5780: 22 5b 2c 5c 5c 73 5d 2b 22 29 20 22 2c 22 20 28 "[,\\s]+") "," (
5790: 63 6f 6e 63 20 22 2c 22 20 74 20 22 2c 22 29 20 conc "," t ",")
57a0: 23 74 29 0a 09 09 09 20 20 20 20 20 27 28 29 29 #t).... '())
57b0: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 ))). (if (not
57c0: 20 74 65 73 74 65 78 69 73 74 73 29 0a 09 28 62 testexists)..(b
57d0: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 egin.. (debug:p
57e0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 rint 0 "ERROR: C
57f0: 61 6e 27 74 20 66 69 6e 64 20 63 6f 6e 66 69 67 an't find config
5800: 20 66 69 6c 65 20 22 20 74 65 73 74 2d 63 6f 6e file " test-con
5810: 66 69 67 66 29 0a 09 20 20 28 65 78 69 74 20 32 figf).. (exit 2
5820: 29 29 0a 09 3b 3b 20 70 75 74 20 74 6f 70 20 76 ))..;; put top v
5830: 61 72 73 20 69 6e 74 6f 20 63 6f 6e 76 65 6e 69 ars into conveni
5840: 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20 61 6e ent variables an
5850: 64 20 6f 70 65 6e 20 74 68 65 20 64 62 0a 09 28 d open the db..(
5860: 6c 65 74 2a 20 28 3b 3b 20 64 62 20 69 73 20 61 let* (;; db is a
5870: 6c 77 61 79 73 20 61 74 20 2a 74 6f 70 70 61 74 lways at *toppat
5880: 68 2a 2f 64 62 2f 6d 65 67 61 74 65 73 74 2e 64 h*/db/megatest.d
5890: 62 0a 09 20 20 20 20 20 20 20 28 69 74 65 6d 73 b.. (items
58a0: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
58b0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 le-ref/default t
58c0: 65 73 74 2d 63 6f 6e 66 20 22 69 74 65 6d 73 22 est-conf "items"
58d0: 20 27 28 29 29 29 0a 09 20 20 20 20 20 20 20 28 '())).. (
58e0: 69 74 65 6d 73 74 61 62 6c 65 20 20 28 68 61 73 itemstable (has
58f0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
5900: 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 69 ult test-conf "i
5910: 74 65 6d 73 74 61 62 6c 65 22 20 27 28 29 29 29 temstable" '()))
5920: 0a 09 20 20 20 20 20 20 20 28 61 6c 6c 69 74 65 .. (allite
5930: 6d 73 20 20 20 20 28 69 66 20 28 6f 72 20 28 6e ms (if (or (n
5940: 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 ot (null? items)
5950: 29 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 )(not (null? ite
5960: 6d 73 74 61 62 6c 65 29 29 29 0a 09 09 09 09 28 mstable))).....(
5970: 61 70 70 65 6e 64 20 28 69 74 65 6d 2d 61 73 73 append (item-ass
5980: 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 oc->item-list it
5990: 65 6d 73 29 0a 09 09 09 09 09 28 69 74 65 6d 2d ems)......(item-
59a0: 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 table->item-list
59b0: 20 69 74 65 6d 73 74 61 62 6c 65 29 29 0a 09 09 itemstable))...
59c0: 09 09 27 28 28 29 29 29 29 20 3b 3b 20 61 20 6c ..'(()))) ;; a l
59d0: 69 73 74 20 77 69 74 68 20 6f 6e 65 20 6e 75 6c ist with one nul
59e0: 6c 20 6c 69 73 74 20 69 73 20 61 20 74 65 73 74 l list is a test
59f0: 20 77 69 74 68 20 6e 6f 20 69 74 65 6d 73 0a 09 with no items..
5a00: 20 20 20 20 20 20 20 28 72 75 6e 63 6f 6e 66 69 (runconfi
5a10: 67 66 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 gf (conc *topp
5a20: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 ath* "/runconfig
5a30: 73 2e 63 6f 6e 66 69 67 22 29 29 29 0a 09 20 20 s.config")))..
5a40: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
5a50: 69 74 65 6d 73 3a 20 22 29 0a 09 20 20 28 69 66 items: ").. (if
5a60: 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a (>= *verbosity*
5a70: 20 31 29 28 70 70 20 61 6c 6c 69 74 65 6d 73 29 1)(pp allitems)
5a80: 29 0a 09 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 ).. (if (>= *ve
5a90: 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 rbosity* 5)..
5aa0: 20 20 20 28 62 65 67 69 6e 0a 09 09 28 70 72 69 (begin...(pri
5ab0: 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 28 70 70 nt "items: ")(pp
5ac0: 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 (item-assoc->it
5ad0: 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 29 29 0a em-list items)).
5ae0: 09 09 28 70 72 69 6e 74 20 22 69 74 65 73 74 61 ..(print "itesta
5af0: 62 6c 65 3a 20 22 29 28 70 70 20 28 69 74 65 6d ble: ")(pp (item
5b00: 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 -table->item-lis
5b10: 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 29 t itemstable))))
5b20: 0a 09 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 .. (if (args:ge
5b30: 74 2d 61 72 67 20 22 2d 6d 22 29 0a 09 20 20 20 t-arg "-m")..
5b40: 20 20 20 28 64 62 3a 73 65 74 2d 63 6f 6d 6d 65 (db:set-comme
5b50: 6e 74 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 nt-for-run db ru
5b60: 6e 2d 69 64 20 28 61 72 67 73 3a 67 65 74 2d 61 n-id (args:get-a
5b70: 72 67 20 22 2d 6d 22 29 29 29 0a 0a 09 20 20 3b rg "-m")))... ;
5b80: 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65 20 ; Here is where
5b90: 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 the test_meta ta
5ba0: 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64 61 ble is best upda
5bb0: 74 65 64 0a 09 20 20 28 72 75 6e 73 3a 75 70 64 ted.. (runs:upd
5bc0: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 ate-test_meta db
5bd0: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
5be0: 63 6f 6e 66 29 0a 0a 09 20 20 3b 3b 20 62 72 61 conf)... ;; bra
5bf0: 69 6e 64 65 61 64 20 77 6f 72 6b 2d 61 72 6f 75 indead work-arou
5c00: 6e 64 20 66 6f 72 20 70 6f 6f 72 6c 79 20 73 70 nd for poorly sp
5c10: 65 63 69 66 69 65 64 20 61 6c 6c 69 74 65 6d 73 ecified allitems
5c20: 20 6c 69 73 74 20 42 55 47 21 21 21 20 46 49 58 list BUG!!! FIX
5c30: 4d 45 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f ME.. (if (null?
5c40: 20 61 6c 6c 69 74 65 6d 73 29 28 73 65 74 21 20 allitems)(set!
5c50: 61 6c 6c 69 74 65 6d 73 20 27 28 28 29 29 29 29 allitems '(())))
5c60: 0a 09 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 .. (let loop ((
5c70: 69 74 65 6d 64 61 74 20 28 63 61 72 20 61 6c 6c itemdat (car all
5c80: 69 74 65 6d 73 29 29 0a 09 09 20 20 20 20 20 28 items))... (
5c90: 74 61 6c 20 20 20 20 20 28 63 64 72 20 61 6c 6c tal (cdr all
5ca0: 69 74 65 6d 73 29 29 29 0a 09 20 20 20 20 3b 3b items))).. ;;
5cb0: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 (lambda (itemda
5cc0: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 t) ;;; ((ripenes
5cd0: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 s "overripe") (t
5ce0: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c emperature "cool
5cf0: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d ") (season "summ
5d00: 65 72 22 29 29 0a 09 20 20 20 20 3b 3b 20 48 61 er")).. ;; Ha
5d10: 6e 64 6c 65 20 6c 69 73 74 73 20 6f 66 20 69 74 ndle lists of it
5d20: 65 6d 73 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 ems.. (let* (
5d30: 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 28 (item-path (
5d40: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
5d50: 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 28 73 74 itemdat)) ;; (st
5d60: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
5d70: 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 (map cadr itemd
5d80: 61 74 29 20 22 2f 22 29 29 0a 09 09 20 20 20 28 at) "/"))... (
5d90: 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 new-test-path (s
5da0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
5db0: 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 e (cons test-pat
5dc0: 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d h (map cadr item
5dd0: 64 61 74 29 29 20 22 2f 22 29 29 0a 09 09 20 20 dat)) "/"))...
5de0: 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 (new-test-name
5df0: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
5e00: 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e -path "") test-n
5e10: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e ame (conc test-n
5e20: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
5e30: 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 h))) ;; just nee
5e40: 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 d it to be uniqu
5e50: 65 0a 09 09 20 20 20 28 74 65 73 74 64 61 74 20 e... (testdat
5e60: 20 20 23 66 29 0a 09 09 20 20 20 28 6e 75 6d 2d #f)... (num-
5e70: 72 75 6e 6e 69 6e 67 20 28 64 62 3a 67 65 74 2d running (db:get-
5e80: 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e count-tests-runn
5e90: 69 6e 67 20 64 62 29 29 0a 09 09 20 20 20 28 6d ing db))... (m
5ea0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
5eb0: 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 bs (config-looku
5ec0: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 p *configdat* "s
5ed0: 65 74 75 70 22 20 22 6d 61 78 5f 63 6f 6e 63 75 etup" "max_concu
5ee0: 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 09 rrent_jobs"))...
5ef0: 20 20 20 28 70 61 72 65 6e 74 2d 74 65 73 74 20 (parent-test
5f00: 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (and (not (null?
5f10: 20 69 74 65 6d 73 29 29 28 65 71 75 61 6c 3f 20 items))(equal?
5f20: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 0a item-path ""))).
5f30: 09 09 20 20 20 28 73 69 6e 67 6c 65 2d 74 65 73 .. (single-tes
5f40: 74 20 28 61 6e 64 20 28 6e 75 6c 6c 3f 20 69 74 t (and (null? it
5f50: 65 6d 73 29 20 28 65 71 75 61 6c 3f 20 69 74 65 ems) (equal? ite
5f60: 6d 2d 70 61 74 68 20 22 22 29 29 29 0a 09 09 20 m-path "")))...
5f70: 20 20 28 69 74 65 6d 2d 74 65 73 74 20 20 20 28 (item-test (
5f80: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 74 65 6d not (equal? item
5f90: 2d 70 61 74 68 20 22 22 29 29 29 29 0a 09 20 20 -path ""))))..
5fa0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5fb0: 20 33 20 22 6d 61 78 2d 63 6f 6e 63 75 72 72 65 3 "max-concurre
5fc0: 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 nt-jobs: " max-c
5fd0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 22 oncurrent-jobs "
5fe0: 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 , num-running: "
5ff0: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a 09 20 num-running)..
6000: 20 20 20 20 20 28 69 66 20 28 72 75 6e 73 3a 63 (if (runs:c
6010: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
6020: 73 20 64 62 29 0a 09 09 20 20 28 62 65 67 69 6e s db)... (begin
6030: 0a 09 09 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 ... (let loop
6040: 32 20 28 28 74 73 20 28 64 62 3a 67 65 74 2d 74 2 ((ts (db:get-t
6050: 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d est-info db run-
6060: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
6070: 6d 2d 70 61 74 68 29 29 20 3b 3b 20 23 66 29 0a m-path)) ;; #f).
6080: 09 09 09 09 28 63 74 20 30 29 29 0a 09 09 20 20 ....(ct 0))...
6090: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 6e 6f (if (and (no
60a0: 74 20 74 73 29 0a 09 09 09 20 20 20 20 20 20 20 t ts)....
60b0: 28 3c 20 63 74 20 31 30 29 29 0a 09 09 09 20 20 (< ct 10))....
60c0: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 28 72 (begin.... (r
60d0: 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62 20 egister-test db
60e0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
60f0: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 09 20 item-path)....
6100: 20 20 20 28 64 62 3a 74 65 73 74 2d 73 65 74 2d (db:test-set-
6110: 63 6f 6d 6d 65 6e 74 20 64 62 20 72 75 6e 2d 69 comment db run-i
6120: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
6130: 2d 70 61 74 68 20 22 22 29 0a 09 09 09 20 20 20 -path "")....
6140: 20 28 6c 6f 6f 70 32 20 28 64 62 3a 67 65 74 2d (loop2 (db:get-
6150: 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e test-info db run
6160: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
6170: 65 6d 2d 70 61 74 68 29 0a 09 09 09 09 20 20 20 em-path).....
6180: 28 2b 20 63 74 20 31 29 29 29 0a 09 09 09 20 20 (+ ct 1)))....
6190: 28 69 66 20 74 73 0a 09 09 09 20 20 20 20 20 20 (if ts....
61a0: 28 73 65 74 21 20 74 65 73 74 64 61 74 20 74 73 (set! testdat ts
61b0: 29 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 ).... (begi
61c0: 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 n.....(debug:pri
61d0: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 43 nt 0 "WARNING: C
61e0: 6f 75 6c 64 6e 27 74 20 72 65 67 69 73 74 65 72 ouldn't register
61f0: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d test " test-nam
6200: 65 20 22 20 77 69 74 68 20 69 74 65 6d 20 70 61 e " with item pa
6210: 74 68 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 th " item-path "
6220: 2c 20 73 6b 69 70 70 69 6e 67 22 29 0a 09 09 09 , skipping")....
6230: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f .(if (not (null?
6240: 20 74 61 6c 29 29 0a 09 09 09 09 20 20 20 20 28 tal))..... (
6250: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 loop (car tal)(c
6260: 64 72 20 74 61 6c 29 29 29 29 29 29 29 0a 09 09 dr tal)))))))...
6270: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 (change-dire
6280: 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 ctory test-path)
6290: 0a 09 09 20 20 20 20 3b 3b 20 74 68 69 73 20 62 ... ;; this b
62a0: 6c 6f 63 6b 20 69 73 20 68 65 72 65 20 6f 6e 6c lock is here onl
62b0: 79 20 74 6f 20 69 6e 66 6f 72 6d 20 74 68 65 20 y to inform the
62c0: 75 73 65 72 20 65 61 72 6c 79 20 6f 6e 0a 09 09 user early on...
62d0: 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 (if (file-ex
62e0: 69 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 ists? runconfigf
62f0: 29 0a 09 09 09 28 73 65 74 75 70 2d 65 6e 76 2d )....(setup-env-
6300: 64 65 66 61 75 6c 74 73 20 64 62 20 72 75 6e 63 defaults db runc
6310: 6f 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 onfigf run-id *a
6320: 6c 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 lready-seen-runc
6330: 6f 6e 66 69 67 2d 69 6e 66 6f 2a 29 0a 09 09 09 onfig-info*)....
6340: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
6350: 57 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 WARNING: You do
6360: 6e 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 not have a run c
6370: 6f 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 onfig file: " ru
6380: 6e 63 6f 6e 66 69 67 66 29 29 0a 09 09 20 20 20 nconfigf))...
6390: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
63a0: 22 72 75 6e 2d 69 64 3a 20 22 20 72 75 6e 2d 69 "run-id: " run-i
63b0: 64 20 22 20 74 65 73 74 2d 6e 61 6d 65 3a 20 22 d " test-name: "
63c0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 74 65 test-name " ite
63d0: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 m-path: " item-p
63e0: 61 74 68 20 22 20 74 65 73 74 64 61 74 3a 20 22 ath " testdat: "
63f0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
6400: 73 20 74 65 73 74 64 61 74 29 20 22 20 74 65 73 s testdat) " tes
6410: 74 2d 73 74 61 74 65 3a 20 22 20 28 74 65 73 74 t-state: " (test
6420: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
6430: 61 74 29 29 0a 09 09 20 20 20 20 28 63 61 73 65 at))... (case
6440: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 (if (args:get-a
6450: 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 rg "-force")....
6460: 20 20 20 20 20 20 27 4e 4f 54 5f 53 54 41 52 54 'NOT_START
6470: 45 44 0a 09 09 09 20 20 20 20 20 20 28 69 66 20 ED.... (if
6480: 74 65 73 74 64 61 74 0a 09 09 09 09 20 20 28 73 testdat..... (s
6490: 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 tring->symbol (t
64a0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
64b0: 73 74 64 61 74 29 29 0a 09 09 09 09 20 20 27 66 stdat))..... 'f
64c0: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 ailed-to-insert)
64d0: 29 0a 09 09 20 20 20 20 20 20 28 28 66 61 69 6c )... ((fail
64e0: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 09 ed-to-insert)...
64f0: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
6500: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 int 0 "ERROR: Fa
6510: 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 iled to insert t
6520: 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 he record into t
6530: 68 65 20 64 62 22 29 29 0a 09 09 20 20 20 20 20 he db"))...
6540: 20 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 ((NOT_STARTED C
6550: 4f 4d 50 4c 45 54 45 44 29 0a 09 09 20 20 20 20 OMPLETED)...
6560: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6570: 36 20 22 47 6f 74 20 68 65 72 65 2c 20 22 20 28 6 "Got here, " (
6580: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
6590: 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 20 estdat))...
65a0: 20 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 (let ((runflag
65b0: 20 23 66 29 29 0a 09 09 09 20 28 63 6f 6e 64 0a #f)).... (cond.
65c0: 09 09 09 20 20 3b 3b 20 69 2e 65 2e 20 74 68 69 ... ;; i.e. thi
65d0: 73 20 69 73 20 74 68 65 20 70 61 72 65 6e 74 20 s is the parent
65e0: 74 65 73 74 20 74 6f 20 61 20 73 75 69 74 65 20 test to a suite
65f0: 6f 66 20 69 74 65 6d 73 2c 20 6e 65 76 65 72 20 of items, never
6600: 22 72 75 6e 22 20 69 74 0a 09 09 09 20 20 28 70 "run" it.... (p
6610: 61 72 65 6e 74 2d 74 65 73 74 0a 09 09 09 20 20 arent-test....
6620: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
6630: 66 29 29 0a 09 09 09 20 20 3b 3b 20 2d 66 6f 72 f)).... ;; -for
6640: 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 ce, run no matte
6650: 72 20 77 68 61 74 0a 09 09 09 20 20 28 28 61 72 r what.... ((ar
6660: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 gs:get-arg "-for
6670: 63 65 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 ce")(set! runfla
6680: 67 20 23 74 29 29 0a 09 09 09 20 20 3b 3b 20 4e g #t)).... ;; N
6690: 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 OT_STARTED, run
66a0: 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 no matter what..
66b0: 09 09 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 .. ((equal? (te
66c0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
66d0: 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 tdat) "NOT_START
66e0: 45 44 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 ED")(set! runfla
66f0: 67 20 23 74 29 29 0a 09 09 09 20 20 3b 3b 20 6e g #t)).... ;; n
6700: 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 ot -rerun and PA
6710: 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 SS, WARN or CHEC
6720: 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 09 09 K, do no run....
6730: 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 ((and (or (not
6740: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6750: 2d 72 65 72 75 6e 22 29 29 0a 09 09 09 09 20 20 -rerun")).....
6760: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 (args:get-arg
6770: 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 29 0a 09 "-keepgoing"))..
6780: 09 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 74 ...(member (test
6790: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
67a0: 64 61 74 29 20 27 28 22 50 41 53 53 22 20 22 57 dat) '("PASS" "W
67b0: 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 29 0a ARN" "CHECK"))).
67c0: 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 ... (set! runf
67d0: 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 3b 3b lag #f)).... ;;
67e0: 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 -rerun and stat
67f0: 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 us is one of the
6800: 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 specifed, run i
6810: 74 0a 09 09 09 20 20 28 28 61 6e 64 20 28 61 72 t.... ((and (ar
6820: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 gs:get-arg "-rer
6830: 75 6e 22 29 0a 09 09 09 09 28 6c 65 74 20 28 28 un").....(let ((
6840: 72 65 72 75 6e 6c 73 74 20 28 73 74 72 69 6e 67 rerunlst (string
6850: 2d 73 70 6c 69 74 20 28 61 72 67 73 3a 67 65 74 -split (args:get
6860: 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 29 20 22 -arg "-rerun") "
6870: 2c 22 29 29 29 20 3b 3b 20 46 41 49 4c 2c 0a 09 ,"))) ;; FAIL,..
6880: 09 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 ... (member (te
6890: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
68a0: 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 stdat) rerunlst)
68b0: 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 )).... (set! r
68c0: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 unflag #t))....
68d0: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 ;; -keepgoing,
68e0: 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 do not rerun FAI
68f0: 4c 0a 09 09 09 20 20 28 28 61 6e 64 20 28 61 72 L.... ((and (ar
6900: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6b 65 65 gs:get-arg "-kee
6910: 70 67 6f 69 6e 67 22 29 0a 09 09 09 09 28 6d 65 pgoing").....(me
6920: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 mber (test:get-s
6930: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 tatus testdat) '
6940: 28 22 46 41 49 4c 22 29 29 29 0a 09 09 09 20 20 ("FAIL")))....
6950: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
6960: 66 29 29 0a 09 09 09 20 20 28 28 61 6e 64 20 28 f)).... ((and (
6970: 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 2d 61 72 not (args:get-ar
6980: 67 20 22 2d 72 65 72 75 6e 22 29 29 0a 09 09 09 g "-rerun"))....
6990: 09 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 .(member (test:g
69a0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
69b0: 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 t) '("FAIL" "n/a
69c0: 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 "))).... (set!
69d0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 runflag #t))...
69e0: 09 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 72 . (else (set! r
69f0: 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 09 09 unflag #f)))....
6a00: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 (debug:print 6
6a10: 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 "RUNNING => runf
6a20: 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 lag: " runflag "
6a30: 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a STATE: " (test:
6a40: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
6a50: 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 28 t) " STATUS: " (
6a60: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
6a70: 74 65 73 74 64 61 74 29 29 0a 09 09 09 20 28 69 testdat)).... (i
6a80: 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a f (not runflag).
6a90: 09 09 09 20 20 20 20 20 28 69 66 20 28 6e 6f 74 ... (if (not
6aa0: 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 parent-test)...
6ab0: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
6ac0: 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 1 "NOTE: Not sta
6ad0: 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77 rting test " new
6ae0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 -test-name " as
6af0: 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 43 4f it is state \"CO
6b00: 4d 50 4c 45 54 45 44 5c 22 20 61 6e 64 20 73 74 MPLETED\" and st
6b10: 61 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 atus \"" (test:g
6b20: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
6b30: 74 29 20 22 5c 22 2c 20 75 73 65 20 2d 66 6f 72 t) "\", use -for
6b40: 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 ce to override")
6b50: 29 0a 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 ).... (let*
6b60: 28 28 67 65 74 2d 70 72 65 72 65 71 73 2d 63 6d ((get-prereqs-cm
6b70: 64 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 09 d (lambda ()....
6b80: 09 09 09 20 20 20 20 20 20 20 28 64 62 2d 67 65 ... (db-ge
6b90: 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 t-prereqs-not-me
6ba0: 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 t db run-id wait
6bb0: 6f 6e 29 29 29 20 3b 3b 20 63 68 65 63 6b 20 62 on))) ;; check b
6bc0: 65 66 6f 72 65 20 72 75 6e 6e 69 6e 67 20 2e 2e efore running ..
6bd0: 2e 2e 0a 09 09 09 09 20 20 20 20 28 6c 61 75 6e ....... (laun
6be0: 63 68 2d 63 6d 64 20 20 20 20 20 20 28 6c 61 6d ch-cmd (lam
6bf0: 62 64 61 20 28 29 0a 09 09 09 09 09 09 20 20 20 bda ().......
6c00: 20 20 20 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 (launch-test
6c10: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
6c20: 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 conf keyvallst t
6c30: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 est-name test-pa
6c40: 74 68 20 69 74 65 6d 64 61 74 29 29 29 0a 09 09 th itemdat)))...
6c50: 09 09 20 20 20 20 28 74 65 73 74 72 75 6e 64 61 .. (testrunda
6c60: 74 20 20 20 20 20 20 28 6c 69 73 74 20 67 65 74 t (list get
6c70: 2d 70 72 65 72 65 71 73 2d 63 6d 64 20 6c 61 75 -prereqs-cmd lau
6c80: 6e 63 68 2d 63 6d 64 29 29 29 0a 09 09 09 20 20 nch-cmd)))....
6c90: 20 20 20 20 20 28 69 66 20 28 6f 72 20 28 61 72 (if (or (ar
6ca0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 gs:get-arg "-for
6cb0: 63 65 22 29 0a 09 09 09 09 20 20 20 20 20 20 20 ce").....
6cc0: 28 6c 65 74 20 28 28 70 72 65 71 73 2d 6e 6f 74 (let ((preqs-not
6cd0: 2d 79 65 74 2d 6d 65 74 20 28 28 63 61 72 20 74 -yet-met ((car t
6ce0: 65 73 74 72 75 6e 64 61 74 29 29 29 29 0a 09 09 estrundat))))...
6cf0: 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
6d00: 20 32 20 22 50 72 65 71 72 65 71 75 65 73 69 74 2 "Preqrequesit
6d10: 65 73 20 66 6f 72 20 22 20 74 65 73 74 2d 6e 61 es for " test-na
6d20: 6d 65 20 22 3a 20 22 20 70 72 65 71 73 2d 6e 6f me ": " preqs-no
6d30: 74 2d 79 65 74 2d 6d 65 74 29 0a 09 09 09 09 09 t-yet-met)......
6d40: 20 28 6e 75 6c 6c 3f 20 70 72 65 71 73 2d 6e 6f (null? preqs-no
6d50: 74 2d 79 65 74 2d 6d 65 74 29 29 29 20 3b 3b 20 t-yet-met))) ;;
6d60: 61 72 65 20 74 68 65 72 65 20 61 6e 79 20 74 65 are there any te
6d70: 73 74 73 20 74 68 61 74 20 6d 75 73 74 20 62 65 sts that must be
6d80: 20 72 75 6e 20 62 65 66 6f 72 65 20 74 68 69 73 run before this
6d90: 20 6f 6e 65 2e 2e 2e 0a 09 09 09 09 20 20 20 28 one........ (
6da0: 69 66 20 28 6e 6f 74 20 28 28 63 61 64 72 20 74 if (not ((cadr t
6db0: 65 73 74 72 75 6e 64 61 74 29 29 29 20 3b 3b 20 estrundat))) ;;
6dc0: 74 68 69 73 20 69 73 20 74 68 65 20 6c 69 6e 65 this is the line
6dd0: 20 74 68 61 74 20 6c 61 75 6e 63 68 65 73 20 74 that launches t
6de0: 68 65 20 74 65 73 74 20 74 6f 20 74 68 65 20 72 he test to the r
6df0: 65 6d 6f 74 65 20 68 6f 73 74 0a 09 09 09 09 20 emote host.....
6e00: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 (begin....
6e10: 09 09 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 .. (print "ERROR
6e20: 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e : Failed to laun
6e30: 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 ch the test. Exi
6e40: 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 ting as soon as
6e50: 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 09 09 09 possible")......
6e60: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 (set! *globalex
6e70: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 itstatus* 1) ;;
6e80: 0a 09 09 09 09 09 20 28 70 72 6f 63 65 73 73 2d ...... (process-
6e90: 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d signal (current-
6ea0: 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e process-id) sign
6eb0: 61 6c 2f 6b 69 6c 6c 29 0a 09 09 09 09 09 20 3b al/kill)...... ;
6ec0: 28 65 78 69 74 20 31 29 0a 09 09 09 09 09 20 29 (exit 1)...... )
6ed0: 29 0a 09 09 09 09 20 20 20 28 69 66 20 28 6e 6f )..... (if (no
6ee0: 74 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 t (args:get-arg
6ef0: 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 29 0a 09 "-keepgoing"))..
6f00: 09 09 09 20 20 20 20 20 20 20 28 68 61 73 68 2d ... (hash-
6f10: 74 61 62 6c 65 2d 73 65 74 21 20 2a 77 61 69 74 table-set! *wait
6f20: 69 6e 67 2d 71 75 65 75 65 2a 20 6e 65 77 2d 74 ing-queue* new-t
6f30: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 72 75 6e est-name testrun
6f40: 64 61 74 29 29 29 29 29 29 29 0a 09 09 20 20 20 dat)))))))...
6f50: 20 20 20 28 28 4b 49 4c 4c 45 44 29 20 0a 09 09 ((KILLED) ...
6f60: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
6f70: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e int 1 "NOTE: " n
6f80: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 ew-test-name " i
6f90: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e s already runnin
6fa0: 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74 g or was explict
6fb0: 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d ly killed, use -
6fc0: 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 force to launch
6fd0: 69 74 2e 22 29 29 0a 09 09 20 20 20 20 20 20 28 it."))... (
6fe0: 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 (LAUNCHED REMOTE
6ff0: 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e HOSTSTART RUNNIN
7000: 47 29 20 20 0a 09 09 20 20 20 20 20 20 20 28 69 G) ... (i
7010: 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 f (> (- (current
7020: 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a -seconds)(+ (db:
7030: 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 test-get-event_t
7040: 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 09 09 ime testdat)....
7050: 09 09 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 ... (db:test
7060: 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f -get-run_duratio
7070: 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 09 n testdat)))....
7080: 20 20 20 20 20 20 31 30 30 29 20 3b 3b 20 69 2e 100) ;; i.
7090: 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 e. no update for
70a0: 20 6d 6f 72 65 20 74 68 61 6e 20 31 30 30 20 73 more than 100 s
70b0: 65 63 6f 6e 64 73 0a 09 09 09 20 20 20 28 62 65 econds.... (be
70c0: 67 69 6e 0a 09 09 09 20 20 20 20 20 28 64 65 62 gin.... (deb
70d0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
70e0: 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 ING: Test " test
70f0: 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 -name " appears
7100: 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 to be dead. Forc
7110: 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 ing it to state
7120: 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 INCOMPLETE and s
7130: 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 tatus STUCK/DEAD
7140: 22 29 0a 09 09 09 20 20 20 20 20 28 74 65 73 74 ").... (test
7150: 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 20 -set-status! db
7160: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
7170: 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 "INCOMPLETE" "S
7180: 54 55 43 4b 2f 44 45 41 44 22 20 69 74 65 6d 64 TUCK/DEAD" itemd
7190: 61 74 20 22 54 65 73 74 20 69 73 20 73 74 75 63 at "Test is stuc
71a0: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a k or dead" #f)).
71b0: 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ... (debug:pri
71c0: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 nt 2 "NOTE: " te
71d0: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 st-name " is alr
71e0: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 eady running")))
71f0: 0a 09 09 20 20 20 20 20 20 28 65 6c 73 65 20 20 ... (else
7200: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
7210: 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c t 0 "ERROR: Fail
7220: 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 ed to launch tes
7230: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d t " new-test-nam
7240: 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 e ". Unrecognise
7250: 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74 3a d state " (test:
7260: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
7270: 74 29 29 29 29 29 29 0a 09 20 20 20 20 20 20 28 t)))))).. (
7280: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 if (not (null? t
7290: 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 al))... (loop (
72a0: 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c car tal)(cdr tal
72b0: 29 29 29 29 29 29 29 29 29 0a 0a 28 64 65 66 69 )))))))))..(defi
72c0: 6e 65 20 28 72 75 6e 2d 77 61 69 74 69 6e 67 2d ne (run-waiting-
72d0: 74 65 73 74 73 20 64 62 29 0a 20 20 28 6c 65 74 tests db). (let
72e0: 20 28 28 6e 75 6d 74 72 69 65 73 20 20 20 20 20 ((numtries
72f0: 20 20 20 20 20 20 30 29 0a 09 28 6c 61 73 74 2d 0)..(last-
7300: 74 72 79 2d 74 69 6d 65 20 20 20 20 20 20 28 63 try-time (c
7310: 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 29 urrent-seconds))
7320: 0a 09 28 74 69 6d 65 73 20 20 20 20 20 20 20 20 ..(times
7330: 20 20 20 20 20 20 28 6c 69 73 74 20 31 29 29 29 (list 1)))
7340: 20 3b 3b 20 6d 69 6e 75 74 65 73 20 74 6f 20 77 ;; minutes to w
7350: 61 69 74 20 62 65 66 6f 72 65 20 74 72 79 69 6e ait before tryin
7360: 67 20 61 67 61 69 6e 20 74 6f 20 6b 69 63 6b 20 g again to kick
7370: 6f 66 66 20 72 75 6e 73 0a 20 20 20 20 3b 3b 20 off runs. ;;
7380: 42 55 47 20 74 68 69 73 20 68 61 63 6b 20 6f 66 BUG this hack of
7390: 20 62 72 75 74 65 20 66 6f 72 63 65 20 72 65 74 brute force ret
73a0: 72 79 69 6e 67 20 77 6f 72 6b 73 20 71 75 69 74 rying works quit
73b0: 65 20 77 65 6c 6c 20 66 6f 72 20 6d 61 6e 79 20 e well for many
73c0: 63 61 73 65 73 20 62 75 74 20 0a 20 20 20 20 3b cases but . ;
73d0: 3b 20 20 20 20 20 77 68 61 74 20 69 73 20 6e 65 ; what is ne
73e0: 65 64 65 64 20 69 73 20 74 6f 20 63 68 65 63 6b eded is to check
73f0: 20 74 68 65 20 64 62 20 66 6f 72 20 74 65 73 74 the db for test
7400: 73 20 74 68 61 74 20 68 61 76 65 20 66 61 69 6c s that have fail
7410: 65 64 20 6c 65 73 73 20 74 68 61 6e 0a 20 20 20 ed less than.
7420: 20 3b 3b 20 20 20 20 20 4e 20 74 69 6d 65 73 20 ;; N times
7430: 6f 72 20 6e 65 76 65 72 20 62 65 65 6e 20 73 74 or never been st
7440: 61 72 74 65 64 20 61 6e 64 20 6b 69 63 6b 20 74 arted and kick t
7450: 68 65 6d 20 6f 66 66 20 61 67 61 69 6e 0a 20 20 hem off again.
7460: 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 77 61 (let loop ((wa
7470: 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 73 iting-test-names
7480: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 (hash-table-key
7490: 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 s *waiting-queue
74a0: 2a 29 29 29 0a 20 20 20 20 20 20 28 63 6f 6e 64 *))). (cond
74b0: 0a 20 20 20 20 20 20 20 28 28 6e 6f 74 20 28 72 . ((not (r
74c0: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
74d0: 2d 74 65 73 74 73 20 64 62 29 29 0a 09 28 73 6c -tests db))..(sl
74e0: 65 65 70 20 32 29 0a 09 28 6c 6f 6f 70 20 77 61 eep 2)..(loop wa
74f0: 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 73 iting-test-names
7500: 29 29 0a 20 20 20 20 20 20 20 28 28 6e 75 6c 6c )). ((null
7510: 3f 20 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e ? waiting-test-n
7520: 61 6d 65 73 29 0a 09 28 64 65 62 75 67 3a 70 72 ames)..(debug:pr
7530: 69 6e 74 20 31 20 22 41 6c 6c 20 74 65 73 74 73 int 1 "All tests
7540: 20 6c 61 75 6e 63 68 65 64 22 29 29 0a 20 20 20 launched")).
7550: 20 20 20 20 28 65 6c 73 65 0a 09 28 73 65 74 21 (else..(set!
7560: 20 6e 75 6d 74 72 69 65 73 20 28 2b 20 6e 75 6d numtries (+ num
7570: 74 72 69 65 73 20 31 29 29 0a 09 28 66 6f 72 2d tries 1))..(for-
7580: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 74 65 each (lambda (te
7590: 73 74 6e 61 6d 65 29 0a 09 09 20 20 20 20 28 69 stname)... (i
75a0: 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d f (runs:can-run-
75b0: 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a 09 more-tests db)..
75c0: 09 09 28 6c 65 74 2a 20 28 28 74 65 73 74 64 61 ..(let* ((testda
75d0: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 t (hash-table-re
75e0: 66 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 f *waiting-queue
75f0: 2a 20 74 65 73 74 6e 61 6d 65 29 29 0a 09 09 09 * testname))....
7600: 20 20 20 20 20 20 20 28 70 72 65 72 65 71 73 20 (prereqs
7610: 28 28 63 61 72 20 74 65 73 74 64 61 74 29 29 29 ((car testdat)))
7620: 0a 09 09 09 20 20 20 20 20 20 20 28 6c 64 62 20 .... (ldb
7630: 20 20 20 20 28 69 66 20 64 62 20 64 62 20 28 6f (if db db (o
7640: 70 65 6e 2d 64 62 29 29 29 29 0a 09 09 09 20 20 pen-db))))....
7650: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
7660: 70 72 65 72 65 71 73 20 72 65 6d 61 69 6e 69 6e prereqs remainin
7670: 67 3a 20 22 20 70 72 65 72 65 71 73 29 0a 09 09 g: " prereqs)...
7680: 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 72 . (if (null? pr
7690: 65 72 65 71 73 29 0a 09 09 09 20 20 20 20 20 20 ereqs)....
76a0: 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62 75 (begin.....(debu
76b0: 67 3a 70 72 69 6e 74 20 32 20 22 50 72 65 72 65 g:print 2 "Prere
76c0: 71 75 69 73 69 74 65 73 20 6d 65 74 2c 20 6c 61 quisites met, la
76d0: 75 6e 63 68 69 6e 67 20 22 20 74 65 73 74 6e 61 unching " testna
76e0: 6d 65 29 0a 09 09 09 09 28 28 63 61 64 72 20 74 me).....((cadr t
76f0: 65 73 74 64 61 74 29 29 0a 09 09 09 09 28 68 61 estdat)).....(ha
7700: 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 65 21 sh-table-delete!
7710: 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 2a *waiting-queue*
7720: 20 74 65 73 74 6e 61 6d 65 29 29 29 0a 09 09 09 testname)))....
7730: 20 20 28 69 66 20 28 6e 6f 74 20 64 62 29 0a 09 (if (not db)..
7740: 09 09 20 20 20 20 20 20 28 73 71 6c 69 74 65 33 .. (sqlite3
7750: 3a 66 69 6e 61 6c 69 7a 65 21 20 6c 64 62 29 29 :finalize! ldb))
7760: 29 29 29 0a 09 09 20 20 77 61 69 74 69 6e 67 2d )))... waiting-
7770: 74 65 73 74 2d 6e 61 6d 65 73 29 0a 09 3b 3b 20 test-names)..;;
7780: 28 73 6c 65 65 70 20 31 30 29 20 3b 3b 20 6e 6f (sleep 10) ;; no
7790: 20 70 6f 69 6e 74 20 69 6e 20 72 75 73 68 69 6e point in rushin
77a0: 67 20 74 68 69 6e 67 73 20 61 74 20 74 68 69 73 g things at this
77b0: 20 73 74 61 67 65 3f 0a 09 28 6c 6f 6f 70 20 28 stage?..(loop (
77c0: 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 hash-table-keys
77d0: 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 2a 29 *waiting-queue*)
77e0: 29 29 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 ))))))..(define
77f0: 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 (get-dir-up-n di
7800: 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 28 r . params) . (
7810: 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28 73 let ((dparts (s
7820: 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 tring-split dir
7830: 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 "/"))..(count
7840: 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d (if (null? param
7850: 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d 73 s) 1 (car params
7860: 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 )))). (conc "
7870: 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 /" (string-inter
7880: 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20 20 sperse ..
7890: 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 (take dparts (-
78a0: 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 (length dparts)
78b0: 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20 20 count))..
78c0: 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 "/")))).;; Remov
78d0: 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 e runs.;; fields
78e0: 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e 20 are passing in
78f0: 74 68 72 6f 75 67 68 20 0a 28 64 65 66 69 6e 65 through .(define
7900: 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 2d 72 75 (runs:remove-ru
7910: 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 70 61 74 ns db runnamepat
7920: 74 20 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 t testpatt itemp
7930: 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b att). (let* ((k
7940: 65 79 73 20 20 20 20 20 20 20 20 28 64 62 2d 67 eys (db-g
7950: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 et-keys db)).. (
7960: 72 75 6e 64 61 74 20 20 20 20 20 20 28 72 75 6e rundat (run
7970: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 s:get-runs-by-pa
7980: 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 tt db keys runna
7990: 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 mepatt)).. (head
79a0: 65 72 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d er (vector-
79b0: 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 ref rundat 0))..
79c0: 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 28 76 (runs (v
79d0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 ector-ref rundat
79e0: 20 31 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 1))). (debug
79f0: 3a 70 72 69 6e 74 20 31 20 22 48 65 61 64 65 72 :print 1 "Header
7a00: 3a 20 22 20 68 65 61 64 65 72 29 0a 20 20 20 20 : " header).
7a10: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 (for-each. (
7a20: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 lambda (run).
7a30: 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 (let ((runke
7a40: 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 y (string-inters
7a50: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 perse (map (lamb
7a60: 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 da (k).......(db
7a70: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
7a80: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
7a90: 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 (vector-ref k 0)
7aa0: 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 29 0a )) keys) "/"))).
7ab0: 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 . (let* ((run-id
7ac0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
7ad0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
7ae0: 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 28 74 der "id") )...(t
7af0: 65 73 74 73 20 20 28 64 62 2d 67 65 74 2d 74 65 ests (db-get-te
7b00: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 sts-for-run db (
7b10: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
7b20: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
7b30: 72 20 22 69 64 22 29 20 74 65 73 74 70 61 74 74 r "id") testpatt
7b40: 20 69 74 65 6d 70 61 74 74 29 29 0a 09 09 28 6c itempatt))...(l
7b50: 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f asttpath "/does/
7b60: 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 not/exist/I/hope
7b70: 22 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 ")).. (if (not
7b80: 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a (null? tests)).
7b90: 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 . (begin..
7ba0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
7bb0: 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 "Removing tests
7bc0: 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b for run: " runk
7bd0: 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 ey " " (db:get-v
7be0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
7bf0: 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 un header "runna
7c00: 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 me"))... (for-ea
7c10: 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 ch... (lambda (
7c20: 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 test)... (let
7c30: 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 * ((item-path (d
7c40: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
7c50: 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 path test))....
7c60: 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 (test-name (db
7c70: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
7c80: 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 me test))....
7c90: 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 (run-dir (db:t
7ca0: 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 est-get-rundir t
7cb0: 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 est)))... (
7cc0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 20 debug:print 1 "
7cd0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
7ce0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22 testname test) "
7cf0: 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d id: " (db:test-
7d00: 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 22 get-id test) " "
7d10: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 item-path)...
7d20: 20 20 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 74 (db:delete-t
7d30: 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 28 est-records db (
7d40: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
7d50: 65 73 74 29 29 0a 09 09 20 20 20 20 20 20 28 69 est))... (i
7d60: 66 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e f (> (string-len
7d70: 67 74 68 20 72 75 6e 2d 64 69 72 29 20 35 29 20 gth run-dir) 5)
7d80: 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 69 63 ;; bad heuristic
7d90: 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76 but should prev
7da0: 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 ent /tmp /home e
7db0: 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 20 28 28 tc..... (let ((
7dc0: 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d 64 69 72 fullpath run-dir
7dd0: 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 3a 74 65 )) ;; "/" (db:te
7de0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
7df0: 20 74 65 73 74 29 29 29 29 0a 09 09 09 20 20 20 test))))....
7e00: 20 28 73 65 74 21 20 6c 61 73 74 74 70 61 74 68 (set! lasttpath
7e10: 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 fullpath)....
7e20: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
7e30: 20 22 72 6d 20 2d 72 66 20 22 20 66 75 6c 6c 70 "rm -rf " fullp
7e40: 61 74 68 29 0a 09 09 09 20 20 20 20 28 73 79 73 ath).... (sys
7e50: 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 tem (conc "rm -r
7e60: 66 20 22 20 66 75 6c 6c 70 61 74 68 29 29 0a 09 f " fullpath))..
7e70: 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 64 69 .. (let* ((di
7e80: 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 28 6c rs-count (+ 1 (l
7e90: 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 6e 67 ength keys)(leng
7ea0: 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 th (string-split
7eb0: 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 29 item-path "/"))
7ec0: 29 29 0a 09 09 09 09 20 20 20 28 64 69 72 2d 74 ))..... (dir-t
7ed0: 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 72 2d 75 o-rem (get-dir-u
7ee0: 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 64 69 72 p-n fullpath dir
7ef0: 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 09 20 20 s-count)).....
7f00: 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 74 (remainingd (st
7f10: 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 20 ring-substitute
7f20: 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 22 5e (regexp (conc "^
7f30: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f 22 " dir-to-rem "/"
7f40: 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 29 29 )) "" fullpath))
7f50: 0a 09 09 09 09 20 20 20 28 63 6d 64 20 28 63 6f ..... (cmd (co
7f60: 6e 63 20 22 63 64 20 22 20 64 69 72 2d 74 6f 2d nc "cd " dir-to-
7f70: 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d 70 20 rem "; rmdir -p
7f80: 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 29 29 " remainingd )))
7f90: 0a 09 09 09 20 20 20 20 20 20 28 69 66 20 28 66 .... (if (f
7fa0: 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 75 6c 6c ile-exists? full
7fb0: 70 61 74 68 29 0a 09 09 09 09 20 20 28 62 65 67 path)..... (beg
7fc0: 69 6e 0a 09 09 09 09 20 20 20 20 28 64 65 62 75 in..... (debu
7fd0: 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 0a 09 g:print 1 cmd)..
7fe0: 09 09 09 20 20 20 20 28 73 79 73 74 65 6d 20 63 ... (system c
7ff0: 6d 64 29 29 29 0a 09 09 09 20 20 20 20 20 20 29 md))).... )
8000: 29 0a 09 09 09 20 20 20 20 29 29 29 0a 09 09 20 ).... )))...
8010: 20 20 20 74 65 73 74 73 29 29 29 0a 09 20 20 20 tests)))..
8020: 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 (let ((remtests
8030: 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f (db-get-tests-fo
8040: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 r-run db (db:get
8050: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
8060: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 run header "id"
8070: 29 29 29 29 0a 09 20 20 20 20 20 28 69 66 20 28 )))).. (if (
8080: 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 null? remtests)
8090: 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 ;; no more tests
80a0: 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 28 6c remaining... (l
80b0: 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 73 et* ((dparts (s
80c0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 tring-split last
80d0: 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 28 tpath "/"))....(
80e0: 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 2f runpath (conc "/
80f0: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 " (string-inters
8100: 70 65 72 73 65 20 0a 09 09 09 09 09 20 20 20 20 perse ......
8110: 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d 20 (take dparts (-
8120: 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 20 (length dparts)
8130: 31 29 29 0a 09 09 09 09 09 20 20 20 20 22 2f 22 1))...... "/"
8140: 29 29 29 29 0a 09 09 20 20 20 28 64 65 62 75 67 ))))... (debug
8150: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 :print 1 "Removi
8160: 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 ng run: " runkey
8170: 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c " " (db:get-val
8180: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
8190: 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 header "runname
81a0: 22 29 29 0a 09 09 20 20 20 28 64 62 3a 64 65 6c "))... (db:del
81b0: 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 ete-run db run-i
81c0: 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 64 20 d)... ;; need
81d0: 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 to figure out th
81e0: 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 e path to the ru
81f0: 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 n dir and remove
8200: 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 it if empty...
8210: 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 6c ;; (if (nul
8220: 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 l? (glob (conc r
8230: 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 unpath "/*")))..
8240: 09 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 62 . ;; (b
8250: 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 20 28 egin... ;; . (
8260: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 debug:print 1 "R
8270: 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 emoving run dir
8280: 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 " runpath)...
8290: 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f ;; . (system (co
82a0: 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 nc "rmdir -p " r
82b0: 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 unpath))))...
82c0: 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 )))).. )). r
82d0: 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d uns)))..;;======
82e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
82f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8300: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8310: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8320: 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 .;; Routines for
8330: 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 manipulating ru
8340: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ns.;;===========
8350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 ===========..;;
8390: 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 Since many calls
83a0: 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 to a run requir
83b0: 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 e pretty much th
83c0: 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b e same setup .;;
83d0: 20 74 68 69 73 20 77 72 61 70 70 65 72 20 69 73 this wrapper is
83e0: 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 used to reduce
83f0: 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 the replication
8400: 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 of code.(define
8410: 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c (general-run-cal
8420: 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 l switchname act
8430: 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 ion-desc proc).
8440: 20 28 69 66 20 28 6e 6f 74 20 28 61 72 67 73 3a (if (not (args:
8450: 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d get-arg ":runnam
8460: 65 22 29 29 0a 20 20 20 20 20 20 28 62 65 67 69 e")). (begi
8470: 6e 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 n..(debug:print
8480: 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 0 "ERROR: Missin
8490: 67 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d g required param
84a0: 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 eter for " switc
84b0: 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 hname ", you mus
84c0: 74 20 73 70 65 63 69 66 79 20 74 68 65 20 72 75 t specify the ru
84d0: 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e n name with :run
84e0: 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 09 name runname")..
84f0: 28 65 78 69 74 20 32 29 29 0a 20 20 20 20 20 20 (exit 2)).
8500: 28 6c 65 74 20 28 28 64 62 20 23 66 29 29 0a 09 (let ((db #f))..
8510: 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d (if (not (setup-
8520: 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 for-run)).. (
8530: 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 begin .. (d
8540: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 ebug:print 0 "Fa
8550: 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 iled to setup, e
8560: 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 xiting")..
8570: 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 65 74 (exit 1)))..(set
8580: 21 20 64 62 20 28 6f 70 65 6e 2d 64 62 29 29 0a ! db (open-db)).
8590: 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a .(if (not (car *
85a0: 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 configinfo*))..
85b0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 (begin..
85c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
85d0: 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 "ERROR: Attempte
85e0: 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 d to " action-de
85f0: 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 sc " but run are
8600: 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f a config file no
8610: 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 t found")..
8620: 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 (exit 1))..
8630: 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 ;; Extract out s
8640: 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d tuff needed in m
8650: 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c ost or many call
8660: 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 s.. ;; here t
8670: 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 hen call proc..
8680: 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 (let* ((keys
8690: 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b 65 (db-get-ke
86a0: 79 73 20 64 62 29 29 0a 09 09 20 20 20 28 6b 65 ys db))... (ke
86b0: 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 ynames (map ke
86c0: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 y:get-fieldname
86d0: 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 keys))... (key
86e0: 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 vallst (keys->v
86f0: 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 allist keys #t))
8700: 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 64 ).. (proc d
8710: 62 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 b keys keynames
8720: 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 28 73 keyvallst)))..(s
8730: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 qlite3:finalize!
8740: 20 64 62 29 0a 09 28 73 65 74 21 20 2a 64 69 64 db)..(set! *did
8750: 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 something* #t)))
8760: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d )..;;===========
8770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
87a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 ===========.;; R
87b0: 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d ollup runs.;;===
87c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
87d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
87e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
87f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8800: 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 ===..;; Update t
8810: 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 he test_meta tab
8820: 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 le for this test
8830: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 .(define (runs:u
8840: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 pdate-test_meta
8850: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 db test-name tes
8860: 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 t-conf). (let (
8870: 28 63 75 72 72 72 65 63 6f 72 64 20 28 64 62 3a (currrecord (db:
8880: 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 testmeta-get-rec
8890: 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 ord db test-name
88a0: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 ))). (if (not
88b0: 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 28 62 currrecord)..(b
88c0: 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 63 75 egin.. (set! cu
88d0: 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 rrrecord (make-v
88e0: 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a 09 20 ector 10 #f))..
88f0: 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 (db:testmeta-ad
8900: 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 d-record db test
8910: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f -name))). (fo
8920: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 r-each . (la
8930: 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20 mbda (key).
8940: 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63 (let* ((idx (c
8950: 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20 adr key))..
8960: 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29 (fld (car key)
8970: 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28 63 ).. (val (c
8980: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 onfig-lookup tes
8990: 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 t-conf "test_met
89a0: 61 22 20 66 6c 64 29 29 29 0a 09 20 28 69 66 20 a" fld))).. (if
89b0: 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 (and val (not (e
89c0: 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 qual? (vector-re
89d0: 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 f currrecord idx
89e0: 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 ) val))).. (
89f0: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 begin.. (p
8a00: 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 rint "Updating "
8a10: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 test-name " " f
8a20: 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 ld " to " val)..
8a30: 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 6d (db:testm
8a40: 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 eta-update-field
8a50: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c db test-name fl
8a60: 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 d val))))).
8a70: 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 '(("author" 2)("
8a80: 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 owner" 3)("descr
8a90: 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 iption" 4)("revi
8aa0: 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 ewed" 5)("tags"
8ab0: 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 9)))))..;; Updat
8ac0: 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 e test_meta for
8ad0: 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e all tests.(defin
8ae0: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 e (runs:update-a
8af0: 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 ll-test_meta db)
8b00: 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e . (let ((test-n
8b10: 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 ames (get-all-le
8b20: 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 gal-tests))).
8b30: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
8b40: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e (lambda (test-n
8b50: 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 ame). (let
8b60: 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 * ((test-path
8b70: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
8b80: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d "/tests/" test-
8b90: 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 name)).. (t
8ba0: 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e est-configf (con
8bb0: 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 c test-path "/te
8bc0: 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 stconfig"))..
8bd0: 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 (testexists
8be0: 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 (and (file-exis
8bf0: 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 ts? test-configf
8c00: 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 )(file-read-acce
8c10: 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 ss? test-configf
8c20: 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 ))).. ;; re
8c30: 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 ad configs with
8c40: 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 tricks turned of
8c50: 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 f (i.e. no syste
8c60: 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d m).. (test-
8c70: 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 conf (if test
8c80: 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e exists (read-con
8c90: 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 fig test-configf
8ca0: 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 #f #f)(make-has
8cb0: 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28 72 h-table)))).. (r
8cc0: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f uns:update-test_
8cd0: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d meta db test-nam
8ce0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 e test-conf))).
8cf0: 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 test-names))
8d00: 29 0a 09 20 0a 28 64 65 66 69 6e 65 20 28 72 75 ).. .(define (ru
8d10: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 ns:rollup-run db
8d20: 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b keys keynames k
8d30: 65 79 76 61 6c 6c 73 74 20 6e 29 0a 20 20 28 6c eyvallst n). (l
8d40: 65 74 2a 20 28 28 6e 65 77 2d 72 75 6e 2d 69 64 et* ((new-run-id
8d50: 20 20 20 28 72 65 67 69 73 74 65 72 2d 72 75 6e (register-run
8d60: 20 64 62 20 6b 65 79 73 29 29 0a 09 20 28 73 69 db keys)).. (si
8d70: 6d 69 6c 61 72 2d 72 75 6e 73 20 28 64 62 3a 67 milar-runs (db:g
8d80: 65 74 2d 72 75 6e 73 20 64 62 20 6b 65 79 73 29 et-runs db keys)
8d90: 29 0a 09 20 28 74 65 73 74 73 2d 6e 2d 64 61 79 ).. (tests-n-day
8da0: 73 20 28 64 62 3a 67 65 74 2d 74 65 73 74 73 2d s (db:get-tests-
8db0: 6e 2d 64 61 79 73 20 64 62 20 73 69 6d 69 6c 61 n-days db simila
8dc0: 72 2d 72 75 6e 73 29 29 29 0a 20 20 20 20 28 66 r-runs))). (f
8dd0: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
8de0: 61 6d 62 64 61 20 28 74 65 73 74 2d 69 64 29 0a ambda (test-id).
8df0: 20 20 20 20 20 20 20 28 64 62 3a 72 6f 6c 6c 75 (db:rollu
8e00: 70 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 p-test db run-id
8e10: 20 74 65 73 74 2d 69 64 29 29 0a 20 20 20 20 20 test-id)).
8e20: 74 65 73 74 73 2d 6e 2d 64 61 79 73 29 29 29 0a tests-n-days))).