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