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 20 70 6f 73 69 78 2d 65 srfi 18) posix-e
01d0: 78 74 72 61 73 20 64 69 72 65 63 74 6f 72 79 2d xtras directory-
01e0: 75 74 69 6c 73 29 0a 28 69 6d 70 6f 72 74 20 28 utils).(import (
01f0: 70 72 65 66 69 78 20 73 71 6c 69 74 65 33 20 73 prefix sqlite3 s
0200: 71 6c 69 74 65 33 3a 29 29 0a 0a 28 64 65 63 6c qlite3:))..(decl
0210: 61 72 65 20 28 75 6e 69 74 20 72 75 6e 73 29 29 are (unit runs))
0220: 0a 28 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 .(declare (uses
0230: 64 62 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 db)).(declare (u
0240: 73 65 73 20 63 6f 6d 6d 6f 6e 29 29 0a 28 64 65 ses common)).(de
0250: 63 6c 61 72 65 20 28 75 73 65 73 20 69 74 65 6d clare (uses item
0260: 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 75 73 s)).(declare (us
0270: 65 73 20 72 75 6e 63 6f 6e 66 69 67 29 29 0a 28 es runconfig)).(
0280: 64 65 63 6c 61 72 65 20 28 75 73 65 73 20 74 65 declare (uses te
0290: 73 74 73 29 29 0a 28 64 65 63 6c 61 72 65 20 28 sts)).(declare (
02a0: 75 73 65 73 20 73 65 72 76 65 72 29 29 0a 0a 28 uses server))..(
02b0: 69 6e 63 6c 75 64 65 20 22 63 6f 6d 6d 6f 6e 5f include "common_
02c0: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 28 69 records.scm").(i
02d0: 6e 63 6c 75 64 65 20 22 6b 65 79 5f 72 65 63 6f nclude "key_reco
02e0: 72 64 73 2e 73 63 6d 22 29 0a 28 69 6e 63 6c 75 rds.scm").(inclu
02f0: 64 65 20 22 64 62 5f 72 65 63 6f 72 64 73 2e 73 de "db_records.s
0300: 63 6d 22 29 0a 28 69 6e 63 6c 75 64 65 20 22 72 cm").(include "r
0310: 75 6e 5f 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 un_records.scm")
0320: 0a 28 69 6e 63 6c 75 64 65 20 22 74 65 73 74 5f .(include "test_
0330: 72 65 63 6f 72 64 73 2e 73 63 6d 22 29 0a 0a 3b records.scm")..;
0340: 3b 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d ; runs:get-runs-
0350: 62 79 2d 70 61 74 74 0a 3b 3b 20 67 65 74 20 72 by-patt.;; get r
0360: 75 6e 73 20 62 79 20 6c 69 73 74 20 6f 66 20 63 uns by list of c
0370: 72 69 74 65 72 69 61 0a 3b 3b 20 72 65 67 69 73 riteria.;; regis
0380: 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 77 ter a test run w
0390: 69 74 68 20 74 68 65 20 64 62 0a 3b 3b 0a 3b 3b ith the db.;;.;;
03a0: 20 55 73 65 3a 20 28 64 62 2d 67 65 74 2d 76 61 Use: (db-get-va
03b0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 28 64 lue-by-header (d
03c0: 62 3a 67 65 74 2d 68 65 61 64 65 72 20 72 75 6e b:get-header run
03d0: 69 6e 66 6f 29 28 64 62 3a 67 65 74 2d 72 6f 77 info)(db:get-row
03e0: 20 72 75 6e 69 6e 66 6f 29 29 0a 3b 3b 20 20 74 runinfo)).;; t
03f0: 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 20 66 o extract info f
0400: 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 rom the structur
0410: 65 20 72 65 74 75 72 6e 65 64 0a 3b 3b 0a 28 64 e returned.;;.(d
0420: 65 66 69 6e 65 20 28 72 75 6e 73 3a 67 65 74 2d efine (runs:get-
0430: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 runs-by-patt db
0440: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 keys runnamepatt
0450: 20 2e 20 70 61 72 61 6d 73 29 20 3b 3b 20 74 65 . params) ;; te
0460: 73 74 2d 6e 61 6d 65 29 0a 20 20 28 6c 65 74 2a st-name). (let*
0470: 20 28 28 6b 65 79 76 61 6c 6c 73 74 20 28 6b 65 ((keyvallst (ke
0480: 79 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 ys->vallist keys
0490: 29 29 0a 09 20 28 74 6d 70 20 20 20 20 20 20 28 )).. (tmp (
04a0: 72 75 6e 73 3a 67 65 74 2d 73 74 64 2d 72 75 6e runs:get-std-run
04b0: 2d 66 69 65 6c 64 73 20 6b 65 79 73 20 27 28 22 -fields keys '("
04c0: 69 64 22 20 22 72 75 6e 6e 61 6d 65 22 20 22 73 id" "runname" "s
04d0: 74 61 74 65 22 20 22 73 74 61 74 75 73 22 20 22 tate" "status" "
04e0: 6f 77 6e 65 72 22 20 22 65 76 65 6e 74 5f 74 69 owner" "event_ti
04f0: 6d 65 22 29 29 29 0a 09 20 28 6b 65 79 73 74 72 me"))).. (keystr
0500: 20 20 20 28 63 61 72 20 74 6d 70 29 29 0a 09 20 (car tmp))..
0510: 28 68 65 61 64 65 72 20 20 20 28 63 61 64 72 20 (header (cadr
0520: 74 6d 70 29 29 0a 09 20 28 72 65 73 20 20 20 20 tmp)).. (res
0530: 20 27 28 29 29 0a 09 20 28 6b 65 79 2d 70 61 74 '()).. (key-pat
0540: 74 20 22 22 29 29 0a 20 20 20 20 28 66 6f 72 2d t "")). (for-
0550: 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 6b 65 each (lambda (ke
0560: 79 76 61 6c 29 0a 09 09 28 6c 65 74 2a 20 28 28 yval)...(let* ((
0570: 6b 65 79 20 20 20 20 28 76 65 63 74 6f 72 2d 72 key (vector-r
0580: 65 66 20 6b 65 79 76 61 6c 20 30 29 29 0a 09 09 ef keyval 0))...
0590: 20 20 20 20 20 20 20 28 66 75 6c 6b 65 79 20 28 (fulkey (
05a0: 63 6f 6e 63 20 22 3a 22 20 6b 65 79 29 29 0a 09 conc ":" key))..
05b0: 09 20 20 20 20 20 20 20 28 70 61 74 74 20 20 20 . (patt
05c0: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 66 75 (args:get-arg fu
05d0: 6c 6b 65 79 29 29 29 0a 09 09 20 20 28 69 66 20 lkey)))... (if
05e0: 70 61 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 patt... (se
05f0: 74 21 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e t! key-patt (con
0600: 63 20 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 c key-patt " AND
0610: 20 22 20 6b 65 79 20 22 20 6c 69 6b 65 20 27 22 " key " like '"
0620: 20 70 61 74 74 20 22 27 22 29 29 0a 09 09 20 20 patt "'"))...
0630: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 28 64 (begin....(d
0640: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
0650: 52 4f 52 3a 20 73 65 61 72 63 68 69 6e 67 20 66 ROR: searching f
0660: 6f 72 20 72 75 6e 73 20 77 69 74 68 20 6e 6f 20 or runs with no
0670: 70 61 74 74 65 72 6e 20 73 65 74 20 66 6f 72 20 pattern set for
0680: 22 20 66 75 6c 6b 65 79 29 0a 09 09 09 28 65 78 " fulkey)....(ex
0690: 69 74 20 36 29 29 29 29 29 0a 09 20 20 20 20 20 it 6)))))..
06a0: 20 6b 65 79 73 29 0a 20 20 20 20 28 73 71 6c 69 keys). (sqli
06b0: 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f 77 te3:for-each-row
06c0: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
06d0: 61 20 2e 20 72 29 0a 20 20 20 20 20 20 20 28 73 a . r). (s
06e0: 65 74 21 20 72 65 73 20 28 63 6f 6e 73 20 28 6c et! res (cons (l
06f0: 69 73 74 2d 3e 76 65 63 74 6f 72 20 28 63 6f 6e ist->vector (con
0700: 73 20 61 20 72 29 29 20 72 65 73 29 29 29 0a 20 s a r)) res))).
0710: 20 20 20 20 64 62 20 0a 20 20 20 20 20 28 63 6f db . (co
0720: 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b 65 79 nc "SELECT " key
0730: 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 str " FROM runs
0740: 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 6c 69 WHERE runname li
0750: 6b 65 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 ke ? " key-patt
0760: 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 6d ";"). runnam
0770: 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 74 epatt). (vect
0780: 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29 29 or header res)))
0790: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
07a0: 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 61 test-get-full-pa
07b0: 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 2a th test). (let*
07c0: 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 3a ((testname (db:
07d0: 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d test-get-testnam
07e0: 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 74 e test)).. (it
07f0: 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d empath (db:test-
0800: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
0810: 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 20 st))). (conc
0820: 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 71 testname (if (eq
0830: 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 22 ual? itempath ""
0840: 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 69 ) "" (conc "(" i
0850: 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 29 tempath ")")))))
0860: 0a 0a 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d ...(define (set-
0870: 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 megatest-env-var
0880: 73 20 64 62 20 72 75 6e 2d 69 64 29 0a 20 20 28 s db run-id). (
0890: 6c 65 74 20 28 28 6b 65 79 73 20 28 72 64 62 3a let ((keys (rdb:
08a0: 67 65 74 2d 6b 65 79 73 20 64 62 29 29 29 0a 20 get-keys db))).
08b0: 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 (for-each (la
08c0: 6d 62 64 61 20 28 6b 65 79 29 0a 09 09 28 73 71 mbda (key)...(sq
08d0: 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 lite3:for-each-r
08e0: 6f 77 0a 09 09 20 28 6c 61 6d 62 64 61 20 28 76 ow... (lambda (v
08f0: 61 6c 29 0a 09 09 20 20 20 28 64 65 62 75 67 3a al)... (debug:
0900: 70 72 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 print 2 "setenv
0910: 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 " (key:get-field
0920: 6e 61 6d 65 20 6b 65 79 29 20 22 20 22 20 76 61 name key) " " va
0930: 6c 29 0a 09 09 20 20 20 28 73 65 74 65 6e 76 20 l)... (setenv
0940: 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 (key:get-fieldna
0950: 6d 65 20 6b 65 79 29 20 76 61 6c 29 29 0a 09 09 me key) val))...
0960: 20 64 62 20 0a 09 09 20 28 63 6f 6e 63 20 22 53 db ... (conc "S
0970: 45 4c 45 43 54 20 22 20 28 6b 65 79 3a 67 65 74 ELECT " (key:get
0980: 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 -fieldname key)
0990: 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 " FROM runs WHER
09a0: 45 20 69 64 3d 3f 3b 22 29 0a 09 09 20 72 75 6e E id=?;")... run
09b0: 2d 69 64 29 29 0a 09 20 20 20 20 20 20 6b 65 79 -id)).. key
09c0: 73 29 0a 20 20 20 20 28 61 6c 69 73 74 2d 3e 65 s). (alist->e
09d0: 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d 74 61 nv-vars (hash-ta
09e0: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
09f0: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 6e 76 *configdat* "env
0a00: 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 29 29 -override" '()))
0a10: 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 73 65 . ;; Lets use
0a20: 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 70 6f this as an oppo
0a30: 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 20 4d rtunity to put M
0a40: 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 68 65 T_RUNNAME in the
0a50: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 environment.
0a60: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 (sqlite3:for-ea
0a70: 63 68 2d 72 6f 77 0a 20 20 20 20 20 28 6c 61 6d ch-row. (lam
0a80: 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 0a 20 20 bda (runname).
0a90: 20 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 (setenv "MT
0aa0: 5f 52 55 4e 4e 41 4d 45 22 20 72 75 6e 6e 61 6d _RUNNAME" runnam
0ab0: 65 29 29 0a 20 20 20 20 20 64 62 0a 20 20 20 20 e)). db.
0ac0: 20 22 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 "SELECT runname
0ad0: 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 FROM runs WHERE
0ae0: 20 69 64 3d 3f 3b 22 0a 20 20 20 20 20 72 75 6e id=?;". run
0af0: 2d 69 64 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 -id). ))..(de
0b00: 66 69 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 fine (set-item-e
0b10: 6e 76 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 nv-vars itemdat)
0b20: 0a 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 . (for-each (la
0b30: 6d 62 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 mbda (item)..
0b40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
0b50: 32 20 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 2 "setenv " (car
0b60: 20 69 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 item) " " (cadr
0b70: 20 69 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 item)).. (
0b80: 73 65 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d setenv (car item
0b90: 29 20 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a ) (cadr item))).
0ba0: 09 20 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a . itemdat))..
0bb0: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 63 61 (define (runs:ca
0bc0: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
0bd0: 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 db test-record)
0be0: 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f 6e 66 . (let* ((tconf
0bf0: 69 67 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ig
0c00: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
0c10: 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 eue-get-testconf
0c20: 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 ig test-record))
0c30: 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 20 20 .. (jobgroup
0c40: 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e (con
0c50: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 fig-lookup tconf
0c60: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 ig "requirements
0c70: 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 0a 09 " "jobgroup"))..
0c80: 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 20 20 (num-running
0c90: 20 20 20 20 20 20 20 20 20 20 28 64 62 3a 67 65 (db:ge
0ca0: 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 t-count-tests-ru
0cb0: 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 6e 75 nning db)).. (nu
0cc0: 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 m-running-in-job
0cd0: 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d 63 6f group (db:get-co
0ce0: 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e 69 6e unt-tests-runnin
0cf0: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 64 62 g-in-jobgroup db
0d00: 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 28 6d jobgroup)).. (m
0d10: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0d20: 62 73 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c bs (config-l
0d30: 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 ookup *configdat
0d40: 2a 20 22 73 65 74 75 70 22 20 20 20 20 20 22 6d * "setup" "m
0d50: 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f ax_concurrent_jo
0d60: 62 73 22 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f bs")).. (job-gro
0d70: 75 70 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 up-limit
0d80: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
0d90: 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 *configdat* "job
0da0: 67 72 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 groups" jobgroup
0db0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ))). (debug:p
0dc0: 72 69 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 rint 2 "max-conc
0dd0: 75 72 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d urrent-jobs: " m
0de0: 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f ax-concurrent-jo
0df0: 62 73 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e bs ", num-runnin
0e00: 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 g: " num-running
0e10: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ). (if (not (
0e20: 65 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 eq? 0 *globalexi
0e30: 74 73 74 61 74 75 73 2a 29 29 0a 09 23 66 0a 09 tstatus*))..#f..
0e40: 28 6c 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72 (let ((can-not-r
0e50: 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09 un-more (cond...
0e60: 09 09 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e .. ;; if max-con
0e70: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20 current-jobs is
0e80: 73 65 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 set and the numb
0e90: 65 72 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72 er running is gr
0ea0: 65 61 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74 eater ..... ;; t
0eb0: 68 61 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e han it than cann
0ec0: 6f 74 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 ot run more jobs
0ed0: 0a 09 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d ..... ((and max-
0ee0: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 0a concurrent-jobs.
0ef0: 09 09 09 09 20 20 20 20 20 20 20 28 73 74 72 69 .... (stri
0f00: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 ng->number max-c
0f10: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a oncurrent-jobs).
0f20: 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e .... (>= n
0f30: 75 6d 2d 72 75 6e 6e 69 6e 67 20 28 73 74 72 69 um-running (stri
0f40: 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 63 ng->number max-c
0f50: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 29 oncurrent-jobs))
0f60: 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 )..... (debug:p
0f70: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
0f80: 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a 6f 62 Max running job
0f90: 73 20 65 78 63 65 65 64 65 64 2c 20 63 75 72 72 s exceeded, curr
0fa0: 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e 6e 69 ent number runni
0fb0: 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e ng: " num-runnin
0fc0: 67 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 g ...... "
0fd0: 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 , max_concurrent
0fe0: 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 6f 6e _jobs: " max-con
0ff0: 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a 09 09 current-jobs)...
1000: 09 09 20 20 23 74 29 0a 09 09 09 09 20 3b 3b 20 .. #t)..... ;;
1010: 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d if job-group-lim
1020: 69 74 20 69 73 20 73 65 74 20 61 6e 64 20 6e 75 it is set and nu
1030: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 69 6e 20 mber of jobs in
1040: 74 68 65 20 67 72 6f 75 70 20 69 73 20 67 72 65 the group is gre
1050: 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 74 68 61 ater..... ;; tha
1060: 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 68 65 6e n the limit then
1070: 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 cannot run more
1080: 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 20 6b 69 jobs of this ki
1090: 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 20 6a 6f nd..... ((and jo
10a0: 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a 09 09 b-group-limit...
10b0: 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e 75 6d .. (>= num
10c0: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 -running-in-jobg
10d0: 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c roup job-group-l
10e0: 69 6d 69 74 29 29 0a 09 09 09 09 20 20 28 64 65 imit))..... (de
10f0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 bug:print 1 "WAR
1100: 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f 66 20 NING: number of
1110: 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 jobs " num-runni
1120: 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 0a ng-in-jobgroup .
1130: 09 09 09 09 09 20 20 20 20 20 20 20 22 20 69 6e ..... " in
1140: 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 20 65 78 " jobgroup " ex
1150: 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e 6f 74 ceeded, will not
1160: 20 72 75 6e 20 22 20 28 74 65 73 74 73 3a 74 65 run " (tests:te
1170: 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 stqueue-get-test
1180: 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 name test-record
1190: 29 29 0a 09 09 09 09 20 20 23 74 29 0a 09 09 09 ))..... #t)....
11a0: 09 20 28 65 6c 73 65 20 23 66 29 29 29 29 0a 09 . (else #f))))..
11b0: 20 20 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 (not can-not-r
11c0: 75 6e 2d 6d 6f 72 65 29 29 29 29 29 0a 0a 3b 3b un-more)))))..;;
11d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
11e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
11f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1200: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1210: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d 65 ======.;; New me
1220: 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 65 thodology. These
1230: 20 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 72 routines will r
1240: 65 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 65 eplace the above
1250: 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b 3b in time. For.;;
1260: 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 73 now the code is
1270: 20 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 69 duplicated. Thi
1280: 73 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 69 s stuff is initi
1290: 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 65 ally used in the
12a0: 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 65 monitor.;; base
12b0: 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d 3d d code..;;======
12c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
12f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1300: 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 20 ..;; register a
1310: 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 68 test run with th
1320: 65 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 75 e db.(define (ru
1330: 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e 20 ns:register-run
1340: 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 db keys keyvalls
1350: 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 t runname state
1360: 73 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 28 status user). (
1370: 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 72 debug:print 3 "r
1380: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e uns:register-run
1390: 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 22 , keys: " keys "
13a0: 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 keyvallst: " ke
13b0: 79 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 6d yvallst " runnam
13c0: 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 73 e: " runname " s
13d0: 74 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 20 tate: " state "
13e0: 73 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 73 status: " status
13f0: 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 " user: " user)
1400: 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 74 . (let* ((keyst
1410: 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 73 r (keys->keys
1420: 74 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f 6d tr keys)).. (com
1430: 6d 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 6c ma (if (> (l
1440: 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 ength keys) 0) "
1450: 2c 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 74 ," "")).. (andst
1460: 72 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e r (if (> (len
1470: 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 41 gth keys) 0) " A
1480: 4e 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 6c ND " "")).. (val
1490: 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 61 slots (keys->va
14a0: 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b 3b lslots keys)) ;;
14b0: 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b 65 ?,?,? ..... (ke
14c0: 79 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 64 yvals (map cad
14d0: 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 20 r keyvallst))..
14e0: 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 65 (allvals (appe
14f0: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
1500: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73 state status us
1510: 65 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 er) keyvals))..
1520: 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 65 (qryvals (appe
1530: 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d 65 nd (list runname
1540: 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 6b ) keyvals)).. (k
1550: 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e 67 ey=?str (string
1560: 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 -intersperse (ma
1570: 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 6f p (lambda (k)(co
1580: 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 6c nc (key:get-fiel
1590: 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 20 dname k) "=?"))
15a0: 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 29 keys) " AND ")))
15b0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
15c0: 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 79 t 3 "keys: " key
15d0: 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 61 s " allvals: " a
15e0: 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c 73 llvals " keyvals
15f0: 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 20 : " keyvals).
1600: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
1610: 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 72 "NOTE: using tar
1620: 67 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 6e get " (string-in
1630: 74 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 6c tersperse keyval
1640: 73 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 69 s "/") " for thi
1650: 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 20 s run"). (if
1660: 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e 75 (and runname (nu
1670: 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 6d ll? (filter (lam
1680: 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 20 bda (x)(not x))
1690: 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 68 keyvals))) ;; th
16a0: 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 65 ere must be a be
16b0: 74 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 70 tter way to "app
16c0: 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 28 ly and"..(let ((
16d0: 72 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 70 res #f)).. (app
16e0: 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 75 ly sqlite3:execu
16f0: 74 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e 53 te db (conc "INS
1700: 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 4e ERT OR IGNORE IN
1710: 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d 65 TO runs (runname
1720: 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f 77 ,state,status,ow
1730: 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 20 ner,event_time"
1740: 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 20 comma keystr ")
1750: 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c VALUES (?,?,?,?,
1760: 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 6e strftime('%s','n
1770: 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c 73 ow')" comma vals
1780: 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 6c lots ");")... al
1790: 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c 79 lvals).. (apply
17a0: 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 63 sqlite3:for-eac
17b0: 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d 62 h-row .. (lamb
17c0: 64 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 73 da (id).. (s
17d0: 65 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 20 et! res id))..
17e0: 20 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 71 db.. (let ((q
17f0: 72 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 ry (conc "SELECT
1800: 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 48 id FROM runs WH
1810: 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 22 ERE (runname=? "
1820: 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 72 andstr key=?str
1830: 20 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 3b ");"))).. ;
1840: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
1850: 71 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 20 qry: " qry) ..
1860: 20 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 76 qry).. qryv
1870: 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 33 als).. (sqlite3
1880: 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 44 :execute db "UPD
1890: 41 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 61 ATE runs SET sta
18a0: 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 48 te=?,status=? WH
18b0: 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 65 ERE id=?;" state
18c0: 20 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 20 status res)..
18d0: 72 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 20 res) ..(begin..
18e0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
18f0: 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 77 "ERROR: Called w
1900: 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 73 ithout all neces
1910: 73 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 23 sary keys").. #
1920: 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 69 f))))..;; This i
1930: 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f 66 s a duplicate of
1940: 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 63 run-tests (whic
1950: 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 65 h has been depre
1960: 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 73 cated). Use this
1970: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20 one instead of
1980: 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b 65 run tests..;; ke
1990: 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 72 yvals.(define (r
19a0: 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 64 62 uns:run-tests db
19b0: 20 74 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 target runname
19c0: 74 65 73 74 2d 70 61 74 74 73 20 75 73 65 72 20 test-patts user
19d0: 66 6c 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 flags). (let* (
19e0: 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 72 64 (keys (rd
19f0: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b:get-keys db)).
1a00: 09 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 . (keyvallst (
1a10: 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 keys:target->key
1a20: 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 val keys target)
1a30: 29 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 ).. (run-id
1a40: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d (runs:register-
1a50: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
1a60: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
1a70: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
1a80: 20 20 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 ;; test-name)
1a90: 29 29 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 )).. (deferred
1aa0: 20 20 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 '()) ;; delay
1ab0: 72 75 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 running these si
1ac0: 6e 63 65 20 74 68 65 79 20 68 61 76 65 20 61 20 nce they have a
1ad0: 77 61 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 waiton clause..
1ae0: 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 ;; keepgoing is
1af0: 74 68 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 the defacto moda
1b00: 6c 69 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 lity now, will a
1b10: 64 64 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 dd hit-n-run a b
1b20: 69 74 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b it later.. ;; (k
1b30: 65 65 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 eepgoing (hash
1b40: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
1b50: 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 lt flags "-keepg
1b60: 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65 oing" #f)).. (te
1b70: 73 74 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09 st-names '())..
1b80: 20 28 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 (runconfigf (
1b90: 63 6f 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 conc *toppath*
1ba0: 22 2f 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e "/runconfigs.con
1bb0: 66 69 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 fig")).. (requir
1bc0: 65 64 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20 ed-tests '())..
1bd0: 28 74 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d (test-records (m
1be0: 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 ake-hash-table))
1bf0: 29 0a 0a 20 20 20 20 28 73 65 74 2d 6d 65 67 61 ).. (set-mega
1c00: 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 test-env-vars db
1c10: 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 run-id) ;; thes
1c20: 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 e may be needed
1c30: 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 by the launching
1c40: 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 20 28 69 process.. (i
1c50: 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 f (file-exists?
1c60: 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 28 73 65 runconfigf)..(se
1c70: 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c 74 73 tup-env-defaults
1c80: 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 20 72 db runconfigf r
1c90: 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 2d 73 un-id *already-s
1ca0: 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d 69 6e een-runconfig-in
1cb0: 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 68 2d fo* "pre-launch-
1cc0: 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 65 62 env-vars")..(deb
1cd0: 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e ug:print 0 "WARN
1ce0: 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f 74 20 ING: You do not
1cf0: 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e 66 69 have a run confi
1d00: 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 6f 6e g file: " runcon
1d10: 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 20 20 figf)). .
1d20: 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 ;; look up all t
1d30: 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 74 68 ests matching th
1d40: 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 e comma separate
1d50: 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 73 20 d list of globs
1d60: 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 2d 70 in. ;; test-p
1d70: 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 61 73 atts (using % as
1d80: 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 20 28 wildcard). (
1d90: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 for-each . (
1da0: 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a 20 20 lambda (patt).
1db0: 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74 (let ((test
1dc0: 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 2a 74 s (glob (conc *t
1dd0: 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f oppath* "/tests/
1de0: 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e 73 6c " (string-transl
1df0: 61 74 65 20 70 61 74 74 20 22 25 22 20 22 2a 22 ate patt "%" "*"
1e00: 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 74 65 ))))).. (set! te
1e10: 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c 61 6d sts (filter (lam
1e20: 62 64 61 20 28 74 65 73 74 29 28 66 69 6c 65 2d bda (test)(file-
1e30: 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 74 65 exists? (conc te
1e40: 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 22 st "/testconfig"
1e50: 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 28 73 ))) tests)).. (s
1e60: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 et! test-names (
1e70: 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 6d 65 append test-name
1e80: 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 28 6c s ..... (map (l
1e90: 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a 09 09 ambda (testp)...
1ea0: 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 69 6e ... (last (strin
1eb0: 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 22 2f g-split testp "/
1ec0: 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 20 20 "))).....
1ed0: 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 20 20 tests))))).
1ee0: 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 20 28 (if test-patts (
1ef0: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 string-split tes
1f00: 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c 69 73 t-patts ",")(lis
1f10: 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 20 3b t "%"))).. ;
1f20: 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 75 70 ; now remove dup
1f30: 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 65 74 licates. (set
1f40: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 64 65 ! test-names (de
1f50: 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 20 lete-duplicates
1f60: 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a 20 20 test-names))..
1f70: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
1f80: 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 61 6d "INFO: test nam
1f90: 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 73 29 es " test-names)
1fa0: 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 65 20 .. ;; on the
1fb0: 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 63 61 first pass or ca
1fc0: 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 73 20 ll to run-tests
1fd0: 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e 4f 54 set FAILS to NOT
1fe0: 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 20 20 _STARTED if.
1ff0: 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 69 73 ;; -keepgoing is
2000: 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 28 specified. (
2010: 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e 75 6d if (eq? *passnum
2020: 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 * 0)..(begin..
2030: 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c 65 74 ;; have to delet
2040: 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 20 77 e test records w
2050: 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 45 44 here NOT_STARTED
2060: 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 6e 20 since they can
2070: 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 6e 67 cause -keepgoing
2080: 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 20 73 to .. ;; get s
2090: 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 63 6f tuck due to beco
20a0: 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 62 6c ming inaccessibl
20b0: 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 64 20 e from a failed
20c0: 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 74 65 test. I.e. if te
20d0: 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a 09 20 st B depends ..
20e0: 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 62 75 ;; on test A bu
20f0: 74 20 74 65 73 74 20 42 20 72 65 61 63 68 65 64 t test B reached
2100: 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 62 65 the point on be
2110: 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 20 61 ing registered a
2120: 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 61 6e s NOT_STARTED an
2130: 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 20 66 d test.. ;; A f
2140: 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 20 72 ailed for some r
2150: 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 72 65 eason then on re
2160: 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 65 70 -run using -keep
2170: 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 63 61 going the run ca
2180: 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 74 65 n never complete
2190: 2e 0a 09 20 20 28 64 62 3a 64 65 6c 65 74 65 2d ... (db:delete-
21a0: 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 64 tests-in-state d
21b0: 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 54 b run-id "NOT_ST
21c0: 41 52 54 45 44 22 29 0a 09 20 20 28 72 64 62 3a ARTED").. (rdb:
21d0: 73 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d set-tests-state-
21e0: 73 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 status db run-id
21f0: 20 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 test-names #f "
2200: 46 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 FAIL" "NOT_START
2210: 45 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 ED" "FAIL")))..
2220: 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 6e 6f ;; now add no
2230: 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 65 72 n-directly refer
2240: 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e 63 69 enced dependenci
2250: 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f 6e 29 es (i.e. waiton)
2260: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
2270: 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 73 29 ull? test-names)
2280: 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 )..(let loop ((h
2290: 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e 61 6d ed (car test-nam
22a0: 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c 20 28 es))... (tal (
22b0: 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 cdr test-names))
22c0: 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 72 65 ) ;; 're
22d0: 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c 6c 73 turn-procs tells
22e0: 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 61 64 the config read
22f0: 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e 6e 69 er to prep runni
2300: 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 72 65 ng system but re
2310: 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 20 28 turn a proc.. (
2320: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 let* ((config (
2330: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f tests:get-testco
2340: 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e nfig hed 'return
2350: 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69 -procs))... (wai
2360: 74 6f 6e 73 20 28 73 74 72 69 6e 67 2d 73 70 6c tons (string-spl
2370: 69 74 20 28 6c 65 74 20 28 28 77 20 28 63 6f 6e it (let ((w (con
2380: 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 fig-lookup confi
2390: 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 g "requirements"
23a0: 20 22 77 61 69 74 6f 6e 22 29 29 29 0a 09 09 09 "waiton")))....
23b0: 09 09 20 20 28 69 66 20 77 20 77 20 22 22 29 29 .. (if w w ""))
23c0: 29 29 29 0a 09 20 20 20 20 3b 3b 20 28 69 74 65 ))).. ;; (ite
23d0: 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 65 74 2d ms (items:get-
23e0: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 items-from-confi
23f0: 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 20 20 20 g config)))..
2400: 20 28 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d (if (not (hash-
2410: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
2420: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 t test-records h
2430: 65 64 20 23 66 29 29 0a 09 09 28 68 61 73 68 2d ed #f))...(hash-
2440: 74 61 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d table-set! test-
2450: 72 65 63 6f 72 64 73 0a 09 09 09 09 20 68 65 64 records..... hed
2460: 20 28 76 65 63 74 6f 72 20 68 65 64 20 20 20 20 (vector hed
2470: 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 20 20 20 ;; 0......
2480: 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a 09 09 09 config ;; 1....
2490: 09 09 20 20 20 20 20 77 61 69 74 6f 6e 73 20 3b .. waitons ;
24a0: 3b 20 32 0a 09 09 09 09 09 20 20 20 20 20 28 63 ; 2...... (c
24b0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e onfig-lookup con
24c0: 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 fig "requirement
24d0: 73 22 20 22 70 72 69 6f 72 69 74 79 22 29 20 20 s" "priority")
24e0: 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 79 20 33 ;; priority 3
24f0: 0a 09 09 09 09 09 20 20 20 20 20 28 6c 65 74 20 ...... (let
2500: 28 28 69 74 65 6d 73 20 20 20 20 20 20 28 68 61 ((items (ha
2510: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
2520: 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 ault config "ite
2530: 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 74 65 6d ms" #f)) ;; item
2540: 73 20 34 0a 09 09 09 09 09 09 20 20 20 28 69 74 s 4....... (it
2550: 65 6d 73 74 61 62 6c 65 20 28 68 61 73 68 2d 74 emstable (hash-t
2560: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
2570: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 74 61 config "itemsta
2580: 62 6c 65 22 20 23 66 29 29 29 20 0a 09 09 09 09 ble" #f))) .....
2590: 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 65 69 . ;; if ei
25a0: 74 68 65 72 20 69 74 65 6d 73 20 6f 72 20 69 74 ther items or it
25b0: 65 6d 73 20 74 61 62 6c 65 20 69 73 20 61 20 70 ems table is a p
25c0: 72 6f 63 20 72 65 74 75 72 6e 20 69 74 20 73 6f roc return it so
25d0: 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 0a 09 09 test running...
25e0: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 70 72 6f ... ;; pro
25f0: 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 20 74 6f cess can know to
2600: 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 65 74 2d call items:get-
2610: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 items-from-confi
2620: 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b g...... ;;
2630: 20 69 66 20 65 69 74 68 65 72 20 69 73 20 61 20 if either is a
2640: 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 20 69 73 list and none is
2650: 20 61 20 70 72 6f 63 20 67 6f 20 61 68 65 61 64 a proc go ahead
2660: 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 2d 69 74 and call get-it
2670: 65 6d 73 0a 09 09 09 09 09 20 20 20 20 20 20 20 ems......
2680: 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 72 65 74 ;; otherwise ret
2690: 75 72 6e 20 23 66 20 2d 20 74 68 69 73 20 69 73 urn #f - this is
26a0: 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 74 65 64 not an iterated
26b0: 20 74 65 73 74 0a 09 09 09 09 09 20 20 20 20 20 test......
26c0: 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 09 28 28 (cond.......((
26d0: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
26e0: 29 20 20 20 20 20 20 0a 09 09 09 09 09 09 20 28 ) ....... (
26f0: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 debug:print 4 "I
2700: 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73 20 61 20 NFO: items is a
2710: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 procedure, will
2720: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09 calc later")....
2730: 09 09 09 20 69 74 65 6d 73 29 20 20 20 20 20 20 ... items)
2740: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 ;; calc la
2750: 74 65 72 0a 09 09 09 09 09 09 28 28 70 72 6f 63 ter.......((proc
2760: 65 64 75 72 65 3f 20 69 74 65 6d 73 74 61 62 6c edure? itemstabl
2770: 65 29 0a 09 09 09 09 09 09 20 28 64 65 62 75 67 e)....... (debug
2780: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 :print 4 "INFO:
2790: 69 74 65 6d 73 74 61 62 6c 65 20 69 73 20 61 20 itemstable is a
27a0: 70 72 6f 63 65 64 75 72 65 2c 20 77 69 6c 6c 20 procedure, will
27b0: 63 61 6c 63 20 6c 61 74 65 72 22 29 0a 09 09 09 calc later")....
27c0: 09 09 09 20 69 74 65 6d 73 74 61 62 6c 65 29 20 ... itemstable)
27d0: 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 20 6c 61 ;; calc la
27e0: 74 65 72 0a 09 09 09 09 09 09 28 28 66 69 6c 74 ter.......((filt
27f0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 09 er (lambda (x)..
2800: 09 09 09 09 09 09 20 20 20 28 6c 65 74 20 28 28 ...... (let ((
2810: 76 61 6c 20 28 63 61 72 20 78 29 29 29 0a 09 09 val (car x)))...
2820: 09 09 09 09 09 20 20 20 20 20 28 69 66 20 28 70 ..... (if (p
2830: 72 6f 63 65 64 75 72 65 3f 20 76 61 6c 29 20 76 rocedure? val) v
2840: 61 6c 20 23 66 29 29 29 0a 09 09 09 09 09 09 09 al #f)))........
2850: 20 28 61 70 70 65 6e 64 20 28 69 66 20 28 6c 69 (append (if (li
2860: 73 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 73 st? items) items
2870: 20 27 28 29 29 0a 09 09 09 09 09 09 09 09 20 28 '())......... (
2880: 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 74 if (list? itemst
2890: 61 62 6c 65 29 20 69 74 65 6d 73 74 61 62 6c 65 able) itemstable
28a0: 20 27 28 29 29 29 29 0a 09 09 09 09 09 09 20 27 '())))....... '
28b0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a have-procedure).
28c0: 09 09 09 09 09 09 28 28 6f 72 20 28 6c 69 73 74 ......((or (list
28d0: 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 3f 20 69 ? items)(list? i
28e0: 74 65 6d 73 74 61 62 6c 65 29 29 20 3b 3b 20 63 temstable)) ;; c
28f0: 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 09 20 28 alc now....... (
2900: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 debug:print 4 "I
2910: 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e 64 20 69 NFO: items and i
2920: 74 65 6d 73 74 61 62 6c 65 20 61 72 65 20 6c 69 temstable are li
2930: 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 sts, calc now\n"
2940: 0a 09 09 09 09 09 09 09 20 20 20 20 20 20 22 20 ........ "
2950: 20 20 20 69 74 65 6d 73 3a 20 22 20 69 74 65 6d items: " item
2960: 73 20 22 20 69 74 65 6d 73 74 61 62 6c 65 3a 20 s " itemstable:
2970: 22 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 09 " itemstable)...
2980: 09 09 09 09 20 28 69 74 65 6d 73 3a 67 65 74 2d .... (items:get-
2990: 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 items-from-confi
29a0: 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 09 09 09 g config))......
29b0: 09 28 65 6c 73 65 20 23 66 29 29 29 20 20 20 20 .(else #f)))
29c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29d0: 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 20 69 74 ;; not it
29e0: 65 72 61 74 65 64 0a 09 09 09 09 09 20 20 20 20 erated......
29f0: 20 23 66 20 20 20 20 20 20 3b 3b 20 69 74 65 6d #f ;; item
2a00: 73 64 61 74 20 35 0a 09 09 09 09 09 20 20 20 20 sdat 5......
2a10: 20 23 66 20 20 20 20 20 20 3b 3b 20 73 70 61 72 #f ;; spar
2a20: 65 20 2d 20 75 73 65 64 20 66 6f 72 20 69 74 65 e - used for ite
2a30: 6d 2d 70 61 74 68 0a 09 09 09 09 09 20 20 20 20 m-path......
2a40: 20 29 29 29 0a 09 20 20 20 20 28 66 6f 72 2d 65 ))).. (for-e
2a50: 61 63 68 20 0a 09 20 20 20 20 20 28 6c 61 6d 62 ach .. (lamb
2a60: 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 20 20 20 da (waiton)..
2a70: 20 20 20 20 28 69 66 20 28 61 6e 64 20 77 61 69 (if (and wai
2a80: 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d 62 65 72 ton (not (member
2a90: 20 77 61 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d waiton test-nam
2aa0: 65 73 29 29 29 0a 09 09 20 20 20 28 62 65 67 69 es)))... (begi
2ab0: 6e 0a 09 09 20 20 20 20 20 28 73 65 74 21 20 72 n... (set! r
2ac0: 65 71 75 69 72 65 64 2d 74 65 73 74 73 20 28 63 equired-tests (c
2ad0: 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 71 75 69 ons waiton requi
2ae0: 72 65 64 2d 74 65 73 74 73 29 29 0a 09 09 20 20 red-tests))...
2af0: 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 6e 61 (set! test-na
2b00: 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e mes (cons waiton
2b10: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 29 29 test-names)))))
2b20: 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 70 65 6e ;; was an appen
2b30: 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 0a 09 20 d, now a cons..
2b40: 20 20 20 20 77 61 69 74 6f 6e 73 29 0a 09 20 20 waitons)..
2b50: 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 (let ((remtest
2b60: 73 20 28 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 s (delete-duplic
2b70: 61 74 65 73 20 28 61 70 70 65 6e 64 20 77 61 69 ates (append wai
2b80: 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a 09 20 20 tons tal))))..
2b90: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
2ba0: 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 29 0a 09 ll? remtests))..
2bb0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 72 65 . (loop (car re
2bc0: 6d 74 65 73 74 73 29 28 63 64 72 20 72 65 6d 74 mtests)(cdr remt
2bd0: 65 73 74 73 29 29 29 29 29 29 29 0a 0a 20 20 20 ests)))))))..
2be0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
2bf0: 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 required-tests)
2c00: 29 0a 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 )..(debug:print
2c10: 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 6e 67 20 1 "INFO: Adding
2c20: 22 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 " required-tests
2c30: 20 22 20 74 6f 20 74 68 65 20 72 75 6e 20 71 75 " to the run qu
2c40: 65 75 65 22 29 29 0a 20 20 20 20 3b 3b 20 4e 4f eue")). ;; NO
2c50: 54 45 3a 20 74 68 65 73 65 20 61 72 65 20 61 6c TE: these are al
2c60: 6c 20 70 61 72 65 6e 74 20 74 65 73 74 73 2c 20 l parent tests,
2c70: 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 20 65 78 items are not ex
2c80: 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 20 20 20 panded yet..
2c90: 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d (runs:run-tests-
2ca0: 71 75 65 75 65 20 64 62 20 72 75 6e 2d 69 64 20 queue db run-id
2cb0: 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 runname test-rec
2cc0: 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 ords keyvallst f
2cd0: 6c 61 67 73 29 0a 20 20 20 20 28 69 66 20 2a 72 lags). (if *r
2ce0: 70 63 3a 6c 69 73 74 65 6e 65 72 2a 20 28 73 65 pc:listener* (se
2cf0: 72 76 65 72 3a 6b 65 65 70 2d 72 75 6e 6e 69 6e rver:keep-runnin
2d00: 67 20 64 62 29 29 0a 20 20 20 20 28 64 65 62 75 g db)). (debu
2d10: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a g:print 4 "INFO:
2d20: 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 All done by her
2d30: 65 22 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 e")))..;; test-r
2d40: 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 73 68 ecords is a hash
2d50: 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a table testname:
2d60: 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63 item_path => vec
2d70: 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 74 tor < testname t
2d80: 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e estconfig waiton
2d90: 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d 73 s priority items
2da0: 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 -info ... >.(def
2db0: 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 ine (runs:run-te
2dc0: 73 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e sts-queue db run
2dd0: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
2de0: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c -records keyvall
2df0: 73 74 20 66 6c 61 67 73 29 0a 20 20 20 20 3b 3b st flags). ;;
2e00: 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 At this point t
2e10: 68 65 20 6c 69 73 74 20 6f 66 20 70 61 72 65 6e he list of paren
2e20: 74 20 74 65 73 74 73 20 69 73 20 65 78 70 61 6e t tests is expan
2e30: 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e 42 2f 2f ded . ;; NB//
2e40: 20 53 68 6f 75 6c 64 20 65 78 70 61 6e 64 20 69 Should expand i
2e50: 74 65 6d 73 20 68 65 72 65 20 61 6e 64 20 74 68 tems here and th
2e60: 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 6f 20 74 en insert into t
2e70: 68 65 20 72 75 6e 20 71 75 65 75 65 2e 0a 20 20 he run queue..
2e80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 (debug:print 5 "
2e90: 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 20 22 20 test-records: "
2ea0: 74 65 73 74 2d 72 65 63 6f 72 64 73 20 22 2c 20 test-records ",
2eb0: 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 keyvallst: " key
2ec0: 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 73 3a 20 vallst " flags:
2ed0: 22 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 " (hash-table->a
2ee0: 6c 69 73 74 20 66 6c 61 67 73 29 29 0a 20 20 28 list flags)). (
2ef0: 6c 65 74 20 28 28 73 6f 72 74 65 64 2d 74 65 73 let ((sorted-tes
2f00: 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 73 3a 73 t-names (tests:s
2f10: 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 74 79 2d ort-by-priority-
2f20: 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 73 74 2d and-waiton test-
2f30: 72 65 63 6f 72 64 73 29 29 0a 09 28 69 74 65 6d records))..(item
2f40: 2d 70 61 74 74 73 20 20 20 20 20 20 20 20 28 68 -patts (h
2f50: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
2f60: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 69 74 fault flags "-it
2f70: 65 6d 70 61 74 74 22 20 23 66 29 29 29 0a 20 20 empatt" #f))).
2f80: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c (if (not (null
2f90: 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 ? sorted-test-na
2fa0: 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 mes))..(let loop
2fb0: 20 28 3b 20 28 6e 75 6d 74 69 6d 65 73 20 30 29 (; (numtimes 0)
2fc0: 20 3b 3b 20 73 68 6f 75 6c 64 6e 27 74 20 6e 65 ;; shouldn't ne
2fd0: 65 64 20 74 68 69 73 0a 09 09 20 20 20 28 68 65 ed this... (he
2fe0: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73 d (car s
2ff0: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 orted-test-names
3000: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 ))... (tal
3010: 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 (cdr sorted
3020: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 09 -test-names)))..
3030: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 (let* ((test-r
3040: 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c ecord (hash-tabl
3050: 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 e-ref test-recor
3060: 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 63 6f ds hed))... (tco
3070: 6e 66 69 67 20 20 20 20 20 28 74 65 73 74 73 3a nfig (tests:
3080: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
3090: 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 stconfig test-re
30a0: 63 6f 72 64 29 29 0a 09 09 20 28 77 61 69 74 6f cord))... (waito
30b0: 6e 73 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 ns (tests:te
30c0: 73 74 71 75 65 75 65 2d 67 65 74 2d 77 61 69 74 stqueue-get-wait
30d0: 6f 6e 73 20 20 20 20 74 65 73 74 2d 72 65 63 6f ons test-reco
30e0: 72 64 29 29 0a 09 09 20 28 70 72 69 6f 72 69 74 rd))... (priorit
30f0: 79 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 y (tests:test
3100: 71 75 65 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 queue-get-priori
3110: 74 79 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 ty test-record
3120: 29 29 0a 09 09 20 28 69 74 65 6d 64 61 74 20 20 ))... (itemdat
3130: 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 (tests:testqu
3140: 65 75 65 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 eue-get-itemdat
3150: 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 test-record))
3160: 20 3b 3b 20 69 74 65 6d 64 61 74 20 63 61 6e 20 ;; itemdat can
3170: 62 65 20 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 be a string, lis
3180: 74 20 6f 72 20 23 66 0a 09 09 20 28 69 74 65 6d t or #f... (item
3190: 73 20 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 s (tests:t
31a0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 estqueue-get-ite
31b0: 6d 73 20 20 20 20 20 20 74 65 73 74 2d 72 65 63 ms test-rec
31c0: 6f 72 64 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 ord))... (item-p
31d0: 61 74 68 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 ath (item-list
31e0: 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 ->path itemdat))
31f0: 29 0a 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ).. (debug:pr
3200: 69 6e 74 20 36 0a 09 09 09 20 22 69 74 65 6d 64 int 6.... "itemd
3210: 61 74 3a 20 20 20 20 20 22 20 69 74 65 6d 64 61 at: " itemda
3220: 74 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d 73 t.... "\n items
3230: 3a 20 20 20 20 20 22 20 69 74 65 6d 73 0a 09 09 : " items...
3240: 09 20 22 5c 6e 20 20 69 74 65 6d 2d 70 61 74 68 . "\n item-path
3250: 3a 20 22 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 : " item-path)..
3260: 20 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 20 (cond..
3270: 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 ((not items) ;;
3280: 77 68 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 when false the t
3290: 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 est is ok to be
32a0: 68 61 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 handed off to la
32b0: 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 unch (but not be
32c0: 66 6f 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65 fore).. (le
32d0: 74 20 28 28 68 61 76 65 2d 72 65 73 6f 75 72 63 t ((have-resourc
32e0: 65 73 20 20 28 72 75 6e 73 3a 63 61 6e 2d 72 75 es (runs:can-ru
32f0: 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 20 64 62 20 n-more-tests db
3300: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b test-record)) ;;
3310: 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 65 73 look at the tes
3320: 74 20 6a 6f 62 67 72 6f 75 70 20 61 6e 64 20 74 t jobgroup and t
3330: 6f 74 20 6a 6f 62 73 20 72 75 6e 6e 69 6e 67 0a ot jobs running.
3340: 09 09 20 20 20 20 28 70 72 65 72 65 71 73 2d 6e .. (prereqs-n
3350: 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 74 2d 70 ot-met (db:get-p
3360: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 rereqs-not-met d
3370: 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 b run-id waitons
3380: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 09 item-path)))...
3390: 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 ;; Don't know at
33a0: 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 68 this time if th
33b0: 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65 6e e test have been
33c0: 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f 6d launched at som
33d0: 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 61 e time in the pa
33e0: 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 20 st...;; i.e. is
33f0: 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 68 this a re-launch
3400: 3f 0a 09 09 28 69 66 20 28 61 6e 64 20 68 61 76 ?...(if (and hav
3410: 65 2d 72 65 73 6f 75 72 63 65 73 0a 09 09 09 20 e-resources....
3420: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e (null? prereqs-n
3430: 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 20 20 3b ot-met))... ;
3440: 3b 20 6e 6f 20 6c 6f 6f 70 20 2d 20 64 72 6f 70 ; no loop - drop
3450: 20 74 68 6f 75 67 68 20 61 6e 64 20 75 73 65 20 though and use
3460: 74 68 65 20 6c 6f 6f 70 20 61 74 20 74 68 65 20 the loop at the
3470: 62 6f 74 74 6f 6d 20 0a 09 09 20 20 20 20 28 69 bottom ... (i
3480: 66 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 f (patt-list-mat
3490: 63 68 20 69 74 65 6d 2d 70 61 74 68 20 69 74 65 ch item-path ite
34a0: 6d 2d 70 61 74 74 73 29 0a 09 09 09 28 72 75 6e m-patts)....(run
34b0: 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 :test db run-id
34c0: 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 runname keyvalls
34d0: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c t test-record fl
34e0: 61 67 73 20 23 66 29 0a 09 09 09 28 64 65 62 75 ags #f)....(debu
34f0: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a g:print 1 "INFO:
3500: 20 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73 Skipping " (tes
3510: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
3520: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 -testname test-r
3530: 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d ecord) " " item-
3540: 70 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65 path " as it doe
3550: 73 6e 27 74 20 6d 61 74 63 68 20 22 20 69 74 65 sn't match " ite
3560: 6d 2d 70 61 74 74 73 29 29 0a 09 09 20 20 20 20 m-patts))...
3570: 3b 3b 20 65 6c 73 65 20 74 68 65 20 72 75 6e 20 ;; else the run
3580: 69 73 20 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 is stuck, tempor
3590: 61 72 69 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 arily or permane
35a0: 6e 74 6c 79 0a 09 09 20 20 20 20 28 6c 65 74 20 ntly... (let
35b0: 28 28 6e 65 77 74 61 6c 20 28 61 70 70 65 6e 64 ((newtal (append
35c0: 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29 tal (list hed))
35d0: 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 63 6f ))... ;; co
35e0: 75 6c 64 6e 27 74 20 72 75 6e 2c 20 74 61 6b 65 uldn't run, take
35f0: 20 61 20 62 72 65 61 74 68 65 72 0a 09 09 20 20 a breather...
3600: 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 (thread-slee
3610: 70 21 20 30 2e 31 29 20 3b 3b 20 6c 6f 6e 67 20 p! 0.1) ;; long
3620: 73 6c 65 65 70 20 68 65 72 65 20 2d 20 6e 6f 20 sleep here - no
3630: 72 65 73 6f 75 72 63 65 73 2c 20 6d 61 79 20 61 resources, may a
3640: 73 20 77 65 6c 6c 20 62 65 20 70 61 74 69 65 6e s well be patien
3650: 74 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 t... (loop
3660: 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 (car newtal)(cdr
3670: 20 6e 65 77 74 61 6c 29 29 29 29 29 29 0a 09 20 newtal))))))..
3680: 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 63 61 .. ;; ca
3690: 73 65 20 77 68 65 72 65 20 61 6e 20 69 74 65 6d se where an item
36a0: 73 20 63 61 6d 65 20 69 6e 20 61 73 20 61 20 6c s came in as a l
36b0: 69 73 74 20 62 65 65 6e 20 70 72 6f 63 65 73 73 ist been process
36c0: 65 64 0a 09 20 20 20 20 20 28 28 61 6e 64 20 28 ed.. ((and (
36d0: 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 20 20 20 list? items)
36e0: 20 3b 3b 20 74 68 75 73 20 77 65 20 6b 6e 6f 77 ;; thus we know
36f0: 20 6f 75 72 20 69 74 65 6d 73 20 61 72 65 20 61 our items are a
3700: 6c 72 65 61 64 79 20 63 61 6c 63 75 6c 61 74 65 lready calculate
3710: 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 20 69 74 d... (not it
3720: 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e 64 20 6e emdat)) ;; and n
3730: 6f 74 20 79 65 74 20 65 78 70 61 6e 64 65 64 20 ot yet expanded
3740: 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 into the list of
3750: 20 74 68 69 6e 67 73 20 74 6f 20 62 65 20 64 6f things to be do
3760: 6e 65 0a 09 20 20 20 20 20 20 28 69 66 20 28 61 ne.. (if (a
3770: 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 nd (>= *verbosit
3780: 79 2a 20 31 29 0a 09 09 20 20 20 20 20 20 20 28 y* 1)... (
3790: 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 > (length items)
37a0: 20 30 29 0a 09 09 20 20 20 20 20 20 20 28 3e 20 0)... (>
37b0: 28 6c 65 6e 67 74 68 20 28 63 61 72 20 69 74 65 (length (car ite
37c0: 6d 73 29 29 20 30 29 29 0a 09 09 20 20 28 70 70 ms)) 0))... (pp
37d0: 20 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 items))..
37e0: 3b 3b 20 28 69 66 20 28 3e 3d 20 2a 76 65 72 62 ;; (if (>= *verb
37f0: 6f 73 69 74 79 2a 20 35 29 0a 09 20 20 20 20 20 osity* 5)..
3800: 20 3b 3b 20 20 20 20 20 28 62 65 67 69 6e 0a 09 ;; (begin..
3810: 20 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 28 ;; (
3820: 70 72 69 6e 74 20 22 69 74 65 6d 73 3a 20 22 29 print "items: ")
3830: 20 20 20 20 20 28 70 70 20 28 69 74 65 6d 2d 61 (pp (item-a
3840: 73 73 6f 63 2d 3e 69 74 65 6d 2d 6c 69 73 74 20 ssoc->item-list
3850: 69 74 65 6d 73 29 29 0a 09 20 20 20 20 20 20 3b items)).. ;
3860: 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 ; (print "
3870: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 29 28 70 itemstable: ")(p
3880: 70 20 28 69 74 65 6d 2d 74 61 62 6c 65 2d 3e 69 p (item-table->i
3890: 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 74 61 tem-list itemsta
38a0: 62 6c 65 29 29 29 29 0a 09 20 20 20 20 20 20 28 ble)))).. (
38b0: 66 6f 72 2d 65 61 63 68 0a 09 20 20 20 20 20 20 for-each..
38c0: 20 28 6c 61 6d 62 64 61 20 28 6d 79 2d 69 74 65 (lambda (my-ite
38d0: 6d 64 61 74 29 0a 09 09 20 28 6c 65 74 2a 20 28 mdat)... (let* (
38e0: 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 (new-test-record
38f0: 20 28 6c 65 74 20 28 28 6e 65 77 72 65 63 20 28 (let ((newrec (
3900: 6d 61 6b 65 2d 74 65 73 74 73 3a 74 65 73 74 71 make-tests:testq
3910: 75 65 75 65 29 29 29 0a 09 09 09 09 09 20 20 20 ueue)))......
3920: 28 76 65 63 74 6f 72 2d 63 6f 70 79 21 20 74 65 (vector-copy! te
3930: 73 74 2d 72 65 63 6f 72 64 20 6e 65 77 72 65 63 st-record newrec
3940: 29 0a 09 09 09 09 09 20 20 20 6e 65 77 72 65 63 )...... newrec
3950: 29 29 0a 09 09 09 28 6d 79 2d 69 74 65 6d 2d 70 ))....(my-item-p
3960: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
3970: 70 61 74 68 20 6d 79 2d 69 74 65 6d 64 61 74 29 path my-itemdat)
3980: 29 29 0a 09 09 20 20 20 28 69 66 20 28 70 61 74 ))... (if (pat
3990: 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 2d t-list-match my-
39a0: 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d 70 item-path item-p
39b0: 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20 20 atts)
39c0: 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 20 ;; yes, we want
39d0: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 20 to process this
39e0: 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f 75 item, NOTE: Shou
39f0: 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 ld not need this
3a00: 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 20 check here!...
3a10: 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 (let ((new
3a20: 74 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 68 testname (conc h
3a30: 65 64 20 22 2f 22 20 6d 79 2d 69 74 65 6d 2d 70 ed "/" my-item-p
3a40: 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 73 ath))) ;; tes
3a50: 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 71 t names are uniq
3a60: 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f 69 ue on testname/i
3a70: 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 65 tem-path.... (te
3a80: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 sts:testqueue-se
3a90: 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 77 t-items! new
3aa0: 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 29 -test-record #f)
3ab0: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 .... (tests:test
3ac0: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 61 queue-set-itemda
3ad0: 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 t! new-test-re
3ae0: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 29 cord my-itemdat)
3af0: 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 .... (tests:test
3b00: 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f 70 queue-set-item_p
3b10: 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 65 ath! new-test-re
3b20: 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 74 cord my-item-pat
3b30: 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 62 h).... (hash-tab
3b40: 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 le-set! test-rec
3b50: 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d 65 ords newtestname
3b60: 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 new-test-record
3b70: 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c 20 ).... (set! tal
3b80: 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 6d (cons newtestnam
3b90: 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 73 e tal)))))) ;; s
3ba0: 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 69 ince these are i
3bb0: 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 6e temized create n
3bc0: 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 65 ew test names te
3bd0: 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 0a stname/itempath.
3be0: 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a 09 . items)..
3bf0: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 (if (not (
3c00: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 20 null? tal))...
3c10: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 (loop (car tal)(
3c20: 63 64 72 20 74 61 6c 29 29 29 29 0a 0a 09 20 20 cdr tal))))...
3c30: 20 20 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 ;; if items i
3c40: 73 20 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 s a proc then ne
3c50: 65 64 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a ed to run items:
3c60: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 get-items-from-c
3c70: 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c onfig, get the l
3c80: 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 ist and loop ..
3c90: 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 ;; - but
3ca0: 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20 only do that if
3cb0: 72 65 73 6f 75 72 63 65 73 20 65 78 69 73 74 20 resources exist
3cc0: 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 to kick off the
3cd0: 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28 job.. ((or (
3ce0: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
3cf0: 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 )(eq? items 'hav
3d00: 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 e-procedure))..
3d10: 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 72 (if (and (r
3d20: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
3d30: 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 2d 72 -tests db test-r
3d40: 65 63 6f 72 64 29 0a 09 09 20 20 20 20 20 20 20 ecord)...
3d50: 28 6e 75 6c 6c 3f 20 28 64 62 3a 67 65 74 2d 70 (null? (db:get-p
3d60: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 64 rereqs-not-met d
3d70: 62 20 72 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 b run-id waitons
3d80: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 09 item-path)))...
3d90: 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 (let ((test-na
3da0: 6d 65 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 me (tests:testqu
3db0: 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 eue-get-testname
3dc0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 29 0a test-record))).
3dd0: 09 09 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d .. (setenv "M
3de0: 54 5f 54 45 53 54 5f 4e 41 4d 45 22 20 74 65 73 T_TEST_NAME" tes
3df0: 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a 09 09 20 20 t-name) ;; ...
3e00: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 (setenv "MT_RU
3e10: 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e 61 6d 65 NNAME" runname
3e20: 29 0a 09 09 20 20 20 20 28 73 65 74 2d 6d 65 67 )... (set-meg
3e30: 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 64 atest-env-vars d
3e40: 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 65 b run-id) ;; the
3e50: 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 se may be needed
3e60: 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 6e by the launchin
3e70: 67 20 70 72 6f 63 65 73 73 0a 09 09 20 20 20 20 g process...
3e80: 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 (let ((items-lis
3e90: 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 t (items:get-ite
3ea0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 ms-from-config t
3eb0: 63 6f 6e 66 69 67 29 29 29 0a 09 09 20 20 20 20 config)))...
3ec0: 20 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 (if (list? ite
3ed0: 6d 73 2d 6c 69 73 74 29 0a 09 09 09 20 20 28 62 ms-list).... (b
3ee0: 65 67 69 6e 0a 09 09 09 20 20 20 20 28 74 65 73 egin.... (tes
3ef0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 ts:testqueue-set
3f00: 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 65 63 -items! test-rec
3f10: 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a ord items-list).
3f20: 09 09 09 20 20 20 20 28 6c 6f 6f 70 20 68 65 64 ... (loop hed
3f30: 20 74 61 6c 29 29 0a 09 09 09 20 20 28 62 65 67 tal)).... (beg
3f40: 69 6e 0a 09 09 09 20 20 20 20 28 64 65 62 75 67 in.... (debug
3f50: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
3f60: 20 54 68 65 20 70 72 6f 63 20 66 72 6f 6d 20 72 The proc from r
3f70: 65 61 64 69 6e 67 20 74 68 65 20 73 65 74 75 70 eading the setup
3f80: 20 64 69 64 20 6e 6f 74 20 79 69 65 6c 64 20 61 did not yield a
3f90: 20 6c 69 73 74 20 2d 20 70 6c 65 61 73 65 20 72 list - please r
3fa0: 65 70 6f 72 74 20 74 68 69 73 22 29 0a 09 09 09 eport this")....
3fb0: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 29 (exit 1)))))
3fc0: 0a 09 09 20 20 28 6c 65 74 20 28 28 6e 65 77 74 ... (let ((newt
3fd0: 61 6c 20 28 61 70 70 65 6e 64 20 74 61 6c 20 28 al (append tal (
3fe0: 6c 69 73 74 20 68 65 64 29 29 29 29 0a 09 09 20 list hed))))...
3ff0: 20 20 20 3b 3b 20 69 66 20 63 61 6e 27 74 20 72 ;; if can't r
4000: 75 6e 20 6d 6f 72 65 20 74 65 73 74 73 2c 20 6c un more tests, l
4010: 65 74 73 20 74 61 6b 65 20 61 20 62 72 65 61 74 ets take a breat
4020: 68 65 72 0a 09 09 20 20 20 20 28 74 68 72 65 61 her... (threa
4030: 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 20 3b 3b d-sleep! 0.1) ;;
4040: 20 6d 61 79 20 61 73 20 77 65 6c 6c 20 77 61 69 may as well wai
4050: 74 20 61 20 77 68 69 6c 65 20 66 6f 72 20 72 65 t a while for re
4060: 73 6f 75 72 63 65 73 20 74 6f 20 66 72 65 65 20 sources to free
4070: 75 70 0a 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 up... (loop (
4080: 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 car newtal)(cdr
4090: 6e 65 77 74 61 6c 29 29 29 29 29 0a 0a 09 20 20 newtal)))))...
40a0: 20 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 ;; this case
40b0: 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 should not happe
40c0: 6e 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 n, added to help
40d0: 20 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a catch any bugs.
40e0: 09 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 . ((and (lis
40f0: 74 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 t? items) itemda
4100: 74 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 t).. (debug
4110: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
4120: 20 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 Should not have
4130: 20 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 a list of items
4140: 20 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 in a test and t
4150: 68 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 he itemspath set
4160: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 - please report
4170: 20 74 68 69 73 22 29 0a 09 20 20 20 20 20 20 28 this").. (
4180: 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 0a 09 exit 1)))).. ..
4190: 20 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 ;; we get here
41a0: 20 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 on "drop throug
41b0: 68 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 h" - loop for ne
41c0: 78 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 xt test in queue
41d0: 0a 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 .. (if (null? t
41e0: 61 6c 29 0a 09 20 20 20 20 20 20 28 62 65 67 69 al).. (begi
41f0: 6e 0a 09 09 3b 3b 20 46 49 58 4d 45 21 21 21 21 n...;; FIXME!!!!
4200: 20 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 THIS SHOULD NOT
4210: 20 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 REQUIRE AN EXIT
4220: 21 21 21 21 21 21 21 0a 09 09 28 64 65 62 75 67 !!!!!!!...(debug
4230: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 :print 1 "INFO:
4240: 41 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 All tests launch
4250: 65 64 22 29 0a 09 09 28 74 68 72 65 61 64 2d 73 ed")...(thread-s
4260: 6c 65 65 70 21 20 30 2e 35 29 0a 09 09 3b 3b 20 leep! 0.5)...;;
4270: 46 49 58 4d 45 21 20 54 68 69 73 20 68 61 72 73 FIXME! This hars
4280: 68 20 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f h exit should no
4290: 74 20 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e t be necessary..
42a0: 2e 2e 0a 09 09 28 69 66 20 28 6e 6f 74 20 2a 72 .....(if (not *r
42b0: 75 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 unremote*)(exit)
42c0: 29 20 3b 3b 20 0a 09 09 23 66 29 20 3b 3b 20 72 ) ;; ...#f) ;; r
42d0: 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 eturn a #f as a
42e0: 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 hint that we are
42f0: 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 3b 3b 20 done.. ;;
4300: 48 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 Here we need to
4310: 63 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 check that all t
4320: 68 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 he tests remaini
4330: 6e 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 ng to be run are
4340: 20 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e eligible to run
4350: 0a 09 20 20 20 20 20 20 3b 3b 20 61 6e 64 20 61 .. ;; and a
4360: 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 re not blocked b
4370: 79 20 66 61 69 6c 65 64 0a 09 20 20 20 20 20 20 y failed..
4380: 28 6c 65 74 20 28 28 6e 65 77 6c 73 74 20 28 74 (let ((newlst (t
4390: 65 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d ests:filter-non-
43a0: 72 75 6e 6e 61 62 6c 65 20 64 62 20 72 75 6e 2d runnable db run-
43b0: 69 64 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f id tal test-reco
43c0: 72 64 73 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e rds))) ;; i.e. n
43d0: 6f 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c ot FAIL, WAIVED,
43e0: 20 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 INCOMPLETE, PAS
43f0: 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 28 74 68 S, KILLED,...(th
4400: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 read-sleep! 0.1)
4410: 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c ...(if (not (nul
4420: 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 l? newlst))...
4430: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 (loop (car new
4440: 6c 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 lst)(cdr newlst)
4450: 29 29 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 ))))))))..;; par
4460: 65 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 ent-test is ther
4470: 65 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 e as a placehold
4480: 65 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 er for when pare
4490: 6e 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 nt-tests can be
44a0: 72 75 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 run as a setup s
44b0: 74 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e tep.(define (run
44c0: 3a 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 :test db run-id
44d0: 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 runname keyvalls
44e0: 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c t test-record fl
44f0: 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 ags parent-test)
4500: 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 . ;; All these
4510: 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 vars might be re
4520: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 ferenced by the
4530: 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 testconfig file
4540: 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 reader. (let* (
4550: 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 (test-name (t
4560: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
4570: 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 et-testname te
4580: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 st-record)).. (t
4590: 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 est-waitons (tes
45a0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
45b0: 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 -waitons test
45c0: 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 -record)).. (tes
45d0: 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 t-conf (tests
45e0: 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 :testqueue-get-t
45f0: 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 estconfig test-r
4600: 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 ecord)).. (itemd
4610: 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 at (tests:t
4620: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 estqueue-get-ite
4630: 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 mdat test-rec
4640: 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 ord)).. (test-pa
4650: 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 th (conc *top
4660: 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 path* "/tests/"
4670: 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 test-name)) ;; c
4680: 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 ould use tests:g
4690: 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 et-testconfig he
46a0: 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 re ..... (force
46b0: 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 (hash-tab
46c0: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 le-ref/default f
46d0: 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 lags "-force" #f
46e0: 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 )).. (rerun
46f0: 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 (hash-table-r
4700: 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 ef/default flags
4710: 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 "-rerun" #f))..
4720: 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 (keepgoing (
4730: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
4740: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b efault flags "-k
4750: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 eepgoing" #f))..
4760: 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 (item-path
4770: 22 22 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a "")). (debug:
4780: 70 72 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74 print 5... "test
4790: 2d 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 -config: " (hash
47a0: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 -table->alist te
47b0: 73 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 st-conf)... "\n
47c0: 20 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 itemdat: " ite
47d0: 6d 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b mdat... ). ;;
47e0: 20 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 setting itemdat
47f0: 20 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 to a list if it
4800: 20 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 is #f. (if (
4810: 6e 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 not itemdat)(set
4820: 21 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a ! itemdat '())).
4830: 20 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 (set! item-p
4840: 61 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e ath (item-list->
4850: 70 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 path itemdat)).
4860: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
4870: 32 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 2 "Attempting to
4880: 20 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 launch test " t
4890: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 est-name "/" ite
48a0: 6d 2d 70 61 74 68 29 0a 20 20 20 20 28 73 65 74 m-path). (set
48b0: 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d env "MT_TEST_NAM
48c0: 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b E" test-name) ;;
48d0: 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d . (setenv "M
48e0: 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e T_RUNNAME" run
48f0: 6e 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d name). (set-m
4900: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
4910: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 db run-id) ;; t
4920: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 hese may be need
4930: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 ed by the launch
4940: 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 ing process.
4950: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 (change-director
4960: 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 y *toppath*)..
4970: 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 ;; Here is whe
4980: 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 re the test_meta
4990: 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 table is best u
49a0: 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 pdated. ;; Ye
49b0: 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f s, another use o
49c0: 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 f a global for c
49d0: 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 aching. Need a b
49e0: 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 etter way?. (
49f0: 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 if (not (hash-ta
4a00: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
4a10: 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 *test-meta-updat
4a20: 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 ed* test-name #f
4a30: 29 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 )). (begi
4a40: 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c n.. (hash-tabl
4a50: 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 e-set! *test-met
4a60: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d a-updated* test-
4a70: 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 name #t).
4a80: 20 20 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65 (runs:update
4a90: 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 -test_meta db te
4aa0: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e st-name test-con
4ab0: 66 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b f))). . ;;
4ac0: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 (lambda (itemda
4ad0: 74 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 t) ;;; ((ripenes
4ae0: 73 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 s "overripe") (t
4af0: 65 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c emperature "cool
4b00: 22 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d ") (season "summ
4b10: 65 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 er")). (let*
4b20: 28 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 ((new-test-path
4b30: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
4b40: 72 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 rse (cons test-p
4b50: 61 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 ath (map cadr it
4b60: 65 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 emdat)) "/"))..
4b70: 20 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 (new-test-name
4b80: 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 (if (equal? ite
4b90: 6d 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d m-path "") test-
4ba0: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d name (conc test-
4bb0: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
4bc0: 74 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 th))) ;; just ne
4bd0: 65 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 ed it to be uniq
4be0: 75 65 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 ue.. (testdat
4bf0: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 74 65 (db:get-te
4c00: 73 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 st-info db run-i
4c10: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
4c20: 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 -path)).. (tes
4c30: 74 2d 69 64 20 20 20 20 20 20 20 23 66 29 29 0a t-id #f)).
4c40: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 (if (not t
4c50: 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 estdat).. (begi
4c60: 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 n.. ;; ensure
4c70: 20 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 that the path e
4c80: 78 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 xists before reg
4c90: 69 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 istering the tes
4ca0: 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 t.. ;; NOPE:
4cb0: 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e Cannot! Don't kn
4cc0: 6f 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 ow yet which dis
4cd0: 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 k area will be a
4ce0: 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 ssigned......
4cf0: 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e ;; (system (con
4d00: 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 c "mkdir -p " ne
4d10: 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 w-test-path))..
4d20: 20 20 20 28 72 74 65 73 74 73 3a 72 65 67 69 73 (rtests:regis
4d30: 74 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d ter-test db run-
4d40: 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 id test-name ite
4d50: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 m-path).. (se
4d60: 74 21 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 t! testdat (db:g
4d70: 65 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 et-test-info db
4d80: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
4d90: 20 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 item-path)))).
4da0: 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d (set! test-
4db0: 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d id (db:test-get-
4dc0: 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 id testdat)).
4dd0: 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 (change-direc
4de0: 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a tory test-path).
4df0: 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20 (case (if
4e00: 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 force ;; (args:g
4e10: 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 et-arg "-force")
4e20: 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a ...'NOT_STARTED.
4e30: 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 ..(if testdat...
4e40: 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d (string->sym
4e50: 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 bol (test:get-st
4e60: 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 ate testdat))...
4e70: 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 'failed-to-i
4e80: 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 nsert))..((faile
4e90: 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 d-to-insert).. (
4ea0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
4eb0: 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 RROR: Failed to
4ec0: 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 insert the recor
4ed0: 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 d into the db"))
4ee0: 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 ..((NOT_STARTED
4ef0: 43 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 64 65 COMPLETED).. (de
4f00: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 47 6f 74 bug:print 6 "Got
4f10: 20 68 65 72 65 2c 20 22 20 28 74 65 73 74 3a 67 here, " (test:g
4f20: 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 et-state testdat
4f30: 29 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e 66 )).. (let ((runf
4f40: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 6f lag #f)).. (co
4f50: 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 63 nd.. ;; -forc
4f60: 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 e, run no matter
4f70: 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 63 what.. (forc
4f80: 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 e (set! runflag
4f90: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 #t)).. ;; NOT
4fa0: 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e 6f _STARTED, run no
4fb0: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 matter what..
4fc0: 20 20 28 28 65 71 75 61 6c 3f 20 28 74 65 73 74 ((equal? (test
4fd0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
4fe0: 61 74 29 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 at) "NOT_STARTED
4ff0: 22 29 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 ")(set! runflag
5000: 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 #t)).. ;; not
5010: 20 2d 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 -rerun and PASS
5020: 2c 20 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c , WARN or CHECK,
5030: 20 64 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 do no run..
5040: 28 28 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 ((and (or (not r
5050: 65 72 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 erun)... ke
5060: 65 70 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 epgoing)... ;;
5070: 52 65 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 Require to force
5080: 20 72 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 re-run for COMP
5090: 4c 45 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 LETED or *anythi
50a0: 6e 67 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 ng* + PASS,WARN
50b0: 6f 72 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 or CHECK... (or
50c0: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
50d0: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
50e0: 74 29 20 27 28 22 50 41 53 53 22 20 22 57 41 52 t) '("PASS" "WAR
50f0: 4e 22 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 N" "CHECK"))...
5100: 20 20 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 (member (te
5110: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 st:get-state te
5120: 73 74 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 stdat) '("COMPLE
5130: 54 45 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 TED")))) ..
5140: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
5150: 49 4e 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 INFO: running te
5160: 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 st " test-name "
5170: 2f 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 /" item-path " s
5180: 75 70 70 72 65 73 73 65 64 20 61 73 20 69 74 20 uppressed as it
5190: 69 73 20 43 4f 4d 50 4c 45 54 45 44 20 61 6e 64 is COMPLETED and
51a0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
51b0: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 te testdat))..
51c0: 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 (set! runflag
51d0: 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 #f)).. ;; -r
51e0: 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 73 20 erun and status
51f0: 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 is one of the sp
5200: 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 ecifed, run it..
5210: 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 6e 0a ((and rerun.
5220: 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 72 75 .. (let* ((reru
5230: 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 2d 73 nlst (string-s
5240: 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 29 29 plit rerun ","))
5250: 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 75 6e .... (must-rerun
5260: 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 (member (test:g
5270: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 et-status testda
5280: 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 t) rerunlst)))..
5290: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
52a0: 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 65 72 75 t 3 "INFO: -reru
52b0: 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 6e 20 n list: " rerun
52c0: 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 3a 20 ", test-status:
52d0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
52e0: 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 6d 75 us testdat)", mu
52f0: 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 st-rerun: " must
5300: 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 -rerun)... mu
5310: 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 20 20 st-rerun))..
5320: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
5330: 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 66 6f 72 "INFO: Rerun for
5340: 63 65 64 20 66 6f 72 20 74 65 73 74 20 22 20 74 ced for test " t
5350: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 est-name "/" ite
5360: 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20 28 73 m-path).. (s
5370: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
5380: 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f .. ;; -keepgo
5390: 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 ing, do not reru
53a0: 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 61 6e n FAIL.. ((an
53b0: 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 d keepgoing...
53c0: 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 (member (test:ge
53d0: 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 t-status testdat
53e0: 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a 09 20 ) '("FAIL")))..
53f0: 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c 61 (set! runfla
5400: 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 61 6e g #f)).. ((an
5410: 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 d (not rerun)...
5420: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a (member (test:
5430: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
5440: 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 6e 2f at) '("FAIL" "n/
5450: 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 65 74 a"))).. (set
5460: 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 ! runflag #t))..
5470: 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 21 20 (else (set!
5480: 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a 09 20 runflag #f)))..
5490: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 (debug:print 6
54a0: 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e "RUNNING => run
54b0: 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 flag: " runflag
54c0: 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 73 74 " STATE: " (test
54d0: 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 64 :get-state testd
54e0: 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 22 20 at) " STATUS: "
54f0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
5500: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 28 testdat)).. (
5510: 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 if (not runflag)
5520: 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f .. (if (no
5530: 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 t parent-test)..
5540: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 . (debug:print
5550: 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 1 "NOTE: Not st
5560: 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 6e 65 arting test " ne
5570: 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 w-test-name " as
5580: 20 69 74 20 69 73 20 73 74 61 74 65 20 5c 22 22 it is state \""
5590: 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 (test:get-state
55a0: 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 09 22 testdat) ....."
55b0: 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 5c 22 \" and status \"
55c0: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
55d0: 75 73 20 74 65 73 74 64 61 74 29 20 22 5c 22 2c us testdat) "\",
55e0: 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 use -rerun \""
55f0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
5600: 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 testdat).
5610: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5620: 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 6f 72 "\" or
5630: 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 -force to overr
5640: 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 20 3b ide")).. ;
5650: 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 ; NOTE: No longe
5660: 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 70 72 r be checking pr
5670: 65 72 65 71 75 69 73 69 74 65 73 20 68 65 72 65 erequisites here
5680: 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 ! Will never get
5690: 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 72 65 here unless pre
56a0: 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 20 20 reqs are..
56b0: 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 61 64 ;; alread
56c0: 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 20 28 y met... (
56d0: 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d if (not (launch-
56e0: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 test db run-id r
56f0: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 unname test-conf
5700: 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 2d keyvallst test-
5710: 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 20 69 name test-path i
5720: 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 0a 09 temdat flags))..
5730: 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 . (begin...
5740: 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f 52 3a (print "ERROR:
5750: 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 Failed to launc
5760: 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 69 74 h the test. Exit
5770: 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 ing as soon as p
5780: 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 20 20 ossible")...
5790: 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 (set! *globalex
57a0: 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 itstatus* 1) ;;
57b0: 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 73 73 ... (process
57c0: 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 -signal (current
57d0: 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 69 67 -process-id) sig
57e0: 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 nal/kill))))))..
57f0: 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 ((KILLED) .. (de
5800: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 bug:print 1 "NOT
5810: 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 E: " new-test-na
5820: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
5830: 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 running or was e
5840: 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c xplictly killed,
5850: 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c use -force to l
5860: 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 28 28 aunch it."))..((
5870: 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 LAUNCHED REMOTEH
5880: 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 OSTSTART RUNNING
5890: 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 ) .. (if (> (-
58a0: 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 (current-seconds
58b0: 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 65 74 )(+ (db:test-get
58c0: 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 -event_time test
58d0: 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 20 20 dat).....
58e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
58f0: 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 64 61 _duration testda
5900: 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 t)))...600) ;; i
5910: 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 66 6f .e. no update fo
5920: 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 30 20 r more than 600
5930: 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 seconds.. (b
5940: 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 64 65 egin.. (de
5950: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
5960: 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 65 73 NING: Test " tes
5970: 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 72 73 t-name " appears
5980: 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 6f 72 to be dead. For
5990: 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 74 65 cing it to state
59a0: 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 INCOMPLETE and
59b0: 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 45 41 status STUCK/DEA
59c0: 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 65 73 D").. (tes
59d0: 74 2d 73 65 74 2d 73 74 61 74 75 73 21 20 64 62 t-set-status! db
59e0: 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 test-id "INCOMP
59f0: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 LETE" "STUCK/DEA
5a00: 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63 D" "Test is stuc
5a10: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a k or dead" #f)).
5a20: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
5a30: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 nt 2 "NOTE: " te
5a40: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 st-name " is alr
5a50: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 eady running")))
5a60: 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 ..(else (d
5a70: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
5a80: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c ROR: Failed to l
5a90: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 aunch test " new
5aa0: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e -test-name ". Un
5ab0: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 recognised state
5ac0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
5ad0: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 te testdat))))))
5ae0: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d )..;;===========
5af0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 ===========.;; E
5b30: 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a ND OF NEW STUFF.
5b40: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
5b50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
5b80: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e ========..(defin
5b90: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 e (get-dir-up-n
5ba0: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 dir . params) .
5bb0: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 (let ((dparts
5bc0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 (string-split di
5bd0: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 r "/"))..(count
5be0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 (if (null? par
5bf0: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 ams) 1 (car para
5c00: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 ms)))). (conc
5c10: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
5c20: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 ersperse ..
5c30: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 (take dparts (
5c40: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
5c50: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 ) count))..
5c60: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d "/")))).;; Rem
5c70: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c ove runs.;; fiel
5c80: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 ds are passing i
5c90: 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 n through .;; ac
5ca0: 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d tion:.;; 'rem
5cb0: 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 ove-runs.;; '
5cc0: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 set-state-status
5cd0: 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 .;;.;; NB// shou
5ce0: 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f ld pass in keys?
5cf0: 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e .;;.(define (run
5d00: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 64 62 20 s:operate-on db
5d10: 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 action runnamepa
5d20: 74 74 20 74 65 73 74 70 61 74 74 20 69 74 65 6d tt testpatt item
5d30: 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 61 74 patt #!key (stat
5d40: 65 20 23 66 29 28 73 74 61 74 75 73 20 23 66 29 e #f)(status #f)
5d50: 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 (new-state-statu
5d60: 73 20 23 66 29 29 0a 20 20 28 6c 65 74 2a 20 28 s #f)). (let* (
5d70: 28 6b 65 79 73 20 20 20 20 20 20 20 20 20 28 72 (keys (r
5d80: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db:get-keys db))
5d90: 0a 09 20 28 72 75 6e 64 61 74 20 20 20 20 20 20 .. (rundat
5da0: 20 28 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 2d (runs:get-runs-
5db0: 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 20 by-patt db keys
5dc0: 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 0a 09 20 runnamepatt))..
5dd0: 28 68 65 61 64 65 72 20 20 20 20 20 20 20 28 76 (header (v
5de0: 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 ector-ref rundat
5df0: 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 20 0)).. (runs
5e00: 20 20 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 (vector-ref
5e10: 20 72 75 6e 64 61 74 20 31 29 29 0a 09 20 28 73 rundat 1)).. (s
5e20: 74 61 74 65 73 20 20 20 20 20 20 20 28 69 66 20 tates (if
5e30: 73 74 61 74 65 20 20 28 73 74 72 69 6e 67 2d 73 state (string-s
5e40: 70 6c 69 74 20 73 74 61 74 65 20 20 22 2c 22 29 plit state ",")
5e50: 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 75 73 '())).. (status
5e60: 65 73 20 20 20 20 20 28 69 66 20 73 74 61 74 75 es (if statu
5e70: 73 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 s (string-split
5e80: 73 74 61 74 75 73 20 22 2c 22 29 20 27 28 29 29 status ",") '())
5e90: 29 0a 09 20 28 73 74 61 74 65 2d 73 74 61 74 75 ).. (state-statu
5ea0: 73 20 28 69 66 20 28 73 74 72 69 6e 67 3f 20 6e s (if (string? n
5eb0: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 ew-state-status)
5ec0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6e (string-split n
5ed0: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 ew-state-status
5ee0: 22 2c 22 29 20 27 28 23 66 20 23 66 29 29 29 29 ",") '(#f #f))))
5ef0: 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
5f00: 74 20 32 20 22 48 65 61 64 65 72 3a 20 22 20 68 t 2 "Header: " h
5f10: 65 61 64 65 72 20 22 20 61 63 74 69 6f 6e 3a 20 eader " action:
5f20: 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 77 2d 73 " action " new-s
5f30: 74 61 74 65 2d 73 74 61 74 75 73 3a 20 22 20 6e tate-status: " n
5f40: 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 29 ew-state-status)
5f50: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 . (for-each.
5f60: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 75 6e (lambda (run
5f70: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 ). (let ((
5f80: 72 75 6e 6b 65 79 20 28 73 74 72 69 6e 67 2d 69 runkey (string-i
5f90: 6e 74 65 72 73 70 65 72 73 65 20 28 6d 61 70 20 ntersperse (map
5fa0: 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 09 09 09 (lambda (k).....
5fb0: 09 09 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d ..(db:get-value-
5fc0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
5fd0: 61 64 65 72 20 28 76 65 63 74 6f 72 2d 72 65 66 ader (vector-ref
5fe0: 20 6b 20 30 29 29 29 20 6b 65 79 73 29 20 22 2f k 0))) keys) "/
5ff0: 22 29 29 0a 09 20 20 20 20 20 28 64 69 72 73 2d ")).. (dirs-
6000: 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 6b 65 2d to-remove (make-
6010: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 hash-table)))..
6020: 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 64 20 20 (let* ((run-id
6030: 20 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d (db:get-value-
6040: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
6050: 61 64 65 72 20 22 69 64 22 29 29 0a 09 09 28 72 ader "id"))...(r
6060: 75 6e 2d 73 74 61 74 65 20 28 64 62 3a 67 65 74 un-state (db:get
6070: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
6080: 20 72 75 6e 20 68 65 61 64 65 72 20 22 73 74 61 run header "sta
6090: 74 65 22 29 29 0a 09 09 28 74 65 73 74 73 20 20 te"))...(tests
60a0: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 71 75 (if (not (equ
60b0: 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 20 22 6c al? run-state "l
60c0: 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 20 20 20 ocked"))....
60d0: 20 20 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 (rdb:get-test
60e0: 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 62 s-for-run db (db
60f0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
6100: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
6110: 22 69 64 22 29 0a 09 09 09 09 09 09 20 20 20 20 "id").......
6120: 20 20 74 65 73 74 70 61 74 74 20 69 74 65 6d 70 testpatt itemp
6130: 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74 75 att states statu
6140: 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 20 20 ses.......
6150: 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09 09 not-in: #f.....
6160: 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 79 3a .. sort-by:
6170: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 (case action...
6180: 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 65 2d ...... ((remove-
6190: 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 0a 09 runs) 'rundir)..
61a0: 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 20 20 ....... (else
61b0: 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 74 69 'event_ti
61c0: 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 me)))....
61d0: 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 61 '()))...(lasttpa
61e0: 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 78 th "/does/not/ex
61f0: 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a 09 ist/I/hope"))...
6200: 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c (if (not (nul
6210: 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 20 l? tests))..
6220: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 61 (begin... (ca
6230: 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 28 se action... (
6240: 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 (remove-runs)...
6250: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
6260: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 73 1 "Removing tes
6270: 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 75 ts for run: " ru
6280: 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 nkey " " (db:get
6290: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
62a0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e run header "run
62b0: 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 28 name")))... ((
62c0: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 set-state-status
62d0: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
62e0: 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 6e rint 1 "Modifyin
62f0: 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 75 g state and stau
6300: 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 20 s for tests for
6310: 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 run: " runkey "
6320: 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d " (db:get-value-
6330: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
6340: 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 ader "runname"))
6350: 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09 20 )... (else...
6360: 20 20 20 28 70 72 69 6e 74 20 22 49 4e 46 4f 3a (print "INFO:
6370: 20 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 6f action not reco
6380: 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e 29 gnised " action)
6390: 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 0a ))... (for-each.
63a0: 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 .. (lambda (tes
63b0: 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 28 t)... (let* (
63c0: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 (item-path (db:t
63d0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 est-get-item-pat
63e0: 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 h test)).... (
63f0: 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 65 test-name (db:te
6400: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
6410: 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 75 test)).... (ru
6420: 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 74 n-dir (db:test
6430: 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 74 -get-rundir test
6440: 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 )))... (deb
6450: 75 67 3a 70 72 69 6e 74 20 31 20 22 20 20 22 20 ug:print 1 " "
6460: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
6470: 74 6e 61 6d 65 20 74 65 73 74 29 20 22 20 69 64 tname test) " id
6480: 3a 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 : " (db:test-get
6490: 2d 69 64 20 74 65 73 74 29 20 22 20 22 20 69 74 -id test) " " it
64a0: 65 6d 2d 70 61 74 68 20 22 20 61 63 74 69 6f 6e em-path " action
64b0: 3a 20 22 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 : " action)...
64c0: 20 20 20 20 28 63 61 73 65 20 61 63 74 69 6f 6e (case action
64d0: 0a 09 09 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e ....((remove-run
64e0: 73 29 0a 09 09 09 20 28 72 64 62 3a 64 65 6c 65 s).... (rdb:dele
64f0: 74 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 te-test-records
6500: 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d db (db:test-get-
6510: 69 64 20 74 65 73 74 29 29 0a 09 09 09 20 28 64 id test)).... (d
6520: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e ebug:print 1 "IN
6530: 46 4f 3a 20 41 74 74 65 6d 70 74 69 6e 67 20 74 FO: Attempting t
6540: 6f 20 72 65 6d 6f 76 65 20 64 69 72 20 22 20 72 o remove dir " r
6550: 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 66 20 un-dir).... (if
6560: 28 61 6e 64 20 28 3e 20 28 73 74 72 69 6e 67 2d (and (> (string-
6570: 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 29 20 length run-dir)
6580: 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65 2d 65 5)..... (file-e
6590: 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 29 29 xists? run-dir))
65a0: 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 74 69 ;; bad heuristi
65b0: 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 72 65 c but should pre
65c0: 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d 65 20 vent /tmp /home
65d0: 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28 6c 65 etc..... (le
65e0: 74 2a 20 28 28 72 65 61 6c 70 61 74 68 20 28 72 t* ((realpath (r
65f0: 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d 65 20 esolve-pathname
6600: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 20 20 run-dir)))....
6610: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
6620: 74 20 31 20 22 49 4e 46 4f 3a 20 52 65 61 6c 20 t 1 "INFO: Real
6630: 70 61 74 68 20 6f 66 20 69 73 20 22 20 72 65 61 path of is " rea
6640: 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 20 20 lpath)....
6650: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 (if (file-exist
6660: 73 3f 20 72 65 61 6c 70 61 74 68 29 0a 09 09 09 s? realpath)....
6670: 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 73 74 . (if (> (syst
6680: 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d 72 66 em (conc "rm -rf
6690: 20 22 20 72 65 61 6c 70 61 74 68 29 29 20 30 29 " realpath)) 0)
66a0: 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 62 ..... (deb
66b0: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
66c0: 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 20 70 R: There was a p
66d0: 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e 67 20 roblem removing
66e0: 22 20 72 65 61 6c 70 61 74 68 20 22 20 77 69 74 " realpath " wit
66f0: 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 09 20 h rm -f")).....
6700: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
6710: 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 74 20 "WARNING: test
6720: 72 75 6e 20 64 69 72 20 22 20 72 65 61 6c 70 61 run dir " realpa
6730: 74 68 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 th " appears to
6740: 6e 6f 74 20 65 78 69 73 74 22 29 29 0a 09 09 09 not exist"))....
6750: 20 20 20 20 20 20 20 28 69 66 20 28 66 69 6c 65 (if (file
6760: 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 -exists? run-dir
6770: 29 20 3b 3b 20 74 68 65 20 6c 69 6e 6b 0a 09 09 ) ;; the link...
6780: 09 09 20 20 20 28 69 66 20 28 73 79 6d 62 6f 6c .. (if (symbol
6790: 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 69 72 ic-link? run-dir
67a0: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 65 )..... (de
67b0: 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d 64 69 lete-file run-di
67c0: 72 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 69 r)..... (i
67d0: 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 72 75 f (directory? ru
67e0: 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 20 28 n-dir)...... (
67f0: 69 66 20 28 3e 20 28 64 69 72 65 63 74 6f 72 79 if (> (directory
6800: 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 28 66 -fold (lambda (f
6810: 20 78 29 28 2b 20 31 20 78 29 29 20 30 20 72 75 x)(+ 1 x)) 0 ru
6820: 6e 2d 64 69 72 29 20 30 29 0a 09 09 09 09 09 20 n-dir) 0)......
6830: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
6840: 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 72 nt 0 "WARNING: r
6850: 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 efusing to remov
6860: 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 61 73 e " run-dir " as
6870: 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 74 79 it is not empty
6880: 22 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 ")...... (
6890: 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f 72 79 delete-directory
68a0: 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 69 74 run-dir)) ;; it
68b0: 20 73 68 6f 75 6c 64 20 62 65 20 65 6d 70 74 79 should be empty
68c0: 20 62 79 20 68 65 72 65 20 42 55 47 20 42 55 47 by here BUG BUG
68d0: 2c 20 61 64 64 20 65 72 72 6f 72 20 63 61 74 63 , add error catc
68e0: 68 0a 09 09 09 09 09 20 20 20 28 64 65 62 75 67 h...... (debug
68f0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
6900: 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d refusing to rem
6910: 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 ove " run-dir "
6920: 61 73 20 69 74 20 69 73 20 6e 65 69 74 68 65 72 as it is neither
6930: 20 61 20 73 79 6d 6c 69 6e 6b 20 6e 6f 72 20 61 a symlink nor a
6940: 20 64 69 72 65 63 74 6f 72 79 22 29 0a 09 09 09 directory")....
6950: 09 09 20 20 20 29 29 29 29 0a 09 09 09 20 20 20 .. ))))....
6960: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
6970: 20 22 57 41 52 4e 49 4e 47 3a 20 64 69 72 65 63 "WARNING: direc
6980: 74 6f 72 79 20 61 6c 72 65 61 64 79 20 72 65 6d tory already rem
6990: 6f 76 65 64 20 22 20 72 75 6e 2d 64 69 72 29 29 oved " run-dir))
69a0: 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 74 65 )....((set-state
69b0: 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 64 65 -status).... (de
69c0: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 bug:print 2 "INF
69d0: 4f 3a 20 6e 65 77 20 73 74 61 74 65 20 22 20 28 O: new state " (
69e0: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 car state-status
69f0: 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 73 20 ) ", new status
6a00: 22 20 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 " (cadr state-st
6a10: 61 74 75 73 29 29 0a 09 09 09 20 28 64 62 3a 74 atus)).... (db:t
6a20: 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 74 est-set-state-st
6a30: 61 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 64 atus-by-id db (d
6a40: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
6a50: 73 74 29 20 28 63 61 72 20 73 74 61 74 65 2d 73 st) (car state-s
6a60: 74 61 74 75 73 29 28 63 61 64 72 20 73 74 61 74 tatus)(cadr stat
6a70: 65 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 29 e-status) #f))))
6a80: 29 0a 09 09 20 20 74 65 73 74 73 29 29 29 0a 09 )... tests)))..
6a90: 20 20 20 0a 09 20 20 20 3b 3b 20 72 65 6d 6f 76 .. ;; remov
6aa0: 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 72 e the run if zer
6ab0: 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a 09 o tests remain..
6ac0: 20 20 20 28 69 66 20 28 65 71 3f 20 61 63 74 69 (if (eq? acti
6ad0: 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 29 on 'remove-runs)
6ae0: 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 .. (let ((
6af0: 72 65 6d 74 65 73 74 73 20 28 72 64 62 3a 67 65 remtests (rdb:ge
6b00: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
6b10: 64 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 db (db:get-value
6b20: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
6b30: 65 61 64 65 72 20 22 69 64 22 29 20 23 66 20 23 eader "id") #f #
6b40: 66 20 27 28 29 20 27 28 29 29 29 29 0a 09 09 20 f '() '())))...
6b50: 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 (if (null? remte
6b60: 73 74 73 29 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 sts) ;; no more
6b70: 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 0a tests remaining.
6b80: 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 64 .. (let* ((d
6b90: 70 61 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 parts (string-s
6ba0: 70 6c 69 74 20 6c 61 73 74 74 70 61 74 68 20 22 plit lasttpath "
6bb0: 2f 22 29 29 0a 09 09 09 20 20 20 20 28 72 75 6e /")).... (run
6bc0: 70 61 74 68 20 28 63 6f 6e 63 20 22 2f 22 20 28 path (conc "/" (
6bd0: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
6be0: 73 65 20 0a 09 09 09 09 09 09 28 74 61 6b 65 20 se .......(take
6bf0: 64 70 61 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 dparts (- (lengt
6c00: 68 20 64 70 61 72 74 73 29 20 31 29 29 0a 09 09 h dparts) 1))...
6c10: 09 09 09 09 22 2f 22 29 29 29 29 0a 09 09 20 20 ...."/"))))...
6c20: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
6c30: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 t 1 "Removing ru
6c40: 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 20 22 20 n: " runkey " "
6c50: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
6c60: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
6c70: 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 29 0a 09 er "runname"))..
6c80: 09 20 20 20 20 20 20 20 28 64 62 3a 64 65 6c 65 . (db:dele
6c90: 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 te-run db run-id
6ca0: 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 6e 65 )... ;; ne
6cb0: 65 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 ed to figure out
6cc0: 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 65 the path to the
6cd0: 20 72 75 6e 20 64 69 72 20 61 6e 64 20 72 65 6d run dir and rem
6ce0: 6f 76 65 20 69 74 20 69 66 20 65 6d 70 74 79 0a ove it if empty.
6cf0: 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 28 .. ;; (
6d00: 69 66 20 28 6e 75 6c 6c 3f 20 28 67 6c 6f 62 20 if (null? (glob
6d10: 28 63 6f 6e 63 20 72 75 6e 70 61 74 68 20 22 2f (conc runpath "/
6d20: 2a 22 29 29 29 0a 09 09 20 20 20 20 20 20 20 3b *")))... ;
6d30: 3b 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a ; (begin.
6d40: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 64 .. ;; . (d
6d50: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 ebug:print 1 "Re
6d60: 6d 6f 76 69 6e 67 20 72 75 6e 20 64 69 72 20 22 moving run dir "
6d70: 20 72 75 6e 70 61 74 68 29 0a 09 09 20 20 20 20 runpath)...
6d80: 20 20 20 3b 3b 20 09 20 28 73 79 73 74 65 6d 20 ;; . (system
6d90: 28 63 6f 6e 63 20 22 72 6d 64 69 72 20 2d 70 20 (conc "rmdir -p
6da0: 22 20 72 75 6e 70 61 74 68 29 29 29 29 0a 09 09 " runpath))))...
6db0: 20 20 20 20 20 20 20 29 29 29 29 29 0a 09 20 29 ))))).. )
6dc0: 29 0a 20 20 20 20 20 72 75 6e 73 29 29 29 0a 0a ). runs)))..
6dd0: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
6de0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6df0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e00: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e10: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 ========.;; Rout
6e20: 69 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c ines for manipul
6e30: 61 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d ating runs.;;===
6e40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e50: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6e80: 3d 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 ===..;; Since ma
6e90: 6e 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 ny calls to a ru
6ea0: 6e 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 n require pretty
6eb0: 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 much the same s
6ec0: 65 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 etup .;; this wr
6ed0: 61 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f apper is used to
6ee0: 20 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c reduce the repl
6ef0: 69 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a ication of code.
6f00: 28 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c (define (general
6f10: 2d 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 -run-call switch
6f20: 6e 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 name action-desc
6f30: 20 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 proc). (let ((
6f40: 72 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 runname (args:ge
6f50: 74 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 t-arg ":runname"
6f60: 29 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 ))..(target (if
6f70: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6f80: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
6f90: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6fa0: 2d 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 -target")...
6fb0: 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 (args:get-arg "
6fc0: 2d 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 -reqtarg")))..(t
6fd0: 68 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 h1 #f)).
6fe0: 28 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 (cond. ((not
6ff0: 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 target). (
7000: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
7010: 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 RROR: Missing re
7020: 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 quired parameter
7030: 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d for " switchnam
7040: 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 e ", you must sp
7050: 65 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74 ecify the target
7060: 20 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a with -target").
7070: 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a (exit 3)).
7080: 20 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 ((not runna
7090: 6d 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 me). (debug
70a0: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
70b0: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 Missing require
70c0: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 d parameter for
70d0: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 " switchname ",
70e0: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 you must specify
70f0: 20 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 the run name wi
7100: 74 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e th :runname runn
7110: 61 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 ame"). (exi
7120: 74 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 t 3)). (else
7130: 0a 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 . (let ((db
7140: 20 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 #f).. (key
7150: 73 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 s #f))..(if (not
7160: 20 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 (setup-for-run)
7170: 29 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 ).. (begin ..
7180: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
7190: 6e 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 nt 0 "Failed to
71a0: 73 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 setup, exiting")
71b0: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
71c0: 29 29 0a 09 28 73 65 74 21 20 64 62 20 20 20 28 ))..(set! db (
71d0: 6f 70 65 6e 2d 64 62 29 29 0a 09 28 69 66 20 28 open-db))..(if (
71e0: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 args:get-arg "-s
71f0: 65 72 76 65 72 22 29 0a 09 20 20 20 20 28 73 65 erver").. (se
7200: 72 76 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 rver:start db (a
7210: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 rgs:get-arg "-se
7220: 72 76 65 72 22 29 29 0a 09 20 20 20 20 28 69 66 rver")).. (if
7230: 20 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a (not (or (args:
7240: 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c get-arg "-runall
7250: 22 29 0a 09 09 09 20 20 28 61 72 67 73 3a 67 65 ").... (args:ge
7260: 74 2d 61 72 67 20 22 2d 72 75 6e 74 65 73 74 73 t-arg "-runtests
7270: 22 29 29 29 0a 09 09 28 73 65 72 76 65 72 3a 63 ")))...(server:c
7280: 6c 69 65 6e 74 2d 73 65 74 75 70 20 64 62 29 29 lient-setup db))
7290: 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 72 )..(set! keys (r
72a0: 64 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 db:get-keys db))
72b0: 0a 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 ..;; have enough
72c0: 20 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 to process -tar
72d0: 67 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 get or -reqtarg
72e0: 68 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a here..(if (args:
72f0: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 get-arg "-reqtar
7300: 67 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 g").. (let* (
7310: 28 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e (runconfigf (con
7320: 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 c *toppath* "/r
7330: 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 unconfigs.config
7340: 22 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 ")) ;; DO NOT EV
7350: 41 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 ALUATE ALL ...
7360: 20 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 (runconfig (re
7370: 61 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e ad-config runcon
7380: 66 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 figf #f #f envir
7390: 6f 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a on-patt: #f))) .
73a0: 09 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68 . (if (hash
73b0: 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 -table-ref/defau
73c0: 6c 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 lt runconfig (ar
73d0: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
73e0: 74 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 targ") #f)... (
73f0: 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d keys:target-set-
7400: 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a args keys (args:
7410: 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 get-arg "-reqtar
7420: 67 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 g") args:arg-has
7430: 68 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 h)... (begin...
7440: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
7450: 20 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 0 "ERROR: [" (a
7460: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 rgs:get-arg "-re
7470: 71 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 qtarg") "] not f
7480: 6f 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e ound in " runcon
7490: 66 69 67 66 29 0a 09 09 20 20 20 20 28 73 71 6c figf)... (sql
74a0: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 ite3:finalize! d
74b0: 62 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 b)... (exit 1
74c0: 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 )))).. (if (a
74d0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
74e0: 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 rget")...(keys:t
74f0: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b arget-set-args k
7500: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 eys (args:get-ar
7510: 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 g "-target" args
7520: 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a :arg-hash) args:
7530: 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 arg-hash)))..(if
7540: 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 (not (car *conf
7550: 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 iginfo*)).. (
7560: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 begin.. (de
7570: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
7580: 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f OR: Attempted to
7590: 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 " action-desc "
75a0: 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f but run area co
75b0: 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f nfig file not fo
75c0: 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 und").. (ex
75d0: 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 it 1)).. ;; E
75e0: 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 xtract out stuff
75f0: 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 needed in most
7600: 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 or many calls..
7610: 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 ;; here then
7620: 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 call proc.. (
7630: 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 let* ((keynames
7640: 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 (map key:get-f
7650: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a ieldname keys)).
7660: 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 .. (keyvallst
7670: 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 (keys->vallist
7680: 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 keys #t)))..
7690: 20 20 28 70 72 6f 63 20 64 62 20 74 61 72 67 65 (proc db targe
76a0: 74 20 72 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b t runname keys k
76b0: 65 79 6e 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 eynames keyvalls
76c0: 74 29 29 29 0a 09 28 69 66 20 74 68 31 20 28 74 t)))..(if th1 (t
76d0: 68 72 65 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 hread-join! th1)
76e0: 29 0a 09 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 )..(sqlite3:fina
76f0: 6c 69 7a 65 21 20 64 62 29 0a 09 28 73 65 74 21 lize! db)..(set!
7700: 20 2a 64 69 64 73 6f 6d 65 74 68 69 6e 67 2a 20 *didsomething*
7710: 23 74 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d #t))))))..;;====
7720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7730: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7740: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7750: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7760: 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 ==.;; Lock/unloc
7770: 6b 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d k runs.;;=======
7780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
77a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
77b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a ===============.
77c0: 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 68 .(define (runs:h
77d0: 61 6e 64 6c 65 2d 6c 6f 63 6b 69 6e 67 20 64 62 andle-locking db
77e0: 20 74 61 72 67 65 74 20 6b 65 79 73 20 72 75 6e target keys run
77f0: 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b name lock unlock
7800: 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 user). (let* (
7810: 28 72 75 6e 64 61 74 20 20 20 28 72 75 6e 73 3a (rundat (runs:
7820: 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 74 get-runs-by-patt
7830: 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 db keys runname
7840: 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 28 )).. (header (
7850: 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 vector-ref runda
7860: 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 20 t 0)).. (runs
7870: 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 (vector-ref ru
7880: 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 66 ndat 1))). (f
7890: 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 or-each (lambda
78a0: 28 72 75 6e 29 0a 09 09 28 6c 65 74 20 28 28 72 (run)...(let ((r
78b0: 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 61 un-id (db:get-va
78c0: 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 lue-by-header ru
78d0: 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 29 n header "id")))
78e0: 0a 09 09 20 20 28 69 66 20 28 6f 72 20 6c 6f 63 ... (if (or loc
78f0: 6b 0a 09 09 09 20 20 28 61 6e 64 20 75 6e 6c 6f k.... (and unlo
7900: 63 6b 0a 09 09 09 20 20 20 20 20 20 20 28 62 65 ck.... (be
7910: 67 69 6e 0a 09 09 09 09 20 28 70 72 69 6e 74 20 gin..... (print
7920: 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79 20 77 "Do you really w
7930: 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 75 ish to unlock ru
7940: 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c 6e 20 n " run-id "?\n
7950: 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09 20 28 y/n: ")..... (
7960: 65 71 75 61 6c 3f 20 22 79 22 20 28 72 65 61 64 equal? "y" (read
7970: 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09 20 20 20 -line)))))...
7980: 20 20 20 28 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f (db:lock/unlo
7990: 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 ck-run db run-id
79a0: 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 lock unlock use
79b0: 72 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 r)... (debu
79c0: 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f 3a g:print 0 "INFO:
79d0: 20 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f 75 Skipping lock/u
79e0: 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d 69 nlock on " run-i
79f0: 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75 6e d)))).. run
7a00: 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d s))).;;=========
7a10: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a20: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a30: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a40: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
7a50: 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d Rollup runs.;;=
7a60: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a70: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a80: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7a90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7aa0: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 =====..;; Update
7ab0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 the test_meta t
7ac0: 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 able for this te
7ad0: 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 st.(define (runs
7ae0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
7af0: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
7b00: 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 est-conf). (let
7b10: 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 64 ((currrecord (d
7b20: 62 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 b:testmeta-get-r
7b30: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 ecord db test-na
7b40: 6d 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e me))). (if (n
7b50: 6f 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 ot currrecord)..
7b60: 28 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 (begin.. (set!
7b70: 63 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 currrecord (make
7b80: 2d 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a -vector 10 #f)).
7b90: 09 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 2d . (db:testmeta-
7ba0: 61 64 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 add-record db te
7bb0: 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 st-name))). (
7bc0: 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 for-each . (
7bd0: 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 lambda (key).
7be0: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 (let* ((idx
7bf0: 28 63 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 (cadr key))..
7c00: 20 20 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 (fld (car ke
7c10: 79 29 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 y)).. (val
7c20: 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 (config-lookup t
7c30: 65 73 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d est-conf "test_m
7c40: 65 74 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b eta" fld))).. ;;
7c50: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 (debug:print 5
7c60: 22 69 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c "idx: " idx " fl
7c70: 64 3a 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 d: " fld " val:
7c80: 22 20 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e " val).. (if (an
7c90: 64 20 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 d val (not (equa
7ca0: 6c 3f 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 l? (vector-ref c
7cb0: 75 72 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 urrrecord idx) v
7cc0: 61 6c 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 al))).. (beg
7cd0: 69 6e 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e in.. (prin
7ce0: 74 20 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 t "Updating " te
7cf0: 73 74 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 st-name " " fld
7d00: 22 20 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 " to " val)..
7d10: 20 20 20 20 28 64 62 3a 74 65 73 74 6d 65 74 61 (db:testmeta
7d20: 2d 75 70 64 61 74 65 2d 66 69 65 6c 64 20 64 62 -update-field db
7d30: 20 74 65 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 test-name fld v
7d40: 61 6c 29 29 29 29 29 0a 20 20 20 20 20 27 28 28 al))))). '((
7d50: 22 61 75 74 68 6f 72 22 20 32 29 28 22 6f 77 6e "author" 2)("own
7d60: 65 72 22 20 33 29 28 22 64 65 73 63 72 69 70 74 er" 3)("descript
7d70: 69 6f 6e 22 20 34 29 28 22 72 65 76 69 65 77 65 ion" 4)("reviewe
7d80: 64 22 20 35 29 28 22 74 61 67 73 22 20 39 29 29 d" 5)("tags" 9))
7d90: 29 29 29 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 )))..;; Update t
7da0: 65 73 74 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c est_meta for all
7db0: 20 74 65 73 74 73 0a 28 64 65 66 69 6e 65 20 28 tests.(define (
7dc0: 72 75 6e 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d runs:update-all-
7dd0: 74 65 73 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 test_meta db).
7de0: 28 6c 65 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 (let ((test-name
7df0: 73 20 28 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c s (get-all-legal
7e00: 2d 74 65 73 74 73 29 29 29 0a 20 20 20 20 28 66 -tests))). (f
7e10: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
7e20: 61 6d 62 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 ambda (test-name
7e30: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 ). (let* (
7e40: 28 74 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 (test-path (c
7e50: 6f 6e 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f onc *toppath* "/
7e60: 74 65 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d tests/" test-nam
7e70: 65 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 e)).. (test
7e80: 2d 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 -configf (conc t
7e90: 65 73 74 2d 70 61 74 68 20 22 2f 74 65 73 74 63 est-path "/testc
7ea0: 6f 6e 66 69 67 22 29 29 0a 09 20 20 20 20 20 20 onfig"))..
7eb0: 28 74 65 73 74 65 78 69 73 74 73 20 20 20 28 61 (testexists (a
7ec0: 6e 64 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f nd (file-exists?
7ed0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 test-configf)(f
7ee0: 69 6c 65 2d 72 65 61 64 2d 61 63 63 65 73 73 3f ile-read-access?
7ef0: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 test-configf)))
7f00: 0a 09 20 20 20 20 20 20 3b 3b 20 72 65 61 64 20 .. ;; read
7f10: 63 6f 6e 66 69 67 73 20 77 69 74 68 20 74 72 69 configs with tri
7f20: 63 6b 73 20 74 75 72 6e 65 64 20 6f 66 66 20 28 cks turned off (
7f30: 69 2e 65 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a i.e. no system).
7f40: 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e . (test-con
7f50: 66 20 20 20 20 28 69 66 20 74 65 73 74 65 78 69 f (if testexi
7f60: 73 74 73 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 sts (read-config
7f70: 20 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 test-configf #f
7f80: 20 23 66 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 #f)(make-hash-t
7f90: 61 62 6c 65 29 29 29 29 0a 09 20 28 72 75 6e 73 able)))).. (runs
7fa0: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
7fb0: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
7fc0: 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 est-conf))).
7fd0: 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 0a 0a test-names)))..
7fe0: 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 70 72 ;; This could pr
7ff0: 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 63 74 obably be refact
8000: 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 63 6f ored into one co
8010: 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e 2e 0a mplex query ....
8020: 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 6f (define (runs:ro
8030: 6c 6c 75 70 2d 72 75 6e 20 64 62 20 6b 65 79 73 llup-run db keys
8040: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 keyvallst runna
8050: 6d 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20 me user) ;; was
8060: 74 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 target, now keyv
8070: 61 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70 allst. (debug:p
8080: 72 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c rint 4 "runs:rol
8090: 6c 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 lup-run, keys: "
80a0: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 keys " keyvalls
80b0: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 t: " keyvallst "
80c0: 20 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e :runname " runn
80d0: 61 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73 ame " user: " us
80e0: 65 72 29 0a 20 20 28 6c 65 74 2a 20 28 3b 20 28 er). (let* (; (
80f0: 6b 65 79 76 61 6c 6c 6c 73 74 20 20 20 20 20 20 keyvalllst
8100: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 (keys:target->ke
8110: 79 76 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 yval keys target
8120: 29 29 0a 09 20 28 6e 65 77 2d 72 75 6e 2d 69 64 )).. (new-run-id
8130: 20 20 20 20 20 20 28 72 75 6e 73 3a 72 65 67 69 (runs:regi
8140: 73 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 ster-run db keys
8150: 20 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 keyvallst runna
8160: 6d 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 me "new" "n/a" u
8170: 73 65 72 29 29 0a 09 20 28 70 72 65 76 2d 74 65 ser)).. (prev-te
8180: 73 74 73 20 20 20 20 20 20 28 74 65 73 74 3a 67 sts (test:g
8190: 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 72 65 76 et-matching-prev
81a0: 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e 2d 72 65 ious-test-run-re
81b0: 63 6f 72 64 73 20 64 62 20 6e 65 77 2d 72 75 6e cords db new-run
81c0: 2d 69 64 20 22 25 22 20 22 25 22 29 29 0a 09 20 -id "%" "%"))..
81d0: 28 63 75 72 72 2d 74 65 73 74 73 20 20 20 20 20 (curr-tests
81e0: 20 28 72 64 62 3a 67 65 74 2d 74 65 73 74 73 2d (rdb:get-tests-
81f0: 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 for-run db new-r
8200: 75 6e 2d 69 64 20 22 25 22 20 22 25 22 20 27 28 un-id "%" "%" '(
8210: 29 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d ) '())).. (curr-
8220: 74 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 tests-hash (make
8230: 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 -hash-table))).
8240: 20 20 20 28 64 62 3a 75 70 64 61 74 65 2d 72 75 (db:update-ru
8250: 6e 2d 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 n-event_time db
8260: 6e 65 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 new-run-id).
8270: 3b 3b 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 ;; index the alr
8280: 65 61 64 79 20 73 61 76 65 64 20 74 65 73 74 73 eady saved tests
8290: 20 62 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 by testname and
82a0: 20 69 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 itemdat in curr
82b0: 2d 74 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 -tests-hash.
82c0: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 (for-each. (
82d0: 6c 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 lambda (testdat)
82e0: 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 . (let* ((
82f0: 74 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 testname (db:te
8300: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
8310: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 testdat))..
8320: 20 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a (item-path (db:
8330: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
8340: 74 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 th testdat))..
8350: 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 (full-name (
8360: 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f conc testname "/
8370: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 " item-path)))..
8380: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
8390: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 ! curr-tests-has
83a0: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 h full-name test
83b0: 64 61 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 dat))). curr
83c0: 2d 74 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e -tests). ;; N
83d0: 4f 50 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c OPE: Non-optimal
83e0: 20 61 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 approach. Try t
83f0: 68 69 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 his instead..
8400: 20 3b 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 ;; 1. tests a
8410: 72 65 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 re received in a
8420: 20 6c 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 list, most rece
8430: 6e 74 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 nt first. ;;
8440: 20 20 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 2. replace the
8450: 20 72 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 rollup test wit
8460: 68 20 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 h the new *alway
8470: 73 2a 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 s*. (for-each
8480: 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 . (lambda (
8490: 74 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 testdat).
84a0: 28 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 (let* ((testname
84b0: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 (db:test-get-t
84c0: 65 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 estname testdat)
84d0: 29 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 ).. (item-p
84e0: 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 ath (db:test-get
84f0: 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 -item-path testd
8500: 61 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c at)).. (ful
8510: 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 l-name (conc tes
8520: 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 tname "/" item-p
8530: 61 74 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 ath)).. (pr
8540: 65 76 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 ev-test-dat (has
8550: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
8560: 75 6c 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 ult curr-tests-h
8570: 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 ash full-name #f
8580: 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d )).. (test-
8590: 73 74 65 70 73 20 20 20 20 20 20 28 64 62 3a 67 steps (db:g
85a0: 65 74 2d 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 et-steps-for-tes
85b0: 74 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 65 t db (db:test-ge
85c0: 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 29 0a t-id testdat))).
85d0: 09 20 20 20 20 20 20 28 6e 65 77 2d 74 65 73 74 . (new-test
85e0: 2d 72 65 63 6f 72 64 20 23 66 29 29 0a 09 20 3b -record #f)).. ;
85f0: 3b 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 ; replace these
8600: 77 69 74 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 with insert ...
8610: 73 65 6c 65 63 74 0a 09 20 28 61 70 70 6c 79 20 select.. (apply
8620: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
8630: 0a 09 09 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 ...db ...(conc "
8640: 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 INSERT OR REPLAC
8650: 45 20 49 4e 54 4f 20 74 65 73 74 73 20 28 72 75 E INTO tests (ru
8660: 6e 5f 69 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 n_id,testname,st
8670: 61 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 ate,status,event
8680: 5f 74 69 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f _time,host,cpulo
8690: 61 64 2c 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d ad,diskfree,unam
86a0: 65 2c 72 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 e,rundir,item_pa
86b0: 74 68 2c 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c th,run_duration,
86c0: 66 69 6e 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 final_logf,comme
86d0: 6e 74 29 20 22 0a 09 09 20 20 20 20 20 20 22 56 nt) "... "V
86e0: 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f ALUES (?,?,?,?,?
86f0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
8700: 2c 3f 29 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e ,?);")...new-run
8710: 2d 69 64 20 28 63 64 64 72 20 28 76 65 63 74 6f -id (cddr (vecto
8720: 72 2d 3e 6c 69 73 74 20 74 65 73 74 64 61 74 29 r->list testdat)
8730: 29 29 0a 09 20 28 73 65 74 21 20 6e 65 77 2d 74 )).. (set! new-t
8740: 65 73 74 64 61 74 20 28 63 61 72 20 28 72 64 62 estdat (car (rdb
8750: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
8760: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
8770: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 2d 70 testname item-p
8780: 61 74 68 20 27 28 29 20 27 28 29 29 29 29 0a 09 ath '() '())))..
8790: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 (hash-table-set
87a0: 21 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 ! curr-tests-has
87b0: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 6e 65 77 2d h full-name new-
87c0: 74 65 73 74 64 61 74 29 20 3b 3b 20 74 68 69 73 testdat) ;; this
87d0: 20 63 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 could be confus
87e0: 69 6e 67 2c 20 77 68 69 63 68 20 72 65 63 6f 72 ing, which recor
87f0: 64 20 73 68 6f 75 6c 64 20 67 6f 20 69 6e 74 6f d should go into
8800: 20 74 68 65 20 6c 6f 6f 6b 75 70 20 74 61 62 6c the lookup tabl
8810: 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c e?.. ;; Now dupl
8820: 69 63 61 74 65 20 74 68 65 20 74 65 73 74 20 73 icate the test s
8830: 74 65 70 73 0a 09 20 28 64 65 62 75 67 3a 70 72 teps.. (debug:pr
8840: 69 6e 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 int 4 "Copying r
8850: 65 63 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 73 ecords in test_s
8860: 74 65 70 73 20 66 72 6f 6d 20 74 65 73 74 5f 69 teps from test_i
8870: 64 3d 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 d=" (db:test-get
8880: 2d 69 64 20 74 65 73 74 64 61 74 29 20 22 20 74 -id testdat) " t
8890: 6f 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 o " (db:test-get
88a0: 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 29 -id new-testdat)
88b0: 29 0a 09 20 28 73 71 6c 69 74 65 33 3a 65 78 65 ).. (sqlite3:exe
88c0: 63 75 74 65 20 0a 09 20 20 64 62 20 0a 09 20 20 cute .. db ..
88d0: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
88e0: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
88f0: 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 st_steps (test_i
8900: 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 d,stepname,state
8910: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
8920: 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 me,comment) "...
8930: 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 "SELECT " (db:te
8940: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
8950: 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 6d stdat) ",stepnam
8960: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 65 e,state,status,e
8970: 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 6e vent_time,commen
8980: 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 70 t FROM test_step
8990: 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d s WHERE test_id=
89a0: 3f 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74 ?;").. (db:test
89b0: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 -get-id testdat)
89c0: 29 0a 09 20 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 ).. ;; Now dupli
89d0: 63 61 74 65 20 74 68 65 20 74 65 73 74 20 64 61 cate the test da
89e0: 74 61 0a 09 20 28 64 65 62 75 67 3a 70 72 69 6e ta.. (debug:prin
89f0: 74 20 34 20 22 43 6f 70 79 69 6e 67 20 72 65 63 t 4 "Copying rec
8a00: 6f 72 64 73 20 69 6e 20 74 65 73 74 5f 64 61 74 ords in test_dat
8a10: 61 20 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 a from test_id="
8a20: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
8a30: 20 74 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 testdat) " to "
8a40: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
8a50: 20 6e 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 new-testdat))..
8a60: 20 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 (sqlite3:execut
8a70: 65 20 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f e .. db .. (co
8a80: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 nc "INSERT OR RE
8a90: 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f PLACE INTO test_
8aa0: 64 61 74 61 20 28 74 65 73 74 5f 69 64 2c 63 61 data (test_id,ca
8ab0: 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 2c tegory,variable,
8ac0: 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c 74 value,expected,t
8ad0: 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 ol,units,comment
8ae0: 29 20 22 0a 09 09 22 53 45 4c 45 43 54 20 22 20 ) "..."SELECT "
8af0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
8b00: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 22 2c 63 new-testdat) ",c
8b10: 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 6c 65 ategory,variable
8b20: 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 64 2c ,value,expected,
8b30: 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d 65 6e tol,units,commen
8b40: 74 20 46 52 4f 4d 20 74 65 73 74 5f 64 61 74 61 t FROM test_data
8b50: 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 3d 3f WHERE test_id=?
8b60: 3b 22 29 0a 09 20 20 28 64 62 3a 74 65 73 74 2d ;").. (db:test-
8b70: 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 29 get-id testdat))
8b80: 0a 09 20 29 29 0a 20 20 20 20 20 70 72 65 76 2d .. )). prev-
8b90: 74 65 73 74 73 29 29 29 0a 09 20 0a 20 20 20 20 tests))).. .
8ba0: 20 0a .