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 20 74 61 67 73 29 0a 20 20 28 6c -path tags). (l
0c50: 65 74 20 28 28 69 74 65 6d 2d 70 61 74 68 73 20 et ((item-paths
0c60: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
0c70: 2d 70 61 74 68 20 22 22 29 0a 09 09 09 28 6c 69 -path "")....(li
0c80: 73 74 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 st item-path)...
0c90: 09 28 6c 69 73 74 20 69 74 65 6d 2d 70 61 74 68 .(list item-path
0ca0: 20 22 22 29 29 29 29 0a 20 20 20 20 28 66 6f 72 "")))). (for
0cb0: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d -each . (lam
0cc0: 62 64 61 20 28 70 74 68 29 0a 20 20 20 20 20 20 bda (pth).
0cd0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
0ce0: 65 20 64 62 20 22 49 4e 53 45 52 54 20 4f 52 20 e db "INSERT OR
0cf0: 49 47 4e 4f 52 45 20 49 4e 54 4f 20 74 65 73 74 IGNORE INTO test
0d00: 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 s (run_id,testna
0d10: 6d 65 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 69 74 me,event_time,it
0d20: 65 6d 5f 70 61 74 68 2c 73 74 61 74 65 2c 73 74 em_path,state,st
0d30: 61 74 75 73 2c 74 61 67 73 29 20 56 41 4c 55 45 atus,tags) VALUE
0d40: 53 20 28 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 S (?,?,strftime(
0d50: 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f 2c 27 4e '%s','now'),?,'N
0d60: 4f 54 5f 53 54 41 52 54 45 44 27 2c 27 6e 2f 61 OT_STARTED','n/a
0d70: 27 2c 3f 29 3b 22 20 0a 09 09 09 72 75 6e 2d 69 ',?);" ....run-i
0d80: 64 20 0a 09 09 09 74 65 73 74 2d 6e 61 6d 65 0a d ....test-name.
0d90: 09 09 09 70 74 68 20 0a 09 09 09 28 63 6f 6e 63 ...pth ....(conc
0da0: 20 22 2c 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "," (string-int
0db0: 65 72 73 70 65 72 73 65 20 74 61 67 73 20 22 2c ersperse tags ",
0dc0: 22 29 20 22 2c 22 29 29 29 0a 20 20 20 20 20 69 ") ","))). i
0dd0: 74 65 6d 2d 70 61 74 68 73 20 29 29 29 0a 0a 3b tem-paths )))..;
0de0: 3b 20 20 28 64 65 66 69 6e 65 20 64 62 20 28 6f ; (define db (o
0df0: 70 65 6e 2d 64 62 29 29 0a 3b 3b 20 20 28 74 65 pen-db)).;; (te
0e00: 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 st-set-status! d
0e10: 62 20 32 20 22 72 75 6e 66 69 72 73 74 22 20 22 b 2 "runfirst" "
0e20: 43 4f 4d 50 4c 45 54 45 44 22 20 22 50 41 53 53 COMPLETED" "PASS
0e30: 22 20 22 73 75 6d 6d 65 72 22 29 0a 0a 28 64 65 " "summer")..(de
0e40: 66 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 73 fine (test-set-s
0e50: 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 64 tatus! db run-id
0e60: 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 test-name state
0e70: 20 73 74 61 74 75 73 20 69 74 65 6d 64 61 74 2d status itemdat-
0e80: 6f 72 2d 70 61 74 68 20 2e 20 63 6f 6d 6d 65 6e or-path . commen
0e90: 74 29 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d t). (let ((item
0ea0: 2d 70 61 74 68 20 28 69 66 20 28 73 74 72 69 6e -path (if (strin
0eb0: 67 3f 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 61 g? itemdat-or-pa
0ec0: 74 68 29 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 th) itemdat-or-p
0ed0: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
0ee0: 70 61 74 68 20 69 74 65 6d 64 61 74 2d 6f 72 2d path itemdat-or-
0ef0: 70 61 74 68 29 29 29 29 0a 20 20 20 20 28 73 71 path)))). (sq
0f00: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
0f10: 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 "UPDATE tests S
0f20: 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 ET state=?,statu
0f30: 73 3d 3f 2c 65 76 65 6e 74 5f 74 69 6d 65 3d 73 s=?,event_time=s
0f40: 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f trftime('%s','no
0f50: 77 27 29 20 57 48 45 52 45 20 72 75 6e 5f 69 64 w') WHERE run_id
0f60: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
0f70: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
0f80: 3f 3b 22 20 0a 09 09 20 20 20 20 20 73 74 61 74 ?;" ... stat
0f90: 65 20 73 74 61 74 75 73 20 72 75 6e 2d 69 64 20 e status run-id
0fa0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
0fb0: 61 74 68 29 0a 20 20 20 20 28 69 66 20 28 61 6e ath). (if (an
0fc0: 64 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 d (not (equal? i
0fd0: 74 65 6d 2d 70 61 74 68 20 22 22 29 29 20 3b 3b tem-path "")) ;;
0fe0: 20 6e 65 65 64 20 74 6f 20 75 70 64 61 74 65 20 need to update
0ff0: 74 68 65 20 74 6f 70 20 74 65 73 74 20 72 65 63 the top test rec
1000: 6f 72 64 20 69 66 20 50 41 53 53 20 6f 72 20 46 ord if PASS or F
1010: 41 49 4c 20 61 6e 64 20 74 68 69 73 20 69 73 20 AIL and this is
1020: 61 20 73 75 62 74 65 73 74 0a 09 20 20 20 20 20 a subtest..
1030: 28 6f 72 20 28 65 71 75 61 6c 3f 20 73 74 61 74 (or (equal? stat
1040: 75 73 20 22 50 41 53 53 22 29 0a 09 09 20 28 65 us "PASS")... (e
1050: 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 57 41 qual? status "WA
1060: 52 4e 22 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 RN")... (equal?
1070: 73 74 61 74 75 73 20 22 46 41 49 4c 22 29 29 29 status "FAIL")))
1080: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 71 6c ..(begin.. (sql
1090: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 ite3:execute ..
10a0: 20 20 64 62 0a 09 20 20 20 22 55 50 44 41 54 45 db.. "UPDATE
10b0: 20 74 65 73 74 73 20 0a 20 20 20 20 20 20 20 20 tests .
10c0: 20 20 20 20 20 53 45 54 20 66 61 69 6c 5f 63 6f SET fail_co
10d0: 75 6e 74 3d 28 53 45 4c 45 43 54 20 63 6f 75 6e unt=(SELECT coun
10e0: 74 28 69 64 29 20 46 52 4f 4d 20 74 65 73 74 73 t(id) FROM tests
10f0: 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 WHERE run_id=?
1100: 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 AND testname=? A
1110: 4e 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d 20 ND item_path !=
1120: 27 27 20 41 4e 44 20 73 74 61 74 75 73 3d 27 46 '' AND status='F
1130: 41 49 4c 27 29 2c 0a 20 20 20 20 20 20 20 20 20 AIL'),.
1140: 20 20 20 20 20 20 20 20 70 61 73 73 5f 63 6f 75 pass_cou
1150: 6e 74 3d 28 53 45 4c 45 43 54 20 63 6f 75 6e 74 nt=(SELECT count
1160: 28 69 64 29 20 46 52 4f 4d 20 74 65 73 74 73 20 (id) FROM tests
1170: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
1180: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
1190: 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d 20 27 D item_path != '
11a0: 27 20 41 4e 44 20 28 73 74 61 74 75 73 3d 27 50 ' AND (status='P
11b0: 41 53 53 27 20 4f 52 20 73 74 61 74 75 73 3d 27 ASS' OR status='
11c0: 57 41 52 4e 27 29 29 0a 20 20 20 20 20 20 20 20 WARN')).
11d0: 20 20 20 20 20 57 48 45 52 45 20 72 75 6e 5f 69 WHERE run_i
11e0: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
11f0: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
1200: 3d 27 27 3b 22 0a 09 20 20 20 72 75 6e 2d 69 64 ='';".. run-id
1210: 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d 69 test-name run-i
1220: 64 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d d test-name run-
1230: 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a 09 20 id test-name)..
1240: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
1250: 65 0a 09 20 20 20 64 62 0a 09 20 20 20 22 55 50 e.. db.. "UP
1260: 44 41 54 45 20 74 65 73 74 73 0a 20 20 20 20 20 DATE tests.
1270: 20 20 20 20 20 20 20 20 53 45 54 20 73 74 61 74 SET stat
1280: 65 3d 43 41 53 45 20 57 48 45 4e 20 28 53 45 4c e=CASE WHEN (SEL
1290: 45 43 54 20 63 6f 75 6e 74 28 69 64 29 20 46 52 ECT count(id) FR
12a0: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 OM tests WHERE r
12b0: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
12c0: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
12d0: 70 61 74 68 20 21 3d 20 27 27 20 41 4e 44 20 73 path != '' AND s
12e0: 74 61 74 65 20 69 6e 20 28 27 52 55 4e 4e 49 4e tate in ('RUNNIN
12f0: 47 27 2c 27 4e 4f 54 5f 53 54 41 52 54 45 44 27 G','NOT_STARTED'
1300: 29 29 20 3e 20 30 20 54 48 45 4e 20 0a 20 20 20 )) > 0 THEN .
1310: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1320: 20 20 20 20 20 20 20 27 52 55 4e 4e 49 4e 47 27 'RUNNING'
1330: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1340: 20 20 20 20 20 20 20 20 45 4c 53 45 20 27 43 4f ELSE 'CO
1350: 4d 50 4c 45 54 45 44 27 20 45 4e 44 2c 0a 20 20 MPLETED' END,.
1360: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 st
1370: 61 74 75 73 3d 43 41 53 45 20 57 48 45 4e 20 66 atus=CASE WHEN f
1380: 61 69 6c 5f 63 6f 75 6e 74 20 3e 20 30 20 54 48 ail_count > 0 TH
1390: 45 4e 20 27 46 41 49 4c 27 20 57 48 45 4e 20 70 EN 'FAIL' WHEN p
13a0: 61 73 73 5f 63 6f 75 6e 74 20 3e 20 30 20 41 4e ass_count > 0 AN
13b0: 44 20 66 61 69 6c 5f 63 6f 75 6e 74 3d 30 20 54 D fail_count=0 T
13c0: 48 45 4e 20 27 50 41 53 53 27 20 45 4c 53 45 20 HEN 'PASS' ELSE
13d0: 27 55 4e 4b 4e 4f 57 4e 27 20 45 4e 44 0a 20 20 'UNKNOWN' END.
13e0: 20 20 20 20 20 20 20 20 20 20 20 57 48 45 52 45 WHERE
13f0: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
1400: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
1410: 6d 5f 70 61 74 68 3d 27 27 3b 22 0a 09 20 20 20 m_path='';"..
1420: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1430: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
1440: 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 61 6e e))). (if (an
1450: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 63 6f d (not (null? co
1460: 6d 6d 65 6e 74 29 29 0a 09 20 20 20 20 20 28 63 mment)).. (c
1470: 61 72 20 63 6f 6d 6d 65 6e 74 29 29 0a 09 28 73 ar comment))..(s
1480: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 qlite3:execute d
1490: 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 b "UPDATE tests
14a0: 53 45 54 20 63 6f 6d 6d 65 6e 74 3d 3f 20 57 48 SET comment=? WH
14b0: 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 ERE run_id=? AND
14c0: 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 testname=? AND
14d0: 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 0a 09 09 item_path=?;"...
14e0: 09 20 28 63 61 72 20 63 6f 6d 6d 65 6e 74 29 20 . (car comment)
14f0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1500: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 0a item-path))))..
1510: 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 73 65 (define (test-se
1520: 74 2d 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 t-log! db run-id
1530: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 test-name itemd
1540: 61 74 20 6c 6f 67 66 29 20 0a 20 20 28 6c 65 74 at logf) . (let
1550: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 ((item-path (it
1560: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
1570: 65 6d 64 61 74 29 29 29 0a 20 20 20 20 28 73 71 emdat))). (sq
1580: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
1590: 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 "UPDATE tests S
15a0: 45 54 20 66 69 6e 61 6c 5f 6c 6f 67 66 3d 3f 20 ET final_logf=?
15b0: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
15c0: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
15d0: 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 20 D item_path=?;"
15e0: 0a 09 09 20 20 20 20 20 6c 6f 67 66 20 72 75 6e ... logf run
15f0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
1600: 65 6d 2d 70 61 74 68 29 29 29 0a 0a 28 64 65 66 em-path)))..(def
1610: 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 74 6f ine (test-set-to
1620: 70 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 20 plog! db run-id
1630: 74 65 73 74 2d 6e 61 6d 65 20 6c 6f 67 66 29 20 test-name logf)
1640: 0a 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 . (sqlite3:exec
1650: 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 ute db "UPDATE t
1660: 65 73 74 73 20 53 45 54 20 66 69 6e 61 6c 5f 6c ests SET final_l
1670: 6f 67 66 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f ogf=? WHERE run_
1680: 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d id=? AND testnam
1690: 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 e=? AND item_pat
16a0: 68 3d 27 27 3b 22 20 0a 09 09 20 20 20 6c 6f 67 h='';" ... log
16b0: 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 f run-id test-na
16c0: 6d 65 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 me))..(define (t
16d0: 65 73 74 73 3a 73 75 6d 6d 61 72 69 7a 65 2d 69 ests:summarize-i
16e0: 74 65 6d 73 20 64 62 20 72 75 6e 2d 69 64 20 74 tems db run-id t
16f0: 65 73 74 2d 6e 61 6d 65 20 66 6f 72 63 65 29 0a est-name force).
1700: 20 20 3b 3b 20 69 66 20 6e 6f 74 20 66 6f 72 63 ;; if not forc
1710: 65 20 74 68 65 6e 20 6f 6e 6c 79 20 75 70 64 61 e then only upda
1720: 74 65 20 74 68 65 20 72 65 63 6f 72 64 20 69 66 te the record if
1730: 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 69 73 one of these is
1740: 20 74 72 75 65 3a 0a 20 20 3b 3b 20 20 20 31 2e true:. ;; 1.
1750: 20 6c 6f 67 66 20 69 73 20 22 6c 6f 67 2f 66 69 logf is "log/fi
1760: 6e 61 6c 2e 6c 6f 67 0a 20 20 3b 3b 20 20 20 32 nal.log. ;; 2
1770: 2e 20 6c 6f 67 66 20 69 73 20 73 61 6d 65 20 61 . logf is same a
1780: 73 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 s outputfilename
1790: 0a 20 20 28 6c 65 74 20 28 28 6f 75 74 70 75 74 . (let ((output
17a0: 66 69 6c 65 6e 61 6d 65 20 28 63 6f 6e 63 20 22 filename (conc "
17b0: 6d 65 67 61 74 65 73 74 2d 72 6f 6c 6c 75 70 2d megatest-rollup-
17c0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2e 68 74 " test-name ".ht
17d0: 6d 6c 22 29 29 0a 09 28 6f 72 69 67 2d 64 69 72 ml"))..(orig-dir
17e0: 20 20 20 20 20 20 20 28 63 75 72 72 65 6e 74 2d (current-
17f0: 64 69 72 65 63 74 6f 72 79 29 29 0a 09 28 6c 6f directory))..(lo
1800: 67 66 20 20 20 20 20 20 20 20 20 20 20 23 66 29 gf #f)
1810: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 ). (sqlite3:f
1820: 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 or-each-row .
1830: 20 20 28 6c 61 6d 62 64 61 20 28 70 61 74 68 20 (lambda (path
1840: 66 69 6e 61 6c 5f 6c 6f 67 66 29 0a 20 20 20 20 final_logf).
1850: 20 20 20 28 73 65 74 21 20 6c 6f 67 66 20 66 69 (set! logf fi
1860: 6e 61 6c 5f 6c 6f 67 66 29 0a 20 20 20 20 20 20 nal_logf).
1870: 20 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f (if (directory?
1880: 20 70 61 74 68 29 0a 09 20 20 20 28 62 65 67 69 path).. (begi
1890: 6e 0a 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 n.. (print "
18a0: 46 6f 75 6e 64 20 70 61 74 68 3a 20 22 20 70 61 Found path: " pa
18b0: 74 68 29 0a 09 20 20 20 20 20 28 63 68 61 6e 67 th).. (chang
18c0: 65 2d 64 69 72 65 63 74 6f 72 79 20 70 61 74 68 e-directory path
18d0: 29 29 0a 09 20 20 20 20 20 3b 3b 20 28 73 65 74 )).. ;; (set
18e0: 21 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 ! outputfilename
18f0: 20 28 63 6f 6e 63 20 70 61 74 68 20 22 2f 22 20 (conc path "/"
1900: 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 29 outputfilename))
1910: 29 0a 09 20 20 20 28 70 72 69 6e 74 20 22 4e 6f ).. (print "No
1920: 20 73 75 63 68 20 70 61 74 68 3a 20 22 20 70 61 such path: " pa
1930: 74 68 29 29 29 0a 20 20 20 20 20 64 62 20 0a 20 th))). db .
1940: 20 20 20 20 22 53 45 4c 45 43 54 20 72 75 6e 64 "SELECT rund
1950: 69 72 2c 66 69 6e 61 6c 5f 6c 6f 67 66 20 46 52 ir,final_logf FR
1960: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 OM tests WHERE r
1970: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
1980: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
1990: 70 61 74 68 3d 27 27 3b 22 0a 20 20 20 20 20 72 path='';". r
19a0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 un-id test-name)
19b0: 0a 20 20 20 20 28 70 72 69 6e 74 20 22 73 75 6d . (print "sum
19c0: 6d 61 72 69 7a 65 2d 69 74 65 6d 73 20 77 69 74 marize-items wit
19d0: 68 20 6c 6f 67 66 20 22 20 6c 6f 67 66 29 0a 20 h logf " logf).
19e0: 20 20 20 28 69 66 20 28 6f 72 20 28 65 71 75 61 (if (or (equa
19f0: 6c 3f 20 6c 6f 67 66 20 22 6c 6f 67 73 2f 66 69 l? logf "logs/fi
1a00: 6e 61 6c 2e 6c 6f 67 22 29 0a 09 20 20 20 20 28 nal.log").. (
1a10: 65 71 75 61 6c 3f 20 6c 6f 67 66 20 6f 75 74 70 equal? logf outp
1a20: 75 74 66 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 utfilename)..
1a30: 20 66 6f 72 63 65 29 0a 09 28 62 65 67 69 6e 0a force)..(begin.
1a40: 09 20 20 28 69 66 20 28 6f 62 74 61 69 6e 2d 64 . (if (obtain-d
1a50: 6f 74 2d 6c 6f 63 6b 20 6f 75 74 70 75 74 66 69 ot-lock outputfi
1a60: 6c 65 6e 61 6d 65 20 31 20 32 30 20 33 30 29 20 lename 1 20 30)
1a70: 3b 3b 20 72 65 74 72 79 20 65 76 65 72 79 20 73 ;; retry every s
1a80: 65 63 6f 6e 64 20 66 6f 72 20 32 30 20 73 65 63 econd for 20 sec
1a90: 6f 6e 64 73 2c 20 63 61 6c 6c 20 69 74 20 64 65 onds, call it de
1aa0: 61 64 20 61 66 74 65 72 20 33 30 20 73 65 63 6f ad after 30 seco
1ab0: 6e 64 73 20 61 6e 64 20 73 74 65 61 6c 20 74 68 nds and steal th
1ac0: 65 20 6c 6f 63 6b 0a 09 20 20 20 20 20 20 28 70 e lock.. (p
1ad0: 72 69 6e 74 20 22 4f 62 74 61 69 6e 65 64 20 6c rint "Obtained l
1ae0: 6f 63 6b 20 66 6f 72 20 22 20 6f 75 74 70 75 74 ock for " output
1af0: 66 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 20 20 filename)..
1b00: 20 28 70 72 69 6e 74 20 22 46 61 69 6c 65 64 20 (print "Failed
1b10: 74 6f 20 6f 62 74 61 69 6e 20 6c 6f 63 6b 20 66 to obtain lock f
1b20: 6f 72 20 22 20 6f 75 74 70 75 74 66 69 6c 65 6e or " outputfilen
1b30: 61 6d 65 29 29 0a 09 20 20 28 6c 65 74 20 28 28 ame)).. (let ((
1b40: 6f 75 70 20 20 20 20 28 6f 70 65 6e 2d 6f 75 74 oup (open-out
1b50: 70 75 74 2d 66 69 6c 65 20 6f 75 74 70 75 74 66 put-file outputf
1b60: 69 6c 65 6e 61 6d 65 29 29 0a 09 09 28 63 6f 75 ilename))...(cou
1b70: 6e 74 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 nts (make-hash-t
1b80: 61 62 6c 65 29 29 0a 09 09 28 73 74 61 74 65 63 able))...(statec
1b90: 6f 75 6e 74 73 20 28 6d 61 6b 65 2d 68 61 73 68 ounts (make-hash
1ba0: 2d 74 61 62 6c 65 29 29 0a 09 09 28 6f 75 74 74 -table))...(outt
1bb0: 78 74 20 22 22 29 0a 09 09 28 74 6f 74 20 20 20 xt "")...(tot
1bc0: 20 30 29 29 0a 09 20 20 20 20 28 77 69 74 68 2d 0)).. (with-
1bd0: 6f 75 74 70 75 74 2d 74 6f 2d 70 6f 72 74 0a 09 output-to-port..
1be0: 09 6f 75 70 0a 09 20 20 20 20 20 20 28 6c 61 6d .oup.. (lam
1bf0: 62 64 61 20 28 29 0a 09 09 28 73 65 74 21 20 6f bda ()...(set! o
1c00: 75 74 74 78 74 20 28 63 6f 6e 63 20 6f 75 74 74 uttxt (conc outt
1c10: 78 74 20 22 3c 68 74 6d 6c 3e 3c 74 69 74 6c 65 xt "<html><title
1c20: 3e 53 75 6d 6d 61 72 79 3a 20 22 20 74 65 73 74 >Summary: " test
1c30: 2d 6e 61 6d 65 20 0a 09 09 09 09 20 20 20 22 3c -name ..... "<
1c40: 2f 74 69 74 6c 65 3e 3c 62 6f 64 79 3e 3c 68 32 /title><body><h2
1c50: 3e 53 75 6d 6d 61 72 79 20 66 6f 72 20 22 20 74 >Summary for " t
1c60: 65 73 74 2d 6e 61 6d 65 20 22 3c 2f 68 32 3e 22 est-name "</h2>"
1c70: 29 29 0a 09 09 28 73 71 6c 69 74 65 33 3a 66 6f ))...(sqlite3:fo
1c80: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 09 20 28 r-each-row ... (
1c90: 6c 61 6d 62 64 61 20 28 69 64 20 69 74 65 6d 70 lambda (id itemp
1ca0: 61 74 68 20 73 74 61 74 65 20 73 74 61 74 75 73 ath state status
1cb0: 20 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 6c 6f run_duration lo
1cc0: 67 66 20 63 6f 6d 6d 65 6e 74 29 0a 09 09 20 20 gf comment)...
1cd0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
1ce0: 21 20 63 6f 75 6e 74 73 20 73 74 61 74 75 73 20 ! counts status
1cf0: 28 2b 20 31 20 28 68 61 73 68 2d 74 61 62 6c 65 (+ 1 (hash-table
1d00: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 75 -ref/default cou
1d10: 6e 74 73 20 73 74 61 74 75 73 20 30 29 29 29 0a nts status 0))).
1d20: 09 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 .. (hash-table
1d30: 2d 73 65 74 21 20 73 74 61 74 65 63 6f 75 6e 74 -set! statecount
1d40: 73 20 73 74 61 74 65 20 28 2b 20 31 20 28 68 61 s state (+ 1 (ha
1d50: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
1d60: 61 75 6c 74 20 73 74 61 74 65 63 6f 75 6e 74 73 ault statecounts
1d70: 20 73 74 61 74 65 20 30 29 29 29 0a 09 09 20 20 state 0)))...
1d80: 20 28 73 65 74 21 20 6f 75 74 74 78 74 20 28 63 (set! outtxt (c
1d90: 6f 6e 63 20 6f 75 74 74 78 74 20 22 3c 74 72 3e onc outtxt "<tr>
1da0: 22 0a 09 09 09 09 20 20 20 20 20 20 22 3c 74 64 "..... "<td
1db0: 3e 3c 61 20 68 72 65 66 3d 5c 22 22 20 69 74 65 ><a href=\"" ite
1dc0: 6d 70 61 74 68 20 22 2f 22 20 6c 6f 67 66 20 22 mpath "/" logf "
1dd0: 5c 22 3e 20 22 20 69 74 65 6d 70 61 74 68 20 22 \"> " itempath "
1de0: 3c 2f 61 3e 3c 2f 74 64 3e 22 20 0a 09 09 09 09 </a></td>" .....
1df0: 20 20 20 20 20 20 22 3c 74 64 3e 22 20 73 74 61 "<td>" sta
1e00: 74 65 20 20 20 20 22 3c 2f 74 64 3e 22 20 0a 09 te "</td>" ..
1e10: 09 09 09 20 20 20 20 20 20 22 3c 74 64 3e 3c 66 ... "<td><f
1e20: 6f 6e 74 20 63 6f 6c 6f 72 3d 22 20 28 63 6f 6d ont color=" (com
1e30: 6d 6f 6e 3a 67 65 74 2d 63 6f 6c 6f 72 2d 66 72 mon:get-color-fr
1e40: 6f 6d 2d 73 74 61 74 75 73 20 73 74 61 74 75 73 om-status status
1e50: 29 0a 09 09 09 09 20 20 20 20 20 20 22 3e 22 20 )..... ">"
1e60: 20 20 73 74 61 74 75 73 20 20 20 22 3c 2f 66 6f status "</fo
1e70: 6e 74 3e 3c 2f 74 64 3e 22 0a 09 09 09 09 20 20 nt></td>".....
1e80: 20 20 20 20 22 3c 74 64 3e 22 20 28 69 66 20 28 "<td>" (if (
1e90: 65 71 75 61 6c 3f 20 63 6f 6d 6d 65 6e 74 20 22 equal? comment "
1ea0: 22 29 0a 09 09 09 09 09 09 20 22 26 6e 62 73 70 ")....... " 
1eb0: 3b 22 0a 09 09 09 09 09 09 20 63 6f 6d 6d 65 6e ;"....... commen
1ec0: 74 29 20 22 3c 2f 74 64 3e 22 0a 09 09 09 09 09 t) "</td>"......
1ed0: 09 20 22 3c 2f 74 72 3e 22 29 29 29 0a 09 09 20 . "</tr>")))...
1ee0: 64 62 0a 09 09 20 22 53 45 4c 45 43 54 20 69 64 db... "SELECT id
1ef0: 2c 69 74 65 6d 5f 70 61 74 68 2c 73 74 61 74 65 ,item_path,state
1f00: 2c 73 74 61 74 75 73 2c 72 75 6e 5f 64 75 72 61 ,status,run_dura
1f10: 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c tion,final_logf,
1f20: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 comment FROM tes
1f30: 74 73 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d ts WHERE run_id=
1f40: 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f ? AND testname=?
1f50: 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 20 21 AND item_path !
1f60: 3d 20 27 27 3b 22 0a 09 09 20 72 75 6e 2d 69 64 = '';"... run-id
1f70: 20 74 65 73 74 2d 6e 61 6d 65 29 0a 0a 09 09 28 test-name)....(
1f80: 70 72 69 6e 74 20 22 3c 74 61 62 6c 65 3e 3c 74 print "<table><t
1f90: 72 3e 3c 74 64 20 76 61 6c 69 67 6e 3d 5c 22 74 r><td valign=\"t
1fa0: 6f 70 5c 22 3e 22 29 0a 09 09 3b 3b 20 50 72 69 op\">")...;; Pri
1fb0: 6e 74 20 6f 75 74 20 73 74 61 74 73 20 66 6f 72 nt out stats for
1fc0: 20 73 74 61 74 75 73 0a 09 09 28 73 65 74 21 20 status...(set!
1fd0: 74 6f 74 20 30 29 0a 09 09 28 70 72 69 6e 74 20 tot 0)...(print
1fe0: 22 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 "<table cellspac
1ff0: 69 6e 67 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 ing=\"0\" border
2000: 3d 5c 22 31 5c 22 3e 3c 74 72 3e 3c 74 64 20 63 =\"1\"><tr><td c
2010: 6f 6c 73 70 61 6e 3d 5c 22 32 5c 22 3e 3c 68 32 olspan=\"2\"><h2
2020: 3e 53 74 61 74 65 20 73 74 61 74 73 3c 2f 68 32 >State stats</h2
2030: 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 22 29 0a 09 09 ></td></tr>")...
2040: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
2050: 61 20 28 73 74 61 74 65 29 0a 09 09 09 20 20 20 a (state)....
2060: 20 28 73 65 74 21 20 74 6f 74 20 28 2b 20 74 6f (set! tot (+ to
2070: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 t (hash-table-re
2080: 66 20 73 74 61 74 65 63 6f 75 6e 74 73 20 73 74 f statecounts st
2090: 61 74 65 29 29 29 0a 09 09 09 20 20 20 20 28 70 ate))).... (p
20a0: 72 69 6e 74 20 22 3c 74 72 3e 3c 74 64 3e 22 20 rint "<tr><td>"
20b0: 73 74 61 74 65 20 22 3c 2f 74 64 3e 3c 74 64 3e state "</td><td>
20c0: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 " (hash-table-re
20d0: 66 20 73 74 61 74 65 63 6f 75 6e 74 73 20 73 74 f statecounts st
20e0: 61 74 65 29 20 22 3c 2f 74 64 3e 3c 2f 74 72 3e ate) "</td></tr>
20f0: 22 29 29 0a 09 09 09 20 20 28 68 61 73 68 2d 74 ")).... (hash-t
2100: 61 62 6c 65 2d 6b 65 79 73 20 73 74 61 74 65 63 able-keys statec
2110: 6f 75 6e 74 73 29 29 0a 09 09 28 70 72 69 6e 74 ounts))...(print
2120: 20 22 3c 74 72 3e 3c 74 64 3e 54 6f 74 61 6c 3c "<tr><td>Total<
2130: 2f 74 64 3e 3c 74 64 3e 22 20 74 6f 74 20 22 3c /td><td>" tot "<
2140: 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 /td></tr></table
2150: 3e 22 29 0a 09 09 28 70 72 69 6e 74 20 22 3c 2f >")...(print "</
2160: 74 64 3e 3c 74 64 20 76 61 6c 69 67 6e 3d 5c 22 td><td valign=\"
2170: 74 6f 70 5c 22 3e 22 29 0a 09 09 3b 3b 20 50 72 top\">")...;; Pr
2180: 69 6e 74 20 6f 75 74 20 73 74 61 74 73 20 66 6f int out stats fo
2190: 72 20 73 74 61 74 65 0a 09 09 28 73 65 74 21 20 r state...(set!
21a0: 74 6f 74 20 30 29 0a 09 09 28 70 72 69 6e 74 20 tot 0)...(print
21b0: 22 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 "<table cellspac
21c0: 69 6e 67 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 ing=\"0\" border
21d0: 3d 5c 22 31 5c 22 3e 3c 74 72 3e 3c 74 64 20 63 =\"1\"><tr><td c
21e0: 6f 6c 73 70 61 6e 3d 5c 22 32 5c 22 3e 3c 68 32 olspan=\"2\"><h2
21f0: 3e 53 74 61 74 75 73 20 73 74 61 74 73 3c 2f 68 >Status stats</h
2200: 32 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 22 29 0a 09 2></td></tr>")..
2210: 09 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 .(for-each (lamb
2220: 64 61 20 28 73 74 61 74 75 73 29 0a 09 09 09 20 da (status)....
2230: 20 20 20 28 73 65 74 21 20 74 6f 74 20 28 2b 20 (set! tot (+
2240: 74 6f 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d tot (hash-table-
2250: 72 65 66 20 63 6f 75 6e 74 73 20 73 74 61 74 75 ref counts statu
2260: 73 29 29 29 0a 09 09 09 20 20 20 20 28 70 72 69 s))).... (pri
2270: 6e 74 20 22 3c 74 72 3e 3c 74 64 3e 3c 66 6f 6e nt "<tr><td><fon
2280: 74 20 63 6f 6c 6f 72 3d 5c 22 22 20 28 63 6f 6d t color=\"" (com
2290: 6d 6f 6e 3a 67 65 74 2d 63 6f 6c 6f 72 2d 66 72 mon:get-color-fr
22a0: 6f 6d 2d 73 74 61 74 75 73 20 73 74 61 74 75 73 om-status status
22b0: 29 20 22 5c 22 3e 22 20 73 74 61 74 75 73 0a 09 ) "\">" status..
22c0: 09 09 09 20 20 20 22 3c 2f 66 6f 6e 74 3e 3c 2f ... "</font></
22d0: 74 64 3e 3c 74 64 3e 22 20 28 68 61 73 68 2d 74 td><td>" (hash-t
22e0: 61 62 6c 65 2d 72 65 66 20 63 6f 75 6e 74 73 20 able-ref counts
22f0: 73 74 61 74 75 73 29 20 22 3c 2f 74 64 3e 3c 2f status) "</td></
2300: 74 72 3e 22 29 29 0a 09 09 09 20 20 28 68 61 73 tr>")).... (has
2310: 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 63 6f 75 h-table-keys cou
2320: 6e 74 73 29 29 0a 09 09 28 70 72 69 6e 74 20 22 nts))...(print "
2330: 3c 74 72 3e 3c 74 64 3e 54 6f 74 61 6c 3c 2f 74 <tr><td>Total</t
2340: 64 3e 3c 74 64 3e 22 20 74 6f 74 20 22 3c 2f 74 d><td>" tot "</t
2350: 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 22 d></tr></table>"
2360: 29 0a 09 09 28 70 72 69 6e 74 20 22 3c 2f 74 64 )...(print "</td
2370: 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 ></td></tr></tab
2380: 6c 65 3e 22 29 0a 0a 09 09 28 70 72 69 6e 74 20 le>")....(print
2390: 22 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 "<table cellspac
23a0: 69 6e 67 3d 5c 22 30 5c 22 20 62 6f 72 64 65 72 ing=\"0\" border
23b0: 3d 5c 22 31 5c 22 3e 22 20 0a 09 09 20 20 20 20 =\"1\">" ...
23c0: 20 20 20 22 3c 74 72 3e 3c 74 64 3e 49 74 65 6d "<tr><td>Item
23d0: 3c 2f 74 64 3e 3c 74 64 3e 53 74 61 74 65 3c 2f </td><td>State</
23e0: 74 64 3e 3c 74 64 3e 53 74 61 74 75 73 3c 2f 74 td><td>Status</t
23f0: 64 3e 3c 74 64 3e 43 6f 6d 6d 65 6e 74 3c 2f 74 d><td>Comment</t
2400: 64 3e 22 0a 09 09 20 20 20 20 20 20 20 6f 75 74 d>"... out
2410: 74 78 74 20 22 3c 2f 74 61 62 6c 65 3e 3c 2f 62 txt "</table></b
2420: 6f 64 79 3e 3c 2f 68 74 6d 6c 3e 22 29 0a 09 09 ody></html>")...
2430: 28 72 65 6c 65 61 73 65 2d 64 6f 74 2d 6c 6f 63 (release-dot-loc
2440: 6b 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 k outputfilename
2450: 29 29 29 0a 09 20 20 20 20 28 63 6c 6f 73 65 2d ))).. (close-
2460: 6f 75 74 70 75 74 2d 70 6f 72 74 20 6f 75 70 29 output-port oup)
2470: 0a 09 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 .. (change-di
2480: 72 65 63 74 6f 72 79 20 6f 72 69 67 2d 64 69 72 rectory orig-dir
2490: 29 0a 09 20 20 20 20 28 74 65 73 74 2d 73 65 74 ).. (test-set
24a0: 2d 74 6f 70 6c 6f 67 21 20 64 62 20 72 75 6e 2d -toplog! db run-
24b0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 6f 75 74 id test-name out
24c0: 70 75 74 66 69 6c 65 6e 61 6d 65 29 0a 09 20 20 putfilename)..
24d0: 20 20 29 29 29 29 29 0a 0a 3b 3b 20 3b 3b 20 54 )))))..;; ;; T
24e0: 4f 44 4f 3a 20 43 6f 6e 76 65 72 67 65 20 74 68 ODO: Converge th
24f0: 69 73 20 77 69 74 68 20 64 62 3a 67 65 74 2d 74 is with db:get-t
2500: 65 73 74 2d 69 6e 66 6f 0a 3b 3b 20 28 64 65 66 est-info.;; (def
2510: 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d 74 65 ine (runs:get-te
2520: 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 st-info db run-i
2530: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
2540: 2d 70 61 74 68 29 0a 3b 3b 20 20 20 28 6c 65 74 -path).;; (let
2550: 20 28 28 72 65 73 20 23 66 29 29 20 3b 3b 20 28 ((res #f)) ;; (
2560: 76 65 63 74 6f 72 20 23 66 20 23 66 20 23 66 20 vector #f #f #f
2570: 23 66 20 23 66 20 23 66 29 29 29 0a 3b 3b 20 20 #f #f #f))).;;
2580: 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d (sqlite3:for-
2590: 65 61 63 68 2d 72 6f 77 20 0a 3b 3b 20 20 20 20 each-row .;;
25a0: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 20 72 75 (lambda (id ru
25b0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 73 n-id test-name s
25c0: 74 61 74 65 20 73 74 61 74 75 73 29 0a 3b 3b 20 tate status).;;
25d0: 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65 73 (set! res
25e0: 20 28 76 65 63 74 6f 72 20 69 64 20 72 75 6e 2d (vector id run-
25f0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 id test-name sta
2600: 74 65 20 73 74 61 74 75 73 20 69 74 65 6d 2d 70 te status item-p
2610: 61 74 68 29 29 29 0a 3b 3b 20 20 20 20 20 20 64 ath))).;; d
2620: 62 20 22 53 45 4c 45 43 54 20 69 64 2c 72 75 6e b "SELECT id,run
2630: 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 _id,testname,sta
2640: 74 65 2c 73 74 61 74 75 73 20 46 52 4f 4d 20 74 te,status FROM t
2650: 65 73 74 73 20 57 48 45 52 45 20 72 75 6e 5f 69 ests WHERE run_i
2660: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
2670: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
2680: 3d 3f 3b 22 0a 3b 3b 20 20 20 20 20 20 72 75 6e =?;".;; run
2690: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
26a0: 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 20 20 20 20 em-path).;;
26b0: 72 65 73 29 29 0a 0a 28 64 65 66 69 6e 65 2d 69 res))..(define-i
26c0: 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d nline (test:get-
26d0: 69 64 20 76 65 63 29 20 20 20 20 20 20 20 28 76 id vec) (v
26e0: 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 30 29 ector-ref vec 0)
26f0: 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 ).(define-inline
2700: 20 28 74 65 73 74 3a 67 65 74 2d 72 75 6e 5f 69 (test:get-run_i
2710: 64 20 76 65 63 29 20 20 20 28 76 65 63 74 6f 72 d vec) (vector
2720: 2d 72 65 66 20 76 65 63 20 31 29 29 0a 28 64 65 -ref vec 1)).(de
2730: 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 fine-inline (tes
2740: 74 3a 67 65 74 2d 74 65 73 74 2d 6e 61 6d 65 20 t:get-test-name
2750: 76 65 63 29 28 76 65 63 74 6f 72 2d 72 65 66 20 vec)(vector-ref
2760: 76 65 63 20 32 29 29 0a 28 64 65 66 69 6e 65 2d vec 2)).(define-
2770: 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 inline (test:get
2780: 2d 73 74 61 74 65 20 76 65 63 29 20 20 20 20 28 -state vec) (
2790: 76 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 33 vector-ref vec 3
27a0: 29 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e )).(define-inlin
27b0: 65 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 e (test:get-stat
27c0: 75 73 20 76 65 63 29 20 20 20 28 76 65 63 74 6f us vec) (vecto
27d0: 72 2d 72 65 66 20 76 65 63 20 34 29 29 0a 28 64 r-ref vec 4)).(d
27e0: 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 efine-inline (te
27f0: 73 74 3a 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st:get-item-path
2800: 20 76 65 63 29 28 76 65 63 74 6f 72 2d 72 65 66 vec)(vector-ref
2810: 20 76 65 63 20 35 29 29 0a 0a 28 64 65 66 69 6e vec 5))..(defin
2820: 65 20 28 72 75 6e 73 3a 74 65 73 74 2d 67 65 74 e (runs:test-get
2830: 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 73 74 29 -full-path test)
2840: 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e . (let* ((testn
2850: 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ame (db:test-get
2860: 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 74 -testname test
2870: 29 29 0a 09 20 28 69 74 65 6d 70 61 74 68 20 28 )).. (itempath (
2880: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
2890: 2d 70 61 74 68 20 74 65 73 74 29 29 29 0a 20 20 -path test))).
28a0: 20 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 (conc testname
28b0: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
28c0: 6d 70 61 74 68 20 22 22 29 20 22 22 20 28 63 6f mpath "") "" (co
28d0: 6e 63 20 22 28 22 20 69 74 65 6d 70 61 74 68 20 nc "(" itempath
28e0: 22 29 22 29 29 29 29 29 0a 0a 28 64 65 66 69 6e ")")))))..(defin
28f0: 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 74 e-inline (test:t
2900: 65 73 74 2d 67 65 74 2d 66 75 6c 6c 6e 61 6d 65 est-get-fullname
2910: 20 74 65 73 74 29 0a 20 20 20 28 63 6f 6e 63 20 test). (conc
2920: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
2930: 74 6e 61 6d 65 20 74 65 73 74 29 0a 09 20 28 69 tname test).. (i
2940: 66 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 f (equal? (db:te
2950: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
2960: 20 74 65 73 74 29 20 22 22 29 0a 09 20 20 20 20 test) "")..
2970: 20 22 22 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 "".. (conc
2980: 22 28 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 "(" (db:test-get
2990: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 -item-path test)
29a0: 20 22 29 22 29 29 29 29 0a 0a 28 64 65 66 69 6e ")"))))..(defin
29b0: 65 20 28 63 68 65 63 6b 2d 76 61 6c 69 64 2d 69 e (check-valid-i
29c0: 74 65 6d 73 20 63 6c 61 73 73 20 69 74 65 6d 29 tems class item)
29d0: 0a 20 20 28 6c 65 74 20 28 28 76 61 6c 69 64 2d . (let ((valid-
29e0: 76 61 6c 75 65 73 20 28 6c 65 74 20 28 28 73 20 values (let ((s
29f0: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a (config-lookup *
2a00: 63 6f 6e 66 69 67 64 61 74 2a 20 22 76 61 6c 69 configdat* "vali
2a10: 64 76 61 6c 75 65 73 22 20 63 6c 61 73 73 29 29 dvalues" class))
2a20: 29 0a 09 09 09 28 69 66 20 73 20 28 73 74 72 69 )....(if s (stri
2a30: 6e 67 2d 73 70 6c 69 74 20 73 29 20 23 66 29 29 ng-split s) #f))
2a40: 29 29 0a 20 20 20 20 28 69 66 20 76 61 6c 69 64 )). (if valid
2a50: 2d 76 61 6c 75 65 73 0a 09 28 69 66 20 28 6d 65 -values..(if (me
2a60: 6d 62 65 72 20 69 74 65 6d 20 76 61 6c 69 64 2d mber item valid-
2a70: 76 61 6c 75 65 73 29 0a 09 20 20 20 20 69 74 65 values).. ite
2a80: 6d 20 23 66 29 0a 09 69 74 65 6d 29 29 29 0a 0a m #f)..item)))..
2a90: 28 64 65 66 69 6e 65 20 28 74 65 73 74 73 74 65 (define (testste
2aa0: 70 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 p-set-status! db
2ab0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
2ac0: 65 20 74 65 73 74 73 74 65 70 2d 6e 61 6d 65 20 e teststep-name
2ad0: 73 74 61 74 65 2d 69 6e 20 73 74 61 74 75 73 2d state-in status-
2ae0: 69 6e 20 69 74 65 6d 64 61 74 20 63 6f 6d 6d 65 in itemdat comme
2af0: 6e 74 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 nt). (debug:pri
2b00: 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 nt 4 "run-id: "
2b10: 72 75 6e 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 run-id " test-na
2b20: 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 29 me: " test-name)
2b30: 0a 20 20 28 6c 65 74 2a 20 28 28 73 74 61 74 65 . (let* ((state
2b40: 20 20 20 20 20 28 63 68 65 63 6b 2d 76 61 6c 69 (check-vali
2b50: 64 2d 69 74 65 6d 73 20 22 73 74 61 74 65 22 20 d-items "state"
2b60: 73 74 61 74 65 2d 69 6e 29 29 0a 09 20 28 73 74 state-in)).. (st
2b70: 61 74 75 73 20 20 20 20 28 63 68 65 63 6b 2d 76 atus (check-v
2b80: 61 6c 69 64 2d 69 74 65 6d 73 20 22 73 74 61 74 alid-items "stat
2b90: 75 73 22 20 73 74 61 74 75 73 2d 69 6e 29 29 0a us" status-in)).
2ba0: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 . (item-path (it
2bb0: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
2bc0: 65 6d 64 61 74 29 29 0a 09 20 28 74 65 73 74 64 emdat)).. (testd
2bd0: 61 74 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73 at (db:get-tes
2be0: 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 t-info db run-id
2bf0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
2c00: 70 61 74 68 29 29 29 0a 20 20 20 20 28 64 65 62 path))). (deb
2c10: 75 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 ug:print 5 "test
2c20: 64 61 74 3a 20 22 20 74 65 73 74 64 61 74 29 0a dat: " testdat).
2c30: 20 20 20 20 28 69 66 20 28 61 6e 64 20 74 65 73 (if (and tes
2c40: 74 64 61 74 20 3b 3b 20 69 66 20 74 68 65 20 73 tdat ;; if the s
2c50: 65 63 74 69 6f 6e 20 65 78 69 73 74 73 20 74 68 ection exists th
2c60: 65 6e 20 66 6f 72 63 65 20 73 70 65 63 69 66 69 en force specifi
2c70: 63 61 74 69 6f 6e 20 42 55 47 2c 20 49 20 64 6f cation BUG, I do
2c80: 6e 27 74 20 6c 69 6b 65 20 68 6f 77 20 74 68 69 n't like how thi
2c90: 73 20 77 6f 72 6b 73 2e 0a 09 20 20 20 20 20 28 s works... (
2ca0: 6f 72 20 28 6e 6f 74 20 73 74 61 74 65 29 28 6e or (not state)(n
2cb0: 6f 74 20 73 74 61 74 75 73 29 29 29 0a 09 28 64 ot status)))..(d
2cc0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
2cd0: 52 4e 49 4e 47 3a 20 49 6e 76 61 6c 69 64 20 22 RNING: Invalid "
2ce0: 20 28 69 66 20 73 74 61 74 75 73 20 22 73 74 61 (if status "sta
2cf0: 74 75 73 22 20 22 73 74 61 74 65 22 29 0a 09 20 tus" "state")..
2d00: 20 20 20 20 20 20 22 20 76 61 6c 75 65 20 5c 22 " value \"
2d10: 22 20 28 69 66 20 73 74 61 74 75 73 20 73 74 61 " (if status sta
2d20: 74 75 73 2d 69 6e 20 73 74 61 74 65 2d 69 6e 29 tus-in state-in)
2d30: 20 22 5c 22 2c 20 75 70 64 61 74 65 20 79 6f 75 "\", update you
2d40: 72 20 76 61 6c 69 64 73 74 61 74 65 73 20 73 65 r validstates se
2d50: 63 74 69 6f 6e 20 69 6e 20 6d 65 67 61 74 65 73 ction in megates
2d60: 74 2e 63 6f 6e 66 69 67 22 29 29 0a 20 20 20 20 t.config")).
2d70: 28 69 66 20 74 65 73 74 64 61 74 0a 09 28 6c 65 (if testdat..(le
2d80: 74 20 28 28 74 65 73 74 2d 69 64 20 28 74 65 73 t ((test-id (tes
2d90: 74 3a 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 t:get-id testdat
2da0: 29 29 29 0a 09 20 20 28 73 71 6c 69 74 65 33 3a ))).. (sqlite3:
2db0: 65 78 65 63 75 74 65 20 64 62 20 0a 09 09 09 22 execute db ...."
2dc0: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 INSERT OR REPLAC
2dd0: 45 20 69 6e 74 6f 20 74 65 73 74 5f 73 74 65 70 E into test_step
2de0: 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 6e s (test_id,stepn
2df0: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
2e00: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d ,event_time,comm
2e10: 65 6e 74 29 20 56 41 4c 55 45 53 28 3f 2c 3f 2c ent) VALUES(?,?,
2e20: 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 ?,?,strftime('%s
2e30: 27 2c 27 6e 6f 77 27 29 2c 3f 29 3b 22 0a 09 09 ','now'),?);"...
2e40: 09 74 65 73 74 2d 69 64 20 74 65 73 74 73 74 65 .test-id testste
2e50: 70 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 p-name state sta
2e60: 74 75 73 20 28 69 66 20 63 6f 6d 6d 65 6e 74 20 tus (if comment
2e70: 63 6f 6d 6d 65 6e 74 20 22 22 29 29 29 0a 09 28 comment "")))..(
2e80: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
2e90: 52 52 4f 52 3a 20 43 61 6e 27 74 20 75 70 64 61 RROR: Can't upda
2ea0: 74 65 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 te " test-name "
2eb0: 20 66 6f 72 20 72 75 6e 20 22 20 72 75 6e 2d 69 for run " run-i
2ec0: 64 20 22 20 2d 3e 20 6e 6f 20 73 75 63 68 20 74 d " -> no such t
2ed0: 65 73 74 20 69 6e 20 64 62 22 29 29 29 29 0a 0a est in db"))))..
2ee0: 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 67 65 (define (test-ge
2ef0: 74 2d 6b 69 6c 6c 2d 72 65 71 75 65 73 74 20 64 t-kill-request d
2f00: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
2f10: 6d 65 20 69 74 65 6d 64 61 74 29 0a 20 20 28 6c me itemdat). (l
2f20: 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 et* ((item-path
2f30: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 (item-list->path
2f40: 20 69 74 65 6d 64 61 74 29 29 0a 09 20 28 74 65 itemdat)).. (te
2f50: 73 74 64 61 74 20 20 20 28 64 62 3a 67 65 74 2d stdat (db:get-
2f60: 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e test-info db run
2f70: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
2f80: 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 28 em-path))). (
2f90: 65 71 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 equal? (test:get
2fa0: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 -state testdat)
2fb0: 22 4b 49 4c 4c 52 45 51 22 29 29 29 0a 0a 28 64 "KILLREQ")))..(d
2fc0: 65 66 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d efine (test-set-
2fd0: 6d 65 74 61 2d 69 6e 66 6f 20 64 62 20 72 75 6e meta-info db run
2fe0: 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 -id testname ite
2ff0: 6d 64 61 74 29 0a 20 20 28 6c 65 74 20 28 28 69 mdat). (let ((i
3000: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c tem-path (item-l
3010: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
3020: 74 29 29 0a 09 28 63 70 75 6c 6f 61 64 20 20 28 t))..(cpuload (
3030: 67 65 74 2d 63 70 75 2d 6c 6f 61 64 29 29 0a 09 get-cpu-load))..
3040: 28 68 6f 73 74 6e 61 6d 65 20 28 67 65 74 2d 68 (hostname (get-h
3050: 6f 73 74 2d 6e 61 6d 65 29 29 0a 09 28 64 69 73 ost-name))..(dis
3060: 6b 66 72 65 65 20 28 67 65 74 2d 64 66 20 28 63 kfree (get-df (c
3070: 75 72 72 65 6e 74 2d 64 69 72 65 63 74 6f 72 79 urrent-directory
3080: 29 29 29 0a 09 28 75 6e 61 6d 65 20 20 20 20 28 )))..(uname (
3090: 67 65 74 2d 75 6e 61 6d 65 20 22 2d 73 72 76 70 get-uname "-srvp
30a0: 69 6f 22 29 29 0a 09 28 72 75 6e 70 61 74 68 20 io"))..(runpath
30b0: 20 28 63 75 72 72 65 6e 74 2d 64 69 72 65 63 74 (current-direct
30c0: 6f 72 79 29 29 29 0a 20 20 20 20 28 73 71 6c 69 ory))). (sqli
30d0: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
30e0: 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 UPDATE tests SET
30f0: 20 68 6f 73 74 3d 3f 2c 63 70 75 6c 6f 61 64 3d host=?,cpuload=
3100: 3f 2c 64 69 73 6b 66 72 65 65 3d 3f 2c 75 6e 61 ?,diskfree=?,una
3110: 6d 65 3d 3f 2c 72 75 6e 64 69 72 3d 3f 20 57 48 me=?,rundir=? WH
3120: 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 ERE run_id=? AND
3130: 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 testname=? AND
3140: 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 0a 09 09 item_path=?;"...
3150: 20 20 68 6f 73 74 6e 61 6d 65 0a 09 09 20 20 63 hostname... c
3160: 70 75 6c 6f 61 64 0a 09 09 20 20 64 69 73 6b 66 puload... diskf
3170: 72 65 65 0a 09 09 20 20 75 6e 61 6d 65 0a 09 09 ree... uname...
3180: 20 20 72 75 6e 70 61 74 68 0a 09 09 20 20 72 75 runpath... ru
3190: 6e 2d 69 64 0a 09 09 20 20 74 65 73 74 6e 61 6d n-id... testnam
31a0: 65 0a 09 09 20 20 69 74 65 6d 2d 70 61 74 68 29 e... item-path)
31b0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 ))..(define (tes
31c0: 74 2d 75 70 64 61 74 65 2d 6d 65 74 61 2d 69 6e t-update-meta-in
31d0: 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 fo db run-id tes
31e0: 74 6e 61 6d 65 20 69 74 65 6d 64 61 74 20 6d 69 tname itemdat mi
31f0: 6e 75 74 65 73 29 0a 20 20 28 6c 65 74 20 28 28 nutes). (let ((
3200: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d item-path (item-
3210: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 list->path itemd
3220: 61 74 29 29 0a 09 28 63 70 75 6c 6f 61 64 20 20 at))..(cpuload
3230: 28 67 65 74 2d 63 70 75 2d 6c 6f 61 64 29 29 0a (get-cpu-load)).
3240: 09 28 64 69 73 6b 66 72 65 65 20 28 67 65 74 2d .(diskfree (get-
3250: 64 66 20 28 63 75 72 72 65 6e 74 2d 64 69 72 65 df (current-dire
3260: 63 74 6f 72 79 29 29 29 29 0a 20 20 20 20 28 69 ctory)))). (i
3270: 66 20 28 6e 6f 74 20 63 70 75 6c 6f 61 64 29 20 f (not cpuload)
3280: 20 28 62 65 67 69 6e 20 28 64 65 62 75 67 3a 70 (begin (debug:p
3290: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
32a0: 20 43 50 55 4c 4f 41 44 20 6e 6f 74 20 66 6f 75 CPULOAD not fou
32b0: 6e 64 2e 22 29 20 20 28 73 65 74 21 20 63 70 75 nd.") (set! cpu
32c0: 6c 6f 61 64 20 22 6e 2f 61 22 29 29 29 0a 20 20 load "n/a"))).
32d0: 20 20 28 69 66 20 28 6e 6f 74 20 64 69 73 6b 66 (if (not diskf
32e0: 72 65 65 29 20 28 62 65 67 69 6e 20 28 64 65 62 ree) (begin (deb
32f0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
3300: 49 4e 47 3a 20 44 49 53 4b 46 52 45 45 20 6e 6f ING: DISKFREE no
3310: 74 20 66 6f 75 6e 64 2e 22 29 20 28 73 65 74 21 t found.") (set!
3320: 20 64 69 73 6b 66 72 65 65 20 22 6e 2f 61 22 29 diskfree "n/a")
3330: 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 )). (if (not
3340: 69 74 65 6d 2d 70 61 74 68 29 28 62 65 67 69 6e item-path)(begin
3350: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
3360: 22 57 41 52 4e 49 4e 47 3a 20 49 54 45 4d 50 41 "WARNING: ITEMPA
3370: 54 48 20 6e 6f 74 20 73 65 74 2e 22 29 20 20 20 TH not set.")
3380: 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 (set! item-path
3390: 22 22 29 29 29 0a 20 20 20 20 3b 3b 20 28 6c 65 ""))). ;; (le
33a0: 74 20 28 28 74 65 73 74 69 6e 66 6f 20 28 64 62 t ((testinfo (db
33b0: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 :get-test-info d
33c0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d b run-id testnam
33d0: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 e item-path))).
33e0: 20 20 20 3b 3b 20 20 20 28 69 66 20 28 61 6e 64 ;; (if (and
33f0: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 64 (not (equal? (d
3400: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 b:test-get-statu
3410: 73 20 74 65 73 74 69 6e 66 6f 29 20 22 43 4f 4d s testinfo) "COM
3420: 50 4c 45 54 45 44 22 29 29 0a 20 20 20 20 3b 3b PLETED")). ;;
3430: 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 6f 74 (not
3440: 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 (equal? (db:tes
3450: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t-get-status tes
3460: 74 69 6e 66 6f 29 20 22 4b 49 4c 4c 52 45 51 22 tinfo) "KILLREQ"
3470: 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a )). (sqlite3:
3480: 65 78 65 63 75 74 65 0a 20 20 20 20 20 64 62 0a execute. db.
3490: 20 20 20 20 20 22 55 50 44 41 54 45 20 74 65 73 "UPDATE tes
34a0: 74 73 20 53 45 54 20 63 70 75 6c 6f 61 64 3d 3f ts SET cpuload=?
34b0: 2c 64 69 73 6b 66 72 65 65 3d 3f 2c 72 75 6e 5f ,diskfree=?,run_
34c0: 64 75 72 61 74 69 6f 6e 3d 3f 2c 73 74 61 74 65 duration=?,state
34d0: 3d 27 52 55 4e 4e 49 4e 47 27 20 57 48 45 52 45 ='RUNNING' WHERE
34e0: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
34f0: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
3500: 6d 5f 70 61 74 68 3d 3f 20 41 4e 44 20 73 74 61 m_path=? AND sta
3510: 74 65 20 4e 4f 54 20 49 4e 20 28 27 43 4f 4d 50 te NOT IN ('COMP
3520: 4c 45 54 45 44 27 2c 27 4b 49 4c 4c 52 45 51 27 LETED','KILLREQ'
3530: 2c 27 4b 49 4c 4c 45 44 27 29 3b 22 0a 20 20 20 ,'KILLED');".
3540: 20 20 63 70 75 6c 6f 61 64 0a 20 20 20 20 20 64 cpuload. d
3550: 69 73 6b 66 72 65 65 0a 20 20 20 20 20 6d 69 6e iskfree. min
3560: 75 74 65 73 0a 20 20 20 20 20 72 75 6e 2d 69 64 utes. run-id
3570: 0a 20 20 20 20 20 74 65 73 74 6e 61 6d 65 0a 20 . testname.
3580: 20 20 20 20 69 74 65 6d 2d 70 61 74 68 29 29 29 item-path)))
3590: 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 6d ..(define (set-m
35a0: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
35b0: 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c db run-id). (l
35c0: 65 74 20 28 28 6b 65 79 73 20 28 64 62 2d 67 65 et ((keys (db-ge
35d0: 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 20 20 t-keys db))).
35e0: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 (for-each (lamb
35f0: 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71 6c 69 da (key)...(sqli
3600: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
3610: 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76 61 6c ... (lambda (val
3620: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 )... (debug:pr
3630: 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 int 2 "setenv "
3640: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 (key:get-fieldna
3650: 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61 6c 29 me key) " " val)
3660: 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20 28 6b ... (setenv (k
3670: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 ey:get-fieldname
3680: 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 20 64 key) val))... d
3690: 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 45 4c b ... (conc "SEL
36a0: 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 ECT " (key:get-f
36b0: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 ieldname key) "
36c0: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 FROM runs WHERE
36d0: 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e 2d 69 id=?;")... run-i
36e0: 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79 73 29 d)).. keys)
36f0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 ))..(define (set
3700: 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 -item-env-vars i
3710: 74 65 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 temdat). (for-e
3720: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 69 74 65 ach (lambda (ite
3730: 6d 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 m).. (debug
3740: 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 :print 2 "setenv
3750: 20 22 20 28 63 61 72 20 69 74 65 6d 29 20 22 20 " (car item) "
3760: 22 20 28 63 61 64 72 20 69 74 65 6d 29 29 0a 09 " (cadr item))..
3770: 20 20 20 20 20 20 28 73 65 74 65 6e 76 20 28 63 (setenv (c
3780: 61 72 20 69 74 65 6d 29 20 28 63 61 64 72 20 69 ar item) (cadr i
3790: 74 65 6d 29 29 29 0a 09 20 20 20 20 69 74 65 6d tem))).. item
37a0: 64 61 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 dat))..(define (
37b0: 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 get-all-legal-te
37c0: 73 74 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 sts). (let* ((t
37d0: 65 73 74 73 20 20 28 67 6c 6f 62 20 28 63 6f 6e ests (glob (con
37e0: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 c *toppath* "/te
37f0: 73 74 73 2f 2a 22 29 29 29 0a 09 20 28 72 65 73 sts/*"))).. (res
3800: 20 20 20 20 27 28 29 29 29 0a 20 20 20 20 28 64 '())). (d
3810: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
3820: 46 4f 3a 20 4c 6f 6f 6b 69 6e 67 20 61 74 20 74 FO: Looking at t
3830: 65 73 74 73 20 22 20 28 73 74 72 69 6e 67 2d 69 ests " (string-i
3840: 6e 74 65 72 73 70 65 72 73 65 20 74 65 73 74 73 ntersperse tests
3850: 20 22 2c 22 29 29 0a 20 20 20 20 28 66 6f 72 2d ",")). (for-
3860: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 74 65 each (lambda (te
3870: 73 74 70 61 74 68 29 0a 09 09 28 69 66 20 28 66 stpath)...(if (f
3880: 69 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e ile-exists? (con
3890: 63 20 74 65 73 74 70 61 74 68 20 22 2f 74 65 73 c testpath "/tes
38a0: 74 63 6f 6e 66 69 67 22 29 29 0a 09 09 20 20 20 tconfig"))...
38b0: 20 28 73 65 74 21 20 72 65 73 20 28 63 6f 6e 73 (set! res (cons
38c0: 20 28 6c 61 73 74 20 28 73 74 72 69 6e 67 2d 73 (last (string-s
38d0: 70 6c 69 74 20 74 65 73 74 70 61 74 68 20 22 2f plit testpath "/
38e0: 22 29 29 20 72 65 73 29 29 29 29 0a 09 20 20 20 ")) res))))..
38f0: 20 20 20 74 65 73 74 73 29 0a 20 20 20 20 72 65 tests). re
3900: 73 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 s))..(define (ru
3910: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
3920: 74 65 73 74 73 20 64 62 29 0a 20 20 28 6c 65 74 tests db). (let
3930: 20 28 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 ((num-running (
3940: 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 db:get-count-tes
3950: 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a ts-running db)).
3960: 09 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 .(max-concurrent
3970: 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f -jobs (config-lo
3980: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a okup *configdat*
3990: 20 22 73 65 74 75 70 22 20 22 6d 61 78 5f 63 6f "setup" "max_co
39a0: 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 ncurrent_jobs"))
39b0: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 ). (debug:pri
39c0: 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 75 72 nt 2 "max-concur
39d0: 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 rent-jobs: " max
39e0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
39f0: 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a ", num-running:
3a00: 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a " num-running).
3a10: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71 (if (not (eq
3a20: 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 ? 0 *globalexits
3a30: 74 61 74 75 73 2a 29 29 0a 09 23 66 0a 09 28 69 tatus*))..#f..(i
3a40: 66 20 28 6f 72 20 28 6e 6f 74 20 6d 61 78 2d 63 f (or (not max-c
3a50: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a oncurrent-jobs).
3a60: 09 09 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 ..(and max-concu
3a70: 72 72 65 6e 74 2d 6a 6f 62 73 0a 09 09 20 20 20 rrent-jobs...
3a80: 20 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 (string->numbe
3a90: 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 r max-concurrent
3aa0: 2d 6a 6f 62 73 29 0a 09 09 20 20 20 20 20 28 6e -jobs)... (n
3ab0: 6f 74 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 ot (>= num-runni
3ac0: 6e 67 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 ng (string->numb
3ad0: 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e er max-concurren
3ae0: 74 2d 6a 6f 62 73 29 29 29 29 29 0a 09 20 20 20 t-jobs)))))..
3af0: 20 23 74 0a 09 20 20 20 20 28 62 65 67 69 6e 20 #t.. (begin
3b00: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
3b10: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
3b20: 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 Max running job
3b30: 73 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72 s exceeded, curr
3b40: 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 ent number runni
3b50: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e ng: " num-runnin
3b60: 67 20 0a 09 09 09 20 20 20 22 2c 20 6d 61 78 5f g .... ", max_
3b70: 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a concurrent_jobs:
3b80: 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e " max-concurren
3b90: 74 2d 6a 6f 62 73 29 0a 09 20 20 20 20 20 20 23 t-jobs).. #
3ba0: 66 29 29 29 29 29 0a 20 20 0a 28 64 65 66 69 6e f))))). .(defin
3bb0: 65 20 28 72 75 6e 2d 74 65 73 74 73 20 64 62 20 e (run-tests db
3bc0: 74 65 73 74 2d 6e 61 6d 65 73 29 0a 20 20 28 6c test-names). (l
3bd0: 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 et* ((keys
3be0: 20 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 (db-get-keys d
3bf0: 62 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 b)).. (keyvallst
3c00: 20 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 (keys->vallis
3c10: 74 20 6b 65 79 73 20 23 74 29 29 0a 09 20 28 72 t keys #t)).. (r
3c20: 75 6e 2d 69 64 20 20 20 20 20 20 28 72 65 67 69 un-id (regi
3c30: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
3c40: 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d )) ;; test-nam
3c50: 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 e))).. (deferred
3c60: 20 20 20 20 27 28 29 29 29 20 3b 3b 20 64 65 6c '())) ;; del
3c70: 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 ay running these
3c80: 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 since they have
3c90: 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 a waiton clause
3ca0: 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 66 . ;; on the f
3cb0: 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 6c irst pass or cal
3cc0: 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 73 l to run-tests s
3cd0: 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 5f et FAILS to NOT_
3ce0: 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 3b STARTED if. ;
3cf0: 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 ; -keepgoing is
3d00: 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 69 specified. (i
3d10: 66 20 28 61 6e 64 20 28 65 71 3f 20 2a 70 61 73 f (and (eq? *pas
3d20: 73 6e 75 6d 2a 20 30 29 0a 09 20 20 20 20 20 28 snum* 0).. (
3d30: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6b args:get-arg "-k
3d40: 65 65 70 67 6f 69 6e 67 22 29 29 0a 09 28 62 65 eepgoing"))..(be
3d50: 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 gin.. ;; have t
3d60: 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 o delete test re
3d70: 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f cords where NOT_
3d80: 53 54 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 STARTED since th
3d90: 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 ey can cause -ke
3da0: 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b epgoing to .. ;
3db0: 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 ; get stuck due
3dc0: 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 to becoming inac
3dd0: 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 cessible from a
3de0: 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 failed test. I.e
3df0: 2e 20 69 66 20 74 65 73 74 20 42 20 64 65 70 65 . if test B depe
3e00: 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 nds .. ;; on te
3e10: 73 74 20 41 20 62 75 74 20 74 65 73 74 20 42 20 st A but test B
3e20: 72 65 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e reached the poin
3e30: 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 t on being regis
3e40: 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 tered as NOT_STA
3e50: 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 RTED and test..
3e60: 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 ;; A failed for
3e70: 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 some reason the
3e80: 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e n on re-run usin
3e90: 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 g -keepgoing the
3ea0: 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 run can never c
3eb0: 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 64 62 3a omplete... (db:
3ec0: 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d delete-tests-in-
3ed0: 73 74 61 74 65 20 64 62 20 72 75 6e 2d 69 64 20 state db run-id
3ee0: 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 "NOT_STARTED")..
3ef0: 20 20 28 64 62 3a 73 65 74 2d 74 65 73 74 73 2d (db:set-tests-
3f00: 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 20 state-status db
3f10: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
3f20: 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 s #f "FAIL" "NOT
3f30: 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 _STARTED" "FAIL"
3f40: 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 2a 70 ))). (set! *p
3f50: 61 73 73 6e 75 6d 2a 20 28 2b 20 2a 70 61 73 73 assnum* (+ *pass
3f60: 6e 75 6d 2a 20 31 29 29 0a 20 20 20 20 28 6c 65 num* 1)). (le
3f70: 74 20 6c 6f 6f 70 20 28 28 6e 75 6d 74 69 6d 65 t loop ((numtime
3f80: 73 20 30 29 29 0a 20 20 20 20 20 20 28 66 6f 72 s 0)). (for
3f90: 2d 65 61 63 68 20 0a 20 20 20 20 20 20 20 28 6c -each . (l
3fa0: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 ambda (test-name
3fb0: 29 0a 09 20 28 69 66 20 28 72 75 6e 73 3a 63 61 ).. (if (runs:ca
3fc0: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
3fd0: 20 64 62 29 0a 09 20 20 20 20 20 28 72 75 6e 2d db).. (run-
3fe0: 6f 6e 65 2d 74 65 73 74 20 64 62 20 72 75 6e 2d one-test db run-
3ff0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 6b 65 79 id test-name key
4000: 76 61 6c 6c 73 74 29 0a 09 20 20 20 20 20 3b 3b vallst).. ;;
4010: 20 61 64 64 20 73 6f 6d 65 20 64 65 6c 61 79 20 add some delay
4020: 0a 09 20 20 20 20 20 3b 28 73 6c 65 65 70 20 32 .. ;(sleep 2
4030: 29 0a 09 20 20 20 20 20 29 29 0a 20 20 20 20 20 ).. )).
4040: 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a 20 20 test-names).
4050: 20 20 20 20 3b 3b 20 28 72 75 6e 2d 77 61 69 74 ;; (run-wait
4060: 69 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 20 20 ing-tests db).
4070: 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 (if (args:ge
4080: 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e t-arg "-keepgoin
4090: 67 22 29 0a 09 20 20 28 6c 65 74 20 28 28 65 73 g").. (let ((es
40a0: 74 72 65 6d 20 28 64 62 3a 65 73 74 69 6d 61 74 trem (db:estimat
40b0: 65 64 2d 74 65 73 74 73 2d 72 65 6d 61 69 6e 69 ed-tests-remaini
40c0: 6e 67 20 64 62 20 72 75 6e 2d 69 64 29 29 29 0a ng db run-id))).
40d0: 09 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 3e . (if (and (>
40e0: 20 65 73 74 72 65 6d 20 30 29 0a 09 09 20 20 20 estrem 0)...
40f0: 20 20 28 65 71 3f 20 2a 67 6c 6f 62 61 6c 65 78 (eq? *globalex
4100: 69 74 73 74 61 74 75 73 2a 20 30 29 29 0a 09 09 itstatus* 0))...
4110: 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 (begin... (debu
4120: 67 3a 70 72 69 6e 74 20 31 20 22 4b 65 65 70 20 g:print 1 "Keep
4130: 67 6f 69 6e 67 2c 20 65 73 74 69 6d 61 74 65 64 going, estimated
4140: 20 22 20 65 73 74 72 65 6d 20 22 20 74 65 73 74 " estrem " test
4150: 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 72 s remaining to r
4160: 75 6e 2c 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 un, will continu
4170: 65 20 69 6e 20 33 20 73 65 63 6f 6e 64 73 20 2e e in 3 seconds .
4180: 2e 2e 22 29 0a 09 09 20 20 28 73 6c 65 65 70 20 ..")... (sleep
4190: 33 29 0a 09 09 20 20 28 72 75 6e 2d 77 61 69 74 3)... (run-wait
41a0: 69 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 09 09 ing-tests db)...
41b0: 20 20 28 6c 6f 6f 70 20 28 2b 20 6e 75 6d 74 69 (loop (+ numti
41c0: 6d 65 73 20 31 29 29 29 29 29 29 29 29 29 0a 09 mes 1)))))))))..
41d0: 20 20 20 0a 3b 3b 20 56 45 52 59 20 49 4e 45 46 .;; VERY INEF
41e0: 46 49 43 49 45 4e 54 21 20 4d 6f 76 65 20 73 74 FICIENT! Move st
41f0: 75 66 66 20 74 68 61 74 20 73 68 6f 75 6c 64 20 uff that should
4200: 62 65 20 64 6f 6e 65 20 6f 6e 63 65 20 75 70 20 be done once up
4210: 74 6f 20 63 61 6c 6c 69 6e 67 20 70 72 6f 63 0a to calling proc.
4220: 28 64 65 66 69 6e 65 20 28 72 75 6e 2d 6f 6e 65 (define (run-one
4230: 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 -test db run-id
4240: 74 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 61 6c test-name keyval
4250: 6c 73 74 29 0a 20 20 28 64 65 62 75 67 3a 70 72 lst). (debug:pr
4260: 69 6e 74 20 31 20 22 4c 61 75 6e 63 68 69 6e 67 int 1 "Launching
4270: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d test " test-nam
4280: 65 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 e). ;; All thes
4290: 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 e vars might be
42a0: 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 referenced by th
42b0: 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c e testconfig fil
42c0: 65 20 72 65 61 64 65 72 0a 20 20 28 73 65 74 65 e reader. (sete
42d0: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 nv "MT_TEST_NAME
42e0: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 " test-name) ;;
42f0: 0a 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 . (setenv "MT_R
4300: 55 4e 4e 41 4d 45 22 20 20 20 28 61 72 67 73 3a UNNAME" (args:
4310: 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d get-arg ":runnam
4320: 65 22 29 29 0a 20 20 28 73 65 74 2d 6d 65 67 61 e")). (set-mega
4330: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 test-env-vars db
4340: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 run-id) ;; thes
4350: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 e may be needed
4360: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 by the launching
4370: 20 70 72 6f 63 65 73 73 0a 20 20 28 63 68 61 6e process. (chan
4380: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f ge-directory *to
4390: 70 70 61 74 68 2a 29 0a 20 20 28 6c 65 74 2a 20 ppath*). (let*
43a0: 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 ((test-path (
43b0: 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 conc *toppath* "
43c0: 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 /tests/" test-na
43d0: 6d 65 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e me)).. (test-con
43e0: 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d figf (conc test-
43f0: 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 path "/testconfi
4400: 67 22 29 29 0a 09 20 28 74 65 73 74 65 78 69 73 g")).. (testexis
4410: 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d ts (and (file-
4420: 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e exists? test-con
4430: 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d figf)(file-read-
4440: 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e access? test-con
4450: 66 69 67 66 29 29 29 0a 09 20 28 74 65 73 74 2d figf))).. (test-
4460: 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 conf (if test
4470: 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e exists (read-con
4480: 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 fig test-configf
4490: 20 23 66 20 23 74 29 20 28 6d 61 6b 65 2d 68 61 #f #t) (make-ha
44a0: 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 77 sh-table))).. (w
44b0: 61 69 74 6f 6e 20 20 20 20 20 20 20 28 6c 65 74 aiton (let
44c0: 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f ((w (config-loo
44d0: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 72 kup test-conf "r
44e0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 equirements" "wa
44f0: 69 74 6f 6e 22 29 29 29 0a 09 09 09 20 28 69 66 iton"))).... (if
4500: 20 28 73 74 72 69 6e 67 3f 20 77 29 28 73 74 72 (string? w)(str
4510: 69 6e 67 2d 73 70 6c 69 74 20 77 29 27 28 29 29 ing-split w)'())
4520: 29 29 0a 09 20 28 74 61 67 73 20 20 20 20 20 20 )).. (tags
4530: 20 20 20 28 6c 65 74 20 28 28 74 20 28 63 6f 6e (let ((t (con
4540: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d fig-lookup test-
4550: 63 6f 6e 66 20 22 73 65 74 75 70 22 20 22 74 61 conf "setup" "ta
4560: 67 73 22 29 29 29 0a 09 09 09 20 28 69 66 20 28 gs"))).... (if (
4570: 73 74 72 69 6e 67 3f 20 74 29 28 73 74 72 69 6e string? t)(strin
4580: 67 2d 73 70 6c 69 74 20 74 20 22 2c 22 29 20 27 g-split t ",") '
4590: 28 29 29 29 29 29 0a 20 20 20 20 28 69 66 20 28 ())))). (if (
45a0: 6e 6f 74 20 74 65 73 74 65 78 69 73 74 73 29 0a not testexists).
45b0: 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 .(begin.. (debu
45c0: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
45d0: 3a 20 43 61 6e 27 74 20 66 69 6e 64 20 63 6f 6e : Can't find con
45e0: 66 69 67 20 66 69 6c 65 20 22 20 74 65 73 74 2d fig file " test-
45f0: 63 6f 6e 66 69 67 66 29 0a 09 20 20 28 65 78 69 configf).. (exi
4600: 74 20 32 29 29 0a 09 3b 3b 20 70 75 74 20 74 6f t 2))..;; put to
4610: 70 20 76 61 72 73 20 69 6e 74 6f 20 63 6f 6e 76 p vars into conv
4620: 65 6e 69 65 6e 74 20 76 61 72 69 61 62 6c 65 73 enient variables
4630: 20 61 6e 64 20 6f 70 65 6e 20 74 68 65 20 64 62 and open the db
4640: 0a 09 28 6c 65 74 2a 20 28 3b 3b 20 64 62 20 69 ..(let* (;; db i
4650: 73 20 61 6c 77 61 79 73 20 61 74 20 2a 74 6f 70 s always at *top
4660: 70 61 74 68 2a 2f 64 62 2f 6d 65 67 61 74 65 73 path*/db/megates
4670: 74 2e 64 62 0a 09 20 20 20 20 20 20 20 28 69 74 t.db.. (it
4680: 65 6d 73 20 20 20 20 20 20 20 28 68 61 73 68 2d ems (hash-
4690: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
46a0: 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 69 74 65 t test-conf "ite
46b0: 6d 73 22 20 27 28 29 29 29 0a 09 20 20 20 20 20 ms" '()))..
46c0: 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 20 28 (itemstable (
46d0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
46e0: 65 66 61 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 efault test-conf
46f0: 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 27 28 "itemstable" '(
4700: 29 29 29 0a 09 20 20 20 20 20 20 20 28 61 6c 6c ))).. (all
4710: 69 74 65 6d 73 20 20 20 20 28 69 66 20 28 6f 72 items (if (or
4720: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 (not (null? ite
4730: 6d 73 29 29 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 ms))(not (null?
4740: 69 74 65 6d 73 74 61 62 6c 65 29 29 29 0a 09 09 itemstable)))...
4750: 09 09 28 61 70 70 65 6e 64 20 28 69 74 65 6d 2d ..(append (item-
4760: 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 assoc->item-list
4770: 20 69 74 65 6d 73 29 0a 09 09 09 09 09 28 69 74 items)......(it
4780: 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c em-table->item-l
4790: 69 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 ist itemstable))
47a0: 0a 09 09 09 09 27 28 28 29 29 29 29 20 3b 3b 20 .....'(()))) ;;
47b0: 61 20 6c 69 73 74 20 77 69 74 68 20 6f 6e 65 20 a list with one
47c0: 6e 75 6c 6c 20 6c 69 73 74 20 69 73 20 61 20 74 null list is a t
47d0: 65 73 74 20 77 69 74 68 20 6e 6f 20 69 74 65 6d est with no item
47e0: 73 0a 09 20 20 20 20 20 20 20 28 72 75 6e 63 6f s.. (runco
47f0: 6e 66 69 67 66 20 20 28 63 6f 6e 63 20 20 2a 74 nfigf (conc *t
4800: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e oppath* "/runcon
4810: 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 29 0a figs.config"))).
4820: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
4830: 31 20 22 69 74 65 6d 73 3a 20 22 29 0a 09 20 20 1 "items: ")..
4840: 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 (if (>= *verbosi
4850: 74 79 2a 20 31 29 28 70 70 20 61 6c 6c 69 74 65 ty* 1)(pp allite
4860: 6d 73 29 29 0a 09 20 20 28 69 66 20 28 3e 3d 20 ms)).. (if (>=
4870: 2a 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 *verbosity* 5)..
4880: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 28 (begin...(
4890: 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 print "items: ")
48a0: 28 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d (pp (item-assoc-
48b0: 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 >item-list items
48c0: 29 29 0a 09 09 28 70 72 69 6e 74 20 22 69 74 65 ))...(print "ite
48d0: 73 74 61 62 6c 65 3a 20 22 29 28 70 70 20 28 69 stable: ")(pp (i
48e0: 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d tem-table->item-
48f0: 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 list itemstable)
4900: 29 29 29 0a 09 20 20 28 69 66 20 28 61 72 67 73 ))).. (if (args
4910: 3a 67 65 74 2d 61 72 67 20 22 2d 6d 22 29 0a 09 :get-arg "-m")..
4920: 20 20 20 20 20 20 28 64 62 3a 73 65 74 2d 63 6f (db:set-co
4930: 6d 6d 65 6e 74 2d 66 6f 72 2d 72 75 6e 20 64 62 mment-for-run db
4940: 20 72 75 6e 2d 69 64 20 28 61 72 67 73 3a 67 65 run-id (args:ge
4950: 74 2d 61 72 67 20 22 2d 6d 22 29 29 29 0a 0a 09 t-arg "-m")))...
4960: 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 ;; Here is whe
4970: 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 re the test_meta
4980: 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 table is best u
4990: 70 64 61 74 65 64 0a 09 20 20 28 72 75 6e 73 3a pdated.. (runs:
49a0: 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 update-test_meta
49b0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 db test-name te
49c0: 73 74 2d 63 6f 6e 66 29 0a 0a 09 20 20 3b 3b 20 st-conf)... ;;
49d0: 62 72 61 69 6e 64 65 61 64 20 77 6f 72 6b 2d 61 braindead work-a
49e0: 72 6f 75 6e 64 20 66 6f 72 20 70 6f 6f 72 6c 79 round for poorly
49f0: 20 73 70 65 63 69 66 69 65 64 20 61 6c 6c 69 74 specified allit
4a00: 65 6d 73 20 6c 69 73 74 20 42 55 47 21 21 21 20 ems list BUG!!!
4a10: 46 49 58 4d 45 0a 09 20 20 28 69 66 20 28 6e 75 FIXME.. (if (nu
4a20: 6c 6c 3f 20 61 6c 6c 69 74 65 6d 73 29 28 73 65 ll? allitems)(se
4a30: 74 21 20 61 6c 6c 69 74 65 6d 73 20 27 28 28 29 t! allitems '(()
4a40: 29 29 29 0a 09 20 20 28 6c 65 74 20 6c 6f 6f 70 ))).. (let loop
4a50: 20 28 28 69 74 65 6d 64 61 74 20 28 63 61 72 20 ((itemdat (car
4a60: 61 6c 6c 69 74 65 6d 73 29 29 0a 09 09 20 20 20 allitems))...
4a70: 20 20 28 74 61 6c 20 20 20 20 20 28 63 64 72 20 (tal (cdr
4a80: 61 6c 6c 69 74 65 6d 73 29 29 29 0a 09 20 20 20 allitems)))..
4a90: 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65 ;; (lambda (ite
4aa0: 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 mdat) ;;; ((ripe
4ab0: 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 29 ness "overripe")
4ac0: 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 63 (temperature "c
4ad0: 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73 ool") (season "s
4ae0: 75 6d 6d 65 72 22 29 29 0a 09 20 20 20 20 3b 3b ummer")).. ;;
4af0: 20 48 61 6e 64 6c 65 20 6c 69 73 74 73 20 6f 66 Handle lists of
4b00: 20 69 74 65 6d 73 0a 09 20 20 20 20 28 6c 65 74 items.. (let
4b10: 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 20 20 * ((item-path
4b20: 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 (item-list->pa
4b30: 74 68 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 th itemdat)) ;;
4b40: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
4b50: 72 73 65 20 28 6d 61 70 20 63 61 64 72 20 69 74 rse (map cadr it
4b60: 65 6d 64 61 74 29 20 22 2f 22 29 29 0a 09 09 20 emdat) "/"))...
4b70: 20 20 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 (new-test-path
4b80: 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 (string-intersp
4b90: 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d erse (cons test-
4ba0: 70 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 path (map cadr i
4bb0: 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 temdat)) "/"))..
4bc0: 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 . (new-test-na
4bd0: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 me (if (equal? i
4be0: 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 tem-path "") tes
4bf0: 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 t-name (conc tes
4c00: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d t-name "/" item-
4c10: 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 path))) ;; just
4c20: 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e need it to be un
4c30: 69 71 75 65 0a 09 09 20 20 20 28 74 65 73 74 64 ique... (testd
4c40: 61 74 20 20 20 23 66 29 0a 09 09 20 20 20 28 6e at #f)... (n
4c50: 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 62 3a 67 um-running (db:g
4c60: 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 et-count-tests-r
4c70: 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 09 20 20 unning db))...
4c80: 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 (max-concurrent
4c90: 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f -jobs (config-lo
4ca0: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a okup *configdat*
4cb0: 20 22 73 65 74 75 70 22 20 22 6d 61 78 5f 63 6f "setup" "max_co
4cc0: 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 ncurrent_jobs"))
4cd0: 0a 09 09 20 20 20 28 70 61 72 65 6e 74 2d 74 65 ... (parent-te
4ce0: 73 74 20 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 st (and (not (nu
4cf0: 6c 6c 3f 20 69 74 65 6d 73 29 29 28 65 71 75 61 ll? items))(equa
4d00: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 l? item-path "")
4d10: 29 29 0a 09 09 20 20 20 28 73 69 6e 67 6c 65 2d ))... (single-
4d20: 74 65 73 74 20 28 61 6e 64 20 28 6e 75 6c 6c 3f test (and (null?
4d30: 20 69 74 65 6d 73 29 20 28 65 71 75 61 6c 3f 20 items) (equal?
4d40: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 0a item-path ""))).
4d50: 09 09 20 20 20 28 69 74 65 6d 2d 74 65 73 74 20 .. (item-test
4d60: 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 (not (equal? i
4d70: 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 29 0a tem-path "")))).
4d80: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
4d90: 69 6e 74 20 33 20 22 6d 61 78 2d 63 6f 6e 63 75 int 3 "max-concu
4da0: 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 rrent-jobs: " ma
4db0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
4dc0: 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 s ", num-running
4dd0: 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 : " num-running)
4de0: 0a 09 20 20 20 20 20 20 28 69 66 20 28 72 75 6e .. (if (run
4df0: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 s:can-run-more-t
4e00: 65 73 74 73 20 64 62 29 0a 09 09 20 20 28 62 65 ests db)... (be
4e10: 67 69 6e 0a 09 09 20 20 20 20 28 6c 65 74 20 6c gin... (let l
4e20: 6f 6f 70 32 20 28 28 74 73 20 28 64 62 3a 67 65 oop2 ((ts (db:ge
4e30: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 t-test-info db r
4e40: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
4e50: 69 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 23 item-path)) ;; #
4e60: 66 29 0a 09 09 09 09 28 63 74 20 30 29 29 0a 09 f).....(ct 0))..
4e70: 09 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 . (if (and
4e80: 28 6e 6f 74 20 74 73 29 0a 09 09 09 20 20 20 20 (not ts)....
4e90: 20 20 20 28 3c 20 63 74 20 31 30 29 29 0a 09 09 (< ct 10))...
4ea0: 09 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 . (begin....
4eb0: 20 28 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 (register-test
4ec0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
4ed0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 74 61 ame item-path ta
4ee0: 67 73 29 0a 09 09 09 20 20 20 20 28 64 62 3a 74 gs).... (db:t
4ef0: 65 73 74 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 est-set-comment
4f00: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
4f10: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 22 22 ame item-path ""
4f20: 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 ).... (loop2
4f30: 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 (db:get-test-inf
4f40: 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 o db run-id test
4f50: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
4f60: 0a 09 09 09 09 20 20 20 28 2b 20 63 74 20 31 29 ..... (+ ct 1)
4f70: 29 29 0a 09 09 09 20 20 28 69 66 20 74 73 0a 09 )).... (if ts..
4f80: 09 09 20 20 20 20 20 20 28 73 65 74 21 20 74 65 .. (set! te
4f90: 73 74 64 61 74 20 74 73 29 0a 09 09 09 20 20 20 stdat ts)....
4fa0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 (begin.....(d
4fb0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
4fc0: 52 4e 49 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 RNING: Couldn't
4fd0: 72 65 67 69 73 74 65 72 20 74 65 73 74 20 22 20 register test "
4fe0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 test-name " with
4ff0: 20 69 74 65 6d 20 70 61 74 68 20 22 20 69 74 65 item path " ite
5000: 6d 2d 70 61 74 68 20 22 2c 20 73 6b 69 70 70 69 m-path ", skippi
5010: 6e 67 22 29 0a 09 09 09 09 28 69 66 20 28 6e 6f ng").....(if (no
5020: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 t (null? tal))..
5030: 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 ... (loop (ca
5040: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 r tal)(cdr tal))
5050: 29 29 29 29 29 0a 09 09 20 20 20 20 28 63 68 61 )))))... (cha
5060: 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 nge-directory te
5070: 73 74 2d 70 61 74 68 29 0a 09 09 20 20 20 20 3b st-path)... ;
5080: 3b 20 74 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 ; this block is
5090: 68 65 72 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 here only to inf
50a0: 6f 72 6d 20 74 68 65 20 75 73 65 72 20 65 61 72 orm the user ear
50b0: 6c 79 20 6f 6e 0a 09 09 20 20 20 20 28 69 66 20 ly on... (if
50c0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 (file-exists? ru
50d0: 6e 63 6f 6e 66 69 67 66 29 0a 09 09 09 28 73 65 nconfigf)....(se
50e0: 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 tup-env-defaults
50f0: 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 db runconfigf r
5100: 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 un-id *already-s
5110: 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e een-runconfig-in
5120: 66 6f 2a 29 0a 09 09 09 28 64 65 62 75 67 3a 70 fo*)....(debug:p
5130: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
5140: 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 You do not have
5150: 20 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 a run config fi
5160: 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 le: " runconfigf
5170: 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a ))... (debug:
5180: 70 72 69 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a print 4 "run-id:
5190: 20 22 20 72 75 6e 2d 69 64 20 22 20 74 65 73 74 " run-id " test
51a0: 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 -name: " test-na
51b0: 6d 65 20 22 20 69 74 65 6d 2d 70 61 74 68 3a 20 me " item-path:
51c0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 74 65 " item-path " te
51d0: 73 74 64 61 74 3a 20 22 20 28 74 65 73 74 3a 67 stdat: " (test:g
51e0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
51f0: 74 29 20 22 20 74 65 73 74 2d 73 74 61 74 65 3a t) " test-state:
5200: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
5210: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 te testdat))...
5220: 20 20 20 28 63 61 73 65 20 28 69 66 20 28 61 72 (case (if (ar
5230: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 gs:get-arg "-for
5240: 63 65 22 29 0a 09 09 09 20 20 20 20 20 20 27 4e ce").... 'N
5250: 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 09 20 20 OT_STARTED....
5260: 20 20 20 20 28 69 66 20 74 65 73 74 64 61 74 0a (if testdat.
5270: 09 09 09 09 20 20 28 73 74 72 69 6e 67 2d 3e 73 .... (string->s
5280: 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d ymbol (test:get-
5290: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a state testdat)).
52a0: 09 09 09 09 20 20 27 66 61 69 6c 65 64 2d 74 6f .... 'failed-to
52b0: 2d 69 6e 73 65 72 74 29 29 0a 09 09 20 20 20 20 -insert))...
52c0: 20 20 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e ((failed-to-in
52d0: 73 65 72 74 29 0a 09 09 20 20 20 20 20 20 20 28 sert)... (
52e0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
52f0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
5300: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 insert the recor
5310: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 d into the db"))
5320: 0a 09 09 20 20 20 20 20 20 28 28 4e 4f 54 5f 53 ... ((NOT_S
5330: 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 TARTED COMPLETED
5340: 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75 )... (debu
5350: 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 20 68 g:print 6 "Got h
5360: 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67 65 74 ere, " (test:get
5370: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 -state testdat))
5380: 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 ... (let (
5390: 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 (runflag #f))...
53a0: 09 20 28 63 6f 6e 64 0a 09 09 09 20 20 3b 3b 20 . (cond.... ;;
53b0: 69 2e 65 2e 20 74 68 69 73 20 69 73 20 74 68 65 i.e. this is the
53c0: 20 70 61 72 65 6e 74 20 74 65 73 74 20 74 6f 20 parent test to
53d0: 61 20 73 75 69 74 65 20 6f 66 20 69 74 65 6d 73 a suite of items
53e0: 2c 20 6e 65 76 65 72 20 22 72 75 6e 22 20 69 74 , never "run" it
53f0: 0a 09 09 09 20 20 28 70 61 72 65 6e 74 2d 74 65 .... (parent-te
5400: 73 74 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 st.... (set! r
5410: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 unflag #f))....
5420: 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 ;; -force, run
5430: 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 no matter what..
5440: 09 09 20 20 28 28 61 72 67 73 3a 67 65 74 2d 61 .. ((args:get-a
5450: 72 67 20 22 2d 66 6f 72 63 65 22 29 28 73 65 74 rg "-force")(set
5460: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
5470: 09 09 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 .. ;; NOT_START
5480: 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 ED, run no matte
5490: 72 20 77 68 61 74 0a 09 09 09 20 20 28 28 65 71 r what.... ((eq
54a0: 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 ual? (test:get-s
54b0: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 4e tate testdat) "N
54c0: 4f 54 5f 53 54 41 52 54 45 44 22 29 28 73 65 74 OT_STARTED")(set
54d0: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
54e0: 09 09 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 .. ;; not -reru
54f0: 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e n and PASS, WARN
5500: 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f or CHECK, do no
5510: 20 72 75 6e 0a 09 09 09 20 20 28 28 61 6e 64 20 run.... ((and
5520: 28 6f 72 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 (or (not (args:g
5530: 65 74 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 29 et-arg "-rerun")
5540: 29 0a 09 09 09 09 20 20 20 20 28 61 72 67 73 3a )..... (args:
5550: 67 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f get-arg "-keepgo
5560: 69 6e 67 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 ing")).....(memb
5570: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
5580: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 tus testdat) '("
5590: 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 PASS" "WARN" "CH
55a0: 45 43 4b 22 29 29 29 0a 09 09 09 20 20 20 28 73 ECK"))).... (s
55b0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 et! runflag #f))
55c0: 0a 09 09 09 20 20 3b 3b 20 2d 72 65 72 75 6e 20 .... ;; -rerun
55d0: 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e and status is on
55e0: 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 e of the specife
55f0: 64 2c 20 72 75 6e 20 69 74 0a 09 09 09 20 20 28 d, run it.... (
5600: 28 61 6e 64 20 28 61 72 67 73 3a 67 65 74 2d 61 (and (args:get-a
5610: 72 67 20 22 2d 72 65 72 75 6e 22 29 0a 09 09 09 rg "-rerun")....
5620: 09 28 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 74 .(let ((rerunlst
5630: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 (string-split (
5640: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 args:get-arg "-r
5650: 65 72 75 6e 22 29 20 22 2c 22 29 29 29 20 3b 3b erun") ","))) ;;
5660: 20 46 41 49 4c 2c 0a 09 09 09 09 20 20 28 6d 65 FAIL,..... (me
5670: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 mber (test:get-s
5680: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 tatus testdat) r
5690: 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 09 20 20 erunlst)))....
56a0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
56b0: 74 29 29 0a 09 09 09 20 20 3b 3b 20 2d 6b 65 65 t)).... ;; -kee
56c0: 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 pgoing, do not r
56d0: 65 72 75 6e 20 46 41 49 4c 0a 09 09 09 20 20 28 erun FAIL.... (
56e0: 28 61 6e 64 20 28 61 72 67 73 3a 67 65 74 2d 61 (and (args:get-a
56f0: 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 rg "-keepgoing")
5700: 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 28 74 65 .....(member (te
5710: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
5720: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 stdat) '("FAIL")
5730: 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 )).... (set! r
5740: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 unflag #f))....
5750: 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 61 72 67 ((and (not (arg
5760: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 s:get-arg "-reru
5770: 6e 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 n")).....(member
5780: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
5790: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 s testdat) '("FA
57a0: 49 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 09 09 IL" "n/a")))....
57b0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
57c0: 20 23 74 29 29 0a 09 09 09 20 20 28 65 6c 73 65 #t)).... (else
57d0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
57e0: 66 29 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a f))).... (debug:
57f0: 70 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 print 6 "RUNNING
5800: 20 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 => runflag: " r
5810: 75 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 unflag " STATE:
5820: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
5830: 65 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 e testdat) " STA
5840: 54 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 TUS: " (test:get
5850: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
5860: 29 0a 09 09 09 20 28 69 66 20 28 6e 6f 74 20 72 ).... (if (not r
5870: 75 6e 66 6c 61 67 29 0a 09 09 09 20 20 20 20 20 unflag)....
5880: 28 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d (if (not parent-
5890: 74 65 73 74 29 0a 09 09 09 09 20 28 64 65 62 75 test)..... (debu
58a0: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a g:print 1 "NOTE:
58b0: 20 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 Not starting te
58c0: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 st " new-test-na
58d0: 6d 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 me " as it is st
58e0: 61 74 65 20 5c 22 43 4f 4d 50 4c 45 54 45 44 5c ate \"COMPLETED\
58f0: 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 " and status \""
5900: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
5910: 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 s testdat) "\",
5920: 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 use -force to ov
5930: 65 72 72 69 64 65 22 29 29 0a 09 09 09 20 20 20 erride"))....
5940: 20 20 28 6c 65 74 2a 20 28 28 67 65 74 2d 70 72 (let* ((get-pr
5950: 65 72 65 71 73 2d 63 6d 64 20 28 6c 61 6d 62 64 ereqs-cmd (lambd
5960: 61 20 28 29 0a 09 09 09 09 09 09 20 20 20 20 20 a ().......
5970: 20 20 28 64 62 2d 67 65 74 2d 70 72 65 72 65 71 (db-get-prereq
5980: 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e s-not-met db run
5990: 2d 69 64 20 77 61 69 74 6f 6e 29 29 29 20 3b 3b -id waiton))) ;;
59a0: 20 63 68 65 63 6b 20 62 65 66 6f 72 65 20 72 75 check before ru
59b0: 6e 6e 69 6e 67 20 2e 2e 2e 2e 0a 09 09 09 09 20 nning .........
59c0: 20 20 20 28 6c 61 75 6e 63 68 2d 63 6d 64 20 20 (launch-cmd
59d0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 (lambda ()..
59e0: 09 09 09 09 09 20 20 20 20 20 20 20 28 6c 61 75 ..... (lau
59f0: 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d nch-test db run-
5a00: 69 64 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 id test-conf key
5a10: 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 vallst test-name
5a20: 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 test-path itemd
5a30: 61 74 29 29 29 0a 09 09 09 09 20 20 20 20 28 74 at)))..... (t
5a40: 65 73 74 72 75 6e 64 61 74 20 20 20 20 20 20 28 estrundat (
5a50: 6c 69 73 74 20 67 65 74 2d 70 72 65 72 65 71 73 list get-prereqs
5a60: 2d 63 6d 64 20 6c 61 75 6e 63 68 2d 63 6d 64 29 -cmd launch-cmd)
5a70: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 )).... (if
5a80: 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 (or (args:get-a
5a90: 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 rg "-force")....
5aa0: 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 . (let ((p
5ab0: 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 reqs-not-yet-met
5ac0: 20 28 28 63 61 72 20 74 65 73 74 72 75 6e 64 61 ((car testrunda
5ad0: 74 29 29 29 29 0a 09 09 09 09 09 20 28 64 65 62 t))))...... (deb
5ae0: 75 67 3a 70 72 69 6e 74 20 32 20 22 50 72 65 71 ug:print 2 "Preq
5af0: 72 65 71 75 65 73 69 74 65 73 20 66 6f 72 20 22 requesites for "
5b00: 20 74 65 73 74 2d 6e 61 6d 65 20 22 3a 20 22 20 test-name ": "
5b10: 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 preqs-not-yet-me
5b20: 74 29 0a 09 09 09 09 09 20 28 6e 75 6c 6c 3f 20 t)...... (null?
5b30: 70 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 preqs-not-yet-me
5b40: 74 29 29 29 20 3b 3b 20 61 72 65 20 74 68 65 72 t))) ;; are ther
5b50: 65 20 61 6e 79 20 74 65 73 74 73 20 74 68 61 74 e any tests that
5b60: 20 6d 75 73 74 20 62 65 20 72 75 6e 20 62 65 66 must be run bef
5b70: 6f 72 65 20 74 68 69 73 20 6f 6e 65 2e 2e 2e 0a ore this one....
5b80: 09 09 09 09 20 20 20 28 69 66 20 28 6e 6f 74 20 .... (if (not
5b90: 28 28 63 61 64 72 20 74 65 73 74 72 75 6e 64 61 ((cadr testrunda
5ba0: 74 29 29 29 20 3b 3b 20 74 68 69 73 20 69 73 20 t))) ;; this is
5bb0: 74 68 65 20 6c 69 6e 65 20 74 68 61 74 20 6c 61 the line that la
5bc0: 75 6e 63 68 65 73 20 74 68 65 20 74 65 73 74 20 unches the test
5bd0: 74 6f 20 74 68 65 20 72 65 6d 6f 74 65 20 68 6f to the remote ho
5be0: 73 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 62 st..... (b
5bf0: 65 67 69 6e 0a 09 09 09 09 09 20 28 70 72 69 6e egin...... (prin
5c00: 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 t "ERROR: Failed
5c10: 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 to launch the t
5c20: 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 est. Exiting as
5c30: 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 soon as possible
5c40: 22 29 0a 09 09 09 09 09 20 28 73 65 74 21 20 2a ")...... (set! *
5c50: 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 globalexitstatus
5c60: 2a 20 31 29 20 3b 3b 20 0a 09 09 09 09 09 20 28 * 1) ;; ...... (
5c70: 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 process-signal (
5c80: 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d current-process-
5c90: 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 id) signal/kill)
5ca0: 0a 09 09 09 09 09 20 3b 28 65 78 69 74 20 31 29 ...... ;(exit 1)
5cb0: 0a 09 09 09 09 09 20 29 29 0a 09 09 09 09 20 20 ...... )).....
5cc0: 20 28 69 66 20 28 6e 6f 74 20 28 61 72 67 73 3a (if (not (args:
5cd0: 67 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f get-arg "-keepgo
5ce0: 69 6e 67 22 29 29 0a 09 09 09 09 20 20 20 20 20 ing")).....
5cf0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 (hash-table-se
5d00: 74 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 t! *waiting-queu
5d10: 65 2a 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 e* new-test-name
5d20: 20 74 65 73 74 72 75 6e 64 61 74 29 29 29 29 29 testrundat)))))
5d30: 29 29 0a 09 09 20 20 20 20 20 20 28 28 4b 49 4c ))... ((KIL
5d40: 4c 45 44 29 20 0a 09 09 20 20 20 20 20 20 20 28 LED) ... (
5d50: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e debug:print 1 "N
5d60: 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d OTE: " new-test-
5d70: 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 name " is alread
5d80: 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 y running or was
5d90: 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 explictly kille
5da0: 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f d, use -force to
5db0: 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 launch it."))..
5dc0: 09 20 20 20 20 20 20 28 28 4c 41 55 4e 43 48 45 . ((LAUNCHE
5dd0: 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 D REMOTEHOSTSTAR
5de0: 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 09 20 T RUNNING) ...
5df0: 20 20 20 20 20 20 28 69 66 20 28 3e 20 28 2d 20 (if (> (-
5e00: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 (current-seconds
5e10: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 )(+ (db:test-get
5e20: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 -event_time test
5e30: 64 61 74 29 0a 09 09 09 09 09 09 20 20 20 20 20 dat).......
5e40: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
5e50: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 _duration testda
5e60: 74 29 29 29 0a 09 09 09 20 20 20 20 20 20 31 30 t))).... 10
5e70: 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 0) ;; i.e. no up
5e80: 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 date for more th
5e90: 61 6e 20 31 30 30 20 73 65 63 6f 6e 64 73 0a 09 an 100 seconds..
5ea0: 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 .. (begin....
5eb0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5ec0: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 0 "WARNING: Tes
5ed0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 t " test-name "
5ee0: 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 appears to be de
5ef0: 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 ad. Forcing it t
5f00: 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 o state INCOMPLE
5f10: 54 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 TE and status ST
5f20: 55 43 4b 2f 44 45 41 44 22 29 0a 09 09 09 20 20 UCK/DEAD")....
5f30: 20 20 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61 (test-set-sta
5f40: 74 75 73 21 20 64 62 20 72 75 6e 2d 69 64 20 74 tus! db run-id t
5f50: 65 73 74 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 est-name "INCOMP
5f60: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 LETE" "STUCK/DEA
5f70: 44 22 20 69 74 65 6d 64 61 74 20 22 54 65 73 74 D" itemdat "Test
5f80: 20 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 is stuck or dea
5f90: 64 22 29 29 0a 09 09 09 20 20 20 28 64 65 62 75 d")).... (debu
5fa0: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a g:print 2 "NOTE:
5fb0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 " test-name " i
5fc0: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e s already runnin
5fd0: 67 22 29 29 29 0a 09 09 20 20 20 20 20 20 28 65 g")))... (e
5fe0: 6c 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67 lse (debug
5ff0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
6000: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 Failed to launc
6010: 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 h test " new-tes
6020: 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f t-name ". Unreco
6030: 67 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28 gnised state " (
6040: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
6050: 65 73 74 64 61 74 29 29 29 29 29 29 0a 09 20 20 estdat))))))..
6060: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
6070: 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 28 6c ll? tal))... (l
6080: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 oop (car tal)(cd
6090: 72 20 74 61 6c 29 29 29 29 29 29 29 29 29 0a 0a r tal)))))))))..
60a0: 28 64 65 66 69 6e 65 20 28 72 75 6e 2d 77 61 69 (define (run-wai
60b0: 74 69 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 20 ting-tests db).
60c0: 20 28 6c 65 74 20 28 28 6e 75 6d 74 72 69 65 73 (let ((numtries
60d0: 20 20 20 20 20 20 20 20 20 20 20 30 29 0a 09 28 0)..(
60e0: 6c 61 73 74 2d 74 72 79 2d 74 69 6d 65 20 20 20 last-try-time
60f0: 20 20 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f (current-seco
6100: 6e 64 73 29 29 0a 09 28 74 69 6d 65 73 20 20 20 nds))..(times
6110: 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 (list
6120: 20 31 29 29 29 20 3b 3b 20 6d 69 6e 75 74 65 73 1))) ;; minutes
6130: 20 74 6f 20 77 61 69 74 20 62 65 66 6f 72 65 20 to wait before
6140: 74 72 79 69 6e 67 20 61 67 61 69 6e 20 74 6f 20 trying again to
6150: 6b 69 63 6b 20 6f 66 66 20 72 75 6e 73 0a 20 20 kick off runs.
6160: 20 20 3b 3b 20 42 55 47 20 74 68 69 73 20 68 61 ;; BUG this ha
6170: 63 6b 20 6f 66 20 62 72 75 74 65 20 66 6f 72 63 ck of brute forc
6180: 65 20 72 65 74 72 79 69 6e 67 20 77 6f 72 6b 73 e retrying works
6190: 20 71 75 69 74 65 20 77 65 6c 6c 20 66 6f 72 20 quite well for
61a0: 6d 61 6e 79 20 63 61 73 65 73 20 62 75 74 20 0a many cases but .
61b0: 20 20 20 20 3b 3b 20 20 20 20 20 77 68 61 74 20 ;; what
61c0: 69 73 20 6e 65 65 64 65 64 20 69 73 20 74 6f 20 is needed is to
61d0: 63 68 65 63 6b 20 74 68 65 20 64 62 20 66 6f 72 check the db for
61e0: 20 74 65 73 74 73 20 74 68 61 74 20 68 61 76 65 tests that have
61f0: 20 66 61 69 6c 65 64 20 6c 65 73 73 20 74 68 61 failed less tha
6200: 6e 0a 20 20 20 20 3b 3b 20 20 20 20 20 4e 20 74 n. ;; N t
6210: 69 6d 65 73 20 6f 72 20 6e 65 76 65 72 20 62 65 imes or never be
6220: 65 6e 20 73 74 61 72 74 65 64 20 61 6e 64 20 6b en started and k
6230: 69 63 6b 20 74 68 65 6d 20 6f 66 66 20 61 67 61 ick them off aga
6240: 69 6e 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 in. (let loop
6250: 20 28 28 77 61 69 74 69 6e 67 2d 74 65 73 74 2d ((waiting-test-
6260: 6e 61 6d 65 73 20 28 68 61 73 68 2d 74 61 62 6c names (hash-tabl
6270: 65 2d 6b 65 79 73 20 2a 77 61 69 74 69 6e 67 2d e-keys *waiting-
6280: 71 75 65 75 65 2a 29 29 29 0a 20 20 20 20 20 20 queue*))).
6290: 28 63 6f 6e 64 0a 20 20 20 20 20 20 20 28 28 6e (cond. ((n
62a0: 6f 74 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e ot (runs:can-run
62b0: 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 29 -more-tests db))
62c0: 0a 09 28 73 6c 65 65 70 20 32 29 0a 09 28 6c 6f ..(sleep 2)..(lo
62d0: 6f 70 20 77 61 69 74 69 6e 67 2d 74 65 73 74 2d op waiting-test-
62e0: 6e 61 6d 65 73 29 29 0a 20 20 20 20 20 20 20 28 names)). (
62f0: 28 6e 75 6c 6c 3f 20 77 61 69 74 69 6e 67 2d 74 (null? waiting-t
6300: 65 73 74 2d 6e 61 6d 65 73 29 0a 09 28 64 65 62 est-names)..(deb
6310: 75 67 3a 70 72 69 6e 74 20 31 20 22 41 6c 6c 20 ug:print 1 "All
6320: 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29 tests launched")
6330: 29 0a 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 ). (else..
6340: 28 73 65 74 21 20 6e 75 6d 74 72 69 65 73 20 28 (set! numtries (
6350: 2b 20 6e 75 6d 74 72 69 65 73 20 31 29 29 0a 09 + numtries 1))..
6360: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
6370: 61 20 28 74 65 73 74 6e 61 6d 65 29 0a 09 09 20 a (testname)...
6380: 20 20 20 28 69 66 20 28 72 75 6e 73 3a 63 61 6e (if (runs:can
6390: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 -run-more-tests
63a0: 64 62 29 0a 09 09 09 28 6c 65 74 2a 20 28 28 74 db)....(let* ((t
63b0: 65 73 74 64 61 74 20 28 68 61 73 68 2d 74 61 62 estdat (hash-tab
63c0: 6c 65 2d 72 65 66 20 2a 77 61 69 74 69 6e 67 2d le-ref *waiting-
63d0: 71 75 65 75 65 2a 20 74 65 73 74 6e 61 6d 65 29 queue* testname)
63e0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 70 72 65 ).... (pre
63f0: 72 65 71 73 20 28 28 63 61 72 20 74 65 73 74 64 reqs ((car testd
6400: 61 74 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 at)))....
6410: 28 6c 64 62 20 20 20 20 20 28 69 66 20 64 62 20 (ldb (if db
6420: 64 62 20 28 6f 70 65 6e 2d 64 62 29 29 29 29 0a db (open-db)))).
6430: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ... (debug:prin
6440: 74 20 32 20 22 70 72 65 72 65 71 73 20 72 65 6d t 2 "prereqs rem
6450: 61 69 6e 69 6e 67 3a 20 22 20 70 72 65 72 65 71 aining: " prereq
6460: 73 29 0a 09 09 09 20 20 28 69 66 20 28 6e 75 6c s).... (if (nul
6470: 6c 3f 20 70 72 65 72 65 71 73 29 0a 09 09 09 20 l? prereqs)....
6480: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 (begin.....
6490: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
64a0: 50 72 65 72 65 71 75 69 73 69 74 65 73 20 6d 65 Prerequisites me
64b0: 74 2c 20 6c 61 75 6e 63 68 69 6e 67 20 22 20 74 t, launching " t
64c0: 65 73 74 6e 61 6d 65 29 0a 09 09 09 09 28 28 63 estname).....((c
64d0: 61 64 72 20 74 65 73 74 64 61 74 29 29 0a 09 09 adr testdat))...
64e0: 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 ..(hash-table-de
64f0: 6c 65 74 65 21 20 2a 77 61 69 74 69 6e 67 2d 71 lete! *waiting-q
6500: 75 65 75 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 ueue* testname))
6510: 29 0a 09 09 09 20 20 28 69 66 20 28 6e 6f 74 20 ).... (if (not
6520: 64 62 29 0a 09 09 09 20 20 20 20 20 20 28 73 71 db).... (sq
6530: 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 lite3:finalize!
6540: 6c 64 62 29 29 29 29 29 0a 09 09 20 20 77 61 69 ldb)))))... wai
6550: 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 73 29 ting-test-names)
6560: 0a 09 3b 3b 20 28 73 6c 65 65 70 20 31 30 29 20 ..;; (sleep 10)
6570: 3b 3b 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 72 ;; no point in r
6580: 75 73 68 69 6e 67 20 74 68 69 6e 67 73 20 61 74 ushing things at
6590: 20 74 68 69 73 20 73 74 61 67 65 3f 0a 09 28 6c this stage?..(l
65a0: 6f 6f 70 20 28 68 61 73 68 2d 74 61 62 6c 65 2d oop (hash-table-
65b0: 6b 65 79 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 keys *waiting-qu
65c0: 65 75 65 2a 29 29 29 29 29 29 29 0a 0a 28 64 65 eue*)))))))..(de
65d0: 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 fine (get-dir-up
65e0: 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 -n dir . params)
65f0: 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 . (let ((dpart
6600: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 s (string-split
6610: 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 dir "/"))..(cou
6620: 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 nt (if (null?
6630: 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 params) 1 (car p
6640: 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 arams)))). (c
6650: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d onc "/" (string-
6660: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 intersperse ..
6670: 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 (take dpart
6680: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 s (- (length dpa
6690: 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 rts) count))..
66a0: 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 "/")))).;;
66b0: 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 Remove runs.;; f
66c0: 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e ields are passin
66d0: 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 g in through .(d
66e0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f efine (runs:remo
66f0: 76 65 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 ve-runs db runna
6700: 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74 20 mepatt testpatt
6710: 69 74 65 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 itempatt). (let
6720: 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 * ((keys
6730: 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 (db-get-keys db)
6740: 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 ).. (rundat
6750: 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d (runs:get-runs-
6760: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 by-patt db keys
6770: 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 runnamepatt))..
6780: 28 68 65 61 64 65 72 20 20 20 20 20 20 28 76 65 (header (ve
6790: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 ctor-ref rundat
67a0: 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 0)).. (runs
67b0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 (vector-ref r
67c0: 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 undat 1))). (
67d0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 48 debug:print 1 "H
67e0: 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 29 eader: " header)
67f0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 . (for-each.
6800: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e (lambda (run
6810: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 ). (let ((
6820: 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 runkey (string-i
6830: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 ntersperse (map
6840: 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 (lambda (k).....
6850: 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d ..(db:get-value-
6860: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
6870: 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 ader (vector-ref
6880: 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f k 0))) keys) "/
6890: 22 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 "))).. (let* ((r
68a0: 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 61 un-id (db:get-va
68b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
68c0: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20 29 n header "id") )
68d0: 0a 09 09 28 74 65 73 74 73 20 20 28 64 62 2d 67 ...(tests (db-g
68e0: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e et-tests-for-run
68f0: 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 db (db:get-valu
6900: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
6910: 68 65 61 64 65 72 20 22 69 64 22 29 20 74 65 73 header "id") tes
6920: 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 29 29 tpatt itempatt))
6930: 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f ...(lasttpath "/
6940: 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 does/not/exist/I
6950: 2f 68 6f 70 65 22 29 29 0a 09 20 20 20 28 69 66 /hope")).. (if
6960: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 (not (null? tes
6970: 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 ts)).. (be
6980: 67 69 6e 0a 09 09 20 28 64 65 62 75 67 3a 70 72 gin... (debug:pr
6990: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
69a0: 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 tests for run: "
69b0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a runkey " " (db:
69c0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
69d0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
69e0: 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 28 66 runname"))... (f
69f0: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d or-each... (lam
6a00: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 bda (test)...
6a10: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 (let* ((item-pa
6a20: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
6a30: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
6a40: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d .... (test-nam
6a50: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 e (db:test-get-t
6a60: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 estname test))..
6a70: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 .. (run-dir
6a80: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
6a90: 64 69 72 20 74 65 73 74 29 29 29 0a 09 09 20 20 dir test)))...
6aa0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
6ab0: 20 31 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 1 " " (db:test
6ac0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
6ad0: 73 74 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a st) " id: " (db:
6ae0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
6af0: 29 20 22 20 22 20 69 74 65 6d 2d 70 61 74 68 29 ) " " item-path)
6b00: 0a 09 09 20 20 20 20 20 20 28 64 62 3a 64 65 6c ... (db:del
6b10: 65 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 ete-test-records
6b20: 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 db (db:test-get
6b30: 2d 69 64 20 74 65 73 74 29 29 0a 09 09 20 20 20 -id test))...
6b40: 20 20 20 28 69 66 20 28 3e 20 28 73 74 72 69 6e (if (> (strin
6b50: 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 g-length run-dir
6b60: 29 20 35 29 20 3b 3b 20 62 61 64 20 68 65 75 72 ) 5) ;; bad heur
6b70: 69 73 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 istic but should
6b80: 20 70 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 prevent /tmp /h
6b90: 6f 6d 65 20 65 74 63 2e 0a 09 09 09 20 20 28 6c ome etc..... (l
6ba0: 65 74 20 28 28 66 75 6c 6c 70 61 74 68 20 72 75 et ((fullpath ru
6bb0: 6e 2d 64 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 n-dir)) ;; "/" (
6bc0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
6bd0: 2d 70 61 74 68 20 74 65 73 74 29 29 29 29 0a 09 -path test))))..
6be0: 09 09 20 20 20 20 28 73 65 74 21 20 6c 61 73 74 .. (set! last
6bf0: 74 70 61 74 68 20 66 75 6c 6c 70 61 74 68 29 0a tpath fullpath).
6c00: 09 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
6c10: 69 6e 74 20 31 20 22 72 6d 20 2d 72 66 20 22 20 int 1 "rm -rf "
6c20: 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 fullpath)....
6c30: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 (system (conc "
6c40: 72 6d 20 2d 72 66 20 22 20 66 75 6c 6c 70 61 74 rm -rf " fullpat
6c50: 68 29 29 0a 09 09 09 20 20 20 20 28 6c 65 74 2a h)).... (let*
6c60: 20 28 28 64 69 72 73 2d 63 6f 75 6e 74 20 28 2b ((dirs-count (+
6c70: 20 31 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 1 (length keys)
6c80: 28 6c 65 6e 67 74 68 20 28 73 74 72 69 6e 67 2d (length (string-
6c90: 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 68 20 split item-path
6ca0: 22 2f 22 29 29 29 29 0a 09 09 09 09 20 20 20 28 "/"))))..... (
6cb0: 64 69 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74 2d dir-to-rem (get-
6cc0: 64 69 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 74 dir-up-n fullpat
6cd0: 68 20 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a 09 h dirs-count))..
6ce0: 09 09 09 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 ... (remaining
6cf0: 64 20 28 73 74 72 69 6e 67 2d 73 75 62 73 74 69 d (string-substi
6d00: 74 75 74 65 20 28 72 65 67 65 78 70 20 28 63 6f tute (regexp (co
6d10: 6e 63 20 22 5e 22 20 64 69 72 2d 74 6f 2d 72 65 nc "^" dir-to-re
6d20: 6d 20 22 2f 22 29 29 20 22 22 20 66 75 6c 6c 70 m "/")) "" fullp
6d30: 61 74 68 29 29 0a 09 09 09 09 20 20 20 28 63 6d ath))..... (cm
6d40: 64 20 28 63 6f 6e 63 20 22 63 64 20 22 20 64 69 d (conc "cd " di
6d50: 72 2d 74 6f 2d 72 65 6d 20 22 3b 20 72 6d 64 69 r-to-rem "; rmdi
6d60: 72 20 2d 70 20 22 20 72 65 6d 61 69 6e 69 6e 67 r -p " remaining
6d70: 64 20 29 29 29 0a 09 09 09 20 20 20 20 20 20 28 d ))).... (
6d80: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f if (file-exists?
6d90: 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 09 20 fullpath).....
6da0: 20 28 62 65 67 69 6e 0a 09 09 09 09 20 20 20 20 (begin.....
6db0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 63 (debug:print 1 c
6dc0: 6d 64 29 0a 09 09 09 09 20 20 20 20 28 73 79 73 md)..... (sys
6dd0: 74 65 6d 20 63 6d 64 29 29 29 0a 09 09 09 20 20 tem cmd)))....
6de0: 20 20 20 20 29 29 0a 09 09 09 20 20 20 20 29 29 )).... ))
6df0: 29 0a 09 09 20 20 20 20 74 65 73 74 73 29 29 29 )... tests)))
6e00: 0a 09 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 .. (let ((remt
6e10: 65 73 74 73 20 28 64 62 2d 67 65 74 2d 74 65 73 ests (db-get-tes
6e20: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 ts-for-run db (d
6e30: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
6e40: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
6e50: 20 22 69 64 22 29 29 29 29 0a 09 20 20 20 20 20 "id"))))..
6e60: 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 (if (null? remte
6e70: 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 sts) ;; no more
6e80: 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a tests remaining.
6e90: 09 09 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 .. (let* ((dpart
6ea0: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 s (string-split
6eb0: 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 lasttpath "/"))
6ec0: 0a 09 09 09 28 72 75 6e 70 61 74 68 20 28 63 6f ....(runpath (co
6ed0: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 nc "/" (string-i
6ee0: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 ntersperse .....
6ef0: 09 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 . (take dpart
6f00: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 s (- (length dpa
6f10: 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 20 20 rts) 1))......
6f20: 20 20 22 2f 22 29 29 29 29 0a 09 09 20 20 20 28 "/"))))... (
6f30: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 debug:print 1 "R
6f40: 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 emoving run: " r
6f50: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 unkey " " (db:ge
6f60: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
6f70: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 r run header "ru
6f80: 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 20 28 64 nname"))... (d
6f90: 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 b:delete-run db
6fa0: 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 run-id)... ;;
6fb0: 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f need to figure o
6fc0: 75 74 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 ut the path to t
6fd0: 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 he run dir and r
6fe0: 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 emove it if empt
6ff0: 79 0a 09 09 20 20 20 3b 3b 20 20 20 20 28 69 66 y... ;; (if
7000: 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 (null? (glob (c
7010: 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 onc runpath "/*"
7020: 29 29 29 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 )))... ;;
7030: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 3b (begin... ;
7040: 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ; . (debug:print
7050: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 1 "Removing run
7060: 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a dir " runpath).
7070: 09 09 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 .. ;; . (syste
7080: 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d m (conc "rmdir -
7090: 70 20 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a p " runpath)))).
70a0: 09 09 20 20 20 29 29 29 29 0a 09 20 29 29 0a 20 .. )))).. )).
70b0: 20 20 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d runs)))..;;=
70c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
70d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
70e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
70f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7100: 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 =====.;; Routine
7110: 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 s for manipulati
7120: 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d ng runs.;;======
7130: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7140: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7150: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7160: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7170: 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 ..;; Since many
7180: 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 calls to a run r
7190: 65 71 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 equire pretty mu
71a0: 63 68 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 ch the same setu
71b0: 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 p .;; this wrapp
71c0: 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 er is used to re
71d0: 64 75 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 duce the replica
71e0: 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 tion of code.(de
71f0: 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 fine (general-ru
7200: 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d n-call switchnam
7210: 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 e action-desc pr
7220: 6f 63 29 0a 20 20 28 69 66 20 28 6e 6f 74 20 28 oc). (if (not (
7230: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 args:get-arg ":r
7240: 75 6e 6e 61 6d 65 22 29 29 0a 20 20 20 20 20 20 unname")).
7250: 28 62 65 67 69 6e 0a 09 28 64 65 62 75 67 3a 70 (begin..(debug:p
7260: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d rint 0 "ERROR: M
7270: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 issing required
7280: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 parameter for "
7290: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f switchname ", yo
72a0: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 u must specify t
72b0: 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 he run name with
72c0: 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d :runname runnam
72d0: 65 22 29 0a 09 28 65 78 69 74 20 32 29 29 0a 20 e")..(exit 2)).
72e0: 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 23 (let ((db #
72f0: 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 f))..(if (not (s
7300: 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 etup-for-run))..
7310: 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 (begin ..
7320: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
7330: 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 0 "Failed to set
7340: 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 up, exiting")..
7350: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a (exit 1))).
7360: 09 28 73 65 74 21 20 64 62 20 28 6f 70 65 6e 2d .(set! db (open-
7370: 64 62 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 db))..(if (not (
7380: 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a car *configinfo*
7390: 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 )).. (begin..
73a0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
73b0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 nt 0 "ERROR: Att
73c0: 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 empted to " acti
73d0: 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 on-desc " but ru
73e0: 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 n area config fi
73f0: 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 le not found")..
7400: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 0a (exit 1)).
7410: 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 . ;; Extract
7420: 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 out stuff needed
7430: 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 in most or many
7440: 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 calls.. ;; h
7450: 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 ere then call pr
7460: 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 oc.. (let* ((
7470: 6b 65 79 73 20 20 20 20 20 20 20 28 64 62 2d 67 keys (db-g
7480: 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 09 20 et-keys db))...
7490: 20 20 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d (keynames (m
74a0: 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 ap key:get-field
74b0: 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 name keys))...
74c0: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 (keyvallst (ke
74d0: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 ys->vallist keys
74e0: 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 #t))).. (p
74f0: 72 6f 63 20 64 62 20 6b 65 79 73 20 6b 65 79 6e roc db keys keyn
7500: 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 ames keyvallst))
7510: 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 )..(sqlite3:fina
7520: 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 65 74 21 lize! db)..(set!
7530: 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 *didsomething*
7540: 23 74 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d #t))))..;;======
7550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7590: 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a .;; Rollup runs.
75a0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
75b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
75c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
75d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
75e0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 ========..;; Upd
75f0: 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 ate the test_met
7600: 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 a table for this
7610: 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 test.(define (r
7620: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f uns:update-test_
7630: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d meta db test-nam
7640: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 e test-conf). (
7650: 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 let ((currrecord
7660: 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 (db:testmeta-ge
7670: 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 t-record db test
7680: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 -name))). (if
7690: 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 (not currrecord
76a0: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 )..(begin.. (se
76b0: 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d t! currrecord (m
76c0: 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 ake-vector 10 #f
76d0: 29 29 0a 09 20 20 28 64 62 3a 74 65 73 74 6d 65 )).. (db:testme
76e0: 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 ta-add-record db
76f0: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 test-name))).
7700: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
7710: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a (lambda (key).
7720: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 (let* ((i
7730: 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 dx (cadr key))..
7740: 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 (fld (car
7750: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 key)).. (v
7760: 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 al (config-looku
7770: 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 p test-conf "tes
7780: 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 t_meta" fld)))..
7790: 20 28 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e (if (and val (n
77a0: 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 ot (equal? (vect
77b0: 6f 72 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 or-ref currrecor
77c0: 64 20 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 d idx) val)))..
77d0: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 (begin..
77e0: 20 20 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 (print "Updat
77f0: 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 ing " test-name
7800: 22 20 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 " " fld " to " v
7810: 61 6c 29 0a 09 20 20 20 20 20 20 20 28 64 62 3a al).. (db:
7820: 74 65 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d testmeta-update-
7830: 66 69 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 field db test-na
7840: 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a me fld val))))).
7850: 20 20 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 '(("author"
7860: 20 32 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 2)("owner" 3)("
7870: 64 65 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 description" 4)(
7880: 22 72 65 76 69 65 77 65 64 22 20 35 29 28 22 74 "reviewed" 5)("t
7890: 61 67 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 ags" 9)))))..;;
78a0: 55 70 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 Update test_meta
78b0: 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 for all tests.(
78c0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 define (runs:upd
78d0: 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 ate-all-test_met
78e0: 61 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 a db). (let ((t
78f0: 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 est-names (get-a
7900: 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 ll-legal-tests))
7910: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 ). (for-each
7920: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 . (lambda (t
7930: 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 est-name).
7940: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 (let* ((test-pa
7950: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 th (conc *top
7960: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 path* "/tests/"
7970: 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 test-name))..
7980: 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 (test-configf
7990: 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 (conc test-path
79a0: 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 "/testconfig"))
79b0: 0a 09 20 20 20 20 20 20 28 74 65 73 74 65 78 69 .. (testexi
79c0: 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 sts (and (file
79d0: 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f -exists? test-co
79e0: 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 nfigf)(file-read
79f0: 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f -access? test-co
7a00: 6e 66 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 nfigf)))..
7a10: 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 ;; read configs
7a20: 77 69 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e with tricks turn
7a30: 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 ed off (i.e. no
7a40: 73 79 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 system).. (
7a50: 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 test-conf (if
7a60: 20 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 testexists (rea
7a70: 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f d-config test-co
7a80: 6e 66 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b nfigf #f #f)(mak
7a90: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 e-hash-table))))
7aa0: 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d .. (runs:update-
7ab0: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 test_meta db tes
7ac0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 t-name test-conf
7ad0: 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 ))). test-na
7ae0: 6d 65 73 29 29 29 0a 09 20 0a 28 64 65 66 69 6e mes))).. .(defin
7af0: 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 e (runs:rollup-r
7b00: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 6e 61 un db keys keyna
7b10: 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 20 6e 29 mes keyvallst n)
7b20: 0a 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 72 . (let* ((new-r
7b30: 75 6e 2d 69 64 20 20 20 28 72 65 67 69 73 74 65 un-id (registe
7b40: 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 29 29 0a r-run db keys)).
7b50: 09 20 28 73 69 6d 69 6c 61 72 2d 72 75 6e 73 20 . (similar-runs
7b60: 28 64 62 3a 67 65 74 2d 72 75 6e 73 20 64 62 20 (db:get-runs db
7b70: 6b 65 79 73 29 29 0a 09 20 28 74 65 73 74 73 2d keys)).. (tests-
7b80: 6e 2d 64 61 79 73 20 28 64 62 3a 67 65 74 2d 74 n-days (db:get-t
7b90: 65 73 74 73 2d 6e 2d 64 61 79 73 20 64 62 20 73 ests-n-days db s
7ba0: 69 6d 69 6c 61 72 2d 72 75 6e 73 29 29 29 0a 20 imilar-runs))).
7bb0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 (for-each .
7bc0: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 (lambda (test
7bd0: 2d 69 64 29 0a 20 20 20 20 20 20 20 28 64 62 3a -id). (db:
7be0: 72 6f 6c 6c 75 70 2d 74 65 73 74 20 64 62 20 72 rollup-test db r
7bf0: 75 6e 2d 69 64 20 74 65 73 74 2d 69 64 29 29 0a un-id test-id)).
7c00: 20 20 20 20 20 74 65 73 74 73 2d 6e 2d 64 61 79 tests-n-day
7c10: 73 29 29 29 0a s))).