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 29 0a 20 20 28 6f 62 74 est-name). (obt
1700: 61 69 6e 2d 64 6f 74 2d 6c 6f 63 6b 20 22 66 69 ain-dot-lock "fi
1710: 6e 61 6c 2d 72 65 73 75 6c 74 73 2e 68 74 6d 6c nal-results.html
1720: 22 20 31 20 32 30 20 33 30 29 20 3b 3b 20 72 65 " 1 20 30) ;; re
1730: 74 72 79 20 65 76 65 72 79 20 73 65 63 6f 6e 64 try every second
1740: 20 66 6f 72 20 32 30 20 73 65 63 6f 6e 64 73 2c for 20 seconds,
1750: 20 63 61 6c 6c 20 69 74 20 64 65 61 64 20 61 66 call it dead af
1760: 74 65 72 20 33 30 20 73 65 63 6f 6e 64 73 20 61 ter 30 seconds a
1770: 6e 64 20 73 74 65 61 6c 20 74 68 65 20 6c 6f 63 nd steal the loc
1780: 6b 0a 20 20 28 6c 65 74 20 28 28 6f 75 70 20 20 k. (let ((oup
1790: 20 28 6f 70 65 6e 2d 6f 75 74 70 75 74 2d 66 69 (open-output-fi
17a0: 6c 65 20 22 66 69 6e 61 6c 2d 72 65 73 75 6c 74 le "final-result
17b0: 73 2e 68 74 6d 6c 22 29 29 29 0a 20 20 20 20 28 s.html"))). (
17c0: 77 69 74 68 2d 6f 75 74 70 75 74 2d 74 6f 2d 70 with-output-to-p
17d0: 6f 72 74 0a 09 6f 75 70 0a 20 20 20 20 20 20 28 ort..oup. (
17e0: 70 72 69 6e 74 20 22 3c 68 74 6d 6c 3e 3c 74 69 print "<html><ti
17f0: 74 6c 65 3e 53 75 6d 6d 61 72 79 3a 20 22 20 74 tle>Summary: " t
1800: 65 73 74 2d 6e 61 6d 65 20 22 3c 2f 74 69 74 6c est-name "</titl
1810: 65 3e 3c 62 6f 64 79 3e 3c 74 61 62 6c 65 3e 22 e><body><table>"
1820: 29 0a 20 20 20 20 20 20 28 73 71 6c 69 74 65 33 ). (sqlite3
1830: 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 :for-each-row .
1840: 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 69 (lambda (i
1850: 64 20 69 74 65 6d 70 61 74 68 20 73 74 61 74 65 d itempath state
1860: 20 73 74 61 74 75 73 20 72 75 6e 5f 64 75 72 61 status run_dura
1870: 74 69 6f 6e 20 6c 6f 67 66 20 63 6f 6d 6d 65 6e tion logf commen
1880: 74 29 0a 09 20 28 70 72 69 6e 74 20 22 3c 74 72 t).. (print "<tr
1890: 3e 22 0a 09 09 22 3c 74 64 3e 3c 68 72 65 66 3d >"..."<td><href=
18a0: 5c 22 22 20 69 74 65 6d 70 61 74 68 20 22 2f 22 \"" itempath "/"
18b0: 20 6c 6f 67 66 20 22 5c 22 3c 2f 61 3e 22 20 69 logf "\"</a>" i
18c0: 74 65 6d 70 61 74 68 20 22 3c 2f 74 64 3e 22 20 tempath "</td>"
18d0: 0a 09 09 22 3c 74 64 3e 22 20 73 74 61 74 65 20 ..."<td>" state
18e0: 20 20 20 22 3c 2f 74 64 3e 22 20 0a 09 09 22 3c "</td>" ..."<
18f0: 74 64 3e 22 20 73 74 61 74 75 73 20 20 20 22 3c td>" status "<
1900: 2f 74 64 3e 22 0a 09 09 22 3c 74 64 3e 22 20 63 /td>"..."<td>" c
1910: 6f 6d 6d 65 6e 74 20 20 22 3c 2f 74 64 3e 22 0a omment "</td>".
1920: 09 09 22 3c 2f 74 72 3e 22 29 0a 09 20 22 53 45 .."</tr>").. "SE
1930: 4c 45 43 54 20 69 64 2c 69 74 65 6d 5f 70 61 74 LECT id,item_pat
1940: 68 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 72 h,state,status,r
1950: 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 un_duration,fina
1960: 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 20 46 l_logf,comment F
1970: 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 ROM tests WHERE
1980: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
1990: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
19a0: 5f 70 61 74 68 20 21 3d 20 27 27 3b 22 29 29 0a _path != '';")).
19b0: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 3c 2f (print "</
19c0: 62 6f 64 79 3e 3c 2f 68 74 6d 6c 3e 22 29 0a 20 body></html>").
19d0: 20 20 20 20 20 28 63 6c 6f 73 65 2d 6f 75 74 70 (close-outp
19e0: 75 74 2d 70 6f 72 74 20 6f 75 70 29 0a 20 20 20 ut-port oup).
19f0: 20 20 20 28 72 65 6c 65 61 73 65 2d 64 6f 74 2d (release-dot-
1a00: 6c 6f 63 6b 20 22 66 69 6e 61 6c 2d 72 65 73 75 lock "final-resu
1a10: 6c 74 73 2e 68 74 6d 6c 22 29 29 0a 0a 20 20 20 lts.html"))..
1a20: 20 3b 3b 20 41 44 44 20 55 50 44 41 54 45 20 54 ;; ADD UPDATE T
1a30: 4f 20 46 49 4e 41 4c 20 4c 4f 47 20 48 45 52 45 O FINAL LOG HERE
1a40: 0a 0a 29 29 0a 09 09 09 20 20 20 0a 0a 0a 3b 3b ..)).... ...;;
1a50: 20 3b 3b 20 54 4f 44 4f 3a 20 43 6f 6e 76 65 72 ;; TODO: Conver
1a60: 67 65 20 74 68 69 73 20 77 69 74 68 20 64 62 3a ge this with db:
1a70: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 0a 3b 3b get-test-info.;;
1a80: 20 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 (define (runs:g
1a90: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 et-test-info db
1aa0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1ab0: 20 69 74 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 20 item-path).;;
1ac0: 20 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 (let ((res #f))
1ad0: 20 3b 3b 20 28 76 65 63 74 6f 72 20 23 66 20 23 ;; (vector #f #
1ae0: 66 20 23 66 20 23 66 20 23 66 20 23 66 29 29 29 f #f #f #f #f)))
1af0: 0a 3b 3b 20 20 20 20 20 28 73 71 6c 69 74 65 33 .;; (sqlite3
1b00: 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 3b :for-each-row .;
1b10: 3b 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 ; (lambda (
1b20: 69 64 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e id run-id test-n
1b30: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 ame state status
1b40: 29 0a 3b 3b 20 20 20 20 20 20 20 20 28 73 65 74 ).;; (set
1b50: 21 20 72 65 73 20 28 76 65 63 74 6f 72 20 69 64 ! res (vector id
1b60: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
1b70: 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 69 e state status i
1b80: 74 65 6d 2d 70 61 74 68 29 29 29 0a 3b 3b 20 20 tem-path))).;;
1b90: 20 20 20 20 64 62 20 22 53 45 4c 45 43 54 20 69 db "SELECT i
1ba0: 64 2c 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d d,run_id,testnam
1bb0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 20 46 e,state,status F
1bc0: 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 ROM tests WHERE
1bd0: 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 run_id=? AND tes
1be0: 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d tname=? AND item
1bf0: 5f 70 61 74 68 3d 3f 3b 22 0a 3b 3b 20 20 20 20 _path=?;".;;
1c00: 20 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 run-id test-na
1c10: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 3b 3b me item-path).;;
1c20: 20 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 res))..(def
1c30: 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 ine-inline (test
1c40: 3a 67 65 74 2d 69 64 20 76 65 63 29 20 20 20 20 :get-id vec)
1c50: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 76 (vector-ref v
1c60: 65 63 20 30 29 29 0a 28 64 65 66 69 6e 65 2d 69 ec 0)).(define-i
1c70: 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d nline (test:get-
1c80: 72 75 6e 5f 69 64 20 76 65 63 29 20 20 20 28 76 run_id vec) (v
1c90: 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 31 29 ector-ref vec 1)
1ca0: 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 ).(define-inline
1cb0: 20 28 74 65 73 74 3a 67 65 74 2d 74 65 73 74 2d (test:get-test-
1cc0: 6e 61 6d 65 20 76 65 63 29 28 76 65 63 74 6f 72 name vec)(vector
1cd0: 2d 72 65 66 20 76 65 63 20 32 29 29 0a 28 64 65 -ref vec 2)).(de
1ce0: 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 fine-inline (tes
1cf0: 74 3a 67 65 74 2d 73 74 61 74 65 20 76 65 63 29 t:get-state vec)
1d00: 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 (vector-ref
1d10: 76 65 63 20 33 29 29 0a 28 64 65 66 69 6e 65 2d vec 3)).(define-
1d20: 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 inline (test:get
1d30: 2d 73 74 61 74 75 73 20 76 65 63 29 20 20 20 28 -status vec) (
1d40: 76 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 34 vector-ref vec 4
1d50: 29 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e )).(define-inlin
1d60: 65 20 28 74 65 73 74 3a 67 65 74 2d 69 74 65 6d e (test:get-item
1d70: 2d 70 61 74 68 20 76 65 63 29 28 76 65 63 74 6f -path vec)(vecto
1d80: 72 2d 72 65 66 20 76 65 63 20 35 29 29 0a 0a 28 r-ref vec 5))..(
1d90: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 define (runs:tes
1da0: 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 t-get-full-path
1db0: 74 65 73 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 test). (let* ((
1dc0: 74 65 73 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 testname (db:tes
1dd0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 t-get-testname
1de0: 20 74 65 73 74 29 29 0a 09 20 28 69 74 65 6d 70 test)).. (itemp
1df0: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ath (db:test-get
1e00: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 -item-path test)
1e10: 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 74 65 73 )). (conc tes
1e20: 74 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c tname (if (equal
1e30: 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 22 ? itempath "") "
1e40: 22 20 28 63 6f 6e 63 20 22 28 22 20 69 74 65 6d " (conc "(" item
1e50: 70 61 74 68 20 22 29 22 29 29 29 29 29 0a 0a 28 path ")")))))..(
1e60: 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 define-inline (t
1e70: 65 73 74 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c est:test-get-ful
1e80: 6c 6e 61 6d 65 20 74 65 73 74 29 0a 20 20 20 28 lname test). (
1e90: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 conc (db:test-ge
1ea0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 t-testname test)
1eb0: 0a 09 20 28 69 66 20 28 65 71 75 61 6c 3f 20 28 .. (if (equal? (
1ec0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
1ed0: 2d 70 61 74 68 20 74 65 73 74 29 20 22 22 29 0a -path test) "").
1ee0: 09 20 20 20 20 20 22 22 0a 09 20 20 20 20 20 28 . "".. (
1ef0: 63 6f 6e 63 20 22 28 22 20 28 64 62 3a 74 65 73 conc "(" (db:tes
1f00: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t-get-item-path
1f10: 74 65 73 74 29 20 22 29 22 29 29 29 29 0a 0a 28 test) ")"))))..(
1f20: 64 65 66 69 6e 65 20 28 63 68 65 63 6b 2d 76 61 define (check-va
1f30: 6c 69 64 2d 69 74 65 6d 73 20 63 6c 61 73 73 20 lid-items class
1f40: 69 74 65 6d 29 0a 20 20 28 6c 65 74 20 28 28 76 item). (let ((v
1f50: 61 6c 69 64 2d 76 61 6c 75 65 73 20 28 6c 65 74 alid-values (let
1f60: 20 28 28 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f ((s (config-loo
1f70: 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 kup *configdat*
1f80: 22 76 61 6c 69 64 76 61 6c 75 65 73 22 20 63 6c "validvalues" cl
1f90: 61 73 73 29 29 29 0a 09 09 09 28 69 66 20 73 20 ass)))....(if s
1fa0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 29 (string-split s)
1fb0: 20 23 66 29 29 29 29 0a 20 20 20 20 28 69 66 20 #f)))). (if
1fc0: 76 61 6c 69 64 2d 76 61 6c 75 65 73 0a 09 28 69 valid-values..(i
1fd0: 66 20 28 6d 65 6d 62 65 72 20 69 74 65 6d 20 76 f (member item v
1fe0: 61 6c 69 64 2d 76 61 6c 75 65 73 29 0a 09 20 20 alid-values)..
1ff0: 20 20 69 74 65 6d 20 23 66 29 0a 09 69 74 65 6d item #f)..item
2000: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 )))..(define (te
2010: 73 74 73 74 65 70 2d 73 65 74 2d 73 74 61 74 75 ststep-set-statu
2020: 73 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 s! db run-id tes
2030: 74 2d 6e 61 6d 65 20 74 65 73 74 73 74 65 70 2d t-name teststep-
2040: 6e 61 6d 65 20 73 74 61 74 65 2d 69 6e 20 73 74 name state-in st
2050: 61 74 75 73 2d 69 6e 20 69 74 65 6d 64 61 74 20 atus-in itemdat
2060: 63 6f 6d 6d 65 6e 74 29 0a 20 20 28 64 65 62 75 comment). (debu
2070: 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 2d 69 g:print 4 "run-i
2080: 64 3a 20 22 20 72 75 6e 2d 69 64 20 22 20 74 65 d: " run-id " te
2090: 73 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d st-name: " test-
20a0: 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 28 28 name). (let* ((
20b0: 73 74 61 74 65 20 20 20 20 20 28 63 68 65 63 6b state (check
20c0: 2d 76 61 6c 69 64 2d 69 74 65 6d 73 20 22 73 74 -valid-items "st
20d0: 61 74 65 22 20 73 74 61 74 65 2d 69 6e 29 29 0a ate" state-in)).
20e0: 09 20 28 73 74 61 74 75 73 20 20 20 20 28 63 68 . (status (ch
20f0: 65 63 6b 2d 76 61 6c 69 64 2d 69 74 65 6d 73 20 eck-valid-items
2100: 22 73 74 61 74 75 73 22 20 73 74 61 74 75 73 2d "status" status-
2110: 69 6e 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 in)).. (item-pat
2120: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 h (item-list->pa
2130: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 20 28 th itemdat)).. (
2140: 74 65 73 74 64 61 74 20 20 20 28 64 62 3a 67 65 testdat (db:ge
2150: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 t-test-info db r
2160: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
2170: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 item-path))).
2180: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 (debug:print 5
2190: 22 74 65 73 74 64 61 74 3a 20 22 20 74 65 73 74 "testdat: " test
21a0: 64 61 74 29 0a 20 20 20 20 28 69 66 20 28 61 6e dat). (if (an
21b0: 64 20 74 65 73 74 64 61 74 20 3b 3b 20 69 66 20 d testdat ;; if
21c0: 74 68 65 20 73 65 63 74 69 6f 6e 20 65 78 69 73 the section exis
21d0: 74 73 20 74 68 65 6e 20 66 6f 72 63 65 20 73 70 ts then force sp
21e0: 65 63 69 66 69 63 61 74 69 6f 6e 20 42 55 47 2c ecification BUG,
21f0: 20 49 20 64 6f 6e 27 74 20 6c 69 6b 65 20 68 6f I don't like ho
2200: 77 20 74 68 69 73 20 77 6f 72 6b 73 2e 0a 09 20 w this works...
2210: 20 20 20 20 28 6f 72 20 28 6e 6f 74 20 73 74 61 (or (not sta
2220: 74 65 29 28 6e 6f 74 20 73 74 61 74 75 73 29 29 te)(not status))
2230: 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 )..(debug:print
2240: 30 20 22 57 41 52 4e 49 4e 47 3a 20 49 6e 76 61 0 "WARNING: Inva
2250: 6c 69 64 20 22 20 28 69 66 20 73 74 61 74 75 73 lid " (if status
2260: 20 22 73 74 61 74 75 73 22 20 22 73 74 61 74 65 "status" "state
2270: 22 29 0a 09 20 20 20 20 20 20 20 22 20 76 61 6c ").. " val
2280: 75 65 20 5c 22 22 20 28 69 66 20 73 74 61 74 75 ue \"" (if statu
2290: 73 20 73 74 61 74 75 73 2d 69 6e 20 73 74 61 74 s status-in stat
22a0: 65 2d 69 6e 29 20 22 5c 22 2c 20 75 70 64 61 74 e-in) "\", updat
22b0: 65 20 79 6f 75 72 20 76 61 6c 69 64 73 74 61 74 e your validstat
22c0: 65 73 20 73 65 63 74 69 6f 6e 20 69 6e 20 6d 65 es section in me
22d0: 67 61 74 65 73 74 2e 63 6f 6e 66 69 67 22 29 29 gatest.config"))
22e0: 0a 20 20 20 20 28 69 66 20 74 65 73 74 64 61 74 . (if testdat
22f0: 0a 09 28 6c 65 74 20 28 28 74 65 73 74 2d 69 64 ..(let ((test-id
2300: 20 28 74 65 73 74 3a 67 65 74 2d 69 64 20 74 65 (test:get-id te
2310: 73 74 64 61 74 29 29 29 0a 09 20 20 28 73 71 6c stdat))).. (sql
2320: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 ite3:execute db
2330: 0a 09 09 09 22 49 4e 53 45 52 54 20 4f 52 20 52 ...."INSERT OR R
2340: 45 50 4c 41 43 45 20 69 6e 74 6f 20 74 65 73 74 EPLACE into test
2350: 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c _steps (test_id,
2360: 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 stepname,state,s
2370: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 tatus,event_time
2380: 2c 63 6f 6d 6d 65 6e 74 29 20 56 41 4c 55 45 53 ,comment) VALUES
2390: 28 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d (?,?,?,?,strftim
23a0: 65 28 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f 29 e('%s','now'),?)
23b0: 3b 22 0a 09 09 09 74 65 73 74 2d 69 64 20 74 65 ;"....test-id te
23c0: 73 74 73 74 65 70 2d 6e 61 6d 65 20 73 74 61 74 ststep-name stat
23d0: 65 20 73 74 61 74 75 73 20 28 69 66 20 63 6f 6d e status (if com
23e0: 6d 65 6e 74 20 63 6f 6d 6d 65 6e 74 20 22 22 29 ment comment "")
23f0: 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ))..(debug:print
2400: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6e 27 74 0 "ERROR: Can't
2410: 20 75 70 64 61 74 65 20 22 20 74 65 73 74 2d 6e update " test-n
2420: 61 6d 65 20 22 20 66 6f 72 20 72 75 6e 20 22 20 ame " for run "
2430: 72 75 6e 2d 69 64 20 22 20 2d 3e 20 6e 6f 20 73 run-id " -> no s
2440: 75 63 68 20 74 65 73 74 20 69 6e 20 64 62 22 29 uch test in db")
2450: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 )))..(define (te
2460: 73 74 2d 67 65 74 2d 6b 69 6c 6c 2d 72 65 71 75 st-get-kill-requ
2470: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 est db run-id te
2480: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 61 74 29 st-name itemdat)
2490: 0a 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d . (let* ((item-
24a0: 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d path (item-list-
24b0: 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a >path itemdat)).
24c0: 09 20 28 74 65 73 74 64 61 74 20 20 20 28 64 62 . (testdat (db
24d0: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 :get-test-info d
24e0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
24f0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a me item-path))).
2500: 20 20 20 20 28 65 71 75 61 6c 3f 20 28 74 65 73 (equal? (tes
2510: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
2520: 64 61 74 29 20 22 4b 49 4c 4c 52 45 51 22 29 29 dat) "KILLREQ"))
2530: 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 )..(define (test
2540: 2d 73 65 74 2d 6d 65 74 61 2d 69 6e 66 6f 20 64 -set-meta-info d
2550: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d b run-id testnam
2560: 65 20 69 74 65 6d 64 61 74 29 0a 20 20 28 6c 65 e itemdat). (le
2570: 74 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 t ((item-path (i
2580: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 tem-list->path i
2590: 74 65 6d 64 61 74 29 29 0a 09 28 63 70 75 6c 6f temdat))..(cpulo
25a0: 61 64 20 20 28 67 65 74 2d 63 70 75 2d 6c 6f 61 ad (get-cpu-loa
25b0: 64 29 29 0a 09 28 68 6f 73 74 6e 61 6d 65 20 28 d))..(hostname (
25c0: 67 65 74 2d 68 6f 73 74 2d 6e 61 6d 65 29 29 0a get-host-name)).
25d0: 09 28 64 69 73 6b 66 72 65 65 20 28 67 65 74 2d .(diskfree (get-
25e0: 64 66 20 28 63 75 72 72 65 6e 74 2d 64 69 72 65 df (current-dire
25f0: 63 74 6f 72 79 29 29 29 0a 09 28 75 6e 61 6d 65 ctory)))..(uname
2600: 20 20 20 20 28 67 65 74 2d 75 6e 61 6d 65 20 22 (get-uname "
2610: 2d 73 72 76 70 69 6f 22 29 29 0a 09 28 72 75 6e -srvpio"))..(run
2620: 70 61 74 68 20 20 28 63 75 72 72 65 6e 74 2d 64 path (current-d
2630: 69 72 65 63 74 6f 72 79 29 29 29 0a 20 20 20 20 irectory))).
2640: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 (sqlite3:execute
2650: 20 64 62 20 22 55 50 44 41 54 45 20 74 65 73 74 db "UPDATE test
2660: 73 20 53 45 54 20 68 6f 73 74 3d 3f 2c 63 70 75 s SET host=?,cpu
2670: 6c 6f 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 3d load=?,diskfree=
2680: 3f 2c 75 6e 61 6d 65 3d 3f 2c 72 75 6e 64 69 72 ?,uname=?,rundir
2690: 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d =? WHERE run_id=
26a0: 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f ? AND testname=?
26b0: 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f AND item_path=?
26c0: 3b 22 0a 09 09 20 20 68 6f 73 74 6e 61 6d 65 0a ;"... hostname.
26d0: 09 09 20 20 63 70 75 6c 6f 61 64 0a 09 09 20 20 .. cpuload...
26e0: 64 69 73 6b 66 72 65 65 0a 09 09 20 20 75 6e 61 diskfree... una
26f0: 6d 65 0a 09 09 20 20 72 75 6e 70 61 74 68 0a 09 me... runpath..
2700: 09 20 20 72 75 6e 2d 69 64 0a 09 09 20 20 74 65 . run-id... te
2710: 73 74 6e 61 6d 65 0a 09 09 20 20 69 74 65 6d 2d stname... item-
2720: 70 61 74 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 path)))..(define
2730: 20 28 74 65 73 74 2d 75 70 64 61 74 65 2d 6d 65 (test-update-me
2740: 74 61 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 ta-info db run-i
2750: 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 64 d testname itemd
2760: 61 74 20 6d 69 6e 75 74 65 73 29 0a 20 20 28 6c at minutes). (l
2770: 65 74 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 et ((item-path (
2780: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
2790: 69 74 65 6d 64 61 74 29 29 0a 09 28 63 70 75 6c itemdat))..(cpul
27a0: 6f 61 64 20 20 28 67 65 74 2d 63 70 75 2d 6c 6f oad (get-cpu-lo
27b0: 61 64 29 29 0a 09 28 64 69 73 6b 66 72 65 65 20 ad))..(diskfree
27c0: 28 67 65 74 2d 64 66 20 28 63 75 72 72 65 6e 74 (get-df (current
27d0: 2d 64 69 72 65 63 74 6f 72 79 29 29 29 29 0a 20 -directory)))).
27e0: 20 20 20 28 69 66 20 28 6e 6f 74 20 63 70 75 6c (if (not cpul
27f0: 6f 61 64 29 20 20 28 62 65 67 69 6e 20 28 64 65 oad) (begin (de
2800: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
2810: 4e 49 4e 47 3a 20 43 50 55 4c 4f 41 44 20 6e 6f NING: CPULOAD no
2820: 74 20 66 6f 75 6e 64 2e 22 29 20 20 28 73 65 74 t found.") (set
2830: 21 20 63 70 75 6c 6f 61 64 20 22 6e 2f 61 22 29 ! cpuload "n/a")
2840: 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 )). (if (not
2850: 64 69 73 6b 66 72 65 65 29 20 28 62 65 67 69 6e diskfree) (begin
2860: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
2870: 22 57 41 52 4e 49 4e 47 3a 20 44 49 53 4b 46 52 "WARNING: DISKFR
2880: 45 45 20 6e 6f 74 20 66 6f 75 6e 64 2e 22 29 20 EE not found.")
2890: 28 73 65 74 21 20 64 69 73 6b 66 72 65 65 20 22 (set! diskfree "
28a0: 6e 2f 61 22 29 29 29 0a 20 20 20 20 28 69 66 20 n/a"))). (if
28b0: 28 6e 6f 74 20 69 74 65 6d 2d 70 61 74 68 29 28 (not item-path)(
28c0: 62 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 69 begin (debug:pri
28d0: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 49 nt 0 "WARNING: I
28e0: 54 45 4d 50 41 54 48 20 6e 6f 74 20 73 65 74 2e TEMPATH not set.
28f0: 22 29 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d ") (set! item-
2900: 70 61 74 68 20 22 22 29 29 29 0a 20 20 20 20 3b path ""))). ;
2910: 3b 20 28 6c 65 74 20 28 28 74 65 73 74 69 6e 66 ; (let ((testinf
2920: 6f 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 o (db:get-test-i
2930: 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 nfo db run-id te
2940: 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 stname item-path
2950: 29 29 29 0a 20 20 20 20 3b 3b 20 20 20 28 69 66 ))). ;; (if
2960: 20 28 61 6e 64 20 28 6e 6f 74 20 28 65 71 75 61 (and (not (equa
2970: 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d l? (db:test-get-
2980: 73 74 61 74 75 73 20 74 65 73 74 69 6e 66 6f 29 status testinfo)
2990: 20 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 0a 20 "COMPLETED")).
29a0: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 20 20 20 ;;
29b0: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 64 (not (equal? (d
29c0: 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 b:test-get-statu
29d0: 73 20 74 65 73 74 69 6e 66 6f 29 20 22 4b 49 4c s testinfo) "KIL
29e0: 4c 52 45 51 22 29 29 0a 20 20 20 20 28 73 71 6c LREQ")). (sql
29f0: 69 74 65 33 3a 65 78 65 63 75 74 65 0a 20 20 20 ite3:execute.
2a00: 20 20 64 62 0a 20 20 20 20 20 22 55 50 44 41 54 db. "UPDAT
2a10: 45 20 74 65 73 74 73 20 53 45 54 20 63 70 75 6c E tests SET cpul
2a20: 6f 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 3d 3f oad=?,diskfree=?
2a30: 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 3d 3f 2c ,run_duration=?,
2a40: 73 74 61 74 65 3d 27 52 55 4e 4e 49 4e 47 27 20 state='RUNNING'
2a50: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
2a60: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
2a70: 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 20 41 4e D item_path=? AN
2a80: 44 20 73 74 61 74 65 20 4e 4f 54 20 49 4e 20 28 D state NOT IN (
2a90: 27 43 4f 4d 50 4c 45 54 45 44 27 2c 27 4b 49 4c 'COMPLETED','KIL
2aa0: 4c 52 45 51 27 2c 27 4b 49 4c 4c 45 44 27 29 3b LREQ','KILLED');
2ab0: 22 0a 20 20 20 20 20 63 70 75 6c 6f 61 64 0a 20 ". cpuload.
2ac0: 20 20 20 20 64 69 73 6b 66 72 65 65 0a 20 20 20 diskfree.
2ad0: 20 20 6d 69 6e 75 74 65 73 0a 20 20 20 20 20 72 minutes. r
2ae0: 75 6e 2d 69 64 0a 20 20 20 20 20 74 65 73 74 6e un-id. testn
2af0: 61 6d 65 0a 20 20 20 20 20 69 74 65 6d 2d 70 61 ame. item-pa
2b00: 74 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 th)))..(define (
2b10: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 set-megatest-env
2b20: 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 -vars db run-id)
2b30: 0a 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 28 . (let ((keys (
2b40: 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db-get-keys db))
2b50: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 ). (for-each
2b60: 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 (lambda (key)...
2b70: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 (sqlite3:for-eac
2b80: 68 2d 72 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 h-row... (lambda
2b90: 20 28 76 61 6c 29 0a 09 09 20 20 20 28 64 65 62 (val)... (deb
2ba0: 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 ug:print 2 "sete
2bb0: 6e 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 nv " (key:get-fi
2bc0: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 eldname key) " "
2bd0: 20 76 61 6c 29 0a 09 09 20 20 20 28 73 65 74 65 val)... (sete
2be0: 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c nv (key:get-fiel
2bf0: 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 dname key) val))
2c00: 0a 09 09 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 ... db ... (conc
2c10: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a "SELECT " (key:
2c20: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
2c30: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 y) " FROM runs W
2c40: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 HERE id=?;")...
2c50: 72 75 6e 2d 69 64 29 29 0a 09 20 20 20 20 20 20 run-id))..
2c60: 6b 65 79 73 29 29 29 0a 0a 28 64 65 66 69 6e 65 keys)))..(define
2c70: 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76 2d 76 (set-item-env-v
2c80: 61 72 73 20 69 74 65 6d 64 61 74 29 0a 20 20 28 ars itemdat). (
2c90: 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 for-each (lambda
2ca0: 20 28 69 74 65 6d 29 0a 09 20 20 20 20 20 20 28 (item).. (
2cb0: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 73 debug:print 2 "s
2cc0: 65 74 65 6e 76 20 22 20 28 63 61 72 20 69 74 65 etenv " (car ite
2cd0: 6d 29 20 22 20 22 20 28 63 61 64 72 20 69 74 65 m) " " (cadr ite
2ce0: 6d 29 29 0a 09 20 20 20 20 20 20 28 73 65 74 65 m)).. (sete
2cf0: 6e 76 20 28 63 61 72 20 69 74 65 6d 29 20 28 63 nv (car item) (c
2d00: 61 64 72 20 69 74 65 6d 29 29 29 0a 09 20 20 20 adr item)))..
2d10: 20 69 74 65 6d 64 61 74 29 29 0a 0a 28 64 65 66 itemdat))..(def
2d20: 69 6e 65 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 ine (get-all-leg
2d30: 61 6c 2d 74 65 73 74 73 29 0a 20 20 28 6c 65 74 al-tests). (let
2d40: 2a 20 28 28 74 65 73 74 73 20 20 28 67 6c 6f 62 * ((tests (glob
2d50: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
2d60: 20 22 2f 74 65 73 74 73 2f 2a 22 29 29 29 0a 09 "/tests/*")))..
2d70: 20 28 72 65 73 20 20 20 20 27 28 29 29 29 0a 20 (res '())).
2d80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
2d90: 34 20 22 49 4e 46 4f 3a 20 4c 6f 6f 6b 69 6e 67 4 "INFO: Looking
2da0: 20 61 74 20 74 65 73 74 73 20 22 20 28 73 74 72 at tests " (str
2db0: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
2dc0: 74 65 73 74 73 20 22 2c 22 29 29 0a 20 20 20 20 tests ",")).
2dd0: 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 (for-each (lambd
2de0: 61 20 28 74 65 73 74 70 61 74 68 29 0a 09 09 28 a (testpath)...(
2df0: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f if (file-exists?
2e00: 20 28 63 6f 6e 63 20 74 65 73 74 70 61 74 68 20 (conc testpath
2e10: 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a "/testconfig")).
2e20: 09 09 20 20 20 20 28 73 65 74 21 20 72 65 73 20 .. (set! res
2e30: 28 63 6f 6e 73 20 28 6c 61 73 74 20 28 73 74 72 (cons (last (str
2e40: 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 61 ing-split testpa
2e50: 74 68 20 22 2f 22 29 29 20 72 65 73 29 29 29 29 th "/")) res))))
2e60: 0a 09 20 20 20 20 20 20 74 65 73 74 73 29 0a 20 .. tests).
2e70: 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 6e res))..(defin
2e80: 65 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d e (runs:can-run-
2e90: 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a 20 more-tests db).
2ea0: 20 28 6c 65 74 20 28 28 6e 75 6d 2d 72 75 6e 6e (let ((num-runn
2eb0: 69 6e 67 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e ing (db:get-coun
2ec0: 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 t-tests-running
2ed0: 64 62 29 29 0a 09 28 6d 61 78 2d 63 6f 6e 63 75 db))..(max-concu
2ee0: 72 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 rrent-jobs (conf
2ef0: 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 ig-lookup *confi
2f00: 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d gdat* "setup" "m
2f10: 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f ax_concurrent_jo
2f20: 62 73 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 bs"))). (debu
2f30: 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 g:print 2 "max-c
2f40: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 oncurrent-jobs:
2f50: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
2f60: 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e -jobs ", num-run
2f70: 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e ning: " num-runn
2f80: 69 6e 67 29 0a 20 20 20 20 28 69 66 20 28 6e 6f ing). (if (no
2f90: 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c t (eq? 0 *global
2fa0: 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 23 exitstatus*))..#
2fb0: 66 0a 09 28 69 66 20 28 6f 72 20 28 6e 6f 74 20 f..(if (or (not
2fc0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
2fd0: 6f 62 73 29 0a 09 09 28 61 6e 64 20 6d 61 78 2d obs)...(and max-
2fe0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a concurrent-jobs.
2ff0: 09 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d 3e .. (string->
3000: 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 number max-concu
3010: 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 20 20 rrent-jobs)...
3020: 20 20 20 28 6e 6f 74 20 28 3e 3d 20 6e 75 6d 2d (not (>= num-
3030: 72 75 6e 6e 69 6e 67 20 28 73 74 72 69 6e 67 2d running (string-
3040: 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 >number max-conc
3050: 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29 29 29 29 urrent-jobs)))))
3060: 0a 09 20 20 20 20 23 74 0a 09 20 20 20 20 28 62 .. #t.. (b
3070: 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 egin .. (de
3080: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
3090: 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e NING: Max runnin
30a0: 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c g jobs exceeded,
30b0: 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 current number
30c0: 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 running: " num-r
30d0: 75 6e 6e 69 6e 67 20 0a 09 09 09 20 20 20 22 2c unning .... ",
30e0: 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f max_concurrent_
30f0: 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 jobs: " max-conc
3100: 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 20 20 urrent-jobs)..
3110: 20 20 20 20 23 66 29 29 29 29 29 0a 20 20 0a 28 #f))))). .(
3120: 64 65 66 69 6e 65 20 28 72 75 6e 2d 74 65 73 74 define (run-test
3130: 73 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 73 29 s db test-names)
3140: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 . (let* ((keys
3150: 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b (db-get-k
3160: 65 79 73 20 64 62 29 29 0a 09 20 28 6b 65 79 76 eys db)).. (keyv
3170: 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 2d 3e 76 allst (keys->v
3180: 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 allist keys #t))
3190: 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20 .. (run-id
31a0: 28 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 (register-run db
31b0: 20 6b 65 79 73 29 29 29 20 3b 3b 20 20 74 65 73 keys))) ;; tes
31c0: 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 3b 3b t-name))). ;;
31d0: 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70 61 on the first pa
31e0: 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75 ss or call to ru
31f0: 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 49 4c n-tests set FAIL
3200: 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44 S to NOT_STARTED
3210: 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70 if. ;; -keep
3220: 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 66 69 going is specifi
3230: 65 64 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 ed. (if (and
3240: 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 (eq? *passnum* 0
3250: 29 0a 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 ).. (args:ge
3260: 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e t-arg "-keepgoin
3270: 67 22 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 g"))..(begin..
3280: 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74 ;; have to delet
3290: 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77 e test records w
32a0: 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 here NOT_STARTED
32b0: 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20 since they can
32c0: 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 cause -keepgoing
32d0: 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 to .. ;; get s
32e0: 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f tuck due to beco
32f0: 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c ming inaccessibl
3300: 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 e from a failed
3310: 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 test. I.e. if te
3320: 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20 st B depends ..
3330: 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75 ;; on test A bu
3340: 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64 t test B reached
3350: 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 the point on be
3360: 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61 ing registered a
3370: 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e s NOT_STARTED an
3380: 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 d test.. ;; A f
3390: 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 ailed for some r
33a0: 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 eason then on re
33b0: 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 -run using -keep
33c0: 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61 going the run ca
33d0: 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 n never complete
33e0: 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d ... (db:delete-
33f0: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 tests-in-state d
3400: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 b run-id "NOT_ST
3410: 41 52 54 45 44 22 29 0a 09 20 20 28 64 62 3a 73 ARTED").. (db:s
3420: 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 et-tests-state-s
3430: 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 20 tatus db run-id
3440: 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 test-names #f "F
3450: 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 AIL" "NOT_STARTE
3460: 44 22 20 22 46 41 49 4c 22 29 29 29 0a 20 20 20 D" "FAIL"))).
3470: 20 28 73 65 74 21 20 2a 70 61 73 73 6e 75 6d 2a (set! *passnum*
3480: 20 28 2b 20 2a 70 61 73 73 6e 75 6d 2a 20 31 29 (+ *passnum* 1)
3490: 29 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 ). (let loop
34a0: 28 28 6e 75 6d 74 69 6d 65 73 20 30 29 29 0a 20 ((numtimes 0)).
34b0: 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a (for-each .
34c0: 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 (lambda (
34d0: 74 65 73 74 2d 6e 61 6d 65 29 0a 09 20 28 69 66 test-name).. (if
34e0: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d (runs:can-run-m
34f0: 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a 09 20 ore-tests db)..
3500: 20 20 20 20 28 72 75 6e 2d 6f 6e 65 2d 74 65 73 (run-one-tes
3510: 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 t db run-id test
3520: 2d 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 29 -name keyvallst)
3530: 0a 09 20 20 20 20 20 3b 3b 20 61 64 64 20 73 6f .. ;; add so
3540: 6d 65 20 64 65 6c 61 79 20 0a 09 20 20 20 20 20 me delay ..
3550: 3b 28 73 6c 65 65 70 20 32 29 0a 09 20 20 20 20 ;(sleep 2)..
3560: 20 29 29 0a 20 20 20 20 20 20 20 74 65 73 74 2d )). test-
3570: 6e 61 6d 65 73 29 0a 20 20 20 20 20 20 3b 3b 20 names). ;;
3580: 28 72 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 (run-waiting-tes
3590: 74 73 20 64 62 29 0a 20 20 20 20 20 20 28 69 66 ts db). (if
35a0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
35b0: 2d 6b 65 65 70 67 6f 69 6e 67 22 29 0a 09 20 20 -keepgoing")..
35c0: 28 6c 65 74 20 28 28 65 73 74 72 65 6d 20 28 64 (let ((estrem (d
35d0: 62 3a 65 73 74 69 6d 61 74 65 64 2d 74 65 73 74 b:estimated-test
35e0: 73 2d 72 65 6d 61 69 6e 69 6e 67 20 64 62 20 72 s-remaining db r
35f0: 75 6e 2d 69 64 29 29 29 0a 09 20 20 20 20 28 69 un-id))).. (i
3600: 66 20 28 61 6e 64 20 28 3e 20 65 73 74 72 65 6d f (and (> estrem
3610: 20 30 29 0a 09 09 20 20 20 20 20 28 65 71 3f 20 0)... (eq?
3620: 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 *globalexitstatu
3630: 73 2a 20 30 29 29 0a 09 09 28 62 65 67 69 6e 0a s* 0))...(begin.
3640: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
3650: 20 31 20 22 4b 65 65 70 20 67 6f 69 6e 67 2c 20 1 "Keep going,
3660: 65 73 74 69 6d 61 74 65 64 20 22 20 65 73 74 72 estimated " estr
3670: 65 6d 20 22 20 74 65 73 74 73 20 72 65 6d 61 69 em " tests remai
3680: 6e 69 6e 67 20 74 6f 20 72 75 6e 2c 20 77 69 6c ning to run, wil
3690: 6c 20 63 6f 6e 74 69 6e 75 65 20 69 6e 20 33 20 l continue in 3
36a0: 73 65 63 6f 6e 64 73 20 2e 2e 2e 22 29 0a 09 09 seconds ...")...
36b0: 20 20 28 73 6c 65 65 70 20 33 29 0a 09 09 20 20 (sleep 3)...
36c0: 28 72 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 (run-waiting-tes
36d0: 74 73 20 64 62 29 0a 09 09 20 20 28 6c 6f 6f 70 ts db)... (loop
36e0: 20 28 2b 20 6e 75 6d 74 69 6d 65 73 20 31 29 29 (+ numtimes 1))
36f0: 29 29 29 29 29 29 29 0a 09 20 20 20 0a 3b 3b 20 ))))))).. .;;
3700: 56 45 52 59 20 49 4e 45 46 46 49 43 49 45 4e 54 VERY INEFFICIENT
3710: 21 20 4d 6f 76 65 20 73 74 75 66 66 20 74 68 61 ! Move stuff tha
3720: 74 20 73 68 6f 75 6c 64 20 62 65 20 64 6f 6e 65 t should be done
3730: 20 6f 6e 63 65 20 75 70 20 74 6f 20 63 61 6c 6c once up to call
3740: 69 6e 67 20 70 72 6f 63 0a 28 64 65 66 69 6e 65 ing proc.(define
3750: 20 28 72 75 6e 2d 6f 6e 65 2d 74 65 73 74 20 64 (run-one-test d
3760: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
3770: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 29 0a 20 20 me keyvallst).
3780: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
3790: 4c 61 75 6e 63 68 69 6e 67 20 74 65 73 74 20 22 Launching test "
37a0: 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 3b 3b test-name). ;;
37b0: 20 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20 All these vars
37c0: 6d 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e might be referen
37d0: 63 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63 ced by the testc
37e0: 6f 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65 onfig file reade
37f0: 72 0a 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f r. (setenv "MT_
3800: 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d TEST_NAME" test-
3810: 6e 61 6d 65 29 20 3b 3b 20 0a 20 20 28 73 65 74 name) ;; . (set
3820: 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 env "MT_RUNNAME"
3830: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 (args:get-arg
3840: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 20 20 ":runname")).
3850: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e (set-megatest-en
3860: 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 v-vars db run-id
3870: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 ) ;; these may b
3880: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 e needed by the
3890: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 launching proces
38a0: 73 0a 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 s. (change-dire
38b0: 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 ctory *toppath*)
38c0: 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d . (let* ((test-
38d0: 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 path (conc *t
38e0: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f oppath* "/tests/
38f0: 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 " test-name))..
3900: 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 (test-configf (c
3910: 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f onc test-path "/
3920: 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 testconfig"))..
3930: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61 (testexists (a
3940: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f nd (file-exists?
3950: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 test-configf)(f
3960: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f ile-read-access?
3970: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 test-configf)))
3980: 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 .. (test-conf
3990: 20 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 (if testexists
39a0: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 (read-config tes
39b0: 74 2d 63 6f 6e 66 69 67 66 29 20 28 6d 61 6b 65 t-configf) (make
39c0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 -hash-table)))..
39d0: 20 28 77 61 69 74 6f 6e 20 20 20 20 20 20 20 28 (waiton (
39e0: 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d let ((w (config-
39f0: 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 lookup test-conf
3a00: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 "requirements"
3a10: 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 20 "waiton")))....
3a20: 28 69 66 20 28 73 74 72 69 6e 67 3f 20 77 29 28 (if (string? w)(
3a30: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 77 29 27 string-split w)'
3a40: 28 29 29 29 29 0a 09 20 28 74 61 67 73 20 20 20 ()))).. (tags
3a50: 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 20 28 (let ((t (
3a60: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 config-lookup te
3a70: 73 74 2d 63 6f 6e 66 20 22 73 65 74 75 70 22 20 st-conf "setup"
3a80: 22 74 61 67 73 22 29 29 29 0a 09 09 09 20 28 69 "tags"))).... (i
3a90: 66 20 28 73 74 72 69 6e 67 3f 20 74 29 28 73 74 f (string? t)(st
3aa0: 72 69 6e 67 2d 73 70 6c 69 74 20 74 20 22 2c 22 ring-split t ","
3ab0: 29 20 27 28 29 29 29 29 29 0a 20 20 20 20 28 69 ) '())))). (i
3ac0: 66 20 28 6e 6f 74 20 74 65 73 74 65 78 69 73 74 f (not testexist
3ad0: 73 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 s)..(begin.. (d
3ae0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
3af0: 52 4f 52 3a 20 43 61 6e 27 74 20 66 69 6e 64 20 ROR: Can't find
3b00: 63 6f 6e 66 69 67 20 66 69 6c 65 20 22 20 74 65 config file " te
3b10: 73 74 2d 63 6f 6e 66 69 67 66 29 0a 09 20 20 28 st-configf).. (
3b20: 65 78 69 74 20 32 29 29 0a 09 3b 3b 20 70 75 74 exit 2))..;; put
3b30: 20 74 6f 70 20 76 61 72 73 20 69 6e 74 6f 20 63 top vars into c
3b40: 6f 6e 76 65 6e 69 65 6e 74 20 76 61 72 69 61 62 onvenient variab
3b50: 6c 65 73 20 61 6e 64 20 6f 70 65 6e 20 74 68 65 les and open the
3b60: 20 64 62 0a 09 28 6c 65 74 2a 20 28 3b 3b 20 64 db..(let* (;; d
3b70: 62 20 69 73 20 61 6c 77 61 79 73 20 61 74 20 2a b is always at *
3b80: 74 6f 70 70 61 74 68 2a 2f 64 62 2f 6d 65 67 61 toppath*/db/mega
3b90: 74 65 73 74 2e 64 62 0a 09 20 20 20 20 20 20 20 test.db..
3ba0: 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 68 61 (items (ha
3bb0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
3bc0: 61 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 ault test-conf "
3bd0: 69 74 65 6d 73 22 20 27 28 29 29 29 0a 09 20 20 items" '()))..
3be0: 20 20 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 (itemstable
3bf0: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
3c00: 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 63 f/default test-c
3c10: 6f 6e 66 20 22 69 74 65 6d 73 74 61 62 6c 65 22 onf "itemstable"
3c20: 20 27 28 29 29 29 0a 09 20 20 20 20 20 20 20 28 '())).. (
3c30: 61 6c 6c 69 74 65 6d 73 20 20 20 20 28 69 66 20 allitems (if
3c40: 28 6f 72 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (or (not (null?
3c50: 69 74 65 6d 73 29 29 28 6e 6f 74 20 28 6e 75 6c items))(not (nul
3c60: 6c 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 l? itemstable)))
3c70: 0a 09 09 09 09 28 61 70 70 65 6e 64 20 28 69 74 .....(append (it
3c80: 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c em-assoc->item-l
3c90: 69 73 74 20 69 74 65 6d 73 29 0a 09 09 09 09 09 ist items)......
3ca0: 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 (item-table->ite
3cb0: 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c m-list itemstabl
3cc0: 65 29 29 0a 09 09 09 09 27 28 28 29 29 29 29 20 e)).....'(())))
3cd0: 3b 3b 20 61 20 6c 69 73 74 20 77 69 74 68 20 6f ;; a list with o
3ce0: 6e 65 20 6e 75 6c 6c 20 6c 69 73 74 20 69 73 20 ne null list is
3cf0: 61 20 74 65 73 74 20 77 69 74 68 20 6e 6f 20 69 a test with no i
3d00: 74 65 6d 73 0a 09 20 20 20 20 20 20 20 28 72 75 tems.. (ru
3d10: 6e 63 6f 6e 66 69 67 66 20 20 28 63 6f 6e 63 20 nconfigf (conc
3d20: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e *toppath* "/run
3d30: 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 configs.config")
3d40: 29 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 )).. (debug:pri
3d50: 6e 74 20 31 20 22 69 74 65 6d 73 3a 20 22 29 0a nt 1 "items: ").
3d60: 09 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 . (if (>= *verb
3d70: 6f 73 69 74 79 2a 20 31 29 28 70 70 20 61 6c 6c osity* 1)(pp all
3d80: 69 74 65 6d 73 29 29 0a 09 20 20 28 69 66 20 28 items)).. (if (
3d90: 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 35 >= *verbosity* 5
3da0: 29 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a ).. (begin.
3db0: 09 09 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a ..(print "items:
3dc0: 20 22 29 28 70 70 20 28 69 74 65 6d 2d 61 73 73 ")(pp (item-ass
3dd0: 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 oc->item-list it
3de0: 65 6d 73 29 29 0a 09 09 28 70 72 69 6e 74 20 22 ems))...(print "
3df0: 69 74 65 73 74 61 62 6c 65 3a 20 22 29 28 70 70 itestable: ")(pp
3e00: 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 (item-table->it
3e10: 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 62 em-list itemstab
3e20: 6c 65 29 29 29 29 0a 09 20 20 28 69 66 20 28 61 le)))).. (if (a
3e30: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 6d 22 rgs:get-arg "-m"
3e40: 29 0a 09 20 20 20 20 20 20 28 64 62 3a 73 65 74 ).. (db:set
3e50: 2d 63 6f 6d 6d 65 6e 74 2d 66 6f 72 2d 72 75 6e -comment-for-run
3e60: 20 64 62 20 72 75 6e 2d 69 64 20 28 61 72 67 73 db run-id (args
3e70: 3a 67 65 74 2d 61 72 67 20 22 2d 6d 22 29 29 29 :get-arg "-m")))
3e80: 0a 09 20 20 3b 3b 20 62 72 61 69 6e 64 65 61 64 .. ;; braindead
3e90: 20 77 6f 72 6b 2d 61 72 6f 75 6e 64 20 66 6f 72 work-around for
3ea0: 20 70 6f 6f 72 6c 79 20 73 70 65 63 69 66 69 65 poorly specifie
3eb0: 64 20 61 6c 6c 69 74 65 6d 73 20 6c 69 73 74 20 d allitems list
3ec0: 42 55 47 21 21 21 20 46 49 58 4d 45 0a 09 20 20 BUG!!! FIXME..
3ed0: 28 69 66 20 28 6e 75 6c 6c 3f 20 61 6c 6c 69 74 (if (null? allit
3ee0: 65 6d 73 29 28 73 65 74 21 20 61 6c 6c 69 74 65 ems)(set! allite
3ef0: 6d 73 20 27 28 28 29 29 29 29 0a 09 20 20 28 6c ms '(()))).. (l
3f00: 65 74 20 6c 6f 6f 70 20 28 28 69 74 65 6d 64 61 et loop ((itemda
3f10: 74 20 28 63 61 72 20 61 6c 6c 69 74 65 6d 73 29 t (car allitems)
3f20: 29 0a 09 09 20 20 20 20 20 28 74 61 6c 20 20 20 )... (tal
3f30: 20 20 28 63 64 72 20 61 6c 6c 69 74 65 6d 73 29 (cdr allitems)
3f40: 29 29 0a 09 20 20 20 20 3b 3b 20 28 6c 61 6d 62 )).. ;; (lamb
3f50: 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b da (itemdat) ;;;
3f60: 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 ((ripeness "ove
3f70: 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 rripe") (tempera
3f80: 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 ture "cool") (se
3f90: 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a ason "summer")).
3fa0: 09 20 20 20 20 3b 3b 20 48 61 6e 64 6c 65 20 6c . ;; Handle l
3fb0: 69 73 74 73 20 6f 66 20 69 74 65 6d 73 0a 09 20 ists of items..
3fc0: 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d (let* ((item-
3fd0: 70 61 74 68 20 20 20 20 20 28 69 74 65 6d 2d 6c path (item-l
3fe0: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
3ff0: 74 29 29 20 3b 3b 20 28 73 74 72 69 6e 67 2d 69 t)) ;; (string-i
4000: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 ntersperse (map
4010: 63 61 64 72 20 69 74 65 6d 64 61 74 29 20 22 2f cadr itemdat) "/
4020: 22 29 29 0a 09 09 20 20 20 28 6e 65 77 2d 74 65 "))... (new-te
4030: 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d st-path (string-
4040: 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e intersperse (con
4050: 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 s test-path (map
4060: 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 cadr itemdat))
4070: 22 2f 22 29 29 0a 09 09 20 20 20 28 6e 65 77 2d "/"))... (new-
4080: 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 test-name (if (e
4090: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
40a0: 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 "") test-name (c
40b0: 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f onc test-name "/
40c0: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b " item-path))) ;
40d0: 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 ; just need it t
40e0: 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 09 20 20 o be unique...
40f0: 20 28 74 65 73 74 64 61 74 20 20 20 23 66 29 0a (testdat #f).
4100: 09 09 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e .. (num-runnin
4110: 67 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d g (db:get-count-
4120: 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 tests-running db
4130: 29 29 0a 09 09 20 20 20 28 6d 61 78 2d 63 6f 6e ))... (max-con
4140: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f current-jobs (co
4150: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e nfig-lookup *con
4160: 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 figdat* "setup"
4170: 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f "max_concurrent_
4180: 6a 6f 62 73 22 29 29 0a 09 09 20 20 20 28 70 61 jobs"))... (pa
4190: 72 65 6e 74 2d 74 65 73 74 20 28 61 6e 64 20 28 rent-test (and (
41a0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 not (null? items
41b0: 29 29 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 ))(equal? item-p
41c0: 61 74 68 20 22 22 29 29 29 0a 09 09 20 20 20 28 ath "")))... (
41d0: 73 69 6e 67 6c 65 2d 74 65 73 74 20 28 61 6e 64 single-test (and
41e0: 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 20 28 (null? items) (
41f0: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
4200: 20 22 22 29 29 29 0a 09 09 20 20 20 28 69 74 65 "")))... (ite
4210: 6d 2d 74 65 73 74 20 20 20 28 6e 6f 74 20 28 65 m-test (not (e
4220: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
4230: 22 22 29 29 29 29 0a 09 20 20 20 20 20 20 28 64 "")))).. (d
4240: 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 6d 61 ebug:print 3 "ma
4250: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
4260: 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 s: " max-concurr
4270: 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d ent-jobs ", num-
4280: 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 running: " num-r
4290: 75 6e 6e 69 6e 67 29 0a 09 20 20 20 20 20 20 28 unning).. (
42a0: 69 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e if (runs:can-run
42b0: 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a -more-tests db).
42c0: 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 .. (begin...
42d0: 20 28 6c 65 74 20 6c 6f 6f 70 32 20 28 28 74 73 (let loop2 ((ts
42e0: 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e (db:get-test-in
42f0: 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 fo db run-id tes
4300: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
4310: 29 29 20 3b 3b 20 23 66 29 0a 09 09 09 09 28 63 )) ;; #f).....(c
4320: 74 20 30 29 29 0a 09 09 20 20 20 20 20 20 28 69 t 0))... (i
4330: 66 20 28 61 6e 64 20 28 6e 6f 74 20 74 73 29 0a f (and (not ts).
4340: 09 09 09 20 20 20 20 20 20 20 28 3c 20 63 74 20 ... (< ct
4350: 31 30 29 29 0a 09 09 09 20 20 28 62 65 67 69 6e 10)).... (begin
4360: 0a 09 09 09 20 20 20 20 28 72 65 67 69 73 74 65 .... (registe
4370: 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 r-test db run-id
4380: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
4390: 70 61 74 68 20 74 61 67 73 29 0a 09 09 09 20 20 path tags)....
43a0: 20 20 28 64 62 3a 74 65 73 74 2d 73 65 74 2d 63 (db:test-set-c
43b0: 6f 6d 6d 65 6e 74 20 64 62 20 72 75 6e 2d 69 64 omment db run-id
43c0: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
43d0: 70 61 74 68 20 22 22 29 0a 09 09 09 20 20 20 20 path "")....
43e0: 28 6c 6f 6f 70 32 20 28 64 62 3a 67 65 74 2d 74 (loop2 (db:get-t
43f0: 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d est-info db run-
4400: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
4410: 6d 2d 70 61 74 68 29 0a 09 09 09 09 20 20 20 28 m-path)..... (
4420: 2b 20 63 74 20 31 29 29 29 0a 09 09 09 20 20 28 + ct 1))).... (
4430: 69 66 20 74 73 0a 09 09 09 20 20 20 20 20 20 28 if ts.... (
4440: 73 65 74 21 20 74 65 73 74 64 61 74 20 74 73 29 set! testdat ts)
4450: 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e .... (begin
4460: 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e .....(debug:prin
4470: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 43 6f t 0 "WARNING: Co
4480: 75 6c 64 6e 27 74 20 72 65 67 69 73 74 65 72 20 uldn't register
4490: 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 test " test-name
44a0: 20 22 20 77 69 74 68 20 69 74 65 6d 20 70 61 74 " with item pat
44b0: 68 20 22 20 69 74 65 6d 2d 70 61 74 68 20 22 2c h " item-path ",
44c0: 20 73 6b 69 70 70 69 6e 67 22 29 0a 09 09 09 09 skipping").....
44d0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
44e0: 74 61 6c 29 29 0a 09 09 09 09 20 20 20 20 28 6c tal))..... (l
44f0: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 oop (car tal)(cd
4500: 72 20 74 61 6c 29 29 29 29 29 29 29 0a 09 09 20 r tal)))))))...
4510: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
4520: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a tory test-path).
4530: 09 09 20 20 20 20 3b 3b 20 74 68 69 73 20 62 6c .. ;; this bl
4540: 6f 63 6b 20 69 73 20 68 65 72 65 20 6f 6e 6c 79 ock is here only
4550: 20 74 6f 20 69 6e 66 6f 72 6d 20 74 68 65 20 75 to inform the u
4560: 73 65 72 20 65 61 72 6c 79 20 6f 6e 0a 09 09 20 ser early on...
4570: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 (if (file-exi
4580: 73 74 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 sts? runconfigf)
4590: 0a 09 09 09 28 73 65 74 75 70 2d 65 6e 76 2d 64 ....(setup-env-d
45a0: 65 66 61 75 6c 74 73 20 64 62 20 72 75 6e 63 6f efaults db runco
45b0: 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 2a 61 6c nfigf run-id *al
45c0: 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 6e 63 6f ready-seen-runco
45d0: 6e 66 69 67 2d 69 6e 66 6f 2a 29 0a 09 09 09 28 nfig-info*)....(
45e0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
45f0: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e ARNING: You do n
4600: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f ot have a run co
4610: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e nfig file: " run
4620: 63 6f 6e 66 69 67 66 29 29 0a 09 09 20 20 20 20 configf))...
4630: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
4640: 72 75 6e 2d 69 64 3a 20 22 20 72 75 6e 2d 69 64 run-id: " run-id
4650: 20 22 20 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 " test-name: "
4660: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 74 65 6d test-name " item
4670: 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61 -path: " item-pa
4680: 74 68 20 22 20 74 65 73 74 64 61 74 3a 20 22 20 th " testdat: "
4690: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
46a0: 20 74 65 73 74 64 61 74 29 20 22 20 74 65 73 74 testdat) " test
46b0: 2d 73 74 61 74 65 3a 20 22 20 28 74 65 73 74 3a -state: " (test:
46c0: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
46d0: 74 29 29 0a 09 09 20 20 20 20 28 63 61 73 65 20 t))... (case
46e0: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (if (args:get-ar
46f0: 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 20 g "-force")....
4700: 20 20 20 20 20 27 4e 4f 54 5f 53 54 41 52 54 45 'NOT_STARTE
4710: 44 0a 09 09 09 20 20 20 20 20 20 28 69 66 20 74 D.... (if t
4720: 65 73 74 64 61 74 0a 09 09 09 09 20 20 28 73 74 estdat..... (st
4730: 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 ring->symbol (te
4740: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
4750: 74 64 61 74 29 29 0a 09 09 09 09 20 20 27 66 61 tdat))..... 'fa
4760: 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 iled-to-insert))
4770: 0a 09 09 20 20 20 20 20 20 28 28 66 61 69 6c 65 ... ((faile
4780: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 09 20 d-to-insert)...
4790: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
47a0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 nt 0 "ERROR: Fai
47b0: 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68 led to insert th
47c0: 65 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 e record into th
47d0: 65 20 64 62 22 29 29 0a 09 09 20 20 20 20 20 20 e db"))...
47e0: 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f ((NOT_STARTED CO
47f0: 4d 50 4c 45 54 45 44 29 0a 09 09 20 20 20 20 20 MPLETED)...
4800: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 (debug:print 6
4810: 20 22 47 6f 74 20 68 65 72 65 2c 20 22 20 28 74 "Got here, " (t
4820: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
4830: 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 20 20 stdat))...
4840: 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 (let ((runflag
4850: 23 66 29 29 0a 09 09 09 20 28 63 6f 6e 64 0a 09 #f)).... (cond..
4860: 09 09 20 20 3b 3b 20 69 2e 65 2e 20 74 68 69 73 .. ;; i.e. this
4870: 20 69 73 20 74 68 65 20 70 61 72 65 6e 74 20 74 is the parent t
4880: 65 73 74 20 74 6f 20 61 20 73 75 69 74 65 20 6f est to a suite o
4890: 66 20 69 74 65 6d 73 2c 20 6e 65 76 65 72 20 22 f items, never "
48a0: 72 75 6e 22 20 69 74 0a 09 09 09 20 20 28 70 61 run" it.... (pa
48b0: 72 65 6e 74 2d 74 65 73 74 0a 09 09 09 20 20 20 rent-test....
48c0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
48d0: 29 29 0a 09 09 09 20 20 3b 3b 20 2d 66 6f 72 63 )).... ;; -forc
48e0: 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 e, run no matter
48f0: 20 77 68 61 74 0a 09 09 09 20 20 28 28 61 72 67 what.... ((arg
4900: 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 s:get-arg "-forc
4910: 65 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 e")(set! runflag
4920: 20 23 74 29 29 0a 09 09 09 20 20 3b 3b 20 4e 4f #t)).... ;; NO
4930: 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e T_STARTED, run n
4940: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 09 o matter what...
4950: 09 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 . ((equal? (tes
4960: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
4970: 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 dat) "NOT_STARTE
4980: 44 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 D")(set! runflag
4990: 20 23 74 29 29 0a 09 09 09 20 20 3b 3b 20 6e 6f #t)).... ;; no
49a0: 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 t -rerun and PAS
49b0: 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b S, WARN or CHECK
49c0: 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 09 09 20 , do no run....
49d0: 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 ((and (or (not
49e0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
49f0: 72 65 72 75 6e 22 29 29 0a 09 09 09 09 20 20 20 rerun")).....
4a00: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
4a10: 2d 6b 65 65 70 67 6f 69 6e 67 22 29 29 0a 09 09 -keepgoing"))...
4a20: 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a ..(member (test:
4a30: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
4a40: 61 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41 at) '("PASS" "WA
4a50: 52 4e 22 20 22 43 48 45 43 4b 22 29 29 29 0a 09 RN" "CHECK")))..
4a60: 09 09 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c .. (set! runfl
4a70: 61 67 20 23 66 29 29 0a 09 09 09 20 20 3b 3b 20 ag #f)).... ;;
4a80: 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 -rerun and statu
4a90: 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 s is one of the
4aa0: 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 specifed, run it
4ab0: 0a 09 09 09 20 20 28 28 61 6e 64 20 28 61 72 67 .... ((and (arg
4ac0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 s:get-arg "-reru
4ad0: 6e 22 29 0a 09 09 09 09 28 6c 65 74 20 28 28 72 n").....(let ((r
4ae0: 65 72 75 6e 6c 73 74 20 28 73 74 72 69 6e 67 2d erunlst (string-
4af0: 73 70 6c 69 74 20 28 61 72 67 73 3a 67 65 74 2d split (args:get-
4b00: 61 72 67 20 22 2d 72 65 72 75 6e 22 29 20 22 2c arg "-rerun") ",
4b10: 22 29 29 29 20 3b 3b 20 46 41 49 4c 2c 0a 09 09 "))) ;; FAIL,...
4b20: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 .. (member (tes
4b30: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
4b40: 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 tdat) rerunlst))
4b50: 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 75 ).... (set! ru
4b60: 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 20 20 nflag #t))....
4b70: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 64 ;; -keepgoing, d
4b80: 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 4c o not rerun FAIL
4b90: 0a 09 09 09 20 20 28 28 61 6e 64 20 28 61 72 67 .... ((and (arg
4ba0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 s:get-arg "-keep
4bb0: 67 6f 69 6e 67 22 29 0a 09 09 09 09 28 6d 65 6d going").....(mem
4bc0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
4bd0: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 atus testdat) '(
4be0: 22 46 41 49 4c 22 29 29 29 0a 09 09 09 20 20 20 "FAIL")))....
4bf0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
4c00: 29 29 0a 09 09 09 20 20 28 28 61 6e 64 20 28 6e )).... ((and (n
4c10: 6f 74 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 ot (args:get-arg
4c20: 20 22 2d 72 65 72 75 6e 22 29 29 0a 09 09 09 09 "-rerun")).....
4c30: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
4c40: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
4c50: 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 ) '("FAIL" "n/a"
4c60: 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 ))).... (set!
4c70: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 runflag #t))....
4c80: 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 (else (set! ru
4c90: 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 09 09 20 nflag #f)))....
4ca0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 (debug:print 6 "
4cb0: 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c RUNNING => runfl
4cc0: 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 ag: " runflag "
4cd0: 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 STATE: " (test:g
4ce0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
4cf0: 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 ) " STATUS: " (t
4d00: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
4d10: 65 73 74 64 61 74 29 29 0a 09 09 09 20 28 69 66 estdat)).... (if
4d20: 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 (not runflag)..
4d30: 09 09 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 .. (if (not
4d40: 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 09 parent-test)....
4d50: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
4d60: 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 "NOTE: Not star
4d70: 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d ting test " new-
4d80: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 test-name " as i
4d90: 74 20 69 73 20 73 74 61 74 65 20 5c 22 43 4f 4d t is state \"COM
4da0: 50 4c 45 54 45 44 5c 22 20 61 6e 64 20 73 74 61 PLETED\" and sta
4db0: 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 tus \"" (test:ge
4dc0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
4dd0: 29 20 22 5c 22 2c 20 75 73 65 20 2d 66 6f 72 63 ) "\", use -forc
4de0: 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 e to override"))
4df0: 0a 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 .... (let* (
4e00: 28 67 65 74 2d 70 72 65 72 65 71 73 2d 63 6d 64 (get-prereqs-cmd
4e10: 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 09 09 (lambda ().....
4e20: 09 09 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 .. (db-get
4e30: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 -prereqs-not-met
4e40: 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f db run-id waito
4e50: 6e 29 29 29 20 3b 3b 20 63 68 65 63 6b 20 62 65 n))) ;; check be
4e60: 66 6f 72 65 20 72 75 6e 6e 69 6e 67 20 2e 2e 2e fore running ...
4e70: 2e 0a 09 09 09 09 20 20 20 20 28 6c 61 75 6e 63 ...... (launc
4e80: 68 2d 63 6d 64 20 20 20 20 20 20 28 6c 61 6d 62 h-cmd (lamb
4e90: 64 61 20 28 29 0a 09 09 09 09 09 09 20 20 20 20 da ().......
4ea0: 20 20 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 (launch-test
4eb0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 63 db run-id test-c
4ec0: 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 onf keyvallst te
4ed0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 st-name test-pat
4ee0: 68 20 69 74 65 6d 64 61 74 29 29 29 0a 09 09 09 h itemdat)))....
4ef0: 09 20 20 20 20 28 74 65 73 74 72 75 6e 64 61 74 . (testrundat
4f00: 20 20 20 20 20 20 28 6c 69 73 74 20 67 65 74 2d (list get-
4f10: 70 72 65 72 65 71 73 2d 63 6d 64 20 6c 61 75 6e prereqs-cmd laun
4f20: 63 68 2d 63 6d 64 29 29 29 0a 09 09 09 20 20 20 ch-cmd)))....
4f30: 20 20 20 20 28 69 66 20 28 6f 72 20 28 61 72 67 (if (or (arg
4f40: 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 s:get-arg "-forc
4f50: 65 22 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 e")..... (
4f60: 6e 75 6c 6c 3f 20 28 28 63 61 72 20 74 65 73 74 null? ((car test
4f70: 72 75 6e 64 61 74 29 29 29 29 20 3b 3b 20 61 72 rundat)))) ;; ar
4f80: 65 20 74 68 65 72 65 20 61 6e 79 20 74 65 73 74 e there any test
4f90: 73 20 74 68 61 74 20 6d 75 73 74 20 62 65 20 72 s that must be r
4fa0: 75 6e 20 62 65 66 6f 72 65 20 74 68 69 73 20 6f un before this o
4fb0: 6e 65 2e 2e 2e 0a 09 09 09 09 20 20 20 28 69 66 ne........ (if
4fc0: 20 28 6e 6f 74 20 28 28 63 61 64 72 20 74 65 73 (not ((cadr tes
4fd0: 74 72 75 6e 64 61 74 29 29 29 20 3b 3b 20 74 68 trundat))) ;; th
4fe0: 69 73 20 69 73 20 74 68 65 20 6c 69 6e 65 20 74 is is the line t
4ff0: 68 61 74 20 6c 61 75 6e 63 68 65 73 20 74 68 65 hat launches the
5000: 20 74 65 73 74 20 74 6f 20 74 68 65 20 72 65 6d test to the rem
5010: 6f 74 65 20 68 6f 73 74 0a 09 09 09 09 20 20 20 ote host.....
5020: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 09 (begin......
5030: 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 (print "ERROR:
5040: 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 Failed to launch
5050: 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 the test. Exiti
5060: 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f ng as soon as po
5070: 73 73 69 62 6c 65 22 29 0a 09 09 09 09 09 20 28 ssible")...... (
5080: 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 set! *globalexit
5090: 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 status* 1) ;; ..
50a0: 09 09 09 09 20 28 70 72 6f 63 65 73 73 2d 73 69 .... (process-si
50b0: 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 gnal (current-pr
50c0: 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c ocess-id) signal
50d0: 2f 6b 69 6c 6c 29 0a 09 09 09 09 09 20 3b 28 65 /kill)...... ;(e
50e0: 78 69 74 20 31 29 0a 09 09 09 09 09 20 29 29 0a xit 1)...... )).
50f0: 09 09 09 09 20 20 20 28 69 66 20 28 6e 6f 74 20 .... (if (not
5100: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
5110: 6b 65 65 70 67 6f 69 6e 67 22 29 29 0a 09 09 09 keepgoing"))....
5120: 09 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 . (hash-ta
5130: 62 6c 65 2d 73 65 74 21 20 2a 77 61 69 74 69 6e ble-set! *waitin
5140: 67 2d 71 75 65 75 65 2a 20 6e 65 77 2d 74 65 73 g-queue* new-tes
5150: 74 2d 6e 61 6d 65 20 74 65 73 74 72 75 6e 64 61 t-name testrunda
5160: 74 29 29 29 29 29 29 29 0a 09 09 20 20 20 20 20 t)))))))...
5170: 20 28 28 4b 49 4c 4c 45 44 29 20 0a 09 09 20 20 ((KILLED) ...
5180: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
5190: 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 t 1 "NOTE: " new
51a0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 -test-name " is
51b0: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 already running
51c0: 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79 or was explictly
51d0: 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f killed, use -fo
51e0: 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 rce to launch it
51f0: 2e 22 29 29 0a 09 09 20 20 20 20 20 20 28 28 4c ."))... ((L
5200: 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f AUNCHED REMOTEHO
5210: 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 STSTART RUNNING)
5220: 20 20 0a 09 09 20 20 20 20 20 20 20 28 69 66 20 ... (if
5230: 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 (> (- (current-s
5240: 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 econds)(+ (db:te
5250: 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d st-get-event_tim
5260: 65 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 09 e testdat)......
5270: 09 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 . (db:test-g
5280: 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 et-run_duration
5290: 74 65 73 74 64 61 74 29 29 29 0a 09 09 09 20 20 testdat)))....
52a0: 20 20 20 20 31 30 30 29 20 3b 3b 20 69 2e 65 2e 100) ;; i.e.
52b0: 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d no update for m
52c0: 6f 72 65 20 74 68 61 6e 20 31 30 30 20 73 65 63 ore than 100 sec
52d0: 6f 6e 64 73 0a 09 09 09 20 20 20 28 62 65 67 69 onds.... (begi
52e0: 6e 0a 09 09 09 20 20 20 20 20 28 64 65 62 75 67 n.... (debug
52f0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e :print 0 "WARNIN
5300: 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e G: Test " test-n
5310: 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f ame " appears to
5320: 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e be dead. Forcin
5330: 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e g it to state IN
5340: 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 COMPLETE and sta
5350: 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 tus STUCK/DEAD")
5360: 0a 09 09 09 20 20 20 20 20 28 74 65 73 74 2d 73 .... (test-s
5370: 65 74 2d 73 74 61 74 75 73 21 20 64 62 20 72 75 et-status! db ru
5380: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 22 n-id test-name "
5390: 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 INCOMPLETE" "STU
53a0: 43 4b 2f 44 45 41 44 22 20 69 74 65 6d 64 61 74 CK/DEAD" itemdat
53b0: 20 22 54 65 73 74 20 69 73 20 73 74 75 63 6b 20 "Test is stuck
53c0: 6f 72 20 64 65 61 64 22 29 29 0a 09 09 09 20 20 or dead"))....
53d0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
53e0: 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 "NOTE: " test-na
53f0: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
5400: 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 09 20 20 running")))...
5410: 20 20 20 20 28 65 6c 73 65 20 20 20 20 20 20 20 (else
5420: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
5430: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
5440: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e launch test " n
5450: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 ew-test-name ".
5460: 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 Unrecognised sta
5470: 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 te " (test:get-s
5480: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29 29 tate testdat))))
5490: 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e )).. (if (n
54a0: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a ot (null? tal)).
54b0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 .. (loop (car t
54c0: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 al)(cdr tal)))))
54d0: 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 ))))..(define (r
54e0: 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 73 un-waiting-tests
54f0: 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 6e 75 db). (let ((nu
5500: 6d 74 72 69 65 73 20 20 20 20 20 20 20 20 20 20 mtries
5510: 20 30 29 0a 09 28 6c 61 73 74 2d 74 72 79 2d 74 0)..(last-try-t
5520: 69 6d 65 20 20 20 20 20 20 28 63 75 72 72 65 6e ime (curren
5530: 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 28 74 69 t-seconds))..(ti
5540: 6d 65 73 20 20 20 20 20 20 20 20 20 20 20 20 20 mes
5550: 20 28 6c 69 73 74 20 31 29 29 29 20 3b 3b 20 6d (list 1))) ;; m
5560: 69 6e 75 74 65 73 20 74 6f 20 77 61 69 74 20 62 inutes to wait b
5570: 65 66 6f 72 65 20 74 72 79 69 6e 67 20 61 67 61 efore trying aga
5580: 69 6e 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 72 in to kick off r
5590: 75 6e 73 0a 20 20 20 20 3b 3b 20 42 55 47 20 74 uns. ;; BUG t
55a0: 68 69 73 20 68 61 63 6b 20 6f 66 20 62 72 75 74 his hack of brut
55b0: 65 20 66 6f 72 63 65 20 72 65 74 72 79 69 6e 67 e force retrying
55c0: 20 77 6f 72 6b 73 20 71 75 69 74 65 20 77 65 6c works quite wel
55d0: 6c 20 66 6f 72 20 6d 61 6e 79 20 63 61 73 65 73 l for many cases
55e0: 20 62 75 74 20 0a 20 20 20 20 3b 3b 20 20 20 20 but . ;;
55f0: 20 77 68 61 74 20 69 73 20 6e 65 65 64 65 64 20 what is needed
5600: 69 73 20 74 6f 20 63 68 65 63 6b 20 74 68 65 20 is to check the
5610: 64 62 20 66 6f 72 20 74 65 73 74 73 20 74 68 61 db for tests tha
5620: 74 20 68 61 76 65 20 66 61 69 6c 65 64 20 6c 65 t have failed le
5630: 73 73 20 74 68 61 6e 0a 20 20 20 20 3b 3b 20 20 ss than. ;;
5640: 20 20 20 4e 20 74 69 6d 65 73 20 6f 72 20 6e 65 N times or ne
5650: 76 65 72 20 62 65 65 6e 20 73 74 61 72 74 65 64 ver been started
5660: 20 61 6e 64 20 6b 69 63 6b 20 74 68 65 6d 20 6f and kick them o
5670: 66 66 20 61 67 61 69 6e 0a 20 20 20 20 28 6c 65 ff again. (le
5680: 74 20 6c 6f 6f 70 20 28 28 77 61 69 74 69 6e 67 t loop ((waiting
5690: 2d 74 65 73 74 2d 6e 61 6d 65 73 20 28 68 61 73 -test-names (has
56a0: 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 2a 77 61 h-table-keys *wa
56b0: 69 74 69 6e 67 2d 71 75 65 75 65 2a 29 29 29 0a iting-queue*))).
56c0: 20 20 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 (cond.
56d0: 20 20 20 28 28 6e 6f 74 20 28 72 75 6e 73 3a 63 ((not (runs:c
56e0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
56f0: 73 20 64 62 29 29 0a 09 28 73 6c 65 65 70 20 32 s db))..(sleep 2
5700: 29 0a 09 28 6c 6f 6f 70 20 77 61 69 74 69 6e 67 )..(loop waiting
5710: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 20 20 -test-names)).
5720: 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 77 61 69 ((null? wai
5730: 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 73 29 ting-test-names)
5740: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 ..(debug:print 1
5750: 20 22 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e "All tests laun
5760: 63 68 65 64 22 29 29 0a 20 20 20 20 20 20 20 28 ched")). (
5770: 65 6c 73 65 0a 09 28 73 65 74 21 20 6e 75 6d 74 else..(set! numt
5780: 72 69 65 73 20 28 2b 20 6e 75 6d 74 72 69 65 73 ries (+ numtries
5790: 20 31 29 29 0a 09 28 66 6f 72 2d 65 61 63 68 20 1))..(for-each
57a0: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 6e 61 6d (lambda (testnam
57b0: 65 29 0a 09 09 20 20 20 20 28 69 66 20 28 72 75 e)... (if (ru
57c0: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
57d0: 74 65 73 74 73 20 64 62 29 0a 09 09 09 28 6c 65 tests db)....(le
57e0: 74 2a 20 28 28 74 65 73 74 64 61 74 20 28 68 61 t* ((testdat (ha
57f0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 2a 77 61 sh-table-ref *wa
5800: 69 74 69 6e 67 2d 71 75 65 75 65 2a 20 74 65 73 iting-queue* tes
5810: 74 6e 61 6d 65 29 29 0a 09 09 09 20 20 20 20 20 tname))....
5820: 20 20 28 70 72 65 72 65 71 73 20 28 28 63 61 72 (prereqs ((car
5830: 20 74 65 73 74 64 61 74 29 29 29 0a 09 09 09 20 testdat)))....
5840: 20 20 20 20 20 20 28 6c 64 62 20 20 20 20 20 28 (ldb (
5850: 69 66 20 64 62 20 64 62 20 28 6f 70 65 6e 2d 64 if db db (open-d
5860: 62 29 29 29 29 0a 09 09 09 20 20 28 64 65 62 75 b)))).... (debu
5870: 67 3a 70 72 69 6e 74 20 32 20 22 70 72 65 72 65 g:print 2 "prere
5880: 71 73 20 72 65 6d 61 69 6e 69 6e 67 3a 20 22 20 qs remaining: "
5890: 70 72 65 72 65 71 73 29 0a 09 09 09 20 20 28 69 prereqs).... (i
58a0: 66 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 f (null? prereqs
58b0: 29 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 ).... (begi
58c0: 6e 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 n.....(debug:pri
58d0: 6e 74 20 32 20 22 50 72 65 72 65 71 75 69 73 69 nt 2 "Prerequisi
58e0: 74 65 73 20 6d 65 74 2c 20 6c 61 75 6e 63 68 69 tes met, launchi
58f0: 6e 67 20 22 20 74 65 73 74 6e 61 6d 65 29 0a 09 ng " testname)..
5900: 09 09 09 28 28 63 61 64 72 20 74 65 73 74 64 61 ...((cadr testda
5910: 74 29 29 0a 09 09 09 09 28 68 61 73 68 2d 74 61 t)).....(hash-ta
5920: 62 6c 65 2d 64 65 6c 65 74 65 21 20 2a 77 61 69 ble-delete! *wai
5930: 74 69 6e 67 2d 71 75 65 75 65 2a 20 74 65 73 74 ting-queue* test
5940: 6e 61 6d 65 29 29 29 0a 09 09 09 20 20 28 69 66 name))).... (if
5950: 20 28 6e 6f 74 20 64 62 29 0a 09 09 09 20 20 20 (not db)....
5960: 20 20 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 (sqlite3:fina
5970: 6c 69 7a 65 21 20 6c 64 62 29 29 29 29 29 0a 09 lize! ldb)))))..
5980: 09 20 20 77 61 69 74 69 6e 67 2d 74 65 73 74 2d . waiting-test-
5990: 6e 61 6d 65 73 29 0a 09 3b 3b 20 28 73 6c 65 65 names)..;; (slee
59a0: 70 20 31 30 29 20 3b 3b 20 6e 6f 20 70 6f 69 6e p 10) ;; no poin
59b0: 74 20 69 6e 20 72 75 73 68 69 6e 67 20 74 68 69 t in rushing thi
59c0: 6e 67 73 20 61 74 20 74 68 69 73 20 73 74 61 67 ngs at this stag
59d0: 65 3f 0a 09 28 6c 6f 6f 70 20 28 68 61 73 68 2d e?..(loop (hash-
59e0: 74 61 62 6c 65 2d 6b 65 79 73 20 2a 77 61 69 74 table-keys *wait
59f0: 69 6e 67 2d 71 75 65 75 65 2a 29 29 29 29 29 29 ing-queue*))))))
5a00: 29 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 2d )..(define (get-
5a10: 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 dir-up-n dir . p
5a20: 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 arams) . (let (
5a30: 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 (dparts (string
5a40: 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 29 29 -split dir "/"))
5a50: 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 20 28 ..(count (if (
5a60: 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 null? params) 1
5a70: 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 29 0a (car params)))).
5a80: 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 (conc "/" (s
5a90: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
5aa0: 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 6b 65 e .. (take
5ab0: 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 dparts (- (leng
5ac0: 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 6e 74 th dparts) count
5ad0: 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 29 29 )).. "/"))
5ae0: 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e )).;; Remove run
5af0: 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 65 20 s.;; fields are
5b00: 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 passing in throu
5b10: 67 68 20 0a 28 64 65 66 69 6e 65 20 28 72 75 6e gh .(define (run
5b20: 73 3a 72 65 6d 6f 76 65 2d 72 75 6e 73 20 64 62 s:remove-runs db
5b30: 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 runnamepatt tes
5b40: 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 29 0a tpatt itempatt).
5b50: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 (let* ((keys
5b60: 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b 65 (db-get-ke
5b70: 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61 ys db)).. (runda
5b80: 74 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 t (runs:get
5b90: 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 -runs-by-patt db
5ba0: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 keys runnamepat
5bb0: 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 t)).. (header
5bc0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 (vector-ref r
5bd0: 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e undat 0)).. (run
5be0: 73 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 s (vector
5bf0: 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 -ref rundat 1)))
5c00: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
5c10: 74 20 31 20 22 48 65 61 64 65 72 3a 20 22 20 68 t 1 "Header: " h
5c20: 65 61 64 65 72 29 0a 20 20 20 20 28 66 6f 72 2d eader). (for-
5c30: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 each. (lambd
5c40: 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28 a (run). (
5c50: 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74 let ((runkey (st
5c60: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
5c70: 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b (map (lambda (k
5c80: 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d ).......(db:get-
5c90: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
5ca0: 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 63 74 run header (vect
5cb0: 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65 or-ref k 0))) ke
5cc0: 79 73 29 20 22 2f 22 29 29 29 0a 09 20 28 6c 65 ys) "/"))).. (le
5cd0: 74 2a 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a t* ((run-id (db:
5ce0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
5cf0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
5d00: 69 64 22 29 20 29 0a 09 09 28 74 65 73 74 73 20 id") )...(tests
5d10: 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 (db-get-tests-f
5d20: 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 or-run db (db:ge
5d30: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
5d40: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 r run header "id
5d50: 22 29 20 74 65 73 74 70 61 74 74 20 69 74 65 6d ") testpatt item
5d60: 70 61 74 74 29 29 0a 09 09 28 6c 61 73 74 74 70 patt))...(lasttp
5d70: 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 ath "/does/not/e
5d80: 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 09 xist/I/hope"))..
5d90: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c (if (not (nul
5da0: 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20 l? tests))..
5db0: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 64 65 (begin... (de
5dc0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d bug:print 1 "Rem
5dd0: 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 oving tests for
5de0: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 run: " runkey "
5df0: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d " (db:get-value-
5e00: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
5e10: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 ader "runname"))
5e20: 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 ... (for-each...
5e30: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 (lambda (test)
5e40: 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69 ... (let* ((i
5e50: 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 tem-path (db:tes
5e60: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t-get-item-path
5e70: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 65 test)).... (te
5e80: 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 st-name (db:test
5e90: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
5ea0: 73 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d st)).... (run-
5eb0: 64 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67 dir (db:test-g
5ec0: 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29 et-rundir test))
5ed0: 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 )... (debug
5ee0: 3a 70 72 69 6e 74 20 31 20 22 20 20 22 20 28 64 :print 1 " " (d
5ef0: 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e b:test-get-testn
5f00: 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 ame test) " id:
5f10: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
5f20: 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65 6d d test) " " item
5f30: 2d 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 28 -path)... (
5f40: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 db:delete-test-r
5f50: 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a 74 65 ecords db (db:te
5f60: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 st-get-id test))
5f70: 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 3e 20 ... (if (>
5f80: 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 (string-length r
5f90: 75 6e 2d 64 69 72 29 20 35 29 20 3b 3b 20 62 61 un-dir) 5) ;; ba
5fa0: 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74 20 d heuristic but
5fb0: 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f should prevent /
5fc0: 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 tmp /home etc...
5fd0: 09 09 20 20 28 6c 65 74 20 28 28 66 75 6c 6c 70 .. (let ((fullp
5fe0: 61 74 68 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b ath run-dir)) ;;
5ff0: 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 "/" (db:test-ge
6000: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 t-item-path test
6010: 29 29 29 29 0a 09 09 09 20 20 20 20 28 73 65 74 )))).... (set
6020: 21 20 6c 61 73 74 74 70 61 74 68 20 66 75 6c 6c ! lasttpath full
6030: 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 64 65 path).... (de
6040: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 72 6d 20 bug:print 1 "rm
6050: 2d 72 66 20 22 20 66 75 6c 6c 70 61 74 68 29 0a -rf " fullpath).
6060: 09 09 09 20 20 20 20 28 73 79 73 74 65 6d 20 28 ... (system (
6070: 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 66 conc "rm -rf " f
6080: 75 6c 6c 70 61 74 68 29 29 0a 09 09 09 20 20 20 ullpath))....
6090: 20 28 6c 65 74 2a 20 28 28 64 69 72 73 2d 63 6f (let* ((dirs-co
60a0: 75 6e 74 20 28 2b 20 31 20 28 6c 65 6e 67 74 68 unt (+ 1 (length
60b0: 20 6b 65 79 73 29 28 6c 65 6e 67 74 68 20 28 73 keys)(length (s
60c0: 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 6d tring-split item
60d0: 2d 70 61 74 68 20 22 2f 22 29 29 29 29 0a 09 09 -path "/"))))...
60e0: 09 09 20 20 20 28 64 69 72 2d 74 6f 2d 72 65 6d .. (dir-to-rem
60f0: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 66 (get-dir-up-n f
6100: 75 6c 6c 70 61 74 68 20 64 69 72 73 2d 63 6f 75 ullpath dirs-cou
6110: 6e 74 29 29 0a 09 09 09 09 20 20 20 28 72 65 6d nt))..... (rem
6120: 61 69 6e 69 6e 67 64 20 28 73 74 72 69 6e 67 2d ainingd (string-
6130: 73 75 62 73 74 69 74 75 74 65 20 28 72 65 67 65 substitute (rege
6140: 78 70 20 28 63 6f 6e 63 20 22 5e 22 20 64 69 72 xp (conc "^" dir
6150: 2d 74 6f 2d 72 65 6d 20 22 2f 22 29 29 20 22 22 -to-rem "/")) ""
6160: 20 66 75 6c 6c 70 61 74 68 29 29 0a 09 09 09 09 fullpath)).....
6170: 20 20 20 28 63 6d 64 20 28 63 6f 6e 63 20 22 63 (cmd (conc "c
6180: 64 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 d " dir-to-rem "
6190: 3b 20 72 6d 64 69 72 20 2d 70 20 22 20 72 65 6d ; rmdir -p " rem
61a0: 61 69 6e 69 6e 67 64 20 29 29 29 0a 09 09 09 20 ainingd )))....
61b0: 20 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 (if (file-e
61c0: 78 69 73 74 73 3f 20 66 75 6c 6c 70 61 74 68 29 xists? fullpath)
61d0: 0a 09 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 ..... (begin...
61e0: 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 .. (debug:pri
61f0: 6e 74 20 31 20 63 6d 64 29 0a 09 09 09 09 20 20 nt 1 cmd).....
6200: 20 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 29 (system cmd)))
6210: 0a 09 09 09 20 20 20 20 20 20 29 29 0a 09 09 09 .... ))....
6220: 20 20 20 20 29 29 29 0a 09 09 20 20 20 20 74 65 )))... te
6230: 73 74 73 29 29 29 0a 09 20 20 20 28 6c 65 74 20 sts))).. (let
6240: 28 28 72 65 6d 74 65 73 74 73 20 28 64 62 2d 67 ((remtests (db-g
6250: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e et-tests-for-run
6260: 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 db (db:get-valu
6270: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
6280: 68 65 61 64 65 72 20 22 69 64 22 29 29 29 29 0a header "id")))).
6290: 09 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f . (if (null?
62a0: 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f remtests) ;; no
62b0: 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61 more tests rema
62c0: 69 6e 69 6e 67 0a 09 09 20 28 6c 65 74 2a 20 28 ining... (let* (
62d0: 28 64 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 (dparts (string
62e0: 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 -split lasttpath
62f0: 20 22 2f 22 29 29 0a 09 09 09 28 72 75 6e 70 61 "/"))....(runpa
6300: 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 th (conc "/" (st
6310: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
6320: 20 0a 09 09 09 09 09 20 20 20 20 28 74 61 6b 65 ...... (take
6330: 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 dparts (- (leng
6340: 74 68 20 64 70 61 72 74 73 29 20 31 29 29 0a 09 th dparts) 1))..
6350: 09 09 09 09 20 20 20 20 22 2f 22 29 29 29 29 0a .... "/")))).
6360: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e .. (debug:prin
6370: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 t 1 "Removing ru
6380: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 n: " runkey " "
6390: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
63a0: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
63b0: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 er "runname"))..
63c0: 09 20 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 . (db:delete-r
63d0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 un db run-id)...
63e0: 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 ;; need to fi
63f0: 67 75 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 gure out the pat
6400: 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 h to the run dir
6410: 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 and remove it i
6420: 66 20 65 6d 70 74 79 0a 09 09 20 20 20 3b 3b 20 f empty... ;;
6430: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 (if (null? (g
6440: 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 lob (conc runpat
6450: 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 3b h "/*")))... ;
6460: 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a ; (begin.
6470: 09 09 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 .. ;; . (debug
6480: 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 :print 1 "Removi
6490: 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e ng run dir " run
64a0: 70 61 74 68 29 0a 09 09 20 20 20 3b 3b 20 09 20 path)... ;; .
64b0: 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 (system (conc "r
64c0: 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 mdir -p " runpat
64d0: 68 29 29 29 29 0a 09 09 20 20 20 29 29 29 29 0a h))))... )))).
64e0: 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29 . )). runs))
64f0: 29 0a ).