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 20 28 64 aths )))..;; (d
0de0: 65 66 69 6e 65 20 64 62 20 28 6f 70 65 6e 2d 64 efine db (open-d
0df0: 62 29 29 0a 3b 3b 20 20 28 74 65 73 74 2d 73 65 b)).;; (test-se
0e00: 74 2d 73 74 61 74 75 73 21 20 64 62 20 32 20 22 t-status! db 2 "
0e10: 72 75 6e 66 69 72 73 74 22 20 22 43 4f 4d 50 4c runfirst" "COMPL
0e20: 45 54 45 44 22 20 22 50 41 53 53 22 20 22 73 75 ETED" "PASS" "su
0e30: 6d 6d 65 72 22 29 0a 0a 28 64 65 66 69 6e 65 20 mmer")..(define
0e40: 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 (test-set-status
0e50: 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 ! db run-id test
0e60: 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 -name state stat
0e70: 75 73 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 61 us itemdat-or-pa
0e80: 74 68 20 63 6f 6d 6d 65 6e 74 20 64 61 74 29 0a th comment dat).
0e90: 20 20 28 6c 65 74 20 28 28 69 74 65 6d 2d 70 61 (let ((item-pa
0ea0: 74 68 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 th (if (string?
0eb0: 69 74 65 6d 64 61 74 2d 6f 72 2d 70 61 74 68 29 itemdat-or-path)
0ec0: 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 61 74 68 itemdat-or-path
0ed0: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 (item-list->pat
0ee0: 68 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 61 74 h itemdat-or-pat
0ef0: 68 29 29 29 0a 09 28 6f 74 68 65 72 64 61 74 20 h)))..(otherdat
0f00: 20 28 69 66 20 64 61 74 20 64 61 74 20 28 6d 61 (if dat dat (ma
0f10: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 ke-hash-table)))
0f20: 29 0a 20 20 20 20 3b 3b 20 75 70 64 61 74 65 20 ). ;; update
0f30: 74 68 65 20 70 72 69 6d 61 72 79 20 72 65 63 6f the primary reco
0f40: 72 64 20 49 46 20 73 74 61 74 65 20 41 4e 44 20 rd IF state AND
0f50: 73 74 61 74 75 73 20 61 72 65 20 64 65 66 69 6e status are defin
0f60: 65 64 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 ed. (if (and
0f70: 73 74 61 74 65 20 73 74 61 74 75 73 29 0a 09 28 state status)..(
0f80: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
0f90: 64 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 db "UPDATE tests
0fa0: 20 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 SET state=?,sta
0fb0: 74 75 73 3d 3f 2c 65 76 65 6e 74 5f 74 69 6d 65 tus=?,event_time
0fc0: 3d 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 =strftime('%s','
0fd0: 6e 6f 77 27 29 20 57 48 45 52 45 20 72 75 6e 5f now') WHERE run_
0fe0: 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d id=? AND testnam
0ff0: 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 e=? AND item_pat
1000: 68 3d 3f 3b 22 20 0a 09 09 09 20 73 74 61 74 65 h=?;" .... state
1010: 20 73 74 61 74 75 73 20 72 75 6e 2d 69 64 20 74 status run-id t
1020: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
1030: 74 68 29 29 0a 20 20 20 20 3b 3b 20 61 64 64 20 th)). ;; add
1040: 6d 65 74 61 64 61 74 61 20 28 6e 65 65 64 20 74 metadata (need t
1050: 6f 20 64 6f 20 74 68 69 73 20 77 61 79 20 74 6f o do this way to
1060: 20 61 76 6f 69 64 20 53 51 4c 20 69 6e 6a 65 63 avoid SQL injec
1070: 74 69 6f 6e 20 69 73 73 75 65 73 29 0a 20 20 20 tion issues).
1080: 20 3b 3b 20 3a 76 61 6c 75 65 0a 20 20 20 20 28 ;; :value. (
1090: 6c 65 74 20 28 28 76 61 6c 20 28 68 61 73 68 2d let ((val (hash-
10a0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
10b0: 74 20 6f 74 68 65 72 64 61 74 20 22 3a 76 61 6c t otherdat ":val
10c0: 75 65 22 20 23 66 29 29 29 0a 20 20 20 20 20 20 ue" #f))).
10d0: 28 69 66 20 76 61 6c 0a 09 20 20 28 73 71 6c 69 (if val.. (sqli
10e0: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
10f0: 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 UPDATE tests SET
1100: 20 76 61 6c 75 65 3d 3f 20 57 48 45 52 45 20 72 value=? WHERE r
1110: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
1120: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
1130: 70 61 74 68 3d 3f 3b 22 20 76 61 6c 20 72 75 6e path=?;" val run
1140: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
1150: 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 3b em-path))). ;
1160: 3b 20 3a 65 78 70 65 63 74 65 64 5f 76 61 6c 75 ; :expected_valu
1170: 65 0a 20 20 20 20 28 6c 65 74 20 28 28 76 61 6c e. (let ((val
1180: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
1190: 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 64 61 /default otherda
11a0: 74 20 22 3a 65 78 70 65 63 74 65 64 5f 76 61 6c t ":expected_val
11b0: 75 65 22 20 23 66 29 29 29 0a 20 20 20 20 20 20 ue" #f))).
11c0: 28 69 66 20 76 61 6c 0a 09 20 20 28 73 71 6c 69 (if val.. (sqli
11d0: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
11e0: 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 UPDATE tests SET
11f0: 20 65 78 70 65 63 74 65 64 5f 76 61 6c 75 65 3d expected_value=
1200: 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f ? WHERE run_id=?
1210: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
1220: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
1230: 22 20 76 61 6c 20 72 75 6e 2d 69 64 20 74 65 73 " val run-id tes
1240: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
1250: 29 29 29 0a 20 20 20 20 3b 3b 20 3a 74 6f 6c 0a ))). ;; :tol.
1260: 20 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 (let ((val (
1270: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
1280: 65 66 61 75 6c 74 20 6f 74 68 65 72 64 61 74 20 efault otherdat
1290: 22 3a 74 6f 6c 22 20 23 66 29 29 29 0a 20 20 20 ":tol" #f))).
12a0: 20 20 20 28 69 66 20 76 61 6c 0a 09 20 20 28 73 (if val.. (s
12b0: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 qlite3:execute d
12c0: 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 b "UPDATE tests
12d0: 53 45 54 20 74 6f 6c 3d 3f 20 57 48 45 52 45 20 SET tol=? WHERE
12e0: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
12f0: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
1300: 5f 70 61 74 68 3d 3f 3b 22 20 76 61 6c 20 72 75 _path=?;" val ru
1310: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
1320: 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 tem-path))).
1330: 3b 3b 20 3a 66 69 72 73 74 5f 65 72 72 0a 20 20 ;; :first_err.
1340: 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 68 61 (let ((val (ha
1350: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
1360: 61 75 6c 74 20 6f 74 68 65 72 64 61 74 20 22 3a ault otherdat ":
1370: 66 69 72 73 74 5f 65 72 72 22 20 23 66 29 29 29 first_err" #f)))
1380: 0a 20 20 20 20 20 20 28 69 66 20 76 61 6c 0a 09 . (if val..
1390: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 (sqlite3:execu
13a0: 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 65 te db "UPDATE te
13b0: 73 74 73 20 53 45 54 20 66 69 72 73 74 5f 65 72 sts SET first_er
13c0: 72 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 r=? WHERE run_id
13d0: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
13e0: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
13f0: 3f 3b 22 20 76 61 6c 20 72 75 6e 2d 69 64 20 74 ?;" val run-id t
1400: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
1410: 74 68 29 29 29 0a 20 20 20 20 3b 3b 20 3a 66 69 th))). ;; :fi
1420: 72 73 74 5f 77 61 72 6e 0a 20 20 20 20 28 6c 65 rst_warn. (le
1430: 74 20 28 28 76 61 6c 20 28 68 61 73 68 2d 74 61 t ((val (hash-ta
1440: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
1450: 6f 74 68 65 72 64 61 74 20 22 3a 66 69 72 73 74 otherdat ":first
1460: 5f 77 61 72 6e 22 20 23 66 29 29 29 0a 20 20 20 _warn" #f))).
1470: 20 20 20 28 69 66 20 76 61 6c 0a 09 20 20 28 73 (if val.. (s
1480: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 qlite3:execute d
1490: 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 b "UPDATE tests
14a0: 53 45 54 20 66 69 72 73 74 5f 77 61 72 6e 3d 3f SET first_warn=?
14b0: 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 WHERE run_id=?
14c0: 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 AND testname=? A
14d0: 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 ND item_path=?;"
14e0: 20 76 61 6c 20 72 75 6e 2d 69 64 20 74 65 73 74 val run-id test
14f0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
1500: 29 29 0a 20 20 20 20 3b 3b 20 3a 74 6f 6c 5f 70 )). ;; :tol_p
1510: 65 72 63 0a 20 20 20 20 28 6c 65 74 20 28 28 76 erc. (let ((v
1520: 61 6c 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 al (hash-table-r
1530: 65 66 2f 64 65 66 61 75 6c 74 20 6f 74 68 65 72 ef/default other
1540: 64 61 74 20 22 3a 74 6f 6c 5f 70 65 72 63 22 20 dat ":tol_perc"
1550: 23 66 29 29 29 0a 20 20 20 20 20 20 28 69 66 20 #f))). (if
1560: 76 61 6c 0a 09 20 20 28 73 71 6c 69 74 65 33 3a val.. (sqlite3:
1570: 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 41 execute db "UPDA
1580: 54 45 20 74 65 73 74 73 20 53 45 54 20 74 6f 6c TE tests SET tol
1590: 5f 70 65 72 63 3d 3f 20 57 48 45 52 45 20 72 75 _perc=? WHERE ru
15a0: 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e n_id=? AND testn
15b0: 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 ame=? AND item_p
15c0: 61 74 68 3d 3f 3b 22 20 76 61 6c 20 72 75 6e 2d ath=?;" val run-
15d0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
15e0: 6d 2d 70 61 74 68 29 29 29 0a 0a 20 20 20 20 3b m-path))).. ;
15f0: 3b 20 6e 65 65 64 20 74 6f 20 75 70 64 61 74 65 ; need to update
1600: 20 74 68 65 20 74 6f 70 20 74 65 73 74 20 72 65 the top test re
1610: 63 6f 72 64 20 69 66 20 50 41 53 53 20 6f 72 20 cord if PASS or
1620: 46 41 49 4c 20 61 6e 64 20 74 68 69 73 20 69 73 FAIL and this is
1630: 20 61 20 73 75 62 74 65 73 74 0a 20 20 20 20 28 a subtest. (
1640: 69 66 20 28 61 6e 64 20 28 6e 6f 74 20 28 65 71 if (and (not (eq
1650: 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 ual? item-path "
1660: 22 29 29 0a 09 20 20 20 20 20 28 6f 72 20 28 65 ")).. (or (e
1670: 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 50 41 qual? status "PA
1680: 53 53 22 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 SS")... (equal?
1690: 73 74 61 74 75 73 20 22 57 41 52 4e 22 29 0a 09 status "WARN")..
16a0: 09 20 28 65 71 75 61 6c 3f 20 73 74 61 74 75 73 . (equal? status
16b0: 20 22 46 41 49 4c 22 29 29 29 0a 09 28 62 65 67 "FAIL")))..(beg
16c0: 69 6e 0a 09 20 20 28 73 71 6c 69 74 65 33 3a 65 in.. (sqlite3:e
16d0: 78 65 63 75 74 65 20 0a 09 20 20 20 64 62 0a 09 xecute .. db..
16e0: 20 20 20 22 55 50 44 41 54 45 20 74 65 73 74 73 "UPDATE tests
16f0: 20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 53 . S
1700: 45 54 20 66 61 69 6c 5f 63 6f 75 6e 74 3d 28 53 ET fail_count=(S
1710: 45 4c 45 43 54 20 63 6f 75 6e 74 28 69 64 29 20 ELECT count(id)
1720: 46 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 FROM tests WHERE
1730: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
1740: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
1750: 6d 5f 70 61 74 68 20 21 3d 20 27 27 20 41 4e 44 m_path != '' AND
1760: 20 73 74 61 74 75 73 3d 27 46 41 49 4c 27 29 2c status='FAIL'),
1770: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1780: 20 20 70 61 73 73 5f 63 6f 75 6e 74 3d 28 53 45 pass_count=(SE
1790: 4c 45 43 54 20 63 6f 75 6e 74 28 69 64 29 20 46 LECT count(id) F
17a0: 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 ROM tests WHERE
17b0: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
17c0: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
17d0: 5f 70 61 74 68 20 21 3d 20 27 27 20 41 4e 44 20 _path != '' AND
17e0: 28 73 74 61 74 75 73 3d 27 50 41 53 53 27 20 4f (status='PASS' O
17f0: 52 20 73 74 61 74 75 73 3d 27 57 41 52 4e 27 29 R status='WARN')
1800: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 57 ). W
1810: 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e HERE run_id=? AN
1820: 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 D testname=? AND
1830: 20 69 74 65 6d 5f 70 61 74 68 3d 27 27 3b 22 0a item_path='';".
1840: 09 20 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d . run-id test-
1850: 6e 61 6d 65 20 72 75 6e 2d 69 64 20 74 65 73 74 name run-id test
1860: 2d 6e 61 6d 65 20 72 75 6e 2d 69 64 20 74 65 73 -name run-id tes
1870: 74 2d 6e 61 6d 65 29 0a 09 20 20 28 73 71 6c 69 t-name).. (sqli
1880: 74 65 33 3a 65 78 65 63 75 74 65 0a 09 20 20 20 te3:execute..
1890: 64 62 0a 09 20 20 20 22 55 50 44 41 54 45 20 74 db.. "UPDATE t
18a0: 65 73 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 ests.
18b0: 20 20 53 45 54 20 73 74 61 74 65 3d 43 41 53 45 SET state=CASE
18c0: 20 57 48 45 4e 20 28 53 45 4c 45 43 54 20 63 6f WHEN (SELECT co
18d0: 75 6e 74 28 69 64 29 20 46 52 4f 4d 20 74 65 73 unt(id) FROM tes
18e0: 74 73 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d ts WHERE run_id=
18f0: 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f ? AND testname=?
1900: 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 20 21 AND item_path !
1910: 3d 20 27 27 20 41 4e 44 20 73 74 61 74 65 20 69 = '' AND state i
1920: 6e 20 28 27 52 55 4e 4e 49 4e 47 27 2c 27 4e 4f n ('RUNNING','NO
1930: 54 5f 53 54 41 52 54 45 44 27 29 29 20 3e 20 30 T_STARTED')) > 0
1940: 20 54 48 45 4e 20 0a 20 20 20 20 20 20 20 20 20 THEN .
1950: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1960: 20 27 52 55 4e 4e 49 4e 47 27 0a 20 20 20 20 20 'RUNNING'.
1970: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1980: 20 20 45 4c 53 45 20 27 43 4f 4d 50 4c 45 54 45 ELSE 'COMPLETE
1990: 44 27 20 45 4e 44 2c 0a 20 20 20 20 20 20 20 20 D' END,.
19a0: 20 20 20 20 20 20 20 20 73 74 61 74 75 73 3d 43 status=C
19b0: 41 53 45 20 57 48 45 4e 20 66 61 69 6c 5f 63 6f ASE WHEN fail_co
19c0: 75 6e 74 20 3e 20 30 20 54 48 45 4e 20 27 46 41 unt > 0 THEN 'FA
19d0: 49 4c 27 20 57 48 45 4e 20 70 61 73 73 5f 63 6f IL' WHEN pass_co
19e0: 75 6e 74 20 3e 20 30 20 41 4e 44 20 66 61 69 6c unt > 0 AND fail
19f0: 5f 63 6f 75 6e 74 3d 30 20 54 48 45 4e 20 27 50 _count=0 THEN 'P
1a00: 41 53 53 27 20 45 4c 53 45 20 27 55 4e 4b 4e 4f ASS' ELSE 'UNKNO
1a10: 57 4e 27 20 45 4e 44 0a 20 20 20 20 20 20 20 20 WN' END.
1a20: 20 20 20 20 20 57 48 45 52 45 20 72 75 6e 5f 69 WHERE run_i
1a30: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
1a40: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
1a50: 3d 27 27 3b 22 0a 09 20 20 20 72 75 6e 2d 69 64 ='';".. run-id
1a60: 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d 69 test-name run-i
1a70: 64 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 d test-name))).
1a80: 20 20 20 28 69 66 20 28 61 6e 64 20 28 73 74 72 (if (and (str
1a90: 69 6e 67 3f 20 63 6f 6d 6d 65 6e 74 29 0a 09 20 ing? comment)..
1aa0: 20 20 20 20 28 73 74 72 69 6e 67 2d 6d 61 74 63 (string-matc
1ab0: 68 20 28 72 65 67 65 78 70 20 22 5c 5c 53 2b 22 h (regexp "\\S+"
1ac0: 29 20 63 6f 6d 6d 65 6e 74 29 29 0a 09 28 73 71 ) comment))..(sq
1ad0: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
1ae0: 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 "UPDATE tests S
1af0: 45 54 20 63 6f 6d 6d 65 6e 74 3d 3f 20 57 48 45 ET comment=? WHE
1b00: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
1b10: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
1b20: 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 0a 09 09 09 tem_path=?;"....
1b30: 20 28 63 61 72 20 63 6f 6d 6d 65 6e 74 29 20 72 (car comment) r
1b40: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
1b50: 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 item-path)).
1b60: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 ))..(define (tes
1b70: 74 2d 73 65 74 2d 6c 6f 67 21 20 64 62 20 72 75 t-set-log! db ru
1b80: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
1b90: 74 65 6d 64 61 74 20 6c 6f 67 66 29 20 0a 20 20 temdat logf) .
1ba0: 28 6c 65 74 20 28 28 69 74 65 6d 2d 70 61 74 68 (let ((item-path
1bb0: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 (item-list->pat
1bc0: 68 20 69 74 65 6d 64 61 74 29 29 29 0a 20 20 20 h itemdat))).
1bd0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
1be0: 65 20 64 62 20 22 55 50 44 41 54 45 20 74 65 73 e db "UPDATE tes
1bf0: 74 73 20 53 45 54 20 66 69 6e 61 6c 5f 6c 6f 67 ts SET final_log
1c00: 66 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 f=? WHERE run_id
1c10: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
1c20: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
1c30: 3f 3b 22 20 0a 09 09 20 20 20 20 20 6c 6f 67 66 ?;" ... logf
1c40: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
1c50: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 0a e item-path)))..
1c60: 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 73 65 (define (test-se
1c70: 74 2d 74 6f 70 6c 6f 67 21 20 64 62 20 72 75 6e t-toplog! db run
1c80: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 6c 6f -id test-name lo
1c90: 67 66 29 20 0a 20 20 28 73 71 6c 69 74 65 33 3a gf) . (sqlite3:
1ca0: 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 41 execute db "UPDA
1cb0: 54 45 20 74 65 73 74 73 20 53 45 54 20 66 69 6e TE tests SET fin
1cc0: 61 6c 5f 6c 6f 67 66 3d 3f 20 57 48 45 52 45 20 al_logf=? WHERE
1cd0: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
1ce0: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
1cf0: 5f 70 61 74 68 3d 27 27 3b 22 20 0a 09 09 20 20 _path='';" ...
1d00: 20 6c 6f 67 66 20 72 75 6e 2d 69 64 20 74 65 73 logf run-id tes
1d10: 74 2d 6e 61 6d 65 29 29 0a 0a 28 64 65 66 69 6e t-name))..(defin
1d20: 65 20 28 74 65 73 74 73 3a 73 75 6d 6d 61 72 69 e (tests:summari
1d30: 7a 65 2d 69 74 65 6d 73 20 64 62 20 72 75 6e 2d ze-items db run-
1d40: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 66 6f 72 id test-name for
1d50: 63 65 29 0a 20 20 3b 3b 20 69 66 20 6e 6f 74 20 ce). ;; if not
1d60: 66 6f 72 63 65 20 74 68 65 6e 20 6f 6e 6c 79 20 force then only
1d70: 75 70 64 61 74 65 20 74 68 65 20 72 65 63 6f 72 update the recor
1d80: 64 20 69 66 20 6f 6e 65 20 6f 66 20 74 68 65 73 d if one of thes
1d90: 65 20 69 73 20 74 72 75 65 3a 0a 20 20 3b 3b 20 e is true:. ;;
1da0: 20 20 31 2e 20 6c 6f 67 66 20 69 73 20 22 6c 6f 1. logf is "lo
1db0: 67 2f 66 69 6e 61 6c 2e 6c 6f 67 0a 20 20 3b 3b g/final.log. ;;
1dc0: 20 20 20 32 2e 20 6c 6f 67 66 20 69 73 20 73 61 2. logf is sa
1dd0: 6d 65 20 61 73 20 6f 75 74 70 75 74 66 69 6c 65 me as outputfile
1de0: 6e 61 6d 65 0a 20 20 28 6c 65 74 20 28 28 6f 75 name. (let ((ou
1df0: 74 70 75 74 66 69 6c 65 6e 61 6d 65 20 28 63 6f tputfilename (co
1e00: 6e 63 20 22 6d 65 67 61 74 65 73 74 2d 72 6f 6c nc "megatest-rol
1e10: 6c 75 70 2d 22 20 74 65 73 74 2d 6e 61 6d 65 20 lup-" test-name
1e20: 22 2e 68 74 6d 6c 22 29 29 0a 09 28 6f 72 69 67 ".html"))..(orig
1e30: 2d 64 69 72 20 20 20 20 20 20 20 28 63 75 72 72 -dir (curr
1e40: 65 6e 74 2d 64 69 72 65 63 74 6f 72 79 29 29 0a ent-directory)).
1e50: 09 28 6c 6f 67 66 20 20 20 20 20 20 20 20 20 20 .(logf
1e60: 20 23 66 29 29 0a 20 20 20 20 28 73 71 6c 69 74 #f)). (sqlit
1e70: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 e3:for-each-row
1e80: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 70 . (lambda (p
1e90: 61 74 68 20 66 69 6e 61 6c 5f 6c 6f 67 66 29 0a ath final_logf).
1ea0: 20 20 20 20 20 20 20 28 73 65 74 21 20 6c 6f 67 (set! log
1eb0: 66 20 66 69 6e 61 6c 5f 6c 6f 67 66 29 0a 20 20 f final_logf).
1ec0: 20 20 20 20 20 28 69 66 20 28 64 69 72 65 63 74 (if (direct
1ed0: 6f 72 79 3f 20 70 61 74 68 29 0a 09 20 20 20 28 ory? path).. (
1ee0: 62 65 67 69 6e 0a 09 20 20 20 20 20 28 70 72 69 begin.. (pri
1ef0: 6e 74 20 22 46 6f 75 6e 64 20 70 61 74 68 3a 20 nt "Found path:
1f00: 22 20 70 61 74 68 29 0a 09 20 20 20 20 20 28 63 " path).. (c
1f10: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 hange-directory
1f20: 70 61 74 68 29 29 0a 09 20 20 20 20 20 3b 3b 20 path)).. ;;
1f30: 28 73 65 74 21 20 6f 75 74 70 75 74 66 69 6c 65 (set! outputfile
1f40: 6e 61 6d 65 20 28 63 6f 6e 63 20 70 61 74 68 20 name (conc path
1f50: 22 2f 22 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 "/" outputfilena
1f60: 6d 65 29 29 29 0a 09 20 20 20 28 70 72 69 6e 74 me))).. (print
1f70: 20 22 4e 6f 20 73 75 63 68 20 70 61 74 68 3a 20 "No such path:
1f80: 22 20 70 61 74 68 29 29 29 0a 20 20 20 20 20 64 " path))). d
1f90: 62 20 0a 20 20 20 20 20 22 53 45 4c 45 43 54 20 b . "SELECT
1fa0: 72 75 6e 64 69 72 2c 66 69 6e 61 6c 5f 6c 6f 67 rundir,final_log
1fb0: 66 20 46 52 4f 4d 20 74 65 73 74 73 20 57 48 45 f FROM tests WHE
1fc0: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
1fd0: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
1fe0: 74 65 6d 5f 70 61 74 68 3d 27 27 3b 22 0a 20 20 tem_path='';".
1ff0: 20 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e run-id test-n
2000: 61 6d 65 29 0a 20 20 20 20 28 70 72 69 6e 74 20 ame). (print
2010: 22 73 75 6d 6d 61 72 69 7a 65 2d 69 74 65 6d 73 "summarize-items
2020: 20 77 69 74 68 20 6c 6f 67 66 20 22 20 6c 6f 67 with logf " log
2030: 66 29 0a 20 20 20 20 28 69 66 20 28 6f 72 20 28 f). (if (or (
2040: 65 71 75 61 6c 3f 20 6c 6f 67 66 20 22 6c 6f 67 equal? logf "log
2050: 73 2f 66 69 6e 61 6c 2e 6c 6f 67 22 29 0a 09 20 s/final.log")..
2060: 20 20 20 28 65 71 75 61 6c 3f 20 6c 6f 67 66 20 (equal? logf
2070: 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 0a outputfilename).
2080: 09 20 20 20 20 66 6f 72 63 65 29 0a 09 28 62 65 . force)..(be
2090: 67 69 6e 0a 09 20 20 28 69 66 20 28 6f 62 74 61 gin.. (if (obta
20a0: 69 6e 2d 64 6f 74 2d 6c 6f 63 6b 20 6f 75 74 70 in-dot-lock outp
20b0: 75 74 66 69 6c 65 6e 61 6d 65 20 31 20 32 30 20 utfilename 1 20
20c0: 33 30 29 20 3b 3b 20 72 65 74 72 79 20 65 76 65 30) ;; retry eve
20d0: 72 79 20 73 65 63 6f 6e 64 20 66 6f 72 20 32 30 ry second for 20
20e0: 20 73 65 63 6f 6e 64 73 2c 20 63 61 6c 6c 20 69 seconds, call i
20f0: 74 20 64 65 61 64 20 61 66 74 65 72 20 33 30 20 t dead after 30
2100: 73 65 63 6f 6e 64 73 20 61 6e 64 20 73 74 65 61 seconds and stea
2110: 6c 20 74 68 65 20 6c 6f 63 6b 0a 09 20 20 20 20 l the lock..
2120: 20 20 28 70 72 69 6e 74 20 22 4f 62 74 61 69 6e (print "Obtain
2130: 65 64 20 6c 6f 63 6b 20 66 6f 72 20 22 20 6f 75 ed lock for " ou
2140: 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 0a 09 20 tputfilename)..
2150: 20 20 20 20 20 28 70 72 69 6e 74 20 22 46 61 69 (print "Fai
2160: 6c 65 64 20 74 6f 20 6f 62 74 61 69 6e 20 6c 6f led to obtain lo
2170: 63 6b 20 66 6f 72 20 22 20 6f 75 74 70 75 74 66 ck for " outputf
2180: 69 6c 65 6e 61 6d 65 29 29 0a 09 20 20 28 6c 65 ilename)).. (le
2190: 74 20 28 28 6f 75 70 20 20 20 20 28 6f 70 65 6e t ((oup (open
21a0: 2d 6f 75 74 70 75 74 2d 66 69 6c 65 20 6f 75 74 -output-file out
21b0: 70 75 74 66 69 6c 65 6e 61 6d 65 29 29 0a 09 09 putfilename))...
21c0: 28 63 6f 75 6e 74 73 20 28 6d 61 6b 65 2d 68 61 (counts (make-ha
21d0: 73 68 2d 74 61 62 6c 65 29 29 0a 09 09 28 73 74 sh-table))...(st
21e0: 61 74 65 63 6f 75 6e 74 73 20 28 6d 61 6b 65 2d atecounts (make-
21f0: 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 09 28 hash-table))...(
2200: 6f 75 74 74 78 74 20 22 22 29 0a 09 09 28 74 6f outtxt "")...(to
2210: 74 20 20 20 20 30 29 29 0a 09 20 20 20 20 28 77 t 0)).. (w
2220: 69 74 68 2d 6f 75 74 70 75 74 2d 74 6f 2d 70 6f ith-output-to-po
2230: 72 74 0a 09 09 6f 75 70 0a 09 20 20 20 20 20 20 rt...oup..
2240: 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 28 73 65 (lambda ()...(se
2250: 74 21 20 6f 75 74 74 78 74 20 28 63 6f 6e 63 20 t! outtxt (conc
2260: 6f 75 74 74 78 74 20 22 3c 68 74 6d 6c 3e 3c 74 outtxt "<html><t
2270: 69 74 6c 65 3e 53 75 6d 6d 61 72 79 3a 20 22 20 itle>Summary: "
2280: 74 65 73 74 2d 6e 61 6d 65 20 0a 09 09 09 09 20 test-name .....
2290: 20 20 22 3c 2f 74 69 74 6c 65 3e 3c 62 6f 64 79 "</title><body
22a0: 3e 3c 68 32 3e 53 75 6d 6d 61 72 79 20 66 6f 72 ><h2>Summary for
22b0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 3c 2f " test-name "</
22c0: 68 32 3e 22 29 29 0a 09 09 28 73 71 6c 69 74 65 h2>"))...(sqlite
22d0: 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 3:for-each-row .
22e0: 09 09 20 28 6c 61 6d 62 64 61 20 28 69 64 20 69 .. (lambda (id i
22f0: 74 65 6d 70 61 74 68 20 73 74 61 74 65 20 73 74 tempath state st
2300: 61 74 75 73 20 72 75 6e 5f 64 75 72 61 74 69 6f atus run_duratio
2310: 6e 20 6c 6f 67 66 20 63 6f 6d 6d 65 6e 74 29 0a n logf comment).
2320: 09 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 .. (hash-table
2330: 2d 73 65 74 21 20 63 6f 75 6e 74 73 20 73 74 61 -set! counts sta
2340: 74 75 73 20 28 2b 20 31 20 28 68 61 73 68 2d 74 tus (+ 1 (hash-t
2350: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
2360: 20 63 6f 75 6e 74 73 20 73 74 61 74 75 73 20 30 counts status 0
2370: 29 29 29 0a 09 09 20 20 20 28 68 61 73 68 2d 74 )))... (hash-t
2380: 61 62 6c 65 2d 73 65 74 21 20 73 74 61 74 65 63 able-set! statec
2390: 6f 75 6e 74 73 20 73 74 61 74 65 20 28 2b 20 31 ounts state (+ 1
23a0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
23b0: 2f 64 65 66 61 75 6c 74 20 73 74 61 74 65 63 6f /default stateco
23c0: 75 6e 74 73 20 73 74 61 74 65 20 30 29 29 29 0a unts state 0))).
23d0: 09 09 20 20 20 28 73 65 74 21 20 6f 75 74 74 78 .. (set! outtx
23e0: 74 20 28 63 6f 6e 63 20 6f 75 74 74 78 74 20 22 t (conc outtxt "
23f0: 3c 74 72 3e 22 0a 09 09 09 09 20 20 20 20 20 20 <tr>".....
2400: 22 3c 74 64 3e 3c 61 20 68 72 65 66 3d 5c 22 22 "<td><a href=\""
2410: 20 69 74 65 6d 70 61 74 68 20 22 2f 22 20 6c 6f itempath "/" lo
2420: 67 66 20 22 5c 22 3e 20 22 20 69 74 65 6d 70 61 gf "\"> " itempa
2430: 74 68 20 22 3c 2f 61 3e 3c 2f 74 64 3e 22 20 0a th "</a></td>" .
2440: 09 09 09 09 20 20 20 20 20 20 22 3c 74 64 3e 22 .... "<td>"
2450: 20 73 74 61 74 65 20 20 20 20 22 3c 2f 74 64 3e state "</td>
2460: 22 20 0a 09 09 09 09 20 20 20 20 20 20 22 3c 74 " ..... "<t
2470: 64 3e 3c 66 6f 6e 74 20 63 6f 6c 6f 72 3d 22 20 d><font color="
2480: 28 63 6f 6d 6d 6f 6e 3a 67 65 74 2d 63 6f 6c 6f (common:get-colo
2490: 72 2d 66 72 6f 6d 2d 73 74 61 74 75 73 20 73 74 r-from-status st
24a0: 61 74 75 73 29 0a 09 09 09 09 20 20 20 20 20 20 atus).....
24b0: 22 3e 22 20 20 20 73 74 61 74 75 73 20 20 20 22 ">" status "
24c0: 3c 2f 66 6f 6e 74 3e 3c 2f 74 64 3e 22 0a 09 09 </font></td>"...
24d0: 09 09 20 20 20 20 20 20 22 3c 74 64 3e 22 20 28 .. "<td>" (
24e0: 69 66 20 28 65 71 75 61 6c 3f 20 63 6f 6d 6d 65 if (equal? comme
24f0: 6e 74 20 22 22 29 0a 09 09 09 09 09 09 20 22 26 nt "")....... "&
2500: 6e 62 73 70 3b 22 0a 09 09 09 09 09 09 20 63 6f nbsp;"....... co
2510: 6d 6d 65 6e 74 29 20 22 3c 2f 74 64 3e 22 0a 09 mment) "</td>"..
2520: 09 09 09 09 09 20 22 3c 2f 74 72 3e 22 29 29 29 ..... "</tr>")))
2530: 0a 09 09 20 64 62 0a 09 09 20 22 53 45 4c 45 43 ... db... "SELEC
2540: 54 20 69 64 2c 69 74 65 6d 5f 70 61 74 68 2c 73 T id,item_path,s
2550: 74 61 74 65 2c 73 74 61 74 75 73 2c 72 75 6e 5f tate,status,run_
2560: 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c duration,final_l
2570: 6f 67 66 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d ogf,comment FROM
2580: 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 6e tests WHERE run
2590: 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 _id=? AND testna
25a0: 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 me=? AND item_pa
25b0: 74 68 20 21 3d 20 27 27 3b 22 0a 09 09 20 72 75 th != '';"... ru
25c0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a n-id test-name).
25d0: 0a 09 09 28 70 72 69 6e 74 20 22 3c 74 61 62 6c ...(print "<tabl
25e0: 65 3e 3c 74 72 3e 3c 74 64 20 76 61 6c 69 67 6e e><tr><td valign
25f0: 3d 5c 22 74 6f 70 5c 22 3e 22 29 0a 09 09 3b 3b =\"top\">")...;;
2600: 20 50 72 69 6e 74 20 6f 75 74 20 73 74 61 74 73 Print out stats
2610: 20 66 6f 72 20 73 74 61 74 75 73 0a 09 09 28 73 for status...(s
2620: 65 74 21 20 74 6f 74 20 30 29 0a 09 09 28 70 72 et! tot 0)...(pr
2630: 69 6e 74 20 22 3c 74 61 62 6c 65 20 63 65 6c 6c int "<table cell
2640: 73 70 61 63 69 6e 67 3d 5c 22 30 5c 22 20 62 6f spacing=\"0\" bo
2650: 72 64 65 72 3d 5c 22 31 5c 22 3e 3c 74 72 3e 3c rder=\"1\"><tr><
2660: 74 64 20 63 6f 6c 73 70 61 6e 3d 5c 22 32 5c 22 td colspan=\"2\"
2670: 3e 3c 68 32 3e 53 74 61 74 65 20 73 74 61 74 73 ><h2>State stats
2680: 3c 2f 68 32 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 22 </h2></td></tr>"
2690: 29 0a 09 09 28 66 6f 72 2d 65 61 63 68 20 28 6c )...(for-each (l
26a0: 61 6d 62 64 61 20 28 73 74 61 74 65 29 0a 09 09 ambda (state)...
26b0: 09 20 20 20 20 28 73 65 74 21 20 74 6f 74 20 28 . (set! tot (
26c0: 2b 20 74 6f 74 20 28 68 61 73 68 2d 74 61 62 6c + tot (hash-tabl
26d0: 65 2d 72 65 66 20 73 74 61 74 65 63 6f 75 6e 74 e-ref statecount
26e0: 73 20 73 74 61 74 65 29 29 29 0a 09 09 09 20 20 s state)))....
26f0: 20 20 28 70 72 69 6e 74 20 22 3c 74 72 3e 3c 74 (print "<tr><t
2700: 64 3e 22 20 73 74 61 74 65 20 22 3c 2f 74 64 3e d>" state "</td>
2710: 3c 74 64 3e 22 20 28 68 61 73 68 2d 74 61 62 6c <td>" (hash-tabl
2720: 65 2d 72 65 66 20 73 74 61 74 65 63 6f 75 6e 74 e-ref statecount
2730: 73 20 73 74 61 74 65 29 20 22 3c 2f 74 64 3e 3c s state) "</td><
2740: 2f 74 72 3e 22 29 29 0a 09 09 09 20 20 28 68 61 /tr>")).... (ha
2750: 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 73 74 sh-table-keys st
2760: 61 74 65 63 6f 75 6e 74 73 29 29 0a 09 09 28 70 atecounts))...(p
2770: 72 69 6e 74 20 22 3c 74 72 3e 3c 74 64 3e 54 6f rint "<tr><td>To
2780: 74 61 6c 3c 2f 74 64 3e 3c 74 64 3e 22 20 74 6f tal</td><td>" to
2790: 74 20 22 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 t "</td></tr></t
27a0: 61 62 6c 65 3e 22 29 0a 09 09 28 70 72 69 6e 74 able>")...(print
27b0: 20 22 3c 2f 74 64 3e 3c 74 64 20 76 61 6c 69 67 "</td><td valig
27c0: 6e 3d 5c 22 74 6f 70 5c 22 3e 22 29 0a 09 09 3b n=\"top\">")...;
27d0: 3b 20 50 72 69 6e 74 20 6f 75 74 20 73 74 61 74 ; Print out stat
27e0: 73 20 66 6f 72 20 73 74 61 74 65 0a 09 09 28 73 s for state...(s
27f0: 65 74 21 20 74 6f 74 20 30 29 0a 09 09 28 70 72 et! tot 0)...(pr
2800: 69 6e 74 20 22 3c 74 61 62 6c 65 20 63 65 6c 6c int "<table cell
2810: 73 70 61 63 69 6e 67 3d 5c 22 30 5c 22 20 62 6f spacing=\"0\" bo
2820: 72 64 65 72 3d 5c 22 31 5c 22 3e 3c 74 72 3e 3c rder=\"1\"><tr><
2830: 74 64 20 63 6f 6c 73 70 61 6e 3d 5c 22 32 5c 22 td colspan=\"2\"
2840: 3e 3c 68 32 3e 53 74 61 74 75 73 20 73 74 61 74 ><h2>Status stat
2850: 73 3c 2f 68 32 3e 3c 2f 74 64 3e 3c 2f 74 72 3e s</h2></td></tr>
2860: 22 29 0a 09 09 28 66 6f 72 2d 65 61 63 68 20 28 ")...(for-each (
2870: 6c 61 6d 62 64 61 20 28 73 74 61 74 75 73 29 0a lambda (status).
2880: 09 09 09 20 20 20 20 28 73 65 74 21 20 74 6f 74 ... (set! tot
2890: 20 28 2b 20 74 6f 74 20 28 68 61 73 68 2d 74 61 (+ tot (hash-ta
28a0: 62 6c 65 2d 72 65 66 20 63 6f 75 6e 74 73 20 73 ble-ref counts s
28b0: 74 61 74 75 73 29 29 29 0a 09 09 09 20 20 20 20 tatus)))....
28c0: 28 70 72 69 6e 74 20 22 3c 74 72 3e 3c 74 64 3e (print "<tr><td>
28d0: 3c 66 6f 6e 74 20 63 6f 6c 6f 72 3d 5c 22 22 20 <font color=\""
28e0: 28 63 6f 6d 6d 6f 6e 3a 67 65 74 2d 63 6f 6c 6f (common:get-colo
28f0: 72 2d 66 72 6f 6d 2d 73 74 61 74 75 73 20 73 74 r-from-status st
2900: 61 74 75 73 29 20 22 5c 22 3e 22 20 73 74 61 74 atus) "\">" stat
2910: 75 73 0a 09 09 09 09 20 20 20 22 3c 2f 66 6f 6e us..... "</fon
2920: 74 3e 3c 2f 74 64 3e 3c 74 64 3e 22 20 28 68 61 t></td><td>" (ha
2930: 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 63 6f 75 sh-table-ref cou
2940: 6e 74 73 20 73 74 61 74 75 73 29 20 22 3c 2f 74 nts status) "</t
2950: 64 3e 3c 2f 74 72 3e 22 29 29 0a 09 09 09 20 20 d></tr>"))....
2960: 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 (hash-table-keys
2970: 20 63 6f 75 6e 74 73 29 29 0a 09 09 28 70 72 69 counts))...(pri
2980: 6e 74 20 22 3c 74 72 3e 3c 74 64 3e 54 6f 74 61 nt "<tr><td>Tota
2990: 6c 3c 2f 74 64 3e 3c 74 64 3e 22 20 74 6f 74 20 l</td><td>" tot
29a0: 22 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 "</td></tr></tab
29b0: 6c 65 3e 22 29 0a 09 09 28 70 72 69 6e 74 20 22 le>")...(print "
29c0: 3c 2f 74 64 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 3c </td></td></tr><
29d0: 2f 74 61 62 6c 65 3e 22 29 0a 0a 09 09 28 70 72 /table>")....(pr
29e0: 69 6e 74 20 22 3c 74 61 62 6c 65 20 63 65 6c 6c int "<table cell
29f0: 73 70 61 63 69 6e 67 3d 5c 22 30 5c 22 20 62 6f spacing=\"0\" bo
2a00: 72 64 65 72 3d 5c 22 31 5c 22 3e 22 20 0a 09 09 rder=\"1\">" ...
2a10: 20 20 20 20 20 20 20 22 3c 74 72 3e 3c 74 64 3e "<tr><td>
2a20: 49 74 65 6d 3c 2f 74 64 3e 3c 74 64 3e 53 74 61 Item</td><td>Sta
2a30: 74 65 3c 2f 74 64 3e 3c 74 64 3e 53 74 61 74 75 te</td><td>Statu
2a40: 73 3c 2f 74 64 3e 3c 74 64 3e 43 6f 6d 6d 65 6e s</td><td>Commen
2a50: 74 3c 2f 74 64 3e 22 0a 09 09 20 20 20 20 20 20 t</td>"...
2a60: 20 6f 75 74 74 78 74 20 22 3c 2f 74 61 62 6c 65 outtxt "</table
2a70: 3e 3c 2f 62 6f 64 79 3e 3c 2f 68 74 6d 6c 3e 22 ></body></html>"
2a80: 29 0a 09 09 28 72 65 6c 65 61 73 65 2d 64 6f 74 )...(release-dot
2a90: 2d 6c 6f 63 6b 20 6f 75 74 70 75 74 66 69 6c 65 -lock outputfile
2aa0: 6e 61 6d 65 29 29 29 0a 09 20 20 20 20 28 63 6c name))).. (cl
2ab0: 6f 73 65 2d 6f 75 74 70 75 74 2d 70 6f 72 74 20 ose-output-port
2ac0: 6f 75 70 29 0a 09 20 20 20 20 28 63 68 61 6e 67 oup).. (chang
2ad0: 65 2d 64 69 72 65 63 74 6f 72 79 20 6f 72 69 67 e-directory orig
2ae0: 2d 64 69 72 29 0a 09 20 20 20 20 28 74 65 73 74 -dir).. (test
2af0: 2d 73 65 74 2d 74 6f 70 6c 6f 67 21 20 64 62 20 -set-toplog! db
2b00: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
2b10: 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 outputfilename)
2b20: 0a 09 20 20 20 20 29 29 29 29 29 0a 0a 3b 3b 20 .. )))))..;;
2b30: 3b 3b 20 54 4f 44 4f 3a 20 43 6f 6e 76 65 72 67 ;; TODO: Converg
2b40: 65 20 74 68 69 73 20 77 69 74 68 20 64 62 3a 67 e this with db:g
2b50: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 0a 3b 3b 20 et-test-info.;;
2b60: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 (define (runs:ge
2b70: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 t-test-info db r
2b80: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
2b90: 69 74 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 20 20 item-path).;;
2ba0: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 20 (let ((res #f))
2bb0: 3b 3b 20 28 76 65 63 74 6f 72 20 23 66 20 23 66 ;; (vector #f #f
2bc0: 20 23 66 20 23 66 20 23 66 20 23 66 29 29 29 0a #f #f #f #f))).
2bd0: 3b 3b 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a ;; (sqlite3:
2be0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 3b 3b for-each-row .;;
2bf0: 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 69 (lambda (i
2c00: 64 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 d run-id test-na
2c10: 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 29 me state status)
2c20: 0a 3b 3b 20 20 20 20 20 20 20 20 28 73 65 74 21 .;; (set!
2c30: 20 72 65 73 20 28 76 65 63 74 6f 72 20 69 64 20 res (vector id
2c40: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
2c50: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 69 74 state status it
2c60: 65 6d 2d 70 61 74 68 29 29 29 0a 3b 3b 20 20 20 em-path))).;;
2c70: 20 20 20 64 62 20 22 53 45 4c 45 43 54 20 69 64 db "SELECT id
2c80: 2c 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 ,run_id,testname
2c90: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 20 46 52 ,state,status FR
2ca0: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 OM tests WHERE r
2cb0: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
2cc0: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
2cd0: 70 61 74 68 3d 3f 3b 22 0a 3b 3b 20 20 20 20 20 path=?;".;;
2ce0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
2cf0: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 e item-path).;;
2d00: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 res))..(defi
2d10: 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a ne-inline (test:
2d20: 67 65 74 2d 69 64 20 76 65 63 29 20 20 20 20 20 get-id vec)
2d30: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 76 65 (vector-ref ve
2d40: 63 20 30 29 29 0a 28 64 65 66 69 6e 65 2d 69 6e c 0)).(define-in
2d50: 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d 72 line (test:get-r
2d60: 75 6e 5f 69 64 20 76 65 63 29 20 20 20 28 76 65 un_id vec) (ve
2d70: 63 74 6f 72 2d 72 65 66 20 76 65 63 20 31 29 29 ctor-ref vec 1))
2d80: 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 .(define-inline
2d90: 28 74 65 73 74 3a 67 65 74 2d 74 65 73 74 2d 6e (test:get-test-n
2da0: 61 6d 65 20 76 65 63 29 28 76 65 63 74 6f 72 2d ame vec)(vector-
2db0: 72 65 66 20 76 65 63 20 32 29 29 0a 28 64 65 66 ref vec 2)).(def
2dc0: 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 ine-inline (test
2dd0: 3a 67 65 74 2d 73 74 61 74 65 20 76 65 63 29 20 :get-state vec)
2de0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 76 (vector-ref v
2df0: 65 63 20 33 29 29 0a 28 64 65 66 69 6e 65 2d 69 ec 3)).(define-i
2e00: 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d nline (test:get-
2e10: 73 74 61 74 75 73 20 76 65 63 29 20 20 20 28 76 status vec) (v
2e20: 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 34 29 ector-ref vec 4)
2e30: 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 ).(define-inline
2e40: 20 28 74 65 73 74 3a 67 65 74 2d 69 74 65 6d 2d (test:get-item-
2e50: 70 61 74 68 20 76 65 63 29 28 76 65 63 74 6f 72 path vec)(vector
2e60: 2d 72 65 66 20 76 65 63 20 35 29 29 0a 0a 28 64 -ref vec 5))..(d
2e70: 65 66 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 efine (runs:test
2e80: 2d 67 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 -get-full-path t
2e90: 65 73 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 est). (let* ((t
2ea0: 65 73 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 estname (db:test
2eb0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 -get-testname
2ec0: 74 65 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 test)).. (itempa
2ed0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
2ee0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
2ef0: 29 0a 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 ). (conc test
2f00: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f name (if (equal?
2f10: 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 itempath "") ""
2f20: 20 28 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 (conc "(" itemp
2f30: 61 74 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 ath ")")))))..(d
2f40: 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 efine-inline (te
2f50: 73 74 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c st:test-get-full
2f60: 6e 61 6d 65 20 74 65 73 74 29 0a 20 20 20 28 63 name test). (c
2f70: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 onc (db:test-get
2f80: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 0a -testname test).
2f90: 09 20 28 69 66 20 28 65 71 75 61 6c 3f 20 28 64 . (if (equal? (d
2fa0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
2fb0: 70 61 74 68 20 74 65 73 74 29 20 22 22 29 0a 09 path test) "")..
2fc0: 20 20 20 20 20 22 22 0a 09 20 20 20 20 20 28 63 "".. (c
2fd0: 6f 6e 63 20 22 28 22 20 28 64 62 3a 74 65 73 74 onc "(" (db:test
2fe0: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
2ff0: 65 73 74 29 20 22 29 22 29 29 29 29 0a 0a 28 64 est) ")"))))..(d
3000: 65 66 69 6e 65 20 28 63 68 65 63 6b 2d 76 61 6c efine (check-val
3010: 69 64 2d 69 74 65 6d 73 20 63 6c 61 73 73 20 69 id-items class i
3020: 74 65 6d 29 0a 20 20 28 6c 65 74 20 28 28 76 61 tem). (let ((va
3030: 6c 69 64 2d 76 61 6c 75 65 73 20 28 6c 65 74 20 lid-values (let
3040: 28 28 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b ((s (config-look
3050: 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 up *configdat* "
3060: 76 61 6c 69 64 76 61 6c 75 65 73 22 20 63 6c 61 validvalues" cla
3070: 73 73 29 29 29 0a 09 09 09 28 69 66 20 73 20 28 ss)))....(if s (
3080: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 29 20 string-split s)
3090: 23 66 29 29 29 29 0a 20 20 20 20 28 69 66 20 76 #f)))). (if v
30a0: 61 6c 69 64 2d 76 61 6c 75 65 73 0a 09 28 69 66 alid-values..(if
30b0: 20 28 6d 65 6d 62 65 72 20 69 74 65 6d 20 76 61 (member item va
30c0: 6c 69 64 2d 76 61 6c 75 65 73 29 0a 09 20 20 20 lid-values)..
30d0: 20 69 74 65 6d 20 23 66 29 0a 09 69 74 65 6d 29 item #f)..item)
30e0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 ))..(define (tes
30f0: 74 73 74 65 70 2d 73 65 74 2d 73 74 61 74 75 73 tstep-set-status
3100: 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 ! db run-id test
3110: 2d 6e 61 6d 65 20 74 65 73 74 73 74 65 70 2d 6e -name teststep-n
3120: 61 6d 65 20 73 74 61 74 65 2d 69 6e 20 73 74 61 ame state-in sta
3130: 74 75 73 2d 69 6e 20 69 74 65 6d 64 61 74 20 63 tus-in itemdat c
3140: 6f 6d 6d 65 6e 74 29 0a 20 20 28 64 65 62 75 67 omment). (debug
3150: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 2d 69 64 :print 4 "run-id
3160: 3a 20 22 20 72 75 6e 2d 69 64 20 22 20 74 65 73 : " run-id " tes
3170: 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e t-name: " test-n
3180: 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 28 28 73 ame). (let* ((s
3190: 74 61 74 65 20 20 20 20 20 28 63 68 65 63 6b 2d tate (check-
31a0: 76 61 6c 69 64 2d 69 74 65 6d 73 20 22 73 74 61 valid-items "sta
31b0: 74 65 22 20 73 74 61 74 65 2d 69 6e 29 29 0a 09 te" state-in))..
31c0: 20 28 73 74 61 74 75 73 20 20 20 20 28 63 68 65 (status (che
31d0: 63 6b 2d 76 61 6c 69 64 2d 69 74 65 6d 73 20 22 ck-valid-items "
31e0: 73 74 61 74 75 73 22 20 73 74 61 74 75 73 2d 69 status" status-i
31f0: 6e 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 n)).. (item-path
3200: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 (item-list->pat
3210: 68 20 69 74 65 6d 64 61 74 29 29 0a 09 20 28 74 h itemdat)).. (t
3220: 65 73 74 64 61 74 20 20 20 28 64 62 3a 67 65 74 estdat (db:get
3230: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 -test-info db ru
3240: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
3250: 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 tem-path))).
3260: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 (debug:print 5 "
3270: 74 65 73 74 64 61 74 3a 20 22 20 74 65 73 74 64 testdat: " testd
3280: 61 74 29 0a 20 20 20 20 28 69 66 20 28 61 6e 64 at). (if (and
3290: 20 74 65 73 74 64 61 74 20 3b 3b 20 69 66 20 74 testdat ;; if t
32a0: 68 65 20 73 65 63 74 69 6f 6e 20 65 78 69 73 74 he section exist
32b0: 73 20 74 68 65 6e 20 66 6f 72 63 65 20 73 70 65 s then force spe
32c0: 63 69 66 69 63 61 74 69 6f 6e 20 42 55 47 2c 20 cification BUG,
32d0: 49 20 64 6f 6e 27 74 20 6c 69 6b 65 20 68 6f 77 I don't like how
32e0: 20 74 68 69 73 20 77 6f 72 6b 73 2e 0a 09 20 20 this works...
32f0: 20 20 20 28 6f 72 20 28 6e 6f 74 20 73 74 61 74 (or (not stat
3300: 65 29 28 6e 6f 74 20 73 74 61 74 75 73 29 29 29 e)(not status)))
3310: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 ..(debug:print 0
3320: 20 22 57 41 52 4e 49 4e 47 3a 20 49 6e 76 61 6c "WARNING: Inval
3330: 69 64 20 22 20 28 69 66 20 73 74 61 74 75 73 20 id " (if status
3340: 22 73 74 61 74 75 73 22 20 22 73 74 61 74 65 22 "status" "state"
3350: 29 0a 09 20 20 20 20 20 20 20 22 20 76 61 6c 75 ).. " valu
3360: 65 20 5c 22 22 20 28 69 66 20 73 74 61 74 75 73 e \"" (if status
3370: 20 73 74 61 74 75 73 2d 69 6e 20 73 74 61 74 65 status-in state
3380: 2d 69 6e 29 20 22 5c 22 2c 20 75 70 64 61 74 65 -in) "\", update
3390: 20 79 6f 75 72 20 76 61 6c 69 64 73 74 61 74 65 your validstate
33a0: 73 20 73 65 63 74 69 6f 6e 20 69 6e 20 6d 65 67 s section in meg
33b0: 61 74 65 73 74 2e 63 6f 6e 66 69 67 22 29 29 0a atest.config")).
33c0: 20 20 20 20 28 69 66 20 74 65 73 74 64 61 74 0a (if testdat.
33d0: 09 28 6c 65 74 20 28 28 74 65 73 74 2d 69 64 20 .(let ((test-id
33e0: 28 74 65 73 74 3a 67 65 74 2d 69 64 20 74 65 73 (test:get-id tes
33f0: 74 64 61 74 29 29 29 0a 09 20 20 28 73 71 6c 69 tdat))).. (sqli
3400: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 0a te3:execute db .
3410: 09 09 09 22 49 4e 53 45 52 54 20 4f 52 20 52 45 ..."INSERT OR RE
3420: 50 4c 41 43 45 20 69 6e 74 6f 20 74 65 73 74 5f PLACE into test_
3430: 73 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 steps (test_id,s
3440: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 tepname,state,st
3450: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c atus,event_time,
3460: 63 6f 6d 6d 65 6e 74 29 20 56 41 4c 55 45 53 28 comment) VALUES(
3470: 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 ?,?,?,?,strftime
3480: 28 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f 29 3b ('%s','now'),?);
3490: 22 0a 09 09 09 74 65 73 74 2d 69 64 20 74 65 73 "....test-id tes
34a0: 74 73 74 65 70 2d 6e 61 6d 65 20 73 74 61 74 65 tstep-name state
34b0: 20 73 74 61 74 75 73 20 28 69 66 20 63 6f 6d 6d status (if comm
34c0: 65 6e 74 20 63 6f 6d 6d 65 6e 74 20 22 22 29 29 ent comment ""))
34d0: 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 )..(debug:print
34e0: 30 20 22 45 52 52 4f 52 3a 20 43 61 6e 27 74 20 0 "ERROR: Can't
34f0: 75 70 64 61 74 65 20 22 20 74 65 73 74 2d 6e 61 update " test-na
3500: 6d 65 20 22 20 66 6f 72 20 72 75 6e 20 22 20 72 me " for run " r
3510: 75 6e 2d 69 64 20 22 20 2d 3e 20 6e 6f 20 73 75 un-id " -> no su
3520: 63 68 20 74 65 73 74 20 69 6e 20 64 62 22 29 29 ch test in db"))
3530: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 ))..(define (tes
3540: 74 2d 67 65 74 2d 6b 69 6c 6c 2d 72 65 71 75 65 t-get-kill-reque
3550: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 st db run-id tes
3560: 74 2d 6e 61 6d 65 20 69 74 65 6d 64 61 74 29 0a t-name itemdat).
3570: 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 (let* ((item-p
3580: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
3590: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 path itemdat))..
35a0: 20 28 74 65 73 74 64 61 74 20 20 20 28 64 62 3a (testdat (db:
35b0: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
35c0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
35d0: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 e item-path))).
35e0: 20 20 20 28 65 71 75 61 6c 3f 20 28 74 65 73 74 (equal? (test
35f0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
3600: 61 74 29 20 22 4b 49 4c 4c 52 45 51 22 29 29 29 at) "KILLREQ")))
3610: 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d ..(define (test-
3620: 73 65 74 2d 6d 65 74 61 2d 69 6e 66 6f 20 64 62 set-meta-info db
3630: 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 run-id testname
3640: 20 69 74 65 6d 64 61 74 29 0a 20 20 28 6c 65 74 itemdat). (let
3650: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 ((item-path (it
3660: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
3670: 65 6d 64 61 74 29 29 0a 09 28 63 70 75 6c 6f 61 emdat))..(cpuloa
3680: 64 20 20 28 67 65 74 2d 63 70 75 2d 6c 6f 61 64 d (get-cpu-load
3690: 29 29 0a 09 28 68 6f 73 74 6e 61 6d 65 20 28 67 ))..(hostname (g
36a0: 65 74 2d 68 6f 73 74 2d 6e 61 6d 65 29 29 0a 09 et-host-name))..
36b0: 28 64 69 73 6b 66 72 65 65 20 28 67 65 74 2d 64 (diskfree (get-d
36c0: 66 20 28 63 75 72 72 65 6e 74 2d 64 69 72 65 63 f (current-direc
36d0: 74 6f 72 79 29 29 29 0a 09 28 75 6e 61 6d 65 20 tory)))..(uname
36e0: 20 20 20 28 67 65 74 2d 75 6e 61 6d 65 20 22 2d (get-uname "-
36f0: 73 72 76 70 69 6f 22 29 29 0a 09 28 72 75 6e 70 srvpio"))..(runp
3700: 61 74 68 20 20 28 63 75 72 72 65 6e 74 2d 64 69 ath (current-di
3710: 72 65 63 74 6f 72 79 29 29 29 0a 20 20 20 20 28 rectory))). (
3720: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
3730: 64 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 db "UPDATE tests
3740: 20 53 45 54 20 68 6f 73 74 3d 3f 2c 63 70 75 6c SET host=?,cpul
3750: 6f 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 3d 3f oad=?,diskfree=?
3760: 2c 75 6e 61 6d 65 3d 3f 2c 72 75 6e 64 69 72 3d ,uname=?,rundir=
3770: 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f ? WHERE run_id=?
3780: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
3790: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
37a0: 22 0a 09 09 20 20 68 6f 73 74 6e 61 6d 65 0a 09 "... hostname..
37b0: 09 20 20 63 70 75 6c 6f 61 64 0a 09 09 20 20 64 . cpuload... d
37c0: 69 73 6b 66 72 65 65 0a 09 09 20 20 75 6e 61 6d iskfree... unam
37d0: 65 0a 09 09 20 20 72 75 6e 70 61 74 68 0a 09 09 e... runpath...
37e0: 20 20 72 75 6e 2d 69 64 0a 09 09 20 20 74 65 73 run-id... tes
37f0: 74 6e 61 6d 65 0a 09 09 20 20 69 74 65 6d 2d 70 tname... item-p
3800: 61 74 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 ath)))..(define
3810: 28 74 65 73 74 2d 75 70 64 61 74 65 2d 6d 65 74 (test-update-met
3820: 61 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 a-info db run-id
3830: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 64 61 testname itemda
3840: 74 20 6d 69 6e 75 74 65 73 29 0a 20 20 28 6c 65 t minutes). (le
3850: 74 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 t ((item-path (i
3860: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 tem-list->path i
3870: 74 65 6d 64 61 74 29 29 0a 09 28 63 70 75 6c 6f temdat))..(cpulo
3880: 61 64 20 20 28 67 65 74 2d 63 70 75 2d 6c 6f 61 ad (get-cpu-loa
3890: 64 29 29 0a 09 28 64 69 73 6b 66 72 65 65 20 28 d))..(diskfree (
38a0: 67 65 74 2d 64 66 20 28 63 75 72 72 65 6e 74 2d get-df (current-
38b0: 64 69 72 65 63 74 6f 72 79 29 29 29 29 0a 20 20 directory)))).
38c0: 20 20 28 69 66 20 28 6e 6f 74 20 63 70 75 6c 6f (if (not cpulo
38d0: 61 64 29 20 20 28 62 65 67 69 6e 20 28 64 65 62 ad) (begin (deb
38e0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
38f0: 49 4e 47 3a 20 43 50 55 4c 4f 41 44 20 6e 6f 74 ING: CPULOAD not
3900: 20 66 6f 75 6e 64 2e 22 29 20 20 28 73 65 74 21 found.") (set!
3910: 20 63 70 75 6c 6f 61 64 20 22 6e 2f 61 22 29 29 cpuload "n/a"))
3920: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 64 ). (if (not d
3930: 69 73 6b 66 72 65 65 29 20 28 62 65 67 69 6e 20 iskfree) (begin
3940: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
3950: 57 41 52 4e 49 4e 47 3a 20 44 49 53 4b 46 52 45 WARNING: DISKFRE
3960: 45 20 6e 6f 74 20 66 6f 75 6e 64 2e 22 29 20 28 E not found.") (
3970: 73 65 74 21 20 64 69 73 6b 66 72 65 65 20 22 6e set! diskfree "n
3980: 2f 61 22 29 29 29 0a 20 20 20 20 28 69 66 20 28 /a"))). (if (
3990: 6e 6f 74 20 69 74 65 6d 2d 70 61 74 68 29 28 62 not item-path)(b
39a0: 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e egin (debug:prin
39b0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 49 54 t 0 "WARNING: IT
39c0: 45 4d 50 41 54 48 20 6e 6f 74 20 73 65 74 2e 22 EMPATH not set."
39d0: 29 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 ) (set! item-p
39e0: 61 74 68 20 22 22 29 29 29 0a 20 20 20 20 3b 3b ath ""))). ;;
39f0: 20 28 6c 65 74 20 28 28 74 65 73 74 69 6e 66 6f (let ((testinfo
3a00: 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e (db:get-test-in
3a10: 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 fo db run-id tes
3a20: 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 tname item-path)
3a30: 29 29 0a 20 20 20 20 3b 3b 20 20 20 28 69 66 20 )). ;; (if
3a40: 28 61 6e 64 20 28 6e 6f 74 20 28 65 71 75 61 6c (and (not (equal
3a50: 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 ? (db:test-get-s
3a60: 74 61 74 75 73 20 74 65 73 74 69 6e 66 6f 29 20 tatus testinfo)
3a70: 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 0a 20 20 "COMPLETED")).
3a80: 20 20 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 ;;
3a90: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 64 62 (not (equal? (db
3aa0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 :test-get-status
3ab0: 20 74 65 73 74 69 6e 66 6f 29 20 22 4b 49 4c 4c testinfo) "KILL
3ac0: 52 45 51 22 29 29 0a 20 20 20 20 28 73 71 6c 69 REQ")). (sqli
3ad0: 74 65 33 3a 65 78 65 63 75 74 65 0a 20 20 20 20 te3:execute.
3ae0: 20 64 62 0a 20 20 20 20 20 22 55 50 44 41 54 45 db. "UPDATE
3af0: 20 74 65 73 74 73 20 53 45 54 20 63 70 75 6c 6f tests SET cpulo
3b00: 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 3d 3f 2c ad=?,diskfree=?,
3b10: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 3d 3f 2c 73 run_duration=?,s
3b20: 74 61 74 65 3d 27 52 55 4e 4e 49 4e 47 27 20 57 tate='RUNNING' W
3b30: 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e HERE run_id=? AN
3b40: 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 D testname=? AND
3b50: 20 69 74 65 6d 5f 70 61 74 68 3d 3f 20 41 4e 44 item_path=? AND
3b60: 20 73 74 61 74 65 20 4e 4f 54 20 49 4e 20 28 27 state NOT IN ('
3b70: 43 4f 4d 50 4c 45 54 45 44 27 2c 27 4b 49 4c 4c COMPLETED','KILL
3b80: 52 45 51 27 2c 27 4b 49 4c 4c 45 44 27 29 3b 22 REQ','KILLED');"
3b90: 0a 20 20 20 20 20 63 70 75 6c 6f 61 64 0a 20 20 . cpuload.
3ba0: 20 20 20 64 69 73 6b 66 72 65 65 0a 20 20 20 20 diskfree.
3bb0: 20 6d 69 6e 75 74 65 73 0a 20 20 20 20 20 72 75 minutes. ru
3bc0: 6e 2d 69 64 0a 20 20 20 20 20 74 65 73 74 6e 61 n-id. testna
3bd0: 6d 65 0a 20 20 20 20 20 69 74 65 6d 2d 70 61 74 me. item-pat
3be0: 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 h)))..(define (s
3bf0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
3c00: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 0a vars db run-id).
3c10: 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 28 64 (let ((keys (d
3c20: 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 29 b-get-keys db)))
3c30: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 . (for-each (
3c40: 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 28 lambda (key)...(
3c50: 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 sqlite3:for-each
3c60: 2d 72 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 -row... (lambda
3c70: 28 76 61 6c 29 0a 09 09 20 20 20 28 64 65 62 75 (val)... (debu
3c80: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e g:print 2 "seten
3c90: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 v " (key:get-fie
3ca0: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 ldname key) " "
3cb0: 76 61 6c 29 0a 09 09 20 20 20 28 73 65 74 65 6e val)... (seten
3cc0: 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 v (key:get-field
3cd0: 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 0a name key) val)).
3ce0: 09 09 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 20 .. db ... (conc
3cf0: 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 "SELECT " (key:g
3d00: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 et-fieldname key
3d10: 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 ) " FROM runs WH
3d20: 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 72 ERE id=?;")... r
3d30: 75 6e 2d 69 64 29 29 0a 09 20 20 20 20 20 20 6b un-id)).. k
3d40: 65 79 73 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 eys)))..(define
3d50: 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 (set-item-env-va
3d60: 72 73 20 69 74 65 6d 64 61 74 29 0a 20 20 28 66 rs itemdat). (f
3d70: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
3d80: 28 69 74 65 6d 29 0a 09 20 20 20 20 20 20 28 64 (item).. (d
3d90: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 ebug:print 2 "se
3da0: 74 65 6e 76 20 22 20 28 63 61 72 20 69 74 65 6d tenv " (car item
3db0: 29 20 22 20 22 20 28 63 61 64 72 20 69 74 65 6d ) " " (cadr item
3dc0: 29 29 0a 09 20 20 20 20 20 20 28 73 65 74 65 6e )).. (seten
3dd0: 76 20 28 63 61 72 20 69 74 65 6d 29 20 28 63 61 v (car item) (ca
3de0: 64 72 20 69 74 65 6d 29 29 29 0a 09 20 20 20 20 dr item)))..
3df0: 69 74 65 6d 64 61 74 29 29 0a 0a 28 64 65 66 69 itemdat))..(defi
3e00: 6e 65 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 ne (get-all-lega
3e10: 6c 2d 74 65 73 74 73 29 0a 20 20 28 6c 65 74 2a l-tests). (let*
3e20: 20 28 28 74 65 73 74 73 20 20 28 67 6c 6f 62 20 ((tests (glob
3e30: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
3e40: 22 2f 74 65 73 74 73 2f 2a 22 29 29 29 0a 09 20 "/tests/*")))..
3e50: 28 72 65 73 20 20 20 20 27 28 29 29 29 0a 20 20 (res '())).
3e60: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
3e70: 20 22 49 4e 46 4f 3a 20 4c 6f 6f 6b 69 6e 67 20 "INFO: Looking
3e80: 61 74 20 74 65 73 74 73 20 22 20 28 73 74 72 69 at tests " (stri
3e90: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 74 ng-intersperse t
3ea0: 65 73 74 73 20 22 2c 22 29 29 0a 20 20 20 20 28 ests ",")). (
3eb0: 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 for-each (lambda
3ec0: 20 28 74 65 73 74 70 61 74 68 29 0a 09 09 28 69 (testpath)...(i
3ed0: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
3ee0: 28 63 6f 6e 63 20 74 65 73 74 70 61 74 68 20 22 (conc testpath "
3ef0: 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 /testconfig"))..
3f00: 09 20 20 20 20 28 73 65 74 21 20 72 65 73 20 28 . (set! res (
3f10: 63 6f 6e 73 20 28 6c 61 73 74 20 28 73 74 72 69 cons (last (stri
3f20: 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 61 74 ng-split testpat
3f30: 68 20 22 2f 22 29 29 20 72 65 73 29 29 29 29 0a h "/")) res)))).
3f40: 09 20 20 20 20 20 20 74 65 73 74 73 29 0a 20 20 . tests).
3f50: 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 6e 65 res))..(define
3f60: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d (runs:can-run-m
3f70: 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a 20 20 ore-tests db).
3f80: 28 6c 65 74 20 28 28 6e 75 6d 2d 72 75 6e 6e 69 (let ((num-runni
3f90: 6e 67 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 ng (db:get-count
3fa0: 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 -tests-running d
3fb0: 62 29 29 0a 09 28 6d 61 78 2d 63 6f 6e 63 75 72 b))..(max-concur
3fc0: 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 rent-jobs (confi
3fd0: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
3fe0: 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 dat* "setup" "ma
3ff0: 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 x_concurrent_job
4000: 73 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 s"))). (debug
4010: 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f :print 2 "max-co
4020: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 ncurrent-jobs: "
4030: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
4040: 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e jobs ", num-runn
4050: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 ing: " num-runni
4060: 6e 67 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 ng). (if (not
4070: 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 (eq? 0 *globale
4080: 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 23 66 xitstatus*))..#f
4090: 0a 09 28 69 66 20 28 6f 72 20 28 6e 6f 74 20 6d ..(if (or (not m
40a0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
40b0: 62 73 29 0a 09 09 28 61 6e 64 20 6d 61 78 2d 63 bs)...(and max-c
40c0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a 09 oncurrent-jobs..
40d0: 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 6e . (string->n
40e0: 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 umber max-concur
40f0: 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 20 20 20 rent-jobs)...
4100: 20 20 28 6e 6f 74 20 28 3e 3d 20 6e 75 6d 2d 72 (not (>= num-r
4110: 75 6e 6e 69 6e 67 20 28 73 74 72 69 6e 67 2d 3e unning (string->
4120: 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 number max-concu
4130: 72 72 65 6e 74 2d 6a 6f 62 73 29 29 29 29 29 0a rrent-jobs))))).
4140: 09 20 20 20 20 23 74 0a 09 20 20 20 20 28 62 65 . #t.. (be
4150: 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 gin .. (deb
4160: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
4170: 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 ING: Max running
4180: 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20 jobs exceeded,
4190: 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 current number r
41a0: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 unning: " num-ru
41b0: 6e 6e 69 6e 67 20 0a 09 09 09 20 20 20 22 2c 20 nning .... ",
41c0: 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a max_concurrent_j
41d0: 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 obs: " max-concu
41e0: 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 20 20 20 rrent-jobs)..
41f0: 20 20 20 23 66 29 29 29 29 29 0a 20 20 0a 28 64 #f))))). .(d
4200: 65 66 69 6e 65 20 28 72 75 6e 2d 74 65 73 74 73 efine (run-tests
4210: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a db test-names).
4220: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 (let* ((keys
4230: 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b 65 (db-get-ke
4240: 79 73 20 64 62 29 29 0a 09 20 28 6b 65 79 76 61 ys db)).. (keyva
4250: 6c 6c 73 74 20 20 20 28 6b 65 79 73 2d 3e 76 61 llst (keys->va
4260: 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 0a llist keys #t)).
4270: 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20 28 . (run-id (
4280: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 register-run db
4290: 6b 65 79 73 29 29 20 20 3b 3b 20 20 74 65 73 74 keys)) ;; test
42a0: 2d 6e 61 6d 65 29 29 29 0a 09 20 28 64 65 66 65 -name))).. (defe
42b0: 72 72 65 64 20 20 20 20 27 28 29 29 29 20 3b 3b rred '())) ;;
42c0: 20 64 65 6c 61 79 20 72 75 6e 6e 69 6e 67 20 74 delay running t
42d0: 68 65 73 65 20 73 69 6e 63 65 20 74 68 65 79 20 hese since they
42e0: 68 61 76 65 20 61 20 77 61 69 74 6f 6e 20 63 6c have a waiton cl
42f0: 61 75 73 65 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 ause. ;; on t
4300: 68 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 he first pass or
4310: 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 call to run-tes
4320: 74 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 ts set FAILS to
4330: 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 NOT_STARTED if.
4340: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 ;; -keepgoing
4350: 20 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 is specified.
4360: 20 20 28 69 66 20 28 61 6e 64 20 28 65 71 3f 20 (if (and (eq?
4370: 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 20 20 *passnum* 0)..
4380: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 (args:get-arg
4390: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 29 0a "-keepgoing")).
43a0: 09 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 .(begin.. ;; ha
43b0: 76 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 ve to delete tes
43c0: 74 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 t records where
43d0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 NOT_STARTED sinc
43e0: 65 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 e they can cause
43f0: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a -keepgoing to .
4400: 09 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 . ;; get stuck
4410: 64 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 due to becoming
4420: 69 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f inaccessible fro
4430: 6d 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e m a failed test.
4440: 20 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 I.e. if test B
4450: 64 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f depends .. ;; o
4460: 6e 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73 n test A but tes
4470: 74 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20 t B reached the
4480: 70 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 point on being r
4490: 65 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 egistered as NOT
44a0: 5f 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 _STARTED and tes
44b0: 74 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 t.. ;; A failed
44c0: 20 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e for some reason
44d0: 20 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 then on re-run
44e0: 75 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 using -keepgoing
44f0: 20 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 the run can nev
4500: 65 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 er complete...
4510: 28 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 (db:delete-tests
4520: 2d 69 6e 2d 73 74 61 74 65 20 64 62 20 72 75 6e -in-state db run
4530: 2d 69 64 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 -id "NOT_STARTED
4540: 22 29 0a 09 20 20 28 64 62 3a 73 65 74 2d 74 65 ").. (db:set-te
4550: 73 74 73 2d 73 74 61 74 65 2d 73 74 61 74 75 73 sts-state-status
4560: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
4570: 6e 61 6d 65 73 20 23 66 20 22 46 41 49 4c 22 20 names #f "FAIL"
4580: 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 20 22 46 "NOT_STARTED" "F
4590: 41 49 4c 22 29 29 29 0a 20 20 20 20 28 73 65 74 AIL"))). (set
45a0: 21 20 2a 70 61 73 73 6e 75 6d 2a 20 28 2b 20 2a ! *passnum* (+ *
45b0: 70 61 73 73 6e 75 6d 2a 20 31 29 29 0a 20 20 20 passnum* 1)).
45c0: 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 6e 75 6d (let loop ((num
45d0: 74 69 6d 65 73 20 30 29 29 0a 20 20 20 20 20 20 times 0)).
45e0: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
45f0: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d (lambda (test-
4600: 6e 61 6d 65 29 0a 09 20 28 69 66 20 28 72 75 6e name).. (if (run
4610: 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 s:can-run-more-t
4620: 65 73 74 73 20 64 62 29 0a 09 20 20 20 20 20 28 ests db).. (
4630: 72 75 6e 2d 6f 6e 65 2d 74 65 73 74 20 64 62 20 run-one-test db
4640: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
4650: 20 6b 65 79 76 61 6c 6c 73 74 29 0a 09 20 20 20 keyvallst)..
4660: 20 20 3b 3b 20 61 64 64 20 73 6f 6d 65 20 64 65 ;; add some de
4670: 6c 61 79 20 0a 09 20 20 20 20 20 3b 28 73 6c 65 lay .. ;(sle
4680: 65 70 20 32 29 0a 09 20 20 20 20 20 29 29 0a 20 ep 2).. )).
4690: 20 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 test-names
46a0: 29 0a 20 20 20 20 20 20 3b 3b 20 28 72 75 6e 2d ). ;; (run-
46b0: 77 61 69 74 69 6e 67 2d 74 65 73 74 73 20 64 62 waiting-tests db
46c0: 29 0a 20 20 20 20 20 20 28 69 66 20 28 61 72 67 ). (if (arg
46d0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 s:get-arg "-keep
46e0: 67 6f 69 6e 67 22 29 0a 09 20 20 28 6c 65 74 20 going").. (let
46f0: 28 28 65 73 74 72 65 6d 20 28 64 62 3a 65 73 74 ((estrem (db:est
4700: 69 6d 61 74 65 64 2d 74 65 73 74 73 2d 72 65 6d imated-tests-rem
4710: 61 69 6e 69 6e 67 20 64 62 20 72 75 6e 2d 69 64 aining db run-id
4720: 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 6e ))).. (if (an
4730: 64 20 28 3e 20 65 73 74 72 65 6d 20 30 29 0a 09 d (> estrem 0)..
4740: 09 20 20 20 20 20 28 65 71 3f 20 2a 67 6c 6f 62 . (eq? *glob
4750: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 30 29 alexitstatus* 0)
4760: 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 )...(begin... (
4770: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4b debug:print 1 "K
4780: 65 65 70 20 67 6f 69 6e 67 2c 20 65 73 74 69 6d eep going, estim
4790: 61 74 65 64 20 22 20 65 73 74 72 65 6d 20 22 20 ated " estrem "
47a0: 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 tests remaining
47b0: 74 6f 20 72 75 6e 2c 20 77 69 6c 6c 20 63 6f 6e to run, will con
47c0: 74 69 6e 75 65 20 69 6e 20 33 20 73 65 63 6f 6e tinue in 3 secon
47d0: 64 73 20 2e 2e 2e 22 29 0a 09 09 20 20 28 73 6c ds ...")... (sl
47e0: 65 65 70 20 33 29 0a 09 09 20 20 28 72 75 6e 2d eep 3)... (run-
47f0: 77 61 69 74 69 6e 67 2d 74 65 73 74 73 20 64 62 waiting-tests db
4800: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 2b 20 6e )... (loop (+ n
4810: 75 6d 74 69 6d 65 73 20 31 29 29 29 29 29 29 29 umtimes 1)))))))
4820: 29 29 0a 09 20 20 20 0a 3b 3b 20 56 45 52 59 20 )).. .;; VERY
4830: 49 4e 45 46 46 49 43 49 45 4e 54 21 20 4d 6f 76 INEFFICIENT! Mov
4840: 65 20 73 74 75 66 66 20 74 68 61 74 20 73 68 6f e stuff that sho
4850: 75 6c 64 20 62 65 20 64 6f 6e 65 20 6f 6e 63 65 uld be done once
4860: 20 75 70 20 74 6f 20 63 61 6c 6c 69 6e 67 20 70 up to calling p
4870: 72 6f 63 0a 28 64 65 66 69 6e 65 20 28 72 75 6e roc.(define (run
4880: 2d 6f 6e 65 2d 74 65 73 74 20 64 62 20 72 75 6e -one-test db run
4890: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 6b 65 -id test-name ke
48a0: 79 76 61 6c 6c 73 74 29 0a 20 20 28 64 65 62 75 yvallst). (debu
48b0: 67 3a 70 72 69 6e 74 20 31 20 22 4c 61 75 6e 63 g:print 1 "Launc
48c0: 68 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 hing test " test
48d0: 2d 6e 61 6d 65 29 0a 20 20 3b 3b 20 41 6c 6c 20 -name). ;; All
48e0: 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 these vars might
48f0: 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 be referenced b
4900: 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 y the testconfig
4910: 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 file reader. (
4920: 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f setenv "MT_TEST_
4930: 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 NAME" test-name)
4940: 20 3b 3b 20 0a 20 20 28 73 65 74 65 6e 76 20 22 ;; . (setenv "
4950: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 28 61 MT_RUNNAME" (a
4960: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 rgs:get-arg ":ru
4970: 6e 6e 61 6d 65 22 29 29 0a 20 20 28 73 65 74 2d nname")). (set-
4980: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 megatest-env-var
4990: 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 s db run-id) ;;
49a0: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 these may be nee
49b0: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 ded by the launc
49c0: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 28 hing process. (
49d0: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 change-directory
49e0: 20 2a 74 6f 70 70 61 74 68 2a 29 0a 20 20 28 6c *toppath*). (l
49f0: 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 et* ((test-path
4a00: 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 (conc *toppat
4a10: 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 h* "/tests/" tes
4a20: 74 2d 6e 61 6d 65 29 29 0a 09 20 28 74 65 73 74 t-name)).. (test
4a30: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 -configf (conc t
4a40: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 est-path "/testc
4a50: 6f 6e 66 69 67 22 29 29 0a 09 20 28 74 65 73 74 onfig")).. (test
4a60: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 exists (and (f
4a70: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 ile-exists? test
4a80: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 -configf)(file-r
4a90: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 ead-access? test
4aa0: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 28 74 -configf))).. (t
4ab0: 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 est-conf (if
4ac0: 74 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64 testexists (read
4ad0: 2d 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e -config test-con
4ae0: 66 69 67 66 20 23 66 20 23 74 29 20 28 6d 61 6b figf #f #t) (mak
4af0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
4b00: 09 20 28 77 61 69 74 6f 6e 20 20 20 20 20 20 20 . (waiton
4b10: 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 (let ((w (config
4b20: 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e -lookup test-con
4b30: 66 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 f "requirements"
4b40: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 "waiton")))....
4b50: 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 77 29 (if (string? w)
4b60: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 77 29 (string-split w)
4b70: 27 28 29 29 29 29 0a 09 20 28 74 61 67 73 20 20 '()))).. (tags
4b80: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 20 (let ((t
4b90: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 (config-lookup t
4ba0: 65 73 74 2d 63 6f 6e 66 20 22 73 65 74 75 70 22 est-conf "setup"
4bb0: 20 22 74 61 67 73 22 29 29 29 0a 09 09 09 20 3b "tags"))).... ;
4bc0: 3b 20 77 65 20 77 61 6e 74 20 6f 75 72 20 74 61 ; we want our ta
4bd0: 67 73 20 74 6f 20 62 65 20 73 65 70 61 72 61 74 gs to be separat
4be0: 65 64 20 62 79 20 63 6f 6d 6d 61 73 20 61 6e 64 ed by commas and
4bf0: 20 66 75 6c 6c 79 20 64 65 6c 69 6d 69 74 65 64 fully delimited
4c00: 20 62 79 20 63 6f 6d 6d 61 73 0a 09 09 09 20 3b by commas.... ;
4c10: 3b 20 73 6f 20 74 68 61 74 20 71 75 65 72 69 65 ; so that querie
4c20: 73 20 77 69 74 68 20 22 6c 69 6b 65 22 20 63 61 s with "like" ca
4c30: 6e 20 74 69 65 20 74 6f 20 74 68 65 20 63 6f 6d n tie to the com
4c40: 6d 61 73 20 61 74 20 65 69 74 68 65 72 20 65 6e mas at either en
4c50: 64 20 6f 66 20 65 61 63 68 20 74 61 67 0a 09 09 d of each tag...
4c60: 09 20 3b 3b 20 77 68 69 6c 65 20 61 6c 73 6f 20 . ;; while also
4c70: 61 6c 6c 6f 77 69 6e 67 20 74 68 65 20 65 6e 64 allowing the end
4c80: 20 75 73 65 72 20 74 6f 20 66 72 65 65 6c 79 20 user to freely
4c90: 75 73 65 20 73 70 61 63 65 73 20 61 6e 64 20 63 use spaces and c
4ca0: 6f 6d 6d 61 73 20 74 6f 20 73 65 70 61 72 61 74 ommas to separat
4cb0: 65 20 74 61 67 73 0a 09 09 09 20 28 69 66 20 28 e tags.... (if (
4cc0: 73 74 72 69 6e 67 3f 20 74 29 28 73 74 72 69 6e string? t)(strin
4cd0: 67 2d 73 75 62 73 74 69 74 75 74 65 20 28 72 65 g-substitute (re
4ce0: 67 65 78 70 20 22 5b 2c 5c 5c 73 5d 2b 22 29 20 gexp "[,\\s]+")
4cf0: 22 2c 22 20 28 63 6f 6e 63 20 22 2c 22 20 74 20 "," (conc "," t
4d00: 22 2c 22 29 20 23 74 29 0a 09 09 09 20 20 20 20 ",") #t)....
4d10: 20 27 28 29 29 29 29 29 0a 20 20 20 20 28 69 66 '())))). (if
4d20: 20 28 6e 6f 74 20 74 65 73 74 65 78 69 73 74 73 (not testexists
4d30: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 )..(begin.. (de
4d40: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
4d50: 4f 52 3a 20 43 61 6e 27 74 20 66 69 6e 64 20 63 OR: Can't find c
4d60: 6f 6e 66 69 67 20 66 69 6c 65 20 22 20 74 65 73 onfig file " tes
4d70: 74 2d 63 6f 6e 66 69 67 66 29 0a 09 20 20 28 65 t-configf).. (e
4d80: 78 69 74 20 32 29 29 0a 09 3b 3b 20 70 75 74 20 xit 2))..;; put
4d90: 74 6f 70 20 76 61 72 73 20 69 6e 74 6f 20 63 6f top vars into co
4da0: 6e 76 65 6e 69 65 6e 74 20 76 61 72 69 61 62 6c nvenient variabl
4db0: 65 73 20 61 6e 64 20 6f 70 65 6e 20 74 68 65 20 es and open the
4dc0: 64 62 0a 09 28 6c 65 74 2a 20 28 3b 3b 20 64 62 db..(let* (;; db
4dd0: 20 69 73 20 61 6c 77 61 79 73 20 61 74 20 2a 74 is always at *t
4de0: 6f 70 70 61 74 68 2a 2f 64 62 2f 6d 65 67 61 74 oppath*/db/megat
4df0: 65 73 74 2e 64 62 0a 09 20 20 20 20 20 20 20 28 est.db.. (
4e00: 69 74 65 6d 73 20 20 20 20 20 20 20 28 68 61 73 items (has
4e10: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
4e20: 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 69 ult test-conf "i
4e30: 74 65 6d 73 22 20 27 28 29 29 29 0a 09 20 20 20 tems" '()))..
4e40: 20 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 20 (itemstable
4e50: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
4e60: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 63 6f /default test-co
4e70: 6e 66 20 22 69 74 65 6d 73 74 61 62 6c 65 22 20 nf "itemstable"
4e80: 27 28 29 29 29 0a 09 20 20 20 20 20 20 20 28 61 '())).. (a
4e90: 6c 6c 69 74 65 6d 73 20 20 20 20 28 69 66 20 28 llitems (if (
4ea0: 6f 72 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 or (not (null? i
4eb0: 74 65 6d 73 29 29 28 6e 6f 74 20 28 6e 75 6c 6c tems))(not (null
4ec0: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 0a ? itemstable))).
4ed0: 09 09 09 09 28 61 70 70 65 6e 64 20 28 69 74 65 ....(append (ite
4ee0: 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 m-assoc->item-li
4ef0: 73 74 20 69 74 65 6d 73 29 0a 09 09 09 09 09 28 st items)......(
4f00: 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d item-table->item
4f10: 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c 65 -list itemstable
4f20: 29 29 0a 09 09 09 09 27 28 28 29 29 29 29 20 3b )).....'(()))) ;
4f30: 3b 20 61 20 6c 69 73 74 20 77 69 74 68 20 6f 6e ; a list with on
4f40: 65 20 6e 75 6c 6c 20 6c 69 73 74 20 69 73 20 61 e null list is a
4f50: 20 74 65 73 74 20 77 69 74 68 20 6e 6f 20 69 74 test with no it
4f60: 65 6d 73 0a 09 20 20 20 20 20 20 20 28 72 75 6e ems.. (run
4f70: 63 6f 6e 66 69 67 66 20 20 28 63 6f 6e 63 20 20 configf (conc
4f80: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 *toppath* "/runc
4f90: 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 onfigs.config"))
4fa0: 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ).. (debug:prin
4fb0: 74 20 31 20 22 69 74 65 6d 73 3a 20 22 29 0a 09 t 1 "items: ")..
4fc0: 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f (if (>= *verbo
4fd0: 73 69 74 79 2a 20 31 29 28 70 70 20 61 6c 6c 69 sity* 1)(pp alli
4fe0: 74 65 6d 73 29 29 0a 09 20 20 28 69 66 20 28 3e tems)).. (if (>
4ff0: 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 35 29 = *verbosity* 5)
5000: 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 .. (begin..
5010: 09 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 .(print "items:
5020: 22 29 28 70 70 20 28 69 74 65 6d 2d 61 73 73 6f ")(pp (item-asso
5030: 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 c->item-list ite
5040: 6d 73 29 29 0a 09 09 28 70 72 69 6e 74 20 22 69 ms))...(print "i
5050: 74 65 73 74 61 62 6c 65 3a 20 22 29 28 70 70 20 testable: ")(pp
5060: 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 (item-table->ite
5070: 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c m-list itemstabl
5080: 65 29 29 29 29 0a 09 20 20 28 69 66 20 28 61 72 e)))).. (if (ar
5090: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6d 22 29 gs:get-arg "-m")
50a0: 0a 09 20 20 20 20 20 20 28 64 62 3a 73 65 74 2d .. (db:set-
50b0: 63 6f 6d 6d 65 6e 74 2d 66 6f 72 2d 72 75 6e 20 comment-for-run
50c0: 64 62 20 72 75 6e 2d 69 64 20 28 61 72 67 73 3a db run-id (args:
50d0: 67 65 74 2d 61 72 67 20 22 2d 6d 22 29 29 29 0a get-arg "-m"))).
50e0: 0a 09 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 .. ;; Here is w
50f0: 68 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 here the test_me
5100: 74 61 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 ta table is best
5110: 20 75 70 64 61 74 65 64 0a 09 20 20 28 72 75 6e updated.. (run
5120: 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 s:update-test_me
5130: 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 ta db test-name
5140: 74 65 73 74 2d 63 6f 6e 66 29 0a 0a 09 20 20 3b test-conf)... ;
5150: 3b 20 62 72 61 69 6e 64 65 61 64 20 77 6f 72 6b ; braindead work
5160: 2d 61 72 6f 75 6e 64 20 66 6f 72 20 70 6f 6f 72 -around for poor
5170: 6c 79 20 73 70 65 63 69 66 69 65 64 20 61 6c 6c ly specified all
5180: 69 74 65 6d 73 20 6c 69 73 74 20 42 55 47 21 21 items list BUG!!
5190: 21 20 46 49 58 4d 45 0a 09 20 20 28 69 66 20 28 ! FIXME.. (if (
51a0: 6e 75 6c 6c 3f 20 61 6c 6c 69 74 65 6d 73 29 28 null? allitems)(
51b0: 73 65 74 21 20 61 6c 6c 69 74 65 6d 73 20 27 28 set! allitems '(
51c0: 28 29 29 29 29 0a 09 20 20 28 6c 65 74 20 6c 6f ()))).. (let lo
51d0: 6f 70 20 28 28 69 74 65 6d 64 61 74 20 28 63 61 op ((itemdat (ca
51e0: 72 20 61 6c 6c 69 74 65 6d 73 29 29 0a 09 09 20 r allitems))...
51f0: 20 20 20 20 28 74 61 6c 20 20 20 20 20 28 63 64 (tal (cd
5200: 72 20 61 6c 6c 69 74 65 6d 73 29 29 29 0a 09 20 r allitems)))..
5210: 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 ;; (lambda (i
5220: 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 temdat) ;;; ((ri
5230: 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 peness "overripe
5240: 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 ") (temperature
5250: 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 "cool") (season
5260: 22 73 75 6d 6d 65 72 22 29 29 0a 09 20 20 20 20 "summer"))..
5270: 3b 3b 20 48 61 6e 64 6c 65 20 6c 69 73 74 73 20 ;; Handle lists
5280: 6f 66 20 69 74 65 6d 73 0a 09 20 20 20 20 28 6c of items.. (l
5290: 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 et* ((item-path
52a0: 20 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e (item-list->
52b0: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 20 3b path itemdat)) ;
52c0: 3b 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 ; (string-inters
52d0: 70 65 72 73 65 20 28 6d 61 70 20 63 61 64 72 20 perse (map cadr
52e0: 69 74 65 6d 64 61 74 29 20 22 2f 22 29 29 0a 09 itemdat) "/"))..
52f0: 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 70 61 . (new-test-pa
5300: 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 th (string-inter
5310: 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73 sperse (cons tes
5320: 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 72 t-path (map cadr
5330: 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29 itemdat)) "/"))
5340: 0a 09 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d ... (new-test-
5350: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f name (if (equal?
5360: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 item-path "") t
5370: 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 est-name (conc t
5380: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 est-name "/" ite
5390: 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 m-path))) ;; jus
53a0: 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 t need it to be
53b0: 75 6e 69 71 75 65 0a 09 09 20 20 20 28 74 65 73 unique... (tes
53c0: 74 64 61 74 20 20 20 23 66 29 0a 09 09 20 20 20 tdat #f)...
53d0: 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 62 (num-running (db
53e0: 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 :get-count-tests
53f0: 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 09 -running db))...
5400: 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 (max-concurre
5410: 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 67 2d nt-jobs (config-
5420: 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 lookup *configda
5430: 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78 5f t* "setup" "max_
5440: 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 concurrent_jobs"
5450: 29 29 0a 09 09 20 20 20 28 70 61 72 65 6e 74 2d ))... (parent-
5460: 74 65 73 74 20 28 61 6e 64 20 28 6e 6f 74 20 28 test (and (not (
5470: 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 29 28 65 71 null? items))(eq
5480: 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 ual? item-path "
5490: 22 29 29 29 0a 09 09 20 20 20 28 73 69 6e 67 6c ")))... (singl
54a0: 65 2d 74 65 73 74 20 28 61 6e 64 20 28 6e 75 6c e-test (and (nul
54b0: 6c 3f 20 69 74 65 6d 73 29 20 28 65 71 75 61 6c l? items) (equal
54c0: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 ? item-path ""))
54d0: 29 0a 09 09 20 20 20 28 69 74 65 6d 2d 74 65 73 )... (item-tes
54e0: 74 20 20 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f t (not (equal?
54f0: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 item-path "")))
5500: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a ).. (debug:
5510: 70 72 69 6e 74 20 33 20 22 6d 61 78 2d 63 6f 6e print 3 "max-con
5520: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 current-jobs: "
5530: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
5540: 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 obs ", num-runni
5550: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e ng: " num-runnin
5560: 67 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 72 g).. (if (r
5570: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
5580: 2d 74 65 73 74 73 20 64 62 29 0a 09 09 20 20 28 -tests db)... (
5590: 62 65 67 69 6e 0a 09 09 20 20 20 20 28 6c 65 74 begin... (let
55a0: 20 6c 6f 6f 70 32 20 28 28 74 73 20 28 64 62 3a loop2 ((ts (db:
55b0: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
55c0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
55d0: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b e item-path)) ;;
55e0: 20 23 66 29 0a 09 09 09 09 28 63 74 20 30 29 29 #f).....(ct 0))
55f0: 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 61 6e ... (if (an
5600: 64 20 28 6e 6f 74 20 74 73 29 0a 09 09 09 20 20 d (not ts)....
5610: 20 20 20 20 20 28 3c 20 63 74 20 31 30 29 29 0a (< ct 10)).
5620: 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 09 20 ... (begin....
5630: 20 20 20 28 72 65 67 69 73 74 65 72 2d 74 65 73 (register-tes
5640: 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 t db run-id test
5650: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
5660: 0a 09 09 09 20 20 20 20 28 64 62 3a 74 65 73 74 .... (db:test
5670: 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 64 62 20 -set-comment db
5680: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
5690: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 0a 09 item-path "")..
56a0: 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 28 64 62 .. (loop2 (db
56b0: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 :get-test-info d
56c0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
56d0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 me item-path)...
56e0: 09 09 20 20 20 28 2b 20 63 74 20 31 29 29 29 0a .. (+ ct 1))).
56f0: 09 09 09 20 20 28 69 66 20 74 73 0a 09 09 09 20 ... (if ts....
5700: 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 64 (set! testd
5710: 61 74 20 74 73 29 0a 09 09 09 20 20 20 20 20 20 at ts)....
5720: 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62 75 (begin.....(debu
5730: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
5740: 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 72 65 67 NG: Couldn't reg
5750: 69 73 74 65 72 20 74 65 73 74 20 22 20 74 65 73 ister test " tes
5760: 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 20 69 74 t-name " with it
5770: 65 6d 20 70 61 74 68 20 22 20 69 74 65 6d 2d 70 em path " item-p
5780: 61 74 68 20 22 2c 20 73 6b 69 70 70 69 6e 67 22 ath ", skipping"
5790: 29 0a 09 09 09 09 28 69 66 20 28 6e 6f 74 20 28 ).....(if (not (
57a0: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 09 null? tal)).....
57b0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 (loop (car t
57c0: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 al)(cdr tal)))))
57d0: 29 29 0a 09 09 20 20 20 20 28 63 68 61 6e 67 65 ))... (change
57e0: 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d -directory test-
57f0: 70 61 74 68 29 0a 09 09 20 20 20 20 3b 3b 20 74 path)... ;; t
5800: 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 68 65 72 his block is her
5810: 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 6f 72 6d e only to inform
5820: 20 74 68 65 20 75 73 65 72 20 65 61 72 6c 79 20 the user early
5830: 6f 6e 0a 09 09 20 20 20 20 28 69 66 20 28 66 69 on... (if (fi
5840: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f le-exists? runco
5850: 6e 66 69 67 66 29 0a 09 09 09 28 73 65 74 75 70 nfigf)....(setup
5860: 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 64 62 -env-defaults db
5870: 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d runconfigf run-
5880: 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e id *already-seen
5890: 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a -runconfig-info*
58a0: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e )....(debug:prin
58b0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f t 0 "WARNING: Yo
58c0: 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 u do not have a
58d0: 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a run config file:
58e0: 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a " runconfigf)).
58f0: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
5900: 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 nt 4 "run-id: "
5910: 72 75 6e 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 run-id " test-na
5920: 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 me: " test-name
5930: 22 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 " item-path: " i
5940: 74 65 6d 2d 70 61 74 68 20 22 20 74 65 73 74 64 tem-path " testd
5950: 61 74 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d at: " (test:get-
5960: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
5970: 22 20 74 65 73 74 2d 73 74 61 74 65 3a 20 22 20 " test-state: "
5980: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
5990: 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 testdat))...
59a0: 28 63 61 73 65 20 28 69 66 20 28 61 72 67 73 3a (case (if (args:
59b0: 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 get-arg "-force"
59c0: 29 0a 09 09 09 20 20 20 20 20 20 27 4e 4f 54 5f ).... 'NOT_
59d0: 53 54 41 52 54 45 44 0a 09 09 09 20 20 20 20 20 STARTED....
59e0: 20 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 09 (if testdat....
59f0: 09 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 . (string->symb
5a00: 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 ol (test:get-sta
5a10: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 te testdat))....
5a20: 09 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e . 'failed-to-in
5a30: 73 65 72 74 29 29 0a 09 09 20 20 20 20 20 20 28 sert))... (
5a40: 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 (failed-to-inser
5a50: 74 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 t)... (deb
5a60: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
5a70: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 R: Failed to ins
5a80: 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 ert the record i
5a90: 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 09 nto the db"))...
5aa0: 20 20 20 20 20 20 28 28 4e 4f 54 5f 53 54 41 52 ((NOT_STAR
5ab0: 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09 TED COMPLETED)..
5ac0: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
5ad0: 72 69 6e 74 20 36 20 22 47 6f 74 20 68 65 72 65 rint 6 "Got here
5ae0: 2c 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 , " (test:get-st
5af0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
5b00: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 (let ((ru
5b10: 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 28 nflag #f)).... (
5b20: 63 6f 6e 64 0a 09 09 09 20 20 3b 3b 20 69 2e 65 cond.... ;; i.e
5b30: 2e 20 74 68 69 73 20 69 73 20 74 68 65 20 70 61 . this is the pa
5b40: 72 65 6e 74 20 74 65 73 74 20 74 6f 20 61 20 73 rent test to a s
5b50: 75 69 74 65 20 6f 66 20 69 74 65 6d 73 2c 20 6e uite of items, n
5b60: 65 76 65 72 20 22 72 75 6e 22 20 69 74 0a 09 09 ever "run" it...
5b70: 09 20 20 28 70 61 72 65 6e 74 2d 74 65 73 74 0a . (parent-test.
5b80: 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 ... (set! runf
5b90: 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 3b 3b lag #f)).... ;;
5ba0: 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 -force, run no
5bb0: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 09 09 20 matter what....
5bc0: 20 28 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 ((args:get-arg
5bd0: 22 2d 66 6f 72 63 65 22 29 28 73 65 74 21 20 72 "-force")(set! r
5be0: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 unflag #t))....
5bf0: 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c ;; NOT_STARTED,
5c00: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 run no matter w
5c10: 68 61 74 0a 09 09 09 20 20 28 28 65 71 75 61 6c hat.... ((equal
5c20: 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 ? (test:get-stat
5c30: 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f e testdat) "NOT_
5c40: 53 54 41 52 54 45 44 22 29 28 73 65 74 21 20 72 STARTED")(set! r
5c50: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 unflag #t))....
5c60: 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 ;; not -rerun a
5c70: 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 nd PASS, WARN or
5c80: 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 CHECK, do no ru
5c90: 6e 0a 09 09 09 20 20 28 28 61 6e 64 20 28 6f 72 n.... ((and (or
5ca0: 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 2d (not (args:get-
5cb0: 61 72 67 20 22 2d 72 65 72 75 6e 22 29 29 0a 09 arg "-rerun"))..
5cc0: 09 09 09 20 20 20 20 28 61 72 67 73 3a 67 65 74 ... (args:get
5cd0: 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 -arg "-keepgoing
5ce0: 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 ")).....(member
5cf0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
5d00: 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53 testdat) '("PAS
5d10: 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b S" "WARN" "CHECK
5d20: 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 "))).... (set!
5d30: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 runflag #f))...
5d40: 09 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 . ;; -rerun and
5d50: 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f status is one o
5d60: 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 f the specifed,
5d70: 72 75 6e 20 69 74 0a 09 09 09 20 20 28 28 61 6e run it.... ((an
5d80: 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 d (args:get-arg
5d90: 22 2d 72 65 72 75 6e 22 29 0a 09 09 09 09 28 6c "-rerun").....(l
5da0: 65 74 20 28 28 72 65 72 75 6e 6c 73 74 20 28 73 et ((rerunlst (s
5db0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 61 72 67 tring-split (arg
5dc0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 s:get-arg "-reru
5dd0: 6e 22 29 20 22 2c 22 29 29 29 20 3b 3b 20 46 41 n") ","))) ;; FA
5de0: 49 4c 2c 0a 09 09 09 09 20 20 28 6d 65 6d 62 65 IL,..... (membe
5df0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
5e00: 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75 us testdat) reru
5e10: 6e 6c 73 74 29 29 29 0a 09 09 09 20 20 20 28 73 nlst))).... (s
5e20: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
5e30: 0a 09 09 09 20 20 3b 3b 20 2d 6b 65 65 70 67 6f .... ;; -keepgo
5e40: 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 ing, do not reru
5e50: 6e 20 46 41 49 4c 0a 09 09 09 20 20 28 28 61 6e n FAIL.... ((an
5e60: 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 d (args:get-arg
5e70: 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 0a 09 09 "-keepgoing")...
5e80: 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a ..(member (test:
5e90: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
5ea0: 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a at) '("FAIL"))).
5eb0: 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 ... (set! runf
5ec0: 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 28 28 lag #f)).... ((
5ed0: 61 6e 64 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 and (not (args:g
5ee0: 65 74 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 29 et-arg "-rerun")
5ef0: 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 28 74 ).....(member (t
5f00: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
5f10: 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 estdat) '("FAIL"
5f20: 20 22 6e 2f 61 22 29 29 29 0a 09 09 09 20 20 20 "n/a")))....
5f30: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
5f40: 29 29 0a 09 09 09 20 20 28 65 6c 73 65 20 28 73 )).... (else (s
5f50: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 et! runflag #f))
5f60: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 ).... (debug:pri
5f70: 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e nt 6 "RUNNING =>
5f80: 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 runflag: " runf
5f90: 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 lag " STATE: " (
5fa0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
5fb0: 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53 estdat) " STATUS
5fc0: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 : " (test:get-st
5fd0: 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 atus testdat))..
5fe0: 09 09 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 .. (if (not runf
5ff0: 6c 61 67 29 0a 09 09 09 20 20 20 20 20 28 69 66 lag).... (if
6000: 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 (not parent-tes
6010: 74 29 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 t)..... (debug:p
6020: 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f rint 1 "NOTE: No
6030: 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 t starting test
6040: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 " new-test-name
6050: 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65 " as it is state
6060: 20 5c 22 43 4f 4d 50 4c 45 54 45 44 5c 22 20 61 \"COMPLETED\" a
6070: 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 nd status \"" (t
6080: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
6090: 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 estdat) "\", use
60a0: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 -force to overr
60b0: 69 64 65 22 29 29 0a 09 09 09 20 20 20 20 20 28 ide")).... (
60c0: 6c 65 74 2a 20 28 28 67 65 74 2d 70 72 65 72 65 let* ((get-prere
60d0: 71 73 2d 63 6d 64 20 28 6c 61 6d 62 64 61 20 28 qs-cmd (lambda (
60e0: 29 0a 09 09 09 09 09 09 20 20 20 20 20 20 20 28 )....... (
60f0: 64 62 2d 67 65 74 2d 70 72 65 72 65 71 73 2d 6e db-get-prereqs-n
6100: 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 ot-met db run-id
6110: 20 77 61 69 74 6f 6e 29 29 29 20 3b 3b 20 63 68 waiton))) ;; ch
6120: 65 63 6b 20 62 65 66 6f 72 65 20 72 75 6e 6e 69 eck before runni
6130: 6e 67 20 2e 2e 2e 2e 0a 09 09 09 09 20 20 20 20 ng .........
6140: 28 6c 61 75 6e 63 68 2d 63 6d 64 20 20 20 20 20 (launch-cmd
6150: 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 09 09 (lambda ().....
6160: 09 09 20 20 20 20 20 20 20 28 6c 61 75 6e 63 68 .. (launch
6170: 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 -test db run-id
6180: 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c test-conf keyval
6190: 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 lst test-name te
61a0: 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 29 st-path itemdat)
61b0: 29 29 0a 09 09 09 09 20 20 20 20 28 74 65 73 74 ))..... (test
61c0: 72 75 6e 64 61 74 20 20 20 20 20 20 28 6c 69 73 rundat (lis
61d0: 74 20 67 65 74 2d 70 72 65 72 65 71 73 2d 63 6d t get-prereqs-cm
61e0: 64 20 6c 61 75 6e 63 68 2d 63 6d 64 29 29 29 0a d launch-cmd))).
61f0: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 6f ... (if (o
6200: 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 r (args:get-arg
6210: 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 09 20 20 "-force").....
6220: 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 65 71 (let ((preq
6230: 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 20 28 28 s-not-yet-met ((
6240: 63 61 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 car testrundat))
6250: 29 29 0a 09 09 09 09 09 20 28 64 65 62 75 67 3a ))...... (debug:
6260: 70 72 69 6e 74 20 32 20 22 50 72 65 71 72 65 71 print 2 "Preqreq
6270: 75 65 73 69 74 65 73 20 66 6f 72 20 22 20 74 65 uesites for " te
6280: 73 74 2d 6e 61 6d 65 20 22 3a 20 22 20 70 72 65 st-name ": " pre
6290: 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 29 0a qs-not-yet-met).
62a0: 09 09 09 09 09 20 28 6e 75 6c 6c 3f 20 70 72 65 ..... (null? pre
62b0: 71 73 2d 6e 6f 74 2d 79 65 74 2d 6d 65 74 29 29 qs-not-yet-met))
62c0: 29 20 3b 3b 20 61 72 65 20 74 68 65 72 65 20 61 ) ;; are there a
62d0: 6e 79 20 74 65 73 74 73 20 74 68 61 74 20 6d 75 ny tests that mu
62e0: 73 74 20 62 65 20 72 75 6e 20 62 65 66 6f 72 65 st be run before
62f0: 20 74 68 69 73 20 6f 6e 65 2e 2e 2e 0a 09 09 09 this one.......
6300: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 28 63 . (if (not ((c
6310: 61 64 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 adr testrundat))
6320: 29 20 3b 3b 20 74 68 69 73 20 69 73 20 74 68 65 ) ;; this is the
6330: 20 6c 69 6e 65 20 74 68 61 74 20 6c 61 75 6e 63 line that launc
6340: 68 65 73 20 74 68 65 20 74 65 73 74 20 74 6f 20 hes the test to
6350: 74 68 65 20 72 65 6d 6f 74 65 20 68 6f 73 74 0a the remote host.
6360: 09 09 09 09 20 20 20 20 20 20 20 28 62 65 67 69 .... (begi
6370: 6e 0a 09 09 09 09 09 20 28 70 72 69 6e 74 20 22 n...... (print "
6380: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
6390: 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 launch the test
63a0: 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f . Exiting as soo
63b0: 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a n as possible").
63c0: 09 09 09 09 09 20 28 73 65 74 21 20 2a 67 6c 6f ..... (set! *glo
63d0: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 balexitstatus* 1
63e0: 29 20 3b 3b 20 0a 09 09 09 09 09 20 28 70 72 6f ) ;; ...... (pro
63f0: 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 cess-signal (cur
6400: 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 rent-process-id)
6410: 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 0a 09 09 signal/kill)...
6420: 09 09 09 20 3b 28 65 78 69 74 20 31 29 0a 09 09 ... ;(exit 1)...
6430: 09 09 09 20 29 29 0a 09 09 09 09 20 20 20 28 69 ... ))..... (i
6440: 66 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 f (not (args:get
6450: 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 -arg "-keepgoing
6460: 22 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 "))..... (
6470: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
6480: 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 2a 20 *waiting-queue*
6490: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 new-test-name te
64a0: 73 74 72 75 6e 64 61 74 29 29 29 29 29 29 29 0a strundat))))))).
64b0: 09 09 20 20 20 20 20 20 28 28 4b 49 4c 4c 45 44 .. ((KILLED
64c0: 29 20 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 ) ... (deb
64d0: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 ug:print 1 "NOTE
64e0: 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d : " new-test-nam
64f0: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 e " is already r
6500: 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 unning or was ex
6510: 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 plictly killed,
6520: 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 use -force to la
6530: 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 09 20 20 unch it."))...
6540: 20 20 20 20 28 28 4c 41 55 4e 43 48 45 44 20 52 ((LAUNCHED R
6550: 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 EMOTEHOSTSTART R
6560: 55 4e 4e 49 4e 47 29 20 20 0a 09 09 20 20 20 20 UNNING) ...
6570: 20 20 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 (if (> (- (cu
6580: 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b rrent-seconds)(+
6590: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 (db:test-get-ev
65a0: 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 ent_time testdat
65b0: 29 0a 09 09 09 09 09 09 20 20 20 20 20 28 64 62 )....... (db
65c0: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 :test-get-run_du
65d0: 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 ration testdat))
65e0: 29 0a 09 09 09 20 20 20 20 20 20 31 30 30 29 20 ).... 100)
65f0: 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 ;; i.e. no updat
6600: 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 e for more than
6610: 31 30 30 20 73 65 63 6f 6e 64 73 0a 09 09 09 20 100 seconds....
6620: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 (begin....
6630: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
6640: 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 "WARNING: Test "
6650: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 test-name " app
6660: 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e ears to be dead.
6670: 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 Forcing it to s
6680: 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 tate INCOMPLETE
6690: 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b and status STUCK
66a0: 2f 44 45 41 44 22 29 0a 09 09 09 20 20 20 20 20 /DEAD")....
66b0: 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 (test-set-status
66c0: 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 ! db run-id test
66d0: 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 54 -name "INCOMPLET
66e0: 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 E" "STUCK/DEAD"
66f0: 69 74 65 6d 64 61 74 20 22 54 65 73 74 20 69 73 itemdat "Test is
6700: 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 29 stuck or dead")
6710: 29 0a 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 ).... (debug:p
6720: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 rint 2 "NOTE: "
6730: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 test-name " is a
6740: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 lready running")
6750: 29 29 0a 09 09 20 20 20 20 20 20 28 65 6c 73 65 ))... (else
6760: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
6770: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 int 0 "ERROR: Fa
6780: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 iled to launch t
6790: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e est " new-test-n
67a0: 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 ame ". Unrecogni
67b0: 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 sed state " (tes
67c0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
67d0: 64 61 74 29 29 29 29 29 29 0a 09 20 20 20 20 20 dat))))))..
67e0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
67f0: 20 74 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f 70 tal))... (loop
6800: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 (car tal)(cdr t
6810: 61 6c 29 29 29 29 29 29 29 29 29 0a 0a 28 64 65 al)))))))))..(de
6820: 66 69 6e 65 20 28 72 75 6e 2d 77 61 69 74 69 6e fine (run-waitin
6830: 67 2d 74 65 73 74 73 20 64 62 29 0a 20 20 28 6c g-tests db). (l
6840: 65 74 20 28 28 6e 75 6d 74 72 69 65 73 20 20 20 et ((numtries
6850: 20 20 20 20 20 20 20 20 30 29 0a 09 28 6c 61 73 0)..(las
6860: 74 2d 74 72 79 2d 74 69 6d 65 20 20 20 20 20 20 t-try-time
6870: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 (current-seconds
6880: 29 29 0a 09 28 74 69 6d 65 73 20 20 20 20 20 20 ))..(times
6890: 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 31 29 (list 1)
68a0: 29 29 20 3b 3b 20 6d 69 6e 75 74 65 73 20 74 6f )) ;; minutes to
68b0: 20 77 61 69 74 20 62 65 66 6f 72 65 20 74 72 79 wait before try
68c0: 69 6e 67 20 61 67 61 69 6e 20 74 6f 20 6b 69 63 ing again to kic
68d0: 6b 20 6f 66 66 20 72 75 6e 73 0a 20 20 20 20 3b k off runs. ;
68e0: 3b 20 42 55 47 20 74 68 69 73 20 68 61 63 6b 20 ; BUG this hack
68f0: 6f 66 20 62 72 75 74 65 20 66 6f 72 63 65 20 72 of brute force r
6900: 65 74 72 79 69 6e 67 20 77 6f 72 6b 73 20 71 75 etrying works qu
6910: 69 74 65 20 77 65 6c 6c 20 66 6f 72 20 6d 61 6e ite well for man
6920: 79 20 63 61 73 65 73 20 62 75 74 20 0a 20 20 20 y cases but .
6930: 20 3b 3b 20 20 20 20 20 77 68 61 74 20 69 73 20 ;; what is
6940: 6e 65 65 64 65 64 20 69 73 20 74 6f 20 63 68 65 needed is to che
6950: 63 6b 20 74 68 65 20 64 62 20 66 6f 72 20 74 65 ck the db for te
6960: 73 74 73 20 74 68 61 74 20 68 61 76 65 20 66 61 sts that have fa
6970: 69 6c 65 64 20 6c 65 73 73 20 74 68 61 6e 0a 20 iled less than.
6980: 20 20 20 3b 3b 20 20 20 20 20 4e 20 74 69 6d 65 ;; N time
6990: 73 20 6f 72 20 6e 65 76 65 72 20 62 65 65 6e 20 s or never been
69a0: 73 74 61 72 74 65 64 20 61 6e 64 20 6b 69 63 6b started and kick
69b0: 20 74 68 65 6d 20 6f 66 66 20 61 67 61 69 6e 0a them off again.
69c0: 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 (let loop ((
69d0: 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d waiting-test-nam
69e0: 65 73 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b es (hash-table-k
69f0: 65 79 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 eys *waiting-que
6a00: 75 65 2a 29 29 29 0a 20 20 20 20 20 20 28 63 6f ue*))). (co
6a10: 6e 64 0a 20 20 20 20 20 20 20 28 28 6e 6f 74 20 nd. ((not
6a20: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f (runs:can-run-mo
6a30: 72 65 2d 74 65 73 74 73 20 64 62 29 29 0a 09 28 re-tests db))..(
6a40: 73 6c 65 65 70 20 32 29 0a 09 28 6c 6f 6f 70 20 sleep 2)..(loop
6a50: 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d waiting-test-nam
6a60: 65 73 29 29 0a 20 20 20 20 20 20 20 28 28 6e 75 es)). ((nu
6a70: 6c 6c 3f 20 77 61 69 74 69 6e 67 2d 74 65 73 74 ll? waiting-test
6a80: 2d 6e 61 6d 65 73 29 0a 09 28 64 65 62 75 67 3a -names)..(debug:
6a90: 70 72 69 6e 74 20 31 20 22 41 6c 6c 20 74 65 73 print 1 "All tes
6aa0: 74 73 20 6c 61 75 6e 63 68 65 64 22 29 29 0a 20 ts launched")).
6ab0: 20 20 20 20 20 20 28 65 6c 73 65 0a 09 28 73 65 (else..(se
6ac0: 74 21 20 6e 75 6d 74 72 69 65 73 20 28 2b 20 6e t! numtries (+ n
6ad0: 75 6d 74 72 69 65 73 20 31 29 29 0a 09 28 66 6f umtries 1))..(fo
6ae0: 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 r-each (lambda (
6af0: 74 65 73 74 6e 61 6d 65 29 0a 09 09 20 20 20 20 testname)...
6b00: 28 69 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 (if (runs:can-ru
6b10: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 n-more-tests db)
6b20: 0a 09 09 09 28 6c 65 74 2a 20 28 28 74 65 73 74 ....(let* ((test
6b30: 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d dat (hash-table-
6b40: 72 65 66 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 ref *waiting-que
6b50: 75 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 0a 09 ue* testname))..
6b60: 09 09 20 20 20 20 20 20 20 28 70 72 65 72 65 71 .. (prereq
6b70: 73 20 28 28 63 61 72 20 74 65 73 74 64 61 74 29 s ((car testdat)
6b80: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6c 64 )).... (ld
6b90: 62 20 20 20 20 20 28 69 66 20 64 62 20 64 62 20 b (if db db
6ba0: 28 6f 70 65 6e 2d 64 62 29 29 29 29 0a 09 09 09 (open-db))))....
6bb0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
6bc0: 20 22 70 72 65 72 65 71 73 20 72 65 6d 61 69 6e "prereqs remain
6bd0: 69 6e 67 3a 20 22 20 70 72 65 72 65 71 73 29 0a ing: " prereqs).
6be0: 09 09 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 ... (if (null?
6bf0: 70 72 65 72 65 71 73 29 0a 09 09 09 20 20 20 20 prereqs)....
6c00: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 (begin.....(de
6c10: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 50 72 65 bug:print 2 "Pre
6c20: 72 65 71 75 69 73 69 74 65 73 20 6d 65 74 2c 20 requisites met,
6c30: 6c 61 75 6e 63 68 69 6e 67 20 22 20 74 65 73 74 launching " test
6c40: 6e 61 6d 65 29 0a 09 09 09 09 28 28 63 61 64 72 name).....((cadr
6c50: 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 09 28 testdat)).....(
6c60: 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 hash-table-delet
6c70: 65 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 e! *waiting-queu
6c80: 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 29 0a 09 e* testname)))..
6c90: 09 09 20 20 28 69 66 20 28 6e 6f 74 20 64 62 29 .. (if (not db)
6ca0: 0a 09 09 09 20 20 20 20 20 20 28 73 71 6c 69 74 .... (sqlit
6cb0: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 6c 64 62 e3:finalize! ldb
6cc0: 29 29 29 29 29 0a 09 09 20 20 77 61 69 74 69 6e )))))... waitin
6cd0: 67 2d 74 65 73 74 2d 6e 61 6d 65 73 29 0a 09 3b g-test-names)..;
6ce0: 3b 20 28 73 6c 65 65 70 20 31 30 29 20 3b 3b 20 ; (sleep 10) ;;
6cf0: 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 72 75 73 68 no point in rush
6d00: 69 6e 67 20 74 68 69 6e 67 73 20 61 74 20 74 68 ing things at th
6d10: 69 73 20 73 74 61 67 65 3f 0a 09 28 6c 6f 6f 70 is stage?..(loop
6d20: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 (hash-table-key
6d30: 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 s *waiting-queue
6d40: 2a 29 29 29 29 29 29 29 0a 0a 28 64 65 66 69 6e *)))))))..(defin
6d50: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 e (get-dir-up-n
6d60: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 dir . params) .
6d70: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 (let ((dparts
6d80: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 (string-split di
6d90: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 r "/"))..(count
6da0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 (if (null? par
6db0: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 ams) 1 (car para
6dc0: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 ms)))). (conc
6dd0: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
6de0: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 ersperse ..
6df0: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 (take dparts (
6e00: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
6e10: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 ) count))..
6e20: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d "/")))).;; Rem
6e30: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c ove runs.;; fiel
6e40: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 ds are passing i
6e50: 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 69 n through .(defi
6e60: 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 2d ne (runs:remove-
6e70: 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 70 runs db runnamep
6e80: 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 65 att testpatt ite
6e90: 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 28 mpatt). (let* (
6ea0: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 62 (keys (db
6eb0: 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 -get-keys db))..
6ec0: 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 28 72 (rundat (r
6ed0: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d uns:get-runs-by-
6ee0: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e patt db keys run
6ef0: 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 namepatt)).. (he
6f00: 61 64 65 72 20 20 20 20 20 20 28 76 65 63 74 6f ader (vecto
6f10: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 r-ref rundat 0))
6f20: 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 .. (runs
6f30: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
6f40: 61 74 20 31 29 29 29 0a 20 20 20 20 28 64 65 62 at 1))). (deb
6f50: 75 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 64 ug:print 1 "Head
6f60: 65 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 20 er: " header).
6f70: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 (for-each.
6f80: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 (lambda (run).
6f90: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e (let ((run
6fa0: 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 key (string-inte
6fb0: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 rsperse (map (la
6fc0: 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 mbda (k).......(
6fd0: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
6fe0: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
6ff0: 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 r (vector-ref k
7000: 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0))) keys) "/"))
7010: 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d ).. (let* ((run-
7020: 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 id (db:get-value
7030: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
7040: 65 61 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 eader "id") )...
7050: 28 74 65 73 74 73 20 20 28 64 62 2d 67 65 74 2d (tests (db-get-
7060: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
7070: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
7080: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
7090: 64 65 72 20 22 69 64 22 29 20 74 65 73 74 70 61 der "id") testpa
70a0: 74 74 20 69 74 65 6d 70 61 74 74 29 29 0a 09 09 tt itempatt))...
70b0: 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 (lasttpath "/doe
70c0: 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f s/not/exist/I/ho
70d0: 70 65 22 29 29 0a 09 20 20 20 28 69 66 20 28 6e pe")).. (if (n
70e0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 ot (null? tests)
70f0: 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e ).. (begin
7100: 0a 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
7110: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 1 "Removing tes
7120: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 ts for run: " ru
7130: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 nkey " " (db:get
7140: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
7150: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e run header "run
7160: 6e 61 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 2d name"))... (for-
7170: 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 each... (lambda
7180: 20 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c (test)... (l
7190: 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 et* ((item-path
71a0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 (db:test-get-ite
71b0: 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 m-path test))...
71c0: 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 . (test-name (
71d0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
71e0: 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 name test))....
71f0: 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 (run-dir (db
7200: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 :test-get-rundir
7210: 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 test)))...
7220: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
7230: 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 " " (db:test-ge
7240: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 t-testname test)
7250: 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 " id: " (db:tes
7260: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 t-get-id test) "
7270: 20 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 " item-path)...
7280: 20 20 20 20 20 20 28 64 62 3a 64 65 6c 65 74 65 (db:delete
7290: 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 -test-records db
72a0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
72b0: 20 74 65 73 74 29 29 0a 09 09 20 20 20 20 20 20 test))...
72c0: 28 69 66 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c (if (> (string-l
72d0: 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 35 ength run-dir) 5
72e0: 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 ) ;; bad heurist
72f0: 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 ic but should pr
7300: 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 event /tmp /home
7310: 20 65 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 20 etc..... (let
7320: 28 28 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d 64 ((fullpath run-d
7330: 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 3a ir)) ;; "/" (db:
7340: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
7350: 74 68 20 74 65 73 74 29 29 29 29 0a 09 09 09 20 th test))))....
7360: 20 20 20 28 73 65 74 21 20 6c 61 73 74 74 70 61 (set! lasttpa
7370: 74 68 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 th fullpath)....
7380: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
7390: 20 31 20 22 72 6d 20 2d 72 66 20 22 20 66 75 6c 1 "rm -rf " ful
73a0: 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 73 lpath).... (s
73b0: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 ystem (conc "rm
73c0: 2d 72 66 20 22 20 66 75 6c 6c 70 61 74 68 29 29 -rf " fullpath))
73d0: 0a 09 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 .... (let* ((
73e0: 64 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 dirs-count (+ 1
73f0: 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 (length keys)(le
7400: 6e 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c ngth (string-spl
7410: 69 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 it item-path "/"
7420: 29 29 29 29 0a 09 09 09 09 20 20 20 28 64 69 72 ))))..... (dir
7430: 2d 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 72 -to-rem (get-dir
7440: 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 64 -up-n fullpath d
7450: 69 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 09 irs-count)).....
7460: 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 (remainingd (
7470: 73 74 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 string-substitut
7480: 65 20 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 e (regexp (conc
7490: 22 5e 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 "^" dir-to-rem "
74a0: 2f 22 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 /")) "" fullpath
74b0: 29 29 0a 09 09 09 09 20 20 20 28 63 6d 64 20 28 ))..... (cmd (
74c0: 63 6f 6e 63 20 22 63 64 20 22 20 64 69 72 2d 74 conc "cd " dir-t
74d0: 6f 2d 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d o-rem "; rmdir -
74e0: 70 20 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 p " remainingd )
74f0: 29 29 0a 09 09 09 20 20 20 20 20 20 28 69 66 20 )).... (if
7500: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 75 (file-exists? fu
7510: 6c 6c 70 61 74 68 29 0a 09 09 09 09 20 20 28 62 llpath)..... (b
7520: 65 67 69 6e 0a 09 09 09 09 20 20 20 20 28 64 65 egin..... (de
7530: 62 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 bug:print 1 cmd)
7540: 0a 09 09 09 09 20 20 20 20 28 73 79 73 74 65 6d ..... (system
7550: 20 63 6d 64 29 29 29 0a 09 09 09 20 20 20 20 20 cmd)))....
7560: 20 29 29 0a 09 09 09 20 20 20 20 29 29 29 0a 09 )).... )))..
7570: 09 20 20 20 20 74 65 73 74 73 29 29 29 0a 09 20 . tests)))..
7580: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 (let ((remtest
7590: 73 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d s (db-get-tests-
75a0: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 for-run db (db:g
75b0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
75c0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 er run header "i
75d0: 64 22 29 29 29 29 0a 09 20 20 20 20 20 28 69 66 d")))).. (if
75e0: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 (null? remtests
75f0: 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 ) ;; no more tes
7600: 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 ts remaining...
7610: 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 (let* ((dparts
7620: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 (string-split la
7630: 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 sttpath "/"))...
7640: 09 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 .(runpath (conc
7650: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 "/" (string-inte
7660: 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 20 rsperse ......
7670: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 (take dparts (
7680: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
7690: 29 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 22 ) 1))...... "
76a0: 2f 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 62 /"))))... (deb
76b0: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
76c0: 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b ving run: " runk
76d0: 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 ey " " (db:get-v
76e0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
76f0: 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 un header "runna
7700: 6d 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a 64 me"))... (db:d
7710: 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e elete-run db run
7720: 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 -id)... ;; nee
7730: 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 d to figure out
7740: 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 the path to the
7750: 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f run dir and remo
7760: 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 ve it if empty..
7770: 09 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e . ;; (if (n
7780: 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ull? (glob (conc
7790: 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 runpath "/*")))
77a0: 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 20 ... ;;
77b0: 28 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 (begin... ;; .
77c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
77d0: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 "Removing run di
77e0: 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 r " runpath)...
77f0: 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 ;; . (system (
7800: 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 conc "rmdir -p "
7810: 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 runpath))))...
7820: 20 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 )))).. )).
7830: 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d runs)))..;;====
7840: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7850: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7870: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7880: 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 66 ==.;; Routines f
7890: 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 or manipulating
78a0: 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d runs.;;=========
78b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
78c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
78d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
78e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b =============..;
78f0: 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 6c ; Since many cal
7900: 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 75 ls to a run requ
7910: 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 20 ire pretty much
7920: 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 0a the same setup .
7930: 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 20 ;; this wrapper
7940: 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 63 is used to reduc
7950: 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 6f e the replicatio
7960: 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 6e n of code.(defin
7970: 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 e (general-run-c
7980: 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 61 all switchname a
7990: 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 29 ction-desc proc)
79a0: 0a 20 20 28 69 66 20 28 6e 6f 74 20 28 61 72 67 . (if (not (arg
79b0: 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e s:get-arg ":runn
79c0: 61 6d 65 22 29 29 0a 20 20 20 20 20 20 28 62 65 ame")). (be
79d0: 67 69 6e 0a 09 28 64 65 62 75 67 3a 70 72 69 6e gin..(debug:prin
79e0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 t 0 "ERROR: Miss
79f0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 ing required par
7a00: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 ameter for " swi
7a10: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d tchname ", you m
7a20: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 ust specify the
7a30: 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 run name with :r
7a40: 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 unname runname")
7a50: 0a 09 28 65 78 69 74 20 32 29 29 0a 20 20 20 20 ..(exit 2)).
7a60: 20 20 28 6c 65 74 20 28 28 64 62 20 23 66 29 29 (let ((db #f))
7a70: 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 75 ..(if (not (setu
7a80: 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 p-for-run))..
7a90: 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 20 (begin ..
7aa0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
7ab0: 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 2c Failed to setup,
7ac0: 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 20 exiting")..
7ad0: 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 73 (exit 1)))..(s
7ae0: 65 74 21 20 64 62 20 28 6f 70 65 6e 2d 64 62 29 et! db (open-db)
7af0: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 )..(if (not (car
7b00: 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a *configinfo*)).
7b10: 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 . (begin..
7b20: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
7b30: 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 0 "ERROR: Attemp
7b40: 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d ted to " action-
7b50: 64 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 desc " but run a
7b60: 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 rea config file
7b70: 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 not found")..
7b80: 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 (exit 1))..
7b90: 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 ;; Extract out
7ba0: 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e stuff needed in
7bb0: 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 most or many ca
7bc0: 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 lls.. ;; here
7bd0: 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a then call proc.
7be0: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 . (let* ((key
7bf0: 73 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d s (db-get-
7c00: 6b 65 79 73 20 64 62 29 29 0a 09 09 20 20 20 28 keys db))... (
7c10: 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 keynames (map
7c20: 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d key:get-fieldnam
7c30: 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b e keys))... (k
7c40: 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d eyvallst (keys-
7c50: 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 >vallist keys #t
7c60: 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 ))).. (proc
7c70: 20 64 62 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 db keys keyname
7c80: 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 s keyvallst)))..
7c90: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
7ca0: 65 21 20 64 62 29 0a 09 28 73 65 74 21 20 2a 64 e! db)..(set! *d
7cb0: 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 idsomething* #t)
7cc0: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
7cd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7ce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7cf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7d00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
7d10: 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d Rollup runs.;;=
7d20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7d30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7d40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7d50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7d60: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 =====..;; Update
7d70: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 the test_meta t
7d80: 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 able for this te
7d90: 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 st.(define (runs
7da0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
7db0: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
7dc0: 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 est-conf). (let
7dd0: 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 64 ((currrecord (d
7de0: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 b:testmeta-get-r
7df0: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 ecord db test-na
7e00: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e me))). (if (n
7e10: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 ot currrecord)..
7e20: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 (begin.. (set!
7e30: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 currrecord (make
7e40: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a -vector 10 #f)).
7e50: 09 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d . (db:testmeta-
7e60: 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 add-record db te
7e70: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 st-name))). (
7e80: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 for-each . (
7e90: 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 lambda (key).
7ea0: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 (let* ((idx
7eb0: 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 (cadr key))..
7ec0: 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 (fld (car ke
7ed0: 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 y)).. (val
7ee0: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 (config-lookup t
7ef0: 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d est-conf "test_m
7f00: 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 28 69 eta" fld))).. (i
7f10: 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 f (and val (not
7f20: 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d (equal? (vector-
7f30: 72 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 ref currrecord i
7f40: 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 dx) val)))..
7f50: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 (begin..
7f60: 28 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 (print "Updating
7f70: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 " test-name " "
7f80: 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 fld " to " val)
7f90: 0a 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 .. (db:tes
7fa0: 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 tmeta-update-fie
7fb0: 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 ld db test-name
7fc0: 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 fld val))))).
7fd0: 20 20 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 '(("author" 2)
7fe0: 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 ("owner" 3)("des
7ff0: 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 cription" 4)("re
8000: 76 69 65 77 65 64 22 20 35 29 28 22 74 61 67 73 viewed" 5)("tags
8010: 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 " 9)))))..;; Upd
8020: 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f ate test_meta fo
8030: 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 r all tests.(def
8040: 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 ine (runs:update
8050: 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 -all-test_meta d
8060: 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 b). (let ((test
8070: 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d -names (get-all-
8080: 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 legal-tests))).
8090: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 (for-each .
80a0: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 (lambda (test
80b0: 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c -name). (l
80c0: 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 et* ((test-path
80d0: 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 (conc *toppat
80e0: 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 h* "/tests/" tes
80f0: 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 t-name))..
8100: 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 (test-configf (c
8110: 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f onc test-path "/
8120: 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 testconfig"))..
8130: 20 20 20 20 20 28 74 65 73 74 65 78 69 73 74 73 (testexists
8140: 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 (and (file-ex
8150: 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 ists? test-confi
8160: 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 gf)(file-read-ac
8170: 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 cess? test-confi
8180: 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 gf))).. ;;
8190: 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 read configs wit
81a0: 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 h tricks turned
81b0: 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 off (i.e. no sys
81c0: 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 tem).. (tes
81d0: 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 t-conf (if te
81e0: 73 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 stexists (read-c
81f0: 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 onfig test-confi
8200: 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 gf #f #f)(make-h
8210: 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 ash-table))))..
8220: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 (runs:update-tes
8230: 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e t_meta db test-n
8240: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 ame test-conf)))
8250: 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 . test-names
8260: 29 29 29 0a 09 20 0a 28 64 65 66 69 6e 65 20 28 ))).. .(define (
8270: 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 runs:rollup-run
8280: 64 62 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 73 db keys keynames
8290: 20 6b 65 79 76 61 6c 6c 73 74 20 6e 29 0a 20 20 keyvallst n).
82a0: 28 6c 65 74 2a 20 28 28 6e 65 77 2d 72 75 6e 2d (let* ((new-run-
82b0: 69 64 20 20 20 28 72 65 67 69 73 74 65 72 2d 72 id (register-r
82c0: 75 6e 20 64 62 20 6b 65 79 73 29 29 0a 09 20 28 un db keys)).. (
82d0: 73 69 6d 69 6c 61 72 2d 72 75 6e 73 20 28 64 62 similar-runs (db
82e0: 3a 67 65 74 2d 72 75 6e 73 20 64 62 20 6b 65 79 :get-runs db key
82f0: 73 29 29 0a 09 20 28 74 65 73 74 73 2d 6e 2d 64 s)).. (tests-n-d
8300: 61 79 73 20 28 64 62 3a 67 65 74 2d 74 65 73 74 ays (db:get-test
8310: 73 2d 6e 2d 64 61 79 73 20 64 62 20 73 69 6d 69 s-n-days db simi
8320: 6c 61 72 2d 72 75 6e 73 29 29 29 0a 20 20 20 20 lar-runs))).
8330: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
8340: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 69 64 (lambda (test-id
8350: 29 0a 20 20 20 20 20 20 20 28 64 62 3a 72 6f 6c ). (db:rol
8360: 6c 75 70 2d 74 65 73 74 20 64 62 20 72 75 6e 2d lup-test db run-
8370: 69 64 20 74 65 73 74 2d 69 64 29 29 0a 20 20 20 id test-id)).
8380: 20 20 74 65 73 74 73 2d 6e 2d 64 61 79 73 29 29 tests-n-days))
8390: 29 0a ).