0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30 .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77 06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53 r.;; greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72 .;; This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 RRANTY; without
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70 even the.;; imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 or FITNESS FOR
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20 A PARTICULAR.;;
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73 PURPOSE...;; s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25 trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77 Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a ','localtime')..
0180: 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 74 65 ;; register a te
0190: 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 65 20 st run with the
01a0: 64 62 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 db.(define (regi
01b0: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
01c0: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a ) ;; test-name).
01d0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 72 (let* ((keystr
01e0: 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74 (keys->keyst
01f0: 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d r keys)).. (comm
0200: 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 a (if (> (le
0210: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 2c ngth keys) 0) ",
0220: 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 72 " "")).. (andstr
0230: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 (if (> (leng
0240: 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 4e th keys) 0) " AN
0250: 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c 73 D " "")).. (vals
0260: 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c lots (keys->val
0270: 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b 20 slots keys)) ;;
0280: 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 ?,?,? ..... (key
0290: 76 61 6c 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 vallst (keys->va
02a0: 6c 6c 69 73 74 20 6b 65 79 73 29 29 20 3b 3b 20 llist keys)) ;;
02b0: 65 78 74 72 61 63 74 73 20 74 68 65 20 76 61 6c extracts the val
02c0: 75 65 73 20 66 72 6f 6d 20 72 65 6d 61 69 6e 64 ues from remaind
02d0: 65 72 20 6f 66 20 28 61 72 67 76 29 0a 09 20 28 er of (argv).. (
02e0: 72 75 6e 6e 61 6d 65 20 20 20 28 67 65 74 2d 77 runname (get-w
02f0: 69 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 72 75 ith-default ":ru
0300: 6e 6e 61 6d 65 22 20 23 66 29 29 0a 09 20 28 73 nname" #f)).. (s
0310: 74 61 74 65 20 20 20 20 20 28 67 65 74 2d 77 69 tate (get-wi
0320: 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 th-default ":sta
0330: 74 65 22 20 22 6e 6f 22 29 29 0a 09 20 28 73 74 te" "no")).. (st
0340: 61 74 75 73 20 20 20 20 28 67 65 74 2d 77 69 74 atus (get-wit
0350: 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 74 h-default ":stat
0360: 75 73 22 20 22 6e 2f 61 22 29 29 0a 09 20 28 61 us" "n/a")).. (a
0370: 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 llvals (append
0380: 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20 73 (list runname s
0390: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 tate status user
03a0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03b0: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 (qryvals (appe
03c0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
03d0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03e0: 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 (key=?str (stri
03f0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
0400: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 map (lambda (k)(
0410: 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 conc (key:get-fi
0420: 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 eldname k) "=?")
0430: 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 ) keys) " AND ")
0440: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
0450: 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b int 3 "keys: " k
0460: 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 eys " allvals: "
0470: 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 allvals " keyva
0480: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 llst: " keyvalls
0490: 74 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 t). (debug:pr
04a0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 int 2 "NOTE: usi
04b0: 6e 67 20 6b 65 79 20 22 20 28 73 74 72 69 6e 67 ng key " (string
04c0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 -intersperse key
04d0: 76 61 6c 6c 73 74 20 22 2f 22 29 20 22 20 66 6f vallst "/") " fo
04e0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 r this run").
04f0: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d (if (and runnam
0500: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 e (null? (filter
0510: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 (lambda (x)(not
0520: 20 78 29 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 x)) keyvallst))
0530: 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 ) ;; there must
0540: 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20 be a better way
0550: 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 to "apply and"..
0560: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a (let ((res #f)).
0570: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 . (apply sqlite
0580: 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 3:execute db (co
0590: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 nc "INSERT OR IG
05a0: 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 NORE INTO runs (
05b0: 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 runname,state,st
05c0: 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 atus,owner,event
05d0: 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 _time" comma key
05e0: 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f str ") VALUES (?
05f0: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 ,?,?,?,strftime(
0600: 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d '%s','now')" com
0610: 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 ma valslots ");"
0620: 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 )... allvals)..
0630: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
0640: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 for-each-row ..
0650: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 (lambda (id)..
0660: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69 (set! res i
0670: 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 d)).. db.. (
0680: 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 let ((qry (conc
0690: 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 "SELECT id FROM
06a0: 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e runs WHERE (runn
06b0: 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b ame=? " andstr k
06c0: 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a ey=?str ");"))).
06d0: 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 . ;(debug:pr
06e0: 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 int 4 "qry: " qr
06f0: 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 y) .. qry)..
0700: 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 qryvals).. (
0710: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
0720: 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 db "UPDATE runs
0730: 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 SET state=?,stat
0740: 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b us=? WHERE id=?;
0750: 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 " state status r
0760: 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 es).. res) ..(b
0770: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 egin.. (debug:p
0780: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 rint 0 "ERROR: C
0790: 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c alled without al
07a0: 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 l necessary keys
07b0: 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b ").. #f))))..;;
07c0: 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 runs:get-runs-b
07d0: 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72 75 y-patt.;; get ru
07e0: 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63 72 ns by list of cr
07f0: 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73 74 iteria.;; regist
0800: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 er a test run wi
0810: 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b 20 th the db.;;.;;
0820: 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61 6c Use: (db-get-val
0830: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64 62 ue-by-header (db
0840: 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e 69 :get-header runi
0850: 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77 20 nfo)(db:get-row
0860: 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74 6f runinfo)).;; to
0870: 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66 72 extract info fr
0880: 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 65 om the structure
0890: 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64 65 returned.;;.(de
08a0: 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d 72 fine (runs:get-r
08b0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
08c0: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 eys runnamepatt
08d0: 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65 73 . params) ;; tes
08e0: 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 t-name). (let*
08f0: 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65 79 ((keyvallst (key
0900: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 29 s->vallist keys)
0910: 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28 72 ).. (tmp (r
0920: 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e 2d uns:get-std-run-
0930: 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22 69 fields keys '("i
0940: 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73 74 d" "runname" "st
0950: 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22 6f ate" "status" "o
0960: 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69 6d wner" "event_tim
0970: 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72 20 e"))).. (keystr
0980: 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20 28 (car tmp)).. (
0990: 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20 74 header (cadr t
09a0: 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20 20 mp)).. (res
09b0: 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74 74 '()).. (key-patt
09c0: 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 "")). (for-e
09d0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 ach (lambda (key
09e0: 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b val)...(let* ((k
09f0: 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 ey (vector-re
0a00: 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09 20 f keyval 0))...
0a10: 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28 63 (fulkey (c
0a20: 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 onc ":" key))...
0a30: 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20 28 (patt (
0a40: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75 6c args:get-arg ful
0a50: 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20 70 key)))... (if p
0a60: 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 att... (set
0a70: 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 ! key-patt (conc
0a80: 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 key-patt " AND
0a90: 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22 20 " key " like '"
0aa0: 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20 20 patt "'"))...
0ab0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64 65 (begin....(de
0ac0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
0ad0: 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66 6f OR: searching fo
0ae0: 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20 70 r runs with no p
0af0: 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20 22 attern set for "
0b00: 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78 69 fulkey)....(exi
0b10: 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20 20 t 6)))))..
0b20: 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69 74 keys). (sqlit
0b30: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 e3:for-each-row
0b40: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 . (lambda (a
0b50: 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73 65 . r). (se
0b60: 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c 69 t! res (cons (li
0b70: 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e 73 st->vector (cons
0b80: 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20 20 a r)) res))).
0b90: 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e db . (con
0ba0: 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79 73 c "SELECT " keys
0bb0: 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 tr " FROM runs W
0bc0: 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69 6b HERE runname lik
0bd0: 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 e ? " key-patt "
0be0: 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d 65 ;"). runname
0bf0: 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74 6f patt). (vecto
0c00: 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29 0a r header res))).
0c10: 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 73 74 .(define (regist
0c20: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 er-test db run-i
0c30: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
0c40: 2d 70 61 74 68 29 0a 20 20 28 6c 65 74 20 28 28 -path). (let ((
0c50: 69 74 65 6d 2d 70 61 74 68 73 20 28 69 66 20 28 item-paths (if (
0c60: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
0c70: 20 22 22 29 0a 09 09 09 28 6c 69 73 74 20 69 74 "")....(list it
0c80: 65 6d 2d 70 61 74 68 29 0a 09 09 09 28 6c 69 73 em-path)....(lis
0c90: 74 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 t item-path ""))
0ca0: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
0cb0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
0cc0: 70 74 68 29 0a 20 20 20 20 20 20 20 28 73 71 6c pth). (sql
0cd0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 ite3:execute db
0ce0: 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 "INSERT OR IGNOR
0cf0: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 E INTO tests (ru
0d00: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 65 76 n_id,testname,ev
0d10: 65 6e 74 5f 74 69 6d 65 2c 69 74 65 6d 5f 70 61 ent_time,item_pa
0d20: 74 68 2c 73 74 61 74 65 2c 73 74 61 74 75 73 29 th,state,status)
0d30: 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 73 74 72 VALUES (?,?,str
0d40: 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 ftime('%s','now'
0d50: 29 2c 3f 2c 27 4e 4f 54 5f 53 54 41 52 54 45 44 ),?,'NOT_STARTED
0d60: 27 2c 27 6e 2f 61 27 29 3b 22 20 0a 09 09 09 72 ','n/a');" ....r
0d70: 75 6e 2d 69 64 20 0a 09 09 09 74 65 73 74 2d 6e un-id ....test-n
0d80: 61 6d 65 0a 09 09 09 70 74 68 20 0a 09 09 09 3b ame....pth ....;
0d90: 3b 20 28 63 6f 6e 63 20 22 2c 22 20 28 73 74 72 ; (conc "," (str
0da0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
0db0: 74 61 67 73 20 22 2c 22 29 20 22 2c 22 29 0a 09 tags ",") ",")..
0dc0: 09 09 29 29 0a 20 20 20 20 20 69 74 65 6d 2d 70 ..)). item-p
0dd0: 61 74 68 73 20 29 29 29 0a 0a 3b 3b 20 67 65 74 aths )))..;; get
0de0: 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 72 65 the previous re
0df0: 63 6f 72 64 20 66 6f 72 20 77 68 65 6e 20 74 68 cord for when th
0e00: 69 73 20 74 65 73 74 20 77 61 73 20 72 75 6e 20 is test was run
0e10: 77 68 65 72 65 20 61 6c 6c 20 6b 65 79 73 20 6d where all keys m
0e20: 61 74 63 68 20 62 75 74 20 72 75 6e 6e 61 6d 65 atch but runname
0e30: 0a 3b 3b 20 72 65 74 75 72 6e 73 20 23 66 20 69 .;; returns #f i
0e40: 66 20 6e 6f 20 73 75 63 68 20 74 65 73 74 20 66 f no such test f
0e50: 6f 75 6e 64 2c 20 72 65 74 75 72 6e 73 20 61 20 ound, returns a
0e60: 73 69 6e 67 6c 65 20 74 65 73 74 20 72 65 63 6f single test reco
0e70: 72 64 20 69 66 20 66 6f 75 6e 64 0a 28 64 65 66 rd if found.(def
0e80: 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d 70 72 ine (test:get-pr
0e90: 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d evious-test-run-
0ea0: 72 65 63 6f 72 64 20 64 62 20 72 75 6e 2d 69 64 record db run-id
0eb0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
0ec0: 70 61 74 68 29 0a 20 20 28 6c 65 74 2a 20 28 28 path). (let* ((
0ed0: 6b 65 79 73 20 20 20 20 28 64 62 3a 67 65 74 2d keys (db:get-
0ee0: 6b 65 79 73 20 64 62 29 29 0a 09 20 28 73 65 6c keys db)).. (sel
0ef0: 73 74 72 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 str (string-int
0f00: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c ersperse (map (l
0f10: 61 6d 62 64 61 20 28 78 29 28 76 65 63 74 6f 72 ambda (x)(vector
0f20: 2d 72 65 66 20 78 20 30 29 29 20 6b 65 79 73 29 -ref x 0)) keys)
0f30: 20 22 2c 22 29 29 0a 09 20 28 71 72 79 73 74 72 ",")).. (qrystr
0f40: 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 (string-inters
0f50: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 perse (map (lamb
0f60: 64 61 20 28 78 29 28 63 6f 6e 63 20 28 76 65 63 da (x)(conc (vec
0f70: 74 6f 72 2d 72 65 66 20 78 20 30 29 20 22 3d 3f tor-ref x 0) "=?
0f80: 22 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 ")) keys) " AND
0f90: 22 29 29 0a 09 20 28 6b 65 79 76 61 6c 73 20 23 ")).. (keyvals #
0fa0: 66 29 29 0a 20 20 20 20 3b 3b 20 66 69 72 73 74 f)). ;; first
0fb0: 20 6c 6f 6f 6b 20 75 70 20 74 68 65 20 6b 65 79 look up the key
0fc0: 20 76 61 6c 75 65 73 20 66 72 6f 6d 20 74 68 65 values from the
0fd0: 20 72 75 6e 20 73 65 6c 65 63 74 65 64 20 62 79 run selected by
0fe0: 20 72 75 6e 2d 69 64 0a 20 20 20 20 28 73 71 6c run-id. (sql
0ff0: 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f ite3:for-each-ro
1000: 77 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 w . (lambda
1010: 28 61 20 2e 20 62 29 0a 20 20 20 20 20 20 20 28 (a . b). (
1020: 73 65 74 21 20 6b 65 79 76 61 6c 73 20 28 63 6f set! keyvals (co
1030: 6e 73 20 61 20 62 29 29 29 0a 20 20 20 20 20 64 ns a b))). d
1040: 62 0a 20 20 20 20 20 28 63 6f 6e 63 20 22 53 45 b. (conc "SE
1050: 4c 45 43 54 20 22 20 73 65 6c 73 74 72 20 22 20 LECT " selstr "
1060: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 FROM runs WHERE
1070: 69 64 3d 3f 20 4f 52 44 45 52 20 42 59 20 65 76 id=? ORDER BY ev
1080: 65 6e 74 5f 74 69 6d 65 20 44 45 53 43 3b 22 29 ent_time DESC;")
1090: 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 28 69 66 run-id). (if
10a0: 20 28 6e 6f 74 20 6b 65 79 76 61 6c 73 29 0a 09 (not keyvals)..
10b0: 23 66 0a 09 28 6c 65 74 20 28 28 70 72 65 76 2d #f..(let ((prev-
10c0: 72 75 6e 2d 69 64 73 20 27 28 29 29 29 0a 09 20 run-ids '()))..
10d0: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
10e0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 for-each-row...
10f0: 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 09 20 (lambda (id)...
1100: 20 20 28 73 65 74 21 20 70 72 65 76 2d 72 75 6e (set! prev-run
1110: 2d 69 64 73 20 28 63 6f 6e 73 20 69 64 20 70 72 -ids (cons id pr
1120: 65 76 2d 72 75 6e 2d 69 64 73 29 29 29 0a 09 09 ev-run-ids)))...
1130: 20 64 62 0a 09 09 20 28 63 6f 6e 63 20 22 53 45 db... (conc "SE
1140: 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e LECT id FROM run
1150: 73 20 57 48 45 52 45 20 22 20 71 72 79 73 74 72 s WHERE " qrystr
1160: 20 22 20 41 4e 44 20 69 64 20 21 3d 20 3f 3b 22 " AND id != ?;"
1170: 29 20 28 61 70 70 65 6e 64 20 6b 65 79 76 61 6c ) (append keyval
1180: 73 20 28 6c 69 73 74 20 72 75 6e 2d 69 64 29 29 s (list run-id))
1190: 29 0a 09 20 20 3b 3b 20 66 6f 72 20 65 61 63 68 ).. ;; for each
11a0: 20 72 75 6e 20 73 74 61 72 74 69 6e 67 20 77 69 run starting wi
11b0: 74 68 20 74 68 65 20 6d 6f 73 74 20 72 65 63 65 th the most rece
11c0: 6e 74 20 6c 6f 6f 6b 20 74 6f 20 73 65 65 20 69 nt look to see i
11d0: 66 20 74 68 65 72 65 20 69 73 20 61 20 6d 61 74 f there is a mat
11e0: 63 68 69 6e 67 20 74 65 73 74 0a 09 20 20 3b 3b ching test.. ;;
11f0: 20 69 66 20 66 6f 75 6e 64 20 74 68 65 6e 20 72 if found then r
1200: 65 74 75 72 6e 20 74 68 61 74 20 6d 61 74 63 68 eturn that match
1210: 69 6e 67 20 74 65 73 74 20 72 65 63 6f 72 64 0a ing test record.
1220: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
1230: 34 20 22 73 65 6c 73 74 72 3a 20 22 20 73 65 6c 4 "selstr: " sel
1240: 73 74 72 20 22 2c 20 71 72 79 73 74 72 3a 20 22 str ", qrystr: "
1250: 20 71 72 79 73 74 72 20 22 2c 20 6b 65 79 76 61 qrystr ", keyva
1260: 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 20 22 2c ls: " keyvals ",
1270: 20 70 72 65 76 69 6f 75 73 20 72 75 6e 20 69 64 previous run id
1280: 73 20 66 6f 75 6e 64 3a 20 22 20 70 72 65 76 2d s found: " prev-
1290: 72 75 6e 2d 69 64 73 29 0a 09 20 20 28 69 66 20 run-ids).. (if
12a0: 28 6e 75 6c 6c 3f 20 70 72 65 76 2d 72 75 6e 2d (null? prev-run-
12b0: 69 64 73 29 20 23 66 0a 09 20 20 20 20 20 20 28 ids) #f.. (
12c0: 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 let loop ((hed (
12d0: 63 61 72 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 car prev-run-ids
12e0: 29 29 0a 09 09 09 20 28 74 61 6c 20 28 63 64 72 )).... (tal (cdr
12f0: 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 29 29 29 prev-run-ids)))
1300: 0a 09 09 28 6c 65 74 20 28 28 72 65 73 75 6c 74 ...(let ((result
1310: 73 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d s (db-get-tests-
1320: 66 6f 72 2d 72 75 6e 20 64 62 20 68 65 64 20 74 for-run db hed t
1330: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
1340: 74 68 29 29 29 0a 09 09 20 20 28 64 65 62 75 67 th)))... (debug
1350: 3a 70 72 69 6e 74 20 34 20 22 47 6f 74 20 74 65 :print 4 "Got te
1360: 73 74 73 20 66 6f 72 20 72 75 6e 2d 69 64 20 22 sts for run-id "
1370: 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d run-id ", test-
1380: 6e 61 6d 65 20 22 20 74 65 73 74 2d 6e 61 6d 65 name " test-name
1390: 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 20 22 20 ", item-path "
13a0: 69 74 65 6d 2d 70 61 74 68 20 22 3a 20 22 20 72 item-path ": " r
13b0: 65 73 75 6c 74 73 29 0a 09 09 20 20 28 69 66 20 esults)... (if
13c0: 28 61 6e 64 20 28 6e 75 6c 6c 3f 20 72 65 73 75 (and (null? resu
13d0: 6c 74 73 29 0a 09 09 09 20 20 20 28 6e 6f 74 20 lts).... (not
13e0: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 29 0a 09 09 (null? tal)))...
13f0: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 (loop (car
1400: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 0a tal)(cdr tal)).
1410: 09 09 20 20 20 20 20 20 28 63 61 72 20 72 65 73 .. (car res
1420: 75 6c 74 73 29 29 29 29 29 29 29 29 29 0a 20 20 ults))))))))).
1430: 20 20 0a 3b 3b 20 67 65 74 20 74 68 65 20 70 72 .;; get the pr
1440: 65 76 69 6f 75 73 20 72 65 63 6f 72 64 73 20 66 evious records f
1450: 6f 72 20 77 68 65 6e 20 74 68 65 73 65 20 74 65 or when these te
1460: 73 74 73 20 77 65 72 65 20 72 75 6e 20 77 68 65 sts were run whe
1470: 72 65 20 61 6c 6c 20 6b 65 79 73 20 6d 61 74 63 re all keys matc
1480: 68 20 62 75 74 20 72 75 6e 6e 61 6d 65 0a 3b 3b h but runname.;;
1490: 20 4e 42 2f 2f 20 4d 65 72 67 65 20 74 68 69 73 NB// Merge this
14a0: 20 77 69 74 68 20 74 65 73 74 3a 67 65 74 2d 70 with test:get-p
14b0: 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e revious-test-run
14c0: 2d 72 65 63 6f 72 64 73 3f 20 54 68 69 73 20 6f -records? This o
14d0: 6e 65 20 6c 6f 6f 6b 73 20 66 6f 72 20 61 6c 6c ne looks for all
14e0: 20 6d 61 74 63 68 69 6e 67 20 74 65 73 74 73 0a matching tests.
14f0: 3b 3b 20 63 61 6e 20 75 73 65 20 77 69 6c 64 63 ;; can use wildc
1500: 61 72 64 73 2e 20 0a 28 64 65 66 69 6e 65 20 28 ards. .(define (
1510: 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e test:get-matchin
1520: 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d g-previous-test-
1530: 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 72 run-records db r
1540: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
1550: 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 28 6c 65 item-path). (le
1560: 74 2a 20 28 28 6b 65 79 73 20 20 20 20 28 64 62 t* ((keys (db
1570: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 :get-keys db))..
1580: 20 28 73 65 6c 73 74 72 20 20 28 73 74 72 69 6e (selstr (strin
1590: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d g-intersperse (m
15a0: 61 70 20 28 6c 61 6d 62 64 61 20 28 78 29 28 76 ap (lambda (x)(v
15b0: 65 63 74 6f 72 2d 72 65 66 20 78 20 30 29 29 20 ector-ref x 0))
15c0: 6b 65 79 73 29 20 22 2c 22 29 29 0a 09 20 28 71 keys) ",")).. (q
15d0: 72 79 73 74 72 20 20 28 73 74 72 69 6e 67 2d 69 rystr (string-i
15e0: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 ntersperse (map
15f0: 28 6c 61 6d 62 64 61 20 28 78 29 28 63 6f 6e 63 (lambda (x)(conc
1600: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 78 20 30 (vector-ref x 0
1610: 29 20 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 ) "=?")) keys) "
1620: 20 41 4e 44 20 22 29 29 0a 09 20 28 6b 65 79 76 AND ")).. (keyv
1630: 61 6c 73 20 23 66 29 0a 09 20 28 74 65 73 74 73 als #f).. (tests
1640: 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 -hash (make-hash
1650: 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 3b 3b -table))). ;;
1660: 20 66 69 72 73 74 20 6c 6f 6f 6b 20 75 70 20 74 first look up t
1670: 68 65 20 6b 65 79 20 76 61 6c 75 65 73 20 66 72 he key values fr
1680: 6f 6d 20 74 68 65 20 72 75 6e 20 73 65 6c 65 63 om the run selec
1690: 74 65 64 20 62 79 20 72 75 6e 2d 69 64 0a 20 20 ted by run-id.
16a0: 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 (sqlite3:for-e
16b0: 61 63 68 2d 72 6f 77 20 0a 20 20 20 20 20 28 6c ach-row . (l
16c0: 61 6d 62 64 61 20 28 61 20 2e 20 62 29 0a 20 20 ambda (a . b).
16d0: 20 20 20 20 20 28 73 65 74 21 20 6b 65 79 76 61 (set! keyva
16e0: 6c 73 20 28 63 6f 6e 73 20 61 20 62 29 29 29 0a ls (cons a b))).
16f0: 20 20 20 20 20 64 62 0a 20 20 20 20 20 28 63 6f db. (co
1700: 6e 63 20 22 53 45 4c 45 43 54 20 22 20 73 65 6c nc "SELECT " sel
1710: 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 str " FROM runs
1720: 57 48 45 52 45 20 69 64 3d 3f 20 4f 52 44 45 52 WHERE id=? ORDER
1730: 20 42 59 20 65 76 65 6e 74 5f 74 69 6d 65 20 44 BY event_time D
1740: 45 53 43 3b 22 29 20 72 75 6e 2d 69 64 29 0a 20 ESC;") run-id).
1750: 20 20 20 28 69 66 20 28 6e 6f 74 20 6b 65 79 76 (if (not keyv
1760: 61 6c 73 29 0a 09 27 28 29 0a 09 28 6c 65 74 20 als)..'()..(let
1770: 28 28 70 72 65 76 2d 72 75 6e 2d 69 64 73 20 27 ((prev-run-ids '
1780: 28 29 29 29 0a 09 20 20 28 61 70 70 6c 79 20 73 ())).. (apply s
1790: 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d qlite3:for-each-
17a0: 72 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 row... (lambda (
17b0: 69 64 29 0a 09 09 20 20 20 28 73 65 74 21 20 70 id)... (set! p
17c0: 72 65 76 2d 72 75 6e 2d 69 64 73 20 28 63 6f 6e rev-run-ids (con
17d0: 73 20 69 64 20 70 72 65 76 2d 72 75 6e 2d 69 64 s id prev-run-id
17e0: 73 29 29 29 0a 09 09 20 64 62 0a 09 09 20 28 63 s)))... db... (c
17f0: 6f 6e 63 20 22 53 45 4c 45 43 54 20 69 64 20 46 onc "SELECT id F
1800: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 22 ROM runs WHERE "
1810: 20 71 72 79 73 74 72 20 22 20 41 4e 44 20 69 64 qrystr " AND id
1820: 20 21 3d 20 3f 3b 22 29 20 28 61 70 70 65 6e 64 != ?;") (append
1830: 20 6b 65 79 76 61 6c 73 20 28 6c 69 73 74 20 72 keyvals (list r
1840: 75 6e 2d 69 64 29 29 29 0a 09 20 20 3b 3b 20 63 un-id))).. ;; c
1850: 6f 6c 6c 65 63 74 20 61 6c 6c 20 6d 61 74 63 68 ollect all match
1860: 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 74 68 ing tests for th
1870: 65 20 72 75 6e 73 20 74 68 65 6e 0a 09 20 20 3b e runs then.. ;
1880: 3b 20 65 78 74 72 61 63 74 20 74 68 65 20 6d 6f ; extract the mo
1890: 73 74 20 72 65 63 65 6e 74 20 74 65 73 74 20 61 st recent test a
18a0: 6e 64 20 72 65 74 75 72 6e 20 74 68 61 74 2e 0a nd return that..
18b0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
18c0: 34 20 22 73 65 6c 73 74 72 3a 20 22 20 73 65 6c 4 "selstr: " sel
18d0: 73 74 72 20 22 2c 20 71 72 79 73 74 72 3a 20 22 str ", qrystr: "
18e0: 20 71 72 79 73 74 72 20 22 2c 20 6b 65 79 76 61 qrystr ", keyva
18f0: 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 20 0a 09 ls: " keyvals ..
1900: 09 20 20 20 20 20 20 20 22 2c 20 70 72 65 76 69 . ", previ
1910: 6f 75 73 20 72 75 6e 20 69 64 73 20 66 6f 75 6e ous run ids foun
1920: 64 3a 20 22 20 70 72 65 76 2d 72 75 6e 2d 69 64 d: " prev-run-id
1930: 73 29 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f s).. (if (null?
1940: 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 29 20 27 prev-run-ids) '
1950: 28 29 20 20 3b 3b 20 6e 6f 20 70 72 65 76 69 6f () ;; no previo
1960: 75 73 20 72 75 6e 73 3f 20 72 65 74 75 72 6e 20 us runs? return
1970: 6e 75 6c 6c 0a 09 20 20 20 20 20 20 28 6c 65 74 null.. (let
1980: 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 loop ((hed (car
1990: 20 70 72 65 76 2d 72 75 6e 2d 69 64 73 29 29 0a prev-run-ids)).
19a0: 09 09 09 20 28 74 61 6c 20 28 63 64 72 20 70 72 ... (tal (cdr pr
19b0: 65 76 2d 72 75 6e 2d 69 64 73 29 29 29 0a 09 09 ev-run-ids)))...
19c0: 28 6c 65 74 20 28 28 72 65 73 75 6c 74 73 20 28 (let ((results (
19d0: 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db-get-tests-for
19e0: 2d 72 75 6e 20 64 62 20 68 65 64 20 74 65 73 74 -run db hed test
19f0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
1a00: 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 ))... (debug:pr
1a10: 69 6e 74 20 34 20 22 47 6f 74 20 74 65 73 74 73 int 4 "Got tests
1a20: 20 66 6f 72 20 72 75 6e 2d 69 64 20 22 20 72 75 for run-id " ru
1a30: 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d 6e 61 6d n-id ", test-nam
1a40: 65 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 0a 09 e " test-name ..
1a50: 09 09 20 20 20 20 20 20 20 22 2c 20 69 74 65 6d .. ", item
1a60: 2d 70 61 74 68 20 22 20 69 74 65 6d 2d 70 61 74 -path " item-pat
1a70: 68 20 22 20 72 65 73 75 6c 74 73 3a 20 22 20 28 h " results: " (
1a80: 69 6e 74 65 72 73 70 65 72 73 65 20 72 65 73 75 intersperse resu
1a90: 6c 74 73 20 22 5c 6e 22 29 29 0a 09 09 20 20 3b lts "\n"))... ;
1aa0: 3b 20 4b 65 65 70 20 6f 6e 6c 79 20 74 68 65 20 ; Keep only the
1ab0: 79 6f 75 6e 67 65 73 74 20 6f 66 20 61 6e 79 20 youngest of any
1ac0: 74 65 73 74 2f 69 74 65 6d 20 63 6f 6d 62 69 6e test/item combin
1ad0: 61 74 69 6f 6e 0a 09 09 20 20 28 66 6f 72 2d 65 ation... (for-e
1ae0: 61 63 68 20 0a 09 09 20 20 20 28 6c 61 6d 62 64 ach ... (lambd
1af0: 61 20 28 74 65 73 74 64 61 74 29 0a 09 09 20 20 a (testdat)...
1b00: 20 20 20 28 6c 65 74 2a 20 28 28 66 75 6c 6c 2d (let* ((full-
1b10: 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 28 testname (conc (
1b20: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
1b30: 6e 61 6d 65 20 74 65 73 74 64 61 74 29 20 22 2f name testdat) "/
1b40: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
1b50: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 tem-path testdat
1b60: 29 29 29 0a 09 09 09 20 20 20 20 28 73 74 6f 72 ))).... (stor
1b70: 65 64 2d 74 65 73 74 20 20 20 28 68 61 73 68 2d ed-test (hash-
1b80: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
1b90: 74 20 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c t tests-hash ful
1ba0: 6c 2d 74 65 73 74 6e 61 6d 65 20 23 66 29 29 29 l-testname #f)))
1bb0: 0a 09 09 20 20 20 20 20 20 20 28 69 66 20 28 6f ... (if (o
1bc0: 72 20 28 6e 6f 74 20 73 74 6f 72 65 64 2d 74 65 r (not stored-te
1bd0: 73 74 29 0a 09 09 09 20 20 20 20 20 20 20 28 61 st).... (a
1be0: 6e 64 20 73 74 6f 72 65 64 2d 74 65 73 74 0a 09 nd stored-test..
1bf0: 09 09 09 20 20 20 20 28 3e 20 28 64 62 3a 74 65 ... (> (db:te
1c00: 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d st-get-event_tim
1c10: 65 20 74 65 73 74 64 61 74 29 28 64 62 3a 74 65 e testdat)(db:te
1c20: 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d st-get-event_tim
1c30: 65 20 73 74 6f 72 65 64 2d 74 65 73 74 29 29 29 e stored-test)))
1c40: 29 0a 09 09 09 20 20 20 3b 3b 20 74 68 69 73 20 ).... ;; this
1c50: 74 65 73 74 20 69 73 20 79 6f 75 6e 67 65 72 2c test is younger,
1c60: 20 73 74 6f 72 65 20 69 74 20 69 6e 20 74 68 65 store it in the
1c70: 20 68 61 73 68 0a 09 09 09 20 20 20 28 68 61 73 hash.... (has
1c80: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 h-table-set! tes
1c90: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 74 65 73 ts-hash full-tes
1ca0: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 29 tname testdat)))
1cb0: 29 0a 09 09 20 20 20 72 65 73 75 6c 74 73 29 0a )... results).
1cc0: 09 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 .. (if (null? t
1cd0: 61 6c 29 0a 09 09 20 20 20 20 20 20 28 6d 61 70 al)... (map
1ce0: 20 63 64 72 20 28 68 61 73 68 2d 74 61 62 6c 65 cdr (hash-table
1cf0: 2d 3e 61 6c 69 73 74 20 74 65 73 74 73 2d 68 61 ->alist tests-ha
1d00: 73 68 29 29 20 3b 3b 20 72 65 74 75 72 6e 20 61 sh)) ;; return a
1d10: 20 6c 69 73 74 20 6f 66 20 74 68 65 20 6d 6f 73 list of the mos
1d20: 74 20 72 65 63 65 6e 74 20 74 65 73 74 73 0a 09 t recent tests..
1d30: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 . (loop (ca
1d40: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 r tal)(cdr tal))
1d50: 29 29 29 29 29 29 29 29 0a 0a 28 64 65 66 69 6e ))))))))..(defin
1d60: 65 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 e (test-set-stat
1d70: 75 73 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 us! db run-id te
1d80: 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 74 st-name state st
1d90: 61 74 75 73 20 69 74 65 6d 64 61 74 2d 6f 72 2d atus itemdat-or-
1da0: 70 61 74 68 20 63 6f 6d 6d 65 6e 74 20 64 61 74 path comment dat
1db0: 29 0a 20 20 28 6c 65 74 2a 20 28 28 72 65 61 6c ). (let* ((real
1dc0: 2d 73 74 61 74 75 73 20 73 74 61 74 75 73 29 0a -status status).
1dd0: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28 . (item-path (
1de0: 69 66 20 28 73 74 72 69 6e 67 3f 20 69 74 65 6d if (string? item
1df0: 64 61 74 2d 6f 72 2d 70 61 74 68 29 20 69 74 65 dat-or-path) ite
1e00: 6d 64 61 74 2d 6f 72 2d 70 61 74 68 20 28 69 74 mdat-or-path (it
1e10: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
1e20: 65 6d 64 61 74 2d 6f 72 2d 70 61 74 68 29 29 29 emdat-or-path)))
1e30: 0a 09 20 28 74 65 73 74 64 61 74 20 20 20 20 20 .. (testdat
1e40: 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 (db:get-test-inf
1e50: 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 o db run-id test
1e60: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
1e70: 29 0a 09 20 28 74 65 73 74 2d 69 64 20 20 20 20 ).. (test-id
1e80: 20 28 69 66 20 74 65 73 74 64 61 74 20 28 64 62 (if testdat (db
1e90: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
1ea0: 74 64 61 74 29 20 23 66 29 29 0a 09 20 28 6f 74 tdat) #f)).. (ot
1eb0: 68 65 72 64 61 74 20 20 20 20 28 69 66 20 64 61 herdat (if da
1ec0: 74 20 64 61 74 20 28 6d 61 6b 65 2d 68 61 73 68 t dat (make-hash
1ed0: 2d 74 61 62 6c 65 29 29 29 0a 09 20 3b 3b 20 62 -table))).. ;; b
1ee0: 65 66 6f 72 65 20 70 72 6f 63 65 65 64 69 6e 67 efore proceeding
1ef0: 20 77 65 20 6d 75 73 74 20 66 69 6e 64 20 6f 75 we must find ou
1f00: 74 20 69 66 20 74 68 65 20 70 72 65 76 69 6f 75 t if the previou
1f10: 73 20 74 65 73 74 20 28 77 68 65 72 65 20 61 6c s test (where al
1f20: 6c 20 6b 65 79 73 20 6d 61 74 63 68 65 64 20 65 l keys matched e
1f30: 78 63 65 70 74 20 72 75 6e 6e 61 6d 65 29 0a 09 xcept runname)..
1f40: 20 3b 3b 20 77 61 73 20 57 41 49 56 45 44 20 69 ;; was WAIVED i
1f50: 66 20 74 68 69 73 20 74 65 73 74 20 69 73 20 46 f this test is F
1f60: 41 49 4c 0a 09 20 28 77 61 69 76 65 64 20 20 20 AIL.. (waived
1f70: 28 69 66 20 28 65 71 75 61 6c 3f 20 73 74 61 74 (if (equal? stat
1f80: 75 73 20 22 46 41 49 4c 22 29 0a 09 09 20 20 20 us "FAIL")...
1f90: 20 20 20 20 28 6c 65 74 20 28 28 70 72 65 76 2d (let ((prev-
1fa0: 74 65 73 74 20 28 74 65 73 74 3a 67 65 74 2d 70 test (test:get-p
1fb0: 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e revious-test-run
1fc0: 2d 72 65 63 6f 72 64 20 64 62 20 72 75 6e 2d 69 -record db run-i
1fd0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
1fe0: 2d 70 61 74 68 29 29 29 0a 09 09 09 20 28 69 66 -path))).... (if
1ff0: 20 70 72 65 76 2d 74 65 73 74 20 3b 3b 20 74 72 prev-test ;; tr
2000: 75 65 20 69 66 20 77 65 20 66 6f 75 6e 64 20 61 ue if we found a
2010: 20 70 72 65 76 69 6f 75 73 20 74 65 73 74 20 69 previous test i
2020: 6e 20 74 68 69 73 20 72 75 6e 20 73 65 72 69 65 n this run serie
2030: 73 0a 09 09 09 20 20 20 20 20 28 6c 65 74 20 28 s.... (let (
2040: 28 70 72 65 76 2d 73 74 61 74 75 73 20 28 64 62 (prev-status (db
2050: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 :test-get-status
2060: 20 20 20 70 72 65 76 2d 74 65 73 74 29 29 0a 09 prev-test))..
2070: 09 09 09 20 20 20 28 70 72 65 76 2d 73 74 61 74 ... (prev-stat
2080: 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d e (db:test-get-
2090: 73 74 61 74 65 20 20 20 20 70 72 65 76 2d 74 65 state prev-te
20a0: 73 74 29 29 0a 09 09 09 09 20 20 20 28 70 72 65 st))..... (pre
20b0: 76 2d 63 6f 6d 6d 65 6e 74 20 28 64 62 3a 74 65 v-comment (db:te
20c0: 73 74 2d 67 65 74 2d 63 6f 6d 6d 65 6e 74 20 70 st-get-comment p
20d0: 72 65 76 2d 74 65 73 74 29 29 29 0a 09 09 09 20 rev-test)))....
20e0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
20f0: 6e 74 20 34 20 22 70 72 65 76 2d 73 74 61 74 75 nt 4 "prev-statu
2100: 73 20 22 20 70 72 65 76 2d 73 74 61 74 75 73 20 s " prev-status
2110: 22 2c 20 70 72 65 76 2d 73 74 61 74 65 20 22 20 ", prev-state "
2120: 70 72 65 76 2d 73 74 61 74 65 20 22 2c 20 70 72 prev-state ", pr
2130: 65 76 2d 63 6f 6d 6d 65 6e 74 20 22 20 70 72 65 ev-comment " pre
2140: 76 2d 63 6f 6d 6d 65 6e 74 29 0a 09 09 09 20 20 v-comment)....
2150: 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 65 (if (and (e
2160: 71 75 61 6c 3f 20 70 72 65 76 2d 73 74 61 74 65 qual? prev-state
2170: 20 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 0a 09 "COMPLETED")..
2180: 09 09 09 09 28 65 71 75 61 6c 3f 20 70 72 65 76 ....(equal? prev
2190: 2d 73 74 61 74 75 73 20 22 57 41 49 56 45 44 22 -status "WAIVED"
21a0: 29 29 0a 09 09 09 09 20 20 20 70 72 65 76 2d 63 ))..... prev-c
21b0: 6f 6d 6d 65 6e 74 20 3b 3b 20 77 61 69 76 65 64 omment ;; waived
21c0: 20 69 73 20 65 69 74 68 65 72 20 74 68 65 20 63 is either the c
21d0: 6f 6d 6d 65 6e 74 20 6f 72 20 23 66 0a 09 09 09 omment or #f....
21e0: 09 20 20 20 23 66 29 29 0a 09 09 09 20 20 20 20 . #f))....
21f0: 20 23 66 29 29 0a 09 09 20 20 20 20 20 20 20 23 #f))... #
2200: 66 29 29 29 0a 20 20 20 20 28 69 66 20 77 61 69 f))). (if wai
2210: 76 65 64 20 28 73 65 74 21 20 72 65 61 6c 2d 73 ved (set! real-s
2220: 74 61 74 75 73 20 22 57 41 49 56 45 44 22 29 29 tatus "WAIVED"))
2230: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
2240: 74 20 34 20 22 72 65 61 6c 2d 73 74 61 74 75 73 t 4 "real-status
2250: 20 22 20 72 65 61 6c 2d 73 74 61 74 75 73 20 22 " real-status "
2260: 2c 20 77 61 69 76 65 64 20 22 20 77 61 69 76 65 , waived " waive
2270: 64 20 22 2c 20 73 74 61 74 75 73 20 22 20 73 74 d ", status " st
2280: 61 74 75 73 29 0a 0a 20 20 20 20 3b 3b 20 75 70 atus).. ;; up
2290: 64 61 74 65 20 74 68 65 20 70 72 69 6d 61 72 79 date the primary
22a0: 20 72 65 63 6f 72 64 20 49 46 20 73 74 61 74 65 record IF state
22b0: 20 41 4e 44 20 73 74 61 74 75 73 20 61 72 65 20 AND status are
22c0: 64 65 66 69 6e 65 64 0a 20 20 20 20 28 69 66 20 defined. (if
22d0: 28 61 6e 64 20 73 74 61 74 65 20 73 74 61 74 75 (and state statu
22e0: 73 29 0a 09 28 73 71 6c 69 74 65 33 3a 65 78 65 s)..(sqlite3:exe
22f0: 63 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 cute db "UPDATE
2300: 74 65 73 74 73 20 53 45 54 20 73 74 61 74 65 3d tests SET state=
2310: 3f 2c 73 74 61 74 75 73 3d 3f 2c 65 76 65 6e 74 ?,status=?,event
2320: 5f 74 69 6d 65 3d 73 74 72 66 74 69 6d 65 28 27 _time=strftime('
2330: 25 73 27 2c 27 6e 6f 77 27 29 20 57 48 45 52 45 %s','now') WHERE
2340: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
2350: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
2360: 6d 5f 70 61 74 68 3d 3f 3b 22 20 0a 09 09 09 20 m_path=?;" ....
2370: 73 74 61 74 65 20 72 65 61 6c 2d 73 74 61 74 75 state real-statu
2380: 73 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 s run-id test-na
2390: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 0a me item-path))..
23a0: 20 20 20 20 3b 3b 20 69 66 20 73 74 61 74 75 73 ;; if status
23b0: 20 69 73 20 22 41 55 54 4f 22 20 74 68 65 6e 20 is "AUTO" then
23c0: 63 61 6c 6c 20 72 6f 6c 6c 75 70 0a 20 20 20 20 call rollup.
23d0: 28 69 66 20 28 61 6e 64 20 74 65 73 74 2d 69 64 (if (and test-id
23e0: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 28 65 state status (e
23f0: 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 41 55 qual? status "AU
2400: 54 4f 22 29 29 20 0a 09 28 64 62 3a 74 65 73 74 TO")) ..(db:test
2410: 2d 64 61 74 61 2d 72 6f 6c 6c 75 70 20 64 62 20 -data-rollup db
2420: 74 65 73 74 2d 69 64 29 29 0a 0a 20 20 20 20 3b test-id)).. ;
2430: 3b 20 61 64 64 20 6d 65 74 61 64 61 74 61 20 28 ; add metadata (
2440: 6e 65 65 64 20 74 6f 20 64 6f 20 74 68 69 73 20 need to do this
2450: 77 61 79 20 74 6f 20 61 76 6f 69 64 20 53 51 4c way to avoid SQL
2460: 20 69 6e 6a 65 63 74 69 6f 6e 20 69 73 73 75 65 injection issue
2470: 73 29 0a 0a 20 20 20 20 3b 3b 20 3a 66 69 72 73 s).. ;; :firs
2480: 74 5f 65 72 72 0a 20 20 20 20 28 6c 65 74 20 28 t_err. (let (
2490: 28 76 61 6c 20 28 68 61 73 68 2d 74 61 62 6c 65 (val (hash-table
24a0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 6f 74 68 -ref/default oth
24b0: 65 72 64 61 74 20 22 3a 66 69 72 73 74 5f 65 72 erdat ":first_er
24c0: 72 22 20 23 66 29 29 29 0a 20 20 20 20 20 20 28 r" #f))). (
24d0: 69 66 20 76 61 6c 0a 09 20 20 28 73 71 6c 69 74 if val.. (sqlit
24e0: 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 e3:execute db "U
24f0: 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 20 PDATE tests SET
2500: 66 69 72 73 74 5f 65 72 72 3d 3f 20 57 48 45 52 first_err=? WHER
2510: 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 E run_id=? AND t
2520: 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 estname=? AND it
2530: 65 6d 5f 70 61 74 68 3d 3f 3b 22 20 76 61 6c 20 em_path=?;" val
2540: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
2550: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 0a 20 item-path)))..
2560: 20 20 20 3b 3b 20 3a 66 69 72 73 74 5f 77 61 72 ;; :first_war
2570: 6e 0a 20 20 20 20 28 6c 65 74 20 28 28 76 61 6c n. (let ((val
2580: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
2590: 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 64 61 /default otherda
25a0: 74 20 22 3a 66 69 72 73 74 5f 77 61 72 6e 22 20 t ":first_warn"
25b0: 23 66 29 29 29 0a 20 20 20 20 20 20 28 69 66 20 #f))). (if
25c0: 76 61 6c 0a 09 20 20 28 73 71 6c 69 74 65 33 3a val.. (sqlite3:
25d0: 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 41 execute db "UPDA
25e0: 54 45 20 74 65 73 74 73 20 53 45 54 20 66 69 72 TE tests SET fir
25f0: 73 74 5f 77 61 72 6e 3d 3f 20 57 48 45 52 45 20 st_warn=? WHERE
2600: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
2610: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
2620: 5f 70 61 74 68 3d 3f 3b 22 20 76 61 6c 20 72 75 _path=?;" val ru
2630: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
2640: 74 65 6d 2d 70 61 74 68 29 29 29 0a 0a 20 20 20 tem-path)))..
2650: 20 3b 3b 20 6e 65 65 64 20 74 6f 20 75 70 64 61 ;; need to upda
2660: 74 65 20 74 68 65 20 74 6f 70 20 74 65 73 74 20 te the top test
2670: 72 65 63 6f 72 64 20 69 66 20 50 41 53 53 20 6f record if PASS o
2680: 72 20 46 41 49 4c 20 61 6e 64 20 74 68 69 73 20 r FAIL and this
2690: 69 73 20 61 20 73 75 62 74 65 73 74 0a 20 20 20 is a subtest.
26a0: 20 28 69 66 20 28 61 6e 64 20 28 6e 6f 74 20 28 (if (and (not (
26b0: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
26c0: 20 22 22 29 29 0a 09 20 20 20 20 20 28 6f 72 20 "")).. (or
26d0: 28 65 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 (equal? status "
26e0: 50 41 53 53 22 29 0a 09 09 20 28 65 71 75 61 6c PASS")... (equal
26f0: 3f 20 73 74 61 74 75 73 20 22 57 41 52 4e 22 29 ? status "WARN")
2700: 0a 09 09 20 28 65 71 75 61 6c 3f 20 73 74 61 74 ... (equal? stat
2710: 75 73 20 22 46 41 49 4c 22 29 0a 09 09 20 28 65 us "FAIL")... (e
2720: 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 57 41 qual? status "WA
2730: 49 56 45 44 22 29 0a 09 09 20 28 65 71 75 61 6c IVED")... (equal
2740: 3f 20 73 74 61 74 75 73 20 22 52 55 4e 4e 49 4e ? status "RUNNIN
2750: 47 22 29 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 G")))..(begin..
2760: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
2770: 65 20 0a 09 20 20 20 64 62 0a 09 20 20 20 22 55 e .. db.. "U
2780: 50 44 41 54 45 20 74 65 73 74 73 20 0a 20 20 20 PDATE tests .
2790: 20 20 20 20 20 20 20 20 20 20 53 45 54 20 66 61 SET fa
27a0: 69 6c 5f 63 6f 75 6e 74 3d 28 53 45 4c 45 43 54 il_count=(SELECT
27b0: 20 63 6f 75 6e 74 28 69 64 29 20 46 52 4f 4d 20 count(id) FROM
27c0: 74 65 73 74 73 20 57 48 45 52 45 20 72 75 6e 5f tests WHERE run_
27d0: 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d id=? AND testnam
27e0: 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 e=? AND item_pat
27f0: 68 20 21 3d 20 27 27 20 41 4e 44 20 73 74 61 74 h != '' AND stat
2800: 75 73 3d 27 46 41 49 4c 27 29 2c 0a 20 20 20 20 us='FAIL'),.
2810: 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 73 pas
2820: 73 5f 63 6f 75 6e 74 3d 28 53 45 4c 45 43 54 20 s_count=(SELECT
2830: 63 6f 75 6e 74 28 69 64 29 20 46 52 4f 4d 20 74 count(id) FROM t
2840: 65 73 74 73 20 57 48 45 52 45 20 72 75 6e 5f 69 ests WHERE run_i
2850: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
2860: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
2870: 20 21 3d 20 27 27 20 41 4e 44 20 28 73 74 61 74 != '' AND (stat
2880: 75 73 3d 27 50 41 53 53 27 20 4f 52 20 73 74 61 us='PASS' OR sta
2890: 74 75 73 3d 27 57 41 52 4e 27 20 4f 52 20 73 74 tus='WARN' OR st
28a0: 61 74 75 73 3d 27 57 41 49 56 45 44 27 29 29 0a atus='WAIVED')).
28b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 57 48 45 WHE
28c0: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
28d0: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
28e0: 74 65 6d 5f 70 61 74 68 3d 27 27 3b 22 0a 09 20 tem_path='';"..
28f0: 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 run-id test-na
2900: 6d 65 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e me run-id test-n
2910: 61 6d 65 20 72 75 6e 2d 69 64 20 74 65 73 74 2d ame run-id test-
2920: 6e 61 6d 65 29 0a 09 20 20 28 69 66 20 28 65 71 name).. (if (eq
2930: 75 61 6c 3f 20 73 74 61 74 75 73 20 22 52 55 4e ual? status "RUN
2940: 4e 49 4e 47 22 29 20 3b 3b 20 72 75 6e 6e 69 6e NING") ;; runnin
2950: 67 20 74 61 6b 65 73 20 70 72 69 6f 72 69 74 79 g takes priority
2960: 20 6f 76 65 72 20 61 6c 6c 20 6f 74 68 65 72 20 over all other
2970: 73 74 61 74 65 73 2c 20 66 6f 72 63 65 20 74 68 states, force th
2980: 65 20 74 65 73 74 20 73 74 61 74 65 20 74 6f 20 e test state to
2990: 52 55 4e 4e 49 4e 47 0a 09 20 20 20 20 20 20 28 RUNNING.. (
29a0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
29b0: 64 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 db "UPDATE tests
29c0: 20 53 45 54 20 73 74 61 74 65 3d 3f 20 57 48 45 SET state=? WHE
29d0: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
29e0: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
29f0: 74 65 6d 5f 70 61 74 68 3d 27 27 3b 22 20 72 75 tem_path='';" ru
2a00: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a n-id test-name).
2a10: 09 20 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a . (sqlite3:
2a20: 65 78 65 63 75 74 65 0a 09 20 20 20 20 20 20 20 execute..
2a30: 64 62 0a 09 20 20 20 20 20 20 20 22 55 50 44 41 db.. "UPDA
2a40: 54 45 20 74 65 73 74 73 0a 20 20 20 20 20 20 20 TE tests.
2a50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2a60: 53 45 54 20 73 74 61 74 65 3d 43 41 53 45 20 57 SET state=CASE W
2a70: 48 45 4e 20 28 53 45 4c 45 43 54 20 63 6f 75 6e HEN (SELECT coun
2a80: 74 28 69 64 29 20 46 52 4f 4d 20 74 65 73 74 73 t(id) FROM tests
2a90: 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 WHERE run_id=?
2aa0: 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 AND testname=? A
2ab0: 4e 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d 20 ND item_path !=
2ac0: 27 27 20 41 4e 44 20 73 74 61 74 65 20 69 6e 20 '' AND state in
2ad0: 28 27 52 55 4e 4e 49 4e 47 27 2c 27 4e 4f 54 5f ('RUNNING','NOT_
2ae0: 53 54 41 52 54 45 44 27 29 29 20 3e 20 30 20 54 STARTED')) > 0 T
2af0: 48 45 4e 20 0a 20 20 20 20 20 20 20 20 20 20 20 HEN .
2b00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 '
2b10: 52 55 4e 4e 49 4e 47 27 0a 20 20 20 20 20 20 20 RUNNING'.
2b20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b30: 45 4c 53 45 20 27 43 4f 4d 50 4c 45 54 45 44 27 ELSE 'COMPLETED'
2b40: 20 45 4e 44 2c 0a 20 20 20 20 20 20 20 20 20 20 END,.
2b50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b60: 73 74 61 74 75 73 3d 43 41 53 45 20 57 48 45 4e status=CASE WHEN
2b70: 20 66 61 69 6c 5f 63 6f 75 6e 74 20 3e 20 30 20 fail_count > 0
2b80: 54 48 45 4e 20 27 46 41 49 4c 27 20 57 48 45 4e THEN 'FAIL' WHEN
2b90: 20 70 61 73 73 5f 63 6f 75 6e 74 20 3e 20 30 20 pass_count > 0
2ba0: 41 4e 44 20 66 61 69 6c 5f 63 6f 75 6e 74 3d 30 AND fail_count=0
2bb0: 20 54 48 45 4e 20 27 50 41 53 53 27 20 45 4c 53 THEN 'PASS' ELS
2bc0: 45 20 27 55 4e 4b 4e 4f 57 4e 27 20 45 4e 44 0a E 'UNKNOWN' END.
2bd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2be0: 20 20 20 20 20 20 20 57 48 45 52 45 20 72 75 6e WHERE run
2bf0: 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 _id=? AND testna
2c00: 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 me=? AND item_pa
2c10: 74 68 3d 27 27 3b 22 0a 09 20 20 20 20 20 20 20 th='';"..
2c20: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
2c30: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
2c40: 65 29 29 29 29 0a 20 20 20 20 28 69 66 20 28 6f e)))). (if (o
2c50: 72 20 28 61 6e 64 20 28 73 74 72 69 6e 67 3f 20 r (and (string?
2c60: 63 6f 6d 6d 65 6e 74 29 0a 09 09 20 28 73 74 72 comment)... (str
2c70: 69 6e 67 2d 6d 61 74 63 68 20 28 72 65 67 65 78 ing-match (regex
2c80: 70 20 22 5c 5c 53 2b 22 29 20 63 6f 6d 6d 65 6e p "\\S+") commen
2c90: 74 29 29 0a 09 20 20 20 20 77 61 69 76 65 64 29 t)).. waived)
2ca0: 0a 09 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 ..(sqlite3:execu
2cb0: 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 65 te db "UPDATE te
2cc0: 73 74 73 20 53 45 54 20 63 6f 6d 6d 65 6e 74 3d sts SET comment=
2cd0: 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f ? WHERE run_id=?
2ce0: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
2cf0: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
2d00: 22 0a 09 09 09 20 28 69 66 20 77 61 69 76 65 64 ".... (if waived
2d10: 20 77 61 69 76 65 64 20 63 6f 6d 6d 65 6e 74 29 waived comment)
2d20: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
2d30: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 e item-path)).
2d40: 20 20 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 ))..(define (t
2d50: 65 73 74 2d 73 65 74 2d 6c 6f 67 21 20 64 62 20 est-set-log! db
2d60: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
2d70: 20 69 74 65 6d 64 61 74 20 6c 6f 67 66 29 20 0a itemdat logf) .
2d80: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 2d 70 61 (let ((item-pa
2d90: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 th (item-list->p
2da0: 61 74 68 20 69 74 65 6d 64 61 74 29 29 29 0a 20 ath itemdat))).
2db0: 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 (sqlite3:exec
2dc0: 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 ute db "UPDATE t
2dd0: 65 73 74 73 20 53 45 54 20 66 69 6e 61 6c 5f 6c ests SET final_l
2de0: 6f 67 66 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f ogf=? WHERE run_
2df0: 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d id=? AND testnam
2e00: 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 e=? AND item_pat
2e10: 68 3d 3f 3b 22 20 0a 09 09 20 20 20 20 20 6c 6f h=?;" ... lo
2e20: 67 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e gf run-id test-n
2e30: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 ame item-path)))
2e40: 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d ..(define (test-
2e50: 73 65 74 2d 74 6f 70 6c 6f 67 21 20 64 62 20 72 set-toplog! db r
2e60: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
2e70: 6c 6f 67 66 29 20 0a 20 20 28 73 71 6c 69 74 65 logf) . (sqlite
2e80: 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 3:execute db "UP
2e90: 44 41 54 45 20 74 65 73 74 73 20 53 45 54 20 66 DATE tests SET f
2ea0: 69 6e 61 6c 5f 6c 6f 67 66 3d 3f 20 57 48 45 52 inal_logf=? WHER
2eb0: 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 E run_id=? AND t
2ec0: 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 estname=? AND it
2ed0: 65 6d 5f 70 61 74 68 3d 27 27 3b 22 20 0a 09 09 em_path='';" ...
2ee0: 20 20 20 6c 6f 67 66 20 72 75 6e 2d 69 64 20 74 logf run-id t
2ef0: 65 73 74 2d 6e 61 6d 65 29 29 0a 0a 28 64 65 66 est-name))..(def
2f00: 69 6e 65 20 28 74 65 73 74 73 3a 73 75 6d 6d 61 ine (tests:summa
2f10: 72 69 7a 65 2d 69 74 65 6d 73 20 64 62 20 72 75 rize-items db ru
2f20: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 66 n-id test-name f
2f30: 6f 72 63 65 29 0a 20 20 3b 3b 20 69 66 20 6e 6f orce). ;; if no
2f40: 74 20 66 6f 72 63 65 20 74 68 65 6e 20 6f 6e 6c t force then onl
2f50: 79 20 75 70 64 61 74 65 20 74 68 65 20 72 65 63 y update the rec
2f60: 6f 72 64 20 69 66 20 6f 6e 65 20 6f 66 20 74 68 ord if one of th
2f70: 65 73 65 20 69 73 20 74 72 75 65 3a 0a 20 20 3b ese is true:. ;
2f80: 3b 20 20 20 31 2e 20 6c 6f 67 66 20 69 73 20 22 ; 1. logf is "
2f90: 6c 6f 67 2f 66 69 6e 61 6c 2e 6c 6f 67 0a 20 20 log/final.log.
2fa0: 3b 3b 20 20 20 32 2e 20 6c 6f 67 66 20 69 73 20 ;; 2. logf is
2fb0: 73 61 6d 65 20 61 73 20 6f 75 74 70 75 74 66 69 same as outputfi
2fc0: 6c 65 6e 61 6d 65 0a 20 20 28 6c 65 74 20 28 28 lename. (let ((
2fd0: 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 20 28 outputfilename (
2fe0: 63 6f 6e 63 20 22 6d 65 67 61 74 65 73 74 2d 72 conc "megatest-r
2ff0: 6f 6c 6c 75 70 2d 22 20 74 65 73 74 2d 6e 61 6d ollup-" test-nam
3000: 65 20 22 2e 68 74 6d 6c 22 29 29 0a 09 28 6f 72 e ".html"))..(or
3010: 69 67 2d 64 69 72 20 20 20 20 20 20 20 28 63 75 ig-dir (cu
3020: 72 72 65 6e 74 2d 64 69 72 65 63 74 6f 72 79 29 rrent-directory)
3030: 29 0a 09 28 6c 6f 67 66 20 20 20 20 20 20 20 20 )..(logf
3040: 20 20 20 23 66 29 29 0a 20 20 20 20 28 73 71 6c #f)). (sql
3050: 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f ite3:for-each-ro
3060: 77 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 w . (lambda
3070: 28 70 61 74 68 20 66 69 6e 61 6c 5f 6c 6f 67 66 (path final_logf
3080: 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 6c ). (set! l
3090: 6f 67 66 20 66 69 6e 61 6c 5f 6c 6f 67 66 29 0a ogf final_logf).
30a0: 20 20 20 20 20 20 20 28 69 66 20 28 64 69 72 65 (if (dire
30b0: 63 74 6f 72 79 3f 20 70 61 74 68 29 0a 09 20 20 ctory? path)..
30c0: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 28 70 (begin.. (p
30d0: 72 69 6e 74 20 22 46 6f 75 6e 64 20 70 61 74 68 rint "Found path
30e0: 3a 20 22 20 70 61 74 68 29 0a 09 20 20 20 20 20 : " path)..
30f0: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 (change-director
3100: 79 20 70 61 74 68 29 29 0a 09 20 20 20 20 20 3b y path)).. ;
3110: 3b 20 28 73 65 74 21 20 6f 75 74 70 75 74 66 69 ; (set! outputfi
3120: 6c 65 6e 61 6d 65 20 28 63 6f 6e 63 20 70 61 74 lename (conc pat
3130: 68 20 22 2f 22 20 6f 75 74 70 75 74 66 69 6c 65 h "/" outputfile
3140: 6e 61 6d 65 29 29 29 0a 09 20 20 20 28 70 72 69 name))).. (pri
3150: 6e 74 20 22 4e 6f 20 73 75 63 68 20 70 61 74 68 nt "No such path
3160: 3a 20 22 20 70 61 74 68 29 29 29 0a 20 20 20 20 : " path))).
3170: 20 64 62 20 0a 20 20 20 20 20 22 53 45 4c 45 43 db . "SELEC
3180: 54 20 72 75 6e 64 69 72 2c 66 69 6e 61 6c 5f 6c T rundir,final_l
3190: 6f 67 66 20 46 52 4f 4d 20 74 65 73 74 73 20 57 ogf FROM tests W
31a0: 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e HERE run_id=? AN
31b0: 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 D testname=? AND
31c0: 20 69 74 65 6d 5f 70 61 74 68 3d 27 27 3b 22 0a item_path='';".
31d0: 20 20 20 20 20 72 75 6e 2d 69 64 20 74 65 73 74 run-id test
31e0: 2d 6e 61 6d 65 29 0a 20 20 20 20 28 70 72 69 6e -name). (prin
31f0: 74 20 22 73 75 6d 6d 61 72 69 7a 65 2d 69 74 65 t "summarize-ite
3200: 6d 73 20 77 69 74 68 20 6c 6f 67 66 20 22 20 6c ms with logf " l
3210: 6f 67 66 29 0a 20 20 20 20 28 69 66 20 28 6f 72 ogf). (if (or
3220: 20 28 65 71 75 61 6c 3f 20 6c 6f 67 66 20 22 6c (equal? logf "l
3230: 6f 67 73 2f 66 69 6e 61 6c 2e 6c 6f 67 22 29 0a ogs/final.log").
3240: 09 20 20 20 20 28 65 71 75 61 6c 3f 20 6c 6f 67 . (equal? log
3250: 66 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 f outputfilename
3260: 29 0a 09 20 20 20 20 66 6f 72 63 65 29 0a 09 28 ).. force)..(
3270: 62 65 67 69 6e 0a 09 20 20 28 69 66 20 28 6f 62 begin.. (if (ob
3280: 74 61 69 6e 2d 64 6f 74 2d 6c 6f 63 6b 20 6f 75 tain-dot-lock ou
3290: 74 70 75 74 66 69 6c 65 6e 61 6d 65 20 31 20 32 tputfilename 1 2
32a0: 30 20 33 30 29 20 3b 3b 20 72 65 74 72 79 20 65 0 30) ;; retry e
32b0: 76 65 72 79 20 73 65 63 6f 6e 64 20 66 6f 72 20 very second for
32c0: 32 30 20 73 65 63 6f 6e 64 73 2c 20 63 61 6c 6c 20 seconds, call
32d0: 20 69 74 20 64 65 61 64 20 61 66 74 65 72 20 33 it dead after 3
32e0: 30 20 73 65 63 6f 6e 64 73 20 61 6e 64 20 73 74 0 seconds and st
32f0: 65 61 6c 20 74 68 65 20 6c 6f 63 6b 0a 09 20 20 eal the lock..
3300: 20 20 20 20 28 70 72 69 6e 74 20 22 4f 62 74 61 (print "Obta
3310: 69 6e 65 64 20 6c 6f 63 6b 20 66 6f 72 20 22 20 ined lock for "
3320: 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 0a outputfilename).
3330: 09 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 46 . (print "F
3340: 61 69 6c 65 64 20 74 6f 20 6f 62 74 61 69 6e 20 ailed to obtain
3350: 6c 6f 63 6b 20 66 6f 72 20 22 20 6f 75 74 70 75 lock for " outpu
3360: 74 66 69 6c 65 6e 61 6d 65 29 29 0a 09 20 20 28 tfilename)).. (
3370: 6c 65 74 20 28 28 6f 75 70 20 20 20 20 28 6f 70 let ((oup (op
3380: 65 6e 2d 6f 75 74 70 75 74 2d 66 69 6c 65 20 6f en-output-file o
3390: 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 29 0a utputfilename)).
33a0: 09 09 28 63 6f 75 6e 74 73 20 28 6d 61 6b 65 2d ..(counts (make-
33b0: 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 09 28 hash-table))...(
33c0: 73 74 61 74 65 63 6f 75 6e 74 73 20 28 6d 61 6b statecounts (mak
33d0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 e-hash-table))..
33e0: 09 28 6f 75 74 74 78 74 20 22 22 29 0a 09 09 28 .(outtxt "")...(
33f0: 74 6f 74 20 20 20 20 30 29 29 0a 09 20 20 20 20 tot 0))..
3400: 28 77 69 74 68 2d 6f 75 74 70 75 74 2d 74 6f 2d (with-output-to-
3410: 70 6f 72 74 0a 09 09 6f 75 70 0a 09 20 20 20 20 port...oup..
3420: 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 28 (lambda ()...(
3430: 73 65 74 21 20 6f 75 74 74 78 74 20 28 63 6f 6e set! outtxt (con
3440: 63 20 6f 75 74 74 78 74 20 22 3c 68 74 6d 6c 3e c outtxt "<html>
3450: 3c 74 69 74 6c 65 3e 53 75 6d 6d 61 72 79 3a 20 <title>Summary:
3460: 22 20 74 65 73 74 2d 6e 61 6d 65 20 0a 09 09 09 " test-name ....
3470: 09 20 20 20 22 3c 2f 74 69 74 6c 65 3e 3c 62 6f . "</title><bo
3480: 64 79 3e 3c 68 32 3e 53 75 6d 6d 61 72 79 20 66 dy><h2>Summary f
3490: 6f 72 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 or " test-name "
34a0: 3c 2f 68 32 3e 22 29 29 0a 09 09 28 73 71 6c 69 </h2>"))...(sqli
34b0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
34c0: 20 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 69 64 ... (lambda (id
34d0: 20 69 74 65 6d 70 61 74 68 20 73 74 61 74 65 20 itempath state
34e0: 73 74 61 74 75 73 20 72 75 6e 5f 64 75 72 61 74 status run_durat
34f0: 69 6f 6e 20 6c 6f 67 66 20 63 6f 6d 6d 65 6e 74 ion logf comment
3500: 29 0a 09 09 20 20 20 28 68 61 73 68 2d 74 61 62 )... (hash-tab
3510: 6c 65 2d 73 65 74 21 20 63 6f 75 6e 74 73 20 73 le-set! counts s
3520: 74 61 74 75 73 20 28 2b 20 31 20 28 68 61 73 68 tatus (+ 1 (hash
3530: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
3540: 6c 74 20 63 6f 75 6e 74 73 20 73 74 61 74 75 73 lt counts status
3550: 20 30 29 29 29 0a 09 09 20 20 20 28 68 61 73 68 0)))... (hash
3560: 2d 74 61 62 6c 65 2d 73 65 74 21 20 73 74 61 74 -table-set! stat
3570: 65 63 6f 75 6e 74 73 20 73 74 61 74 65 20 28 2b ecounts state (+
3580: 20 31 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 1 (hash-table-r
3590: 65 66 2f 64 65 66 61 75 6c 74 20 73 74 61 74 65 ef/default state
35a0: 63 6f 75 6e 74 73 20 73 74 61 74 65 20 30 29 29 counts state 0))
35b0: 29 0a 09 09 20 20 20 28 73 65 74 21 20 6f 75 74 )... (set! out
35c0: 74 78 74 20 28 63 6f 6e 63 20 6f 75 74 74 78 74 txt (conc outtxt
35d0: 20 22 3c 74 72 3e 22 0a 09 09 09 09 20 20 20 20 "<tr>".....
35e0: 20 20 22 3c 74 64 3e 3c 61 20 68 72 65 66 3d 5c "<td><a href=\
35f0: 22 22 20 69 74 65 6d 70 61 74 68 20 22 2f 22 20 "" itempath "/"
3600: 6c 6f 67 66 20 22 5c 22 3e 20 22 20 69 74 65 6d logf "\"> " item
3610: 70 61 74 68 20 22 3c 2f 61 3e 3c 2f 74 64 3e 22 path "</a></td>"
3620: 20 0a 09 09 09 09 20 20 20 20 20 20 22 3c 74 64 ..... "<td
3630: 3e 22 20 73 74 61 74 65 20 20 20 20 22 3c 2f 74 >" state "</t
3640: 64 3e 22 20 0a 09 09 09 09 20 20 20 20 20 20 22 d>" ..... "
3650: 3c 74 64 3e 3c 66 6f 6e 74 20 63 6f 6c 6f 72 3d <td><font color=
3660: 22 20 28 63 6f 6d 6d 6f 6e 3a 67 65 74 2d 63 6f " (common:get-co
3670: 6c 6f 72 2d 66 72 6f 6d 2d 73 74 61 74 75 73 20 lor-from-status
3680: 73 74 61 74 75 73 29 0a 09 09 09 09 20 20 20 20 status).....
3690: 20 20 22 3e 22 20 20 20 73 74 61 74 75 73 20 20 ">" status
36a0: 20 22 3c 2f 66 6f 6e 74 3e 3c 2f 74 64 3e 22 0a "</font></td>".
36b0: 09 09 09 09 20 20 20 20 20 20 22 3c 74 64 3e 22 .... "<td>"
36c0: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 63 6f 6d (if (equal? com
36d0: 6d 65 6e 74 20 22 22 29 0a 09 09 09 09 09 09 20 ment "").......
36e0: 22 26 6e 62 73 70 3b 22 0a 09 09 09 09 09 09 20 " ".......
36f0: 63 6f 6d 6d 65 6e 74 29 20 22 3c 2f 74 64 3e 22 comment) "</td>"
3700: 0a 09 09 09 09 09 09 20 22 3c 2f 74 72 3e 22 29 ....... "</tr>")
3710: 29 29 0a 09 09 20 64 62 0a 09 09 20 22 53 45 4c ))... db... "SEL
3720: 45 43 54 20 69 64 2c 69 74 65 6d 5f 70 61 74 68 ECT id,item_path
3730: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 72 75 ,state,status,ru
3740: 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c n_duration,final
3750: 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 20 46 52 _logf,comment FR
3760: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 OM tests WHERE r
3770: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
3780: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
3790: 70 61 74 68 20 21 3d 20 27 27 3b 22 0a 09 09 20 path != '';"...
37a0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
37b0: 29 0a 0a 09 09 28 70 72 69 6e 74 20 22 3c 74 61 )....(print "<ta
37c0: 62 6c 65 3e 3c 74 72 3e 3c 74 64 20 76 61 6c 69 ble><tr><td vali
37d0: 67 6e 3d 5c 22 74 6f 70 5c 22 3e 22 29 0a 09 09 gn=\"top\">")...
37e0: 3b 3b 20 50 72 69 6e 74 20 6f 75 74 20 73 74 61 ;; Print out sta
37f0: 74 73 20 66 6f 72 20 73 74 61 74 75 73 0a 09 09 ts for status...
3800: 28 73 65 74 21 20 74 6f 74 20 30 29 0a 09 09 28 (set! tot 0)...(
3810: 70 72 69 6e 74 20 22 3c 74 61 62 6c 65 20 63 65 print "<table ce
3820: 6c 6c 73 70 61 63 69 6e 67 3d 5c 22 30 5c 22 20 llspacing=\"0\"
3830: 62 6f 72 64 65 72 3d 5c 22 31 5c 22 3e 3c 74 72 border=\"1\"><tr
3840: 3e 3c 74 64 20 63 6f 6c 73 70 61 6e 3d 5c 22 32 ><td colspan=\"2
3850: 5c 22 3e 3c 68 32 3e 53 74 61 74 65 20 73 74 61 \"><h2>State sta
3860: 74 73 3c 2f 68 32 3e 3c 2f 74 64 3e 3c 2f 74 72 ts</h2></td></tr
3870: 3e 22 29 0a 09 09 28 66 6f 72 2d 65 61 63 68 20 >")...(for-each
3880: 28 6c 61 6d 62 64 61 20 28 73 74 61 74 65 29 0a (lambda (state).
3890: 09 09 09 20 20 20 20 28 73 65 74 21 20 74 6f 74 ... (set! tot
38a0: 20 28 2b 20 74 6f 74 20 28 68 61 73 68 2d 74 61 (+ tot (hash-ta
38b0: 62 6c 65 2d 72 65 66 20 73 74 61 74 65 63 6f 75 ble-ref statecou
38c0: 6e 74 73 20 73 74 61 74 65 29 29 29 0a 09 09 09 nts state)))....
38d0: 20 20 20 20 28 70 72 69 6e 74 20 22 3c 74 72 3e (print "<tr>
38e0: 3c 74 64 3e 22 20 73 74 61 74 65 20 22 3c 2f 74 <td>" state "</t
38f0: 64 3e 3c 74 64 3e 22 20 28 68 61 73 68 2d 74 61 d><td>" (hash-ta
3900: 62 6c 65 2d 72 65 66 20 73 74 61 74 65 63 6f 75 ble-ref statecou
3910: 6e 74 73 20 73 74 61 74 65 29 20 22 3c 2f 74 64 nts state) "</td
3920: 3e 3c 2f 74 72 3e 22 29 29 0a 09 09 09 20 20 28 ></tr>")).... (
3930: 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 hash-table-keys
3940: 73 74 61 74 65 63 6f 75 6e 74 73 29 29 0a 09 09 statecounts))...
3950: 28 70 72 69 6e 74 20 22 3c 74 72 3e 3c 74 64 3e (print "<tr><td>
3960: 54 6f 74 61 6c 3c 2f 74 64 3e 3c 74 64 3e 22 20 Total</td><td>"
3970: 74 6f 74 20 22 3c 2f 74 64 3e 3c 2f 74 72 3e 3c tot "</td></tr><
3980: 2f 74 61 62 6c 65 3e 22 29 0a 09 09 28 70 72 69 /table>")...(pri
3990: 6e 74 20 22 3c 2f 74 64 3e 3c 74 64 20 76 61 6c nt "</td><td val
39a0: 69 67 6e 3d 5c 22 74 6f 70 5c 22 3e 22 29 0a 09 ign=\"top\">")..
39b0: 09 3b 3b 20 50 72 69 6e 74 20 6f 75 74 20 73 74 .;; Print out st
39c0: 61 74 73 20 66 6f 72 20 73 74 61 74 65 0a 09 09 ats for state...
39d0: 28 73 65 74 21 20 74 6f 74 20 30 29 0a 09 09 28 (set! tot 0)...(
39e0: 70 72 69 6e 74 20 22 3c 74 61 62 6c 65 20 63 65 print "<table ce
39f0: 6c 6c 73 70 61 63 69 6e 67 3d 5c 22 30 5c 22 20 llspacing=\"0\"
3a00: 62 6f 72 64 65 72 3d 5c 22 31 5c 22 3e 3c 74 72 border=\"1\"><tr
3a10: 3e 3c 74 64 20 63 6f 6c 73 70 61 6e 3d 5c 22 32 ><td colspan=\"2
3a20: 5c 22 3e 3c 68 32 3e 53 74 61 74 75 73 20 73 74 \"><h2>Status st
3a30: 61 74 73 3c 2f 68 32 3e 3c 2f 74 64 3e 3c 2f 74 ats</h2></td></t
3a40: 72 3e 22 29 0a 09 09 28 66 6f 72 2d 65 61 63 68 r>")...(for-each
3a50: 20 28 6c 61 6d 62 64 61 20 28 73 74 61 74 75 73 (lambda (status
3a60: 29 0a 09 09 09 20 20 20 20 28 73 65 74 21 20 74 ).... (set! t
3a70: 6f 74 20 28 2b 20 74 6f 74 20 28 68 61 73 68 2d ot (+ tot (hash-
3a80: 74 61 62 6c 65 2d 72 65 66 20 63 6f 75 6e 74 73 table-ref counts
3a90: 20 73 74 61 74 75 73 29 29 29 0a 09 09 09 20 20 status)))....
3aa0: 20 20 28 70 72 69 6e 74 20 22 3c 74 72 3e 3c 74 (print "<tr><t
3ab0: 64 3e 3c 66 6f 6e 74 20 63 6f 6c 6f 72 3d 5c 22 d><font color=\"
3ac0: 22 20 28 63 6f 6d 6d 6f 6e 3a 67 65 74 2d 63 6f " (common:get-co
3ad0: 6c 6f 72 2d 66 72 6f 6d 2d 73 74 61 74 75 73 20 lor-from-status
3ae0: 73 74 61 74 75 73 29 20 22 5c 22 3e 22 20 73 74 status) "\">" st
3af0: 61 74 75 73 0a 09 09 09 09 20 20 20 22 3c 2f 66 atus..... "</f
3b00: 6f 6e 74 3e 3c 2f 74 64 3e 3c 74 64 3e 22 20 28 ont></td><td>" (
3b10: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 63 hash-table-ref c
3b20: 6f 75 6e 74 73 20 73 74 61 74 75 73 29 20 22 3c ounts status) "<
3b30: 2f 74 64 3e 3c 2f 74 72 3e 22 29 29 0a 09 09 09 /td></tr>"))....
3b40: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 (hash-table-ke
3b50: 79 73 20 63 6f 75 6e 74 73 29 29 0a 09 09 28 70 ys counts))...(p
3b60: 72 69 6e 74 20 22 3c 74 72 3e 3c 74 64 3e 54 6f rint "<tr><td>To
3b70: 74 61 6c 3c 2f 74 64 3e 3c 74 64 3e 22 20 74 6f tal</td><td>" to
3b80: 74 20 22 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 t "</td></tr></t
3b90: 61 62 6c 65 3e 22 29 0a 09 09 28 70 72 69 6e 74 able>")...(print
3ba0: 20 22 3c 2f 74 64 3e 3c 2f 74 64 3e 3c 2f 74 72 "</td></td></tr
3bb0: 3e 3c 2f 74 61 62 6c 65 3e 22 29 0a 0a 09 09 28 ></table>")....(
3bc0: 70 72 69 6e 74 20 22 3c 74 61 62 6c 65 20 63 65 print "<table ce
3bd0: 6c 6c 73 70 61 63 69 6e 67 3d 5c 22 30 5c 22 20 llspacing=\"0\"
3be0: 62 6f 72 64 65 72 3d 5c 22 31 5c 22 3e 22 20 0a border=\"1\">" .
3bf0: 09 09 20 20 20 20 20 20 20 22 3c 74 72 3e 3c 74 .. "<tr><t
3c00: 64 3e 49 74 65 6d 3c 2f 74 64 3e 3c 74 64 3e 53 d>Item</td><td>S
3c10: 74 61 74 65 3c 2f 74 64 3e 3c 74 64 3e 53 74 61 tate</td><td>Sta
3c20: 74 75 73 3c 2f 74 64 3e 3c 74 64 3e 43 6f 6d 6d tus</td><td>Comm
3c30: 65 6e 74 3c 2f 74 64 3e 22 0a 09 09 20 20 20 20 ent</td>"...
3c40: 20 20 20 6f 75 74 74 78 74 20 22 3c 2f 74 61 62 outtxt "</tab
3c50: 6c 65 3e 3c 2f 62 6f 64 79 3e 3c 2f 68 74 6d 6c le></body></html
3c60: 3e 22 29 0a 09 09 28 72 65 6c 65 61 73 65 2d 64 >")...(release-d
3c70: 6f 74 2d 6c 6f 63 6b 20 6f 75 74 70 75 74 66 69 ot-lock outputfi
3c80: 6c 65 6e 61 6d 65 29 29 29 0a 09 20 20 20 20 28 lename))).. (
3c90: 63 6c 6f 73 65 2d 6f 75 74 70 75 74 2d 70 6f 72 close-output-por
3ca0: 74 20 6f 75 70 29 0a 09 20 20 20 20 28 63 68 61 t oup).. (cha
3cb0: 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 6f 72 nge-directory or
3cc0: 69 67 2d 64 69 72 29 0a 09 20 20 20 20 28 74 65 ig-dir).. (te
3cd0: 73 74 2d 73 65 74 2d 74 6f 70 6c 6f 67 21 20 64 st-set-toplog! d
3ce0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
3cf0: 6d 65 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d me outputfilenam
3d00: 65 29 0a 09 20 20 20 20 29 29 29 29 29 0a 0a 3b e).. )))))..;
3d10: 3b 20 3b 3b 20 54 4f 44 4f 3a 20 43 6f 6e 76 65 ; ;; TODO: Conve
3d20: 72 67 65 20 74 68 69 73 20 77 69 74 68 20 64 62 rge this with db
3d30: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 0a 3b :get-test-info.;
3d40: 3b 20 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ; (define (runs:
3d50: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
3d60: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
3d70: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 e item-path).;;
3d80: 20 20 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 (let ((res #f)
3d90: 29 20 3b 3b 20 28 76 65 63 74 6f 72 20 23 66 20 ) ;; (vector #f
3da0: 23 66 20 23 66 20 23 66 20 23 66 20 23 66 29 29 #f #f #f #f #f))
3db0: 29 0a 3b 3b 20 20 20 20 20 28 73 71 6c 69 74 65 ).;; (sqlite
3dc0: 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 3:for-each-row .
3dd0: 3b 3b 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ;; (lambda
3de0: 28 69 64 20 72 75 6e 2d 69 64 20 74 65 73 74 2d (id run-id test-
3df0: 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 name state statu
3e00: 73 29 0a 3b 3b 20 20 20 20 20 20 20 20 28 73 65 s).;; (se
3e10: 74 21 20 72 65 73 20 28 76 65 63 74 6f 72 20 69 t! res (vector i
3e20: 64 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 d run-id test-na
3e30: 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 me state status
3e40: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 3b 3b 20 item-path))).;;
3e50: 20 20 20 20 20 64 62 20 22 53 45 4c 45 43 54 20 db "SELECT
3e60: 69 64 2c 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 id,run_id,testna
3e70: 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 20 me,state,status
3e80: 46 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 FROM tests WHERE
3e90: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
3ea0: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
3eb0: 6d 5f 70 61 74 68 3d 3f 3b 22 0a 3b 3b 20 20 20 m_path=?;".;;
3ec0: 20 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e run-id test-n
3ed0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 3b ame item-path).;
3ee0: 3b 20 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 ; res))..(de
3ef0: 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 fine-inline (tes
3f00: 74 3a 67 65 74 2d 69 64 20 76 65 63 29 20 20 20 t:get-id vec)
3f10: 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 (vector-ref
3f20: 76 65 63 20 30 29 29 0a 28 64 65 66 69 6e 65 2d vec 0)).(define-
3f30: 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 inline (test:get
3f40: 2d 72 75 6e 5f 69 64 20 76 65 63 29 20 20 20 28 -run_id vec) (
3f50: 76 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 31 vector-ref vec 1
3f60: 29 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e )).(define-inlin
3f70: 65 20 28 74 65 73 74 3a 67 65 74 2d 74 65 73 74 e (test:get-test
3f80: 2d 6e 61 6d 65 20 76 65 63 29 28 76 65 63 74 6f -name vec)(vecto
3f90: 72 2d 72 65 66 20 76 65 63 20 32 29 29 0a 28 64 r-ref vec 2)).(d
3fa0: 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 efine-inline (te
3fb0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 76 65 63 st:get-state vec
3fc0: 29 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 ) (vector-ref
3fd0: 20 76 65 63 20 33 29 29 0a 28 64 65 66 69 6e 65 vec 3)).(define
3fe0: 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 -inline (test:ge
3ff0: 74 2d 73 74 61 74 75 73 20 76 65 63 29 20 20 20 t-status vec)
4000: 28 76 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 (vector-ref vec
4010: 34 29 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 4)).(define-inli
4020: 6e 65 20 28 74 65 73 74 3a 67 65 74 2d 69 74 65 ne (test:get-ite
4030: 6d 2d 70 61 74 68 20 76 65 63 29 28 76 65 63 74 m-path vec)(vect
4040: 6f 72 2d 72 65 66 20 76 65 63 20 35 29 29 0a 0a or-ref vec 5))..
4050: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 74 65 (define (runs:te
4060: 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61 74 68 st-get-full-path
4070: 20 74 65 73 74 29 0a 20 20 28 6c 65 74 2a 20 28 test). (let* (
4080: 28 74 65 73 74 6e 61 6d 65 20 28 64 62 3a 74 65 (testname (db:te
4090: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
40a0: 20 20 74 65 73 74 29 29 0a 09 20 28 69 74 65 6d test)).. (item
40b0: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 path (db:test-ge
40c0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 t-item-path test
40d0: 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 74 65 ))). (conc te
40e0: 73 74 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 stname (if (equa
40f0: 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 l? itempath "")
4100: 22 22 20 28 63 6f 6e 63 20 22 28 22 20 69 74 65 "" (conc "(" ite
4110: 6d 70 61 74 68 20 22 29 22 29 29 29 29 29 0a 0a mpath ")")))))..
4120: 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 (define-inline (
4130: 74 65 73 74 3a 74 65 73 74 2d 67 65 74 2d 66 75 test:test-get-fu
4140: 6c 6c 6e 61 6d 65 20 74 65 73 74 29 0a 20 20 20 llname test).
4150: 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 (conc (db:test-g
4160: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
4170: 29 0a 09 20 28 69 66 20 28 65 71 75 61 6c 3f 20 ).. (if (equal?
4180: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 (db:test-get-ite
4190: 6d 2d 70 61 74 68 20 74 65 73 74 29 20 22 22 29 m-path test) "")
41a0: 0a 09 20 20 20 20 20 22 22 0a 09 20 20 20 20 20 .. ""..
41b0: 28 63 6f 6e 63 20 22 28 22 20 28 64 62 3a 74 65 (conc "(" (db:te
41c0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
41d0: 20 74 65 73 74 29 20 22 29 22 29 29 29 29 0a 0a test) ")"))))..
41e0: 28 64 65 66 69 6e 65 20 28 63 68 65 63 6b 2d 76 (define (check-v
41f0: 61 6c 69 64 2d 69 74 65 6d 73 20 63 6c 61 73 73 alid-items class
4200: 20 69 74 65 6d 29 0a 20 20 28 6c 65 74 20 28 28 item). (let ((
4210: 76 61 6c 69 64 2d 76 61 6c 75 65 73 20 28 6c 65 valid-values (le
4220: 74 20 28 28 73 20 28 63 6f 6e 66 69 67 2d 6c 6f t ((s (config-lo
4230: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a okup *configdat*
4240: 20 22 76 61 6c 69 64 76 61 6c 75 65 73 22 20 63 "validvalues" c
4250: 6c 61 73 73 29 29 29 0a 09 09 09 28 69 66 20 73 lass)))....(if s
4260: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 (string-split s
4270: 29 20 23 66 29 29 29 29 0a 20 20 20 20 28 69 66 ) #f)))). (if
4280: 20 76 61 6c 69 64 2d 76 61 6c 75 65 73 0a 09 28 valid-values..(
4290: 69 66 20 28 6d 65 6d 62 65 72 20 69 74 65 6d 20 if (member item
42a0: 76 61 6c 69 64 2d 76 61 6c 75 65 73 29 0a 09 20 valid-values)..
42b0: 20 20 20 69 74 65 6d 20 23 66 29 0a 09 69 74 65 item #f)..ite
42c0: 6d 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 m)))..(define (t
42d0: 65 73 74 73 74 65 70 2d 73 65 74 2d 73 74 61 74 eststep-set-stat
42e0: 75 73 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 us! db run-id te
42f0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 73 74 65 70 st-name teststep
4300: 2d 6e 61 6d 65 20 73 74 61 74 65 2d 69 6e 20 73 -name state-in s
4310: 74 61 74 75 73 2d 69 6e 20 69 74 65 6d 64 61 74 tatus-in itemdat
4320: 20 63 6f 6d 6d 65 6e 74 29 0a 20 20 28 64 65 62 comment). (deb
4330: 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 2d ug:print 4 "run-
4340: 69 64 3a 20 22 20 72 75 6e 2d 69 64 20 22 20 74 id: " run-id " t
4350: 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 est-name: " test
4360: 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 28 -name). (let* (
4370: 28 73 74 61 74 65 20 20 20 20 20 28 63 68 65 63 (state (chec
4380: 6b 2d 76 61 6c 69 64 2d 69 74 65 6d 73 20 22 73 k-valid-items "s
4390: 74 61 74 65 22 20 73 74 61 74 65 2d 69 6e 29 29 tate" state-in))
43a0: 0a 09 20 28 73 74 61 74 75 73 20 20 20 20 28 63 .. (status (c
43b0: 68 65 63 6b 2d 76 61 6c 69 64 2d 69 74 65 6d 73 heck-valid-items
43c0: 20 22 73 74 61 74 75 73 22 20 73 74 61 74 75 73 "status" status
43d0: 2d 69 6e 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 -in)).. (item-pa
43e0: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 th (item-list->p
43f0: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 20 ath itemdat))..
4400: 28 74 65 73 74 64 61 74 20 20 20 28 64 62 3a 67 (testdat (db:g
4410: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 et-test-info db
4420: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
4430: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 item-path))).
4440: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 (debug:print 5
4450: 20 22 74 65 73 74 64 61 74 3a 20 22 20 74 65 73 "testdat: " tes
4460: 74 64 61 74 29 0a 20 20 20 20 28 69 66 20 28 61 tdat). (if (a
4470: 6e 64 20 74 65 73 74 64 61 74 20 3b 3b 20 69 66 nd testdat ;; if
4480: 20 74 68 65 20 73 65 63 74 69 6f 6e 20 65 78 69 the section exi
4490: 73 74 73 20 74 68 65 6e 20 66 6f 72 63 65 20 73 sts then force s
44a0: 70 65 63 69 66 69 63 61 74 69 6f 6e 20 42 55 47 pecification BUG
44b0: 2c 20 49 20 64 6f 6e 27 74 20 6c 69 6b 65 20 68 , I don't like h
44c0: 6f 77 20 74 68 69 73 20 77 6f 72 6b 73 2e 0a 09 ow this works...
44d0: 20 20 20 20 20 28 6f 72 20 28 6e 6f 74 20 73 74 (or (not st
44e0: 61 74 65 29 28 6e 6f 74 20 73 74 61 74 75 73 29 ate)(not status)
44f0: 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ))..(debug:print
4500: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 49 6e 76 0 "WARNING: Inv
4510: 61 6c 69 64 20 22 20 28 69 66 20 73 74 61 74 75 alid " (if statu
4520: 73 20 22 73 74 61 74 75 73 22 20 22 73 74 61 74 s "status" "stat
4530: 65 22 29 0a 09 20 20 20 20 20 20 20 22 20 76 61 e").. " va
4540: 6c 75 65 20 5c 22 22 20 28 69 66 20 73 74 61 74 lue \"" (if stat
4550: 75 73 20 73 74 61 74 75 73 2d 69 6e 20 73 74 61 us status-in sta
4560: 74 65 2d 69 6e 29 20 22 5c 22 2c 20 75 70 64 61 te-in) "\", upda
4570: 74 65 20 79 6f 75 72 20 76 61 6c 69 64 73 74 61 te your validsta
4580: 74 65 73 20 73 65 63 74 69 6f 6e 20 69 6e 20 6d tes section in m
4590: 65 67 61 74 65 73 74 2e 63 6f 6e 66 69 67 22 29 egatest.config")
45a0: 29 0a 20 20 20 20 28 69 66 20 74 65 73 74 64 61 ). (if testda
45b0: 74 0a 09 28 6c 65 74 20 28 28 74 65 73 74 2d 69 t..(let ((test-i
45c0: 64 20 28 74 65 73 74 3a 67 65 74 2d 69 64 20 74 d (test:get-id t
45d0: 65 73 74 64 61 74 29 29 29 0a 09 20 20 28 73 71 estdat))).. (sq
45e0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
45f0: 20 0a 09 09 09 22 49 4e 53 45 52 54 20 4f 52 20 ...."INSERT OR
4600: 52 45 50 4c 41 43 45 20 69 6e 74 6f 20 74 65 73 REPLACE into tes
4610: 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 64 t_steps (test_id
4620: 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c ,stepname,state,
4630: 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d status,event_tim
4640: 65 2c 63 6f 6d 6d 65 6e 74 29 20 56 41 4c 55 45 e,comment) VALUE
4650: 53 28 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 S(?,?,?,?,strfti
4660: 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f me('%s','now'),?
4670: 29 3b 22 0a 09 09 09 74 65 73 74 2d 69 64 20 74 );"....test-id t
4680: 65 73 74 73 74 65 70 2d 6e 61 6d 65 20 73 74 61 eststep-name sta
4690: 74 65 20 73 74 61 74 75 73 20 28 69 66 20 63 6f te status (if co
46a0: 6d 6d 65 6e 74 20 63 6f 6d 6d 65 6e 74 20 22 22 mment comment ""
46b0: 29 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e )))..(debug:prin
46c0: 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6e 27 t 0 "ERROR: Can'
46d0: 74 20 75 70 64 61 74 65 20 22 20 74 65 73 74 2d t update " test-
46e0: 6e 61 6d 65 20 22 20 66 6f 72 20 72 75 6e 20 22 name " for run "
46f0: 20 72 75 6e 2d 69 64 20 22 20 2d 3e 20 6e 6f 20 run-id " -> no
4700: 73 75 63 68 20 74 65 73 74 20 69 6e 20 64 62 22 such test in db"
4710: 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 ))))..(define (t
4720: 65 73 74 2d 67 65 74 2d 6b 69 6c 6c 2d 72 65 71 est-get-kill-req
4730: 75 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 uest db run-id t
4740: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 61 74 est-name itemdat
4750: 29 0a 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d ). (let* ((item
4760: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 -path (item-list
4770: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 ->path itemdat))
4780: 0a 09 20 28 74 65 73 74 64 61 74 20 20 20 28 64 .. (testdat (d
4790: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 b:get-test-info
47a0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
47b0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 ame item-path)))
47c0: 0a 20 20 20 20 28 65 71 75 61 6c 3f 20 28 74 65 . (equal? (te
47d0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
47e0: 74 64 61 74 29 20 22 4b 49 4c 4c 52 45 51 22 29 tdat) "KILLREQ")
47f0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 ))..(define (tes
4800: 74 2d 73 65 74 2d 6d 65 74 61 2d 69 6e 66 6f 20 t-set-meta-info
4810: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 db run-id testna
4820: 6d 65 20 69 74 65 6d 64 61 74 29 0a 20 20 28 6c me itemdat). (l
4830: 65 74 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 et ((item-path (
4840: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
4850: 69 74 65 6d 64 61 74 29 29 0a 09 28 63 70 75 6c itemdat))..(cpul
4860: 6f 61 64 20 20 28 67 65 74 2d 63 70 75 2d 6c 6f oad (get-cpu-lo
4870: 61 64 29 29 0a 09 28 68 6f 73 74 6e 61 6d 65 20 ad))..(hostname
4880: 28 67 65 74 2d 68 6f 73 74 2d 6e 61 6d 65 29 29 (get-host-name))
4890: 0a 09 28 64 69 73 6b 66 72 65 65 20 28 67 65 74 ..(diskfree (get
48a0: 2d 64 66 20 28 63 75 72 72 65 6e 74 2d 64 69 72 -df (current-dir
48b0: 65 63 74 6f 72 79 29 29 29 0a 09 28 75 6e 61 6d ectory)))..(unam
48c0: 65 20 20 20 20 28 67 65 74 2d 75 6e 61 6d 65 20 e (get-uname
48d0: 22 2d 73 72 76 70 69 6f 22 29 29 0a 09 28 72 75 "-srvpio"))..(ru
48e0: 6e 70 61 74 68 20 20 28 63 75 72 72 65 6e 74 2d npath (current-
48f0: 64 69 72 65 63 74 6f 72 79 29 29 29 0a 20 20 20 directory))).
4900: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
4910: 65 20 64 62 20 22 55 50 44 41 54 45 20 74 65 73 e db "UPDATE tes
4920: 74 73 20 53 45 54 20 68 6f 73 74 3d 3f 2c 63 70 ts SET host=?,cp
4930: 75 6c 6f 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 uload=?,diskfree
4940: 3d 3f 2c 75 6e 61 6d 65 3d 3f 2c 72 75 6e 64 69 =?,uname=?,rundi
4950: 72 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 r=? WHERE run_id
4960: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
4970: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
4980: 3f 3b 22 0a 09 09 20 20 68 6f 73 74 6e 61 6d 65 ?;"... hostname
4990: 0a 09 09 20 20 63 70 75 6c 6f 61 64 0a 09 09 20 ... cpuload...
49a0: 20 64 69 73 6b 66 72 65 65 0a 09 09 20 20 75 6e diskfree... un
49b0: 61 6d 65 0a 09 09 20 20 72 75 6e 70 61 74 68 0a ame... runpath.
49c0: 09 09 20 20 72 75 6e 2d 69 64 0a 09 09 20 20 74 .. run-id... t
49d0: 65 73 74 6e 61 6d 65 0a 09 09 20 20 69 74 65 6d estname... item
49e0: 2d 70 61 74 68 29 29 29 0a 0a 28 64 65 66 69 6e -path)))..(defin
49f0: 65 20 28 74 65 73 74 2d 75 70 64 61 74 65 2d 6d e (test-update-m
4a00: 65 74 61 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d eta-info db run-
4a10: 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d id testname item
4a20: 64 61 74 20 6d 69 6e 75 74 65 73 29 0a 20 20 28 dat minutes). (
4a30: 6c 65 74 20 28 28 69 74 65 6d 2d 70 61 74 68 20 let ((item-path
4a40: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 (item-list->path
4a50: 20 69 74 65 6d 64 61 74 29 29 0a 09 28 63 70 75 itemdat))..(cpu
4a60: 6c 6f 61 64 20 20 28 67 65 74 2d 63 70 75 2d 6c load (get-cpu-l
4a70: 6f 61 64 29 29 0a 09 28 64 69 73 6b 66 72 65 65 oad))..(diskfree
4a80: 20 28 67 65 74 2d 64 66 20 28 63 75 72 72 65 6e (get-df (curren
4a90: 74 2d 64 69 72 65 63 74 6f 72 79 29 29 29 29 0a t-directory)))).
4aa0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 70 75 (if (not cpu
4ab0: 6c 6f 61 64 29 20 20 28 62 65 67 69 6e 20 28 64 load) (begin (d
4ac0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
4ad0: 52 4e 49 4e 47 3a 20 43 50 55 4c 4f 41 44 20 6e RNING: CPULOAD n
4ae0: 6f 74 20 66 6f 75 6e 64 2e 22 29 20 20 28 73 65 ot found.") (se
4af0: 74 21 20 63 70 75 6c 6f 61 64 20 22 6e 2f 61 22 t! cpuload "n/a"
4b00: 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 ))). (if (not
4b10: 20 64 69 73 6b 66 72 65 65 29 20 28 62 65 67 69 diskfree) (begi
4b20: 6e 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 n (debug:print 0
4b30: 20 22 57 41 52 4e 49 4e 47 3a 20 44 49 53 4b 46 "WARNING: DISKF
4b40: 52 45 45 20 6e 6f 74 20 66 6f 75 6e 64 2e 22 29 REE not found.")
4b50: 20 28 73 65 74 21 20 64 69 73 6b 66 72 65 65 20 (set! diskfree
4b60: 22 6e 2f 61 22 29 29 29 0a 20 20 20 20 28 69 66 "n/a"))). (if
4b70: 20 28 6e 6f 74 20 69 74 65 6d 2d 70 61 74 68 29 (not item-path)
4b80: 28 62 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 (begin (debug:pr
4b90: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
4ba0: 49 54 45 4d 50 41 54 48 20 6e 6f 74 20 73 65 74 ITEMPATH not set
4bb0: 2e 22 29 20 20 20 28 73 65 74 21 20 69 74 65 6d .") (set! item
4bc0: 2d 70 61 74 68 20 22 22 29 29 29 0a 20 20 20 20 -path ""))).
4bd0: 3b 3b 20 28 6c 65 74 20 28 28 74 65 73 74 69 6e ;; (let ((testin
4be0: 66 6f 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d fo (db:get-test-
4bf0: 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 info db run-id t
4c00: 65 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 estname item-pat
4c10: 68 29 29 29 0a 20 20 20 20 3b 3b 20 20 20 28 69 h))). ;; (i
4c20: 66 20 28 61 6e 64 20 28 6e 6f 74 20 28 65 71 75 f (and (not (equ
4c30: 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 al? (db:test-get
4c40: 2d 73 74 61 74 75 73 20 74 65 73 74 69 6e 66 6f -status testinfo
4c50: 29 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 0a ) "COMPLETED")).
4c60: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 20 20 ;;
4c70: 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 (not (equal? (
4c80: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 db:test-get-stat
4c90: 75 73 20 74 65 73 74 69 6e 66 6f 29 20 22 4b 49 us testinfo) "KI
4ca0: 4c 4c 52 45 51 22 29 29 0a 20 20 20 20 28 73 71 LLREQ")). (sq
4cb0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 0a 20 20 lite3:execute.
4cc0: 20 20 20 64 62 0a 20 20 20 20 20 22 55 50 44 41 db. "UPDA
4cd0: 54 45 20 74 65 73 74 73 20 53 45 54 20 63 70 75 TE tests SET cpu
4ce0: 6c 6f 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 3d load=?,diskfree=
4cf0: 3f 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 3d 3f ?,run_duration=?
4d00: 2c 73 74 61 74 65 3d 27 52 55 4e 4e 49 4e 47 27 ,state='RUNNING'
4d10: 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 WHERE run_id=?
4d20: 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 AND testname=? A
4d30: 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 20 41 ND item_path=? A
4d40: 4e 44 20 73 74 61 74 65 20 4e 4f 54 20 49 4e 20 ND state NOT IN
4d50: 28 27 43 4f 4d 50 4c 45 54 45 44 27 2c 27 4b 49 ('COMPLETED','KI
4d60: 4c 4c 52 45 51 27 2c 27 4b 49 4c 4c 45 44 27 29 LLREQ','KILLED')
4d70: 3b 22 0a 20 20 20 20 20 63 70 75 6c 6f 61 64 0a ;". cpuload.
4d80: 20 20 20 20 20 64 69 73 6b 66 72 65 65 0a 20 20 diskfree.
4d90: 20 20 20 6d 69 6e 75 74 65 73 0a 20 20 20 20 20 minutes.
4da0: 72 75 6e 2d 69 64 0a 20 20 20 20 20 74 65 73 74 run-id. test
4db0: 6e 61 6d 65 0a 20 20 20 20 20 69 74 65 6d 2d 70 name. item-p
4dc0: 61 74 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 ath)))..(define
4dd0: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e (set-megatest-en
4de0: 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 v-vars db run-id
4df0: 29 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 ). (let ((keys
4e00: 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 (db-get-keys db)
4e10: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
4e20: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 09 (lambda (key)..
4e30: 09 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 .(sqlite3:for-ea
4e40: 63 68 2d 72 6f 77 0a 09 09 20 28 6c 61 6d 62 64 ch-row... (lambd
4e50: 61 20 28 76 61 6c 29 0a 09 09 20 20 20 28 64 65 a (val)... (de
4e60: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 bug:print 2 "set
4e70: 65 6e 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 env " (key:get-f
4e80: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 ieldname key) "
4e90: 22 20 76 61 6c 29 0a 09 09 20 20 20 28 73 65 74 " val)... (set
4ea0: 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 env (key:get-fie
4eb0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29 ldname key) val)
4ec0: 29 0a 09 09 20 64 62 20 0a 09 09 20 28 63 6f 6e )... db ... (con
4ed0: 63 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 c "SELECT " (key
4ee0: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b :get-fieldname k
4ef0: 65 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 ey) " FROM runs
4f00: 57 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 09 WHERE id=?;")...
4f10: 20 72 75 6e 2d 69 64 29 29 0a 09 20 20 20 20 20 run-id))..
4f20: 20 6b 65 79 73 29 29 29 0a 0a 28 64 65 66 69 6e keys)))..(defin
4f30: 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76 2d e (set-item-env-
4f40: 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a 20 20 vars itemdat).
4f50: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
4f60: 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20 20 20 a (item)..
4f70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
4f80: 73 65 74 65 6e 76 20 22 20 28 63 61 72 20 69 74 setenv " (car it
4f90: 65 6d 29 20 22 20 22 20 28 63 61 64 72 20 69 74 em) " " (cadr it
4fa0: 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73 65 74 em)).. (set
4fb0: 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29 20 28 env (car item) (
4fc0: 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09 20 20 cadr item)))..
4fd0: 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28 64 65 itemdat))..(de
4fe0: 66 69 6e 65 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 fine (get-all-le
4ff0: 67 61 6c 2d 74 65 73 74 73 29 0a 20 20 28 6c 65 gal-tests). (le
5000: 74 2a 20 28 28 74 65 73 74 73 20 20 28 67 6c 6f t* ((tests (glo
5010: 62 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 b (conc *toppath
5020: 2a 20 22 2f 74 65 73 74 73 2f 2a 22 29 29 29 0a * "/tests/*"))).
5030: 09 20 28 72 65 73 20 20 20 20 27 28 29 29 29 0a . (res '())).
5040: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5050: 20 34 20 22 49 4e 46 4f 3a 20 4c 6f 6f 6b 69 6e 4 "INFO: Lookin
5060: 67 20 61 74 20 74 65 73 74 73 20 22 20 28 73 74 g at tests " (st
5070: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
5080: 20 74 65 73 74 73 20 22 2c 22 29 29 0a 20 20 20 tests ",")).
5090: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 (for-each (lamb
50a0: 64 61 20 28 74 65 73 74 70 61 74 68 29 0a 09 09 da (testpath)...
50b0: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 (if (file-exists
50c0: 3f 20 28 63 6f 6e 63 20 74 65 73 74 70 61 74 68 ? (conc testpath
50d0: 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 "/testconfig"))
50e0: 0a 09 09 20 20 20 20 28 73 65 74 21 20 72 65 73 ... (set! res
50f0: 20 28 63 6f 6e 73 20 28 6c 61 73 74 20 28 73 74 (cons (last (st
5100: 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 ring-split testp
5110: 61 74 68 20 22 2f 22 29 29 20 72 65 73 29 29 29 ath "/")) res)))
5120: 29 0a 09 20 20 20 20 20 20 74 65 73 74 73 29 0a ).. tests).
5130: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 res))..(defi
5140: 6e 65 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e ne (runs:can-run
5150: 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a -more-tests db).
5160: 20 20 28 6c 65 74 20 28 28 6e 75 6d 2d 72 75 6e (let ((num-run
5170: 6e 69 6e 67 20 28 64 62 3a 67 65 74 2d 63 6f 75 ning (db:get-cou
5180: 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 nt-tests-running
5190: 20 64 62 29 29 0a 09 28 6d 61 78 2d 63 6f 6e 63 db))..(max-conc
51a0: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e urrent-jobs (con
51b0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 fig-lookup *conf
51c0: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 igdat* "setup" "
51d0: 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a max_concurrent_j
51e0: 6f 62 73 22 29 29 29 0a 20 20 20 20 28 64 65 62 obs"))). (deb
51f0: 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d ug:print 2 "max-
5200: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a concurrent-jobs:
5210: 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e " max-concurren
5220: 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 t-jobs ", num-ru
5230: 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e nning: " num-run
5240: 6e 69 6e 67 29 0a 20 20 20 20 28 69 66 20 28 6e ning). (if (n
5250: 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 ot (eq? 0 *globa
5260: 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 lexitstatus*))..
5270: 23 66 0a 09 28 69 66 20 28 6f 72 20 28 6e 6f 74 #f..(if (or (not
5280: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
5290: 6a 6f 62 73 29 0a 09 09 28 61 6e 64 20 6d 61 78 jobs)...(and max
52a0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
52b0: 0a 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d ... (string-
52c0: 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 >number max-conc
52d0: 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 20 urrent-jobs)...
52e0: 20 20 20 20 28 6e 6f 74 20 28 3e 3d 20 6e 75 6d (not (>= num
52f0: 2d 72 75 6e 6e 69 6e 67 20 28 73 74 72 69 6e 67 -running (string
5300: 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e ->number max-con
5310: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29 29 29 current-jobs))))
5320: 29 0a 09 20 20 20 20 23 74 0a 09 20 20 20 20 28 ).. #t.. (
5330: 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 begin .. (d
5340: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
5350: 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 RNING: Max runni
5360: 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 ng jobs exceeded
5370: 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 , current number
5380: 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d running: " num-
5390: 72 75 6e 6e 69 6e 67 20 0a 09 09 09 20 20 20 22 running .... "
53a0: 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 , max_concurrent
53b0: 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e _jobs: " max-con
53c0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 20 current-jobs)..
53d0: 20 20 20 20 20 23 66 29 29 29 29 29 0a 20 20 0a #f))))). .
53e0: 28 64 65 66 69 6e 65 20 28 72 75 6e 2d 74 65 73 (define (run-tes
53f0: 74 73 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 73 ts db test-names
5400: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 ). (let* ((keys
5410: 20 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d (db-get-
5420: 6b 65 79 73 20 64 62 29 29 0a 09 20 28 6b 65 79 keys db)).. (key
5430: 76 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 2d 3e vallst (keys->
5440: 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 vallist keys #t)
5450: 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 ).. (run-id
5460: 20 28 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 (register-run d
5470: 62 20 6b 65 79 73 29 29 20 20 3b 3b 20 20 74 65 b keys)) ;; te
5480: 73 74 2d 6e 61 6d 65 29 29 29 0a 09 20 28 64 65 st-name))).. (de
5490: 66 65 72 72 65 64 20 20 20 20 27 28 29 29 29 20 ferred '()))
54a0: 3b 3b 20 64 65 6c 61 79 20 72 75 6e 6e 69 6e 67 ;; delay running
54b0: 20 74 68 65 73 65 20 73 69 6e 63 65 20 74 68 65 these since the
54c0: 79 20 68 61 76 65 20 61 20 77 61 69 74 6f 6e 20 y have a waiton
54d0: 63 6c 61 75 73 65 0a 20 20 20 20 3b 3b 20 6f 6e clause. ;; on
54e0: 20 74 68 65 20 66 69 72 73 74 20 70 61 73 73 20 the first pass
54f0: 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 or call to run-t
5500: 65 73 74 73 20 73 65 74 20 46 41 49 4c 53 20 74 ests set FAILS t
5510: 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66 o NOT_STARTED if
5520: 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 . ;; -keepgoi
5530: 6e 67 20 69 73 20 73 70 65 63 69 66 69 65 64 0a ng is specified.
5540: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 65 71 (if (and (eq
5550: 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 ? *passnum* 0)..
5560: 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 (args:get-a
5570: 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 rg "-keepgoing")
5580: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 )..(begin.. ;;
5590: 68 61 76 65 20 74 6f 20 64 65 6c 65 74 65 20 74 have to delete t
55a0: 65 73 74 20 72 65 63 6f 72 64 73 20 77 68 65 72 est records wher
55b0: 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 69 e NOT_STARTED si
55c0: 6e 63 65 20 74 68 65 79 20 63 61 6e 20 63 61 75 nce they can cau
55d0: 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f se -keepgoing to
55e0: 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 74 75 63 .. ;; get stuc
55f0: 6b 20 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e k due to becomin
5600: 67 20 69 6e 61 63 63 65 73 73 69 62 6c 65 20 66 g inaccessible f
5610: 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 74 65 73 rom a failed tes
5620: 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 73 74 20 t. I.e. if test
5630: 42 20 64 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b B depends .. ;;
5640: 20 6f 6e 20 74 65 73 74 20 41 20 62 75 74 20 74 on test A but t
5650: 65 73 74 20 42 20 72 65 61 63 68 65 64 20 74 68 est B reached th
5660: 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 e point on being
5670: 20 72 65 67 69 73 74 65 72 65 64 20 61 73 20 4e registered as N
5680: 4f 54 5f 53 54 41 52 54 45 44 20 61 6e 64 20 74 OT_STARTED and t
5690: 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c est.. ;; A fail
56a0: 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 ed for some reas
56b0: 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 on then on re-ru
56c0: 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 n using -keepgoi
56d0: 6e 67 20 74 68 65 20 72 75 6e 20 63 61 6e 20 6e ng the run can n
56e0: 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 ever complete...
56f0: 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 (db:delete-tes
5700: 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 62 20 72 ts-in-state db r
5710: 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 41 52 54 un-id "NOT_START
5720: 45 44 22 29 0a 09 20 20 28 64 62 3a 73 65 74 2d ED").. (db:set-
5730: 74 65 73 74 73 2d 73 74 61 74 65 2d 73 74 61 74 tests-state-stat
5740: 75 73 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 us db run-id tes
5750: 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 41 49 4c t-names #f "FAIL
5760: 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 20 " "NOT_STARTED"
5770: 22 46 41 49 4c 22 29 29 29 0a 20 20 20 20 28 73 "FAIL"))). (s
5780: 65 74 21 20 2a 70 61 73 73 6e 75 6d 2a 20 28 2b et! *passnum* (+
5790: 20 2a 70 61 73 73 6e 75 6d 2a 20 31 29 29 0a 20 *passnum* 1)).
57a0: 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 6e (let loop ((n
57b0: 75 6d 74 69 6d 65 73 20 30 29 29 0a 20 20 20 20 umtimes 0)).
57c0: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
57d0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 (lambda (tes
57e0: 74 2d 6e 61 6d 65 29 0a 09 20 28 69 66 20 28 72 t-name).. (if (r
57f0: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
5800: 2d 74 65 73 74 73 20 64 62 29 0a 09 20 20 20 20 -tests db)..
5810: 20 28 72 75 6e 2d 6f 6e 65 2d 74 65 73 74 20 64 (run-one-test d
5820: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
5830: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 29 0a 09 20 me keyvallst)..
5840: 20 20 20 20 3b 3b 20 61 64 64 20 73 6f 6d 65 20 ;; add some
5850: 64 65 6c 61 79 20 0a 09 20 20 20 20 20 3b 28 73 delay .. ;(s
5860: 6c 65 65 70 20 32 29 0a 09 20 20 20 20 20 29 29 leep 2).. ))
5870: 0a 20 20 20 20 20 20 20 74 65 73 74 2d 6e 61 6d . test-nam
5880: 65 73 29 0a 20 20 20 20 20 20 3b 3b 20 28 72 75 es). ;; (ru
5890: 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 73 20 n-waiting-tests
58a0: 64 62 29 0a 20 20 20 20 20 20 28 69 66 20 28 61 db). (if (a
58b0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6b 65 rgs:get-arg "-ke
58c0: 65 70 67 6f 69 6e 67 22 29 0a 09 20 20 28 6c 65 epgoing").. (le
58d0: 74 20 28 28 65 73 74 72 65 6d 20 28 64 62 3a 65 t ((estrem (db:e
58e0: 73 74 69 6d 61 74 65 64 2d 74 65 73 74 73 2d 72 stimated-tests-r
58f0: 65 6d 61 69 6e 69 6e 67 20 64 62 20 72 75 6e 2d emaining db run-
5900: 69 64 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 id))).. (if (
5910: 61 6e 64 20 28 3e 20 65 73 74 72 65 6d 20 30 29 and (> estrem 0)
5920: 0a 09 09 20 20 20 20 20 28 65 71 3f 20 2a 67 6c ... (eq? *gl
5930: 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 obalexitstatus*
5940: 30 29 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 0))...(begin...
5950: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5960: 22 4b 65 65 70 20 67 6f 69 6e 67 2c 20 65 73 74 "Keep going, est
5970: 69 6d 61 74 65 64 20 22 20 65 73 74 72 65 6d 20 imated " estrem
5980: 22 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e " tests remainin
5990: 67 20 74 6f 20 72 75 6e 2c 20 77 69 6c 6c 20 63 g to run, will c
59a0: 6f 6e 74 69 6e 75 65 20 69 6e 20 33 20 73 65 63 ontinue in 3 sec
59b0: 6f 6e 64 73 20 2e 2e 2e 22 29 0a 09 09 20 20 28 onds ...")... (
59c0: 73 6c 65 65 70 20 33 29 0a 09 09 20 20 28 72 75 sleep 3)... (ru
59d0: 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 73 20 n-waiting-tests
59e0: 64 62 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 2b db)... (loop (+
59f0: 20 6e 75 6d 74 69 6d 65 73 20 31 29 29 29 29 29 numtimes 1)))))
5a00: 29 29 29 29 0a 09 20 20 20 0a 3b 3b 20 56 45 52 )))).. .;; VER
5a10: 59 20 49 4e 45 46 46 49 43 49 45 4e 54 21 20 4d Y INEFFICIENT! M
5a20: 6f 76 65 20 73 74 75 66 66 20 74 68 61 74 20 73 ove stuff that s
5a30: 68 6f 75 6c 64 20 62 65 20 64 6f 6e 65 20 6f 6e hould be done on
5a40: 63 65 20 75 70 20 74 6f 20 63 61 6c 6c 69 6e 67 ce up to calling
5a50: 20 70 72 6f 63 0a 28 64 65 66 69 6e 65 20 28 72 proc.(define (r
5a60: 75 6e 2d 6f 6e 65 2d 74 65 73 74 20 64 62 20 72 un-one-test db r
5a70: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
5a80: 6b 65 79 76 61 6c 6c 73 74 29 0a 20 20 28 64 65 keyvallst). (de
5a90: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4c 61 75 bug:print 1 "Lau
5aa0: 6e 63 68 69 6e 67 20 74 65 73 74 20 22 20 74 65 nching test " te
5ab0: 73 74 2d 6e 61 6d 65 29 0a 20 20 3b 3b 20 41 6c st-name). ;; Al
5ac0: 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 l these vars mig
5ad0: 68 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 ht be referenced
5ae0: 20 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 by the testconf
5af0: 69 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 ig file reader.
5b00: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 (setenv "MT_TES
5b10: 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d T_NAME" test-nam
5b20: 65 29 20 3b 3b 20 0a 20 20 28 73 65 74 65 6e 76 e) ;; . (setenv
5b30: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 "MT_RUNNAME"
5b40: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a (args:get-arg ":
5b50: 72 75 6e 6e 61 6d 65 22 29 29 0a 20 20 28 73 65 runname")). (se
5b60: 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 t-megatest-env-v
5b70: 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b ars db run-id) ;
5b80: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e ; these may be n
5b90: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 eeded by the lau
5ba0: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 nching process.
5bb0: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f (change-directo
5bc0: 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 20 20 ry *toppath*).
5bd0: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 (let* ((test-pat
5be0: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 h (conc *topp
5bf0: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 ath* "/tests/" t
5c00: 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 28 74 65 est-name)).. (te
5c10: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 st-configf (conc
5c20: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 test-path "/tes
5c30: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 74 65 tconfig")).. (te
5c40: 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 stexists (and
5c50: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 (file-exists? te
5c60: 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 st-configf)(file
5c70: 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 -read-access? te
5c80: 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 st-configf)))..
5c90: 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 (test-conf (i
5ca0: 66 20 74 65 73 74 65 78 69 73 74 73 20 28 72 65 f testexists (re
5cb0: 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 ad-config test-c
5cc0: 6f 6e 66 69 67 66 20 23 66 20 23 74 29 20 28 6d onfigf #f #t) (m
5cd0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
5ce0: 29 0a 09 20 28 77 61 69 74 6f 6e 20 20 20 20 20 ).. (waiton
5cf0: 20 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 (let ((w (conf
5d00: 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 ig-lookup test-c
5d10: 6f 6e 66 20 22 72 65 71 75 69 72 65 6d 65 6e 74 onf "requirement
5d20: 73 22 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 s" "waiton")))..
5d30: 09 09 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 .. (if (string?
5d40: 77 29 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 w)(string-split
5d50: 77 29 27 28 29 29 29 29 0a 09 20 28 74 61 67 73 w)'()))).. (tags
5d60: 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 (let ((
5d70: 74 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 t (config-lookup
5d80: 20 74 65 73 74 2d 63 6f 6e 66 20 22 73 65 74 75 test-conf "setu
5d90: 70 22 20 22 74 61 67 73 22 29 29 29 0a 09 09 09 p" "tags")))....
5da0: 20 3b 3b 20 77 65 20 77 61 6e 74 20 6f 75 72 20 ;; we want our
5db0: 74 61 67 73 20 74 6f 20 62 65 20 73 65 70 61 72 tags to be separ
5dc0: 61 74 65 64 20 62 79 20 63 6f 6d 6d 61 73 20 61 ated by commas a
5dd0: 6e 64 20 66 75 6c 6c 79 20 64 65 6c 69 6d 69 74 nd fully delimit
5de0: 65 64 20 62 79 20 63 6f 6d 6d 61 73 0a 09 09 09 ed by commas....
5df0: 20 3b 3b 20 73 6f 20 74 68 61 74 20 71 75 65 72 ;; so that quer
5e00: 69 65 73 20 77 69 74 68 20 22 6c 69 6b 65 22 20 ies with "like"
5e10: 63 61 6e 20 74 69 65 20 74 6f 20 74 68 65 20 63 can tie to the c
5e20: 6f 6d 6d 61 73 20 61 74 20 65 69 74 68 65 72 20 ommas at either
5e30: 65 6e 64 20 6f 66 20 65 61 63 68 20 74 61 67 0a end of each tag.
5e40: 09 09 09 20 3b 3b 20 77 68 69 6c 65 20 61 6c 73 ... ;; while als
5e50: 6f 20 61 6c 6c 6f 77 69 6e 67 20 74 68 65 20 65 o allowing the e
5e60: 6e 64 20 75 73 65 72 20 74 6f 20 66 72 65 65 6c nd user to freel
5e70: 79 20 75 73 65 20 73 70 61 63 65 73 20 61 6e 64 y use spaces and
5e80: 20 63 6f 6d 6d 61 73 20 74 6f 20 73 65 70 61 72 commas to separ
5e90: 61 74 65 20 74 61 67 73 0a 09 09 09 20 28 69 66 ate tags.... (if
5ea0: 20 28 73 74 72 69 6e 67 3f 20 74 29 28 73 74 72 (string? t)(str
5eb0: 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 ing-substitute (
5ec0: 72 65 67 65 78 70 20 22 5b 2c 5c 5c 73 5d 2b 22 regexp "[,\\s]+"
5ed0: 29 20 22 2c 22 20 28 63 6f 6e 63 20 22 2c 22 20 ) "," (conc ","
5ee0: 74 20 22 2c 22 29 20 23 74 29 0a 09 09 09 20 20 t ",") #t)....
5ef0: 20 20 20 27 28 29 29 29 29 29 0a 20 20 20 20 28 '())))). (
5f00: 69 66 20 28 6e 6f 74 20 74 65 73 74 65 78 69 73 if (not testexis
5f10: 74 73 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 ts)..(begin.. (
5f20: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
5f30: 52 52 4f 52 3a 20 43 61 6e 27 74 20 66 69 6e 64 RROR: Can't find
5f40: 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 22 20 74 config file " t
5f50: 65 73 74 2d 63 6f 6e 66 69 67 66 29 0a 09 20 20 est-configf)..
5f60: 28 65 78 69 74 20 32 29 29 0a 09 3b 3b 20 70 75 (exit 2))..;; pu
5f70: 74 20 74 6f 70 20 76 61 72 73 20 69 6e 74 6f 20 t top vars into
5f80: 63 6f 6e 76 65 6e 69 65 6e 74 20 76 61 72 69 61 convenient varia
5f90: 62 6c 65 73 20 61 6e 64 20 6f 70 65 6e 20 74 68 bles and open th
5fa0: 65 20 64 62 0a 09 28 6c 65 74 2a 20 28 3b 3b 20 e db..(let* (;;
5fb0: 64 62 20 69 73 20 61 6c 77 61 79 73 20 61 74 20 db is always at
5fc0: 2a 74 6f 70 70 61 74 68 2a 2f 64 62 2f 6d 65 67 *toppath*/db/meg
5fd0: 61 74 65 73 74 2e 64 62 0a 09 20 20 20 20 20 20 atest.db..
5fe0: 20 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 68 (items (h
5ff0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
6000: 66 61 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 fault test-conf
6010: 22 69 74 65 6d 73 22 20 27 28 29 29 29 0a 09 20 "items" '()))..
6020: 20 20 20 20 20 20 28 69 74 65 6d 73 74 61 62 6c (itemstabl
6030: 65 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 e (hash-table-r
6040: 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d ef/default test-
6050: 63 6f 6e 66 20 22 69 74 65 6d 73 74 61 62 6c 65 conf "itemstable
6060: 22 20 27 28 29 29 29 0a 09 20 20 20 20 20 20 20 " '()))..
6070: 28 61 6c 6c 69 74 65 6d 73 20 20 20 20 28 69 66 (allitems (if
6080: 20 28 6f 72 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (or (not (null?
6090: 20 69 74 65 6d 73 29 29 28 6e 6f 74 20 28 6e 75 items))(not (nu
60a0: 6c 6c 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 ll? itemstable))
60b0: 29 0a 09 09 09 09 28 61 70 70 65 6e 64 20 28 69 ).....(append (i
60c0: 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d tem-assoc->item-
60d0: 6c 69 73 74 20 69 74 65 6d 73 29 0a 09 09 09 09 list items).....
60e0: 09 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 .(item-table->it
60f0: 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 em-list itemstab
6100: 6c 65 29 29 0a 09 09 09 09 27 28 28 29 29 29 29 le)).....'(())))
6110: 20 3b 3b 20 61 20 6c 69 73 74 20 77 69 74 68 20 ;; a list with
6120: 6f 6e 65 20 6e 75 6c 6c 20 6c 69 73 74 20 69 73 one null list is
6130: 20 61 20 74 65 73 74 20 77 69 74 68 20 6e 6f 20 a test with no
6140: 69 74 65 6d 73 0a 09 20 20 20 20 20 20 20 28 72 items.. (r
6150: 75 6e 63 6f 6e 66 69 67 66 20 20 28 63 6f 6e 63 unconfigf (conc
6160: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 *toppath* "/ru
6170: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 nconfigs.config"
6180: 29 29 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 ))).. (debug:pr
6190: 69 6e 74 20 31 20 22 69 74 65 6d 73 3a 20 22 29 int 1 "items: ")
61a0: 0a 09 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 .. (if (>= *ver
61b0: 62 6f 73 69 74 79 2a 20 31 29 28 70 70 20 61 6c bosity* 1)(pp al
61c0: 6c 69 74 65 6d 73 29 29 0a 09 20 20 28 69 66 20 litems)).. (if
61d0: 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 (>= *verbosity*
61e0: 35 29 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e 5).. (begin
61f0: 0a 09 09 28 70 72 69 6e 74 20 22 69 74 65 6d 73 ...(print "items
6200: 3a 20 22 29 28 70 70 20 28 69 74 65 6d 2d 61 73 : ")(pp (item-as
6210: 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 soc->item-list i
6220: 74 65 6d 73 29 29 0a 09 09 28 70 72 69 6e 74 20 tems))...(print
6230: 22 69 74 65 73 74 61 62 6c 65 3a 20 22 29 28 70 "itestable: ")(p
6240: 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 p (item-table->i
6250: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 tem-list itemsta
6260: 62 6c 65 29 29 29 29 0a 09 20 20 28 69 66 20 28 ble)))).. (if (
6270: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6d args:get-arg "-m
6280: 22 29 0a 09 20 20 20 20 20 20 28 64 62 3a 73 65 ").. (db:se
6290: 74 2d 63 6f 6d 6d 65 6e 74 2d 66 6f 72 2d 72 75 t-comment-for-ru
62a0: 6e 20 64 62 20 72 75 6e 2d 69 64 20 28 61 72 67 n db run-id (arg
62b0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 6d 22 29 29 s:get-arg "-m"))
62c0: 29 0a 0a 09 20 20 3b 3b 20 48 65 72 65 20 69 73 )... ;; Here is
62d0: 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 5f where the test_
62e0: 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 65 meta table is be
62f0: 73 74 20 75 70 64 61 74 65 64 0a 09 20 20 28 72 st updated.. (r
6300: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f uns:update-test_
6310: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d meta db test-nam
6320: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 0a 09 20 e test-conf)...
6330: 20 3b 3b 20 62 72 61 69 6e 64 65 61 64 20 77 6f ;; braindead wo
6340: 72 6b 2d 61 72 6f 75 6e 64 20 66 6f 72 20 70 6f rk-around for po
6350: 6f 72 6c 79 20 73 70 65 63 69 66 69 65 64 20 61 orly specified a
6360: 6c 6c 69 74 65 6d 73 20 6c 69 73 74 20 42 55 47 llitems list BUG
6370: 21 21 21 20 46 49 58 4d 45 0a 09 20 20 28 69 66 !!! FIXME.. (if
6380: 20 28 6e 75 6c 6c 3f 20 61 6c 6c 69 74 65 6d 73 (null? allitems
6390: 29 28 73 65 74 21 20 61 6c 6c 69 74 65 6d 73 20 )(set! allitems
63a0: 27 28 28 29 29 29 29 0a 09 20 20 28 6c 65 74 20 '(()))).. (let
63b0: 6c 6f 6f 70 20 28 28 69 74 65 6d 64 61 74 20 28 loop ((itemdat (
63c0: 63 61 72 20 61 6c 6c 69 74 65 6d 73 29 29 0a 09 car allitems))..
63d0: 09 20 20 20 20 20 28 74 61 6c 20 20 20 20 20 28 . (tal (
63e0: 63 64 72 20 61 6c 6c 69 74 65 6d 73 29 29 29 0a cdr allitems))).
63f0: 09 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 . ;; (lambda
6400: 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 (itemdat) ;;; ((
6410: 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 ripeness "overri
6420: 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 pe") (temperatur
6430: 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f e "cool") (seaso
6440: 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 09 20 20 n "summer"))..
6450: 20 20 3b 3b 20 48 61 6e 64 6c 65 20 6c 69 73 74 ;; Handle list
6460: 73 20 6f 66 20 69 74 65 6d 73 0a 09 20 20 20 20 s of items..
6470: 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 (let* ((item-pat
6480: 68 20 20 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 h (item-list
6490: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 ->path itemdat))
64a0: 20 3b 3b 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 ;; (string-inte
64b0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 63 61 64 rsperse (map cad
64c0: 72 20 69 74 65 6d 64 61 74 29 20 22 2f 22 29 29 r itemdat) "/"))
64d0: 0a 09 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d ... (new-test-
64e0: 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 path (string-int
64f0: 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 ersperse (cons t
6500: 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 est-path (map ca
6510: 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 dr itemdat)) "/"
6520: 29 29 0a 09 09 20 20 20 28 6e 65 77 2d 74 65 73 ))... (new-tes
6530: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 t-name (if (equa
6540: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 l? item-path "")
6550: 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 test-name (conc
6560: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 test-name "/" i
6570: 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a tem-path))) ;; j
6580: 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 ust need it to b
6590: 65 20 75 6e 69 71 75 65 0a 09 09 20 20 20 28 74 e unique... (t
65a0: 65 73 74 64 61 74 20 20 20 23 66 29 0a 09 09 20 estdat #f)...
65b0: 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 (num-running (
65c0: 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 db:get-count-tes
65d0: 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a ts-running db)).
65e0: 09 09 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 .. (max-concur
65f0: 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 rent-jobs (confi
6600: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
6610: 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 dat* "setup" "ma
6620: 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 x_concurrent_job
6630: 73 22 29 29 0a 09 09 20 20 20 28 70 61 72 65 6e s"))... (paren
6640: 74 2d 74 65 73 74 20 28 61 6e 64 20 28 6e 6f 74 t-test (and (not
6650: 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 29 28 (null? items))(
6660: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
6670: 20 22 22 29 29 29 0a 09 09 20 20 20 28 73 69 6e "")))... (sin
6680: 67 6c 65 2d 74 65 73 74 20 28 61 6e 64 20 28 6e gle-test (and (n
6690: 75 6c 6c 3f 20 69 74 65 6d 73 29 20 28 65 71 75 ull? items) (equ
66a0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 al? item-path ""
66b0: 29 29 29 0a 09 09 20 20 20 28 69 74 65 6d 2d 74 )))... (item-t
66c0: 65 73 74 20 20 20 28 6e 6f 74 20 28 65 71 75 61 est (not (equa
66d0: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 l? item-path "")
66e0: 29 29 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 ))).. (debu
66f0: 67 3a 70 72 69 6e 74 20 33 20 22 6d 61 78 2d 63 g:print 3 "max-c
6700: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 oncurrent-jobs:
6710: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
6720: 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e -jobs ", num-run
6730: 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e ning: " num-runn
6740: 69 6e 67 29 0a 09 20 20 20 20 20 20 28 69 66 20 ing).. (if
6750: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f (runs:can-run-mo
6760: 72 65 2d 74 65 73 74 73 20 64 62 29 0a 09 09 20 re-tests db)...
6770: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 6c (begin... (l
6780: 65 74 20 6c 6f 6f 70 32 20 28 28 74 73 20 28 64 et loop2 ((ts (d
6790: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 b:get-test-info
67a0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
67b0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 20 ame item-path))
67c0: 3b 3b 20 23 66 29 0a 09 09 09 09 28 63 74 20 30 ;; #f).....(ct 0
67d0: 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 ))... (if (
67e0: 61 6e 64 20 28 6e 6f 74 20 74 73 29 0a 09 09 09 and (not ts)....
67f0: 20 20 20 20 20 20 20 28 3c 20 63 74 20 31 30 29 (< ct 10)
6800: 29 0a 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 ).... (begin...
6810: 09 20 20 20 20 28 72 65 67 69 73 74 65 72 2d 74 . (register-t
6820: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 est db run-id te
6830: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
6840: 68 29 0a 09 09 09 20 20 20 20 28 64 62 3a 74 65 h).... (db:te
6850: 73 74 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 64 st-set-comment d
6860: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
6870: 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 me item-path "")
6880: 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 28 .... (loop2 (
6890: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f db:get-test-info
68a0: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
68b0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a name item-path).
68c0: 09 09 09 09 20 20 20 28 2b 20 63 74 20 31 29 29 .... (+ ct 1))
68d0: 29 0a 09 09 09 20 20 28 69 66 20 74 73 0a 09 09 ).... (if ts...
68e0: 09 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 . (set! tes
68f0: 74 64 61 74 20 74 73 29 0a 09 09 09 20 20 20 20 tdat ts)....
6900: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 (begin.....(de
6910: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
6920: 4e 49 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 72 NING: Couldn't r
6930: 65 67 69 73 74 65 72 20 74 65 73 74 20 22 20 74 egister test " t
6940: 65 73 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 20 est-name " with
6950: 69 74 65 6d 20 70 61 74 68 20 22 20 69 74 65 6d item path " item
6960: 2d 70 61 74 68 20 22 2c 20 73 6b 69 70 70 69 6e -path ", skippin
6970: 67 22 29 0a 09 09 09 09 28 69 66 20 28 6e 6f 74 g").....(if (not
6980: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 (null? tal))...
6990: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 .. (loop (car
69a0: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 tal)(cdr tal)))
69b0: 29 29 29 29 0a 09 09 20 20 20 20 28 63 68 61 6e ))))... (chan
69c0: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 ge-directory tes
69d0: 74 2d 70 61 74 68 29 0a 09 09 20 20 20 20 3b 3b t-path)... ;;
69e0: 20 74 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 68 this block is h
69f0: 65 72 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 6f ere only to info
6a00: 72 6d 20 74 68 65 20 75 73 65 72 20 65 61 72 6c rm the user earl
6a10: 79 20 6f 6e 0a 09 09 20 20 20 20 28 69 66 20 28 y on... (if (
6a20: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e file-exists? run
6a30: 63 6f 6e 66 69 67 66 29 0a 09 09 09 28 73 65 74 configf)....(set
6a40: 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 up-env-defaults
6a50: 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 db runconfigf ru
6a60: 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 n-id *already-se
6a70: 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 en-runconfig-inf
6a80: 6f 2a 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 o*)....(debug:pr
6a90: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
6aa0: 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 You do not have
6ab0: 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c a run config fil
6ac0: 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 e: " runconfigf)
6ad0: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
6ae0: 72 69 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 rint 4 "run-id:
6af0: 22 20 72 75 6e 2d 69 64 20 22 20 74 65 73 74 2d " run-id " test-
6b00: 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d name: " test-nam
6b10: 65 20 22 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 e " item-path: "
6b20: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 74 65 73 item-path " tes
6b30: 74 64 61 74 3a 20 22 20 28 74 65 73 74 3a 67 65 tdat: " (test:ge
6b40: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
6b50: 29 20 22 20 74 65 73 74 2d 73 74 61 74 65 3a 20 ) " test-state:
6b60: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
6b70: 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 e testdat))...
6b80: 20 20 28 63 61 73 65 20 28 69 66 20 28 61 72 67 (case (if (arg
6b90: 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 s:get-arg "-forc
6ba0: 65 22 29 0a 09 09 09 20 20 20 20 20 20 27 4e 4f e").... 'NO
6bb0: 54 5f 53 54 41 52 54 45 44 0a 09 09 09 20 20 20 T_STARTED....
6bc0: 20 20 20 28 69 66 20 74 65 73 74 64 61 74 0a 09 (if testdat..
6bd0: 09 09 09 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 ... (string->sy
6be0: 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 mbol (test:get-s
6bf0: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 tate testdat))..
6c00: 09 09 09 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d ... 'failed-to-
6c10: 69 6e 73 65 72 74 29 29 0a 09 09 20 20 20 20 20 insert))...
6c20: 20 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 ((failed-to-ins
6c30: 65 72 74 29 0a 09 09 20 20 20 20 20 20 20 28 64 ert)... (d
6c40: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
6c50: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 ROR: Failed to i
6c60: 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 nsert the record
6c70: 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a into the db")).
6c80: 09 09 20 20 20 20 20 20 28 28 4e 4f 54 5f 53 54 .. ((NOT_ST
6c90: 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 ARTED COMPLETED)
6ca0: 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 ... (debug
6cb0: 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 20 68 65 :print 6 "Got he
6cc0: 72 65 2c 20 22 20 28 74 65 73 74 3a 67 65 74 2d re, " (test:get-
6cd0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a state testdat)).
6ce0: 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 .. (let ((
6cf0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 runflag #f))....
6d00: 20 28 63 6f 6e 64 0a 09 09 09 20 20 3b 3b 20 69 (cond.... ;; i
6d10: 2e 65 2e 20 74 68 69 73 20 69 73 20 74 68 65 20 .e. this is the
6d20: 70 61 72 65 6e 74 20 74 65 73 74 20 74 6f 20 61 parent test to a
6d30: 20 73 75 69 74 65 20 6f 66 20 69 74 65 6d 73 2c suite of items,
6d40: 20 6e 65 76 65 72 20 22 72 75 6e 22 20 69 74 0a never "run" it.
6d50: 09 09 09 20 20 28 70 61 72 65 6e 74 2d 74 65 73 ... (parent-tes
6d60: 74 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 75 t.... (set! ru
6d70: 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 nflag #f))....
6d80: 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e ;; -force, run n
6d90: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 09 o matter what...
6da0: 09 20 20 28 28 61 72 67 73 3a 67 65 74 2d 61 72 . ((args:get-ar
6db0: 67 20 22 2d 66 6f 72 63 65 22 29 28 73 65 74 21 g "-force")(set!
6dc0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 runflag #t))...
6dd0: 09 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 . ;; NOT_STARTE
6de0: 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 D, run no matter
6df0: 20 77 68 61 74 0a 09 09 09 20 20 28 28 65 71 75 what.... ((equ
6e00: 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 al? (test:get-st
6e10: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f ate testdat) "NO
6e20: 54 5f 53 54 41 52 54 45 44 22 29 28 73 65 74 21 T_STARTED")(set!
6e30: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 runflag #t))...
6e40: 09 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e . ;; not -rerun
6e50: 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 and PASS, WARN
6e60: 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 or CHECK, do no
6e70: 72 75 6e 0a 09 09 09 20 20 28 28 61 6e 64 20 28 run.... ((and (
6e80: 6f 72 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 or (not (args:ge
6e90: 74 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 29 29 t-arg "-rerun"))
6ea0: 0a 09 09 09 09 20 20 20 20 28 61 72 67 73 3a 67 ..... (args:g
6eb0: 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 et-arg "-keepgoi
6ec0: 6e 67 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 ng")).....(membe
6ed0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
6ee0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50 us testdat) '("P
6ef0: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 ASS" "WARN" "CHE
6f00: 43 4b 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 CK"))).... (se
6f10: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a t! runflag #f)).
6f20: 09 09 09 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 ... ;; -rerun a
6f30: 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 nd status is one
6f40: 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64 of the specifed
6f50: 2c 20 72 75 6e 20 69 74 0a 09 09 09 20 20 28 28 , run it.... ((
6f60: 61 6e 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 and (args:get-ar
6f70: 67 20 22 2d 72 65 72 75 6e 22 29 0a 09 09 09 09 g "-rerun").....
6f80: 28 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 74 20 (let ((rerunlst
6f90: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 61 (string-split (a
6fa0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
6fb0: 72 75 6e 22 29 20 22 2c 22 29 29 29 20 3b 3b 20 run") ","))) ;;
6fc0: 46 41 49 4c 2c 0a 09 09 09 09 20 20 28 6d 65 6d FAIL,..... (mem
6fd0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
6fe0: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 atus testdat) re
6ff0: 72 75 6e 6c 73 74 29 29 29 0a 09 09 09 20 20 20 runlst)))....
7000: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
7010: 29 29 0a 09 09 09 20 20 3b 3b 20 2d 6b 65 65 70 )).... ;; -keep
7020: 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 going, do not re
7030: 72 75 6e 20 46 41 49 4c 0a 09 09 09 20 20 28 28 run FAIL.... ((
7040: 61 6e 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 and (args:get-ar
7050: 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 0a g "-keepgoing").
7060: 09 09 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 ....(member (tes
7070: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
7080: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 tdat) '("FAIL"))
7090: 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 75 ).... (set! ru
70a0: 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 nflag #f))....
70b0: 28 28 61 6e 64 20 28 6e 6f 74 20 28 61 72 67 73 ((and (not (args
70c0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 6e :get-arg "-rerun
70d0: 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 ")).....(member
70e0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
70f0: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 testdat) '("FAI
7100: 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 09 09 20 L" "n/a")))....
7110: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 (set! runflag
7120: 23 74 29 29 0a 09 09 09 20 20 28 65 6c 73 65 20 #t)).... (else
7130: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
7140: 29 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 ))).... (debug:p
7150: 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 rint 6 "RUNNING
7160: 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 => runflag: " ru
7170: 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 nflag " STATE: "
7180: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
7190: 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 testdat) " STAT
71a0: 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d US: " (test:get-
71b0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 status testdat))
71c0: 0a 09 09 09 20 28 69 66 20 28 6e 6f 74 20 72 75 .... (if (not ru
71d0: 6e 66 6c 61 67 29 0a 09 09 09 20 20 20 20 20 28 nflag).... (
71e0: 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 if (not parent-t
71f0: 65 73 74 29 0a 09 09 09 09 20 28 64 65 62 75 67 est)..... (debug
7200: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 :print 1 "NOTE:
7210: 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 Not starting tes
7220: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d t " new-test-nam
7230: 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 e " as it is sta
7240: 74 65 20 5c 22 43 4f 4d 50 4c 45 54 45 44 5c 22 te \"COMPLETED\"
7250: 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 and status \""
7260: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
7270: 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 testdat) "\", u
7280: 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 se -force to ove
7290: 72 72 69 64 65 22 29 29 0a 09 09 09 20 20 20 20 rride"))....
72a0: 20 28 6c 65 74 2a 20 28 28 67 65 74 2d 70 72 65 (let* ((get-pre
72b0: 72 65 71 73 2d 63 6d 64 20 28 6c 61 6d 62 64 61 reqs-cmd (lambda
72c0: 20 28 29 0a 09 09 09 09 09 09 20 20 20 20 20 20 ().......
72d0: 20 28 64 62 2d 67 65 74 2d 70 72 65 72 65 71 73 (db-get-prereqs
72e0: 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d -not-met db run-
72f0: 69 64 20 77 61 69 74 6f 6e 29 29 29 20 3b 3b 20 id waiton))) ;;
7300: 63 68 65 63 6b 20 62 65 66 6f 72 65 20 72 75 6e check before run
7310: 6e 69 6e 67 20 2e 2e 2e 2e 0a 09 09 09 09 20 20 ning .........
7320: 20 20 28 6c 61 75 6e 63 68 2d 63 6d 64 20 20 20 (launch-cmd
7330: 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 (lambda ()...
7340: 09 09 09 09 20 20 20 20 20 20 20 28 6c 61 75 6e .... (laun
7350: 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 ch-test db run-i
7360: 64 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 d test-conf keyv
7370: 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 allst test-name
7380: 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 test-path itemda
7390: 74 29 29 29 0a 09 09 09 09 20 20 20 20 28 74 65 t)))..... (te
73a0: 73 74 72 75 6e 64 61 74 20 20 20 20 20 20 28 6c strundat (l
73b0: 69 73 74 20 67 65 74 2d 70 72 65 72 65 71 73 2d ist get-prereqs-
73c0: 63 6d 64 20 6c 61 75 6e 63 68 2d 63 6d 64 29 29 cmd launch-cmd))
73d0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 ).... (if
73e0: 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (or (args:get-ar
73f0: 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 09 g "-force").....
7400: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 (let ((pr
7410: 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 20 eqs-not-yet-met
7420: 28 28 63 61 72 20 74 65 73 74 72 75 6e 64 61 74 ((car testrundat
7430: 29 29 29 29 0a 09 09 09 09 09 20 28 64 65 62 75 ))))...... (debu
7440: 67 3a 70 72 69 6e 74 20 32 20 22 50 72 65 71 72 g:print 2 "Preqr
7450: 65 71 75 65 73 69 74 65 73 20 66 6f 72 20 22 20 equesites for "
7460: 74 65 73 74 2d 6e 61 6d 65 20 22 3a 20 22 20 70 test-name ": " p
7470: 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 reqs-not-yet-met
7480: 29 0a 09 09 09 09 09 20 28 6e 75 6c 6c 3f 20 70 )...... (null? p
7490: 72 65 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 reqs-not-yet-met
74a0: 29 29 29 20 3b 3b 20 61 72 65 20 74 68 65 72 65 ))) ;; are there
74b0: 20 61 6e 79 20 74 65 73 74 73 20 74 68 61 74 20 any tests that
74c0: 6d 75 73 74 20 62 65 20 72 75 6e 20 62 65 66 6f must be run befo
74d0: 72 65 20 74 68 69 73 20 6f 6e 65 2e 2e 2e 0a 09 re this one.....
74e0: 09 09 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ... (if (not (
74f0: 28 63 61 64 72 20 74 65 73 74 72 75 6e 64 61 74 (cadr testrundat
7500: 29 29 29 20 3b 3b 20 74 68 69 73 20 69 73 20 74 ))) ;; this is t
7510: 68 65 20 6c 69 6e 65 20 74 68 61 74 20 6c 61 75 he line that lau
7520: 6e 63 68 65 73 20 74 68 65 20 74 65 73 74 20 74 nches the test t
7530: 6f 20 74 68 65 20 72 65 6d 6f 74 65 20 68 6f 73 o the remote hos
7540: 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 62 65 t..... (be
7550: 67 69 6e 0a 09 09 09 09 09 20 28 70 72 69 6e 74 gin...... (print
7560: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 "ERROR: Failed
7570: 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 to launch the te
7580: 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 st. Exiting as s
7590: 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 oon as possible"
75a0: 29 0a 09 09 09 09 09 20 28 73 65 74 21 20 2a 67 )...... (set! *g
75b0: 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a lobalexitstatus*
75c0: 20 31 29 20 3b 3b 20 0a 09 09 09 09 09 20 28 70 1) ;; ...... (p
75d0: 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 rocess-signal (c
75e0: 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 urrent-process-i
75f0: 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 0a d) signal/kill).
7600: 09 09 09 09 09 20 3b 28 65 78 69 74 20 31 29 0a ..... ;(exit 1).
7610: 09 09 09 09 09 20 29 29 0a 09 09 09 09 20 20 20 ..... )).....
7620: 28 69 66 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 (if (not (args:g
7630: 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 et-arg "-keepgoi
7640: 6e 67 22 29 29 0a 09 09 09 09 20 20 20 20 20 20 ng")).....
7650: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
7660: 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 ! *waiting-queue
7670: 2a 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 * new-test-name
7680: 74 65 73 74 72 75 6e 64 61 74 29 29 29 29 29 29 testrundat))))))
7690: 29 0a 09 09 20 20 20 20 20 20 28 28 4b 49 4c 4c )... ((KILL
76a0: 45 44 29 20 0a 09 09 20 20 20 20 20 20 20 28 64 ED) ... (d
76b0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f ebug:print 1 "NO
76c0: 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e TE: " new-test-n
76d0: 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 ame " is already
76e0: 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 running or was
76f0: 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 explictly killed
7700: 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 , use -force to
7710: 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 09 launch it."))...
7720: 20 20 20 20 20 20 28 28 4c 41 55 4e 43 48 45 44 ((LAUNCHED
7730: 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 REMOTEHOSTSTART
7740: 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 09 20 20 RUNNING) ...
7750: 20 20 20 20 20 28 69 66 20 28 3e 20 28 2d 20 28 (if (> (- (
7760: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 current-seconds)
7770: 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (+ (db:test-get-
7780: 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 event_time testd
7790: 61 74 29 0a 09 09 09 09 09 09 20 20 20 20 20 28 at)....... (
77a0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f db:test-get-run_
77b0: 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 duration testdat
77c0: 29 29 29 0a 09 09 09 20 20 20 20 20 20 31 30 30 ))).... 100
77d0: 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 ) ;; i.e. no upd
77e0: 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 ate for more tha
77f0: 6e 20 31 30 30 20 73 65 63 6f 6e 64 73 0a 09 09 n 100 seconds...
7800: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 . (begin....
7810: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
7820: 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 0 "WARNING: Test
7830: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 " test-name " a
7840: 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 ppears to be dea
7850: 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f d. Forcing it to
7860: 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 state INCOMPLET
7870: 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 E and status STU
7880: 43 4b 2f 44 45 41 44 22 29 0a 09 09 09 20 20 20 CK/DEAD")....
7890: 20 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 (test-set-stat
78a0: 75 73 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 us! db run-id te
78b0: 73 74 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c st-name "INCOMPL
78c0: 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 ETE" "STUCK/DEAD
78d0: 22 20 69 74 65 6d 64 61 74 20 22 54 65 73 74 20 " itemdat "Test
78e0: 69 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 is stuck or dead
78f0: 22 20 23 66 29 29 0a 09 09 09 20 20 20 28 64 65 " #f)).... (de
7900: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 bug:print 2 "NOT
7910: 45 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 E: " test-name "
7920: 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e is already runn
7930: 69 6e 67 22 29 29 29 0a 09 09 20 20 20 20 20 20 ing")))...
7940: 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 65 62 (else (deb
7950: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
7960: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 R: Failed to lau
7970: 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d 74 nch test " new-t
7980: 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 est-name ". Unre
7990: 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20 22 cognised state "
79a0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
79b0: 20 74 65 73 74 64 61 74 29 29 29 29 29 29 0a 09 testdat))))))..
79c0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 (if (not (
79d0: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 null? tal))...
79e0: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 (loop (car tal)(
79f0: 63 64 72 20 74 61 6c 29 29 29 29 29 29 29 29 29 cdr tal)))))))))
7a00: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 2d 77 ..(define (run-w
7a10: 61 69 74 69 6e 67 2d 74 65 73 74 73 20 64 62 29 aiting-tests db)
7a20: 0a 20 20 28 6c 65 74 20 28 28 6e 75 6d 74 72 69 . (let ((numtri
7a30: 65 73 20 20 20 20 20 20 20 20 20 20 20 30 29 0a es 0).
7a40: 09 28 6c 61 73 74 2d 74 72 79 2d 74 69 6d 65 20 .(last-try-time
7a50: 20 20 20 20 20 28 63 75 72 72 65 6e 74 2d 73 65 (current-se
7a60: 63 6f 6e 64 73 29 29 0a 09 28 74 69 6d 65 73 20 conds))..(times
7a70: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 (li
7a80: 73 74 20 31 29 29 29 20 3b 3b 20 6d 69 6e 75 74 st 1))) ;; minut
7a90: 65 73 20 74 6f 20 77 61 69 74 20 62 65 66 6f 72 es to wait befor
7aa0: 65 20 74 72 79 69 6e 67 20 61 67 61 69 6e 20 74 e trying again t
7ab0: 6f 20 6b 69 63 6b 20 6f 66 66 20 72 75 6e 73 0a o kick off runs.
7ac0: 20 20 20 20 3b 3b 20 42 55 47 20 74 68 69 73 20 ;; BUG this
7ad0: 68 61 63 6b 20 6f 66 20 62 72 75 74 65 20 66 6f hack of brute fo
7ae0: 72 63 65 20 72 65 74 72 79 69 6e 67 20 77 6f 72 rce retrying wor
7af0: 6b 73 20 71 75 69 74 65 20 77 65 6c 6c 20 66 6f ks quite well fo
7b00: 72 20 6d 61 6e 79 20 63 61 73 65 73 20 62 75 74 r many cases but
7b10: 20 0a 20 20 20 20 3b 3b 20 20 20 20 20 77 68 61 . ;; wha
7b20: 74 20 69 73 20 6e 65 65 64 65 64 20 69 73 20 74 t is needed is t
7b30: 6f 20 63 68 65 63 6b 20 74 68 65 20 64 62 20 66 o check the db f
7b40: 6f 72 20 74 65 73 74 73 20 74 68 61 74 20 68 61 or tests that ha
7b50: 76 65 20 66 61 69 6c 65 64 20 6c 65 73 73 20 74 ve failed less t
7b60: 68 61 6e 0a 20 20 20 20 3b 3b 20 20 20 20 20 4e han. ;; N
7b70: 20 74 69 6d 65 73 20 6f 72 20 6e 65 76 65 72 20 times or never
7b80: 62 65 65 6e 20 73 74 61 72 74 65 64 20 61 6e 64 been started and
7b90: 20 6b 69 63 6b 20 74 68 65 6d 20 6f 66 66 20 61 kick them off a
7ba0: 67 61 69 6e 0a 20 20 20 20 28 6c 65 74 20 6c 6f gain. (let lo
7bb0: 6f 70 20 28 28 77 61 69 74 69 6e 67 2d 74 65 73 op ((waiting-tes
7bc0: 74 2d 6e 61 6d 65 73 20 28 68 61 73 68 2d 74 61 t-names (hash-ta
7bd0: 62 6c 65 2d 6b 65 79 73 20 2a 77 61 69 74 69 6e ble-keys *waitin
7be0: 67 2d 71 75 65 75 65 2a 29 29 29 0a 20 20 20 20 g-queue*))).
7bf0: 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 20 20 28 (cond. (
7c00: 28 6e 6f 74 20 28 72 75 6e 73 3a 63 61 6e 2d 72 (not (runs:can-r
7c10: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 un-more-tests db
7c20: 29 29 0a 09 28 73 6c 65 65 70 20 32 29 0a 09 28 ))..(sleep 2)..(
7c30: 6c 6f 6f 70 20 77 61 69 74 69 6e 67 2d 74 65 73 loop waiting-tes
7c40: 74 2d 6e 61 6d 65 73 29 29 0a 20 20 20 20 20 20 t-names)).
7c50: 20 28 28 6e 75 6c 6c 3f 20 77 61 69 74 69 6e 67 ((null? waiting
7c60: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 0a 09 28 64 -test-names)..(d
7c70: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 41 6c ebug:print 1 "Al
7c80: 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 64 l tests launched
7c90: 22 29 29 0a 20 20 20 20 20 20 20 28 65 6c 73 65 ")). (else
7ca0: 0a 09 28 73 65 74 21 20 6e 75 6d 74 72 69 65 73 ..(set! numtries
7cb0: 20 28 2b 20 6e 75 6d 74 72 69 65 73 20 31 29 29 (+ numtries 1))
7cc0: 0a 09 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d ..(for-each (lam
7cd0: 62 64 61 20 28 74 65 73 74 6e 61 6d 65 29 0a 09 bda (testname)..
7ce0: 09 20 20 20 20 28 69 66 20 28 72 75 6e 73 3a 63 . (if (runs:c
7cf0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
7d00: 73 20 64 62 29 0a 09 09 09 28 6c 65 74 2a 20 28 s db)....(let* (
7d10: 28 74 65 73 74 64 61 74 20 28 68 61 73 68 2d 74 (testdat (hash-t
7d20: 61 62 6c 65 2d 72 65 66 20 2a 77 61 69 74 69 6e able-ref *waitin
7d30: 67 2d 71 75 65 75 65 2a 20 74 65 73 74 6e 61 6d g-queue* testnam
7d40: 65 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 70 e)).... (p
7d50: 72 65 72 65 71 73 20 28 28 63 61 72 20 74 65 73 rereqs ((car tes
7d60: 74 64 61 74 29 29 29 0a 09 09 09 20 20 20 20 20 tdat)))....
7d70: 20 20 28 6c 64 62 20 20 20 20 20 28 69 66 20 64 (ldb (if d
7d80: 62 20 64 62 20 28 6f 70 65 6e 2d 64 62 29 29 29 b db (open-db)))
7d90: 29 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 ).... (debug:pr
7da0: 69 6e 74 20 32 20 22 70 72 65 72 65 71 73 20 72 int 2 "prereqs r
7db0: 65 6d 61 69 6e 69 6e 67 3a 20 22 20 70 72 65 72 emaining: " prer
7dc0: 65 71 73 29 0a 09 09 09 20 20 28 69 66 20 28 6e eqs).... (if (n
7dd0: 75 6c 6c 3f 20 70 72 65 72 65 71 73 29 0a 09 09 ull? prereqs)...
7de0: 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 . (begin...
7df0: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 ..(debug:print 2
7e00: 20 22 50 72 65 72 65 71 75 69 73 69 74 65 73 20 "Prerequisites
7e10: 6d 65 74 2c 20 6c 61 75 6e 63 68 69 6e 67 20 22 met, launching "
7e20: 20 74 65 73 74 6e 61 6d 65 29 0a 09 09 09 09 28 testname).....(
7e30: 28 63 61 64 72 20 74 65 73 74 64 61 74 29 29 0a (cadr testdat)).
7e40: 09 09 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d ....(hash-table-
7e50: 64 65 6c 65 74 65 21 20 2a 77 61 69 74 69 6e 67 delete! *waiting
7e60: 2d 71 75 65 75 65 2a 20 74 65 73 74 6e 61 6d 65 -queue* testname
7e70: 29 29 29 0a 09 09 09 20 20 28 69 66 20 28 6e 6f ))).... (if (no
7e80: 74 20 64 62 29 0a 09 09 09 20 20 20 20 20 20 28 t db).... (
7e90: 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 sqlite3:finalize
7ea0: 21 20 6c 64 62 29 29 29 29 29 0a 09 09 20 20 77 ! ldb)))))... w
7eb0: 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 aiting-test-name
7ec0: 73 29 0a 09 3b 3b 20 28 73 6c 65 65 70 20 31 30 s)..;; (sleep 10
7ed0: 29 20 3b 3b 20 6e 6f 20 70 6f 69 6e 74 20 69 6e ) ;; no point in
7ee0: 20 72 75 73 68 69 6e 67 20 74 68 69 6e 67 73 20 rushing things
7ef0: 61 74 20 74 68 69 73 20 73 74 61 67 65 3f 0a 09 at this stage?..
7f00: 28 6c 6f 6f 70 20 28 68 61 73 68 2d 74 61 62 6c (loop (hash-tabl
7f10: 65 2d 6b 65 79 73 20 2a 77 61 69 74 69 6e 67 2d e-keys *waiting-
7f20: 71 75 65 75 65 2a 29 29 29 29 29 29 29 0a 0a 28 queue*)))))))..(
7f30: 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d define (get-dir-
7f40: 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d up-n dir . param
7f50: 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 s) . (let ((dpa
7f60: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c rts (string-spl
7f70: 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 it dir "/"))..(c
7f80: 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c ount (if (null
7f90: 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 ? params) 1 (car
7fa0: 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 params)))).
7fb0: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e (conc "/" (strin
7fc0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 g-intersperse ..
7fd0: 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 (take dpa
7fe0: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 rts (- (length d
7ff0: 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 parts) count))..
8000: 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b "/")))).;
8010: 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b ; Remove runs.;;
8020: 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 fields are pass
8030: 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a ing in through .
8040: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 (define (runs:re
8050: 6d 6f 76 65 2d 72 75 6e 73 20 64 62 20 72 75 6e move-runs db run
8060: 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 namepatt testpat
8070: 74 20 69 74 65 6d 70 61 74 74 29 0a 20 20 28 6c t itempatt). (l
8080: 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 et* ((keys
8090: 20 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 (db-get-keys d
80a0: 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 b)).. (rundat
80b0: 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e (runs:get-run
80c0: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 s-by-patt db key
80d0: 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a s runnamepatt)).
80e0: 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20 28 . (header (
80f0: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
8100: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 t 0)).. (runs
8110: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 (vector-ref
8120: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 rundat 1))).
8130: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
8140: 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 "Header: " heade
8150: 72 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 r). (for-each
8160: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 . (lambda (r
8170: 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 un). (let
8180: 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 ((runkey (string
8190: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 -intersperse (ma
81a0: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 p (lambda (k)...
81b0: 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 ....(db:get-valu
81c0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
81d0: 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 header (vector-r
81e0: 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 ef k 0))) keys)
81f0: 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 "/")).. (dir
8200: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b s-to-remove (mak
8210: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
8220: 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 . (let* ((run-id
8230: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
8240: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
8250: 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 28 74 der "id") )...(t
8260: 65 73 74 73 20 20 28 64 62 2d 67 65 74 2d 74 65 ests (db-get-te
8270: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 sts-for-run db (
8280: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
8290: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
82a0: 72 20 22 69 64 22 29 20 74 65 73 74 70 61 74 74 r "id") testpatt
82b0: 20 69 74 65 6d 70 61 74 74 29 29 0a 09 09 28 6c itempatt))...(l
82c0: 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f asttpath "/does/
82d0: 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 not/exist/I/hope
82e0: 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28 6e 6f "))... (if (no
82f0: 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 t (null? tests))
8300: 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a .. (begin.
8310: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
8320: 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 1 "Removing test
8330: 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e s for run: " run
8340: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d key " " (db:get-
8350: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
8360: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e run header "runn
8370: 61 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 2d 65 ame"))... (for-e
8380: 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 ach... (lambda
8390: 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 (test)... (le
83a0: 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 t* ((item-path (
83b0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
83c0: 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 -path test))....
83d0: 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 (test-name (d
83e0: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
83f0: 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 ame test))....
8400: 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a (run-dir (db:
8410: 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 test-get-rundir
8420: 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 test)))...
8430: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
8440: 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 " (db:test-get
8450: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 -testname test)
8460: 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 " id: " (db:test
8470: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 -get-id test) "
8480: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 " item-path)...
8490: 20 20 20 20 20 28 64 62 3a 64 65 6c 65 74 65 2d (db:delete-
84a0: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 test-records db
84b0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
84c0: 74 65 73 74 29 29 0a 09 09 20 20 20 20 20 20 28 test))... (
84d0: 69 66 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 if (> (string-le
84e0: 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 35 29 ngth run-dir) 5)
84f0: 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 69 ;; bad heuristi
8500: 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65 c but should pre
8510: 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 vent /tmp /home
8520: 65 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 20 28 etc..... (let (
8530: 28 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d 64 69 (fullpath run-di
8540: 72 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 3a 74 r)) ;; "/" (db:t
8550: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 est-get-item-pat
8560: 68 20 74 65 73 74 29 29 29 29 0a 09 09 09 20 20 h test))))....
8570: 20 20 28 73 65 74 21 20 6c 61 73 74 74 70 61 74 (set! lasttpat
8580: 68 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 h fullpath)....
8590: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 (hash-table-s
85a0: 65 74 21 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f et! dirs-to-remo
85b0: 76 65 20 66 75 6c 6c 70 61 74 68 20 23 74 29 0a ve fullpath #t).
85c0: 09 09 09 20 20 20 20 3b 3b 20 54 68 65 20 66 6f ... ;; The fo
85d0: 6c 6c 6f 77 69 6e 67 20 77 61 73 20 74 68 65 20 llowing was the
85e0: 73 61 66 65 20 64 65 6c 65 74 65 20 63 6f 64 65 safe delete code
85f0: 20 62 75 74 20 69 74 20 77 61 73 20 6e 6f 74 20 but it was not
8600: 62 65 69 6e 67 20 65 78 65 63 74 75 74 65 64 2e being exectuted.
8610: 0a 09 09 09 20 20 20 20 3b 3b 20 28 6c 65 74 2a .... ;; (let*
8620: 20 28 28 64 69 72 73 2d 63 6f 75 6e 74 20 28 2b ((dirs-count (+
8630: 20 31 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 1 (length keys)
8640: 28 6c 65 6e 67 74 68 20 28 73 74 72 69 6e 67 2d (length (string-
8650: 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 68 20 split item-path
8660: 22 2f 22 29 29 29 29 0a 09 09 09 20 20 20 20 3b "/")))).... ;
8670: 3b 20 20 20 20 20 20 20 20 28 64 69 72 2d 74 6f ; (dir-to
8680: 2d 72 65 6d 20 28 67 65 74 2d 64 69 72 2d 75 70 -rem (get-dir-up
8690: 2d 6e 20 66 75 6c 6c 70 61 74 68 20 64 69 72 73 -n fullpath dirs
86a0: 2d 63 6f 75 6e 74 29 29 0a 09 09 09 20 20 20 20 -count))....
86b0: 3b 3b 20 20 20 20 20 20 20 20 28 72 65 6d 61 69 ;; (remai
86c0: 6e 69 6e 67 64 20 28 73 74 72 69 6e 67 2d 73 75 ningd (string-su
86d0: 62 73 74 69 74 75 74 65 20 28 72 65 67 65 78 70 bstitute (regexp
86e0: 20 28 63 6f 6e 63 20 22 5e 22 20 64 69 72 2d 74 (conc "^" dir-t
86f0: 6f 2d 72 65 6d 20 22 2f 22 29 29 20 22 22 20 66 o-rem "/")) "" f
8700: 75 6c 6c 70 61 74 68 29 29 0a 09 09 09 20 20 20 ullpath))....
8710: 20 3b 3b 20 20 20 20 20 20 20 20 28 63 6d 64 20 ;; (cmd
8720: 28 63 6f 6e 63 20 22 63 64 20 22 20 64 69 72 2d (conc "cd " dir-
8730: 74 6f 2d 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 to-rem "; rmdir
8740: 2d 70 20 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 -p " remainingd
8750: 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 ))).... ;;
8760: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 (if (file-exists
8770: 3f 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 ? fullpath)....
8780: 20 20 20 3b 3b 20 20 20 20 20 20 20 28 62 65 67 ;; (beg
8790: 69 6e 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 in.... ;;
87a0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
87b0: 74 20 31 20 63 6d 64 29 0a 09 09 09 20 20 20 20 t 1 cmd)....
87c0: 3b 3b 20 20 20 20 20 20 20 20 20 28 73 79 73 74 ;; (syst
87d0: 65 6d 20 63 6d 64 29 29 29 0a 09 09 09 20 20 20 em cmd)))....
87e0: 20 3b 3b 20 20 20 29 29 0a 09 09 09 20 20 20 20 ;; ))....
87f0: 29 29 29 29 0a 09 09 20 20 20 20 74 65 73 74 73 ))))... tests
8800: 29 29 29 0a 0a 09 20 20 20 3b 3b 20 6c 6f 6f 6b )))... ;; look
8810: 20 74 68 6f 75 67 68 20 74 68 65 20 64 69 72 73 though the dirs
8820: 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 6f 72 20 63 -to-remove for c
8830: 61 6e 64 69 64 61 74 65 73 20 66 6f 72 20 72 65 andidates for re
8840: 6d 6f 76 61 6c 2e 20 44 6f 20 74 68 69 73 20 61 moval. Do this a
8850: 66 74 65 72 20 64 65 6c 65 74 69 6e 67 20 74 68 fter deleting th
8860: 65 20 72 65 63 6f 72 64 73 0a 09 20 20 20 3b 3b e records.. ;;
8870: 20 66 6f 72 20 65 61 63 68 20 74 65 73 74 20 69 for each test i
8880: 6e 20 63 61 73 65 20 77 65 20 67 65 74 20 6b 69 n case we get ki
8890: 6c 6c 65 64 2e 20 54 68 61 74 20 73 68 6f 75 6c lled. That shoul
88a0: 64 20 6d 69 6e 69 6d 69 7a 65 20 74 68 65 20 64 d minimize the d
88b0: 65 74 72 69 74 75 73 20 6c 65 66 74 20 6f 6e 20 etritus left on
88c0: 64 69 73 6b 0a 09 20 20 20 3b 3b 20 70 72 6f 63 disk.. ;; proc
88d0: 65 73 73 20 74 68 65 20 64 69 72 73 20 66 72 6f ess the dirs fro
88e0: 6d 20 6c 6f 6e 67 65 73 74 20 73 74 72 69 6e 67 m longest string
88f0: 20 6c 65 6e 67 74 68 20 74 6f 20 73 68 6f 72 74 length to short
8900: 65 73 74 0a 09 20 20 20 28 66 6f 72 2d 65 61 63 est.. (for-eac
8910: 68 20 0a 09 20 20 20 20 28 6c 61 6d 62 64 61 20 h .. (lambda
8920: 28 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a (dir-to-remove).
8930: 09 20 20 20 20 20 20 28 69 66 20 28 66 69 6c 65 . (if (file
8940: 2d 65 78 69 73 74 73 3f 20 64 69 72 2d 74 6f 2d -exists? dir-to-
8950: 72 65 6d 6f 76 65 29 0a 09 09 20 20 28 6c 65 74 remove)... (let
8960: 20 28 28 64 69 72 2d 69 6e 2d 64 62 20 27 28 29 ((dir-in-db '()
8970: 29 29 0a 09 09 20 20 20 20 28 73 71 6c 69 74 65 ))... (sqlite
8980: 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 3:for-each-row..
8990: 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 64 . (lambda (d
89a0: 69 72 29 0a 09 09 20 20 20 20 20 20 20 28 73 65 ir)... (se
89b0: 74 21 20 64 69 72 2d 69 6e 2d 64 62 20 28 63 6f t! dir-in-db (co
89c0: 6e 73 20 64 69 72 20 64 69 72 2d 69 6e 2d 64 62 ns dir dir-in-db
89d0: 29 29 29 0a 09 09 20 20 20 20 20 64 62 20 22 53 )))... db "S
89e0: 45 4c 45 43 54 20 72 75 6e 64 69 72 20 46 52 4f ELECT rundir FRO
89f0: 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 M tests WHERE ru
8a00: 6e 64 69 72 20 4c 49 4b 45 20 3f 3b 22 20 0a 09 ndir LIKE ?;" ..
8a10: 09 20 20 20 20 20 28 63 6f 6e 63 20 22 25 22 20 . (conc "%"
8a20: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 25 dir-to-remove "%
8a30: 22 29 29 20 3b 3b 20 79 65 73 2c 20 49 27 6d 20 ")) ;; yes, I'm
8a40: 67 6f 69 6e 67 20 74 6f 20 62 61 69 6c 20 69 66 going to bail if
8a50: 20 74 68 65 72 65 20 69 73 20 61 6e 79 74 68 69 there is anythi
8a60: 6e 67 20 6c 69 6b 65 20 74 68 69 73 20 64 69 72 ng like this dir
8a70: 20 69 6e 20 74 68 65 20 64 62 0a 09 09 20 20 20 in the db...
8a80: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 64 69 72 2d (if (null? dir-
8a90: 69 6e 2d 64 62 29 0a 09 09 09 28 62 65 67 69 6e in-db)....(begin
8aa0: 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 .... (debug:pri
8ab0: 6e 74 20 32 20 22 52 65 6d 6f 76 69 6e 67 20 64 nt 2 "Removing d
8ac0: 69 72 65 63 74 6f 72 79 20 77 69 74 68 20 7a 65 irectory with ze
8ad0: 72 6f 20 64 62 20 72 65 66 65 72 65 6e 63 65 73 ro db references
8ae0: 3a 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 : " dir-to-remov
8af0: 65 29 0a 09 09 09 20 20 28 73 79 73 74 65 6d 20 e).... (system
8b00: 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 (conc "rm -rf "
8b10: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a dir-to-remove)).
8b20: 09 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65 ... (hash-table
8b30: 2d 64 65 6c 65 74 65 21 20 64 69 72 73 2d 74 6f -delete! dirs-to
8b40: 2d 72 65 6d 6f 76 65 20 64 69 72 2d 74 6f 2d 72 -remove dir-to-r
8b50: 65 6d 6f 76 65 29 29 0a 09 09 09 28 64 65 62 75 emove))....(debu
8b60: 67 3a 70 72 69 6e 74 20 32 20 22 53 6b 69 70 70 g:print 2 "Skipp
8b70: 69 6e 67 20 72 65 6d 6f 76 61 6c 20 6f 66 20 22 ing removal of "
8b80: 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 dir-to-remove "
8b90: 20 66 6f 72 20 6e 6f 77 20 61 73 20 69 74 20 73 for now as it s
8ba0: 74 69 6c 6c 20 68 61 73 20 72 65 66 65 72 65 6e till has referen
8bb0: 63 65 73 20 69 6e 20 74 68 65 20 64 61 74 61 62 ces in the datab
8bc0: 61 73 65 22 29 29 29 29 29 0a 09 20 20 20 20 28 ase"))))).. (
8bd0: 73 6f 72 74 20 28 68 61 73 68 2d 74 61 62 6c 65 sort (hash-table
8be0: 2d 6b 65 79 73 20 64 69 72 73 2d 74 6f 2d 72 65 -keys dirs-to-re
8bf0: 6d 6f 76 65 29 20 28 6c 61 6d 62 64 61 20 28 61 move) (lambda (a
8c00: 20 62 29 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 b)(> (string-le
8c10: 6e 67 74 68 20 61 29 28 73 74 72 69 6e 67 2d 6c ngth a)(string-l
8c20: 65 6e 67 74 68 20 62 29 29 29 29 29 0a 0a 09 20 ength b)))))...
8c30: 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 ;; remove the
8c40: 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74 run if zero test
8c50: 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 6c 65 s remain.. (le
8c60: 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 64 62 t ((remtests (db
8c70: 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 -get-tests-for-r
8c80: 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 un db (db:get-va
8c90: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
8ca0: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 29 n header "id")))
8cb0: 29 0a 09 20 20 20 20 20 28 69 66 20 28 6e 75 6c ).. (if (nul
8cc0: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 l? remtests) ;;
8cd0: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 no more tests re
8ce0: 6d 61 69 6e 69 6e 67 0a 09 09 20 28 6c 65 74 2a maining... (let*
8cf0: 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 ((dparts (stri
8d00: 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 ng-split lasttpa
8d10: 74 68 20 22 2f 22 29 29 0a 09 09 09 28 72 75 6e th "/"))....(run
8d20: 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 path (conc "/" (
8d30: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
8d40: 73 65 20 0a 09 09 09 09 09 20 20 20 20 28 74 61 se ...... (ta
8d50: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 ke dparts (- (le
8d60: 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29 ngth dparts) 1))
8d70: 0a 09 09 09 09 09 20 20 20 20 22 2f 22 29 29 29 ...... "/")))
8d80: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 )... (debug:pr
8d90: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
8da0: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 run: " runkey "
8db0: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d " (db:get-value-
8dc0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
8dd0: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 ader "runname"))
8de0: 0a 09 09 20 20 20 28 64 62 3a 64 65 6c 65 74 65 ... (db:delete
8df0: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a -run db run-id).
8e00: 09 09 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 .. ;; need to
8e10: 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 70 figure out the p
8e20: 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64 ath to the run d
8e30: 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 ir and remove it
8e40: 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 3b if empty... ;
8e50: 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 ; (if (null?
8e60: 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 (glob (conc runp
8e70: 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 ath "/*")))...
8e80: 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 ;; (begi
8e90: 6e 0a 09 09 20 20 20 3b 3b 20 09 20 28 64 65 62 n... ;; . (deb
8ea0: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
8eb0: 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 ving run dir " r
8ec0: 75 6e 70 61 74 68 29 0a 09 09 20 20 20 3b 3b 20 unpath)... ;;
8ed0: 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 . (system (conc
8ee0: 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70 "rmdir -p " runp
8ef0: 61 74 68 29 29 29 29 0a 09 09 20 20 20 29 29 29 ath))))... )))
8f00: 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 ).. )). runs
8f10: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
8f20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8f30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8f40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8f50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
8f60: 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 Routines for ma
8f70: 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a nipulating runs.
8f80: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
8f90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8fa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8fb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8fc0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e ========..;; Sin
8fd0: 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f ce many calls to
8fe0: 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 70 a run require p
8ff0: 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 73 retty much the s
9000: 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 ame setup .;; th
9010: 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75 73 is wrapper is us
9020: 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 65 ed to reduce the
9030: 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 replication of
9040: 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65 code.(define (ge
9050: 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 neral-run-call s
9060: 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e witchname action
9070: 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 69 -desc proc). (i
9080: 66 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 f (not (args:get
9090: 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 -arg ":runname")
90a0: 29 0a 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 ). (begin..
90b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
90c0: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 ERROR: Missing r
90d0: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 equired paramete
90e0: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 r for " switchna
90f0: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 me ", you must s
9100: 70 65 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e pecify the run n
9110: 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d ame with :runnam
9120: 65 20 72 75 6e 6e 61 6d 65 22 29 0a 09 28 65 78 e runname")..(ex
9130: 69 74 20 32 29 29 0a 20 20 20 20 20 20 28 6c 65 it 2)). (le
9140: 74 20 28 28 64 62 20 23 66 29 29 0a 09 28 69 66 t ((db #f))..(if
9150: 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 (not (setup-for
9160: 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67 -run)).. (beg
9170: 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 75 in .. (debu
9180: 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65 g:print 0 "Faile
9190: 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74 d to setup, exit
91a0: 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65 78 ing").. (ex
91b0: 69 74 20 31 29 29 29 0a 09 28 73 65 74 21 20 64 it 1)))..(set! d
91c0: 62 20 28 6f 70 65 6e 2d 64 62 29 29 0a 09 28 69 b (open-db))..(i
91d0: 66 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e f (not (car *con
91e0: 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 figinfo*))..
91f0: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 (begin.. (d
9200: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
9210: 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 ROR: Attempted t
9220: 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 o " action-desc
9230: 22 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 " but run area c
9240: 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 onfig file not f
9250: 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 ound").. (e
9260: 78 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 xit 1)).. ;;
9270: 45 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 Extract out stuf
9280: 66 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 f needed in most
9290: 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 or many calls..
92a0: 20 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e ;; here then
92b0: 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 call proc..
92c0: 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 (let* ((keys
92d0: 20 20 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 (db-get-keys
92e0: 64 62 29 29 0a 09 09 20 20 20 28 6b 65 79 6e 61 db))... (keyna
92f0: 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 mes (map key:g
9300: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 et-fieldname key
9310: 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c s))... (keyval
9320: 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c lst (keys->vall
9330: 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 ist keys #t)))..
9340: 20 20 20 20 20 20 28 70 72 6f 63 20 64 62 20 6b (proc db k
9350: 65 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 eys keynames key
9360: 76 61 6c 6c 73 74 29 29 29 0a 09 28 73 71 6c 69 vallst)))..(sqli
9370: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 te3:finalize! db
9380: 29 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d )..(set! *didsom
9390: 65 74 68 69 6e 67 2a 20 23 74 29 29 29 29 0a 0a ething* #t))))..
93a0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
93b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
93c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
93d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
93e0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c ========.;; Roll
93f0: 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d up runs.;;======
9400: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9420: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9430: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9440: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 ..;; Update the
9450: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 test_meta table
9460: 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 for this test.(d
9470: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 efine (runs:upda
9480: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
9490: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
94a0: 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 onf). (let ((cu
94b0: 72 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73 rrrecord (db:tes
94c0: 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 tmeta-get-record
94d0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 db test-name)))
94e0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 . (if (not cu
94f0: 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 rrrecord)..(begi
9500: 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 n.. (set! currr
9510: 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 ecord (make-vect
9520: 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 64 or 10 #f)).. (d
9530: 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 b:testmeta-add-r
9540: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 ecord db test-na
9550: 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 me))). (for-e
9560: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 ach . (lambd
9570: 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 a (key). (
9580: 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 let* ((idx (cadr
9590: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 key)).. (f
95a0: 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 ld (car key))..
95b0: 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 (val (conf
95c0: 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 ig-lookup test-c
95d0: 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 onf "test_meta"
95e0: 66 6c 64 29 29 29 0a 09 20 28 69 66 20 28 61 6e fld))).. (if (an
95f0: 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 d val (not (equa
9600: 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 l? (vector-ref c
9610: 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 urrrecord idx) v
9620: 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 al))).. (beg
9630: 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e in.. (prin
9640: 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 t "Updating " te
9650: 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 st-name " " fld
9660: 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 " to " val)..
9670: 20 20 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 (db:testmeta
9680: 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 -update-field db
9690: 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 test-name fld v
96a0: 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 al))))). '((
96b0: 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e "author" 2)("own
96c0: 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74 er" 3)("descript
96d0: 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 ion" 4)("reviewe
96e0: 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29 d" 5)("tags" 9))
96f0: 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 )))..;; Update t
9700: 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c est_meta for all
9710: 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 tests.(define (
9720: 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d runs:update-all-
9730: 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 test_meta db).
9740: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 (let ((test-name
9750: 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c s (get-all-legal
9760: 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 -tests))). (f
9770: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
9780: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 ambda (test-name
9790: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 ). (let* (
97a0: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 (test-path (c
97b0: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
97c0: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d tests/" test-nam
97d0: 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 e)).. (test
97e0: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 -configf (conc t
97f0: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 est-path "/testc
9800: 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 onfig"))..
9810: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61 (testexists (a
9820: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f nd (file-exists?
9830: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 test-configf)(f
9840: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f ile-read-access?
9850: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 test-configf)))
9860: 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 .. ;; read
9870: 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 configs with tri
9880: 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 cks turned off (
9890: 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a i.e. no system).
98a0: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e . (test-con
98b0: 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69 f (if testexi
98c0: 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 sts (read-config
98d0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 test-configf #f
98e0: 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 #f)(make-hash-t
98f0: 61 62 6c 65 29 29 29 29 0a 09 20 28 72 75 6e 73 able)))).. (runs
9900: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
9910: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
9920: 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 est-conf))).
9930: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 test-names)))..
9940: 20 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 .;; This could
9950: 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 probably be refa
9960: 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 ctored into one
9970: 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e complex query ..
9980: 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
9990: 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 rollup-run db ke
99a0: 79 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 6e 65 ys). (let* ((ne
99b0: 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 20 28 72 w-run-id (r
99c0: 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b egister-run db k
99d0: 65 79 73 29 29 0a 09 20 28 70 72 65 76 2d 74 65 eys)).. (prev-te
99e0: 73 74 73 20 20 20 20 20 20 28 74 65 73 74 3a 67 sts (test:g
99f0: 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 et-matching-prev
9a00: 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 ious-test-run-re
9a10: 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e cords db new-run
9a20: 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 -id "%" "%"))..
9a30: 28 63 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 (curr-tests
9a40: 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 (db-get-tests-f
9a50: 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 or-run db new-ru
9a60: 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 n-id "%" "%"))..
9a70: 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 (curr-tests-has
9a80: 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 h (make-hash-tab
9a90: 6c 65 29 29 29 0a 20 20 20 20 3b 3b 20 69 6e 64 le))). ;; ind
9aa0: 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 73 ex the already s
9ab0: 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 65 aved tests by te
9ac0: 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d 70 stname and itemp
9ad0: 61 74 68 20 69 6e 20 63 75 72 72 2d 74 65 73 74 ath in curr-test
9ae0: 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d s-hash. (for-
9af0: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 each. (lambd
9b00: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 a (testdat).
9b10: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e (let* ((testn
9b20: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ame (db:test-ge
9b30: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 t-testname testd
9b40: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 at)).. (ite
9b50: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
9b60: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
9b70: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
9b80: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 full-name (conc
9b90: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 testname "/" ite
9ba0: 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 m-path))).. (has
9bb0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
9bc0: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
9bd0: 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 l-name testdat))
9be0: 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 ). curr-test
9bf0: 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 s). ;; NOPE:
9c00: 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 Non-optimal appr
9c10: 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 oach. Try this i
9c20: 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 nstead.. ;;
9c30: 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 1. tests are re
9c40: 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 ceived in a list
9c50: 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 , most recent fi
9c60: 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 rst. ;; 2.
9c70: 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c replace the roll
9c80: 75 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 up test with the
9c90: 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 new *always*.
9ca0: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
9cb0: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 (lambda (testd
9cc0: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a at). (let*
9cd0: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 ((testname (db
9ce0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
9cf0: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 me testdat))..
9d00: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 (item-path (
9d10: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
9d20: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a -path testdat)).
9d30: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d . (full-nam
9d40: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 e (conc testname
9d50: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
9d60: 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 .. (prev-te
9d70: 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 st-dat (hash-tab
9d80: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 le-ref/default c
9d90: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 urr-tests-hash f
9da0: 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 ull-name #f))..
9db0: 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 (test-steps
9dc0: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 (db:get-st
9dd0: 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 eps-for-test db
9de0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
9df0: 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 testdat)))..
9e00: 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f (new-test-reco
9e10: 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 rd #f)).. ;; rep
9e20: 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 lace these with
9e30: 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 insert ... selec
9e40: 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 t.. (apply sqlit
9e50: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 e3:execute ...db
9e60: 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 ...(conc "INSER
9e70: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
9e80: 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c O tests (run_id,
9e90: 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 testname,state,s
9ea0: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 tatus,event_time
9eb0: 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 ,host,cpuload,di
9ec0: 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e skfree,uname,run
9ed0: 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 dir,item_path,ru
9ee0: 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c n_duration,final
9ef0: 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 2c 66 69 _logf,comment,fi
9f00: 72 73 74 5f 65 72 72 2c 66 69 72 73 74 5f 77 61 rst_err,first_wa
9f10: 72 6e 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 rn) "... "V
9f20: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f ALUES (?,?,?,?,?
9f30: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
9f40: 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 ,?,?,?);")...new
9f50: 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 -run-id (cddr (v
9f60: 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 ector->list test
9f70: 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e dat))).. (set! n
9f80: 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 ew-testdat (car
9f90: 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f (db-get-tests-fo
9fa0: 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e r-run db new-run
9fb0: 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 -id testname ite
9fc0: 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 m-path))).. (has
9fd0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
9fe0: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
9ff0: 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 l-name new-testd
a000: 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c at) ;; this coul
a010: 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 d be confusing,
a020: 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f which record sho
a030: 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 uld go into the
a040: 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 lookup table?..
a050: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 ;; Now duplicate
a060: 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a the test steps.
a070: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
a080: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 "Copying record
a090: 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 s in test_steps
a0a0: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 from test_id=" (
a0b0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
a0c0: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 estdat) " to " (
a0d0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e db:test-get-id n
a0e0: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 ew-testdat)).. (
a0f0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
a100: 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 .. db .. (conc
a110: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c "INSERT OR REPL
a120: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 ACE INTO test_st
a130: 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 eps (test_id,ste
a140: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 pname,state,stat
a150: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f us,event_time,co
a160: 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 mment) "..."SELE
a170: 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 CT " (db:test-ge
a180: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
a190: 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 ) ",stepname,sta
a1a0: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
a1b0: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f time,comment FRO
a1c0: 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 M test_steps WHE
a1d0: 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a RE test_id=?;").
a1e0: 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d . (db:test-get-
a1f0: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b id testdat)).. ;
a200: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 ; Now duplicate
a210: 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 the test data..
a220: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
a230: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 Copying records
a240: 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f in test_data fro
a250: 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a m test_id=" (db:
a260: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
a270: 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a dat) " to " (db:
a280: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d test-get-id new-
a290: 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c testdat)).. (sql
a2a0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 ite3:execute ..
a2b0: 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 db .. (conc "I
a2c0: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 NSERT OR REPLACE
a2d0: 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 INTO test_data
a2e0: 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 (test_id,categor
a2f0: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 y,variable,value
a300: 2c 65 78 70 65 63 74 65 64 5f 76 61 6c 75 65 2c ,expected_value,
a310: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e tol,units,commen
a320: 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22 t) "..."SELECT "
a330: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
a340: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c new-testdat) ",
a350: 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c category,variabl
a360: 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 e,value,expected
a370: 5f 76 61 6c 75 65 2c 74 6f 6c 2c 75 6e 69 74 73 _value,tol,units
a380: 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 ,comment FROM te
a390: 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 65 st_data WHERE te
a3a0: 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 st_id=?;").. (d
a3b0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
a3c0: 73 74 64 61 74 29 29 0a 09 20 29 29 0a 20 20 20 stdat)).. )).
a3d0: 20 20 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a prev-tests))).
a3e0: 09 20 0a 20 20 20 20 20 0a . . .