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 3b 3b 20 4c 65 74 keys). ;; Let
09b0: 73 20 75 73 65 20 74 68 69 73 20 61 73 20 61 6e s use this as an
09c0: 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 74 6f 20 opportunity to
09d0: 70 75 74 20 4d 54 5f 52 55 4e 4e 41 4d 45 20 69 put MT_RUNNAME i
09e0: 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e n the environmen
09f0: 74 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 t. (sqlite3:f
0a00: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 20 20 20 20 or-each-row.
0a10: 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61 6d (lambda (runnam
0a20: 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 65 6e e). (seten
0a30: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 72 v "MT_RUNNAME" r
0a40: 75 6e 6e 61 6d 65 29 29 0a 20 20 20 20 20 64 62 unname)). db
0a50: 0a 20 20 20 20 20 22 53 45 4c 45 43 54 20 72 75 . "SELECT ru
0a60: 6e 6e 61 6d 65 20 46 52 4f 4d 20 72 75 6e 73 20 nname FROM runs
0a70: 57 48 45 52 45 20 69 64 3d 3f 3b 22 0a 20 20 20 WHERE id=?;".
0a80: 20 20 72 75 6e 2d 69 64 29 0a 20 20 20 20 29 29 run-id). ))
0a90: 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 ..(define (set-i
0aa0: 74 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 tem-env-vars ite
0ab0: 6d 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 mdat). (for-eac
0ac0: 68 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 h (lambda (item)
0ad0: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
0ae0: 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 rint 2 "setenv "
0af0: 20 28 63 61 72 20 69 74 65 6d 29 20 22 20 22 20 (car item) " "
0b00: 28 63 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20 (cadr item))..
0b10: 20 20 20 20 28 73 65 74 65 6e 76 20 28 63 61 72 (setenv (car
0b20: 20 69 74 65 6d 29 20 28 63 61 64 72 20 69 74 65 item) (cadr ite
0b30: 6d 29 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61 m))).. itemda
0b40: 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 t))..(define (ru
0b50: 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d ns:can-run-more-
0b60: 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 65 tests db test-re
0b70: 63 6f 72 64 29 0a 20 20 28 6c 65 74 2a 20 28 28 cord). (let* ((
0b80: 74 63 6f 6e 66 69 67 20 20 20 20 20 20 20 20 20 tconfig
0b90: 20 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 (tests:t
0ba0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 estqueue-get-tes
0bb0: 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 63 tconfig test-rec
0bc0: 6f 72 64 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 ord)).. (jobgrou
0bd0: 70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 p
0be0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
0bf0: 74 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 tconfig "require
0c00: 6d 65 6e 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 ments" "jobgroup
0c10: 22 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 ")).. (num-runni
0c20: 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 20 28 ng (
0c30: 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 db:get-count-tes
0c40: 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a ts-running db)).
0c50: 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 . (num-running-i
0c60: 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 64 62 3a 67 n-jobgroup (db:g
0c70: 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 et-count-tests-r
0c80: 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f unning-in-jobgro
0c90: 75 70 20 64 62 20 6a 6f 62 67 72 6f 75 70 29 29 up db jobgroup))
0ca0: 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 .. (max-concurre
0cb0: 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 63 6f 6e nt-jobs (con
0cc0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 fig-lookup *conf
0cd0: 69 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 20 igdat* "setup"
0ce0: 20 20 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 "max_concurre
0cf0: 6e 74 5f 6a 6f 62 73 22 29 29 0a 09 20 28 6a 6f nt_jobs")).. (jo
0d00: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 b-group-limit
0d10: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f (config-lo
0d20: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a okup *configdat*
0d30: 20 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 "jobgroups" job
0d40: 67 72 6f 75 70 29 29 29 0a 20 20 20 20 28 64 65 group))). (de
0d50: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 bug:print 2 "max
0d60: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
0d70: 3a 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 : " max-concurre
0d80: 6e 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 nt-jobs ", num-r
0d90: 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 unning: " num-ru
0da0: 6e 6e 69 6e 67 29 0a 20 20 20 20 28 69 66 20 28 nning). (if (
0db0: 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 not (eq? 0 *glob
0dc0: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a alexitstatus*)).
0dd0: 09 23 66 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d .#f..(let ((can-
0de0: 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f not-run-more (co
0df0: 6e 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 nd..... ;; if ma
0e00: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
0e10: 73 20 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 s is set and the
0e20: 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 number running
0e30: 69 73 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 is greater .....
0e40: 20 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e ;; than it than
0e50: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 cannot run more
0e60: 20 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 jobs..... ((and
0e70: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
0e80: 6a 6f 62 73 0a 09 09 09 09 20 20 20 20 20 20 20 jobs.....
0e90: 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 (string->number
0ea0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
0eb0: 6f 62 73 29 0a 09 09 09 09 20 20 20 20 20 20 20 obs).....
0ec0: 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 (>= num-running
0ed0: 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 (string->number
0ee0: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
0ef0: 6f 62 73 29 29 29 0a 09 09 09 09 20 20 28 64 65 obs)))..... (de
0f00: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
0f10: 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e NING: Max runnin
0f20: 67 20 6a 6f 62 73 20 65 78 63 65 65 64 65 64 2c g jobs exceeded,
0f30: 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 current number
0f40: 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 running: " num-r
0f50: 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 20 20 20 unning ......
0f60: 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 ", max_concu
0f70: 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 rrent_jobs: " ma
0f80: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
0f90: 73 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 s)..... #t)....
0fa0: 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75 . ;; if job-grou
0fb0: 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 74 20 61 p-limit is set a
0fc0: 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 nd number of job
0fd0: 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 20 69 s in the group i
0fe0: 73 20 67 72 65 61 74 65 72 0a 09 09 09 09 20 3b s greater..... ;
0ff0: 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 6d 69 74 ; than the limit
1000: 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e then cannot run
1010: 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 20 74 68 more jobs of th
1020: 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 28 28 61 is kind..... ((a
1030: 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d nd job-group-lim
1040: 69 74 0a 09 09 09 09 20 20 20 20 20 20 20 28 3e it..... (>
1050: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e = num-running-in
1060: 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72 -jobgroup job-gr
1070: 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09 oup-limit)).....
1080: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
1090: 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 "WARNING: numbe
10a0: 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d r of jobs " num-
10b0: 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 running-in-jobgr
10c0: 6f 75 70 20 0a 09 09 09 09 09 20 20 20 20 20 20 oup ......
10d0: 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70 " in " jobgroup
10e0: 20 22 20 65 78 63 65 65 64 65 64 2c 20 77 69 6c " exceeded, wil
10f0: 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 74 65 73 l not run " (tes
1100: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
1110: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 -testname test-r
1120: 65 63 6f 72 64 29 29 0a 09 09 09 09 20 20 23 74 ecord))..... #t
1130: 29 0a 09 09 09 09 20 28 65 6c 73 65 20 23 66 29 )..... (else #f)
1140: 29 29 29 0a 09 20 20 28 6e 6f 74 20 63 61 6e 2d ))).. (not can-
1150: 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29 29 29 29 not-run-more))))
1160: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d )..;;===========
1170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
11a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e ===========.;; N
11b0: 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 ew methodology.
11c0: 54 68 65 73 65 20 72 6f 75 74 69 6e 65 73 20 77 These routines w
11d0: 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 65 20 ill replace the
11e0: 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e 20 46 above in time. F
11f0: 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 63 6f or.;; now the co
1200: 64 65 20 69 73 20 64 75 70 6c 69 63 61 74 65 64 de is duplicated
1210: 2e 20 54 68 69 73 20 73 74 75 66 66 20 69 73 20 . This stuff is
1220: 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 20 69 initially used i
1230: 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b n the monitor.;;
1240: 20 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d based code..;;=
1250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1280: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1290: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 73 74 =====..;; regist
12a0: 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 69 er a test run wi
12b0: 74 68 20 74 68 65 20 64 62 0a 28 64 65 66 69 6e th the db.(defin
12c0: 65 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 e (runs:register
12d0: 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 -run db keys key
12e0: 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 73 vallst runname s
12f0: 74 61 74 65 20 73 74 61 74 75 73 20 75 73 65 72 tate status user
1300: 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ). (debug:print
1310: 20 33 20 22 72 75 6e 73 3a 72 65 67 69 73 74 65 3 "runs:registe
1320: 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b r-run, keys: " k
1330: 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a eys " keyvallst:
1340: 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 72 " keyvallst " r
1350: 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e 61 6d unname: " runnam
1360: 65 20 22 20 73 74 61 74 65 3a 20 22 20 73 74 61 e " state: " sta
1370: 74 65 20 22 20 73 74 61 74 75 73 3a 20 22 20 73 te " status: " s
1380: 74 61 74 75 73 20 22 20 75 73 65 72 3a 20 22 20 tatus " user: "
1390: 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 user). (let* ((
13a0: 6b 65 79 73 74 72 20 20 20 20 28 6b 65 79 73 2d keystr (keys-
13b0: 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 29 0a 09 >keystr keys))..
13c0: 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 66 20 (comma (if
13d0: 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 (> (length keys)
13e0: 20 30 29 20 22 2c 22 20 22 22 29 29 0a 09 20 28 0) "," "")).. (
13f0: 61 6e 64 73 74 72 20 20 20 20 28 69 66 20 28 3e andstr (if (>
1400: 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 (length keys) 0
1410: 29 20 22 20 41 4e 44 20 22 20 22 22 29 29 0a 09 ) " AND " ""))..
1420: 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b 65 79 (valslots (key
1430: 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 79 73 s->valslots keys
1440: 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a )) ;; ?,?,? ....
1450: 09 20 28 6b 65 79 76 61 6c 73 20 20 20 28 6d 61 . (keyvals (ma
1460: 70 20 63 61 64 72 20 6b 65 79 76 61 6c 6c 73 74 p cadr keyvallst
1470: 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 20 20 )).. (allvals
1480: 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 (append (list ru
1490: 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 61 74 nname state stat
14a0: 75 73 20 75 73 65 72 29 20 6b 65 79 76 61 6c 73 us user) keyvals
14b0: 29 29 0a 09 20 28 71 72 79 76 61 6c 73 20 20 20 )).. (qryvals
14c0: 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 72 75 (append (list ru
14d0: 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 29 29 nname) keyvals))
14e0: 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 28 73 .. (key=?str (s
14f0: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
1500: 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 e (map (lambda (
1510: 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 65 74 k)(conc (key:get
1520: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 22 3d -fieldname k) "=
1530: 3f 22 29 29 20 6b 65 79 73 29 20 22 20 41 4e 44 ?")) keys) " AND
1540: 20 22 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 "))). (debug
1550: 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 73 3a 20 :print 3 "keys:
1560: 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 6c 73 " keys " allvals
1570: 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 6b 65 : " allvals " ke
1580: 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 6c 73 yvals: " keyvals
1590: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 ). (debug:pri
15a0: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 69 6e nt 2 "NOTE: usin
15b0: 67 20 74 61 72 67 65 74 20 22 20 28 73 74 72 69 g target " (stri
15c0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 6b ng-intersperse k
15d0: 65 79 76 61 6c 73 20 22 2f 22 29 20 22 20 66 6f eyvals "/") " fo
15e0: 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 20 20 r this run").
15f0: 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e 61 6d (if (and runnam
1600: 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 65 72 e (null? (filter
1610: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 (lambda (x)(not
1620: 20 78 29 29 20 6b 65 79 76 61 6c 73 29 29 29 20 x)) keyvals)))
1630: 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 62 65 ;; there must be
1640: 20 61 20 62 65 74 74 65 72 20 77 61 79 20 74 6f a better way to
1650: 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 28 6c "apply and"..(l
1660: 65 74 20 28 28 72 65 73 20 23 66 29 29 0a 09 20 et ((res #f))..
1670: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
1680: 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 6e 63 execute db (conc
1690: 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 4e 4f "INSERT OR IGNO
16a0: 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 72 75 RE INTO runs (ru
16b0: 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 nname,state,stat
16c0: 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 5f 74 us,owner,event_t
16d0: 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 73 74 ime" comma keyst
16e0: 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f 2c 3f r ") VALUES (?,?
16f0: 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 27 25 ,?,?,strftime('%
1700: 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 s','now')" comma
1710: 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 29 0a valslots ");").
1720: 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 20 28 .. allvals).. (
1730: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 66 6f apply sqlite3:fo
1740: 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 20 20 r-each-row ..
1750: 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 20 20 (lambda (id)..
1760: 20 20 20 28 73 65 74 21 20 72 65 73 20 69 64 29 (set! res id)
1770: 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 6c 65 ).. db.. (le
1780: 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 22 53 t ((qry (conc "S
1790: 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 72 75 ELECT id FROM ru
17a0: 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e 61 6d ns WHERE (runnam
17b0: 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b 65 79 e=? " andstr key
17c0: 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a 09 20 =?str ");")))..
17d0: 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 69 6e ;(debug:prin
17e0: 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 79 29 t 4 "qry: " qry)
17f0: 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 20 20 .. qry)..
1800: 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 73 71 qryvals).. (sq
1810: 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 64 62 lite3:execute db
1820: 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 53 45 "UPDATE runs SE
1830: 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 75 73 T state=?,status
1840: 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 20 =? WHERE id=?;"
1850: 73 74 61 74 65 20 73 74 61 74 75 73 20 72 65 73 state status res
1860: 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 65 67 ).. res) ..(beg
1870: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 in.. (debug:pri
1880: 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 61 6c nt 0 "ERROR: Cal
1890: 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 led without all
18a0: 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 22 29 necessary keys")
18b0: 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b 20 54 .. #f))))..;; T
18c0: 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 63 61 his is a duplica
18d0: 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 73 20 te of run-tests
18e0: 28 77 68 69 63 68 20 68 61 73 20 62 65 65 6e 20 (which has been
18f0: 64 65 70 72 65 63 61 74 65 64 29 2e 20 55 73 65 deprecated). Use
1900: 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 65 61 this one instea
1910: 64 20 6f 66 20 72 75 6e 20 74 65 73 74 73 2e 0a d of run tests..
1920: 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 65 66 69 ;; keyvals.(defi
1930: 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 ne (runs:run-tes
1940: 74 73 20 64 62 20 74 61 72 67 65 74 20 72 75 6e ts db target run
1950: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 name test-patts
1960: 69 74 65 6d 2d 70 61 74 74 73 20 75 73 65 72 20 item-patts user
1970: 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 flags). (let* (
1980: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 64 (keys (rd
1990: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b:get-keys db)).
19a0: 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 . (keyvallst (
19b0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 keys:target->key
19c0: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 val keys target)
19d0: 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 ).. (run-id
19e0: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d (runs:register-
19f0: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
1a00: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
1a10: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
1a20: 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 ;; test-name)
1a30: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 )).. (deferred
1a40: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 '()) ;; delay
1a50: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 running these si
1a60: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20 nce they have a
1a70: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 waiton clause..
1a80: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 ;; keepgoing is
1a90: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 the defacto moda
1aa0: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 lity now, will a
1ab0: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 dd hit-n-run a b
1ac0: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b it later.. ;; (k
1ad0: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 eepgoing (hash
1ae0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
1af0: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 lt flags "-keepg
1b00: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65 oing" #f)).. (te
1b10: 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09 st-names '())..
1b20: 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 (runconfigf (
1b30: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 conc *toppath*
1b40: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e "/runconfigs.con
1b50: 66 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 fig")).. (requir
1b60: 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20 ed-tests '())..
1b70: 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d (test-records (m
1b80: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
1b90: 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 ).. (set-mega
1ba0: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 test-env-vars db
1bb0: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 run-id) ;; thes
1bc0: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 e may be needed
1bd0: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 by the launching
1be0: 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 69 process.. (i
1bf0: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
1c00: 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 65 runconfigf)..(se
1c10: 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 tup-env-defaults
1c20: 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 db runconfigf r
1c30: 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 un-id *already-s
1c40: 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e een-runconfig-in
1c50: 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d fo* "pre-launch-
1c60: 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 env-vars")..(deb
1c70: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
1c80: 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 ING: You do not
1c90: 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 have a run confi
1ca0: 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e g file: " runcon
1cb0: 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 figf)). .
1cc0: 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 ;; look up all t
1cd0: 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 ests matching th
1ce0: 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 e comma separate
1cf0: 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 d list of globs
1d00: 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 in. ;; test-p
1d10: 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 atts (using % as
1d20: 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 28 wildcard). (
1d30: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 for-each . (
1d40: 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 20 lambda (patt).
1d50: 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74 (let ((test
1d60: 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74 s (glob (conc *t
1d70: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f oppath* "/tests/
1d80: 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c " (string-transl
1d90: 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22 ate patt "%" "*"
1da0: 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 65 ))))).. (set! te
1db0: 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d sts (filter (lam
1dc0: 62 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 2d bda (test)(file-
1dd0: 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65 exists? (conc te
1de0: 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 st "/testconfig"
1df0: 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 73 ))) tests)).. (s
1e00: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 et! test-names (
1e10: 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65 append test-name
1e20: 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 6c s ..... (map (l
1e30: 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 09 ambda (testp)...
1e40: 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 6e ... (last (strin
1e50: 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 2f g-split testp "/
1e60: 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 "))).....
1e70: 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 20 tests))))).
1e80: 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 28 (if test-patts (
1e90: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 string-split tes
1ea0: 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 73 t-patts ",")(lis
1eb0: 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 3b t "%"))).. ;
1ec0: 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 70 ; now remove dup
1ed0: 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 74 licates. (set
1ee0: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 65 ! test-names (de
1ef0: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 lete-duplicates
1f00: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 test-names))..
1f10: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
1f20: 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 6d "INFO: test nam
1f30: 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 29 es " test-names)
1f40: 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 .. ;; on the
1f50: 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 first pass or ca
1f60: 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 ll to run-tests
1f70: 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 set FAILS to NOT
1f80: 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 _STARTED if.
1f90: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 ;; -keepgoing is
1fa0: 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 specified. (
1fb0: 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d if (eq? *passnum
1fc0: 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 * 0)..(begin..
1fd0: 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74 ;; have to delet
1fe0: 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77 e test records w
1ff0: 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 here NOT_STARTED
2000: 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20 since they can
2010: 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 cause -keepgoing
2020: 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 to .. ;; get s
2030: 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f tuck due to beco
2040: 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c ming inaccessibl
2050: 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 e from a failed
2060: 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 test. I.e. if te
2070: 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20 st B depends ..
2080: 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75 ;; on test A bu
2090: 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64 t test B reached
20a0: 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 the point on be
20b0: 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61 ing registered a
20c0: 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e s NOT_STARTED an
20d0: 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 d test.. ;; A f
20e0: 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 ailed for some r
20f0: 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 eason then on re
2100: 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 -run using -keep
2110: 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61 going the run ca
2120: 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 n never complete
2130: 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d ... (db:delete-
2140: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 tests-in-state d
2150: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 b run-id "NOT_ST
2160: 41 52 54 45 44 22 29 0a 09 20 20 28 72 64 62 3a ARTED").. (rdb:
2170: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d set-tests-state-
2180: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 status db run-id
2190: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 test-names #f "
21a0: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 FAIL" "NOT_START
21b0: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 ED" "FAIL")))..
21c0: 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f ;; now add no
21d0: 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 n-directly refer
21e0: 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 enced dependenci
21f0: 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 es (i.e. waiton)
2200: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
2210: 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 ull? test-names)
2220: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 )..(let loop ((h
2230: 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d ed (car test-nam
2240: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 es))... (tal (
2250: 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 cdr test-names))
2260: 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 ) ;; 're
2270: 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 turn-procs tells
2280: 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 the config read
2290: 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 er to prep runni
22a0: 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 ng system but re
22b0: 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 turn a proc.. (
22c0: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 let* ((config (
22d0: 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e test:get-testcon
22e0: 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e 2d fig hed 'return-
22f0: 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69 74 procs))... (wait
2300: 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 ons (string-spli
2310: 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e 66 t (let ((w (conf
2320: 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 ig-lookup config
2330: 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 "requirements"
2340: 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 09 "waiton"))).....
2350: 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29 . (if w w "")))
2360: 29 29 0a 09 20 20 20 20 3b 3b 20 28 69 74 65 6d )).. ;; (item
2370: 73 20 20 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 s (items:get-i
2380: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 tems-from-config
2390: 20 63 6f 6e 66 69 67 29 29 29 0a 09 20 20 20 20 config)))..
23a0: 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 (if (not (hash-t
23b0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
23c0: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 test-records he
23d0: 64 20 23 66 29 29 0a 09 09 28 68 61 73 68 2d 74 d #f))...(hash-t
23e0: 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 able-set! test-r
23f0: 65 63 6f 72 64 73 0a 09 09 09 09 20 68 65 64 20 ecords..... hed
2400: 28 76 65 63 74 6f 72 20 68 65 64 20 20 20 20 20 (vector hed
2410: 3b 3b 20 30 0a 09 09 09 09 09 20 20 20 20 20 63 ;; 0...... c
2420: 6f 6e 66 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 onfig ;; 1.....
2430: 09 20 20 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b . waitons ;;
2440: 20 32 0a 09 09 09 09 09 20 20 20 20 20 28 63 6f 2...... (co
2450: 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 nfig-lookup conf
2460: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 ig "requirements
2470: 22 20 22 70 72 69 6f 72 69 74 79 22 29 20 20 20 " "priority")
2480: 20 20 3b 3b 20 70 72 69 6f 72 69 74 79 20 33 0a ;; priority 3.
2490: 09 09 09 09 09 20 20 20 20 20 28 6c 65 74 20 28 ..... (let (
24a0: 28 69 74 65 6d 73 20 20 20 20 20 20 28 68 61 73 (items (has
24b0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
24c0: 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d ult config "item
24d0: 73 22 20 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 s" #f)) ;; items
24e0: 20 34 0a 09 09 09 09 09 09 20 20 20 28 69 74 65 4....... (ite
24f0: 6d 73 74 61 62 6c 65 20 28 68 61 73 68 2d 74 61 mstable (hash-ta
2500: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
2510: 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 74 61 62 config "itemstab
2520: 6c 65 22 20 23 66 29 29 29 20 0a 09 09 09 09 09 le" #f))) ......
2530: 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 74 ;; if eit
2540: 68 65 72 20 69 74 65 6d 73 20 6f 72 20 69 74 65 her items or ite
2550: 6d 73 20 74 61 62 6c 65 20 69 73 20 61 20 70 72 ms table is a pr
2560: 6f 63 20 72 65 74 75 72 6e 20 69 74 20 73 6f 20 oc return it so
2570: 74 65 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 test running....
2580: 09 09 20 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 .. ;; proc
2590: 65 73 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 ess can know to
25a0: 63 61 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 call items:get-i
25b0: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 tems-from-config
25c0: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 ...... ;;
25d0: 69 66 20 65 69 74 68 65 72 20 69 73 20 61 20 6c if either is a l
25e0: 69 73 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 ist and none is
25f0: 61 20 70 72 6f 63 20 67 6f 20 61 68 65 61 64 20 a proc go ahead
2600: 61 6e 64 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 and call get-ite
2610: 6d 73 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b ms...... ;
2620: 3b 20 6f 74 68 65 72 77 69 73 65 20 72 65 74 75 ; otherwise retu
2630: 72 6e 20 23 66 20 2d 20 74 68 69 73 20 69 73 20 rn #f - this is
2640: 6e 6f 74 20 61 6e 20 69 74 65 72 61 74 65 64 20 not an iterated
2650: 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 20 test......
2660: 20 28 63 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 (cond.......((p
2670: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 rocedure? items)
2680: 20 20 20 20 20 20 0a 09 09 09 09 09 09 20 28 64 ....... (d
2690: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
26a0: 46 4f 3a 20 69 74 65 6d 73 20 69 73 20 61 20 70 FO: items is a p
26b0: 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 rocedure, will c
26c0: 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09 09 alc later").....
26d0: 09 09 20 69 74 65 6d 73 29 20 20 20 20 20 20 20 .. items)
26e0: 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 ;; calc lat
26f0: 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f 63 65 er.......((proce
2700: 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 dure? itemstable
2710: 29 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 3a )....... (debug:
2720: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 print 4 "INFO: i
2730: 74 65 6d 73 74 61 62 6c 65 20 69 73 20 61 20 70 temstable is a p
2740: 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 rocedure, will c
2750: 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09 09 alc later").....
2760: 09 09 20 69 74 65 6d 73 74 61 62 6c 65 29 20 20 .. itemstable)
2770: 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 ;; calc lat
2780: 65 72 0a 09 09 09 09 09 09 28 28 66 69 6c 74 65 er.......((filte
2790: 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 09 09 r (lambda (x)...
27a0: 09 09 09 09 09 20 20 20 28 6c 65 74 20 28 28 76 ..... (let ((v
27b0: 61 6c 20 28 63 61 72 20 78 29 29 29 0a 09 09 09 al (car x)))....
27c0: 09 09 09 09 20 20 20 20 20 28 69 66 20 28 70 72 .... (if (pr
27d0: 6f 63 65 64 75 72 65 3f 20 76 61 6c 29 20 76 61 ocedure? val) va
27e0: 6c 20 23 66 29 29 29 0a 09 09 09 09 09 09 09 20 l #f)))........
27f0: 28 61 70 70 65 6e 64 20 28 69 66 20 28 6c 69 73 (append (if (lis
2800: 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 73 20 t? items) items
2810: 27 28 29 29 0a 09 09 09 09 09 09 09 09 20 28 69 '())......... (i
2820: 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 f (list? itemsta
2830: 62 6c 65 29 20 69 74 65 6d 73 74 61 62 6c 65 20 ble) itemstable
2840: 27 28 29 29 29 29 0a 09 09 09 09 09 09 20 27 68 '())))....... 'h
2850: 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a 09 ave-procedure)..
2860: 09 09 09 09 09 28 28 6f 72 20 28 6c 69 73 74 3f .....((or (list?
2870: 20 69 74 65 6d 73 29 28 6c 69 73 74 3f 20 69 74 items)(list? it
2880: 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b 20 63 61 emstable)) ;; ca
2890: 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 20 28 64 lc now....... (d
28a0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
28b0: 46 4f 3a 20 69 74 65 6d 73 20 61 6e 64 20 69 74 FO: items and it
28c0: 65 6d 73 74 61 62 6c 65 20 61 72 65 20 6c 69 73 emstable are lis
28d0: 74 73 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a ts, calc now\n".
28e0: 09 09 09 09 09 09 09 20 20 20 20 20 20 22 20 20 ....... "
28f0: 20 20 69 74 65 6d 73 3a 20 22 20 69 74 65 6d 73 items: " items
2900: 20 22 20 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 " itemstable: "
2910: 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 itemstable)....
2920: 09 09 09 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 ... (items:get-i
2930: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 tems-from-config
2940: 20 63 6f 6e 66 69 67 29 29 0a 09 09 09 09 09 09 config)).......
2950: 28 65 6c 73 65 20 23 66 29 29 29 20 20 20 20 20 (else #f)))
2960: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2970: 20 20 20 20 20 20 3b 3b 20 6e 6f 74 20 69 74 65 ;; not ite
2980: 72 61 74 65 64 0a 09 09 09 09 09 20 20 20 20 20 rated......
2990: 23 66 20 20 20 20 20 20 3b 3b 20 69 74 65 6d 73 #f ;; items
29a0: 64 61 74 20 35 0a 09 09 09 09 09 20 20 20 20 20 dat 5......
29b0: 3b 3b 20 23 66 20 20 20 20 20 20 3b 3b 20 73 70 ;; #f ;; sp
29c0: 61 72 65 0a 09 09 09 09 09 20 20 20 20 20 29 29 are...... ))
29d0: 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 ).. (for-each
29e0: 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 .. (lambda
29f0: 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 (waiton)..
2a00: 20 28 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e (if (and waiton
2a10: 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 (not (member wa
2a20: 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 iton test-names)
2a30: 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 ))... (begin..
2a40: 09 20 20 20 20 20 28 73 65 74 21 20 72 65 71 75 . (set! requ
2a50: 69 72 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 ired-tests (cons
2a60: 20 77 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64 waiton required
2a70: 2d 74 65 73 74 73 29 29 0a 09 09 20 20 20 20 20 -tests))...
2a80: 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 (set! test-names
2a90: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 (cons waiton te
2aa0: 73 74 2d 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b st-names))))) ;;
2ab0: 20 77 61 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 was an append,
2ac0: 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 now a cons..
2ad0: 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 waitons).. (
2ae0: 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 let ((remtests (
2af0: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 delete-duplicate
2b00: 73 20 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e s (append waiton
2b10: 73 20 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 s tal))))..
2b20: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
2b30: 20 72 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 remtests))...
2b40: 28 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 (loop (car remte
2b50: 73 74 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 sts)(cdr remtest
2b60: 73 29 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 s))))))).. (i
2b70: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 f (not (null? re
2b80: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 quired-tests))..
2b90: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
2ba0: 49 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 INFO: Adding " r
2bb0: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 equired-tests "
2bc0: 74 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 to the run queue
2bd0: 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45 3a ")). ;; NOTE:
2be0: 20 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20 70 these are all p
2bf0: 61 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74 65 arent tests, ite
2c00: 6d 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61 6e ms are not expan
2c10: 64 65 64 20 79 65 74 2e 0a 20 20 20 20 28 72 75 ded yet.. (ru
2c20: 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 ns:run-tests-que
2c30: 75 65 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e ue db run-id run
2c40: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
2c50: 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 s keyvallst flag
2c60: 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 s). (debug:pr
2c70: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c int 4 "INFO: All
2c80: 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29 done by here"))
2c90: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 )..(define (runs
2ca0: 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 65 :run-tests-queue
2cb0: 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 db run-id runna
2cc0: 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 me test-records
2cd0: 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 29 keyvallst flags)
2ce0: 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 73 20 . ;; At this
2cf0: 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 20 6f point the list o
2d00: 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 20 69 f parent tests i
2d10: 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 20 20 s expanded .
2d20: 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 20 65 ;; NB// Should e
2d30: 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 72 65 xpand items here
2d40: 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 72 74 and then insert
2d50: 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 71 75 into the run qu
2d60: 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a 70 72 eue.. (debug:pr
2d70: 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65 63 6f int 5 "test-reco
2d80: 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65 63 6f rds: " test-reco
2d90: 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c 73 74 rds ", keyvallst
2da0: 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 29 0a 20 : " keyvallst).
2db0: 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 (let ((sorted-t
2dc0: 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 est-names (tests
2dd0: 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 :sort-by-priorit
2de0: 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 y-and-waiton tes
2df0: 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 69 74 t-records))..(it
2e00: 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 20 em-patts
2e10: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
2e20: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d default flags "-
2e30: 69 74 65 6d 70 61 74 74 22 20 23 66 29 29 29 0a itempatt" #f))).
2e40: 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 3b (let loop (;
2e50: 20 28 6e 75 6d 74 69 6d 65 73 20 30 29 20 3b 3b (numtimes 0) ;;
2e60: 20 73 68 6f 75 6c 64 6e 27 74 20 6e 65 65 64 20 shouldn't need
2e70: 74 68 69 73 0a 09 20 20 20 20 20 20 20 28 68 65 this.. (he
2e80: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73 d (car s
2e90: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 orted-test-names
2ea0: 29 29 0a 09 20 20 20 20 20 20 20 28 74 61 6c 20 )).. (tal
2eb0: 20 20 20 20 20 20 20 20 28 63 64 72 20 73 6f 72 (cdr sor
2ec0: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 ted-test-names))
2ed0: 29 0a 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 ). (let* ((
2ee0: 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61 73 test-record (has
2ef0: 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73 74 h-table-ref test
2f00: 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a 09 -records hed))..
2f10: 20 20 20 20 20 28 74 63 6f 6e 66 69 67 20 20 20 (tconfig
2f20: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
2f30: 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 ue-get-testconfi
2f40: 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a g test-record)).
2f50: 09 20 20 20 20 20 28 77 61 69 74 6f 6e 73 20 20 . (waitons
2f60: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
2f70: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 eue-get-waitons
2f80: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
2f90: 0a 09 20 20 20 20 20 28 70 72 69 6f 72 69 74 79 .. (priority
2fa0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
2fb0: 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 ueue-get-priorit
2fc0: 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 y test-record)
2fd0: 29 0a 09 20 20 20 20 20 28 69 74 65 6d 64 61 74 ).. (itemdat
2fe0: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 (tests:test
2ff0: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 queue-get-itemda
3000: 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 t test-record
3010: 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 73 20 )).. (items
3020: 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 (tests:tes
3030: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73 tqueue-get-items
3040: 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 test-recor
3050: 64 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 2d d)).. (item-
3060: 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 path (item-lis
3070: 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 t->path itemdat)
3080: 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ))..(debug:print
3090: 20 36 0a 09 09 20 20 20 20 20 22 69 74 65 6d 64 6... "itemd
30a0: 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 at: " itemda
30b0: 74 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 74 t... "\n it
30c0: 65 6d 73 3a 20 20 20 20 20 22 20 69 74 65 6d 73 ems: " items
30d0: 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 74 65 ... "\n ite
30e0: 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d 70 m-path: " item-p
30f0: 61 74 68 29 0a 09 28 63 6f 6e 64 0a 09 20 28 28 ath)..(cond.. ((
3100: 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 68 not items) ;; wh
3110: 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 65 73 en false the tes
3120: 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 61 t is ok to be ha
3130: 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e nded off to laun
3140: 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 66 6f ch (but not befo
3150: 72 65 29 0a 09 20 20 28 6c 65 74 20 28 28 68 61 re).. (let ((ha
3160: 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 28 72 ve-resources (r
3170: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
3180: 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 -tests db test-r
3190: 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 ecord)) ;; look
31a0: 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 67 at the test jobg
31b0: 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f 62 roup and tot job
31c0: 73 20 72 75 6e 6e 69 6e 67 0a 09 09 28 70 72 65 s running...(pre
31d0: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 reqs-not-met (db
31e0: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 :get-prereqs-not
31f0: 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 -met db run-id w
3200: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 aitons item-path
3210: 29 29 29 0a 09 20 20 20 20 3b 3b 20 44 6f 6e 27 ))).. ;; Don'
3220: 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 74 t know at this t
3230: 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 74 20 ime if the test
3240: 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 68 have been launch
3250: 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 20 ed at some time
3260: 69 6e 20 74 68 65 20 70 61 73 74 0a 09 20 20 20 in the past..
3270: 20 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73 ;; i.e. is this
3280: 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 20 a re-launch?..
3290: 20 20 20 28 69 66 20 28 61 6e 64 20 68 61 76 65 (if (and have
32a0: 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20 20 -resources...
32b0: 20 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 (null? prereqs
32c0: 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 3b 3b 20 -not-met))...;;
32d0: 6e 6f 20 6c 6f 6f 70 20 2d 20 64 72 6f 70 20 74 no loop - drop t
32e0: 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 74 68 hough and use th
32f0: 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 62 6f e loop at the bo
3300: 74 74 6f 6d 20 0a 09 09 28 72 75 6e 3a 74 65 73 ttom ...(run:tes
3310: 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e t db run-id runn
3320: 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 ame keyvallst te
3330: 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 st-record flags
3340: 23 66 29 0a 09 09 3b 3b 20 65 6c 73 65 20 74 68 #f)...;; else th
3350: 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 e run is stuck,
3360: 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 temporarily or p
3370: 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 28 6c 65 ermanently...(le
3380: 74 20 28 28 6e 65 77 74 61 6c 20 28 61 70 70 65 t ((newtal (appe
3390: 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 nd tal (list hed
33a0: 29 29 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 6c ))))... ;; coul
33b0: 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 61 dn't run, take a
33c0: 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 28 74 breather... (t
33d0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 34 29 0a hread-sleep! 4).
33e0: 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e .. (loop (car n
33f0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 ewtal)(cdr newta
3400: 6c 29 29 29 29 29 29 0a 09 20 0a 09 20 3b 3b 20 l)))))).. .. ;;
3410: 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 74 case where an it
3420: 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61 ems came in as a
3430: 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65 list been proce
3440: 73 73 65 64 0a 09 20 28 28 61 6e 64 20 28 6c 69 ssed.. ((and (li
3450: 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20 3b st? items) ;
3460: 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20 6f ; thus we know o
3470: 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c 72 ur items are alr
3480: 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64 0a eady calculated.
3490: 09 20 20 20 20 20 20 20 28 6e 6f 74 20 20 20 69 . (not i
34a0: 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 temdat)) ;; and
34b0: 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 not yet expanded
34c0: 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f into the list o
34d0: 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 f things to be d
34e0: 6f 6e 65 0a 09 20 20 28 69 66 20 28 3e 3d 20 2a one.. (if (>= *
34f0: 76 65 72 62 6f 73 69 74 79 2a 20 31 29 28 70 70 verbosity* 1)(pp
3500: 20 69 74 65 6d 73 29 29 0a 09 20 20 3b 3b 20 28 items)).. ;; (
3510: 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 if (>= *verbosit
3520: 79 2a 20 35 29 0a 09 20 20 3b 3b 20 20 20 20 20 y* 5).. ;;
3530: 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 20 20 20 (begin.. ;;
3540: 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 (print "items
3550: 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 69 74 : ") (pp (it
3560: 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c em-assoc->item-l
3570: 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 3b ist items)).. ;
3580: 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 ; (print "
3590: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70 itemstable: ")(p
35a0: 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 p (item-table->i
35b0: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 tem-list itemsta
35c0: 62 6c 65 29 29 29 29 0a 09 20 20 28 66 6f 72 2d ble)))).. (for-
35d0: 65 61 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 61 each.. (lambda
35e0: 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 20 (my-itemdat)..
35f0: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d (let* ((new-
3600: 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c 65 74 test-record (let
3610: 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d ((newrec (make-
3620: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 29 tests:testqueue)
3630: 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 76 ))..... (v
3640: 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 74 ector-copy! test
3650: 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 0a -record newrec).
3660: 09 09 09 09 20 20 20 20 20 20 20 6e 65 77 72 65 .... newre
3670: 63 29 29 0a 09 09 20 20 20 20 28 6d 79 2d 69 74 c))... (my-it
3680: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 em-path (item-li
3690: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d st->path my-item
36a0: 64 61 74 29 29 0a 09 09 20 20 20 20 28 69 74 65 dat))... (ite
36b0: 6d 2d 6d 61 74 63 68 65 73 20 28 69 66 20 69 74 m-matches (if it
36c0: 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 3b em-patts ;
36d0: 3b 20 68 65 72 65 20 77 65 20 61 72 65 20 66 69 ; here we are fi
36e0: 6c 74 65 72 69 6e 67 20 66 6f 72 20 6d 61 74 63 ltering for matc
36f0: 68 65 73 20 77 69 74 68 20 2d 69 74 65 6d 70 61 hes with -itempa
3700: 74 74 0a 09 09 09 09 20 20 20 20 20 20 28 6c 65 tt..... (le
3710: 74 20 28 28 72 65 73 20 23 66 29 29 09 20 3b 3b t ((res #f)). ;;
3720: 20 6c 6f 6f 6b 20 74 68 72 6f 75 67 68 20 61 6c look through al
3730: 6c 20 74 68 65 20 69 74 65 6d 2d 70 61 74 74 73 l the item-patts
3740: 20 69 66 20 64 65 66 69 6e 65 64 2c 20 66 6f 72 if defined, for
3750: 6d 61 74 20 69 73 20 70 61 74 74 31 2c 70 61 74 mat is patt1,pat
3760: 74 32 2c 70 61 74 74 33 20 2e 2e 2e 20 77 69 6c t2,patt3 ... wil
3770: 64 63 61 72 64 20 69 73 20 25 0a 09 09 09 09 09 dcard is %......
3780: 28 66 6f 72 2d 65 61 63 68 20 0a 09 09 09 09 09 (for-each ......
3790: 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a (lambda (patt).
37a0: 09 09 09 09 09 20 20 20 28 69 66 20 28 73 74 72 ..... (if (str
37b0: 69 6e 67 2d 73 65 61 72 63 68 20 28 67 6c 6f 62 ing-search (glob
37c0: 2d 3e 72 65 67 65 78 70 0a 09 09 09 09 09 09 09 ->regexp........
37d0: 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 74 (string-t
37e0: 72 61 6e 73 6c 61 74 65 20 70 61 74 74 20 22 25 ranslate patt "%
37f0: 22 20 22 2a 22 29 29 0a 09 09 09 09 09 09 09 20 " "*"))........
3800: 20 20 20 20 20 69 74 65 6d 2d 70 61 74 68 29 0a item-path).
3810: 09 09 09 09 09 20 20 20 20 20 20 20 28 73 65 74 ..... (set
3820: 21 20 72 65 73 20 23 74 29 29 29 0a 09 09 09 09 ! res #t))).....
3830: 09 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 . (string-split
3840: 69 74 65 6d 2d 70 61 74 74 73 20 22 2c 22 29 29 item-patts ","))
3850: 0a 09 09 09 09 09 72 65 73 29 0a 09 09 09 09 20 ......res).....
3860: 20 20 20 20 20 23 74 29 29 29 0a 09 20 20 20 20 #t)))..
3870: 20 20 20 28 69 66 20 69 74 65 6d 2d 6d 61 74 63 (if item-matc
3880: 68 65 73 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 hes ;; yes, we w
3890: 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 74 ant to process t
38a0: 68 69 73 20 69 74 65 6d 0a 09 09 20 20 20 28 6c his item... (l
38b0: 65 74 20 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 et ((newtestname
38c0: 20 28 63 6f 6e 63 20 68 65 64 20 22 2f 22 20 6d (conc hed "/" m
38d0: 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 29 20 0a y-item-path))) .
38e0: 09 09 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 .. (tests:te
38f0: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d stqueue-set-item
3900: 73 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 s! new-test-re
3910: 63 6f 72 64 20 23 66 29 0a 09 09 20 20 20 20 20 cord #f)...
3920: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3930: 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 6e 65 -set-itemdat! ne
3940: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d 79 w-test-record my
3950: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 20 20 20 -itemdat)...
3960: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
3970: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 6e ! test-records n
3980: 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d 74 ewtestname new-t
3990: 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 20 20 est-record)...
39a0: 20 20 20 28 73 65 74 21 20 74 61 6c 20 28 63 6f (set! tal (co
39b0: 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 74 ns newtestname t
39c0: 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e 63 al)))))) ;; sinc
39d0: 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65 6d e these are item
39e0: 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77 20 ized create new
39f0: 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74 6e test names testn
3a00: 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 20 ame/itempath..
3a10: 20 69 74 65 6d 73 29 0a 09 20 20 28 6c 6f 6f 70 items).. (loop
3a20: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 (car tal)(cdr t
3a30: 61 6c 29 29 29 0a 0a 09 20 3b 3b 20 69 66 20 69 al)))... ;; if i
3a40: 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20 74 tems is a proc t
3a50: 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 hen need to run
3a60: 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d items:get-items-
3a70: 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 from-config, get
3a80: 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f the list and lo
3a90: 6f 70 20 0a 09 20 3b 3b 20 20 20 20 2d 20 62 75 op .. ;; - bu
3aa0: 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 t only do that i
3ab0: 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 73 f resources exis
3ac0: 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 t to kick off th
3ad0: 65 20 6a 6f 62 0a 09 20 28 28 6f 72 20 28 70 72 e job.. ((or (pr
3ae0: 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 ocedure? items)(
3af0: 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d eq? items 'have-
3b00: 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 28 procedure)).. (
3b10: 69 66 20 28 61 6e 64 20 28 72 75 6e 73 3a 63 61 if (and (runs:ca
3b20: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
3b30: 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 db test-record)
3b40: 0a 09 09 20 20 20 28 6e 75 6c 6c 3f 20 28 64 62 ... (null? (db
3b50: 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 :get-prereqs-not
3b60: 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 77 -met db run-id w
3b70: 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 aitons item-path
3b80: 29 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 20 ))).. (let
3b90: 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 73 ((test-name (tes
3ba0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3bb0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 -testname test-r
3bc0: 65 63 6f 72 64 29 29 29 0a 09 09 28 73 65 74 65 ecord)))...(sete
3bd0: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 nv "MT_TEST_NAME
3be0: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 " test-name) ;;
3bf0: 0a 09 09 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 ...(setenv "MT_R
3c00: 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d UNNAME" runnam
3c10: 65 29 0a 09 09 28 73 65 74 2d 6d 65 67 61 74 65 e)...(set-megate
3c20: 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 st-env-vars db r
3c30: 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 un-id) ;; these
3c40: 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 may be needed by
3c50: 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 the launching p
3c60: 72 6f 63 65 73 73 0a 09 09 28 6c 65 74 20 28 28 rocess...(let ((
3c70: 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 6d items-list (item
3c80: 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d s:get-items-from
3c90: 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 29 -config tconfig)
3ca0: 29 29 0a 09 09 20 20 28 69 66 20 28 6c 69 73 74 ))... (if (list
3cb0: 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 ? items-list)...
3cc0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 (begin....
3cd0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3ce0: 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74 -set-items! test
3cf0: 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 -record items-li
3d00: 73 74 29 0a 09 09 09 28 6c 6f 6f 70 20 68 65 64 st)....(loop hed
3d10: 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28 tal))... (
3d20: 62 65 67 69 6e 0a 09 09 09 28 64 65 62 75 67 3a begin....(debug:
3d30: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
3d40: 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 65 The proc from re
3d50: 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 20 ading the setup
3d60: 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 20 did not yield a
3d70: 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 65 list - please re
3d80: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 28 port this")....(
3d90: 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20 20 exit 1)))))..
3da0: 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 61 6c (let ((newtal
3db0: 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 (append tal (li
3dc0: 73 74 20 68 65 64 29 29 29 29 0a 09 09 3b 3b 20 st hed))))...;;
3dd0: 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 if can't run mor
3de0: 65 20 74 65 73 74 73 2c 20 6c 65 74 73 20 74 61 e tests, lets ta
3df0: 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 ke a breather...
3e00: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 31 (thread-sleep! 1
3e10: 29 0a 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e )...(loop (car n
3e20: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 ewtal)(cdr newta
3e30: 6c 29 29 29 29 29 0a 0a 09 20 3b 3b 20 74 68 69 l)))))... ;; thi
3e40: 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f s case should no
3e50: 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 20 t happen, added
3e60: 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 6e to help catch an
3e70: 79 20 62 75 67 73 0a 09 20 28 28 61 6e 64 20 28 y bugs.. ((and (
3e80: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 list? items) ite
3e90: 6d 64 61 74 29 0a 09 20 20 28 64 65 62 75 67 3a mdat).. (debug:
3ea0: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
3eb0: 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 Should not have
3ec0: 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 a list of items
3ed0: 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68 in a test and th
3ee0: 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20 e itemspath set
3ef0: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 - please report
3f00: 74 68 69 73 22 29 0a 09 20 20 28 65 78 69 74 20 this").. (exit
3f10: 31 29 29 29 29 0a 09 0a 20 20 20 20 20 20 3b 3b 1))))... ;;
3f20: 20 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e 20 we get here on
3f30: 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 2d "drop through" -
3f40: 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 loop for next t
3f50: 65 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 20 est in queue.
3f60: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 (if (null? ta
3f70: 6c 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 20 l).. (begin..
3f80: 20 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54 ;; FIXME!!!! T
3f90: 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 HIS SHOULD NOT R
3fa0: 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 21 EQUIRE AN EXIT!!
3fb0: 21 21 21 21 21 0a 09 20 20 20 20 28 64 65 62 75 !!!!!.. (debu
3fc0: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a g:print 1 "INFO:
3fd0: 20 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 All tests launc
3fe0: 68 65 64 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 hed, exiting")..
3ff0: 20 20 20 20 28 65 78 69 74 20 30 29 29 0a 09 20 (exit 0))..
4000: 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 (loop (car tal)
4010: 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 0a 0a (cdr tal))))))..
4020: 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 ;; parent-test i
4030: 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 s there as a pla
4040: 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 ceholder for whe
4050: 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 n parent-tests c
4060: 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 an be run as a s
4070: 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e etup step.(defin
4080: 65 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20 72 e (run:test db r
4090: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 un-id runname ke
40a0: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 yvallst test-rec
40b0: 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 ord flags parent
40c0: 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 -test). ;; All
40d0: 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 these vars might
40e0: 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 be referenced b
40f0: 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 y the testconfig
4100: 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 file reader. (
4110: 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 let* ((test-name
4120: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
4130: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d ueue-get-testnam
4140: 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 e test-record)
4150: 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e ).. (test-waiton
4160: 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 s (tests:testque
4170: 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 ue-get-waitons
4180: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
4190: 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 . (test-conf
41a0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
41b0: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 -get-testconfig
41c0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
41d0: 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 (itemdat (t
41e0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
41f0: 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 et-itemdat te
4200: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 st-record)).. (t
4210: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e est-path (con
4220: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 c *toppath* "/te
4230: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 sts/" test-name)
4240: 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 ) ;; could use t
4250: 65 73 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e 66 est:get-testconf
4260: 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 66 ig here ..... (f
4270: 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61 73 orce (has
4280: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
4290: 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 63 ult flags "-forc
42a0: 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 6e e" #f)).. (rerun
42b0: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 (hash-ta
42c0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
42d0: 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 23 flags "-rerun" #
42e0: 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e 67 f)).. (keepgoing
42f0: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d (hash-table-
4300: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 ref/default flag
4310: 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 23 s "-keepgoing" #
4320: 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 68 f)).. (item-path
4330: 20 20 20 20 20 22 22 29 29 0a 20 20 20 20 28 64 "")). (d
4340: 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 09 20 ebug:print 5...
4350: 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 "test-config: "
4360: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 (hash-table->ali
4370: 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 st test-conf)...
4380: 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 "\n itemdat:
4390: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 " itemdat... ).
43a0: 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 ;; setting it
43b0: 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 emdat to a list
43c0: 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 if it is #f.
43d0: 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 (if (not itemdat
43e0: 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 )(set! itemdat '
43f0: 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 ())). (set! i
4400: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c tem-path (item-l
4410: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
4420: 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 t)). (debug:p
4430: 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69 rint 2 "Attempti
4440: 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 ng to launch tes
4450: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f t " test-name "/
4460: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 20 " item-path).
4470: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 (setenv "MT_TES
4480: 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d T_NAME" test-nam
4490: 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 65 e) ;; . (sete
44a0: 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 nv "MT_RUNNAME"
44b0: 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 28 runname). (
44c0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 set-megatest-env
44d0: 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 -vars db run-id)
44e0: 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 ;; these may be
44f0: 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c needed by the l
4500: 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 aunching process
4510: 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 . (change-dir
4520: 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a ectory *toppath*
4530: 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 ).. ;; Here i
4540: 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 s where the test
4550: 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 _meta table is b
4560: 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 est updated.
4570: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 (runs:update-tes
4580: 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e t_meta db test-n
4590: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 ame test-conf).
45a0: 20 20 20 0a 20 20 20 20 3b 3b 20 28 6c 61 6d 62 . ;; (lamb
45b0: 64 61 20 28 69 74 65 6d 64 61 74 29 20 3b 3b 3b da (itemdat) ;;;
45c0: 20 28 28 72 69 70 65 6e 65 73 73 20 22 6f 76 65 ((ripeness "ove
45d0: 72 72 69 70 65 22 29 20 28 74 65 6d 70 65 72 61 rripe") (tempera
45e0: 74 75 72 65 20 22 63 6f 6f 6c 22 29 20 28 73 65 ture "cool") (se
45f0: 61 73 6f 6e 20 22 73 75 6d 6d 65 72 22 29 29 0a ason "summer")).
4600: 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d (let* ((new-
4610: 74 65 73 74 2d 70 61 74 68 20 28 73 74 72 69 6e test-path (strin
4620: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 63 g-intersperse (c
4630: 6f 6e 73 20 74 65 73 74 2d 70 61 74 68 20 28 6d ons test-path (m
4640: 61 70 20 63 61 64 72 20 69 74 65 6d 64 61 74 29 ap cadr itemdat)
4650: 29 20 22 2f 22 29 29 0a 09 20 20 20 28 6e 65 77 ) "/")).. (new
4660: 2d 74 65 73 74 2d 6e 61 6d 65 20 28 69 66 20 28 -test-name (if (
4670: 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 equal? item-path
4680: 20 22 22 29 20 74 65 73 74 2d 6e 61 6d 65 20 28 "") test-name (
4690: 63 6f 6e 63 20 74 65 73 74 2d 6e 61 6d 65 20 22 conc test-name "
46a0: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 20 /" item-path)))
46b0: 3b 3b 20 6a 75 73 74 20 6e 65 65 64 20 69 74 20 ;; just need it
46c0: 74 6f 20 62 65 20 75 6e 69 71 75 65 0a 09 20 20 to be unique..
46d0: 20 28 74 65 73 74 64 61 74 20 20 20 20 20 20 20 (testdat
46e0: 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 (db:get-test-inf
46f0: 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 o db run-id test
4700: 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 -name item-path)
4710: 29 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f )). (if (no
4720: 74 20 74 65 73 74 64 61 74 29 0a 09 20 20 28 62 t testdat).. (b
4730: 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 egin.. ;; ens
4740: 75 72 65 20 74 68 61 74 20 74 68 65 20 70 61 74 ure that the pat
4750: 68 20 65 78 69 73 74 73 20 62 65 66 6f 72 65 20 h exists before
4760: 72 65 67 69 73 74 65 72 69 6e 67 20 74 68 65 20 registering the
4770: 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 test.. ;; NOP
4780: 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 E: Cannot! Don't
4790: 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20 know yet which
47a0: 64 69 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 disk area will b
47b0: 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 e assigned......
47c0: 20 20 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 ;; (system (
47d0: 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 conc "mkdir -p "
47e0: 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29 new-test-path))
47f0: 0a 09 20 20 20 20 28 72 74 65 73 74 73 3a 72 65 .. (rtests:re
4800: 67 69 73 74 65 72 2d 74 65 73 74 20 64 62 20 72 gister-test db r
4810: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
4820: 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 item-path)..
4830: 28 73 65 74 21 20 74 65 73 74 64 61 74 20 28 64 (set! testdat (d
4840: 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 b:get-test-info
4850: 64 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e db run-id test-n
4860: 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 29 29 ame item-path)))
4870: 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67 65 2d ). (change-
4880: 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d 70 directory test-p
4890: 61 74 68 29 0a 20 20 20 20 20 20 28 63 61 73 65 ath). (case
48a0: 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 61 (if force ;; (a
48b0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 6f rgs:get-arg "-fo
48c0: 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 41 rce")...'NOT_STA
48d0: 52 54 45 44 0a 09 09 28 69 66 20 74 65 73 74 64 RTED...(if testd
48e0: 61 74 0a 09 09 20 20 20 20 28 73 74 72 69 6e 67 at... (string
48f0: 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a 67 ->symbol (test:g
4900: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
4910: 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c 65 64 ))... 'failed
4920: 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 28 -to-insert))..((
4930: 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 74 failed-to-insert
4940: 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ).. (debug:print
4950: 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 0 "ERROR: Faile
4960: 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 d to insert the
4970: 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 20 record into the
4980: 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 41 db"))..((NOT_STA
4990: 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 0a RTED COMPLETED).
49a0: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 . (debug:print 6
49b0: 20 22 47 6f 74 20 68 65 72 65 2c 20 22 20 28 74 "Got here, " (t
49c0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
49d0: 73 74 64 61 74 29 29 0a 09 20 28 6c 65 74 20 28 stdat)).. (let (
49e0: 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 (runflag #f))..
49f0: 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 (cond.. ;;
4a00: 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 6d -force, run no m
4a10: 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 atter what..
4a20: 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 6e (force (set! run
4a30: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b flag #t)).. ;
4a40: 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 72 ; NOT_STARTED, r
4a50: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 un no matter wha
4a60: 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f 20 t.. ((equal?
4a70: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
4a80: 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 54 testdat) "NOT_ST
4a90: 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75 6e ARTED")(set! run
4aa0: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 3b flag #t)).. ;
4ab0: 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e 64 ; not -rerun and
4ac0: 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 43 PASS, WARN or C
4ad0: 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e 0a HECK, do no run.
4ae0: 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 28 . ((and (or (
4af0: 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 20 not rerun)...
4b00: 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 09 keepgoing)...
4b10: 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f 20 ;; Require to
4b20: 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f 72 force re-run for
4b30: 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a 61 COMPLETED or *a
4b40: 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 2c nything* + PASS,
4b50: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 09 WARN or CHECK...
4b60: 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 74 (or (member (t
4b70: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
4b80: 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53 22 estdat) '("PASS"
4b90: 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 29 "WARN" "CHECK")
4ba0: 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 65 )... (membe
4bb0: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
4bc0: 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 43 e testdat) '("C
4bd0: 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a 09 OMPLETED")))) ..
4be0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
4bf0: 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e 69 t 2 "INFO: runni
4c00: 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e ng test " test-n
4c10: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
4c20: 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20 61 h " suppressed a
4c30: 73 20 69 74 20 69 73 20 43 4f 4d 50 4c 45 54 45 s it is COMPLETE
4c40: 44 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67 65 D and " (test:ge
4c50: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
4c60: 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 ).. (set! ru
4c70: 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 nflag #f))..
4c80: 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 ;; -rerun and st
4c90: 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 atus is one of t
4ca0: 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 6e he specifed, run
4cb0: 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 72 it.. ((and r
4cc0: 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 erun... (let* (
4cd0: 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74 72 (rerunlst (str
4ce0: 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 ing-split rerun
4cf0: 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74 2d ",")).... (must-
4d00: 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 rerun (member (t
4d10: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
4d20: 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 74 estdat) rerunlst
4d30: 29 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 )))... (debug
4d40: 3a 70 72 69 6e 74 20 33 20 22 49 4e 46 4f 3a 20 :print 3 "INFO:
4d50: 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 -rerun list: " r
4d60: 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 erun ", test-sta
4d70: 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65 74 tus: " (test:get
4d80: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
4d90: 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 ", must-rerun: "
4da0: 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 must-rerun)...
4db0: 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a must-rerun)).
4dc0: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
4dd0: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 52 65 72 75 nt 2 "INFO: Reru
4de0: 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 73 n forced for tes
4df0: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f t " test-name "/
4e00: 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 " item-path)..
4e10: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
4e20: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b #t)).. ;; -k
4e30: 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 eepgoing, do not
4e40: 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 rerun FAIL..
4e50: 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 ((and keepgoing
4e60: 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 ... (member (te
4e70: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
4e80: 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 29 stdat) '("FAIL")
4e90: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 )).. (set! r
4ea0: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 unflag #f))..
4eb0: 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 ((and (not reru
4ec0: 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 n)... (member (
4ed0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
4ee0: 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c testdat) '("FAIL
4ef0: 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 " "n/a")))..
4f00: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
4f10: 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 28 t)).. (else (
4f20: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
4f30: 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 72 )).. (debug:pr
4f40: 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d int 6 "RUNNING =
4f50: 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e > runflag: " run
4f60: 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 20 flag " STATE: "
4f70: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
4f80: 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 55 testdat) " STATU
4f90: 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 S: " (test:get-s
4fa0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a tatus testdat)).
4fb0: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 6e . (if (not run
4fc0: 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 69 flag).. (i
4fd0: 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 f (not parent-te
4fe0: 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a st)... (debug:
4ff0: 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e print 1 "NOTE: N
5000: 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 74 ot starting test
5010: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 " new-test-name
5020: 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 74 " as it is stat
5030: 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d e \"" (test:get-
5040: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 0a state testdat) .
5050: 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 74 ...."\" and stat
5060: 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 us \"" (test:get
5070: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
5080: 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 6e "\", use -rerun
5090: 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 \"" (test:get-s
50a0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 tatus testdat) "
50b0: 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 \" or -force to
50c0: 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 20 override"))..
50d0: 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 ;; NOTE: No
50e0: 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b 69 longer be checki
50f0: 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 65 73 ng prerequisites
5100: 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 here! Will neve
5110: 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 73 r get here unles
5120: 73 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 20 s prereqs are..
5130: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 61 ;; a
5140: 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 lready met...
5150: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 (if (not (la
5160: 75 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 6e unch-test db run
5170: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
5180: 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 -conf keyvallst
5190: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 test-name test-p
51a0: 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 67 ath itemdat flag
51b0: 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a s))... (begin.
51c0: 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 45 .. (print "E
51d0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
51e0: 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 2e launch the test.
51f0: 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e Exiting as soon
5200: 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 as possible")..
5210: 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c 6f . (set! *glo
5220: 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 31 balexitstatus* 1
5230: 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 72 ) ;; ... (pr
5240: 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 ocess-signal (cu
5250: 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 rrent-process-id
5260: 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 ) signal/kill)))
5270: 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a )))..((KILLED) .
5280: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 . (debug:print 1
5290: 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 "NOTE: " new-te
52a0: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 st-name " is alr
52b0: 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 eady running or
52c0: 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 was explictly ki
52d0: 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 lled, use -force
52e0: 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 to launch it.")
52f0: 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 45 )..((LAUNCHED RE
5300: 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 55 MOTEHOSTSTART RU
5310: 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 28 NNING) .. (if (
5320: 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 > (- (current-se
5330: 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 73 conds)(+ (db:tes
5340: 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 t-get-event_time
5350: 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 20 testdat).....
5360: 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 (db:test-ge
5370: 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 t-run_duration t
5380: 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 29 estdat)))...600)
5390: 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 ;; i.e. no upda
53a0: 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e te for more than
53b0: 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 600 seconds..
53c0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 (begin..
53d0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
53e0: 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 "WARNING: Test
53f0: 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 " test-name " ap
5400: 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 64 pears to be dead
5410: 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 . Forcing it to
5420: 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 state INCOMPLETE
5430: 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 43 and status STUC
5440: 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 20 K/DEAD")..
5450: 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 (test-set-statu
5460: 73 21 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 s! db run-id tes
5470: 74 2d 6e 61 6d 65 20 22 49 4e 43 4f 4d 50 4c 45 t-name "INCOMPLE
5480: 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 44 22 TE" "STUCK/DEAD"
5490: 20 69 74 65 6d 64 61 74 20 22 54 65 73 74 20 69 itemdat "Test i
54a0: 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 s stuck or dead"
54b0: 20 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 #f)).. (deb
54c0: 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 ug:print 2 "NOTE
54d0: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 : " test-name "
54e0: 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 is already runni
54f0: 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 ng")))..(else
5500: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5510: 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 0 "ERROR: Faile
5520: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 d to launch test
5530: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 " new-test-name
5540: 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 ". Unrecognised
5550: 20 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 state " (test:g
5560: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
5570: 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d )))))))..;;=====
5580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55c0: 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 =.;; END OF NEW
55d0: 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d STUFF.;;========
55e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
55f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a ==============..
5620: 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 (define (get-dir
5630: 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 -up-n dir . para
5640: 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 ms) . (let ((dp
5650: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 arts (string-sp
5660: 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 lit dir "/"))..(
5670: 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c count (if (nul
5680: 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 l? params) 1 (ca
5690: 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 r params)))).
56a0: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 (conc "/" (stri
56b0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a ng-intersperse .
56c0: 09 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 . (take dp
56d0: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 arts (- (length
56e0: 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a dparts) count)).
56f0: 09 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a . "/")))).
5700: 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b ;; Remove runs.;
5710: 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 ; fields are pas
5720: 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 sing in through
5730: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 .(define (runs:r
5740: 65 6d 6f 76 65 2d 72 75 6e 73 20 64 62 20 72 75 emove-runs db ru
5750: 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 nnamepatt testpa
5760: 74 74 20 69 74 65 6d 70 61 74 74 29 0a 20 20 28 tt itempatt). (
5770: 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 let* ((keys
5780: 20 20 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 (rdb:get-keys
5790: 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 db)).. (rundat
57a0: 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 (runs:get-r
57b0: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
57c0: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 eys runnamepatt)
57d0: 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 ).. (header
57e0: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e (vector-ref run
57f0: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 dat 0)).. (runs
5800: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 (vector-r
5810: 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 ef rundat 1))).
5820: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
5830: 31 20 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 1 "Header: " hea
5840: 64 65 72 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 der). (for-ea
5850: 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ch. (lambda
5860: 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 (run). (le
5870: 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 t ((runkey (stri
5880: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
5890: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a map (lambda (k).
58a0: 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 ......(db:get-va
58b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
58c0: 6e 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 n header (vector
58d0: 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 -ref k 0))) keys
58e0: 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 ) "/")).. (d
58f0: 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d irs-to-remove (m
5900: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
5910: 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d ).. (let* ((run-
5920: 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 id (db:get-value
5930: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
5940: 65 61 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 eader "id") )...
5950: 28 74 65 73 74 73 20 20 28 72 64 62 3a 67 65 74 (tests (rdb:get
5960: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 -tests-for-run d
5970: 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d b (db:get-value-
5980: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
5990: 61 64 65 72 20 22 69 64 22 29 20 74 65 73 74 70 ader "id") testp
59a0: 61 74 74 20 69 74 65 6d 70 61 74 74 20 27 28 29 att itempatt '()
59b0: 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 '()))...(lasttp
59c0: 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 ath "/does/not/e
59d0: 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a xist/I/hope"))..
59e0: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 . (if (not (nu
59f0: 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 ll? tests))..
5a00: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 64 (begin... (d
5a10: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 ebug:print 1 "Re
5a20: 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 moving tests for
5a30: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 run: " runkey "
5a40: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 " (db:get-value
5a50: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
5a60: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 eader "runname")
5a70: 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 )... (for-each..
5a80: 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 . (lambda (test
5a90: 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 )... (let* ((
5aa0: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 item-path (db:te
5ab0: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
5ac0: 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 test)).... (t
5ad0: 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 est-name (db:tes
5ae0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
5af0: 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e est)).... (run
5b00: 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d -dir (db:test-
5b10: 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 get-rundir test)
5b20: 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 ))... (debu
5b30: 67 3a 70 72 69 6e 74 20 31 20 22 20 20 22 20 28 g:print 1 " " (
5b40: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
5b50: 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a name test) " id:
5b60: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
5b70: 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65 id test) " " ite
5b80: 6d 2d 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 m-path)...
5b90: 28 72 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 (rdb:delete-test
5ba0: 2d 72 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a -records db (db:
5bb0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
5bc0: 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 ))... (if (
5bd0: 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 > (string-length
5be0: 20 72 75 6e 2d 64 69 72 29 20 35 29 20 3b 3b 20 run-dir) 5) ;;
5bf0: 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 bad heuristic bu
5c00: 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 t should prevent
5c10: 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e /tmp /home etc.
5c20: 0a 09 09 09 20 20 28 6c 65 74 20 28 28 66 75 6c .... (let ((ful
5c30: 6c 70 61 74 68 20 72 75 6e 2d 64 69 72 29 29 20 lpath run-dir))
5c40: 3b 3b 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d ;; "/" (db:test-
5c50: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
5c60: 73 74 29 29 29 29 0a 09 09 09 20 20 20 20 28 73 st)))).... (s
5c70: 65 74 21 20 6c 61 73 74 74 70 61 74 68 20 66 75 et! lasttpath fu
5c80: 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 llpath).... (
5c90: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
5ca0: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 dirs-to-remove f
5cb0: 75 6c 6c 70 61 74 68 20 23 74 29 0a 09 09 09 20 ullpath #t)....
5cc0: 20 20 20 3b 3b 20 54 68 65 20 66 6f 6c 6c 6f 77 ;; The follow
5cd0: 69 6e 67 20 77 61 73 20 74 68 65 20 73 61 66 65 ing was the safe
5ce0: 20 64 65 6c 65 74 65 20 63 6f 64 65 20 62 75 74 delete code but
5cf0: 20 69 74 20 77 61 73 20 6e 6f 74 20 62 65 69 6e it was not bein
5d00: 67 20 65 78 65 63 74 75 74 65 64 2e 0a 09 09 09 g exectuted.....
5d10: 20 20 20 20 3b 3b 20 28 6c 65 74 2a 20 28 28 64 ;; (let* ((d
5d20: 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 28 irs-count (+ 1 (
5d30: 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 6e length keys)(len
5d40: 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 gth (string-spli
5d50: 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 t item-path "/")
5d60: 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 ))).... ;;
5d70: 20 20 20 20 20 28 64 69 72 2d 74 6f 2d 72 65 6d (dir-to-rem
5d80: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 66 (get-dir-up-n f
5d90: 75 6c 6c 70 61 74 68 20 64 69 72 73 2d 63 6f 75 ullpath dirs-cou
5da0: 6e 74 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 nt)).... ;;
5db0: 20 20 20 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 (remaining
5dc0: 64 20 28 73 74 72 69 6e 67 2d 73 75 62 73 74 69 d (string-substi
5dd0: 74 75 74 65 20 28 72 65 67 65 78 70 20 28 63 6f tute (regexp (co
5de0: 6e 63 20 22 5e 22 20 64 69 72 2d 74 6f 2d 72 65 nc "^" dir-to-re
5df0: 6d 20 22 2f 22 29 29 20 22 22 20 66 75 6c 6c 70 m "/")) "" fullp
5e00: 61 74 68 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 ath)).... ;;
5e10: 20 20 20 20 20 20 20 28 63 6d 64 20 28 63 6f 6e (cmd (con
5e20: 63 20 22 63 64 20 22 20 64 69 72 2d 74 6f 2d 72 c "cd " dir-to-r
5e30: 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d 70 20 22 em "; rmdir -p "
5e40: 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 29 29 0a remainingd ))).
5e50: 09 09 09 20 20 20 20 3b 3b 20 20 20 28 69 66 20 ... ;; (if
5e60: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 75 (file-exists? fu
5e70: 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 3b llpath).... ;
5e80: 3b 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 ; (begin..
5e90: 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 .. ;;
5ea0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
5eb0: 63 6d 64 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 cmd).... ;;
5ec0: 20 20 20 20 20 20 20 28 73 79 73 74 65 6d 20 63 (system c
5ed0: 6d 64 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 md))).... ;;
5ee0: 20 20 29 29 0a 09 09 09 20 20 20 20 29 29 29 29 )).... ))))
5ef0: 0a 09 09 20 20 20 20 74 65 73 74 73 29 29 29 0a ... tests))).
5f00: 0a 09 20 20 20 3b 3b 20 6c 6f 6f 6b 20 74 68 6f .. ;; look tho
5f10: 75 67 68 20 74 68 65 20 64 69 72 73 2d 74 6f 2d ugh the dirs-to-
5f20: 72 65 6d 6f 76 65 20 66 6f 72 20 63 61 6e 64 69 remove for candi
5f30: 64 61 74 65 73 20 66 6f 72 20 72 65 6d 6f 76 61 dates for remova
5f40: 6c 2e 20 44 6f 20 74 68 69 73 20 61 66 74 65 72 l. Do this after
5f50: 20 64 65 6c 65 74 69 6e 67 20 74 68 65 20 72 65 deleting the re
5f60: 63 6f 72 64 73 0a 09 20 20 20 3b 3b 20 66 6f 72 cords.. ;; for
5f70: 20 65 61 63 68 20 74 65 73 74 20 69 6e 20 63 61 each test in ca
5f80: 73 65 20 77 65 20 67 65 74 20 6b 69 6c 6c 65 64 se we get killed
5f90: 2e 20 54 68 61 74 20 73 68 6f 75 6c 64 20 6d 69 . That should mi
5fa0: 6e 69 6d 69 7a 65 20 74 68 65 20 64 65 74 72 69 nimize the detri
5fb0: 74 75 73 20 6c 65 66 74 20 6f 6e 20 64 69 73 6b tus left on disk
5fc0: 0a 09 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 .. ;; process
5fd0: 74 68 65 20 64 69 72 73 20 66 72 6f 6d 20 6c 6f the dirs from lo
5fe0: 6e 67 65 73 74 20 73 74 72 69 6e 67 20 6c 65 6e ngest string len
5ff0: 67 74 68 20 74 6f 20 73 68 6f 72 74 65 73 74 0a gth to shortest.
6000: 09 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 . (for-each ..
6010: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 (lambda (dir
6020: 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 20 20 20 -to-remove)..
6030: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 (if (file-exi
6040: 73 74 73 3f 20 64 69 72 2d 74 6f 2d 72 65 6d 6f sts? dir-to-remo
6050: 76 65 29 0a 09 09 20 20 28 6c 65 74 20 28 28 64 ve)... (let ((d
6060: 69 72 2d 69 6e 2d 64 62 20 27 28 29 29 29 0a 09 ir-in-db '()))..
6070: 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f . (sqlite3:fo
6080: 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 20 20 r-each-row...
6090: 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 29 0a (lambda (dir).
60a0: 09 09 20 20 20 20 20 20 20 28 73 65 74 21 20 64 .. (set! d
60b0: 69 72 2d 69 6e 2d 64 62 20 28 63 6f 6e 73 20 64 ir-in-db (cons d
60c0: 69 72 20 64 69 72 2d 69 6e 2d 64 62 29 29 29 0a ir dir-in-db))).
60d0: 09 09 20 20 20 20 20 64 62 20 22 53 45 4c 45 43 .. db "SELEC
60e0: 54 20 72 75 6e 64 69 72 20 46 52 4f 4d 20 74 65 T rundir FROM te
60f0: 73 74 73 20 57 48 45 52 45 20 72 75 6e 64 69 72 sts WHERE rundir
6100: 20 4c 49 4b 45 20 3f 3b 22 20 0a 09 09 20 20 20 LIKE ?;" ...
6110: 20 20 28 63 6f 6e 63 20 22 25 22 20 64 69 72 2d (conc "%" dir-
6120: 74 6f 2d 72 65 6d 6f 76 65 20 22 25 22 29 29 20 to-remove "%"))
6130: 3b 3b 20 79 65 73 2c 20 49 27 6d 20 67 6f 69 6e ;; yes, I'm goin
6140: 67 20 74 6f 20 62 61 69 6c 20 69 66 20 74 68 65 g to bail if the
6150: 72 65 20 69 73 20 61 6e 79 74 68 69 6e 67 20 6c re is anything l
6160: 69 6b 65 20 74 68 69 73 20 64 69 72 20 69 6e 20 ike this dir in
6170: 74 68 65 20 64 62 0a 09 09 20 20 20 20 28 69 66 the db... (if
6180: 20 28 6e 75 6c 6c 3f 20 64 69 72 2d 69 6e 2d 64 (null? dir-in-d
6190: 62 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 b)....(begin....
61a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
61b0: 20 22 52 65 6d 6f 76 69 6e 67 20 64 69 72 65 63 "Removing direc
61c0: 74 6f 72 79 20 77 69 74 68 20 7a 65 72 6f 20 64 tory with zero d
61d0: 62 20 72 65 66 65 72 65 6e 63 65 73 3a 20 22 20 b references: "
61e0: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 dir-to-remove)..
61f0: 09 09 20 20 28 73 79 73 74 65 6d 20 28 63 6f 6e .. (system (con
6200: 63 20 22 72 6d 20 2d 72 66 20 22 20 64 69 72 2d c "rm -rf " dir-
6210: 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 20 to-remove))....
6220: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c (hash-table-del
6230: 65 74 65 21 20 64 69 72 73 2d 74 6f 2d 72 65 6d ete! dirs-to-rem
6240: 6f 76 65 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 ove dir-to-remov
6250: 65 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 e))....(debug:pr
6260: 69 6e 74 20 32 20 22 53 6b 69 70 70 69 6e 67 20 int 2 "Skipping
6270: 72 65 6d 6f 76 61 6c 20 6f 66 20 22 20 64 69 72 removal of " dir
6280: 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 20 66 6f 72 -to-remove " for
6290: 20 6e 6f 77 20 61 73 20 69 74 20 73 74 69 6c 6c now as it still
62a0: 20 68 61 73 20 72 65 66 65 72 65 6e 63 65 73 20 has references
62b0: 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 65 22 in the database"
62c0: 29 29 29 29 29 0a 09 20 20 20 20 28 73 6f 72 74 ))))).. (sort
62d0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 (hash-table-key
62e0: 73 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 s dirs-to-remove
62f0: 29 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 ) (lambda (a b)(
6300: 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 > (string-length
6310: 20 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 a)(string-lengt
6320: 68 20 62 29 29 29 29 29 0a 0a 09 20 20 20 3b 3b h b)))))... ;;
6330: 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 remove the run
6340: 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 if zero tests re
6350: 6d 61 69 6e 0a 09 20 20 20 28 6c 65 74 20 28 28 main.. (let ((
6360: 72 65 6d 74 65 73 74 73 20 28 72 64 62 3a 67 65 remtests (rdb:ge
6370: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
6380: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 db (db:get-value
6390: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
63a0: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 23 eader "id") #f #
63b0: 66 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 20 f '() '())))..
63c0: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 (if (null? re
63d0: 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f mtests) ;; no mo
63e0: 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 re tests remaini
63f0: 6e 67 0a 09 09 20 28 6c 65 74 2a 20 28 28 64 70 ng... (let* ((dp
6400: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 arts (string-sp
6410: 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f lit lasttpath "/
6420: 22 29 29 0a 09 09 09 28 72 75 6e 70 61 74 68 20 "))....(runpath
6430: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e (conc "/" (strin
6440: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 g-intersperse ..
6450: 09 09 09 09 20 20 20 20 28 74 61 6b 65 20 64 70 .... (take dp
6460: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 arts (- (length
6470: 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 dparts) 1)).....
6480: 09 20 20 20 20 22 2f 22 29 29 29 29 0a 09 09 20 . "/"))))...
6490: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
64a0: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 "Removing run:
64b0: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
64c0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
64d0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
64e0: 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 "runname"))...
64f0: 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 (db:delete-run
6500: 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 db run-id)...
6510: 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 ;; need to figur
6520: 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 e out the path t
6530: 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e o the run dir an
6540: 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 d remove it if e
6550: 6d 70 74 79 0a 09 09 20 20 20 3b 3b 20 20 20 20 mpty... ;;
6560: 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 (if (null? (glob
6570: 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 (conc runpath "
6580: 2f 2a 22 29 29 29 0a 09 09 20 20 20 3b 3b 20 20 /*")))... ;;
6590: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 (begin...
65a0: 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 ;; . (debug:pr
65b0: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
65c0: 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 run dir " runpat
65d0: 68 29 0a 09 09 20 20 20 3b 3b 20 09 20 28 73 79 h)... ;; . (sy
65e0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 stem (conc "rmdi
65f0: 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 r -p " runpath))
6600: 29 29 0a 09 09 20 20 20 29 29 29 29 0a 09 20 29 ))... )))).. )
6610: 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a ). runs)))..
6620: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
6630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6650: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6660: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 ========.;; Rout
6670: 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c ines for manipul
6680: 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d ating runs.;;===
6690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66d0: 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 ===..;; Since ma
66e0: 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 ny calls to a ru
66f0: 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 n require pretty
6700: 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 much the same s
6710: 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 etup .;; this wr
6720: 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f apper is used to
6730: 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c reduce the repl
6740: 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a ication of code.
6750: 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c (define (general
6760: 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 -run-call switch
6770: 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 name action-desc
6780: 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 proc). (let ((
6790: 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 runname (args:ge
67a0: 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 t-arg ":runname"
67b0: 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 ))..(target (if
67c0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
67d0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
67e0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
67f0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
6800: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6810: 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 -reqtarg")))..(t
6820: 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 h1 #f)).
6830: 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 (cond. ((not
6840: 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 target). (
6850: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
6860: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 RROR: Missing re
6870: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 quired parameter
6880: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d for " switchnam
6890: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 e ", you must sp
68a0: 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74 ecify the target
68b0: 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a with -target").
68c0: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a (exit 3)).
68d0: 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 ((not runna
68e0: 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 me). (debug
68f0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
6900: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 Missing require
6910: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 d parameter for
6920: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 " switchname ",
6930: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 you must specify
6940: 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 the run name wi
6950: 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e th :runname runn
6960: 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 ame"). (exi
6970: 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 t 3)). (else
6980: 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 . (let ((db
6990: 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 #f).. (key
69a0: 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 s #f))..(if (not
69b0: 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 (setup-for-run)
69c0: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 ).. (begin ..
69d0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
69e0: 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 nt 0 "Failed to
69f0: 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 setup, exiting")
6a00: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
6a10: 29 29 0a 09 28 73 65 74 21 20 64 62 20 20 20 28 ))..(set! db (
6a20: 6f 70 65 6e 2d 64 62 29 29 0a 09 28 69 66 20 28 open-db))..(if (
6a30: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 args:get-arg "-s
6a40: 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 73 65 erver").. (se
6a50: 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 rver:start db (a
6a60: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 rgs:get-arg "-se
6a70: 72 76 65 72 22 29 29 0a 09 20 20 20 20 28 69 66 rver")).. (if
6a80: 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a (not (or (args:
6a90: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c get-arg "-runall
6aa0: 22 29 0a 09 09 09 20 20 28 61 72 67 73 3a 67 65 ").... (args:ge
6ab0: 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 t-arg "-runtests
6ac0: 22 29 29 29 0a 09 09 28 73 65 74 21 20 74 68 31 ")))...(set! th1
6ad0: 20 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 2d (server:client-
6ae0: 73 65 74 75 70 20 64 62 29 29 29 29 0a 09 28 73 setup db))))..(s
6af0: 65 74 21 20 6b 65 79 73 20 28 72 64 62 3a 67 65 et! keys (rdb:ge
6b00: 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 t-keys db))..;;
6b10: 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 have enough to p
6b20: 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f rocess -target o
6b30: 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a r -reqtarg here.
6b40: 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 .(if (args:get-a
6b50: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 rg "-reqtarg")..
6b60: 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 (let* ((runc
6b70: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 onfigf (conc *t
6b80: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e oppath* "/runcon
6b90: 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b figs.config")) ;
6ba0: 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 ; DO NOT EVALUAT
6bb0: 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e E ALL ... (run
6bc0: 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f config (read-co
6bd0: 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 nfig runconfigf
6be0: 23 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 #f #f environ-pa
6bf0: 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 tt: #f))) ..
6c00: 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c (if (hash-tabl
6c10: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 e-ref/default ru
6c20: 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 nconfig (args:ge
6c30: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
6c40: 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a ) #f)... (keys:
6c50: 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 target-set-args
6c60: 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 keys (args:get-a
6c70: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 rg "-reqtarg") a
6c80: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 rgs:arg-hash)...
6c90: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 (begin... (
6ca0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
6cb0: 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 RROR: [" (args:g
6cc0: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 et-arg "-reqtarg
6cd0: 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 ") "] not found
6ce0: 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 in " runconfigf)
6cf0: 0a 09 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a ... (sqlite3:
6d00: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 finalize! db)...
6d10: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a (exit 1)))).
6d20: 09 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 . (if (args:g
6d30: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 et-arg "-target"
6d40: 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 )...(keys:target
6d50: 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 -set-args keys (
6d60: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 args:get-arg "-t
6d70: 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d arget" args:arg-
6d80: 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 hash) args:arg-h
6d90: 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 ash)))..(if (not
6da0: 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 (car *configinf
6db0: 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e o*)).. (begin
6dc0: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
6dd0: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 rint 0 "ERROR: A
6de0: 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 ttempted to " ac
6df0: 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 tion-desc " but
6e00: 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 run area config
6e10: 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 file not found")
6e20: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
6e30: 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 ).. ;; Extrac
6e40: 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 t out stuff need
6e50: 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 ed in most or ma
6e60: 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b ny calls.. ;;
6e70: 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 here then call
6e80: 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 proc.. (let*
6e90: 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 ((keynames (ma
6ea0: 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e p key:get-fieldn
6eb0: 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 ame keys))...
6ec0: 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 (keyvallst (key
6ed0: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 s->vallist keys
6ee0: 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 #t))).. (pr
6ef0: 6f 63 20 64 62 20 74 61 72 67 65 74 20 72 75 6e oc db target run
6f00: 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d name keys keynam
6f10: 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a es keyvallst))).
6f20: 09 28 69 66 20 74 68 31 20 28 74 68 72 65 61 64 .(if th1 (thread
6f30: 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 73 -join! th1))..(s
6f40: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 qlite3:finalize!
6f50: 20 64 62 29 0a 09 28 73 65 74 21 20 2a 64 69 64 db)..(set! *did
6f60: 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 something* #t)))
6f70: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
6f80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6f90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6fa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6fb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
6fc0: 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d Rollup runs.;;=
6fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6fe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6ff0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7000: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7010: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 =====..;; Update
7020: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 the test_meta t
7030: 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 able for this te
7040: 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 st.(define (runs
7050: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
7060: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
7070: 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 est-conf). (let
7080: 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 64 ((currrecord (d
7090: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 b:testmeta-get-r
70a0: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 ecord db test-na
70b0: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e me))). (if (n
70c0: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 ot currrecord)..
70d0: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 (begin.. (set!
70e0: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 currrecord (make
70f0: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a -vector 10 #f)).
7100: 09 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d . (db:testmeta-
7110: 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 add-record db te
7120: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 st-name))). (
7130: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 for-each . (
7140: 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 lambda (key).
7150: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 (let* ((idx
7160: 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 (cadr key))..
7170: 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 (fld (car ke
7180: 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 y)).. (val
7190: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 (config-lookup t
71a0: 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d est-conf "test_m
71b0: 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b eta" fld))).. ;;
71c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 (debug:print 5
71d0: 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c "idx: " idx " fl
71e0: 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 d: " fld " val:
71f0: 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e " val).. (if (an
7200: 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 d val (not (equa
7210: 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 l? (vector-ref c
7220: 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 urrrecord idx) v
7230: 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 al))).. (beg
7240: 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e in.. (prin
7250: 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 t "Updating " te
7260: 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 st-name " " fld
7270: 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 " to " val)..
7280: 20 20 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 (db:testmeta
7290: 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 -update-field db
72a0: 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 test-name fld v
72b0: 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 al))))). '((
72c0: 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e "author" 2)("own
72d0: 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74 er" 3)("descript
72e0: 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 ion" 4)("reviewe
72f0: 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29 d" 5)("tags" 9))
7300: 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 )))..;; Update t
7310: 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c est_meta for all
7320: 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 tests.(define (
7330: 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d runs:update-all-
7340: 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 test_meta db).
7350: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 (let ((test-name
7360: 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c s (get-all-legal
7370: 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 -tests))). (f
7380: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
7390: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 ambda (test-name
73a0: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 ). (let* (
73b0: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 (test-path (c
73c0: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
73d0: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d tests/" test-nam
73e0: 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 e)).. (test
73f0: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 -configf (conc t
7400: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 est-path "/testc
7410: 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 onfig"))..
7420: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61 (testexists (a
7430: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f nd (file-exists?
7440: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 test-configf)(f
7450: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f ile-read-access?
7460: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 test-configf)))
7470: 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 .. ;; read
7480: 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 configs with tri
7490: 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 cks turned off (
74a0: 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a i.e. no system).
74b0: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e . (test-con
74c0: 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69 f (if testexi
74d0: 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 sts (read-config
74e0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 test-configf #f
74f0: 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 #f)(make-hash-t
7500: 61 62 6c 65 29 29 29 29 0a 09 20 28 72 75 6e 73 able)))).. (runs
7510: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
7520: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
7530: 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 est-conf))).
7540: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a test-names)))..
7550: 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72 ;; This could pr
7560: 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 63 74 obably be refact
7570: 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f ored into one co
7580: 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a mplex query ....
7590: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f (define (runs:ro
75a0: 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 79 73 llup-run db keys
75b0: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 keyvallst runna
75c0: 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20 me user) ;; was
75d0: 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 target, now keyv
75e0: 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70 allst. (debug:p
75f0: 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c rint 4 "runs:rol
7600: 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 lup-run, keys: "
7610: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 keys " keyvalls
7620: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 t: " keyvallst "
7630: 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e :runname " runn
7640: 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73 ame " user: " us
7650: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 3b 20 28 er). (let* (; (
7660: 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 keyvalllst
7670: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 (keys:target->ke
7680: 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 yval keys target
7690: 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 )).. (new-run-id
76a0: 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69 (runs:regi
76b0: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
76c0: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 keyvallst runna
76d0: 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 me "new" "n/a" u
76e0: 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 ser)).. (prev-te
76f0: 73 74 73 20 20 20 20 20 20 28 74 65 73 74 3a 67 sts (test:g
7700: 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 et-matching-prev
7710: 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 ious-test-run-re
7720: 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e cords db new-run
7730: 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 -id "%" "%"))..
7740: 28 63 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 (curr-tests
7750: 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d (rdb:get-tests-
7760: 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 for-run db new-r
7770: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 27 28 un-id "%" "%" '(
7780: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d ) '())).. (curr-
7790: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 tests-hash (make
77a0: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 -hash-table))).
77b0: 20 20 20 28 64 62 3a 75 70 64 61 74 65 2d 72 75 (db:update-ru
77c0: 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 n-event_time db
77d0: 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 new-run-id).
77e0: 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 ;; index the alr
77f0: 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 eady saved tests
7800: 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 by testname and
7810: 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 itemdat in curr
7820: 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 -tests-hash.
7830: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 (for-each. (
7840: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 lambda (testdat)
7850: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 . (let* ((
7860: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 testname (db:te
7870: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
7880: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 testdat))..
7890: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a (item-path (db:
78a0: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
78b0: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 th testdat))..
78c0: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 (full-name (
78d0: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f conc testname "/
78e0: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 " item-path)))..
78f0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
7900: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 ! curr-tests-has
7910: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 h full-name test
7920: 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 dat))). curr
7930: 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e -tests). ;; N
7940: 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c OPE: Non-optimal
7950: 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 approach. Try t
7960: 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 his instead..
7970: 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 ;; 1. tests a
7980: 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 re received in a
7990: 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 list, most rece
79a0: 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 nt first. ;;
79b0: 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 2. replace the
79c0: 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 rollup test wit
79d0: 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 h the new *alway
79e0: 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 s*. (for-each
79f0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
7a00: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 testdat).
7a10: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 (let* ((testname
7a20: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 (db:test-get-t
7a30: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 estname testdat)
7a40: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 ).. (item-p
7a50: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ath (db:test-get
7a60: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 -item-path testd
7a70: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c at)).. (ful
7a80: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 l-name (conc tes
7a90: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 tname "/" item-p
7aa0: 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 ath)).. (pr
7ab0: 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 ev-test-dat (has
7ac0: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
7ad0: 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 ult curr-tests-h
7ae0: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 ash full-name #f
7af0: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d )).. (test-
7b00: 73 74 65 70 73 20 20 20 20 20 20 28 64 62 3a 67 steps (db:g
7b10: 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 et-steps-for-tes
7b20: 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 t db (db:test-ge
7b30: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a t-id testdat))).
7b40: 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 . (new-test
7b50: 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b -record #f)).. ;
7b60: 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 ; replace these
7b70: 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 with insert ...
7b80: 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 select.. (apply
7b90: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
7ba0: 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 ...db ...(conc "
7bb0: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 INSERT OR REPLAC
7bc0: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 E INTO tests (ru
7bd0: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 n_id,testname,st
7be0: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 ate,status,event
7bf0: 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f _time,host,cpulo
7c00: 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d ad,diskfree,unam
7c10: 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 e,rundir,item_pa
7c20: 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c th,run_duration,
7c30: 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 final_logf,comme
7c40: 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 nt) "... "V
7c50: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f ALUES (?,?,?,?,?
7c60: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
7c70: 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e ,?);")...new-run
7c80: 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 74 6f -id (cddr (vecto
7c90: 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 r->list testdat)
7ca0: 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 )).. (set! new-t
7cb0: 65 73 74 64 61 74 20 28 63 61 72 20 28 72 64 62 estdat (car (rdb
7cc0: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
7cd0: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
7ce0: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70 testname item-p
7cf0: 61 74 68 20 27 28 29 20 27 28 29 29 29 29 0a 09 ath '() '())))..
7d00: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
7d10: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 ! curr-tests-has
7d20: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d h full-name new-
7d30: 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 testdat) ;; this
7d40: 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 could be confus
7d50: 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 ing, which recor
7d60: 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f d should go into
7d70: 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c the lookup tabl
7d80: 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c e?.. ;; Now dupl
7d90: 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73 icate the test s
7da0: 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 teps.. (debug:pr
7db0: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 int 4 "Copying r
7dc0: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 ecords in test_s
7dd0: 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 teps from test_i
7de0: 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 d=" (db:test-get
7df0: 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 -id testdat) " t
7e00: 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 o " (db:test-get
7e10: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
7e20: 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65 ).. (sqlite3:exe
7e30: 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20 cute .. db ..
7e40: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
7e50: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
7e60: 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 st_steps (test_i
7e70: 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 d,stepname,state
7e80: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
7e90: 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 me,comment) "...
7ea0: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 "SELECT " (db:te
7eb0: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
7ec0: 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d stdat) ",stepnam
7ed0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 e,state,status,e
7ee0: 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e vent_time,commen
7ef0: 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 t FROM test_step
7f00: 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d s WHERE test_id=
7f10: 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74 ?;").. (db:test
7f20: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 -get-id testdat)
7f30: 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 ).. ;; Now dupli
7f40: 63 61 74 65 20 74 68 65 20 74 65 73 74 20 64 61 cate the test da
7f50: 74 61 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e ta.. (debug:prin
7f60: 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 t 4 "Copying rec
7f70: 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 ords in test_dat
7f80: 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 a from test_id="
7f90: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
7fa0: 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 testdat) " to "
7fb0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
7fc0: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 new-testdat))..
7fd0: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
7fe0: 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f e .. db .. (co
7ff0: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 nc "INSERT OR RE
8000: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f PLACE INTO test_
8010: 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 data (test_id,ca
8020: 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c tegory,variable,
8030: 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 value,expected,t
8040: 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 ol,units,comment
8050: 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 ) "..."SELECT "
8060: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
8070: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 63 new-testdat) ",c
8080: 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 ategory,variable
8090: 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c ,value,expected,
80a0: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e tol,units,commen
80b0: 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 t FROM test_data
80c0: 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f WHERE test_id=?
80d0: 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74 2d ;").. (db:test-
80e0: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
80f0: 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d .. )). prev-
8100: 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 tests))).. .
8110: 20 0a .