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 69 66 20 2a 72 70 63 3a s). (if *rpc:
2c70: 6c 69 73 74 65 6e 65 72 2a 20 28 73 65 72 76 65 listener* (serve
2c80: 72 3a 6b 65 65 70 2d 72 75 6e 6e 69 6e 67 20 64 r:keep-running d
2c90: 62 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 b)). (debug:p
2ca0: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c rint 4 "INFO: Al
2cb0: 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 l done by here")
2cc0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e ))..(define (run
2cd0: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 s:run-tests-queu
2ce0: 65 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e e db run-id runn
2cf0: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 ame test-records
2d00: 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 keyvallst flags
2d10: 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 73 ). ;; At this
2d20: 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 20 point the list
2d30: 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 20 of parent tests
2d40: 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 20 is expanded .
2d50: 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 20 ;; NB// Should
2d60: 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 72 expand items her
2d70: 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 72 e and then inser
2d80: 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 71 t into the run q
2d90: 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a 70 ueue.. (debug:p
2da0: 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65 63 rint 5 "test-rec
2db0: 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65 63 ords: " test-rec
2dc0: 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c 73 ords ", keyvalls
2dd0: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 29 0a t: " keyvallst).
2de0: 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d (let ((sorted-
2df0: 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 test-names (test
2e00: 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 s:sort-by-priori
2e10: 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 ty-and-waiton te
2e20: 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 69 st-records))..(i
2e30: 74 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 tem-patts
2e40: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
2e50: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 /default flags "
2e60: 2d 69 74 65 6d 70 61 74 74 22 20 23 66 29 29 29 -itempatt" #f)))
2e70: 0a 20 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 . (let loop (
2e80: 3b 20 28 6e 75 6d 74 69 6d 65 73 20 30 29 20 3b ; (numtimes 0) ;
2e90: 3b 20 73 68 6f 75 6c 64 6e 27 74 20 6e 65 65 64 ; shouldn't need
2ea0: 20 74 68 69 73 0a 09 20 20 20 20 20 20 20 28 68 this.. (h
2eb0: 65 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 ed (car
2ec0: 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 sorted-test-name
2ed0: 73 29 29 0a 09 20 20 20 20 20 20 20 28 74 61 6c s)).. (tal
2ee0: 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73 6f (cdr so
2ef0: 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 rted-test-names)
2f00: 29 29 0a 20 20 20 20 20 20 28 6c 65 74 2a 20 28 )). (let* (
2f10: 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 61 (test-record (ha
2f20: 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 73 sh-table-ref tes
2f30: 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 0a t-records hed)).
2f40: 09 20 20 20 20 20 28 74 63 6f 6e 66 69 67 20 20 . (tconfig
2f50: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
2f60: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 eue-get-testconf
2f70: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 ig test-record))
2f80: 0a 09 20 20 20 20 20 28 77 61 69 74 6f 6e 73 20 .. (waitons
2f90: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
2fa0: 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 ueue-get-waitons
2fb0: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 test-record)
2fc0: 29 0a 09 20 20 20 20 20 28 70 72 69 6f 72 69 74 ).. (priorit
2fd0: 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 y (tests:test
2fe0: 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 queue-get-priori
2ff0: 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 ty test-record
3000: 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 64 61 )).. (itemda
3010: 74 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 t (tests:tes
3020: 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 tqueue-get-itemd
3030: 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 at test-recor
3040: 64 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d 73 d)).. (items
3050: 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 (tests:te
3060: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d stqueue-get-item
3070: 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f s test-reco
3080: 72 64 29 29 0a 09 20 20 20 20 20 28 69 74 65 6d rd)).. (item
3090: 2d 70 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 -path (item-li
30a0: 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 st->path itemdat
30b0: 29 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e )))..(debug:prin
30c0: 74 20 36 0a 09 09 20 20 20 20 20 22 69 74 65 6d t 6... "item
30d0: 64 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 dat: " itemd
30e0: 61 74 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 at... "\n i
30f0: 74 65 6d 73 3a 20 20 20 20 20 22 20 69 74 65 6d tems: " item
3100: 73 0a 09 09 20 20 20 20 20 22 5c 6e 20 20 69 74 s... "\n it
3110: 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 6d 2d em-path: " item-
3120: 70 61 74 68 29 0a 09 28 63 6f 6e 64 0a 09 20 28 path)..(cond.. (
3130: 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 (not items) ;; w
3140: 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 65 hen false the te
3150: 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 st is ok to be h
3160: 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 anded off to lau
3170: 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 66 nch (but not bef
3180: 6f 72 65 29 0a 09 20 20 28 6c 65 74 20 28 28 68 ore).. (let ((h
3190: 61 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 28 ave-resources (
31a0: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
31b0: 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d e-tests db test-
31c0: 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b record)) ;; look
31d0: 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 at the test job
31e0: 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f group and tot jo
31f0: 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 28 70 72 bs running...(pr
3200: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 ereqs-not-met (d
3210: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f b:get-prereqs-no
3220: 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 t-met db run-id
3230: 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 waitons item-pat
3240: 68 29 29 29 0a 09 20 20 20 20 3b 3b 20 44 6f 6e h))).. ;; Don
3250: 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 73 20 't know at this
3260: 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 73 74 time if the test
3270: 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 6e 63 have been launc
3280: 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 6d 65 hed at some time
3290: 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 20 20 in the past..
32a0: 20 20 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 ;; i.e. is thi
32b0: 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 s a re-launch?..
32c0: 20 20 20 20 28 69 66 20 28 61 6e 64 20 68 61 76 (if (and hav
32d0: 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 20 20 e-resources...
32e0: 20 20 20 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 (null? prereq
32f0: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 3b 3b s-not-met))...;;
3300: 20 6e 6f 20 6c 6f 6f 70 20 2d 20 64 72 6f 70 20 no loop - drop
3310: 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 74 though and use t
3320: 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 62 he loop at the b
3330: 6f 74 74 6f 6d 20 0a 09 09 28 72 75 6e 3a 74 65 ottom ...(run:te
3340: 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 75 6e st db run-id run
3350: 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 name keyvallst t
3360: 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 est-record flags
3370: 20 23 66 29 0a 09 09 3b 3b 20 65 6c 73 65 20 74 #f)...;; else t
3380: 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c he run is stuck,
3390: 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 temporarily or
33a0: 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 28 6c permanently...(l
33b0: 65 74 20 28 28 6e 65 77 74 61 6c 20 28 61 70 70 et ((newtal (app
33c0: 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 68 65 end tal (list he
33d0: 64 29 29 29 29 0a 09 09 20 20 3b 3b 20 63 6f 75 d))))... ;; cou
33e0: 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 20 ldn't run, take
33f0: 61 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 28 a breather... (
3400: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 34 29 thread-sleep! 4)
3410: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 ... (loop (car
3420: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 newtal)(cdr newt
3430: 61 6c 29 29 29 29 29 29 0a 09 20 0a 09 20 3b 3b al)))))).. .. ;;
3440: 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 case where an i
3450: 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 tems came in as
3460: 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 a list been proc
3470: 65 73 73 65 64 0a 09 20 28 28 61 6e 64 20 28 6c essed.. ((and (l
3480: 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 20 ist? items)
3490: 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 20 ;; thus we know
34a0: 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 6c our items are al
34b0: 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 64 ready calculated
34c0: 0a 09 20 20 20 20 20 20 20 28 6e 6f 74 20 20 20 .. (not
34d0: 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 itemdat)) ;; and
34e0: 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 not yet expande
34f0: 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 d into the list
3500: 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 of things to be
3510: 64 6f 6e 65 0a 09 20 20 28 69 66 20 28 3e 3d 20 done.. (if (>=
3520: 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 28 70 *verbosity* 1)(p
3530: 70 20 69 74 65 6d 73 29 29 0a 09 20 20 3b 3b 20 p items)).. ;;
3540: 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 (if (>= *verbosi
3550: 74 79 2a 20 35 29 0a 09 20 20 3b 3b 20 20 20 20 ty* 5).. ;;
3560: 20 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 20 20 (begin.. ;;
3570: 20 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d (print "item
3580: 73 3a 20 22 29 20 20 20 20 20 28 70 70 20 28 69 s: ") (pp (i
3590: 74 65 6d 2d 61 73 73 6f 63 2d 3e 69 74 65 6d 2d tem-assoc->item-
35a0: 6c 69 73 74 20 69 74 65 6d 73 29 29 0a 09 20 20 list items))..
35b0: 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 ;; (print
35c0: 22 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 "itemstable: ")(
35d0: 70 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e pp (item-table->
35e0: 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 item-list itemst
35f0: 61 62 6c 65 29 29 29 29 0a 09 20 20 28 66 6f 72 able)))).. (for
3600: 2d 65 61 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 -each.. (lambd
3610: 61 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 a (my-itemdat)..
3620: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 (let* ((new
3630: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c 65 -test-record (le
3640: 74 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b 65 t ((newrec (make
3650: 2d 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 -tests:testqueue
3660: 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 )))..... (
3670: 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 73 vector-copy! tes
3680: 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 29 t-record newrec)
3690: 0a 09 09 09 09 20 20 20 20 20 20 20 6e 65 77 72 ..... newr
36a0: 65 63 29 29 0a 09 09 20 20 20 20 28 6d 79 2d 69 ec))... (my-i
36b0: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c tem-path (item-l
36c0: 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 ist->path my-ite
36d0: 6d 64 61 74 29 29 0a 09 09 20 20 20 20 28 69 74 mdat))... (it
36e0: 65 6d 2d 6d 61 74 63 68 65 73 20 28 69 66 20 69 em-matches (if i
36f0: 74 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 tem-patts
3700: 3b 3b 20 68 65 72 65 20 77 65 20 61 72 65 20 66 ;; here we are f
3710: 69 6c 74 65 72 69 6e 67 20 66 6f 72 20 6d 61 74 iltering for mat
3720: 63 68 65 73 20 77 69 74 68 20 2d 69 74 65 6d 70 ches with -itemp
3730: 61 74 74 0a 09 09 09 09 20 20 20 20 20 20 28 6c att..... (l
3740: 65 74 20 28 28 72 65 73 20 23 66 29 29 09 20 3b et ((res #f)). ;
3750: 3b 20 6c 6f 6f 6b 20 74 68 72 6f 75 67 68 20 61 ; look through a
3760: 6c 6c 20 74 68 65 20 69 74 65 6d 2d 70 61 74 74 ll the item-patt
3770: 73 20 69 66 20 64 65 66 69 6e 65 64 2c 20 66 6f s if defined, fo
3780: 72 6d 61 74 20 69 73 20 70 61 74 74 31 2c 70 61 rmat is patt1,pa
3790: 74 74 32 2c 70 61 74 74 33 20 2e 2e 2e 20 77 69 tt2,patt3 ... wi
37a0: 6c 64 63 61 72 64 20 69 73 20 25 0a 09 09 09 09 ldcard is %.....
37b0: 09 28 66 6f 72 2d 65 61 63 68 20 0a 09 09 09 09 .(for-each .....
37c0: 09 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 . (lambda (patt)
37d0: 0a 09 09 09 09 09 20 20 20 28 69 66 20 28 73 74 ...... (if (st
37e0: 72 69 6e 67 2d 73 65 61 72 63 68 20 28 67 6c 6f ring-search (glo
37f0: 62 2d 3e 72 65 67 65 78 70 0a 09 09 09 09 09 09 b->regexp.......
3800: 09 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d . (string-
3810: 74 72 61 6e 73 6c 61 74 65 20 70 61 74 74 20 22 translate patt "
3820: 25 22 20 22 2a 22 29 29 0a 09 09 09 09 09 09 09 %" "*"))........
3830: 20 20 20 20 20 20 69 74 65 6d 2d 70 61 74 68 29 item-path)
3840: 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 73 65 ...... (se
3850: 74 21 20 72 65 73 20 23 74 29 29 29 0a 09 09 09 t! res #t)))....
3860: 09 09 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 .. (string-split
3870: 20 69 74 65 6d 2d 70 61 74 74 73 20 22 2c 22 29 item-patts ",")
3880: 29 0a 09 09 09 09 09 72 65 73 29 0a 09 09 09 09 )......res).....
3890: 20 20 20 20 20 20 23 74 29 29 29 0a 09 20 20 20 #t)))..
38a0: 20 20 20 20 28 69 66 20 69 74 65 6d 2d 6d 61 74 (if item-mat
38b0: 63 68 65 73 20 3b 3b 20 79 65 73 2c 20 77 65 20 ches ;; yes, we
38c0: 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 20 want to process
38d0: 74 68 69 73 20 69 74 65 6d 0a 09 09 20 20 20 28 this item... (
38e0: 6c 65 74 20 28 28 6e 65 77 74 65 73 74 6e 61 6d let ((newtestnam
38f0: 65 20 28 63 6f 6e 63 20 68 65 64 20 22 2f 22 20 e (conc hed "/"
3900: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 29 20 my-item-path)))
3910: 0a 09 09 20 20 20 20 20 28 74 65 73 74 73 3a 74 ... (tests:t
3920: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 estqueue-set-ite
3930: 6d 73 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 ms! new-test-r
3940: 65 63 6f 72 64 20 23 66 29 0a 09 09 20 20 20 20 ecord #f)...
3950: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
3960: 65 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 6e e-set-itemdat! n
3970: 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 6d ew-test-record m
3980: 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 20 20 y-itemdat)...
3990: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 (hash-table-se
39a0: 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 t! test-records
39b0: 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d newtestname new-
39c0: 74 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 20 test-record)...
39d0: 20 20 20 20 28 73 65 74 21 20 74 61 6c 20 28 63 (set! tal (c
39e0: 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 ons newtestname
39f0: 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 69 6e tal)))))) ;; sin
3a00: 63 65 20 74 68 65 73 65 20 61 72 65 20 69 74 65 ce these are ite
3a10: 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e 65 77 mized create new
3a20: 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 73 74 test names test
3a30: 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 name/itempath..
3a40: 20 20 69 74 65 6d 73 29 0a 09 20 20 28 6c 6f 6f items).. (loo
3a50: 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 p (car tal)(cdr
3a60: 74 61 6c 29 29 29 0a 0a 09 20 3b 3b 20 69 66 20 tal)))... ;; if
3a70: 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 20 items is a proc
3a80: 74 68 65 6e 20 6e 65 65 64 20 74 6f 20 72 75 6e then need to run
3a90: 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 items:get-items
3aa0: 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 -from-config, ge
3ab0: 74 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 6c t the list and l
3ac0: 6f 6f 70 20 0a 09 20 3b 3b 20 20 20 20 2d 20 62 oop .. ;; - b
3ad0: 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 ut only do that
3ae0: 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 if resources exi
3af0: 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 st to kick off t
3b00: 68 65 20 6a 6f 62 0a 09 20 28 28 6f 72 20 28 70 he job.. ((or (p
3b10: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 rocedure? items)
3b20: 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 (eq? items 'have
3b30: 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 -procedure))..
3b40: 28 69 66 20 28 61 6e 64 20 28 72 75 6e 73 3a 63 (if (and (runs:c
3b50: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
3b60: 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 s db test-record
3b70: 29 0a 09 09 20 20 20 28 6e 75 6c 6c 3f 20 28 64 )... (null? (d
3b80: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f b:get-prereqs-no
3b90: 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 t-met db run-id
3ba0: 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 waitons item-pat
3bb0: 68 29 29 29 0a 09 20 20 20 20 20 20 28 6c 65 74 h))).. (let
3bc0: 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 ((test-name (te
3bd0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3be0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d t-testname test-
3bf0: 72 65 63 6f 72 64 29 29 29 0a 09 09 28 73 65 74 record)))...(set
3c00: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d env "MT_TEST_NAM
3c10: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b E" test-name) ;;
3c20: 20 0a 09 09 28 73 65 74 65 6e 76 20 22 4d 54 5f ...(setenv "MT_
3c30: 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 RUNNAME" runna
3c40: 6d 65 29 0a 09 09 28 73 65 74 2d 6d 65 67 61 74 me)...(set-megat
3c50: 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 est-env-vars db
3c60: 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 run-id) ;; these
3c70: 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 may be needed b
3c80: 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 y the launching
3c90: 70 72 6f 63 65 73 73 0a 09 09 28 6c 65 74 20 28 process...(let (
3ca0: 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 65 (items-list (ite
3cb0: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
3cc0: 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 67 m-config tconfig
3cd0: 29 29 29 0a 09 09 20 20 28 69 66 20 28 6c 69 73 )))... (if (lis
3ce0: 74 3f 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 t? items-list)..
3cf0: 09 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 . (begin...
3d00: 09 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 .(tests:testqueu
3d10: 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 74 65 73 e-set-items! tes
3d20: 74 2d 72 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c t-record items-l
3d30: 69 73 74 29 0a 09 09 09 28 6c 6f 6f 70 20 68 65 ist)....(loop he
3d40: 64 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 d tal))...
3d50: 28 62 65 67 69 6e 0a 09 09 09 28 64 65 62 75 67 (begin....(debug
3d60: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
3d70: 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 The proc from r
3d80: 65 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 eading the setup
3d90: 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 did not yield a
3da0: 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 list - please r
3db0: 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 eport this")....
3dc0: 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20 (exit 1)))))..
3dd0: 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 74 61 (let ((newta
3de0: 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 6c l (append tal (l
3df0: 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 3b 3b ist hed))))...;;
3e00: 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d 6f if can't run mo
3e10: 72 65 20 74 65 73 74 73 2c 20 6c 65 74 73 20 74 re tests, lets t
3e20: 61 6b 65 20 61 20 62 72 65 61 74 68 65 72 0a 09 ake a breather..
3e30: 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 .(thread-sleep!
3e40: 31 29 0a 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 1)...(loop (car
3e50: 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 newtal)(cdr newt
3e60: 61 6c 29 29 29 29 29 0a 0a 09 20 3b 3b 20 74 68 al)))))... ;; th
3e70: 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 6e is case should n
3e80: 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 64 ot happen, added
3e90: 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 61 to help catch a
3ea0: 6e 79 20 62 75 67 73 0a 09 20 28 28 61 6e 64 20 ny bugs.. ((and
3eb0: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 (list? items) it
3ec0: 65 6d 64 61 74 29 0a 09 20 20 28 64 65 62 75 67 emdat).. (debug
3ed0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
3ee0: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 Should not have
3ef0: 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 a list of items
3f00: 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 in a test and t
3f10: 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 he itemspath set
3f20: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 - please report
3f30: 20 74 68 69 73 22 29 0a 09 20 20 28 65 78 69 74 this").. (exit
3f40: 20 31 29 29 29 29 0a 09 0a 20 20 20 20 20 20 3b 1))))... ;
3f50: 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e ; we get here on
3f60: 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 "drop through"
3f70: 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 - loop for next
3f80: 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 test in queue.
3f90: 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 (if (null? t
3fa0: 61 6c 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 20 al).. (begin..
3fb0: 20 20 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 ;; FIXME!!!!
3fc0: 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 THIS SHOULD NOT
3fd0: 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 REQUIRE AN EXIT!
3fe0: 21 21 21 21 21 21 0a 09 20 20 20 20 28 64 65 62 !!!!!!.. (deb
3ff0: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f ug:print 1 "INFO
4000: 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e : All tests laun
4010: 63 68 65 64 22 29 0a 09 20 20 20 20 3b 3b 20 28 ched").. ;; (
4020: 65 78 69 74 20 30 29 0a 09 20 20 20 20 29 0a 09 exit 0).. )..
4030: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c (loop (car tal
4040: 29 28 63 64 72 20 74 61 6c 29 29 29 29 29 29 0a )(cdr tal)))))).
4050: 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 74 20 .;; parent-test
4060: 69 73 20 74 68 65 72 65 20 61 73 20 61 20 70 6c is there as a pl
4070: 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 aceholder for wh
4080: 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 73 20 en parent-tests
4090: 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 61 20 can be run as a
40a0: 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 66 69 setup step.(defi
40b0: 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 64 62 20 ne (run:test db
40c0: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b run-id runname k
40d0: 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 eyvallst test-re
40e0: 63 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e cord flags paren
40f0: 74 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c t-test). ;; All
4100: 20 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 these vars migh
4110: 74 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 t be referenced
4120: 62 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 by the testconfi
4130: 67 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 g file reader.
4140: 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d (let* ((test-nam
4150: 65 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 e (tests:test
4160: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 queue-get-testna
4170: 6d 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 me test-record
4180: 29 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f )).. (test-waito
4190: 6e 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 ns (tests:testqu
41a0: 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 eue-get-waitons
41b0: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
41c0: 0a 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 .. (test-conf
41d0: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
41e0: 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 e-get-testconfig
41f0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
4200: 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 (itemdat (
4210: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
4220: 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 get-itemdat t
4230: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 est-record)).. (
4240: 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f test-path (co
4250: 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 nc *toppath* "/t
4260: 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 ests/" test-name
4270: 29 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 )) ;; could use
4280: 74 65 73 74 3a 67 65 74 2d 74 65 73 74 63 6f 6e test:get-testcon
4290: 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 fig here ..... (
42a0: 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61 force (ha
42b0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
42c0: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 ault flags "-for
42d0: 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 ce" #f)).. (reru
42e0: 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 n (hash-t
42f0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
4300: 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 flags "-rerun"
4310: 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e #f)).. (keepgoin
4320: 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 g (hash-table
4330: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 -ref/default fla
4340: 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 gs "-keepgoing"
4350: 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 #f)).. (item-pat
4360: 68 20 20 20 20 20 22 22 29 29 0a 20 20 20 20 28 h "")). (
4370: 64 65 62 75 67 3a 70 72 69 6e 74 20 35 0a 09 09 debug:print 5...
4380: 20 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 "test-config: "
4390: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c (hash-table->al
43a0: 69 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 ist test-conf)..
43b0: 09 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a . "\n itemdat:
43c0: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a " itemdat... ).
43d0: 20 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 ;; setting i
43e0: 74 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 temdat to a list
43f0: 20 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 if it is #f.
4400: 20 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 (if (not itemda
4410: 74 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 t)(set! itemdat
4420: 27 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 '())). (set!
4430: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d item-path (item-
4440: 6c 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 list->path itemd
4450: 61 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a at)). (debug:
4460: 70 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 print 2 "Attempt
4470: 69 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 ing to launch te
4480: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
4490: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 20 20 /" item-path).
44a0: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 (setenv "MT_TE
44b0: 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 ST_NAME" test-na
44c0: 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 me) ;; . (set
44d0: 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 env "MT_RUNNAME"
44e0: 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 runname).
44f0: 28 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e (set-megatest-en
4500: 76 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 v-vars db run-id
4510: 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 ) ;; these may b
4520: 65 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 e needed by the
4530: 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 launching proces
4540: 73 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 s. (change-di
4550: 72 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 rectory *toppath
4560: 2a 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 *).. ;; Here
4570: 69 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73 is where the tes
4580: 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 t_meta table is
4590: 62 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 best updated.
45a0: 20 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 ;; Yes, another
45b0: 20 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c use of a global
45c0: 20 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 for caching. Ne
45d0: 65 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f ed a better way?
45e0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 . (if (not (h
45f0: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
4600: 66 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 fault *test-meta
4610: 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e -updated* test-n
4620: 61 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 ame #f)).
4630: 20 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 (begin.. (has
4640: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 h-table-set! *te
4650: 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a st-meta-updated*
4660: 20 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 test-name #t).
4670: 20 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a (runs:
4680: 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 update-test_meta
4690: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 db test-name te
46a0: 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a st-conf))). .
46b0: 20 20 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 ;; (lambda (
46c0: 69 74 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 itemdat) ;;; ((r
46d0: 69 70 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 ipeness "overrip
46e0: 65 22 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 e") (temperature
46f0: 20 22 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e "cool") (season
4700: 20 22 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 "summer")).
4710: 28 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 (let* ((new-test
4720: 2d 70 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e -path (string-in
4730: 74 65 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 tersperse (cons
4740: 74 65 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 test-path (map c
4750: 61 64 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f adr itemdat)) "/
4760: 22 29 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 ")).. (new-tes
4770: 74 2d 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 t-name (if (equa
4780: 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 l? item-path "")
4790: 20 74 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 test-name (conc
47a0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 test-name "/" i
47b0: 74 65 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a tem-path))) ;; j
47c0: 75 73 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 ust need it to b
47d0: 65 20 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 e unique.. (te
47e0: 73 74 64 61 74 20 20 20 20 20 20 20 28 64 62 3a stdat (db:
47f0: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 get-test-info db
4800: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
4810: 65 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 e item-path))..
4820: 20 20 28 74 65 73 74 2d 69 64 20 20 20 20 20 20 (test-id
4830: 20 23 66 29 29 0a 20 20 20 20 20 20 28 69 66 20 #f)). (if
4840: 28 6e 6f 74 20 74 65 73 74 64 61 74 29 0a 09 20 (not testdat)..
4850: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 3b 3b 20 (begin.. ;;
4860: 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20 ensure that the
4870: 70 61 74 68 20 65 78 69 73 74 73 20 62 65 66 6f path exists befo
4880: 72 65 20 72 65 67 69 73 74 65 72 69 6e 67 20 74 re registering t
4890: 68 65 20 74 65 73 74 0a 09 20 20 20 20 3b 3b 20 he test.. ;;
48a0: 4e 4f 50 45 3a 20 43 61 6e 6e 6f 74 21 20 44 6f NOPE: Cannot! Do
48b0: 6e 27 74 20 6b 6e 6f 77 20 79 65 74 20 77 68 69 n't know yet whi
48c0: 63 68 20 64 69 73 6b 20 61 72 65 61 20 77 69 6c ch disk area wil
48d0: 6c 20 62 65 20 61 73 73 69 67 6e 65 64 2e 2e 2e l be assigned...
48e0: 2e 0a 09 20 20 20 20 3b 3b 20 28 73 79 73 74 65 ... ;; (syste
48f0: 6d 20 28 63 6f 6e 63 20 22 6d 6b 64 69 72 20 2d m (conc "mkdir -
4900: 70 20 22 20 6e 65 77 2d 74 65 73 74 2d 70 61 74 p " new-test-pat
4910: 68 29 29 0a 09 20 20 20 20 28 72 74 65 73 74 73 h)).. (rtests
4920: 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 :register-test d
4930: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
4940: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 me item-path)..
4950: 20 20 20 28 73 65 74 21 20 74 65 73 74 64 61 74 (set! testdat
4960: 20 28 64 62 3a 67 65 74 2d 74 65 73 74 2d 69 6e (db:get-test-in
4970: 66 6f 20 64 62 20 72 75 6e 2d 69 64 20 74 65 73 fo db run-id tes
4980: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
4990: 29 29 29 29 0a 20 20 20 20 20 20 28 73 65 74 21 )))). (set!
49a0: 20 74 65 73 74 2d 69 64 20 28 64 62 3a 74 65 73 test-id (db:tes
49b0: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 t-get-id testdat
49c0: 29 29 0a 20 20 20 20 20 20 28 63 68 61 6e 67 65 )). (change
49d0: 2d 64 69 72 65 63 74 6f 72 79 20 74 65 73 74 2d -directory test-
49e0: 70 61 74 68 29 0a 20 20 20 20 20 20 28 63 61 73 path). (cas
49f0: 65 20 28 69 66 20 66 6f 72 63 65 20 3b 3b 20 28 e (if force ;; (
4a00: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 66 args:get-arg "-f
4a10: 6f 72 63 65 22 29 0a 09 09 27 4e 4f 54 5f 53 54 orce")...'NOT_ST
4a20: 41 52 54 45 44 0a 09 09 28 69 66 20 74 65 73 74 ARTED...(if test
4a30: 64 61 74 0a 09 09 20 20 20 20 28 73 74 72 69 6e dat... (strin
4a40: 67 2d 3e 73 79 6d 62 6f 6c 20 28 74 65 73 74 3a g->symbol (test:
4a50: 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 get-state testda
4a60: 74 29 29 0a 09 09 20 20 20 20 27 66 61 69 6c 65 t))... 'faile
4a70: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 29 0a 09 28 d-to-insert))..(
4a80: 28 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 (failed-to-inser
4a90: 74 29 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e t).. (debug:prin
4aa0: 74 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c t 0 "ERROR: Fail
4ab0: 65 64 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 ed to insert the
4ac0: 20 72 65 63 6f 72 64 20 69 6e 74 6f 20 74 68 65 record into the
4ad0: 20 64 62 22 29 29 0a 09 28 28 4e 4f 54 5f 53 54 db"))..((NOT_ST
4ae0: 41 52 54 45 44 20 43 4f 4d 50 4c 45 54 45 44 29 ARTED COMPLETED)
4af0: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
4b00: 36 20 22 47 6f 74 20 68 65 72 65 2c 20 22 20 28 6 "Got here, " (
4b10: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 test:get-state t
4b20: 65 73 74 64 61 74 29 29 0a 09 20 28 6c 65 74 20 estdat)).. (let
4b30: 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 ((runflag #f))..
4b40: 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b 3b (cond.. ;;
4b50: 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f 20 -force, run no
4b60: 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 20 matter what..
4b70: 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 75 (force (set! ru
4b80: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 nflag #t))..
4b90: 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c 20 ;; NOT_STARTED,
4ba0: 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 run no matter wh
4bb0: 61 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c 3f at.. ((equal?
4bc0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
4bd0: 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f 53 testdat) "NOT_S
4be0: 54 41 52 54 45 44 22 29 28 73 65 74 21 20 72 75 TARTED")(set! ru
4bf0: 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 nflag #t))..
4c00: 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 6e ;; not -rerun an
4c10: 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 20 d PASS, WARN or
4c20: 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 6e CHECK, do no run
4c30: 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 20 .. ((and (or
4c40: 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 (not rerun)...
4c50: 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a 09 keepgoing)..
4c60: 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 6f . ;; Require to
4c70: 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 6f force re-run fo
4c80: 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 2a r COMPLETED or *
4c90: 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 53 anything* + PASS
4ca0: 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a 09 ,WARN or CHECK..
4cb0: 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 28 . (or (member (
4cc0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
4cd0: 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53 53 testdat) '("PASS
4ce0: 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 " "WARN" "CHECK"
4cf0: 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d 62 ))... (memb
4d00: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
4d10: 74 65 20 20 74 65 73 74 64 61 74 29 20 27 28 22 te testdat) '("
4d20: 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 0a COMPLETED")))) .
4d30: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
4d40: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e 6e nt 2 "INFO: runn
4d50: 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 2d ing test " test-
4d60: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
4d70: 74 68 20 22 20 73 75 70 70 72 65 73 73 65 64 20 th " suppressed
4d80: 61 73 20 69 74 20 69 73 20 43 4f 4d 50 4c 45 54 as it is COMPLET
4d90: 45 44 20 61 6e 64 20 22 20 28 74 65 73 74 3a 67 ED and " (test:g
4da0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
4db0: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 )).. (set! r
4dc0: 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 unflag #f))..
4dd0: 20 3b 3b 20 2d 72 65 72 75 6e 20 61 6e 64 20 73 ;; -rerun and s
4de0: 74 61 74 75 73 20 69 73 20 6f 6e 65 20 6f 66 20 tatus is one of
4df0: 74 68 65 20 73 70 65 63 69 66 65 64 2c 20 72 75 the specifed, ru
4e00: 6e 20 69 74 0a 09 20 20 20 20 28 28 61 6e 64 20 n it.. ((and
4e10: 72 65 72 75 6e 0a 09 09 20 20 28 6c 65 74 2a 20 rerun... (let*
4e20: 28 28 72 65 72 75 6e 6c 73 74 20 20 20 28 73 74 ((rerunlst (st
4e30: 72 69 6e 67 2d 73 70 6c 69 74 20 72 65 72 75 6e ring-split rerun
4e40: 20 22 2c 22 29 29 0a 09 09 09 20 28 6d 75 73 74 ",")).... (must
4e50: 2d 72 65 72 75 6e 20 28 6d 65 6d 62 65 72 20 28 -rerun (member (
4e60: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
4e70: 74 65 73 74 64 61 74 29 20 72 65 72 75 6e 6c 73 testdat) rerunls
4e80: 74 29 29 29 0a 09 09 20 20 20 20 28 64 65 62 75 t)))... (debu
4e90: 67 3a 70 72 69 6e 74 20 33 20 22 49 4e 46 4f 3a g:print 3 "INFO:
4ea0: 20 2d 72 65 72 75 6e 20 6c 69 73 74 3a 20 22 20 -rerun list: "
4eb0: 72 65 72 75 6e 20 22 2c 20 74 65 73 74 2d 73 74 rerun ", test-st
4ec0: 61 74 75 73 3a 20 22 20 28 74 65 73 74 3a 67 65 atus: " (test:ge
4ed0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
4ee0: 29 22 2c 20 6d 75 73 74 2d 72 65 72 75 6e 3a 20 )", must-rerun:
4ef0: 22 20 6d 75 73 74 2d 72 65 72 75 6e 29 0a 09 09 " must-rerun)...
4f00: 20 20 20 20 6d 75 73 74 2d 72 65 72 75 6e 29 29 must-rerun))
4f10: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 .. (debug:pr
4f20: 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 52 65 72 int 2 "INFO: Rer
4f30: 75 6e 20 66 6f 72 63 65 64 20 66 6f 72 20 74 65 un forced for te
4f40: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
4f50: 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 /" item-path)..
4f60: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 (set! runfla
4f70: 67 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 2d g #t)).. ;; -
4f80: 6b 65 65 70 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f keepgoing, do no
4f90: 74 20 72 65 72 75 6e 20 46 41 49 4c 0a 09 20 20 t rerun FAIL..
4fa0: 20 20 28 28 61 6e 64 20 6b 65 65 70 67 6f 69 6e ((and keepgoin
4fb0: 67 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 g... (member (t
4fc0: 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 est:get-status t
4fd0: 65 73 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 estdat) '("FAIL"
4fe0: 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 ))).. (set!
4ff0: 72 75 6e 66 6c 61 67 20 23 66 29 29 0a 09 20 20 runflag #f))..
5000: 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 72 65 72 ((and (not rer
5010: 75 6e 29 0a 09 09 20 20 28 6d 65 6d 62 65 72 20 un)... (member
5020: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
5030: 20 74 65 73 74 64 61 74 29 20 27 28 22 46 41 49 testdat) '("FAI
5040: 4c 22 20 22 6e 2f 61 22 29 29 29 0a 09 20 20 20 L" "n/a")))..
5050: 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 (set! runflag
5060: 23 74 29 29 0a 09 20 20 20 20 28 65 6c 73 65 20 #t)).. (else
5070: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
5080: 29 29 29 0a 09 20 20 20 28 64 65 62 75 67 3a 70 ))).. (debug:p
5090: 72 69 6e 74 20 36 20 22 52 55 4e 4e 49 4e 47 20 rint 6 "RUNNING
50a0: 3d 3e 20 72 75 6e 66 6c 61 67 3a 20 22 20 72 75 => runflag: " ru
50b0: 6e 66 6c 61 67 20 22 20 53 54 41 54 45 3a 20 22 nflag " STATE: "
50c0: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
50d0: 20 74 65 73 74 64 61 74 29 20 22 20 53 54 41 54 testdat) " STAT
50e0: 55 53 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d US: " (test:get-
50f0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 29 status testdat))
5100: 0a 09 20 20 20 28 69 66 20 28 6e 6f 74 20 72 75 .. (if (not ru
5110: 6e 66 6c 61 67 29 0a 09 20 20 20 20 20 20 20 28 nflag).. (
5120: 69 66 20 28 6e 6f 74 20 70 61 72 65 6e 74 2d 74 if (not parent-t
5130: 65 73 74 29 0a 09 09 20 20 20 28 64 65 62 75 67 est)... (debug
5140: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 :print 1 "NOTE:
5150: 4e 6f 74 20 73 74 61 72 74 69 6e 67 20 74 65 73 Not starting tes
5160: 74 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d t " new-test-nam
5170: 65 20 22 20 61 73 20 69 74 20 69 73 20 73 74 61 e " as it is sta
5180: 74 65 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 te \"" (test:get
5190: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 -state testdat)
51a0: 0a 09 09 09 09 22 5c 22 20 61 6e 64 20 73 74 61 ....."\" and sta
51b0: 74 75 73 20 5c 22 22 20 28 74 65 73 74 3a 67 65 tus \"" (test:ge
51c0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
51d0: 29 20 22 5c 22 2c 20 75 73 65 20 2d 72 65 72 75 ) "\", use -reru
51e0: 6e 20 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d n \"" (test:get-
51f0: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 0a status testdat).
5200: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5220: 22 5c 22 20 6f 72 20 2d 66 6f 72 63 65 20 74 6f "\" or -force to
5230: 20 6f 76 65 72 72 69 64 65 22 29 29 0a 09 20 20 override"))..
5240: 20 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f ;; NOTE: No
5250: 20 6c 6f 6e 67 65 72 20 62 65 20 63 68 65 63 6b longer be check
5260: 69 6e 67 20 70 72 65 72 65 71 75 69 73 69 74 65 ing prerequisite
5270: 73 20 68 65 72 65 21 20 57 69 6c 6c 20 6e 65 76 s here! Will nev
5280: 65 72 20 67 65 74 20 68 65 72 65 20 75 6e 6c 65 er get here unle
5290: 73 73 20 70 72 65 72 65 71 73 20 61 72 65 0a 09 ss prereqs are..
52a0: 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 ;;
52b0: 61 6c 72 65 61 64 79 20 6d 65 74 2e 0a 09 20 20 already met...
52c0: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6c (if (not (l
52d0: 61 75 6e 63 68 2d 74 65 73 74 20 64 62 20 72 75 aunch-test db ru
52e0: 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 n-id runname tes
52f0: 74 2d 63 6f 6e 66 20 6b 65 79 76 61 6c 6c 73 74 t-conf keyvallst
5300: 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d test-name test-
5310: 70 61 74 68 20 69 74 65 6d 64 61 74 20 66 6c 61 path itemdat fla
5320: 67 73 29 29 0a 09 09 20 20 20 28 62 65 67 69 6e gs))... (begin
5330: 0a 09 09 20 20 20 20 20 28 70 72 69 6e 74 20 22 ... (print "
5340: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
5350: 20 6c 61 75 6e 63 68 20 74 68 65 20 74 65 73 74 launch the test
5360: 2e 20 45 78 69 74 69 6e 67 20 61 73 20 73 6f 6f . Exiting as soo
5370: 6e 20 61 73 20 70 6f 73 73 69 62 6c 65 22 29 0a n as possible").
5380: 09 09 20 20 20 20 20 28 73 65 74 21 20 2a 67 6c .. (set! *gl
5390: 6f 62 61 6c 65 78 69 74 73 74 61 74 75 73 2a 20 obalexitstatus*
53a0: 31 29 20 3b 3b 20 0a 09 09 20 20 20 20 20 28 70 1) ;; ... (p
53b0: 72 6f 63 65 73 73 2d 73 69 67 6e 61 6c 20 28 63 rocess-signal (c
53c0: 75 72 72 65 6e 74 2d 70 72 6f 63 65 73 73 2d 69 urrent-process-i
53d0: 64 29 20 73 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 d) signal/kill))
53e0: 29 29 29 29 0a 09 28 28 4b 49 4c 4c 45 44 29 20 ))))..((KILLED)
53f0: 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
5400: 31 20 22 4e 4f 54 45 3a 20 22 20 6e 65 77 2d 74 1 "NOTE: " new-t
5410: 65 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c est-name " is al
5420: 72 65 61 64 79 20 72 75 6e 6e 69 6e 67 20 6f 72 ready running or
5430: 20 77 61 73 20 65 78 70 6c 69 63 74 6c 79 20 6b was explictly k
5440: 69 6c 6c 65 64 2c 20 75 73 65 20 2d 66 6f 72 63 illed, use -forc
5450: 65 20 74 6f 20 6c 61 75 6e 63 68 20 69 74 2e 22 e to launch it."
5460: 29 29 0a 09 28 28 4c 41 55 4e 43 48 45 44 20 52 ))..((LAUNCHED R
5470: 45 4d 4f 54 45 48 4f 53 54 53 54 41 52 54 20 52 EMOTEHOSTSTART R
5480: 55 4e 4e 49 4e 47 29 20 20 0a 09 20 28 69 66 20 UNNING) .. (if
5490: 28 3e 20 28 2d 20 28 63 75 72 72 65 6e 74 2d 73 (> (- (current-s
54a0: 65 63 6f 6e 64 73 29 28 2b 20 28 64 62 3a 74 65 econds)(+ (db:te
54b0: 73 74 2d 67 65 74 2d 65 76 65 6e 74 5f 74 69 6d st-get-event_tim
54c0: 65 20 74 65 73 74 64 61 74 29 0a 09 09 09 09 20 e testdat).....
54d0: 20 20 20 20 20 20 28 64 62 3a 74 65 73 74 2d 67 (db:test-g
54e0: 65 74 2d 72 75 6e 5f 64 75 72 61 74 69 6f 6e 20 et-run_duration
54f0: 74 65 73 74 64 61 74 29 29 29 0a 09 09 36 30 30 testdat)))...600
5500: 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f 20 75 70 64 ) ;; i.e. no upd
5510: 61 74 65 20 66 6f 72 20 6d 6f 72 65 20 74 68 61 ate for more tha
5520: 6e 20 36 30 30 20 73 65 63 6f 6e 64 73 0a 09 20 n 600 seconds..
5530: 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 (begin..
5540: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
5550: 30 20 22 57 41 52 4e 49 4e 47 3a 20 54 65 73 74 0 "WARNING: Test
5560: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 " test-name " a
5570: 70 70 65 61 72 73 20 74 6f 20 62 65 20 64 65 61 ppears to be dea
5580: 64 2e 20 46 6f 72 63 69 6e 67 20 69 74 20 74 6f d. Forcing it to
5590: 20 73 74 61 74 65 20 49 4e 43 4f 4d 50 4c 45 54 state INCOMPLET
55a0: 45 20 61 6e 64 20 73 74 61 74 75 73 20 53 54 55 E and status STU
55b0: 43 4b 2f 44 45 41 44 22 29 0a 09 20 20 20 20 20 CK/DEAD")..
55c0: 20 20 28 74 65 73 74 2d 73 65 74 2d 73 74 61 74 (test-set-stat
55d0: 75 73 21 20 64 62 20 74 65 73 74 2d 69 64 20 22 us! db test-id "
55e0: 49 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 INCOMPLETE" "STU
55f0: 43 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20 69 CK/DEAD" "Test i
5600: 73 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 s stuck or dead"
5610: 20 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 #f)).. (deb
5620: 75 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 ug:print 2 "NOTE
5630: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 : " test-name "
5640: 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 is already runni
5650: 6e 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 ng")))..(else
5660: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
5670: 20 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 0 "ERROR: Faile
5680: 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 d to launch test
5690: 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 " new-test-name
56a0: 20 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 ". Unrecognised
56b0: 20 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 state " (test:g
56c0: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
56d0: 29 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d )))))))..;;=====
56e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
56f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5720: 3d 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 =.;; END OF NEW
5730: 53 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d STUFF.;;========
5740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5760: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a ==============..
5780: 28 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 (define (get-dir
5790: 2d 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 -up-n dir . para
57a0: 6d 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 ms) . (let ((dp
57b0: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 arts (string-sp
57c0: 6c 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 lit dir "/"))..(
57d0: 63 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c count (if (nul
57e0: 6c 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 l? params) 1 (ca
57f0: 72 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 r params)))).
5800: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 (conc "/" (stri
5810: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a ng-intersperse .
5820: 09 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 . (take dp
5830: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 arts (- (length
5840: 64 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a dparts) count)).
5850: 09 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a . "/")))).
5860: 3b 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b ;; Remove runs.;
5870: 3b 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 ; fields are pas
5880: 73 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 sing in through
5890: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 .(define (runs:r
58a0: 65 6d 6f 76 65 2d 72 75 6e 73 20 64 62 20 72 75 emove-runs db ru
58b0: 6e 6e 61 6d 65 70 61 74 74 20 74 65 73 74 70 61 nnamepatt testpa
58c0: 74 74 20 69 74 65 6d 70 61 74 74 29 0a 20 20 28 tt itempatt). (
58d0: 6c 65 74 2a 20 28 28 6b 65 79 73 20 20 20 20 20 let* ((keys
58e0: 20 20 20 28 72 64 62 3a 67 65 74 2d 6b 65 79 73 (rdb:get-keys
58f0: 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 db)).. (rundat
5900: 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 (runs:get-r
5910: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
5920: 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 eys runnamepatt)
5930: 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 ).. (header
5940: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e (vector-ref run
5950: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 dat 0)).. (runs
5960: 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 (vector-r
5970: 65 66 20 72 75 6e 64 61 74 20 31 29 29 29 0a 20 ef rundat 1))).
5980: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
5990: 31 20 22 48 65 61 64 65 72 3a 20 22 20 68 65 61 1 "Header: " hea
59a0: 64 65 72 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 der). (for-ea
59b0: 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 ch. (lambda
59c0: 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 (run). (le
59d0: 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 t ((runkey (stri
59e0: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
59f0: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a map (lambda (k).
5a00: 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 ......(db:get-va
5a10: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
5a20: 6e 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 n header (vector
5a30: 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 -ref k 0))) keys
5a40: 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 ) "/")).. (d
5a50: 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d irs-to-remove (m
5a60: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
5a70: 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d ).. (let* ((run-
5a80: 69 64 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 id (db:get-value
5a90: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
5aa0: 65 61 64 65 72 20 22 69 64 22 29 20 29 0a 09 09 eader "id") )...
5ab0: 28 74 65 73 74 73 20 20 28 72 64 62 3a 67 65 74 (tests (rdb:get
5ac0: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 -tests-for-run d
5ad0: 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d b (db:get-value-
5ae0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
5af0: 61 64 65 72 20 22 69 64 22 29 20 74 65 73 74 70 ader "id") testp
5b00: 61 74 74 20 69 74 65 6d 70 61 74 74 20 27 28 29 att itempatt '()
5b10: 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 '()))...(lasttp
5b20: 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 ath "/does/not/e
5b30: 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a xist/I/hope"))..
5b40: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 . (if (not (nu
5b50: 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 ll? tests))..
5b60: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 64 (begin... (d
5b70: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 ebug:print 1 "Re
5b80: 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f 72 moving tests for
5b90: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 run: " runkey "
5ba0: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 " (db:get-value
5bb0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
5bc0: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 eader "runname")
5bd0: 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a 09 )... (for-each..
5be0: 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 . (lambda (test
5bf0: 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 28 )... (let* ((
5c00: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 item-path (db:te
5c10: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
5c20: 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 74 test)).... (t
5c30: 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 73 est-name (db:tes
5c40: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
5c50: 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75 6e est)).... (run
5c60: 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74 2d -dir (db:test-
5c70: 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74 29 get-rundir test)
5c80: 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 ))... (debu
5c90: 67 3a 70 72 69 6e 74 20 31 20 22 20 20 22 20 28 g:print 1 " " (
5ca0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
5cb0: 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a name test) " id:
5cc0: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
5cd0: 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74 65 id test) " " ite
5ce0: 6d 2d 70 61 74 68 29 0a 09 09 20 20 20 20 20 20 m-path)...
5cf0: 28 72 64 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 (rdb:delete-test
5d00: 2d 72 65 63 6f 72 64 73 20 64 62 20 28 64 62 3a -records db (db:
5d10: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
5d20: 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 20 28 ))... (if (
5d30: 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 > (string-length
5d40: 20 72 75 6e 2d 64 69 72 29 20 35 29 20 3b 3b 20 run-dir) 5) ;;
5d50: 62 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 bad heuristic bu
5d60: 74 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 t should prevent
5d70: 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e /tmp /home etc.
5d80: 0a 09 09 09 20 20 28 6c 65 74 20 28 28 66 75 6c .... (let ((ful
5d90: 6c 70 61 74 68 20 72 75 6e 2d 64 69 72 29 29 20 lpath run-dir))
5da0: 3b 3b 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d ;; "/" (db:test-
5db0: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
5dc0: 73 74 29 29 29 29 0a 09 09 09 20 20 20 20 28 73 st)))).... (s
5dd0: 65 74 21 20 6c 61 73 74 74 70 61 74 68 20 66 75 et! lasttpath fu
5de0: 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 28 llpath).... (
5df0: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
5e00: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 66 dirs-to-remove f
5e10: 75 6c 6c 70 61 74 68 20 23 74 29 0a 09 09 09 20 ullpath #t)....
5e20: 20 20 20 3b 3b 20 54 68 65 20 66 6f 6c 6c 6f 77 ;; The follow
5e30: 69 6e 67 20 77 61 73 20 74 68 65 20 73 61 66 65 ing was the safe
5e40: 20 64 65 6c 65 74 65 20 63 6f 64 65 20 62 75 74 delete code but
5e50: 20 69 74 20 77 61 73 20 6e 6f 74 20 62 65 69 6e it was not bein
5e60: 67 20 65 78 65 63 74 75 74 65 64 2e 0a 09 09 09 g exectuted.....
5e70: 20 20 20 20 3b 3b 20 28 6c 65 74 2a 20 28 28 64 ;; (let* ((d
5e80: 69 72 73 2d 63 6f 75 6e 74 20 28 2b 20 31 20 28 irs-count (+ 1 (
5e90: 6c 65 6e 67 74 68 20 6b 65 79 73 29 28 6c 65 6e length keys)(len
5ea0: 67 74 68 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 gth (string-spli
5eb0: 74 20 69 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 t item-path "/")
5ec0: 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 20 ))).... ;;
5ed0: 20 20 20 20 20 28 64 69 72 2d 74 6f 2d 72 65 6d (dir-to-rem
5ee0: 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 66 (get-dir-up-n f
5ef0: 75 6c 6c 70 61 74 68 20 64 69 72 73 2d 63 6f 75 ullpath dirs-cou
5f00: 6e 74 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 nt)).... ;;
5f10: 20 20 20 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 (remaining
5f20: 64 20 28 73 74 72 69 6e 67 2d 73 75 62 73 74 69 d (string-substi
5f30: 74 75 74 65 20 28 72 65 67 65 78 70 20 28 63 6f tute (regexp (co
5f40: 6e 63 20 22 5e 22 20 64 69 72 2d 74 6f 2d 72 65 nc "^" dir-to-re
5f50: 6d 20 22 2f 22 29 29 20 22 22 20 66 75 6c 6c 70 m "/")) "" fullp
5f60: 61 74 68 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 ath)).... ;;
5f70: 20 20 20 20 20 20 20 28 63 6d 64 20 28 63 6f 6e (cmd (con
5f80: 63 20 22 63 64 20 22 20 64 69 72 2d 74 6f 2d 72 c "cd " dir-to-r
5f90: 65 6d 20 22 3b 20 72 6d 64 69 72 20 2d 70 20 22 em "; rmdir -p "
5fa0: 20 72 65 6d 61 69 6e 69 6e 67 64 20 29 29 29 0a remainingd ))).
5fb0: 09 09 09 20 20 20 20 3b 3b 20 20 20 28 69 66 20 ... ;; (if
5fc0: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 66 75 (file-exists? fu
5fd0: 6c 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 3b llpath).... ;
5fe0: 3b 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 ; (begin..
5ff0: 09 09 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 .. ;;
6000: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
6010: 63 6d 64 29 0a 09 09 09 20 20 20 20 3b 3b 20 20 cmd).... ;;
6020: 20 20 20 20 20 20 20 28 73 79 73 74 65 6d 20 63 (system c
6030: 6d 64 29 29 29 0a 09 09 09 20 20 20 20 3b 3b 20 md))).... ;;
6040: 20 20 29 29 0a 09 09 09 20 20 20 20 29 29 29 29 )).... ))))
6050: 0a 09 09 20 20 20 20 74 65 73 74 73 29 29 29 0a ... tests))).
6060: 0a 09 20 20 20 3b 3b 20 6c 6f 6f 6b 20 74 68 6f .. ;; look tho
6070: 75 67 68 20 74 68 65 20 64 69 72 73 2d 74 6f 2d ugh the dirs-to-
6080: 72 65 6d 6f 76 65 20 66 6f 72 20 63 61 6e 64 69 remove for candi
6090: 64 61 74 65 73 20 66 6f 72 20 72 65 6d 6f 76 61 dates for remova
60a0: 6c 2e 20 44 6f 20 74 68 69 73 20 61 66 74 65 72 l. Do this after
60b0: 20 64 65 6c 65 74 69 6e 67 20 74 68 65 20 72 65 deleting the re
60c0: 63 6f 72 64 73 0a 09 20 20 20 3b 3b 20 66 6f 72 cords.. ;; for
60d0: 20 65 61 63 68 20 74 65 73 74 20 69 6e 20 63 61 each test in ca
60e0: 73 65 20 77 65 20 67 65 74 20 6b 69 6c 6c 65 64 se we get killed
60f0: 2e 20 54 68 61 74 20 73 68 6f 75 6c 64 20 6d 69 . That should mi
6100: 6e 69 6d 69 7a 65 20 74 68 65 20 64 65 74 72 69 nimize the detri
6110: 74 75 73 20 6c 65 66 74 20 6f 6e 20 64 69 73 6b tus left on disk
6120: 0a 09 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 20 .. ;; process
6130: 74 68 65 20 64 69 72 73 20 66 72 6f 6d 20 6c 6f the dirs from lo
6140: 6e 67 65 73 74 20 73 74 72 69 6e 67 20 6c 65 6e ngest string len
6150: 67 74 68 20 74 6f 20 73 68 6f 72 74 65 73 74 0a gth to shortest.
6160: 09 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 09 . (for-each ..
6170: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 (lambda (dir
6180: 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 20 20 20 -to-remove)..
6190: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 (if (file-exi
61a0: 73 74 73 3f 20 64 69 72 2d 74 6f 2d 72 65 6d 6f sts? dir-to-remo
61b0: 76 65 29 0a 09 09 20 20 28 6c 65 74 20 28 28 64 ve)... (let ((d
61c0: 69 72 2d 69 6e 2d 64 62 20 27 28 29 29 29 0a 09 ir-in-db '()))..
61d0: 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 6f . (sqlite3:fo
61e0: 72 2d 65 61 63 68 2d 72 6f 77 0a 09 09 20 20 20 r-each-row...
61f0: 20 20 28 6c 61 6d 62 64 61 20 28 64 69 72 29 0a (lambda (dir).
6200: 09 09 20 20 20 20 20 20 20 28 73 65 74 21 20 64 .. (set! d
6210: 69 72 2d 69 6e 2d 64 62 20 28 63 6f 6e 73 20 64 ir-in-db (cons d
6220: 69 72 20 64 69 72 2d 69 6e 2d 64 62 29 29 29 0a ir dir-in-db))).
6230: 09 09 20 20 20 20 20 64 62 20 22 53 45 4c 45 43 .. db "SELEC
6240: 54 20 72 75 6e 64 69 72 20 46 52 4f 4d 20 74 65 T rundir FROM te
6250: 73 74 73 20 57 48 45 52 45 20 72 75 6e 64 69 72 sts WHERE rundir
6260: 20 4c 49 4b 45 20 3f 3b 22 20 0a 09 09 20 20 20 LIKE ?;" ...
6270: 20 20 28 63 6f 6e 63 20 22 25 22 20 64 69 72 2d (conc "%" dir-
6280: 74 6f 2d 72 65 6d 6f 76 65 20 22 25 22 29 29 20 to-remove "%"))
6290: 3b 3b 20 79 65 73 2c 20 49 27 6d 20 67 6f 69 6e ;; yes, I'm goin
62a0: 67 20 74 6f 20 62 61 69 6c 20 69 66 20 74 68 65 g to bail if the
62b0: 72 65 20 69 73 20 61 6e 79 74 68 69 6e 67 20 6c re is anything l
62c0: 69 6b 65 20 74 68 69 73 20 64 69 72 20 69 6e 20 ike this dir in
62d0: 74 68 65 20 64 62 0a 09 09 20 20 20 20 28 69 66 the db... (if
62e0: 20 28 6e 75 6c 6c 3f 20 64 69 72 2d 69 6e 2d 64 (null? dir-in-d
62f0: 62 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 b)....(begin....
6300: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
6310: 20 22 52 65 6d 6f 76 69 6e 67 20 64 69 72 65 63 "Removing direc
6320: 74 6f 72 79 20 77 69 74 68 20 7a 65 72 6f 20 64 tory with zero d
6330: 62 20 72 65 66 65 72 65 6e 63 65 73 3a 20 22 20 b references: "
6340: 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 65 29 0a 09 dir-to-remove)..
6350: 09 09 20 20 28 73 79 73 74 65 6d 20 28 63 6f 6e .. (system (con
6360: 63 20 22 72 6d 20 2d 72 66 20 22 20 64 69 72 2d c "rm -rf " dir-
6370: 74 6f 2d 72 65 6d 6f 76 65 29 29 0a 09 09 09 20 to-remove))....
6380: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 64 65 6c (hash-table-del
6390: 65 74 65 21 20 64 69 72 73 2d 74 6f 2d 72 65 6d ete! dirs-to-rem
63a0: 6f 76 65 20 64 69 72 2d 74 6f 2d 72 65 6d 6f 76 ove dir-to-remov
63b0: 65 29 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 e))....(debug:pr
63c0: 69 6e 74 20 32 20 22 53 6b 69 70 70 69 6e 67 20 int 2 "Skipping
63d0: 72 65 6d 6f 76 61 6c 20 6f 66 20 22 20 64 69 72 removal of " dir
63e0: 2d 74 6f 2d 72 65 6d 6f 76 65 20 22 20 66 6f 72 -to-remove " for
63f0: 20 6e 6f 77 20 61 73 20 69 74 20 73 74 69 6c 6c now as it still
6400: 20 68 61 73 20 72 65 66 65 72 65 6e 63 65 73 20 has references
6410: 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 65 22 in the database"
6420: 29 29 29 29 29 0a 09 20 20 20 20 28 73 6f 72 74 ))))).. (sort
6430: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 6b 65 79 (hash-table-key
6440: 73 20 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 s dirs-to-remove
6450: 29 20 28 6c 61 6d 62 64 61 20 28 61 20 62 29 28 ) (lambda (a b)(
6460: 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 > (string-length
6470: 20 61 29 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 a)(string-lengt
6480: 68 20 62 29 29 29 29 29 0a 0a 09 20 20 20 3b 3b h b)))))... ;;
6490: 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 6e 20 remove the run
64a0: 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 72 65 if zero tests re
64b0: 6d 61 69 6e 0a 09 20 20 20 28 6c 65 74 20 28 28 main.. (let ((
64c0: 72 65 6d 74 65 73 74 73 20 28 72 64 62 3a 67 65 remtests (rdb:ge
64d0: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
64e0: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 db (db:get-value
64f0: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
6500: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 23 eader "id") #f #
6510: 66 20 27 28 29 20 27 28 29 29 29 29 0a 09 20 20 f '() '())))..
6520: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 (if (null? re
6530: 6d 74 65 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f mtests) ;; no mo
6540: 72 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 re tests remaini
6550: 6e 67 0a 09 09 20 28 6c 65 74 2a 20 28 28 64 70 ng... (let* ((dp
6560: 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 arts (string-sp
6570: 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 2f lit lasttpath "/
6580: 22 29 29 0a 09 09 09 28 72 75 6e 70 61 74 68 20 "))....(runpath
6590: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e (conc "/" (strin
65a0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 g-intersperse ..
65b0: 09 09 09 09 20 20 20 20 28 74 61 6b 65 20 64 70 .... (take dp
65c0: 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 arts (- (length
65d0: 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 dparts) 1)).....
65e0: 09 20 20 20 20 22 2f 22 29 29 29 29 0a 09 09 20 . "/"))))...
65f0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
6600: 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 "Removing run:
6610: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
6620: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
6630: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
6640: 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 "runname"))...
6650: 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 6e 20 (db:delete-run
6660: 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 20 db run-id)...
6670: 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 72 ;; need to figur
6680: 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 74 e out the path t
6690: 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 6e o the run dir an
66a0: 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 65 d remove it if e
66b0: 6d 70 74 79 0a 09 09 20 20 20 3b 3b 20 20 20 20 mpty... ;;
66c0: 28 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 (if (null? (glob
66d0: 20 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 (conc runpath "
66e0: 2f 2a 22 29 29 29 0a 09 09 20 20 20 3b 3b 20 20 /*")))... ;;
66f0: 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 (begin...
6700: 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 72 ;; . (debug:pr
6710: 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 int 1 "Removing
6720: 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 74 run dir " runpat
6730: 68 29 0a 09 09 20 20 20 3b 3b 20 09 20 28 73 79 h)... ;; . (sy
6740: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 69 stem (conc "rmdi
6750: 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 29 r -p " runpath))
6760: 29 29 0a 09 09 20 20 20 29 29 29 29 0a 09 20 29 ))... )))).. )
6770: 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a ). runs)))..
6780: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
6790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
67a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
67b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
67c0: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 ========.;; Rout
67d0: 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c ines for manipul
67e0: 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d ating runs.;;===
67f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6800: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6810: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6820: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6830: 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 ===..;; Since ma
6840: 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 ny calls to a ru
6850: 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 n require pretty
6860: 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 much the same s
6870: 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 etup .;; this wr
6880: 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f apper is used to
6890: 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c reduce the repl
68a0: 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a ication of code.
68b0: 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c (define (general
68c0: 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 -run-call switch
68d0: 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 name action-desc
68e0: 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 proc). (let ((
68f0: 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 runname (args:ge
6900: 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 t-arg ":runname"
6910: 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 ))..(target (if
6920: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6930: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
6940: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6950: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
6960: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6970: 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 -reqtarg")))..(t
6980: 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 h1 #f)).
6990: 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 (cond. ((not
69a0: 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 target). (
69b0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
69c0: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 RROR: Missing re
69d0: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 quired parameter
69e0: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d for " switchnam
69f0: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 e ", you must sp
6a00: 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74 ecify the target
6a10: 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a with -target").
6a20: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a (exit 3)).
6a30: 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 ((not runna
6a40: 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 me). (debug
6a50: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
6a60: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 Missing require
6a70: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 d parameter for
6a80: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 " switchname ",
6a90: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 you must specify
6aa0: 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 the run name wi
6ab0: 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e th :runname runn
6ac0: 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 ame"). (exi
6ad0: 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 t 3)). (else
6ae0: 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 . (let ((db
6af0: 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 #f).. (key
6b00: 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 s #f))..(if (not
6b10: 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 (setup-for-run)
6b20: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 ).. (begin ..
6b30: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
6b40: 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 nt 0 "Failed to
6b50: 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 setup, exiting")
6b60: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
6b70: 29 29 0a 09 28 73 65 74 21 20 64 62 20 20 20 28 ))..(set! db (
6b80: 6f 70 65 6e 2d 64 62 29 29 0a 09 28 69 66 20 28 open-db))..(if (
6b90: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 args:get-arg "-s
6ba0: 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 73 65 erver").. (se
6bb0: 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 rver:start db (a
6bc0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 rgs:get-arg "-se
6bd0: 72 76 65 72 22 29 29 0a 09 20 20 20 20 28 69 66 rver")).. (if
6be0: 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a (not (or (args:
6bf0: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c get-arg "-runall
6c00: 22 29 0a 09 09 09 20 20 28 61 72 67 73 3a 67 65 ").... (args:ge
6c10: 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 t-arg "-runtests
6c20: 22 29 29 29 0a 09 09 28 73 65 72 76 65 72 3a 63 ")))...(server:c
6c30: 6c 69 65 6e 74 2d 73 65 74 75 70 20 64 62 29 29 lient-setup db))
6c40: 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 72 )..(set! keys (r
6c50: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db:get-keys db))
6c60: 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 ..;; have enough
6c70: 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 to process -tar
6c80: 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 get or -reqtarg
6c90: 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a here..(if (args:
6ca0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 get-arg "-reqtar
6cb0: 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 g").. (let* (
6cc0: 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e (runconfigf (con
6cd0: 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 c *toppath* "/r
6ce0: 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 unconfigs.config
6cf0: 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 ")) ;; DO NOT EV
6d00: 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 ALUATE ALL ...
6d10: 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 (runconfig (re
6d20: 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e ad-config runcon
6d30: 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 figf #f #f envir
6d40: 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a on-patt: #f))) .
6d50: 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68 . (if (hash
6d60: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
6d70: 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 lt runconfig (ar
6d80: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
6d90: 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 targ") #f)... (
6da0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d keys:target-set-
6db0: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a args keys (args:
6dc0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 get-arg "-reqtar
6dd0: 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 g") args:arg-has
6de0: 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 h)... (begin...
6df0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
6e00: 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 0 "ERROR: [" (a
6e10: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
6e20: 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 qtarg") "] not f
6e30: 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e ound in " runcon
6e40: 66 69 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c figf)... (sql
6e50: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 ite3:finalize! d
6e60: 62 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 b)... (exit 1
6e70: 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 )))).. (if (a
6e80: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
6e90: 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 rget")...(keys:t
6ea0: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b arget-set-args k
6eb0: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 eys (args:get-ar
6ec0: 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 g "-target" args
6ed0: 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a :arg-hash) args:
6ee0: 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 arg-hash)))..(if
6ef0: 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 (not (car *conf
6f00: 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 iginfo*)).. (
6f10: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 begin.. (de
6f20: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
6f30: 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f OR: Attempted to
6f40: 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 " action-desc "
6f50: 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f but run area co
6f60: 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f nfig file not fo
6f70: 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 und").. (ex
6f80: 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 it 1)).. ;; E
6f90: 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 xtract out stuff
6fa0: 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 needed in most
6fb0: 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 or many calls..
6fc0: 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 ;; here then
6fd0: 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 call proc.. (
6fe0: 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 let* ((keynames
6ff0: 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 (map key:get-f
7000: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a ieldname keys)).
7010: 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 .. (keyvallst
7020: 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 (keys->vallist
7030: 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 keys #t)))..
7040: 20 20 28 70 72 6f 63 20 64 62 20 74 61 72 67 65 (proc db targe
7050: 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b t runname keys k
7060: 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 eynames keyvalls
7070: 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 t)))..(if th1 (t
7080: 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 hread-join! th1)
7090: 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 )..(sqlite3:fina
70a0: 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 65 74 21 lize! db)..(set!
70b0: 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 *didsomething*
70c0: 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d #t))))))..;;====
70d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
70e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
70f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7100: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7110: 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 75 6e ==.;; Rollup run
7120: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d s.;;============
7130: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7140: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7150: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7160: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 ==========..;; U
7170: 70 64 61 74 65 20 74 68 65 20 74 65 73 74 5f 6d pdate the test_m
7180: 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 74 68 eta table for th
7190: 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e 65 20 is test.(define
71a0: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 (runs:update-tes
71b0: 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e t_meta db test-n
71c0: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 0a 20 ame test-conf).
71d0: 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 63 6f (let ((currreco
71e0: 72 64 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d rd (db:testmeta-
71f0: 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 65 get-record db te
7200: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 st-name))). (
7210: 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 6f if (not currreco
7220: 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 rd)..(begin.. (
7230: 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 20 set! currrecord
7240: 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 20 (make-vector 10
7250: 23 66 29 29 0a 09 20 20 28 64 62 3a 74 65 73 74 #f)).. (db:test
7260: 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 meta-add-record
7270: 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a db test-name))).
7280: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 (for-each .
7290: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 (lambda (key
72a0: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 ). (let* (
72b0: 28 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 (idx (cadr key))
72c0: 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 .. (fld (ca
72d0: 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 r key))..
72e0: 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f (val (config-loo
72f0: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 kup test-conf "t
7300: 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 est_meta" fld)))
7310: 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 .. ;; (debug:pri
7320: 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 nt 5 "idx: " idx
7330: 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 " fld: " fld "
7340: 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 val: " val).. (i
7350: 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 f (and val (not
7360: 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d (equal? (vector-
7370: 72 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 ref currrecord i
7380: 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 dx) val)))..
7390: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 (begin..
73a0: 28 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 (print "Updating
73b0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 " test-name " "
73c0: 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 fld " to " val)
73d0: 0a 09 20 20 20 20 20 20 20 28 64 62 3a 74 65 73 .. (db:tes
73e0: 74 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 tmeta-update-fie
73f0: 6c 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 ld db test-name
7400: 66 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 fld val))))).
7410: 20 20 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 '(("author" 2)
7420: 28 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 ("owner" 3)("des
7430: 63 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 cription" 4)("re
7440: 76 69 65 77 65 64 22 20 35 29 28 22 74 61 67 73 viewed" 5)("tags
7450: 22 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 " 9)))))..;; Upd
7460: 61 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f ate test_meta fo
7470: 72 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 r all tests.(def
7480: 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 ine (runs:update
7490: 2d 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 -all-test_meta d
74a0: 62 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 b). (let ((test
74b0: 2d 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d -names (get-all-
74c0: 6c 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 legal-tests))).
74d0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 (for-each .
74e0: 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 (lambda (test
74f0: 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c -name). (l
7500: 65 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 et* ((test-path
7510: 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 (conc *toppat
7520: 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 h* "/tests/" tes
7530: 74 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 t-name))..
7540: 28 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 (test-configf (c
7550: 6f 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f onc test-path "/
7560: 74 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 testconfig"))..
7570: 20 20 20 20 20 28 74 65 73 74 65 78 69 73 74 73 (testexists
7580: 20 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 (and (file-ex
7590: 69 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 ists? test-confi
75a0: 67 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 gf)(file-read-ac
75b0: 63 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 cess? test-confi
75c0: 67 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 gf))).. ;;
75d0: 72 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 read configs wit
75e0: 68 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 h tricks turned
75f0: 6f 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 off (i.e. no sys
7600: 74 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 tem).. (tes
7610: 74 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 t-conf (if te
7620: 73 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 stexists (read-c
7630: 6f 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 onfig test-confi
7640: 67 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 gf #f #f)(make-h
7650: 61 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 ash-table))))..
7660: 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 (runs:update-tes
7670: 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 2d 6e t_meta db test-n
7680: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 ame test-conf)))
7690: 0a 20 20 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 . test-names
76a0: 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 )))..;; This cou
76b0: 6c 64 20 70 72 6f 62 61 62 6c 79 20 62 65 20 72 ld probably be r
76c0: 65 66 61 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f efactored into o
76d0: 6e 65 20 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 ne complex query
76e0: 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 ....(define (ru
76f0: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 20 64 62 ns:rollup-run db
7700: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 keys keyvallst
7710: 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b 3b runname user) ;;
7720: 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f 77 was target, now
7730: 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 65 keyvallst. (de
7740: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 6e bug:print 4 "run
7750: 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b 65 s:rollup-run, ke
7760: 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 79 ys: " keys " key
7770: 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c vallst: " keyval
7780: 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 22 lst " :runname "
7790: 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 3a runname " user:
77a0: 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a " user). (let*
77b0: 20 28 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 (; (keyvalllst
77c0: 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 (keys:targe
77d0: 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 t->keyval keys t
77e0: 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 arget)).. (new-r
77f0: 75 6e 2d 69 64 20 20 20 20 20 20 28 72 75 6e 73 un-id (runs
7800: 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 :register-run db
7810: 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 keys keyvallst
7820: 72 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e runname "new" "n
7830: 2f 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 /a" user)).. (pr
7840: 65 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 74 ev-tests (t
7850: 65 73 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 est:get-matching
7860: 2d 70 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 -previous-test-r
7870: 75 6e 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 un-records db ne
7880: 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 w-run-id "%" "%"
7890: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 )).. (curr-tests
78a0: 20 20 20 20 20 20 28 72 64 62 3a 67 65 74 2d 74 (rdb:get-t
78b0: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ests-for-run db
78c0: 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 22 20 22 new-run-id "%" "
78d0: 25 22 20 27 28 29 20 27 28 29 29 29 0a 09 20 28 %" '() '())).. (
78e0: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 curr-tests-hash
78f0: 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 (make-hash-table
7900: 29 29 29 0a 20 20 20 20 28 64 62 3a 75 70 64 61 ))). (db:upda
7910: 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 69 6d te-run-event_tim
7920: 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 29 e db new-run-id)
7930: 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 74 68 . ;; index th
7940: 65 20 61 6c 72 65 61 64 79 20 73 61 76 65 64 20 e already saved
7950: 74 65 73 74 73 20 62 79 20 74 65 73 74 6e 61 6d tests by testnam
7960: 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20 69 6e e and itemdat in
7970: 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 curr-tests-hash
7980: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 . (for-each.
7990: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 (lambda (tes
79a0: 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 tdat). (le
79b0: 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 t* ((testname (
79c0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 db:test-get-test
79d0: 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 name testdat))..
79e0: 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 (item-path
79f0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 (db:test-get-it
7a00: 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 em-path testdat)
7a10: 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e ).. (full-n
7a20: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 ame (conc testna
7a30: 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 me "/" item-path
7a40: 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c ))).. (hash-tabl
7a50: 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 e-set! curr-test
7a60: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 s-hash full-name
7a70: 20 74 65 73 74 64 61 74 29 29 29 0a 20 20 20 20 testdat))).
7a80: 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20 20 20 curr-tests).
7a90: 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 ;; NOPE: Non-op
7aa0: 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 timal approach.
7ab0: 54 72 79 20 74 68 69 73 20 69 6e 73 74 65 61 64 Try this instead
7ac0: 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 74 65 .. ;; 1. te
7ad0: 73 74 73 20 61 72 65 20 72 65 63 65 69 76 65 64 sts are received
7ae0: 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f 73 74 in a list, most
7af0: 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a 20 20 recent first.
7b00: 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c 61 63 ;; 2. replac
7b10: 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 65 73 e the rollup tes
7b20: 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 20 2a t with the new *
7b30: 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 6f 72 always*. (for
7b40: 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d -each . (lam
7b50: 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 bda (testdat).
7b60: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 (let* ((tes
7b70: 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d tname (db:test-
7b80: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
7b90: 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 tdat)).. (i
7ba0: 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 tem-path (db:tes
7bb0: 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 t-get-item-path
7bc0: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 testdat))..
7bd0: 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e (full-name (con
7be0: 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 c testname "/" i
7bf0: 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 20 tem-path))..
7c00: 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64 61 74 (prev-test-dat
7c10: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
7c20: 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d 74 65 /default curr-te
7c30: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 sts-hash full-na
7c40: 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20 20 28 me #f)).. (
7c50: 74 65 73 74 2d 73 74 65 70 73 20 20 20 20 20 20 test-steps
7c60: 28 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 6f (db:get-steps-fo
7c70: 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74 65 r-test db (db:te
7c80: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
7c90: 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65 77 t))).. (new
7ca0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 -test-record #f)
7cb0: 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 74 ).. ;; replace t
7cc0: 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 72 74 hese with insert
7cd0: 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 61 ... select.. (a
7ce0: 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 pply sqlite3:exe
7cf0: 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28 63 cute ...db ...(c
7d00: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 onc "INSERT OR R
7d10: 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 EPLACE INTO test
7d20: 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e 61 s (run_id,testna
7d30: 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c me,state,status,
7d40: 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 2c event_time,host,
7d50: 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 65 cpuload,diskfree
7d60: 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 74 ,uname,rundir,it
7d70: 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 61 em_path,run_dura
7d80: 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 2c tion,final_logf,
7d90: 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 comment) "...
7da0: 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f 2c "VALUES (?,?,
7db0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ?,?,?,?,?,?,?,?,
7dc0: 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e 65 ?,?,?,?);")...ne
7dd0: 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 28 w-run-id (cddr (
7de0: 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 73 vector->list tes
7df0: 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 20 tdat))).. (set!
7e00: 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 72 new-testdat (car
7e10: 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d (rdb:get-tests-
7e20: 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 for-run db new-r
7e30: 75 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 un-id testname i
7e40: 74 65 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29 tem-path '() '()
7e50: 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c ))).. (hash-tabl
7e60: 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 e-set! curr-test
7e70: 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 s-hash full-name
7e80: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b new-testdat) ;;
7e90: 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63 this could be c
7ea0: 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20 onfusing, which
7eb0: 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f record should go
7ec0: 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 into the lookup
7ed0: 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 table?.. ;; Now
7ee0: 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 duplicate the t
7ef0: 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 62 est steps.. (deb
7f00: 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 ug:print 4 "Copy
7f10: 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 ing records in t
7f20: 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 est_steps from t
7f30: 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 est_id=" (db:tes
7f40: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 t-get-id testdat
7f50: 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 ) " to " (db:tes
7f60: 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 t-get-id new-tes
7f70: 74 64 61 74 29 29 0a 09 20 28 73 71 6c 69 74 65 tdat)).. (sqlite
7f80: 33 3a 65 78 65 63 75 74 65 20 0a 09 20 20 64 62 3:execute .. db
7f90: 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 .. (conc "INSE
7fa0: 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e RT OR REPLACE IN
7fb0: 54 4f 20 74 65 73 74 5f 73 74 65 70 73 20 28 74 TO test_steps (t
7fc0: 65 73 74 5f 69 64 2c 73 74 65 70 6e 61 6d 65 2c est_id,stepname,
7fd0: 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 state,status,eve
7fe0: 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 29 nt_time,comment)
7ff0: 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 28 "..."SELECT " (
8000: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e db:test-get-id n
8010: 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 ew-testdat) ",st
8020: 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 epname,state,sta
8030: 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 tus,event_time,c
8040: 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 omment FROM test
8050: 5f 73 74 65 70 73 20 57 48 45 52 45 20 74 65 73 _steps WHERE tes
8060: 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 t_id=?;").. (db
8070: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
8080: 74 64 61 74 29 29 0a 09 20 3b 3b 20 4e 6f 77 20 tdat)).. ;; Now
8090: 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 duplicate the te
80a0: 73 74 20 64 61 74 61 0a 09 20 28 64 65 62 75 67 st data.. (debug
80b0: 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 6e :print 4 "Copyin
80c0: 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 73 g records in tes
80d0: 74 5f 64 61 74 61 20 66 72 6f 6d 20 74 65 73 74 t_data from test
80e0: 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 _id=" (db:test-g
80f0: 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 et-id testdat) "
8100: 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 to " (db:test-g
8110: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
8120: 74 29 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 t)).. (sqlite3:e
8130: 78 65 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 xecute .. db ..
8140: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 (conc "INSERT
8150: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 OR REPLACE INTO
8160: 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f test_data (test_
8170: 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 id,category,vari
8180: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 able,value,expec
8190: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f ted,tol,units,co
81a0: 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 mment) "..."SELE
81b0: 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 CT " (db:test-ge
81c0: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
81d0: 29 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 ) ",category,var
81e0: 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 iable,value,expe
81f0: 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 cted,tol,units,c
8200: 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 omment FROM test
8210: 5f 64 61 74 61 20 57 48 45 52 45 20 74 65 73 74 _data WHERE test
8220: 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 28 64 62 3a _id=?;").. (db:
8230: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
8240: 64 61 74 29 29 0a 09 20 29 29 0a 20 20 20 20 20 dat)).. )).
8250: 70 72 65 76 2d 74 65 73 74 73 29 29 29 0a 09 20 prev-tests)))..
8260: 0a 20 20 20 20 20 0a . .