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 20 28 69 dot-locking (
01c0: 73 72 66 69 20 31 38 29 29 0a 28 69 6d 70 6f 72 srfi 18)).(impor
01d0: 74 20 28 70 72 65 66 69 78 20 73 71 6c 69 74 65 t (prefix sqlite
01e0: 33 20 73 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 3 sqlite3:))..(d
01f0: 65 63 6c 61 72 65 20 28 75 6e 69 74 20 72 75 6e eclare (unit run
0200: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73 s)).(declare (us
0210: 65 73 20 64 62 29 29 0a 28 64 65 63 6c 61 72 65 es db)).(declare
0220: 20 28 75 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a (uses common)).
0230: 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 69 (declare (uses i
0240: 74 65 6d 73 29 29 0a 28 64 65 63 6c 61 72 65 20 tems)).(declare
0250: 28 75 73 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 (uses runconfig)
0260: 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 ).(declare (uses
0270: 20 74 65 73 74 73 29 29 0a 28 64 65 63 6c 61 72 tests)).(declar
0280: 65 20 28 75 73 65 73 20 73 65 72 76 65 72 29 29 e (uses server))
0290: 0a 0a 28 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d ..(include "comm
02a0: 6f 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 on_records.scm")
02b0: 0a 28 69 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 .(include "key_r
02c0: 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e ecords.scm").(in
02d0: 63 6c 75 64 65 20 22 64 62 5f 72 65 63 6f 72 64 clude "db_record
02e0: 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 s.scm").(include
02f0: 20 22 72 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 "run_records.sc
0300: 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 m").(include "te
0310: 73 74 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 st_records.scm")
0320: 0a 0a 3b 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 ..;; runs:get-ru
0330: 6e 73 2d 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 ns-by-patt.;; ge
0340: 74 20 72 75 6e 73 20 62 79 20 6c 69 73 74 20 6f t runs by list o
0350: 66 20 63 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 f criteria.;; re
0360: 67 69 73 74 65 72 20 61 20 74 65 73 74 20 72 75 gister a test ru
0370: 6e 20 77 69 74 68 20 74 68 65 20 64 62 0a 3b 3b n with the db.;;
0380: 0a 3b 3b 20 55 73 65 3a 20 28 64 62 2d 67 65 74 .;; Use: (db-get
0390: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
03a0: 20 28 64 62 3a 67 65 74 2d 68 65 61 64 65 72 20 (db:get-header
03b0: 72 75 6e 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d runinfo)(db:get-
03c0: 72 6f 77 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b row runinfo)).;;
03d0: 20 20 74 6f 20 65 78 74 72 61 63 74 20 69 6e 66 to extract inf
03e0: 6f 20 66 72 6f 6d 20 74 68 65 20 73 74 72 75 63 o from the struc
03f0: 74 75 72 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b ture returned.;;
0400: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 .(define (runs:g
0410: 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 et-runs-by-patt
0420: 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 db keys runnamep
0430: 61 74 74 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b att . params) ;;
0440: 20 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c test-name). (l
0450: 65 74 2a 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 et* ((keyvallst
0460: 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b (keys->vallist k
0470: 65 79 73 29 29 0a 09 20 28 74 6d 70 20 20 20 20 eys)).. (tmp
0480: 20 20 28 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d (runs:get-std-
0490: 72 75 6e 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 run-fields keys
04a0: 27 28 22 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 '("id" "runname"
04b0: 20 22 73 74 61 74 65 22 20 22 73 74 61 74 75 73 "state" "status
04c0: 22 20 22 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 " "owner" "event
04d0: 5f 74 69 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 _time"))).. (key
04e0: 73 74 72 20 20 20 28 63 61 72 20 74 6d 70 29 29 str (car tmp))
04f0: 0a 09 20 28 68 65 61 64 65 72 20 20 20 28 63 61 .. (header (ca
0500: 64 72 20 74 6d 70 29 29 0a 09 20 28 72 65 73 20 dr tmp)).. (res
0510: 20 20 20 20 27 28 29 29 0a 09 20 28 6b 65 79 2d '()).. (key-
0520: 70 61 74 74 20 22 22 29 29 0a 20 20 20 20 28 66 patt "")). (f
0530: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
0540: 28 6b 65 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a (keyval)...(let*
0550: 20 28 28 6b 65 79 20 20 20 20 28 76 65 63 74 6f ((key (vecto
0560: 72 2d 72 65 66 20 6b 65 79 76 61 6c 20 30 29 29 r-ref keyval 0))
0570: 0a 09 09 20 20 20 20 20 20 20 28 66 75 6c 6b 65 ... (fulke
0580: 79 20 28 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 y (conc ":" key)
0590: 29 0a 09 09 20 20 20 20 20 20 20 28 70 61 74 74 )... (patt
05a0: 20 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 (args:get-arg
05b0: 20 66 75 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 fulkey)))... (
05c0: 69 66 20 70 61 74 74 0a 09 09 20 20 20 20 20 20 if patt...
05d0: 28 73 65 74 21 20 6b 65 79 2d 70 61 74 74 20 28 (set! key-patt (
05e0: 63 6f 6e 63 20 6b 65 79 2d 70 61 74 74 20 22 20 conc key-patt "
05f0: 41 4e 44 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 AND " key " like
0600: 20 27 22 20 70 61 74 74 20 22 27 22 29 29 0a 09 '" patt "'"))..
0610: 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 . (begin...
0620: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 .(debug:print 0
0630: 22 45 52 52 4f 52 3a 20 73 65 61 72 63 68 69 6e "ERROR: searchin
0640: 67 20 66 6f 72 20 72 75 6e 73 20 77 69 74 68 20 g for runs with
0650: 6e 6f 20 70 61 74 74 65 72 6e 20 73 65 74 20 66 no pattern set f
0660: 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 or " fulkey)....
0670: 28 65 78 69 74 20 36 29 29 29 29 29 0a 09 20 20 (exit 6)))))..
0680: 20 20 20 20 6b 65 79 73 29 0a 20 20 20 20 28 73 keys). (s
0690: 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d qlite3:for-each-
06a0: 72 6f 77 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 row . (lambd
06b0: 61 20 28 61 20 2e 20 72 29 0a 20 20 20 20 20 20 a (a . r).
06c0: 20 28 73 65 74 21 20 72 65 73 20 28 63 6f 6e 73 (set! res (cons
06d0: 20 28 6c 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 (list->vector (
06e0: 63 6f 6e 73 20 61 20 72 29 29 20 72 65 73 29 29 cons a r)) res))
06f0: 29 0a 20 20 20 20 20 64 62 20 0a 20 20 20 20 20 ). db .
0700: 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 (conc "SELECT "
0710: 6b 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 keystr " FROM ru
0720: 6e 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 ns WHERE runname
0730: 20 6c 69 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 like ? " key-pa
0740: 74 74 20 22 3b 22 29 0a 20 20 20 20 20 72 75 6e tt ";"). run
0750: 6e 61 6d 65 70 61 74 74 29 0a 20 20 20 20 28 76 namepatt). (v
0760: 65 63 74 6f 72 20 68 65 61 64 65 72 20 72 65 73 ector header res
0770: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 )))..(define (ru
0780: 6e 73 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c ns:test-get-full
0790: 2d 70 61 74 68 20 74 65 73 74 29 0a 20 20 28 6c -path test). (l
07a0: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 28 et* ((testname (
07b0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
07c0: 6e 61 6d 65 20 20 20 74 65 73 74 29 29 0a 09 20 name test))..
07d0: 28 69 74 65 6d 70 61 74 68 20 28 64 62 3a 74 65 (itempath (db:te
07e0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
07f0: 20 74 65 73 74 29 29 29 0a 20 20 20 20 28 63 6f test))). (co
0800: 6e 63 20 74 65 73 74 6e 61 6d 65 20 28 69 66 20 nc testname (if
0810: 28 65 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 (equal? itempath
0820: 20 22 22 29 20 22 22 20 28 63 6f 6e 63 20 22 28 "") "" (conc "(
0830: 22 20 69 74 65 6d 70 61 74 68 20 22 29 22 29 29 " itempath ")"))
0840: 29 29 29 0a 0a 0a 28 64 65 66 69 6e 65 20 28 73 )))...(define (s
0850: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
0860: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 0a vars db run-id).
0870: 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 28 72 (let ((keys (r
0880: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db:get-keys db))
0890: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 ). (for-each
08a0: 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 (lambda (key)...
08b0: 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 (sqlite3:for-eac
08c0: 68 2d 72 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 h-row... (lambda
08d0: 20 28 76 61 6c 29 0a 09 09 20 20 20 28 64 65 62 (val)... (deb
08e0: 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 65 ug:print 2 "sete
08f0: 6e 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 nv " (key:get-fi
0900: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 eldname key) " "
0910: 20 76 61 6c 29 0a 09 09 20 20 20 28 73 65 74 65 val)... (sete
0920: 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c nv (key:get-fiel
0930: 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 dname key) val))
0940: 0a 09 09 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 ... db ... (conc
0950: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a "SELECT " (key:
0960: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
0970: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 y) " FROM runs W
0980: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 HERE id=?;")...
0990: 72 75 6e 2d 69 64 29 29 0a 09 20 20 20 20 20 20 run-id))..
09a0: 6b 65 79 73 29 0a 20 20 20 20 28 61 6c 69 73 74 keys). (alist
09b0: 2d 3e 65 6e 76 2d 76 61 72 73 20 28 68 61 73 68 ->env-vars (hash
09c0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
09d0: 6c 74 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 lt *configdat* "
09e0: 65 6e 76 2d 6f 76 65 72 72 69 64 65 22 20 27 28 env-override" '(
09f0: 29 29 29 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 ))). ;; Lets
0a00: 75 73 65 20 74 68 69 73 20 61 73 20 61 6e 20 6f use this as an o
0a10: 70 70 6f 72 74 75 6e 69 74 79 20 74 6f 20 70 75 pportunity to pu
0a20: 74 20 4d 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 t MT_RUNNAME in
0a30: 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a the environment.
0a40: 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 (sqlite3:for
0a50: 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20 20 20 28 -each-row. (
0a60: 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 lambda (runname)
0a70: 0a 20 20 20 20 20 20 20 28 73 65 74 65 6e 76 20 . (setenv
0a80: 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 72 75 6e "MT_RUNNAME" run
0a90: 6e 61 6d 65 29 29 0a 20 20 20 20 20 64 62 0a 20 name)). db.
0aa0: 20 20 20 20 22 53 45 4c 45 43 54 20 72 75 6e 6e "SELECT runn
0ab0: 61 6d 65 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 ame FROM runs WH
0ac0: 45 52 45 20 69 64 3d 3f 3b 22 0a 20 20 20 20 20 ERE id=?;".
0ad0: 72 75 6e 2d 69 64 29 0a 20 20 20 20 29 29 0a 0a run-id). ))..
0ae0: 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 74 65 (define (set-ite
0af0: 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 6d 64 m-env-vars itemd
0b00: 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 68 20 at). (for-each
0b10: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 0a 09 (lambda (item)..
0b20: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
0b30: 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 28 nt 2 "setenv " (
0b40: 63 61 72 20 69 74 65 6d 29 20 22 20 22 20 28 63 car item) " " (c
0b50: 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20 20 20 adr item))..
0b60: 20 20 28 73 65 74 65 6e 76 20 28 63 61 72 20 69 (setenv (car i
0b70: 74 65 6d 29 20 28 63 61 64 72 20 69 74 65 6d 29 tem) (cadr item)
0b80: 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61 74 29 )).. itemdat)
0b90: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 )..(define (runs
0ba0: 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 :can-run-more-te
0bb0: 73 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f sts db test-reco
0bc0: 72 64 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 rd). (let* ((tc
0bd0: 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20 20 20 onfig
0be0: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 (tests:tes
0bf0: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 tqueue-get-testc
0c00: 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 onfig test-recor
0c10: 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 d)).. (jobgroup
0c20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 (
0c30: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 config-lookup tc
0c40: 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 onfig "requireme
0c50: 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 nts" "jobgroup")
0c60: 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 ).. (num-running
0c70: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 62 (db
0c80: 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 :get-count-tests
0c90: 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 -running db))..
0ca0: 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d (num-running-in-
0cb0: 6a 6f 62 67 72 6f 75 70 20 28 64 62 3a 67 65 74 jobgroup (db:get
0cc0: 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e -count-tests-run
0cd0: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 ning-in-jobgroup
0ce0: 20 64 62 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 db jobgroup))..
0cf0: 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 (max-concurrent
0d00: 2d 6a 6f 62 73 20 20 20 20 20 28 63 6f 6e 66 69 -jobs (confi
0d10: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
0d20: 64 61 74 2a 20 22 73 65 74 75 70 22 20 20 20 20 dat* "setup"
0d30: 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 "max_concurrent
0d40: 5f 6a 6f 62 73 22 29 29 0a 09 20 28 6a 6f 62 2d _jobs")).. (job-
0d50: 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 group-limit
0d60: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b (config-look
0d70: 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 up *configdat* "
0d80: 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 jobgroups" jobgr
0d90: 6f 75 70 29 29 29 0a 20 20 20 20 28 64 65 62 75 oup))). (debu
0da0: 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 g:print 2 "max-c
0db0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 oncurrent-jobs:
0dc0: 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 " max-concurrent
0dd0: 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e -jobs ", num-run
0de0: 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e ning: " num-runn
0df0: 69 6e 67 29 0a 20 20 20 20 28 69 66 20 28 6e 6f ing). (if (no
0e00: 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c t (eq? 0 *global
0e10: 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a 09 23 exitstatus*))..#
0e20: 66 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f f..(let ((can-no
0e30: 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 t-run-more (cond
0e40: 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d ..... ;; if max-
0e50: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 concurrent-jobs
0e60: 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 20 6e is set and the n
0e70: 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 umber running is
0e80: 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 20 3b greater ..... ;
0e90: 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e 20 63 ; than it than c
0ea0: 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a annot run more j
0eb0: 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 20 6d obs..... ((and m
0ec0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0ed0: 62 73 0a 09 09 09 09 20 20 20 20 20 20 20 28 73 bs..... (s
0ee0: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 tring->number ma
0ef0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
0f00: 73 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e s)..... (>
0f10: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 = num-running (s
0f20: 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 tring->number ma
0f30: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
0f40: 73 29 29 29 0a 09 09 09 09 20 20 28 64 65 62 75 s)))..... (debu
0f50: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
0f60: 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 NG: Max running
0f70: 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20 63 jobs exceeded, c
0f80: 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 urrent number ru
0f90: 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e nning: " num-run
0fa0: 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20 20 20 ning ......
0fb0: 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 ", max_concurr
0fc0: 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d ent_jobs: " max-
0fd0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 concurrent-jobs)
0fe0: 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 09 20 ..... #t).....
0ff0: 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d ;; if job-group-
1000: 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61 6e 64 limit is set and
1010: 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 number of jobs
1020: 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69 73 20 in the group is
1030: 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 greater..... ;;
1040: 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 than the limit t
1050: 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d hen cannot run m
1060: 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 ore jobs of this
1070: 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 kind..... ((and
1080: 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 job-group-limit
1090: 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 ..... (>=
10a0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
10b0: 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 obgroup job-grou
10c0: 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09 20 20 p-limit)).....
10d0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
10e0: 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 WARNING: number
10f0: 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 of jobs " num-ru
1100: 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 nning-in-jobgrou
1110: 70 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 p ...... "
1120: 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 in " jobgroup "
1130: 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 exceeded, will
1140: 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73 74 73 not run " (tests
1150: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
1160: 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 estname test-rec
1170: 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74 29 0a ord))..... #t).
1180: 09 09 09 09 20 28 65 6c 73 65 20 23 66 29 29 29 .... (else #f)))
1190: 29 0a 09 20 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f ).. (not can-no
11a0: 74 2d 72 75 6e 2d 6d 6f 72 65 29 29 29 29 29 0a t-run-more))))).
11b0: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
11c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
11d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
11e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
11f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 =========.;; New
1200: 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 methodology. Th
1210: 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 69 6c ese routines wil
1220: 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 61 62 l replace the ab
1230: 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 ove in time. For
1240: 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 .;; now the code
1250: 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 2e 20 is duplicated.
1260: 54 68 69 73 20 73 74 75 66 66 20 69 73 20 69 6e This stuff is in
1270: 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 itially used in
1280: 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 the monitor.;; b
1290: 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d ased code..;;===
12a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12e0: 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 ===..;; register
12f0: 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 74 68 a test run with
1300: 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e 65 20 the db.(define
1310: 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 (runs:register-r
1320: 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 un db keys keyva
1330: 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 llst runname sta
1340: 74 65 20 73 74 61 74 75 73 20 75 73 65 72 29 0a te status user).
1350: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 (debug:print 3
1360: 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d "runs:register-
1370: 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 run, keys: " key
1380: 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 s " keyvallst: "
1390: 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72 75 6e keyvallst " run
13a0: 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 name: " runname
13b0: 22 20 73 74 61 74 65 3a 20 22 20 73 74 61 74 65 " state: " state
13c0: 20 22 20 73 74 61 74 75 73 3a 20 22 20 73 74 61 " status: " sta
13d0: 74 75 73 20 22 20 75 73 65 72 3a 20 22 20 75 73 tus " user: " us
13e0: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 er). (let* ((ke
13f0: 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b ystr (keys->k
1400: 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09 20 28 eystr keys)).. (
1410: 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20 28 3e comma (if (>
1420: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 (length keys) 0
1430: 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28 61 6e ) "," "")).. (an
1440: 64 73 74 72 20 20 20 20 28 69 66 20 28 3e 20 28 dstr (if (> (
1450: 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 length keys) 0)
1460: 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09 20 28 " AND " "")).. (
1470: 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d valslots (keys-
1480: 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 >valslots keys))
1490: 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 ;; ?,?,? .....
14a0: 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61 70 20 (keyvals (map
14b0: 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 cadr keyvallst))
14c0: 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 .. (allvals (a
14d0: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e ppend (list runn
14e0: 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 75 73 ame state status
14f0: 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73 29 29 user) keyvals))
1500: 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20 28 61 .. (qryvals (a
1510: 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e ppend (list runn
1520: 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 ame) keyvals))..
1530: 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 (key=?str (str
1540: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
1550: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 (map (lambda (k)
1560: 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 (conc (key:get-f
1570: 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 ieldname k) "=?"
1580: 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 )) keys) " AND "
1590: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ))). (debug:p
15a0: 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 rint 3 "keys: "
15b0: 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 keys " allvals:
15c0: 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 " allvals " keyv
15d0: 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a als: " keyvals).
15e0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
15f0: 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 2 "NOTE: using
1600: 74 61 72 67 65 74 20 22 20 28 73 74 72 69 6e 67 target " (string
1610: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 -intersperse key
1620: 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f 72 20 vals "/") " for
1630: 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 20 28 this run"). (
1640: 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 if (and runname
1650: 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 (null? (filter (
1660: 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 78 lambda (x)(not x
1670: 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b )) keyvals))) ;;
1680: 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 20 61 there must be a
1690: 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20 22 better way to "
16a0: 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 apply and"..(let
16b0: 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 20 28 ((res #f)).. (
16c0: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 apply sqlite3:ex
16d0: 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 20 22 ecute db (conc "
16e0: 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 INSERT OR IGNORE
16f0: 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e INTO runs (runn
1700: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
1710: 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d ,owner,event_tim
1720: 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 e" comma keystr
1730: 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f ") VALUES (?,?,?
1740: 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27 ,?,strftime('%s'
1750: 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 ,'now')" comma v
1760: 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 alslots ");")...
1770: 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 allvals).. (ap
1780: 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d ply sqlite3:for-
1790: 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c each-row .. (l
17a0: 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 20 20 ambda (id)..
17b0: 20 28 73 65 74 21 20 72 65 73 20 69 64 29 29 0a (set! res id)).
17c0: 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 74 20 . db.. (let
17d0: 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 45 4c ((qry (conc "SEL
17e0: 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 ECT id FROM runs
17f0: 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d WHERE (runname=
1800: 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f ? " andstr key=?
1810: 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 20 20 str ");")))..
1820: 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 20 ;(debug:print
1830: 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 20 0a 4 "qry: " qry) .
1840: 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 20 71 . qry).. q
1850: 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 ryvals).. (sqli
1860: 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 te3:execute db "
1870: 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 54 20 UPDATE runs SET
1880: 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f state=?,status=?
1890: 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 WHERE id=?;" st
18a0: 61 74 65 20 73 74 61 74 75 73 20 72 65 73 29 0a ate status res).
18b0: 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 69 6e . res) ..(begin
18c0: 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
18d0: 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 0 "ERROR: Calle
18e0: 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 d without all ne
18f0: 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 0a 09 cessary keys")..
1900: 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 #f))))..;; Thi
1910: 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 74 65 s is a duplicate
1920: 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 28 77 of run-tests (w
1930: 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 64 65 hich has been de
1940: 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 20 74 precated). Use t
1950: 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 his one instead
1960: 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b of run tests..;;
1970: 20 6b 65 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 keyvals.(define
1980: 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 (runs:run-tests
1990: 20 64 62 20 74 61 72 67 65 74 20 72 75 6e 6e 61 db target runna
19a0: 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 75 73 me test-patts us
19b0: 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 er flags). (let
19c0: 2a 20 28 28 6b 65 79 73 20 20 20 20 20 20 20 20 * ((keys
19d0: 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 (rdb:get-keys db
19e0: 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 )).. (keyvallst
19f0: 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e (keys:target->
1a00: 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 keyval keys targ
1a10: 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 et)).. (run-id
1a20: 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69 73 74 (runs:regist
1a30: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b er-run db keys k
1a40: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 eyvallst runname
1a50: 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 65 "new" "n/a" use
1a60: 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 r)) ;; test-na
1a70: 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 65 me))).. (deferre
1a80: 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 6c d '()) ;; del
1a90: 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 ay running these
1aa0: 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 65 since they have
1ab0: 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 a waiton clause
1ac0: 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 .. ;; keepgoing
1ad0: 69 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 6d is the defacto m
1ae0: 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c odality now, wil
1af0: 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 l add hit-n-run
1b00: 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b a bit later.. ;;
1b10: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 68 (keepgoing (h
1b20: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
1b30: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 fault flags "-ke
1b40: 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 epgoing" #f))..
1b50: 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 (test-names '()
1b60: 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 ).. (runconfigf
1b70: 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 (conc *toppat
1b80: 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e h* "/runconfigs.
1b90: 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65 71 config")).. (req
1ba0: 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29 29 uired-tests '())
1bb0: 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64 73 .. (test-records
1bc0: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c (make-hash-tabl
1bd0: 65 29 29 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d e))).. (set-m
1be0: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
1bf0: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 db run-id) ;; t
1c00: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 hese may be need
1c10: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 ed by the launch
1c20: 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 ing process..
1c30: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 (if (file-exist
1c40: 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 s? runconfigf)..
1c50: 28 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 (setup-env-defau
1c60: 6c 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 lts db runconfig
1c70: 66 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 f run-id *alread
1c80: 79 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 y-seen-runconfig
1c90: 2d 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e -info* "pre-laun
1ca0: 63 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 ch-env-vars")..(
1cb0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
1cc0: 41 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e ARNING: You do n
1cd0: 6f 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f ot have a run co
1ce0: 6e 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e nfig file: " run
1cf0: 63 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 configf)). .
1d00: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c ;; look up al
1d10: 6c 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 l tests matching
1d20: 20 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 the comma separ
1d30: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f ated list of glo
1d40: 62 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 bs in. ;; tes
1d50: 74 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 t-patts (using %
1d60: 20 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 as wildcard).
1d70: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
1d80: 20 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 (lambda (patt)
1d90: 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 . (let ((t
1da0: 65 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ests (glob (conc
1db0: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
1dc0: 74 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 ts/" (string-tra
1dd0: 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 nslate patt "%"
1de0: 22 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 "*"))))).. (set!
1df0: 20 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 tests (filter (
1e00: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 lambda (test)(fi
1e10: 6c 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 le-exists? (conc
1e20: 20 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 test "/testconf
1e30: 69 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 ig"))) tests))..
1e40: 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 (set! test-name
1e50: 73 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e s (append test-n
1e60: 61 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 ames ..... (map
1e70: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 (lambda (testp)
1e80: 0a 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 ...... (last (st
1e90: 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 ring-split testp
1ea0: 20 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 "/"))).....
1eb0: 20 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 tests))))).
1ec0: 20 20 20 28 69 66 20 74 65 73 74 2d 70 61 74 74 (if test-patt
1ed0: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 s (string-split
1ee0: 74 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28 test-patts ",")(
1ef0: 6c 69 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20 list "%")))..
1f00: 20 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 ;; now remove
1f10: 64 75 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 duplicates. (
1f20: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 set! test-names
1f30: 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 (delete-duplicat
1f40: 65 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a es test-names)).
1f50: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
1f60: 74 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 t 0 "INFO: test
1f70: 6e 61 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d names " test-nam
1f80: 65 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 es).. ;; on t
1f90: 68 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 he first pass or
1fa0: 20 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 call to run-tes
1fb0: 74 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 ts set FAILS to
1fc0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 NOT_STARTED if.
1fd0: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 ;; -keepgoing
1fe0: 20 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 is specified.
1ff0: 20 20 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 (if (eq? *pass
2000: 6e 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a num* 0)..(begin.
2010: 09 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 . ;; have to de
2020: 6c 65 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 lete test record
2030: 73 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 s where NOT_STAR
2040: 54 45 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 TED since they c
2050: 61 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f an cause -keepgo
2060: 69 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 ing to .. ;; ge
2070: 74 20 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 t stuck due to b
2080: 65 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 ecoming inaccess
2090: 69 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c ible from a fail
20a0: 65 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 ed test. I.e. if
20b0: 20 74 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 test B depends
20c0: 0a 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 .. ;; on test A
20d0: 20 62 75 74 20 74 65 73 74 20 42 20 72 65 61 63 but test B reac
20e0: 68 65 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e hed the point on
20f0: 20 62 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 being registere
2100: 64 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 d as NOT_STARTED
2110: 20 61 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 and test.. ;;
2120: 41 20 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d A failed for som
2130: 65 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e e reason then on
2140: 20 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b re-run using -k
2150: 65 65 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e eepgoing the run
2160: 20 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c can never compl
2170: 65 74 65 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 ete... (db:dele
2180: 74 65 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 te-tests-in-stat
2190: 65 20 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 e db run-id "NOT
21a0: 5f 53 54 41 52 54 45 44 22 29 0a 09 20 20 28 72 _STARTED").. (r
21b0: 64 62 3a 73 65 74 2d 74 65 73 74 73 2d 73 74 61 db:set-tests-sta
21c0: 74 65 2d 73 74 61 74 75 73 20 64 62 20 72 75 6e te-status db run
21d0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 -id test-names #
21e0: 66 20 22 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 f "FAIL" "NOT_ST
21f0: 41 52 54 45 44 22 20 22 46 41 49 4c 22 29 29 29 ARTED" "FAIL")))
2200: 0a 0a 20 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 .. ;; now add
2210: 20 6e 6f 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 non-directly re
2220: 66 65 72 65 6e 63 65 64 20 64 65 70 65 6e 64 65 ferenced depende
2230: 6e 63 69 65 73 20 28 69 2e 65 2e 20 77 61 69 74 ncies (i.e. wait
2240: 6f 6e 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 on). (if (not
2250: 20 28 6e 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d (null? test-nam
2260: 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 es))..(let loop
2270: 28 28 68 65 64 20 28 63 61 72 20 74 65 73 74 2d ((hed (car test-
2280: 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61 names))... (ta
2290: 6c 20 28 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 l (cdr test-name
22a0: 73 29 29 29 20 20 20 20 20 20 20 20 20 3b 3b 20 s))) ;;
22b0: 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 'return-procs te
22c0: 6c 6c 73 20 74 68 65 20 63 6f 6e 66 69 67 20 72 lls the config r
22d0: 65 61 64 65 72 20 74 6f 20 70 72 65 70 20 72 75 eader to prep ru
22e0: 6e 6e 69 6e 67 20 73 79 73 74 65 6d 20 62 75 74 nning system but
22f0: 20 72 65 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 return a proc..
2300: 20 20 28 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 (let* ((config
2310: 20 20 28 74 65 73 74 73 3a 67 65 74 2d 74 65 73 (tests:get-tes
2320: 74 63 6f 6e 66 69 67 20 68 65 64 20 27 72 65 74 tconfig hed 'ret
2330: 75 72 6e 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 urn-procs))... (
2340: 77 61 69 74 6f 6e 73 20 28 73 74 72 69 6e 67 2d waitons (string-
2350: 73 70 6c 69 74 20 28 6c 65 74 20 28 28 77 20 28 split (let ((w (
2360: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f config-lookup co
2370: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e nfig "requiremen
2380: 74 73 22 20 22 77 61 69 74 6f 6e 22 29 29 29 0a ts" "waiton"))).
2390: 09 09 09 09 09 20 20 28 69 66 20 77 20 77 20 22 ..... (if w w "
23a0: 22 29 29 29 29 29 0a 09 20 20 20 20 3b 3b 20 28 "))))).. ;; (
23b0: 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 items (items:g
23c0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
23d0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 nfig config)))..
23e0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 (if (not (ha
23f0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
2400: 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 64 ault test-record
2410: 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 61 s hed #f))...(ha
2420: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 sh-table-set! te
2430: 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 20 st-records.....
2440: 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 64 20 hed (vector hed
2450: 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 ;; 0......
2460: 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a config ;; 1.
2470: 09 09 09 09 09 20 20 20 20 20 77 61 69 74 6f 6e ..... waiton
2480: 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 20 s ;; 2......
2490: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
24a0: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d config "requirem
24b0: 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 22 ents" "priority"
24c0: 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 ) ;; priorit
24d0: 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 28 6c y 3...... (l
24e0: 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 20 20 et ((items
24f0: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
2500: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 default config "
2510: 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 items" #f)) ;; i
2520: 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20 20 tems 4.......
2530: 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61 73 (itemstable (has
2540: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
2550: 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d ult config "item
2560: 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a 09 stable" #f))) ..
2570: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 .... ;; if
2580: 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f 72 either items or
2590: 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73 20 items table is
25a0: 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69 74 a proc return it
25b0: 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 so test running
25c0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 ...... ;;
25d0: 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 process can know
25e0: 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 to call items:g
25f0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
2600: 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 20 20 nfig......
2610: 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 73 ;; if either is
2620: 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 a list and none
2630: 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61 68 is a proc go ah
2640: 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 ead and call get
2650: 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20 20 -items......
2660: 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 ;; otherwise
2670: 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69 73 return #f - this
2680: 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 is not an itera
2690: 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 20 20 ted test......
26a0: 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 (cond......
26b0: 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 .((procedure? it
26c0: 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09 09 ems) ......
26d0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
26e0: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73 "INFO: items is
26f0: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 a procedure, wi
2700: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a ll calc later").
2710: 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 20 20 ...... items)
2720: 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 ;; calc
2730: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 70 later.......((p
2740: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 74 rocedure? itemst
2750: 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 64 65 able)....... (de
2760: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
2770: 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 69 73 O: itemstable is
2780: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 a procedure, wi
2790: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a ll calc later").
27a0: 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62 6c ...... itemstabl
27b0: 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 e) ;; calc
27c0: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 66 later.......((f
27d0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 ilter (lambda (x
27e0: 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65 74 )........ (let
27f0: 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29 29 ((val (car x)))
2800: 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69 66 ........ (if
2810: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61 6c (procedure? val
2820: 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09 09 ) val #f))).....
2830: 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66 20 ... (append (if
2840: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 (list? items) it
2850: 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09 09 ems '())........
2860: 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 . (if (list? ite
2870: 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74 61 mstable) itemsta
2880: 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09 09 ble '())))......
2890: 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 . 'have-procedur
28a0: 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28 6c e).......((or (l
28b0: 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 ist? items)(list
28c0: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 3b ? itemstable)) ;
28d0: 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 ; calc now......
28e0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
28f0: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e "INFO: items an
2900: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65 d itemstable are
2910: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 lists, calc now
2920: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20 \n"........
2930: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69 " items: " i
2940: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c tems " itemstabl
2950: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29 e: " itemstable)
2960: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67 ....... (items:g
2970: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
2980: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 nfig config))...
2990: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20 ....(else #f)))
29a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29b0: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 ;; not
29c0: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20 iterated......
29d0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69 #f ;; i
29e0: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20 temsdat 5......
29f0: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73 #f ;; s
2a00: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20 pare - used for
2a10: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20 item-path......
2a20: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f ))).. (fo
2a30: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c r-each .. (l
2a40: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 ambda (waiton)..
2a50: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 (if (and
2a60: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d waiton (not (mem
2a70: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d ber waiton test-
2a80: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62 names)))... (b
2a90: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74 egin... (set
2aa0: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 ! required-tests
2ab0: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 (cons waiton re
2ac0: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 quired-tests))..
2ad0: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 . (set! test
2ae0: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 -names (cons wai
2af0: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 ton test-names))
2b00: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 ))) ;; was an ap
2b10: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 pend, now a cons
2b20: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a .. waitons).
2b30: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 . (let ((remt
2b40: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70 ests (delete-dup
2b50: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20 licates (append
2b60: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a waitons tal)))).
2b70: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 . (if (not
2b80: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 (null? remtests)
2b90: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 )... (loop (car
2ba0: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72 remtests)(cdr r
2bb0: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a emtests)))))))..
2bc0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
2bd0: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73 ll? required-tes
2be0: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 ts))..(debug:pri
2bf0: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 nt 1 "INFO: Addi
2c00: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 ng " required-te
2c10: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e sts " to the run
2c20: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b queue")). ;;
2c30: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 NOTE: these are
2c40: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 all parent test
2c50: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 s, items are not
2c60: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 expanded yet..
2c70: 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 (runs:run-tes
2c80: 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e 2d ts-queue db run-
2c90: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
2ca0: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 records keyvalls
2cb0: 74 20 66 6c 61 67 73 29 0a 20 20 20 20 28 69 66 t flags). (if
2cc0: 20 2a 72 70 63 3a 6c 69 73 74 65 6e 65 72 2a 20 *rpc:listener*
2cd0: 28 73 65 72 76 65 72 3a 6b 65 65 70 2d 72 75 6e (server:keep-run
2ce0: 6e 69 6e 67 20 64 62 29 29 0a 20 20 20 20 28 64 ning db)). (d
2cf0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
2d00: 46 4f 3a 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20 FO: All done by
2d10: 68 65 72 65 22 29 29 29 0a 0a 3b 3b 20 74 65 73 here")))..;; tes
2d20: 74 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 68 t-records is a h
2d30: 61 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61 ash table testna
2d40: 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 me:item_path =>
2d50: 76 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d vector < testnam
2d60: 65 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69 e testconfig wai
2d70: 74 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74 tons priority it
2d80: 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 ems-info ... >.(
2d90: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e define (runs:run
2da0: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 64 62 20 -tests-queue db
2db0: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 run-id runname t
2dc0: 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 est-records keyv
2dd0: 61 6c 6c 73 74 20 66 6c 61 67 73 29 0a 20 20 20 allst flags).
2de0: 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e ;; At this poin
2df0: 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70 61 t the list of pa
2e00: 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65 78 rent tests is ex
2e10: 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e panded . ;; N
2e20: 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 6e B// Should expan
2e30: 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e 64 d items here and
2e40: 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 then insert int
2e50: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 2e o the run queue.
2e60: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
2e70: 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 5 "test-records:
2e80: 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 " test-records
2e90: 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 ", keyvallst: "
2ea0: 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 keyvallst " flag
2eb0: 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 s: " (hash-table
2ec0: 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29 0a ->alist flags)).
2ed0: 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d (let ((sorted-
2ee0: 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 test-names (test
2ef0: 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 s:sort-by-priori
2f00: 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 ty-and-waiton te
2f10: 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 69 st-records))..(i
2f20: 74 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 tem-patts
2f30: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
2f40: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 /default flags "
2f50: 2d 69 74 65 6d 70 61 74 74 22 20 23 66 29 29 29 -itempatt" #f)))
2f60: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
2f70: 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 ull? sorted-test
2f80: 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c -names))..(let l
2f90: 6f 6f 70 20 28 3b 20 28 6e 75 6d 74 69 6d 65 73 oop (; (numtimes
2fa0: 20 30 29 20 3b 3b 20 73 68 6f 75 6c 64 6e 27 74 0) ;; shouldn't
2fb0: 20 6e 65 65 64 20 74 68 69 73 0a 09 09 20 20 20 need this...
2fc0: 28 68 65 64 20 20 20 20 20 20 20 20 20 28 63 61 (hed (ca
2fd0: 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 r sorted-test-na
2fe0: 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 mes))... (tal
2ff0: 20 20 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 (cdr sor
3000: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 ted-test-names))
3010: 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 74 65 73 ).. (let* ((tes
3020: 74 2d 72 65 63 6f 72 64 20 28 68 61 73 68 2d 74 t-record (hash-t
3030: 61 62 6c 65 2d 72 65 66 20 74 65 73 74 2d 72 65 able-ref test-re
3040: 63 6f 72 64 73 20 68 65 64 29 29 0a 09 09 20 28 cords hed))... (
3050: 74 63 6f 6e 66 69 67 20 20 20 20 20 28 74 65 73 tconfig (tes
3060: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3070: 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 -testconfig test
3080: 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 77 61 -record))... (wa
3090: 69 74 6f 6e 73 20 20 20 20 20 28 74 65 73 74 73 itons (tests
30a0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 77 :testqueue-get-w
30b0: 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 aitons test-r
30c0: 65 63 6f 72 64 29 29 0a 09 09 20 28 70 72 69 6f ecord))... (prio
30d0: 72 69 74 79 20 20 20 20 28 74 65 73 74 73 3a 74 rity (tests:t
30e0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 70 72 69 estqueue-get-pri
30f0: 6f 72 69 74 79 20 20 20 74 65 73 74 2d 72 65 63 ority test-rec
3100: 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 64 61 ord))... (itemda
3110: 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 t (tests:tes
3120: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 tqueue-get-itemd
3130: 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 at test-recor
3140: 64 29 29 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 d)) ;; itemdat c
3150: 61 6e 20 62 65 20 61 20 73 74 72 69 6e 67 2c 20 an be a string,
3160: 6c 69 73 74 20 6f 72 20 23 66 0a 09 09 20 28 69 list or #f... (i
3170: 74 65 6d 73 20 20 20 20 20 20 20 28 74 65 73 74 tems (test
3180: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
3190: 69 74 65 6d 73 20 20 20 20 20 20 74 65 73 74 2d items test-
31a0: 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 74 65 record))... (ite
31b0: 6d 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c m-path (item-l
31c0: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
31d0: 74 29 29 29 0a 09 20 20 20 20 28 64 65 62 75 67 t))).. (debug
31e0: 3a 70 72 69 6e 74 20 36 0a 09 09 09 20 22 69 74 :print 6.... "it
31f0: 65 6d 64 61 74 3a 20 20 20 20 20 22 20 69 74 65 emdat: " ite
3200: 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20 20 69 74 mdat.... "\n it
3210: 65 6d 73 3a 20 20 20 20 20 22 20 69 74 65 6d 73 ems: " items
3220: 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 .... "\n item-p
3230: 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 ath: " item-path
3240: 29 0a 09 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 ).. (cond..
3250: 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 ((not items)
3260: 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 ;; when false th
3270: 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 e test is ok to
3280: 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f be handed off to
3290: 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 launch (but not
32a0: 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 before)..
32b0: 28 6c 65 74 20 28 28 68 61 76 65 2d 72 65 73 6f (let ((have-reso
32c0: 75 72 63 65 73 20 20 28 72 75 6e 73 3a 63 61 6e urces (runs:can
32d0: 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 -run-more-tests
32e0: 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 db test-record))
32f0: 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 ;; look at the
3300: 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e test jobgroup an
3310: 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 d tot jobs runni
3320: 6e 67 0a 09 09 20 20 20 20 28 70 72 65 72 65 71 ng... (prereq
3330: 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 s-not-met (db:ge
3340: 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 t-prereqs-not-me
3350: 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 t db run-id wait
3360: 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 29 29 29 ons item-path)))
3370: 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 ...;; Don't know
3380: 20 61 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 at this time if
3390: 20 74 68 65 20 74 65 73 74 20 68 61 76 65 20 62 the test have b
33a0: 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 een launched at
33b0: 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 some time in the
33c0: 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 past...;; i.e.
33d0: 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75 is this a re-lau
33e0: 6e 63 68 3f 0a 09 09 28 69 66 20 28 61 6e 64 20 nch?...(if (and
33f0: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 have-resources..
3400: 09 09 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 .. (null? prereq
3410: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 s-not-met))...
3420: 20 20 3b 3b 20 6e 6f 20 6c 6f 6f 70 20 2d 20 64 ;; no loop - d
3430: 72 6f 70 20 74 68 6f 75 67 68 20 61 6e 64 20 75 rop though and u
3440: 73 65 20 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 se the loop at t
3450: 68 65 20 62 6f 74 74 6f 6d 20 0a 09 09 20 20 20 he bottom ...
3460: 20 28 69 66 20 28 70 61 74 74 2d 6c 69 73 74 2d (if (patt-list-
3470: 6d 61 74 63 68 20 69 74 65 6d 2d 70 61 74 68 20 match item-path
3480: 69 74 65 6d 2d 70 61 74 74 73 29 0a 09 09 09 28 item-patts)....(
3490: 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e 2d run:test db run-
34a0: 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 id runname keyva
34b0: 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 llst test-record
34c0: 20 66 6c 61 67 73 20 23 66 29 0a 09 09 09 28 64 flags #f)....(d
34d0: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e ebug:print 1 "IN
34e0: 46 4f 3a 20 53 6b 69 70 70 69 6e 67 20 22 20 28 FO: Skipping " (
34f0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
3500: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
3510: 74 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69 74 t-record) " " it
3520: 65 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74 20 em-path " as it
3530: 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22 20 doesn't match "
3540: 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09 09 20 item-patts))...
3550: 20 20 20 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 ;; else the r
3560: 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 74 65 6d un is stuck, tem
3570: 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 65 72 6d porarily or perm
3580: 61 6e 65 6e 74 6c 79 0a 09 09 20 20 20 20 28 6c anently... (l
3590: 65 74 20 28 28 6e 65 77 74 61 6c 20 28 61 70 70 et ((newtal (app
35a0: 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 end tal (list he
35b0: 64 29 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b d))))... ;;
35c0: 20 63 6f 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 couldn't run, t
35d0: 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 ake a breather..
35e0: 09 20 20 20 20 20 20 28 74 68 72 65 61 64 2d 73 . (thread-s
35f0: 6c 65 65 70 21 20 30 2e 31 29 20 3b 3b 20 6c 6f leep! 0.1) ;; lo
3600: 6e 67 20 73 6c 65 65 70 20 68 65 72 65 20 2d 20 ng sleep here -
3610: 6e 6f 20 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 no resources, ma
3620: 79 20 61 73 20 77 65 6c 6c 20 62 65 20 70 61 74 y as well be pat
3630: 69 65 6e 74 0a 09 09 20 20 20 20 20 20 28 6c 6f ient... (lo
3640: 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 op (car newtal)(
3650: 63 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29 29 cdr newtal))))))
3660: 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b .. .. ;;
3670: 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 case where an i
3680: 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 tems came in as
3690: 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 a list been proc
36a0: 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61 6e essed.. ((an
36b0: 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 d (list? items)
36c0: 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b ;; thus we k
36d0: 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72 now our items ar
36e0: 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c e already calcul
36f0: 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 ated... (not
3700: 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e itemdat)) ;; an
3710: 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 d not yet expand
3720: 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 ed into the list
3730: 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 of things to be
3740: 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 66 done.. (if
3750: 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f (and (>= *verbo
3760: 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 sity* 1)...
3770: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 (> (length ite
3780: 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 ms) 0)...
3790: 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 (> (length (car
37a0: 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 items)) 0))...
37b0: 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 (pp items))..
37c0: 20 20 20 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 ;; (if (>= *v
37d0: 65 72 62 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 erbosity* 5)..
37e0: 20 20 20 20 3b 3b 20 20 20 20 20 28 62 65 67 69 ;; (begi
37f0: 6e 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20 20 n.. ;;
3800: 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 3a (print "items:
3810: 20 22 29 20 20 20 20 20 28 70 70 20 28 69 74 65 ") (pp (ite
3820: 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 m-assoc->item-li
3830: 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 st items))..
3840: 20 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e ;; (prin
3850: 74 20 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 t "itemstable: "
3860: 29 28 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 )(pp (item-table
3870: 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d ->item-list item
3880: 73 74 61 62 6c 65 29 29 29 29 0a 09 20 20 20 20 stable))))..
3890: 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 (for-each..
38a0: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d (lambda (my-
38b0: 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 itemdat)... (let
38c0: 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 * ((new-test-rec
38d0: 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 65 ord (let ((newre
38e0: 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 c (make-tests:te
38f0: 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 09 stqueue)))......
3900: 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 (vector-copy!
3910: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 test-record new
3920: 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 77 rec)...... new
3930: 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 rec))....(my-ite
3940: 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 m-path (item-lis
3950: 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 t->path my-itemd
3960: 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 28 at)))... (if (
3970: 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 patt-list-match
3980: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65 my-item-path ite
3990: 6d 2d 70 61 74 74 73 29 20 20 20 20 20 20 20 20 m-patts)
39a0: 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 ;; yes, we wa
39b0: 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 nt to process th
39c0: 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 is item, NOTE: S
39d0: 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 hould not need t
39e0: 68 69 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a his check here!.
39f0: 09 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 .. (let ((
3a00: 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e newtestname (con
3a10: 63 20 68 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 c hed "/" my-ite
3a20: 6d 2d 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20 m-path))) ;;
3a30: 74 65 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75 test names are u
3a40: 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d nique on testnam
3a50: 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 e/item-path....
3a60: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3a70: 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 -set-items!
3a80: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 new-test-record
3a90: 23 66 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 #f).... (tests:t
3aa0: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 estqueue-set-ite
3ab0: 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74 mdat! new-test
3ac0: 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 -record my-itemd
3ad0: 61 74 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 at).... (tests:t
3ae0: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 estqueue-set-ite
3af0: 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 m_path! new-test
3b00: 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d -record my-item-
3b10: 70 61 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d path).... (hash-
3b20: 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d table-set! test-
3b30: 72 65 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e records newtestn
3b40: 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 ame new-test-rec
3b50: 6f 72 64 29 0a 09 09 09 20 28 73 65 74 21 20 74 ord).... (set! t
3b60: 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 al (cons newtest
3b70: 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b name tal)))))) ;
3b80: 3b 20 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 ; since these ar
3b90: 65 20 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 e itemized creat
3ba0: 65 20 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 e new test names
3bb0: 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 testname/itempa
3bc0: 74 68 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73 th.. items
3bd0: 29 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f ).. (if (no
3be0: 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 t (null? tal))..
3bf0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 . (loop (car ta
3c00: 6c 29 28 63 64 72 20 74 61 6c 29 29 29 29 0a 0a l)(cdr tal))))..
3c10: 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d . ;; if item
3c20: 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e s is a proc then
3c30: 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65 need to run ite
3c40: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
3c50: 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 m-config, get th
3c60: 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 e list and loop
3c70: 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 .. ;; - b
3c80: 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 ut only do that
3c90: 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 if resources exi
3ca0: 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 st to kick off t
3cb0: 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f he job.. ((o
3cc0: 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 r (procedure? it
3cd0: 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 ems)(eq? items '
3ce0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 have-procedure))
3cf0: 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 .. (if (and
3d00: 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d (runs:can-run-m
3d10: 6f 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 ore-tests db tes
3d20: 74 2d 72 65 63 6f 72 64 29 0a 09 09 20 20 20 20 t-record)...
3d30: 20 20 20 28 6e 75 6c 6c 3f 20 28 64 62 3a 67 65 (null? (db:ge
3d40: 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 t-prereqs-not-me
3d50: 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 t db run-id wait
3d60: 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 29 29 29 ons item-path)))
3d70: 0a 09 09 20 20 28 6c 65 74 20 28 28 74 65 73 74 ... (let ((test
3d80: 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a 74 65 73 -name (tests:tes
3d90: 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e tqueue-get-testn
3da0: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 ame test-record)
3db0: 29 29 0a 09 09 20 20 20 20 28 73 65 74 65 6e 76 ))... (setenv
3dc0: 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 "MT_TEST_NAME"
3dd0: 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 test-name) ;; ..
3de0: 09 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 . (setenv "MT
3df0: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e _RUNNAME" runn
3e00: 61 6d 65 29 0a 09 09 20 20 20 20 28 73 65 74 2d ame)... (set-
3e10: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 megatest-env-var
3e20: 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 s db run-id) ;;
3e30: 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 these may be nee
3e40: 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 ded by the launc
3e50: 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 20 hing process...
3e60: 20 20 20 28 6c 65 74 20 28 28 69 74 65 6d 73 2d (let ((items-
3e70: 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 74 2d list (items:get-
3e80: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 items-from-confi
3e90: 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 09 20 g tconfig)))...
3ea0: 20 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f 20 (if (list?
3eb0: 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 20 items-list)....
3ec0: 20 28 62 65 67 69 6e 0a 09 09 09 20 20 20 20 28 (begin.... (
3ed0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
3ee0: 73 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d set-items! test-
3ef0: 72 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 record items-lis
3f00: 74 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 t).... (loop
3f10: 68 65 64 20 74 61 6c 29 29 0a 09 09 09 20 20 28 hed tal)).... (
3f20: 62 65 67 69 6e 0a 09 09 09 20 20 20 20 28 64 65 begin.... (de
3f30: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
3f40: 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 66 72 6f OR: The proc fro
3f50: 6d 20 72 65 61 64 69 6e 67 20 74 68 65 20 73 65 m reading the se
3f60: 74 75 70 20 64 69 64 20 6e 6f 74 20 79 69 65 6c tup did not yiel
3f70: 64 20 61 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 d a list - pleas
3f80: 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 0a e report this").
3f90: 09 09 09 20 20 20 20 28 65 78 69 74 20 31 29 29 ... (exit 1))
3fa0: 29 29 29 0a 09 09 20 20 28 6c 65 74 20 28 28 6e )))... (let ((n
3fb0: 65 77 74 61 6c 20 28 61 70 70 65 6e 64 20 74 61 ewtal (append ta
3fc0: 6c 20 28 6c 69 73 74 20 68 65 64 29 29 29 29 0a l (list hed)))).
3fd0: 09 09 20 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 .. ;; if can'
3fe0: 74 20 72 75 6e 20 6d 6f 72 65 20 74 65 73 74 73 t run more tests
3ff0: 2c 20 6c 65 74 73 20 74 61 6b 65 20 61 20 62 72 , lets take a br
4000: 65 61 74 68 65 72 0a 09 09 20 20 20 20 28 74 68 eather... (th
4010: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 read-sleep! 0.1)
4020: 20 3b 3b 20 6d 61 79 20 61 73 20 77 65 6c 6c 20 ;; may as well
4030: 77 61 69 74 20 61 20 77 68 69 6c 65 20 66 6f 72 wait a while for
4040: 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 66 72 resources to fr
4050: 65 65 20 75 70 0a 09 09 20 20 20 20 28 6c 6f 6f ee up... (loo
4060: 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 p (car newtal)(c
4070: 64 72 20 6e 65 77 74 61 6c 29 29 29 29 29 0a 0a dr newtal)))))..
4080: 09 20 20 20 20 20 3b 3b 20 74 68 69 73 20 63 61 . ;; this ca
4090: 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 se should not ha
40a0: 70 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 ppen, added to h
40b0: 65 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62 75 elp catch any bu
40c0: 67 73 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 gs.. ((and (
40d0: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 list? items) ite
40e0: 6d 64 61 74 29 0a 09 20 20 20 20 20 20 28 64 65 mdat).. (de
40f0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
4100: 4f 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 OR: Should not h
4110: 61 76 65 20 61 20 6c 69 73 74 20 6f 66 20 69 74 ave a list of it
4120: 65 6d 73 20 69 6e 20 61 20 74 65 73 74 20 61 6e ems in a test an
4130: 64 20 74 68 65 20 69 74 65 6d 73 70 61 74 68 20 d the itemspath
4140: 73 65 74 20 2d 20 70 6c 65 61 73 65 20 72 65 70 set - please rep
4150: 6f 72 74 20 74 68 69 73 22 29 0a 09 20 20 20 20 ort this")..
4160: 20 20 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 (exit 1))))..
4170: 20 0a 09 20 20 3b 3b 20 77 65 20 67 65 74 20 68 .. ;; we get h
4180: 65 72 65 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 ere on "drop thr
4190: 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 ough" - loop for
41a0: 20 6e 65 78 74 20 74 65 73 74 20 69 6e 20 71 75 next test in qu
41b0: 65 75 65 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c eue.. (if (null
41c0: 3f 20 74 61 6c 29 0a 09 20 20 20 20 20 20 28 62 ? tal).. (b
41d0: 65 67 69 6e 0a 09 09 3b 3b 20 46 49 58 4d 45 21 egin...;; FIXME!
41e0: 21 21 21 20 54 48 49 53 20 53 48 4f 55 4c 44 20 !!! THIS SHOULD
41f0: 4e 4f 54 20 52 45 51 55 49 52 45 20 41 4e 20 45 NOT REQUIRE AN E
4200: 58 49 54 21 21 21 21 21 21 21 0a 09 09 28 64 65 XIT!!!!!!!...(de
4210: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 bug:print 1 "INF
4220: 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 O: All tests lau
4230: 6e 63 68 65 64 22 29 0a 09 09 28 74 68 72 65 61 nched")...(threa
4240: 64 2d 73 6c 65 65 70 21 20 30 2e 35 29 0a 09 09 d-sleep! 0.5)...
4250: 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20 68 ;; FIXME! This h
4260: 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c 64 arsh exit should
4270: 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72 not be necessar
4280: 79 2e 2e 2e 2e 0a 09 09 28 69 66 20 28 6e 6f 74 y.......(if (not
4290: 20 2a 72 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 *runremote*)(ex
42a0: 69 74 29 29 20 3b 3b 20 0a 09 09 23 66 29 20 3b it)) ;; ...#f) ;
42b0: 3b 20 72 65 74 75 72 6e 20 61 20 23 66 20 61 73 ; return a #f as
42c0: 20 61 20 68 69 6e 74 20 74 68 61 74 20 77 65 20 a hint that we
42d0: 61 72 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 are done..
42e0: 3b 3b 20 48 65 72 65 20 77 65 20 6e 65 65 64 20 ;; Here we need
42f0: 74 6f 20 63 68 65 63 6b 20 74 68 61 74 20 61 6c to check that al
4300: 6c 20 74 68 65 20 74 65 73 74 73 20 72 65 6d 61 l the tests rema
4310: 69 6e 69 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 ining to be run
4320: 61 72 65 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 are eligible to
4330: 72 75 6e 0a 09 20 20 20 20 20 20 3b 3b 20 61 6e run.. ;; an
4340: 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 d are not blocke
4350: 64 20 62 79 20 66 61 69 6c 65 64 0a 09 20 20 20 d by failed..
4360: 20 20 20 28 6c 65 74 20 28 28 6e 65 77 6c 73 74 (let ((newlst
4370: 20 28 74 65 73 74 73 3a 66 69 6c 74 65 72 2d 6e (tests:filter-n
4380: 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 64 62 20 72 on-runnable db r
4390: 75 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 2d 72 un-id tal test-r
43a0: 65 63 6f 72 64 73 29 29 29 20 3b 3b 20 69 2e 65 ecords))) ;; i.e
43b0: 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 . not FAIL, WAIV
43c0: 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 ED, INCOMPLETE,
43d0: 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 PASS, KILLED,...
43e0: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 (thread-sleep! 0
43f0: 2e 31 29 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 .1)...(if (not (
4400: 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 null? newlst))..
4410: 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 . (loop (car
4420: 6e 65 77 6c 73 74 29 28 63 64 72 20 6e 65 77 6c newlst)(cdr newl
4430: 73 74 29 29 29 29 29 29 29 29 29 0a 0a 3b 3b 20 st)))))))))..;;
4440: 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20 74 parent-test is t
4450: 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65 68 here as a placeh
4460: 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20 70 older for when p
4470: 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e 20 arent-tests can
4480: 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74 75 be run as a setu
4490: 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20 28 p step.(define (
44a0: 72 75 6e 3a 74 65 73 74 20 64 62 20 72 75 6e 2d run:test db run-
44b0: 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 id runname keyva
44c0: 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 llst test-record
44d0: 20 66 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 65 flags parent-te
44e0: 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 st). ;; All the
44f0: 73 65 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 se vars might be
4500: 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 referenced by t
4510: 68 65 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 he testconfig fi
4520: 6c 65 20 72 65 61 64 65 72 0a 20 20 28 6c 65 74 le reader. (let
4530: 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 * ((test-name
4540: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
4550: 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 e-get-testname
4560: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
4570: 20 28 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 (test-waitons (
4580: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
4590: 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 get-waitons t
45a0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 est-record)).. (
45b0: 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 test-conf (te
45c0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
45d0: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 t-testconfig tes
45e0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74 t-record)).. (it
45f0: 65 6d 64 61 74 20 20 20 20 20 20 28 74 65 73 74 emdat (test
4600: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
4610: 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d itemdat test-
4620: 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 record)).. (test
4630: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a -path (conc *
4640: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
4650: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b /" test-name)) ;
4660: 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 ; could use test
4670: 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 s:get-testconfig
4680: 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 here ..... (for
4690: 63 65 20 20 20 20 20 20 20 20 28 68 61 73 68 2d ce (hash-
46a0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
46b0: 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 t flags "-force"
46c0: 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e 20 20 #f)).. (rerun
46d0: 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c (hash-tabl
46e0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c e-ref/default fl
46f0: 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 66 29 ags "-rerun" #f)
4700: 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 ).. (keepgoing
4710: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
4720: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 f/default flags
4730: 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 "-keepgoing" #f)
4740: 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 ).. (item-path
4750: 20 20 20 22 22 29 29 0a 20 20 20 20 28 64 65 62 "")). (deb
4760: 75 67 3a 70 72 69 6e 74 20 35 0a 09 09 20 22 74 ug:print 5... "t
4770: 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 est-config: " (h
4780: 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 ash-table->alist
4790: 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 test-conf)... "
47a0: 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 22 20 \n itemdat: "
47b0: 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 itemdat... ).
47c0: 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 65 6d ;; setting item
47d0: 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 69 66 dat to a list if
47e0: 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 28 69 it is #f. (i
47f0: 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 f (not itemdat)(
4800: 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 28 29 set! itemdat '()
4810: 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 74 65 )). (set! ite
4820: 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 m-path (item-lis
4830: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 t->path itemdat)
4840: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 ). (debug:pri
4850: 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69 6e 67 nt 2 "Attempting
4860: 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 to launch test
4870: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 " test-name "/"
4880: 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 20 20 28 item-path). (
4890: 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f setenv "MT_TEST_
48a0: 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 NAME" test-name)
48b0: 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76 ;; . (setenv
48c0: 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 "MT_RUNNAME"
48d0: 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 runname). (se
48e0: 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 t-megatest-env-v
48f0: 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 20 3b ars db run-id) ;
4900: 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 6e ; these may be n
4910: 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 75 eeded by the lau
4920: 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 nching process.
4930: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
4940: 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a tory *toppath*).
4950: 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73 20 . ;; Here is
4960: 77 68 65 72 65 20 74 68 65 20 74 65 73 74 5f 6d where the test_m
4970: 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 65 73 eta table is bes
4980: 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 3b 3b t updated. ;;
4990: 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 Yes, another us
49a0: 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f e of a global fo
49b0: 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 r caching. Need
49c0: 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a 20 20 a better way?.
49d0: 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 (if (not (hash
49e0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
49f0: 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 lt *test-meta-up
4a00: 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 dated* test-name
4a10: 20 23 66 29 29 0a 20 20 20 20 20 20 20 20 28 62 #f)). (b
4a20: 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 egin.. (hash-t
4a30: 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73 74 2d able-set! *test-
4a40: 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 74 65 meta-updated* te
4a50: 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 st-name #t).
4a60: 20 20 20 20 20 20 20 28 72 75 6e 73 3a 75 70 64 (runs:upd
4a70: 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 ate-test_meta db
4a80: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
4a90: 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20 20 conf))). .
4aa0: 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 65 ;; (lambda (ite
4ab0: 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 mdat) ;;; ((ripe
4ac0: 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 29 ness "overripe")
4ad0: 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 63 (temperature "c
4ae0: 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 73 ool") (season "s
4af0: 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c 65 ummer")). (le
4b00: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 t* ((new-test-pa
4b10: 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 th (string-inter
4b20: 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 73 sperse (cons tes
4b30: 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 72 t-path (map cadr
4b40: 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 29 itemdat)) "/"))
4b50: 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e .. (new-test-n
4b60: 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 ame (if (equal?
4b70: 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 65 item-path "") te
4b80: 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 st-name (conc te
4b90: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d st-name "/" item
4ba0: 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 -path))) ;; just
4bb0: 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 75 need it to be u
4bc0: 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74 64 nique.. (testd
4bd0: 61 74 20 20 20 20 20 20 20 28 64 62 3a 67 65 74 at (db:get
4be0: 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 -test-info db ru
4bf0: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
4c00: 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28 tem-path)).. (
4c10: 74 65 73 74 2d 69 64 20 20 20 20 20 20 20 23 66 test-id #f
4c20: 29 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f )). (if (no
4c30: 74 20 74 65 73 74 64 61 74 29 0a 09 20 20 28 62 t testdat).. (b
4c40: 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 egin.. ;; ens
4c50: 75 72 65 20 74 68 61 74 20 74 68 65 20 70 61 74 ure that the pat
4c60: 68 20 65 78 69 73 74 73 20 62 65 66 6f 72 65 20 h exists before
4c70: 72 65 67 69 73 74 65 72 69 6e 67 20 74 68 65 20 registering the
4c80: 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 test.. ;; NOP
4c90: 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 E: Cannot! Don't
4ca0: 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20 know yet which
4cb0: 64 69 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 disk area will b
4cc0: 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 e assigned......
4cd0: 20 20 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 ;; (system (
4ce0: 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 conc "mkdir -p "
4cf0: 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29 new-test-path))
4d00: 0a 09 20 20 20 20 28 72 74 65 73 74 73 3a 72 65 .. (rtests:re
4d10: 67 69 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 gister-test db r
4d20: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
4d30: 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 item-path)..
4d40: 28 73 65 74 21 20 74 65 73 74 64 61 74 20 28 64 (set! testdat (d
4d50: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 b:get-test-info
4d60: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
4d70: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 ame item-path)))
4d80: 29 0a 20 20 20 20 20 20 28 73 65 74 21 20 74 65 ). (set! te
4d90: 73 74 2d 69 64 20 28 64 62 3a 74 65 73 74 2d 67 st-id (db:test-g
4da0: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a et-id testdat)).
4db0: 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 (change-di
4dc0: 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 rectory test-pat
4dd0: 68 29 0a 20 20 20 20 20 20 28 63 61 73 65 20 28 h). (case (
4de0: 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 if force ;; (arg
4df0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 s:get-arg "-forc
4e00: 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 e")...'NOT_START
4e10: 45 44 0a 09 09 28 69 66 20 74 65 73 74 64 61 74 ED...(if testdat
4e20: 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e ... (string->
4e30: 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 symbol (test:get
4e40: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 -state testdat))
4e50: 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74 ... 'failed-t
4e60: 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61 o-insert))..((fa
4e70: 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a iled-to-insert).
4e80: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 . (debug:print 0
4e90: 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 "ERROR: Failed
4ea0: 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 to insert the re
4eb0: 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 cord into the db
4ec0: 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 "))..((NOT_START
4ed0: 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 ED COMPLETED)..
4ee0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 (debug:print 6 "
4ef0: 47 6f 74 20 68 65 72 65 2c 20 22 20 28 74 65 73 Got here, " (tes
4f00: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
4f10: 64 61 74 29 29 0a 09 20 28 6c 65 74 20 28 28 72 dat)).. (let ((r
4f20: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 unflag #f))..
4f30: 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 (cond.. ;; -f
4f40: 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 orce, run no mat
4f50: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 ter what.. (f
4f60: 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c orce (set! runfl
4f70: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
4f80: 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e NOT_STARTED, run
4f90: 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a no matter what.
4fa0: 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20 28 74 . ((equal? (t
4fb0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
4fc0: 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 stdat) "NOT_STAR
4fd0: 54 45 44 22 29 28 73 65 74 21 20 72 75 6e 66 6c TED")(set! runfl
4fe0: 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 ag #t)).. ;;
4ff0: 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 not -rerun and P
5000: 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 ASS, WARN or CHE
5010: 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 CK, do no run..
5020: 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f ((and (or (no
5030: 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 20 20 t rerun)...
5040: 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 keepgoing)...
5050: 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 66 6f ;; Require to fo
5060: 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 rce re-run for C
5070: 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 OMPLETED or *any
5080: 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 thing* + PASS,WA
5090: 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 RN or CHECK...
50a0: 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 65 73 (or (member (tes
50b0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
50c0: 74 64 61 74 29 20 27 28 22 50 41 53 53 22 20 22 tdat) '("PASS" "
50d0: 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 29 0a WARN" "CHECK")).
50e0: 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 72 20 .. (member
50f0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
5100: 20 74 65 73 74 64 61 74 29 20 27 28 22 43 4f 4d testdat) '("COM
5110: 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 20 20 PLETED")))) ..
5120: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
5130: 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 2 "INFO: running
5140: 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d test " test-nam
5150: 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 e "/" item-path
5160: 22 20 73 75 70 70 72 65 73 73 65 64 20 61 73 20 " suppressed as
5170: 69 74 20 69 73 20 43 4f 4d 50 4c 45 54 45 44 20 it is COMPLETED
5180: 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65 74 2d and " (test:get-
5190: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a state testdat)).
51a0: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 . (set! runf
51b0: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b lag #f)).. ;;
51c0: 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 -rerun and stat
51d0: 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 us is one of the
51e0: 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 specifed, run i
51f0: 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 t.. ((and rer
5200: 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 un... (let* ((r
5210: 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e erunlst (strin
5220: 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c g-split rerun ",
5230: 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 ")).... (must-re
5240: 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 run (member (tes
5250: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
5260: 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 tdat) rerunlst))
5270: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
5280: 72 69 6e 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 rint 3 "INFO: -r
5290: 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 erun list: " rer
52a0: 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75 un ", test-statu
52b0: 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 s: " (test:get-s
52c0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 22 2c tatus testdat)",
52d0: 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d must-rerun: " m
52e0: 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 ust-rerun)...
52f0: 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 must-rerun))..
5300: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5310: 20 32 20 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 2 "INFO: Rerun
5320: 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20 forced for test
5330: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 " test-name "/"
5340: 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 item-path)..
5350: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
5360: 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 t)).. ;; -kee
5370: 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 pgoing, do not r
5380: 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 erun FAIL.. (
5390: 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 (and keepgoing..
53a0: 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 . (member (test
53b0: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
53c0: 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 dat) '("FAIL")))
53d0: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e .. (set! run
53e0: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 flag #f)).. (
53f0: 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 (and (not rerun)
5400: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 ... (member (te
5410: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
5420: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 stdat) '("FAIL"
5430: 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 "n/a"))).. (
5440: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 set! runflag #t)
5450: 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 ).. (else (se
5460: 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 t! runflag #f)))
5470: 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e .. (debug:prin
5480: 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 t 6 "RUNNING =>
5490: 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c runflag: " runfl
54a0: 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 ag " STATE: " (t
54b0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
54c0: 73 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a stdat) " STATUS:
54d0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
54e0: 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 tus testdat))..
54f0: 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c (if (not runfl
5500: 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 ag).. (if
5510: 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 (not parent-test
5520: 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 )... (debug:pr
5530: 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 int 1 "NOTE: Not
5540: 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 starting test "
5550: 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 new-test-name "
5560: 20 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20 as it is state
5570: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 \"" (test:get-st
5580: 61 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 ate testdat) ...
5590: 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 .."\" and status
55a0: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 \"" (test:get-s
55b0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 tatus testdat) "
55c0: 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c \", use -rerun \
55d0: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 "" (test:get-sta
55e0: 74 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20 tus testdat).
55f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5600: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 "\"
5610: 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 or -force to ov
5620: 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20 erride"))..
5630: 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f ;; NOTE: No lo
5640: 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67 nger be checking
5650: 20 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68 prerequisites h
5660: 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 ere! Will never
5670: 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20 get here unless
5680: 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20 prereqs are..
5690: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 ;; alr
56a0: 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 eady met...
56b0: 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e (if (not (laun
56c0: 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 ch-test db run-i
56d0: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 d runname test-c
56e0: 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 onf keyvallst te
56f0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 st-name test-pat
5700: 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29 h itemdat flags)
5710: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 )... (begin...
5720: 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 (print "ERR
5730: 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 OR: Failed to la
5740: 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 unch the test. E
5750: 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 xiting as soon a
5760: 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 s possible")...
5770: 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 (set! *globa
5780: 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 lexitstatus* 1)
5790: 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63 ;; ... (proc
57a0: 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 ess-signal (curr
57b0: 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 ent-process-id)
57c0: 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 signal/kill)))))
57d0: 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 )..((KILLED) ..
57e0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
57f0: 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 NOTE: " new-test
5800: 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 -name " is alrea
5810: 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 dy running or wa
5820: 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c s explictly kill
5830: 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 ed, use -force t
5840: 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a o launch it.")).
5850: 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f .((LAUNCHED REMO
5860: 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e TEHOSTSTART RUNN
5870: 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20 ING) .. (if (>
5880: 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f (- (current-seco
5890: 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d nds)(+ (db:test-
58a0: 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 get-event_time t
58b0: 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20 estdat).....
58c0: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
58d0: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 run_duration tes
58e0: 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b tdat)))...600) ;
58f0: 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 ; i.e. no update
5900: 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 for more than 6
5910: 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 00 seconds..
5920: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 (begin..
5930: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
5940: 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 WARNING: Test "
5950: 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 test-name " appe
5960: 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 ars to be dead.
5970: 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 Forcing it to st
5980: 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 ate INCOMPLETE a
5990: 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f nd status STUCK/
59a0: 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28 DEAD").. (
59b0: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 test-set-status!
59c0: 20 64 62 20 74 65 73 74 2d 69 64 20 22 49 4e 43 db test-id "INC
59d0: 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 4b 2f OMPLETE" "STUCK/
59e0: 44 45 41 44 22 20 22 54 65 73 74 20 69 73 20 73 DEAD" "Test is s
59f0: 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 23 66 tuck or dead" #f
5a00: 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a )).. (debug:
5a10: 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 print 2 "NOTE: "
5a20: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 test-name " is
5a30: 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 already running"
5a40: 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 20 20 )))..(else
5a50: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
5a60: 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 "ERROR: Failed t
5a70: 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 o launch test "
5a80: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e new-test-name ".
5a90: 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 73 74 Unrecognised st
5aa0: 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 74 2d ate " (test:get-
5ab0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 29 29 state testdat)))
5ac0: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ))))..;;========
5ad0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5ae0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
5b10: 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 ; END OF NEW STU
5b20: 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d FF.;;===========
5b30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 ===========..(de
5b70: 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d 75 70 fine (get-dir-up
5b80: 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d 73 29 -n dir . params)
5b90: 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 72 74 . (let ((dpart
5ba0: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 s (string-split
5bb0: 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 dir "/"))..(cou
5bc0: 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 nt (if (null?
5bd0: 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 20 70 params) 1 (car p
5be0: 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 28 63 arams)))). (c
5bf0: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d onc "/" (string-
5c00: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 20 20 intersperse ..
5c10: 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 74 (take dpart
5c20: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 s (- (length dpa
5c30: 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 rts) count))..
5c40: 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 "/")))).;;
5c50: 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 Remove runs.;; f
5c60: 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 69 6e ields are passin
5c70: 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a 28 64 g in through .(d
5c80: 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 65 6d 6f efine (runs:remo
5c90: 76 65 2d 72 75 6e 73 20 64 62 20 72 75 6e 6e 61 ve-runs db runna
5ca0: 6d 65 70 61 74 74 20 74 65 73 74 70 61 74 74 20 mepatt testpatt
5cb0: 69 74 65 6d 70 61 74 74 20 23 21 6b 65 79 20 28 itempatt #!key (
5cc0: 73 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73 state #f)(status
5cd0: 20 23 66 29 29 0a 20 20 28 6c 65 74 2a 20 28 28 #f)). (let* ((
5ce0: 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 64 62 keys (rdb
5cf0: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 :get-keys db))..
5d00: 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 28 72 (rundat (r
5d10: 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d uns:get-runs-by-
5d20: 70 61 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e patt db keys run
5d30: 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 namepatt)).. (he
5d40: 61 64 65 72 20 20 20 20 20 20 28 76 65 63 74 6f ader (vecto
5d50: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 r-ref rundat 0))
5d60: 0a 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 .. (runs
5d70: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
5d80: 61 74 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 at 1)).. (states
5d90: 20 20 20 20 20 20 28 69 66 20 73 74 61 74 65 20 (if state
5da0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 73 (string-split s
5db0: 74 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 29 tate ",") '()))
5dc0: 0a 09 20 28 73 74 61 74 75 73 65 73 20 20 20 20 .. (statuses
5dd0: 28 69 66 20 73 74 61 74 75 73 20 28 73 74 72 69 (if status (stri
5de0: 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 73 20 ng-split status
5df0: 22 2c 22 29 20 27 28 29 29 29 29 0a 20 20 20 20 ",") '()))).
5e00: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
5e10: 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 Header: " header
5e20: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a ). (for-each.
5e30: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 (lambda (ru
5e40: 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 n). (let (
5e50: 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d (runkey (string-
5e60: 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 intersperse (map
5e70: 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 (lambda (k)....
5e80: 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 ...(db:get-value
5e90: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
5ea0: 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 eader (vector-re
5eb0: 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 f k 0))) keys) "
5ec0: 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 /")).. (dirs
5ed0: 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 -to-remove (make
5ee0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 -hash-table)))..
5ef0: 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 (let* ((run-id
5f00: 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 (db:get-value
5f10: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
5f20: 65 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 28 eader "id"))...(
5f30: 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 65 run-state (db:ge
5f40: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
5f50: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 74 r run header "st
5f60: 61 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 20 ate"))...(tests
5f70: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71 (if (not (eq
5f80: 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 22 ual? run-state "
5f90: 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 20 locked"))....
5fa0: 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 (rdb:get-tes
5fb0: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 ts-for-run db (d
5fc0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
5fd0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
5fe0: 20 22 69 64 22 29 20 74 65 73 74 70 61 74 74 20 "id") testpatt
5ff0: 69 74 65 6d 70 61 74 74 20 73 74 61 74 65 73 20 itempatt states
6000: 73 74 61 74 75 73 65 73 20 6e 6f 74 2d 69 6e 3a statuses not-in:
6010: 20 23 66 29 0a 09 09 09 20 20 20 20 20 20 20 27 #f).... '
6020: 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61 74 ()))...(lasttpat
6030: 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 h "/does/not/exi
6040: 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09 20 st/I/hope"))...
6050: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c (if (not (null
6060: 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20 20 ? tests))..
6070: 20 20 28 62 65 67 69 6e 0a 09 09 20 28 64 65 62 (begin... (deb
6080: 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d 6f ug:print 1 "Remo
6090: 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 20 72 ving tests for r
60a0: 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 un: " runkey " "
60b0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
60c0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
60d0: 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a der "runname")).
60e0: 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 .. (for-each...
60f0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a (lambda (test).
6100: 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 .. (let* ((it
6110: 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 em-path (db:test
6120: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
6130: 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 est)).... (tes
6140: 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d t-name (db:test-
6150: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
6160: 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 t)).... (run-d
6170: 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ir (db:test-ge
6180: 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 29 29 t-rundir test)))
6190: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a ... (debug:
61a0: 70 72 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 print 1 " " (db
61b0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
61c0: 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 me test) " id: "
61d0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
61e0: 20 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d test) " " item-
61f0: 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 28 72 path)... (r
6200: 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 db:delete-test-r
6210: 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a 74 65 ecords db (db:te
6220: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 29 st-get-id test))
6230: 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 3e 20 ... (if (>
6240: 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 72 (string-length r
6250: 75 6e 2d 64 69 72 29 20 35 29 20 3b 3b 20 62 61 un-dir) 5) ;; ba
6260: 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74 20 d heuristic but
6270: 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f should prevent /
6280: 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 tmp /home etc...
6290: 09 09 20 20 28 6c 65 74 20 28 28 66 75 6c 6c 70 .. (let ((fullp
62a0: 61 74 68 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b ath run-dir)) ;;
62b0: 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 "/" (db:test-ge
62c0: 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 t-item-path test
62d0: 29 29 29 29 0a 09 09 09 20 20 20 20 28 73 65 74 )))).... (set
62e0: 21 20 6c 61 73 74 74 70 61 74 68 20 66 75 6c 6c ! lasttpath full
62f0: 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 68 61 path).... (ha
6300: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 64 69 sh-table-set! di
6310: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 75 6c rs-to-remove ful
6320: 6c 70 61 74 68 20 23 74 29 0a 09 09 09 20 20 20 lpath #t)....
6330: 20 3b 3b 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e ;; The followin
6340: 67 20 77 61 73 20 74 68 65 20 73 61 66 65 20 64 g was the safe d
6350: 65 6c 65 74 65 20 63 6f 64 65 20 62 75 74 20 69 elete code but i
6360: 74 20 77 61 73 20 6e 6f 74 20 62 65 69 6e 67 20 t was not being
6370: 65 78 65 63 74 75 74 65 64 2e 0a 09 09 09 20 20 exectuted.....
6380: 20 20 3b 3b 20 28 6c 65 74 2a 20 28 28 64 69 72 ;; (let* ((dir
6390: 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 28 6c 65 s-count (+ 1 (le
63a0: 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 6e 67 74 ngth keys)(lengt
63b0: 68 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 h (string-split
63c0: 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 29 29 item-path "/")))
63d0: 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 20 ).... ;;
63e0: 20 20 20 28 64 69 72 2d 74 6f 2d 72 65 6d 20 28 (dir-to-rem (
63f0: 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 66 75 6c get-dir-up-n ful
6400: 6c 70 61 74 68 20 64 69 72 73 2d 63 6f 75 6e 74 lpath dirs-count
6410: 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 )).... ;;
6420: 20 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 64 20 (remainingd
6430: 28 73 74 72 69 6e 67 2d 73 75 62 73 74 69 74 75 (string-substitu
6440: 74 65 20 28 72 65 67 65 78 70 20 28 63 6f 6e 63 te (regexp (conc
6450: 20 22 5e 22 20 64 69 72 2d 74 6f 2d 72 65 6d 20 "^" dir-to-rem
6460: 22 2f 22 29 29 20 22 22 20 66 75 6c 6c 70 61 74 "/")) "" fullpat
6470: 68 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 h)).... ;;
6480: 20 20 20 20 20 28 63 6d 64 20 28 63 6f 6e 63 20 (cmd (conc
6490: 22 63 64 20 22 20 64 69 72 2d 74 6f 2d 72 65 6d "cd " dir-to-rem
64a0: 20 22 3b 20 72 6d 64 69 72 20 2d 70 20 22 20 72 "; rmdir -p " r
64b0: 65 6d 61 69 6e 69 6e 67 64 20 29 29 29 0a 09 09 emainingd )))...
64c0: 09 20 20 20 20 3b 3b 20 20 20 28 69 66 20 28 66 . ;; (if (f
64d0: 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 75 6c 6c ile-exists? full
64e0: 70 61 74 68 29 0a 09 09 09 20 20 20 20 3b 3b 20 path).... ;;
64f0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 (begin....
6500: 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 20 28 ;; (
6510: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 63 6d debug:print 1 cm
6520: 64 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 20 d).... ;;
6530: 20 20 20 20 20 28 73 79 73 74 65 6d 20 63 6d 64 (system cmd
6540: 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 ))).... ;;
6550: 29 29 0a 09 09 09 20 20 20 20 29 29 29 29 0a 09 )).... ))))..
6560: 09 20 20 20 20 74 65 73 74 73 29 29 29 0a 0a 09 . tests)))...
6570: 20 20 20 3b 3b 20 6c 6f 6f 6b 20 74 68 6f 75 67 ;; look thoug
6580: 68 20 74 68 65 20 64 69 72 73 2d 74 6f 2d 72 65 h the dirs-to-re
6590: 6d 6f 76 65 20 66 6f 72 20 63 61 6e 64 69 64 61 move for candida
65a0: 74 65 73 20 66 6f 72 20 72 65 6d 6f 76 61 6c 2e tes for removal.
65b0: 20 44 6f 20 74 68 69 73 20 61 66 74 65 72 20 64 Do this after d
65c0: 65 6c 65 74 69 6e 67 20 74 68 65 20 72 65 63 6f eleting the reco
65d0: 72 64 73 0a 09 20 20 20 3b 3b 20 66 6f 72 20 65 rds.. ;; for e
65e0: 61 63 68 20 74 65 73 74 20 69 6e 20 63 61 73 65 ach test in case
65f0: 20 77 65 20 67 65 74 20 6b 69 6c 6c 65 64 2e 20 we get killed.
6600: 54 68 61 74 20 73 68 6f 75 6c 64 20 6d 69 6e 69 That should mini
6610: 6d 69 7a 65 20 74 68 65 20 64 65 74 72 69 74 75 mize the detritu
6620: 73 20 6c 65 66 74 20 6f 6e 20 64 69 73 6b 0a 09 s left on disk..
6630: 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 74 68 ;; process th
6640: 65 20 64 69 72 73 20 66 72 6f 6d 20 6c 6f 6e 67 e dirs from long
6650: 65 73 74 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 est string lengt
6660: 68 20 74 6f 20 73 68 6f 72 74 65 73 74 0a 09 20 h to shortest..
6670: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 20 20 (for-each ..
6680: 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 2d 74 (lambda (dir-t
6690: 6f 2d 72 65 6d 6f 76 65 29 0a 09 20 20 20 20 20 o-remove)..
66a0: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 (if (file-exist
66b0: 73 3f 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 s? dir-to-remove
66c0: 29 0a 09 09 20 20 28 6c 65 74 20 28 28 64 69 72 )... (let ((dir
66d0: 2d 69 6e 2d 64 62 20 27 28 29 29 29 0a 09 09 20 -in-db '()))...
66e0: 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d (sqlite3:for-
66f0: 65 61 63 68 2d 72 6f 77 0a 09 09 20 20 20 20 20 each-row...
6700: 28 6c 61 6d 62 64 61 20 28 64 69 72 29 0a 09 09 (lambda (dir)...
6710: 20 20 20 20 20 20 20 28 73 65 74 21 20 64 69 72 (set! dir
6720: 2d 69 6e 2d 64 62 20 28 63 6f 6e 73 20 64 69 72 -in-db (cons dir
6730: 20 64 69 72 2d 69 6e 2d 64 62 29 29 29 0a 09 09 dir-in-db)))...
6740: 20 20 20 20 20 64 62 20 22 53 45 4c 45 43 54 20 db "SELECT
6750: 72 75 6e 64 69 72 20 46 52 4f 4d 20 74 65 73 74 rundir FROM test
6760: 73 20 57 48 45 52 45 20 72 75 6e 64 69 72 20 4c s WHERE rundir L
6770: 49 4b 45 20 3f 3b 22 20 0a 09 09 20 20 20 20 20 IKE ?;" ...
6780: 28 63 6f 6e 63 20 22 25 22 20 64 69 72 2d 74 6f (conc "%" dir-to
6790: 2d 72 65 6d 6f 76 65 20 22 25 22 29 29 20 3b 3b -remove "%")) ;;
67a0: 20 79 65 73 2c 20 49 27 6d 20 67 6f 69 6e 67 20 yes, I'm going
67b0: 74 6f 20 62 61 69 6c 20 69 66 20 74 68 65 72 65 to bail if there
67c0: 20 69 73 20 61 6e 79 74 68 69 6e 67 20 6c 69 6b is anything lik
67d0: 65 20 74 68 69 73 20 64 69 72 20 69 6e 20 74 68 e this dir in th
67e0: 65 20 64 62 0a 09 09 20 20 20 20 28 69 66 20 28 e db... (if (
67f0: 6e 75 6c 6c 3f 20 64 69 72 2d 69 6e 2d 64 62 29 null? dir-in-db)
6800: 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 20 20 ....(begin....
6810: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
6820: 52 65 6d 6f 76 69 6e 67 20 64 69 72 65 63 74 6f Removing directo
6830: 72 79 20 77 69 74 68 20 7a 65 72 6f 20 64 62 20 ry with zero db
6840: 72 65 66 65 72 65 6e 63 65 73 3a 20 22 20 64 69 references: " di
6850: 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 09 09 r-to-remove)....
6860: 20 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 (system (conc
6870: 22 72 6d 20 2d 72 66 20 22 20 64 69 72 2d 74 6f "rm -rf " dir-to
6880: 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 20 20 28 -remove)).... (
6890: 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c 65 74 hash-table-delet
68a0: 65 21 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 e! dirs-to-remov
68b0: 65 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 e dir-to-remove)
68c0: 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e )....(debug:prin
68d0: 74 20 32 20 22 53 6b 69 70 70 69 6e 67 20 72 65 t 2 "Skipping re
68e0: 6d 6f 76 61 6c 20 6f 66 20 22 20 64 69 72 2d 74 moval of " dir-t
68f0: 6f 2d 72 65 6d 6f 76 65 20 22 20 66 6f 72 20 6e o-remove " for n
6900: 6f 77 20 61 73 20 69 74 20 73 74 69 6c 6c 20 68 ow as it still h
6910: 61 73 20 72 65 66 65 72 65 6e 63 65 73 20 69 6e as references in
6920: 20 74 68 65 20 64 61 74 61 62 61 73 65 22 29 29 the database"))
6930: 29 29 29 0a 09 20 20 20 20 28 73 6f 72 74 20 28 ))).. (sort (
6940: 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 73 20 hash-table-keys
6950: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 29 20 dirs-to-remove)
6960: 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 3e 20 (lambda (a b)(>
6970: 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 61 (string-length a
6980: 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 )(string-length
6990: 62 29 29 29 29 29 0a 0a 09 20 20 20 3b 3b 20 72 b)))))... ;; r
69a0: 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 69 66 emove the run if
69b0: 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 6d 61 zero tests rema
69c0: 69 6e 0a 09 20 20 20 28 6c 65 74 20 28 28 72 65 in.. (let ((re
69d0: 6d 74 65 73 74 73 20 28 72 64 62 3a 67 65 74 2d mtests (rdb:get-
69e0: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
69f0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
6a00: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
6a10: 64 65 72 20 22 69 64 22 29 20 23 66 20 23 66 20 der "id") #f #f
6a20: 27 28 29 20 27 28 29 29 29 29 0a 09 20 20 20 20 '() '())))..
6a30: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 (if (null? remt
6a40: 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 ests) ;; no more
6a50: 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 tests remaining
6a60: 0a 09 09 20 28 6c 65 74 2a 20 28 28 64 70 61 72 ... (let* ((dpar
6a70: 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ts (string-spli
6a80: 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 t lasttpath "/")
6a90: 29 0a 09 09 09 28 72 75 6e 70 61 74 68 20 28 63 )....(runpath (c
6aa0: 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d onc "/" (string-
6ab0: 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 intersperse ....
6ac0: 09 09 20 20 20 20 28 74 61 6b 65 20 64 70 61 72 .. (take dpar
6ad0: 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 ts (- (length dp
6ae0: 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 20 arts) 1))......
6af0: 20 20 20 22 2f 22 29 29 29 29 0a 09 09 20 20 20 "/"))))...
6b00: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
6b10: 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 Removing run: "
6b20: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 runkey " " (db:g
6b30: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
6b40: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 er run header "r
6b50: 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 20 28 unname"))... (
6b60: 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 64 62 db:delete-run db
6b70: 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 3b 3b run-id)... ;;
6b80: 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 65 20 need to figure
6b90: 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 6f 20 out the path to
6ba0: 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e 64 20 the run dir and
6bb0: 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 6d 70 remove it if emp
6bc0: 74 79 0a 09 09 20 20 20 3b 3b 20 20 20 20 28 69 ty... ;; (i
6bd0: 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 f (null? (glob (
6be0: 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f 2a conc runpath "/*
6bf0: 22 29 29 29 0a 09 09 20 20 20 3b 3b 20 20 20 20 ")))... ;;
6c00: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 (begin...
6c10: 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e ;; . (debug:prin
6c20: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 t 1 "Removing ru
6c30: 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 n dir " runpath)
6c40: 0a 09 09 20 20 20 3b 3b 20 09 20 28 73 79 73 74 ... ;; . (syst
6c50: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 em (conc "rmdir
6c60: 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 29 29 -p " runpath))))
6c70: 0a 09 09 20 20 20 29 29 29 29 0a 09 20 29 29 0a ... )))).. )).
6c80: 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b runs)))..;;
6c90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ca0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6cb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6cc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6cd0: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e ======.;; Routin
6ce0: 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 es for manipulat
6cf0: 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d ing runs.;;=====
6d00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6d40: 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 =..;; Since many
6d50: 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 calls to a run
6d60: 72 65 71 75 69 72 65 20 70 72 65 74 74 79 20 6d require pretty m
6d70: 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 65 74 uch the same set
6d80: 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 up .;; this wrap
6d90: 70 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 72 per is used to r
6da0: 65 64 75 63 65 20 74 68 65 20 72 65 70 6c 69 63 educe the replic
6db0: 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 ation of code.(d
6dc0: 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 efine (general-r
6dd0: 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 un-call switchna
6de0: 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 me action-desc p
6df0: 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 72 75 roc). (let ((ru
6e00: 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 74 2d nname (args:get-
6e10: 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 arg ":runname"))
6e20: 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 20 28 ..(target (if (
6e30: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 args:get-arg "-t
6e40: 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 arget")... (
6e50: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 args:get-arg "-t
6e60: 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 28 arget")... (
6e70: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 args:get-arg "-r
6e80: 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 68 31 eqtarg")))..(th1
6e90: 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 63 #f)). (c
6ea0: 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 ond. ((not t
6eb0: 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 64 65 arget). (de
6ec0: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
6ed0: 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 75 OR: Missing requ
6ee0: 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 66 ired parameter f
6ef0: 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 20 or " switchname
6f00: 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 63 ", you must spec
6f10: 69 66 79 20 74 68 65 20 74 61 72 67 65 74 20 77 ify the target w
6f20: 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20 20 ith -target").
6f30: 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 (exit 3)).
6f40: 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 ((not runname
6f50: 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 ). (debug:p
6f60: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 4d rint 0 "ERROR: M
6f70: 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 issing required
6f80: 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 20 parameter for "
6f90: 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f switchname ", yo
6fa0: 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 u must specify t
6fb0: 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 he run name with
6fc0: 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d :runname runnam
6fd0: 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 20 e"). (exit
6fe0: 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 3)). (else.
6ff0: 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 20 (let ((db
7000: 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73 20 #f).. (keys
7010: 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 #f))..(if (not (
7020: 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a setup-for-run)).
7030: 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 20 . (begin ..
7040: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
7050: 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 65 0 "Failed to se
7060: 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 tup, exiting")..
7070: 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 29 (exit 1)))
7080: 0a 09 28 73 65 74 21 20 64 62 20 20 20 28 6f 70 ..(set! db (op
7090: 65 6e 2d 64 62 29 29 0a 09 28 69 66 20 28 61 72 en-db))..(if (ar
70a0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 gs:get-arg "-ser
70b0: 76 65 72 22 29 0a 09 20 20 20 20 28 73 65 72 76 ver").. (serv
70c0: 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 72 67 er:start db (arg
70d0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 s:get-arg "-serv
70e0: 65 72 22 29 29 0a 09 20 20 20 20 28 69 66 20 28 er")).. (if (
70f0: 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 65 not (or (args:ge
7100: 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 t-arg "-runall")
7110: 0a 09 09 09 20 20 28 61 72 67 73 3a 67 65 74 2d .... (args:get-
7120: 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 arg "-runtests")
7130: 29 29 0a 09 09 28 73 65 72 76 65 72 3a 63 6c 69 ))...(server:cli
7140: 65 6e 74 2d 73 65 74 75 70 20 64 62 29 29 29 0a ent-setup db))).
7150: 09 28 73 65 74 21 20 6b 65 79 73 20 28 72 64 62 .(set! keys (rdb
7160: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 :get-keys db))..
7170: 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 74 ;; have enough t
7180: 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 65 o process -targe
7190: 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 65 t or -reqtarg he
71a0: 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 re..(if (args:ge
71b0: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
71c0: 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 72 ).. (let* ((r
71d0: 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 unconfigf (conc
71e0: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e *toppath* "/run
71f0: 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 configs.config")
7200: 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c ) ;; DO NOT EVAL
7210: 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 UATE ALL ... (
7220: 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 64 runconfig (read
7230: 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 -config runconfi
7240: 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f 6e gf #f #f environ
7250: 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 20 -patt: #f))) ..
7260: 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d 74 (if (hash-t
7270: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
7280: 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 runconfig (args
7290: 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 :get-arg "-reqta
72a0: 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b 65 rg") #f)... (ke
72b0: 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 72 ys:target-set-ar
72c0: 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 65 gs keys (args:ge
72d0: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
72e0: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 ) args:arg-hash)
72f0: 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 20 ... (begin...
7300: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
7310: 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 "ERROR: [" (arg
7320: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
7330: 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 arg") "] not fou
7340: 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 nd in " runconfi
7350: 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c 69 74 gf)... (sqlit
7360: 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 e3:finalize! db)
7370: 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 29 29 ... (exit 1))
7380: 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 72 67 )).. (if (arg
7390: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
73a0: 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 et")...(keys:tar
73b0: 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 get-set-args key
73c0: 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 s (args:get-arg
73d0: 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 3a 61 "-target" args:a
73e0: 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a 61 72 rg-hash) args:ar
73f0: 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 20 28 g-hash)))..(if (
7400: 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 not (car *config
7410: 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 info*)).. (be
7420: 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 62 75 gin.. (debu
7430: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
7440: 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f 20 22 : Attempted to "
7450: 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 action-desc " b
7460: 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 ut run area conf
7470: 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e ig file not foun
7480: 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 69 74 d").. (exit
7490: 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 1)).. ;; Ext
74a0: 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 20 6e ract out stuff n
74b0: 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 eeded in most or
74c0: 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 many calls..
74d0: 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 63 61 ;; here then ca
74e0: 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 ll proc.. (le
74f0: 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 t* ((keynames
7500: 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 (map key:get-fie
7510: 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 ldname keys))...
7520: 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 (keyvallst (
7530: 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 keys->vallist ke
7540: 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 20 20 ys #t)))..
7550: 28 70 72 6f 63 20 64 62 20 74 61 72 67 65 74 20 (proc db target
7560: 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 runname keys key
7570: 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 names keyvallst)
7580: 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 68 72 ))..(if th1 (thr
7590: 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a ead-join! th1)).
75a0: 09 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 .(sqlite3:finali
75b0: 7a 65 21 20 64 62 29 0a 09 28 73 65 74 21 20 2a ze! db)..(set! *
75c0: 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 didsomething* #t
75d0: 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d ))))))..;;======
75e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
75f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7620: 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a .;; Rollup runs.
7630: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
7640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7670: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 ========..;; Upd
7680: 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 ate the test_met
7690: 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 69 73 a table for this
76a0: 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 28 72 test.(define (r
76b0: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f uns:update-test_
76c0: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d meta db test-nam
76d0: 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 e test-conf). (
76e0: 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f 72 64 let ((currrecord
76f0: 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 (db:testmeta-ge
7700: 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 t-record db test
7710: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 69 66 -name))). (if
7720: 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f 72 64 (not currrecord
7730: 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 73 65 )..(begin.. (se
7740: 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 28 6d t! currrecord (m
7750: 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 23 66 ake-vector 10 #f
7760: 29 29 0a 09 20 20 28 64 62 3a 74 65 73 74 6d 65 )).. (db:testme
7770: 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 64 62 ta-add-record db
7780: 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 test-name))).
7790: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
77a0: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a (lambda (key).
77b0: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 69 (let* ((i
77c0: 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 0a 09 dx (cadr key))..
77d0: 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 72 20 (fld (car
77e0: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 76 key)).. (v
77f0: 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 al (config-looku
7800: 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 p test-conf "tes
7810: 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 0a 09 t_meta" fld)))..
7820: 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ;; (debug:print
7830: 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 20 22 5 "idx: " idx "
7840: 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 76 61 fld: " fld " va
7850: 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 66 20 l: " val).. (if
7860: 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 (and val (not (e
7870: 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 qual? (vector-re
7880: 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 64 78 f currrecord idx
7890: 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 20 28 ) val))).. (
78a0: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 70 begin.. (p
78b0: 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 20 22 rint "Updating "
78c0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 test-name " " f
78d0: 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 ld " to " val)..
78e0: 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 6d (db:testm
78f0: 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 eta-update-field
7900: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c db test-name fl
7910: 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 d val))))).
7920: 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 22 '(("author" 2)("
7930: 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 72 owner" 3)("descr
7940: 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 69 iption" 4)("revi
7950: 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22 20 ewed" 5)("tags"
7960: 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 9)))))..;; Updat
7970: 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 e test_meta for
7980: 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 6e all tests.(defin
7990: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 e (runs:update-a
79a0: 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 29 ll-test_meta db)
79b0: 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e . (let ((test-n
79c0: 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 ames (get-all-le
79d0: 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 20 gal-tests))).
79e0: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
79f0: 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d 6e (lambda (test-n
7a00: 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 ame). (let
7a10: 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 20 * ((test-path
7a20: 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a (conc *toppath*
7a30: 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 2d "/tests/" test-
7a40: 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 74 name)).. (t
7a50: 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e est-configf (con
7a60: 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 65 c test-path "/te
7a70: 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 stconfig"))..
7a80: 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20 20 (testexists
7a90: 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 (and (file-exis
7aa0: 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 ts? test-configf
7ab0: 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 )(file-read-acce
7ac0: 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 ss? test-configf
7ad0: 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 ))).. ;; re
7ae0: 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 20 ad configs with
7af0: 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 tricks turned of
7b00: 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 f (i.e. no syste
7b10: 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d m).. (test-
7b20: 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 74 conf (if test
7b30: 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f 6e exists (read-con
7b40: 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 fig test-configf
7b50: 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 #f #f)(make-has
7b60: 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 28 72 h-table)))).. (r
7b70: 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f uns:update-test_
7b80: 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e 61 6d meta db test-nam
7b90: 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 e test-conf))).
7ba0: 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 test-names))
7bb0: 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 )..;; This could
7bc0: 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 probably be ref
7bd0: 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 actored into one
7be0: 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e complex query .
7bf0: 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 ...(define (runs
7c00: 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b :rollup-run db k
7c10: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 eys keyvallst ru
7c20: 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 nname user) ;; w
7c30: 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b as target, now k
7c40: 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 eyvallst. (debu
7c50: 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e 73 3a g:print 4 "runs:
7c60: 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 rollup-run, keys
7c70: 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 76 61 : " keys " keyva
7c80: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 llst: " keyvalls
7c90: 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 t " :runname " r
7ca0: 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a 20 22 unname " user: "
7cb0: 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 user). (let* (
7cc0: 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 ; (keyvalllst
7cd0: 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 2d (keys:target-
7ce0: 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 72 >keyval keys tar
7cf0: 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e get)).. (new-run
7d00: 2d 69 64 20 20 20 20 20 20 28 72 75 6e 73 3a 72 -id (runs:r
7d10: 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 6b egister-run db k
7d20: 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 eys keyvallst ru
7d30: 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 nname "new" "n/a
7d40: 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 76 " user)).. (prev
7d50: 2d 74 65 73 74 73 20 20 20 20 20 20 28 74 65 73 -tests (tes
7d60: 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 t:get-matching-p
7d70: 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e revious-test-run
7d80: 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d -records db new-
7d90: 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 run-id "%" "%"))
7da0: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20 .. (curr-tests
7db0: 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 (rdb:get-tes
7dc0: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 ts-for-run db ne
7dd0: 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 w-run-id "%" "%"
7de0: 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 63 75 '() '())).. (cu
7df0: 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 28 6d rr-tests-hash (m
7e00: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
7e10: 29 0a 20 20 20 20 28 64 62 3a 75 70 64 61 74 65 ). (db:update
7e20: 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 -run-event_time
7e30: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 db new-run-id).
7e40: 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 ;; index the
7e50: 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 74 65 already saved te
7e60: 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d 65 20 sts by testname
7e70: 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e 20 63 and itemdat in c
7e80: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 urr-tests-hash.
7e90: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 (for-each.
7ea0: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 (lambda (testd
7eb0: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a at). (let*
7ec0: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 ((testname (db
7ed0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
7ee0: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 me testdat))..
7ef0: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 (item-path (
7f00: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
7f10: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a -path testdat)).
7f20: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d . (full-nam
7f30: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 e (conc testname
7f40: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
7f50: 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d ).. (hash-table-
7f60: 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d set! curr-tests-
7f70: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 hash full-name t
7f80: 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 20 63 estdat))). c
7f90: 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 20 3b urr-tests). ;
7fa0: 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 ; NOPE: Non-opti
7fb0: 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 54 72 mal approach. Tr
7fc0: 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 2e 0a y this instead..
7fd0: 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 ;; 1. test
7fe0: 73 20 61 72 65 20 72 65 63 65 69 76 65 64 20 69 s are received i
7ff0: 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 n a list, most r
8000: 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 20 20 ecent first.
8010: 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 65 20 ;; 2. replace
8020: 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 the rollup test
8030: 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a 61 6c with the new *al
8040: 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 ways*. (for-e
8050: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 ach . (lambd
8060: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 a (testdat).
8070: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e (let* ((testn
8080: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ame (db:test-ge
8090: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 t-testname testd
80a0: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 at)).. (ite
80b0: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
80c0: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
80d0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
80e0: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 full-name (conc
80f0: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 testname "/" ite
8100: 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 20 20 m-path))..
8110: 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 20 28 (prev-test-dat (
8120: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
8130: 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 73 74 efault curr-test
8140: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 s-hash full-name
8150: 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 74 65 #f)).. (te
8160: 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 28 64 st-steps (d
8170: 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d b:get-steps-for-
8180: 74 65 73 74 20 64 62 20 28 64 62 3a 74 65 73 74 test db (db:test
8190: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 -get-id testdat)
81a0: 29 29 0a 09 20 20 20 20 20 20 28 6e 65 77 2d 74 )).. (new-t
81b0: 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 29 0a est-record #f)).
81c0: 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 68 65 . ;; replace the
81d0: 73 65 20 77 69 74 68 20 69 6e 73 65 72 74 20 2e se with insert .
81e0: 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 70 70 .. select.. (app
81f0: 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 ly sqlite3:execu
8200: 74 65 20 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e te ...db ...(con
8210: 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 c "INSERT OR REP
8220: 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 73 20 LACE INTO tests
8230: 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 (run_id,testname
8240: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 ,state,status,ev
8250: 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 ent_time,host,cp
8260: 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 uload,diskfree,u
8270: 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d name,rundir,item
8280: 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 _path,run_durati
8290: 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f on,final_logf,co
82a0: 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 20 20 mment) "...
82b0: 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c "VALUES (?,?,?,
82c0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
82d0: 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d ?,?,?);")...new-
82e0: 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 76 65 run-id (cddr (ve
82f0: 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 ctor->list testd
8300: 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 6e 65 at))).. (set! ne
8310: 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 20 28 w-testdat (car (
8320: 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f rdb:get-tests-fo
8330: 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e r-run db new-run
8340: 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 65 -id testname ite
8350: 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 29 m-path '() '()))
8360: 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d ).. (hash-table-
8370: 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 2d set! curr-tests-
8380: 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e hash full-name n
8390: 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 74 ew-testdat) ;; t
83a0: 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e his could be con
83b0: 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 65 fusing, which re
83c0: 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 cord should go i
83d0: 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 nto the lookup t
83e0: 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 able?.. ;; Now d
83f0: 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 uplicate the tes
8400: 74 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 67 t steps.. (debug
8410: 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e :print 4 "Copyin
8420: 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 g records in tes
8430: 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 73 t_steps from tes
8440: 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d t_id=" (db:test-
8450: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 get-id testdat)
8460: 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d " to " (db:test-
8470: 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 get-id new-testd
8480: 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a at)).. (sqlite3:
8490: 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a execute .. db .
84a0: 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 . (conc "INSERT
84b0: 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f OR REPLACE INTO
84c0: 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 65 73 test_steps (tes
84d0: 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 t_id,stepname,st
84e0: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 ate,status,event
84f0: 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 _time,comment) "
8500: 0a 09 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 ..."SELECT " (db
8510: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
8520: 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70 -testdat) ",step
8530: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
8540: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d s,event_time,com
8550: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 ment FROM test_s
8560: 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f teps WHERE test_
8570: 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 id=?;").. (db:t
8580: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
8590: 61 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 at)).. ;; Now du
85a0: 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 73 74 plicate the test
85b0: 20 64 61 74 61 0a 09 20 28 64 65 62 75 67 3a 70 data.. (debug:p
85c0: 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 rint 4 "Copying
85d0: 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f records in test_
85e0: 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 data from test_i
85f0: 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 d=" (db:test-get
8600: 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 -id testdat) " t
8610: 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 o " (db:test-get
8620: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
8630: 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65 ).. (sqlite3:exe
8640: 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20 cute .. db ..
8650: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
8660: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
8670: 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 st_data (test_id
8680: 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 ,category,variab
8690: 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 le,value,expecte
86a0: 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d d,tol,units,comm
86b0: 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 43 54 ent) "..."SELECT
86c0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
86d0: 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 id new-testdat)
86e0: 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 ",category,varia
86f0: 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 ble,value,expect
8700: 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d ed,tol,units,com
8710: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 ment FROM test_d
8720: 61 74 61 20 57 48 45 52 45 20 74 65 73 74 5f 69 ata WHERE test_i
8730: 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 d=?;").. (db:te
8740: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
8750: 74 29 29 0a 09 20 29 29 0a 20 20 20 20 20 70 72 t)).. )). pr
8760: 65 76 2d 74 65 73 74 73 29 29 29 0a 09 20 0a 20 ev-tests))).. .
8770: 20 20 20 20 0a .