0000: 0a 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30 .;; Copyright 20
0010: 30 36 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77 06-2011, Matthew
0020: 20 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b Welland..;; .;;
0030: 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 This program i
0040: 73 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 s made available
0050: 20 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 under the GNU G
0060: 50 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f PL version 2.0 o
0070: 72 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53 r.;; greater. S
0080: 65 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 ee the accompany
0090: 69 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 ing file COPYING
00a0: 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b for details..;;
00b0: 20 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72 .;; This progr
00c0: 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 am is distribute
00d0: 64 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 d WITHOUT ANY WA
00e0: 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 RRANTY; without
00f0: 65 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70 even the.;; imp
0100: 6c 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 lied warranty of
0110: 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 MERCHANTABILITY
0120: 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 or FITNESS FOR
0130: 41 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20 A PARTICULAR.;;
0140: 20 50 55 52 50 4f 53 45 2e 0a 0a 3b 3b 20 20 73 PURPOSE...;; s
0150: 74 72 66 74 69 6d 65 28 27 25 6d 2f 25 64 2f 25 trftime('%m/%d/%
0160: 59 20 25 48 3a 25 4d 3a 25 53 27 2c 27 6e 6f 77 Y %H:%M:%S','now
0170: 27 2c 27 6c 6f 63 61 6c 74 69 6d 65 27 29 0a 0a ','localtime')..
0180: 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 74 65 ;; register a te
0190: 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 65 20 st run with the
01a0: 64 62 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 db.(define (regi
01b0: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
01c0: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a ) ;; test-name).
01d0: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 72 (let* ((keystr
01e0: 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 74 (keys->keyst
01f0: 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d 6d r keys)).. (comm
0200: 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 a (if (> (le
0210: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 2c ngth keys) 0) ",
0220: 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 72 " "")).. (andstr
0230: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67 (if (> (leng
0240: 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 4e th keys) 0) " AN
0250: 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c 73 D " "")).. (vals
0260: 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 6c lots (keys->val
0270: 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b 20 slots keys)) ;;
0280: 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 79 ?,?,? ..... (key
0290: 76 61 6c 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 vallst (keys->va
02a0: 6c 6c 69 73 74 20 6b 65 79 73 29 29 20 3b 3b 20 llist keys)) ;;
02b0: 65 78 74 72 61 63 74 73 20 74 68 65 20 76 61 6c extracts the val
02c0: 75 65 73 20 66 72 6f 6d 20 72 65 6d 61 69 6e 64 ues from remaind
02d0: 65 72 20 6f 66 20 28 61 72 67 76 29 0a 09 20 28 er of (argv).. (
02e0: 72 75 6e 6e 61 6d 65 20 20 20 28 67 65 74 2d 77 runname (get-w
02f0: 69 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 72 75 ith-default ":ru
0300: 6e 6e 61 6d 65 22 20 23 66 29 29 0a 09 20 28 73 nname" #f)).. (s
0310: 74 61 74 65 20 20 20 20 20 28 67 65 74 2d 77 69 tate (get-wi
0320: 74 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 th-default ":sta
0330: 74 65 22 20 22 6e 6f 22 29 29 0a 09 20 28 73 74 te" "no")).. (st
0340: 61 74 75 73 20 20 20 20 28 67 65 74 2d 77 69 74 atus (get-wit
0350: 68 2d 64 65 66 61 75 6c 74 20 22 3a 73 74 61 74 h-default ":stat
0360: 75 73 22 20 22 6e 2f 61 22 29 29 0a 09 20 28 61 us" "n/a")).. (a
0370: 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 6e 64 llvals (append
0380: 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 20 73 (list runname s
0390: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 tate status user
03a0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03b0: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 (qryvals (appe
03c0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
03d0: 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 ) keyvallst))..
03e0: 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 (key=?str (stri
03f0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
0400: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 map (lambda (k)(
0410: 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 conc (key:get-fi
0420: 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 eldname k) "=?")
0430: 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 ) keys) " AND ")
0440: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
0450: 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b int 3 "keys: " k
0460: 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 eys " allvals: "
0470: 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 allvals " keyva
0480: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 llst: " keyvalls
0490: 74 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 t). (debug:pr
04a0: 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 int 2 "NOTE: usi
04b0: 6e 67 20 6b 65 79 20 22 20 28 73 74 72 69 6e 67 ng key " (string
04c0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 -intersperse key
04d0: 76 61 6c 6c 73 74 20 22 2f 22 29 20 22 20 66 6f vallst "/") " fo
04e0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 r this run").
04f0: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d (if (and runnam
0500: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 e (null? (filter
0510: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 (lambda (x)(not
0520: 20 78 29 29 20 6b 65 79 76 61 6c 6c 73 74 29 29 x)) keyvallst))
0530: 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 ) ;; there must
0540: 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20 be a better way
0550: 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 to "apply and"..
0560: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a (let ((res #f)).
0570: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 . (apply sqlite
0580: 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 3:execute db (co
0590: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 nc "INSERT OR IG
05a0: 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 NORE INTO runs (
05b0: 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 runname,state,st
05c0: 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 atus,owner,event
05d0: 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 _time" comma key
05e0: 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f str ") VALUES (?
05f0: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 ,?,?,?,strftime(
0600: 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d '%s','now')" com
0610: 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 ma valslots ");"
0620: 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 )... allvals)..
0630: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
0640: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 for-each-row ..
0650: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 (lambda (id)..
0660: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69 (set! res i
0670: 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 d)).. db.. (
0680: 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 let ((qry (conc
0690: 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 "SELECT id FROM
06a0: 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e runs WHERE (runn
06b0: 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b ame=? " andstr k
06c0: 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a ey=?str ");"))).
06d0: 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 . ;(debug:pr
06e0: 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 int 4 "qry: " qr
06f0: 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 y) .. qry)..
0700: 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 qryvals).. (
0710: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
0720: 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 db "UPDATE runs
0730: 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 SET state=?,stat
0740: 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b us=? WHERE id=?;
0750: 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 " state status r
0760: 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 es).. res) ..(b
0770: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 egin.. (debug:p
0780: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 rint 0 "ERROR: C
0790: 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c alled without al
07a0: 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 l necessary keys
07b0: 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b ").. #f))))..;;
07c0: 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 runs:get-runs-b
07d0: 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72 75 y-patt.;; get ru
07e0: 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63 72 ns by list of cr
07f0: 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73 74 iteria.;; regist
0800: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 er a test run wi
0810: 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b 20 th the db.;;.;;
0820: 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61 6c Use: (db-get-val
0830: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64 62 ue-by-header (db
0840: 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e 69 :get-header runi
0850: 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77 20 nfo)(db:get-row
0860: 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74 6f runinfo)).;; to
0870: 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66 72 extract info fr
0880: 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 65 om the structure
0890: 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64 65 returned.;;.(de
08a0: 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d 72 fine (runs:get-r
08b0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
08c0: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 eys runnamepatt
08d0: 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65 73 . params) ;; tes
08e0: 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a 20 t-name). (let*
08f0: 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65 79 ((keyvallst (key
0900: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 29 s->vallist keys)
0910: 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28 72 ).. (tmp (r
0920: 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e 2d uns:get-std-run-
0930: 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22 69 fields keys '("i
0940: 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73 74 d" "runname" "st
0950: 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22 6f ate" "status" "o
0960: 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69 6d wner" "event_tim
0970: 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72 20 e"))).. (keystr
0980: 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20 28 (car tmp)).. (
0990: 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20 74 header (cadr t
09a0: 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20 20 mp)).. (res
09b0: 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74 74 '()).. (key-patt
09c0: 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 "")). (for-e
09d0: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 ach (lambda (key
09e0: 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b val)...(let* ((k
09f0: 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 ey (vector-re
0a00: 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09 20 f keyval 0))...
0a10: 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28 63 (fulkey (c
0a20: 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 onc ":" key))...
0a30: 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20 28 (patt (
0a40: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75 6c args:get-arg ful
0a50: 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20 70 key)))... (if p
0a60: 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 att... (set
0a70: 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 ! key-patt (conc
0a80: 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 key-patt " AND
0a90: 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22 20 " key " like '"
0aa0: 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20 20 patt "'"))...
0ab0: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64 65 (begin....(de
0ac0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
0ad0: 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66 6f OR: searching fo
0ae0: 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20 70 r runs with no p
0af0: 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20 22 attern set for "
0b00: 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78 69 fulkey)....(exi
0b10: 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20 20 t 6)))))..
0b20: 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69 74 keys). (sqlit
0b30: 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 e3:for-each-row
0b40: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 . (lambda (a
0b50: 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73 65 . r). (se
0b60: 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c 69 t! res (cons (li
0b70: 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e 73 st->vector (cons
0b80: 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20 20 a r)) res))).
0b90: 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f 6e db . (con
0ba0: 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79 73 c "SELECT " keys
0bb0: 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 tr " FROM runs W
0bc0: 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69 6b HERE runname lik
0bd0: 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 e ? " key-patt "
0be0: 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d 65 ;"). runname
0bf0: 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74 6f patt). (vecto
0c00: 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29 0a r header res))).
0c10: 0a 28 64 65 66 69 6e 65 20 28 72 65 67 69 73 74 .(define (regist
0c20: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 er-test db run-i
0c30: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
0c40: 2d 70 61 74 68 20 74 61 67 73 29 0a 20 20 28 6c -path tags). (l
0c50: 65 74 20 28 28 69 74 65 6d 2d 70 61 74 68 73 20 et ((item-paths
0c60: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
0c70: 2d 70 61 74 68 20 22 22 29 0a 09 09 09 28 6c 69 -path "")....(li
0c80: 73 74 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 st item-path)...
0c90: 09 28 6c 69 73 74 20 69 74 65 6d 2d 70 61 74 68 .(list item-path
0ca0: 20 22 22 29 29 29 29 0a 20 20 20 20 28 66 6f 72 "")))). (for
0cb0: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d -each . (lam
0cc0: 62 64 61 20 28 70 74 68 29 0a 20 20 20 20 20 20 bda (pth).
0cd0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
0ce0: 65 20 64 62 20 22 49 4e 53 45 52 54 20 4f 52 20 e db "INSERT OR
0cf0: 49 47 4e 4f 52 45 20 49 4e 54 4f 20 74 65 73 74 IGNORE INTO test
0d00: 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 s (run_id,testna
0d10: 6d 65 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 69 74 me,event_time,it
0d20: 65 6d 5f 70 61 74 68 2c 73 74 61 74 65 2c 73 74 em_path,state,st
0d30: 61 74 75 73 2c 74 61 67 73 29 20 56 41 4c 55 45 atus,tags) VALUE
0d40: 53 20 28 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 S (?,?,strftime(
0d50: 27 25 73 27 2c 27 6e 6f 77 27 29 2c 3f 2c 27 4e '%s','now'),?,'N
0d60: 4f 54 5f 53 54 41 52 54 45 44 27 2c 27 6e 2f 61 OT_STARTED','n/a
0d70: 27 2c 3f 29 3b 22 20 0a 09 09 09 72 75 6e 2d 69 ',?);" ....run-i
0d80: 64 20 0a 09 09 09 74 65 73 74 2d 6e 61 6d 65 0a d ....test-name.
0d90: 09 09 09 70 74 68 20 0a 09 09 09 28 63 6f 6e 63 ...pth ....(conc
0da0: 20 22 2c 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "," (string-int
0db0: 65 72 73 70 65 72 73 65 20 74 61 67 73 20 22 2c ersperse tags ",
0dc0: 22 29 20 22 2c 22 29 29 29 0a 20 20 20 20 20 69 ") ","))). i
0dd0: 74 65 6d 2d 70 61 74 68 73 20 29 29 29 0a 0a 3b tem-paths )))..;
0de0: 3b 20 20 28 64 65 66 69 6e 65 20 64 62 20 28 6f ; (define db (o
0df0: 70 65 6e 2d 64 62 29 29 0a 3b 3b 20 20 28 74 65 pen-db)).;; (te
0e00: 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 st-set-status! d
0e10: 62 20 32 20 22 72 75 6e 66 69 72 73 74 22 20 22 b 2 "runfirst" "
0e20: 43 4f 4d 50 4c 45 54 45 44 22 20 22 50 41 53 53 COMPLETED" "PASS
0e30: 22 20 22 73 75 6d 6d 65 72 22 29 0a 0a 28 64 65 " "summer")..(de
0e40: 66 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 73 fine (test-set-s
0e50: 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 64 tatus! db run-id
0e60: 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 test-name state
0e70: 20 73 74 61 74 75 73 20 69 74 65 6d 64 61 74 2d status itemdat-
0e80: 6f 72 2d 70 61 74 68 20 2e 20 63 6f 6d 6d 65 6e or-path . commen
0e90: 74 29 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d t). (let ((item
0ea0: 2d 70 61 74 68 20 28 69 66 20 28 73 74 72 69 6e -path (if (strin
0eb0: 67 3f 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 61 g? itemdat-or-pa
0ec0: 74 68 29 20 69 74 65 6d 64 61 74 2d 6f 72 2d 70 th) itemdat-or-p
0ed0: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
0ee0: 70 61 74 68 20 69 74 65 6d 64 61 74 2d 6f 72 2d path itemdat-or-
0ef0: 70 61 74 68 29 29 29 29 0a 20 20 20 20 28 73 71 path)))). (sq
0f00: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
0f10: 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 "UPDATE tests S
0f20: 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 ET state=?,statu
0f30: 73 3d 3f 2c 65 76 65 6e 74 5f 74 69 6d 65 3d 73 s=?,event_time=s
0f40: 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e 6f trftime('%s','no
0f50: 77 27 29 20 57 48 45 52 45 20 72 75 6e 5f 69 64 w') WHERE run_id
0f60: 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d =? AND testname=
0f70: 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d ? AND item_path=
0f80: 3f 3b 22 20 0a 09 09 20 20 20 20 20 73 74 61 74 ?;" ... stat
0f90: 65 20 73 74 61 74 75 73 20 72 75 6e 2d 69 64 20 e status run-id
0fa0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
0fb0: 61 74 68 29 0a 20 20 20 20 28 69 66 20 28 61 6e ath). (if (an
0fc0: 64 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 d (not (equal? i
0fd0: 74 65 6d 2d 70 61 74 68 20 22 22 29 29 20 3b 3b tem-path "")) ;;
0fe0: 20 6e 65 65 64 20 74 6f 20 75 70 64 61 74 65 20 need to update
0ff0: 74 68 65 20 74 6f 70 20 74 65 73 74 20 72 65 63 the top test rec
1000: 6f 72 64 20 69 66 20 50 41 53 53 20 6f 72 20 46 ord if PASS or F
1010: 41 49 4c 20 61 6e 64 20 74 68 69 73 20 69 73 20 AIL and this is
1020: 61 20 73 75 62 74 65 73 74 0a 09 20 20 20 20 20 a subtest..
1030: 28 6f 72 20 28 65 71 75 61 6c 3f 20 73 74 61 74 (or (equal? stat
1040: 75 73 20 22 50 41 53 53 22 29 0a 09 09 20 28 65 us "PASS")... (e
1050: 71 75 61 6c 3f 20 73 74 61 74 75 73 20 22 57 41 qual? status "WA
1060: 52 4e 22 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 RN")... (equal?
1070: 73 74 61 74 75 73 20 22 46 41 49 4c 22 29 29 29 status "FAIL")))
1080: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 71 6c ..(begin.. (sql
1090: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 ite3:execute ..
10a0: 20 20 64 62 0a 09 20 20 20 22 55 50 44 41 54 45 db.. "UPDATE
10b0: 20 74 65 73 74 73 20 0a 20 20 20 20 20 20 20 20 tests .
10c0: 20 20 20 20 20 53 45 54 20 66 61 69 6c 5f 63 6f SET fail_co
10d0: 75 6e 74 3d 28 53 45 4c 45 43 54 20 63 6f 75 6e unt=(SELECT coun
10e0: 74 28 69 64 29 20 46 52 4f 4d 20 74 65 73 74 73 t(id) FROM tests
10f0: 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 WHERE run_id=?
1100: 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 AND testname=? A
1110: 4e 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d 20 ND item_path !=
1120: 27 27 20 41 4e 44 20 73 74 61 74 75 73 3d 27 46 '' AND status='F
1130: 41 49 4c 27 29 2c 0a 20 20 20 20 20 20 20 20 20 AIL'),.
1140: 20 20 20 20 20 20 20 20 70 61 73 73 5f 63 6f 75 pass_cou
1150: 6e 74 3d 28 53 45 4c 45 43 54 20 63 6f 75 6e 74 nt=(SELECT count
1160: 28 69 64 29 20 46 52 4f 4d 20 74 65 73 74 73 20 (id) FROM tests
1170: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
1180: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
1190: 44 20 69 74 65 6d 5f 70 61 74 68 20 21 3d 20 27 D item_path != '
11a0: 27 20 41 4e 44 20 28 73 74 61 74 75 73 3d 27 50 ' AND (status='P
11b0: 41 53 53 27 20 4f 52 20 73 74 61 74 75 73 3d 27 ASS' OR status='
11c0: 57 41 52 4e 27 29 29 0a 20 20 20 20 20 20 20 20 WARN')).
11d0: 20 20 20 20 20 57 48 45 52 45 20 72 75 6e 5f 69 WHERE run_i
11e0: 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 d=? AND testname
11f0: 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 =? AND item_path
1200: 3d 27 27 3b 22 0a 09 20 20 20 72 75 6e 2d 69 64 ='';".. run-id
1210: 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d 69 test-name run-i
1220: 64 20 74 65 73 74 2d 6e 61 6d 65 20 72 75 6e 2d d test-name run-
1230: 69 64 20 74 65 73 74 2d 6e 61 6d 65 29 0a 09 20 id test-name)..
1240: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
1250: 65 0a 09 20 20 20 64 62 0a 09 20 20 20 22 55 50 e.. db.. "UP
1260: 44 41 54 45 20 74 65 73 74 73 0a 20 20 20 20 20 DATE tests.
1270: 20 20 20 20 20 20 20 20 53 45 54 20 73 74 61 74 SET stat
1280: 65 3d 43 41 53 45 20 57 48 45 4e 20 28 53 45 4c e=CASE WHEN (SEL
1290: 45 43 54 20 63 6f 75 6e 74 28 69 64 29 20 46 52 ECT count(id) FR
12a0: 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 72 OM tests WHERE r
12b0: 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 un_id=? AND test
12c0: 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f name=? AND item_
12d0: 70 61 74 68 20 21 3d 20 27 27 20 41 4e 44 20 73 path != '' AND s
12e0: 74 61 74 65 20 69 6e 20 28 27 52 55 4e 4e 49 4e tate in ('RUNNIN
12f0: 47 27 2c 27 4e 4f 54 5f 53 54 41 52 54 45 44 27 G','NOT_STARTED'
1300: 29 29 20 3e 20 30 20 54 48 45 4e 20 0a 20 20 20 )) > 0 THEN .
1310: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1320: 20 20 20 20 20 20 20 27 52 55 4e 4e 49 4e 47 27 'RUNNING'
1330: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1340: 20 20 20 20 20 20 20 20 45 4c 53 45 20 27 43 4f ELSE 'CO
1350: 4d 50 4c 45 54 45 44 27 20 45 4e 44 2c 0a 20 20 MPLETED' END,.
1360: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 st
1370: 61 74 75 73 3d 43 41 53 45 20 57 48 45 4e 20 66 atus=CASE WHEN f
1380: 61 69 6c 5f 63 6f 75 6e 74 20 3e 20 30 20 54 48 ail_count > 0 TH
1390: 45 4e 20 27 46 41 49 4c 27 20 57 48 45 4e 20 70 EN 'FAIL' WHEN p
13a0: 61 73 73 5f 63 6f 75 6e 74 20 3e 20 30 20 41 4e ass_count > 0 AN
13b0: 44 20 66 61 69 6c 5f 63 6f 75 6e 74 3d 30 20 54 D fail_count=0 T
13c0: 48 45 4e 20 27 50 41 53 53 27 20 45 4c 53 45 20 HEN 'PASS' ELSE
13d0: 27 55 4e 4b 4e 4f 57 4e 27 20 45 4e 44 0a 20 20 'UNKNOWN' END.
13e0: 20 20 20 20 20 20 20 20 20 20 20 57 48 45 52 45 WHERE
13f0: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
1400: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
1410: 6d 5f 70 61 74 68 3d 27 27 3b 22 0a 09 20 20 20 m_path='';"..
1420: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1430: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
1440: 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 61 6e e))). (if (an
1450: 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 63 6f d (not (null? co
1460: 6d 6d 65 6e 74 29 29 0a 09 20 20 20 20 20 28 63 mment)).. (c
1470: 61 72 20 63 6f 6d 6d 65 6e 74 29 29 0a 09 28 73 ar comment))..(s
1480: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 qlite3:execute d
1490: 62 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 b "UPDATE tests
14a0: 53 45 54 20 63 6f 6d 6d 65 6e 74 3d 3f 20 57 48 SET comment=? WH
14b0: 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 ERE run_id=? AND
14c0: 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 testname=? AND
14d0: 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 0a 09 09 item_path=?;"...
14e0: 09 20 28 63 61 72 20 63 6f 6d 6d 65 6e 74 29 20 . (car comment)
14f0: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
1500: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 0a item-path))))..
1510: 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 73 65 (define (test-se
1520: 74 2d 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 t-log! db run-id
1530: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 64 test-name itemd
1540: 61 74 20 6c 6f 67 66 29 20 0a 20 20 28 6c 65 74 at logf) . (let
1550: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 ((item-path (it
1560: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
1570: 65 6d 64 61 74 29 29 29 0a 20 20 20 20 28 73 71 emdat))). (sq
1580: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
1590: 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 53 "UPDATE tests S
15a0: 45 54 20 66 69 6e 61 6c 5f 6c 6f 67 66 3d 3f 20 ET final_logf=?
15b0: 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 WHERE run_id=? A
15c0: 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e ND testname=? AN
15d0: 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 20 D item_path=?;"
15e0: 0a 09 09 20 20 20 20 20 6c 6f 67 66 20 72 75 6e ... logf run
15f0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
1600: 65 6d 2d 70 61 74 68 29 29 29 0a 0a 28 64 65 66 em-path)))..(def
1610: 69 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 74 6f ine (test-set-to
1620: 70 6c 6f 67 21 20 64 62 20 72 75 6e 2d 69 64 20 plog! db run-id
1630: 74 65 73 74 2d 6e 61 6d 65 20 6c 6f 67 66 29 20 test-name logf)
1640: 0a 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 . (sqlite3:exec
1650: 75 74 65 20 64 62 20 22 55 50 44 41 54 45 20 74 ute db "UPDATE t
1660: 65 73 74 73 20 53 45 54 20 66 69 6e 61 6c 5f 6c ests SET final_l
1670: 6f 67 66 3d 3f 20 57 48 45 52 45 20 72 75 6e 5f ogf=? WHERE run_
1680: 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e 61 6d id=? AND testnam
1690: 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 61 74 e=? AND item_pat
16a0: 68 3d 27 27 3b 22 20 0a 09 09 20 20 20 6c 6f 67 h='';" ... log
16b0: 66 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 f run-id test-na
16c0: 6d 65 29 29 0a 0a 3b 3b 20 3b 3b 20 54 4f 44 4f me))..;; ;; TODO
16d0: 3a 20 43 6f 6e 76 65 72 67 65 20 74 68 69 73 20 : Converge this
16e0: 77 69 74 68 20 64 62 3a 67 65 74 2d 74 65 73 74 with db:get-test
16f0: 2d 69 6e 66 6f 0a 3b 3b 20 28 64 65 66 69 6e 65 -info.;; (define
1700: 20 28 72 75 6e 73 3a 67 65 74 2d 74 65 73 74 2d (runs:get-test-
1710: 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 info db run-id t
1720: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
1730: 74 68 29 0a 3b 3b 20 20 20 28 6c 65 74 20 28 28 th).;; (let ((
1740: 72 65 73 20 23 66 29 29 20 3b 3b 20 28 76 65 63 res #f)) ;; (vec
1750: 74 6f 72 20 23 66 20 23 66 20 23 66 20 23 66 20 tor #f #f #f #f
1760: 23 66 20 23 66 29 29 29 0a 3b 3b 20 20 20 20 20 #f #f))).;;
1770: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 (sqlite3:for-eac
1780: 68 2d 72 6f 77 20 0a 3b 3b 20 20 20 20 20 20 28 h-row .;; (
1790: 6c 61 6d 62 64 61 20 28 69 64 20 72 75 6e 2d 69 lambda (id run-i
17a0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 d test-name stat
17b0: 65 20 73 74 61 74 75 73 29 0a 3b 3b 20 20 20 20 e status).;;
17c0: 20 20 20 20 28 73 65 74 21 20 72 65 73 20 28 76 (set! res (v
17d0: 65 63 74 6f 72 20 69 64 20 72 75 6e 2d 69 64 20 ector id run-id
17e0: 74 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 test-name state
17f0: 73 74 61 74 75 73 20 69 74 65 6d 2d 70 61 74 68 status item-path
1800: 29 29 29 0a 3b 3b 20 20 20 20 20 20 64 62 20 22 ))).;; db "
1810: 53 45 4c 45 43 54 20 69 64 2c 72 75 6e 5f 69 64 SELECT id,run_id
1820: 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c ,testname,state,
1830: 73 74 61 74 75 73 20 46 52 4f 4d 20 74 65 73 74 status FROM test
1840: 73 20 57 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f s WHERE run_id=?
1850: 20 41 4e 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 AND testname=?
1860: 41 4e 44 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b AND item_path=?;
1870: 22 0a 3b 3b 20 20 20 20 20 20 72 75 6e 2d 69 64 ".;; run-id
1880: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
1890: 70 61 74 68 29 0a 3b 3b 20 20 20 20 20 72 65 73 path).;; res
18a0: 29 29 0a 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 69 ))..(define-inli
18b0: 6e 65 20 28 74 65 73 74 3a 67 65 74 2d 69 64 20 ne (test:get-id
18c0: 76 65 63 29 20 20 20 20 20 20 20 28 76 65 63 74 vec) (vect
18d0: 6f 72 2d 72 65 66 20 76 65 63 20 30 29 29 0a 28 or-ref vec 0)).(
18e0: 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 define-inline (t
18f0: 65 73 74 3a 67 65 74 2d 72 75 6e 5f 69 64 20 76 est:get-run_id v
1900: 65 63 29 20 20 20 28 76 65 63 74 6f 72 2d 72 65 ec) (vector-re
1910: 66 20 76 65 63 20 31 29 29 0a 28 64 65 66 69 6e f vec 1)).(defin
1920: 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a 67 e-inline (test:g
1930: 65 74 2d 74 65 73 74 2d 6e 61 6d 65 20 76 65 63 et-test-name vec
1940: 29 28 76 65 63 74 6f 72 2d 72 65 66 20 76 65 63 )(vector-ref vec
1950: 20 32 29 29 0a 28 64 65 66 69 6e 65 2d 69 6e 6c 2)).(define-inl
1960: 69 6e 65 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ine (test:get-st
1970: 61 74 65 20 76 65 63 29 20 20 20 20 28 76 65 63 ate vec) (vec
1980: 74 6f 72 2d 72 65 66 20 76 65 63 20 33 29 29 0a tor-ref vec 3)).
1990: 28 64 65 66 69 6e 65 2d 69 6e 6c 69 6e 65 20 28 (define-inline (
19a0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
19b0: 76 65 63 29 20 20 20 28 76 65 63 74 6f 72 2d 72 vec) (vector-r
19c0: 65 66 20 76 65 63 20 34 29 29 0a 28 64 65 66 69 ef vec 4)).(defi
19d0: 6e 65 2d 69 6e 6c 69 6e 65 20 28 74 65 73 74 3a ne-inline (test:
19e0: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 76 65 get-item-path ve
19f0: 63 29 28 76 65 63 74 6f 72 2d 72 65 66 20 76 65 c)(vector-ref ve
1a00: 63 20 35 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 c 5))..(define (
1a10: 72 75 6e 73 3a 74 65 73 74 2d 67 65 74 2d 66 75 runs:test-get-fu
1a20: 6c 6c 2d 70 61 74 68 20 74 65 73 74 29 0a 20 20 ll-path test).
1a30: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 (let* ((testname
1a40: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
1a50: 73 74 6e 61 6d 65 20 20 20 74 65 73 74 29 29 0a stname test)).
1a60: 09 20 28 69 74 65 6d 70 61 74 68 20 28 64 62 3a . (itempath (db:
1a70: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
1a80: 74 68 20 74 65 73 74 29 29 29 0a 20 20 20 20 28 th test))). (
1a90: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 28 69 conc testname (i
1aa0: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 f (equal? itempa
1ab0: 74 68 20 22 22 29 20 22 22 20 28 63 6f 6e 63 20 th "") "" (conc
1ac0: 22 28 22 20 69 74 65 6d 70 61 74 68 20 22 29 22 "(" itempath ")"
1ad0: 29 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 2d 69 )))))..(define-i
1ae0: 6e 6c 69 6e 65 20 28 74 65 73 74 3a 74 65 73 74 nline (test:test
1af0: 2d 67 65 74 2d 66 75 6c 6c 6e 61 6d 65 20 74 65 -get-fullname te
1b00: 73 74 29 0a 20 20 20 28 63 6f 6e 63 20 28 64 62 st). (conc (db
1b10: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
1b20: 6d 65 20 74 65 73 74 29 0a 09 20 28 69 66 20 28 me test).. (if (
1b30: 65 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d equal? (db:test-
1b40: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
1b50: 73 74 29 20 22 22 29 0a 09 20 20 20 20 20 22 22 st) "").. ""
1b60: 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 22 28 22 .. (conc "("
1b70: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
1b80: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 20 22 29 em-path test) ")
1b90: 22 29 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 "))))..(define (
1ba0: 63 68 65 63 6b 2d 76 61 6c 69 64 2d 69 74 65 6d check-valid-item
1bb0: 73 20 63 6c 61 73 73 20 69 74 65 6d 29 0a 20 20 s class item).
1bc0: 28 6c 65 74 20 28 28 76 61 6c 69 64 2d 76 61 6c (let ((valid-val
1bd0: 75 65 73 20 28 6c 65 74 20 28 28 73 20 28 63 6f ues (let ((s (co
1be0: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e nfig-lookup *con
1bf0: 66 69 67 64 61 74 2a 20 22 76 61 6c 69 64 76 61 figdat* "validva
1c00: 6c 75 65 73 22 20 63 6c 61 73 73 29 29 29 0a 09 lues" class)))..
1c10: 09 09 28 69 66 20 73 20 28 73 74 72 69 6e 67 2d ..(if s (string-
1c20: 73 70 6c 69 74 20 73 29 20 23 66 29 29 29 29 0a split s) #f)))).
1c30: 20 20 20 20 28 69 66 20 76 61 6c 69 64 2d 76 61 (if valid-va
1c40: 6c 75 65 73 0a 09 28 69 66 20 28 6d 65 6d 62 65 lues..(if (membe
1c50: 72 20 69 74 65 6d 20 76 61 6c 69 64 2d 76 61 6c r item valid-val
1c60: 75 65 73 29 0a 09 20 20 20 20 69 74 65 6d 20 23 ues).. item #
1c70: 66 29 0a 09 69 74 65 6d 29 29 29 0a 0a 28 64 65 f)..item)))..(de
1c80: 66 69 6e 65 20 28 74 65 73 74 73 74 65 70 2d 73 fine (teststep-s
1c90: 65 74 2d 73 74 61 74 75 73 21 20 64 62 20 72 75 et-status! db ru
1ca0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 74 n-id test-name t
1cb0: 65 73 74 73 74 65 70 2d 6e 61 6d 65 20 73 74 61 eststep-name sta
1cc0: 74 65 2d 69 6e 20 73 74 61 74 75 73 2d 69 6e 20 te-in status-in
1cd0: 69 74 65 6d 64 61 74 20 63 6f 6d 6d 65 6e 74 29 itemdat comment)
1ce0: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
1cf0: 34 20 22 72 75 6e 2d 69 64 3a 20 22 20 72 75 6e 4 "run-id: " run
1d00: 2d 69 64 20 22 20 74 65 73 74 2d 6e 61 6d 65 3a -id " test-name:
1d10: 20 22 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 " test-name).
1d20: 28 6c 65 74 2a 20 28 28 73 74 61 74 65 20 20 20 (let* ((state
1d30: 20 20 28 63 68 65 63 6b 2d 76 61 6c 69 64 2d 69 (check-valid-i
1d40: 74 65 6d 73 20 22 73 74 61 74 65 22 20 73 74 61 tems "state" sta
1d50: 74 65 2d 69 6e 29 29 0a 09 20 28 73 74 61 74 75 te-in)).. (statu
1d60: 73 20 20 20 20 28 63 68 65 63 6b 2d 76 61 6c 69 s (check-vali
1d70: 64 2d 69 74 65 6d 73 20 22 73 74 61 74 75 73 22 d-items "status"
1d80: 20 73 74 61 74 75 73 2d 69 6e 29 29 0a 09 20 28 status-in)).. (
1d90: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d item-path (item-
1da0: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 list->path itemd
1db0: 61 74 29 29 0a 09 20 28 74 65 73 74 64 61 74 20 at)).. (testdat
1dc0: 20 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 (db:get-test-i
1dd0: 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 nfo db run-id te
1de0: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
1df0: 68 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a h))). (debug:
1e00: 70 72 69 6e 74 20 35 20 22 74 65 73 74 64 61 74 print 5 "testdat
1e10: 3a 20 22 20 74 65 73 74 64 61 74 29 0a 20 20 20 : " testdat).
1e20: 20 28 69 66 20 28 61 6e 64 20 74 65 73 74 64 61 (if (and testda
1e30: 74 20 3b 3b 20 69 66 20 74 68 65 20 73 65 63 74 t ;; if the sect
1e40: 69 6f 6e 20 65 78 69 73 74 73 20 74 68 65 6e 20 ion exists then
1e50: 66 6f 72 63 65 20 73 70 65 63 69 66 69 63 61 74 force specificat
1e60: 69 6f 6e 20 42 55 47 2c 20 49 20 64 6f 6e 27 74 ion BUG, I don't
1e70: 20 6c 69 6b 65 20 68 6f 77 20 74 68 69 73 20 77 like how this w
1e80: 6f 72 6b 73 2e 0a 09 20 20 20 20 20 28 6f 72 20 orks... (or
1e90: 28 6e 6f 74 20 73 74 61 74 65 29 28 6e 6f 74 20 (not state)(not
1ea0: 73 74 61 74 75 73 29 29 29 0a 09 28 64 65 62 75 status)))..(debu
1eb0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
1ec0: 4e 47 3a 20 49 6e 76 61 6c 69 64 20 22 20 28 69 NG: Invalid " (i
1ed0: 66 20 73 74 61 74 75 73 20 22 73 74 61 74 75 73 f status "status
1ee0: 22 20 22 73 74 61 74 65 22 29 0a 09 20 20 20 20 " "state")..
1ef0: 20 20 20 22 20 76 61 6c 75 65 20 5c 22 22 20 28 " value \"" (
1f00: 69 66 20 73 74 61 74 75 73 20 73 74 61 74 75 73 if status status
1f10: 2d 69 6e 20 73 74 61 74 65 2d 69 6e 29 20 22 5c -in state-in) "\
1f20: 22 2c 20 75 70 64 61 74 65 20 79 6f 75 72 20 76 ", update your v
1f30: 61 6c 69 64 73 74 61 74 65 73 20 73 65 63 74 69 alidstates secti
1f40: 6f 6e 20 69 6e 20 6d 65 67 61 74 65 73 74 2e 63 on in megatest.c
1f50: 6f 6e 66 69 67 22 29 29 0a 20 20 20 20 28 69 66 onfig")). (if
1f60: 20 74 65 73 74 64 61 74 0a 09 28 6c 65 74 20 28 testdat..(let (
1f70: 28 74 65 73 74 2d 69 64 20 28 74 65 73 74 3a 67 (test-id (test:g
1f80: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 et-id testdat)))
1f90: 0a 09 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 .. (sqlite3:exe
1fa0: 63 75 74 65 20 64 62 20 0a 09 09 09 22 49 4e 53 cute db ...."INS
1fb0: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 69 ERT OR REPLACE i
1fc0: 6e 74 6f 20 74 65 73 74 5f 73 74 65 70 73 20 28 nto test_steps (
1fd0: 74 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 test_id,stepname
1fe0: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 ,state,status,ev
1ff0: 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 ent_time,comment
2000: 29 20 56 41 4c 55 45 53 28 3f 2c 3f 2c 3f 2c 3f ) VALUES(?,?,?,?
2010: 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 ,strftime('%s','
2020: 6e 6f 77 27 29 2c 3f 29 3b 22 0a 09 09 09 74 65 now'),?);"....te
2030: 73 74 2d 69 64 20 74 65 73 74 73 74 65 70 2d 6e st-id teststep-n
2040: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 ame state status
2050: 20 28 69 66 20 63 6f 6d 6d 65 6e 74 20 63 6f 6d (if comment com
2060: 6d 65 6e 74 20 22 22 29 29 29 0a 09 28 64 65 62 ment "")))..(deb
2070: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
2080: 52 3a 20 43 61 6e 27 74 20 75 70 64 61 74 65 20 R: Can't update
2090: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 66 6f " test-name " fo
20a0: 72 20 72 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 r run " run-id "
20b0: 20 2d 3e 20 6e 6f 20 73 75 63 68 20 74 65 73 74 -> no such test
20c0: 20 69 6e 20 64 62 22 29 29 29 29 0a 0a 28 64 65 in db"))))..(de
20d0: 66 69 6e 65 20 28 74 65 73 74 2d 67 65 74 2d 6b fine (test-get-k
20e0: 69 6c 6c 2d 72 65 71 75 65 73 74 20 64 62 20 72 ill-request db r
20f0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
2100: 69 74 65 6d 64 61 74 29 0a 20 20 28 6c 65 74 2a itemdat). (let*
2110: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 69 74 ((item-path (it
2120: 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 em-list->path it
2130: 65 6d 64 61 74 29 29 0a 09 20 28 74 65 73 74 64 emdat)).. (testd
2140: 61 74 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73 at (db:get-tes
2150: 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 t-info db run-id
2160: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
2170: 70 61 74 68 29 29 29 0a 20 20 20 20 28 65 71 75 path))). (equ
2180: 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 al? (test:get-st
2190: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 4b 49 ate testdat) "KI
21a0: 4c 4c 52 45 51 22 29 29 29 0a 0a 28 64 65 66 69 LLREQ")))..(defi
21b0: 6e 65 20 28 74 65 73 74 2d 73 65 74 2d 6d 65 74 ne (test-set-met
21c0: 61 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 a-info db run-id
21d0: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 64 61 testname itemda
21e0: 74 29 0a 20 20 28 6c 65 74 20 28 28 69 74 65 6d t). (let ((item
21f0: 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 -path (item-list
2200: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 ->path itemdat))
2210: 0a 09 28 63 70 75 6c 6f 61 64 20 20 28 67 65 74 ..(cpuload (get
2220: 2d 63 70 75 2d 6c 6f 61 64 29 29 0a 09 28 68 6f -cpu-load))..(ho
2230: 73 74 6e 61 6d 65 20 28 67 65 74 2d 68 6f 73 74 stname (get-host
2240: 2d 6e 61 6d 65 29 29 0a 09 28 64 69 73 6b 66 72 -name))..(diskfr
2250: 65 65 20 28 67 65 74 2d 64 66 20 28 63 75 72 72 ee (get-df (curr
2260: 65 6e 74 2d 64 69 72 65 63 74 6f 72 79 29 29 29 ent-directory)))
2270: 0a 09 28 75 6e 61 6d 65 20 20 20 20 28 67 65 74 ..(uname (get
2280: 2d 75 6e 61 6d 65 20 22 2d 73 72 76 70 69 6f 22 -uname "-srvpio"
2290: 29 29 0a 09 28 72 75 6e 70 61 74 68 20 20 28 63 ))..(runpath (c
22a0: 75 72 72 65 6e 74 2d 64 69 72 65 63 74 6f 72 79 urrent-directory
22b0: 29 29 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 ))). (sqlite3
22c0: 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 :execute db "UPD
22d0: 41 54 45 20 74 65 73 74 73 20 53 45 54 20 68 6f ATE tests SET ho
22e0: 73 74 3d 3f 2c 63 70 75 6c 6f 61 64 3d 3f 2c 64 st=?,cpuload=?,d
22f0: 69 73 6b 66 72 65 65 3d 3f 2c 75 6e 61 6d 65 3d iskfree=?,uname=
2300: 3f 2c 72 75 6e 64 69 72 3d 3f 20 57 48 45 52 45 ?,rundir=? WHERE
2310: 20 72 75 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 run_id=? AND te
2320: 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 stname=? AND ite
2330: 6d 5f 70 61 74 68 3d 3f 3b 22 0a 09 09 20 20 68 m_path=?;"... h
2340: 6f 73 74 6e 61 6d 65 0a 09 09 20 20 63 70 75 6c ostname... cpul
2350: 6f 61 64 0a 09 09 20 20 64 69 73 6b 66 72 65 65 oad... diskfree
2360: 0a 09 09 20 20 75 6e 61 6d 65 0a 09 09 20 20 72 ... uname... r
2370: 75 6e 70 61 74 68 0a 09 09 20 20 72 75 6e 2d 69 unpath... run-i
2380: 64 0a 09 09 20 20 74 65 73 74 6e 61 6d 65 0a 09 d... testname..
2390: 09 20 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a . item-path))).
23a0: 0a 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 75 .(define (test-u
23b0: 70 64 61 74 65 2d 6d 65 74 61 2d 69 6e 66 6f 20 pdate-meta-info
23c0: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 6e 61 db run-id testna
23d0: 6d 65 20 69 74 65 6d 64 61 74 20 6d 69 6e 75 74 me itemdat minut
23e0: 65 73 29 0a 20 20 28 6c 65 74 20 28 28 69 74 65 es). (let ((ite
23f0: 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 m-path (item-lis
2400: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 t->path itemdat)
2410: 29 0a 09 28 63 70 75 6c 6f 61 64 20 20 28 67 65 )..(cpuload (ge
2420: 74 2d 63 70 75 2d 6c 6f 61 64 29 29 0a 09 28 64 t-cpu-load))..(d
2430: 69 73 6b 66 72 65 65 20 28 67 65 74 2d 64 66 20 iskfree (get-df
2440: 28 63 75 72 72 65 6e 74 2d 64 69 72 65 63 74 6f (current-directo
2450: 72 79 29 29 29 29 0a 20 20 20 20 28 69 66 20 28 ry)))). (if (
2460: 6e 6f 74 20 63 70 75 6c 6f 61 64 29 20 20 28 62 not cpuload) (b
2470: 65 67 69 6e 20 28 64 65 62 75 67 3a 70 72 69 6e egin (debug:prin
2480: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 43 50 t 0 "WARNING: CP
2490: 55 4c 4f 41 44 20 6e 6f 74 20 66 6f 75 6e 64 2e ULOAD not found.
24a0: 22 29 20 20 28 73 65 74 21 20 63 70 75 6c 6f 61 ") (set! cpuloa
24b0: 64 20 22 6e 2f 61 22 29 29 29 0a 20 20 20 20 28 d "n/a"))). (
24c0: 69 66 20 28 6e 6f 74 20 64 69 73 6b 66 72 65 65 if (not diskfree
24d0: 29 20 28 62 65 67 69 6e 20 28 64 65 62 75 67 3a ) (begin (debug:
24e0: 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 print 0 "WARNING
24f0: 3a 20 44 49 53 4b 46 52 45 45 20 6e 6f 74 20 66 : DISKFREE not f
2500: 6f 75 6e 64 2e 22 29 20 28 73 65 74 21 20 64 69 ound.") (set! di
2510: 73 6b 66 72 65 65 20 22 6e 2f 61 22 29 29 29 0a skfree "n/a"))).
2520: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 (if (not ite
2530: 6d 2d 70 61 74 68 29 28 62 65 67 69 6e 20 28 64 m-path)(begin (d
2540: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
2550: 52 4e 49 4e 47 3a 20 49 54 45 4d 50 41 54 48 20 RNING: ITEMPATH
2560: 6e 6f 74 20 73 65 74 2e 22 29 20 20 20 28 73 65 not set.") (se
2570: 74 21 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 t! item-path "")
2580: 29 29 0a 20 20 20 20 3b 3b 20 28 6c 65 74 20 28 )). ;; (let (
2590: 28 74 65 73 74 69 6e 66 6f 20 28 64 62 3a 67 65 (testinfo (db:ge
25a0: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 t-test-info db r
25b0: 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 un-id testname i
25c0: 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 tem-path))).
25d0: 3b 3b 20 20 20 28 69 66 20 28 61 6e 64 20 28 6e ;; (if (and (n
25e0: 6f 74 20 28 65 71 75 61 6c 3f 20 28 64 62 3a 74 ot (equal? (db:t
25f0: 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 est-get-status t
2600: 65 73 74 69 6e 66 6f 29 20 22 43 4f 4d 50 4c 45 estinfo) "COMPLE
2610: 54 45 44 22 29 29 0a 20 20 20 20 3b 3b 20 20 20 TED")). ;;
2620: 20 20 20 20 20 20 20 20 20 28 6e 6f 74 20 28 65 (not (e
2630: 71 75 61 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 qual? (db:test-g
2640: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 69 6e et-status testin
2650: 66 6f 29 20 22 4b 49 4c 4c 52 45 51 22 29 29 0a fo) "KILLREQ")).
2660: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 65 78 65 (sqlite3:exe
2670: 63 75 74 65 0a 20 20 20 20 20 64 62 0a 20 20 20 cute. db.
2680: 20 20 22 55 50 44 41 54 45 20 74 65 73 74 73 20 "UPDATE tests
2690: 53 45 54 20 63 70 75 6c 6f 61 64 3d 3f 2c 64 69 SET cpuload=?,di
26a0: 73 6b 66 72 65 65 3d 3f 2c 72 75 6e 5f 64 75 72 skfree=?,run_dur
26b0: 61 74 69 6f 6e 3d 3f 2c 73 74 61 74 65 3d 27 52 ation=?,state='R
26c0: 55 4e 4e 49 4e 47 27 20 57 48 45 52 45 20 72 75 UNNING' WHERE ru
26d0: 6e 5f 69 64 3d 3f 20 41 4e 44 20 74 65 73 74 6e n_id=? AND testn
26e0: 61 6d 65 3d 3f 20 41 4e 44 20 69 74 65 6d 5f 70 ame=? AND item_p
26f0: 61 74 68 3d 3f 20 41 4e 44 20 73 74 61 74 65 20 ath=? AND state
2700: 4e 4f 54 20 49 4e 20 28 27 43 4f 4d 50 4c 45 54 NOT IN ('COMPLET
2710: 45 44 27 2c 27 4b 49 4c 4c 52 45 51 27 2c 27 4b ED','KILLREQ','K
2720: 49 4c 4c 45 44 27 29 3b 22 0a 20 20 20 20 20 63 ILLED');". c
2730: 70 75 6c 6f 61 64 0a 20 20 20 20 20 64 69 73 6b puload. disk
2740: 66 72 65 65 0a 20 20 20 20 20 6d 69 6e 75 74 65 free. minute
2750: 73 0a 20 20 20 20 20 72 75 6e 2d 69 64 0a 20 20 s. run-id.
2760: 20 20 20 74 65 73 74 6e 61 6d 65 0a 20 20 20 20 testname.
2770: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 0a 28 item-path)))..(
2780: 64 65 66 69 6e 65 20 28 73 65 74 2d 6d 65 67 61 define (set-mega
2790: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 test-env-vars db
27a0: 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c 65 74 20 run-id). (let
27b0: 28 28 6b 65 79 73 20 28 64 62 2d 67 65 74 2d 6b ((keys (db-get-k
27c0: 65 79 73 20 64 62 29 29 29 0a 20 20 20 20 28 66 eys db))). (f
27d0: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
27e0: 28 6b 65 79 29 0a 09 09 28 73 71 6c 69 74 65 33 (key)...(sqlite3
27f0: 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 :for-each-row...
2800: 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 29 0a 09 (lambda (val)..
2810: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 . (debug:print
2820: 20 32 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65 2 "setenv " (ke
2830: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 y:get-fieldname
2840: 6b 65 79 29 20 22 20 22 20 76 61 6c 29 0a 09 09 key) " " val)...
2850: 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65 79 3a (setenv (key:
2860: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
2870: 79 29 20 76 61 6c 29 29 0a 09 09 20 64 62 20 0a y) val))... db .
2880: 09 09 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 .. (conc "SELECT
2890: 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c " (key:get-fiel
28a0: 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 46 52 4f dname key) " FRO
28b0: 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 64 3d M runs WHERE id=
28c0: 3f 3b 22 29 0a 09 09 20 72 75 6e 2d 69 64 29 29 ?;")... run-id))
28d0: 0a 09 20 20 20 20 20 20 6b 65 79 73 29 29 29 0a .. keys))).
28e0: 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 74 .(define (set-it
28f0: 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 6d em-env-vars item
2900: 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 68 dat). (for-each
2910: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 0a (lambda (item).
2920: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
2930: 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 int 2 "setenv "
2940: 28 63 61 72 20 69 74 65 6d 29 20 22 20 22 20 28 (car item) " " (
2950: 63 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20 20 cadr item))..
2960: 20 20 20 28 73 65 74 65 6e 76 20 28 63 61 72 20 (setenv (car
2970: 69 74 65 6d 29 20 28 63 61 64 72 20 69 74 65 6d item) (cadr item
2980: 29 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61 74 ))).. itemdat
2990: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 74 ))..(define (get
29a0: 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 73 -all-legal-tests
29b0: 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 ). (let* ((test
29c0: 73 20 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a s (glob (conc *
29d0: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
29e0: 2f 2a 22 29 29 29 0a 09 20 28 72 65 73 20 20 20 /*"))).. (res
29f0: 20 27 28 29 29 29 0a 20 20 20 20 28 64 65 62 75 '())). (debu
2a00: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a g:print 4 "INFO:
2a10: 20 4c 6f 6f 6b 69 6e 67 20 61 74 20 74 65 73 74 Looking at test
2a20: 73 20 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 s " (string-inte
2a30: 72 73 70 65 72 73 65 20 74 65 73 74 73 20 22 2c rsperse tests ",
2a40: 22 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 ")). (for-eac
2a50: 68 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 h (lambda (testp
2a60: 61 74 68 29 0a 09 09 28 69 66 20 28 66 69 6c 65 ath)...(if (file
2a70: 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 -exists? (conc t
2a80: 65 73 74 70 61 74 68 20 22 2f 74 65 73 74 63 6f estpath "/testco
2a90: 6e 66 69 67 22 29 29 0a 09 09 20 20 20 20 28 73 nfig"))... (s
2aa0: 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c et! res (cons (l
2ab0: 61 73 74 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ast (string-spli
2ac0: 74 20 74 65 73 74 70 61 74 68 20 22 2f 22 29 29 t testpath "/"))
2ad0: 20 72 65 73 29 29 29 29 0a 09 20 20 20 20 20 20 res))))..
2ae0: 74 65 73 74 73 29 0a 20 20 20 20 72 65 73 29 29 tests). res))
2af0: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
2b00: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
2b10: 74 73 20 64 62 29 0a 20 20 28 6c 65 74 20 28 28 ts db). (let ((
2b20: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 62 3a num-running (db:
2b30: 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d get-count-tests-
2b40: 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 28 6d running db))..(m
2b50: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
2b60: 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 bs (config-looku
2b70: 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 73 p *configdat* "s
2b80: 65 74 75 70 22 20 22 6d 61 78 5f 63 6f 6e 63 75 etup" "max_concu
2b90: 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 29 0a 20 rrent_jobs"))).
2ba0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
2bb0: 32 20 22 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 2 "max-concurren
2bc0: 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f t-jobs: " max-co
2bd0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 22 2c ncurrent-jobs ",
2be0: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 num-running: "
2bf0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a 20 20 20 num-running).
2c00: 20 28 69 66 20 28 6e 6f 74 20 28 65 71 3f 20 30 (if (not (eq? 0
2c10: 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 *globalexitstat
2c20: 75 73 2a 29 29 0a 09 23 66 0a 09 28 69 66 20 28 us*))..#f..(if (
2c30: 6f 72 20 28 6e 6f 74 20 6d 61 78 2d 63 6f 6e 63 or (not max-conc
2c40: 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 28 urrent-jobs)...(
2c50: 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 and max-concurre
2c60: 6e 74 2d 6a 6f 62 73 0a 09 09 20 20 20 20 20 28 nt-jobs... (
2c70: 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d string->number m
2c80: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
2c90: 62 73 29 0a 09 09 20 20 20 20 20 28 6e 6f 74 20 bs)... (not
2ca0: 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 (>= num-running
2cb0: 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 (string->number
2cc0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
2cd0: 6f 62 73 29 29 29 29 29 0a 09 20 20 20 20 23 74 obs))))).. #t
2ce0: 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 .. (begin ..
2cf0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
2d00: 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 4d 61 t 0 "WARNING: Ma
2d10: 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 73 20 65 x running jobs e
2d20: 78 63 65 65 64 65 64 2c 20 63 75 72 72 65 6e 74 xceeded, current
2d30: 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 3a number running:
2d40: 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 0a " num-running .
2d50: 09 09 09 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e ... ", max_con
2d60: 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 current_jobs: "
2d70: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
2d80: 6f 62 73 29 0a 09 20 20 20 20 20 20 23 66 29 29 obs).. #f))
2d90: 29 29 29 0a 20 20 0a 28 64 65 66 69 6e 65 20 28 ))). .(define (
2da0: 72 75 6e 2d 74 65 73 74 73 20 64 62 20 74 65 73 run-tests db tes
2db0: 74 2d 6e 61 6d 65 73 29 0a 20 20 28 6c 65 74 2a t-names). (let*
2dc0: 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 ((keys (
2dd0: 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db-get-keys db))
2de0: 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 .. (keyvallst
2df0: 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b (keys->vallist k
2e00: 65 79 73 20 23 74 29 29 0a 09 20 28 72 75 6e 2d eys #t)).. (run-
2e10: 69 64 20 20 20 20 20 20 28 72 65 67 69 73 74 65 id (registe
2e20: 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 29 29 29 r-run db keys)))
2e30: 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 ;; test-name))
2e40: 29 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 ). ;; on the
2e50: 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 first pass or ca
2e60: 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 ll to run-tests
2e70: 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 set FAILS to NOT
2e80: 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 _STARTED if.
2e90: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 ;; -keepgoing is
2ea0: 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 specified. (
2eb0: 69 66 20 28 61 6e 64 20 28 65 71 3f 20 2a 70 61 if (and (eq? *pa
2ec0: 73 73 6e 75 6d 2a 20 30 29 0a 09 20 20 20 20 20 ssnum* 0)..
2ed0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
2ee0: 6b 65 65 70 67 6f 69 6e 67 22 29 29 0a 09 28 62 keepgoing"))..(b
2ef0: 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 65 20 egin.. ;; have
2f00: 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 72 to delete test r
2f10: 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e 4f 54 ecords where NOT
2f20: 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 20 74 _STARTED since t
2f30: 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 2d 6b hey can cause -k
2f40: 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 20 20 eepgoing to ..
2f50: 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 75 65 ;; get stuck due
2f60: 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 6e 61 to becoming ina
2f70: 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 61 ccessible from a
2f80: 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 49 2e failed test. I.
2f90: 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 65 70 e. if test B dep
2fa0: 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e 20 74 ends .. ;; on t
2fb0: 65 73 74 20 41 20 62 75 74 20 74 65 73 74 20 42 est A but test B
2fc0: 20 72 65 61 63 68 65 64 20 74 68 65 20 70 6f 69 reached the poi
2fd0: 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 67 69 nt on being regi
2fe0: 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f 53 54 stered as NOT_ST
2ff0: 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 0a 09 ARTED and test..
3000: 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 66 6f ;; A failed fo
3010: 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 74 68 r some reason th
3020: 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 73 69 en on re-run usi
3030: 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 74 68 ng -keepgoing th
3040: 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 72 20 e run can never
3050: 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 64 62 complete... (db
3060: 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 6e :delete-tests-in
3070: 2d 73 74 61 74 65 20 64 62 20 72 75 6e 2d 69 64 -state db run-id
3080: 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 0a "NOT_STARTED").
3090: 09 20 20 28 64 62 3a 73 65 74 2d 74 65 73 74 73 . (db:set-tests
30a0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 -state-status db
30b0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
30c0: 65 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f es #f "FAIL" "NO
30d0: 54 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 4c T_STARTED" "FAIL
30e0: 22 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 2a "))). (set! *
30f0: 70 61 73 73 6e 75 6d 2a 20 28 2b 20 2a 70 61 73 passnum* (+ *pas
3100: 73 6e 75 6d 2a 20 31 29 29 0a 20 20 20 20 28 6c snum* 1)). (l
3110: 65 74 20 6c 6f 6f 70 20 28 28 6e 75 6d 74 69 6d et loop ((numtim
3120: 65 73 20 30 29 29 0a 20 20 20 20 20 20 28 66 6f es 0)). (fo
3130: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 20 20 28 r-each . (
3140: 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d lambda (test-nam
3150: 65 29 0a 09 20 28 69 66 20 28 72 75 6e 73 3a 63 e).. (if (runs:c
3160: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
3170: 73 20 64 62 29 0a 09 20 20 20 20 20 28 72 75 6e s db).. (run
3180: 2d 6f 6e 65 2d 74 65 73 74 20 64 62 20 72 75 6e -one-test db run
3190: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 6b 65 -id test-name ke
31a0: 79 76 61 6c 6c 73 74 29 0a 09 20 20 20 20 20 3b yvallst).. ;
31b0: 3b 20 61 64 64 20 73 6f 6d 65 20 64 65 6c 61 79 ; add some delay
31c0: 20 0a 09 20 20 20 20 20 3b 28 73 6c 65 65 70 20 .. ;(sleep
31d0: 32 29 0a 09 20 20 20 20 20 29 29 0a 20 20 20 20 2).. )).
31e0: 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 0a 20 test-names).
31f0: 20 20 20 20 20 3b 3b 20 28 72 75 6e 2d 77 61 69 ;; (run-wai
3200: 74 69 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 20 ting-tests db).
3210: 20 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 (if (args:g
3220: 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 et-arg "-keepgoi
3230: 6e 67 22 29 0a 09 20 20 28 6c 65 74 20 28 28 65 ng").. (let ((e
3240: 73 74 72 65 6d 20 28 64 62 3a 65 73 74 69 6d 61 strem (db:estima
3250: 74 65 64 2d 74 65 73 74 73 2d 72 65 6d 61 69 6e ted-tests-remain
3260: 69 6e 67 20 64 62 20 72 75 6e 2d 69 64 29 29 29 ing db run-id)))
3270: 0a 09 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 .. (if (and (
3280: 3e 20 65 73 74 72 65 6d 20 30 29 0a 09 09 20 20 > estrem 0)...
3290: 20 20 20 28 65 71 3f 20 2a 67 6c 6f 62 61 6c 65 (eq? *globale
32a0: 78 69 74 73 74 61 74 75 73 2a 20 30 29 29 0a 09 xitstatus* 0))..
32b0: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 .(begin... (deb
32c0: 75 67 3a 70 72 69 6e 74 20 31 20 22 4b 65 65 70 ug:print 1 "Keep
32d0: 20 67 6f 69 6e 67 2c 20 65 73 74 69 6d 61 74 65 going, estimate
32e0: 64 20 22 20 65 73 74 72 65 6d 20 22 20 74 65 73 d " estrem " tes
32f0: 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f 20 ts remaining to
3300: 72 75 6e 2c 20 77 69 6c 6c 20 63 6f 6e 74 69 6e run, will contin
3310: 75 65 20 69 6e 20 33 20 73 65 63 6f 6e 64 73 20 ue in 3 seconds
3320: 2e 2e 2e 22 29 0a 09 09 20 20 28 73 6c 65 65 70 ...")... (sleep
3330: 20 33 29 0a 09 09 20 20 28 72 75 6e 2d 77 61 69 3)... (run-wai
3340: 74 69 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 09 ting-tests db)..
3350: 09 20 20 28 6c 6f 6f 70 20 28 2b 20 6e 75 6d 74 . (loop (+ numt
3360: 69 6d 65 73 20 31 29 29 29 29 29 29 29 29 29 0a imes 1))))))))).
3370: 09 20 20 20 0a 3b 3b 20 56 45 52 59 20 49 4e 45 . .;; VERY INE
3380: 46 46 49 43 49 45 4e 54 21 20 4d 6f 76 65 20 73 FFICIENT! Move s
3390: 74 75 66 66 20 74 68 61 74 20 73 68 6f 75 6c 64 tuff that should
33a0: 20 62 65 20 64 6f 6e 65 20 6f 6e 63 65 20 75 70 be done once up
33b0: 20 74 6f 20 63 61 6c 6c 69 6e 67 20 70 72 6f 63 to calling proc
33c0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 2d 6f 6e .(define (run-on
33d0: 65 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 e-test db run-id
33e0: 20 74 65 73 74 2d 6e 61 6d 65 20 6b 65 79 76 61 test-name keyva
33f0: 6c 6c 73 74 29 0a 20 20 28 64 65 62 75 67 3a 70 llst). (debug:p
3400: 72 69 6e 74 20 31 20 22 4c 61 75 6e 63 68 69 6e rint 1 "Launchin
3410: 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 g test " test-na
3420: 6d 65 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 me). ;; All the
3430: 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 se vars might be
3440: 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 referenced by t
3450: 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 he testconfig fi
3460: 6c 65 20 72 65 61 64 65 72 0a 20 20 28 73 65 74 le reader. (set
3470: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d env "MT_TEST_NAM
3480: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b E" test-name) ;;
3490: 20 0a 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f . (setenv "MT_
34a0: 52 55 4e 4e 41 4d 45 22 20 20 20 28 61 72 67 73 RUNNAME" (args
34b0: 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 :get-arg ":runna
34c0: 6d 65 22 29 29 0a 20 20 28 73 65 74 2d 6d 65 67 me")). (set-meg
34d0: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 atest-env-vars d
34e0: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 b run-id) ;; the
34f0: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 se may be needed
3500: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e by the launchin
3510: 67 20 70 72 6f 63 65 73 73 0a 20 20 28 63 68 61 g process. (cha
3520: 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 2a 74 nge-directory *t
3530: 6f 70 70 61 74 68 2a 29 0a 20 20 28 6c 65 74 2a oppath*). (let*
3540: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 ((test-path
3550: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
3560: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
3570: 61 6d 65 29 29 0a 09 20 28 74 65 73 74 2d 63 6f ame)).. (test-co
3580: 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 nfigf (conc test
3590: 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 -path "/testconf
35a0: 69 67 22 29 29 0a 09 20 28 74 65 73 74 65 78 69 ig")).. (testexi
35b0: 73 74 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 sts (and (file
35c0: 2d 65 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f -exists? test-co
35d0: 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 nfigf)(file-read
35e0: 2d 61 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f -access? test-co
35f0: 6e 66 69 67 66 29 29 29 0a 09 20 28 74 65 73 74 nfigf))).. (test
3600: 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 -conf (if tes
3610: 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f texists (read-co
3620: 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 nfig test-config
3630: 66 29 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 f) (make-hash-ta
3640: 62 6c 65 29 29 29 0a 09 20 28 77 61 69 74 6f 6e ble))).. (waiton
3650: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 77 20 (let ((w
3660: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 (config-lookup t
3670: 65 73 74 2d 63 6f 6e 66 20 22 72 65 71 75 69 72 est-conf "requir
3680: 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e 22 ements" "waiton"
3690: 29 29 29 0a 09 09 09 20 28 69 66 20 28 73 74 72 ))).... (if (str
36a0: 69 6e 67 3f 20 77 29 28 73 74 72 69 6e 67 2d 73 ing? w)(string-s
36b0: 70 6c 69 74 20 77 29 27 28 29 29 29 29 0a 09 20 plit w)'())))..
36c0: 28 74 61 67 73 20 20 20 20 20 20 20 20 20 28 6c (tags (l
36d0: 65 74 20 28 28 74 20 28 63 6f 6e 66 69 67 2d 6c et ((t (config-l
36e0: 6f 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 ookup test-conf
36f0: 22 73 65 74 75 70 22 20 22 74 61 67 73 22 29 29 "setup" "tags"))
3700: 29 0a 09 09 09 20 28 69 66 20 28 73 74 72 69 6e ).... (if (strin
3710: 67 3f 20 74 29 28 73 74 72 69 6e 67 2d 73 70 6c g? t)(string-spl
3720: 69 74 20 74 20 22 2c 22 29 20 27 28 29 29 29 29 it t ",") '())))
3730: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 ). (if (not t
3740: 65 73 74 65 78 69 73 74 73 29 0a 09 28 62 65 67 estexists)..(beg
3750: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 in.. (debug:pri
3760: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6e nt 0 "ERROR: Can
3770: 27 74 20 66 69 6e 64 20 63 6f 6e 66 69 67 20 66 't find config f
3780: 69 6c 65 20 22 20 74 65 73 74 2d 63 6f 6e 66 69 ile " test-confi
3790: 67 66 29 0a 09 20 20 28 65 78 69 74 20 32 29 29 gf).. (exit 2))
37a0: 0a 09 3b 3b 20 70 75 74 20 74 6f 70 20 76 61 72 ..;; put top var
37b0: 73 20 69 6e 74 6f 20 63 6f 6e 76 65 6e 69 65 6e s into convenien
37c0: 74 20 76 61 72 69 61 62 6c 65 73 20 61 6e 64 20 t variables and
37d0: 6f 70 65 6e 20 74 68 65 20 64 62 0a 09 28 6c 65 open the db..(le
37e0: 74 2a 20 28 3b 3b 20 64 62 20 69 73 20 61 6c 77 t* (;; db is alw
37f0: 61 79 73 20 61 74 20 2a 74 6f 70 70 61 74 68 2a ays at *toppath*
3800: 2f 64 62 2f 6d 65 67 61 74 65 73 74 2e 64 62 0a /db/megatest.db.
3810: 09 20 20 20 20 20 20 20 28 69 74 65 6d 73 20 20 . (items
3820: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 (hash-table
3830: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 73 -ref/default tes
3840: 74 2d 63 6f 6e 66 20 22 69 74 65 6d 73 22 20 27 t-conf "items" '
3850: 28 29 29 29 0a 09 20 20 20 20 20 20 20 28 69 74 ())).. (it
3860: 65 6d 73 74 61 62 6c 65 20 20 28 68 61 73 68 2d emstable (hash-
3870: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
3880: 74 20 74 65 73 74 2d 63 6f 6e 66 20 22 69 74 65 t test-conf "ite
3890: 6d 73 74 61 62 6c 65 22 20 27 28 29 29 29 0a 09 mstable" '()))..
38a0: 20 20 20 20 20 20 20 28 61 6c 6c 69 74 65 6d 73 (allitems
38b0: 20 20 20 20 28 69 66 20 28 6f 72 20 28 6e 6f 74 (if (or (not
38c0: 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 29 28 (null? items))(
38d0: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 not (null? items
38e0: 74 61 62 6c 65 29 29 29 0a 09 09 09 09 28 61 70 table))).....(ap
38f0: 70 65 6e 64 20 28 69 74 65 6d 2d 61 73 73 6f 63 pend (item-assoc
3900: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d ->item-list item
3910: 73 29 0a 09 09 09 09 09 28 69 74 65 6d 2d 74 61 s)......(item-ta
3920: 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 ble->item-list i
3930: 74 65 6d 73 74 61 62 6c 65 29 29 0a 09 09 09 09 temstable)).....
3940: 27 28 28 29 29 29 29 20 3b 3b 20 61 20 6c 69 73 '(()))) ;; a lis
3950: 74 20 77 69 74 68 20 6f 6e 65 20 6e 75 6c 6c 20 t with one null
3960: 6c 69 73 74 20 69 73 20 61 20 74 65 73 74 20 77 list is a test w
3970: 69 74 68 20 6e 6f 20 69 74 65 6d 73 0a 09 20 20 ith no items..
3980: 20 20 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 66 (runconfigf
3990: 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 (conc *toppat
39a0: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e h* "/runconfigs.
39b0: 63 6f 6e 66 69 67 22 29 29 29 0a 09 20 20 28 64 config"))).. (d
39c0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 69 74 ebug:print 1 "it
39d0: 65 6d 73 3a 20 22 29 0a 09 20 20 28 69 66 20 28 ems: ").. (if (
39e0: 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 >= *verbosity* 1
39f0: 29 28 70 70 20 61 6c 6c 69 74 65 6d 73 29 29 0a )(pp allitems)).
3a00: 09 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 . (if (>= *verb
3a10: 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 20 20 osity* 5)..
3a20: 20 28 62 65 67 69 6e 0a 09 09 28 70 72 69 6e 74 (begin...(print
3a30: 20 22 69 74 65 6d 73 3a 20 22 29 28 70 70 20 28 "items: ")(pp (
3a40: 69 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d item-assoc->item
3a50: 2d 6c 69 73 74 20 69 74 65 6d 73 29 29 0a 09 09 -list items))...
3a60: 28 70 72 69 6e 74 20 22 69 74 65 73 74 61 62 6c (print "itestabl
3a70: 65 3a 20 22 29 28 70 70 20 28 69 74 65 6d 2d 74 e: ")(pp (item-t
3a80: 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 able->item-list
3a90: 69 74 65 6d 73 74 61 62 6c 65 29 29 29 29 0a 09 itemstable))))..
3aa0: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d (if (args:get-
3ab0: 61 72 67 20 22 2d 6d 22 29 0a 09 20 20 20 20 20 arg "-m")..
3ac0: 20 28 64 62 3a 73 65 74 2d 63 6f 6d 6d 65 6e 74 (db:set-comment
3ad0: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d -for-run db run-
3ae0: 69 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 id (args:get-arg
3af0: 20 22 2d 6d 22 29 29 29 0a 09 20 20 3b 3b 20 62 "-m"))).. ;; b
3b00: 72 61 69 6e 64 65 61 64 20 77 6f 72 6b 2d 61 72 raindead work-ar
3b10: 6f 75 6e 64 20 66 6f 72 20 70 6f 6f 72 6c 79 20 ound for poorly
3b20: 73 70 65 63 69 66 69 65 64 20 61 6c 6c 69 74 65 specified allite
3b30: 6d 73 20 6c 69 73 74 20 42 55 47 21 21 21 20 46 ms list BUG!!! F
3b40: 49 58 4d 45 0a 09 20 20 28 69 66 20 28 6e 75 6c IXME.. (if (nul
3b50: 6c 3f 20 61 6c 6c 69 74 65 6d 73 29 28 73 65 74 l? allitems)(set
3b60: 21 20 61 6c 6c 69 74 65 6d 73 20 27 28 28 29 29 ! allitems '(())
3b70: 29 29 0a 09 20 20 28 6c 65 74 20 6c 6f 6f 70 20 )).. (let loop
3b80: 28 28 69 74 65 6d 64 61 74 20 28 63 61 72 20 61 ((itemdat (car a
3b90: 6c 6c 69 74 65 6d 73 29 29 0a 09 09 20 20 20 20 llitems))...
3ba0: 20 28 74 61 6c 20 20 20 20 20 28 63 64 72 20 61 (tal (cdr a
3bb0: 6c 6c 69 74 65 6d 73 29 29 29 0a 09 20 20 20 20 llitems)))..
3bc0: 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d ;; (lambda (item
3bd0: 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e dat) ;;; ((ripen
3be0: 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 ess "overripe")
3bf0: 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f (temperature "co
3c00: 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 ol") (season "su
3c10: 6d 6d 65 72 22 29 29 0a 09 20 20 20 20 3b 3b 20 mmer")).. ;;
3c20: 48 61 6e 64 6c 65 20 6c 69 73 74 73 20 6f 66 20 Handle lists of
3c30: 69 74 65 6d 73 0a 09 20 20 20 20 28 6c 65 74 2a items.. (let*
3c40: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 ((item-path
3c50: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 (item-list->pat
3c60: 68 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 28 h itemdat)) ;; (
3c70: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
3c80: 73 65 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 se (map cadr ite
3c90: 6d 64 61 74 29 20 22 2f 22 29 29 0a 09 09 20 20 mdat) "/"))...
3ca0: 20 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 (new-test-path
3cb0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
3cc0: 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 rse (cons test-p
3cd0: 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 ath (map cadr it
3ce0: 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 09 emdat)) "/"))...
3cf0: 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d (new-test-nam
3d00: 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 e (if (equal? it
3d10: 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 em-path "") test
3d20: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 -name (conc test
3d30: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 -name "/" item-p
3d40: 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e ath))) ;; just n
3d50: 65 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 eed it to be uni
3d60: 71 75 65 0a 09 09 20 20 20 28 74 65 73 74 64 61 que... (testda
3d70: 74 20 20 20 23 66 29 0a 09 09 20 20 20 28 6e 75 t #f)... (nu
3d80: 6d 2d 72 75 6e 6e 69 6e 67 20 28 64 62 3a 67 65 m-running (db:ge
3d90: 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 t-count-tests-ru
3da0: 6e 6e 69 6e 67 20 64 62 29 29 0a 09 09 20 20 20 nning db))...
3db0: 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d (max-concurrent-
3dc0: 6a 6f 62 73 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f jobs (config-loo
3dd0: 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 kup *configdat*
3de0: 22 73 65 74 75 70 22 20 22 6d 61 78 5f 63 6f 6e "setup" "max_con
3df0: 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a current_jobs")).
3e00: 09 09 20 20 20 28 70 61 72 65 6e 74 2d 74 65 73 .. (parent-tes
3e10: 74 20 28 61 6e 64 20 28 6e 6f 74 20 28 6e 75 6c t (and (not (nul
3e20: 6c 3f 20 69 74 65 6d 73 29 29 28 65 71 75 61 6c l? items))(equal
3e30: 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 29 ? item-path ""))
3e40: 29 0a 09 09 20 20 20 28 73 69 6e 67 6c 65 2d 74 )... (single-t
3e50: 65 73 74 20 28 61 6e 64 20 28 6e 75 6c 6c 3f 20 est (and (null?
3e60: 69 74 65 6d 73 29 20 28 65 71 75 61 6c 3f 20 69 items) (equal? i
3e70: 74 65 6d 2d 70 61 74 68 20 22 22 29 29 29 0a 09 tem-path "")))..
3e80: 09 20 20 20 28 69 74 65 6d 2d 74 65 73 74 20 20 . (item-test
3e90: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 69 74 (not (equal? it
3ea0: 65 6d 2d 70 61 74 68 20 22 22 29 29 29 29 0a 09 em-path ""))))..
3eb0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
3ec0: 6e 74 20 33 20 22 6d 61 78 2d 63 6f 6e 63 75 72 nt 3 "max-concur
3ed0: 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 rent-jobs: " max
3ee0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
3ef0: 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a ", num-running:
3f00: 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a " num-running).
3f10: 09 20 20 20 20 20 20 28 69 66 20 28 72 75 6e 73 . (if (runs
3f20: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
3f30: 73 74 73 20 64 62 29 0a 09 09 20 20 28 62 65 67 sts db)... (beg
3f40: 69 6e 0a 09 09 20 20 20 20 28 6c 65 74 20 6c 6f in... (let lo
3f50: 6f 70 32 20 28 28 74 73 20 28 64 62 3a 67 65 74 op2 ((ts (db:get
3f60: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 -test-info db ru
3f70: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
3f80: 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 23 66 tem-path)) ;; #f
3f90: 29 0a 09 09 09 09 28 63 74 20 30 29 29 0a 09 09 ).....(ct 0))...
3fa0: 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 (if (and (
3fb0: 6e 6f 74 20 74 73 29 0a 09 09 09 20 20 20 20 20 not ts)....
3fc0: 20 20 28 3c 20 63 74 20 31 30 29 29 0a 09 09 09 (< ct 10))....
3fd0: 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 (begin....
3fe0: 28 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 (register-test d
3ff0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
4000: 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 74 61 67 me item-path tag
4010: 73 29 0a 09 09 09 20 20 20 20 28 64 62 3a 74 65 s).... (db:te
4020: 73 74 2d 73 65 74 2d 63 6f 6d 6d 65 6e 74 20 64 st-set-comment d
4030: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
4040: 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 me item-path "")
4050: 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 32 20 28 .... (loop2 (
4060: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f db:get-test-info
4070: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
4080: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a name item-path).
4090: 09 09 09 09 20 20 20 28 2b 20 63 74 20 31 29 29 .... (+ ct 1))
40a0: 29 0a 09 09 09 20 20 28 69 66 20 74 73 0a 09 09 ).... (if ts...
40b0: 09 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 . (set! tes
40c0: 74 64 61 74 20 74 73 29 0a 09 09 09 20 20 20 20 tdat ts)....
40d0: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 (begin.....(de
40e0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
40f0: 4e 49 4e 47 3a 20 43 6f 75 6c 64 6e 27 74 20 72 NING: Couldn't r
4100: 65 67 69 73 74 65 72 20 74 65 73 74 20 22 20 74 egister test " t
4110: 65 73 74 2d 6e 61 6d 65 20 22 20 77 69 74 68 20 est-name " with
4120: 69 74 65 6d 20 70 61 74 68 20 22 20 69 74 65 6d item path " item
4130: 2d 70 61 74 68 20 22 2c 20 73 6b 69 70 70 69 6e -path ", skippin
4140: 67 22 29 0a 09 09 09 09 28 69 66 20 28 6e 6f 74 g").....(if (not
4150: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 (null? tal))...
4160: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 .. (loop (car
4170: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 tal)(cdr tal)))
4180: 29 29 29 29 0a 09 09 20 20 20 20 28 63 68 61 6e ))))... (chan
4190: 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 ge-directory tes
41a0: 74 2d 70 61 74 68 29 0a 09 09 20 20 20 20 3b 3b t-path)... ;;
41b0: 20 74 68 69 73 20 62 6c 6f 63 6b 20 69 73 20 68 this block is h
41c0: 65 72 65 20 6f 6e 6c 79 20 74 6f 20 69 6e 66 6f ere only to info
41d0: 72 6d 20 74 68 65 20 75 73 65 72 20 65 61 72 6c rm the user earl
41e0: 79 20 6f 6e 0a 09 09 20 20 20 20 28 69 66 20 28 y on... (if (
41f0: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e file-exists? run
4200: 63 6f 6e 66 69 67 66 29 0a 09 09 09 28 73 65 74 configf)....(set
4210: 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 up-env-defaults
4220: 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 db runconfigf ru
4230: 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 n-id *already-se
4240: 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 en-runconfig-inf
4250: 6f 2a 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 o*)....(debug:pr
4260: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
4270: 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 You do not have
4280: 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c a run config fil
4290: 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 e: " runconfigf)
42a0: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
42b0: 72 69 6e 74 20 34 20 22 72 75 6e 2d 69 64 3a 20 rint 4 "run-id:
42c0: 22 20 72 75 6e 2d 69 64 20 22 20 74 65 73 74 2d " run-id " test-
42d0: 6e 61 6d 65 3a 20 22 20 74 65 73 74 2d 6e 61 6d name: " test-nam
42e0: 65 20 22 20 69 74 65 6d 2d 70 61 74 68 3a 20 22 e " item-path: "
42f0: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 74 65 73 item-path " tes
4300: 74 64 61 74 3a 20 22 20 28 74 65 73 74 3a 67 65 tdat: " (test:ge
4310: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
4320: 29 20 22 20 74 65 73 74 2d 73 74 61 74 65 3a 20 ) " test-state:
4330: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
4340: 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 e testdat))...
4350: 20 20 28 63 61 73 65 20 28 69 66 20 28 61 72 67 (case (if (arg
4360: 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 s:get-arg "-forc
4370: 65 22 29 0a 09 09 09 20 20 20 20 20 20 27 4e 4f e").... 'NO
4380: 54 5f 53 54 41 52 54 45 44 0a 09 09 09 20 20 20 T_STARTED....
4390: 20 20 20 28 69 66 20 74 65 73 74 64 61 74 0a 09 (if testdat..
43a0: 09 09 09 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 ... (string->sy
43b0: 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 mbol (test:get-s
43c0: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 tate testdat))..
43d0: 09 09 09 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d ... 'failed-to-
43e0: 69 6e 73 65 72 74 29 29 0a 09 09 20 20 20 20 20 insert))...
43f0: 20 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 ((failed-to-ins
4400: 65 72 74 29 0a 09 09 20 20 20 20 20 20 20 28 64 ert)... (d
4410: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
4420: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 ROR: Failed to i
4430: 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 nsert the record
4440: 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a into the db")).
4450: 09 09 20 20 20 20 20 20 28 28 4e 4f 54 5f 53 54 .. ((NOT_ST
4460: 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 ARTED COMPLETED)
4470: 0a 09 09 20 20 20 20 20 20 20 28 64 65 62 75 67 ... (debug
4480: 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 20 68 65 :print 6 "Got he
4490: 72 65 2c 20 22 20 28 74 65 73 74 3a 67 65 74 2d re, " (test:get-
44a0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a state testdat)).
44b0: 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 .. (let ((
44c0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 runflag #f))....
44d0: 20 28 63 6f 6e 64 0a 09 09 09 20 20 3b 3b 20 69 (cond.... ;; i
44e0: 2e 65 2e 20 74 68 69 73 20 69 73 20 74 68 65 20 .e. this is the
44f0: 70 61 72 65 6e 74 20 74 65 73 74 20 74 6f 20 61 parent test to a
4500: 20 73 75 69 74 65 20 6f 66 20 69 74 65 6d 73 2c suite of items,
4510: 20 6e 65 76 65 72 20 22 72 75 6e 22 20 69 74 0a never "run" it.
4520: 09 09 09 20 20 28 70 61 72 65 6e 74 2d 74 65 73 ... (parent-tes
4530: 74 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 75 t.... (set! ru
4540: 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 nflag #f))....
4550: 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e ;; -force, run n
4560: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 09 o matter what...
4570: 09 20 20 28 28 61 72 67 73 3a 67 65 74 2d 61 72 . ((args:get-ar
4580: 67 20 22 2d 66 6f 72 63 65 22 29 28 73 65 74 21 g "-force")(set!
4590: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 runflag #t))...
45a0: 09 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 . ;; NOT_STARTE
45b0: 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 D, run no matter
45c0: 20 77 68 61 74 0a 09 09 09 20 20 28 28 65 71 75 what.... ((equ
45d0: 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 al? (test:get-st
45e0: 61 74 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f ate testdat) "NO
45f0: 54 5f 53 54 41 52 54 45 44 22 29 28 73 65 74 21 T_STARTED")(set!
4600: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 09 runflag #t))...
4610: 09 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e . ;; not -rerun
4620: 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 and PASS, WARN
4630: 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 or CHECK, do no
4640: 72 75 6e 0a 09 09 09 20 20 28 28 61 6e 64 20 28 run.... ((and (
4650: 6f 72 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 or (not (args:ge
4660: 74 2d 61 72 67 20 22 2d 72 65 72 75 6e 22 29 29 t-arg "-rerun"))
4670: 0a 09 09 09 09 20 20 20 20 28 61 72 67 73 3a 67 ..... (args:g
4680: 65 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 et-arg "-keepgoi
4690: 6e 67 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 ng")).....(membe
46a0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
46b0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50 us testdat) '("P
46c0: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 ASS" "WARN" "CHE
46d0: 43 4b 22 29 29 29 0a 09 09 09 20 20 20 28 73 65 CK"))).... (se
46e0: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 0a t! runflag #f)).
46f0: 09 09 09 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 ... ;; -rerun a
4700: 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e 65 nd status is one
4710: 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 64 of the specifed
4720: 2c 20 72 75 6e 20 69 74 0a 09 09 09 20 20 28 28 , run it.... ((
4730: 61 6e 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 and (args:get-ar
4740: 67 20 22 2d 72 65 72 75 6e 22 29 0a 09 09 09 09 g "-rerun").....
4750: 28 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 74 20 (let ((rerunlst
4760: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 61 (string-split (a
4770: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
4780: 72 75 6e 22 29 20 22 2c 22 29 29 29 20 3b 3b 20 run") ","))) ;;
4790: 46 41 49 4c 2c 0a 09 09 09 09 20 20 28 6d 65 6d FAIL,..... (mem
47a0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
47b0: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 atus testdat) re
47c0: 72 75 6e 6c 73 74 29 29 29 0a 09 09 09 20 20 20 runlst)))....
47d0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
47e0: 29 29 0a 09 09 09 20 20 3b 3b 20 2d 6b 65 65 70 )).... ;; -keep
47f0: 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 going, do not re
4800: 72 75 6e 20 46 41 49 4c 0a 09 09 09 20 20 28 28 run FAIL.... ((
4810: 61 6e 64 20 28 61 72 67 73 3a 67 65 74 2d 61 72 and (args:get-ar
4820: 67 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 29 0a g "-keepgoing").
4830: 09 09 09 09 28 6d 65 6d 62 65 72 20 28 74 65 73 ....(member (tes
4840: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
4850: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 tdat) '("FAIL"))
4860: 29 0a 09 09 09 20 20 20 28 73 65 74 21 20 72 75 ).... (set! ru
4870: 6e 66 6c 61 67 20 23 66 29 29 0a 09 09 09 20 20 nflag #f))....
4880: 28 28 61 6e 64 20 28 6e 6f 74 20 28 61 72 67 73 ((and (not (args
4890: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 72 75 6e :get-arg "-rerun
48a0: 22 29 29 0a 09 09 09 09 28 6d 65 6d 62 65 72 20 ")).....(member
48b0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
48c0: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 testdat) '("FAI
48d0: 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 09 09 20 L" "n/a")))....
48e0: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 (set! runflag
48f0: 23 74 29 29 0a 09 09 09 20 20 28 65 6c 73 65 20 #t)).... (else
4900: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
4910: 29 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 ))).... (debug:p
4920: 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 rint 6 "RUNNING
4930: 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 => runflag: " ru
4940: 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 nflag " STATE: "
4950: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
4960: 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 testdat) " STAT
4970: 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d US: " (test:get-
4980: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 status testdat))
4990: 0a 09 09 09 20 28 69 66 20 28 6e 6f 74 20 72 75 .... (if (not ru
49a0: 6e 66 6c 61 67 29 0a 09 09 09 20 20 20 20 20 28 nflag).... (
49b0: 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 if (not parent-t
49c0: 65 73 74 29 0a 09 09 09 09 20 28 64 65 62 75 67 est)..... (debug
49d0: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 :print 1 "NOTE:
49e0: 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 Not starting tes
49f0: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d t " new-test-nam
4a00: 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 e " as it is sta
4a10: 74 65 20 5c 22 43 4f 4d 50 4c 45 54 45 44 5c 22 te \"COMPLETED\"
4a20: 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 and status \""
4a30: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
4a40: 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 testdat) "\", u
4a50: 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 se -force to ove
4a60: 72 72 69 64 65 22 29 29 0a 09 09 09 20 20 20 20 rride"))....
4a70: 20 28 6c 65 74 2a 20 28 28 67 65 74 2d 70 72 65 (let* ((get-pre
4a80: 72 65 71 73 2d 63 6d 64 20 28 6c 61 6d 62 64 61 reqs-cmd (lambda
4a90: 20 28 29 0a 09 09 09 09 09 09 20 20 20 20 20 20 ().......
4aa0: 20 28 64 62 2d 67 65 74 2d 70 72 65 72 65 71 73 (db-get-prereqs
4ab0: 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d -not-met db run-
4ac0: 69 64 20 77 61 69 74 6f 6e 29 29 29 20 3b 3b 20 id waiton))) ;;
4ad0: 63 68 65 63 6b 20 62 65 66 6f 72 65 20 72 75 6e check before run
4ae0: 6e 69 6e 67 20 2e 2e 2e 2e 0a 09 09 09 09 20 20 ning .........
4af0: 20 20 28 6c 61 75 6e 63 68 2d 63 6d 64 20 20 20 (launch-cmd
4b00: 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 09 09 (lambda ()...
4b10: 09 09 09 09 20 20 20 20 20 20 20 28 6c 61 75 6e .... (laun
4b20: 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 ch-test db run-i
4b30: 64 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 d test-conf keyv
4b40: 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 allst test-name
4b50: 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 test-path itemda
4b60: 74 29 29 29 0a 09 09 09 09 20 20 20 20 28 74 65 t)))..... (te
4b70: 73 74 72 75 6e 64 61 74 20 20 20 20 20 20 28 6c strundat (l
4b80: 69 73 74 20 67 65 74 2d 70 72 65 72 65 71 73 2d ist get-prereqs-
4b90: 63 6d 64 20 6c 61 75 6e 63 68 2d 63 6d 64 29 29 cmd launch-cmd))
4ba0: 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 ).... (if
4bb0: 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (or (args:get-ar
4bc0: 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 09 09 g "-force").....
4bd0: 20 20 20 20 20 20 20 28 6e 75 6c 6c 3f 20 28 28 (null? ((
4be0: 63 61 72 20 74 65 73 74 72 75 6e 64 61 74 29 29 car testrundat))
4bf0: 29 29 20 3b 3b 20 61 72 65 20 74 68 65 72 65 20 )) ;; are there
4c00: 61 6e 79 20 74 65 73 74 73 20 74 68 61 74 20 6d any tests that m
4c10: 75 73 74 20 62 65 20 72 75 6e 20 62 65 66 6f 72 ust be run befor
4c20: 65 20 74 68 69 73 20 6f 6e 65 2e 2e 2e 0a 09 09 e this one......
4c30: 09 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 28 .. (if (not ((
4c40: 63 61 64 72 20 74 65 73 74 72 75 6e 64 61 74 29 cadr testrundat)
4c50: 29 29 20 3b 3b 20 74 68 69 73 20 69 73 20 74 68 )) ;; this is th
4c60: 65 20 6c 69 6e 65 20 74 68 61 74 20 6c 61 75 6e e line that laun
4c70: 63 68 65 73 20 74 68 65 20 74 65 73 74 20 74 6f ches the test to
4c80: 20 74 68 65 20 72 65 6d 6f 74 65 20 68 6f 73 74 the remote host
4c90: 0a 09 09 09 09 20 20 20 20 20 20 20 28 62 65 67 ..... (beg
4ca0: 69 6e 0a 09 09 09 09 09 20 28 70 72 69 6e 74 20 in...... (print
4cb0: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 "ERROR: Failed t
4cc0: 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 o launch the tes
4cd0: 74 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f t. Exiting as so
4ce0: 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 on as possible")
4cf0: 0a 09 09 09 09 09 20 28 73 65 74 21 20 2a 67 6c ...... (set! *gl
4d00: 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 obalexitstatus*
4d10: 31 29 20 3b 3b 20 0a 09 09 09 09 09 20 28 70 72 1) ;; ...... (pr
4d20: 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 ocess-signal (cu
4d30: 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 rrent-process-id
4d40: 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 0a 09 ) signal/kill)..
4d50: 09 09 09 09 20 3b 28 65 78 69 74 20 31 29 0a 09 .... ;(exit 1)..
4d60: 09 09 09 09 20 29 29 0a 09 09 09 09 20 20 20 28 .... ))..... (
4d70: 69 66 20 28 6e 6f 74 20 28 61 72 67 73 3a 67 65 if (not (args:ge
4d80: 74 2d 61 72 67 20 22 2d 6b 65 65 70 67 6f 69 6e t-arg "-keepgoin
4d90: 67 22 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 g")).....
4da0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 (hash-table-set!
4db0: 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 65 2a *waiting-queue*
4dc0: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 74 new-test-name t
4dd0: 65 73 74 72 75 6e 64 61 74 29 29 29 29 29 29 29 estrundat)))))))
4de0: 0a 09 09 20 20 20 20 20 20 28 28 4b 49 4c 4c 45 ... ((KILLE
4df0: 44 29 20 0a 09 09 20 20 20 20 20 20 20 28 64 65 D) ... (de
4e00: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 bug:print 1 "NOT
4e10: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 E: " new-test-na
4e20: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
4e30: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 running or was e
4e40: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c xplictly killed,
4e50: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c use -force to l
4e60: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 09 20 aunch it."))...
4e70: 20 20 20 20 20 28 28 4c 41 55 4e 43 48 45 44 20 ((LAUNCHED
4e80: 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 REMOTEHOSTSTART
4e90: 52 55 4e 4e 49 4e 47 29 20 20 0a 09 09 20 20 20 RUNNING) ...
4ea0: 20 20 20 20 28 69 66 20 28 3e 20 28 2d 20 28 63 (if (> (- (c
4eb0: 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 urrent-seconds)(
4ec0: 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 + (db:test-get-e
4ed0: 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 vent_time testda
4ee0: 74 29 0a 09 09 09 09 09 09 20 20 20 20 20 28 64 t)....... (d
4ef0: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 b:test-get-run_d
4f00: 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 uration testdat)
4f10: 29 29 0a 09 09 09 20 20 20 20 20 20 31 30 30 29 )).... 100)
4f20: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 ;; i.e. no upda
4f30: 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e te for more than
4f40: 20 31 30 30 20 73 65 63 6f 6e 64 73 0a 09 09 09 100 seconds....
4f50: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 (begin....
4f60: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
4f70: 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 "WARNING: Test
4f80: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 " test-name " ap
4f90: 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 pears to be dead
4fa0: 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 . Forcing it to
4fb0: 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 state INCOMPLETE
4fc0: 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 and status STUC
4fd0: 4b 2f 44 45 41 44 22 29 0a 09 09 09 20 20 20 20 K/DEAD")....
4fe0: 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 (test-set-statu
4ff0: 73 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 s! db run-id tes
5000: 74 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 t-name "INCOMPLE
5010: 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 TE" "STUCK/DEAD"
5020: 20 69 74 65 6d 64 61 74 20 22 54 65 73 74 20 69 itemdat "Test i
5030: 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 s stuck or dead"
5040: 29 29 0a 09 09 09 20 20 20 28 64 65 62 75 67 3a )).... (debug:
5050: 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 print 2 "NOTE: "
5060: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 test-name " is
5070: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 already running"
5080: 29 29 29 0a 09 09 20 20 20 20 20 20 28 65 6c 73 )))... (els
5090: 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 e (debug:p
50a0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 46 rint 0 "ERROR: F
50b0: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 ailed to launch
50c0: 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 2d test " new-test-
50d0: 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 6e name ". Unrecogn
50e0: 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74 65 ised state " (te
50f0: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
5100: 74 64 61 74 29 29 29 29 29 29 0a 09 20 20 20 20 tdat))))))..
5110: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c (if (not (null
5120: 3f 20 74 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f ? tal))... (loo
5130: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 p (car tal)(cdr
5140: 74 61 6c 29 29 29 29 29 29 29 29 29 0a 0a 28 64 tal)))))))))..(d
5150: 65 66 69 6e 65 20 28 72 75 6e 2d 77 61 69 74 69 efine (run-waiti
5160: 6e 67 2d 74 65 73 74 73 20 64 62 29 0a 20 20 28 ng-tests db). (
5170: 6c 65 74 20 28 28 6e 75 6d 74 72 69 65 73 20 20 let ((numtries
5180: 20 20 20 20 20 20 20 20 20 30 29 0a 09 28 6c 61 0)..(la
5190: 73 74 2d 74 72 79 2d 74 69 6d 65 20 20 20 20 20 st-try-time
51a0: 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 (current-second
51b0: 73 29 29 0a 09 28 74 69 6d 65 73 20 20 20 20 20 s))..(times
51c0: 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 31 (list 1
51d0: 29 29 29 20 3b 3b 20 6d 69 6e 75 74 65 73 20 74 ))) ;; minutes t
51e0: 6f 20 77 61 69 74 20 62 65 66 6f 72 65 20 74 72 o wait before tr
51f0: 79 69 6e 67 20 61 67 61 69 6e 20 74 6f 20 6b 69 ying again to ki
5200: 63 6b 20 6f 66 66 20 72 75 6e 73 0a 20 20 20 20 ck off runs.
5210: 3b 3b 20 42 55 47 20 74 68 69 73 20 68 61 63 6b ;; BUG this hack
5220: 20 6f 66 20 62 72 75 74 65 20 66 6f 72 63 65 20 of brute force
5230: 72 65 74 72 79 69 6e 67 20 77 6f 72 6b 73 20 71 retrying works q
5240: 75 69 74 65 20 77 65 6c 6c 20 66 6f 72 20 6d 61 uite well for ma
5250: 6e 79 20 63 61 73 65 73 20 62 75 74 20 0a 20 20 ny cases but .
5260: 20 20 3b 3b 20 20 20 20 20 77 68 61 74 20 69 73 ;; what is
5270: 20 6e 65 65 64 65 64 20 69 73 20 74 6f 20 63 68 needed is to ch
5280: 65 63 6b 20 74 68 65 20 64 62 20 66 6f 72 20 74 eck the db for t
5290: 65 73 74 73 20 74 68 61 74 20 68 61 76 65 20 66 ests that have f
52a0: 61 69 6c 65 64 20 6c 65 73 73 20 74 68 61 6e 0a ailed less than.
52b0: 20 20 20 20 3b 3b 20 20 20 20 20 4e 20 74 69 6d ;; N tim
52c0: 65 73 20 6f 72 20 6e 65 76 65 72 20 62 65 65 6e es or never been
52d0: 20 73 74 61 72 74 65 64 20 61 6e 64 20 6b 69 63 started and kic
52e0: 6b 20 74 68 65 6d 20 6f 66 66 20 61 67 61 69 6e k them off again
52f0: 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 . (let loop (
5300: 28 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 (waiting-test-na
5310: 6d 65 73 20 28 68 61 73 68 2d 74 61 62 6c 65 2d mes (hash-table-
5320: 6b 65 79 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 keys *waiting-qu
5330: 65 75 65 2a 29 29 29 0a 20 20 20 20 20 20 28 63 eue*))). (c
5340: 6f 6e 64 0a 20 20 20 20 20 20 20 28 28 6e 6f 74 ond. ((not
5350: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d (runs:can-run-m
5360: 6f 72 65 2d 74 65 73 74 73 20 64 62 29 29 0a 09 ore-tests db))..
5370: 28 73 6c 65 65 70 20 32 29 0a 09 28 6c 6f 6f 70 (sleep 2)..(loop
5380: 20 77 61 69 74 69 6e 67 2d 74 65 73 74 2d 6e 61 waiting-test-na
5390: 6d 65 73 29 29 0a 20 20 20 20 20 20 20 28 28 6e mes)). ((n
53a0: 75 6c 6c 3f 20 77 61 69 74 69 6e 67 2d 74 65 73 ull? waiting-tes
53b0: 74 2d 6e 61 6d 65 73 29 0a 09 28 64 65 62 75 67 t-names)..(debug
53c0: 3a 70 72 69 6e 74 20 31 20 22 41 6c 6c 20 74 65 :print 1 "All te
53d0: 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29 29 0a sts launched")).
53e0: 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 28 73 (else..(s
53f0: 65 74 21 20 6e 75 6d 74 72 69 65 73 20 28 2b 20 et! numtries (+
5400: 6e 75 6d 74 72 69 65 73 20 31 29 29 0a 09 28 66 numtries 1))..(f
5410: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
5420: 28 74 65 73 74 6e 61 6d 65 29 0a 09 09 20 20 20 (testname)...
5430: 20 28 69 66 20 28 72 75 6e 73 3a 63 61 6e 2d 72 (if (runs:can-r
5440: 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 un-more-tests db
5450: 29 0a 09 09 09 28 6c 65 74 2a 20 28 28 74 65 73 )....(let* ((tes
5460: 74 64 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 tdat (hash-table
5470: 2d 72 65 66 20 2a 77 61 69 74 69 6e 67 2d 71 75 -ref *waiting-qu
5480: 65 75 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 0a eue* testname)).
5490: 09 09 09 20 20 20 20 20 20 20 28 70 72 65 72 65 ... (prere
54a0: 71 73 20 28 28 63 61 72 20 74 65 73 74 64 61 74 qs ((car testdat
54b0: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 6c ))).... (l
54c0: 64 62 20 20 20 20 20 28 69 66 20 64 62 20 64 62 db (if db db
54d0: 20 28 6f 70 65 6e 2d 64 62 29 29 29 29 0a 09 09 (open-db))))...
54e0: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
54f0: 32 20 22 70 72 65 72 65 71 73 20 72 65 6d 61 69 2 "prereqs remai
5500: 6e 69 6e 67 3a 20 22 20 70 72 65 72 65 71 73 29 ning: " prereqs)
5510: 0a 09 09 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f .... (if (null?
5520: 20 70 72 65 72 65 71 73 29 0a 09 09 09 20 20 20 prereqs)....
5530: 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 (begin.....(d
5540: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 50 72 ebug:print 2 "Pr
5550: 65 72 65 71 75 69 73 69 74 65 73 20 6d 65 74 2c erequisites met,
5560: 20 6c 61 75 6e 63 68 69 6e 67 20 22 20 74 65 73 launching " tes
5570: 74 6e 61 6d 65 29 0a 09 09 09 09 28 28 63 61 64 tname).....((cad
5580: 72 20 74 65 73 74 64 61 74 29 29 0a 09 09 09 09 r testdat)).....
5590: 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 (hash-table-dele
55a0: 74 65 21 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 te! *waiting-que
55b0: 75 65 2a 20 74 65 73 74 6e 61 6d 65 29 29 29 0a ue* testname))).
55c0: 09 09 09 20 20 28 69 66 20 28 6e 6f 74 20 64 62 ... (if (not db
55d0: 29 0a 09 09 09 20 20 20 20 20 20 28 73 71 6c 69 ).... (sqli
55e0: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 6c 64 te3:finalize! ld
55f0: 62 29 29 29 29 29 0a 09 09 20 20 77 61 69 74 69 b)))))... waiti
5600: 6e 67 2d 74 65 73 74 2d 6e 61 6d 65 73 29 0a 09 ng-test-names)..
5610: 3b 3b 20 28 73 6c 65 65 70 20 31 30 29 20 3b 3b ;; (sleep 10) ;;
5620: 20 6e 6f 20 70 6f 69 6e 74 20 69 6e 20 72 75 73 no point in rus
5630: 68 69 6e 67 20 74 68 69 6e 67 73 20 61 74 20 74 hing things at t
5640: 68 69 73 20 73 74 61 67 65 3f 0a 09 28 6c 6f 6f his stage?..(loo
5650: 70 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 p (hash-table-ke
5660: 79 73 20 2a 77 61 69 74 69 6e 67 2d 71 75 65 75 ys *waiting-queu
5670: 65 2a 29 29 29 29 29 29 29 0a 0a 28 64 65 66 69 e*)))))))..(defi
5680: 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e ne (get-dir-up-n
5690: 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a dir . params) .
56a0: 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 (let ((dparts
56b0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 (string-split d
56c0: 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 ir "/"))..(count
56d0: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 (if (null? pa
56e0: 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 rams) 1 (car par
56f0: 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e ams)))). (con
5700: 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e c "/" (string-in
5710: 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 tersperse ..
5720: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 (take dparts
5730: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
5740: 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 s) count))..
5750: 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 "/")))).;; Re
5760: 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 move runs.;; fie
5770: 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 lds are passing
5780: 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 in through .(def
5790: 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 ine (runs:remove
57a0: 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 -runs db runname
57b0: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 patt testpatt it
57c0: 65 6d 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 empatt). (let*
57d0: 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 ((keys (d
57e0: 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b-get-keys db)).
57f0: 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 28 . (rundat (
5800: 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 runs:get-runs-by
5810: 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 -patt db keys ru
5820: 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 nnamepatt)).. (h
5830: 65 61 64 65 72 20 20 20 20 20 20 28 76 65 63 74 eader (vect
5840: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 or-ref rundat 0)
5850: 29 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 ).. (runs
5860: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e (vector-ref run
5870: 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 64 65 dat 1))). (de
5880: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 bug:print 1 "Hea
5890: 64 65 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 der: " header).
58a0: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 (for-each.
58b0: 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a (lambda (run).
58c0: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 (let ((ru
58d0: 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 nkey (string-int
58e0: 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c ersperse (map (l
58f0: 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 ambda (k).......
5900: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
5910: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
5920: 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b er (vector-ref k
5930: 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 0))) keys) "/")
5940: 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e )).. (let* ((run
5950: 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 -id (db:get-valu
5960: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
5970: 68 65 61 64 65 72 20 22 69 64 22 29 20 29 0a 09 header "id") )..
5980: 09 28 74 65 73 74 73 20 20 28 64 62 2d 67 65 74 .(tests (db-get
5990: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 -tests-for-run d
59a0: 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d b (db:get-value-
59b0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
59c0: 61 64 65 72 20 22 69 64 22 29 20 74 65 73 74 70 ader "id") testp
59d0: 61 74 74 20 69 74 65 6d 70 61 74 74 29 29 0a 09 att itempatt))..
59e0: 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f .(lasttpath "/do
59f0: 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 es/not/exist/I/h
5a00: 6f 70 65 22 29 29 0a 09 20 20 20 28 69 66 20 28 ope")).. (if (
5a10: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 not (null? tests
5a20: 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 )).. (begi
5a30: 6e 0a 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e n... (debug:prin
5a40: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 t 1 "Removing te
5a50: 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 sts for run: " r
5a60: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 unkey " " (db:ge
5a70: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
5a80: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 r run header "ru
5a90: 6e 6e 61 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 nname"))... (for
5aa0: 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 -each... (lambd
5ab0: 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 a (test)... (
5ac0: 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 let* ((item-path
5ad0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
5ae0: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 em-path test))..
5af0: 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 .. (test-name
5b00: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
5b10: 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 tname test))....
5b20: 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 (run-dir (d
5b30: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 b:test-get-rundi
5b40: 72 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 r test)))...
5b50: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
5b60: 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 " " (db:test-g
5b70: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
5b80: 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 ) " id: " (db:te
5b90: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 st-get-id test)
5ba0: 22 20 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 " " item-path)..
5bb0: 09 20 20 20 20 20 20 28 64 62 3a 64 65 6c 65 74 . (db:delet
5bc0: 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 e-test-records d
5bd0: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 b (db:test-get-i
5be0: 64 20 74 65 73 74 29 29 0a 09 09 20 20 20 20 20 d test))...
5bf0: 20 28 69 66 20 28 3e 20 28 73 74 72 69 6e 67 2d (if (> (string-
5c00: 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 length run-dir)
5c10: 35 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 5) ;; bad heuris
5c20: 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 tic but should p
5c30: 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d revent /tmp /hom
5c40: 65 20 65 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 e etc..... (let
5c50: 20 28 28 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d ((fullpath run-
5c60: 64 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 dir)) ;; "/" (db
5c70: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
5c80: 61 74 68 20 74 65 73 74 29 29 29 29 0a 09 09 09 ath test))))....
5c90: 20 20 20 20 28 73 65 74 21 20 6c 61 73 74 74 70 (set! lasttp
5ca0: 61 74 68 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 ath fullpath)...
5cb0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
5cc0: 74 20 31 20 22 72 6d 20 2d 72 66 20 22 20 66 75 t 1 "rm -rf " fu
5cd0: 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 llpath).... (
5ce0: 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d system (conc "rm
5cf0: 20 2d 72 66 20 22 20 66 75 6c 6c 70 61 74 68 29 -rf " fullpath)
5d00: 29 0a 09 09 09 20 20 20 20 28 6c 65 74 2a 20 28 ).... (let* (
5d10: 28 64 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 (dirs-count (+ 1
5d20: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c (length keys)(l
5d30: 65 6e 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 ength (string-sp
5d40: 6c 69 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f lit item-path "/
5d50: 22 29 29 29 29 0a 09 09 09 09 20 20 20 28 64 69 "))))..... (di
5d60: 72 2d 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 r-to-rem (get-di
5d70: 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 r-up-n fullpath
5d80: 64 69 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 dirs-count))....
5d90: 09 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 . (remainingd
5da0: 28 73 74 72 69 6e 67 2d 73 75 62 73 74 69 74 75 (string-substitu
5db0: 74 65 20 28 72 65 67 65 78 70 20 28 63 6f 6e 63 te (regexp (conc
5dc0: 20 22 5e 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 "^" dir-to-rem
5dd0: 22 2f 22 29 29 20 22 22 20 66 75 6c 6c 70 61 74 "/")) "" fullpat
5de0: 68 29 29 0a 09 09 09 09 20 20 20 28 63 6d 64 20 h))..... (cmd
5df0: 28 63 6f 6e 63 20 22 63 64 20 22 20 64 69 72 2d (conc "cd " dir-
5e00: 74 6f 2d 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 to-rem "; rmdir
5e10: 2d 70 20 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 -p " remainingd
5e20: 29 29 29 0a 09 09 09 20 20 20 20 20 20 28 69 66 ))).... (if
5e30: 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 (file-exists? f
5e40: 75 6c 6c 70 61 74 68 29 0a 09 09 09 09 20 20 28 ullpath)..... (
5e50: 62 65 67 69 6e 0a 09 09 09 09 20 20 20 20 28 64 begin..... (d
5e60: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 ebug:print 1 cmd
5e70: 29 0a 09 09 09 09 20 20 20 20 28 73 79 73 74 65 )..... (syste
5e80: 6d 20 63 6d 64 29 29 29 0a 09 09 09 20 20 20 20 m cmd)))....
5e90: 20 20 29 29 0a 09 09 09 20 20 20 20 29 29 29 0a )).... ))).
5ea0: 09 09 20 20 20 20 74 65 73 74 73 29 29 29 0a 09 .. tests)))..
5eb0: 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 (let ((remtes
5ec0: 74 73 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 ts (db-get-tests
5ed0: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 3a -for-run db (db:
5ee0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
5ef0: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
5f00: 69 64 22 29 29 29 29 0a 09 20 20 20 20 20 28 69 id")))).. (i
5f10: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 f (null? remtest
5f20: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 s) ;; no more te
5f30: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 sts remaining...
5f40: 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 (let* ((dparts
5f50: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c (string-split l
5f60: 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 asttpath "/"))..
5f70: 09 09 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 ..(runpath (conc
5f80: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
5f90: 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 ersperse ......
5fa0: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 (take dparts
5fb0: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
5fc0: 73 29 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 s) 1))......
5fd0: 22 2f 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 "/"))))... (de
5fe0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d bug:print 1 "Rem
5ff0: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e oving run: " run
6000: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d key " " (db:get-
6010: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
6020: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e run header "runn
6030: 61 6d 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a ame"))... (db:
6040: 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 delete-run db ru
6050: 6e 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 n-id)... ;; ne
6060: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 ed to figure out
6070: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 the path to the
6080: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d run dir and rem
6090: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a ove it if empty.
60a0: 09 09 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 .. ;; (if (
60b0: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e null? (glob (con
60c0: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 c runpath "/*"))
60d0: 29 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 )... ;;
60e0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 (begin... ;;
60f0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
6100: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 "Removing run d
6110: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 ir " runpath)...
6120: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 ;; . (system
6130: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 (conc "rmdir -p
6140: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 " runpath))))...
6150: 20 20 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 )))).. )).
6160: 20 20 72 75 6e 73 29 29 29 0a runs))).