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: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 ))..(define (set
0b70: 2d 69 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 -item-env-vars i
0b80: 74 65 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 temdat). (for-e
0b90: 61 63 68 20 28 6c 61 6d 62 64 61 20 28 69 74 65 ach (lambda (ite
0ba0: 6d 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 m).. (debug
0bb0: 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 :print 2 "setenv
0bc0: 20 22 20 28 63 61 72 20 69 74 65 6d 29 20 22 20 " (car item) "
0bd0: 22 20 28 63 61 64 72 20 69 74 65 6d 29 29 0a 09 " (cadr item))..
0be0: 20 20 20 20 20 20 28 73 65 74 65 6e 76 20 28 63 (setenv (c
0bf0: 61 72 20 69 74 65 6d 29 20 28 63 61 64 72 20 69 ar item) (cadr i
0c00: 74 65 6d 29 29 29 0a 09 20 20 20 20 69 74 65 6d tem))).. item
0c10: 64 61 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 dat))..(define (
0c20: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
0c30: 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d e-tests db test-
0c40: 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74 2a 20 record). (let*
0c50: 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20 20 20 ((tconfig
0c60: 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 73 (tests
0c70: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
0c80: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 estconfig test-r
0c90: 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 ecord)).. (jobgr
0ca0: 6f 75 70 20 20 20 20 20 20 20 20 20 20 20 20 20 oup
0cb0: 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 (config-looku
0cc0: 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69 p tconfig "requi
0cd0: 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f rements" "jobgro
0ce0: 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e up")).. (num-run
0cf0: 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 ning
0d00: 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 (db:get-count-t
0d10: 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 ests-running db)
0d20: 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 ).. (num-running
0d30: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 64 62 -in-jobgroup (db
0d40: 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 :get-count-tests
0d50: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 -running-in-jobg
0d60: 72 6f 75 70 20 64 62 20 6a 6f 62 67 72 6f 75 70 roup db jobgroup
0d70: 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 72 )).. (max-concur
0d80: 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 63 rent-jobs (c
0d90: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f onfig-lookup *co
0da0: 6e 66 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 nfigdat* "setup"
0db0: 20 20 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 "max_concur
0dc0: 72 65 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 20 28 rent_jobs")).. (
0dd0: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 job-group-limit
0de0: 20 20 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d (config-
0df0: 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 lookup *configda
0e00: 74 2a 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a t* "jobgroups" j
0e10: 6f 62 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 obgroup))). (
0e20: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d debug:print 2 "m
0e30: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0e40: 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 bs: " max-concur
0e50: 72 65 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d rent-jobs ", num
0e60: 2d 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d -running: " num-
0e70: 72 75 6e 6e 69 6e 67 29 0a 20 20 20 20 28 69 66 running). (if
0e80: 20 28 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c (not (eq? 0 *gl
0e90: 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 obalexitstatus*)
0ea0: 29 0a 09 23 66 0a 09 28 6c 65 74 20 28 28 63 61 )..#f..(let ((ca
0eb0: 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 n-not-run-more (
0ec0: 63 6f 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 cond..... ;; if
0ed0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
0ee0: 6f 62 73 20 69 73 20 73 65 74 20 61 6e 64 20 74 obs is set and t
0ef0: 68 65 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e he number runnin
0f00: 67 20 69 73 20 67 72 65 61 74 65 72 20 0a 09 09 g is greater ...
0f10: 09 09 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 .. ;; than it th
0f20: 61 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f an cannot run mo
0f30: 72 65 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 re jobs..... ((a
0f40: 6e 64 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e nd max-concurren
0f50: 74 2d 6a 6f 62 73 0a 09 09 09 09 20 20 20 20 20 t-jobs.....
0f60: 20 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 (string->numbe
0f70: 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 r max-concurrent
0f80: 2d 6a 6f 62 73 29 0a 09 09 09 09 20 20 20 20 20 -jobs).....
0f90: 20 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e (>= num-runnin
0fa0: 67 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 g (string->numbe
0fb0: 72 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 r max-concurrent
0fc0: 2d 6a 6f 62 73 29 29 29 0a 09 09 09 09 20 20 28 -jobs)))..... (
0fd0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
0fe0: 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e ARNING: Max runn
0ff0: 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 ing jobs exceede
1000: 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 d, current numbe
1010: 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d r running: " num
1020: 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 -running ......
1030: 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e ", max_con
1040: 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 current_jobs: "
1050: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
1060: 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 obs)..... #t)..
1070: 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 ... ;; if job-gr
1080: 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 oup-limit is set
1090: 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a and number of j
10a0: 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 obs in the group
10b0: 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 is greater.....
10c0: 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d ;; than the lim
10d0: 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 it then cannot r
10e0: 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 un more jobs of
10f0: 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 this kind..... (
1100: 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c (and job-group-l
1110: 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 imit.....
1120: 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d (>= num-running-
1130: 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d in-jobgroup job-
1140: 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 group-limit))...
1150: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
1160: 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 1 "WARNING: num
1170: 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 ber of jobs " nu
1180: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 m-running-in-job
1190: 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 group ......
11a0: 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f " in " jobgro
11b0: 75 70 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 up " exceeded, w
11c0: 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 ill not run " (t
11d0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
11e0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
11f0: 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 -record)).....
1200: 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 #t)..... (else #
1210: 66 29 29 29 29 0a 09 20 20 28 6e 6f 74 20 63 61 f)))).. (not ca
1220: 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29 29 n-not-run-more))
1230: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
1240: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
1280: 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 New methodology
1290: 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65 73 . These routines
12a0: 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 will replace th
12b0: 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e e above in time.
12c0: 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 For.;; now the
12d0: 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61 74 code is duplicat
12e0: 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20 69 ed. This stuff i
12f0: 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 s initially used
1300: 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a in the monitor.
1310: 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b ;; based code..;
1320: 3b 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 3d 0a 0a 3b 3b 20 72 65 67 69 =======..;; regi
1370: 73 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 ster a test run
1380: 77 69 74 68 20 74 68 65 20 64 62 0a 28 64 65 66 with the db.(def
1390: 69 6e 65 20 28 72 75 6e 73 3a 72 65 67 69 73 74 ine (runs:regist
13a0: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b er-run db keys k
13b0: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 eyvallst runname
13c0: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73 state status us
13d0: 65 72 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 er). (debug:pri
13e0: 6e 74 20 33 20 22 72 75 6e 73 3a 72 65 67 69 73 nt 3 "runs:regis
13f0: 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 ter-run, keys: "
1400: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 keys " keyvalls
1410: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 t: " keyvallst "
1420: 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e runname: " runn
1430: 61 6d 65 20 22 20 73 74 61 74 65 3a 20 22 20 73 ame " state: " s
1440: 74 61 74 65 20 22 20 73 74 61 74 75 73 3a 20 22 tate " status: "
1450: 20 73 74 61 74 75 73 20 22 20 75 73 65 72 3a 20 status " user:
1460: 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 " user). (let*
1470: 28 28 6b 65 79 73 74 72 20 20 20 20 28 6b 65 79 ((keystr (key
1480: 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 29 s->keystr keys))
1490: 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 .. (comma (i
14a0: 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 f (> (length key
14b0: 73 29 20 30 29 20 22 2c 22 20 22 22 29 29 0a 09 s) 0) "," ""))..
14c0: 20 28 61 6e 64 73 74 72 20 20 20 20 28 69 66 20 (andstr (if
14d0: 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 (> (length keys)
14e0: 20 30 29 20 22 20 41 4e 44 20 22 20 22 22 29 29 0) " AND " ""))
14f0: 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b .. (valslots (k
1500: 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 eys->valslots ke
1510: 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e ys)) ;; ?,?,? ..
1520: 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20 28 ... (keyvals (
1530: 6d 61 70 20 63 61 64 72 20 6b 65 79 76 61 6c 6c map cadr keyvall
1540: 73 74 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 st)).. (allvals
1550: 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 (append (list
1560: 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 runname state st
1570: 61 74 75 73 20 75 73 65 72 29 20 6b 65 79 76 61 atus user) keyva
1580: 6c 73 29 29 0a 09 20 28 71 72 79 76 61 6c 73 20 ls)).. (qryvals
1590: 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 (append (list
15a0: 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 runname) keyvals
15b0: 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 )).. (key=?str
15c0: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
15d0: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 rse (map (lambda
15e0: 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 (k)(conc (key:g
15f0: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 et-fieldname k)
1600: 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 20 41 "=?")) keys) " A
1610: 4e 44 20 22 29 29 29 0a 20 20 20 20 28 64 65 62 ND "))). (deb
1620: 75 67 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 73 ug:print 3 "keys
1630: 3a 20 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 : " keys " allva
1640: 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 ls: " allvals "
1650: 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 keyvals: " keyva
1660: 6c 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ls). (debug:p
1670: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 rint 2 "NOTE: us
1680: 69 6e 67 20 74 61 72 67 65 74 20 22 20 28 73 74 ing target " (st
1690: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
16a0: 20 6b 65 79 76 61 6c 73 20 22 2f 22 29 20 22 20 keyvals "/") "
16b0: 66 6f 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 for this run").
16c0: 20 20 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e (if (and runn
16d0: 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 ame (null? (filt
16e0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e er (lambda (x)(n
16f0: 6f 74 20 78 29 29 20 6b 65 79 76 61 6c 73 29 29 ot x)) keyvals))
1700: 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 ) ;; there must
1710: 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20 be a better way
1720: 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 to "apply and"..
1730: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a (let ((res #f)).
1740: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 . (apply sqlite
1750: 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 3:execute db (co
1760: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 nc "INSERT OR IG
1770: 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 NORE INTO runs (
1780: 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 runname,state,st
1790: 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 atus,owner,event
17a0: 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 _time" comma key
17b0: 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f str ") VALUES (?
17c0: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 ,?,?,?,strftime(
17d0: 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d '%s','now')" com
17e0: 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 ma valslots ");"
17f0: 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 )... allvals)..
1800: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
1810: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 for-each-row ..
1820: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 (lambda (id)..
1830: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69 (set! res i
1840: 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 d)).. db.. (
1850: 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 let ((qry (conc
1860: 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 "SELECT id FROM
1870: 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e runs WHERE (runn
1880: 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b ame=? " andstr k
1890: 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a ey=?str ");"))).
18a0: 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 . ;(debug:pr
18b0: 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 int 4 "qry: " qr
18c0: 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 y) .. qry)..
18d0: 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 qryvals).. (
18e0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
18f0: 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 db "UPDATE runs
1900: 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 SET state=?,stat
1910: 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b us=? WHERE id=?;
1920: 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 " state status r
1930: 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 es).. res) ..(b
1940: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 egin.. (debug:p
1950: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 rint 0 "ERROR: C
1960: 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c alled without al
1970: 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 l necessary keys
1980: 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b ").. #f))))..;;
1990: 20 54 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 This is a dupli
19a0: 63 61 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 cate of run-test
19b0: 73 20 28 77 68 69 63 68 20 68 61 73 20 62 65 65 s (which has bee
19c0: 6e 20 64 65 70 72 65 63 61 74 65 64 29 2e 20 55 n deprecated). U
19d0: 73 65 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 se this one inst
19e0: 65 61 64 20 6f 66 20 72 75 6e 20 74 65 73 74 73 ead of run tests
19f0: 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 65 ..;; keyvals.(de
1a00: 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 fine (runs:run-t
1a10: 65 73 74 73 20 64 62 20 74 61 72 67 65 74 20 72 ests db target r
1a20: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 74 unname test-patt
1a30: 73 20 69 74 65 6d 2d 70 61 74 74 73 20 75 73 65 s item-patts use
1a40: 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a r flags). (let*
1a50: 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 ((keys (
1a60: 64 62 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db-get-keys db))
1a70: 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 .. (keyvallst
1a80: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 (keys:target->ke
1a90: 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 yval keys target
1aa0: 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 )).. (run-id
1ab0: 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 (runs:register
1ac0: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 -run db keys key
1ad0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 vallst runname "
1ae0: 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 new" "n/a" user)
1af0: 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 ) ;; test-name
1b00: 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 ))).. (deferred
1b10: 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 '()) ;; delay
1b20: 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 running these s
1b30: 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 ince they have a
1b40: 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 waiton clause..
1b50: 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 ;; keepgoing is
1b60: 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 the defacto mod
1b70: 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 ality now, will
1b80: 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 add hit-n-run a
1b90: 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 bit later.. ;; (
1ba0: 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 keepgoing (has
1bb0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
1bc0: 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 ult flags "-keep
1bd0: 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 going" #f)).. (t
1be0: 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a est-names '()).
1bf0: 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 . (runconfigf
1c00: 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
1c10: 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f "/runconfigs.co
1c20: 6e 66 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 nfig")).. (requi
1c30: 72 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a 09 red-tests '())..
1c40: 20 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20 28 (test-records (
1c50: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
1c60: 29 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 )).. (set-meg
1c70: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 atest-env-vars d
1c80: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 b run-id) ;; the
1c90: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 se may be needed
1ca0: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e by the launchin
1cb0: 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 g process.. (
1cc0: 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f if (file-exists?
1cd0: 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 runconfigf)..(s
1ce0: 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 etup-env-default
1cf0: 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 s db runconfigf
1d00: 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d run-id *already-
1d10: 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 seen-runconfig-i
1d20: 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 nfo* "pre-launch
1d30: 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 -env-vars")..(de
1d40: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
1d50: 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 NING: You do not
1d60: 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 have a run conf
1d70: 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f ig file: " runco
1d80: 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 nfigf)). .
1d90: 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 ;; look up all
1da0: 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 tests matching t
1db0: 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 he comma separat
1dc0: 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 ed list of globs
1dd0: 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d in. ;; test-
1de0: 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 patts (using % a
1df0: 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 s wildcard).
1e00: 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 (for-each .
1e10: 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 (lambda (patt).
1e20: 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 (let ((tes
1e30: 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a ts (glob (conc *
1e40: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
1e50: 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 /" (string-trans
1e60: 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a late patt "%" "*
1e70: 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 "))))).. (set! t
1e80: 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 ests (filter (la
1e90: 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 mbda (test)(file
1ea0: 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 -exists? (conc t
1eb0: 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 est "/testconfig
1ec0: 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 "))) tests)).. (
1ed0: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 set! test-names
1ee0: 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d (append test-nam
1ef0: 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 es ..... (map (
1f00: 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 lambda (testp)..
1f10: 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 .... (last (stri
1f20: 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 ng-split testp "
1f30: 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 /"))).....
1f40: 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 tests))))).
1f50: 20 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 (if test-patts
1f60: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 (string-split te
1f70: 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 st-patts ",")(li
1f80: 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 st "%")))..
1f90: 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 ;; now remove du
1fa0: 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 plicates. (se
1fb0: 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 t! test-names (d
1fc0: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 elete-duplicates
1fd0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 test-names))..
1fe0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
1ff0: 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 0 "INFO: test na
2000: 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 mes " test-names
2010: 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 ).. ;; on the
2020: 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 first pass or c
2030: 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 all to run-tests
2040: 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f set FAILS to NO
2050: 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 T_STARTED if.
2060: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 ;; -keepgoing i
2070: 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 s specified.
2080: 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 (if (eq? *passnu
2090: 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 m* 0)..(begin..
20a0: 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 ;; have to dele
20b0: 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 te test records
20c0: 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 where NOT_STARTE
20d0: 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e D since they can
20e0: 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e cause -keepgoin
20f0: 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 g to .. ;; get
2100: 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 stuck due to bec
2110: 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 oming inaccessib
2120: 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 le from a failed
2130: 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 test. I.e. if t
2140: 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 est B depends ..
2150: 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 ;; on test A b
2160: 75 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 ut test B reache
2170: 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 d the point on b
2180: 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 eing registered
2190: 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 as NOT_STARTED a
21a0: 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 nd test.. ;; A
21b0: 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 failed for some
21c0: 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 reason then on r
21d0: 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 e-run using -kee
21e0: 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 pgoing the run c
21f0: 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 an never complet
2200: 65 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 e... (db:delete
2210: 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 -tests-in-state
2220: 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 db run-id "NOT_S
2230: 54 41 52 54 45 44 22 29 0a 09 20 20 28 64 62 3a TARTED").. (db:
2240: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d set-tests-state-
2250: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 status db run-id
2260: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 test-names #f "
2270: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 FAIL" "NOT_START
2280: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 ED" "FAIL")))..
2290: 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f ;; now add no
22a0: 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 n-directly refer
22b0: 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 enced dependenci
22c0: 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 es (i.e. waiton)
22d0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
22e0: 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 ull? test-names)
22f0: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 )..(let loop ((h
2300: 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d ed (car test-nam
2310: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 es))... (tal (
2320: 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 cdr test-names))
2330: 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 ) ;; 're
2340: 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 turn-procs tells
2350: 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 the config read
2360: 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 er to prep runni
2370: 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 ng system but re
2380: 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 turn a proc.. (
2390: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 let* ((config (
23a0: 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e test:get-testcon
23b0: 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d fig hed 'return-
23c0: 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74 procs))... (wait
23d0: 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ons (string-spli
23e0: 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 t (let ((w (conf
23f0: 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 ig-lookup config
2400: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 "requirements"
2410: 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 09 "waiton"))).....
2420: 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29 . (if w w "")))
2430: 29 29 0a 3b 3b 09 09 20 28 69 74 65 6d 73 20 20 )).;;.. (items
2440: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d (items:get-item
2450: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f s-from-config co
2460: 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 nfig))).. (if
2470: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c (not (hash-tabl
2480: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 e-ref/default te
2490: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 st-records hed #
24a0: 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c f))...(hash-tabl
24b0: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f e-set! test-reco
24c0: 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 rds..... hed (ve
24d0: 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 ctor hed ;;
24e0: 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 0...... conf
24f0: 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 ig ;; 1......
2500: 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a waitons ;; 2.
2510: 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 ..... (confi
2520: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 g-lookup config
2530: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 "requirements" "
2540: 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b priority") ;
2550: 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 ; priority 3....
2560: 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 .. (let ((it
2570: 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 ems (hash-t
2580: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
2590: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 config "items"
25a0: 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a #f)) ;; items 4.
25b0: 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 ...... (itemst
25c0: 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 able (hash-table
25d0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e -ref/default con
25e0: 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 fig "itemstable"
25f0: 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 #f))) ......
2600: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 ;; if either
2610: 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 items or items
2620: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 table is a proc
2630: 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 return it so tes
2640: 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 t running......
2650: 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 ;; process
2660: 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c can know to cal
2670: 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d l items:get-item
2680: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 s-from-config...
2690: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 ... ;; if
26a0: 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 either is a list
26b0: 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 and none is a p
26c0: 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 roc go ahead and
26d0: 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a call get-items.
26e0: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f ..... ;; o
26f0: 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 therwise return
2700: 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 #f - this is not
2710: 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 an iterated tes
2720: 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63 t...... (c
2730: 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 ond.......((proc
2740: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 edure? items)
2750: 20 20 20 69 74 65 6d 73 29 20 20 20 20 20 20 20 items)
2760: 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 ;; calc lat
2770: 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 er.......((proce
2780: 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 dure? itemstable
2790: 29 20 69 74 65 6d 73 74 61 62 6c 65 29 20 20 20 ) itemstable)
27a0: 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 ;; calc late
27b0: 72 0a 09 09 09 09 09 09 28 28 6f 72 20 28 6c 69 r.......((or (li
27c0: 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 3f st? items)(list?
27d0: 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b itemstable)) ;;
27e0: 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 calc now.......
27f0: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d (items:get-item
2800: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f s-from-config co
2810: 6e 66 69 67 29 29 0a 09 09 09 09 09 09 28 65 6c nfig)).......(el
2820: 73 65 20 23 66 29 29 29 20 20 20 20 20 20 20 20 se #f)))
2830: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2840: 20 20 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74 ;; not iterat
2850: 65 64 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 ed...... #f
2860: 20 20 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 74 ;; itemsdat
2870: 20 35 0a 09 09 09 09 09 20 20 20 20 20 3b 3b 20 5...... ;;
2880: 23 66 20 20 20 20 20 20 3b 3b 20 73 70 61 72 65 #f ;; spare
2890: 0a 09 09 09 09 09 20 20 20 20 20 29 29 29 0a 09 ...... )))..
28a0: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 (for-each ..
28b0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 77 61 (lambda (wa
28c0: 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 20 28 69 iton).. (i
28d0: 66 20 28 61 6e 64 20 77 61 69 74 6f 6e 20 28 6e f (and waiton (n
28e0: 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 69 74 6f ot (member waito
28f0: 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a n test-names))).
2900: 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 .. (begin...
2910: 20 20 20 28 73 65 74 21 20 72 65 71 75 69 72 65 (set! require
2920: 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 20 77 61 d-tests (cons wa
2930: 69 74 6f 6e 20 72 65 71 75 69 72 65 64 2d 74 65 iton required-te
2940: 73 74 73 29 29 0a 09 09 20 20 20 20 20 28 73 65 sts))... (se
2950: 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 61 t! test-names (a
2960: 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65 73 ppend test-names
2970: 20 28 6c 69 73 74 20 77 61 69 74 6f 6e 29 29 29 (list waiton)))
2980: 29 29 29 0a 09 20 20 20 20 20 77 61 69 74 6f 6e ))).. waiton
2990: 73 29 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 s).. (let ((r
29a0: 65 6d 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d emtests (delete-
29b0: 64 75 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 duplicates (appe
29c0: 6e 64 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 nd waitons tal))
29d0: 29 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e )).. (if (n
29e0: 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 ot (null? remtes
29f0: 74 73 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 ts))... (loop (
2a00: 63 61 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 car remtests)(cd
2a10: 72 20 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 r remtests))))))
2a20: 29 0a 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 ).. (if (not
2a30: 28 6e 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d (null? required-
2a40: 74 65 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a tests))..(debug:
2a50: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 print 1 "INFO: A
2a60: 64 64 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 dding " required
2a70: 2d 74 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 -tests " to the
2a80: 72 75 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 run queue")).
2a90: 20 3b 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 ;; NOTE: these
2aa0: 61 72 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 are all parent t
2ab0: 65 73 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 ests, items are
2ac0: 6e 6f 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 not expanded yet
2ad0: 2e 0a 20 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d .. (runs:run-
2ae0: 74 65 73 74 73 2d 71 75 65 75 65 20 64 62 20 72 tests-queue db r
2af0: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 un-id runname te
2b00: 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 st-records keyva
2b10: 6c 6c 73 74 20 66 6c 61 67 73 29 29 29 0a 0a 28 llst flags)))..(
2b20: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e define (runs:run
2b30: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 64 62 20 -tests-queue db
2b40: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 run-id runname t
2b50: 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 est-records keyv
2b60: 61 6c 6c 73 74 20 66 6c 61 67 73 29 0a 20 20 20 allst flags).
2b70: 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e ;; At this poin
2b80: 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70 61 t the list of pa
2b90: 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65 78 rent tests is ex
2ba0: 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e panded . ;; N
2bb0: 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 6e B// Should expan
2bc0: 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e 64 d items here and
2bd0: 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 then insert int
2be0: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 2e o the run queue.
2bf0: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
2c00: 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 5 "test-records:
2c10: 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 " test-records
2c20: 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 ", keyvallst: "
2c30: 6b 65 79 76 61 6c 6c 73 74 29 0a 20 20 28 6c 65 keyvallst). (le
2c40: 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73 74 2d t ((sorted-test-
2c50: 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73 6f 72 names (tests:sor
2c60: 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e t-by-priority-an
2c70: 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 d-waiton test-re
2c80: 63 6f 72 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 cords))..(item-p
2c90: 61 74 74 73 20 20 20 20 20 20 20 20 28 68 61 73 atts (has
2ca0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
2cb0: 75 6c 74 20 66 6c 61 67 73 20 22 2d 69 74 65 6d ult flags "-item
2cc0: 70 61 74 74 22 20 23 66 29 29 29 0a 20 20 20 20 patt" #f))).
2cd0: 28 6c 65 74 20 6c 6f 6f 70 20 28 3b 20 28 6e 75 (let loop (; (nu
2ce0: 6d 74 69 6d 65 73 20 30 29 20 3b 3b 20 73 68 6f mtimes 0) ;; sho
2cf0: 75 6c 64 6e 27 74 20 6e 65 65 64 20 74 68 69 73 uldn't need this
2d00: 0a 09 20 20 20 20 20 20 20 28 68 65 64 20 20 20 .. (hed
2d10: 20 20 20 20 20 20 28 63 61 72 20 73 6f 72 74 65 (car sorte
2d20: 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 d-test-names))..
2d30: 20 20 20 20 20 20 20 28 74 61 6c 20 20 20 20 20 (tal
2d40: 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 2d (cdr sorted-
2d50: 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 20 20 test-names))).
2d60: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 (let* ((test
2d70: 2d 72 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 -record (hash-ta
2d80: 62 6c 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 ble-ref test-rec
2d90: 6f 72 64 73 20 68 65 64 29 29 0a 09 20 20 20 20 ords hed))..
2da0: 20 28 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74 (tconfig (t
2db0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
2dc0: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 et-testconfig te
2dd0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 20 st-record))..
2de0: 20 20 28 77 61 69 74 6f 6e 73 20 20 20 20 20 28 (waitons (
2df0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
2e00: 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 get-waitons t
2e10: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 20 est-record))..
2e20: 20 20 20 28 70 72 69 6f 72 69 74 79 20 20 20 20 (priority
2e30: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
2e40: 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 20 20 20 -get-priority
2e50: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
2e60: 20 20 20 20 28 69 74 65 6d 64 61 74 20 20 20 20 (itemdat
2e70: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
2e80: 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 e-get-itemdat
2e90: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
2ea0: 20 20 20 20 20 28 69 74 65 6d 73 20 20 20 20 20 (items
2eb0: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
2ec0: 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20 ue-get-items
2ed0: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
2ee0: 09 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 . (item-path
2ef0: 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 (item-list->p
2f00: 61 74 68 20 69 74 65 6d 64 61 74 29 29 29 0a 09 ath itemdat)))..
2f10: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 (debug:print 6..
2f20: 09 20 20 20 20 20 22 69 74 65 6d 64 61 74 3a 20 . "itemdat:
2f30: 20 20 20 20 22 20 69 74 65 6d 64 61 74 0a 09 09 " itemdat...
2f40: 20 20 20 20 20 22 5c 6e 20 20 69 74 65 6d 73 3a "\n items:
2f50: 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 20 " items...
2f60: 20 20 20 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 "\n item-pa
2f70: 74 68 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 29 th: " item-path)
2f80: 0a 09 28 63 6f 6e 64 0a 09 20 28 28 6e 6f 74 20 ..(cond.. ((not
2f90: 69 74 65 6d 73 29 20 3b 3b 20 77 68 65 6e 20 66 items) ;; when f
2fa0: 61 6c 73 65 20 74 68 65 20 74 65 73 74 20 69 73 alse the test is
2fb0: 20 6f 6b 20 74 6f 20 62 65 20 68 61 6e 64 65 64 ok to be handed
2fc0: 20 6f 66 66 20 74 6f 20 6c 61 75 6e 63 68 20 28 off to launch (
2fd0: 62 75 74 20 6e 6f 74 20 62 65 66 6f 72 65 29 0a but not before).
2fe0: 09 20 20 28 6c 65 74 20 28 28 68 61 76 65 2d 72 . (let ((have-r
2ff0: 65 73 6f 75 72 63 65 73 20 20 28 72 75 6e 73 3a esources (runs:
3000: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
3010: 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 ts db test-recor
3020: 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 d)) ;; look at t
3030: 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 he test jobgroup
3040: 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 and tot jobs ru
3050: 6e 6e 69 6e 67 0a 09 09 28 70 72 65 72 65 71 73 nning...(prereqs
3060: 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 74 -not-met (db:get
3070: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 -prereqs-not-met
3080: 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f db run-id waito
3090: 6e 73 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a ns item-path))).
30a0: 09 20 20 20 20 28 69 66 20 28 61 6e 64 20 68 61 . (if (and ha
30b0: 76 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 ve-resources...
30c0: 20 20 20 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 (null? prere
30d0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 3b qs-not-met))...;
30e0: 3b 20 6e 6f 20 6c 6f 6f 70 20 2d 20 64 72 6f 70 ; no loop - drop
30f0: 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 though and use
3100: 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 the loop at the
3110: 62 6f 74 74 6f 6d 20 0a 09 09 28 72 75 6e 3a 74 bottom ...(run:t
3120: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 est db run-id ru
3130: 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 nname keyvallst
3140: 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 test-record flag
3150: 73 20 23 66 29 0a 09 09 3b 3b 20 65 6c 73 65 20 s #f)...;; else
3160: 74 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b the run is stuck
3170: 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 , temporarily or
3180: 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 28 permanently...(
3190: 6c 65 74 20 28 28 6e 65 77 74 61 6c 20 28 61 70 let ((newtal (ap
31a0: 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 pend tal (list h
31b0: 65 64 29 29 29 29 0a 09 09 20 20 3b 3b 20 63 6f ed))))... ;; co
31c0: 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 uldn't run, take
31d0: 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 a breather...
31e0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 31 (thread-sleep! 1
31f0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 )... (loop (car
3200: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 tal)(cdr tal)))
3210: 29 29 29 0a 09 20 0a 09 20 3b 3b 20 63 61 73 65 ))).. .. ;; case
3220: 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d 73 20 where an items
3230: 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c 69 73 came in as a lis
3240: 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 65 64 t been processed
3250: 0a 09 20 28 28 61 6e 64 20 28 6c 69 73 74 3f 20 .. ((and (list?
3260: 69 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 68 items) ;; th
3270: 75 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 69 us we know our i
3280: 74 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 79 tems are already
3290: 20 63 61 6c 63 75 6c 61 74 65 64 0a 09 20 20 20 calculated..
32a0: 20 20 20 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 (not itemd
32b0: 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 at)) ;; and not
32c0: 79 65 74 20 65 78 70 61 6e 64 65 64 20 69 6e 74 yet expanded int
32d0: 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20 74 68 o the list of th
32e0: 69 6e 67 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a ings to be done.
32f0: 09 20 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 . (if (>= *verb
3300: 6f 73 69 74 79 2a 20 31 29 28 70 70 20 69 74 65 osity* 1)(pp ite
3310: 6d 73 29 29 0a 09 20 20 3b 3b 20 28 69 66 20 28 ms)).. ;; (if (
3320: 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 35 >= *verbosity* 5
3330: 29 0a 09 20 20 3b 3b 20 20 20 20 20 28 62 65 67 ).. ;; (beg
3340: 69 6e 0a 09 20 20 3b 3b 20 20 20 20 20 20 20 28 in.. ;; (
3350: 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 print "items: ")
3360: 20 20 20 20 20 28 70 70 20 28 69 74 65 6d 2d 61 (pp (item-a
3370: 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 ssoc->item-list
3380: 69 74 65 6d 73 29 29 0a 09 20 20 3b 3b 20 20 20 items)).. ;;
3390: 20 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d (print "item
33a0: 73 74 61 62 6c 65 3a 20 22 29 28 70 70 20 28 69 stable: ")(pp (i
33b0: 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d tem-table->item-
33c0: 6c 69 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 list itemstable)
33d0: 29 29 29 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 ))).. (for-each
33e0: 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 .. (lambda (my
33f0: 2d 69 74 65 6d 64 61 74 29 0a 09 20 20 20 20 20 -itemdat)..
3400: 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 (let* ((new-test
3410: 2d 72 65 63 6f 72 64 20 28 6c 65 74 20 28 28 6e -record (let ((n
3420: 65 77 72 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 ewrec (make-test
3430: 73 3a 74 65 73 74 71 75 65 75 65 29 29 29 0a 09 s:testqueue)))..
3440: 09 09 09 20 20 20 20 20 20 20 28 76 65 63 74 6f ... (vecto
3450: 72 2d 63 6f 70 79 21 20 74 65 73 74 2d 72 65 63 r-copy! test-rec
3460: 6f 72 64 20 6e 65 77 72 65 63 29 0a 09 09 09 09 ord newrec).....
3470: 20 20 20 20 20 20 20 6e 65 77 72 65 63 29 29 0a newrec)).
3480: 09 09 20 20 20 20 28 6d 79 2d 69 74 65 6d 2d 70 .. (my-item-p
3490: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
34a0: 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 path my-itemdat)
34b0: 29 0a 09 09 20 20 20 20 28 69 74 65 6d 2d 6d 61 )... (item-ma
34c0: 74 63 68 65 73 20 28 69 66 20 69 74 65 6d 2d 70 tches (if item-p
34d0: 61 74 74 73 20 20 20 20 20 20 20 3b 3b 20 68 65 atts ;; he
34e0: 72 65 20 77 65 20 61 72 65 20 66 69 6c 74 65 72 re we are filter
34f0: 69 6e 67 20 66 6f 72 20 6d 61 74 63 68 65 73 20 ing for matches
3500: 77 69 74 68 20 2d 69 74 65 6d 70 61 74 74 0a 09 with -itempatt..
3510: 09 09 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 ... (let ((
3520: 72 65 73 20 23 66 29 29 09 20 3b 3b 20 6c 6f 6f res #f)). ;; loo
3530: 6b 20 74 68 72 6f 75 67 68 20 61 6c 6c 20 74 68 k through all th
3540: 65 20 69 74 65 6d 2d 70 61 74 74 73 20 69 66 20 e item-patts if
3550: 64 65 66 69 6e 65 64 2c 20 66 6f 72 6d 61 74 20 defined, format
3560: 69 73 20 70 61 74 74 31 2c 70 61 74 74 32 2c 70 is patt1,patt2,p
3570: 61 74 74 33 20 2e 2e 2e 20 77 69 6c 64 63 61 72 att3 ... wildcar
3580: 64 20 69 73 20 25 0a 09 09 09 09 09 28 66 6f 72 d is %......(for
3590: 2d 65 61 63 68 20 0a 09 09 09 09 09 20 28 6c 61 -each ...... (la
35a0: 6d 62 64 61 20 28 70 61 74 74 29 0a 09 09 09 09 mbda (patt).....
35b0: 09 20 20 20 28 69 66 20 28 73 74 72 69 6e 67 2d . (if (string-
35c0: 73 65 61 72 63 68 20 28 67 6c 6f 62 2d 3e 72 65 search (glob->re
35d0: 67 65 78 70 0a 09 09 09 09 09 09 09 20 20 20 20 gexp........
35e0: 20 20 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 (string-trans
35f0: 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a late patt "%" "*
3600: 22 29 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 "))........
3610: 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 09 09 item-path).....
3620: 09 20 20 20 20 20 20 20 28 73 65 74 21 20 72 65 . (set! re
3630: 73 20 23 74 29 29 29 0a 09 09 09 09 09 20 28 73 s #t)))...... (s
3640: 74 72 69 6e 67 2d 73 70 6c 69 74 20 69 74 65 6d tring-split item
3650: 2d 70 61 74 74 73 20 22 2c 22 29 29 0a 09 09 09 -patts ","))....
3660: 09 09 72 65 73 29 0a 09 09 09 09 20 20 20 20 20 ..res).....
3670: 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 20 28 #t))).. (
3680: 69 66 20 69 74 65 6d 2d 6d 61 74 63 68 65 73 20 if item-matches
3690: 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 ;; yes, we want
36a0: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 to process this
36b0: 69 74 65 6d 0a 09 09 20 20 20 28 6c 65 74 20 28 item... (let (
36c0: 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f (newtestname (co
36d0: 6e 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74 nc hed "/" my-it
36e0: 65 6d 2d 70 61 74 68 29 29 29 20 0a 09 09 20 20 em-path))) ...
36f0: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
3700: 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 eue-set-items!
3710: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 new-test-record
3720: 20 23 66 29 0a 09 09 20 20 20 20 20 28 74 65 73 #f)... (tes
3730: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 ts:testqueue-set
3740: 2d 69 74 65 6d 64 61 74 21 20 6e 65 77 2d 74 65 -itemdat! new-te
3750: 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 st-record my-ite
3760: 6d 64 61 74 29 0a 09 09 20 20 20 20 20 28 68 61 mdat)... (ha
3770: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 sh-table-set! te
3780: 73 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 st-records newte
3790: 73 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d stname new-test-
37a0: 72 65 63 6f 72 64 29 0a 09 09 20 20 20 20 20 28 record)... (
37b0: 73 65 74 21 20 74 61 6c 20 28 63 6f 6e 73 20 6e set! tal (cons n
37c0: 65 77 74 65 73 74 6e 61 6d 65 20 74 61 6c 29 29 ewtestname tal))
37d0: 29 29 29 29 20 3b 3b 20 73 69 6e 63 65 20 74 68 )))) ;; since th
37e0: 65 73 65 20 61 72 65 20 69 74 65 6d 69 7a 65 64 ese are itemized
37f0: 20 63 72 65 61 74 65 20 6e 65 77 20 74 65 73 74 create new test
3800: 20 6e 61 6d 65 73 20 74 65 73 74 6e 61 6d 65 2f names testname/
3810: 69 74 65 6d 70 61 74 68 0a 09 20 20 20 69 74 65 itempath.. ite
3820: 6d 73 29 0a 09 20 20 28 6c 6f 6f 70 20 28 63 61 ms).. (loop (ca
3830: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 r tal)(cdr tal))
3840: 29 0a 0a 09 20 3b 3b 20 69 66 20 69 74 65 6d 73 )... ;; if items
3850: 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 is a proc then
3860: 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d need to run item
3870: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d s:get-items-from
3880: 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 -config, get the
3890: 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a list and loop .
38a0: 09 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e . ;; - but on
38b0: 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20 72 65 ly do that if re
38c0: 73 6f 75 72 63 65 73 20 65 78 69 73 74 20 74 6f sources exist to
38d0: 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f kick off the jo
38e0: 62 0a 09 20 28 28 70 72 6f 63 65 64 75 72 65 3f b.. ((procedure?
38f0: 20 69 74 65 6d 73 29 0a 09 20 20 28 69 66 20 28 items).. (if (
3900: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
3910: 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d e-tests db test-
3920: 72 65 63 6f 72 64 29 0a 09 20 20 20 20 20 20 28 record).. (
3930: 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 74 let ((items-list
3940: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d (items:get-item
3950: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 s-from-config tc
3960: 6f 6e 66 69 67 29 29 29 0a 09 09 28 69 66 20 28 onfig)))...(if (
3970: 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 list? items-list
3980: 29 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 )... (begin..
3990: 09 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 . (tests:te
39a0: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d stqueue-set-item
39b0: 73 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69 74 s test-record it
39c0: 65 6d 73 2d 6c 69 73 74 29 0a 09 09 20 20 20 20 ems-list)...
39d0: 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 29 (loop hed tal)
39e0: 29 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 )... (begin..
39f0: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
3a00: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 int 0 "ERROR: Th
3a10: 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 e proc from read
3a20: 69 6e 67 20 74 68 65 20 73 65 74 75 70 20 64 69 ing the setup di
3a30: 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 d not yield a li
3a40: 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f st - please repo
3a50: 72 74 20 74 68 69 73 22 29 0a 09 09 20 20 20 20 rt this")...
3a60: 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 (exit 1))))..
3a70: 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 (let ((newt
3a80: 61 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 al (append tal (
3a90: 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 3b list hed))))...;
3aa0: 3b 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d ; if can't run m
3ab0: 6f 72 65 20 74 65 73 74 73 2c 20 6c 65 74 73 20 ore tests, lets
3ac0: 74 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a take a breather.
3ad0: 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 ..(thread-sleep!
3ae0: 20 31 29 0a 09 09 28 6c 6f 6f 70 20 28 63 61 72 1)...(loop (car
3af0: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 newtal)(cdr new
3b00: 74 61 6c 29 29 29 29 29 0a 0a 09 20 3b 3b 20 74 tal)))))... ;; t
3b10: 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 his case should
3b20: 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 not happen, adde
3b30: 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 d to help catch
3b40: 61 6e 79 20 62 75 67 73 0a 09 20 28 28 61 6e 64 any bugs.. ((and
3b50: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 (list? items) i
3b60: 74 65 6d 64 61 74 29 0a 09 20 20 28 64 65 62 75 temdat).. (debu
3b70: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
3b80: 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 : Should not hav
3b90: 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d e a list of item
3ba0: 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 s in a test and
3bb0: 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 the itemspath se
3bc0: 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 t - please repor
3bd0: 74 20 74 68 69 73 22 29 0a 09 20 20 28 65 78 69 t this").. (exi
3be0: 74 20 31 29 29 29 0a 09 0a 09 3b 3b 20 77 65 20 t 1)))....;; we
3bf0: 67 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f get here on "dro
3c00: 70 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f p through" - loo
3c10: 70 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 p for next test
3c20: 69 6e 20 71 75 65 75 65 0a 09 28 69 66 20 28 6e in queue..(if (n
3c30: 75 6c 6c 3f 20 74 61 6c 29 0a 09 20 20 20 20 28 ull? tal).. (
3c40: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 debug:print 1 "I
3c50: 4e 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c NFO: All tests l
3c60: 61 75 6e 63 68 65 64 22 29 0a 09 20 20 20 20 28 aunched").. (
3c70: 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 loop (car tal)(c
3c80: 64 72 20 74 61 6c 29 29 29 29 29 29 29 0a 0a 3b dr tal)))))))..;
3c90: 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 ; parent-test is
3ca0: 20 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 there as a plac
3cb0: 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e eholder for when
3cc0: 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 parent-tests ca
3cd0: 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 n be run as a se
3ce0: 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 tup step.(define
3cf0: 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 (run:test db ru
3d00: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 n-id runname key
3d10: 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f vallst test-reco
3d20: 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d rd flags parent-
3d30: 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 test). ;; All t
3d40: 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 hese vars might
3d50: 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 be referenced by
3d60: 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 the testconfig
3d70: 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c file reader. (l
3d80: 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 et* ((test-name
3d90: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
3da0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 eue-get-testname
3db0: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
3dc0: 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 .. (test-waitons
3dd0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
3de0: 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 e-get-waitons
3df0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
3e00: 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 (test-conf (
3e10: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
3e20: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 get-testconfig t
3e30: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 est-record)).. (
3e40: 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 itemdat (te
3e50: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3e60: 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 t-itemdat tes
3e70: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 t-record)).. (te
3e80: 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 st-path (conc
3e90: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
3ea0: 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 ts/" test-name))
3eb0: 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 ;; could use te
3ec0: 73 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 st:get-testconfi
3ed0: 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f g here ..... (fo
3ee0: 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73 68 rce (hash
3ef0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
3f00: 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 lt flags "-force
3f10: 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20 " #f)).. (rerun
3f20: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
3f30: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
3f40: 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66 lags "-rerun" #f
3f50: 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 )).. (keepgoing
3f60: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
3f70: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 ef/default flags
3f80: 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 "-keepgoing" #f
3f90: 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20 )).. (item-path
3fa0: 20 20 20 20 22 22 29 29 0a 20 20 20 20 28 64 65 "")). (de
3fb0: 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 09 20 22 bug:print 5... "
3fc0: 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 28 test-config: " (
3fd0: 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 hash-table->alis
3fe0: 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 20 t test-conf)...
3ff0: 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 22 "\n itemdat: "
4000: 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 20 itemdat... ).
4010: 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 65 ;; setting ite
4020: 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 69 mdat to a list i
4030: 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 28 f it is #f. (
4040: 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 29 if (not itemdat)
4050: 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 28 (set! itemdat '(
4060: 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 74 ))). (set! it
4070: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 em-path (item-li
4080: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 st->path itemdat
4090: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
40a0: 69 6e 74 20 31 20 22 41 74 74 65 6d 70 74 69 6e int 1 "Attemptin
40b0: 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 g to launch test
40c0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 " test-name "/"
40d0: 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 20 20 item-path).
40e0: 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 (setenv "MT_TEST
40f0: 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 _NAME" test-name
4100: 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e ) ;; . (seten
4110: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 v "MT_RUNNAME"
4120: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73 runname). (s
4130: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
4140: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 vars db run-id)
4150: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 ;; these may be
4160: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 needed by the la
4170: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a unching process.
4180: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 (change-dire
4190: 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 ctory *toppath*)
41a0: 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73 .. ;; Here is
41b0: 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 5f where the test_
41c0: 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 65 meta table is be
41d0: 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 28 st updated. (
41e0: 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 runs:update-test
41f0: 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 _meta db test-na
4200: 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 me test-conf).
4210: 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 . ;; (lambd
4220: 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 a (itemdat) ;;;
4230: 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 72 ((ripeness "over
4240: 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 74 ripe") (temperat
4250: 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 ure "cool") (sea
4260: 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 son "summer")).
4270: 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 (let* ((new-t
4280: 65 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e 67 est-path (string
4290: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 6f -intersperse (co
42a0: 6e 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d 61 ns test-path (ma
42b0: 70 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 29 p cadr itemdat))
42c0: 20 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 2d "/")).. (new-
42d0: 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 test-name (if (e
42e0: 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 qual? item-path
42f0: 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 "") test-name (c
4300: 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f onc test-name "/
4310: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 3b " item-path))) ;
4320: 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 74 ; just need it t
4330: 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20 20 o be unique..
4340: 28 74 65 73 74 64 61 74 20 20 20 20 20 20 20 28 (testdat (
4350: 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f db:get-test-info
4360: 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d db run-id test-
4370: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 name item-path))
4380: 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 ). (if (not
4390: 20 74 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 testdat).. (be
43a0: 67 69 6e 0a 09 20 20 20 20 28 72 65 67 69 73 74 gin.. (regist
43b0: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 er-test db run-i
43c0: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
43d0: 2d 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 74 -path).. (set
43e0: 21 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 65 ! testdat (db:ge
43f0: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 t-test-info db r
4400: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
4410: 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20 item-path)))).
4420: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 (change-dire
4430: 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 ctory test-path)
4440: 0a 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 . (case (if
4450: 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a force ;; (args:
4460: 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 get-arg "-force"
4470: 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 )...'NOT_STARTED
4480: 0a 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 ...(if testdat..
4490: 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 . (string->sy
44a0: 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 mbol (test:get-s
44b0: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 tate testdat))..
44c0: 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d . 'failed-to-
44d0: 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c insert))..((fail
44e0: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 ed-to-insert)..
44f0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
4500: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
4510: 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f insert the reco
4520: 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 rd into the db")
4530: 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 )..((NOT_STARTED
4540: 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 64 COMPLETED).. (d
4550: 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 47 6f ebug:print 6 "Go
4560: 74 20 68 65 72 65 2c 20 22 20 28 74 65 73 74 3a t here, " (test:
4570: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
4580: 74 29 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e t)).. (let ((run
4590: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 flag #f)).. (c
45a0: 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 ond.. ;; -for
45b0: 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 ce, run no matte
45c0: 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 r what.. (for
45d0: 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 ce (set! runflag
45e0: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f #t)).. ;; NO
45f0: 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e T_STARTED, run n
4600: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 o matter what..
4610: 20 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 ((equal? (tes
4620: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
4630: 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 dat) "NOT_STARTE
4640: 44 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 D")(set! runflag
4650: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f #t)).. ;; no
4660: 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 t -rerun and PAS
4670: 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b S, WARN or CHECK
4680: 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 , do no run..
4690: 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 ((and (or (not
46a0: 72 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b rerun)... k
46b0: 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 28 6d eepgoing)... (m
46c0: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d ember (test:get-
46d0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
46e0: 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 20 '("PASS" "WARN"
46f0: 22 43 48 45 43 4b 22 29 29 29 0a 09 20 20 20 20 "CHECK")))..
4700: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
4710: 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 f)).. ;; -rer
4720: 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 un and status is
4730: 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 one of the spec
4740: 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 ifed, run it..
4750: 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 ((and rerun...
4760: 20 20 28 6c 65 74 20 28 28 72 65 72 75 6e 6c 73 (let ((rerunls
4770: 74 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 t (string-split
4780: 72 65 72 75 6e 20 22 2c 22 29 29 29 20 3b 3b 20 rerun ","))) ;;
4790: 46 41 49 4c 2c 0a 09 09 20 20 20 20 28 6d 65 6d FAIL,... (mem
47a0: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
47b0: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 atus testdat) re
47c0: 72 75 6e 6c 73 74 29 29 29 0a 09 20 20 20 20 20 runlst)))..
47d0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
47e0: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 )).. ;; -keep
47f0: 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 going, do not re
4800: 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 run FAIL.. ((
4810: 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 and keepgoing...
4820: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a (member (test:
4830: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
4840: 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a at) '("FAIL"))).
4850: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 . (set! runf
4860: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 lag #f)).. ((
4870: 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a and (not rerun).
4880: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 .. (member (tes
4890: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
48a0: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 tdat) '("FAIL" "
48b0: 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 n/a"))).. (s
48c0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
48d0: 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 .. (else (set
48e0: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a ! runflag #f))).
48f0: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 . (debug:print
4900: 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 6 "RUNNING => r
4910: 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 unflag: " runfla
4920: 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 g " STATE: " (te
4930: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
4940: 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 tdat) " STATUS:
4950: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
4960: 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 us testdat))..
4970: 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 (if (not runfla
4980: 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 g).. (if (
4990: 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 not parent-test)
49a0: 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ... (debug:pri
49b0: 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 nt 1 "NOTE: Not
49c0: 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 starting test "
49d0: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 new-test-name "
49e0: 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c as it is state \
49f0: 22 43 4f 4d 50 4c 45 54 45 44 5c 22 20 61 6e 64 "COMPLETED\" and
4a00: 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 73 status \"" (tes
4a10: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
4a20: 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 2d tdat) "\", use -
4a30: 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 force to overrid
4a40: 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 e")).. ;;
4a50: 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 NOTE: No longer
4a60: 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 be checking prer
4a70: 65 71 75 69 73 69 74 65 73 20 68 65 72 65 21 20 equisites here!
4a80: 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 Will never get h
4a90: 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 ere unless prere
4aa0: 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b qs are.. ;
4ab0: 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 ; already
4ac0: 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66 met... (if
4ad0: 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 (not (launch-te
4ae0: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e st db run-id run
4af0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b name test-conf k
4b00: 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 eyvallst test-na
4b10: 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 me test-path ite
4b20: 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 mdat flags))...
4b30: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 (begin...
4b40: 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 (print "ERROR: F
4b50: 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 ailed to launch
4b60: 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e the test. Exitin
4b70: 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 g as soon as pos
4b80: 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 sible")... (
4b90: 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 set! *globalexit
4ba0: 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 status* 1) ;; ..
4bb0: 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 . (process-s
4bc0: 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 ignal (current-p
4bd0: 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 rocess-id) signa
4be0: 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 l/kill))))))..((
4bf0: 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 KILLED) .. (debu
4c00: 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a g:print 1 "NOTE:
4c10: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 " new-test-name
4c20: 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 " is already ru
4c30: 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 nning or was exp
4c40: 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 lictly killed, u
4c50: 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 se -force to lau
4c60: 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 nch it."))..((LA
4c70: 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 UNCHED REMOTEHOS
4c80: 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 TSTART RUNNING)
4c90: 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 .. (if (> (- (c
4ca0: 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 urrent-seconds)(
4cb0: 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 + (db:test-get-e
4cc0: 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 vent_time testda
4cd0: 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 t)..... (d
4ce0: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 b:test-get-run_d
4cf0: 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 uration testdat)
4d00: 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 ))...600) ;; i.e
4d10: 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 . no update for
4d20: 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 more than 600 se
4d30: 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 conds.. (beg
4d40: 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 in.. (debu
4d50: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
4d60: 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d NG: Test " test-
4d70: 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 name " appears t
4d80: 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 o be dead. Forci
4d90: 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 ng it to state I
4da0: 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 NCOMPLETE and st
4db0: 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 atus STUCK/DEAD"
4dc0: 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 74 2d ).. (test-
4dd0: 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 20 72 set-status! db r
4de0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
4df0: 22 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 "INCOMPLETE" "ST
4e00: 55 43 4b 2f 44 45 41 44 22 20 69 74 65 6d 64 61 UCK/DEAD" itemda
4e10: 74 20 22 54 65 73 74 20 69 73 20 73 74 75 63 6b t "Test is stuck
4e20: 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a 09 or dead" #f))..
4e30: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
4e40: 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 73 t 2 "NOTE: " tes
4e50: 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 t-name " is alre
4e60: 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 0a ady running"))).
4e70: 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 65 .(else (de
4e80: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
4e90: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 OR: Failed to la
4ea0: 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 2d unch test " new-
4eb0: 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 test-name ". Unr
4ec0: 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 20 ecognised state
4ed0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
4ee0: 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 29 e testdat)))))))
4ef0: 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ..;;============
4f00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4f10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4f20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4f30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e ==========.;; EN
4f40: 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a 3b D OF NEW STUFF.;
4f50: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
4f60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4f70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4f80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
4f90: 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 =======..(define
4fa0: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 64 (get-dir-up-n d
4fb0: 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 20 ir . params) .
4fc0: 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 28 (let ((dparts (
4fd0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 72 string-split dir
4fe0: 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 20 "/"))..(count
4ff0: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 61 (if (null? para
5000: 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 6d ms) 1 (car param
5010: 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 s)))). (conc
5020: 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 "/" (string-inte
5030: 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 20 rsperse ..
5040: 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 2d (take dparts (-
5050: 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 29 (length dparts)
5060: 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 20 count))..
5070: 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d 6f "/")))).;; Remo
5080: 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 ve runs.;; field
5090: 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 6e s are passing in
50a0: 20 74 68 72 6f 75 67 68 20 0a 28 64 65 66 69 6e through .(defin
50b0: 65 20 28 72 75 6e 73 3a 72 65 6d 6f 76 65 2d 72 e (runs:remove-r
50c0: 75 6e 73 20 64 62 20 72 75 6e 6e 61 6d 65 70 61 uns db runnamepa
50d0: 74 74 20 74 65 73 74 70 61 74 74 20 69 74 65 6d tt testpatt item
50e0: 70 61 74 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 patt). (let* ((
50f0: 6b 65 79 73 20 20 20 20 20 20 20 20 28 64 62 2d keys (db-
5100: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 get-keys db))..
5110: 28 72 75 6e 64 61 74 20 20 20 20 20 20 28 72 75 (rundat (ru
5120: 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 ns:get-runs-by-p
5130: 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e att db keys runn
5140: 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 amepatt)).. (hea
5150: 64 65 72 20 20 20 20 20 20 28 76 65 63 74 6f 72 der (vector
5160: 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a -ref rundat 0)).
5170: 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 28 . (runs (
5180: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
5190: 74 20 31 29 29 29 0a 20 20 20 20 28 64 65 62 75 t 1))). (debu
51a0: 67 3a 70 72 69 6e 74 20 31 20 22 48 65 61 64 65 g:print 1 "Heade
51b0: 72 3a 20 22 20 68 65 61 64 65 72 29 0a 20 20 20 r: " header).
51c0: 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 (for-each.
51d0: 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 (lambda (run).
51e0: 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b (let ((runk
51f0: 65 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 ey (string-inter
5200: 73 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d sperse (map (lam
5210: 62 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 bda (k).......(d
5220: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
5230: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
5240: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 (vector-ref k 0
5250: 29 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a ))) keys) "/")).
5260: 09 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 . (dirs-to-r
5270: 65 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 emove (make-hash
5280: 2d 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 -table))).. (let
5290: 2a 20 28 28 72 75 6e 2d 69 64 20 28 64 62 3a 67 * ((run-id (db:g
52a0: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
52b0: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 er run header "i
52c0: 64 22 29 20 29 0a 09 09 28 74 65 73 74 73 20 20 d") )...(tests
52d0: 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f (db-get-tests-fo
52e0: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 r-run db (db:get
52f0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
5300: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 run header "id"
5310: 29 20 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 ) testpatt itemp
5320: 61 74 74 20 27 28 29 20 27 28 29 29 29 0a 09 09 att '() '()))...
5330: 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 6f 65 (lasttpath "/doe
5340: 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f 68 6f s/not/exist/I/ho
5350: 70 65 22 29 29 0a 0a 09 20 20 20 28 69 66 20 28 pe"))... (if (
5360: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 73 74 73 not (null? tests
5370: 29 29 0a 09 20 20 20 20 20 20 20 28 62 65 67 69 )).. (begi
5380: 6e 0a 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e n... (debug:prin
5390: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 t 1 "Removing te
53a0: 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 sts for run: " r
53b0: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 unkey " " (db:ge
53c0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
53d0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 r run header "ru
53e0: 6e 6e 61 6d 65 22 29 29 0a 09 09 20 28 66 6f 72 nname"))... (for
53f0: 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d 62 64 -each... (lambd
5400: 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 20 28 a (test)... (
5410: 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 74 68 let* ((item-path
5420: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
5430: 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 0a 09 em-path test))..
5440: 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d 65 20 .. (test-name
5450: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
5460: 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 09 09 tname test))....
5470: 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 28 64 (run-dir (d
5480: 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 64 69 b:test-get-rundi
5490: 72 20 74 65 73 74 29 29 29 0a 09 09 20 20 20 20 r test)))...
54a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
54b0: 20 22 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 " " (db:test-g
54c0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
54d0: 29 20 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 ) " id: " (db:te
54e0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 st-get-id test)
54f0: 22 20 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 " " item-path)..
5500: 09 20 20 20 20 20 20 28 64 62 3a 64 65 6c 65 74 . (db:delet
5510: 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 e-test-records d
5520: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 b (db:test-get-i
5530: 64 20 74 65 73 74 29 29 0a 09 09 20 20 20 20 20 d test))...
5540: 20 28 69 66 20 28 3e 20 28 73 74 72 69 6e 67 2d (if (> (string-
5550: 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 length run-dir)
5560: 35 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 5) ;; bad heuris
5570: 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 tic but should p
5580: 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d revent /tmp /hom
5590: 65 20 65 74 63 2e 0a 09 09 09 20 20 28 6c 65 74 e etc..... (let
55a0: 20 28 28 66 75 6c 6c 70 61 74 68 20 72 75 6e 2d ((fullpath run-
55b0: 64 69 72 29 29 20 3b 3b 20 22 2f 22 20 28 64 62 dir)) ;; "/" (db
55c0: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
55d0: 61 74 68 20 74 65 73 74 29 29 29 29 0a 09 09 09 ath test))))....
55e0: 20 20 20 20 28 73 65 74 21 20 6c 61 73 74 74 70 (set! lasttp
55f0: 61 74 68 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 ath fullpath)...
5600: 09 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 . (hash-table
5610: 2d 73 65 74 21 20 64 69 72 73 2d 74 6f 2d 72 65 -set! dirs-to-re
5620: 6d 6f 76 65 20 66 75 6c 6c 70 61 74 68 20 23 74 move fullpath #t
5630: 29 0a 09 09 09 20 20 20 20 3b 3b 20 54 68 65 20 ).... ;; The
5640: 66 6f 6c 6c 6f 77 69 6e 67 20 77 61 73 20 74 68 following was th
5650: 65 20 73 61 66 65 20 64 65 6c 65 74 65 20 63 6f e safe delete co
5660: 64 65 20 62 75 74 20 69 74 20 77 61 73 20 6e 6f de but it was no
5670: 74 20 62 65 69 6e 67 20 65 78 65 63 74 75 74 65 t being exectute
5680: 64 2e 0a 09 09 09 20 20 20 20 3b 3b 20 28 6c 65 d..... ;; (le
5690: 74 2a 20 28 28 64 69 72 73 2d 63 6f 75 6e 74 20 t* ((dirs-count
56a0: 28 2b 20 31 20 28 6c 65 6e 67 74 68 20 6b 65 79 (+ 1 (length key
56b0: 73 29 28 6c 65 6e 67 74 68 20 28 73 74 72 69 6e s)(length (strin
56c0: 67 2d 73 70 6c 69 74 20 69 74 65 6d 2d 70 61 74 g-split item-pat
56d0: 68 20 22 2f 22 29 29 29 29 0a 09 09 09 20 20 20 h "/"))))....
56e0: 20 3b 3b 20 20 20 20 20 20 20 20 28 64 69 72 2d ;; (dir-
56f0: 74 6f 2d 72 65 6d 20 28 67 65 74 2d 64 69 72 2d to-rem (get-dir-
5700: 75 70 2d 6e 20 66 75 6c 6c 70 61 74 68 20 64 69 up-n fullpath di
5710: 72 73 2d 63 6f 75 6e 74 29 29 0a 09 09 09 20 20 rs-count))....
5720: 20 20 3b 3b 20 20 20 20 20 20 20 20 28 72 65 6d ;; (rem
5730: 61 69 6e 69 6e 67 64 20 28 73 74 72 69 6e 67 2d ainingd (string-
5740: 73 75 62 73 74 69 74 75 74 65 20 28 72 65 67 65 substitute (rege
5750: 78 70 20 28 63 6f 6e 63 20 22 5e 22 20 64 69 72 xp (conc "^" dir
5760: 2d 74 6f 2d 72 65 6d 20 22 2f 22 29 29 20 22 22 -to-rem "/")) ""
5770: 20 66 75 6c 6c 70 61 74 68 29 29 0a 09 09 09 20 fullpath))....
5780: 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 63 6d ;; (cm
5790: 64 20 28 63 6f 6e 63 20 22 63 64 20 22 20 64 69 d (conc "cd " di
57a0: 72 2d 74 6f 2d 72 65 6d 20 22 3b 20 72 6d 64 69 r-to-rem "; rmdi
57b0: 72 20 2d 70 20 22 20 72 65 6d 61 69 6e 69 6e 67 r -p " remaining
57c0: 64 20 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 d ))).... ;;
57d0: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 (if (file-exis
57e0: 74 73 3f 20 66 75 6c 6c 70 61 74 68 29 0a 09 09 ts? fullpath)...
57f0: 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 62 . ;; (b
5800: 65 67 69 6e 0a 09 09 09 20 20 20 20 3b 3b 20 20 egin.... ;;
5810: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
5820: 69 6e 74 20 31 20 63 6d 64 29 0a 09 09 09 20 20 int 1 cmd)....
5830: 20 20 3b 3b 20 20 20 20 20 20 20 20 20 28 73 79 ;; (sy
5840: 73 74 65 6d 20 63 6d 64 29 29 29 0a 09 09 09 20 stem cmd)))....
5850: 20 20 20 3b 3b 20 20 20 29 29 0a 09 09 09 20 20 ;; ))....
5860: 20 20 29 29 29 29 0a 09 09 20 20 20 20 74 65 73 ))))... tes
5870: 74 73 29 29 29 0a 0a 09 20 20 20 3b 3b 20 6c 6f ts)))... ;; lo
5880: 6f 6b 20 74 68 6f 75 67 68 20 74 68 65 20 64 69 ok though the di
5890: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 6f 72 rs-to-remove for
58a0: 20 63 61 6e 64 69 64 61 74 65 73 20 66 6f 72 20 candidates for
58b0: 72 65 6d 6f 76 61 6c 2e 20 44 6f 20 74 68 69 73 removal. Do this
58c0: 20 61 66 74 65 72 20 64 65 6c 65 74 69 6e 67 20 after deleting
58d0: 74 68 65 20 72 65 63 6f 72 64 73 0a 09 20 20 20 the records..
58e0: 3b 3b 20 66 6f 72 20 65 61 63 68 20 74 65 73 74 ;; for each test
58f0: 20 69 6e 20 63 61 73 65 20 77 65 20 67 65 74 20 in case we get
5900: 6b 69 6c 6c 65 64 2e 20 54 68 61 74 20 73 68 6f killed. That sho
5910: 75 6c 64 20 6d 69 6e 69 6d 69 7a 65 20 74 68 65 uld minimize the
5920: 20 64 65 74 72 69 74 75 73 20 6c 65 66 74 20 6f detritus left o
5930: 6e 20 64 69 73 6b 0a 09 20 20 20 3b 3b 20 70 72 n disk.. ;; pr
5940: 6f 63 65 73 73 20 74 68 65 20 64 69 72 73 20 66 ocess the dirs f
5950: 72 6f 6d 20 6c 6f 6e 67 65 73 74 20 73 74 72 69 rom longest stri
5960: 6e 67 20 6c 65 6e 67 74 68 20 74 6f 20 73 68 6f ng length to sho
5970: 72 74 65 73 74 0a 09 20 20 20 28 66 6f 72 2d 65 rtest.. (for-e
5980: 61 63 68 20 0a 09 20 20 20 20 28 6c 61 6d 62 64 ach .. (lambd
5990: 61 20 28 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 a (dir-to-remove
59a0: 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 66 69 ).. (if (fi
59b0: 6c 65 2d 65 78 69 73 74 73 3f 20 64 69 72 2d 74 le-exists? dir-t
59c0: 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 20 20 28 6c o-remove)... (l
59d0: 65 74 20 28 28 64 69 72 2d 69 6e 2d 64 62 20 27 et ((dir-in-db '
59e0: 28 29 29 29 0a 09 09 20 20 20 20 28 73 71 6c 69 ()))... (sqli
59f0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
5a00: 0a 09 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ... (lambda
5a10: 28 64 69 72 29 0a 09 09 20 20 20 20 20 20 20 28 (dir)... (
5a20: 73 65 74 21 20 64 69 72 2d 69 6e 2d 64 62 20 28 set! dir-in-db (
5a30: 63 6f 6e 73 20 64 69 72 20 64 69 72 2d 69 6e 2d cons dir dir-in-
5a40: 64 62 29 29 29 0a 09 09 20 20 20 20 20 64 62 20 db)))... db
5a50: 22 53 45 4c 45 43 54 20 72 75 6e 64 69 72 20 46 "SELECT rundir F
5a60: 52 4f 4d 20 74 65 73 74 73 20 57 48 45 52 45 20 ROM tests WHERE
5a70: 72 75 6e 64 69 72 20 4c 49 4b 45 20 3f 3b 22 20 rundir LIKE ?;"
5a80: 0a 09 09 20 20 20 20 20 28 63 6f 6e 63 20 22 25 ... (conc "%
5a90: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 20 " dir-to-remove
5aa0: 22 25 22 29 29 20 3b 3b 20 79 65 73 2c 20 49 27 "%")) ;; yes, I'
5ab0: 6d 20 67 6f 69 6e 67 20 74 6f 20 62 61 69 6c 20 m going to bail
5ac0: 69 66 20 74 68 65 72 65 20 69 73 20 61 6e 79 74 if there is anyt
5ad0: 68 69 6e 67 20 6c 69 6b 65 20 74 68 69 73 20 64 hing like this d
5ae0: 69 72 20 69 6e 20 74 68 65 20 64 62 0a 09 09 20 ir in the db...
5af0: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 64 69 (if (null? di
5b00: 72 2d 69 6e 2d 64 62 29 0a 09 09 09 28 62 65 67 r-in-db)....(beg
5b10: 69 6e 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 in.... (debug:p
5b20: 72 69 6e 74 20 32 20 22 52 65 6d 6f 76 69 6e 67 rint 2 "Removing
5b30: 20 64 69 72 65 63 74 6f 72 79 20 77 69 74 68 20 directory with
5b40: 7a 65 72 6f 20 64 62 20 72 65 66 65 72 65 6e 63 zero db referenc
5b50: 65 73 3a 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d es: " dir-to-rem
5b60: 6f 76 65 29 0a 09 09 09 20 20 28 73 79 73 74 65 ove).... (syste
5b70: 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 20 m (conc "rm -rf
5b80: 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 " dir-to-remove)
5b90: 29 0a 09 09 09 20 20 28 68 61 73 68 2d 74 61 62 ).... (hash-tab
5ba0: 6c 65 2d 64 65 6c 65 74 65 21 20 64 69 72 73 2d le-delete! dirs-
5bb0: 74 6f 2d 72 65 6d 6f 76 65 20 64 69 72 2d 74 6f to-remove dir-to
5bc0: 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 28 64 65 -remove))....(de
5bd0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 53 6b 69 bug:print 2 "Ski
5be0: 70 70 69 6e 67 20 72 65 6d 6f 76 61 6c 20 6f 66 pping removal of
5bf0: 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 " dir-to-remove
5c00: 20 22 20 66 6f 72 20 6e 6f 77 20 61 73 20 69 74 " for now as it
5c10: 20 73 74 69 6c 6c 20 68 61 73 20 72 65 66 65 72 still has refer
5c20: 65 6e 63 65 73 20 69 6e 20 74 68 65 20 64 61 74 ences in the dat
5c30: 61 62 61 73 65 22 29 29 29 29 29 0a 09 20 20 20 abase")))))..
5c40: 20 28 73 6f 72 74 20 28 68 61 73 68 2d 74 61 62 (sort (hash-tab
5c50: 6c 65 2d 6b 65 79 73 20 64 69 72 73 2d 74 6f 2d le-keys dirs-to-
5c60: 72 65 6d 6f 76 65 29 20 28 6c 61 6d 62 64 61 20 remove) (lambda
5c70: 28 61 20 62 29 28 3e 20 28 73 74 72 69 6e 67 2d (a b)(> (string-
5c80: 6c 65 6e 67 74 68 20 61 29 28 73 74 72 69 6e 67 length a)(string
5c90: 2d 6c 65 6e 67 74 68 20 62 29 29 29 29 29 0a 0a -length b)))))..
5ca0: 09 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 . ;; remove th
5cb0: 65 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 e run if zero te
5cc0: 73 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 sts remain.. (
5cd0: 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 let ((remtests (
5ce0: 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db-get-tests-for
5cf0: 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d -run db (db:get-
5d00: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
5d10: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 run header "id")
5d20: 20 23 66 20 23 66 20 27 28 29 20 27 28 29 29 29 #f #f '() '()))
5d30: 29 0a 09 20 20 20 20 20 28 69 66 20 28 6e 75 6c ).. (if (nul
5d40: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 l? remtests) ;;
5d50: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 no more tests re
5d60: 6d 61 69 6e 69 6e 67 0a 09 09 20 28 6c 65 74 2a maining... (let*
5d70: 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 ((dparts (stri
5d80: 6e 67 2d 73 70 6c 69 74 20 6c 61 73 74 74 70 61 ng-split lasttpa
5d90: 74 68 20 22 2f 22 29 29 0a 09 09 09 28 72 75 6e th "/"))....(run
5da0: 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 path (conc "/" (
5db0: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
5dc0: 73 65 20 0a 09 09 09 09 09 20 20 20 20 28 74 61 se ...... (ta
5dd0: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 ke dparts (- (le
5de0: 6e 67 74 68 20 64 70 61 72 74 73 29 20 31 29 29 ngth dparts) 1))
5df0: 0a 09 09 09 09 09 20 20 20 20 22 2f 22 29 29 29 ...... "/")))
5e00: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 )... (debug:pr
5e10: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
5e20: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 run: " runkey "
5e30: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d " (db:get-value-
5e40: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
5e50: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 ader "runname"))
5e60: 0a 09 09 20 20 20 28 64 62 3a 64 65 6c 65 74 65 ... (db:delete
5e70: 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a -run db run-id).
5e80: 09 09 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 .. ;; need to
5e90: 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 70 figure out the p
5ea0: 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64 ath to the run d
5eb0: 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 ir and remove it
5ec0: 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 3b if empty... ;
5ed0: 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 ; (if (null?
5ee0: 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 (glob (conc runp
5ef0: 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 ath "/*")))...
5f00: 20 3b 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 ;; (begi
5f10: 6e 0a 09 09 20 20 20 3b 3b 20 09 20 28 64 65 62 n... ;; . (deb
5f20: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
5f30: 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 20 72 ving run dir " r
5f40: 75 6e 70 61 74 68 29 0a 09 09 20 20 20 3b 3b 20 unpath)... ;;
5f50: 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 . (system (conc
5f60: 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70 "rmdir -p " runp
5f70: 61 74 68 29 29 29 29 0a 09 09 20 20 20 29 29 29 ath))))... )))
5f80: 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e 73 ).. )). runs
5f90: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
5fa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5fb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5fc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
5fe0: 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d 61 Routines for ma
5ff0: 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 0a nipulating runs.
6000: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
6010: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6040: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e ========..;; Sin
6050: 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 6f ce many calls to
6060: 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 70 a run require p
6070: 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 73 retty much the s
6080: 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 68 ame setup .;; th
6090: 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75 73 is wrapper is us
60a0: 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 65 ed to reduce the
60b0: 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 replication of
60c0: 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 65 code.(define (ge
60d0: 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 73 neral-run-call s
60e0: 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f 6e witchname action
60f0: 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 6c -desc proc). (l
6100: 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 72 et ((runname (ar
6110: 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 6e gs:get-arg ":run
6120: 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65 74 name"))..(target
6130: 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d (if (args:get-
6140: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 arg "-target")..
6150: 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d . (args:get-
6160: 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 arg "-target")..
6170: 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 2d . (args:get-
6180: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 29 arg "-reqtarg"))
6190: 29 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 )). (cond.
61a0: 20 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a ((not target).
61b0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
61c0: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 nt 0 "ERROR: Mis
61d0: 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 sing required pa
61e0: 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 rameter for " sw
61f0: 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 itchname ", you
6200: 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 must specify the
6210: 20 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 61 target with -ta
6220: 72 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 78 rget"). (ex
6230: 69 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f it 3)). ((no
6240: 74 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 t runname).
6250: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
6260: 22 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 "ERROR: Missing
6270: 72 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 required paramet
6280: 65 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e er for " switchn
6290: 61 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 ame ", you must
62a0: 73 70 65 63 69 66 79 20 74 68 65 20 72 75 6e 20 specify the run
62b0: 6e 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 name with :runna
62c0: 6d 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 me runname").
62d0: 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 (exit 3)).
62e0: 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c (else. (l
62f0: 65 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 20 et ((db #f)..
6300: 20 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28 (keys #f))..(
6310: 69 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 if (not (setup-f
6320: 6f 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62 or-run)).. (b
6330: 65 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 egin .. (de
6340: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69 bug:print 0 "Fai
6350: 6c 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78 led to setup, ex
6360: 69 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28 iting").. (
6370: 65 78 69 74 20 31 29 29 29 0a 09 28 73 65 74 21 exit 1)))..(set!
6380: 20 64 62 20 20 20 28 6f 70 65 6e 2d 64 62 29 29 db (open-db))
6390: 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 64 62 ..(set! keys (db
63a0: 2d 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 -get-keys db))..
63b0: 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 ;; have enough t
63c0: 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 o process -targe
63d0: 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 t or -reqtarg he
63e0: 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 re..(if (args:ge
63f0: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
6400: 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 ).. (let* ((r
6410: 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 unconfigf (conc
6420: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e *toppath* "/run
6430: 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 configs.config")
6440: 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c ) ;; DO NOT EVAL
6450: 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 UATE ALL ... (
6460: 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 runconfig (read
6470: 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 -config runconfi
6480: 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e gf #f #f environ
6490: 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 -patt: #f))) ..
64a0: 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 (if (hash-t
64b0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
64c0: 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 runconfig (args
64d0: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
64e0: 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 rg") #f)... (ke
64f0: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 ys:target-set-ar
6500: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 gs keys (args:ge
6510: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
6520: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 ) args:arg-hash)
6530: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 ... (begin...
6540: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
6550: 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 "ERROR: [" (arg
6560: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
6570: 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 arg") "] not fou
6580: 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 nd in " runconfi
6590: 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c 69 74 gf)... (sqlit
65a0: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 e3:finalize! db)
65b0: 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 29 29 ... (exit 1))
65c0: 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 72 67 )).. (if (arg
65d0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
65e0: 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 et")...(keys:tar
65f0: 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 get-set-args key
6600: 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 s (args:get-arg
6610: 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a 61 "-target" args:a
6620: 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72 rg-hash) args:ar
6630: 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20 28 g-hash)))..(if (
6640: 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 not (car *config
6650: 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 info*)).. (be
6660: 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75 gin.. (debu
6670: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
6680: 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22 : Attempted to "
6690: 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 action-desc " b
66a0: 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 ut run area conf
66b0: 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e ig file not foun
66c0: 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 d").. (exit
66d0: 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 1)).. ;; Ext
66e0: 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e ract out stuff n
66f0: 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 eeded in most or
6700: 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 many calls..
6710: 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61 ;; here then ca
6720: 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 ll proc.. (le
6730: 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 t* ((keynames
6740: 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 (map key:get-fie
6750: 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 ldname keys))...
6760: 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 (keyvallst (
6770: 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 keys->vallist ke
6780: 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 ys #t)))..
6790: 28 70 72 6f 63 20 64 62 20 74 61 72 67 65 74 20 (proc db target
67a0: 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 runname keys key
67b0: 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 names keyvallst)
67c0: 29 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 6e ))..(sqlite3:fin
67d0: 61 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 65 74 alize! db)..(set
67e0: 21 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a ! *didsomething*
67f0: 20 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d #t))))))..;;===
6800: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6810: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6820: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6830: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6840: 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 ===.;; Rollup ru
6850: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ns.;;===========
6860: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6870: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6880: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6890: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 ===========..;;
68a0: 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f Update the test_
68b0: 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 meta table for t
68c0: 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 his test.(define
68d0: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 (runs:update-te
68e0: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d st_meta db test-
68f0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a name test-conf).
6900: 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 (let ((currrec
6910: 6f 72 64 20 28 64 62 3a 74 65 73 74 6d 65 74 61 ord (db:testmeta
6920: 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 -get-record db t
6930: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 est-name))).
6940: 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 (if (not currrec
6950: 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 ord)..(begin..
6960: 28 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 (set! currrecord
6970: 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 (make-vector 10
6980: 20 23 66 29 29 0a 09 20 20 28 64 62 3a 74 65 73 #f)).. (db:tes
6990: 74 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 tmeta-add-record
69a0: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 db test-name)))
69b0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
69c0: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 (lambda (ke
69d0: 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 y). (let*
69e0: 28 28 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 ((idx (cadr key)
69f0: 29 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 ).. (fld (c
6a00: 61 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 ar key))..
6a10: 20 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f (val (config-lo
6a20: 6f 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 okup test-conf "
6a30: 74 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 test_meta" fld))
6a40: 29 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 ).. ;; (debug:pr
6a50: 69 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 int 5 "idx: " id
6a60: 78 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 x " fld: " fld "
6a70: 20 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 val: " val).. (
6a80: 69 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 if (and val (not
6a90: 20 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 (equal? (vector
6aa0: 2d 72 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 -ref currrecord
6ab0: 69 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 idx) val)))..
6ac0: 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 (begin..
6ad0: 20 28 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e (print "Updatin
6ae0: 67 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 g " test-name "
6af0: 22 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c " fld " to " val
6b00: 29 0a 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 ).. (db:te
6b10: 73 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69 stmeta-update-fi
6b20: 65 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 eld db test-name
6b30: 20 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20 fld val))))).
6b40: 20 20 20 27 28 28 22 61 75 74 68 6f 72 22 20 32 '(("author" 2
6b50: 29 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65 )("owner" 3)("de
6b60: 73 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72 scription" 4)("r
6b70: 65 76 69 65 77 65 64 22 20 35 29 28 22 74 61 67 eviewed" 5)("tag
6b80: 73 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 s" 9)))))..;; Up
6b90: 64 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66 date test_meta f
6ba0: 6f 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 or all tests.(de
6bb0: 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 fine (runs:updat
6bc0: 65 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 e-all-test_meta
6bd0: 64 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73 db). (let ((tes
6be0: 74 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c t-names (get-all
6bf0: 2d 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a -legal-tests))).
6c00: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 (for-each .
6c10: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 (lambda (tes
6c20: 74 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 t-name). (
6c30: 6c 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 let* ((test-path
6c40: 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 (conc *toppa
6c50: 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 th* "/tests/" te
6c60: 73 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 st-name))..
6c70: 20 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 (test-configf (
6c80: 63 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 conc test-path "
6c90: 2f 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 /testconfig"))..
6ca0: 20 20 20 20 20 20 28 74 65 73 74 65 78 69 73 74 (testexist
6cb0: 73 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 s (and (file-e
6cc0: 78 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 xists? test-conf
6cd0: 69 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 igf)(file-read-a
6ce0: 63 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 ccess? test-conf
6cf0: 69 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b igf))).. ;;
6d00: 20 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69 read configs wi
6d10: 74 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64 th tricks turned
6d20: 20 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 off (i.e. no sy
6d30: 73 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65 stem).. (te
6d40: 73 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 st-conf (if t
6d50: 65 73 74 65 78 69 73 74 73 20 28 72 65 61 64 2d estexists (read-
6d60: 63 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 config test-conf
6d70: 69 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d igf #f #f)(make-
6d80: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 hash-table))))..
6d90: 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 (runs:update-te
6da0: 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d st_meta db test-
6db0: 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 name test-conf))
6dc0: 29 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 ). test-name
6dd0: 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f s)))..;; This co
6de0: 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 uld probably be
6df0: 72 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 refactored into
6e00: 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 one complex quer
6e10: 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 y ....(define (r
6e20: 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 uns:rollup-run d
6e30: 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 b keys keyvallst
6e40: 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b runname user) ;
6e50: 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f ; was target, no
6e60: 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 w keyvallst. (d
6e70: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 ebug:print 4 "ru
6e80: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b ns:rollup-run, k
6e90: 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 eys: " keys " ke
6ea0: 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 yvallst: " keyva
6eb0: 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 llst " :runname
6ec0: 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 " runname " user
6ed0: 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 : " user). (let
6ee0: 2a 20 28 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 * (; (keyvalllst
6ef0: 20 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67 (keys:targ
6f00: 65 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 et->keyval keys
6f10: 74 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d target)).. (new-
6f20: 72 75 6e 2d 69 64 20 20 20 20 20 20 28 72 75 6e run-id (run
6f30: 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 s:register-run d
6f40: 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 b keys keyvallst
6f50: 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 runname "new" "
6f60: 6e 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 n/a" user)).. (p
6f70: 72 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 rev-tests (
6f80: 74 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e test:get-matchin
6f90: 67 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d g-previous-test-
6fa0: 72 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e run-records db n
6fb0: 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 ew-run-id "%" "%
6fc0: 22 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 ")).. (curr-test
6fd0: 73 20 20 20 20 20 20 28 64 62 2d 67 65 74 2d 74 s (db-get-t
6fe0: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ests-for-run db
6ff0: 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 new-run-id "%" "
7000: 25 22 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 %" '() '())).. (
7010: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 curr-tests-hash
7020: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 (make-hash-table
7030: 29 29 29 0a 20 20 20 20 28 64 62 3a 75 70 64 61 ))). (db:upda
7040: 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d te-run-event_tim
7050: 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 e db new-run-id)
7060: 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 . ;; index th
7070: 65 20 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 e already saved
7080: 74 65 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d tests by testnam
7090: 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e e and itemdat in
70a0: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 curr-tests-hash
70b0: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 . (for-each.
70c0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 (lambda (tes
70d0: 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 tdat). (le
70e0: 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 t* ((testname (
70f0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
7100: 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 name testdat))..
7110: 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 (item-path
7120: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
7130: 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 em-path testdat)
7140: 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e ).. (full-n
7150: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 ame (conc testna
7160: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 me "/" item-path
7170: 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c ))).. (hash-tabl
7180: 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 e-set! curr-test
7190: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 s-hash full-name
71a0: 20 74 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 testdat))).
71b0: 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 curr-tests).
71c0: 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 ;; NOPE: Non-op
71d0: 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 timal approach.
71e0: 54 72 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 Try this instead
71f0: 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 .. ;; 1. te
7200: 73 74 73 20 61 72 65 20 72 65 63 65 69 76 65 64 sts are received
7210: 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 in a list, most
7220: 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 recent first.
7230: 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 ;; 2. replac
7240: 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 e the rollup tes
7250: 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a t with the new *
7260: 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 always*. (for
7270: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d -each . (lam
7280: 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 bda (testdat).
7290: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 (let* ((tes
72a0: 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d tname (db:test-
72b0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
72c0: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 tdat)).. (i
72d0: 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 tem-path (db:tes
72e0: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t-get-item-path
72f0: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 testdat))..
7300: 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e (full-name (con
7310: 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 c testname "/" i
7320: 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 tem-path))..
7330: 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 (prev-test-dat
7340: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
7350: 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 /default curr-te
7360: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 sts-hash full-na
7370: 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 me #f)).. (
7380: 74 65 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 test-steps
7390: 28 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f (db:get-steps-fo
73a0: 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74 65 r-test db (db:te
73b0: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
73c0: 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65 77 t))).. (new
73d0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 -test-record #f)
73e0: 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 ).. ;; replace t
73f0: 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 72 74 hese with insert
7400: 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 ... select.. (a
7410: 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 pply sqlite3:exe
7420: 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28 63 cute ...db ...(c
7430: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 onc "INSERT OR R
7440: 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 EPLACE INTO test
7450: 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 s (run_id,testna
7460: 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c me,state,status,
7470: 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c event_time,host,
7480: 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 cpuload,diskfree
7490: 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 ,uname,rundir,it
74a0: 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 em_path,run_dura
74b0: 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c tion,final_logf,
74c0: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 comment) "...
74d0: 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c "VALUES (?,?,
74e0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
74f0: 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 ?,?,?,?);")...ne
7500: 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 w-run-id (cddr (
7510: 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 vector->list tes
7520: 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 tdat))).. (set!
7530: 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 new-testdat (car
7540: 20 28 64 62 2d 67 65 74 2d 74 65 73 74 73 2d 66 (db-get-tests-f
7550: 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 or-run db new-ru
7560: 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 n-id testname it
7570: 65 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 em-path '() '())
7580: 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 )).. (hash-table
7590: 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 -set! curr-tests
75a0: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 -hash full-name
75b0: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 new-testdat) ;;
75c0: 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f this could be co
75d0: 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 nfusing, which r
75e0: 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 ecord should go
75f0: 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 into the lookup
7600: 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 table?.. ;; Now
7610: 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 duplicate the te
7620: 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 st steps.. (debu
7630: 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 g:print 4 "Copyi
7640: 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 ng records in te
7650: 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 st_steps from te
7660: 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 st_id=" (db:test
7670: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 -get-id testdat)
7680: 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 " to " (db:test
7690: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 -get-id new-test
76a0: 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 dat)).. (sqlite3
76b0: 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 :execute .. db
76c0: 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 .. (conc "INSER
76d0: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
76e0: 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 O test_steps (te
76f0: 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 st_id,stepname,s
7700: 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e tate,status,even
7710: 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 t_time,comment)
7720: 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 "..."SELECT " (d
7730: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 b:test-get-id ne
7740: 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 w-testdat) ",ste
7750: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 pname,state,stat
7760: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f us,event_time,co
7770: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f mment FROM test_
7780: 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 steps WHERE test
7790: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a _id=?;").. (db:
77a0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
77b0: 64 61 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 dat)).. ;; Now d
77c0: 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 uplicate the tes
77d0: 74 20 64 61 74 61 0a 09 20 28 64 65 62 75 67 3a t data.. (debug:
77e0: 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 print 4 "Copying
77f0: 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 records in test
7800: 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f _data from test_
7810: 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 id=" (db:test-ge
7820: 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 t-id testdat) "
7830: 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 to " (db:test-ge
7840: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
7850: 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 )).. (sqlite3:ex
7860: 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 ecute .. db ..
7870: 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f (conc "INSERT O
7880: 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 R REPLACE INTO t
7890: 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 est_data (test_i
78a0: 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 d,category,varia
78b0: 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 ble,value,expect
78c0: 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d ed,tol,units,com
78d0: 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 ment) "..."SELEC
78e0: 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 T " (db:test-get
78f0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
7900: 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 ",category,vari
7910: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 able,value,expec
7920: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f ted,tol,units,co
7930: 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f mment FROM test_
7940: 64 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f data WHERE test_
7950: 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 id=?;").. (db:t
7960: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
7970: 61 74 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 at)).. )). p
7980: 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a rev-tests))).. .
7990: 20 20 20 20 20 0a .