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 61 70 70 65 6e est-names (appen
2c50: 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 6c 69 d test-names (li
2c60: 73 74 20 77 61 69 74 6f 6e 29 29 29 29 29 29 0a st waiton)))))).
2c70: 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a 09 . waitons)..
2c80: 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 (let ((remte
2c90: 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c sts (delete-dupl
2ca0: 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20 77 icates (append w
2cb0: 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a 09 aitons tal))))..
2cc0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 (if (not (
2cd0: 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 29 null? remtests))
2ce0: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 ... (loop (car
2cf0: 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72 65 remtests)(cdr re
2d00: 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a 20 mtests)))))))..
2d10: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c (if (not (nul
2d20: 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 l? required-test
2d30: 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e s))..(debug:prin
2d40: 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 6e t 1 "INFO: Addin
2d50: 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 73 g " required-tes
2d60: 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20 ts " to the run
2d70: 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20 queue")). ;;
2d80: 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 20 NOTE: these are
2d90: 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73 all parent tests
2da0: 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20 , items are not
2db0: 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20 expanded yet..
2dc0: 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 (runs:run-test
2dd0: 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e 2d 69 s-queue db run-i
2de0: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 d runname test-r
2df0: 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 ecords keyvallst
2e00: 20 66 6c 61 67 73 29 29 29 0a 0a 28 64 65 66 69 flags)))..(defi
2e10: 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 ne (runs:run-tes
2e20: 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e 2d ts-queue db run-
2e30: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
2e40: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 records keyvalls
2e50: 74 20 66 6c 61 67 73 29 0a 20 20 20 20 3b 3b 20 t flags). ;;
2e60: 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 68 At this point th
2e70: 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e 74 e list of parent
2e80: 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e 64 tests is expand
2e90: 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 ed . ;; NB//
2ea0: 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69 74 Should expand it
2eb0: 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68 65 ems here and the
2ec0: 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 68 n insert into th
2ed0: 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20 28 e run queue.. (
2ee0: 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 74 debug:print 5 "t
2ef0: 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20 74 est-records: " t
2f00: 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20 6b est-records ", k
2f10: 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 eyvallst: " keyv
2f20: 61 6c 6c 73 74 29 0a 20 20 28 6c 65 74 20 28 28 allst). (let ((
2f30: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 sorted-test-name
2f40: 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 s (tests:sort-by
2f50: 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 -priority-and-wa
2f60: 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 iton test-record
2f70: 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74 73 s))..(item-patts
2f80: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 (hash-ta
2f90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
2fa0: 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74 74 flags "-itempatt
2fb0: 22 20 23 66 29 29 29 0a 20 20 20 20 28 6c 65 74 " #f))). (let
2fc0: 20 6c 6f 6f 70 20 28 3b 20 28 6e 75 6d 74 69 6d loop (; (numtim
2fd0: 65 73 20 30 29 20 3b 3b 20 73 68 6f 75 6c 64 6e es 0) ;; shouldn
2fe0: 27 74 20 6e 65 65 64 20 74 68 69 73 0a 09 20 20 't need this..
2ff0: 20 20 20 20 20 28 68 65 64 20 20 20 20 20 20 20 (hed
3000: 20 20 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65 (car sorted-te
3010: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 20 20 20 20 st-names))..
3020: 20 20 20 28 74 61 6c 20 20 20 20 20 20 20 20 20 (tal
3030: 28 63 64 72 20 73 6f 72 74 65 64 2d 74 65 73 74 (cdr sorted-test
3040: 2d 6e 61 6d 65 73 29 29 29 0a 20 20 20 20 20 20 -names))).
3050: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 65 63 (let* ((test-rec
3060: 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c 65 2d ord (hash-table-
3070: 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 64 73 ref test-records
3080: 20 68 65 64 29 29 0a 09 20 20 20 20 20 28 74 63 hed)).. (tc
3090: 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 73 onfig (tests
30a0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
30b0: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 estconfig test-r
30c0: 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 28 77 ecord)).. (w
30d0: 61 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74 aitons (test
30e0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
30f0: 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d waitons test-
3100: 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 28 record)).. (
3110: 70 72 69 6f 72 69 74 79 20 20 20 20 28 74 65 73 priority (tes
3120: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3130: 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65 73 74 -priority test
3140: 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 20 20 -record))..
3150: 28 69 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 (itemdat (te
3160: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3170: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 t-itemdat 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 73 20 20 20 20 20 20 20 28 74 (items (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 73 20 20 20 20 20 20 74 65 et-items 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 2d 70 61 74 68 20 20 20 28 (item-path (
31e0: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
31f0: 69 74 65 6d 64 61 74 29 29 29 0a 09 28 64 65 62 itemdat)))..(deb
3200: 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 20 20 20 ug:print 6...
3210: 20 20 22 69 74 65 6d 64 61 74 3a 20 20 20 20 20 "itemdat:
3220: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 20 20 20 " itemdat...
3230: 20 22 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 "\n items:
3240: 20 22 20 69 74 65 6d 73 0a 09 09 20 20 20 20 20 " items...
3250: 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 3a 20 "\n item-path:
3260: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 28 63 " item-path)..(c
3270: 6f 6e 64 0a 09 20 28 28 6e 6f 74 20 69 74 65 6d ond.. ((not item
3280: 73 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 s) ;; when false
3290: 20 74 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20 the test is ok
32a0: 74 6f 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66 to be handed off
32b0: 20 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20 to launch (but
32c0: 6e 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 20 28 not before).. (
32d0: 6c 65 74 20 28 28 68 61 76 65 2d 72 65 73 6f 75 let ((have-resou
32e0: 72 63 65 73 20 20 28 72 75 6e 73 3a 63 61 6e 2d rces (runs:can-
32f0: 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 run-more-tests d
3300: 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 b test-record))
3310: 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 ;; look at the t
3320: 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 est jobgroup and
3330: 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e tot jobs runnin
3340: 67 0a 09 09 28 70 72 65 72 65 71 73 2d 6e 6f 74 g...(prereqs-not
3350: 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d 70 72 65 -met (db:get-pre
3360: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 62 20 reqs-not-met db
3370: 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 run-id waitons i
3380: 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 20 20 tem-path)))..
3390: 20 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 ;; Don't know a
33a0: 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 t this time if t
33b0: 68 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65 he test have bee
33c0: 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f n launched at so
33d0: 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 me time in the p
33e0: 61 73 74 0a 09 20 20 20 20 3b 3b 20 69 2e 65 2e ast.. ;; i.e.
33f0: 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61 is this a re-la
3400: 75 6e 63 68 3f 0a 09 20 20 20 20 28 69 66 20 28 unch?.. (if (
3410: 61 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 and have-resourc
3420: 65 73 0a 09 09 20 20 20 20 20 28 6e 75 6c 6c 3f es... (null?
3430: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
3440: 29 29 0a 09 09 3b 3b 20 6e 6f 20 6c 6f 6f 70 20 ))...;; no loop
3450: 2d 20 64 72 6f 70 20 74 68 6f 75 67 68 20 61 6e - drop though an
3460: 64 20 75 73 65 20 74 68 65 20 6c 6f 6f 70 20 61 d use the loop a
3470: 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 0a 09 09 t the bottom ...
3480: 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e (run:test db run
3490: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 -id runname keyv
34a0: 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 allst test-recor
34b0: 64 20 66 6c 61 67 73 20 23 66 29 0a 09 09 3b 3b d flags #f)...;;
34c0: 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73 else the run is
34d0: 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 stuck, temporar
34e0: 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 ily or permanent
34f0: 6c 79 0a 09 09 28 6c 65 74 20 28 28 6e 65 77 74 ly...(let ((newt
3500: 61 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 al (append tal (
3510: 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 20 list hed))))...
3520: 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e ;; couldn't run
3530: 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 , take a breathe
3540: 72 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c r... (thread-sl
3550: 65 65 70 21 20 31 29 0a 09 09 20 20 28 6c 6f 6f eep! 1)... (loo
3560: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 p (car newtal)(c
3570: 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29 29 0a dr newtal)))))).
3580: 09 20 0a 09 20 3b 3b 20 63 61 73 65 20 77 68 65 . .. ;; case whe
3590: 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d 65 re an items came
35a0: 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65 in as a list be
35b0: 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 28 en processed.. (
35c0: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d (and (list? item
35d0: 73 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 s) ;; thus w
35e0: 65 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 e know our items
35f0: 20 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c are already cal
3600: 63 75 6c 61 74 65 64 0a 09 20 20 20 20 20 20 20 culated..
3610: 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 29 29 (not itemdat))
3620: 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 74 20 ;; and not yet
3630: 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 74 68 expanded into th
3640: 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e 67 73 e list of things
3650: 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 20 28 to be done.. (
3660: 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 if (>= *verbosit
3670: 79 2a 20 31 29 28 70 70 20 69 74 65 6d 73 29 29 y* 1)(pp items))
3680: 0a 09 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a .. ;; (if (>= *
3690: 76 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 verbosity* 5)..
36a0: 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09 ;; (begin..
36b0: 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e ;; (prin
36c0: 74 20 22 69 74 65 6d 73 3a 20 22 29 20 20 20 20 t "items: ")
36d0: 20 28 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63 (pp (item-assoc
36e0: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d ->item-list item
36f0: 73 29 29 0a 09 20 20 3b 3b 20 20 20 20 20 20 20 s)).. ;;
3700: 28 70 72 69 6e 74 20 22 69 74 65 6d 73 74 61 62 (print "itemstab
3710: 6c 65 3a 20 22 29 28 70 70 20 28 69 74 65 6d 2d le: ")(pp (item-
3720: 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c 69 73 74 table->item-list
3730: 20 69 74 65 6d 73 74 61 62 6c 65 29 29 29 29 0a itemstable)))).
3740: 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 . (for-each..
3750: 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 (lambda (my-ite
3760: 6d 64 61 74 29 0a 09 20 20 20 20 20 28 6c 65 74 mdat).. (let
3770: 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 * ((new-test-rec
3780: 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 ord (let ((newre
3790: 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 c (make-tests:te
37a0: 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 20 stqueue))).....
37b0: 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 63 6f (vector-co
37c0: 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 py! test-record
37d0: 6e 65 77 72 65 63 29 0a 09 09 09 09 20 20 20 20 newrec).....
37e0: 20 20 20 6e 65 77 72 65 63 29 29 0a 09 09 20 20 newrec))...
37f0: 20 20 28 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 (my-item-path
3800: 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 (item-list->path
3810: 20 6d 79 2d 69 74 65 6d 64 61 74 29 29 0a 09 09 my-itemdat))...
3820: 20 20 20 20 28 69 74 65 6d 2d 6d 61 74 63 68 65 (item-matche
3830: 73 20 28 69 66 20 69 74 65 6d 2d 70 61 74 74 73 s (if item-patts
3840: 20 20 20 20 20 20 20 3b 3b 20 68 65 72 65 20 77 ;; here w
3850: 65 20 61 72 65 20 66 69 6c 74 65 72 69 6e 67 20 e are filtering
3860: 66 6f 72 20 6d 61 74 63 68 65 73 20 77 69 74 68 for matches with
3870: 20 2d 69 74 65 6d 70 61 74 74 0a 09 09 09 09 20 -itempatt.....
3880: 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 20 (let ((res
3890: 23 66 29 29 09 20 3b 3b 20 6c 6f 6f 6b 20 74 68 #f)). ;; look th
38a0: 72 6f 75 67 68 20 61 6c 6c 20 74 68 65 20 69 74 rough all the it
38b0: 65 6d 2d 70 61 74 74 73 20 69 66 20 64 65 66 69 em-patts if defi
38c0: 6e 65 64 2c 20 66 6f 72 6d 61 74 20 69 73 20 70 ned, format is p
38d0: 61 74 74 31 2c 70 61 74 74 32 2c 70 61 74 74 33 att1,patt2,patt3
38e0: 20 2e 2e 2e 20 77 69 6c 64 63 61 72 64 20 69 73 ... wildcard is
38f0: 20 25 0a 09 09 09 09 09 28 66 6f 72 2d 65 61 63 %......(for-eac
3900: 68 20 0a 09 09 09 09 09 20 28 6c 61 6d 62 64 61 h ...... (lambda
3910: 20 28 70 61 74 74 29 0a 09 09 09 09 09 20 20 20 (patt)......
3920: 28 69 66 20 28 73 74 72 69 6e 67 2d 73 65 61 72 (if (string-sear
3930: 63 68 20 28 67 6c 6f 62 2d 3e 72 65 67 65 78 70 ch (glob->regexp
3940: 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 20 28 ........ (
3950: 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c 61 74 65 string-translate
3960: 20 70 61 74 74 20 22 25 22 20 22 2a 22 29 29 0a patt "%" "*")).
3970: 09 09 09 09 09 09 09 20 20 20 20 20 20 69 74 65 ....... ite
3980: 6d 2d 70 61 74 68 29 0a 09 09 09 09 09 20 20 20 m-path)......
3990: 20 20 20 20 28 73 65 74 21 20 72 65 73 20 23 74 (set! res #t
39a0: 29 29 29 0a 09 09 09 09 09 20 28 73 74 72 69 6e )))...... (strin
39b0: 67 2d 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 g-split item-pat
39c0: 74 73 20 22 2c 22 29 29 0a 09 09 09 09 09 72 65 ts ","))......re
39d0: 73 29 0a 09 09 09 09 20 20 20 20 20 20 23 74 29 s)..... #t)
39e0: 29 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 69 )).. (if i
39f0: 74 65 6d 2d 6d 61 74 63 68 65 73 20 3b 3b 20 79 tem-matches ;; y
3a00: 65 73 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 es, we want to p
3a10: 72 6f 63 65 73 73 20 74 68 69 73 20 69 74 65 6d rocess this item
3a20: 0a 09 09 20 20 20 28 6c 65 74 20 28 28 6e 65 77 ... (let ((new
3a30: 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 68 testname (conc h
3a40: 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70 ed "/" my-item-p
3a50: 61 74 68 29 29 29 20 0a 09 09 20 20 20 20 20 28 ath))) ... (
3a60: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
3a70: 73 65 74 2d 69 74 65 6d 73 21 20 20 20 6e 65 77 set-items! new
3a80: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 -test-record #f)
3a90: 0a 09 09 20 20 20 20 20 28 74 65 73 74 73 3a 74 ... (tests:t
3aa0: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 estqueue-set-ite
3ab0: 6d 64 61 74 21 20 6e 65 77 2d 74 65 73 74 2d 72 mdat! new-test-r
3ac0: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 ecord my-itemdat
3ad0: 29 0a 09 09 20 20 20 20 20 28 68 61 73 68 2d 74 )... (hash-t
3ae0: 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 able-set! test-r
3af0: 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 ecords newtestna
3b00: 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f me new-test-reco
3b10: 72 64 29 0a 09 09 20 20 20 20 20 28 73 65 74 21 rd)... (set!
3b20: 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 tal (cons newte
3b30: 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 stname tal))))))
3b40: 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 ;; since these
3b50: 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 are itemized cre
3b60: 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d ate new test nam
3b70: 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d es testname/item
3b80: 70 61 74 68 0a 09 20 20 20 69 74 65 6d 73 29 0a path.. items).
3b90: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 . (loop (car ta
3ba0: 6c 29 28 63 64 72 20 74 61 6c 29 29 29 0a 0a 09 l)(cdr tal)))...
3bb0: 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20 ;; if items is
3bc0: 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 a proc then need
3bd0: 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 to run items:ge
3be0: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e t-items-from-con
3bf0: 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73 fig, get the lis
3c00: 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 3b 3b t and loop .. ;;
3c10: 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 64 - but only d
3c20: 6f 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 72 o that if resour
3c30: 63 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 63 ces exist to kic
3c40: 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 20 k off the job..
3c50: 28 28 6f 72 20 28 70 72 6f 63 65 64 75 72 65 3f ((or (procedure?
3c60: 20 69 74 65 6d 73 29 28 65 71 3f 20 69 74 65 6d items)(eq? item
3c70: 73 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 s 'have-procedur
3c80: 65 29 29 0a 09 20 20 28 69 66 20 28 72 75 6e 73 e)).. (if (runs
3c90: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
3ca0: 73 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f sts db test-reco
3cb0: 72 64 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20 rd).. (let
3cc0: 28 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 ((items-list (it
3cd0: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 ems:get-items-fr
3ce0: 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 om-config tconfi
3cf0: 67 29 29 29 0a 09 09 28 69 66 20 28 6c 69 73 74 g)))...(if (list
3d00: 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 ? items-list)...
3d10: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 (begin...
3d20: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
3d30: 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 eue-set-items! t
3d40: 65 73 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 est-record items
3d50: 2d 6c 69 73 74 29 0a 09 09 20 20 20 20 20 20 28 -list)... (
3d60: 6c 6f 6f 70 20 68 65 64 20 74 61 6c 29 29 0a 09 loop hed tal))..
3d70: 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 . (begin...
3d80: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
3d90: 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 70 0 "ERROR: The p
3da0: 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e 67 roc from reading
3db0: 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20 6e the setup did n
3dc0: 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 20 ot yield a list
3dd0: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 - please report
3de0: 74 68 69 73 22 29 0a 09 09 20 20 20 20 20 20 28 this")... (
3df0: 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 exit 1))))..
3e00: 20 20 28 6c 65 74 20 28 28 6e 65 77 74 61 6c 20 (let ((newtal
3e10: 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 (append tal (lis
3e20: 74 20 68 65 64 29 29 29 29 0a 09 09 3b 3b 20 69 t hed))))...;; i
3e30: 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 f can't run more
3e40: 20 74 65 73 74 73 2c 20 6c 65 74 73 20 74 61 6b tests, lets tak
3e50: 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 28 e a breather...(
3e60: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 31 29 thread-sleep! 1)
3e70: 0a 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 ...(loop (car ne
3e80: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c wtal)(cdr newtal
3e90: 29 29 29 29 29 0a 0a 09 20 3b 3b 20 74 68 69 73 )))))... ;; this
3ea0: 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 case should not
3eb0: 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 20 74 happen, added t
3ec0: 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 6e 79 o help catch any
3ed0: 20 62 75 67 73 0a 09 20 28 28 61 6e 64 20 28 6c bugs.. ((and (l
3ee0: 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d ist? items) item
3ef0: 64 61 74 29 0a 09 20 20 28 64 65 62 75 67 3a 70 dat).. (debug:p
3f00: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 53 rint 0 "ERROR: S
3f10: 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 61 hould not have a
3f20: 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 69 list of items i
3f30: 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68 65 n a test and the
3f40: 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20 2d itemspath set -
3f50: 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 74 please report t
3f60: 68 69 73 22 29 0a 09 20 20 28 65 78 69 74 20 31 his").. (exit 1
3f70: 29 29 29 29 0a 09 0a 20 20 20 20 20 20 3b 3b 20 ))))... ;;
3f80: 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e 20 22 we get here on "
3f90: 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 2d 20 drop through" -
3fa0: 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 65 loop for next te
3fb0: 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 20 20 st in queue.
3fc0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 6c (if (null? tal
3fd0: 29 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ).. (debug:prin
3fe0: 74 20 31 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 74 t 1 "INFO: All t
3ff0: 65 73 74 73 20 6c 61 75 6e 63 68 65 64 22 29 0a ests launched").
4000: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 . (loop (car ta
4010: 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 l)(cdr tal))))))
4020: 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 ..;; parent-test
4030: 20 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 is there as a p
4040: 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 laceholder for w
4050: 68 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 hen parent-tests
4060: 20 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 can be run as a
4070: 20 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 setup step.(def
4080: 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 64 62 ine (run:test db
4090: 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 run-id runname
40a0: 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 keyvallst test-r
40b0: 65 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 ecord flags pare
40c0: 6e 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c nt-test). ;; Al
40d0: 6c 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 l these vars mig
40e0: 68 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 ht be referenced
40f0: 20 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 by the testconf
4100: 69 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 ig file reader.
4110: 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 (let* ((test-na
4120: 6d 65 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 me (tests:tes
4130: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e tqueue-get-testn
4140: 61 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 ame test-recor
4150: 64 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 d)).. (test-wait
4160: 6f 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 ons (tests:testq
4170: 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 ueue-get-waitons
4180: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 test-record)
4190: 29 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 ).. (test-conf
41a0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
41b0: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ue-get-testconfi
41c0: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a g test-record)).
41d0: 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 . (itemdat
41e0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
41f0: 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 -get-itemdat
4200: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
4210: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 (test-path (c
4220: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
4230: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d tests/" test-nam
4240: 65 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 e)) ;; could use
4250: 20 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 6f test:get-testco
4260: 6e 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 nfig here .....
4270: 28 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 (force (h
4280: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
4290: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f fault flags "-fo
42a0: 72 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 rce" #f)).. (rer
42b0: 75 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d un (hash-
42c0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
42d0: 74 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 t flags "-rerun"
42e0: 20 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 #f)).. (keepgoi
42f0: 6e 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c ng (hash-tabl
4300: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c e-ref/default fl
4310: 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 ags "-keepgoing"
4320: 20 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 #f)).. (item-pa
4330: 74 68 20 20 20 20 20 22 22 29 29 0a 20 20 20 20 th "")).
4340: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 (debug:print 5..
4350: 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 . "test-config:
4360: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 " (hash-table->a
4370: 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a list test-conf).
4380: 09 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 .. "\n itemdat
4390: 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 : " itemdat... )
43a0: 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 . ;; setting
43b0: 69 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 itemdat to a lis
43c0: 74 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 t if it is #f.
43d0: 20 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 (if (not itemd
43e0: 61 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 at)(set! itemdat
43f0: 20 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 '())). (set!
4400: 20 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d item-path (item
4410: 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d -list->path item
4420: 64 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 dat)). (debug
4430: 3a 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 :print 2 "Attemp
4440: 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 ting to launch t
4450: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
4460: 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 "/" item-path).
4470: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 (setenv "MT_T
4480: 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e EST_NAME" test-n
4490: 61 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 ame) ;; . (se
44a0: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 tenv "MT_RUNNAME
44b0: 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 " runname).
44c0: 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 (set-megatest-e
44d0: 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 nv-vars db run-i
44e0: 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 d) ;; these may
44f0: 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 be needed by the
4500: 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 launching proce
4510: 73 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 ss. (change-d
4520: 69 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 irectory *toppat
4530: 68 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 h*).. ;; Here
4540: 20 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65 is where the te
4550: 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 st_meta table is
4560: 20 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 best updated.
4570: 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 (runs:update-t
4580: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 est_meta db test
4590: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 -name test-conf)
45a0: 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 . . ;; (la
45b0: 6d 62 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b mbda (itemdat) ;
45c0: 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f ;; ((ripeness "o
45d0: 76 65 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 verripe") (tempe
45e0: 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 rature "cool") (
45f0: 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 season "summer")
4600: 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 ). (let* ((ne
4610: 77 2d 74 65 73 74 2d 70 61 74 68 20 28 73 74 72 w-test-path (str
4620: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
4630: 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 20 (cons test-path
4640: 28 6d 61 70 20 63 61 64 72 20 69 74 65 6d 64 61 (map cadr itemda
4650: 74 29 29 20 22 2f 22 29 29 0a 09 20 20 20 28 6e t)) "/")).. (n
4660: 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 ew-test-name (if
4670: 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 (equal? item-pa
4680: 74 68 20 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 th "") test-name
4690: 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 (conc test-name
46a0: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
46b0: 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 ) ;; just need i
46c0: 74 20 74 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 t to be unique..
46d0: 20 20 20 28 74 65 73 74 64 61 74 20 20 20 20 20 (testdat
46e0: 20 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 (db:get-test-i
46f0: 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 nfo db run-id te
4700: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
4710: 68 29 29 29 0a 20 20 20 20 20 20 28 69 66 20 28 h))). (if (
4720: 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20 20 not testdat)..
4730: 28 62 65 67 69 6e 0a 09 20 20 20 20 28 72 65 67 (begin.. (reg
4740: 69 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 ister-test db ru
4750: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
4760: 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 28 tem-path).. (
4770: 73 65 74 21 20 74 65 73 74 64 61 74 20 28 64 62 set! testdat (db
4780: 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 :get-test-info d
4790: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
47a0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 me item-path))))
47b0: 0a 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d 64 . (change-d
47c0: 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70 61 irectory test-pa
47d0: 74 68 29 0a 20 20 20 20 20 20 28 63 61 73 65 20 th). (case
47e0: 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 (if force ;; (ar
47f0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 gs:get-arg "-for
4800: 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 ce")...'NOT_STAR
4810: 54 45 44 0a 09 09 28 69 66 20 74 65 73 74 64 61 TED...(if testda
4820: 74 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d t... (string-
4830: 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 >symbol (test:ge
4840: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
4850: 29 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64 2d )... 'failed-
4860: 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28 66 to-insert))..((f
4870: 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 ailed-to-insert)
4880: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
4890: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 0 "ERROR: Failed
48a0: 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 72 to insert the r
48b0: 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 64 ecord into the d
48c0: 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 b"))..((NOT_STAR
48d0: 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09 TED COMPLETED)..
48e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 (debug:print 6
48f0: 22 47 6f 74 20 68 65 72 65 2c 20 22 20 28 74 65 "Got here, " (te
4900: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
4910: 74 64 61 74 29 29 0a 09 20 28 6c 65 74 20 28 28 tdat)).. (let ((
4920: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 runflag #f))..
4930: 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d (cond.. ;; -
4940: 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 force, run no ma
4950: 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 tter what.. (
4960: 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e 66 force (set! runf
4970: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b lag #t)).. ;;
4980: 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75 NOT_STARTED, ru
4990: 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 n no matter what
49a0: 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20 28 .. ((equal? (
49b0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
49c0: 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 estdat) "NOT_STA
49d0: 52 54 45 44 22 29 28 73 65 74 21 20 72 75 6e 66 RTED")(set! runf
49e0: 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b lag #t)).. ;;
49f0: 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 not -rerun and
4a00: 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 PASS, WARN or CH
4a10: 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 ECK, do no run..
4a20: 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e ((and (or (n
4a30: 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20 ot rerun)...
4a40: 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 keepgoing)...
4a50: 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66 ;; Require to f
4a60: 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20 orce re-run for
4a70: 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e COMPLETED or *an
4a80: 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57 ything* + PASS,W
4a90: 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20 ARN or CHECK...
4aa0: 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65 (or (member (te
4ab0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
4ac0: 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20 stdat) '("PASS"
4ad0: 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 "WARN" "CHECK"))
4ae0: 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72 ... (member
4af0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
4b00: 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f testdat) '("CO
4b10: 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20 MPLETED")))) ..
4b20: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 (set! runfla
4b30: 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d g #f)).. ;; -
4b40: 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 rerun and status
4b50: 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 is one of the s
4b60: 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a pecifed, run it.
4b70: 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e . ((and rerun
4b80: 0a 09 09 20 20 28 6c 65 74 20 28 28 72 65 72 75 ... (let ((reru
4b90: 6e 6c 73 74 20 28 73 74 72 69 6e 67 2d 73 70 6c nlst (string-spl
4ba0: 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 29 20 it rerun ",")))
4bb0: 3b 3b 20 46 41 49 4c 2c 0a 09 09 20 20 20 20 28 ;; FAIL,... (
4bc0: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 member (test:get
4bd0: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
4be0: 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 20 20 rerunlst)))..
4bf0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
4c00: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b #t)).. ;; -k
4c10: 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 eepgoing, do not
4c20: 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 rerun FAIL..
4c30: 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 ((and keepgoing
4c40: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 ... (member (te
4c50: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
4c60: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 stdat) '("FAIL")
4c70: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 )).. (set! r
4c80: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 unflag #f))..
4c90: 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 ((and (not reru
4ca0: 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 n)... (member (
4cb0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
4cc0: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c testdat) '("FAIL
4cd0: 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 " "n/a")))..
4ce0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
4cf0: 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 t)).. (else (
4d00: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
4d10: 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 )).. (debug:pr
4d20: 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d int 6 "RUNNING =
4d30: 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e > runflag: " run
4d40: 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 flag " STATE: "
4d50: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
4d60: 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55 testdat) " STATU
4d70: 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 S: " (test:get-s
4d80: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a tatus testdat)).
4d90: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e . (if (not run
4da0: 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 flag).. (i
4db0: 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 f (not parent-te
4dc0: 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a st)... (debug:
4dd0: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e print 1 "NOTE: N
4de0: 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 ot starting test
4df0: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 " new-test-name
4e00: 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74 " as it is stat
4e10: 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d e \"" (test:get-
4e20: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 0a state testdat) .
4e30: 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 ...."\" and stat
4e40: 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 us \"" (test:get
4e50: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
4e60: 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e "\", use -rerun
4e70: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 \"" (test:get-s
4e80: 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 5c tate testdat) "\
4e90: 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f " or -force to o
4ea0: 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 verride"))..
4eb0: 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c ;; NOTE: No l
4ec0: 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e onger be checkin
4ed0: 67 20 70 72 65 72 65 71 75 69 73 69 74 65 73 20 g prerequisites
4ee0: 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 here! Will never
4ef0: 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 get here unless
4f00: 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 prereqs are..
4f10: 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c ;; al
4f20: 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 ready met...
4f30: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 (if (not (lau
4f40: 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d nch-test db run-
4f50: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
4f60: 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 conf keyvallst t
4f70: 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 est-name test-pa
4f80: 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 th itemdat flags
4f90: 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 ))... (begin..
4fa0: 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 . (print "ER
4fb0: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c ROR: Failed to l
4fc0: 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 aunch the test.
4fd0: 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 Exiting as soon
4fe0: 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 as possible")...
4ff0: 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 (set! *glob
5000: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 alexitstatus* 1)
5010: 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f ;; ... (pro
5020: 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 cess-signal (cur
5030: 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 rent-process-id)
5040: 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 signal/kill))))
5050: 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 ))..((KILLED) ..
5060: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5070: 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 "NOTE: " new-tes
5080: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 t-name " is alre
5090: 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 ady running or w
50a0: 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c as explictly kil
50b0: 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 led, use -force
50c0: 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 to launch it."))
50d0: 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d ..((LAUNCHED REM
50e0: 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e OTEHOSTSTART RUN
50f0: 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e NING) .. (if (>
5100: 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 (- (current-sec
5110: 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 onds)(+ (db:test
5120: 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 -get-event_time
5130: 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 testdat).....
5140: 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 (db:test-get
5150: 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 -run_duration te
5160: 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 stdat)))...600)
5170: 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 ;; i.e. no updat
5180: 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 e for more than
5190: 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 600 seconds..
51a0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 (begin..
51b0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
51c0: 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 "WARNING: Test "
51d0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 test-name " app
51e0: 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e ears to be dead.
51f0: 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 Forcing it to s
5200: 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 tate INCOMPLETE
5210: 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b and status STUCK
5220: 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 /DEAD")..
5230: 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 (test-set-status
5240: 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 ! db run-id test
5250: 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 54 -name "INCOMPLET
5260: 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 E" "STUCK/DEAD"
5270: 69 74 65 6d 64 61 74 20 22 54 65 73 74 20 69 73 itemdat "Test is
5280: 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 stuck or dead"
5290: 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 #f)).. (debu
52a0: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a g:print 2 "NOTE:
52b0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 " test-name " i
52c0: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e s already runnin
52d0: 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 g")))..(else
52e0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
52f0: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 0 "ERROR: Failed
5300: 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 to launch test
5310: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 " new-test-name
5320: 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 ". Unrecognised
5330: 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 state " (test:ge
5340: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
5350: 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d ))))))..;;======
5360: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5370: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
53a0: 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 .;; END OF NEW S
53b0: 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d TUFF.;;=========
53c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
53d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
53e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
53f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 =============..(
5400: 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d define (get-dir-
5410: 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d up-n dir . param
5420: 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 s) . (let ((dpa
5430: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c rts (string-spl
5440: 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 it dir "/"))..(c
5450: 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c ount (if (null
5460: 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 ? params) 1 (car
5470: 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 params)))).
5480: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e (conc "/" (strin
5490: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 g-intersperse ..
54a0: 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 (take dpa
54b0: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 rts (- (length d
54c0: 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 parts) count))..
54d0: 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b "/")))).;
54e0: 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b ; Remove runs.;;
54f0: 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 fields are pass
5500: 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a ing in through .
5510: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 (define (runs:re
5520: 6d 6f 76 65 2d 72 75 6e 73 20 64 62 20 72 75 6e move-runs db run
5530: 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 namepatt testpat
5540: 74 20 69 74 65 6d 70 61 74 74 29 0a 20 20 28 6c t itempatt). (l
5550: 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 et* ((keys
5560: 20 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 (db-get-keys d
5570: 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 20 b)).. (rundat
5580: 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e (runs:get-run
5590: 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 s-by-patt db key
55a0: 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a s runnamepatt)).
55b0: 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20 28 . (header (
55c0: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
55d0: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 t 0)).. (runs
55e0: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 (vector-ref
55f0: 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 rundat 1))).
5600: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5610: 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 "Header: " heade
5620: 72 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 r). (for-each
5630: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 . (lambda (r
5640: 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 un). (let
5650: 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 ((runkey (string
5660: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 -intersperse (ma
5670: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 p (lambda (k)...
5680: 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 ....(db:get-valu
5690: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
56a0: 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 header (vector-r
56b0: 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 ef k 0))) keys)
56c0: 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 "/")).. (dir
56d0: 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b s-to-remove (mak
56e0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
56f0: 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 . (let* ((run-id
5700: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
5710: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
5720: 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 28 74 der "id") )...(t
5730: 65 73 74 73 20 20 28 64 62 2d 67 65 74 2d 74 65 ests (db-get-te
5740: 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 sts-for-run db (
5750: 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d db:get-value-by-
5760: 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 header run heade
5770: 72 20 22 69 64 22 29 20 74 65 73 74 70 61 74 74 r "id") testpatt
5780: 20 69 74 65 6d 70 61 74 74 20 27 28 29 20 27 28 itempatt '() '(
5790: 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 68 )))...(lasttpath
57a0: 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 "/does/not/exis
57b0: 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 t/I/hope"))...
57c0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
57d0: 20 74 65 73 74 73 29 29 0a 09 20 20 20 20 20 20 tests))..
57e0: 20 28 62 65 67 69 6e 0a 09 09 20 28 64 65 62 75 (begin... (debu
57f0: 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 g:print 1 "Remov
5800: 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 75 ing tests for ru
5810: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 n: " runkey " "
5820: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
5830: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
5840: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 er "runname"))..
5850: 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 . (for-each...
5860: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 (lambda (test)..
5870: 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 . (let* ((ite
5880: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
5890: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
58a0: 73 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 st)).... (test
58b0: 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 -name (db:test-g
58c0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
58d0: 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 )).... (run-di
58e0: 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 r (db:test-get
58f0: 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a -rundir test))).
5900: 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
5910: 72 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a rint 1 " " (db:
5920: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
5930: 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 e test) " id: "
5940: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
5950: 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 test) " " item-p
5960: 61 74 68 29 0a 09 09 20 20 20 20 20 20 28 64 62 ath)... (db
5970: 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 63 :delete-test-rec
5980: 6f 72 64 73 20 64 62 20 28 64 62 3a 74 65 73 74 ords db (db:test
5990: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 0a 09 -get-id test))..
59a0: 09 20 20 20 20 20 20 28 69 66 20 28 3e 20 28 73 . (if (> (s
59b0: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 75 6e tring-length run
59c0: 2d 64 69 72 29 20 35 29 20 3b 3b 20 62 61 64 20 -dir) 5) ;; bad
59d0: 68 65 75 72 69 73 74 69 63 20 62 75 74 20 73 68 heuristic but sh
59e0: 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 6d ould prevent /tm
59f0: 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 09 p /home etc.....
5a00: 20 20 28 6c 65 74 20 28 28 66 75 6c 6c 70 61 74 (let ((fullpat
5a10: 68 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 22 h run-dir)) ;; "
5a20: 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d /" (db:test-get-
5a30: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
5a40: 29 29 0a 09 09 09 20 20 20 20 28 73 65 74 21 20 )).... (set!
5a50: 6c 61 73 74 74 70 61 74 68 20 66 75 6c 6c 70 61 lasttpath fullpa
5a60: 74 68 29 0a 09 09 09 20 20 20 20 28 68 61 73 68 th).... (hash
5a70: 2d 74 61 62 6c 65 2d 73 65 74 21 20 64 69 72 73 -table-set! dirs
5a80: 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 75 6c 6c 70 -to-remove fullp
5a90: 61 74 68 20 23 74 29 0a 09 09 09 20 20 20 20 3b ath #t).... ;
5aa0: 3b 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 ; The following
5ab0: 77 61 73 20 74 68 65 20 73 61 66 65 20 64 65 6c was the safe del
5ac0: 65 74 65 20 63 6f 64 65 20 62 75 74 20 69 74 20 ete code but it
5ad0: 77 61 73 20 6e 6f 74 20 62 65 69 6e 67 20 65 78 was not being ex
5ae0: 65 63 74 75 74 65 64 2e 0a 09 09 09 20 20 20 20 ectuted.....
5af0: 3b 3b 20 28 6c 65 74 2a 20 28 28 64 69 72 73 2d ;; (let* ((dirs-
5b00: 63 6f 75 6e 74 20 28 2b 20 31 20 28 6c 65 6e 67 count (+ 1 (leng
5b10: 74 68 20 6b 65 79 73 29 28 6c 65 6e 67 74 68 20 th keys)(length
5b20: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 (string-split it
5b30: 65 6d 2d 70 61 74 68 20 22 2f 22 29 29 29 29 0a em-path "/")))).
5b40: 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ... ;;
5b50: 20 28 64 69 72 2d 74 6f 2d 72 65 6d 20 28 67 65 (dir-to-rem (ge
5b60: 74 2d 64 69 72 2d 75 70 2d 6e 20 66 75 6c 6c 70 t-dir-up-n fullp
5b70: 61 74 68 20 64 69 72 73 2d 63 6f 75 6e 74 29 29 ath dirs-count))
5b80: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 .... ;;
5b90: 20 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 28 73 (remainingd (s
5ba0: 74 72 69 6e 67 2d 73 75 62 73 74 69 74 75 74 65 tring-substitute
5bb0: 20 28 72 65 67 65 78 70 20 28 63 6f 6e 63 20 22 (regexp (conc "
5bc0: 5e 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 2f ^" dir-to-rem "/
5bd0: 22 29 29 20 22 22 20 66 75 6c 6c 70 61 74 68 29 ")) "" fullpath)
5be0: 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 ).... ;;
5bf0: 20 20 20 28 63 6d 64 20 28 63 6f 6e 63 20 22 63 (cmd (conc "c
5c00: 64 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 22 d " dir-to-rem "
5c10: 3b 20 72 6d 64 69 72 20 2d 70 20 22 20 72 65 6d ; rmdir -p " rem
5c20: 61 69 6e 69 6e 67 64 20 29 29 29 0a 09 09 09 20 ainingd )))....
5c30: 20 20 20 3b 3b 20 20 20 28 69 66 20 28 66 69 6c ;; (if (fil
5c40: 65 2d 65 78 69 73 74 73 3f 20 66 75 6c 6c 70 61 e-exists? fullpa
5c50: 74 68 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 th).... ;;
5c60: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 20 20 (begin....
5c70: 20 20 3b 3b 20 20 20 20 20 20 20 20 20 28 64 65 ;; (de
5c80: 62 75 67 3a 70 72 69 6e 74 20 31 20 63 6d 64 29 bug:print 1 cmd)
5c90: 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 .... ;;
5ca0: 20 20 20 28 73 79 73 74 65 6d 20 63 6d 64 29 29 (system cmd))
5cb0: 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 29 29 ).... ;; ))
5cc0: 0a 09 09 09 20 20 20 20 29 29 29 29 0a 09 09 20 .... ))))...
5cd0: 20 20 20 74 65 73 74 73 29 29 29 0a 0a 09 20 20 tests)))...
5ce0: 20 3b 3b 20 6c 6f 6f 6b 20 74 68 6f 75 67 68 20 ;; look though
5cf0: 74 68 65 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f the dirs-to-remo
5d00: 76 65 20 66 6f 72 20 63 61 6e 64 69 64 61 74 65 ve for candidate
5d10: 73 20 66 6f 72 20 72 65 6d 6f 76 61 6c 2e 20 44 s for removal. D
5d20: 6f 20 74 68 69 73 20 61 66 74 65 72 20 64 65 6c o this after del
5d30: 65 74 69 6e 67 20 74 68 65 20 72 65 63 6f 72 64 eting the record
5d40: 73 0a 09 20 20 20 3b 3b 20 66 6f 72 20 65 61 63 s.. ;; for eac
5d50: 68 20 74 65 73 74 20 69 6e 20 63 61 73 65 20 77 h test in case w
5d60: 65 20 67 65 74 20 6b 69 6c 6c 65 64 2e 20 54 68 e get killed. Th
5d70: 61 74 20 73 68 6f 75 6c 64 20 6d 69 6e 69 6d 69 at should minimi
5d80: 7a 65 20 74 68 65 20 64 65 74 72 69 74 75 73 20 ze the detritus
5d90: 6c 65 66 74 20 6f 6e 20 64 69 73 6b 0a 09 20 20 left on disk..
5da0: 20 3b 3b 20 70 72 6f 63 65 73 73 20 74 68 65 20 ;; process the
5db0: 64 69 72 73 20 66 72 6f 6d 20 6c 6f 6e 67 65 73 dirs from longes
5dc0: 74 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 t string length
5dd0: 74 6f 20 73 68 6f 72 74 65 73 74 0a 09 20 20 20 to shortest..
5de0: 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 (for-each ..
5df0: 28 6c 61 6d 62 64 61 20 28 64 69 72 2d 74 6f 2d (lambda (dir-to-
5e00: 72 65 6d 6f 76 65 29 0a 09 20 20 20 20 20 20 28 remove).. (
5e10: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f if (file-exists?
5e20: 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a dir-to-remove).
5e30: 09 09 20 20 28 6c 65 74 20 28 28 64 69 72 2d 69 .. (let ((dir-i
5e40: 6e 2d 64 62 20 27 28 29 29 29 0a 09 09 20 20 20 n-db '()))...
5e50: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 (sqlite3:for-ea
5e60: 63 68 2d 72 6f 77 0a 09 09 20 20 20 20 20 28 6c ch-row... (l
5e70: 61 6d 62 64 61 20 28 64 69 72 29 0a 09 09 20 20 ambda (dir)...
5e80: 20 20 20 20 20 28 73 65 74 21 20 64 69 72 2d 69 (set! dir-i
5e90: 6e 2d 64 62 20 28 63 6f 6e 73 20 64 69 72 20 64 n-db (cons dir d
5ea0: 69 72 2d 69 6e 2d 64 62 29 29 29 0a 09 09 20 20 ir-in-db)))...
5eb0: 20 20 20 64 62 20 22 53 45 4c 45 43 54 20 72 75 db "SELECT ru
5ec0: 6e 64 69 72 20 46 52 4f 4d 20 74 65 73 74 73 20 ndir FROM tests
5ed0: 57 48 45 52 45 20 72 75 6e 64 69 72 20 4c 49 4b WHERE rundir LIK
5ee0: 45 20 3f 3b 22 20 0a 09 09 20 20 20 20 20 28 63 E ?;" ... (c
5ef0: 6f 6e 63 20 22 25 22 20 64 69 72 2d 74 6f 2d 72 onc "%" dir-to-r
5f00: 65 6d 6f 76 65 20 22 25 22 29 29 20 3b 3b 20 79 emove "%")) ;; y
5f10: 65 73 2c 20 49 27 6d 20 67 6f 69 6e 67 20 74 6f es, I'm going to
5f20: 20 62 61 69 6c 20 69 66 20 74 68 65 72 65 20 69 bail if there i
5f30: 73 20 61 6e 79 74 68 69 6e 67 20 6c 69 6b 65 20 s anything like
5f40: 74 68 69 73 20 64 69 72 20 69 6e 20 74 68 65 20 this dir in the
5f50: 64 62 0a 09 09 20 20 20 20 28 69 66 20 28 6e 75 db... (if (nu
5f60: 6c 6c 3f 20 64 69 72 2d 69 6e 2d 64 62 29 0a 09 ll? dir-in-db)..
5f70: 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20 28 64 ..(begin.... (d
5f80: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 52 65 ebug:print 2 "Re
5f90: 6d 6f 76 69 6e 67 20 64 69 72 65 63 74 6f 72 79 moving directory
5fa0: 20 77 69 74 68 20 7a 65 72 6f 20 64 62 20 72 65 with zero db re
5fb0: 66 65 72 65 6e 63 65 73 3a 20 22 20 64 69 72 2d ferences: " dir-
5fc0: 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 09 20 20 to-remove)....
5fd0: 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 (system (conc "r
5fe0: 6d 20 2d 72 66 20 22 20 64 69 72 2d 74 6f 2d 72 m -rf " dir-to-r
5ff0: 65 6d 6f 76 65 29 29 0a 09 09 09 20 20 28 68 61 emove)).... (ha
6000: 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 65 21 sh-table-delete!
6010: 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 dirs-to-remove
6020: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 29 0a dir-to-remove)).
6030: 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ...(debug:print
6040: 32 20 22 53 6b 69 70 70 69 6e 67 20 72 65 6d 6f 2 "Skipping remo
6050: 76 61 6c 20 6f 66 20 22 20 64 69 72 2d 74 6f 2d val of " dir-to-
6060: 72 65 6d 6f 76 65 20 22 20 66 6f 72 20 6e 6f 77 remove " for now
6070: 20 61 73 20 69 74 20 73 74 69 6c 6c 20 68 61 73 as it still has
6080: 20 72 65 66 65 72 65 6e 63 65 73 20 69 6e 20 74 references in t
6090: 68 65 20 64 61 74 61 62 61 73 65 22 29 29 29 29 he database"))))
60a0: 29 0a 09 20 20 20 20 28 73 6f 72 74 20 28 68 61 ).. (sort (ha
60b0: 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 64 69 sh-table-keys di
60c0: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 29 20 28 6c rs-to-remove) (l
60d0: 61 6d 62 64 61 20 28 61 20 62 29 28 3e 20 28 73 ambda (a b)(> (s
60e0: 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 61 29 28 tring-length a)(
60f0: 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 62 29 string-length b)
6100: 29 29 29 29 0a 0a 09 20 20 20 3b 3b 20 72 65 6d ))))... ;; rem
6110: 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a ove the run if z
6120: 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e ero tests remain
6130: 0a 09 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 .. (let ((remt
6140: 65 73 74 73 20 28 64 62 2d 67 65 74 2d 74 65 73 ests (db-get-tes
6150: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 ts-for-run db (d
6160: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
6170: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
6180: 20 22 69 64 22 29 20 23 66 20 23 66 20 27 28 29 "id") #f #f '()
6190: 20 27 28 29 29 29 29 0a 09 20 20 20 20 20 28 69 '()))).. (i
61a0: 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 f (null? remtest
61b0: 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 s) ;; no more te
61c0: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 sts remaining...
61d0: 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 (let* ((dparts
61e0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c (string-split l
61f0: 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 asttpath "/"))..
6200: 09 09 28 72 75 6e 70 61 74 68 20 28 63 6f 6e 63 ..(runpath (conc
6210: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
6220: 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 09 20 ersperse ......
6230: 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 (take dparts
6240: 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 (- (length dpart
6250: 73 29 20 31 29 29 0a 09 09 09 09 09 20 20 20 20 s) 1))......
6260: 22 2f 22 29 29 29 29 0a 09 09 20 20 20 28 64 65 "/"))))... (de
6270: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d bug:print 1 "Rem
6280: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e oving run: " run
6290: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d key " " (db:get-
62a0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
62b0: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e run header "runn
62c0: 61 6d 65 22 29 29 0a 09 09 20 20 20 28 64 62 3a ame"))... (db:
62d0: 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 20 72 75 delete-run db ru
62e0: 6e 2d 69 64 29 0a 09 09 20 20 20 3b 3b 20 6e 65 n-id)... ;; ne
62f0: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 ed to figure out
6300: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 the path to the
6310: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d run dir and rem
6320: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a ove it if empty.
6330: 09 09 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 .. ;; (if (
6340: 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e null? (glob (con
6350: 63 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 c runpath "/*"))
6360: 29 0a 09 09 20 20 20 3b 3b 20 20 20 20 20 20 20 )... ;;
6370: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 3b 3b 20 (begin... ;;
6380: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
6390: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 20 64 "Removing run d
63a0: 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a 09 09 ir " runpath)...
63b0: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 ;; . (system
63c0: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 (conc "rmdir -p
63d0: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 " runpath))))...
63e0: 20 20 20 29 29 29 29 0a 09 20 29 29 0a 20 20 20 )))).. )).
63f0: 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d runs)))..;;===
6400: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6420: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6430: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6440: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 ===.;; Routines
6450: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 for manipulating
6460: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d runs.;;========
6470: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6480: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6490: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
64a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a ==============..
64b0: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 ;; Since many ca
64c0: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 lls to a run req
64d0: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 uire pretty much
64e0: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 the same setup
64f0: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 .;; this wrapper
6500: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 is used to redu
6510: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 ce the replicati
6520: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 on of code.(defi
6530: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d ne (general-run-
6540: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 call switchname
6550: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 action-desc proc
6560: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 ). (let ((runna
6570: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 me (args:get-arg
6580: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 ":runname"))..(
6590: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67 target (if (arg
65a0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
65b0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 et")... (arg
65c0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
65d0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 et")... (arg
65e0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
65f0: 61 72 67 22 29 29 29 29 0a 20 20 20 20 28 63 6f arg")))). (co
6600: 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 nd. ((not ta
6610: 72 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 rget). (deb
6620: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
6630: 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 R: Missing requi
6640: 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f red parameter fo
6650: 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 r " switchname "
6660: 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 , you must speci
6670: 66 79 20 74 68 65 20 74 61 72 67 65 74 20 77 69 fy the target wi
6680: 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 th -target").
6690: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 (exit 3)).
66a0: 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 ((not runname)
66b0: 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
66c0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 int 0 "ERROR: Mi
66d0: 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 ssing required p
66e0: 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 arameter for " s
66f0: 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 witchname ", you
6700: 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 must specify th
6710: 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 e run name with
6720: 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 :runname runname
6730: 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 "). (exit 3
6740: 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 )). (else.
6750: 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 (let ((db
6760: 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 #f).. (keys #
6770: 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 f))..(if (not (s
6780: 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 etup-for-run))..
6790: 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 (begin ..
67a0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
67b0: 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 0 "Failed to set
67c0: 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 up, exiting")..
67d0: 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29 0a (exit 1))).
67e0: 09 28 73 65 74 21 20 64 62 20 20 20 28 6f 70 65 .(set! db (ope
67f0: 6e 2d 64 62 29 29 0a 09 28 73 65 74 21 20 6b 65 n-db))..(set! ke
6800: 79 73 20 28 64 62 2d 67 65 74 2d 6b 65 79 73 20 ys (db-get-keys
6810: 64 62 29 29 0a 09 3b 3b 20 68 61 76 65 20 65 6e db))..;; have en
6820: 6f 75 67 68 20 74 6f 20 70 72 6f 63 65 73 73 20 ough to process
6830: 2d 74 61 72 67 65 74 20 6f 72 20 2d 72 65 71 74 -target or -reqt
6840: 61 72 67 20 68 65 72 65 0a 09 28 69 66 20 28 61 arg here..(if (a
6850: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
6860: 71 74 61 72 67 22 29 0a 09 20 20 20 20 28 6c 65 qtarg").. (le
6870: 74 2a 20 28 28 72 75 6e 63 6f 6e 66 69 67 66 20 t* ((runconfigf
6880: 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
6890: 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f "/runconfigs.co
68a0: 6e 66 69 67 22 29 29 20 3b 3b 20 44 4f 20 4e 4f nfig")) ;; DO NO
68b0: 54 20 45 56 41 4c 55 41 54 45 20 41 4c 4c 20 0a T EVALUATE ALL .
68c0: 09 09 20 20 20 28 72 75 6e 63 6f 6e 66 69 67 20 .. (runconfig
68d0: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 72 75 (read-config ru
68e0: 6e 63 6f 6e 66 69 67 66 20 23 66 20 23 66 20 65 nconfigf #f #f e
68f0: 6e 76 69 72 6f 6e 2d 70 61 74 74 3a 20 23 66 29 nviron-patt: #f)
6900: 29 29 20 0a 09 20 20 20 20 20 20 28 69 66 20 28 )) .. (if (
6910: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
6920: 65 66 61 75 6c 74 20 72 75 6e 63 6f 6e 66 69 67 efault runconfig
6930: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6940: 2d 72 65 71 74 61 72 67 22 29 20 23 66 29 0a 09 -reqtarg") #f)..
6950: 09 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d . (keys:target-
6960: 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 61 set-args keys (a
6970: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
6980: 71 74 61 72 67 22 29 20 61 72 67 73 3a 61 72 67 qtarg") args:arg
6990: 2d 68 61 73 68 29 0a 09 09 20 20 28 62 65 67 69 -hash)... (begi
69a0: 6e 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 n... (debug:p
69b0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 5b rint 0 "ERROR: [
69c0: 22 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 " (args:get-arg
69d0: 22 2d 72 65 71 74 61 72 67 22 29 20 22 5d 20 6e "-reqtarg") "] n
69e0: 6f 74 20 66 6f 75 6e 64 20 69 6e 20 22 20 72 75 ot found in " ru
69f0: 6e 63 6f 6e 66 69 67 66 29 0a 09 09 20 20 20 20 nconfigf)...
6a00: 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a (sqlite3:finaliz
6a10: 65 21 20 64 62 29 0a 09 09 20 20 20 20 28 65 78 e! db)... (ex
6a20: 69 74 20 31 29 29 29 29 0a 09 20 20 20 20 28 69 it 1)))).. (i
6a30: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 f (args:get-arg
6a40: 22 2d 74 61 72 67 65 74 22 29 0a 09 09 28 6b 65 "-target")...(ke
6a50: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 ys:target-set-ar
6a60: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 gs keys (args:ge
6a70: 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 20 t-arg "-target"
6a80: 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 20 61 args:arg-hash) a
6a90: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 29 29 0a rgs:arg-hash))).
6aa0: 09 28 69 66 20 28 6e 6f 74 20 28 63 61 72 20 2a .(if (not (car *
6ab0: 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 0a 09 20 configinfo*))..
6ac0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 (begin..
6ad0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
6ae0: 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 70 74 65 "ERROR: Attempte
6af0: 64 20 74 6f 20 22 20 61 63 74 69 6f 6e 2d 64 65 d to " action-de
6b00: 73 63 20 22 20 62 75 74 20 72 75 6e 20 61 72 65 sc " but run are
6b10: 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 20 6e 6f a config file no
6b20: 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 20 20 20 t found")..
6b30: 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 20 20 (exit 1))..
6b40: 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 74 20 73 ;; Extract out s
6b50: 74 75 66 66 20 6e 65 65 64 65 64 20 69 6e 20 6d tuff needed in m
6b60: 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 61 6c 6c ost or many call
6b70: 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 65 20 74 s.. ;; here t
6b80: 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 0a 09 20 hen call proc..
6b90: 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 6e 61 (let* ((keyna
6ba0: 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 79 3a 67 mes (map key:g
6bb0: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 et-fieldname key
6bc0: 73 29 29 0a 09 09 20 20 20 28 6b 65 79 76 61 6c s))... (keyval
6bd0: 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 61 6c 6c lst (keys->vall
6be0: 69 73 74 20 6b 65 79 73 20 23 74 29 29 29 0a 09 ist keys #t)))..
6bf0: 20 20 20 20 20 20 28 70 72 6f 63 20 64 62 20 74 (proc db t
6c00: 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 arget runname ke
6c10: 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 ys keynames keyv
6c20: 61 6c 6c 73 74 29 29 29 0a 09 28 73 71 6c 69 74 allst)))..(sqlit
6c30: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 e3:finalize! db)
6c40: 0a 09 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 ..(set! *didsome
6c50: 74 68 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a thing* #t)))))).
6c60: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
6c70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6c80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6c90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ca0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c =========.;; Rol
6cb0: 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d lup runs.;;=====
6cc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6cd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ce0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6cf0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d00: 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 =..;; Update the
6d10: 20 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 test_meta table
6d20: 20 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 for this test.(
6d30: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 define (runs:upd
6d40: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 ate-test_meta db
6d50: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
6d60: 63 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 conf). (let ((c
6d70: 75 72 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 urrrecord (db:te
6d80: 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 stmeta-get-recor
6d90: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 d db test-name))
6da0: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 ). (if (not c
6db0: 75 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 urrrecord)..(beg
6dc0: 69 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 in.. (set! curr
6dd0: 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 record (make-vec
6de0: 74 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 tor 10 #f)).. (
6df0: 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d db:testmeta-add-
6e00: 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e record db test-n
6e10: 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d ame))). (for-
6e20: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 each . (lamb
6e30: 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 da (key).
6e40: 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 (let* ((idx (cad
6e50: 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 r key)).. (
6e60: 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a fld (car key)).
6e70: 09 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e . (val (con
6e80: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d fig-lookup test-
6e90: 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 conf "test_meta"
6ea0: 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 fld))).. ;; (de
6eb0: 62 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 bug:print 5 "idx
6ec0: 3a 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 : " idx " fld: "
6ed0: 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 fld " val: " va
6ee0: 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 l).. (if (and va
6ef0: 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 l (not (equal? (
6f00: 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 vector-ref currr
6f10: 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 ecord idx) val))
6f20: 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 ).. (begin..
6f30: 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 (print "U
6f40: 70 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e pdating " test-n
6f50: 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f ame " " fld " to
6f60: 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 " val)..
6f70: 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 (db:testmeta-upd
6f80: 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 ate-field db tes
6f90: 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 t-name fld val))
6fa0: 29 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 ))). '(("aut
6fb0: 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 hor" 2)("owner"
6fc0: 33 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 3)("description"
6fd0: 20 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35 4)("reviewed" 5
6fe0: 29 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a )("tags" 9))))).
6ff0: 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f .;; Update test_
7000: 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 meta for all tes
7010: 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 ts.(define (runs
7020: 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 :update-all-test
7030: 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 _meta db). (let
7040: 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 ((test-names (g
7050: 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 et-all-legal-tes
7060: 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 ts))). (for-e
7070: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 ach . (lambd
7080: 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 a (test-name).
7090: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 (let* ((tes
70a0: 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 t-path (conc
70b0: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 *toppath* "/test
70c0: 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a s/" test-name)).
70d0: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e . (test-con
70e0: 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d figf (conc test-
70f0: 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 path "/testconfi
7100: 67 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 g")).. (tes
7110: 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 texists (and (
7120: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 file-exists? tes
7130: 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d t-configf)(file-
7140: 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 read-access? tes
7150: 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 t-configf)))..
7160: 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 ;; read conf
7170: 69 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 igs with tricks
7180: 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e turned off (i.e.
7190: 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 no system)..
71a0: 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 (test-conf
71b0: 20 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 (if testexists
71c0: 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 (read-config tes
71d0: 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 t-configf #f #f)
71e0: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 (make-hash-table
71f0: 29 29 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 )))).. (runs:upd
7200: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 ate-test_meta db
7210: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
7220: 63 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 conf))). tes
7230: 74 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 t-names)))..;; T
7240: 68 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 his could probab
7250: 6c 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 ly be refactored
7260: 20 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 into one comple
7270: 78 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 x query ....(def
7280: 69 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 ine (runs:rollup
7290: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 -run db keys key
72a0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 vallst runname u
72b0: 73 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 ser) ;; was targ
72c0: 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 et, now keyvalls
72d0: 74 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 t. (debug:print
72e0: 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 4 "runs:rollup-
72f0: 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 run, keys: " key
7300: 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 s " keyvallst: "
7310: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 keyvallst " :ru
7320: 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 nname " runname
7330: 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a " user: " user).
7340: 20 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 (let* (; (keyv
7350: 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 alllst (key
7360: 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c s:target->keyval
7370: 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 keys target))..
7380: 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 (new-run-id
7390: 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 (runs:register
73a0: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 -run db keys key
73b0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 vallst runname "
73c0: 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 new" "n/a" user)
73d0: 29 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 ).. (prev-tests
73e0: 20 20 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d (test:get-m
73f0: 61 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 atching-previous
7400: 2d 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 -test-run-record
7410: 73 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 s db new-run-id
7420: 22 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 "%" "%")).. (cur
7430: 72 2d 74 65 73 74 73 20 20 20 20 20 20 28 64 62 r-tests (db
7440: 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 -get-tests-for-r
7450: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
7460: 20 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29 "%" "%" '() '()
7470: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 )).. (curr-tests
7480: 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 -hash (make-hash
7490: 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 -table))). (d
74a0: 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 b:update-run-eve
74b0: 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 nt_time db new-r
74c0: 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e un-id). ;; in
74d0: 64 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 dex the already
74e0: 73 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 saved tests by t
74f0: 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d estname and item
7500: 64 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 dat in curr-test
7510: 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d s-hash. (for-
7520: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 each. (lambd
7530: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 a (testdat).
7540: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e (let* ((testn
7550: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ame (db:test-ge
7560: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 t-testname testd
7570: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 at)).. (ite
7580: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
7590: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
75a0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
75b0: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 full-name (conc
75c0: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 testname "/" ite
75d0: 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 m-path))).. (has
75e0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
75f0: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
7600: 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 l-name testdat))
7610: 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 ). curr-test
7620: 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 s). ;; NOPE:
7630: 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 Non-optimal appr
7640: 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 oach. Try this i
7650: 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 nstead.. ;;
7660: 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 1. tests are re
7670: 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 ceived in a list
7680: 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 , most recent fi
7690: 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 rst. ;; 2.
76a0: 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c replace the roll
76b0: 75 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 up test with the
76c0: 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 new *always*.
76d0: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
76e0: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 (lambda (testd
76f0: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a at). (let*
7700: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 ((testname (db
7710: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
7720: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 me testdat))..
7730: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 (item-path (
7740: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
7750: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a -path testdat)).
7760: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d . (full-nam
7770: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 e (conc testname
7780: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
7790: 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 .. (prev-te
77a0: 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 st-dat (hash-tab
77b0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 le-ref/default c
77c0: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 urr-tests-hash f
77d0: 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 ull-name #f))..
77e0: 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 (test-steps
77f0: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 (db:get-st
7800: 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 eps-for-test db
7810: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
7820: 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 testdat)))..
7830: 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f (new-test-reco
7840: 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 rd #f)).. ;; rep
7850: 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 lace these with
7860: 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 insert ... selec
7870: 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 t.. (apply sqlit
7880: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 e3:execute ...db
7890: 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 ...(conc "INSER
78a0: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
78b0: 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c O tests (run_id,
78c0: 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 testname,state,s
78d0: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 tatus,event_time
78e0: 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 ,host,cpuload,di
78f0: 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e skfree,uname,run
7900: 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 dir,item_path,ru
7910: 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c n_duration,final
7920: 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 _logf,comment) "
7930: 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 ... "VALUES
7940: 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c (?,?,?,?,?,?,?,
7950: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 ?,?,?,?,?,?,?);"
7960: 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 )...new-run-id (
7970: 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 cddr (vector->li
7980: 73 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 st testdat)))..
7990: 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 (set! new-testda
79a0: 74 20 28 63 61 72 20 28 64 62 2d 67 65 74 2d 74 t (car (db-get-t
79b0: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ests-for-run db
79c0: 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 6e new-run-id testn
79d0: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 28 ame item-path '(
79e0: 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 68 ) '()))).. (hash
79f0: 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 72 -table-set! curr
7a00: 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c -tests-hash full
7a10: 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 61 -name new-testda
7a20: 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c 64 t) ;; this could
7a30: 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 77 be confusing, w
7a40: 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f 75 hich record shou
7a50: 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 6c ld go into the l
7a60: 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 3b ookup table?.. ;
7a70: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 ; Now duplicate
7a80: 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a 09 the test steps..
7a90: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
7aa0: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 "Copying records
7ab0: 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 66 in test_steps f
7ac0: 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 rom test_id=" (d
7ad0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
7ae0: 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 stdat) " to " (d
7af0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 b:test-get-id ne
7b00: 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 w-testdat)).. (s
7b10: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a qlite3:execute .
7b20: 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 . db .. (conc
7b30: 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 "INSERT OR REPLA
7b40: 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 65 CE INTO test_ste
7b50: 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 70 ps (test_id,step
7b60: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
7b70: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d s,event_time,com
7b80: 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 ment) "..."SELEC
7b90: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 T " (db:test-get
7ba0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
7bb0: 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 ",stepname,stat
7bc0: 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 e,status,event_t
7bd0: 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d ime,comment FROM
7be0: 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 52 test_steps WHER
7bf0: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 E test_id=?;")..
7c00: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 (db:test-get-i
7c10: 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b 3b d testdat)).. ;;
7c20: 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 Now duplicate t
7c30: 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 28 he test data.. (
7c40: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 debug:print 4 "C
7c50: 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 opying records i
7c60: 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d n test_data from
7c70: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 test_id=" (db:t
7c80: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
7c90: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 at) " to " (db:t
7ca0: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 est-get-id new-t
7cb0: 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 estdat)).. (sqli
7cc0: 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 te3:execute ..
7cd0: 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e db .. (conc "IN
7ce0: 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 SERT OR REPLACE
7cf0: 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 28 INTO test_data (
7d00: 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 79 test_id,category
7d10: 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c ,variable,value,
7d20: 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 expected,tol,uni
7d30: 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 ts,comment) "...
7d40: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 "SELECT " (db:te
7d50: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
7d60: 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 stdat) ",categor
7d70: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 y,variable,value
7d80: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e ,expected,tol,un
7d90: 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d its,comment FROM
7da0: 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 test_data WHERE
7db0: 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 test_id=?;")..
7dc0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
7dd0: 20 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 0a testdat)).. )).
7de0: 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 29 prev-tests)
7df0: 29 29 0a 09 20 0a 20 20 20 20 20 0a )).. . .