0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30 .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77 06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53 r.;; greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72 .;; This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 RRANTY; without
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70 even the.;; imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 or FITNESS FOR
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20 A PARTICULAR.;;
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73 PURPOSE...;; s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25 trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77 Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a ','localtime')..
0180: 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 74 65 ;; register a te
0190: 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 65 20 st run with the
01a0: 64 62 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 db.(define (regi
01b0: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
01c0: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a ) ;; test-name).
01d0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 72 (let* ((keystr
01e0: 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74 (keys->keyst
01f0: 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d r keys)).. (comm
0200: 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 a (if (> (le
0210: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 2c ngth keys) 0) ",
0220: 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 72 " "")).. (andstr
0230: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 (if (> (leng
0240: 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 4e th keys) 0) " AN
0250: 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c 73 D " "")).. (vals
0260: 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c lots (keys->val
0270: 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b 20 slots keys)) ;;
0280: 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 ?,?,? ..... (key
0290: 76 61 6c 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 vallst (keys->va
02a0: 6c 6c 69 73 74 20 6b 65 79 73 29 29 20 3b 3b 20 llist keys)) ;;
02b0: 65 78 74 72 61 63 74 73 20 74 68 65 20 76 61 6c extracts the val
02c0: 75 65 73 20 66 72 6f 6d 20 72 65 6d 61 69 6e 64 ues from remaind
02d0: 65 72 20 6f 66 20 28 61 72 67 76 29 0a 09 20 28 er of (argv).. (
02e0: 72 75 6e 6e 61 6d 65 20 20 20 28 67 65 74 2d 77 runname (get-w
02f0: 69 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 72 75 ith-default ":ru
0300: 6e 6e 61 6d 65 22 20 23 66 29 29 0a 09 20 28 73 nname" #f)).. (s
0310: 74 61 74 65 20 20 20 20 20 28 67 65 74 2d 77 69 tate (get-wi
0320: 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 th-default ":sta
0330: 74 65 22 20 22 6e 6f 22 29 29 0a 09 20 28 73 74 te" "no")).. (st
0340: 61 74 75 73 20 20 20 20 28 67 65 74 2d 77 69 74 atus (get-wit
0350: 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 74 h-default ":stat
0360: 75 73 22 20 22 6e 2f 61 22 29 29 0a 09 20 28 61 us" "n/a")).. (a
0370: 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 llvals (append
0380: 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20 73 (list runname s
0390: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 tate status user
03a0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03b0: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 (qryvals (appe
03c0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
03d0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03e0: 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 (key=?str (stri
03f0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
0400: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 map (lambda (k)(
0410: 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 conc (key:get-fi
0420: 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 eldname k) "=?")
0430: 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 ) keys) " AND ")
0440: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
0450: 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b int 3 "keys: " k
0460: 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 eys " allvals: "
0470: 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 allvals " keyva
0480: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 llst: " keyvalls
0490: 74 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 t). (debug:pr
04a0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 int 2 "NOTE: usi
04b0: 6e 67 20 6b 65 79 20 22 20 28 73 74 72 69 6e 67 ng key " (string
04c0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 -intersperse key
04d0: 76 61 6c 6c 73 74 20 22 2f 22 29 20 22 20 66 6f vallst "/") " fo
04e0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 r this run").
04f0: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d (if (and runnam
0500: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 e (null? (filter
0510: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 (lambda (x)(not
0520: 20 78 29 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 x)) keyvallst))
0530: 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 ) ;; there must
0540: 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20 be a better way
0550: 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 to "apply and"..
0560: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a (let ((res #f)).
0570: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 . (apply sqlite
0580: 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 3:execute db (co
0590: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 nc "INSERT OR IG
05a0: 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 NORE INTO runs (
05b0: 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 runname,state,st
05c0: 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 atus,owner,event
05d0: 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 _time" comma key
05e0: 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f str ") VALUES (?
05f0: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 ,?,?,?,strftime(
0600: 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d '%s','now')" com
0610: 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 ma valslots ");"
0620: 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 )... allvals)..
0630: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
0640: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 for-each-row ..
0650: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 (lambda (id)..
0660: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69 (set! res i
0670: 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 d)).. db.. (
0680: 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 let ((qry (conc
0690: 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 "SELECT id FROM
06a0: 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e runs WHERE (runn
06b0: 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b ame=? " andstr k
06c0: 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a ey=?str ");"))).
06d0: 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 . ;(debug:pr
06e0: 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 int 4 "qry: " qr
06f0: 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 y) .. qry)..
0700: 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 qryvals).. (
0710: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
0720: 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 db "UPDATE runs
0730: 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 SET state=?,stat
0740: 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b us=? WHERE id=?;
0750: 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 " state status r
0760: 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 es).. res) ..(b
0770: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 egin.. (debug:p
0780: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 rint 0 "ERROR: C
0790: 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c alled without al
07a0: 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 l necessary keys
07b0: 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b ").. #f))))..;;
07c0: 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 runs:get-runs-b
07d0: 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72 75 y-patt.;; get ru
07e0: 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63 72 ns by list of cr
07f0: 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73 74 iteria.;; regist
0800: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 er a test run wi
0810: 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b 20 th the db.;;.;;
0820: 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61 6c Use: (db-get-val
0830: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64 62 ue-by-header (db
0840: 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e 69 :get-header runi
0850: 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77 20 nfo)(db:get-row
0860: 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74 6f runinfo)).;; to
0870: 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66 72 extract info fr
0880: 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 65 om the structure
0890: 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64 65 returned.;;.(de
08a0: 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d 72 fine (runs:get-r
08b0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
08c0: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 eys runnamepatt
08d0: 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65 73 . params) ;; tes
08e0: 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 t-name). (let*
08f0: 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65 79 ((keyvallst (key
0900: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 29 s->vallist keys)
0910: 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28 72 ).. (tmp (r
0920: 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e 2d uns:get-std-run-
0930: 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22 69 fields keys '("i
0940: 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73 74 d" "runname" "st
0950: 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22 6f ate" "status" "o
0960: 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69 6d wner" "event_tim
0970: 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72 20 e"))).. (keystr
0980: 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20 28 (car tmp)).. (
0990: 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20 74 header (cadr t
09a0: 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20 20 mp)).. (res
09b0: 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74 74 '()).. (key-patt
09c0: 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 "")). (for-e
09d0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 ach (lambda (key
09e0: 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b val)...(let* ((k
09f0: 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 ey (vector-re
0a00: 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09 20 f keyval 0))...
0a10: 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28 63 (fulkey (c
0a20: 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 onc ":" key))...
0a30: 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20 28 (patt (
0a40: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75 6c args:get-arg ful
0a50: 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20 70 key)))... (if p
0a60: 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 att... (set
0a70: 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 ! key-patt (conc
0a80: 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 key-patt " AND
0a90: 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22 20 " key " like '"
0aa0: 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20 20 patt "'"))...
0ab0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64 65 (begin....(de
0ac0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
0ad0: 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66 6f OR: searching fo
0ae0: 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20 70 r runs with no p
0af0: 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20 22 attern set for "
0b00: 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78 69 fulkey)....(exi
0b10: 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20 20 t 6)))))..
0b20: 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69 74 keys). (sqlit
0b30: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 e3:for-each-row
0b40: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 . (lambda (a
0b50: 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73 65 . r). (se
0b60: 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c 69 t! res (cons (li
0b70: 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e 73 st->vector (cons
0b80: 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20 20 a r)) res))).
0b90: 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e db . (con
0ba0: 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79 73 c "SELECT " keys
0bb0: 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 tr " FROM runs W
0bc0: 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69 6b HERE runname lik
0bd0: 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 e ? " key-patt "
0be0: 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d 65 ;"). runname
0bf0: 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74 6f patt). (vecto
0c00: 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29 0a r header res))).
0c10: 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 73 74 .(define (regist
0c20: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 er-test db run-i
0c30: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
0c40: 2d 70 61 74 68 29 0a 20 20 28 6c 65 74 20 28 28 -path). (let ((
0c50: 69 74 65 6d 2d 70 61 74 68 73 20 28 69 66 20 28 item-paths (if (
0c60: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
0c70: 20 22 22 29 0a 09 09 09 28 6c 69 73 74 20 69 74 "")....(list it
0c80: 65 6d 2d 70 61 74 68 29 0a 09 09 09 28 6c 69 73 em-path)....(lis
0c90: 74 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 t item-path ""))
0ca0: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
0cb0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
0cc0: 70 74 68 29 0a 20 20 20 20 20 20 20 28 73 71 6c pth). (sql
0cd0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 ite3:execute db
0ce0: 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 "INSERT OR IGNOR
0cf0: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 E INTO tests (ru
0d00: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 65 76 n_id,testname,ev
0d10: 65 6e 74 5f 74 69 6d 65 2c 69 74 65 6d 5f 70 61 ent_time,item_pa
0d20: 74 68 2c 73 74 61 74 65 2c 73 74 61 74 75 73 29 th,state,status)
0d30: 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 73 74 72 VALUES (?,?,str
0d40: 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f 77 27 ftime('%s','now'
0d50: 29 2c 3f 2c 27 4e 4f 54 5f 53 54 41 52 54 45 44 ),?,'NOT_STARTED
0d60: 27 2c 27 6e 2f 61 27 29 3b 22 20 72 75 6e 2d 69 ','n/a');" run-i
0d70: 64 20 74 65 73 74 2d 6e 61 6d 65 20 70 74 68 29 d test-name pth)
0d80: 29 0a 20 20 20 20 20 69 74 65 6d 2d 70 61 74 68 ). item-path
0d90: 73 29 29 29 0a 0a 3b 3b 20 20 28 64 65 66 69 6e s)))..;; (defin
0da0: 65 20 64 62 20 28 6f 70 65 6e 2d 64 62 29 29 0a e db (open-db)).
0db0: 3b 3b 20 20 28 74 65 73 74 2d 73 65 74 2d 73 74 ;; (test-set-st
0dc0: 61 74 75 73 21 20 64 62 20 32 20 22 72 75 6e 66 atus! db 2 "runf
0dd0: 69 72 73 74 22 20 22 43 4f 4d 50 4c 45 54 45 44 irst" "COMPLETED
0de0: 22 20 22 50 41 53 53 22 20 22 73 75 6d 6d 65 72 " "PASS" "summer
0df0: 22 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 ")..(define (tes
0e00: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 t-set-status! db
0e10: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
0e20: 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 69 e state status i
0e30: 74 65 6d 64 61 74 2d 6f 72 2d 70 61 74 68 20 2e temdat-or-path .
0e40: 20 63 6f 6d 6d 65 6e 74 29 0a 20 20 28 6c 65 74 comment). (let
0e50: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 66 ((item-path (if
0e60: 20 28 73 74 72 69 6e 67 3f 20 69 74 65 6d 64 61 (string? itemda
0e70: 74 2d 6f 72 2d 70 61 74 68 29 20 69 74 65 6d 64 t-or-path) itemd
0e80: 61 74 2d 6f 72 2d 70 61 74 68 20 28 69 74 65 6d at-or-path (item
0e90: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d -list->path item
0ea0: 64 61 74 2d 6f 72 2d 70 61 74 68 29 29 29 29 0a dat-or-path)))).
0eb0: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 (sqlite3:exe
0ec0: 63 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 cute db "UPDATE
0ed0: 74 65 73 74 73 20 53 45 54 20 73 74 61 74 65 3d tests SET state=
0ee0: 3f 2c 73 74 61 74 75 73 3d 3f 2c 65 76 65 6e 74 ?,status=?,event
0ef0: 5f 74 69 6d 65 3d 73 74 72 66 74 69 6d 65 28 27 _time=strftime('
0f00: 25 73 27 2c 27 6e 6f 77 27 29 20 57 48 45 52 45 %s','now') WHERE
0f10: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
0f20: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
0f30: 6d 5f 70 61 74 68 3d 3f 3b 22 20 0a 09 09 20 20 m_path=?;" ...
0f40: 20 20 20 73 74 61 74 65 20 73 74 61 74 75 73 20 state status
0f50: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
0f60: 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 20 20 item-path).
0f70: 28 69 66 20 28 61 6e 64 20 28 6e 6f 74 20 28 65 (if (and (not (e
0f80: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
0f90: 22 22 29 29 20 3b 3b 20 6e 65 65 64 20 74 6f 20 "")) ;; need to
0fa0: 75 70 64 61 74 65 20 74 68 65 20 74 6f 70 20 74 update the top t
0fb0: 65 73 74 20 72 65 63 6f 72 64 20 69 66 20 50 41 est record if PA
0fc0: 53 53 20 6f 72 20 46 41 49 4c 20 61 6e 64 20 74 SS or FAIL and t
0fd0: 68 69 73 20 69 73 20 61 20 73 75 62 74 65 73 74 his is a subtest
0fe0: 0a 09 20 20 20 20 20 28 6f 72 20 28 65 71 75 61 .. (or (equa
0ff0: 6c 3f 20 73 74 61 74 75 73 20 22 50 41 53 53 22 l? status "PASS"
1000: 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 73 74 61 )... (equal? sta
1010: 74 75 73 20 22 57 41 52 4e 22 29 0a 09 09 20 28 tus "WARN")... (
1020: 65 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 46 equal? status "F
1030: 41 49 4c 22 29 29 29 0a 09 28 62 65 67 69 6e 0a AIL")))..(begin.
1040: 09 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 . (sqlite3:exec
1050: 75 74 65 20 0a 09 20 20 20 64 62 0a 09 20 20 20 ute .. db..
1060: 22 55 50 44 41 54 45 20 74 65 73 74 73 20 0a 20 "UPDATE tests .
1070: 20 20 20 20 20 20 20 20 20 20 20 20 53 45 54 20 SET
1080: 66 61 69 6c 5f 63 6f 75 6e 74 3d 28 53 45 4c 45 fail_count=(SELE
1090: 43 54 20 63 6f 75 6e 74 28 69 64 29 20 46 52 4f CT count(id) FRO
10a0: 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 M tests WHERE ru
10b0: 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e n_id=? AND testn
10c0: 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 ame=? AND item_p
10d0: 61 74 68 20 21 3d 20 27 27 20 41 4e 44 20 73 74 ath != '' AND st
10e0: 61 74 75 73 3d 27 46 41 49 4c 27 29 2c 0a 20 20 atus='FAIL'),.
10f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 p
1100: 61 73 73 5f 63 6f 75 6e 74 3d 28 53 45 4c 45 43 ass_count=(SELEC
1110: 54 20 63 6f 75 6e 74 28 69 64 29 20 46 52 4f 4d T count(id) FROM
1120: 20 74 65 73 74 73 20 57 48 45 52 45 20 72 75 6e tests WHERE run
1130: 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 _id=? AND testna
1140: 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 me=? AND item_pa
1150: 74 68 20 21 3d 20 27 27 20 41 4e 44 20 28 73 74 th != '' AND (st
1160: 61 74 75 73 3d 27 50 41 53 53 27 20 4f 52 20 73 atus='PASS' OR s
1170: 74 61 74 75 73 3d 27 57 41 52 4e 27 29 29 0a 20 tatus='WARN')).
1180: 20 20 20 20 20 20 20 20 20 20 20 20 57 48 45 52 WHER
1190: 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 E run_id=? AND t
11a0: 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 estname=? AND it
11b0: 65 6d 5f 70 61 74 68 3d 27 27 3b 22 0a 09 20 20 em_path='';"..
11c0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
11d0: 65 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 e run-id test-na
11e0: 6d 65 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e me run-id test-n
11f0: 61 6d 65 29 0a 09 20 20 28 73 71 6c 69 74 65 33 ame).. (sqlite3
1200: 3a 65 78 65 63 75 74 65 0a 09 20 20 20 64 62 0a :execute.. db.
1210: 09 20 20 20 22 55 50 44 41 54 45 20 74 65 73 74 . "UPDATE test
1220: 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 53 s. S
1230: 45 54 20 73 74 61 74 65 3d 27 43 4f 4d 50 4c 45 ET state='COMPLE
1240: 54 45 44 27 2c 0a 20 20 20 20 20 20 20 20 20 20 TED',.
1250: 20 20 20 20 20 20 73 74 61 74 75 73 3d 43 41 53 status=CAS
1260: 45 20 57 48 45 4e 20 66 61 69 6c 5f 63 6f 75 6e E WHEN fail_coun
1270: 74 20 3e 20 30 20 54 48 45 4e 20 27 46 41 49 4c t > 0 THEN 'FAIL
1280: 27 20 57 48 45 4e 20 70 61 73 73 5f 63 6f 75 6e ' WHEN pass_coun
1290: 74 20 3e 20 30 20 41 4e 44 20 66 61 69 6c 5f 63 t > 0 AND fail_c
12a0: 6f 75 6e 74 3d 30 20 54 48 45 4e 20 27 50 41 53 ount=0 THEN 'PAS
12b0: 53 27 20 45 4c 53 45 20 27 55 4e 4b 4e 4f 57 4e S' ELSE 'UNKNOWN
12c0: 27 20 45 4e 44 0a 20 20 20 20 20 20 20 20 20 20 ' END.
12d0: 20 20 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d WHERE run_id=
12e0: 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f ? AND testname=?
12f0: 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 27 AND item_path='
1300: 27 3b 22 0a 09 20 20 20 72 75 6e 2d 69 64 20 74 ';".. run-id t
1310: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 est-name))).
1320: 28 69 66 20 28 61 6e 64 20 28 6e 6f 74 20 28 6e (if (and (not (n
1330: 75 6c 6c 3f 20 63 6f 6d 6d 65 6e 74 29 29 0a 09 ull? comment))..
1340: 20 20 20 20 20 28 63 61 72 20 63 6f 6d 6d 65 6e (car commen
1350: 74 29 29 0a 09 28 73 71 6c 69 74 65 33 3a 65 78 t))..(sqlite3:ex
1360: 65 63 75 74 65 20 64 62 20 22 55 50 44 41 54 45 ecute db "UPDATE
1370: 20 74 65 73 74 73 20 53 45 54 20 63 6f 6d 6d 65 tests SET comme
1380: 6e 74 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 nt=? WHERE run_i
1390: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
13a0: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
13b0: 3d 3f 3b 22 0a 09 09 09 20 28 63 61 72 20 63 6f =?;".... (car co
13c0: 6d 6d 65 6e 74 29 20 72 75 6e 2d 69 64 20 74 65 mment) run-id te
13d0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
13e0: 68 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 h))))..(define (
13f0: 74 65 73 74 2d 73 65 74 2d 6c 6f 67 21 20 64 62 test-set-log! db
1400: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
1410: 65 20 69 74 65 6d 64 61 74 20 6c 6f 67 66 29 20 e itemdat logf)
1420: 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d 2d 70 . (let ((item-p
1430: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
1440: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 29 0a path itemdat))).
1450: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 (sqlite3:exe
1460: 63 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 cute db "UPDATE
1470: 74 65 73 74 73 20 53 45 54 20 66 69 6e 61 6c 5f tests SET final_
1480: 6c 6f 67 66 3d 3f 20 57 48 45 52 45 20 72 75 6e logf=? WHERE run
1490: 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 _id=? AND testna
14a0: 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 me=? AND item_pa
14b0: 74 68 3d 3f 3b 22 20 0a 09 09 20 20 20 20 20 6c th=?;" ... l
14c0: 6f 67 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d ogf run-id test-
14d0: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 name item-path))
14e0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 )..(define (test
14f0: 2d 73 65 74 2d 74 6f 70 6c 6f 67 21 20 64 62 20 -set-toplog! db
1500: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1510: 20 6c 6f 67 66 29 20 0a 20 20 28 73 71 6c 69 74 logf) . (sqlit
1520: 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 e3:execute db "U
1530: 50 44 41 54 45 20 74 65 73 74 73 20 53 45 54 20 PDATE tests SET
1540: 66 69 6e 61 6c 5f 6c 6f 67 66 3d 3f 20 57 48 45 final_logf=? WHE
1550: 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 RE run_id=? AND
1560: 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 testname=? AND i
1570: 74 65 6d 5f 70 61 74 68 3d 27 27 3b 22 20 0a 09 tem_path='';" ..
1580: 09 20 20 20 6c 6f 67 66 20 72 75 6e 2d 69 64 20 . logf run-id
1590: 74 65 73 74 2d 6e 61 6d 65 29 29 0a 0a 3b 3b 20 test-name))..;;
15a0: 3b 3b 20 54 4f 44 4f 3a 20 43 6f 6e 76 65 72 67 ;; TODO: Converg
15b0: 65 20 74 68 69 73 20 77 69 74 68 20 64 62 3a 67 e this with db:g
15c0: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 0a 3b 3b 20 et-test-info.;;
15d0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 (define (runs:ge
15e0: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 t-test-info db r
15f0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
1600: 69 74 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 20 20 item-path).;;
1610: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 20 (let ((res #f))
1620: 3b 3b 20 28 76 65 63 74 6f 72 20 23 66 20 23 66 ;; (vector #f #f
1630: 20 23 66 20 23 66 20 23 66 20 23 66 29 29 29 0a #f #f #f #f))).
1640: 3b 3b 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a ;; (sqlite3:
1650: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 3b 3b for-each-row .;;
1660: 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 69 (lambda (i
1670: 64 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 d run-id test-na
1680: 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 29 me state status)
1690: 0a 3b 3b 20 20 20 20 20 20 20 20 28 73 65 74 21 .;; (set!
16a0: 20 72 65 73 20 28 76 65 63 74 6f 72 20 69 64 20 res (vector id
16b0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
16c0: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 69 74 state status it
16d0: 65 6d 2d 70 61 74 68 29 29 29 0a 3b 3b 20 20 20 em-path))).;;
16e0: 20 20 20 64 62 20 22 53 45 4c 45 43 54 20 69 64 db "SELECT id
16f0: 2c 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 ,run_id,testname
1700: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 20 46 52 ,state,status FR
1710: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 OM tests WHERE r
1720: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
1730: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
1740: 70 61 74 68 3d 3f 3b 22 0a 3b 3b 20 20 20 20 20 path=?;".;;
1750: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
1760: 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 3b 3b 20 e item-path).;;
1770: 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 res))..(defi
1780: 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a ne-inline (test:
1790: 67 65 74 2d 69 64 20 76 65 63 29 20 20 20 20 20 get-id vec)
17a0: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 76 65 (vector-ref ve
17b0: 63 20 30 29 29 0a 28 64 65 66 69 6e 65 2d 69 6e c 0)).(define-in
17c0: 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d 72 line (test:get-r
17d0: 75 6e 5f 69 64 20 76 65 63 29 20 20 20 28 76 65 un_id vec) (ve
17e0: 63 74 6f 72 2d 72 65 66 20 76 65 63 20 31 29 29 ctor-ref vec 1))
17f0: 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 .(define-inline
1800: 28 74 65 73 74 3a 67 65 74 2d 74 65 73 74 2d 6e (test:get-test-n
1810: 61 6d 65 20 76 65 63 29 28 76 65 63 74 6f 72 2d ame vec)(vector-
1820: 72 65 66 20 76 65 63 20 32 29 29 0a 28 64 65 66 ref vec 2)).(def
1830: 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 ine-inline (test
1840: 3a 67 65 74 2d 73 74 61 74 65 20 76 65 63 29 20 :get-state vec)
1850: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 76 (vector-ref v
1860: 65 63 20 33 29 29 0a 28 64 65 66 69 6e 65 2d 69 ec 3)).(define-i
1870: 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d nline (test:get-
1880: 73 74 61 74 75 73 20 76 65 63 29 20 20 20 28 76 status vec) (v
1890: 65 63 74 6f 72 2d 72 65 66 20 76 65 63 20 34 29 ector-ref vec 4)
18a0: 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 ).(define-inline
18b0: 20 28 74 65 73 74 3a 67 65 74 2d 69 74 65 6d 2d (test:get-item-
18c0: 70 61 74 68 20 76 65 63 29 28 76 65 63 74 6f 72 path vec)(vector
18d0: 2d 72 65 66 20 76 65 63 20 35 29 29 0a 0a 28 64 -ref vec 5))..(d
18e0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 efine (runs:test
18f0: 2d 67 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 -get-full-path t
1900: 65 73 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 est). (let* ((t
1910: 65 73 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 estname (db:test
1920: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 -get-testname
1930: 74 65 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 test)).. (itempa
1940: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
1950: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
1960: 29 0a 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 ). (conc test
1970: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f name (if (equal?
1980: 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 itempath "") ""
1990: 20 28 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 (conc "(" itemp
19a0: 61 74 68 20 22 29 22 29 29 29 29 29 0a 0a 28 64 ath ")")))))..(d
19b0: 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 efine-inline (te
19c0: 73 74 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c st:test-get-full
19d0: 6e 61 6d 65 20 74 65 73 74 29 0a 20 20 20 28 63 name test). (c
19e0: 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 onc (db:test-get
19f0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 0a -testname test).
1a00: 09 20 28 69 66 20 28 65 71 75 61 6c 3f 20 28 64 . (if (equal? (d
1a10: 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d b:test-get-item-
1a20: 70 61 74 68 20 74 65 73 74 29 20 22 22 29 0a 09 path test) "")..
1a30: 20 20 20 20 20 22 22 0a 09 20 20 20 20 20 28 63 "".. (c
1a40: 6f 6e 63 20 22 28 22 20 28 64 62 3a 74 65 73 74 onc "(" (db:test
1a50: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
1a60: 65 73 74 29 20 22 29 22 29 29 29 29 0a 0a 28 64 est) ")"))))..(d
1a70: 65 66 69 6e 65 20 28 63 68 65 63 6b 2d 76 61 6c efine (check-val
1a80: 69 64 2d 69 74 65 6d 73 20 63 6c 61 73 73 20 69 id-items class i
1a90: 74 65 6d 29 0a 20 20 28 6c 65 74 20 28 28 76 61 tem). (let ((va
1aa0: 6c 69 64 2d 76 61 6c 75 65 73 20 28 6c 65 74 20 lid-values (let
1ab0: 28 28 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b ((s (config-look
1ac0: 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 up *configdat* "
1ad0: 76 61 6c 69 64 76 61 6c 75 65 73 22 20 63 6c 61 validvalues" cla
1ae0: 73 73 29 29 29 0a 09 09 09 28 69 66 20 73 20 28 ss)))....(if s (
1af0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 29 20 string-split s)
1b00: 23 66 29 29 29 29 0a 20 20 20 20 28 69 66 20 76 #f)))). (if v
1b10: 61 6c 69 64 2d 76 61 6c 75 65 73 0a 09 28 69 66 alid-values..(if
1b20: 20 28 6d 65 6d 62 65 72 20 69 74 65 6d 20 76 61 (member item va
1b30: 6c 69 64 2d 76 61 6c 75 65 73 29 0a 09 20 20 20 lid-values)..
1b40: 20 69 74 65 6d 20 23 66 29 0a 09 69 74 65 6d 29 item #f)..item)
1b50: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 ))..(define (tes
1b60: 74 73 74 65 70 2d 73 65 74 2d 73 74 61 74 75 73 tstep-set-status
1b70: 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 ! db run-id test
1b80: 2d 6e 61 6d 65 20 74 65 73 74 73 74 65 70 2d 6e -name teststep-n
1b90: 61 6d 65 20 73 74 61 74 65 2d 69 6e 20 73 74 61 ame state-in sta
1ba0: 74 75 73 2d 69 6e 20 69 74 65 6d 64 61 74 20 63 tus-in itemdat c
1bb0: 6f 6d 6d 65 6e 74 29 0a 20 20 28 64 65 62 75 67 omment). (debug
1bc0: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 2d 69 64 :print 4 "run-id
1bd0: 3a 20 22 20 72 75 6e 2d 69 64 20 22 20 74 65 73 : " run-id " tes
1be0: 74 2d 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e t-name: " test-n
1bf0: 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 28 28 73 ame). (let* ((s
1c00: 74 61 74 65 20 20 20 20 20 28 63 68 65 63 6b 2d tate (check-
1c10: 76 61 6c 69 64 2d 69 74 65 6d 73 20 22 73 74 61 valid-items "sta
1c20: 74 65 22 20 73 74 61 74 65 2d 69 6e 29 29 0a 09 te" state-in))..
1c30: 20 28 73 74 61 74 75 73 20 20 20 20 28 63 68 65 (status (che
1c40: 63 6b 2d 76 61 6c 69 64 2d 69 74 65 6d 73 20 22 ck-valid-items "
1c50: 73 74 61 74 75 73 22 20 73 74 61 74 75 73 2d 69 status" status-i
1c60: 6e 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 n)).. (item-path
1c70: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 (item-list->pat
1c80: 68 20 69 74 65 6d 64 61 74 29 29 0a 09 20 28 74 h itemdat)).. (t
1c90: 65 73 74 64 61 74 20 20 20 28 64 62 3a 67 65 74 estdat (db:get
1ca0: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 -test-info db ru
1cb0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
1cc0: 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 tem-path))).
1cd0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 (debug:print 5 "
1ce0: 74 65 73 74 64 61 74 3a 20 22 20 74 65 73 74 64 testdat: " testd
1cf0: 61 74 29 0a 20 20 20 20 28 69 66 20 28 61 6e 64 at). (if (and
1d00: 20 74 65 73 74 64 61 74 20 3b 3b 20 69 66 20 74 testdat ;; if t
1d10: 68 65 20 73 65 63 74 69 6f 6e 20 65 78 69 73 74 he section exist
1d20: 73 20 74 68 65 6e 20 66 6f 72 63 65 20 73 70 65 s then force spe
1d30: 63 69 66 69 63 61 74 69 6f 6e 20 42 55 47 2c 20 cification BUG,
1d40: 49 20 64 6f 6e 27 74 20 6c 69 6b 65 20 68 6f 77 I don't like how
1d50: 20 74 68 69 73 20 77 6f 72 6b 73 2e 0a 09 20 20 this works...
1d60: 20 20 20 28 6f 72 20 28 6e 6f 74 20 73 74 61 74 (or (not stat
1d70: 65 29 28 6e 6f 74 20 73 74 61 74 75 73 29 29 29 e)(not status)))
1d80: 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 ..(debug:print 0
1d90: 20 22 57 41 52 4e 49 4e 47 3a 20 49 6e 76 61 6c "WARNING: Inval
1da0: 69 64 20 22 20 28 69 66 20 73 74 61 74 75 73 20 id " (if status
1db0: 22 73 74 61 74 75 73 22 20 22 73 74 61 74 65 22 "status" "state"
1dc0: 29 0a 09 20 20 20 20 20 20 20 22 20 76 61 6c 75 ).. " valu
1dd0: 65 20 5c 22 22 20 28 69 66 20 73 74 61 74 75 73 e \"" (if status
1de0: 20 73 74 61 74 75 73 2d 69 6e 20 73 74 61 74 65 status-in state
1df0: 2d 69 6e 29 20 22 5c 22 2c 20 75 70 64 61 74 65 -in) "\", update
1e00: 20 79 6f 75 72 20 76 61 6c 69 64 73 74 61 74 65 your validstate
1e10: 73 20 73 65 63 74 69 6f 6e 20 69 6e 20 6d 65 67 s section in meg
1e20: 61 74 65 73 74 2e 63 6f 6e 66 69 67 22 29 29 0a atest.config")).
1e30: 20 20 20 20 28 69 66 20 74 65 73 74 64 61 74 0a (if testdat.
1e40: 09 28 6c 65 74 20 28 28 74 65 73 74 2d 69 64 20 .(let ((test-id
1e50: 28 74 65 73 74 3a 67 65 74 2d 69 64 20 74 65 73 (test:get-id tes
1e60: 74 64 61 74 29 29 29 0a 09 20 20 28 73 71 6c 69 tdat))).. (sqli
1e70: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 0a te3:execute db .
1e80: 09 09 09 22 49 4e 53 45 52 54 20 4f 52 20 52 45 ..."INSERT OR RE
1e90: 50 4c 41 43 45 20 69 6e 74 6f 20 74 65 73 74 5f PLACE into test_
1ea0: 73 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 steps (test_id,s
1eb0: 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 tepname,state,st
1ec0: 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c atus,event_time,
1ed0: 63 6f 6d 6d 65 6e 74 29 20 56 41 4c 55 45 53 28 comment) VALUES(
1ee0: 3f 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 ?,?,?,?,strftime
1ef0: 28 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f 29 3b ('%s','now'),?);
1f00: 22 0a 09 09 09 74 65 73 74 2d 69 64 20 74 65 73 "....test-id tes
1f10: 74 73 74 65 70 2d 6e 61 6d 65 20 73 74 61 74 65 tstep-name state
1f20: 20 73 74 61 74 75 73 20 28 69 66 20 63 6f 6d 6d status (if comm
1f30: 65 6e 74 20 63 6f 6d 6d 65 6e 74 20 22 22 29 29 ent comment ""))
1f40: 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 )..(debug:print
1f50: 30 20 22 45 52 52 4f 52 3a 20 43 61 6e 27 74 20 0 "ERROR: Can't
1f60: 75 70 64 61 74 65 20 22 20 74 65 73 74 2d 6e 61 update " test-na
1f70: 6d 65 20 22 20 66 6f 72 20 72 75 6e 20 22 20 72 me " for run " r
1f80: 75 6e 2d 69 64 20 22 20 2d 3e 20 6e 6f 20 73 75 un-id " -> no su
1f90: 63 68 20 74 65 73 74 20 69 6e 20 64 62 22 29 29 ch test in db"))
1fa0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 ))..(define (tes
1fb0: 74 2d 67 65 74 2d 6b 69 6c 6c 2d 72 65 71 75 65 t-get-kill-reque
1fc0: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 st db run-id tes
1fd0: 74 2d 6e 61 6d 65 20 69 74 65 6d 64 61 74 29 0a t-name itemdat).
1fe0: 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 (let* ((item-p
1ff0: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
2000: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 path itemdat))..
2010: 20 28 74 65 73 74 64 61 74 20 20 20 28 64 62 3a (testdat (db:
2020: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
2030: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
2040: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 e item-path))).
2050: 20 20 20 28 65 71 75 61 6c 3f 20 28 74 65 73 74 (equal? (test
2060: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
2070: 61 74 29 20 22 4b 49 4c 4c 52 45 51 22 29 29 29 at) "KILLREQ")))
2080: 0a 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d ..(define (test-
2090: 73 65 74 2d 6d 65 74 61 2d 69 6e 66 6f 20 64 62 set-meta-info db
20a0: 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 run-id testname
20b0: 20 69 74 65 6d 64 61 74 29 0a 20 20 28 6c 65 74 itemdat). (let
20c0: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 ((item-path (it
20d0: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
20e0: 65 6d 64 61 74 29 29 0a 09 28 63 70 75 6c 6f 61 emdat))..(cpuloa
20f0: 64 20 20 28 67 65 74 2d 63 70 75 2d 6c 6f 61 64 d (get-cpu-load
2100: 29 29 0a 09 28 68 6f 73 74 6e 61 6d 65 20 28 67 ))..(hostname (g
2110: 65 74 2d 68 6f 73 74 2d 6e 61 6d 65 29 29 0a 09 et-host-name))..
2120: 28 64 69 73 6b 66 72 65 65 20 28 67 65 74 2d 64 (diskfree (get-d
2130: 66 20 28 63 75 72 72 65 6e 74 2d 64 69 72 65 63 f (current-direc
2140: 74 6f 72 79 29 29 29 0a 09 28 75 6e 61 6d 65 20 tory)))..(uname
2150: 20 20 20 28 67 65 74 2d 75 6e 61 6d 65 20 22 2d (get-uname "-
2160: 73 72 76 70 69 6f 22 29 29 0a 09 28 72 75 6e 70 srvpio"))..(runp
2170: 61 74 68 20 20 28 63 75 72 72 65 6e 74 2d 64 69 ath (current-di
2180: 72 65 63 74 6f 72 79 29 29 29 0a 20 20 20 20 28 rectory))). (
2190: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
21a0: 64 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 db "UPDATE tests
21b0: 20 53 45 54 20 68 6f 73 74 3d 3f 2c 63 70 75 6c SET host=?,cpul
21c0: 6f 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 3d 3f oad=?,diskfree=?
21d0: 2c 75 6e 61 6d 65 3d 3f 2c 72 75 6e 64 69 72 3d ,uname=?,rundir=
21e0: 3f 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f ? WHERE run_id=?
21f0: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
2200: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
2210: 22 0a 09 09 20 20 68 6f 73 74 6e 61 6d 65 0a 09 "... hostname..
2220: 09 20 20 63 70 75 6c 6f 61 64 0a 09 09 20 20 64 . cpuload... d
2230: 69 73 6b 66 72 65 65 0a 09 09 20 20 75 6e 61 6d iskfree... unam
2240: 65 0a 09 09 20 20 72 75 6e 70 61 74 68 0a 09 09 e... runpath...
2250: 20 20 72 75 6e 2d 69 64 0a 09 09 20 20 74 65 73 run-id... tes
2260: 74 6e 61 6d 65 0a 09 09 20 20 69 74 65 6d 2d 70 tname... item-p
2270: 61 74 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 ath)))..(define
2280: 28 74 65 73 74 2d 75 70 64 61 74 65 2d 6d 65 74 (test-update-met
2290: 61 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 a-info db run-id
22a0: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 64 61 testname itemda
22b0: 74 20 6d 69 6e 75 74 65 73 29 0a 20 20 28 6c 65 t minutes). (le
22c0: 74 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 t ((item-path (i
22d0: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 tem-list->path i
22e0: 74 65 6d 64 61 74 29 29 0a 09 28 63 70 75 6c 6f temdat))..(cpulo
22f0: 61 64 20 20 28 67 65 74 2d 63 70 75 2d 6c 6f 61 ad (get-cpu-loa
2300: 64 29 29 0a 09 28 64 69 73 6b 66 72 65 65 20 28 d))..(diskfree (
2310: 67 65 74 2d 64 66 20 28 63 75 72 72 65 6e 74 2d get-df (current-
2320: 64 69 72 65 63 74 6f 72 79 29 29 29 29 0a 20 20 directory)))).
2330: 20 20 28 69 66 20 28 6e 6f 74 20 63 70 75 6c 6f (if (not cpulo
2340: 61 64 29 20 20 28 62 65 67 69 6e 20 28 64 65 62 ad) (begin (deb
2350: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
2360: 49 4e 47 3a 20 43 50 55 4c 4f 41 44 20 6e 6f 74 ING: CPULOAD not
2370: 20 66 6f 75 6e 64 2e 22 29 20 20 28 73 65 74 21 found.") (set!
2380: 20 63 70 75 6c 6f 61 64 20 22 6e 2f 61 22 29 29 cpuload "n/a"))
2390: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 64 ). (if (not d
23a0: 69 73 6b 66 72 65 65 29 20 28 62 65 67 69 6e 20 iskfree) (begin
23b0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
23c0: 57 41 52 4e 49 4e 47 3a 20 44 49 53 4b 46 52 45 WARNING: DISKFRE
23d0: 45 20 6e 6f 74 20 66 6f 75 6e 64 2e 22 29 20 28 E not found.") (
23e0: 73 65 74 21 20 64 69 73 6b 66 72 65 65 20 22 6e set! diskfree "n
23f0: 2f 61 22 29 29 29 0a 20 20 20 20 28 69 66 20 28 /a"))). (if (
2400: 6e 6f 74 20 69 74 65 6d 2d 70 61 74 68 29 28 62 not item-path)(b
2410: 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e egin (debug:prin
2420: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 49 54 t 0 "WARNING: IT
2430: 45 4d 50 41 54 48 20 6e 6f 74 20 73 65 74 2e 22 EMPATH not set."
2440: 29 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 ) (set! item-p
2450: 61 74 68 20 22 22 29 29 29 0a 20 20 20 20 3b 3b ath ""))). ;;
2460: 20 28 6c 65 74 20 28 28 74 65 73 74 69 6e 66 6f (let ((testinfo
2470: 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e (db:get-test-in
2480: 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 fo db run-id tes
2490: 74 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 tname item-path)
24a0: 29 29 0a 20 20 20 20 3b 3b 20 20 20 28 69 66 20 )). ;; (if
24b0: 28 61 6e 64 20 28 6e 6f 74 20 28 65 71 75 61 6c (and (not (equal
24c0: 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 ? (db:test-get-s
24d0: 74 61 74 75 73 20 74 65 73 74 69 6e 66 6f 29 20 tatus testinfo)
24e0: 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 0a 20 20 "COMPLETED")).
24f0: 20 20 3b 3b 20 20 20 20 20 20 20 20 20 20 20 20 ;;
2500: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 64 62 (not (equal? (db
2510: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 :test-get-status
2520: 20 74 65 73 74 69 6e 66 6f 29 20 22 4b 49 4c 4c testinfo) "KILL
2530: 52 45 51 22 29 29 0a 20 20 20 20 28 73 71 6c 69 REQ")). (sqli
2540: 74 65 33 3a 65 78 65 63 75 74 65 0a 20 20 20 20 te3:execute.
2550: 20 64 62 0a 20 20 20 20 20 22 55 50 44 41 54 45 db. "UPDATE
2560: 20 74 65 73 74 73 20 53 45 54 20 63 70 75 6c 6f tests SET cpulo
2570: 61 64 3d 3f 2c 64 69 73 6b 66 72 65 65 3d 3f 2c ad=?,diskfree=?,
2580: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 3d 3f 2c 73 run_duration=?,s
2590: 74 61 74 65 3d 27 52 55 4e 4e 49 4e 47 27 20 57 tate='RUNNING' W
25a0: 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e HERE run_id=? AN
25b0: 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 D testname=? AND
25c0: 20 69 74 65 6d 5f 70 61 74 68 3d 3f 20 41 4e 44 item_path=? AND
25d0: 20 73 74 61 74 65 20 4e 4f 54 20 49 4e 20 28 27 state NOT IN ('
25e0: 43 4f 4d 50 4c 45 54 45 44 27 2c 27 4b 49 4c 4c COMPLETED','KILL
25f0: 52 45 51 27 2c 27 4b 49 4c 4c 45 44 27 29 3b 22 REQ','KILLED');"
2600: 0a 20 20 20 20 20 63 70 75 6c 6f 61 64 0a 20 20 . cpuload.
2610: 20 20 20 64 69 73 6b 66 72 65 65 0a 20 20 20 20 diskfree.
2620: 20 6d 69 6e 75 74 65 73 0a 20 20 20 20 20 72 75 minutes. ru
2630: 6e 2d 69 64 0a 20 20 20 20 20 74 65 73 74 6e 61 n-id. testna
2640: 6d 65 0a 20 20 20 20 20 69 74 65 6d 2d 70 61 74 me. item-pat
2650: 68 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 h)))..(define (s
2660: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
2670: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 0a vars db run-id).
2680: 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 28 64 (let ((keys (d
2690: 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 29 b-get-keys db)))
26a0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 . (for-each (
26b0: 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 28 lambda (key)...(
26c0: 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 sqlite3:for-each
26d0: 2d 72 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 -row... (lambda
26e0: 28 76 61 6c 29 0a 09 09 20 20 20 28 64 65 62 75 (val)... (debu
26f0: 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e g:print 2 "seten
2700: 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 v " (key:get-fie
2710: 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 ldname key) " "
2720: 76 61 6c 29 0a 09 09 20 20 20 28 73 65 74 65 6e val)... (seten
2730: 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 v (key:get-field
2740: 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 0a name key) val)).
2750: 09 09 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 20 .. db ... (conc
2760: 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 "SELECT " (key:g
2770: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 et-fieldname key
2780: 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 ) " FROM runs WH
2790: 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 72 ERE id=?;")... r
27a0: 75 6e 2d 69 64 29 29 0a 09 20 20 20 20 20 20 6b un-id)).. k
27b0: 65 79 73 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 eys)))..(define
27c0: 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 (set-item-env-va
27d0: 72 73 20 69 74 65 6d 64 61 74 29 0a 20 20 28 66 rs itemdat). (f
27e0: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
27f0: 28 69 74 65 6d 29 0a 09 20 20 20 20 20 20 28 64 (item).. (d
2800: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 ebug:print 2 "se
2810: 74 65 6e 76 20 22 20 28 63 61 72 20 69 74 65 6d tenv " (car item
2820: 29 20 22 20 22 20 28 63 61 64 72 20 69 74 65 6d ) " " (cadr item
2830: 29 29 0a 09 20 20 20 20 20 20 28 73 65 74 65 6e )).. (seten
2840: 76 20 28 63 61 72 20 69 74 65 6d 29 20 28 63 61 v (car item) (ca
2850: 64 72 20 69 74 65 6d 29 29 29 0a 09 20 20 20 20 dr item)))..
2860: 69 74 65 6d 64 61 74 29 29 0a 0a 28 64 65 66 69 itemdat))..(defi
2870: 6e 65 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 ne (get-all-lega
2880: 6c 2d 74 65 73 74 73 29 0a 20 20 28 6c 65 74 2a l-tests). (let*
2890: 20 28 28 74 65 73 74 73 20 20 28 67 6c 6f 62 20 ((tests (glob
28a0: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
28b0: 22 2f 74 65 73 74 73 2f 2a 22 29 29 29 0a 09 20 "/tests/*")))..
28c0: 28 72 65 73 20 20 20 20 27 28 29 29 29 0a 20 20 (res '())).
28d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
28e0: 20 22 49 4e 46 4f 3a 20 4c 6f 6f 6b 69 6e 67 20 "INFO: Looking
28f0: 61 74 20 74 65 73 74 73 20 22 20 28 73 74 72 69 at tests " (stri
2900: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 74 ng-intersperse t
2910: 65 73 74 73 20 22 2c 22 29 29 0a 20 20 20 20 28 ests ",")). (
2920: 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 for-each (lambda
2930: 20 28 74 65 73 74 70 61 74 68 29 0a 09 09 28 69 (testpath)...(i
2940: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
2950: 28 63 6f 6e 63 20 74 65 73 74 70 61 74 68 20 22 (conc testpath "
2960: 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 /testconfig"))..
2970: 09 20 20 20 20 28 73 65 74 21 20 72 65 73 20 28 . (set! res (
2980: 63 6f 6e 73 20 28 6c 61 73 74 20 28 73 74 72 69 cons (last (stri
2990: 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 61 74 ng-split testpat
29a0: 68 20 22 2f 22 29 29 20 72 65 73 29 29 29 29 0a h "/")) res)))).
29b0: 09 20 20 20 20 20 20 74 65 73 74 73 29 0a 20 20 . tests).
29c0: 20 20 72 65 73 29 29 0a 0a 28 64 65 66 69 6e 65 res))..(define
29d0: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d (runs:can-run-m
29e0: 6f 72 65 2d 74 65 73 74 73 20 64 62 29 0a 20 20 ore-tests db).
29f0: 28 6c 65 74 20 28 28 6e 75 6d 2d 72 75 6e 6e 69 (let ((num-runni
2a00: 6e 67 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 ng (db:get-count
2a10: 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 -tests-running d
2a20: 62 29 29 0a 09 28 6d 61 78 2d 63 6f 6e 63 75 72 b))..(max-concur
2a30: 72 65 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 rent-jobs (confi
2a40: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
2a50: 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 dat* "setup" "ma
2a60: 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 x_concurrent_job
2a70: 73 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 s"))). (debug
2a80: 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f :print 2 "max-co
2a90: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 ncurrent-jobs: "
2aa0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
2ab0: 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e jobs ", num-runn
2ac0: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 ing: " num-runni
2ad0: 6e 67 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 ng). (if (not
2ae0: 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 (eq? 0 *globale
2af0: 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 23 66 xitstatus*))..#f
2b00: 0a 09 28 69 66 20 28 6f 72 20 28 6e 6f 74 20 6d ..(if (or (not m
2b10: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
2b20: 62 73 29 0a 09 09 28 61 6e 64 20 6d 61 78 2d 63 bs)...(and max-c
2b30: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a 09 oncurrent-jobs..
2b40: 09 20 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 6e . (string->n
2b50: 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 72 umber max-concur
2b60: 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 20 20 20 rent-jobs)...
2b70: 20 20 28 6e 6f 74 20 28 3e 3d 20 6e 75 6d 2d 72 (not (>= num-r
2b80: 75 6e 6e 69 6e 67 20 28 73 74 72 69 6e 67 2d 3e unning (string->
2b90: 6e 75 6d 62 65 72 20 6d 61 78 2d 63 6f 6e 63 75 number max-concu
2ba0: 72 72 65 6e 74 2d 6a 6f 62 73 29 29 29 29 29 0a rrent-jobs))))).
2bb0: 09 20 20 20 20 23 74 0a 09 20 20 20 20 28 62 65 . #t.. (be
2bc0: 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 gin .. (deb
2bd0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
2be0: 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 ING: Max running
2bf0: 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20 jobs exceeded,
2c00: 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 current number r
2c10: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 unning: " num-ru
2c20: 6e 6e 69 6e 67 20 0a 09 09 09 20 20 20 22 2c 20 nning .... ",
2c30: 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a max_concurrent_j
2c40: 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 obs: " max-concu
2c50: 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 20 20 20 rrent-jobs)..
2c60: 20 20 20 23 66 29 29 29 29 29 0a 20 20 0a 28 64 #f))))). .(d
2c70: 65 66 69 6e 65 20 28 72 75 6e 2d 74 65 73 74 73 efine (run-tests
2c80: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a db test-names).
2c90: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 (let* ((keys
2ca0: 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 6b 65 (db-get-ke
2cb0: 79 73 20 64 62 29 29 0a 09 20 28 6b 65 79 76 61 ys db)).. (keyva
2cc0: 6c 6c 73 74 20 20 20 28 6b 65 79 73 2d 3e 76 61 llst (keys->va
2cd0: 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 0a llist keys #t)).
2ce0: 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20 28 . (run-id (
2cf0: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 register-run db
2d00: 6b 65 79 73 29 29 29 20 3b 3b 20 20 74 65 73 74 keys))) ;; test
2d10: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 3b 3b 20 -name))). ;;
2d20: 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70 61 73 on the first pas
2d30: 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 72 75 6e s or call to run
2d40: 2d 74 65 73 74 73 20 73 65 74 20 46 41 49 4c 53 -tests set FAILS
2d50: 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 to NOT_STARTED
2d60: 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 if. ;; -keepg
2d70: 6f 69 6e 67 20 69 73 20 73 70 65 63 69 66 69 65 oing is specifie
2d80: 64 0a 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 d. (if (and (
2d90: 65 71 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 eq? *passnum* 0)
2da0: 0a 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 .. (args:get
2db0: 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 -arg "-keepgoing
2dc0: 22 29 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 3b "))..(begin.. ;
2dd0: 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74 65 ; have to delete
2de0: 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77 68 test records wh
2df0: 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 ere NOT_STARTED
2e00: 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20 63 since they can c
2e10: 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 20 ause -keepgoing
2e20: 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 74 to .. ;; get st
2e30: 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f 6d uck due to becom
2e40: 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c 65 ing inaccessible
2e50: 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 74 from a failed t
2e60: 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 73 est. I.e. if tes
2e70: 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20 20 t B depends ..
2e80: 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75 74 ;; on test A but
2e90: 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64 20 test B reached
2ea0: 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 69 the point on bei
2eb0: 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61 73 ng registered as
2ec0: 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e 64 NOT_STARTED and
2ed0: 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 61 test.. ;; A fa
2ee0: 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 65 iled for some re
2ef0: 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 2d ason then on re-
2f00: 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 67 run using -keepg
2f10: 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61 6e oing the run can
2f20: 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 2e never complete.
2f30: 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 74 .. (db:delete-t
2f40: 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 62 ests-in-state db
2f50: 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 41 run-id "NOT_STA
2f60: 52 54 45 44 22 29 0a 09 20 20 28 64 62 3a 73 65 RTED").. (db:se
2f70: 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 74 t-tests-state-st
2f80: 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 20 74 atus db run-id t
2f90: 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 41 est-names #f "FA
2fa0: 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 IL" "NOT_STARTED
2fb0: 22 20 22 46 41 49 4c 22 29 29 29 0a 20 20 20 20 " "FAIL"))).
2fc0: 28 73 65 74 21 20 2a 70 61 73 73 6e 75 6d 2a 20 (set! *passnum*
2fd0: 28 2b 20 2a 70 61 73 73 6e 75 6d 2a 20 31 29 29 (+ *passnum* 1))
2fe0: 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 . (let loop (
2ff0: 28 6e 75 6d 74 69 6d 65 73 20 30 29 29 0a 20 20 (numtimes 0)).
3000: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 (for-each .
3010: 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 (lambda (t
3020: 65 73 74 2d 6e 61 6d 65 29 0a 09 20 28 69 66 20 est-name).. (if
3030: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f (runs:can-run-mo
3040: 72 65 2d 74 65 73 74 73 20 64 62 29 0a 09 20 20 re-tests db)..
3050: 20 20 20 28 72 75 6e 2d 6f 6e 65 2d 74 65 73 74 (run-one-test
3060: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
3070: 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 29 0a name keyvallst).
3080: 09 20 20 20 20 20 3b 3b 20 61 64 64 20 73 6f 6d . ;; add som
3090: 65 20 64 65 6c 61 79 20 0a 09 20 20 20 20 20 3b e delay .. ;
30a0: 28 73 6c 65 65 70 20 32 29 0a 09 20 20 20 20 20 (sleep 2)..
30b0: 29 29 0a 20 20 20 20 20 20 20 74 65 73 74 2d 6e )). test-n
30c0: 61 6d 65 73 29 0a 20 20 20 20 20 20 3b 3b 20 28 ames). ;; (
30d0: 72 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 run-waiting-test
30e0: 73 20 64 62 29 0a 20 20 20 20 20 20 28 69 66 20 s db). (if
30f0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
3100: 6b 65 65 70 67 6f 69 6e 67 22 29 0a 09 20 20 28 keepgoing").. (
3110: 6c 65 74 20 28 28 65 73 74 72 65 6d 20 28 64 62 let ((estrem (db
3120: 3a 65 73 74 69 6d 61 74 65 64 2d 74 65 73 74 73 :estimated-tests
3130: 2d 72 65 6d 61 69 6e 69 6e 67 20 64 62 20 72 75 -remaining db ru
3140: 6e 2d 69 64 29 29 29 0a 09 20 20 20 20 28 69 66 n-id))).. (if
3150: 20 28 61 6e 64 20 28 3e 20 65 73 74 72 65 6d 20 (and (> estrem
3160: 30 29 0a 09 09 20 20 20 20 20 28 65 71 3f 20 2a 0)... (eq? *
3170: 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 globalexitstatus
3180: 2a 20 30 29 29 0a 09 09 28 62 65 67 69 6e 0a 09 * 0))...(begin..
3190: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
31a0: 31 20 22 4b 65 65 70 20 67 6f 69 6e 67 2c 20 65 1 "Keep going, e
31b0: 73 74 69 6d 61 74 65 64 20 22 20 65 73 74 72 65 stimated " estre
31c0: 6d 20 22 20 74 65 73 74 73 20 72 65 6d 61 69 6e m " tests remain
31d0: 69 6e 67 20 74 6f 20 72 75 6e 2c 20 77 69 6c 6c ing to run, will
31e0: 20 63 6f 6e 74 69 6e 75 65 20 69 6e 20 33 20 73 continue in 3 s
31f0: 65 63 6f 6e 64 73 20 2e 2e 2e 22 29 0a 09 09 20 econds ...")...
3200: 20 28 73 6c 65 65 70 20 33 29 0a 09 09 20 20 28 (sleep 3)... (
3210: 72 75 6e 2d 77 61 69 74 69 6e 67 2d 74 65 73 74 run-waiting-test
3220: 73 20 64 62 29 0a 09 09 20 20 28 6c 6f 6f 70 20 s db)... (loop
3230: 28 2b 20 6e 75 6d 74 69 6d 65 73 20 31 29 29 29 (+ numtimes 1)))
3240: 29 29 29 29 29 29 0a 09 20 20 20 0a 3b 3b 20 56 )))))).. .;; V
3250: 45 52 59 20 49 4e 45 46 46 49 43 49 45 4e 54 21 ERY INEFFICIENT!
3260: 20 4d 6f 76 65 20 73 74 75 66 66 20 74 68 61 74 Move stuff that
3270: 20 73 68 6f 75 6c 64 20 62 65 20 64 6f 6e 65 20 should be done
3280: 6f 6e 63 65 20 75 70 20 74 6f 20 63 61 6c 6c 69 once up to calli
3290: 6e 67 20 70 72 6f 63 0a 28 64 65 66 69 6e 65 20 ng proc.(define
32a0: 28 72 75 6e 2d 6f 6e 65 2d 74 65 73 74 20 64 62 (run-one-test db
32b0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
32c0: 65 20 6b 65 79 76 61 6c 6c 73 74 29 0a 20 20 28 e keyvallst). (
32d0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4c debug:print 1 "L
32e0: 61 75 6e 63 68 69 6e 67 20 74 65 73 74 20 22 20 aunching test "
32f0: 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 3b 3b 20 test-name). ;;
3300: 41 6c 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d All these vars m
3310: 69 67 68 74 20 62 65 20 72 65 66 65 72 65 6e 63 ight be referenc
3320: 65 64 20 62 79 20 74 68 65 20 74 65 73 74 63 6f ed by the testco
3330: 6e 66 69 67 20 66 69 6c 65 20 72 65 61 64 65 72 nfig file reader
3340: 0a 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 . (setenv "MT_T
3350: 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e EST_NAME" test-n
3360: 61 6d 65 29 20 3b 3b 20 0a 20 20 28 73 65 74 65 ame) ;; . (sete
3370: 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 nv "MT_RUNNAME"
3380: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 (args:get-arg
3390: 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 20 20 28 ":runname")). (
33a0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 set-megatest-env
33b0: 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 -vars db run-id)
33c0: 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 ;; these may be
33d0: 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c needed by the l
33e0: 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 aunching process
33f0: 0a 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 . (change-direc
3400: 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a tory *toppath*).
3410: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 (let* ((test-p
3420: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f ath (conc *to
3430: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 ppath* "/tests/"
3440: 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 20 28 test-name)).. (
3450: 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f test-configf (co
3460: 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 nc test-path "/t
3470: 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 estconfig")).. (
3480: 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61 6e testexists (an
3490: 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 d (file-exists?
34a0: 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 test-configf)(fi
34b0: 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 le-read-access?
34c0: 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a test-configf))).
34d0: 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 . (test-conf
34e0: 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 (if testexists (
34f0: 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 read-config test
3500: 2d 63 6f 6e 66 69 67 66 29 20 28 6d 61 6b 65 2d -configf) (make-
3510: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 hash-table)))..
3520: 28 77 61 69 74 6f 6e 20 20 20 20 20 20 20 28 6c (waiton (l
3530: 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c et ((w (config-l
3540: 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 ookup test-conf
3550: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 "requirements" "
3560: 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 20 28 waiton"))).... (
3570: 69 66 20 28 73 74 72 69 6e 67 3f 20 77 29 28 73 if (string? w)(s
3580: 74 72 69 6e 67 2d 73 70 6c 69 74 20 77 29 27 28 tring-split w)'(
3590: 29 29 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e ))))). (if (n
35a0: 6f 74 20 74 65 73 74 65 78 69 73 74 73 29 0a 09 ot testexists)..
35b0: 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 (begin.. (debug
35c0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
35d0: 20 43 61 6e 27 74 20 66 69 6e 64 20 63 6f 6e 66 Can't find conf
35e0: 69 67 20 66 69 6c 65 20 22 20 74 65 73 74 2d 63 ig file " test-c
35f0: 6f 6e 66 69 67 66 29 0a 09 20 20 28 65 78 69 74 onfigf).. (exit
3600: 20 32 29 29 0a 09 3b 3b 20 70 75 74 20 74 6f 70 2))..;; put top
3610: 20 76 61 72 73 20 69 6e 74 6f 20 63 6f 6e 76 65 vars into conve
3620: 6e 69 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20 nient variables
3630: 61 6e 64 20 6f 70 65 6e 20 74 68 65 20 64 62 0a and open the db.
3640: 09 28 6c 65 74 2a 20 28 3b 3b 20 64 62 20 69 73 .(let* (;; db is
3650: 20 61 6c 77 61 79 73 20 61 74 20 2a 74 6f 70 70 always at *topp
3660: 61 74 68 2a 2f 64 62 2f 6d 65 67 61 74 65 73 74 ath*/db/megatest
3670: 2e 64 62 0a 09 20 20 20 20 20 20 20 28 69 74 65 .db.. (ite
3680: 6d 73 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 ms (hash-t
3690: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
36a0: 20 74 65 73 74 2d 63 6f 6e 66 20 22 69 74 65 6d test-conf "item
36b0: 73 22 20 27 28 29 29 29 0a 09 20 20 20 20 20 20 s" '()))..
36c0: 20 28 69 74 65 6d 73 74 61 62 6c 65 20 20 28 68 (itemstable (h
36d0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
36e0: 66 61 75 6c 74 20 74 65 73 74 2d 63 6f 6e 66 20 fault test-conf
36f0: 22 69 74 65 6d 73 74 61 62 6c 65 22 20 27 28 29 "itemstable" '()
3700: 29 29 0a 09 20 20 20 20 20 20 20 28 61 6c 6c 69 )).. (alli
3710: 74 65 6d 73 20 20 20 20 28 69 66 20 28 6f 72 20 tems (if (or
3720: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d (not (null? item
3730: 73 29 29 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 s))(not (null? i
3740: 74 65 6d 73 74 61 62 6c 65 29 29 29 0a 09 09 09 temstable)))....
3750: 09 28 61 70 70 65 6e 64 20 28 69 74 65 6d 2d 61 .(append (item-a
3760: 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 ssoc->item-list
3770: 69 74 65 6d 73 29 0a 09 09 09 09 09 28 69 74 65 items)......(ite
3780: 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 m-table->item-li
3790: 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 0a st itemstable)).
37a0: 09 09 09 09 27 28 28 29 29 29 29 20 3b 3b 20 61 ....'(()))) ;; a
37b0: 20 6c 69 73 74 20 77 69 74 68 20 6f 6e 65 20 6e list with one n
37c0: 75 6c 6c 20 6c 69 73 74 20 69 73 20 61 20 74 65 ull list is a te
37d0: 73 74 20 77 69 74 68 20 6e 6f 20 69 74 65 6d 73 st with no items
37e0: 0a 09 20 20 20 20 20 20 20 28 72 75 6e 63 6f 6e .. (runcon
37f0: 66 69 67 66 20 20 28 63 6f 6e 63 20 20 2a 74 6f figf (conc *to
3800: 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 ppath* "/runconf
3810: 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 29 0a 09 igs.config")))..
3820: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
3830: 20 22 69 74 65 6d 73 3a 20 22 29 0a 09 20 20 28 "items: ").. (
3840: 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 if (>= *verbosit
3850: 79 2a 20 31 29 28 70 70 20 61 6c 6c 69 74 65 6d y* 1)(pp allitem
3860: 73 29 29 0a 09 20 20 28 69 66 20 28 3e 3d 20 2a s)).. (if (>= *
3870: 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 verbosity* 5)..
3880: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 28 70 (begin...(p
3890: 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 28 rint "items: ")(
38a0: 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d 3e pp (item-assoc->
38b0: 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 29 item-list items)
38c0: 29 0a 09 09 28 70 72 69 6e 74 20 22 69 74 65 73 )...(print "ites
38d0: 74 61 62 6c 65 3a 20 22 29 28 70 70 20 28 69 74 table: ")(pp (it
38e0: 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c em-table->item-l
38f0: 69 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 ist itemstable))
3900: 29 29 0a 09 20 20 28 69 66 20 28 61 72 67 73 3a )).. (if (args:
3910: 67 65 74 2d 61 72 67 20 22 2d 6d 22 29 0a 09 20 get-arg "-m")..
3920: 20 20 20 20 20 28 64 62 3a 73 65 74 2d 63 6f 6d (db:set-com
3930: 6d 65 6e 74 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ment-for-run db
3940: 72 75 6e 2d 69 64 20 28 61 72 67 73 3a 67 65 74 run-id (args:get
3950: 2d 61 72 67 20 22 2d 6d 22 29 29 29 0a 09 20 20 -arg "-m")))..
3960: 3b 3b 20 62 72 61 69 6e 64 65 61 64 20 77 6f 72 ;; braindead wor
3970: 6b 2d 61 72 6f 75 6e 64 20 66 6f 72 20 70 6f 6f k-around for poo
3980: 72 6c 79 20 73 70 65 63 69 66 69 65 64 20 61 6c rly specified al
3990: 6c 69 74 65 6d 73 20 6c 69 73 74 20 42 55 47 21 litems list BUG!
39a0: 21 21 20 46 49 58 4d 45 0a 09 20 20 28 69 66 20 !! FIXME.. (if
39b0: 28 6e 75 6c 6c 3f 20 61 6c 6c 69 74 65 6d 73 29 (null? allitems)
39c0: 28 73 65 74 21 20 61 6c 6c 69 74 65 6d 73 20 27 (set! allitems '
39d0: 28 28 29 29 29 29 0a 09 20 20 28 6c 65 74 20 6c (()))).. (let l
39e0: 6f 6f 70 20 28 28 69 74 65 6d 64 61 74 20 28 63 oop ((itemdat (c
39f0: 61 72 20 61 6c 6c 69 74 65 6d 73 29 29 0a 09 09 ar allitems))...
3a00: 20 20 20 20 20 28 74 61 6c 20 20 20 20 20 28 63 (tal (c
3a10: 64 72 20 61 6c 6c 69 74 65 6d 73 29 29 29 0a 09 dr allitems)))..
3a20: 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 ;; (lambda (
3a30: 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 itemdat) ;;; ((r
3a40: 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 ipeness "overrip
3a50: 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 e") (temperature
3a60: 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e "cool") (season
3a70: 20 22 73 75 6d 6d 65 72 22 29 29 0a 09 20 20 20 "summer"))..
3a80: 20 3b 3b 20 48 61 6e 64 6c 65 20 6c 69 73 74 73 ;; Handle lists
3a90: 20 6f 66 20 69 74 65 6d 73 0a 09 20 20 20 20 28 of items.. (
3aa0: 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 let* ((item-path
3ab0: 20 20 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d (item-list-
3ac0: 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 20 >path itemdat))
3ad0: 3b 3b 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 ;; (string-inter
3ae0: 73 70 65 72 73 65 20 28 6d 61 70 20 63 61 64 72 sperse (map cadr
3af0: 20 69 74 65 6d 64 61 74 29 20 22 2f 22 29 29 0a itemdat) "/")).
3b00: 09 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 70 .. (new-test-p
3b10: 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 ath (string-inte
3b20: 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 rsperse (cons te
3b30: 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 st-path (map cad
3b40: 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 r itemdat)) "/")
3b50: 29 0a 09 09 20 20 20 28 6e 65 77 2d 74 65 73 74 )... (new-test
3b60: 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c -name (if (equal
3b70: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 ? item-path "")
3b80: 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 test-name (conc
3b90: 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 test-name "/" it
3ba0: 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 em-path))) ;; ju
3bb0: 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 st need it to be
3bc0: 20 75 6e 69 71 75 65 0a 09 09 20 20 20 28 74 65 unique... (te
3bd0: 73 74 64 61 74 20 20 20 23 66 29 0a 09 09 20 20 stdat #f)...
3be0: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 (num-running (d
3bf0: 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 b:get-count-test
3c00: 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 s-running db))..
3c10: 09 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 . (max-concurr
3c20: 65 6e 74 2d 6a 6f 62 73 20 28 63 6f 6e 66 69 67 ent-jobs (config
3c30: 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 -lookup *configd
3c40: 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d 61 78 at* "setup" "max
3c50: 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 _concurrent_jobs
3c60: 22 29 29 0a 09 09 20 20 20 28 70 61 72 65 6e 74 "))... (parent
3c70: 2d 74 65 73 74 20 28 61 6e 64 20 28 6e 6f 74 20 -test (and (not
3c80: 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 29 28 65 (null? items))(e
3c90: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
3ca0: 22 22 29 29 29 0a 09 09 20 20 20 28 73 69 6e 67 "")))... (sing
3cb0: 6c 65 2d 74 65 73 74 20 28 61 6e 64 20 28 6e 75 le-test (and (nu
3cc0: 6c 6c 3f 20 69 74 65 6d 73 29 20 28 65 71 75 61 ll? items) (equa
3cd0: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 l? item-path "")
3ce0: 29 29 0a 09 09 20 20 20 28 69 74 65 6d 2d 74 65 ))... (item-te
3cf0: 73 74 20 20 20 28 6e 6f 74 20 28 65 71 75 61 6c st (not (equal
3d00: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 ? item-path ""))
3d10: 29 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 )).. (debug
3d20: 3a 70 72 69 6e 74 20 33 20 22 6d 61 78 2d 63 6f :print 3 "max-co
3d30: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 ncurrent-jobs: "
3d40: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
3d50: 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e jobs ", num-runn
3d60: 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 ing: " num-runni
3d70: 6e 67 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 ng).. (if (
3d80: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
3d90: 65 2d 74 65 73 74 73 20 64 62 29 0a 09 09 20 20 e-tests db)...
3da0: 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 6c 65 (begin... (le
3db0: 74 20 6c 6f 6f 70 32 20 28 28 74 73 20 28 64 62 t loop2 ((ts (db
3dc0: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 :get-test-info d
3dd0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
3de0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 20 3b me item-path)) ;
3df0: 3b 20 23 66 29 0a 09 09 09 09 28 63 74 20 30 29 ; #f).....(ct 0)
3e00: 29 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 61 )... (if (a
3e10: 6e 64 20 28 6e 6f 74 20 74 73 29 0a 09 09 09 20 nd (not ts)....
3e20: 20 20 20 20 20 20 28 3c 20 63 74 20 31 30 29 29 (< ct 10))
3e30: 0a 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 09 .... (begin....
3e40: 20 20 20 20 28 72 65 67 69 73 74 65 72 2d 74 65 (register-te
3e50: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 st db run-id tes
3e60: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
3e70: 29 0a 09 09 09 20 20 20 20 28 64 62 3a 74 65 73 ).... (db:tes
3e80: 74 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 64 62 t-set-comment db
3e90: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
3ea0: 65 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 0a e item-path "").
3eb0: 09 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 28 64 ... (loop2 (d
3ec0: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 b:get-test-info
3ed0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
3ee0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 ame item-path)..
3ef0: 09 09 09 20 20 20 28 2b 20 63 74 20 31 29 29 29 ... (+ ct 1)))
3f00: 0a 09 09 09 20 20 28 69 66 20 74 73 0a 09 09 09 .... (if ts....
3f10: 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 (set! test
3f20: 64 61 74 20 74 73 29 0a 09 09 09 20 20 20 20 20 dat ts)....
3f30: 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 62 (begin.....(deb
3f40: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
3f50: 49 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 72 65 ING: Couldn't re
3f60: 67 69 73 74 65 72 20 74 65 73 74 20 22 20 74 65 gister test " te
3f70: 73 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 20 69 st-name " with i
3f80: 74 65 6d 20 70 61 74 68 20 22 20 69 74 65 6d 2d tem path " item-
3f90: 70 61 74 68 20 22 2c 20 73 6b 69 70 70 69 6e 67 path ", skipping
3fa0: 22 29 0a 09 09 09 09 28 69 66 20 28 6e 6f 74 20 ").....(if (not
3fb0: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 09 (null? tal))....
3fc0: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 . (loop (car
3fd0: 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 tal)(cdr tal))))
3fe0: 29 29 29 0a 09 09 20 20 20 20 28 63 68 61 6e 67 )))... (chang
3ff0: 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 e-directory test
4000: 2d 70 61 74 68 29 0a 09 09 20 20 20 20 3b 3b 20 -path)... ;;
4010: 74 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 68 65 this block is he
4020: 72 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 6f 72 re only to infor
4030: 6d 20 74 68 65 20 75 73 65 72 20 65 61 72 6c 79 m the user early
4040: 20 6f 6e 0a 09 09 20 20 20 20 28 69 66 20 28 66 on... (if (f
4050: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 ile-exists? runc
4060: 6f 6e 66 69 67 66 29 0a 09 09 09 28 73 65 74 75 onfigf)....(setu
4070: 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 64 p-env-defaults d
4080: 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e b runconfigf run
4090: 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65 -id *already-see
40a0: 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f n-runconfig-info
40b0: 2a 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 *)....(debug:pri
40c0: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 nt 0 "WARNING: Y
40d0: 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 ou do not have a
40e0: 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 run config file
40f0: 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 : " runconfigf))
4100: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
4110: 69 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 22 int 4 "run-id: "
4120: 20 72 75 6e 2d 69 64 20 22 20 74 65 73 74 2d 6e run-id " test-n
4130: 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 ame: " test-name
4140: 20 22 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 " item-path: "
4150: 69 74 65 6d 2d 70 61 74 68 20 22 20 74 65 73 74 item-path " test
4160: 64 61 74 3a 20 22 20 28 74 65 73 74 3a 67 65 74 dat: " (test:get
4170: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
4180: 20 22 20 74 65 73 74 2d 73 74 61 74 65 3a 20 22 " test-state: "
4190: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
41a0: 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 testdat))...
41b0: 20 28 63 61 73 65 20 28 69 66 20 28 61 72 67 73 (case (if (args
41c0: 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 :get-arg "-force
41d0: 22 29 0a 09 09 09 20 20 20 20 20 20 27 4e 4f 54 ").... 'NOT
41e0: 5f 53 54 41 52 54 45 44 0a 09 09 09 20 20 20 20 _STARTED....
41f0: 20 20 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 (if testdat...
4200: 09 09 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d .. (string->sym
4210: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 bol (test:get-st
4220: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
4230: 09 09 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 .. 'failed-to-i
4240: 6e 73 65 72 74 29 29 0a 09 09 20 20 20 20 20 20 nsert))...
4250: 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 ((failed-to-inse
4260: 72 74 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 rt)... (de
4270: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
4280: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e OR: Failed to in
4290: 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 sert the record
42a0: 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 into the db"))..
42b0: 09 20 20 20 20 20 20 28 28 4e 4f 54 5f 53 54 41 . ((NOT_STA
42c0: 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a RTED COMPLETED).
42d0: 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
42e0: 70 72 69 6e 74 20 36 20 22 47 6f 74 20 68 65 72 print 6 "Got her
42f0: 65 2c 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 e, " (test:get-s
4300: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 tate testdat))..
4310: 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 . (let ((r
4320: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 unflag #f))....
4330: 28 63 6f 6e 64 0a 09 09 09 20 20 3b 3b 20 69 2e (cond.... ;; i.
4340: 65 2e 20 74 68 69 73 20 69 73 20 74 68 65 20 70 e. this is the p
4350: 61 72 65 6e 74 20 74 65 73 74 20 74 6f 20 61 20 arent test to a
4360: 73 75 69 74 65 20 6f 66 20 69 74 65 6d 73 2c 20 suite of items,
4370: 6e 65 76 65 72 20 22 72 75 6e 22 20 69 74 0a 09 never "run" it..
4380: 09 09 20 20 28 70 61 72 65 6e 74 2d 74 65 73 74 .. (parent-test
4390: 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e .... (set! run
43a0: 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 3b flag #f)).... ;
43b0: 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f ; -force, run no
43c0: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 09 09 matter what....
43d0: 20 20 28 28 61 72 67 73 3a 67 65 74 2d 61 72 67 ((args:get-arg
43e0: 20 22 2d 66 6f 72 63 65 22 29 28 73 65 74 21 20 "-force")(set!
43f0: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 runflag #t))....
4400: 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 ;; NOT_STARTED
4410: 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 , run no matter
4420: 77 68 61 74 0a 09 09 09 20 20 28 28 65 71 75 61 what.... ((equa
4430: 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 l? (test:get-sta
4440: 74 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 te testdat) "NOT
4450: 5f 53 54 41 52 54 45 44 22 29 28 73 65 74 21 20 _STARTED")(set!
4460: 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 09 runflag #t))....
4470: 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 ;; not -rerun
4480: 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f and PASS, WARN o
4490: 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 r CHECK, do no r
44a0: 75 6e 0a 09 09 09 20 20 28 28 61 6e 64 20 28 6f un.... ((and (o
44b0: 72 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 r (not (args:get
44c0: 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 29 29 0a -arg "-rerun")).
44d0: 09 09 09 09 20 20 20 20 28 61 72 67 73 3a 67 65 .... (args:ge
44e0: 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e t-arg "-keepgoin
44f0: 67 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 g")).....(member
4500: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 (test:get-statu
4510: 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 s testdat) '("PA
4520: 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 SS" "WARN" "CHEC
4530: 4b 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 74 K"))).... (set
4540: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 ! runflag #f))..
4550: 09 09 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e .. ;; -rerun an
4560: 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 d status is one
4570: 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64 2c of the specifed,
4580: 20 72 75 6e 20 69 74 0a 09 09 09 20 20 28 28 61 run it.... ((a
4590: 6e 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 nd (args:get-arg
45a0: 20 22 2d 72 65 72 75 6e 22 29 0a 09 09 09 09 28 "-rerun").....(
45b0: 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 74 20 28 let ((rerunlst (
45c0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 61 72 string-split (ar
45d0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 gs:get-arg "-rer
45e0: 75 6e 22 29 20 22 2c 22 29 29 29 20 3b 3b 20 46 un") ","))) ;; F
45f0: 41 49 4c 2c 0a 09 09 09 09 20 20 28 6d 65 6d 62 AIL,..... (memb
4600: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
4610: 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 72 tus testdat) rer
4620: 75 6e 6c 73 74 29 29 29 0a 09 09 09 20 20 20 28 unlst))).... (
4630: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
4640: 29 0a 09 09 09 20 20 3b 3b 20 2d 6b 65 65 70 67 ).... ;; -keepg
4650: 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 oing, do not rer
4660: 75 6e 20 46 41 49 4c 0a 09 09 09 20 20 28 28 61 un FAIL.... ((a
4670: 6e 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 nd (args:get-arg
4680: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 0a 09 "-keepgoing")..
4690: 09 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 74 ...(member (test
46a0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
46b0: 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 dat) '("FAIL")))
46c0: 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 75 6e .... (set! run
46d0: 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 28 flag #f)).... (
46e0: 28 61 6e 64 20 28 6e 6f 74 20 28 61 72 67 73 3a (and (not (args:
46f0: 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 get-arg "-rerun"
4700: 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 28 )).....(member (
4710: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
4720: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c testdat) '("FAIL
4730: 22 20 22 6e 2f 61 22 29 29 29 0a 09 09 09 20 20 " "n/a")))....
4740: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
4750: 74 29 29 0a 09 09 09 20 20 28 65 6c 73 65 20 28 t)).... (else (
4760: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
4770: 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 )).... (debug:pr
4780: 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d int 6 "RUNNING =
4790: 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e > runflag: " run
47a0: 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 flag " STATE: "
47b0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
47c0: 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55 testdat) " STATU
47d0: 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 S: " (test:get-s
47e0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a tatus testdat)).
47f0: 09 09 09 20 28 69 66 20 28 6e 6f 74 20 72 75 6e ... (if (not run
4800: 66 6c 61 67 29 0a 09 09 09 20 20 20 20 20 28 69 flag).... (i
4810: 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 f (not parent-te
4820: 73 74 29 0a 09 09 09 09 20 28 64 65 62 75 67 3a st)..... (debug:
4830: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e print 1 "NOTE: N
4840: 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 ot starting test
4850: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 " new-test-name
4860: 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74 " as it is stat
4870: 65 20 5c 22 43 4f 4d 50 4c 45 54 45 44 5c 22 20 e \"COMPLETED\"
4880: 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 and status \"" (
4890: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
48a0: 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 testdat) "\", us
48b0: 65 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 e -force to over
48c0: 72 69 64 65 22 29 29 0a 09 09 09 20 20 20 20 20 ride"))....
48d0: 28 6c 65 74 2a 20 28 28 67 65 74 2d 70 72 65 72 (let* ((get-prer
48e0: 65 71 73 2d 63 6d 64 20 28 6c 61 6d 62 64 61 20 eqs-cmd (lambda
48f0: 28 29 0a 09 09 09 09 09 09 20 20 20 20 20 20 20 ().......
4900: 28 64 62 2d 67 65 74 2d 70 72 65 72 65 71 73 2d (db-get-prereqs-
4910: 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 not-met db run-i
4920: 64 20 77 61 69 74 6f 6e 29 29 29 20 3b 3b 20 63 d waiton))) ;; c
4930: 68 65 63 6b 20 62 65 66 6f 72 65 20 72 75 6e 6e heck before runn
4940: 69 6e 67 20 2e 2e 2e 2e 0a 09 09 09 09 20 20 20 ing .........
4950: 20 28 6c 61 75 6e 63 68 2d 63 6d 64 20 20 20 20 (launch-cmd
4960: 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 09 (lambda ()....
4970: 09 09 09 20 20 20 20 20 20 20 28 6c 61 75 6e 63 ... (launc
4980: 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 h-test db run-id
4990: 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 test-conf keyva
49a0: 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 llst test-name t
49b0: 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 est-path itemdat
49c0: 29 29 29 0a 09 09 09 09 20 20 20 20 28 74 65 73 )))..... (tes
49d0: 74 72 75 6e 64 61 74 20 20 20 20 20 20 28 6c 69 trundat (li
49e0: 73 74 20 67 65 74 2d 70 72 65 72 65 71 73 2d 63 st get-prereqs-c
49f0: 6d 64 20 6c 61 75 6e 63 68 2d 63 6d 64 29 29 29 md launch-cmd)))
4a00: 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 .... (if (
4a10: 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 or (args:get-arg
4a20: 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 09 20 "-force").....
4a30: 20 20 20 20 20 20 28 6e 75 6c 6c 3f 20 28 28 63 (null? ((c
4a40: 61 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 29 ar testrundat)))
4a50: 29 20 3b 3b 20 61 72 65 20 74 68 65 72 65 20 61 ) ;; are there a
4a60: 6e 79 20 74 65 73 74 73 20 74 68 61 74 20 6d 75 ny tests that mu
4a70: 73 74 20 62 65 20 72 75 6e 20 62 65 66 6f 72 65 st be run before
4a80: 20 74 68 69 73 20 6f 6e 65 2e 2e 2e 0a 09 09 09 this one.......
4a90: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 28 63 . (if (not ((c
4aa0: 61 64 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 adr testrundat))
4ab0: 29 20 3b 3b 20 74 68 69 73 20 69 73 20 74 68 65 ) ;; this is the
4ac0: 20 6c 69 6e 65 20 74 68 61 74 20 6c 61 75 6e 63 line that launc
4ad0: 68 65 73 20 74 68 65 20 74 65 73 74 20 74 6f 20 hes the test to
4ae0: 74 68 65 20 72 65 6d 6f 74 65 20 68 6f 73 74 0a the remote host.
4af0: 09 09 09 09 20 20 20 20 20 20 20 28 62 65 67 69 .... (begi
4b00: 6e 0a 09 09 09 09 09 20 28 70 72 69 6e 74 20 22 n...... (print "
4b10: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
4b20: 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 launch the test
4b30: 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f . Exiting as soo
4b40: 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a n as possible").
4b50: 09 09 09 09 09 20 28 73 65 74 21 20 2a 67 6c 6f ..... (set! *glo
4b60: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 balexitstatus* 1
4b70: 29 20 3b 3b 20 0a 09 09 09 09 09 20 28 70 72 6f ) ;; ...... (pro
4b80: 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 cess-signal (cur
4b90: 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 rent-process-id)
4ba0: 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 0a 09 09 signal/kill)...
4bb0: 09 09 09 20 3b 28 65 78 69 74 20 31 29 0a 09 09 ... ;(exit 1)...
4bc0: 09 09 09 20 29 29 0a 09 09 09 09 20 20 20 28 69 ... ))..... (i
4bd0: 66 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 74 f (not (args:get
4be0: 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 -arg "-keepgoing
4bf0: 22 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 "))..... (
4c00: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
4c10: 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 2a 20 *waiting-queue*
4c20: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 new-test-name te
4c30: 73 74 72 75 6e 64 61 74 29 29 29 29 29 29 29 0a strundat))))))).
4c40: 09 09 20 20 20 20 20 20 28 28 4b 49 4c 4c 45 44 .. ((KILLED
4c50: 29 20 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 ) ... (deb
4c60: 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 ug:print 1 "NOTE
4c70: 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d : " new-test-nam
4c80: 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 e " is already r
4c90: 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 unning or was ex
4ca0: 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 plictly killed,
4cb0: 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 use -force to la
4cc0: 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 09 20 20 unch it."))...
4cd0: 20 20 20 20 28 28 4c 41 55 4e 43 48 45 44 20 52 ((LAUNCHED R
4ce0: 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 EMOTEHOSTSTART R
4cf0: 55 4e 4e 49 4e 47 29 20 20 0a 09 09 20 20 20 20 UNNING) ...
4d00: 20 20 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 (if (> (- (cu
4d10: 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b rrent-seconds)(+
4d20: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 (db:test-get-ev
4d30: 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 ent_time testdat
4d40: 29 0a 09 09 09 09 09 09 20 20 20 20 20 28 64 62 )....... (db
4d50: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 :test-get-run_du
4d60: 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 ration testdat))
4d70: 29 0a 09 09 09 20 20 20 20 20 20 31 30 30 29 20 ).... 100)
4d80: 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 ;; i.e. no updat
4d90: 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 e for more than
4da0: 31 30 30 20 73 65 63 6f 6e 64 73 0a 09 09 09 20 100 seconds....
4db0: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 (begin....
4dc0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
4dd0: 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 "WARNING: Test "
4de0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 test-name " app
4df0: 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e ears to be dead.
4e00: 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 Forcing it to s
4e10: 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 tate INCOMPLETE
4e20: 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b and status STUCK
4e30: 2f 44 45 41 44 22 29 0a 09 09 09 20 20 20 20 20 /DEAD")....
4e40: 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 (test-set-status
4e50: 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 ! db run-id test
4e60: 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 54 -name "INCOMPLET
4e70: 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 E" "STUCK/DEAD"
4e80: 69 74 65 6d 64 61 74 20 22 54 65 73 74 20 69 73 itemdat "Test is
4e90: 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 29 stuck or dead")
4ea0: 29 0a 09 09 09 20 20 20 28 64 65 62 75 67 3a 70 ).... (debug:p
4eb0: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 rint 2 "NOTE: "
4ec0: 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 test-name " is a
4ed0: 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 lready running")
4ee0: 29 29 0a 09 09 20 20 20 20 20 20 28 65 6c 73 65 ))... (else
4ef0: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
4f00: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 int 0 "ERROR: Fa
4f10: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 iled to launch t
4f20: 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e est " new-test-n
4f30: 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 ame ". Unrecogni
4f40: 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 73 sed state " (tes
4f50: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
4f60: 64 61 74 29 29 29 29 29 29 0a 09 20 20 20 20 20 dat))))))..
4f70: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
4f80: 20 74 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f 70 tal))... (loop
4f90: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 (car tal)(cdr t
4fa0: 61 6c 29 29 29 29 29 29 29 29 29 0a 0a 28 64 65 al)))))))))..(de
4fb0: 66 69 6e 65 20 28 72 75 6e 2d 77 61 69 74 69 6e fine (run-waitin
4fc0: 67 2d 74 65 73 74 73 20 64 62 29 0a 20 20 28 6c g-tests db). (l
4fd0: 65 74 20 28 28 6e 75 6d 74 72 69 65 73 20 20 20 et ((numtries
4fe0: 20 20 20 20 20 20 20 20 30 29 0a 09 28 6c 61 73 0)..(las
4ff0: 74 2d 74 72 79 2d 74 69 6d 65 20 20 20 20 20 20 t-try-time
5000: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 (current-seconds
5010: 29 29 0a 09 28 74 69 6d 65 73 20 20 20 20 20 20 ))..(times
5020: 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 31 29 (list 1)
5030: 29 29 20 3b 3b 20 6d 69 6e 75 74 65 73 20 74 6f )) ;; minutes to
5040: 20 77 61 69 74 20 62 65 66 6f 72 65 20 74 72 79 wait before try
5050: 69 6e 67 20 61 67 61 69 6e 20 74 6f 20 6b 69 63 ing again to kic
5060: 6b 20 6f 66 66 20 72 75 6e 73 0a 20 20 20 20 3b k off runs. ;
5070: 3b 20 42 55 47 20 74 68 69 73 20 68 61 63 6b 20 ; BUG this hack
5080: 6f 66 20 62 72 75 74 65 20 66 6f 72 63 65 20 72 of brute force r
5090: 65 74 72 79 69 6e 67 20 77 6f 72 6b 73 20 71 75 etrying works qu
50a0: 69 74 65 20 77 65 6c 6c 20 66 6f 72 20 6d 61 6e ite well for man
50b0: 79 20 63 61 73 65 73 20 62 75 74 20 0a 20 20 20 y cases but .
50c0: 20 3b 3b 20 20 20 20 20 77 68 61 74 20 69 73 20 ;; what is
50d0: 6e 65 65 64 65 64 20 69 73 20 74 6f 20 63 68 65 needed is to che
50e0: 63 6b 20 74 68 65 20 64 62 20 66 6f 72 20 74 65 ck the db for te
50f0: 73 74 73 20 74 68 61 74 20 68 61 76 65 20 66 61 sts that have fa
5100: 69 6c 65 64 20 6c 65 73 73 20 74 68 61 6e 0a 20 iled less than.
5110: 20 20 20 3b 3b 20 20 20 20 20 4e 20 74 69 6d 65 ;; N time
5120: 73 20 6f 72 20 6e 65 76 65 72 20 62 65 65 6e 20 s or never been
5130: 73 74 61 72 74 65 64 20 61 6e 64 20 6b 69 63 6b started and kick
5140: 20 74 68 65 6d 20 6f 66 66 20 61 67 61 69 6e 0a them off again.
5150: 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 (let loop ((
5160: 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d waiting-test-nam
5170: 65 73 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b es (hash-table-k
5180: 65 79 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 eys *waiting-que
5190: 75 65 2a 29 29 29 0a 20 20 20 20 20 20 28 63 6f ue*))). (co
51a0: 6e 64 0a 20 20 20 20 20 20 20 28 28 6e 6f 74 20 nd. ((not
51b0: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f (runs:can-run-mo
51c0: 72 65 2d 74 65 73 74 73 20 64 62 29 29 0a 09 28 re-tests db))..(
51d0: 73 6c 65 65 70 20 32 29 0a 09 28 6c 6f 6f 70 20 sleep 2)..(loop
51e0: 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 6d waiting-test-nam
51f0: 65 73 29 29 0a 20 20 20 20 20 20 20 28 28 6e 75 es)). ((nu
5200: 6c 6c 3f 20 77 61 69 74 69 6e 67 2d 74 65 73 74 ll? waiting-test
5210: 2d 6e 61 6d 65 73 29 0a 09 28 64 65 62 75 67 3a -names)..(debug:
5220: 70 72 69 6e 74 20 31 20 22 41 6c 6c 20 74 65 73 print 1 "All tes
5230: 74 73 20 6c 61 75 6e 63 68 65 64 22 29 29 0a 20 ts launched")).
5240: 20 20 20 20 20 20 28 65 6c 73 65 0a 09 28 73 65 (else..(se
5250: 74 21 20 6e 75 6d 74 72 69 65 73 20 28 2b 20 6e t! numtries (+ n
5260: 75 6d 74 72 69 65 73 20 31 29 29 0a 09 28 66 6f umtries 1))..(fo
5270: 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 r-each (lambda (
5280: 74 65 73 74 6e 61 6d 65 29 0a 09 09 20 20 20 20 testname)...
5290: 28 69 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 (if (runs:can-ru
52a0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 29 n-more-tests db)
52b0: 0a 09 09 09 28 6c 65 74 2a 20 28 28 74 65 73 74 ....(let* ((test
52c0: 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d dat (hash-table-
52d0: 72 65 66 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 ref *waiting-que
52e0: 75 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 0a 09 ue* testname))..
52f0: 09 09 20 20 20 20 20 20 20 28 70 72 65 72 65 71 .. (prereq
5300: 73 20 28 28 63 61 72 20 74 65 73 74 64 61 74 29 s ((car testdat)
5310: 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6c 64 )).... (ld
5320: 62 20 20 20 20 20 28 69 66 20 64 62 20 64 62 20 b (if db db
5330: 28 6f 70 65 6e 2d 64 62 29 29 29 29 0a 09 09 09 (open-db))))....
5340: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
5350: 20 22 70 72 65 72 65 71 73 20 72 65 6d 61 69 6e "prereqs remain
5360: 69 6e 67 3a 20 22 20 70 72 65 72 65 71 73 29 0a ing: " prereqs).
5370: 09 09 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 ... (if (null?
5380: 70 72 65 72 65 71 73 29 0a 09 09 09 20 20 20 20 prereqs)....
5390: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 (begin.....(de
53a0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 50 72 65 bug:print 2 "Pre
53b0: 72 65 71 75 69 73 69 74 65 73 20 6d 65 74 2c 20 requisites met,
53c0: 6c 61 75 6e 63 68 69 6e 67 20 22 20 74 65 73 74 launching " test
53d0: 6e 61 6d 65 29 0a 09 09 09 09 28 28 63 61 64 72 name).....((cadr
53e0: 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 09 28 testdat)).....(
53f0: 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 hash-table-delet
5400: 65 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 e! *waiting-queu
5410: 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 29 0a 09 e* testname)))..
5420: 09 09 20 20 28 69 66 20 28 6e 6f 74 20 64 62 29 .. (if (not db)
5430: 0a 09 09 09 20 20 20 20 20 20 28 73 71 6c 69 74 .... (sqlit
5440: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 6c 64 62 e3:finalize! ldb
5450: 29 29 29 29 29 0a 09 09 20 20 77 61 69 74 69 6e )))))... waitin
5460: 67 2d 74 65 73 74 2d 6e 61 6d 65 73 29 0a 09 3b g-test-names)..;
5470: 3b 20 28 73 6c 65 65 70 20 31 30 29 20 3b 3b 20 ; (sleep 10) ;;
5480: 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 72 75 73 68 no point in rush
5490: 69 6e 67 20 74 68 69 6e 67 73 20 61 74 20 74 68 ing things at th
54a0: 69 73 20 73 74 61 67 65 3f 0a 09 28 6c 6f 6f 70 is stage?..(loop
54b0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 (hash-table-key
54c0: 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 s *waiting-queue
54d0: 2a 29 29 29 29 29 29 29 0a 0a 28 64 65 66 69 6e *)))))))..(defin
54e0: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 e (get-dir-up-n
54f0: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 dir . params) .
5500: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 (let ((dparts
5510: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 (string-split di
5520: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 r "/"))..(count
5530: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 (if (null? par
5540: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 ams) 1 (car para
5550: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 ms)))). (conc
5560: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
5570: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 ersperse ..
5580: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 (take dparts (
5590: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
55a0: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 ) count))..
55b0: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d "/")))).;; Rem
55c0: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c ove runs.;; fiel
55d0: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 ds are passing i
55e0: 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 69 n through .(defi
55f0: 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 2d ne (runs:remove-
5600: 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 70 runs db runnamep
5610: 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 65 att testpatt ite
5620: 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 28 mpatt). (let* (
5630: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 62 (keys (db
5640: 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 -get-keys db))..
5650: 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 28 72 (rundat (r
5660: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d uns:get-runs-by-
5670: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e patt db keys run
5680: 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 namepatt)).. (he
5690: 61 64 65 72 20 20 20 20 20 20 28 76 65 63 74 6f ader (vecto
56a0: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 r-ref rundat 0))
56b0: 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 .. (runs
56c0: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
56d0: 61 74 20 31 29 29 29 0a 20 20 20 20 28 64 65 62 at 1))). (deb
56e0: 75 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 64 ug:print 1 "Head
56f0: 65 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 20 er: " header).
5700: 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 (for-each.
5710: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 (lambda (run).
5720: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e (let ((run
5730: 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 key (string-inte
5740: 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 rsperse (map (la
5750: 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 mbda (k).......(
5760: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
5770: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
5780: 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 r (vector-ref k
5790: 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0))) keys) "/"))
57a0: 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d ).. (let* ((run-
57b0: 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 id (db:get-value
57c0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
57d0: 65 61 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 eader "id") )...
57e0: 28 74 65 73 74 73 20 20 28 64 62 2d 67 65 74 2d (tests (db-get-
57f0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
5800: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
5810: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
5820: 64 65 72 20 22 69 64 22 29 20 74 65 73 74 70 61 der "id") testpa
5830: 74 74 20 69 74 65 6d 70 61 74 74 29 29 0a 09 09 tt itempatt))...
5840: 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 (lasttpath "/doe
5850: 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f s/not/exist/I/ho
5860: 70 65 22 29 29 0a 09 20 20 20 28 69 66 20 28 6e pe")).. (if (n
5870: 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 ot (null? tests)
5880: 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 6e ).. (begin
5890: 0a 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ... (debug:print
58a0: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 1 "Removing tes
58b0: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 ts for run: " ru
58c0: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 nkey " " (db:get
58d0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
58e0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e run header "run
58f0: 6e 61 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 2d name"))... (for-
5900: 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 each... (lambda
5910: 20 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 6c (test)... (l
5920: 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 20 et* ((item-path
5930: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 (db:test-get-ite
5940: 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 09 m-path test))...
5950: 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 . (test-name (
5960: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
5970: 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 20 name test))....
5980: 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 62 (run-dir (db
5990: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 :test-get-rundir
59a0: 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 20 test)))...
59b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
59c0: 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 " " (db:test-ge
59d0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 t-testname test)
59e0: 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 " id: " (db:tes
59f0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 t-get-id test) "
5a00: 20 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 " item-path)...
5a10: 20 20 20 20 20 20 28 64 62 3a 64 65 6c 65 74 65 (db:delete
5a20: 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 -test-records db
5a30: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
5a40: 20 74 65 73 74 29 29 0a 09 09 20 20 20 20 20 20 test))...
5a50: 28 69 66 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c (if (> (string-l
5a60: 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 35 ength run-dir) 5
5a70: 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 ) ;; bad heurist
5a80: 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 ic but should pr
5a90: 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 event /tmp /home
5aa0: 20 65 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 20 etc..... (let
5ab0: 28 28 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d 64 ((fullpath run-d
5ac0: 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 3a ir)) ;; "/" (db:
5ad0: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
5ae0: 74 68 20 74 65 73 74 29 29 29 29 0a 09 09 09 20 th test))))....
5af0: 20 20 20 28 73 65 74 21 20 6c 61 73 74 74 70 61 (set! lasttpa
5b00: 74 68 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 th fullpath)....
5b10: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5b20: 20 31 20 22 72 6d 20 2d 72 66 20 22 20 66 75 6c 1 "rm -rf " ful
5b30: 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 73 lpath).... (s
5b40: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 ystem (conc "rm
5b50: 2d 72 66 20 22 20 66 75 6c 6c 70 61 74 68 29 29 -rf " fullpath))
5b60: 0a 09 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 .... (let* ((
5b70: 64 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 dirs-count (+ 1
5b80: 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 (length keys)(le
5b90: 6e 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c ngth (string-spl
5ba0: 69 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 it item-path "/"
5bb0: 29 29 29 29 0a 09 09 09 09 20 20 20 28 64 69 72 ))))..... (dir
5bc0: 2d 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 72 -to-rem (get-dir
5bd0: 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 64 -up-n fullpath d
5be0: 69 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 09 irs-count)).....
5bf0: 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 (remainingd (
5c00: 73 74 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 string-substitut
5c10: 65 20 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 e (regexp (conc
5c20: 22 5e 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 "^" dir-to-rem "
5c30: 2f 22 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 /")) "" fullpath
5c40: 29 29 0a 09 09 09 09 20 20 20 28 63 6d 64 20 28 ))..... (cmd (
5c50: 63 6f 6e 63 20 22 63 64 20 22 20 64 69 72 2d 74 conc "cd " dir-t
5c60: 6f 2d 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d o-rem "; rmdir -
5c70: 70 20 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 p " remainingd )
5c80: 29 29 0a 09 09 09 20 20 20 20 20 20 28 69 66 20 )).... (if
5c90: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 75 (file-exists? fu
5ca0: 6c 6c 70 61 74 68 29 0a 09 09 09 09 20 20 28 62 llpath)..... (b
5cb0: 65 67 69 6e 0a 09 09 09 09 20 20 20 20 28 64 65 egin..... (de
5cc0: 62 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 bug:print 1 cmd)
5cd0: 0a 09 09 09 09 20 20 20 20 28 73 79 73 74 65 6d ..... (system
5ce0: 20 63 6d 64 29 29 29 0a 09 09 09 20 20 20 20 20 cmd)))....
5cf0: 20 29 29 0a 09 09 09 20 20 20 20 29 29 29 0a 09 )).... )))..
5d00: 09 20 20 20 20 74 65 73 74 73 29 29 29 0a 09 20 . tests)))..
5d10: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 (let ((remtest
5d20: 73 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d s (db-get-tests-
5d30: 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 for-run db (db:g
5d40: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
5d50: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 er run header "i
5d60: 64 22 29 29 29 29 0a 09 20 20 20 20 20 28 69 66 d")))).. (if
5d70: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 (null? remtests
5d80: 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 ) ;; no more tes
5d90: 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 ts remaining...
5da0: 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 (let* ((dparts
5db0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 (string-split la
5dc0: 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 sttpath "/"))...
5dd0: 09 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 20 .(runpath (conc
5de0: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 "/" (string-inte
5df0: 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 20 rsperse ......
5e00: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 (take dparts (
5e10: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
5e20: 29 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 22 ) 1))...... "
5e30: 2f 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 62 /"))))... (deb
5e40: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
5e50: 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e 6b ving run: " runk
5e60: 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 ey " " (db:get-v
5e70: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
5e80: 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 un header "runna
5e90: 6d 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a 64 me"))... (db:d
5ea0: 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e elete-run db run
5eb0: 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 65 -id)... ;; nee
5ec0: 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 d to figure out
5ed0: 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 20 the path to the
5ee0: 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d 6f run dir and remo
5ef0: 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a 09 ve it if empty..
5f00: 09 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e . ;; (if (n
5f10: 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ull? (glob (conc
5f20: 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 runpath "/*")))
5f30: 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 20 ... ;;
5f40: 28 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 09 (begin... ;; .
5f50: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5f60: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 "Removing run di
5f70: 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 20 r " runpath)...
5f80: 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 28 ;; . (system (
5f90: 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 22 conc "rmdir -p "
5fa0: 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 20 runpath))))...
5fb0: 20 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 )))).. )).
5fc0: 20 72 75 6e 73 29 29 29 0a runs))).