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: 28 75 73 65 20 73 71 6c 69 74 65 33 20 73 72 66 (use sqlite3 srf
0190: 69 2d 31 20 70 6f 73 69 78 20 72 65 67 65 78 20 i-1 posix regex
01a0: 72 65 67 65 78 2d 63 61 73 65 20 73 72 66 69 2d regex-case srfi-
01b0: 36 39 20 64 6f 74 2d 6c 6f 63 6b 69 6e 67 29 0a 69 dot-locking).
01c0: 28 69 6d 70 6f 72 74 20 28 70 72 65 66 69 78 20 (import (prefix
01d0: 73 71 6c 69 74 65 33 20 73 71 6c 69 74 65 33 3a sqlite3 sqlite3:
01e0: 29 29 0a 0a 28 64 65 63 6c 61 72 65 20 28 75 6e ))..(declare (un
01f0: 69 74 20 72 75 6e 73 29 29 0a 28 64 65 63 6c 61 it runs)).(decla
0200: 72 65 20 28 75 73 65 73 20 64 62 29 29 0a 28 64 re (uses db)).(d
0210: 65 63 6c 61 72 65 20 28 75 73 65 73 20 63 6f 6d eclare (uses com
0220: 6d 6f 6e 29 29 0a 28 64 65 63 6c 61 72 65 20 28 mon)).(declare (
0230: 75 73 65 73 20 69 74 65 6d 73 29 29 0a 28 64 65 uses items)).(de
0240: 63 6c 61 72 65 20 28 75 73 65 73 20 72 75 6e 63 clare (uses runc
0250: 6f 6e 66 69 67 29 29 0a 28 64 65 63 6c 61 72 65 onfig)).(declare
0260: 20 28 75 73 65 73 20 74 65 73 74 73 29 29 0a 0a (uses tests))..
0270: 28 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e (include "common
0280: 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 _records.scm").(
0290: 69 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 include "key_rec
02a0: 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c ords.scm").(incl
02b0: 75 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e ude "db_records.
02c0: 73 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 scm").(include "
02d0: 72 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 run_records.scm"
02e0: 29 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 ).(include "test
02f0: 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a _records.scm")..
0300: 3b 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 ;; runs:get-runs
0310: 2d 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 -by-patt.;; get
0320: 72 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 runs by list of
0330: 63 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 criteria.;; regi
0340: 73 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 ster a test run
0350: 77 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b with the db.;;.;
0360: 3b 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 ; Use: (db-get-v
0370: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 alue-by-header (
0380: 64 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 db:get-header ru
0390: 6e 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f ninfo)(db:get-ro
03a0: 77 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 w runinfo)).;;
03b0: 74 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 to extract info
03c0: 66 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 from the structu
03d0: 72 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 re returned.;;.(
03e0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 define (runs:get
03f0: 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 -runs-by-patt db
0400: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 keys runnamepat
0410: 74 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 t . params) ;; t
0420: 65 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 est-name). (let
0430: 2a 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b * ((keyvallst (k
0440: 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 eys->vallist key
0450: 73 29 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 s)).. (tmp
0460: 28 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 (runs:get-std-ru
0470: 6e 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 n-fields keys '(
0480: 22 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 "id" "runname" "
0490: 73 74 61 74 65 22 20 22 73 74 61 74 75 73 22 20 state" "status"
04a0: 22 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 "owner" "event_t
04b0: 69 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 ime"))).. (keyst
04c0: 72 20 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 r (car tmp))..
04d0: 20 28 68 65 61 64 65 72 20 20 20 28 63 61 64 72 (header (cadr
04e0: 20 74 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 tmp)).. (res
04f0: 20 20 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 '()).. (key-pa
0500: 74 74 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 tt "")). (for
0510: 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b -each (lambda (k
0520: 65 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 eyval)...(let* (
0530: 28 6b 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d (key (vector-
0540: 72 65 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 ref keyval 0))..
0550: 09 20 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 . (fulkey
0560: 28 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a (conc ":" key)).
0570: 09 09 20 20 20 20 20 20 20 28 70 61 74 74 20 20 .. (patt
0580: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 (args:get-arg f
0590: 75 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 ulkey)))... (if
05a0: 20 70 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 patt... (s
05b0: 65 74 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f et! key-patt (co
05c0: 6e 63 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e nc key-patt " AN
05d0: 44 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 D " key " like '
05e0: 22 20 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 " patt "'"))...
05f0: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 (begin....(
0600: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
0610: 52 52 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 RROR: searching
0620: 66 6f 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f for runs with no
0630: 20 70 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 pattern set for
0640: 20 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 " fulkey)....(e
0650: 78 69 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 xit 6)))))..
0660: 20 20 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c keys). (sql
0670: 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f ite3:for-each-ro
0680: 77 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 w . (lambda
0690: 28 61 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 (a . r). (
06a0: 73 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 set! res (cons (
06b0: 6c 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f list->vector (co
06c0: 6e 73 20 61 20 72 29 29 20 72 65 73 29 29 29 0a ns a r)) res))).
06d0: 20 20 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 db . (c
06e0: 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 onc "SELECT " ke
06f0: 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 ystr " FROM runs
0700: 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c WHERE runname l
0710: 69 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 ike ? " key-patt
0720: 20 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 ";"). runna
0730: 6d 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 mepatt). (vec
0740: 74 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29 tor header res))
0750: 29 0a 0a 3b 3b 20 3b 3b 20 54 4f 44 4f 3a 20 43 )..;; ;; TODO: C
0760: 6f 6e 76 65 72 67 65 20 74 68 69 73 20 77 69 74 onverge this wit
0770: 68 20 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e h db:get-test-in
0780: 66 6f 0a 3b 3b 20 28 64 65 66 69 6e 65 20 28 72 fo.;; (define (r
0790: 75 6e 73 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 uns:get-test-inf
07a0: 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 o db run-id test
07b0: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
07c0: 0a 3b 3b 20 20 20 28 6c 65 74 20 28 28 72 65 73 .;; (let ((res
07d0: 20 23 66 29 29 20 3b 3b 20 28 76 65 63 74 6f 72 #f)) ;; (vector
07e0: 20 23 66 20 23 66 20 23 66 20 23 66 20 23 66 20 #f #f #f #f #f
07f0: 23 66 29 29 29 0a 3b 3b 20 20 20 20 20 28 73 71 #f))).;; (sq
0800: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
0810: 6f 77 20 0a 3b 3b 20 20 20 20 20 20 28 6c 61 6d ow .;; (lam
0820: 62 64 61 20 28 69 64 20 72 75 6e 2d 69 64 20 74 bda (id run-id t
0830: 65 73 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 est-name state s
0840: 74 61 74 75 73 29 0a 3b 3b 20 20 20 20 20 20 20 tatus).;;
0850: 20 28 73 65 74 21 20 72 65 73 20 28 76 65 63 74 (set! res (vect
0860: 6f 72 20 69 64 20 72 75 6e 2d 69 64 20 74 65 73 or id run-id tes
0870: 74 2d 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 t-name state sta
0880: 74 75 73 20 69 74 65 6d 2d 70 61 74 68 29 29 29 tus item-path)))
0890: 0a 3b 3b 20 20 20 20 20 20 64 62 20 22 53 45 4c .;; db "SEL
08a0: 45 43 54 20 69 64 2c 72 75 6e 5f 69 64 2c 74 65 ECT id,run_id,te
08b0: 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 stname,state,sta
08c0: 74 75 73 20 46 52 4f 4d 20 74 65 73 74 73 20 57 tus FROM tests W
08d0: 48 45 52 45 20 72 75 6e 5f 69 64 3d 3f 20 41 4e HERE run_id=? AN
08e0: 44 20 74 65 73 74 6e 61 6d 65 3d 3f 20 41 4e 44 D testname=? AND
08f0: 20 69 74 65 6d 5f 70 61 74 68 3d 3f 3b 22 0a 3b item_path=?;".;
0900: 3b 20 20 20 20 20 20 72 75 6e 2d 69 64 20 74 65 ; run-id te
0910: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
0920: 68 29 0a 3b 3b 20 20 20 20 20 72 65 73 29 29 0a h).;; res)).
0930: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 74 .(define (runs:t
0940: 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61 74 est-get-full-pat
0950: 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 2a 20 h test). (let*
0960: 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 3a 74 ((testname (db:t
0970: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
0980: 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 74 65 test)).. (ite
0990: 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 mpath (db:test-g
09a0: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
09b0: 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 74 t))). (conc t
09c0: 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 71 75 estname (if (equ
09d0: 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29 al? itempath "")
09e0: 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 69 74 "" (conc "(" it
09f0: 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 29 0a empath ")"))))).
0a00: 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 6d ..(define (set-m
0a10: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
0a20: 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 6c db run-id). (l
0a30: 65 74 20 28 28 6b 65 79 73 20 28 64 62 2d 67 65 et ((keys (db-ge
0a40: 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 20 20 t-keys db))).
0a50: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 (for-each (lamb
0a60: 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71 6c 69 da (key)...(sqli
0a70: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
0a80: 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76 61 6c ... (lambda (val
0a90: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 )... (debug:pr
0aa0: 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 int 2 "setenv "
0ab0: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 (key:get-fieldna
0ac0: 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61 6c 29 me key) " " val)
0ad0: 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20 28 6b ... (setenv (k
0ae0: 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 ey:get-fieldname
0af0: 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 20 64 key) val))... d
0b00: 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 45 4c b ... (conc "SEL
0b10: 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 ECT " (key:get-f
0b20: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 ieldname key) "
0b30: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 FROM runs WHERE
0b40: 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e 2d 69 id=?;")... run-i
0b50: 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79 73 29 d)).. keys)
0b60: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65 . ;; Lets use
0b70: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f this as an oppo
0b80: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d rtunity to put M
0b90: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65 T_RUNNAME in the
0ba0: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 environment.
0bb0: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 (sqlite3:for-ea
0bc0: 63 68 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d ch-row. (lam
0bd0: 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20 bda (runname).
0be0: 20 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 (setenv "MT
0bf0: 5f 52 55 4e 4e 41 4d 45 22 20 72 75 6e 6e 61 6d _RUNNAME" runnam
0c00: 65 29 29 0a 20 20 20 20 20 64 62 0a 20 20 20 20 e)). db.
0c10: 20 22 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 "SELECT runname
0c20: 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 FROM runs WHERE
0c30: 20 69 64 3d 3f 3b 22 0a 20 20 20 20 20 72 75 6e id=?;". run
0c40: 2d 69 64 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 -id). ))..(de
0c50: 66 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 fine (set-item-e
0c60: 6e 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 nv-vars itemdat)
0c70: 0a 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 . (for-each (la
0c80: 6d 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 mbda (item)..
0c90: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
0ca0: 32 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 2 "setenv " (car
0cb0: 20 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 item) " " (cadr
0cc0: 20 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 item)).. (
0cd0: 73 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d setenv (car item
0ce0: 29 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a ) (cadr item))).
0cf0: 09 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a . itemdat))..
0d00: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 (define (runs:ca
0d10: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
0d20: 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 db test-record)
0d30: 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f 6e 66 . (let* ((tconf
0d40: 69 67 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ig
0d50: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
0d60: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 eue-get-testconf
0d70: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 ig test-record))
0d80: 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 20 20 .. (jobgroup
0d90: 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e (con
0da0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 fig-lookup tconf
0db0: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 ig "requirements
0dc0: 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 0a 09 " "jobgroup"))..
0dd0: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 (num-running
0de0: 20 20 20 20 20 20 20 20 20 20 28 64 62 3a 67 65 (db:ge
0df0: 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 t-count-tests-ru
0e00: 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 6e 75 nning db)).. (nu
0e10: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 m-running-in-job
0e20: 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d 63 6f group (db:get-co
0e30: 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e unt-tests-runnin
0e40: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 64 62 g-in-jobgroup db
0e50: 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 28 6d jobgroup)).. (m
0e60: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0e70: 62 73 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c bs (config-l
0e80: 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 ookup *configdat
0e90: 2a 20 22 73 65 74 75 70 22 20 20 20 20 20 22 6d * "setup" "m
0ea0: 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f ax_concurrent_jo
0eb0: 62 73 22 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f bs")).. (job-gro
0ec0: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 up-limit
0ed0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
0ee0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 *configdat* "job
0ef0: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 groups" jobgroup
0f00: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ))). (debug:p
0f10: 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 rint 2 "max-conc
0f20: 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d urrent-jobs: " m
0f30: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0f40: 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e bs ", num-runnin
0f50: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 g: " num-running
0f60: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ). (if (not (
0f70: 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 eq? 0 *globalexi
0f80: 74 73 74 61 74 75 73 2a 29 29 0a 09 23 66 0a 09 tstatus*))..#f..
0f90: 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72 (let ((can-not-r
0fa0: 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09 un-more (cond...
0fb0: 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e .. ;; if max-con
0fc0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20 current-jobs is
0fd0: 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 set and the numb
0fe0: 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72 er running is gr
0ff0: 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74 eater ..... ;; t
1000: 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e han it than cann
1010: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 ot run more jobs
1020: 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d ..... ((and max-
1030: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a concurrent-jobs.
1040: 09 09 09 09 20 20 20 20 20 20 20 28 73 74 72 69 .... (stri
1050: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 ng->number max-c
1060: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a oncurrent-jobs).
1070: 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e .... (>= n
1080: 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 74 72 69 um-running (stri
1090: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 ng->number max-c
10a0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29 oncurrent-jobs))
10b0: 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 )..... (debug:p
10c0: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
10d0: 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 Max running job
10e0: 73 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72 s exceeded, curr
10f0: 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 ent number runni
1100: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e ng: " num-runnin
1110: 67 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 g ...... "
1120: 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 , max_concurrent
1130: 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e _jobs: " max-con
1140: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 current-jobs)...
1150: 09 09 20 20 23 74 29 0a 09 09 09 09 20 3b 3b 20 .. #t)..... ;;
1160: 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d if job-group-lim
1170: 69 74 20 69 73 20 73 65 74 20 61 6e 64 20 6e 75 it is set and nu
1180: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 69 6e 20 mber of jobs in
1190: 74 68 65 20 67 72 6f 75 70 20 69 73 20 67 72 65 the group is gre
11a0: 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 74 68 61 ater..... ;; tha
11b0: 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 68 65 6e n the limit then
11c0: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 cannot run more
11d0: 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 20 6b 69 jobs of this ki
11e0: 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 20 6a 6f nd..... ((and jo
11f0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a 09 09 b-group-limit...
1200: 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e 75 6d .. (>= num
1210: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 -running-in-jobg
1220: 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c roup job-group-l
1230: 69 6d 69 74 29 29 0a 09 09 09 09 20 20 28 64 65 imit))..... (de
1240: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 bug:print 1 "WAR
1250: 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f 66 20 NING: number of
1260: 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 jobs " num-runni
1270: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 0a ng-in-jobgroup .
1280: 09 09 09 09 09 20 20 20 20 20 20 20 22 20 69 6e ..... " in
1290: 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 20 65 78 " jobgroup " ex
12a0: 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e 6f 74 ceeded, will not
12b0: 20 72 75 6e 20 22 20 28 74 65 73 74 73 3a 74 65 run " (tests:te
12c0: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 stqueue-get-test
12d0: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
12e0: 29 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 ))..... #t)....
12f0: 09 20 28 65 6c 73 65 20 23 66 29 29 29 29 0a 09 . (else #f))))..
1300: 20 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 (not can-not-r
1310: 75 6e 2d 6d 6f 72 65 29 29 29 29 29 0a 0a 3b 3b un-more)))))..;;
1320: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1330: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1360: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d 65 ======.;; New me
1370: 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65 thodology. These
1380: 20 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 72 routines will r
1390: 65 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 65 eplace the above
13a0: 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b in time. For.;;
13b0: 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 73 now the code is
13c0: 20 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 69 duplicated. Thi
13d0: 73 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 69 s stuff is initi
13e0: 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 65 ally used in the
13f0: 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65 monitor.;; base
1400: 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d d code..;;======
1410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1420: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1430: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1440: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1450: 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 ..;; register a
1460: 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 test run with th
1470: 65 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 75 e db.(define (ru
1480: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 ns:register-run
1490: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 db keys keyvalls
14a0: 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 t runname state
14b0: 73 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 28 status user). (
14c0: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 72 debug:print 3 "r
14d0: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e uns:register-run
14e0: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 , keys: " keys "
14f0: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 keyvallst: " ke
1500: 79 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d yvallst " runnam
1510: 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 73 e: " runname " s
1520: 74 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 20 tate: " state "
1530: 73 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 73 status: " status
1540: 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 " user: " user)
1550: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 . (let* ((keyst
1560: 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 r (keys->keys
1570: 74 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d tr keys)).. (com
1580: 6d 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c ma (if (> (l
1590: 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 ength keys) 0) "
15a0: 2c 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 ," "")).. (andst
15b0: 72 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e r (if (> (len
15c0: 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 gth keys) 0) " A
15d0: 4e 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c ND " "")).. (val
15e0: 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 slots (keys->va
15f0: 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b lslots keys)) ;;
1600: 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 ?,?,? ..... (ke
1610: 79 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 64 yvals (map cad
1620: 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 r keyvallst))..
1630: 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 (allvals (appe
1640: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
1650: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73 state status us
1660: 65 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 er) keyvals))..
1670: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 (qryvals (appe
1680: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
1690: 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 6b ) keyvals)).. (k
16a0: 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67 ey=?str (string
16b0: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 -intersperse (ma
16c0: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f p (lambda (k)(co
16d0: 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c nc (key:get-fiel
16e0: 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20 dname k) "=?"))
16f0: 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 29 keys) " AND ")))
1700: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
1710: 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79 t 3 "keys: " key
1720: 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61 s " allvals: " a
1730: 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 73 llvals " keyvals
1740: 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 20 : " keyvals).
1750: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
1760: 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 72 "NOTE: using tar
1770: 67 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 6e get " (string-in
1780: 74 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c tersperse keyval
1790: 73 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 69 s "/") " for thi
17a0: 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 20 s run"). (if
17b0: 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75 (and runname (nu
17c0: 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 6d ll? (filter (lam
17d0: 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 20 bda (x)(not x))
17e0: 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 68 keyvals))) ;; th
17f0: 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 65 ere must be a be
1800: 74 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 70 tter way to "app
1810: 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 28 ly and"..(let ((
1820: 72 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 70 res #f)).. (app
1830: 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 ly sqlite3:execu
1840: 74 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e 53 te db (conc "INS
1850: 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e ERT OR IGNORE IN
1860: 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65 TO runs (runname
1870: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f 77 ,state,status,ow
1880: 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20 ner,event_time"
1890: 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 20 comma keystr ")
18a0: 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c VALUES (?,?,?,?,
18b0: 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e strftime('%s','n
18c0: 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73 ow')" comma vals
18d0: 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 6c lots ");")... al
18e0: 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c 79 lvals).. (apply
18f0: 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 sqlite3:for-eac
1900: 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62 h-row .. (lamb
1910: 64 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 73 da (id).. (s
1920: 65 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 20 et! res id))..
1930: 20 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 71 db.. (let ((q
1940: 72 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 ry (conc "SELECT
1950: 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 id FROM runs WH
1960: 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22 ERE (runname=? "
1970: 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 72 andstr key=?str
1980: 20 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 3b ");"))).. ;
1990: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
19a0: 71 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 20 qry: " qry) ..
19b0: 20 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 76 qry).. qryv
19c0: 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 33 als).. (sqlite3
19d0: 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 :execute db "UPD
19e0: 41 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 61 ATE runs SET sta
19f0: 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48 te=?,status=? WH
1a00: 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 65 ERE id=?;" state
1a10: 20 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 20 status res)..
1a20: 72 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 20 res) ..(begin..
1a30: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
1a40: 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77 "ERROR: Called w
1a50: 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73 ithout all neces
1a60: 73 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 23 sary keys").. #
1a70: 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69 f))))..;; This i
1a80: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66 s a duplicate of
1a90: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63 run-tests (whic
1aa0: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65 h has been depre
1ab0: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73 cated). Use this
1ac0: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20 one instead of
1ad0: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65 run tests..;; ke
1ae0: 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 72 yvals.(define (r
1af0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 64 62 uns:run-tests db
1b00: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 target runname
1b10: 74 65 73 74 2d 70 61 74 74 73 20 69 74 65 6d 2d test-patts item-
1b20: 70 61 74 74 73 20 75 73 65 72 20 66 6c 61 67 73 patts user flags
1b30: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 ). (let* ((keys
1b40: 20 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d (db-get-
1b50: 6b 65 79 73 20 64 62 29 29 0a 09 20 28 6b 65 79 keys db)).. (key
1b60: 76 61 6c 6c 73 74 20 20 20 28 6b 65 79 73 3a 74 vallst (keys:t
1b70: 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 arget->keyval ke
1b80: 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 28 72 ys target)).. (r
1b90: 75 6e 2d 69 64 20 20 20 20 20 20 28 72 75 6e 73 un-id (runs
1ba0: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 :register-run db
1bb0: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 keys keyvallst
1bc0: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e runname "new" "n
1bd0: 2f 61 22 20 75 73 65 72 29 29 20 20 3b 3b 20 20 /a" user)) ;;
1be0: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 09 20 28 test-name))).. (
1bf0: 64 65 66 65 72 72 65 64 20 20 20 20 27 28 29 29 deferred '())
1c00: 20 3b 3b 20 64 65 6c 61 79 20 72 75 6e 6e 69 6e ;; delay runnin
1c10: 67 20 74 68 65 73 65 20 73 69 6e 63 65 20 74 68 g these since th
1c20: 65 79 20 68 61 76 65 20 61 20 77 61 69 74 6f 6e ey have a waiton
1c30: 20 63 6c 61 75 73 65 0a 09 20 3b 3b 20 6b 65 65 clause.. ;; kee
1c40: 70 67 6f 69 6e 67 20 69 73 20 74 68 65 20 64 65 pgoing is the de
1c50: 66 61 63 74 6f 20 6d 6f 64 61 6c 69 74 79 20 6e facto modality n
1c60: 6f 77 2c 20 77 69 6c 6c 20 61 64 64 20 68 69 74 ow, will add hit
1c70: 2d 6e 2d 72 75 6e 20 61 20 62 69 74 20 6c 61 74 -n-run a bit lat
1c80: 65 72 0a 09 20 3b 3b 20 28 6b 65 65 70 67 6f 69 er.. ;; (keepgoi
1c90: 6e 67 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 ng (hash-table
1ca0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 -ref/default fla
1cb0: 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 gs "-keepgoing"
1cc0: 23 66 29 29 0a 09 20 28 74 65 73 74 2d 6e 61 6d #f)).. (test-nam
1cd0: 65 73 20 20 27 28 29 29 0a 09 20 28 72 75 6e 63 es '()).. (runc
1ce0: 6f 6e 66 69 67 66 20 20 20 28 63 6f 6e 63 20 20 onfigf (conc
1cf0: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 *toppath* "/runc
1d00: 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 onfigs.config"))
1d10: 0a 09 20 28 72 65 71 75 69 72 65 64 2d 74 65 73 .. (required-tes
1d20: 74 73 20 27 28 29 29 0a 09 20 28 74 65 73 74 2d ts '()).. (test-
1d30: 72 65 63 6f 72 64 73 20 28 6d 61 6b 65 2d 68 61 records (make-ha
1d40: 73 68 2d 74 61 62 6c 65 29 29 29 0a 0a 20 20 20 sh-table)))..
1d50: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 (set-megatest-e
1d60: 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 nv-vars db run-i
1d70: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 d) ;; these may
1d80: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 be needed by the
1d90: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 launching proce
1da0: 73 73 0a 0a 20 20 20 20 28 69 66 20 28 66 69 6c ss.. (if (fil
1db0: 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 63 6f 6e e-exists? runcon
1dc0: 66 69 67 66 29 0a 09 28 73 65 74 75 70 2d 65 6e figf)..(setup-en
1dd0: 76 2d 64 65 66 61 75 6c 74 73 20 64 62 20 72 75 v-defaults db ru
1de0: 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d 69 64 20 nconfigf run-id
1df0: 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e 2d 72 75 *already-seen-ru
1e00: 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a 20 22 70 nconfig-info* "p
1e10: 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d 76 61 re-launch-env-va
1e20: 72 73 22 29 0a 09 28 64 65 62 75 67 3a 70 72 69 rs")..(debug:pri
1e30: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 59 nt 0 "WARNING: Y
1e40: 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 61 ou do not have a
1e50: 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 6c 65 run config file
1e60: 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 29 : " runconfigf))
1e70: 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 6c 6f 6f . . ;; loo
1e80: 6b 20 75 70 20 61 6c 6c 20 74 65 73 74 73 20 6d k up all tests m
1e90: 61 74 63 68 69 6e 67 20 74 68 65 20 63 6f 6d 6d atching the comm
1ea0: 61 20 73 65 70 61 72 61 74 65 64 20 6c 69 73 74 a separated list
1eb0: 20 6f 66 20 67 6c 6f 62 73 20 69 6e 0a 20 20 20 of globs in.
1ec0: 20 3b 3b 20 74 65 73 74 2d 70 61 74 74 73 20 28 ;; test-patts (
1ed0: 75 73 69 6e 67 20 25 20 61 73 20 77 69 6c 64 63 using % as wildc
1ee0: 61 72 64 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 ard). (for-ea
1ef0: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
1f00: 20 28 70 61 74 74 29 0a 20 20 20 20 20 20 20 28 (patt). (
1f10: 6c 65 74 20 28 28 74 65 73 74 73 20 28 67 6c 6f let ((tests (glo
1f20: 62 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 b (conc *toppath
1f30: 2a 20 22 2f 74 65 73 74 73 2f 22 20 28 73 74 72 * "/tests/" (str
1f40: 69 6e 67 2d 74 72 61 6e 73 6c 61 74 65 20 70 61 ing-translate pa
1f50: 74 74 20 22 25 22 20 22 2a 22 29 29 29 29 29 0a tt "%" "*"))))).
1f60: 09 20 28 73 65 74 21 20 74 65 73 74 73 20 28 66 . (set! tests (f
1f70: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74 ilter (lambda (t
1f80: 65 73 74 29 28 66 69 6c 65 2d 65 78 69 73 74 73 est)(file-exists
1f90: 3f 20 28 63 6f 6e 63 20 74 65 73 74 20 22 2f 74 ? (conc test "/t
1fa0: 65 73 74 63 6f 6e 66 69 67 22 29 29 29 20 74 65 estconfig"))) te
1fb0: 73 74 73 29 29 0a 09 20 28 73 65 74 21 20 74 65 sts)).. (set! te
1fc0: 73 74 2d 6e 61 6d 65 73 20 28 61 70 70 65 6e 64 st-names (append
1fd0: 20 74 65 73 74 2d 6e 61 6d 65 73 20 0a 09 09 09 test-names ....
1fe0: 09 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 . (map (lambda
1ff0: 28 74 65 73 74 70 29 0a 09 09 09 09 09 20 28 6c (testp)...... (l
2000: 61 73 74 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ast (string-spli
2010: 74 20 74 65 73 74 70 20 22 2f 22 29 29 29 0a 09 t testp "/")))..
2020: 09 09 09 20 20 20 20 20 20 20 74 65 73 74 73 29 ... tests)
2030: 29 29 29 29 0a 20 20 20 20 20 28 69 66 20 74 65 )))). (if te
2040: 73 74 2d 70 61 74 74 73 20 28 73 74 72 69 6e 67 st-patts (string
2050: 2d 73 70 6c 69 74 20 74 65 73 74 2d 70 61 74 74 -split test-patt
2060: 73 20 22 2c 22 29 28 6c 69 73 74 20 22 25 22 29 s ",")(list "%")
2070: 29 29 0a 0a 20 20 20 20 20 3b 3b 20 6e 6f 77 20 )).. ;; now
2080: 72 65 6d 6f 76 65 20 64 75 70 6c 69 63 61 74 65 remove duplicate
2090: 73 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 s. (set! test
20a0: 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64 -names (delete-d
20b0: 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e uplicates test-n
20c0: 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62 ames)).. (deb
20d0: 75 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f ug:print 0 "INFO
20e0: 3a 20 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74 : test names " t
20f0: 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20 est-names)..
2100: 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 ;; on the first
2110: 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 pass or call to
2120: 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 run-tests set FA
2130: 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 ILS to NOT_START
2140: 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 ED if. ;; -ke
2150: 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 epgoing is speci
2160: 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71 fied. (if (eq
2170: 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 ? *passnum* 0)..
2180: 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 (begin.. ;; hav
2190: 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 e to delete test
21a0: 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e records where N
21b0: 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 OT_STARTED since
21c0: 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 they can cause
21d0: 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 -keepgoing to ..
21e0: 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 ;; get stuck d
21f0: 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 ue to becoming i
2200: 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d naccessible from
2210: 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 a failed test.
2220: 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 I.e. if test B d
2230: 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e epends .. ;; on
2240: 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74 test A but test
2250: 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70 B reached the p
2260: 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 oint on being re
2270: 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f gistered as NOT_
2280: 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 STARTED and test
2290: 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 .. ;; A failed
22a0: 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 for some reason
22b0: 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 then on re-run u
22c0: 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 sing -keepgoing
22d0: 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 the run can neve
22e0: 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 r complete... (
22f0: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d db:delete-tests-
2300: 69 6e 2d 73 74 61 74 65 20 64 62 20 72 75 6e 2d in-state db run-
2310: 69 64 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 id "NOT_STARTED"
2320: 29 0a 09 20 20 28 64 62 3a 73 65 74 2d 74 65 73 ).. (db:set-tes
2330: 74 73 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 ts-state-status
2340: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
2350: 61 6d 65 73 20 23 66 20 22 46 41 49 4c 22 20 22 ames #f "FAIL" "
2360: 4e 4f 54 5f 53 54 41 52 54 45 44 22 20 22 46 41 NOT_STARTED" "FA
2370: 49 4c 22 29 29 29 0a 0a 20 20 20 20 3b 3b 20 6e IL"))).. ;; n
2380: 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 63 ow add non-direc
2390: 74 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 64 tly referenced d
23a0: 65 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e 65 ependencies (i.e
23b0: 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 28 69 . waiton). (i
23c0: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 f (not (null? te
23d0: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 st-names))..(let
23e0: 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 72 loop ((hed (car
23f0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 test-names))...
2400: 20 20 20 28 74 61 6c 20 28 63 64 72 20 74 65 73 (tal (cdr tes
2410: 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20 20 t-names)))
2420: 20 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 72 ;; 'return-pr
2430: 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63 6f ocs tells the co
2440: 6e 66 69 67 20 72 65 61 64 65 72 20 74 6f 20 70 nfig reader to p
2450: 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 74 rep running syst
2460: 65 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61 20 em but return a
2470: 70 72 6f 63 0a 09 20 20 28 6c 65 74 2a 20 28 28 proc.. (let* ((
2480: 63 6f 6e 66 69 67 20 20 28 74 65 73 74 3a 67 65 config (test:ge
2490: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 64 t-testconfig hed
24a0: 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 29 29 'return-procs))
24b0: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 28 73 74 ... (waitons (st
24c0: 72 69 6e 67 2d 73 70 6c 69 74 20 28 6c 65 74 20 ring-split (let
24d0: 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b ((w (config-look
24e0: 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 up config "requi
24f0: 72 65 6d 65 6e 74 73 22 20 22 77 61 69 74 6f 6e rements" "waiton
2500: 22 29 29 29 0a 09 09 09 09 09 20 20 28 69 66 20 ")))...... (if
2510: 77 20 77 20 22 22 29 29 29 29 29 0a 09 20 20 20 w w "")))))..
2520: 20 3b 3b 20 28 69 74 65 6d 73 20 20 20 28 69 74 ;; (items (it
2530: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 ems:get-items-fr
2540: 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 om-config config
2550: 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f ))).. (if (no
2560: 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 t (hash-table-re
2570: 66 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 f/default test-r
2580: 65 63 6f 72 64 73 20 68 65 64 20 23 66 29 29 0a ecords hed #f)).
2590: 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 ..(hash-table-se
25a0: 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 0a t! test-records.
25b0: 09 09 09 09 20 68 65 64 20 28 76 65 63 74 6f 72 .... hed (vector
25c0: 20 68 65 64 20 20 20 20 20 3b 3b 20 30 0a 09 09 hed ;; 0...
25d0: 09 09 09 20 20 20 20 20 63 6f 6e 66 69 67 20 20 ... config
25e0: 3b 3b 20 31 0a 09 09 09 09 09 20 20 20 20 20 77 ;; 1...... w
25f0: 61 69 74 6f 6e 73 20 3b 3b 20 32 0a 09 09 09 09 aitons ;; 2.....
2600: 09 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f . (config-lo
2610: 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 71 okup config "req
2620: 75 69 72 65 6d 65 6e 74 73 22 20 22 70 72 69 6f uirements" "prio
2630: 72 69 74 79 22 29 20 20 20 20 20 3b 3b 20 70 72 rity") ;; pr
2640: 69 6f 72 69 74 79 20 33 0a 09 09 09 09 09 20 20 iority 3......
2650: 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 20 (let ((items
2660: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 (hash-table
2670: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e -ref/default con
2680: 66 69 67 20 22 69 74 65 6d 73 22 20 23 66 29 29 fig "items" #f))
2690: 20 3b 3b 20 69 74 65 6d 73 20 34 0a 09 09 09 09 ;; items 4.....
26a0: 09 09 20 20 20 28 69 74 65 6d 73 74 61 62 6c 65 .. (itemstable
26b0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
26c0: 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 /default config
26d0: 22 69 74 65 6d 73 74 61 62 6c 65 22 20 23 66 29 "itemstable" #f)
26e0: 29 29 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 )) ......
26f0: 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 74 65 ;; if either ite
2700: 6d 73 20 6f 72 20 69 74 65 6d 73 20 74 61 62 6c ms or items tabl
2710: 65 20 69 73 20 61 20 70 72 6f 63 20 72 65 74 75 e is a proc retu
2720: 72 6e 20 69 74 20 73 6f 20 74 65 73 74 20 72 75 rn it so test ru
2730: 6e 6e 69 6e 67 0a 09 09 09 09 09 20 20 20 20 20 nning......
2740: 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 63 61 6e ;; process can
2750: 20 6b 6e 6f 77 20 74 6f 20 63 61 6c 6c 20 69 74 know to call it
2760: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 ems:get-items-fr
2770: 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 09 09 09 20 om-config......
2780: 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 ;; if eith
2790: 65 72 20 69 73 20 61 20 6c 69 73 74 20 61 6e 64 er is a list and
27a0: 20 6e 6f 6e 65 20 69 73 20 61 20 70 72 6f 63 20 none is a proc
27b0: 67 6f 20 61 68 65 61 64 20 61 6e 64 20 63 61 6c go ahead and cal
27c0: 6c 20 67 65 74 2d 69 74 65 6d 73 0a 09 09 09 09 l get-items.....
27d0: 09 20 20 20 20 20 20 20 3b 3b 20 6f 74 68 65 72 . ;; other
27e0: 77 69 73 65 20 72 65 74 75 72 6e 20 23 66 20 2d wise return #f -
27f0: 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 6e 20 this is not an
2800: 69 74 65 72 61 74 65 64 20 74 65 73 74 0a 09 09 iterated test...
2810: 09 09 09 20 20 20 20 20 20 20 28 63 6f 6e 64 0a ... (cond.
2820: 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 ......((procedur
2830: 65 3f 20 69 74 65 6d 73 29 20 20 20 20 20 20 0a e? items) .
2840: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 ...... (debug:pr
2850: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 int 4 "INFO: ite
2860: 6d 73 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 ms is a procedur
2870: 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 e, will calc lat
2880: 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d er")....... item
2890: 73 29 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b s) ;;
28a0: 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 calc later.....
28b0: 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 ..((procedure? i
28c0: 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 temstable)......
28d0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
28e0: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 74 61 62 "INFO: itemstab
28f0: 6c 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 le is a procedur
2900: 65 2c 20 77 69 6c 6c 20 63 61 6c 63 20 6c 61 74 e, will calc lat
2910: 65 72 22 29 0a 09 09 09 09 09 09 20 69 74 65 6d er")....... item
2920: 73 74 61 62 6c 65 29 20 20 20 20 20 20 20 3b 3b stable) ;;
2930: 20 63 61 6c 63 20 6c 61 74 65 72 0a 09 09 09 09 calc later.....
2940: 09 09 28 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 ..((filter (lamb
2950: 64 61 20 28 78 29 0a 09 09 09 09 09 09 09 20 20 da (x)........
2960: 20 28 6c 65 74 20 28 28 76 61 6c 20 28 63 61 72 (let ((val (car
2970: 20 78 29 29 29 0a 09 09 09 09 09 09 09 20 20 20 x)))........
2980: 20 20 28 69 66 20 28 70 72 6f 63 65 64 75 72 65 (if (procedure
2990: 3f 20 76 61 6c 29 20 76 61 6c 20 23 66 29 29 29 ? val) val #f)))
29a0: 0a 09 09 09 09 09 09 09 20 28 61 70 70 65 6e 64 ........ (append
29b0: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d (if (list? item
29c0: 73 29 20 69 74 65 6d 73 20 27 28 29 29 0a 09 09 s) items '())...
29d0: 09 09 09 09 09 09 20 28 69 66 20 28 6c 69 73 74 ...... (if (list
29e0: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 20 69 74 ? itemstable) it
29f0: 65 6d 73 74 61 62 6c 65 20 27 28 29 29 29 29 0a emstable '()))).
2a00: 09 09 09 09 09 09 20 27 68 61 76 65 2d 70 72 6f ...... 'have-pro
2a10: 63 65 64 75 72 65 29 0a 09 09 09 09 09 09 28 28 cedure).......((
2a20: 6f 72 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 or (list? items)
2a30: 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c (list? itemstabl
2a40: 65 29 29 20 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a e)) ;; calc now.
2a50: 09 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 ...... (debug:pr
2a60: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 int 4 "INFO: ite
2a70: 6d 73 20 61 6e 64 20 69 74 65 6d 73 74 61 62 6c ms and itemstabl
2a80: 65 20 61 72 65 20 6c 69 73 74 73 2c 20 63 61 6c e are lists, cal
2a90: 63 20 6e 6f 77 5c 6e 22 0a 09 09 09 09 09 09 09 c now\n"........
2aa0: 20 20 20 20 20 20 22 20 20 20 20 69 74 65 6d 73 " items
2ab0: 3a 20 22 20 69 74 65 6d 73 20 22 20 69 74 65 6d : " items " item
2ac0: 73 74 61 62 6c 65 3a 20 22 20 69 74 65 6d 73 74 stable: " itemst
2ad0: 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 69 74 able)....... (it
2ae0: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 ems:get-items-fr
2af0: 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f 6e 66 69 67 om-config config
2b00: 29 29 0a 09 09 09 09 09 09 28 65 6c 73 65 20 23 )).......(else #
2b10: 66 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 f)))
2b20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b ;
2b30: 3b 20 6e 6f 74 20 69 74 65 72 61 74 65 64 0a 09 ; not iterated..
2b40: 09 09 09 09 20 20 20 20 20 23 66 20 20 20 20 20 .... #f
2b50: 20 3b 3b 20 69 74 65 6d 73 64 61 74 20 35 0a 09 ;; itemsdat 5..
2b60: 09 09 09 09 20 20 20 20 20 3b 3b 20 23 66 20 20 .... ;; #f
2b70: 20 20 20 20 3b 3b 20 73 70 61 72 65 0a 09 09 09 ;; spare....
2b80: 09 09 20 20 20 20 20 29 29 29 0a 09 20 20 20 20 .. )))..
2b90: 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 (for-each ..
2ba0: 20 28 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e (lambda (waiton
2bb0: 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 61 ).. (if (a
2bc0: 6e 64 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 nd waiton (not (
2bd0: 6d 65 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65 member waiton te
2be0: 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 st-names)))...
2bf0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 (begin... (
2c00: 73 65 74 21 20 72 65 71 75 69 72 65 64 2d 74 65 set! required-te
2c10: 73 74 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e sts (cons waiton
2c20: 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 required-tests)
2c30: 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 74 )... (set! t
2c40: 65 73 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 est-names (cons
2c50: 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 waiton test-name
2c60: 73 29 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e s))))) ;; was an
2c70: 20 61 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 append, now a c
2c80: 6f 6e 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e ons.. waiton
2c90: 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 s).. (let ((r
2ca0: 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d emtests (delete-
2cb0: 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 duplicates (appe
2cc0: 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 nd waitons tal))
2cd0: 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e )).. (if (n
2ce0: 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 ot (null? remtes
2cf0: 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 ts))... (loop (
2d00: 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 car remtests)(cd
2d10: 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 r remtests))))))
2d20: 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 ).. (if (not
2d30: 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d (null? required-
2d40: 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a tests))..(debug:
2d50: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 print 1 "INFO: A
2d60: 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 dding " required
2d70: 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 -tests " to the
2d80: 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 run queue")).
2d90: 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 ;; NOTE: these
2da0: 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 are all parent t
2db0: 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 ests, items are
2dc0: 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 not expanded yet
2dd0: 2e 0a 20 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d .. (runs:run-
2de0: 74 65 73 74 73 2d 71 75 65 75 65 20 64 62 20 72 tests-queue db r
2df0: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 un-id runname te
2e00: 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 st-records keyva
2e10: 6c 6c 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 llst flags).
2e20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
2e30: 49 4e 46 4f 3a 20 41 6c 6c 20 64 6f 6e 65 20 62 INFO: All done b
2e40: 79 20 68 65 72 65 22 29 29 29 0a 0a 28 64 65 66 y here")))..(def
2e50: 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 ine (runs:run-te
2e60: 73 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e sts-queue db run
2e70: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
2e80: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c -records keyvall
2e90: 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 3b 3b st flags). ;;
2ea0: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 At this point t
2eb0: 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e he list of paren
2ec0: 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e t tests is expan
2ed0: 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f ded . ;; NB//
2ee0: 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69 Should expand i
2ef0: 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68 tems here and th
2f00: 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 en insert into t
2f10: 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20 he run queue..
2f20: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 (debug:print 5 "
2f30: 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20 test-records: "
2f40: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20 test-records ",
2f50: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 keyvallst: " key
2f60: 76 61 6c 6c 73 74 29 0a 20 20 28 6c 65 74 20 28 vallst). (let (
2f70: 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d (sorted-test-nam
2f80: 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 es (tests:sort-b
2f90: 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 y-priority-and-w
2fa0: 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 aiton test-recor
2fb0: 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74 ds))..(item-patt
2fc0: 73 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 s (hash-t
2fd0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
2fe0: 20 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74 flags "-itempat
2ff0: 74 22 20 23 66 29 29 29 0a 20 20 20 20 28 6c 65 t" #f))). (le
3000: 74 20 6c 6f 6f 70 20 28 3b 20 28 6e 75 6d 74 69 t loop (; (numti
3010: 6d 65 73 20 30 29 20 3b 3b 20 73 68 6f 75 6c 64 mes 0) ;; should
3020: 6e 27 74 20 6e 65 65 64 20 74 68 69 73 0a 09 20 n't need this..
3030: 20 20 20 20 20 20 28 68 65 64 20 20 20 20 20 20 (hed
3040: 20 20 20 28 63 61 72 20 73 6f 72 74 65 64 2d 74 (car sorted-t
3050: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 20 20 20 est-names))..
3060: 20 20 20 20 28 74 61 6c 20 20 20 20 20 20 20 20 (tal
3070: 20 28 63 64 72 20 73 6f 72 74 65 64 2d 74 65 73 (cdr sorted-tes
3080: 74 2d 6e 61 6d 65 73 29 29 29 0a 20 20 20 20 20 t-names))).
3090: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65 (let* ((test-re
30a0: 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65 cord (hash-table
30b0: 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64 -ref test-record
30c0: 73 20 68 65 64 29 29 0a 09 20 20 20 20 20 28 74 s hed)).. (t
30d0: 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 config (test
30e0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
30f0: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d testconfig test-
3100: 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 28 record)).. (
3110: 77 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73 waitons (tes
3120: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3130: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 -waitons test
3140: 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 -record))..
3150: 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 74 65 (priority (te
3160: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3170: 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65 73 t-priority tes
3180: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 t-record))..
3190: 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 (itemdat (t
31a0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
31b0: 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 et-itemdat te
31c0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 st-record))..
31d0: 20 20 28 69 74 65 6d 73 20 20 20 20 20 20 20 28 (items (
31e0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
31f0: 67 65 74 2d 69 74 65 6d 73 20 20 20 20 20 20 74 get-items t
3200: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 est-record))..
3210: 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 (item-path
3220: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 (item-list->path
3230: 20 69 74 65 6d 64 61 74 29 29 29 0a 09 28 64 65 itemdat)))..(de
3240: 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 20 20 bug:print 6...
3250: 20 20 20 22 69 74 65 6d 64 61 74 3a 20 20 20 20 "itemdat:
3260: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 20 20 " itemdat...
3270: 20 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 "\n items:
3280: 20 20 22 20 69 74 65 6d 73 0a 09 09 20 20 20 20 " items...
3290: 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a "\n item-path:
32a0: 20 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 28 " item-path)..(
32b0: 63 6f 6e 64 0a 09 20 28 28 6e 6f 74 20 69 74 65 cond.. ((not ite
32c0: 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 ms) ;; when fals
32d0: 65 20 74 68 65 20 74 65 73 74 20 69 73 20 6f 6b e the test is ok
32e0: 20 74 6f 20 62 65 20 68 61 6e 64 65 64 20 6f 66 to be handed of
32f0: 66 20 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 f to launch (but
3300: 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 20 not before)..
3310: 28 6c 65 74 20 28 28 68 61 76 65 2d 72 65 73 6f (let ((have-reso
3320: 75 72 63 65 73 20 20 28 72 75 6e 73 3a 63 61 6e urces (runs:can
3330: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 -run-more-tests
3340: 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 db test-record))
3350: 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 ;; look at the
3360: 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e test jobgroup an
3370: 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 d tot jobs runni
3380: 6e 67 0a 09 09 28 70 72 65 72 65 71 73 2d 6e 6f ng...(prereqs-no
3390: 74 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d 70 72 t-met (db:get-pr
33a0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 ereqs-not-met db
33b0: 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 run-id waitons
33c0: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 20 item-path)))..
33d0: 20 20 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 ;; Don't know
33e0: 61 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 at this time if
33f0: 74 68 65 20 74 65 73 74 20 68 61 76 65 20 62 65 the test have be
3400: 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 en launched at s
3410: 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 ome time in the
3420: 70 61 73 74 0a 09 20 20 20 20 3b 3b 20 69 2e 65 past.. ;; i.e
3430: 2e 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c . is this a re-l
3440: 61 75 6e 63 68 3f 0a 09 20 20 20 20 28 69 66 20 aunch?.. (if
3450: 28 61 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 (and have-resour
3460: 63 65 73 0a 09 09 20 20 20 20 20 28 6e 75 6c 6c ces... (null
3470: 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 ? prereqs-not-me
3480: 74 29 29 0a 09 09 3b 3b 20 6e 6f 20 6c 6f 6f 70 t))...;; no loop
3490: 20 2d 20 64 72 6f 70 20 74 68 6f 75 67 68 20 61 - drop though a
34a0: 6e 64 20 75 73 65 20 74 68 65 20 6c 6f 6f 70 20 nd use the loop
34b0: 61 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 0a 09 at the bottom ..
34c0: 09 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 .(run:test db ru
34d0: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 n-id runname key
34e0: 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f vallst test-reco
34f0: 72 64 20 66 6c 61 67 73 20 23 66 29 0a 09 09 3b rd flags #f)...;
3500: 3b 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20 69 ; else the run i
3510: 73 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 s stuck, tempora
3520: 72 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e rily or permanen
3530: 74 6c 79 0a 09 09 28 6c 65 74 20 28 28 6e 65 77 tly...(let ((new
3540: 74 61 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 tal (append tal
3550: 28 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 (list hed))))...
3560: 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 ;; couldn't ru
3570: 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 n, take a breath
3580: 65 72 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 er... (thread-s
3590: 6c 65 65 70 21 20 34 29 0a 09 09 20 20 28 6c 6f leep! 4)... (lo
35a0: 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 op (car newtal)(
35b0: 63 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29 29 cdr newtal))))))
35c0: 0a 09 20 0a 09 20 3b 3b 20 63 61 73 65 20 77 68 .. .. ;; case wh
35d0: 65 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d ere an items cam
35e0: 65 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 e in as a list b
35f0: 65 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 een processed..
3600: 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 ((and (list? ite
3610: 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 ms) ;; thus
3620: 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d we know our item
3630: 73 20 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 s are already ca
3640: 6c 63 75 6c 61 74 65 64 0a 09 20 20 20 20 20 20 lculated..
3650: 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29 (not itemdat)
3660: 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 ) ;; and not yet
3670: 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 expanded into t
3680: 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 he list of thing
3690: 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 s to be done..
36a0: 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 (if (>= *verbosi
36b0: 74 79 2a 20 31 29 28 70 70 20 69 74 65 6d 73 29 ty* 1)(pp items)
36c0: 29 0a 09 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 ).. ;; (if (>=
36d0: 2a 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 *verbosity* 5)..
36e0: 20 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a ;; (begin.
36f0: 09 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 . ;; (pri
3700: 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 20 20 20 nt "items: ")
3710: 20 20 28 70 70 20 28 69 74 65 6d 2d 61 73 73 6f (pp (item-asso
3720: 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 c->item-list ite
3730: 6d 73 29 29 0a 09 20 20 3b 3b 20 20 20 20 20 20 ms)).. ;;
3740: 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 74 61 (print "itemsta
3750: 62 6c 65 3a 20 22 29 28 70 70 20 28 69 74 65 6d ble: ")(pp (item
3760: 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 -table->item-lis
3770: 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 29 t itemstable))))
3780: 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 .. (for-each..
3790: 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 (lambda (my-it
37a0: 65 6d 64 61 74 29 0a 09 20 20 20 20 20 28 6c 65 emdat).. (le
37b0: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 t* ((new-test-re
37c0: 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 cord (let ((newr
37d0: 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 ec (make-tests:t
37e0: 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 estqueue))).....
37f0: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 63 (vector-c
3800: 6f 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64 opy! test-record
3810: 20 6e 65 77 72 65 63 29 0a 09 09 09 09 20 20 20 newrec).....
3820: 20 20 20 20 6e 65 77 72 65 63 29 29 0a 09 09 20 newrec))...
3830: 20 20 20 28 6d 79 2d 69 74 65 6d 2d 70 61 74 68 (my-item-path
3840: 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 (item-list->pat
3850: 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 29 0a 09 h my-itemdat))..
3860: 09 20 20 20 20 28 69 74 65 6d 2d 6d 61 74 63 68 . (item-match
3870: 65 73 20 28 69 66 20 69 74 65 6d 2d 70 61 74 74 es (if item-patt
3880: 73 20 20 20 20 20 20 20 3b 3b 20 68 65 72 65 20 s ;; here
3890: 77 65 20 61 72 65 20 66 69 6c 74 65 72 69 6e 67 we are filtering
38a0: 20 66 6f 72 20 6d 61 74 63 68 65 73 20 77 69 74 for matches wit
38b0: 68 20 2d 69 74 65 6d 70 61 74 74 0a 09 09 09 09 h -itempatt.....
38c0: 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 (let ((res
38d0: 20 23 66 29 29 09 20 3b 3b 20 6c 6f 6f 6b 20 74 #f)). ;; look t
38e0: 68 72 6f 75 67 68 20 61 6c 6c 20 74 68 65 20 69 hrough all the i
38f0: 74 65 6d 2d 70 61 74 74 73 20 69 66 20 64 65 66 tem-patts if def
3900: 69 6e 65 64 2c 20 66 6f 72 6d 61 74 20 69 73 20 ined, format is
3910: 70 61 74 74 31 2c 70 61 74 74 32 2c 70 61 74 74 patt1,patt2,patt
3920: 33 20 2e 2e 2e 20 77 69 6c 64 63 61 72 64 20 69 3 ... wildcard i
3930: 73 20 25 0a 09 09 09 09 09 28 66 6f 72 2d 65 61 s %......(for-ea
3940: 63 68 20 0a 09 09 09 09 09 20 28 6c 61 6d 62 64 ch ...... (lambd
3950: 61 20 28 70 61 74 74 29 0a 09 09 09 09 09 20 20 a (patt)......
3960: 20 28 69 66 20 28 73 74 72 69 6e 67 2d 73 65 61 (if (string-sea
3970: 72 63 68 20 28 67 6c 6f 62 2d 3e 72 65 67 65 78 rch (glob->regex
3980: 70 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 20 p........
3990: 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c 61 74 (string-translat
39a0: 65 20 70 61 74 74 20 22 25 22 20 22 2a 22 29 29 e patt "%" "*"))
39b0: 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 69 74 ........ it
39c0: 65 6d 2d 70 61 74 68 29 0a 09 09 09 09 09 20 20 em-path)......
39d0: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 23 (set! res #
39e0: 74 29 29 29 0a 09 09 09 09 09 20 28 73 74 72 69 t)))...... (stri
39f0: 6e 67 2d 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 ng-split item-pa
3a00: 74 74 73 20 22 2c 22 29 29 0a 09 09 09 09 09 72 tts ","))......r
3a10: 65 73 29 0a 09 09 09 09 20 20 20 20 20 20 23 74 es)..... #t
3a20: 29 29 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 ))).. (if
3a30: 69 74 65 6d 2d 6d 61 74 63 68 65 73 20 3b 3b 20 item-matches ;;
3a40: 79 65 73 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 yes, we want to
3a50: 70 72 6f 63 65 73 73 20 74 68 69 73 20 69 74 65 process this ite
3a60: 6d 0a 09 09 20 20 20 28 6c 65 74 20 28 28 6e 65 m... (let ((ne
3a70: 77 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 wtestname (conc
3a80: 68 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d hed "/" my-item-
3a90: 70 61 74 68 29 29 29 20 0a 09 09 20 20 20 20 20 path))) ...
3aa0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3ab0: 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 6e 65 -set-items! ne
3ac0: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 w-test-record #f
3ad0: 29 0a 09 09 20 20 20 20 20 28 74 65 73 74 73 3a )... (tests:
3ae0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 testqueue-set-it
3af0: 65 6d 64 61 74 21 20 6e 65 77 2d 74 65 73 74 2d emdat! new-test-
3b00: 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 record my-itemda
3b10: 74 29 0a 09 09 20 20 20 20 20 28 68 61 73 68 2d t)... (hash-
3b20: 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d table-set! test-
3b30: 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e records newtestn
3b40: 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 ame new-test-rec
3b50: 6f 72 64 29 0a 09 09 20 20 20 20 20 28 73 65 74 ord)... (set
3b60: 21 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 ! tal (cons newt
3b70: 65 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 estname tal)))))
3b80: 29 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 ) ;; since these
3b90: 20 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 are itemized cr
3ba0: 65 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 eate new test na
3bb0: 6d 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 mes testname/ite
3bc0: 6d 70 61 74 68 0a 09 20 20 20 69 74 65 6d 73 29 mpath.. items)
3bd0: 0a 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 .. (loop (car t
3be0: 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 0a 0a al)(cdr tal)))..
3bf0: 09 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 . ;; if items is
3c00: 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 a proc then nee
3c10: 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 d to run items:g
3c20: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
3c30: 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 nfig, get the li
3c40: 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 3b st and loop .. ;
3c50: 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 ; - but only
3c60: 64 6f 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 do that if resou
3c70: 72 63 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 rces exist to ki
3c80: 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 ck off the job..
3c90: 20 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 ((or (procedure
3ca0: 3f 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 ? items)(eq? ite
3cb0: 6d 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 ms 'have-procedu
3cc0: 72 65 29 29 0a 09 20 20 28 69 66 20 28 61 6e 64 re)).. (if (and
3cd0: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d (runs:can-run-m
3ce0: 6f 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 ore-tests db tes
3cf0: 74 2d 72 65 63 6f 72 64 29 0a 09 09 20 20 20 28 t-record)... (
3d00: 6e 75 6c 6c 3f 20 28 64 62 3a 67 65 74 2d 70 72 null? (db:get-pr
3d10: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 ereqs-not-met db
3d20: 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 run-id waitons
3d30: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 20 item-path)))..
3d40: 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d (let ((test-
3d50: 6e 61 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 name (tests:test
3d60: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 queue-get-testna
3d70: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 me test-record))
3d80: 29 0a 09 09 28 73 65 74 65 6e 76 20 22 4d 54 5f )...(setenv "MT_
3d90: 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d TEST_NAME" test-
3da0: 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 28 73 65 74 name) ;; ...(set
3db0: 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 env "MT_RUNNAME"
3dc0: 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09 28 73 runname)...(s
3dd0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
3de0: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 vars db run-id)
3df0: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 ;; these may be
3e00: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 needed by the la
3e10: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a unching process.
3e20: 09 09 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c ..(let ((items-l
3e30: 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 ist (items:get-i
3e40: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 tems-from-config
3e50: 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 20 20 tconfig)))...
3e60: 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 (if (list? items
3e70: 2d 6c 69 73 74 29 0a 09 09 20 20 20 20 20 20 28 -list)... (
3e80: 62 65 67 69 6e 0a 09 09 09 28 74 65 73 74 73 3a begin....(tests:
3e90: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 testqueue-set-it
3ea0: 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 ems! test-record
3eb0: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 items-list)....
3ec0: 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 29 29 0a (loop hed tal)).
3ed0: 09 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 .. (begin..
3ee0: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 ..(debug:print 0
3ef0: 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f "ERROR: The pro
3f00: 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 c from reading t
3f10: 68 65 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74 he setup did not
3f20: 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 yield a list -
3f30: 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 please report th
3f40: 69 73 22 29 0a 09 09 09 28 65 78 69 74 20 31 29 is")....(exit 1)
3f50: 29 29 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 )))).. (let
3f60: 20 28 28 6e 65 77 74 61 6c 20 28 61 70 70 65 6e ((newtal (appen
3f70: 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 d tal (list hed)
3f80: 29 29 29 0a 09 09 3b 3b 20 69 66 20 63 61 6e 27 )))...;; if can'
3f90: 74 20 72 75 6e 20 6d 6f 72 65 20 74 65 73 74 73 t run more tests
3fa0: 2c 20 6c 65 74 73 20 74 61 6b 65 20 61 20 62 72 , lets take a br
3fb0: 65 61 74 68 65 72 0a 09 09 28 74 68 72 65 61 64 eather...(thread
3fc0: 2d 73 6c 65 65 70 21 20 31 29 0a 09 09 28 6c 6f -sleep! 1)...(lo
3fd0: 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 op (car newtal)(
3fe0: 63 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29 0a cdr newtal))))).
3ff0: 0a 09 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 .. ;; this case
4000: 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 should not happe
4010: 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 n, added to help
4020: 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a catch any bugs.
4030: 09 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 . ((and (list? i
4040: 74 65 6d 73 29 20 69 74 65 6d 64 61 74 29 0a 09 tems) itemdat)..
4050: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
4060: 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 20 "ERROR: Should
4070: 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 20 not have a list
4080: 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 65 of items in a te
4090: 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d 73 st and the items
40a0: 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 73 path set - pleas
40b0: 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a e report this").
40c0: 09 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 . (exit 1))))..
40d0: 0a 20 20 20 20 20 20 3b 3b 20 77 65 20 67 65 74 . ;; we get
40e0: 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70 20 74 here on "drop t
40f0: 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66 hrough" - loop f
4100: 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69 6e 20 or next test in
4110: 71 75 65 75 65 0a 20 20 20 20 20 20 28 69 66 20 queue. (if
4120: 28 6e 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 28 (null? tal).. (
4130: 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 46 49 begin.. ;; FI
4140: 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 4f XME!!!! THIS SHO
4150: 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 20 ULD NOT REQUIRE
4160: 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a 09 AN EXIT!!!!!!!..
4170: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
4180: 20 31 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 65 1 "INFO: All te
4190: 73 74 73 20 6c 61 75 6e 63 68 65 64 2c 20 65 78 sts launched, ex
41a0: 69 74 69 6e 67 22 29 0a 09 20 20 20 20 28 65 78 iting").. (ex
41b0: 69 74 20 30 29 29 0a 09 20 20 28 6c 6f 6f 70 20 it 0)).. (loop
41c0: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 (car tal)(cdr ta
41d0: 6c 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 65 l))))))..;; pare
41e0: 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 nt-test is there
41f0: 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 as a placeholde
4200: 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e r for when paren
4210: 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 t-tests can be r
4220: 75 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74 un as a setup st
4230: 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a ep.(define (run:
4240: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 test db run-id r
4250: 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 unname keyvallst
4260: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 test-record fla
4270: 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a gs parent-test).
4280: 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 ;; All these v
4290: 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 ars might be ref
42a0: 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 erenced by the t
42b0: 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 estconfig file r
42c0: 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 eader. (let* ((
42d0: 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 test-name (te
42e0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
42f0: 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 t-testname tes
4300: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 t-record)).. (te
4310: 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74 st-waitons (test
4320: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
4330: 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d waitons test-
4340: 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 record)).. (test
4350: 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a -conf (tests:
4360: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
4370: 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 stconfig test-re
4380: 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61 cord)).. (itemda
4390: 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 t (tests:te
43a0: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d stqueue-get-item
43b0: 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f dat test-reco
43c0: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74 rd)).. (test-pat
43d0: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 h (conc *topp
43e0: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 ath* "/tests/" t
43f0: 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f est-name)) ;; co
4400: 75 6c 64 20 75 73 65 20 74 65 73 74 3a 67 65 74 uld use test:get
4410: 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72 65 -testconfig here
4420: 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 20 ..... (force
4430: 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 (hash-table
4440: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 -ref/default fla
4450: 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 29 gs "-force" #f))
4460: 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 20 .. (rerun
4470: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
4480: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 /default flags "
4490: 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 28 -rerun" #f)).. (
44a0: 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 61 keepgoing (ha
44b0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
44c0: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 ault flags "-kee
44d0: 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 pgoing" #f)).. (
44e0: 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22 22 item-path ""
44f0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
4500: 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74 2d 63 int 5... "test-c
4510: 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d 74 onfig: " (hash-t
4520: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 able->alist test
4530: 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 20 -conf)... "\n
4540: 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d 64 itemdat: " itemd
4550: 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 73 at... ). ;; s
4560: 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 74 etting itemdat t
4570: 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 69 o a list if it i
4580: 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e 6f s #f. (if (no
4590: 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 20 t itemdat)(set!
45a0: 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 20 itemdat '())).
45b0: 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 74 (set! item-pat
45c0: 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 h (item-list->pa
45d0: 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 20 th itemdat)).
45e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
45f0: 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 6c "Attempting to l
4600: 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 73 aunch test " tes
4610: 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d t-name "/" item-
4620: 70 61 74 68 29 0a 20 20 20 20 28 73 65 74 65 6e path). (seten
4630: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 v "MT_TEST_NAME"
4640: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a test-name) ;; .
4650: 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f (setenv "MT_
4660: 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 RUNNAME" runna
4670: 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 me). (set-meg
4680: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 atest-env-vars d
4690: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 b run-id) ;; the
46a0: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 se may be needed
46b0: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e by the launchin
46c0: 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 63 g process. (c
46d0: 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 hange-directory
46e0: 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 20 *toppath*)..
46f0: 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 65 ;; Here is where
4700: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 the test_meta t
4710: 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 64 able is best upd
4720: 61 74 65 64 0a 20 20 20 20 28 72 75 6e 73 3a 75 ated. (runs:u
4730: 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 pdate-test_meta
4740: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 db test-name tes
4750: 74 2d 63 6f 6e 66 29 0a 20 20 20 20 0a 20 20 20 t-conf). .
4760: 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65 ;; (lambda (ite
4770: 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 mdat) ;;; ((ripe
4780: 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 29 ness "overripe")
4790: 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 63 (temperature "c
47a0: 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73 ool") (season "s
47b0: 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c 65 ummer")). (le
47c0: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 t* ((new-test-pa
47d0: 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 th (string-inter
47e0: 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73 sperse (cons tes
47f0: 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 72 t-path (map cadr
4800: 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29 itemdat)) "/"))
4810: 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e .. (new-test-n
4820: 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 ame (if (equal?
4830: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65 item-path "") te
4840: 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 st-name (conc te
4850: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d st-name "/" item
4860: 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 -path))) ;; just
4870: 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 75 need it to be u
4880: 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74 64 nique.. (testd
4890: 61 74 20 20 20 20 20 20 20 28 64 62 3a 67 65 74 at (db:get
48a0: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 -test-info db ru
48b0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
48c0: 74 65 6d 2d 70 61 74 68 29 29 29 0a 20 20 20 20 tem-path))).
48d0: 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 64 (if (not testd
48e0: 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 at).. (begin..
48f0: 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 61 ;; ensure tha
4900: 74 20 74 68 65 20 70 61 74 68 20 65 78 69 73 74 t the path exist
4910: 73 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 65 s before registe
4920: 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 20 ring the test..
4930: 20 20 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 (system (conc
4940: 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 "mkdir -p " new
4950: 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 -test-path))..
4960: 20 20 28 72 65 67 69 73 74 65 72 2d 74 65 73 74 (register-test
4970: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
4980: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a name item-path).
4990: 09 20 20 20 20 28 73 65 74 21 20 74 65 73 74 64 . (set! testd
49a0: 61 74 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d at (db:get-test-
49b0: 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 info db run-id t
49c0: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
49d0: 74 68 29 29 29 29 0a 20 20 20 20 20 20 28 63 68 th)))). (ch
49e0: 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 20 74 ange-directory t
49f0: 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 20 20 est-path).
4a00: 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 65 20 (case (if force
4a10: 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 ;; (args:get-arg
4a20: 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 4e 4f "-force")...'NO
4a30: 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 66 20 T_STARTED...(if
4a40: 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 28 73 testdat... (s
4a50: 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 tring->symbol (t
4a60: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
4a70: 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 27 66 stdat))... 'f
4a80: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 ailed-to-insert)
4a90: 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f 2d 69 )..((failed-to-i
4aa0: 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 67 3a nsert).. (debug:
4ab0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
4ac0: 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 72 74 Failed to insert
4ad0: 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e 74 6f the record into
4ae0: 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 4e 4f the db"))..((NO
4af0: 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 4c 45 T_STARTED COMPLE
4b00: 54 45 44 29 0a 09 20 28 64 65 62 75 67 3a 70 72 TED).. (debug:pr
4b10: 69 6e 74 20 36 20 22 47 6f 74 20 68 65 72 65 2c int 6 "Got here,
4b20: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
4b30: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 28 te testdat)).. (
4b40: 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 23 66 let ((runflag #f
4b50: 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 )).. (cond..
4b60: 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e ;; -force, run
4b70: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a no matter what.
4b80: 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 65 74 . (force (set
4b90: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
4ba0: 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 ;; NOT_START
4bb0: 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 ED, run no matte
4bc0: 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 65 71 r what.. ((eq
4bd0: 75 61 6c 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 ual? (test:get-s
4be0: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 4e tate testdat) "N
4bf0: 4f 54 5f 53 54 41 52 54 45 44 22 29 28 73 65 74 OT_STARTED")(set
4c00: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
4c10: 20 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 ;; not -reru
4c20: 6e 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e n and PASS, WARN
4c30: 20 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f or CHECK, do no
4c40: 20 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 run.. ((and
4c50: 28 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a (or (not rerun).
4c60: 09 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e .. keepgoin
4c70: 67 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72 g)... ;; Requir
4c80: 65 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 e to force re-ru
4c90: 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 n for COMPLETED
4ca0: 6f 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 or *anything* +
4cb0: 50 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 PASS,WARN or CHE
4cc0: 43 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 CK... (or (memb
4cd0: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
4ce0: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 tus testdat) '("
4cf0: 50 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 PASS" "WARN" "CH
4d00: 45 43 4b 22 29 29 0a 09 09 20 20 20 20 20 20 28 ECK"))... (
4d10: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 member (test:get
4d20: 2d 73 74 61 74 65 20 20 74 65 73 74 64 61 74 29 -state testdat)
4d30: 20 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 '("COMPLETED"))
4d40: 29 29 20 0a 09 20 20 20 20 20 28 73 65 74 21 20 )) .. (set!
4d50: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 runflag #f))..
4d60: 20 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 ;; -rerun and
4d70: 73 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 status is one of
4d80: 20 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 the specifed, r
4d90: 75 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 un it.. ((and
4da0: 20 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 20 rerun... (let
4db0: 28 28 72 65 72 75 6e 6c 73 74 20 28 73 74 72 69 ((rerunlst (stri
4dc0: 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22 ng-split rerun "
4dd0: 2c 22 29 29 29 20 3b 3b 20 46 41 49 4c 2c 0a 09 ,"))) ;; FAIL,..
4de0: 09 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 . (member (te
4df0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
4e00: 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 stdat) rerunlst)
4e10: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 )).. (set! r
4e20: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 unflag #t))..
4e30: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 ;; -keepgoing,
4e40: 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 do not rerun FAI
4e50: 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 L.. ((and kee
4e60: 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 pgoing... (memb
4e70: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
4e80: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 tus testdat) '("
4e90: 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 FAIL"))).. (
4ea0: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
4eb0: 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f ).. ((and (no
4ec0: 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 t rerun)... (me
4ed0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 mber (test:get-s
4ee0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 tatus testdat) '
4ef0: 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 ("FAIL" "n/a")))
4f00: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e .. (set! run
4f10: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 flag #t)).. (
4f20: 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c else (set! runfl
4f30: 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 ag #f))).. (de
4f40: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e bug:print 6 "RUN
4f50: 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a NING => runflag:
4f60: 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 " runflag " STA
4f70: 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d TE: " (test:get-
4f80: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 state testdat) "
4f90: 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 STATUS: " (test
4fa0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
4fb0: 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e dat)).. (if (n
4fc0: 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 ot runflag)..
4fd0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 (if (not par
4fe0: 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 ent-test)... (
4ff0: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e debug:print 1 "N
5000: 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e OTE: Not startin
5010: 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 g test " new-tes
5020: 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 t-name " as it i
5030: 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 s state \"" (tes
5040: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
5050: 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e dat) ....."\" an
5060: 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 d status \"" (te
5070: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
5080: 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 stdat) "\", use
5090: 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 -rerun \"" (test
50a0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
50b0: 61 74 29 20 22 5c 22 20 6f 72 20 2d 66 6f 72 63 at) "\" or -forc
50c0: 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 29 e to override"))
50d0: 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 45 .. ;; NOTE
50e0: 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 63 : No longer be c
50f0: 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 69 hecking prerequi
5100: 73 69 74 65 73 20 68 65 72 65 21 20 57 69 6c 6c sites here! Will
5110: 20 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 20 never get here
5120: 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 61 unless prereqs a
5130: 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 20 re.. ;;
5140: 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 2e already met.
5150: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f .. (if (no
5160: 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 64 t (launch-test d
5170: 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 b run-id runname
5180: 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 61 test-conf keyva
5190: 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 74 llst test-name t
51a0: 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 74 est-path itemdat
51b0: 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 62 flags))... (b
51c0: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 69 egin... (pri
51d0: 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 nt "ERROR: Faile
51e0: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 20 d to launch the
51f0: 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 73 test. Exiting as
5200: 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 6c soon as possibl
5210: 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 e")... (set!
5220: 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 74 *globalexitstat
5230: 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 20 us* 1) ;; ...
5240: 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e 61 (process-signa
5250: 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 65 l (current-proce
5260: 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b 69 ss-id) signal/ki
5270: 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c 4c ll))))))..((KILL
5280: 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 72 ED) .. (debug:pr
5290: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 6e int 1 "NOTE: " n
52a0: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 ew-test-name " i
52b0: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e s already runnin
52c0: 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 74 g or was explict
52d0: 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 2d ly killed, use -
52e0: 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 20 force to launch
52f0: 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 48 it."))..((LAUNCH
5300: 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 41 ED REMOTEHOSTSTA
5310: 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 20 RT RUNNING) ..
5320: 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 65 (if (> (- (curre
5330: 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 64 nt-seconds)(+ (d
5340: 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e 74 b:test-get-event
5350: 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a 09 _time testdat)..
5360: 09 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 ... (db:te
5370: 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 74 st-get-run_durat
5380: 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a 09 ion testdat)))..
5390: 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f .600) ;; i.e. no
53a0: 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 65 update for more
53b0: 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e 64 than 600 second
53c0: 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 s.. (begin..
53d0: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
53e0: 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 int 0 "WARNING:
53f0: 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 Test " test-name
5400: 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 " appears to be
5410: 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 69 dead. Forcing i
5420: 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f 4d t to state INCOM
5430: 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 73 PLETE and status
5440: 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 20 STUCK/DEAD")..
5450: 20 20 20 20 20 20 28 74 65 73 74 2d 73 65 74 2d (test-set-
5460: 73 74 61 74 75 73 21 20 64 62 20 72 75 6e 2d 69 status! db run-i
5470: 64 20 74 65 73 74 2d 6e 61 6d 65 20 22 49 4e 43 d test-name "INC
5480: 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f OMPLETE" "STUCK/
5490: 44 45 41 44 22 20 69 74 65 6d 64 61 74 20 22 54 DEAD" itemdat "T
54a0: 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 est is stuck or
54b0: 64 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 20 dead" #f))..
54c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
54d0: 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 "NOTE: " test-na
54e0: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
54f0: 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c running")))..(el
5500: 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a se (debug:
5510: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
5520: 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 Failed to launch
5530: 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 test " new-test
5540: 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 -name ". Unrecog
5550: 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74 nised state " (t
5560: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
5570: 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b stdat)))))))..;;
5580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55c0: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 ======.;; END OF
55d0: 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d NEW STUFF.;;===
55e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5620: 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 ===..(define (ge
5630: 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e t-dir-up-n dir .
5640: 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 params) . (let
5650: 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 ((dparts (stri
5660: 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 ng-split dir "/"
5670: 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 ))..(count (if
5680: 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 (null? params)
5690: 31 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 1 (car params)))
56a0: 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 ). (conc "/"
56b0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
56c0: 72 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 rse .. (ta
56d0: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 ke dparts (- (le
56e0: 6e 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 ngth dparts) cou
56f0: 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 nt)).. "/"
5700: 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 )))).;; Remove r
5710: 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 uns.;; fields ar
5720: 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 e passing in thr
5730: 6f 75 67 68 20 0a 28 64 65 66 69 6e 65 20 28 72 ough .(define (r
5740: 75 6e 73 3a 72 65 6d 6f 76 65 2d 72 75 6e 73 20 uns:remove-runs
5750: 64 62 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 db runnamepatt t
5760: 65 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 estpatt itempatt
5770: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 ). (let* ((keys
5780: 20 20 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d (db-get-
5790: 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 75 6e keys db)).. (run
57a0: 64 61 74 20 20 20 20 20 20 28 72 75 6e 73 3a 67 dat (runs:g
57b0: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 et-runs-by-patt
57c0: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 db keys runnamep
57d0: 61 74 74 29 29 0a 09 20 28 68 65 61 64 65 72 20 att)).. (header
57e0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 (vector-ref
57f0: 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 rundat 0)).. (r
5800: 75 6e 73 20 20 20 20 20 20 20 20 28 76 65 63 74 uns (vect
5810: 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 or-ref rundat 1)
5820: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
5830: 69 6e 74 20 31 20 22 48 65 61 64 65 72 3a 20 22 int 1 "Header: "
5840: 20 68 65 61 64 65 72 29 0a 20 20 20 20 28 66 6f header). (fo
5850: 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d r-each. (lam
5860: 62 64 61 20 28 72 75 6e 29 0a 20 20 20 20 20 20 bda (run).
5870: 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 79 20 28 (let ((runkey (
5880: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
5890: 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 se (map (lambda
58a0: 28 6b 29 0a 09 09 09 09 09 09 28 64 62 3a 67 65 (k).......(db:ge
58b0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
58c0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 28 76 65 r run header (ve
58d0: 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 29 29 20 ctor-ref k 0)))
58e0: 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 20 20 20 keys) "/"))..
58f0: 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 (dirs-to-remov
5900: 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 e (make-hash-tab
5910: 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 le))).. (let* ((
5920: 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 run-id (db:get-v
5930: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
5940: 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 20 un header "id")
5950: 29 0a 09 09 28 74 65 73 74 73 20 20 28 64 62 2d )...(tests (db-
5960: 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 get-tests-for-ru
5970: 6e 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c n db (db:get-val
5980: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
5990: 20 68 65 61 64 65 72 20 22 69 64 22 29 20 74 65 header "id") te
59a0: 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 stpatt itempatt
59b0: 27 28 29 20 27 28 29 29 29 0a 09 09 28 6c 61 73 '() '()))...(las
59c0: 74 74 70 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f ttpath "/does/no
59d0: 74 2f 65 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 t/exist/I/hope")
59e0: 29 0a 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 )... (if (not
59f0: 28 6e 75 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 (null? tests))..
5a00: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 (begin...
5a10: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5a20: 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 "Removing tests
5a30: 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 for run: " runke
5a40: 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 y " " (db:get-va
5a50: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
5a60: 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d n header "runnam
5a70: 65 22 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 e"))... (for-eac
5a80: 68 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 h... (lambda (t
5a90: 65 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a est)... (let*
5aa0: 20 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 ((item-path (db
5ab0: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
5ac0: 61 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 ath test))....
5ad0: 20 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a (test-name (db:
5ae0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
5af0: 65 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 e test)).... (
5b00: 72 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 run-dir (db:te
5b10: 73 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 st-get-rundir te
5b20: 73 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 st)))... (d
5b30: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 20 20 ebug:print 1 "
5b40: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 " (db:test-get-t
5b50: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 estname test) "
5b60: 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 id: " (db:test-g
5b70: 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 et-id test) " "
5b80: 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 20 item-path)...
5b90: 20 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 74 65 (db:delete-te
5ba0: 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 28 64 st-records db (d
5bb0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
5bc0: 73 74 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 st))... (if
5bd0: 20 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 (> (string-leng
5be0: 74 68 20 72 75 6e 2d 64 69 72 29 20 35 29 20 3b th run-dir) 5) ;
5bf0: 3b 20 62 61 64 20 68 65 75 72 69 73 74 69 63 20 ; bad heuristic
5c00: 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 but should preve
5c10: 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 nt /tmp /home et
5c20: 63 2e 0a 09 09 09 20 20 28 6c 65 74 20 28 28 66 c..... (let ((f
5c30: 75 6c 6c 70 61 74 68 20 72 75 6e 2d 64 69 72 29 ullpath run-dir)
5c40: 29 20 3b 3b 20 22 2f 22 20 28 64 62 3a 74 65 73 ) ;; "/" (db:tes
5c50: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t-get-item-path
5c60: 74 65 73 74 29 29 29 29 0a 09 09 09 20 20 20 20 test))))....
5c70: 28 73 65 74 21 20 6c 61 73 74 74 70 61 74 68 20 (set! lasttpath
5c80: 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 fullpath)....
5c90: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
5ca0: 21 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 ! dirs-to-remove
5cb0: 20 66 75 6c 6c 70 61 74 68 20 23 74 29 0a 09 09 fullpath #t)...
5cc0: 09 20 20 20 20 3b 3b 20 54 68 65 20 66 6f 6c 6c . ;; The foll
5cd0: 6f 77 69 6e 67 20 77 61 73 20 74 68 65 20 73 61 owing was the sa
5ce0: 66 65 20 64 65 6c 65 74 65 20 63 6f 64 65 20 62 fe delete code b
5cf0: 75 74 20 69 74 20 77 61 73 20 6e 6f 74 20 62 65 ut it was not be
5d00: 69 6e 67 20 65 78 65 63 74 75 74 65 64 2e 0a 09 ing exectuted...
5d10: 09 09 20 20 20 20 3b 3b 20 28 6c 65 74 2a 20 28 .. ;; (let* (
5d20: 28 64 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 (dirs-count (+ 1
5d30: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c (length keys)(l
5d40: 65 6e 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 ength (string-sp
5d50: 6c 69 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f lit item-path "/
5d60: 22 29 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 ")))).... ;;
5d70: 20 20 20 20 20 20 20 28 64 69 72 2d 74 6f 2d 72 (dir-to-r
5d80: 65 6d 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e em (get-dir-up-n
5d90: 20 66 75 6c 6c 70 61 74 68 20 64 69 72 73 2d 63 fullpath dirs-c
5da0: 6f 75 6e 74 29 29 0a 09 09 09 20 20 20 20 3b 3b ount)).... ;;
5db0: 20 20 20 20 20 20 20 20 28 72 65 6d 61 69 6e 69 (remaini
5dc0: 6e 67 64 20 28 73 74 72 69 6e 67 2d 73 75 62 73 ngd (string-subs
5dd0: 74 69 74 75 74 65 20 28 72 65 67 65 78 70 20 28 titute (regexp (
5de0: 63 6f 6e 63 20 22 5e 22 20 64 69 72 2d 74 6f 2d conc "^" dir-to-
5df0: 72 65 6d 20 22 2f 22 29 29 20 22 22 20 66 75 6c rem "/")) "" ful
5e00: 6c 70 61 74 68 29 29 0a 09 09 09 20 20 20 20 3b lpath)).... ;
5e10: 3b 20 20 20 20 20 20 20 20 28 63 6d 64 20 28 63 ; (cmd (c
5e20: 6f 6e 63 20 22 63 64 20 22 20 64 69 72 2d 74 6f onc "cd " dir-to
5e30: 2d 72 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d 70 -rem "; rmdir -p
5e40: 20 22 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 29 " remainingd ))
5e50: 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 28 69 ).... ;; (i
5e60: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
5e70: 66 75 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 fullpath)....
5e80: 20 3b 3b 20 20 20 20 20 20 20 28 62 65 67 69 6e ;; (begin
5e90: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 .... ;;
5ea0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
5eb0: 31 20 63 6d 64 29 0a 09 09 09 20 20 20 20 3b 3b 1 cmd).... ;;
5ec0: 20 20 20 20 20 20 20 20 20 28 73 79 73 74 65 6d (system
5ed0: 20 63 6d 64 29 29 29 0a 09 09 09 20 20 20 20 3b cmd))).... ;
5ee0: 3b 20 20 20 29 29 0a 09 09 09 20 20 20 20 29 29 ; )).... ))
5ef0: 29 29 0a 09 09 20 20 20 20 74 65 73 74 73 29 29 ))... tests))
5f00: 29 0a 0a 09 20 20 20 3b 3b 20 6c 6f 6f 6b 20 74 )... ;; look t
5f10: 68 6f 75 67 68 20 74 68 65 20 64 69 72 73 2d 74 hough the dirs-t
5f20: 6f 2d 72 65 6d 6f 76 65 20 66 6f 72 20 63 61 6e o-remove for can
5f30: 64 69 64 61 74 65 73 20 66 6f 72 20 72 65 6d 6f didates for remo
5f40: 76 61 6c 2e 20 44 6f 20 74 68 69 73 20 61 66 74 val. Do this aft
5f50: 65 72 20 64 65 6c 65 74 69 6e 67 20 74 68 65 20 er deleting the
5f60: 72 65 63 6f 72 64 73 0a 09 20 20 20 3b 3b 20 66 records.. ;; f
5f70: 6f 72 20 65 61 63 68 20 74 65 73 74 20 69 6e 20 or each test in
5f80: 63 61 73 65 20 77 65 20 67 65 74 20 6b 69 6c 6c case we get kill
5f90: 65 64 2e 20 54 68 61 74 20 73 68 6f 75 6c 64 20 ed. That should
5fa0: 6d 69 6e 69 6d 69 7a 65 20 74 68 65 20 64 65 74 minimize the det
5fb0: 72 69 74 75 73 20 6c 65 66 74 20 6f 6e 20 64 69 ritus left on di
5fc0: 73 6b 0a 09 20 20 20 3b 3b 20 70 72 6f 63 65 73 sk.. ;; proces
5fd0: 73 20 74 68 65 20 64 69 72 73 20 66 72 6f 6d 20 s the dirs from
5fe0: 6c 6f 6e 67 65 73 74 20 73 74 72 69 6e 67 20 6c longest string l
5ff0: 65 6e 67 74 68 20 74 6f 20 73 68 6f 72 74 65 73 ength to shortes
6000: 74 0a 09 20 20 20 28 66 6f 72 2d 65 61 63 68 20 t.. (for-each
6010: 0a 09 20 20 20 20 28 6c 61 6d 62 64 61 20 28 64 .. (lambda (d
6020: 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 20 ir-to-remove)..
6030: 20 20 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 (if (file-e
6040: 78 69 73 74 73 3f 20 64 69 72 2d 74 6f 2d 72 65 xists? dir-to-re
6050: 6d 6f 76 65 29 0a 09 09 20 20 28 6c 65 74 20 28 move)... (let (
6060: 28 64 69 72 2d 69 6e 2d 64 62 20 27 28 29 29 29 (dir-in-db '()))
6070: 0a 09 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a ... (sqlite3:
6080: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 for-each-row...
6090: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 (lambda (dir
60a0: 29 0a 09 09 20 20 20 20 20 20 20 28 73 65 74 21 )... (set!
60b0: 20 64 69 72 2d 69 6e 2d 64 62 20 28 63 6f 6e 73 dir-in-db (cons
60c0: 20 64 69 72 20 64 69 72 2d 69 6e 2d 64 62 29 29 dir dir-in-db))
60d0: 29 0a 09 09 20 20 20 20 20 64 62 20 22 53 45 4c )... db "SEL
60e0: 45 43 54 20 72 75 6e 64 69 72 20 46 52 4f 4d 20 ECT rundir FROM
60f0: 74 65 73 74 73 20 57 48 45 52 45 20 72 75 6e 64 tests WHERE rund
6100: 69 72 20 4c 49 4b 45 20 3f 3b 22 20 0a 09 09 20 ir LIKE ?;" ...
6110: 20 20 20 20 28 63 6f 6e 63 20 22 25 22 20 64 69 (conc "%" di
6120: 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 25 22 29 r-to-remove "%")
6130: 29 20 3b 3b 20 79 65 73 2c 20 49 27 6d 20 67 6f ) ;; yes, I'm go
6140: 69 6e 67 20 74 6f 20 62 61 69 6c 20 69 66 20 74 ing to bail if t
6150: 68 65 72 65 20 69 73 20 61 6e 79 74 68 69 6e 67 here is anything
6160: 20 6c 69 6b 65 20 74 68 69 73 20 64 69 72 20 69 like this dir i
6170: 6e 20 74 68 65 20 64 62 0a 09 09 20 20 20 20 28 n the db... (
6180: 69 66 20 28 6e 75 6c 6c 3f 20 64 69 72 2d 69 6e if (null? dir-in
6190: 2d 64 62 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 -db)....(begin..
61a0: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
61b0: 20 32 20 22 52 65 6d 6f 76 69 6e 67 20 64 69 72 2 "Removing dir
61c0: 65 63 74 6f 72 79 20 77 69 74 68 20 7a 65 72 6f ectory with zero
61d0: 20 64 62 20 72 65 66 65 72 65 6e 63 65 73 3a 20 db references:
61e0: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 " dir-to-remove)
61f0: 0a 09 09 09 20 20 28 73 79 73 74 65 6d 20 28 63 .... (system (c
6200: 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 64 69 onc "rm -rf " di
6210: 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 r-to-remove))...
6220: 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 . (hash-table-d
6230: 65 6c 65 74 65 21 20 64 69 72 73 2d 74 6f 2d 72 elete! dirs-to-r
6240: 65 6d 6f 76 65 20 64 69 72 2d 74 6f 2d 72 65 6d emove dir-to-rem
6250: 6f 76 65 29 29 0a 09 09 09 28 64 65 62 75 67 3a ove))....(debug:
6260: 70 72 69 6e 74 20 32 20 22 53 6b 69 70 70 69 6e print 2 "Skippin
6270: 67 20 72 65 6d 6f 76 61 6c 20 6f 66 20 22 20 64 g removal of " d
6280: 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 20 66 ir-to-remove " f
6290: 6f 72 20 6e 6f 77 20 61 73 20 69 74 20 73 74 69 or now as it sti
62a0: 6c 6c 20 68 61 73 20 72 65 66 65 72 65 6e 63 65 ll has reference
62b0: 73 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 s in the databas
62c0: 65 22 29 29 29 29 29 0a 09 20 20 20 20 28 73 6f e"))))).. (so
62d0: 72 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b rt (hash-table-k
62e0: 65 79 73 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f eys dirs-to-remo
62f0: 76 65 29 20 28 6c 61 6d 62 64 61 20 28 61 20 62 ve) (lambda (a b
6300: 29 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 )(> (string-leng
6310: 74 68 20 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e th a)(string-len
6320: 67 74 68 20 62 29 29 29 29 29 0a 0a 09 20 20 20 gth b)))))...
6330: 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 ;; remove the ru
6340: 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 n if zero tests
6350: 72 65 6d 61 69 6e 0a 09 20 20 20 28 6c 65 74 20 remain.. (let
6360: 28 28 72 65 6d 74 65 73 74 73 20 28 64 62 2d 67 ((remtests (db-g
6370: 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e et-tests-for-run
6380: 20 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 db (db:get-valu
6390: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
63a0: 68 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 header "id") #f
63b0: 23 66 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 #f '() '())))..
63c0: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 (if (null? r
63d0: 65 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d emtests) ;; no m
63e0: 6f 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e ore tests remain
63f0: 69 6e 67 0a 09 09 20 28 6c 65 74 2a 20 28 28 64 ing... (let* ((d
6400: 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 parts (string-s
6410: 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 plit lasttpath "
6420: 2f 22 29 29 0a 09 09 09 28 72 75 6e 70 61 74 68 /"))....(runpath
6430: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 (conc "/" (stri
6440: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a ng-intersperse .
6450: 09 09 09 09 09 20 20 20 20 28 74 61 6b 65 20 64 ..... (take d
6460: 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 parts (- (length
6470: 20 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 dparts) 1))....
6480: 09 09 20 20 20 20 22 2f 22 29 29 29 29 0a 09 09 .. "/"))))...
6490: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
64a0: 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 1 "Removing run:
64b0: 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 " runkey " " (d
64c0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
64d0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
64e0: 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 "runname"))...
64f0: 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e (db:delete-run
6500: 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 db run-id)...
6510: 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 ;; need to figu
6520: 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 re out the path
6530: 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 to the run dir a
6540: 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 nd remove it if
6550: 65 6d 70 74 79 0a 09 09 20 20 20 3b 3b 20 20 20 empty... ;;
6560: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f (if (null? (glo
6570: 62 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 b (conc runpath
6580: 22 2f 2a 22 29 29 29 0a 09 09 20 20 20 3b 3b 20 "/*")))... ;;
6590: 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 (begin...
65a0: 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 ;; . (debug:p
65b0: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 rint 1 "Removing
65c0: 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 run dir " runpa
65d0: 74 68 29 0a 09 09 20 20 20 3b 3b 20 09 20 28 73 th)... ;; . (s
65e0: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 ystem (conc "rmd
65f0: 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 ir -p " runpath)
6600: 29 29 29 0a 09 09 20 20 20 29 29 29 29 0a 09 20 )))... ))))..
6610: 29 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a )). runs))).
6620: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
6630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 =========.;; Rou
6670: 74 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 tines for manipu
6680: 6c 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d lating runs.;;==
6690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66d0: 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d ====..;; Since m
66e0: 61 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 any calls to a r
66f0: 75 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 un require prett
6700: 79 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 y much the same
6710: 73 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 setup .;; this w
6720: 72 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 rapper is used t
6730: 6f 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 o reduce the rep
6740: 6c 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 lication of code
6750: 0a 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 .(define (genera
6760: 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 l-run-call switc
6770: 68 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 hname action-des
6780: 63 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 c proc). (let (
6790: 28 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 (runname (args:g
67a0: 65 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 et-arg ":runname
67b0: 22 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 "))..(target (i
67c0: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 f (args:get-arg
67d0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 "-target")...
67e0: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 (args:get-arg
67f0: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 "-target")...
6800: 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 (args:get-arg
6810: 22 2d 72 65 71 74 61 72 67 22 29 29 29 29 0a 20 "-reqtarg")))).
6820: 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 (cond. ((
6830: 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 not target).
6840: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
6850: 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 "ERROR: Missing
6860: 20 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 required parame
6870: 74 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 ter for " switch
6880: 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 name ", you must
6890: 20 73 70 65 63 69 66 79 20 74 68 65 20 74 61 72 specify the tar
68a0: 67 65 74 20 77 69 74 68 20 2d 74 61 72 67 65 74 get with -target
68b0: 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 "). (exit 3
68c0: 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 20 72 75 )). ((not ru
68d0: 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 28 64 65 nname). (de
68e0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
68f0: 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 OR: Missing requ
6900: 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 ired parameter f
6910: 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 or " switchname
6920: 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 ", you must spec
6930: 69 66 79 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 ify the run name
6940: 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 with :runname r
6950: 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 20 20 28 unname"). (
6960: 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 28 65 exit 3)). (e
6970: 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 74 20 28 lse. (let (
6980: 28 64 62 20 20 20 23 66 29 0a 09 20 20 20 20 28 (db #f).. (
6990: 6b 65 79 73 20 23 66 29 29 0a 09 28 69 66 20 28 keys #f))..(if (
69a0: 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 not (setup-for-r
69b0: 75 6e 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e un)).. (begin
69c0: 20 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a .. (debug:
69d0: 70 72 69 6e 74 20 30 20 22 46 61 69 6c 65 64 20 print 0 "Failed
69e0: 74 6f 20 73 65 74 75 70 2c 20 65 78 69 74 69 6e to setup, exitin
69f0: 67 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 g").. (exit
6a00: 20 31 29 29 29 0a 09 28 73 65 74 21 20 64 62 20 1)))..(set! db
6a10: 20 20 28 6f 70 65 6e 2d 64 62 29 29 0a 09 28 73 (open-db))..(s
6a20: 65 74 21 20 6b 65 79 73 20 28 64 62 2d 67 65 74 et! keys (db-get
6a30: 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 -keys db))..;; h
6a40: 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 ave enough to pr
6a50: 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 ocess -target or
6a60: 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 -reqtarg here..
6a70: 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 (if (args:get-ar
6a80: 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 g "-reqtarg")..
6a90: 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f (let* ((runco
6aa0: 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f nfigf (conc *to
6ab0: 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 ppath* "/runconf
6ac0: 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b igs.config")) ;;
6ad0: 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 DO NOT EVALUATE
6ae0: 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 ALL ... (runc
6af0: 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e onfig (read-con
6b00: 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 fig runconfigf #
6b10: 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 f #f environ-pat
6b20: 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 20 t: #f))) ..
6b30: 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65 (if (hash-table
6b40: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e -ref/default run
6b50: 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74 config (args:get
6b60: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 -arg "-reqtarg")
6b70: 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 #f)... (keys:t
6b80: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b arget-set-args k
6b90: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 eys (args:get-ar
6ba0: 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 72 g "-reqtarg") ar
6bb0: 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20 gs:arg-hash)...
6bc0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 (begin... (d
6bd0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
6be0: 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 ROR: [" (args:ge
6bf0: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
6c00: 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 ) "] not found i
6c10: 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a n " runconfigf).
6c20: 09 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 .. (sqlite3:f
6c30: 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 20 inalize! db)...
6c40: 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 (exit 1))))..
6c50: 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 (if (args:ge
6c60: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 t-arg "-target")
6c70: 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 2d ...(keys:target-
6c80: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 set-args keys (a
6c90: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
6ca0: 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d 68 rget" args:arg-h
6cb0: 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 61 ash) args:arg-ha
6cc0: 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 sh)))..(if (not
6cd0: 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f (car *configinfo
6ce0: 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e 0a *)).. (begin.
6cf0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
6d00: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 74 int 0 "ERROR: At
6d10: 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 74 tempted to " act
6d20: 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 72 ion-desc " but r
6d30: 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 66 un area config f
6d40: 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a ile not found").
6d50: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 . (exit 1))
6d60: 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 74 .. ;; Extract
6d70: 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 65 out stuff neede
6d80: 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e d in most or man
6d90: 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 y calls.. ;;
6da0: 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 here then call p
6db0: 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 roc.. (let* (
6dc0: 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 (keynames (map
6dd0: 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 key:get-fieldna
6de0: 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 28 me keys))... (
6df0: 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 keyvallst (keys
6e00: 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 ->vallist keys #
6e10: 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 6f t))).. (pro
6e20: 63 20 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e c db target runn
6e30: 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d 65 ame keys keyname
6e40: 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a 09 s keyvallst)))..
6e50: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
6e60: 65 21 20 64 62 29 0a 09 28 73 65 74 21 20 2a 64 e! db)..(set! *d
6e70: 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 idsomething* #t)
6e80: 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d )))))..;;=======
6e90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ea0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6eb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ec0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
6ed0: 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b ;; Rollup runs.;
6ee0: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
6ef0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f20: 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 =======..;; Upda
6f30: 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 te the test_meta
6f40: 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 table for this
6f50: 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 test.(define (ru
6f60: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
6f70: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eta db test-name
6f80: 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c test-conf). (l
6f90: 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 et ((currrecord
6fa0: 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 (db:testmeta-get
6fb0: 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d -record db test-
6fc0: 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 name))). (if
6fd0: 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 (not currrecord)
6fe0: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 ..(begin.. (set
6ff0: 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 ! currrecord (ma
7000: 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 ke-vector 10 #f)
7010: 29 0a 09 20 20 28 64 62 3a 74 65 73 74 6d 65 74 ).. (db:testmet
7020: 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 a-add-record db
7030: 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 test-name))).
7040: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
7050: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 (lambda (key).
7060: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 (let* ((id
7070: 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 x (cadr key))..
7080: 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 (fld (car
7090: 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 key)).. (va
70a0: 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 l (config-lookup
70b0: 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 test-conf "test
70c0: 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 _meta" fld)))..
70d0: 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;; (debug:print
70e0: 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 5 "idx: " idx "
70f0: 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c fld: " fld " val
7100: 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 : " val).. (if (
7110: 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 and val (not (eq
7120: 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 ual? (vector-ref
7130: 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 currrecord idx)
7140: 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 val))).. (b
7150: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 egin.. (pr
7160: 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 int "Updating "
7170: 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c test-name " " fl
7180: 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 d " to " val)..
7190: 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 6d 65 (db:testme
71a0: 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 ta-update-field
71b0: 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 db test-name fld
71c0: 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 val))))). '
71d0: 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f (("author" 2)("o
71e0: 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 69 wner" 3)("descri
71f0: 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 ption" 4)("revie
7200: 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 39 wed" 5)("tags" 9
7210: 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 )))))..;; Update
7220: 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 test_meta for a
7230: 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 ll tests.(define
7240: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c (runs:update-al
7250: 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a l-test_meta db).
7260: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 (let ((test-na
7270: 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 mes (get-all-leg
7280: 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 al-tests))).
7290: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
72a0: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 (lambda (test-na
72b0: 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a me). (let*
72c0: 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 ((test-path
72d0: 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 (conc *toppath*
72e0: 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e "/tests/" test-n
72f0: 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 ame)).. (te
7300: 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 st-configf (conc
7310: 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 test-path "/tes
7320: 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 tconfig"))..
7330: 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 20 (testexists
7340: 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 (and (file-exist
7350: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
7360: 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 (file-read-acces
7370: 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 s? test-configf)
7380: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 )).. ;; rea
7390: 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 d configs with t
73a0: 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 ricks turned off
73b0: 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d (i.e. no system
73c0: 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 ).. (test-c
73d0: 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 65 onf (if teste
73e0: 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 xists (read-conf
73f0: 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 ig test-configf
7400: 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 #f #f)(make-hash
7410: 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28 72 75 -table)))).. (ru
7420: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
7430: 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eta db test-name
7440: 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 test-conf))).
7450: 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 test-names)))
7460: 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 ..;; This could
7470: 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 probably be refa
7480: 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 ctored into one
7490: 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e complex query ..
74a0: 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
74b0: 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 rollup-run db ke
74c0: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
74d0: 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 name user) ;; wa
74e0: 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 s target, now ke
74f0: 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 yvallst. (debug
7500: 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 :print 4 "runs:r
7510: 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a ollup-run, keys:
7520: 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c " keys " keyval
7530: 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 lst: " keyvallst
7540: 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 " :runname " ru
7550: 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 nname " user: "
7560: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 3b user). (let* (;
7570: 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 (keyvalllst
7580: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e (keys:target->
7590: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 keyval keys targ
75a0: 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d et)).. (new-run-
75b0: 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 id (runs:re
75c0: 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 gister-run db ke
75d0: 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e ys keyvallst run
75e0: 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 name "new" "n/a"
75f0: 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d user)).. (prev-
7600: 74 65 73 74 73 20 20 20 20 20 20 28 74 65 73 74 tests (test
7610: 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 :get-matching-pr
7620: 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d evious-test-run-
7630: 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 records db new-r
7640: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a un-id "%" "%")).
7650: 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20 20 . (curr-tests
7660: 20 20 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 (db-get-tests
7670: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d -for-run db new-
7680: 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 27 run-id "%" "%" '
7690: 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 () '())).. (curr
76a0: 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b -tests-hash (mak
76b0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
76c0: 20 20 20 20 28 64 62 3a 75 70 64 61 74 65 2d 72 (db:update-r
76d0: 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 un-event_time db
76e0: 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 new-run-id).
76f0: 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c ;; index the al
7700: 72 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74 ready saved test
7710: 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e s by testname an
7720: 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 d itemdat in cur
7730: 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 r-tests-hash.
7740: 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 (for-each.
7750: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 (lambda (testdat
7760: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 ). (let* (
7770: 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 (testname (db:t
7780: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
7790: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 testdat))..
77a0: 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 (item-path (db
77b0: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
77c0: 61 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 ath testdat))..
77d0: 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 (full-name
77e0: 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 (conc testname "
77f0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a /" item-path))).
7800: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 . (hash-table-se
7810: 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 t! curr-tests-ha
7820: 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 sh full-name tes
7830: 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 tdat))). cur
7840: 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 r-tests). ;;
7850: 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 NOPE: Non-optima
7860: 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 l approach. Try
7870: 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 this instead..
7880: 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 ;; 1. tests
7890: 61 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 are received in
78a0: 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 a list, most rec
78b0: 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b ent first. ;;
78c0: 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 2. replace th
78d0: 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 e rollup test wi
78e0: 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 th the new *alwa
78f0: 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 ys*. (for-eac
7900: 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 h . (lambda
7910: 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 (testdat).
7920: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d (let* ((testnam
7930: 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d e (db:test-get-
7940: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 testname testdat
7950: 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d )).. (item-
7960: 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 path (db:test-ge
7970: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 t-item-path test
7980: 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 dat)).. (fu
7990: 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 ll-name (conc te
79a0: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d stname "/" item-
79b0: 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 path)).. (p
79c0: 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 rev-test-dat (ha
79d0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
79e0: 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d ault curr-tests-
79f0: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 hash full-name #
7a00: 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 f)).. (test
7a10: 2d 73 74 65 70 73 20 20 20 20 20 20 28 64 62 3a -steps (db:
7a20: 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 get-steps-for-te
7a30: 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 st db (db:test-g
7a40: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 et-id testdat)))
7a50: 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 .. (new-tes
7a60: 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 t-record #f))..
7a70: 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 ;; replace these
7a80: 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e with insert ...
7a90: 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 select.. (apply
7aa0: 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 sqlite3:execute
7ab0: 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 ...db ...(conc
7ac0: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 "INSERT OR REPLA
7ad0: 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 CE INTO tests (r
7ae0: 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 un_id,testname,s
7af0: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e tate,status,even
7b00: 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c t_time,host,cpul
7b10: 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 oad,diskfree,una
7b20: 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 me,rundir,item_p
7b30: 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e ath,run_duration
7b40: 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d ,final_logf,comm
7b50: 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 ent) "... "
7b60: 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c VALUES (?,?,?,?,
7b70: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
7b80: 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 ?,?);")...new-ru
7b90: 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 74 n-id (cddr (vect
7ba0: 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 or->list testdat
7bb0: 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d ))).. (set! new-
7bc0: 74 65 73 74 64 61 74 20 28 63 61 72 20 28 64 62 testdat (car (db
7bd0: 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 -get-tests-for-r
7be0: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
7bf0: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70 testname item-p
7c00: 61 74 68 20 27 28 29 20 27 28 29 29 29 29 0a 09 ath '() '())))..
7c10: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
7c20: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 ! curr-tests-has
7c30: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d h full-name new-
7c40: 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 testdat) ;; this
7c50: 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 could be confus
7c60: 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 ing, which recor
7c70: 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f d should go into
7c80: 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c the lookup tabl
7c90: 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c e?.. ;; Now dupl
7ca0: 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73 icate the test s
7cb0: 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 teps.. (debug:pr
7cc0: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 int 4 "Copying r
7cd0: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 ecords in test_s
7ce0: 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 teps from test_i
7cf0: 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 d=" (db:test-get
7d00: 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 -id testdat) " t
7d10: 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 o " (db:test-get
7d20: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
7d30: 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65 ).. (sqlite3:exe
7d40: 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20 cute .. db ..
7d50: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
7d60: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
7d70: 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 st_steps (test_i
7d80: 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 d,stepname,state
7d90: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
7da0: 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 me,comment) "...
7db0: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 "SELECT " (db:te
7dc0: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
7dd0: 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d stdat) ",stepnam
7de0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 e,state,status,e
7df0: 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e vent_time,commen
7e00: 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 t FROM test_step
7e10: 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d s WHERE test_id=
7e20: 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74 ?;").. (db:test
7e30: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 -get-id testdat)
7e40: 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 ).. ;; Now dupli
7e50: 63 61 74 65 20 74 68 65 20 74 65 73 74 20 64 61 cate the test da
7e60: 74 61 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e ta.. (debug:prin
7e70: 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 t 4 "Copying rec
7e80: 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 ords in test_dat
7e90: 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 a from test_id="
7ea0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
7eb0: 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 testdat) " to "
7ec0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
7ed0: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 new-testdat))..
7ee0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
7ef0: 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f e .. db .. (co
7f00: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 nc "INSERT OR RE
7f10: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f PLACE INTO test_
7f20: 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 data (test_id,ca
7f30: 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c tegory,variable,
7f40: 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 value,expected,t
7f50: 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 ol,units,comment
7f60: 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 ) "..."SELECT "
7f70: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
7f80: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 63 new-testdat) ",c
7f90: 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 ategory,variable
7fa0: 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c ,value,expected,
7fb0: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e tol,units,commen
7fc0: 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 t FROM test_data
7fd0: 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f WHERE test_id=?
7fe0: 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74 2d ;").. (db:test-
7ff0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
8000: 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d .. )). prev-
8010: 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 tests))).. .
8020: 20 0a .