0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30 .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77 06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53 r.;; greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72 .;; This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 RRANTY; without
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70 even the.;; imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 or FITNESS FOR
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20 A PARTICULAR.;;
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73 PURPOSE...;; s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25 trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77 Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a ','localtime')..
0180: 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 74 65 ;; register a te
0190: 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 65 20 st run with the
01a0: 64 62 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 db.(define (regi
01b0: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
01c0: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a ) ;; test-name).
01d0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 72 (let* ((keystr
01e0: 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74 (keys->keyst
01f0: 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d r keys)).. (comm
0200: 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 a (if (> (le
0210: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 2c ngth keys) 0) ",
0220: 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 72 " "")).. (andstr
0230: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 (if (> (leng
0240: 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 4e th keys) 0) " AN
0250: 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c 73 D " "")).. (vals
0260: 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c lots (keys->val
0270: 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b 20 slots keys)) ;;
0280: 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 ?,?,? ..... (key
0290: 76 61 6c 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 vallst (keys->va
02a0: 6c 6c 69 73 74 20 6b 65 79 73 29 29 20 3b 3b 20 llist keys)) ;;
02b0: 65 78 74 72 61 63 74 73 20 74 68 65 20 76 61 6c extracts the val
02c0: 75 65 73 20 66 72 6f 6d 20 72 65 6d 61 69 6e 64 ues from remaind
02d0: 65 72 20 6f 66 20 28 61 72 67 76 29 0a 09 20 28 er of (argv).. (
02e0: 72 75 6e 6e 61 6d 65 20 20 20 28 67 65 74 2d 77 runname (get-w
02f0: 69 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 72 75 ith-default ":ru
0300: 6e 6e 61 6d 65 22 20 23 66 29 29 0a 09 20 28 73 nname" #f)).. (s
0310: 74 61 74 65 20 20 20 20 20 28 67 65 74 2d 77 69 tate (get-wi
0320: 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 th-default ":sta
0330: 74 65 22 20 22 6e 6f 22 29 29 0a 09 20 28 73 74 te" "no")).. (st
0340: 61 74 75 73 20 20 20 20 28 67 65 74 2d 77 69 74 atus (get-wit
0350: 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 74 h-default ":stat
0360: 75 73 22 20 22 6e 2f 61 22 29 29 0a 09 20 28 61 us" "n/a")).. (a
0370: 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 llvals (append
0380: 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20 73 (list runname s
0390: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 tate status user
03a0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03b0: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 (qryvals (appe
03c0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
03d0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03e0: 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 (key=?str (stri
03f0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
0400: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 map (lambda (k)(
0410: 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 conc (key:get-fi
0420: 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 eldname k) "=?")
0430: 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 ) keys) " AND ")
0440: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
0450: 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b int 3 "keys: " k
0460: 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 eys " allvals: "
0470: 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 allvals " keyva
0480: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 llst: " keyvalls
0490: 74 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 t). (debug:pr
04a0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 int 2 "NOTE: usi
04b0: 6e 67 20 6b 65 79 20 22 20 28 73 74 72 69 6e 67 ng key " (string
04c0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 -intersperse key
04d0: 76 61 6c 6c 73 74 20 22 2f 22 29 20 22 20 66 6f vallst "/") " fo
04e0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 r this run").
04f0: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d (if (and runnam
0500: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 e (null? (filter
0510: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 (lambda (x)(not
0520: 20 78 29 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 x)) keyvallst))
0530: 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 ) ;; there must
0540: 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20 be a better way
0550: 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 to "apply and"..
0560: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a (let ((res #f)).
0570: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 . (apply sqlite
0580: 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 3:execute db (co
0590: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 nc "INSERT OR IG
05a0: 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 NORE INTO runs (
05b0: 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 runname,state,st
05c0: 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 atus,owner,event
05d0: 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 _time" comma key
05e0: 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f str ") VALUES (?
05f0: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 ,?,?,?,strftime(
0600: 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d '%s','now')" com
0610: 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 ma valslots ");"
0620: 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 )... allvals)..
0630: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
0640: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 for-each-row ..
0650: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 (lambda (id)..
0660: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69 (set! res i
0670: 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 d)).. db.. (
0680: 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 let ((qry (conc
0690: 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 "SELECT id FROM
06a0: 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e runs WHERE (runn
06b0: 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b ame=? " andstr k
06c0: 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a ey=?str ");"))).
06d0: 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 . ;(debug:pr
06e0: 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 int 4 "qry: " qr
06f0: 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 y) .. qry)..
0700: 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 qryvals).. (
0710: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
0720: 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 db "UPDATE runs
0730: 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 SET state=?,stat
0740: 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b us=? WHERE id=?;
0750: 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 " state status r
0760: 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 es).. res) ..(b
0770: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 egin.. (debug:p
0780: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 rint 0 "ERROR: C
0790: 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c alled without al
07a0: 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 l necessary keys
07b0: 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b ").. #f))))..;;
07c0: 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 runs:get-runs-b
07d0: 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72 75 y-patt.;; get ru
07e0: 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63 72 ns by list of cr
07f0: 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73 74 iteria.;; regist
0800: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 er a test run wi
0810: 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b 20 th the db.;;.;;
0820: 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61 6c Use: (db-get-val
0830: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64 62 ue-by-header (db
0840: 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e 69 :get-header runi
0850: 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77 20 nfo)(db:get-row
0860: 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74 6f runinfo)).;; to
0870: 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66 72 extract info fr
0880: 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 65 om the structure
0890: 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64 65 returned.;;.(de
08a0: 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d 72 fine (runs:get-r
08b0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
08c0: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 eys runnamepatt
08d0: 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65 73 . params) ;; tes
08e0: 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 t-name). (let*
08f0: 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65 79 ((keyvallst (key
0900: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 29 s->vallist keys)
0910: 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28 72 ).. (tmp (r
0920: 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e 2d uns:get-std-run-
0930: 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22 69 fields keys '("i
0940: 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73 74 d" "runname" "st
0950: 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22 6f ate" "status" "o
0960: 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69 6d wner" "event_tim
0970: 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72 20 e"))).. (keystr
0980: 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20 28 (car tmp)).. (
0990: 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20 74 header (cadr t
09a0: 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20 20 mp)).. (res
09b0: 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74 74 '()).. (key-patt
09c0: 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 "")). (for-e
09d0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 ach (lambda (key
09e0: 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b val)...(let* ((k
09f0: 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 ey (vector-re
0a00: 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09 20 f keyval 0))...
0a10: 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28 63 (fulkey (c
0a20: 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 onc ":" key))...
0a30: 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20 28 (patt (
0a40: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75 6c args:get-arg ful
0a50: 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20 70 key)))... (if p
0a60: 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 att... (set
0a70: 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 ! key-patt (conc
0a80: 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 key-patt " AND
0a90: 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22 20 " key " like '"
0aa0: 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20 20 patt "'"))...
0ab0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64 65 (begin....(de
0ac0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
0ad0: 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66 6f OR: searching fo
0ae0: 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20 70 r runs with no p
0af0: 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20 22 attern set for "
0b00: 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78 69 fulkey)....(exi
0b10: 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20 20 t 6)))))..
0b20: 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69 74 keys). (sqlit
0b30: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 e3:for-each-row
0b40: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 . (lambda (a
0b50: 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73 65 . r). (se
0b60: 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c 69 t! res (cons (li
0b70: 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e 73 st->vector (cons
0b80: 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20 20 a r)) res))).
0b90: 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e db . (con
0ba0: 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79 73 c "SELECT " keys
0bb0: 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 tr " FROM runs W
0bc0: 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69 6b HERE runname lik
0bd0: 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 e ? " key-patt "
0be0: 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d 65 ;"). runname
0bf0: 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74 6f patt). (vecto
0c00: 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29 0a r header res))).
0c10: 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 73 74 .(define (regist
0c20: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 er-test db run-i
0c30: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
0c40: 2d 70 61 74 68 20 74 61 67 73 29 0a 20 20 28 6c -path tags). (l
0c50: 65 74 20 28 28 69 74 65 6d 2d 70 61 74 68 73 20 et ((item-paths
0c60: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
0c70: 2d 70 61 74 68 20 22 22 29 0a 09 09 09 28 6c 69 -path "")....(li
0c80: 73 74 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 st item-path)...
0c90: 09 28 6c 69 73 74 20 69 74 65 6d 2d 70 61 74 68 .(list item-path
0ca0: 20 22 22 29 29 29 29 0a 20 20 20 20 28 66 6f 72 "")))). (for
0cb0: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d -each . (lam
0cc0: 62 64 61 20 28 70 74 68 29 0a 20 20 20 20 20 20 bda (pth).
0cd0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
0ce0: 65 20 64 62 20 22 49 4e 53 45 52 54 20 4f 52 20 e db "INSERT OR
0cf0: 49 47 4e 4f 52 45 20 49 4e 54 4f 20 74 65 73 74 IGNORE INTO test
0d00: 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 s (run_id,testna
0d10: 6d 65 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 69 74 me,event_time,it
0d20: 65 6d 5f 70 61 74 68 2c 73 74 61 74 65 2c 73 74 em_path,state,st
0d30: 61 74 75 73 2c 74 61 67 73 29 20 56 41 4c 55 45 atus,tags) VALUE
0d40: 53 20 28 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 S (?,?,strftime(
0d50: 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f 2c 27 4e '%s','now'),?,'N
0d60: 4f 54 5f 53 54 41 52 54 45 44 27 2c 27 6e 2f 61 OT_STARTED','n/a
0d70: 27 2c 3f 29 3b 22 20 0a 09 09 09 72 75 6e 2d 69 ',?);" ....run-i
0d80: 64 20 0a 09 09 09 74 65 73 74 2d 6e 61 6d 65 0a d ....test-name.
0d90: 09 09 09 70 74 68 20 0a 09 09 09 28 63 6f 6e 63 ...pth ....(conc
0da0: 20 22 2c 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "," (string-int
0db0: 65 72 73 70 65 72 73 65 20 74 61 67 73 20 22 2c ersperse tags ",
0dc0: 22 29 20 22 2c 22 29 29 29 0a 20 20 20 20 20 69 ") ","))). i
0dd0: 74 65 6d 2d 70 61 74 68 73 20 29 29 29 0a 0a 3b tem-paths )))..;
0de0: 3b 20 20 28 64 65 66 69 6e 65 20 64 62 20 28 6f ; (define db (o
0df0: 70 65 6e 2d 64 62 29 29 0a 3b 3b 20 20 28 74 65 pen-db)).;; (te
0e00: 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 st-set-status! d
0e10: 62 20 32 20 22 72 75 6e 66 69 72 73 74 22 20 22 b 2 "runfirst" "
0e20: 43 4f 4d 50 4c 45 54 45 44 22 20 22 50 41 53 53 COMPLETED" "PASS
0e30: 22 20 22 73 75 6d 6d 65 72 22 29 0a 0a 28 64 65 " "summer")..(de
0e40: 66 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 73 fine (test-set-s
0e50: 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 64 tatus! db run-id
0e60: 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 test-name state
0e70: 20 73 74 61 74 75 73 20 69 74 65 6d 64 61 74 2d status itemdat-
0e80: 6f 72 2d 70 61 74 68 20 2e 20 63 6f 6d 6d 65 6e or-path . commen
0e90: 74 29 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d t). (let ((item
0ea0: 2d 70 61 74 68 20 28 69 66 20 28 73 74 72 69 6e -path (if (strin
0eb0: 67 3f 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 61 g? itemdat-or-pa
0ec0: 74 68 29 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 th) itemdat-or-p
0ed0: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
0ee0: 70 61 74 68 20 69 74 65 6d 64 61 74 2d 6f 72 2d path itemdat-or-
0ef0: 70 61 74 68 29 29 29 29 0a 20 20 20 20 28 73 71 path)))). (sq
0f00: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
0f10: 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 "UPDATE tests S
0f20: 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 ET state=?,statu
0f30: 73 3d 3f 2c 65 76 65 6e 74 5f 74 69 6d 65 3d 73 s=?,event_time=s
0f40: 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f trftime('%s','no
0f50: 77 27 29 20 57 48 45 52 45 20 72 75 6e 5f 69 64 w') WHERE run_id
0f60: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
0f70: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
0f80: 3f 3b 22 20 0a 09 09 20 20 20 20 20 73 74 61 74 ?;" ... stat
0f90: 65 20 73 74 61 74 75 73 20 72 75 6e 2d 69 64 20 e status run-id
0fa0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
0fb0: 61 74 68 29 0a 20 20 20 20 28 69 66 20 28 61 6e ath). (if (an
0fc0: 64 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 d (not (equal? i
0fd0: 74 65 6d 2d 70 61 74 68 20 22 22 29 29 20 3b 3b tem-path "")) ;;
0fe0: 20 6e 65 65 64 20 74 6f 20 75 70 64 61 74 65 20 need to update
0ff0: 74 68 65 20 74 6f 70 20 74 65 73 74 20 72 65 63 the top test rec
1000: 6f 72 64 20 69 66 20 50 41 53 53 20 6f 72 20 46 ord if PASS or F
1010: 41 49 4c 20 61 6e 64 20 74 68 69 73 20 69 73 20 AIL and this is
1020: 61 20 73 75 62 74 65 73 74 0a 09 20 20 20 20 20 a subtest..
1030: 28 6f 72 20 28 65 71 75 61 6c 3f 20 73 74 61 74 (or (equal? stat
1040: 75 73 20 22 50 41 53 53 22 29 0a 09 09 20 28 65 us "PASS")... (e
1050: 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 57 41 qual? status "WA
1060: 52 4e 22 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 RN")... (equal?
1070: 73 74 61 74 75 73 20 22 46 41 49 4c 22 29 29 29 status "FAIL")))
1080: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 71 6c ..(begin.. (sql
1090: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 ite3:execute ..
10a0: 20 20 64 62 0a 09 20 20 20 22 55 50 44 41 54 45 db.. "UPDATE
10b0: 20 74 65 73 74 73 20 0a 20 20 20 20 20 20 20 20 tests .
10c0: 20 20 20 20 20 53 45 54 20 66 61 69 6c 5f 63 6f SET fail_co
10d0: 75 6e 74 3d 28 53 45 4c 45 43 54 20 63 6f 75 6e unt=(SELECT coun
10e0: 74 28 69 64 29 20 46 52 4f 4d 20 74 65 73 74 73 t(id) FROM tests
10f0: 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 WHERE run_id=?
1100: 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 AND testname=? A
1110: 4e 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d 20 ND item_path !=
1120: 27 27 20 41 4e 44 20 73 74 61 74 75 73 3d 27 46 '' AND status='F
1130: 41 49 4c 27 29 2c 0a 20 20 20 20 20 20 20 20 20 AIL'),.
1140: 20 20 20 20 20 20 20 20 70 61 73 73 5f 63 6f 75 pass_cou
1150: 6e 74 3d 28 53 45 4c 45 43 54 20 63 6f 75 6e 74 nt=(SELECT count
1160: 28 69 64 29 20 46 52 4f 4d 20 74 65 73 74 73 20 (id) FROM tests
1170: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
1180: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
1190: 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d 20 27 D item_path != '
11a0: 27 20 41 4e 44 20 28 73 74 61 74 75 73 3d 27 50 ' AND (status='P
11b0: 41 53 53 27 20 4f 52 20 73 74 61 74 75 73 3d 27 ASS' OR status='
11c0: 57 41 52 4e 27 29 29 0a 20 20 20 20 20 20 20 20 WARN')).
11d0: 20 20 20 20 20 57 48 45 52 45 20 72 75 6e 5f 69 WHERE run_i
11e0: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
11f0: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
1200: 3d 27 27 3b 22 0a 09 20 20 20 72 75 6e 2d 69 64 ='';".. run-id
1210: 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d 69 test-name run-i
1220: 64 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d d test-name run-
1230: 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a 09 20 id test-name)..
1240: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
1250: 65 0a 09 20 20 20 64 62 0a 09 20 20 20 22 55 50 e.. db.. "UP
1260: 44 41 54 45 20 74 65 73 74 73 0a 20 20 20 20 20 DATE tests.
1270: 20 20 20 20 20 20 20 20 53 45 54 20 73 74 61 74 SET stat
1280: 65 3d 43 41 53 45 20 57 48 45 4e 20 28 53 45 4c e=CASE WHEN (SEL
1290: 45 43 54 20 63 6f 75 6e 74 28 69 64 29 20 46 52 ECT count(id) FR
12a0: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 OM tests WHERE r
12b0: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
12c0: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
12d0: 70 61 74 68 20 21 3d 20 27 27 20 41 4e 44 20 73 path != '' AND s
12e0: 74 61 74 65 20 69 6e 20 28 27 52 55 4e 4e 49 4e tate in ('RUNNIN
12f0: 47 27 2c 27 4e 4f 54 5f 53 54 41 52 54 45 44 27 G','NOT_STARTED'
1300: 29 29 20 3e 20 30 20 54 48 45 4e 20 0a 20 20 20 )) > 0 THEN .
1310: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1320: 20 20 20 20 20 20 20 27 52 55 4e 4e 49 4e 47 27 'RUNNING'
1330: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1340: 20 20 20 20 20 20 20 20 45 4c 53 45 20 27 43 4f ELSE 'CO
1350: 4d 50 4c 45 54 45 44 27 20 45 4e 44 2c 0a 20 20 MPLETED' END,.
1360: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 st
1370: 61 74 75 73 3d 43 41 53 45 20 57 48 45 4e 20 66 atus=CASE WHEN f
1380: 61 69 6c 5f 63 6f 75 6e 74 20 3e 20 30 20 54 48 ail_count > 0 TH
1390: 45 4e 20 27 46 41 49 4c 27 20 57 48 45 4e 20 70 EN 'FAIL' WHEN p
13a0: 61 73 73 5f 63 6f 75 6e 74 20 3e 20 30 20 41 4e ass_count > 0 AN
13b0: 44 20 66 61 69 6c 5f 63 6f 75 6e 74 3d 30 20 54 D fail_count=0 T
13c0: 48 45 4e 20 27 50 41 53 53 27 20 45 4c 53 45 20 HEN 'PASS' ELSE
13d0: 27 55 4e 4b 4e 4f 57 4e 27 20 45 4e 44 0a 20 20 'UNKNOWN' END.
13e0: 20 20 20 20 20 20 20 20 20 20 20 57 48 45 52 45 WHERE
13f0: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
1400: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
1410: 6d 5f 70 61 74 68 3d 27 27 3b 22 0a 09 20 20 20 m_path='';"..
1420: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1430: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
1440: 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 61 6e e))). (if (an
1450: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 63 6f d (not (null? co
1460: 6d 6d 65 6e 74 29 29 0a 09 20 20 20 20 20 28 63 mment)).. (c
1470: 61 72 20 63 6f 6d 6d 65 6e 74 29 29 0a 09 28 73 ar comment))..(s
1480: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 qlite3:execute d
1490: 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 b "UPDATE tests
14a0: 53 45 54 20 63 6f 6d 6d 65 6e 74 3d 3f 20 57 48 SET comment=? WH
14b0: 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 ERE run_id=? AND
14c0: 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 testname=? AND
14d0: 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 0a 09 09 item_path=?;"...
14e0: 09 20 28 63 61 72 20 63 6f 6d 6d 65 6e 74 29 20 . (car comment)
14f0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1500: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 0a item-path))))..
1510: 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 73 65 (define (test-se
1520: 74 2d 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 t-log! db run-id
1530: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 test-name itemd
1540: 61 74 20 6c 6f 67 66 29 20 0a 20 20 28 6c 65 74 at logf) . (let
1550: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 ((item-path (it
1560: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
1570: 65 6d 64 61 74 29 29 29 0a 20 20 20 20 28 73 71 emdat))). (sq
1580: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
1590: 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 "UPDATE tests S
15a0: 45 54 20 66 69 6e 61 6c 5f 6c 6f 67 66 3d 3f 20 ET final_logf=?
15b0: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
15c0: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
15d0: 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 20 D item_path=?;"
15e0: 0a 09 09 20 20 20 20 20 6c 6f 67 66 20 72 75 6e ... logf run
15f0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
1600: 65 6d 2d 70 61 74 68 29 29 29 0a 0a 28 64 65 66 em-path)))..(def
1610: 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 74 6f ine (test-set-to
1620: 70 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 20 plog! db run-id
1630: 74 65 73 74 2d 6e 61 6d 65 20 6c 6f 67 66 29 20 test-name logf)
1640: 0a 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 . (sqlite3:exec
1650: 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 ute db "UPDATE t
1660: 65 73 74 73 20 53 45 54 20 66 69 6e 61 6c 5f 6c ests SET final_l
1670: 6f 67 66 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f ogf=? WHERE run_
1680: 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d id=? AND testnam
1690: 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 e=? AND item_pat
16a0: 68 3d 27 27 3b 22 20 0a 09 09 20 20 20 6c 6f 67 h='';" ... log
16b0: 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 f run-id test-na
16c0: 6d 65 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 me))..(define (t
16d0: 65 73 74 73 3a 73 75 6d 6d 61 72 69 7a 65 2d 69 ests:summarize-i
16e0: 74 65 6d 73 20 64 62 20 72 75 6e 2d 69 64 20 74 tems db run-id t
16f0: 65 73 74 2d 6e 61 6d 65 20 66 6f 72 63 65 29 0a est-name force).
1700: 20 20 3b 3b 20 69 66 20 6e 6f 74 20 66 6f 72 63 ;; if not forc
1710: 65 20 74 68 65 6e 20 6f 6e 6c 79 20 75 70 64 61 e then only upda
1720: 74 65 20 74 68 65 20 72 65 63 6f 72 64 20 69 66 te the record if
1730: 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 69 73 one of these is
1740: 20 74 72 75 65 3a 0a 20 20 3b 3b 20 20 20 31 2e true:. ;; 1.
1750: 20 6c 6f 67 66 20 69 73 20 22 6c 6f 67 2f 66 69 logf is "log/fi
1760: 6e 61 6c 2e 6c 6f 67 0a 20 20 3b 3b 20 20 20 32 nal.log. ;; 2
1770: 2e 20 6c 6f 67 66 20 69 73 20 73 61 6d 65 20 61 . logf is same a
1780: 73 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 s outputfilename
1790: 0a 20 20 28 6c 65 74 20 28 28 6f 75 74 70 75 74 . (let ((output
17a0: 66 69 6c 65 6e 61 6d 65 20 28 63 6f 6e 63 20 22 filename (conc "
17b0: 6d 65 67 61 74 65 73 74 2d 72 6f 6c 6c 75 70 2d megatest-rollup-
17c0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2e 68 74 " test-name ".ht
17d0: 6d 6c 22 29 29 0a 09 28 6f 72 69 67 2d 64 69 72 ml"))..(orig-dir
17e0: 20 20 20 20 20 20 20 28 63 75 72 72 65 6e 74 2d (current-
17f0: 64 69 72 65 63 74 6f 72 79 29 29 0a 09 28 6c 6f directory))..(lo
1800: 67 66 20 20 20 20 20 20 20 20 20 20 20 23 66 29 gf #f)
1810: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 ). (sqlite3:f
1820: 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 or-each-row .
1830: 20 20 28 6c 61 6d 62 64 61 20 28 70 61 74 68 20 (lambda (path
1840: 66 69 6e 61 6c 5f 6c 6f 67 66 29 0a 20 20 20 20 final_logf).
1850: 20 20 20 28 73 65 74 21 20 6c 6f 67 66 20 66 69 (set! logf fi
1860: 6e 61 6c 5f 6c 6f 67 66 29 0a 20 20 20 20 20 20 nal_logf).
1870: 20 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f (if (directory?
1880: 20 70 61 74 68 29 0a 09 20 20 20 28 62 65 67 69 path).. (begi
1890: 6e 0a 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 n.. (print "
18a0: 46 6f 75 6e 64 20 70 61 74 68 3a 20 22 20 70 61 Found path: " pa
18b0: 74 68 29 0a 09 20 20 20 20 20 28 63 68 61 6e 67 th).. (chang
18c0: 65 2d 64 69 72 65 63 74 6f 72 79 20 70 61 74 68 e-directory path
18d0: 29 29 0a 09 20 20 20 20 20 3b 3b 20 28 73 65 74 )).. ;; (set
18e0: 21 20 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 ! outputfilename
18f0: 20 28 63 6f 6e 63 20 70 61 74 68 20 22 2f 22 20 (conc path "/"
1900: 6f 75 74 70 75 74 66 69 6c 65 6e 61 6d 65 29 29 outputfilename))
1910: 29 0a 09 20 20 20 28 70 72 69 6e 74 20 22 4e 6f ).. (print "No
1920: 20 73 75 63 68 20 70 61 74 68 3a 20 22 20 70 61 such path: " pa
1930: 74 68 29 29 29 0a 20 20 20 20 20 64 62 20 0a 20 th))). db .
1940: 20 20 20 20 22 53 45 4c 45 43 54 20 72 75 6e 64 "SELECT rund
1950: 69 72 2c 66 69 6e 61 6c 5f 6c 6f 67 66 20 46 52 ir,final_logf FR
1960: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 OM tests WHERE r
1970: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
1980: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
1990: 70 61 74 68 3d 27 27 3b 22 0a 20 20 20 20 20 72 path='';". r
19a0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 un-id test-name)
19b0: 0a 20 20 20 20 28 70 72 69 6e 74 20 22 73 75 6d . (print "sum
19c0: 6d 61 72 69 7a 65 2d 69 74 65 6d 73 20 77 69 74 marize-items wit
19d0: 68 20 6c 6f 67 66 20 22 20 6c 6f 67 66 29 0a 20 h logf " logf).
19e0: 20 20 20 28 69 66 20 28 6f 72 20 28 65 71 75 61 (if (or (equa
19f0: 6c 3f 20 6c 6f 67 66 20 22 6c 6f 67 73 2f 66 69 l? logf "logs/fi
1a00: 6e 61 6c 2e 6c 6f 67 22 29 0a 09 20 20 20 20 28 nal.log").. (
1a10: 65 71 75 61 6c 3f 20 6c 6f 67 66 20 6f 75 74 70 equal? logf outp
1a20: 75 74 66 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 utfilename)..
1a30: 20 66 6f 72 63 65 29 0a 09 28 62 65 67 69 6e 0a force)..(begin.
1a40: 09 20 20 28 69 66 20 28 6f 62 74 61 69 6e 2d 64 . (if (obtain-d
1a50: 6f 74 2d 6c 6f 63 6b 20 6f 75 74 70 75 74 66 69 ot-lock outputfi
1a60: 6c 65 6e 61 6d 65 20 31 20 32 30 20 33 30 29 20 lename 1 20 30)
1a70: 3b 3b 20 72 65 74 72 79 20 65 76 65 72 79 20 73 ;; retry every s
1a80: 65 63 6f 6e 64 20 66 6f 72 20 32 30 20 73 65 63 econd for 20 sec
1a90: 6f 6e 64 73 2c 20 63 61 6c 6c 20 69 74 20 64 65 onds, call it de
1aa0: 61 64 20 61 66 74 65 72 20 33 30 20 73 65 63 6f ad after 30 seco
1ab0: 6e 64 73 20 61 6e 64 20 73 74 65 61 6c 20 74 68 nds and steal th
1ac0: 65 20 6c 6f 63 6b 0a 09 20 20 20 20 20 20 28 70 e lock.. (p
1ad0: 72 69 6e 74 20 22 4f 62 74 61 69 6e 65 64 20 6c rint "Obtained l
1ae0: 6f 63 6b 20 66 6f 72 20 22 20 6f 75 74 70 75 74 ock for " output
1af0: 66 69 6c 65 6e 61 6d 65 29 0a 09 20 20 20 20 20 filename)..
1b00: 20 28 70 72 69 6e 74 20 22 46 61 69 6c 65 64 20 (print "Failed
1b10: 74 6f 20 6f 62 74 61 69 6e 20 6c 6f 63 6b 20 66 to obtain lock f
1b20: 6f 72 20 22 20 6f 75 74 70 75 74 66 69 6c 65 6e or " outputfilen
1b30: 61 6d 65 29 29 0a 09 20 20 28 6c 65 74 20 28 28 ame)).. (let ((
1b40: 6f 75 70 20 20 20 28 6f 70 65 6e 2d 6f 75 74 70 oup (open-outp
1b50: 75 74 2d 66 69 6c 65 20 6f 75 74 70 75 74 66 69 ut-file outputfi
1b60: 6c 65 6e 61 6d 65 29 29 29 0a 09 20 20 20 20 28 lename))).. (
1b70: 77 69 74 68 2d 6f 75 74 70 75 74 2d 74 6f 2d 70 with-output-to-p
1b80: 6f 72 74 0a 09 09 6f 75 70 0a 09 20 20 20 20 20 ort...oup..
1b90: 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 28 70 (lambda ()...(p
1ba0: 72 69 6e 74 20 22 3c 68 74 6d 6c 3e 3c 74 69 74 rint "<html><tit
1bb0: 6c 65 3e 53 75 6d 6d 61 72 79 3a 20 22 20 74 65 le>Summary: " te
1bc0: 73 74 2d 6e 61 6d 65 20 22 3c 2f 74 69 74 6c 65 st-name "</title
1bd0: 3e 3c 62 6f 64 79 3e 3c 68 31 3e 53 75 6d 6d 61 ><body><h1>Summa
1be0: 72 79 20 66 6f 72 20 22 20 74 65 73 74 2d 6e 61 ry for " test-na
1bf0: 6d 65 20 22 3c 74 61 62 6c 65 3e 22 29 0a 09 09 me "<table>")...
1c00: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 (sqlite3:for-eac
1c10: 68 2d 72 6f 77 20 0a 09 09 20 28 6c 61 6d 62 64 h-row ... (lambd
1c20: 61 20 28 69 64 20 69 74 65 6d 70 61 74 68 20 73 a (id itempath s
1c30: 74 61 74 65 20 73 74 61 74 75 73 20 72 75 6e 5f tate status run_
1c40: 64 75 72 61 74 69 6f 6e 20 6c 6f 67 66 20 63 6f duration logf co
1c50: 6d 6d 65 6e 74 29 0a 09 09 20 20 20 28 70 72 69 mment)... (pri
1c60: 6e 74 20 22 3c 74 72 3e 22 0a 09 09 09 20 20 22 nt "<tr>".... "
1c70: 3c 74 64 3e 3c 61 20 68 72 65 66 3d 5c 22 22 20 <td><a href=\""
1c80: 69 74 65 6d 70 61 74 68 20 22 2f 22 20 6c 6f 67 itempath "/" log
1c90: 66 20 22 5c 22 3c 2f 61 3e 22 20 69 74 65 6d 70 f "\"</a>" itemp
1ca0: 61 74 68 20 22 3c 2f 74 64 3e 22 20 0a 09 09 09 ath "</td>" ....
1cb0: 20 20 22 3c 74 64 3e 22 20 73 74 61 74 65 20 20 "<td>" state
1cc0: 20 20 22 3c 2f 74 64 3e 22 20 0a 09 09 09 20 20 "</td>" ....
1cd0: 22 3c 74 64 3e 3c 66 6f 6e 74 20 63 6f 6c 6f 72 "<td><font color
1ce0: 3d 22 20 28 63 6f 6e 64 0a 09 09 09 09 09 20 20 =" (cond......
1cf0: 20 20 20 20 28 28 65 71 75 61 6c 3f 20 73 74 61 ((equal? sta
1d00: 74 75 73 20 22 50 41 53 53 22 29 20 22 67 72 65 tus "PASS") "gre
1d10: 65 6e 22 29 0a 09 09 09 09 09 20 20 20 20 20 20 en")......
1d20: 28 28 65 71 75 61 6c 3f 20 73 74 61 74 75 73 20 ((equal? status
1d30: 22 46 41 49 4c 22 29 20 22 72 65 64 22 29 0a 09 "FAIL") "red")..
1d40: 09 09 09 09 20 20 20 20 20 20 28 65 6c 73 65 20 .... (else
1d50: 22 62 6c 75 65 22 29 29 20 22 3e 22 20 20 20 73 "blue")) ">" s
1d60: 74 61 74 75 73 20 20 20 22 3c 2f 66 6f 6e 74 3e tatus "</font>
1d70: 3c 2f 74 64 3e 22 0a 09 09 09 09 09 20 20 20 20 </td>"......
1d80: 20 20 22 3c 74 64 3e 22 20 63 6f 6d 6d 65 6e 74 "<td>" comment
1d90: 20 20 22 3c 2f 74 64 3e 22 0a 09 09 09 09 09 20 "</td>"......
1da0: 20 20 20 20 20 22 3c 2f 74 72 3e 22 29 29 0a 09 "</tr>"))..
1db0: 09 20 64 62 0a 09 09 20 22 53 45 4c 45 43 54 20 . db... "SELECT
1dc0: 69 64 2c 69 74 65 6d 5f 70 61 74 68 2c 73 74 61 id,item_path,sta
1dd0: 74 65 2c 73 74 61 74 75 73 2c 72 75 6e 5f 64 75 te,status,run_du
1de0: 72 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 ration,final_log
1df0: 66 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 f,comment FROM t
1e00: 65 73 74 73 20 57 48 45 52 45 20 72 75 6e 5f 69 ests WHERE run_i
1e10: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
1e20: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
1e30: 20 21 3d 20 27 27 3b 22 0a 09 09 20 72 75 6e 2d != '';"... run-
1e40: 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a 09 09 id test-name)...
1e50: 28 70 72 69 6e 74 20 22 3c 2f 62 6f 64 79 3e 3c (print "</body><
1e60: 2f 68 74 6d 6c 3e 22 29 0a 09 09 28 72 65 6c 65 /html>")...(rele
1e70: 61 73 65 2d 64 6f 74 2d 6c 6f 63 6b 20 6f 75 74 ase-dot-lock out
1e80: 70 75 74 66 69 6c 65 6e 61 6d 65 29 29 29 0a 09 putfilename)))..
1e90: 20 20 20 20 28 63 6c 6f 73 65 2d 6f 75 74 70 75 (close-outpu
1ea0: 74 2d 70 6f 72 74 20 6f 75 70 29 0a 09 20 20 20 t-port oup)..
1eb0: 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f (change-directo
1ec0: 72 79 20 6f 72 69 67 2d 64 69 72 29 0a 09 20 20 ry orig-dir)..
1ed0: 20 20 28 74 65 73 74 2d 73 65 74 2d 74 6f 70 6c (test-set-topl
1ee0: 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 og! db run-id te
1ef0: 73 74 2d 6e 61 6d 65 20 6f 75 74 70 75 74 66 69 st-name outputfi
1f00: 6c 65 6e 61 6d 65 29 0a 09 20 20 20 20 29 29 29 lename).. )))
1f10: 29 29 0a 0a 3b 3b 20 3b 3b 20 54 4f 44 4f 3a 20 ))..;; ;; TODO:
1f20: 43 6f 6e 76 65 72 67 65 20 74 68 69 73 20 77 69 Converge this wi
1f30: 74 68 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 th db:get-test-i
1f40: 6e 66 6f 0a 3b 3b 20 28 64 65 66 69 6e 65 20 28 nfo.;; (define (
1f50: 72 75 6e 73 3a 67 65 74 2d 74 65 73 74 2d 69 6e runs:get-test-in
1f60: 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 fo db run-id tes
1f70: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
1f80: 29 0a 3b 3b 20 20 20 28 6c 65 74 20 28 28 72 65 ).;; (let ((re
1f90: 73 20 23 66 29 29 20 3b 3b 20 28 76 65 63 74 6f s #f)) ;; (vecto
1fa0: 72 20 23 66 20 23 66 20 23 66 20 23 66 20 23 66 r #f #f #f #f #f
1fb0: 20 23 66 29 29 29 0a 3b 3b 20 20 20 20 20 28 73 #f))).;; (s
1fc0: 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d qlite3:for-each-
1fd0: 72 6f 77 20 0a 3b 3b 20 20 20 20 20 20 28 6c 61 row .;; (la
1fe0: 6d 62 64 61 20 28 69 64 20 72 75 6e 2d 69 64 20 mbda (id run-id
1ff0: 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 test-name state
2000: 73 74 61 74 75 73 29 0a 3b 3b 20 20 20 20 20 20 status).;;
2010: 20 20 28 73 65 74 21 20 72 65 73 20 28 76 65 63 (set! res (vec
2020: 74 6f 72 20 69 64 20 72 75 6e 2d 69 64 20 74 65 tor id run-id te
2030: 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 74 st-name state st
2040: 61 74 75 73 20 69 74 65 6d 2d 70 61 74 68 29 29 atus item-path))
2050: 29 0a 3b 3b 20 20 20 20 20 20 64 62 20 22 53 45 ).;; db "SE
2060: 4c 45 43 54 20 69 64 2c 72 75 6e 5f 69 64 2c 74 LECT id,run_id,t
2070: 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 estname,state,st
2080: 61 74 75 73 20 46 52 4f 4d 20 74 65 73 74 73 20 atus FROM tests
2090: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
20a0: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
20b0: 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 0a D item_path=?;".
20c0: 3b 3b 20 20 20 20 20 20 72 75 6e 2d 69 64 20 74 ;; run-id t
20d0: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
20e0: 74 68 29 0a 3b 3b 20 20 20 20 20 72 65 73 29 29 th).;; res))
20f0: 0a 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 ..(define-inline
2100: 20 28 74 65 73 74 3a 67 65 74 2d 69 64 20 76 65 (test:get-id ve
2110: 63 29 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 c) (vector
2120: 2d 72 65 66 20 76 65 63 20 30 29 29 0a 28 64 65 -ref vec 0)).(de
2130: 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 fine-inline (tes
2140: 74 3a 67 65 74 2d 72 75 6e 5f 69 64 20 76 65 63 t:get-run_id vec
2150: 29 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 ) (vector-ref
2160: 76 65 63 20 31 29 29 0a 28 64 65 66 69 6e 65 2d vec 1)).(define-
2170: 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 inline (test:get
2180: 2d 74 65 73 74 2d 6e 61 6d 65 20 76 65 63 29 28 -test-name vec)(
2190: 76 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 32 vector-ref vec 2
21a0: 29 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e )).(define-inlin
21b0: 65 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 e (test:get-stat
21c0: 65 20 76 65 63 29 20 20 20 20 28 76 65 63 74 6f e vec) (vecto
21d0: 72 2d 72 65 66 20 76 65 63 20 33 29 29 0a 28 64 r-ref vec 3)).(d
21e0: 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 efine-inline (te
21f0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 76 65 st:get-status ve
2200: 63 29 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 c) (vector-ref
2210: 20 76 65 63 20 34 29 29 0a 28 64 65 66 69 6e 65 vec 4)).(define
2220: 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 -inline (test:ge
2230: 74 2d 69 74 65 6d 2d 70 61 74 68 20 76 65 63 29 t-item-path vec)
2240: 28 76 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 (vector-ref vec
2250: 35 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 5))..(define (ru
2260: 6e 73 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c ns:test-get-full
2270: 2d 70 61 74 68 20 74 65 73 74 29 0a 20 20 28 6c -path test). (l
2280: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 28 et* ((testname (
2290: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
22a0: 6e 61 6d 65 20 20 20 74 65 73 74 29 29 0a 09 20 name test))..
22b0: 28 69 74 65 6d 70 61 74 68 20 28 64 62 3a 74 65 (itempath (db:te
22c0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
22d0: 20 74 65 73 74 29 29 29 0a 20 20 20 20 28 63 6f test))). (co
22e0: 6e 63 20 74 65 73 74 6e 61 6d 65 20 28 69 66 20 nc testname (if
22f0: 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 (equal? itempath
2300: 20 22 22 29 20 22 22 20 28 63 6f 6e 63 20 22 28 "") "" (conc "(
2310: 22 20 69 74 65 6d 70 61 74 68 20 22 29 22 29 29 " itempath ")"))
2320: 29 29 29 0a 0a 28 64 65 66 69 6e 65 2d 69 6e 6c )))..(define-inl
2330: 69 6e 65 20 28 74 65 73 74 3a 74 65 73 74 2d 67 ine (test:test-g
2340: 65 74 2d 66 75 6c 6c 6e 61 6d 65 20 74 65 73 74 et-fullname test
2350: 29 0a 20 20 20 28 63 6f 6e 63 20 28 64 62 3a 74 ). (conc (db:t
2360: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
2370: 20 74 65 73 74 29 0a 09 20 28 69 66 20 28 65 71 test).. (if (eq
2380: 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 ual? (db:test-ge
2390: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 t-item-path test
23a0: 29 20 22 22 29 0a 09 20 20 20 20 20 22 22 0a 09 ) "").. ""..
23b0: 20 20 20 20 20 28 63 6f 6e 63 20 22 28 22 20 28 (conc "(" (
23c0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
23d0: 2d 70 61 74 68 20 74 65 73 74 29 20 22 29 22 29 -path test) ")")
23e0: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 63 68 )))..(define (ch
23f0: 65 63 6b 2d 76 61 6c 69 64 2d 69 74 65 6d 73 20 eck-valid-items
2400: 63 6c 61 73 73 20 69 74 65 6d 29 0a 20 20 28 6c class item). (l
2410: 65 74 20 28 28 76 61 6c 69 64 2d 76 61 6c 75 65 et ((valid-value
2420: 73 20 28 6c 65 74 20 28 28 73 20 28 63 6f 6e 66 s (let ((s (conf
2430: 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 ig-lookup *confi
2440: 67 64 61 74 2a 20 22 76 61 6c 69 64 76 61 6c 75 gdat* "validvalu
2450: 65 73 22 20 63 6c 61 73 73 29 29 29 0a 09 09 09 es" class)))....
2460: 28 69 66 20 73 20 28 73 74 72 69 6e 67 2d 73 70 (if s (string-sp
2470: 6c 69 74 20 73 29 20 23 66 29 29 29 29 0a 20 20 lit s) #f)))).
2480: 20 20 28 69 66 20 76 61 6c 69 64 2d 76 61 6c 75 (if valid-valu
2490: 65 73 0a 09 28 69 66 20 28 6d 65 6d 62 65 72 20 es..(if (member
24a0: 69 74 65 6d 20 76 61 6c 69 64 2d 76 61 6c 75 65 item valid-value
24b0: 73 29 0a 09 20 20 20 20 69 74 65 6d 20 23 66 29 s).. item #f)
24c0: 0a 09 69 74 65 6d 29 29 29 0a 0a 28 64 65 66 69 ..item)))..(defi
24d0: 6e 65 20 28 74 65 73 74 73 74 65 70 2d 73 65 74 ne (teststep-set
24e0: 2d 73 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d -status! db run-
24f0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 id test-name tes
2500: 74 73 74 65 70 2d 6e 61 6d 65 20 73 74 61 74 65 tstep-name state
2510: 2d 69 6e 20 73 74 61 74 75 73 2d 69 6e 20 69 74 -in status-in it
2520: 65 6d 64 61 74 20 63 6f 6d 6d 65 6e 74 29 0a 20 emdat comment).
2530: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
2540: 22 72 75 6e 2d 69 64 3a 20 22 20 72 75 6e 2d 69 "run-id: " run-i
2550: 64 20 22 20 74 65 73 74 2d 6e 61 6d 65 3a 20 22 d " test-name: "
2560: 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c test-name). (l
2570: 65 74 2a 20 28 28 73 74 61 74 65 20 20 20 20 20 et* ((state
2580: 28 63 68 65 63 6b 2d 76 61 6c 69 64 2d 69 74 65 (check-valid-ite
2590: 6d 73 20 22 73 74 61 74 65 22 20 73 74 61 74 65 ms "state" state
25a0: 2d 69 6e 29 29 0a 09 20 28 73 74 61 74 75 73 20 -in)).. (status
25b0: 20 20 20 28 63 68 65 63 6b 2d 76 61 6c 69 64 2d (check-valid-
25c0: 69 74 65 6d 73 20 22 73 74 61 74 75 73 22 20 73 items "status" s
25d0: 74 61 74 75 73 2d 69 6e 29 29 0a 09 20 28 69 74 tatus-in)).. (it
25e0: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 em-path (item-li
25f0: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 st->path itemdat
2600: 29 29 0a 09 20 28 74 65 73 74 64 61 74 20 20 20 )).. (testdat
2610: 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 (db:get-test-inf
2620: 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 o db run-id test
2630: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
2640: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
2650: 69 6e 74 20 35 20 22 74 65 73 74 64 61 74 3a 20 int 5 "testdat:
2660: 22 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 28 " testdat). (
2670: 69 66 20 28 61 6e 64 20 74 65 73 74 64 61 74 20 if (and testdat
2680: 3b 3b 20 69 66 20 74 68 65 20 73 65 63 74 69 6f ;; if the sectio
2690: 6e 20 65 78 69 73 74 73 20 74 68 65 6e 20 66 6f n exists then fo
26a0: 72 63 65 20 73 70 65 63 69 66 69 63 61 74 69 6f rce specificatio
26b0: 6e 20 42 55 47 2c 20 49 20 64 6f 6e 27 74 20 6c n BUG, I don't l
26c0: 69 6b 65 20 68 6f 77 20 74 68 69 73 20 77 6f 72 ike how this wor
26d0: 6b 73 2e 0a 09 20 20 20 20 20 28 6f 72 20 28 6e ks... (or (n
26e0: 6f 74 20 73 74 61 74 65 29 28 6e 6f 74 20 73 74 ot state)(not st
26f0: 61 74 75 73 29 29 29 0a 09 28 64 65 62 75 67 3a atus)))..(debug:
2700: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 print 0 "WARNING
2710: 3a 20 49 6e 76 61 6c 69 64 20 22 20 28 69 66 20 : Invalid " (if
2720: 73 74 61 74 75 73 20 22 73 74 61 74 75 73 22 20 status "status"
2730: 22 73 74 61 74 65 22 29 0a 09 20 20 20 20 20 20 "state")..
2740: 20 22 20 76 61 6c 75 65 20 5c 22 22 20 28 69 66 " value \"" (if
2750: 20 73 74 61 74 75 73 20 73 74 61 74 75 73 2d 69 status status-i
2760: 6e 20 73 74 61 74 65 2d 69 6e 29 20 22 5c 22 2c n state-in) "\",
2770: 20 75 70 64 61 74 65 20 79 6f 75 72 20 76 61 6c update your val
2780: 69 64 73 74 61 74 65 73 20 73 65 63 74 69 6f 6e idstates section
2790: 20 69 6e 20 6d 65 67 61 74 65 73 74 2e 63 6f 6e in megatest.con
27a0: 66 69 67 22 29 29 0a 20 20 20 20 28 69 66 20 74 fig")). (if t
27b0: 65 73 74 64 61 74 0a 09 28 6c 65 74 20 28 28 74 estdat..(let ((t
27c0: 65 73 74 2d 69 64 20 28 74 65 73 74 3a 67 65 74 est-id (test:get
27d0: 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 -id testdat)))..
27e0: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 (sqlite3:execu
27f0: 74 65 20 64 62 20 0a 09 09 09 22 49 4e 53 45 52 te db ...."INSER
2800: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 69 6e 74 T OR REPLACE int
2810: 6f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 o test_steps (te
2820: 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 st_id,stepname,s
2830: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e tate,status,even
2840: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 t_time,comment)
2850: 56 41 4c 55 45 53 28 3f 2c 3f 2c 3f 2c 3f 2c 73 VALUES(?,?,?,?,s
2860: 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f trftime('%s','no
2870: 77 27 29 2c 3f 29 3b 22 0a 09 09 09 74 65 73 74 w'),?);"....test
2880: 2d 69 64 20 74 65 73 74 73 74 65 70 2d 6e 61 6d -id teststep-nam
2890: 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 28 e state status (
28a0: 69 66 20 63 6f 6d 6d 65 6e 74 20 63 6f 6d 6d 65 if comment comme
28b0: 6e 74 20 22 22 29 29 29 0a 09 28 64 65 62 75 67 nt "")))..(debug
28c0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
28d0: 20 43 61 6e 27 74 20 75 70 64 61 74 65 20 22 20 Can't update "
28e0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 66 6f 72 20 test-name " for
28f0: 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 20 2d run " run-id " -
2900: 3e 20 6e 6f 20 73 75 63 68 20 74 65 73 74 20 69 > no such test i
2910: 6e 20 64 62 22 29 29 29 29 0a 0a 28 64 65 66 69 n db"))))..(defi
2920: 6e 65 20 28 74 65 73 74 2d 67 65 74 2d 6b 69 6c ne (test-get-kil
2930: 6c 2d 72 65 71 75 65 73 74 20 64 62 20 72 75 6e l-request db run
2940: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
2950: 65 6d 64 61 74 29 0a 20 20 28 6c 65 74 2a 20 28 emdat). (let* (
2960: 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d (item-path (item
2970: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d -list->path item
2980: 64 61 74 29 29 0a 09 20 28 74 65 73 74 64 61 74 dat)).. (testdat
2990: 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d (db:get-test-
29a0: 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 info db run-id t
29b0: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
29c0: 74 68 29 29 29 0a 20 20 20 20 28 65 71 75 61 6c th))). (equal
29d0: 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 ? (test:get-stat
29e0: 65 20 74 65 73 74 64 61 74 29 20 22 4b 49 4c 4c e testdat) "KILL
29f0: 52 45 51 22 29 29 29 0a 0a 28 64 65 66 69 6e 65 REQ")))..(define
2a00: 20 28 74 65 73 74 2d 73 65 74 2d 6d 65 74 61 2d (test-set-meta-
2a10: 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 info db run-id t
2a20: 65 73 74 6e 61 6d 65 20 69 74 65 6d 64 61 74 29 estname itemdat)
2a30: 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d 2d 70 . (let ((item-p
2a40: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
2a50: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 path itemdat))..
2a60: 28 63 70 75 6c 6f 61 64 20 20 28 67 65 74 2d 63 (cpuload (get-c
2a70: 70 75 2d 6c 6f 61 64 29 29 0a 09 28 68 6f 73 74 pu-load))..(host
2a80: 6e 61 6d 65 20 28 67 65 74 2d 68 6f 73 74 2d 6e name (get-host-n
2a90: 61 6d 65 29 29 0a 09 28 64 69 73 6b 66 72 65 65 ame))..(diskfree
2aa0: 20 28 67 65 74 2d 64 66 20 28 63 75 72 72 65 6e (get-df (curren
2ab0: 74 2d 64 69 72 65 63 74 6f 72 79 29 29 29 0a 09 t-directory)))..
2ac0: 28 75 6e 61 6d 65 20 20 20 20 28 67 65 74 2d 75 (uname (get-u
2ad0: 6e 61 6d 65 20 22 2d 73 72 76 70 69 6f 22 29 29 name "-srvpio"))
2ae0: 0a 09 28 72 75 6e 70 61 74 68 20 20 28 63 75 72 ..(runpath (cur
2af0: 72 65 6e 74 2d 64 69 72 65 63 74 6f 72 79 29 29 rent-directory))
2b00: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 ). (sqlite3:e
2b10: 78 65 63 75 74 65 20 64 62 20 22 55 50 44 41 54 xecute db "UPDAT
2b20: 45 20 74 65 73 74 73 20 53 45 54 20 68 6f 73 74 E tests SET host
2b30: 3d 3f 2c 63 70 75 6c 6f 61 64 3d 3f 2c 64 69 73 =?,cpuload=?,dis
2b40: 6b 66 72 65 65 3d 3f 2c 75 6e 61 6d 65 3d 3f 2c kfree=?,uname=?,
2b50: 72 75 6e 64 69 72 3d 3f 20 57 48 45 52 45 20 72 rundir=? WHERE r
2b60: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
2b70: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
2b80: 70 61 74 68 3d 3f 3b 22 0a 09 09 20 20 68 6f 73 path=?;"... hos
2b90: 74 6e 61 6d 65 0a 09 09 20 20 63 70 75 6c 6f 61 tname... cpuloa
2ba0: 64 0a 09 09 20 20 64 69 73 6b 66 72 65 65 0a 09 d... diskfree..
2bb0: 09 20 20 75 6e 61 6d 65 0a 09 09 20 20 72 75 6e . uname... run
2bc0: 70 61 74 68 0a 09 09 20 20 72 75 6e 2d 69 64 0a path... run-id.
2bd0: 09 09 20 20 74 65 73 74 6e 61 6d 65 0a 09 09 20 .. testname...
2be0: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 0a 28 item-path)))..(
2bf0: 64 65 66 69 6e 65 20 28 74 65 73 74 2d 75 70 64 define (test-upd
2c00: 61 74 65 2d 6d 65 74 61 2d 69 6e 66 6f 20 64 62 ate-meta-info db
2c10: 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 run-id testname
2c20: 20 69 74 65 6d 64 61 74 20 6d 69 6e 75 74 65 73 itemdat minutes
2c30: 29 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d 2d ). (let ((item-
2c40: 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d path (item-list-
2c50: 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a >path itemdat)).
2c60: 09 28 63 70 75 6c 6f 61 64 20 20 28 67 65 74 2d .(cpuload (get-
2c70: 63 70 75 2d 6c 6f 61 64 29 29 0a 09 28 64 69 73 cpu-load))..(dis
2c80: 6b 66 72 65 65 20 28 67 65 74 2d 64 66 20 28 63 kfree (get-df (c
2c90: 75 72 72 65 6e 74 2d 64 69 72 65 63 74 6f 72 79 urrent-directory
2ca0: 29 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f )))). (if (no
2cb0: 74 20 63 70 75 6c 6f 61 64 29 20 20 28 62 65 67 t cpuload) (beg
2cc0: 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 in (debug:print
2cd0: 30 20 22 57 41 52 4e 49 4e 47 3a 20 43 50 55 4c 0 "WARNING: CPUL
2ce0: 4f 41 44 20 6e 6f 74 20 66 6f 75 6e 64 2e 22 29 OAD not found.")
2cf0: 20 20 28 73 65 74 21 20 63 70 75 6c 6f 61 64 20 (set! cpuload
2d00: 22 6e 2f 61 22 29 29 29 0a 20 20 20 20 28 69 66 "n/a"))). (if
2d10: 20 28 6e 6f 74 20 64 69 73 6b 66 72 65 65 29 20 (not diskfree)
2d20: 28 62 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 (begin (debug:pr
2d30: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
2d40: 44 49 53 4b 46 52 45 45 20 6e 6f 74 20 66 6f 75 DISKFREE not fou
2d50: 6e 64 2e 22 29 20 28 73 65 74 21 20 64 69 73 6b nd.") (set! disk
2d60: 66 72 65 65 20 22 6e 2f 61 22 29 29 29 0a 20 20 free "n/a"))).
2d70: 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 2d (if (not item-
2d80: 70 61 74 68 29 28 62 65 67 69 6e 20 28 64 65 62 path)(begin (deb
2d90: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
2da0: 49 4e 47 3a 20 49 54 45 4d 50 41 54 48 20 6e 6f ING: ITEMPATH no
2db0: 74 20 73 65 74 2e 22 29 20 20 20 28 73 65 74 21 t set.") (set!
2dc0: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 item-path "")))
2dd0: 0a 20 20 20 20 3b 3b 20 28 6c 65 74 20 28 28 74 . ;; (let ((t
2de0: 65 73 74 69 6e 66 6f 20 28 64 62 3a 67 65 74 2d estinfo (db:get-
2df0: 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e test-info db run
2e00: 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 -id testname ite
2e10: 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 3b 3b m-path))). ;;
2e20: 20 20 20 28 69 66 20 28 61 6e 64 20 28 6e 6f 74 (if (and (not
2e30: 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 (equal? (db:tes
2e40: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t-get-status tes
2e50: 74 69 6e 66 6f 29 20 22 43 4f 4d 50 4c 45 54 45 tinfo) "COMPLETE
2e60: 44 22 29 29 0a 20 20 20 20 3b 3b 20 20 20 20 20 D")). ;;
2e70: 20 20 20 20 20 20 20 28 6e 6f 74 20 28 65 71 75 (not (equ
2e80: 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 al? (db:test-get
2e90: 2d 73 74 61 74 75 73 20 74 65 73 74 69 6e 66 6f -status testinfo
2ea0: 29 20 22 4b 49 4c 4c 52 45 51 22 29 29 0a 20 20 ) "KILLREQ")).
2eb0: 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 (sqlite3:execu
2ec0: 74 65 0a 20 20 20 20 20 64 62 0a 20 20 20 20 20 te. db.
2ed0: 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 45 "UPDATE tests SE
2ee0: 54 20 63 70 75 6c 6f 61 64 3d 3f 2c 64 69 73 6b T cpuload=?,disk
2ef0: 66 72 65 65 3d 3f 2c 72 75 6e 5f 64 75 72 61 74 free=?,run_durat
2f00: 69 6f 6e 3d 3f 2c 73 74 61 74 65 3d 27 52 55 4e ion=?,state='RUN
2f10: 4e 49 4e 47 27 20 57 48 45 52 45 20 72 75 6e 5f NING' WHERE run_
2f20: 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d id=? AND testnam
2f30: 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 e=? AND item_pat
2f40: 68 3d 3f 20 41 4e 44 20 73 74 61 74 65 20 4e 4f h=? AND state NO
2f50: 54 20 49 4e 20 28 27 43 4f 4d 50 4c 45 54 45 44 T IN ('COMPLETED
2f60: 27 2c 27 4b 49 4c 4c 52 45 51 27 2c 27 4b 49 4c ','KILLREQ','KIL
2f70: 4c 45 44 27 29 3b 22 0a 20 20 20 20 20 63 70 75 LED');". cpu
2f80: 6c 6f 61 64 0a 20 20 20 20 20 64 69 73 6b 66 72 load. diskfr
2f90: 65 65 0a 20 20 20 20 20 6d 69 6e 75 74 65 73 0a ee. minutes.
2fa0: 20 20 20 20 20 72 75 6e 2d 69 64 0a 20 20 20 20 run-id.
2fb0: 20 74 65 73 74 6e 61 6d 65 0a 20 20 20 20 20 69 testname. i
2fc0: 74 65 6d 2d 70 61 74 68 29 29 29 0a 0a 28 64 65 tem-path)))..(de
2fd0: 66 69 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 fine (set-megate
2fe0: 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 st-env-vars db r
2ff0: 75 6e 2d 69 64 29 0a 20 20 28 6c 65 74 20 28 28 un-id). (let ((
3000: 6b 65 79 73 20 28 64 62 2d 67 65 74 2d 6b 65 79 keys (db-get-key
3010: 73 20 64 62 29 29 29 0a 20 20 20 20 28 66 6f 72 s db))). (for
3020: 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b -each (lambda (k
3030: 65 79 29 0a 09 09 28 73 71 6c 69 74 65 33 3a 66 ey)...(sqlite3:f
3040: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 28 or-each-row... (
3050: 6c 61 6d 62 64 61 20 28 76 61 6c 29 0a 09 09 20 lambda (val)...
3060: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
3070: 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65 79 3a "setenv " (key:
3080: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
3090: 79 29 20 22 20 22 20 76 61 6c 29 0a 09 09 20 20 y) " " val)...
30a0: 20 28 73 65 74 65 6e 76 20 28 6b 65 79 3a 67 65 (setenv (key:ge
30b0: 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 t-fieldname key)
30c0: 20 76 61 6c 29 29 0a 09 09 20 64 62 20 0a 09 09 val))... db ...
30d0: 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 (conc "SELECT "
30e0: 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e (key:get-fieldn
30f0: 61 6d 65 20 6b 65 79 29 20 22 20 46 52 4f 4d 20 ame key) " FROM
3100: 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f 3b runs WHERE id=?;
3110: 22 29 0a 09 09 20 72 75 6e 2d 69 64 29 29 0a 09 ")... run-id))..
3120: 20 20 20 20 20 20 6b 65 79 73 29 29 29 0a 0a 28 keys)))..(
3130: 64 65 66 69 6e 65 20 28 73 65 74 2d 69 74 65 6d define (set-item
3140: 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 6d 64 61 -env-vars itemda
3150: 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 68 20 28 t). (for-each (
3160: 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 0a 09 20 lambda (item)..
3170: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
3180: 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 28 63 t 2 "setenv " (c
3190: 61 72 20 69 74 65 6d 29 20 22 20 22 20 28 63 61 ar item) " " (ca
31a0: 64 72 20 69 74 65 6d 29 29 0a 09 20 20 20 20 20 dr item))..
31b0: 20 28 73 65 74 65 6e 76 20 28 63 61 72 20 69 74 (setenv (car it
31c0: 65 6d 29 20 28 63 61 64 72 20 69 74 65 6d 29 29 em) (cadr item))
31d0: 29 0a 09 20 20 20 20 69 74 65 6d 64 61 74 29 29 ).. itemdat))
31e0: 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d 61 ..(define (get-a
31f0: 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 0a ll-legal-tests).
3200: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 73 20 (let* ((tests
3210: 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74 6f (glob (conc *to
3220: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 2a ppath* "/tests/*
3230: 22 29 29 29 0a 09 20 28 72 65 73 20 20 20 20 27 "))).. (res '
3240: 28 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a ())). (debug:
3250: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 4c print 4 "INFO: L
3260: 6f 6f 6b 69 6e 67 20 61 74 20 74 65 73 74 73 20 ooking at tests
3270: 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 " (string-inters
3280: 70 65 72 73 65 20 74 65 73 74 73 20 22 2c 22 29 perse tests ",")
3290: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 ). (for-each
32a0: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 61 74 (lambda (testpat
32b0: 68 29 0a 09 09 28 69 66 20 28 66 69 6c 65 2d 65 h)...(if (file-e
32c0: 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65 73 xists? (conc tes
32d0: 74 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 tpath "/testconf
32e0: 69 67 22 29 29 0a 09 09 20 20 20 20 28 73 65 74 ig"))... (set
32f0: 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c 61 73 ! res (cons (las
3300: 74 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 t (string-split
3310: 74 65 73 74 70 61 74 68 20 22 2f 22 29 29 20 72 testpath "/")) r
3320: 65 73 29 29 29 29 0a 09 20 20 20 20 20 20 74 65 es)))).. te
3330: 73 74 73 29 0a 20 20 20 20 72 65 73 29 29 0a 0a sts). res))..
3340: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 (define (runs:ca
3350: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
3360: 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 6e 75 db). (let ((nu
3370: 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 62 3a 67 65 m-running (db:ge
3380: 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 t-count-tests-ru
3390: 6e 6e 69 6e 67 20 64 62 29 29 0a 09 28 6d 61 78 nning db))..(max
33a0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
33b0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
33c0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 65 74 *configdat* "set
33d0: 75 70 22 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 up" "max_concurr
33e0: 65 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 20 20 20 ent_jobs"))).
33f0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
3400: 22 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d "max-concurrent-
3410: 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 jobs: " max-conc
3420: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e urrent-jobs ", n
3430: 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 um-running: " nu
3440: 6d 2d 72 75 6e 6e 69 6e 67 29 0a 20 20 20 20 28 m-running). (
3450: 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a if (not (eq? 0 *
3460: 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 globalexitstatus
3470: 2a 29 29 0a 09 23 66 0a 09 28 69 66 20 28 6f 72 *))..#f..(if (or
3480: 20 28 6e 6f 74 20 6d 61 78 2d 63 6f 6e 63 75 72 (not max-concur
3490: 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 28 61 6e rent-jobs)...(an
34a0: 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 d max-concurrent
34b0: 2d 6a 6f 62 73 0a 09 09 20 20 20 20 20 28 73 74 -jobs... (st
34c0: 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 ring->number max
34d0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
34e0: 29 0a 09 09 20 20 20 20 20 28 6e 6f 74 20 28 3e )... (not (>
34f0: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 = num-running (s
3500: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 tring->number ma
3510: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
3520: 73 29 29 29 29 29 0a 09 20 20 20 20 23 74 0a 09 s))))).. #t..
3530: 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 (begin ..
3540: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
3550: 30 20 22 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 0 "WARNING: Max
3560: 72 75 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 running jobs exc
3570: 65 65 64 65 64 2c 20 63 75 72 72 65 6e 74 20 6e eeded, current n
3580: 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 umber running: "
3590: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 num-running ...
35a0: 09 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 . ", max_concu
35b0: 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 rrent_jobs: " ma
35c0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
35d0: 73 29 0a 09 20 20 20 20 20 20 23 66 29 29 29 29 s).. #f))))
35e0: 29 0a 20 20 0a 28 64 65 66 69 6e 65 20 28 72 75 ). .(define (ru
35f0: 6e 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d n-tests db test-
3600: 6e 61 6d 65 73 29 0a 20 20 28 6c 65 74 2a 20 28 names). (let* (
3610: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 62 (keys (db
3620: 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 -get-keys db))..
3630: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b (keyvallst (k
3640: 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 eys->vallist key
3650: 73 20 23 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 s #t)).. (run-id
3660: 20 20 20 20 20 20 28 72 65 67 69 73 74 65 72 2d (register-
3670: 72 75 6e 20 64 62 20 6b 65 79 73 29 29 29 20 3b run db keys))) ;
3680: 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a ; test-name))).
3690: 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 66 69 ;; on the fi
36a0: 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 6c 6c rst pass or call
36b0: 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 73 65 to run-tests se
36c0: 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 t FAILS to NOT_S
36d0: 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 3b 3b TARTED if. ;;
36e0: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 73 -keepgoing is s
36f0: 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 69 66 pecified. (if
3700: 20 28 61 6e 64 20 28 65 71 3f 20 2a 70 61 73 73 (and (eq? *pass
3710: 6e 75 6d 2a 20 30 29 0a 09 20 20 20 20 20 28 61 num* 0).. (a
3720: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6b 65 rgs:get-arg "-ke
3730: 65 70 67 6f 69 6e 67 22 29 29 0a 09 28 62 65 67 epgoing"))..(beg
3740: 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 74 6f in.. ;; have to
3750: 20 64 65 6c 65 74 65 20 74 65 73 74 20 72 65 63 delete test rec
3760: 6f 72 64 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 ords where NOT_S
3770: 54 41 52 54 45 44 20 73 69 6e 63 65 20 74 68 65 TARTED since the
3780: 79 20 63 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 y can cause -kee
3790: 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b pgoing to .. ;;
37a0: 20 67 65 74 20 73 74 75 63 6b 20 64 75 65 20 74 get stuck due t
37b0: 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 o becoming inacc
37c0: 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 essible from a f
37d0: 61 69 6c 65 64 20 74 65 73 74 2e 20 49 2e 65 2e ailed test. I.e.
37e0: 20 69 66 20 74 65 73 74 20 42 20 64 65 70 65 6e if test B depen
37f0: 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 ds .. ;; on tes
3800: 74 20 41 20 62 75 74 20 74 65 73 74 20 42 20 72 t A but test B r
3810: 65 61 63 68 65 64 20 74 68 65 20 70 6f 69 6e 74 eached the point
3820: 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 73 74 on being regist
3830: 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 ered as NOT_STAR
3840: 54 45 44 20 61 6e 64 20 74 65 73 74 0a 09 20 20 TED and test..
3850: 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 6f 72 20 ;; A failed for
3860: 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 65 6e some reason then
3870: 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 on re-run using
3880: 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 65 20 -keepgoing the
3890: 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 63 6f run can never co
38a0: 6d 70 6c 65 74 65 2e 0a 09 20 20 28 64 62 3a 64 mplete... (db:d
38b0: 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73 elete-tests-in-s
38c0: 74 61 74 65 20 64 62 20 72 75 6e 2d 69 64 20 22 tate db run-id "
38d0: 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a 09 20 NOT_STARTED")..
38e0: 20 28 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 (db:set-tests-s
38f0: 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 20 72 tate-status db r
3900: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 un-id test-names
3910: 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f #f "FAIL" "NOT_
3920: 53 54 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 STARTED" "FAIL")
3930: 29 29 0a 20 20 20 20 28 73 65 74 21 20 2a 70 61 )). (set! *pa
3940: 73 73 6e 75 6d 2a 20 28 2b 20 2a 70 61 73 73 6e ssnum* (+ *passn
3950: 75 6d 2a 20 31 29 29 0a 20 20 20 20 28 6c 65 74 um* 1)). (let
3960: 20 6c 6f 6f 70 20 28 28 6e 75 6d 74 69 6d 65 73 loop ((numtimes
3970: 20 30 29 29 0a 20 20 20 20 20 20 28 66 6f 72 2d 0)). (for-
3980: 65 61 63 68 20 0a 20 20 20 20 20 20 20 28 6c 61 each . (la
3990: 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 mbda (test-name)
39a0: 0a 09 20 28 69 66 20 28 72 75 6e 73 3a 63 61 6e .. (if (runs:can
39b0: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 -run-more-tests
39c0: 64 62 29 0a 09 20 20 20 20 20 28 72 75 6e 2d 6f db).. (run-o
39d0: 6e 65 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 ne-test db run-i
39e0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 d test-name keyv
39f0: 61 6c 6c 73 74 29 0a 09 20 20 20 20 20 3b 3b 20 allst).. ;;
3a00: 61 64 64 20 73 6f 6d 65 20 64 65 6c 61 79 20 0a add some delay .
3a10: 09 20 20 20 20 20 3b 28 73 6c 65 65 70 20 32 29 . ;(sleep 2)
3a20: 0a 09 20 20 20 20 20 29 29 0a 20 20 20 20 20 20 .. )).
3a30: 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a 20 20 20 test-names).
3a40: 20 20 20 3b 3b 20 28 72 75 6e 2d 77 61 69 74 69 ;; (run-waiti
3a50: 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 20 20 20 ng-tests db).
3a60: 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 (if (args:get
3a70: 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 -arg "-keepgoing
3a80: 22 29 0a 09 20 20 28 6c 65 74 20 28 28 65 73 74 ").. (let ((est
3a90: 72 65 6d 20 28 64 62 3a 65 73 74 69 6d 61 74 65 rem (db:estimate
3aa0: 64 2d 74 65 73 74 73 2d 72 65 6d 61 69 6e 69 6e d-tests-remainin
3ab0: 67 20 64 62 20 72 75 6e 2d 69 64 29 29 29 0a 09 g db run-id)))..
3ac0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 3e 20 (if (and (>
3ad0: 65 73 74 72 65 6d 20 30 29 0a 09 09 20 20 20 20 estrem 0)...
3ae0: 20 28 65 71 3f 20 2a 67 6c 6f 62 61 6c 65 78 69 (eq? *globalexi
3af0: 74 73 74 61 74 75 73 2a 20 30 29 29 0a 09 09 28 tstatus* 0))...(
3b00: 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 begin... (debug
3b10: 3a 70 72 69 6e 74 20 31 20 22 4b 65 65 70 20 67 :print 1 "Keep g
3b20: 6f 69 6e 67 2c 20 65 73 74 69 6d 61 74 65 64 20 oing, estimated
3b30: 22 20 65 73 74 72 65 6d 20 22 20 74 65 73 74 73 " estrem " tests
3b40: 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 72 75 remaining to ru
3b50: 6e 2c 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 n, will continue
3b60: 20 69 6e 20 33 20 73 65 63 6f 6e 64 73 20 2e 2e in 3 seconds ..
3b70: 2e 22 29 0a 09 09 20 20 28 73 6c 65 65 70 20 33 .")... (sleep 3
3b80: 29 0a 09 09 20 20 28 72 75 6e 2d 77 61 69 74 69 )... (run-waiti
3b90: 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 09 09 20 ng-tests db)...
3ba0: 20 28 6c 6f 6f 70 20 28 2b 20 6e 75 6d 74 69 6d (loop (+ numtim
3bb0: 65 73 20 31 29 29 29 29 29 29 29 29 29 0a 09 20 es 1)))))))))..
3bc0: 20 20 0a 3b 3b 20 56 45 52 59 20 49 4e 45 46 46 .;; VERY INEFF
3bd0: 49 43 49 45 4e 54 21 20 4d 6f 76 65 20 73 74 75 ICIENT! Move stu
3be0: 66 66 20 74 68 61 74 20 73 68 6f 75 6c 64 20 62 ff that should b
3bf0: 65 20 64 6f 6e 65 20 6f 6e 63 65 20 75 70 20 74 e done once up t
3c00: 6f 20 63 61 6c 6c 69 6e 67 20 70 72 6f 63 0a 28 o calling proc.(
3c10: 64 65 66 69 6e 65 20 28 72 75 6e 2d 6f 6e 65 2d define (run-one-
3c20: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 test db run-id t
3c30: 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 61 6c 6c est-name keyvall
3c40: 73 74 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 st). (debug:pri
3c50: 6e 74 20 31 20 22 4c 61 75 6e 63 68 69 6e 67 20 nt 1 "Launching
3c60: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 test " test-name
3c70: 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 ). ;; All these
3c80: 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 vars might be r
3c90: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 eferenced by the
3ca0: 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 testconfig file
3cb0: 20 72 65 61 64 65 72 0a 20 20 28 73 65 74 65 6e reader. (seten
3cc0: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 v "MT_TEST_NAME"
3cd0: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a test-name) ;; .
3ce0: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 (setenv "MT_RU
3cf0: 4e 4e 41 4d 45 22 20 20 20 28 61 72 67 73 3a 67 NNAME" (args:g
3d00: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 et-arg ":runname
3d10: 22 29 29 0a 20 20 28 73 65 74 2d 6d 65 67 61 74 ")). (set-megat
3d20: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 est-env-vars db
3d30: 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 run-id) ;; these
3d40: 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 may be needed b
3d50: 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 y the launching
3d60: 70 72 6f 63 65 73 73 0a 20 20 28 63 68 61 6e 67 process. (chang
3d70: 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 e-directory *top
3d80: 70 61 74 68 2a 29 0a 20 20 28 6c 65 74 2a 20 28 path*). (let* (
3d90: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 (test-path (c
3da0: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
3db0: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d tests/" test-nam
3dc0: 65 29 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 e)).. (test-conf
3dd0: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 igf (conc test-p
3de0: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 ath "/testconfig
3df0: 22 29 29 0a 09 20 28 74 65 73 74 65 78 69 73 74 ")).. (testexist
3e00: 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 s (and (file-e
3e10: 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 xists? test-conf
3e20: 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 igf)(file-read-a
3e30: 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 ccess? test-conf
3e40: 69 67 66 29 29 29 0a 09 20 28 74 65 73 74 2d 63 igf))).. (test-c
3e50: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 onf (if teste
3e60: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 xists (read-conf
3e70: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 ig test-configf)
3e80: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c (make-hash-tabl
3e90: 65 29 29 29 0a 09 20 28 77 61 69 74 6f 6e 20 20 e))).. (waiton
3ea0: 20 20 20 20 20 28 6c 65 74 20 28 28 77 20 28 63 (let ((w (c
3eb0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 onfig-lookup tes
3ec0: 74 2d 63 6f 6e 66 20 22 72 65 71 75 69 72 65 6d t-conf "requirem
3ed0: 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 29 29 ents" "waiton"))
3ee0: 29 0a 09 09 09 20 28 69 66 20 28 73 74 72 69 6e ).... (if (strin
3ef0: 67 3f 20 77 29 28 73 74 72 69 6e 67 2d 73 70 6c g? w)(string-spl
3f00: 69 74 20 77 29 27 28 29 29 29 29 0a 09 20 28 74 it w)'()))).. (t
3f10: 61 67 73 20 20 20 20 20 20 20 20 20 28 6c 65 74 ags (let
3f20: 20 28 28 74 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f ((t (config-loo
3f30: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 73 kup test-conf "s
3f40: 65 74 75 70 22 20 22 74 61 67 73 22 29 29 29 0a etup" "tags"))).
3f50: 09 09 09 20 28 69 66 20 28 73 74 72 69 6e 67 3f ... (if (string?
3f60: 20 74 29 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 t)(string-split
3f70: 20 74 20 22 2c 22 29 20 27 28 29 29 29 29 29 0a t ",") '())))).
3f80: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 (if (not tes
3f90: 74 65 78 69 73 74 73 29 0a 09 28 62 65 67 69 6e texists)..(begin
3fa0: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
3fb0: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6e 27 74 0 "ERROR: Can't
3fc0: 20 66 69 6e 64 20 63 6f 6e 66 69 67 20 66 69 6c find config fil
3fd0: 65 20 22 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 e " test-configf
3fe0: 29 0a 09 20 20 28 65 78 69 74 20 32 29 29 0a 09 ).. (exit 2))..
3ff0: 3b 3b 20 70 75 74 20 74 6f 70 20 76 61 72 73 20 ;; put top vars
4000: 69 6e 74 6f 20 63 6f 6e 76 65 6e 69 65 6e 74 20 into convenient
4010: 76 61 72 69 61 62 6c 65 73 20 61 6e 64 20 6f 70 variables and op
4020: 65 6e 20 74 68 65 20 64 62 0a 09 28 6c 65 74 2a en the db..(let*
4030: 20 28 3b 3b 20 64 62 20 69 73 20 61 6c 77 61 79 (;; db is alway
4040: 73 20 61 74 20 2a 74 6f 70 70 61 74 68 2a 2f 64 s at *toppath*/d
4050: 62 2f 6d 65 67 61 74 65 73 74 2e 64 62 0a 09 20 b/megatest.db..
4060: 20 20 20 20 20 20 28 69 74 65 6d 73 20 20 20 20 (items
4070: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
4080: 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d ef/default test-
4090: 63 6f 6e 66 20 22 69 74 65 6d 73 22 20 27 28 29 conf "items" '()
40a0: 29 29 0a 09 20 20 20 20 20 20 20 28 69 74 65 6d )).. (item
40b0: 73 74 61 62 6c 65 20 20 28 68 61 73 68 2d 74 61 stable (hash-ta
40c0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
40d0: 74 65 73 74 2d 63 6f 6e 66 20 22 69 74 65 6d 73 test-conf "items
40e0: 74 61 62 6c 65 22 20 27 28 29 29 29 0a 09 20 20 table" '()))..
40f0: 20 20 20 20 20 28 61 6c 6c 69 74 65 6d 73 20 20 (allitems
4100: 20 20 28 69 66 20 28 6f 72 20 28 6e 6f 74 20 28 (if (or (not (
4110: 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 29 28 6e 6f null? items))(no
4120: 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 74 61 t (null? itemsta
4130: 62 6c 65 29 29 29 0a 09 09 09 09 28 61 70 70 65 ble))).....(appe
4140: 6e 64 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d 3e nd (item-assoc->
4150: 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 29 item-list items)
4160: 0a 09 09 09 09 09 28 69 74 65 6d 2d 74 61 62 6c ......(item-tabl
4170: 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 e->item-list ite
4180: 6d 73 74 61 62 6c 65 29 29 0a 09 09 09 09 27 28 mstable)).....'(
4190: 28 29 29 29 29 20 3b 3b 20 61 20 6c 69 73 74 20 ()))) ;; a list
41a0: 77 69 74 68 20 6f 6e 65 20 6e 75 6c 6c 20 6c 69 with one null li
41b0: 73 74 20 69 73 20 61 20 74 65 73 74 20 77 69 74 st is a test wit
41c0: 68 20 6e 6f 20 69 74 65 6d 73 0a 09 20 20 20 20 h no items..
41d0: 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 (runconfigf
41e0: 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
41f0: 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f "/runconfigs.co
4200: 6e 66 69 67 22 29 29 29 0a 09 20 20 28 64 65 62 nfig"))).. (deb
4210: 75 67 3a 70 72 69 6e 74 20 31 20 22 69 74 65 6d ug:print 1 "item
4220: 73 3a 20 22 29 0a 09 20 20 28 69 66 20 28 3e 3d s: ").. (if (>=
4230: 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 28 *verbosity* 1)(
4240: 70 70 20 61 6c 6c 69 74 65 6d 73 29 29 0a 09 20 pp allitems))..
4250: 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 (if (>= *verbos
4260: 69 74 79 2a 20 35 29 0a 09 20 20 20 20 20 20 28 ity* 5).. (
4270: 62 65 67 69 6e 0a 09 09 28 70 72 69 6e 74 20 22 begin...(print "
4280: 69 74 65 6d 73 3a 20 22 29 28 70 70 20 28 69 74 items: ")(pp (it
4290: 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c em-assoc->item-l
42a0: 69 73 74 20 69 74 65 6d 73 29 29 0a 09 09 28 70 ist items))...(p
42b0: 72 69 6e 74 20 22 69 74 65 73 74 61 62 6c 65 3a rint "itestable:
42c0: 20 22 29 28 70 70 20 28 69 74 65 6d 2d 74 61 62 ")(pp (item-tab
42d0: 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 le->item-list it
42e0: 65 6d 73 74 61 62 6c 65 29 29 29 29 0a 09 20 20 emstable))))..
42f0: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (if (args:get-ar
4300: 67 20 22 2d 6d 22 29 0a 09 20 20 20 20 20 20 28 g "-m").. (
4310: 64 62 3a 73 65 74 2d 63 6f 6d 6d 65 6e 74 2d 66 db:set-comment-f
4320: 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 or-run db run-id
4330: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
4340: 2d 6d 22 29 29 29 0a 09 20 20 3b 3b 20 62 72 61 -m"))).. ;; bra
4350: 69 6e 64 65 61 64 20 77 6f 72 6b 2d 61 72 6f 75 indead work-arou
4360: 6e 64 20 66 6f 72 20 70 6f 6f 72 6c 79 20 73 70 nd for poorly sp
4370: 65 63 69 66 69 65 64 20 61 6c 6c 69 74 65 6d 73 ecified allitems
4380: 20 6c 69 73 74 20 42 55 47 21 21 21 20 46 49 58 list BUG!!! FIX
4390: 4d 45 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f ME.. (if (null?
43a0: 20 61 6c 6c 69 74 65 6d 73 29 28 73 65 74 21 20 allitems)(set!
43b0: 61 6c 6c 69 74 65 6d 73 20 27 28 28 29 29 29 29 allitems '(())))
43c0: 0a 09 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 .. (let loop ((
43d0: 69 74 65 6d 64 61 74 20 28 63 61 72 20 61 6c 6c itemdat (car all
43e0: 69 74 65 6d 73 29 29 0a 09 09 20 20 20 20 20 28 items))... (
43f0: 74 61 6c 20 20 20 20 20 28 63 64 72 20 61 6c 6c tal (cdr all
4400: 69 74 65 6d 73 29 29 29 0a 09 20 20 20 20 3b 3b items))).. ;;
4410: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 (lambda (itemda
4420: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 t) ;;; ((ripenes
4430: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 s "overripe") (t
4440: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c emperature "cool
4450: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d ") (season "summ
4460: 65 72 22 29 29 0a 09 20 20 20 20 3b 3b 20 48 61 er")).. ;; Ha
4470: 6e 64 6c 65 20 6c 69 73 74 73 20 6f 66 20 69 74 ndle lists of it
4480: 65 6d 73 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 ems.. (let* (
4490: 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 28 (item-path (
44a0: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
44b0: 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 28 73 74 itemdat)) ;; (st
44c0: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
44d0: 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 (map cadr itemd
44e0: 61 74 29 20 22 2f 22 29 29 0a 09 09 20 20 20 28 at) "/"))... (
44f0: 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 new-test-path (s
4500: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
4510: 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 e (cons test-pat
4520: 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d h (map cadr item
4530: 64 61 74 29 29 20 22 2f 22 29 29 0a 09 09 20 20 dat)) "/"))...
4540: 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 (new-test-name
4550: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
4560: 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e -path "") test-n
4570: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e ame (conc test-n
4580: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
4590: 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 h))) ;; just nee
45a0: 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 d it to be uniqu
45b0: 65 0a 09 09 20 20 20 28 74 65 73 74 64 61 74 20 e... (testdat
45c0: 20 20 23 66 29 0a 09 09 20 20 20 28 6e 75 6d 2d #f)... (num-
45d0: 72 75 6e 6e 69 6e 67 20 28 64 62 3a 67 65 74 2d running (db:get-
45e0: 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e count-tests-runn
45f0: 69 6e 67 20 64 62 29 29 0a 09 09 20 20 20 28 6d ing db))... (m
4600: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
4610: 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 bs (config-looku
4620: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 p *configdat* "s
4630: 65 74 75 70 22 20 22 6d 61 78 5f 63 6f 6e 63 75 etup" "max_concu
4640: 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 09 rrent_jobs"))...
4650: 20 20 20 28 70 61 72 65 6e 74 2d 74 65 73 74 20 (parent-test
4660: 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (and (not (null?
4670: 20 69 74 65 6d 73 29 29 28 65 71 75 61 6c 3f 20 items))(equal?
4680: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 0a item-path ""))).
4690: 09 09 20 20 20 28 73 69 6e 67 6c 65 2d 74 65 73 .. (single-tes
46a0: 74 20 28 61 6e 64 20 28 6e 75 6c 6c 3f 20 69 74 t (and (null? it
46b0: 65 6d 73 29 20 28 65 71 75 61 6c 3f 20 69 74 65 ems) (equal? ite
46c0: 6d 2d 70 61 74 68 20 22 22 29 29 29 0a 09 09 20 m-path "")))...
46d0: 20 20 28 69 74 65 6d 2d 74 65 73 74 20 20 20 28 (item-test (
46e0: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 74 65 6d not (equal? item
46f0: 2d 70 61 74 68 20 22 22 29 29 29 29 0a 09 20 20 -path ""))))..
4700: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
4710: 20 33 20 22 6d 61 78 2d 63 6f 6e 63 75 72 72 65 3 "max-concurre
4720: 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 nt-jobs: " max-c
4730: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 22 oncurrent-jobs "
4740: 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 , num-running: "
4750: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a 09 20 num-running)..
4760: 20 20 20 20 20 28 69 66 20 28 72 75 6e 73 3a 63 (if (runs:c
4770: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
4780: 73 20 64 62 29 0a 09 09 20 20 28 62 65 67 69 6e s db)... (begin
4790: 0a 09 09 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 ... (let loop
47a0: 32 20 28 28 74 73 20 28 64 62 3a 67 65 74 2d 74 2 ((ts (db:get-t
47b0: 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d est-info db run-
47c0: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
47d0: 6d 2d 70 61 74 68 29 29 20 3b 3b 20 23 66 29 0a m-path)) ;; #f).
47e0: 09 09 09 09 28 63 74 20 30 29 29 0a 09 09 20 20 ....(ct 0))...
47f0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 6e 6f (if (and (no
4800: 74 20 74 73 29 0a 09 09 09 20 20 20 20 20 20 20 t ts)....
4810: 28 3c 20 63 74 20 31 30 29 29 0a 09 09 09 20 20 (< ct 10))....
4820: 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 28 72 (begin.... (r
4830: 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 62 20 egister-test db
4840: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
4850: 20 69 74 65 6d 2d 70 61 74 68 20 74 61 67 73 29 item-path tags)
4860: 0a 09 09 09 20 20 20 20 28 64 62 3a 74 65 73 74 .... (db:test
4870: 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 64 62 20 -set-comment db
4880: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
4890: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 0a 09 item-path "")..
48a0: 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 28 64 62 .. (loop2 (db
48b0: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 :get-test-info d
48c0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
48d0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 me item-path)...
48e0: 09 09 20 20 20 28 2b 20 63 74 20 31 29 29 29 0a .. (+ ct 1))).
48f0: 09 09 09 20 20 28 69 66 20 74 73 0a 09 09 09 20 ... (if ts....
4900: 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 64 (set! testd
4910: 61 74 20 74 73 29 0a 09 09 09 20 20 20 20 20 20 at ts)....
4920: 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62 75 (begin.....(debu
4930: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
4940: 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 72 65 67 NG: Couldn't reg
4950: 69 73 74 65 72 20 74 65 73 74 20 22 20 74 65 73 ister test " tes
4960: 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 20 69 74 t-name " with it
4970: 65 6d 20 70 61 74 68 20 22 20 69 74 65 6d 2d 70 em path " item-p
4980: 61 74 68 20 22 2c 20 73 6b 69 70 70 69 6e 67 22 ath ", skipping"
4990: 29 0a 09 09 09 09 28 69 66 20 28 6e 6f 74 20 28 ).....(if (not (
49a0: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 09 null? tal)).....
49b0: 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 (loop (car t
49c0: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 al)(cdr tal)))))
49d0: 29 29 0a 09 09 20 20 20 20 28 63 68 61 6e 67 65 ))... (change
49e0: 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d -directory test-
49f0: 70 61 74 68 29 0a 09 09 20 20 20 20 3b 3b 20 74 path)... ;; t
4a00: 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 68 65 72 his block is her
4a10: 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 6f 72 6d e only to inform
4a20: 20 74 68 65 20 75 73 65 72 20 65 61 72 6c 79 20 the user early
4a30: 6f 6e 0a 09 09 20 20 20 20 28 69 66 20 28 66 69 on... (if (fi
4a40: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f le-exists? runco
4a50: 6e 66 69 67 66 29 0a 09 09 09 28 73 65 74 75 70 nfigf)....(setup
4a60: 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 64 62 -env-defaults db
4a70: 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d runconfigf run-
4a80: 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e id *already-seen
4a90: 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a -runconfig-info*
4aa0: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e )....(debug:prin
4ab0: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 6f t 0 "WARNING: Yo
4ac0: 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 20 u do not have a
4ad0: 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 3a run config file:
4ae0: 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 0a " runconfigf)).
4af0: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
4b00: 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 nt 4 "run-id: "
4b10: 72 75 6e 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 run-id " test-na
4b20: 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 me: " test-name
4b30: 22 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 " item-path: " i
4b40: 74 65 6d 2d 70 61 74 68 20 22 20 74 65 73 74 64 tem-path " testd
4b50: 61 74 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d at: " (test:get-
4b60: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
4b70: 22 20 74 65 73 74 2d 73 74 61 74 65 3a 20 22 20 " test-state: "
4b80: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
4b90: 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 testdat))...
4ba0: 28 63 61 73 65 20 28 69 66 20 28 61 72 67 73 3a (case (if (args:
4bb0: 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 get-arg "-force"
4bc0: 29 0a 09 09 09 20 20 20 20 20 20 27 4e 4f 54 5f ).... 'NOT_
4bd0: 53 54 41 52 54 45 44 0a 09 09 09 20 20 20 20 20 STARTED....
4be0: 20 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 09 (if testdat....
4bf0: 09 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 . (string->symb
4c00: 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 ol (test:get-sta
4c10: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 te testdat))....
4c20: 09 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e . 'failed-to-in
4c30: 73 65 72 74 29 29 0a 09 09 20 20 20 20 20 20 28 sert))... (
4c40: 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 (failed-to-inser
4c50: 74 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 t)... (deb
4c60: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
4c70: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 R: Failed to ins
4c80: 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 ert the record i
4c90: 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 09 nto the db"))...
4ca0: 20 20 20 20 20 20 28 28 4e 4f 54 5f 53 54 41 52 ((NOT_STAR
4cb0: 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09 TED COMPLETED)..
4cc0: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
4cd0: 72 69 6e 74 20 36 20 22 47 6f 74 20 68 65 72 65 rint 6 "Got here
4ce0: 2c 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 , " (test:get-st
4cf0: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
4d00: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 (let ((ru
4d10: 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 28 nflag #f)).... (
4d20: 63 6f 6e 64 0a 09 09 09 20 20 3b 3b 20 69 2e 65 cond.... ;; i.e
4d30: 2e 20 74 68 69 73 20 69 73 20 74 68 65 20 70 61 . this is the pa
4d40: 72 65 6e 74 20 74 65 73 74 20 74 6f 20 61 20 73 rent test to a s
4d50: 75 69 74 65 20 6f 66 20 69 74 65 6d 73 2c 20 6e uite of items, n
4d60: 65 76 65 72 20 22 72 75 6e 22 20 69 74 0a 09 09 ever "run" it...
4d70: 09 20 20 28 70 61 72 65 6e 74 2d 74 65 73 74 0a . (parent-test.
4d80: 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 ... (set! runf
4d90: 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 3b 3b lag #f)).... ;;
4da0: 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 -force, run no
4db0: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 09 09 20 matter what....
4dc0: 20 28 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 ((args:get-arg
4dd0: 22 2d 66 6f 72 63 65 22 29 28 73 65 74 21 20 72 "-force")(set! r
4de0: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 unflag #t))....
4df0: 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c ;; NOT_STARTED,
4e00: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 run no matter w
4e10: 68 61 74 0a 09 09 09 20 20 28 28 65 71 75 61 6c hat.... ((equal
4e20: 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 ? (test:get-stat
4e30: 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f e testdat) "NOT_
4e40: 53 54 41 52 54 45 44 22 29 28 73 65 74 21 20 72 STARTED")(set! r
4e50: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 unflag #t))....
4e60: 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 ;; not -rerun a
4e70: 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 nd PASS, WARN or
4e80: 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 CHECK, do no ru
4e90: 6e 0a 09 09 09 20 20 28 28 61 6e 64 20 28 6f 72 n.... ((and (or
4ea0: 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 2d (not (args:get-
4eb0: 61 72 67 20 22 2d 72 65 72 75 6e 22 29 29 0a 09 arg "-rerun"))..
4ec0: 09 09 09 20 20 20 20 28 61 72 67 73 3a 67 65 74 ... (args:get
4ed0: 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 -arg "-keepgoing
4ee0: 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 ")).....(member
4ef0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
4f00: 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53 testdat) '("PAS
4f10: 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b S" "WARN" "CHECK
4f20: 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 "))).... (set!
4f30: 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 runflag #f))...
4f40: 09 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 . ;; -rerun and
4f50: 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f status is one o
4f60: 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 f the specifed,
4f70: 72 75 6e 20 69 74 0a 09 09 09 20 20 28 28 61 6e run it.... ((an
4f80: 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 d (args:get-arg
4f90: 22 2d 72 65 72 75 6e 22 29 0a 09 09 09 09 28 6c "-rerun").....(l
4fa0: 65 74 20 28 28 72 65 72 75 6e 6c 73 74 20 28 73 et ((rerunlst (s
4fb0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 61 72 67 tring-split (arg
4fc0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 s:get-arg "-reru
4fd0: 6e 22 29 20 22 2c 22 29 29 29 20 3b 3b 20 46 41 n") ","))) ;; FA
4fe0: 49 4c 2c 0a 09 09 09 09 20 20 28 6d 65 6d 62 65 IL,..... (membe
4ff0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
5000: 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 75 us testdat) reru
5010: 6e 6c 73 74 29 29 29 0a 09 09 09 20 20 20 28 73 nlst))).... (s
5020: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
5030: 0a 09 09 09 20 20 3b 3b 20 2d 6b 65 65 70 67 6f .... ;; -keepgo
5040: 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 ing, do not reru
5050: 6e 20 46 41 49 4c 0a 09 09 09 20 20 28 28 61 6e n FAIL.... ((an
5060: 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 d (args:get-arg
5070: 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 0a 09 09 "-keepgoing")...
5080: 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a ..(member (test:
5090: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
50a0: 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a at) '("FAIL"))).
50b0: 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 ... (set! runf
50c0: 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 28 28 lag #f)).... ((
50d0: 61 6e 64 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 and (not (args:g
50e0: 65 74 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 29 et-arg "-rerun")
50f0: 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 28 74 ).....(member (t
5100: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
5110: 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 estdat) '("FAIL"
5120: 20 22 6e 2f 61 22 29 29 29 0a 09 09 09 20 20 20 "n/a")))....
5130: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
5140: 29 29 0a 09 09 09 20 20 28 65 6c 73 65 20 28 73 )).... (else (s
5150: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 et! runflag #f))
5160: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 ).... (debug:pri
5170: 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e nt 6 "RUNNING =>
5180: 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 runflag: " runf
5190: 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 lag " STATE: " (
51a0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
51b0: 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53 estdat) " STATUS
51c0: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 : " (test:get-st
51d0: 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 atus testdat))..
51e0: 09 09 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 .. (if (not runf
51f0: 6c 61 67 29 0a 09 09 09 20 20 20 20 20 28 69 66 lag).... (if
5200: 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 (not parent-tes
5210: 74 29 0a 09 09 09 09 20 28 64 65 62 75 67 3a 70 t)..... (debug:p
5220: 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f rint 1 "NOTE: No
5230: 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 t starting test
5240: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 " new-test-name
5250: 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65 " as it is state
5260: 20 5c 22 43 4f 4d 50 4c 45 54 45 44 5c 22 20 61 \"COMPLETED\" a
5270: 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 nd status \"" (t
5280: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
5290: 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 estdat) "\", use
52a0: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 -force to overr
52b0: 69 64 65 22 29 29 0a 09 09 09 20 20 20 20 20 28 ide")).... (
52c0: 6c 65 74 2a 20 28 28 67 65 74 2d 70 72 65 72 65 let* ((get-prere
52d0: 71 73 2d 63 6d 64 20 28 6c 61 6d 62 64 61 20 28 qs-cmd (lambda (
52e0: 29 0a 09 09 09 09 09 09 20 20 20 20 20 20 20 28 )....... (
52f0: 64 62 2d 67 65 74 2d 70 72 65 72 65 71 73 2d 6e db-get-prereqs-n
5300: 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 ot-met db run-id
5310: 20 77 61 69 74 6f 6e 29 29 29 20 3b 3b 20 63 68 waiton))) ;; ch
5320: 65 63 6b 20 62 65 66 6f 72 65 20 72 75 6e 6e 69 eck before runni
5330: 6e 67 20 2e 2e 2e 2e 0a 09 09 09 09 20 20 20 20 ng .........
5340: 28 6c 61 75 6e 63 68 2d 63 6d 64 20 20 20 20 20 (launch-cmd
5350: 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 09 09 (lambda ().....
5360: 09 09 20 20 20 20 20 20 20 28 6c 61 75 6e 63 68 .. (launch
5370: 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 -test db run-id
5380: 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c test-conf keyval
5390: 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 lst test-name te
53a0: 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 29 st-path itemdat)
53b0: 29 29 0a 09 09 09 09 20 20 20 20 28 74 65 73 74 ))..... (test
53c0: 72 75 6e 64 61 74 20 20 20 20 20 20 28 6c 69 73 rundat (lis
53d0: 74 20 67 65 74 2d 70 72 65 72 65 71 73 2d 63 6d t get-prereqs-cm
53e0: 64 20 6c 61 75 6e 63 68 2d 63 6d 64 29 29 29 0a d launch-cmd))).
53f0: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 6f ... (if (o
5400: 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 r (args:get-arg
5410: 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 09 20 20 "-force").....
5420: 20 20 20 20 20 28 6e 75 6c 6c 3f 20 28 28 63 61 (null? ((ca
5430: 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 29 29 r testrundat))))
5440: 20 3b 3b 20 61 72 65 20 74 68 65 72 65 20 61 6e ;; are there an
5450: 79 20 74 65 73 74 73 20 74 68 61 74 20 6d 75 73 y tests that mus
5460: 74 20 62 65 20 72 75 6e 20 62 65 66 6f 72 65 20 t be run before
5470: 74 68 69 73 20 6f 6e 65 2e 2e 2e 0a 09 09 09 09 this one........
5480: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 28 63 61 (if (not ((ca
5490: 64 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 29 dr testrundat)))
54a0: 20 3b 3b 20 74 68 69 73 20 69 73 20 74 68 65 20 ;; this is the
54b0: 6c 69 6e 65 20 74 68 61 74 20 6c 61 75 6e 63 68 line that launch
54c0: 65 73 20 74 68 65 20 74 65 73 74 20 74 6f 20 74 es the test to t
54d0: 68 65 20 72 65 6d 6f 74 65 20 68 6f 73 74 0a 09 he remote host..
54e0: 09 09 09 20 20 20 20 20 20 20 28 62 65 67 69 6e ... (begin
54f0: 0a 09 09 09 09 09 20 28 70 72 69 6e 74 20 22 45 ...... (print "E
5500: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
5510: 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e launch the test.
5520: 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e Exiting as soon
5530: 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 as possible")..
5540: 09 09 09 09 20 28 73 65 74 21 20 2a 67 6c 6f 62 .... (set! *glob
5550: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 alexitstatus* 1)
5560: 20 3b 3b 20 0a 09 09 09 09 09 20 28 70 72 6f 63 ;; ...... (proc
5570: 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 ess-signal (curr
5580: 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 ent-process-id)
5590: 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 0a 09 09 09 signal/kill)....
55a0: 09 09 20 3b 28 65 78 69 74 20 31 29 0a 09 09 09 .. ;(exit 1)....
55b0: 09 09 20 29 29 0a 09 09 09 09 20 20 20 28 69 66 .. ))..... (if
55c0: 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 2d (not (args:get-
55d0: 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 arg "-keepgoing"
55e0: 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 68 ))..... (h
55f0: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a ash-table-set! *
5600: 77 61 69 74 69 6e 67 2d 71 75 65 75 65 2a 20 6e waiting-queue* n
5610: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 ew-test-name tes
5620: 74 72 75 6e 64 61 74 29 29 29 29 29 29 29 0a 09 trundat)))))))..
5630: 09 20 20 20 20 20 20 28 28 4b 49 4c 4c 45 44 29 . ((KILLED)
5640: 20 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75 ... (debu
5650: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a g:print 1 "NOTE:
5660: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 " new-test-name
5670: 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 " is already ru
5680: 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 nning or was exp
5690: 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 lictly killed, u
56a0: 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 se -force to lau
56b0: 6e 63 68 20 69 74 2e 22 29 29 0a 09 09 20 20 20 nch it."))...
56c0: 20 20 20 28 28 4c 41 55 4e 43 48 45 44 20 52 45 ((LAUNCHED RE
56d0: 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 MOTEHOSTSTART RU
56e0: 4e 4e 49 4e 47 29 20 20 0a 09 09 20 20 20 20 20 NNING) ...
56f0: 20 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 (if (> (- (cur
5700: 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 rent-seconds)(+
5710: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 (db:test-get-eve
5720: 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 nt_time testdat)
5730: 0a 09 09 09 09 09 09 20 20 20 20 20 28 64 62 3a ....... (db:
5740: 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 test-get-run_dur
5750: 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 ation testdat)))
5760: 0a 09 09 09 20 20 20 20 20 20 31 30 30 29 20 3b .... 100) ;
5770: 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 ; i.e. no update
5780: 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 31 for more than 1
5790: 30 30 20 73 65 63 6f 6e 64 73 0a 09 09 09 20 20 00 seconds....
57a0: 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 (begin....
57b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
57c0: 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 WARNING: Test "
57d0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 test-name " appe
57e0: 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 ars to be dead.
57f0: 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 Forcing it to st
5800: 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 ate INCOMPLETE a
5810: 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f nd status STUCK/
5820: 44 45 41 44 22 29 0a 09 09 09 20 20 20 20 20 28 DEAD").... (
5830: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 test-set-status!
5840: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
5850: 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 54 45 name "INCOMPLETE
5860: 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 69 " "STUCK/DEAD" i
5870: 74 65 6d 64 61 74 20 22 54 65 73 74 20 69 73 20 temdat "Test is
5880: 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 29 29 stuck or dead"))
5890: 0a 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 .... (debug:pr
58a0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 int 2 "NOTE: " t
58b0: 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c est-name " is al
58c0: 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 ready running"))
58d0: 29 0a 09 09 20 20 20 20 20 20 28 65 6c 73 65 20 )... (else
58e0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
58f0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 nt 0 "ERROR: Fai
5900: 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 led to launch te
5910: 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 st " new-test-na
5920: 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 me ". Unrecognis
5930: 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 74 ed state " (test
5940: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
5950: 61 74 29 29 29 29 29 29 0a 09 20 20 20 20 20 20 at))))))..
5960: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
5970: 74 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 tal))... (loop
5980: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 (car tal)(cdr ta
5990: 6c 29 29 29 29 29 29 29 29 29 0a 0a 28 64 65 66 l)))))))))..(def
59a0: 69 6e 65 20 28 72 75 6e 2d 77 61 69 74 69 6e 67 ine (run-waiting
59b0: 2d 74 65 73 74 73 20 64 62 29 0a 20 20 28 6c 65 -tests db). (le
59c0: 74 20 28 28 6e 75 6d 74 72 69 65 73 20 20 20 20 t ((numtries
59d0: 20 20 20 20 20 20 20 30 29 0a 09 28 6c 61 73 74 0)..(last
59e0: 2d 74 72 79 2d 74 69 6d 65 20 20 20 20 20 20 28 -try-time (
59f0: 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 current-seconds)
5a00: 29 0a 09 28 74 69 6d 65 73 20 20 20 20 20 20 20 )..(times
5a10: 20 20 20 20 20 20 20 28 6c 69 73 74 20 31 29 29 (list 1))
5a20: 29 20 3b 3b 20 6d 69 6e 75 74 65 73 20 74 6f 20 ) ;; minutes to
5a30: 77 61 69 74 20 62 65 66 6f 72 65 20 74 72 79 69 wait before tryi
5a40: 6e 67 20 61 67 61 69 6e 20 74 6f 20 6b 69 63 6b ng again to kick
5a50: 20 6f 66 66 20 72 75 6e 73 0a 20 20 20 20 3b 3b off runs. ;;
5a60: 20 42 55 47 20 74 68 69 73 20 68 61 63 6b 20 6f BUG this hack o
5a70: 66 20 62 72 75 74 65 20 66 6f 72 63 65 20 72 65 f brute force re
5a80: 74 72 79 69 6e 67 20 77 6f 72 6b 73 20 71 75 69 trying works qui
5a90: 74 65 20 77 65 6c 6c 20 66 6f 72 20 6d 61 6e 79 te well for many
5aa0: 20 63 61 73 65 73 20 62 75 74 20 0a 20 20 20 20 cases but .
5ab0: 3b 3b 20 20 20 20 20 77 68 61 74 20 69 73 20 6e ;; what is n
5ac0: 65 65 64 65 64 20 69 73 20 74 6f 20 63 68 65 63 eeded is to chec
5ad0: 6b 20 74 68 65 20 64 62 20 66 6f 72 20 74 65 73 k the db for tes
5ae0: 74 73 20 74 68 61 74 20 68 61 76 65 20 66 61 69 ts that have fai
5af0: 6c 65 64 20 6c 65 73 73 20 74 68 61 6e 0a 20 20 led less than.
5b00: 20 20 3b 3b 20 20 20 20 20 4e 20 74 69 6d 65 73 ;; N times
5b10: 20 6f 72 20 6e 65 76 65 72 20 62 65 65 6e 20 73 or never been s
5b20: 74 61 72 74 65 64 20 61 6e 64 20 6b 69 63 6b 20 tarted and kick
5b30: 74 68 65 6d 20 6f 66 66 20 61 67 61 69 6e 0a 20 them off again.
5b40: 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 77 (let loop ((w
5b50: 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 aiting-test-name
5b60: 73 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 s (hash-table-ke
5b70: 79 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 ys *waiting-queu
5b80: 65 2a 29 29 29 0a 20 20 20 20 20 20 28 63 6f 6e e*))). (con
5b90: 64 0a 20 20 20 20 20 20 20 28 28 6e 6f 74 20 28 d. ((not (
5ba0: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
5bb0: 65 2d 74 65 73 74 73 20 64 62 29 29 0a 09 28 73 e-tests db))..(s
5bc0: 6c 65 65 70 20 32 29 0a 09 28 6c 6f 6f 70 20 77 leep 2)..(loop w
5bd0: 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 aiting-test-name
5be0: 73 29 29 0a 20 20 20 20 20 20 20 28 28 6e 75 6c s)). ((nul
5bf0: 6c 3f 20 77 61 69 74 69 6e 67 2d 74 65 73 74 2d l? waiting-test-
5c00: 6e 61 6d 65 73 29 0a 09 28 64 65 62 75 67 3a 70 names)..(debug:p
5c10: 72 69 6e 74 20 31 20 22 41 6c 6c 20 74 65 73 74 rint 1 "All test
5c20: 73 20 6c 61 75 6e 63 68 65 64 22 29 29 0a 20 20 s launched")).
5c30: 20 20 20 20 20 28 65 6c 73 65 0a 09 28 73 65 74 (else..(set
5c40: 21 20 6e 75 6d 74 72 69 65 73 20 28 2b 20 6e 75 ! numtries (+ nu
5c50: 6d 74 72 69 65 73 20 31 29 29 0a 09 28 66 6f 72 mtries 1))..(for
5c60: 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 74 -each (lambda (t
5c70: 65 73 74 6e 61 6d 65 29 0a 09 09 20 20 20 20 28 estname)... (
5c80: 69 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e if (runs:can-run
5c90: 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a -more-tests db).
5ca0: 09 09 09 28 6c 65 74 2a 20 28 28 74 65 73 74 64 ...(let* ((testd
5cb0: 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 at (hash-table-r
5cc0: 65 66 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 ef *waiting-queu
5cd0: 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 0a 09 09 e* testname))...
5ce0: 09 20 20 20 20 20 20 20 28 70 72 65 72 65 71 73 . (prereqs
5cf0: 20 28 28 63 61 72 20 74 65 73 74 64 61 74 29 29 ((car testdat))
5d00: 29 0a 09 09 09 20 20 20 20 20 20 20 28 6c 64 62 ).... (ldb
5d10: 20 20 20 20 20 28 69 66 20 64 62 20 64 62 20 28 (if db db (
5d20: 6f 70 65 6e 2d 64 62 29 29 29 29 0a 09 09 09 20 open-db))))....
5d30: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
5d40: 22 70 72 65 72 65 71 73 20 72 65 6d 61 69 6e 69 "prereqs remaini
5d50: 6e 67 3a 20 22 20 70 72 65 72 65 71 73 29 0a 09 ng: " prereqs)..
5d60: 09 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 .. (if (null? p
5d70: 72 65 72 65 71 73 29 0a 09 09 09 20 20 20 20 20 rereqs)....
5d80: 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62 (begin.....(deb
5d90: 75 67 3a 70 72 69 6e 74 20 32 20 22 50 72 65 72 ug:print 2 "Prer
5da0: 65 71 75 69 73 69 74 65 73 20 6d 65 74 2c 20 6c equisites met, l
5db0: 61 75 6e 63 68 69 6e 67 20 22 20 74 65 73 74 6e aunching " testn
5dc0: 61 6d 65 29 0a 09 09 09 09 28 28 63 61 64 72 20 ame).....((cadr
5dd0: 74 65 73 74 64 61 74 29 29 0a 09 09 09 09 28 68 testdat)).....(h
5de0: 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 65 ash-table-delete
5df0: 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 ! *waiting-queue
5e00: 2a 20 74 65 73 74 6e 61 6d 65 29 29 29 0a 09 09 * testname)))...
5e10: 09 20 20 28 69 66 20 28 6e 6f 74 20 64 62 29 0a . (if (not db).
5e20: 09 09 09 20 20 20 20 20 20 28 73 71 6c 69 74 65 ... (sqlite
5e30: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 6c 64 62 29 3:finalize! ldb)
5e40: 29 29 29 29 0a 09 09 20 20 77 61 69 74 69 6e 67 ))))... waiting
5e50: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 0a 09 3b 3b -test-names)..;;
5e60: 20 28 73 6c 65 65 70 20 31 30 29 20 3b 3b 20 6e (sleep 10) ;; n
5e70: 6f 20 70 6f 69 6e 74 20 69 6e 20 72 75 73 68 69 o point in rushi
5e80: 6e 67 20 74 68 69 6e 67 73 20 61 74 20 74 68 69 ng things at thi
5e90: 73 20 73 74 61 67 65 3f 0a 09 28 6c 6f 6f 70 20 s stage?..(loop
5ea0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 (hash-table-keys
5eb0: 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 2a *waiting-queue*
5ec0: 29 29 29 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 )))))))..(define
5ed0: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 (get-dir-up-n d
5ee0: 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 ir . params) .
5ef0: 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28 (let ((dparts (
5f00: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 string-split dir
5f10: 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 "/"))..(count
5f20: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 (if (null? para
5f30: 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d ms) 1 (car param
5f40: 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 s)))). (conc
5f50: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 "/" (string-inte
5f60: 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20 rsperse ..
5f70: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d (take dparts (-
5f80: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 (length dparts)
5f90: 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20 count))..
5fa0: 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f "/")))).;; Remo
5fb0: 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 ve runs.;; field
5fc0: 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e s are passing in
5fd0: 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 69 6e through .(defin
5fe0: 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 2d 72 e (runs:remove-r
5ff0: 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 70 61 uns db runnamepa
6000: 74 74 20 74 65 73 74 70 61 74 74 20 69 74 65 6d tt testpatt item
6010: 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 patt). (let* ((
6020: 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 62 2d keys (db-
6030: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 get-keys db))..
6040: 28 72 75 6e 64 61 74 20 20 20 20 20 20 28 72 75 (rundat (ru
6050: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 ns:get-runs-by-p
6060: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e att db keys runn
6070: 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 amepatt)).. (hea
6080: 64 65 72 20 20 20 20 20 20 28 76 65 63 74 6f 72 der (vector
6090: 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a -ref rundat 0)).
60a0: 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 28 . (runs (
60b0: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
60c0: 74 20 31 29 29 29 0a 20 20 20 20 28 64 65 62 75 t 1))). (debu
60d0: 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 64 65 g:print 1 "Heade
60e0: 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 20 20 r: " header).
60f0: 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 (for-each.
6100: 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 (lambda (run).
6110: 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b (let ((runk
6120: 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 ey (string-inter
6130: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d sperse (map (lam
6140: 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 bda (k).......(d
6150: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
6160: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
6170: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 (vector-ref k 0
6180: 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 29 ))) keys) "/")))
6190: 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 .. (let* ((run-i
61a0: 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d d (db:get-value-
61b0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
61c0: 61 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 28 ader "id") )...(
61d0: 74 65 73 74 73 20 20 28 64 62 2d 67 65 74 2d 74 tests (db-get-t
61e0: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ests-for-run db
61f0: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
6200: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
6210: 65 72 20 22 69 64 22 29 20 74 65 73 74 70 61 74 er "id") testpat
6220: 74 20 69 74 65 6d 70 61 74 74 29 29 0a 09 09 28 t itempatt))...(
6230: 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 73 lasttpath "/does
6240: 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 /not/exist/I/hop
6250: 65 22 29 29 0a 09 20 20 20 28 69 66 20 28 6e 6f e")).. (if (no
6260: 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 t (null? tests))
6270: 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a .. (begin.
6280: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
6290: 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 1 "Removing test
62a0: 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e s for run: " run
62b0: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d key " " (db:get-
62c0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
62d0: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e run header "runn
62e0: 61 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 2d 65 ame"))... (for-e
62f0: 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 ach... (lambda
6300: 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 (test)... (le
6310: 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 t* ((item-path (
6320: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
6330: 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 -path test))....
6340: 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 (test-name (d
6350: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
6360: 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 ame test))....
6370: 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a (run-dir (db:
6380: 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 test-get-rundir
6390: 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 test)))...
63a0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
63b0: 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 " (db:test-get
63c0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 -testname test)
63d0: 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 " id: " (db:test
63e0: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 -get-id test) "
63f0: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 " item-path)...
6400: 20 20 20 20 20 28 64 62 3a 64 65 6c 65 74 65 2d (db:delete-
6410: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 test-records db
6420: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
6430: 74 65 73 74 29 29 0a 09 09 20 20 20 20 20 20 28 test))... (
6440: 69 66 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 if (> (string-le
6450: 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 35 29 ngth run-dir) 5)
6460: 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 69 ;; bad heuristi
6470: 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65 c but should pre
6480: 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 vent /tmp /home
6490: 65 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 20 28 etc..... (let (
64a0: 28 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d 64 69 (fullpath run-di
64b0: 72 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 3a 74 r)) ;; "/" (db:t
64c0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 est-get-item-pat
64d0: 68 20 74 65 73 74 29 29 29 29 0a 09 09 09 20 20 h test))))....
64e0: 20 20 28 73 65 74 21 20 6c 61 73 74 74 70 61 74 (set! lasttpat
64f0: 68 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 h fullpath)....
6500: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6510: 31 20 22 72 6d 20 2d 72 66 20 22 20 66 75 6c 6c 1 "rm -rf " full
6520: 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 73 79 path).... (sy
6530: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d stem (conc "rm -
6540: 72 66 20 22 20 66 75 6c 6c 70 61 74 68 29 29 0a rf " fullpath)).
6550: 09 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 64 ... (let* ((d
6560: 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 28 irs-count (+ 1 (
6570: 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 6e length keys)(len
6580: 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 gth (string-spli
6590: 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 t item-path "/")
65a0: 29 29 29 0a 09 09 09 09 20 20 20 28 64 69 72 2d )))..... (dir-
65b0: 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 72 2d to-rem (get-dir-
65c0: 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 64 69 up-n fullpath di
65d0: 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 09 20 rs-count)).....
65e0: 20 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 (remainingd (s
65f0: 74 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 tring-substitute
6600: 20 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 22 (regexp (conc "
6610: 5e 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f ^" dir-to-rem "/
6620: 22 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 29 ")) "" fullpath)
6630: 29 0a 09 09 09 09 20 20 20 28 63 6d 64 20 28 63 )..... (cmd (c
6640: 6f 6e 63 20 22 63 64 20 22 20 64 69 72 2d 74 6f onc "cd " dir-to
6650: 2d 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d 70 -rem "; rmdir -p
6660: 20 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 29 " remainingd ))
6670: 29 0a 09 09 09 20 20 20 20 20 20 28 69 66 20 28 ).... (if (
6680: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 75 6c file-exists? ful
6690: 6c 70 61 74 68 29 0a 09 09 09 09 20 20 28 62 65 lpath)..... (be
66a0: 67 69 6e 0a 09 09 09 09 20 20 20 20 28 64 65 62 gin..... (deb
66b0: 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 0a ug:print 1 cmd).
66c0: 09 09 09 09 20 20 20 20 28 73 79 73 74 65 6d 20 .... (system
66d0: 63 6d 64 29 29 29 0a 09 09 09 20 20 20 20 20 20 cmd)))....
66e0: 29 29 0a 09 09 09 20 20 20 20 29 29 29 0a 09 09 )).... )))...
66f0: 20 20 20 20 74 65 73 74 73 29 29 29 0a 09 20 20 tests)))..
6700: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 (let ((remtests
6710: 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 (db-get-tests-f
6720: 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 or-run db (db:ge
6730: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
6740: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
6750: 22 29 29 29 29 0a 09 20 20 20 20 20 28 69 66 20 ")))).. (if
6760: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 (null? remtests)
6770: 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 ;; no more test
6780: 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 28 s remaining... (
6790: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 let* ((dparts (
67a0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 string-split las
67b0: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 ttpath "/"))....
67c0: 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 22 (runpath (conc "
67d0: 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 /" (string-inter
67e0: 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 20 20 sperse ......
67f0: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d (take dparts (-
6800: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 (length dparts)
6810: 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 22 2f 1))...... "/
6820: 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 62 75 "))))... (debu
6830: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 g:print 1 "Remov
6840: 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 ing run: " runke
6850: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 y " " (db:get-va
6860: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
6870: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d n header "runnam
6880: 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a 64 65 e"))... (db:de
6890: 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d lete-run db run-
68a0: 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 64 id)... ;; need
68b0: 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 74 to figure out t
68c0: 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 72 he path to the r
68d0: 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 un dir and remov
68e0: 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 09 e it if empty...
68f0: 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 ;; (if (nu
6900: 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 ll? (glob (conc
6910: 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a runpath "/*"))).
6920: 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 .. ;; (
6930: 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 20 begin... ;; .
6940: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
6950: 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 Removing run dir
6960: 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 " runpath)...
6970: 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 63 ;; . (system (c
6980: 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 20 onc "rmdir -p "
6990: 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 20 runpath))))...
69a0: 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 20 )))).. )).
69b0: 72 75 6e 73 29 29 29 0a runs))).