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 63 68 65 63 ))).. ;; chec
23d0: 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 69 k for hed in wai
23e0: 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f 75 tons => this wou
23f0: 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c 20 ld be circular,
2400: 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 73 remove it and is
2410: 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 65 sue an.. ;; e
2420: 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 6d rror.. (if (m
2430: 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f 6e ember hed waiton
2440: 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 20 s)...(begin...
2450: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
2460: 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 65 ERROR: test " he
2470: 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 d " has listed i
2480: 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f tself as a waito
2490: 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 n, please correc
24a0: 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 t this!")... (s
24b0: 65 74 21 20 77 61 69 74 6f 6e 73 20 28 66 69 6c et! waitons (fil
24c0: 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 ter (lambda (x)(
24d0: 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 65 not (equal? x he
24e0: 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 29 d))) waitons))))
24f0: 0a 09 20 20 20 20 0a 09 20 20 20 20 3b 3b 20 28 .. .. ;; (
2500: 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a 67 items (items:g
2510: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
2520: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a 09 nfig config)))..
2530: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 (if (not (ha
2540: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
2550: 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 64 ault test-record
2560: 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 61 s hed #f))...(ha
2570: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 sh-table-set! te
2580: 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 20 st-records.....
2590: 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 64 20 hed (vector hed
25a0: 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 20 ;; 0......
25b0: 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 0a config ;; 1.
25c0: 09 09 09 09 09 20 20 20 20 20 77 61 69 74 6f 6e ..... waiton
25d0: 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 20 s ;; 2......
25e0: 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 (config-lookup
25f0: 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d config "requirem
2600: 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 22 ents" "priority"
2610: 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 74 ) ;; priorit
2620: 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 28 6c y 3...... (l
2630: 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 20 20 et ((items
2640: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
2650: 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 default config "
2660: 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 69 items" #f)) ;; i
2670: 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20 20 tems 4.......
2680: 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61 73 (itemstable (has
2690: 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 h-table-ref/defa
26a0: 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 6d ult config "item
26b0: 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a 09 stable" #f))) ..
26c0: 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 .... ;; if
26d0: 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f 72 either items or
26e0: 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73 20 items table is
26f0: 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69 74 a proc return it
2700: 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e 67 so test running
2710: 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 ...... ;;
2720: 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f 77 process can know
2730: 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a 67 to call items:g
2740: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
2750: 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 20 20 nfig......
2760: 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 73 ;; if either is
2770: 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e 65 a list and none
2780: 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61 68 is a proc go ah
2790: 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 74 ead and call get
27a0: 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20 20 -items......
27b0: 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 20 ;; otherwise
27c0: 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69 73 return #f - this
27d0: 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 61 is not an itera
27e0: 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 20 20 ted test......
27f0: 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 09 (cond......
2800: 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 .((procedure? it
2810: 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09 09 ems) ......
2820: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
2830: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69 73 "INFO: items is
2840: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 a procedure, wi
2850: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a ll calc later").
2860: 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 20 20 ...... items)
2870: 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 ;; calc
2880: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 70 later.......((p
2890: 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 74 rocedure? itemst
28a0: 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 64 65 able)....... (de
28b0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
28c0: 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 69 73 O: itemstable is
28d0: 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 69 a procedure, wi
28e0: 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 0a ll calc later").
28f0: 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62 6c ...... itemstabl
2900: 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 63 e) ;; calc
2910: 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 66 later.......((f
2920: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 ilter (lambda (x
2930: 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65 74 )........ (let
2940: 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29 29 ((val (car x)))
2950: 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69 66 ........ (if
2960: 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61 6c (procedure? val
2970: 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09 09 ) val #f))).....
2980: 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66 20 ... (append (if
2990: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 (list? items) it
29a0: 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09 09 ems '())........
29b0: 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 . (if (list? ite
29c0: 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74 61 mstable) itemsta
29d0: 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09 09 ble '())))......
29e0: 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 . 'have-procedur
29f0: 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28 6c e).......((or (l
2a00: 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 74 ist? items)(list
2a10: 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 3b ? itemstable)) ;
2a20: 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 09 ; calc now......
2a30: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
2a40: 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61 6e "INFO: items an
2a50: 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 65 d itemstable are
2a60: 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f 77 lists, calc now
2a70: 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 20 \n"........
2a80: 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 69 " items: " i
2a90: 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 6c tems " itemstabl
2aa0: 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 29 e: " itemstable)
2ab0: 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a 67 ....... (items:g
2ac0: 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f et-items-from-co
2ad0: 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 09 nfig config))...
2ae0: 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 20 ....(else #f)))
2af0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b00: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f 74 ;; not
2b10: 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 20 iterated......
2b20: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 69 #f ;; i
2b30: 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 20 temsdat 5......
2b40: 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 73 #f ;; s
2b50: 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 20 pare - used for
2b60: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 20 item-path......
2b70: 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 6f ))).. (fo
2b80: 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 6c r-each .. (l
2b90: 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a 09 ambda (waiton)..
2ba0: 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 (if (and
2bb0: 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 6d waiton (not (mem
2bc0: 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 2d ber waiton test-
2bd0: 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 62 names)))... (b
2be0: 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 74 egin... (set
2bf0: 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 73 ! required-tests
2c00: 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 65 (cons waiton re
2c10: 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 quired-tests))..
2c20: 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 . (set! test
2c30: 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 69 -names (cons wai
2c40: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 ton test-names))
2c50: 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 70 ))) ;; was an ap
2c60: 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e 73 pend, now a cons
2c70: 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 0a .. waitons).
2c80: 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 . (let ((remt
2c90: 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 70 ests (delete-dup
2ca0: 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 20 licates (append
2cb0: 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 0a waitons tal)))).
2cc0: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 . (if (not
2cd0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 (null? remtests)
2ce0: 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 )... (loop (car
2cf0: 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 72 remtests)(cdr r
2d00: 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a 0a emtests)))))))..
2d10: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 (if (not (nu
2d20: 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 73 ll? required-tes
2d30: 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 69 ts))..(debug:pri
2d40: 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 69 nt 1 "INFO: Addi
2d50: 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 65 ng " required-te
2d60: 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 6e sts " to the run
2d70: 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b 3b queue")). ;;
2d80: 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 65 NOTE: these are
2d90: 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 74 all parent test
2da0: 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f 74 s, items are not
2db0: 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a 20 expanded yet..
2dc0: 20 20 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 (runs:run-tes
2dd0: 74 73 2d 71 75 65 75 65 20 64 62 20 72 75 6e 2d ts-queue db run-
2de0: 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d id runname test-
2df0: 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 records keyvalls
2e00: 74 20 66 6c 61 67 73 29 0a 20 20 20 20 28 69 66 t flags). (if
2e10: 20 2a 72 70 63 3a 6c 69 73 74 65 6e 65 72 2a 20 *rpc:listener*
2e20: 28 73 65 72 76 65 72 3a 6b 65 65 70 2d 72 75 6e (server:keep-run
2e30: 6e 69 6e 67 20 64 62 29 29 0a 20 20 20 20 28 64 ning db)). (d
2e40: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
2e50: 46 4f 3a 20 41 6c 6c 20 64 6f 6e 65 20 62 79 20 FO: All done by
2e60: 68 65 72 65 22 29 29 29 0a 0a 3b 3b 20 74 65 73 here")))..;; tes
2e70: 74 2d 72 65 63 6f 72 64 73 20 69 73 20 61 20 68 t-records is a h
2e80: 61 73 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61 ash table testna
2e90: 6d 65 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 me:item_path =>
2ea0: 76 65 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d vector < testnam
2eb0: 65 20 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69 e testconfig wai
2ec0: 74 6f 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74 tons priority it
2ed0: 65 6d 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 ems-info ... >.(
2ee0: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e define (runs:run
2ef0: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 64 62 20 -tests-queue db
2f00: 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 run-id runname t
2f10: 65 73 74 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 est-records keyv
2f20: 61 6c 6c 73 74 20 66 6c 61 67 73 29 0a 20 20 20 allst flags).
2f30: 20 3b 3b 20 41 74 20 74 68 69 73 20 70 6f 69 6e ;; At this poin
2f40: 74 20 74 68 65 20 6c 69 73 74 20 6f 66 20 70 61 t the list of pa
2f50: 72 65 6e 74 20 74 65 73 74 73 20 69 73 20 65 78 rent tests is ex
2f60: 70 61 6e 64 65 64 20 0a 20 20 20 20 3b 3b 20 4e panded . ;; N
2f70: 42 2f 2f 20 53 68 6f 75 6c 64 20 65 78 70 61 6e B// Should expan
2f80: 64 20 69 74 65 6d 73 20 68 65 72 65 20 61 6e 64 d items here and
2f90: 20 74 68 65 6e 20 69 6e 73 65 72 74 20 69 6e 74 then insert int
2fa0: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 2e o the run queue.
2fb0: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
2fc0: 35 20 22 74 65 73 74 2d 72 65 63 6f 72 64 73 3a 5 "test-records:
2fd0: 20 22 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 " test-records
2fe0: 22 2c 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 ", keyvallst: "
2ff0: 6b 65 79 76 61 6c 6c 73 74 20 22 20 66 6c 61 67 keyvallst " flag
3000: 73 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 s: " (hash-table
3010: 2d 3e 61 6c 69 73 74 20 66 6c 61 67 73 29 29 0a ->alist flags)).
3020: 20 20 28 6c 65 74 20 28 28 73 6f 72 74 65 64 2d (let ((sorted-
3030: 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 73 74 test-names (test
3040: 73 3a 73 6f 72 74 2d 62 79 2d 70 72 69 6f 72 69 s:sort-by-priori
3050: 74 79 2d 61 6e 64 2d 77 61 69 74 6f 6e 20 74 65 ty-and-waiton te
3060: 73 74 2d 72 65 63 6f 72 64 73 29 29 0a 09 28 69 st-records))..(i
3070: 74 65 6d 2d 70 61 74 74 73 20 20 20 20 20 20 20 tem-patts
3080: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
3090: 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 /default flags "
30a0: 2d 69 74 65 6d 70 61 74 74 22 20 23 66 29 29 29 -itempatt" #f)))
30b0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
30c0: 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74 65 73 74 ull? sorted-test
30d0: 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 74 20 6c -names))..(let l
30e0: 6f 6f 70 20 28 28 68 65 64 20 20 20 20 20 20 20 oop ((hed
30f0: 20 20 28 63 61 72 20 73 6f 72 74 65 64 2d 74 65 (car sorted-te
3100: 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 st-names))...
3110: 28 74 61 6c 20 20 20 20 20 20 20 20 20 28 63 64 (tal (cd
3120: 72 20 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 r sorted-test-na
3130: 6d 65 73 29 29 29 0a 09 20 20 28 6c 65 74 2a 20 mes))).. (let*
3140: 28 28 74 65 73 74 2d 72 65 63 6f 72 64 20 28 68 ((test-record (h
3150: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 20 74 65 ash-table-ref te
3160: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 29 29 st-records hed))
3170: 0a 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20 20 ... (tconfig
3180: 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 (tests:testqueu
3190: 65 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 e-get-testconfig
31a0: 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 test-record))..
31b0: 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20 20 28 . (waitons (
31c0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
31d0: 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 get-waitons t
31e0: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 est-record))...
31f0: 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 74 65 (priority (te
3200: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3210: 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65 73 t-priority tes
3220: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 t-record))... (i
3230: 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 73 74 temdat (test
3240: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
3250: 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d itemdat test-
3260: 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74 65 6d record)) ;; item
3270: 64 61 74 20 63 61 6e 20 62 65 20 61 20 73 74 72 dat can be a str
3280: 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23 66 0a ing, list or #f.
3290: 09 09 20 28 69 74 65 6d 73 20 20 20 20 20 20 20 .. (items
32a0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
32b0: 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20 20 20 -get-items
32c0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 test-record))...
32d0: 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28 69 (item-path (i
32e0: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 tem-list->path i
32f0: 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e 65 77 temdat))... (new
3300: 74 61 6c 20 20 20 20 20 20 28 61 70 70 65 6e 64 tal (append
3310: 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29 tal (list hed))
3320: 29 0a 09 09 20 28 63 61 6c 63 2d 66 61 69 6c 73 )... (calc-fails
3330: 20 20 28 6c 61 6d 62 64 61 20 28 70 72 65 72 65 (lambda (prere
3340: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 qs-not-met).....
3350: 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 (filter (lambda
3360: 28 74 65 73 74 29 0a 09 09 09 09 09 20 20 28 64 (test)...... (d
3370: 65 62 75 67 3a 70 72 69 6e 74 20 39 20 22 74 65 ebug:print 9 "te
3380: 73 74 3a 20 22 20 74 65 73 74 29 0a 09 09 09 09 st: " test).....
3390: 09 20 20 28 61 6e 64 20 28 76 65 63 74 6f 72 3f . (and (vector?
33a0: 20 74 65 73 74 29 20 3b 3b 20 6e 6f 74 20 28 73 test) ;; not (s
33b0: 74 72 69 6e 67 3f 20 74 65 73 74 29 29 0a 09 09 tring? test))...
33c0: 09 09 09 20 20 20 20 20 20 20 28 6e 6f 74 20 28 ... (not (
33d0: 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 73 74 2d member (db:test-
33e0: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 29 get-status test)
33f0: 0a 09 09 09 09 09 09 09 20 20 20 20 27 28 22 50 ........ '("P
3400: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 ASS" "WARN" "CHE
3410: 43 4b 22 20 22 57 41 49 56 45 44 22 29 29 29 29 CK" "WAIVED"))))
3420: 29 0a 09 09 09 09 09 70 72 65 72 65 71 73 2d 6e )......prereqs-n
3430: 6f 74 2d 6d 65 74 29 29 29 29 0a 09 20 20 20 20 ot-met))))..
3440: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 (debug:print 6..
3450: 09 09 20 22 69 74 65 6d 64 61 74 3a 20 20 20 20 .. "itemdat:
3460: 20 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 " itemdat.... "
3470: 5c 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 22 \n items: "
3480: 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 20 items.... "\n
3490: 69 74 65 6d 2d 70 61 74 68 3a 20 22 20 69 74 65 item-path: " ite
34a0: 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 m-path.... "\n
34b0: 77 61 69 74 6f 6e 73 3a 20 20 20 22 20 77 61 69 waitons: " wai
34c0: 74 6f 6e 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 tons)... ;; c
34d0: 68 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 heck for hed in
34e0: 77 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 waitons => this
34f0: 77 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 would be circula
3500: 72 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 r, remove it and
3510: 20 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b issue an.. ;
3520: 3b 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 ; error.. (if
3530: 20 28 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69 (member hed wai
3540: 74 6f 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 tons)...(begin..
3550: 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
3560: 30 20 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22 0 "ERROR: test "
3570: 20 68 65 64 20 22 20 68 61 73 20 6c 69 73 74 65 hed " has liste
3580: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 d itself as a wa
3590: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 iton, please cor
35a0: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 rect this!")...
35b0: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66 (set! waiton (f
35c0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 ilter (lambda (x
35d0: 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 )(not (equal? x
35e0: 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 hed))) waitons))
35f0: 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 0a 09 ))... (cond..
3600: 20 20 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 ((not items
3610: 29 20 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 ) ;; when false
3620: 74 68 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 the test is ok t
3630: 6f 20 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 o be handed off
3640: 74 6f 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e to launch (but n
3650: 6f 74 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 ot before)..
3660: 20 20 28 6c 65 74 2a 20 28 28 68 61 76 65 2d 72 (let* ((have-r
3670: 65 73 6f 75 72 63 65 73 20 20 28 72 75 6e 73 3a esources (runs:
3680: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
3690: 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 ts db test-recor
36a0: 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 d)) ;; look at t
36b0: 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 he test jobgroup
36c0: 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 and tot jobs ru
36d0: 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 70 72 nning... (pr
36e0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 ereqs-not-met (d
36f0: 62 3a 67 65 74 2d 70 72 65 72 65 71 73 2d 6e 6f b:get-prereqs-no
3700: 74 2d 6d 65 74 20 64 62 20 72 75 6e 2d 69 64 20 t-met db run-id
3710: 77 61 69 74 6f 6e 73 20 69 74 65 6d 2d 70 61 74 waitons item-pat
3720: 68 20 6d 6f 64 65 3a 20 28 63 6f 6e 66 69 67 2d h mode: (config-
3730: 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 lookup tconfig "
3740: 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 74 requirements" "t
3750: 65 73 74 6d 6f 64 65 22 29 29 29 0a 09 09 20 20 estmode")))...
3760: 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 20 (fails
3770: 20 20 20 20 28 63 61 6c 63 2d 66 61 69 6c 73 20 (calc-fails
3780: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 prereqs-not-met)
3790: 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e ))...(debug:prin
37a0: 74 20 38 20 22 49 4e 46 4f 3a 20 68 61 76 65 2d t 8 "INFO: have-
37b0: 72 65 73 6f 75 72 63 65 73 3a 20 22 20 68 61 76 resources: " hav
37c0: 65 2d 72 65 73 6f 75 72 63 65 73 20 22 20 70 72 e-resources " pr
37d0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 ereqs-not-met: "
37e0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
37f0: 20 22 20 66 61 69 6c 73 3a 20 22 20 66 61 69 6c " fails: " fail
3800: 73 29 0a 09 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e s)...;; Don't kn
3810: 6f 77 20 61 74 20 74 68 69 73 20 74 69 6d 65 20 ow at this time
3820: 69 66 20 74 68 65 20 74 65 73 74 20 68 61 76 65 if the test have
3830: 20 62 65 65 6e 20 6c 61 75 6e 63 68 65 64 20 61 been launched a
3840: 74 20 73 6f 6d 65 20 74 69 6d 65 20 69 6e 20 74 t some time in t
3850: 68 65 20 70 61 73 74 0a 09 09 3b 3b 20 69 2e 65 he past...;; i.e
3860: 2e 20 69 73 20 74 68 69 73 20 61 20 72 65 2d 6c . is this a re-l
3870: 61 75 6e 63 68 3f 0a 09 09 28 63 6f 6e 64 0a 09 aunch?...(cond..
3880: 09 20 28 28 61 6e 64 20 68 61 76 65 2d 72 65 73 . ((and have-res
3890: 6f 75 72 63 65 73 0a 09 09 20 20 20 20 20 20 20 ources...
38a0: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e (null? prereqs-n
38b0: 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 3b 3b 20 ot-met))... ;;
38c0: 6e 6f 20 6c 6f 6f 70 20 68 65 72 65 2c 20 6a 75 no loop here, ju
38d0: 73 74 20 64 72 6f 70 20 74 68 6f 75 67 68 20 61 st drop though a
38e0: 6e 64 20 75 73 65 20 74 68 65 20 6c 6f 6f 70 20 nd use the loop
38f0: 61 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 0a 09 at the bottom ..
3900: 09 20 20 28 69 66 20 28 70 61 74 74 2d 6c 69 73 . (if (patt-lis
3910: 74 2d 6d 61 74 63 68 20 69 74 65 6d 2d 70 61 74 t-match item-pat
3920: 68 20 69 74 65 6d 2d 70 61 74 74 73 29 0a 09 09 h item-patts)...
3930: 20 20 20 20 20 20 28 72 75 6e 3a 74 65 73 74 20 (run:test
3940: 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d db run-id runnam
3950: 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 74 e keyvallst test
3960: 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 23 66 -record flags #f
3970: 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 )... (debug
3980: 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 :print 1 "INFO:
3990: 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73 74 Skipping " (test
39a0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
39b0: 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 testname test-re
39c0: 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d 70 cord) " " item-p
39d0: 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65 73 ath " as it does
39e0: 6e 27 74 20 6d 61 74 63 68 20 22 20 69 74 65 6d n't match " item
39f0: 2d 70 61 74 74 73 29 29 0a 09 09 20 20 3b 3b 20 -patts))... ;;
3a00: 65 6c 73 65 20 74 68 65 20 72 75 6e 20 69 73 20 else the run is
3a10: 73 74 75 63 6b 2c 20 74 65 6d 70 6f 72 61 72 69 stuck, temporari
3a20: 6c 79 20 6f 72 20 70 65 72 6d 61 6e 65 6e 74 6c ly or permanentl
3a30: 79 0a 09 09 20 20 3b 3b 20 62 75 74 20 73 68 6f y... ;; but sho
3a40: 75 6c 64 20 63 68 65 63 6b 20 69 66 20 69 74 20 uld check if it
3a50: 69 73 20 64 75 65 20 74 6f 20 6c 61 63 6b 20 6f is due to lack o
3a60: 66 20 72 65 73 6f 75 72 63 65 73 20 76 73 2e 20 f resources vs.
3a70: 70 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 prerequisites...
3a80: 20 20 29 0a 09 09 20 28 28 6e 6f 74 20 68 61 76 )... ((not hav
3a90: 65 2d 72 65 73 6f 75 72 63 65 73 29 20 3b 3b 20 e-resources) ;;
3aa0: 73 69 6d 70 6c 79 20 74 72 79 20 61 67 61 69 6e simply try again
3ab0: 20 61 66 74 65 72 20 77 61 69 74 69 6e 67 20 61 after waiting a
3ac0: 20 73 65 63 6f 6e 64 0a 09 09 20 20 28 74 68 72 second... (thr
3ad0: 65 61 64 2d 73 6c 65 65 70 21 20 31 2e 30 29 0a ead-sleep! 1.0).
3ae0: 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 .. (debug:print
3af0: 20 31 20 22 49 4e 46 4f 3a 20 6e 6f 20 72 65 73 1 "INFO: no res
3b00: 6f 75 72 63 65 73 20 74 6f 20 72 75 6e 20 6e 65 ources to run ne
3b10: 77 20 74 65 73 74 73 2c 20 77 61 69 74 69 6e 67 w tests, waiting
3b20: 20 2e 2e 2e 22 29 0a 09 09 20 20 3b 3b 20 63 6f ...")... ;; co
3b30: 75 6c 64 20 68 61 76 65 20 64 6f 6e 65 20 68 65 uld have done he
3b40: 64 20 74 61 6c 20 68 65 72 65 20 62 75 74 20 64 d tal here but d
3b50: 6f 69 6e 67 20 63 61 72 2f 63 64 72 20 6f 66 20 oing car/cdr of
3b60: 6e 65 77 74 61 6c 20 74 6f 20 72 6f 74 61 74 65 newtal to rotate
3b70: 20 74 65 73 74 73 0a 09 09 20 20 28 6c 6f 6f 70 tests... (loop
3b80: 20 28 63 61 72 20 6e 65 77 74 61 6c 29 28 63 64 (car newtal)(cd
3b90: 72 20 6e 65 77 74 61 6c 29 29 29 0a 09 09 20 28 r newtal)))... (
3ba0: 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 else ;; must be
3bb0: 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70 72 we have unmet pr
3bc0: 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 erequisites...
3bd0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
3be0: 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 "FAILS: " fails
3bf0: 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e )... ;; If on
3c00: 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 e or more of the
3c10: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
3c20: 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20 77 are FAIL then w
3c30: 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20 20 e can issue...
3c40: 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 61 ;; a message a
3c50: 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f 6d nd drop hed from
3c60: 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62 65 the items to be
3c70: 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 processed....
3c80: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 (if (null? fai
3c90: 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 ls)....(begin...
3ca0: 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 . ;; couldn't r
3cb0: 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 un, take a breat
3cc0: 68 65 72 0a 09 09 09 20 20 28 64 65 62 75 67 3a her.... (debug:
3cd0: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 53 print 4 "INFO: S
3ce0: 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20 houldn't really
3cf0: 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 20 63 get here, race c
3d00: 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 ondition? Unable
3d10: 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20 to launch more
3d20: 74 65 73 74 73 20 61 74 20 74 68 69 73 20 6d 6f tests at this mo
3d30: 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 ment, killing ti
3d40: 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 28 74 me ...").... (t
3d50: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 hread-sleep! 0.1
3d60: 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20 ) ;; long sleep
3d70: 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72 here - no resour
3d80: 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c ces, may as well
3d90: 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20 be patient....
3da0: 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20 ;; we made new
3db0: 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20 tal by sticking
3dc0: 68 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20 hed at the back
3dd0: 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20 of the list....
3de0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 (loop (car newt
3df0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 29 al)(cdr newtal))
3e00: 29 0a 09 09 09 3b 3b 20 74 68 65 20 77 61 69 74 )....;; the wait
3e10: 6f 6e 20 69 73 20 46 41 49 4c 20 73 6f 20 6e 6f on is FAIL so no
3e20: 20 70 6f 69 6e 74 20 69 6e 20 74 72 79 69 6e 67 point in trying
3e30: 20 74 6f 20 72 75 6e 20 68 65 64 20 65 76 65 72 to run hed ever
3e40: 20 61 67 61 69 6e 0a 09 09 09 28 69 66 20 28 6e again....(if (n
3e50: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a ot (null? tal)).
3e60: 09 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 ... (begin...
3e70: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
3e80: 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 44 72 6f int 1 "WARN: Dro
3e90: 70 70 69 6e 67 20 74 65 73 74 20 22 20 28 64 62 pping test " (db
3ea0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 2d 6e :test-get-test-n
3eb0: 61 6d 65 20 68 65 64 29 20 22 2f 22 20 28 64 62 ame hed) "/" (db
3ec0: 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 :test-get-item-p
3ed0: 61 74 68 20 68 65 64 29 0a 09 09 09 09 09 20 20 ath hed)......
3ee0: 20 22 20 66 72 6f 6d 20 74 68 65 20 6c 61 75 6e " from the laun
3ef0: 63 68 20 6c 69 73 74 20 61 73 20 69 74 20 68 61 ch list as it ha
3f00: 73 20 70 72 65 72 65 71 75 69 73 74 65 73 20 74 s prerequistes t
3f10: 68 61 74 20 61 72 65 20 46 41 49 4c 22 29 0a 09 hat are FAIL")..
3f20: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 .. (loop (c
3f30: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 ar tal)(cdr tal)
3f40: 29 29 29 29 29 29 29 29 0a 09 20 20 20 20 20 0a )))))))).. .
3f50: 09 20 20 20 20 20 3b 3b 20 63 61 73 65 20 77 68 . ;; case wh
3f60: 65 72 65 20 61 6e 20 69 74 65 6d 73 20 63 61 6d ere an items cam
3f70: 65 20 69 6e 20 61 73 20 61 20 6c 69 73 74 20 62 e in as a list b
3f80: 65 65 6e 20 70 72 6f 63 65 73 73 65 64 0a 09 20 een processed..
3f90: 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 3f ((and (list?
3fa0: 20 69 74 65 6d 73 29 20 20 20 20 20 3b 3b 20 74 items) ;; t
3fb0: 68 75 73 20 77 65 20 6b 6e 6f 77 20 6f 75 72 20 hus we know our
3fc0: 69 74 65 6d 73 20 61 72 65 20 61 6c 72 65 61 64 items are alread
3fd0: 79 20 63 61 6c 63 75 6c 61 74 65 64 0a 09 09 20 y calculated...
3fe0: 20 20 28 6e 6f 74 20 20 20 69 74 65 6d 64 61 74 (not itemdat
3ff0: 29 29 20 3b 3b 20 61 6e 64 20 6e 6f 74 20 79 65 )) ;; and not ye
4000: 74 20 65 78 70 61 6e 64 65 64 20 69 6e 74 6f 20 t expanded into
4010: 74 68 65 20 6c 69 73 74 20 6f 66 20 74 68 69 6e the list of thin
4020: 67 73 20 74 6f 20 62 65 20 64 6f 6e 65 0a 09 20 gs to be done..
4030: 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 3e (if (and (>
4040: 3d 20 2a 76 65 72 62 6f 73 69 74 79 2a 20 31 29 = *verbosity* 1)
4050: 0a 09 09 20 20 20 20 20 20 20 28 3e 20 28 6c 65 ... (> (le
4060: 6e 67 74 68 20 69 74 65 6d 73 29 20 30 29 0a 09 ngth items) 0)..
4070: 09 20 20 20 20 20 20 20 28 3e 20 28 6c 65 6e 67 . (> (leng
4080: 74 68 20 28 63 61 72 20 69 74 65 6d 73 29 29 20 th (car items))
4090: 30 29 29 0a 09 09 20 20 28 70 70 20 69 74 65 6d 0))... (pp item
40a0: 73 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 28 69 s)).. ;; (i
40b0: 66 20 28 3e 3d 20 2a 76 65 72 62 6f 73 69 74 79 f (>= *verbosity
40c0: 2a 20 35 29 0a 09 20 20 20 20 20 20 3b 3b 20 20 * 5).. ;;
40d0: 20 20 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 (begin..
40e0: 20 3b 3b 20 20 20 20 20 20 20 28 70 72 69 6e 74 ;; (print
40f0: 20 22 69 74 65 6d 73 3a 20 22 29 20 20 20 20 20 "items: ")
4100: 28 70 70 20 28 69 74 65 6d 2d 61 73 73 6f 63 2d (pp (item-assoc-
4110: 3e 69 74 65 6d 2d 6c 69 73 74 20 69 74 65 6d 73 >item-list items
4120: 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 20 20 20 )).. ;;
4130: 20 20 20 28 70 72 69 6e 74 20 22 69 74 65 6d 73 (print "items
4140: 74 61 62 6c 65 3a 20 22 29 28 70 70 20 28 69 74 table: ")(pp (it
4150: 65 6d 2d 74 61 62 6c 65 2d 3e 69 74 65 6d 2d 6c em-table->item-l
4160: 69 73 74 20 69 74 65 6d 73 74 61 62 6c 65 29 29 ist itemstable))
4170: 29 29 0a 09 20 20 20 20 20 20 28 66 6f 72 2d 65 )).. (for-e
4180: 61 63 68 0a 09 20 20 20 20 20 20 20 28 6c 61 6d ach.. (lam
4190: 62 64 61 20 28 6d 79 2d 69 74 65 6d 64 61 74 29 bda (my-itemdat)
41a0: 0a 09 09 20 28 6c 65 74 2a 20 28 28 6e 65 77 2d ... (let* ((new-
41b0: 74 65 73 74 2d 72 65 63 6f 72 64 20 28 6c 65 74 test-record (let
41c0: 20 28 28 6e 65 77 72 65 63 20 28 6d 61 6b 65 2d ((newrec (make-
41d0: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 29 tests:testqueue)
41e0: 29 29 0a 09 09 09 09 09 20 20 20 28 76 65 63 74 ))...... (vect
41f0: 6f 72 2d 63 6f 70 79 21 20 74 65 73 74 2d 72 65 or-copy! test-re
4200: 63 6f 72 64 20 6e 65 77 72 65 63 29 0a 09 09 09 cord newrec)....
4210: 09 09 20 20 20 6e 65 77 72 65 63 29 29 0a 09 09 .. newrec))...
4220: 09 28 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 28 .(my-item-path (
4230: 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 item-list->path
4240: 6d 79 2d 69 74 65 6d 64 61 74 29 29 29 0a 09 09 my-itemdat)))...
4250: 20 20 20 28 69 66 20 28 70 61 74 74 2d 6c 69 73 (if (patt-lis
4260: 74 2d 6d 61 74 63 68 20 6d 79 2d 69 74 65 6d 2d t-match my-item-
4270: 70 61 74 68 20 69 74 65 6d 2d 70 61 74 74 73 29 path item-patts)
4280: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 79 65 ;; ye
4290: 73 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 70 72 s, we want to pr
42a0: 6f 63 65 73 73 20 74 68 69 73 20 69 74 65 6d 2c ocess this item,
42b0: 20 4e 4f 54 45 3a 20 53 68 6f 75 6c 64 20 6e 6f NOTE: Should no
42c0: 74 20 6e 65 65 64 20 74 68 69 73 20 63 68 65 63 t need this chec
42d0: 6b 20 68 65 72 65 21 0a 09 09 20 20 20 20 20 20 k here!...
42e0: 20 28 6c 65 74 20 28 28 6e 65 77 74 65 73 74 6e (let ((newtestn
42f0: 61 6d 65 20 28 63 6f 6e 63 20 68 65 64 20 22 2f ame (conc hed "/
4300: 22 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 29 " my-item-path))
4310: 29 20 20 20 20 3b 3b 20 74 65 73 74 20 6e 61 6d ) ;; test nam
4320: 65 73 20 61 72 65 20 75 6e 69 71 75 65 20 6f 6e es are unique on
4330: 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 6d 2d 70 testname/item-p
4340: 61 74 68 0a 09 09 09 20 28 74 65 73 74 73 3a 74 ath.... (tests:t
4350: 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 estqueue-set-ite
4360: 6d 73 21 20 20 20 20 20 6e 65 77 2d 74 65 73 74 ms! new-test
4370: 2d 72 65 63 6f 72 64 20 23 66 29 0a 09 09 09 20 -record #f)....
4380: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
4390: 2d 73 65 74 2d 69 74 65 6d 64 61 74 21 20 20 20 -set-itemdat!
43a0: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 new-test-record
43b0: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 09 20 my-itemdat)....
43c0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
43d0: 2d 73 65 74 2d 69 74 65 6d 5f 70 61 74 68 21 20 -set-item_path!
43e0: 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 new-test-record
43f0: 6d 79 2d 69 74 65 6d 2d 70 61 74 68 29 0a 09 09 my-item-path)...
4400: 09 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 . (hash-table-se
4410: 74 21 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 t! test-records
4420: 6e 65 77 74 65 73 74 6e 61 6d 65 20 6e 65 77 2d newtestname new-
4430: 74 65 73 74 2d 72 65 63 6f 72 64 29 0a 09 09 09 test-record)....
4440: 20 28 73 65 74 21 20 74 61 6c 20 28 63 6f 6e 73 (set! tal (cons
4450: 20 6e 65 77 74 65 73 74 6e 61 6d 65 20 74 61 6c newtestname tal
4460: 29 29 29 29 29 29 20 3b 3b 20 73 69 6e 63 65 20 )))))) ;; since
4470: 74 68 65 73 65 20 61 72 65 20 69 74 65 6d 69 7a these are itemiz
4480: 65 64 20 63 72 65 61 74 65 20 6e 65 77 20 74 65 ed create new te
4490: 73 74 20 6e 61 6d 65 73 20 74 65 73 74 6e 61 6d st names testnam
44a0: 65 2f 69 74 65 6d 70 61 74 68 0a 09 20 20 20 20 e/itempath..
44b0: 20 20 20 69 74 65 6d 73 29 0a 09 20 20 20 20 20 items)..
44c0: 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f (if (not (null?
44d0: 20 74 61 6c 29 29 0a 09 09 20 20 28 6c 6f 6f 70 tal))... (loop
44e0: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 (car tal)(cdr t
44f0: 61 6c 29 29 29 29 0a 0a 09 20 20 20 20 20 3b 3b al))))... ;;
4500: 20 69 66 20 69 74 65 6d 73 20 69 73 20 61 20 70 if items is a p
4510: 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 20 74 6f roc then need to
4520: 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 74 2d 69 run items:get-i
4530: 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 tems-from-config
4540: 2c 20 67 65 74 20 74 68 65 20 6c 69 73 74 20 61 , get the list a
4550: 6e 64 20 6c 6f 6f 70 20 0a 09 20 20 20 20 20 3b nd loop .. ;
4560: 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e 6c 79 20 ; - but only
4570: 64 6f 20 74 68 61 74 20 69 66 20 72 65 73 6f 75 do that if resou
4580: 72 63 65 73 20 65 78 69 73 74 20 74 6f 20 6b 69 rces exist to ki
4590: 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f 62 0a 09 ck off the job..
45a0: 20 20 20 20 20 28 28 6f 72 20 28 70 72 6f 63 65 ((or (proce
45b0: 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71 3f dure? items)(eq?
45c0: 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72 6f items 'have-pro
45d0: 63 65 64 75 72 65 29 29 0a 09 20 20 20 20 20 20 cedure))..
45e0: 28 6c 65 74 2a 20 28 28 63 61 6e 2d 72 75 6e 2d (let* ((can-run-
45f0: 6d 6f 72 65 20 20 20 20 28 72 75 6e 73 3a 63 61 more (runs:ca
4600: 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 73 n-run-more-tests
4610: 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 64 29 db test-record)
4620: 29 0a 09 09 20 20 20 20 20 28 70 72 65 72 65 71 )... (prereq
4630: 73 2d 6e 6f 74 2d 6d 65 74 20 28 64 62 3a 67 65 s-not-met (db:ge
4640: 74 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 t-prereqs-not-me
4650: 74 20 64 62 20 72 75 6e 2d 69 64 20 77 61 69 74 t db run-id wait
4660: 6f 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f ons item-path mo
4670: 64 65 3a 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b de: (config-look
4680: 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 up tconfig "requ
4690: 69 72 65 6d 65 6e 74 73 22 20 22 74 65 73 74 6d irements" "testm
46a0: 6f 64 65 22 29 29 29 0a 09 09 20 20 20 20 20 28 ode")))... (
46b0: 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 fails
46c0: 28 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 (calc-fails prer
46d0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 eqs-not-met)))..
46e0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 .(debug:print 8
46f0: 22 49 4e 46 4f 3a 20 63 61 6e 2d 72 75 6e 2d 6d "INFO: can-run-m
4700: 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d ore: " can-run-m
4710: 6f 72 65 0a 09 09 09 20 20 20 20 20 22 20 70 72 ore.... " pr
4720: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 5c 6e ereqs-not-met:\n
4730: 20 20 22 20 28 69 6e 74 65 72 73 70 65 72 73 65 " (intersperse
4740: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
4750: 20 22 5c 6e 22 29 0a 09 09 09 20 20 20 20 20 22 "\n").... "
4760: 20 66 61 69 6c 73 3a 5c 6e 20 22 20 20 20 20 20 fails:\n "
4770: 20 20 20 20 20 20 20 28 69 6e 74 65 72 73 70 65 (interspe
4780: 72 73 65 20 66 61 69 6c 73 20 22 5c 6e 22 29 29 rse fails "\n"))
4790: 0a 09 09 28 63 6f 6e 64 20 0a 09 09 20 28 28 61 ...(cond ... ((a
47a0: 6e 64 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 nd can-run-more
47b0: 28 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e (null? prereqs-n
47c0: 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 28 6c 65 ot-met))... (le
47d0: 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 t ((test-name (t
47e0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
47f0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
4800: 2d 72 65 63 6f 72 64 29 29 29 0a 09 09 20 20 20 -record)))...
4810: 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 (setenv "MT_TES
4820: 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d T_NAME" test-nam
4830: 65 29 20 3b 3b 20 0a 09 09 20 20 20 20 28 73 65 e) ;; ... (se
4840: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 tenv "MT_RUNNAME
4850: 22 20 20 20 72 75 6e 6e 61 6d 65 29 0a 09 09 20 " runname)...
4860: 20 20 20 28 73 65 74 2d 6d 65 67 61 74 65 73 74 (set-megatest
4870: 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 6e -env-vars db run
4880: 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d 61 -id) ;; these ma
4890: 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 74 y be needed by t
48a0: 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 6f he launching pro
48b0: 63 65 73 73 0a 09 09 20 20 20 20 28 6c 65 74 20 cess... (let
48c0: 28 28 69 74 65 6d 73 2d 6c 69 73 74 20 28 69 74 ((items-list (it
48d0: 65 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 ems:get-items-fr
48e0: 6f 6d 2d 63 6f 6e 66 69 67 20 74 63 6f 6e 66 69 om-config tconfi
48f0: 67 29 29 29 0a 09 09 20 20 20 20 20 20 28 69 66 g)))... (if
4900: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 2d 6c 69 (list? items-li
4910: 73 74 29 0a 09 09 09 20 20 28 62 65 67 69 6e 0a st).... (begin.
4920: 09 09 09 20 20 20 20 28 74 65 73 74 73 3a 74 65 ... (tests:te
4930: 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d stqueue-set-item
4940: 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 69 s! test-record i
4950: 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 20 20 tems-list)....
4960: 20 20 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 29 (loop hed tal)
4970: 29 0a 09 09 09 20 20 28 62 65 67 69 6e 0a 09 09 ).... (begin...
4980: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
4990: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 t 0 "ERROR: The
49a0: 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e proc from readin
49b0: 67 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20 g the setup did
49c0: 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 not yield a list
49d0: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 - please report
49e0: 20 74 68 69 73 22 29 0a 09 09 09 20 20 20 20 28 this").... (
49f0: 65 78 69 74 20 31 29 29 29 29 29 29 0a 09 09 20 exit 1))))))...
4a00: 28 28 61 6e 64 20 63 61 6e 2d 72 75 6e 2d 6d 6f ((and can-run-mo
4a10: 72 65 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 re (null? fails)
4a20: 29 0a 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 )... (debug:pri
4a30: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 43 61 6e 27 nt 4 "INFO: Can'
4a40: 74 20 72 75 6e 20 6d 6f 72 65 20 72 69 67 68 74 t run more right
4a50: 20 6e 6f 77 2c 20 6b 69 6c 6c 69 6e 67 20 61 20 now, killing a
4a60: 6c 69 74 74 6c 65 20 74 69 6d 65 20 2e 2e 2e 22 little time ..."
4a70: 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 6c )... (thread-sl
4a80: 65 65 70 21 20 33 2e 30 29 0a 09 09 20 20 28 6c eep! 3.0)... (l
4a90: 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c 29 oop (car newtal)
4aa0: 28 63 64 72 20 6e 65 77 74 61 6c 29 29 29 20 3b (cdr newtal))) ;
4ab0: 3b 20 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 ; an issue with
4ac0: 70 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 prereqs not yet
4ad0: 6d 65 74 3f 0a 09 09 20 28 65 6c 73 65 0a 09 09 met?... (else...
4ae0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 (debug:print 1
4af0: 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 22 20 20 "INFO: test "
4b00: 68 65 64 20 22 20 68 61 73 20 66 61 69 6c 65 64 hed " has failed
4b10: 20 70 72 65 72 65 71 75 69 73 69 74 65 28 73 29 prerequisite(s)
4b20: 3b 20 22 0a 09 09 09 20 20 20 20 20 20 20 28 73 ; ".... (s
4b30: 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 tring-interspers
4b40: 65 20 28 6d 61 70 20 64 62 3a 74 65 73 74 2d 67 e (map db:test-g
4b50: 65 74 2d 74 65 73 74 6e 61 6d 65 20 66 61 69 6c et-testname fail
4b60: 73 29 20 22 2c 20 22 29 0a 09 09 09 20 20 20 20 s) ", ")....
4b70: 20 20 20 22 2c 20 72 65 6d 6f 76 69 6e 67 20 69 ", removing i
4b80: 74 20 66 72 6f 6d 20 74 6f 2d 64 6f 20 6c 69 73 t from to-do lis
4b90: 74 22 29 0a 09 09 20 20 28 69 66 20 28 6e 6f 74 t")... (if (not
4ba0: 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 (null? tal))...
4bb0: 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 (loop (car
4bc0: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 29 29 tal)(cdr tal)))
4bd0: 29 29 29 29 0a 09 20 20 20 20 20 0a 09 20 20 20 )))).. ..
4be0: 20 20 3b 3b 20 74 68 69 73 20 63 61 73 65 20 73 ;; this case s
4bf0: 68 6f 75 6c 64 20 6e 6f 74 20 68 61 70 70 65 6e hould not happen
4c00: 2c 20 61 64 64 65 64 20 74 6f 20 68 65 6c 70 20 , added to help
4c10: 63 61 74 63 68 20 61 6e 79 20 62 75 67 73 0a 09 catch any bugs..
4c20: 20 20 20 20 20 28 28 61 6e 64 20 28 6c 69 73 74 ((and (list
4c30: 3f 20 69 74 65 6d 73 29 20 69 74 65 6d 64 61 74 ? items) itemdat
4c40: 29 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a ).. (debug:
4c50: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
4c60: 53 68 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 Should not have
4c70: 61 20 6c 69 73 74 20 6f 66 20 69 74 65 6d 73 20 a list of items
4c80: 69 6e 20 61 20 74 65 73 74 20 61 6e 64 20 74 68 in a test and th
4c90: 65 20 69 74 65 6d 73 70 61 74 68 20 73 65 74 20 e itemspath set
4ca0: 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 20 - please report
4cb0: 74 68 69 73 22 29 0a 09 20 20 20 20 20 20 28 65 this").. (e
4cc0: 78 69 74 20 31 29 29 29 29 0a 09 20 20 0a 09 20 xit 1)))).. ..
4cd0: 20 3b 3b 20 77 65 20 67 65 74 20 68 65 72 65 20 ;; we get here
4ce0: 6f 6e 20 22 64 72 6f 70 20 74 68 72 6f 75 67 68 on "drop through
4cf0: 22 20 2d 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 " - loop for nex
4d00: 74 20 74 65 73 74 20 69 6e 20 71 75 65 75 65 0a t test in queue.
4d10: 09 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 . (if (null? ta
4d20: 6c 29 0a 09 20 20 20 20 20 20 28 62 65 67 69 6e l).. (begin
4d30: 0a 09 09 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 ...;; FIXME!!!!
4d40: 54 48 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 THIS SHOULD NOT
4d50: 52 45 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 REQUIRE AN EXIT!
4d60: 21 21 21 21 21 21 0a 09 09 28 64 65 62 75 67 3a !!!!!!...(debug:
4d70: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 print 1 "INFO: A
4d80: 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 ll tests launche
4d90: 64 22 29 0a 09 09 28 74 68 72 65 61 64 2d 73 6c d")...(thread-sl
4da0: 65 65 70 21 20 30 2e 35 29 0a 09 09 3b 3b 20 46 eep! 0.5)...;; F
4db0: 49 58 4d 45 21 20 54 68 69 73 20 68 61 72 73 68 IXME! This harsh
4dc0: 20 65 78 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 exit should not
4dd0: 20 62 65 20 6e 65 63 65 73 73 61 72 79 2e 2e 2e be necessary...
4de0: 2e 0a 09 09 28 69 66 20 28 6e 6f 74 20 2a 72 75 ....(if (not *ru
4df0: 6e 72 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 nremote*)(exit))
4e00: 20 3b 3b 20 0a 09 09 23 66 29 20 3b 3b 20 72 65 ;; ...#f) ;; re
4e10: 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 68 turn a #f as a h
4e20: 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 20 int that we are
4e30: 64 6f 6e 65 0a 09 20 20 20 20 20 20 3b 3b 20 48 done.. ;; H
4e40: 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 63 ere we need to c
4e50: 68 65 63 6b 20 74 68 61 74 20 61 6c 6c 20 74 68 heck that all th
4e60: 65 20 74 65 73 74 73 20 72 65 6d 61 69 6e 69 6e e tests remainin
4e70: 67 20 74 6f 20 62 65 20 72 75 6e 20 61 72 65 20 g to be run are
4e80: 65 6c 69 67 69 62 6c 65 20 74 6f 20 72 75 6e 0a eligible to run.
4e90: 09 20 20 20 20 20 20 3b 3b 20 61 6e 64 20 61 72 . ;; and ar
4ea0: 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 62 79 e not blocked by
4eb0: 20 66 61 69 6c 65 64 0a 09 20 20 20 20 20 20 28 failed.. (
4ec0: 6c 65 74 20 28 28 6e 65 77 6c 73 74 20 28 74 65 let ((newlst (te
4ed0: 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d 72 sts:filter-non-r
4ee0: 75 6e 6e 61 62 6c 65 20 64 62 20 72 75 6e 2d 69 unnable db run-i
4ef0: 64 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f 72 d tal test-recor
4f00: 64 73 29 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f ds))) ;; i.e. no
4f10: 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 t FAIL, WAIVED,
4f20: 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 INCOMPLETE, PASS
4f30: 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 28 74 68 72 , KILLED,...(thr
4f40: 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 31 29 0a ead-sleep! 0.1).
4f50: 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c ..(if (not (null
4f60: 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 20 20 20 ? newlst))...
4f70: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 6c (loop (car newl
4f80: 73 74 29 28 63 64 72 20 6e 65 77 6c 73 74 29 29 st)(cdr newlst))
4f90: 29 29 29 29 29 29 29 0a 0a 3b 3b 20 70 61 72 65 )))))))..;; pare
4fa0: 6e 74 2d 74 65 73 74 20 69 73 20 74 68 65 72 65 nt-test is there
4fb0: 20 61 73 20 61 20 70 6c 61 63 65 68 6f 6c 64 65 as a placeholde
4fc0: 72 20 66 6f 72 20 77 68 65 6e 20 70 61 72 65 6e r for when paren
4fd0: 74 2d 74 65 73 74 73 20 63 61 6e 20 62 65 20 72 t-tests can be r
4fe0: 75 6e 20 61 73 20 61 20 73 65 74 75 70 20 73 74 un as a setup st
4ff0: 65 70 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 3a ep.(define (run:
5000: 74 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 72 test db run-id r
5010: 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 unname keyvallst
5020: 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 test-record fla
5030: 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 29 0a gs parent-test).
5040: 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 20 76 ;; All these v
5050: 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 65 66 ars might be ref
5060: 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 74 erenced by the t
5070: 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 20 72 estconfig file r
5080: 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 28 28 eader. (let* ((
5090: 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 74 65 test-name (te
50a0: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
50b0: 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 65 73 t-testname tes
50c0: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 t-record)).. (te
50d0: 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 73 74 st-waitons (test
50e0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
50f0: 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 74 2d waitons test-
5100: 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 record)).. (test
5110: 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 73 3a -conf (tests:
5120: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
5130: 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d 72 65 stconfig test-re
5140: 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d 64 61 cord)).. (itemda
5150: 74 20 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 t (tests:te
5160: 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d stqueue-get-item
5170: 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 63 6f dat test-reco
5180: 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 61 74 rd)).. (test-pat
5190: 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 h (conc *topp
51a0: 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 ath* "/tests/" t
51b0: 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 63 6f est-name)) ;; co
51c0: 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a 67 65 uld use tests:ge
51d0: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 72 t-testconfig her
51e0: 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 20 20 e ..... (force
51f0: 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c (hash-tabl
5200: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c e-ref/default fl
5210: 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 66 29 ags "-force" #f)
5220: 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 20 20 ).. (rerun
5230: 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 (hash-table-re
5240: 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 f/default flags
5250: 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a 09 20 "-rerun" #f))..
5260: 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 28 68 (keepgoing (h
5270: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
5280: 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b 65 fault flags "-ke
5290: 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 20 epgoing" #f))..
52a0: 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 20 22 (item-path "
52b0: 22 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ")). (debug:p
52c0: 72 69 6e 74 20 35 0a 09 09 20 22 74 65 73 74 2d rint 5... "test-
52d0: 63 6f 6e 66 69 67 3a 20 22 20 28 68 61 73 68 2d config: " (hash-
52e0: 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 table->alist tes
52f0: 74 2d 63 6f 6e 66 29 0a 09 09 20 22 5c 6e 20 20 t-conf)... "\n
5300: 20 69 74 65 6d 64 61 74 3a 20 22 20 69 74 65 6d itemdat: " item
5310: 64 61 74 0a 09 09 20 29 0a 20 20 20 20 3b 3b 20 dat... ). ;;
5320: 73 65 74 74 69 6e 67 20 69 74 65 6d 64 61 74 20 setting itemdat
5330: 74 6f 20 61 20 6c 69 73 74 20 69 66 20 69 74 20 to a list if it
5340: 69 73 20 23 66 0a 20 20 20 20 28 69 66 20 28 6e is #f. (if (n
5350: 6f 74 20 69 74 65 6d 64 61 74 29 28 73 65 74 21 ot itemdat)(set!
5360: 20 69 74 65 6d 64 61 74 20 27 28 29 29 29 0a 20 itemdat '())).
5370: 20 20 20 28 73 65 74 21 20 69 74 65 6d 2d 70 61 (set! item-pa
5380: 74 68 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 th (item-list->p
5390: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 20 20 ath itemdat)).
53a0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
53b0: 20 22 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 "Attempting to
53c0: 6c 61 75 6e 63 68 20 74 65 73 74 20 22 20 74 65 launch test " te
53d0: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d st-name "/" item
53e0: 2d 70 61 74 68 29 0a 20 20 20 20 28 73 65 74 65 -path). (sete
53f0: 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 nv "MT_TEST_NAME
5400: 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 " test-name) ;;
5410: 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 . (setenv "MT
5420: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e _RUNNAME" runn
5430: 61 6d 65 29 0a 20 20 20 20 28 73 65 74 2d 6d 65 ame). (set-me
5440: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 gatest-env-vars
5450: 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 db run-id) ;; th
5460: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 ese may be neede
5470: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 d by the launchi
5480: 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 28 ng process. (
5490: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 change-directory
54a0: 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 20 *toppath*)..
54b0: 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 72 ;; Here is wher
54c0: 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 e the test_meta
54d0: 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 70 table is best up
54e0: 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 73 dated. ;; Yes
54f0: 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f 66 , another use of
5500: 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 61 a global for ca
5510: 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 65 ching. Need a be
5520: 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 69 tter way?. (i
5530: 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 f (not (hash-tab
5540: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a le-ref/default *
5550: 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 test-meta-update
5560: 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 29 d* test-name #f)
5570: 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 6e ). (begin
5580: 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 .. (hash-table
5590: 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 61 -set! *test-meta
55a0: 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e -updated* test-n
55b0: 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 20 ame #t).
55c0: 20 20 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d (runs:update-
55d0: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 test_meta db tes
55e0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 t-name test-conf
55f0: 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 ))). . ;;
5600: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 (lambda (itemdat
5610: 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 ) ;;; ((ripeness
5620: 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 "overripe") (te
5630: 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 mperature "cool"
5640: 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 ) (season "summe
5650: 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 r")). (let* (
5660: 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 (new-test-path (
5670: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
5680: 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 se (cons test-pa
5690: 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 th (map cadr ite
56a0: 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 mdat)) "/"))..
56b0: 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 (new-test-name
56c0: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
56d0: 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e -path "") test-n
56e0: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e ame (conc test-n
56f0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
5700: 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 h))) ;; just nee
5710: 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 d it to be uniqu
5720: 65 0a 09 20 20 20 28 74 65 73 74 64 61 74 20 20 e.. (testdat
5730: 20 20 20 20 20 28 64 62 3a 67 65 74 2d 74 65 73 (db:get-tes
5740: 74 2d 69 6e 66 6f 20 64 62 20 72 75 6e 2d 69 64 t-info db run-id
5750: 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d test-name item-
5760: 70 61 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 path)).. (test
5770: 2d 69 64 20 20 20 20 20 20 20 23 66 29 29 0a 20 -id #f)).
5780: 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 (if (not te
5790: 73 74 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e stdat).. (begin
57a0: 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 .. ;; ensure
57b0: 74 68 61 74 20 74 68 65 20 70 61 74 68 20 65 78 that the path ex
57c0: 69 73 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 ists before regi
57d0: 73 74 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 stering the test
57e0: 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 .. ;; NOPE: C
57f0: 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f annot! Don't kno
5800: 77 20 79 65 74 20 77 68 69 63 68 20 64 69 73 6b w yet which disk
5810: 20 61 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 area will be as
5820: 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 signed......
5830: 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 ;; (system (conc
5840: 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 "mkdir -p " new
5850: 2d 74 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 -test-path))..
5860: 20 20 28 72 74 65 73 74 73 3a 72 65 67 69 73 74 (rtests:regist
5870: 65 72 2d 74 65 73 74 20 64 62 20 72 75 6e 2d 69 er-test db run-i
5880: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
5890: 2d 70 61 74 68 29 0a 09 20 20 20 20 28 73 65 74 -path).. (set
58a0: 21 20 74 65 73 74 64 61 74 20 28 64 62 3a 67 65 ! testdat (db:ge
58b0: 74 2d 74 65 73 74 2d 69 6e 66 6f 20 64 62 20 72 t-test-info db r
58c0: 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 un-id test-name
58d0: 69 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 20 20 item-path)))).
58e0: 20 20 20 20 28 73 65 74 21 20 74 65 73 74 2d 69 (set! test-i
58f0: 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 d (db:test-get-i
5900: 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 20 20 d testdat)).
5910: 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 (change-direct
5920: 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 0a 20 ory test-path).
5930: 20 20 20 20 20 28 63 61 73 65 20 28 69 66 20 66 (case (if f
5940: 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 orce ;; (args:ge
5950: 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 29 0a t-arg "-force").
5960: 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 ..'NOT_STARTED..
5970: 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 09 20 .(if testdat...
5980: 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 (string->symb
5990: 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 ol (test:get-sta
59a0: 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 09 20 te testdat))...
59b0: 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 'failed-to-in
59c0: 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c 65 64 sert))..((failed
59d0: 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 -to-insert).. (d
59e0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
59f0: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 ROR: Failed to i
5a00: 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f 72 64 nsert the record
5a10: 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 29 0a into the db")).
5a20: 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 .((NOT_STARTED C
5a30: 4f 4d 50 4c 45 54 45 44 29 0a 09 20 28 6c 65 74 OMPLETED).. (let
5a40: 20 28 28 72 75 6e 66 6c 61 67 20 23 66 29 29 0a ((runflag #f)).
5a50: 09 20 20 20 28 63 6f 6e 64 0a 09 20 20 20 20 3b . (cond.. ;
5a60: 3b 20 2d 66 6f 72 63 65 2c 20 72 75 6e 20 6e 6f ; -force, run no
5a70: 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 20 matter what..
5a80: 20 20 28 66 6f 72 63 65 20 28 73 65 74 21 20 72 (force (set! r
5a90: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 unflag #t))..
5aa0: 20 3b 3b 20 4e 4f 54 5f 53 54 41 52 54 45 44 2c ;; NOT_STARTED,
5ab0: 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 run no matter w
5ac0: 68 61 74 0a 09 20 20 20 20 28 28 65 71 75 61 6c hat.. ((equal
5ad0: 3f 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 ? (test:get-stat
5ae0: 65 20 74 65 73 74 64 61 74 29 20 22 4e 4f 54 5f e testdat) "NOT_
5af0: 53 54 41 52 54 45 44 22 29 28 73 65 74 21 20 72 STARTED")(set! r
5b00: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 unflag #t))..
5b10: 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e 20 61 ;; not -rerun a
5b20: 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 6f 72 nd PASS, WARN or
5b30: 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 72 75 CHECK, do no ru
5b40: 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6f 72 n.. ((and (or
5b50: 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 (not rerun)...
5b60: 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 29 0a keepgoing).
5b70: 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 20 74 .. ;; Require t
5b80: 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e 20 66 o force re-run f
5b90: 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f 72 20 or COMPLETED or
5ba0: 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 41 53 *anything* + PAS
5bb0: 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 0a S,WARN or CHECK.
5bc0: 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 72 20 .. (or (member
5bd0: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 (test:get-status
5be0: 20 74 65 73 74 64 61 74 29 20 27 28 22 50 41 53 testdat) '("PAS
5bf0: 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b S" "WARN" "CHECK
5c00: 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d 65 6d "))... (mem
5c10: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
5c20: 61 74 65 20 20 74 65 73 74 64 61 74 29 20 27 28 ate testdat) '(
5c30: 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 29 20 "COMPLETED"))))
5c40: 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 .. (debug:pr
5c50: 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 72 75 6e int 2 "INFO: run
5c60: 6e 69 6e 67 20 74 65 73 74 20 22 20 74 65 73 74 ning test " test
5c70: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 -name "/" item-p
5c80: 61 74 68 20 22 20 73 75 70 70 72 65 73 73 65 64 ath " suppressed
5c90: 20 61 73 20 69 74 20 69 73 20 22 20 28 74 65 73 as it is " (tes
5ca0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
5cb0: 64 61 74 29 20 22 20 61 6e 64 20 22 20 28 74 65 dat) " and " (te
5cc0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
5cd0: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 28 73 stdat)).. (s
5ce0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 et! runflag #f))
5cf0: 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 6e 20 .. ;; -rerun
5d00: 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 6f 6e and status is on
5d10: 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 65 e of the specife
5d20: 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 20 28 d, run it.. (
5d30: 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 20 28 (and rerun... (
5d40: 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 74 20 let* ((rerunlst
5d50: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 (string-split
5d60: 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 09 20 rerun ","))....
5d70: 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d 65 6d (must-rerun (mem
5d80: 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 ber (test:get-st
5d90: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 72 65 atus testdat) re
5da0: 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 20 20 runlst)))...
5db0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 (debug:print 3 "
5dc0: 49 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c 69 73 INFO: -rerun lis
5dd0: 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 74 65 t: " rerun ", te
5de0: 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28 74 65 st-status: " (te
5df0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
5e00: 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d 72 65 stdat)", must-re
5e10: 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 72 75 run: " must-reru
5e20: 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d 72 65 n)... must-re
5e30: 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64 65 62 run)).. (deb
5e40: 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e 46 4f ug:print 2 "INFO
5e50: 3a 20 52 65 72 75 6e 20 66 6f 72 63 65 64 20 66 : Rerun forced f
5e60: 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e or test " test-n
5e70: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
5e80: 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 h).. (set! r
5e90: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 unflag #t))..
5ea0: 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 2c 20 ;; -keepgoing,
5eb0: 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 41 49 do not rerun FAI
5ec0: 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b 65 65 L.. ((and kee
5ed0: 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 6d 62 pgoing... (memb
5ee0: 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 er (test:get-sta
5ef0: 74 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 tus testdat) '("
5f00: 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 20 28 FAIL"))).. (
5f10: 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 29 set! runflag #f)
5f20: 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 6e 6f ).. ((and (no
5f30: 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 6d 65 t rerun)... (me
5f40: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 mber (test:get-s
5f50: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 tatus testdat) '
5f60: 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 29 29 ("FAIL" "n/a")))
5f70: 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e .. (set! run
5f80: 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 20 28 flag #t)).. (
5f90: 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e 66 6c else (set! runfl
5fa0: 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 64 65 ag #f))).. (de
5fb0: 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 55 4e bug:print 6 "RUN
5fc0: 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 67 3a NING => runflag:
5fd0: 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 54 41 " runflag " STA
5fe0: 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d TE: " (test:get-
5ff0: 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 22 state testdat) "
6000: 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 73 74 STATUS: " (test
6010: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
6020: 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 28 6e dat)).. (if (n
6030: 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 20 20 ot runflag)..
6040: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 61 72 (if (not par
6050: 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 20 28 ent-test)... (
6060: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e debug:print 1 "N
6070: 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 69 6e OTE: Not startin
6080: 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 g test " new-tes
6090: 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 20 69 t-name " as it i
60a0: 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 65 73 s state \"" (tes
60b0: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
60c0: 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 61 6e dat) ....."\" an
60d0: 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 74 65 d status \"" (te
60e0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
60f0: 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 65 20 stdat) "\", use
6100: 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 73 74 -rerun \"" (test
6110: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
6120: 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 dat).
6130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6140: 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 6f 72 "\" or -for
6150: 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 22 29 ce to override")
6160: 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e 4f 54 ).. ;; NOT
6170: 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 E: No longer be
6180: 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 71 75 checking prerequ
6190: 69 73 69 74 65 73 20 68 65 72 65 21 20 57 69 6c isites here! Wil
61a0: 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 72 65 l never get here
61b0: 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 73 20 unless prereqs
61c0: 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b 20 20 are.. ;;
61d0: 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d 65 74 already met
61e0: 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 6e ... (if (n
61f0: 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 74 20 ot (launch-test
6200: 64 62 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 6d db run-id runnam
6210: 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 79 76 e test-conf keyv
6220: 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d 65 20 allst test-name
6230: 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d 64 61 test-path itemda
6240: 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20 20 28 t flags))... (
6250: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 70 72 begin... (pr
6260: 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 69 6c int "ERROR: Fail
6270: 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 68 65 ed to launch the
6280: 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 20 61 test. Exiting a
6290: 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 69 62 s soon as possib
62a0: 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73 65 74 le")... (set
62b0: 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 74 61 ! *globalexitsta
62c0: 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 20 20 tus* 1) ;; ...
62d0: 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69 67 6e (process-sign
62e0: 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 6f 63 al (current-proc
62f0: 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c 2f 6b ess-id) signal/k
6300: 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b 49 4c ill))))))..((KIL
6310: 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67 3a 70 LED) .. (debug:p
6320: 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 22 20 rint 1 "NOTE: "
6330: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 new-test-name "
6340: 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 is already runni
6350: 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c 69 63 ng or was explic
6360: 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 65 20 tly killed, use
6370: 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e 63 68 -force to launch
6380: 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 4e 43 it."))..((LAUNC
6390: 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 53 54 HED REMOTEHOSTST
63a0: 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 0a 09 ART RUNNING) ..
63b0: 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 72 72 (if (> (- (curr
63c0: 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b 20 28 ent-seconds)(+ (
63d0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 65 6e db:test-get-even
63e0: 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 29 0a t_time testdat).
63f0: 09 09 09 09 20 20 20 20 20 20 20 28 64 62 3a 74 .... (db:t
6400: 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 72 61 est-get-run_dura
6410: 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 29 0a tion testdat))).
6420: 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e 20 6e ..600) ;; i.e. n
6430: 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d 6f 72 o update for mor
6440: 65 20 74 68 61 6e 20 36 30 30 20 73 65 63 6f 6e e than 600 secon
6450: 64 73 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a ds.. (begin.
6460: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
6470: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
6480: 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d Test " test-nam
6490: 65 20 22 20 61 70 70 65 61 72 73 20 74 6f 20 62 e " appears to b
64a0: 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e 67 20 e dead. Forcing
64b0: 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e 43 4f it to state INCO
64c0: 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 74 75 MPLETE and statu
64d0: 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 0a 09 s STUCK/DEAD")..
64e0: 20 20 20 20 20 20 20 28 74 65 73 74 2d 73 65 74 (test-set
64f0: 2d 73 74 61 74 75 73 21 20 64 62 20 74 65 73 74 -status! db test
6500: 2d 69 64 20 22 49 4e 43 4f 4d 50 4c 45 54 45 22 -id "INCOMPLETE"
6510: 20 22 53 54 55 43 4b 2f 44 45 41 44 22 20 22 54 "STUCK/DEAD" "T
6520: 65 73 74 20 69 73 20 73 74 75 63 6b 20 6f 72 20 est is stuck or
6530: 64 65 61 64 22 20 23 66 29 29 0a 09 20 20 20 20 dead" #f))..
6540: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
6550: 22 4e 4f 54 45 3a 20 22 20 74 65 73 74 2d 6e 61 "NOTE: " test-na
6560: 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 79 20 me " is already
6570: 72 75 6e 6e 69 6e 67 22 29 29 29 0a 09 28 65 6c running")))..(el
6580: 73 65 20 20 20 20 20 20 20 28 64 65 62 75 67 3a se (debug:
6590: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
65a0: 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 Failed to launch
65b0: 20 74 65 73 74 20 22 20 6e 65 77 2d 74 65 73 74 test " new-test
65c0: 2d 6e 61 6d 65 20 22 2e 20 55 6e 72 65 63 6f 67 -name ". Unrecog
65d0: 6e 69 73 65 64 20 73 74 61 74 65 20 22 20 28 74 nised state " (t
65e0: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
65f0: 73 74 64 61 74 29 29 29 29 29 29 29 0a 0a 3b 3b stdat)))))))..;;
6600: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6640: 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 4e 44 20 4f 46 ======.;; END OF
6650: 20 4e 45 57 20 53 54 55 46 46 0a 3b 3b 3d 3d 3d NEW STUFF.;;===
6660: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6670: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6680: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
6690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
66a0: 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 67 65 ===..(define (ge
66b0: 74 2d 64 69 72 2d 75 70 2d 6e 20 64 69 72 20 2e t-dir-up-n dir .
66c0: 20 70 61 72 61 6d 73 29 20 0a 20 20 28 6c 65 74 params) . (let
66d0: 20 28 28 64 70 61 72 74 73 20 20 28 73 74 72 69 ((dparts (stri
66e0: 6e 67 2d 73 70 6c 69 74 20 64 69 72 20 22 2f 22 ng-split dir "/"
66f0: 29 29 0a 09 28 63 6f 75 6e 74 20 20 20 28 69 66 ))..(count (if
6700: 20 28 6e 75 6c 6c 3f 20 70 61 72 61 6d 73 29 20 (null? params)
6710: 31 20 28 63 61 72 20 70 61 72 61 6d 73 29 29 29 1 (car params)))
6720: 29 0a 20 20 20 20 28 63 6f 6e 63 20 22 2f 22 20 ). (conc "/"
6730: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
6740: 72 73 65 20 0a 09 20 20 20 20 20 20 20 28 74 61 rse .. (ta
6750: 6b 65 20 64 70 61 72 74 73 20 28 2d 20 28 6c 65 ke dparts (- (le
6760: 6e 67 74 68 20 64 70 61 72 74 73 29 20 63 6f 75 ngth dparts) cou
6770: 6e 74 29 29 0a 09 20 20 20 20 20 20 20 22 2f 22 nt)).. "/"
6780: 29 29 29 29 0a 3b 3b 20 52 65 6d 6f 76 65 20 72 )))).;; Remove r
6790: 75 6e 73 0a 3b 3b 20 66 69 65 6c 64 73 20 61 72 uns.;; fields ar
67a0: 65 20 70 61 73 73 69 6e 67 20 69 6e 20 74 68 72 e passing in thr
67b0: 6f 75 67 68 20 0a 3b 3b 20 61 63 74 69 6f 6e 3a ough .;; action:
67c0: 0a 3b 3b 20 20 20 20 27 72 65 6d 6f 76 65 2d 72 .;; 'remove-r
67d0: 75 6e 73 0a 3b 3b 20 20 20 20 27 73 65 74 2d 73 uns.;; 'set-s
67e0: 74 61 74 65 2d 73 74 61 74 75 73 0a 3b 3b 0a 3b tate-status.;;.;
67f0: 3b 20 4e 42 2f 2f 20 73 68 6f 75 6c 64 20 70 61 ; NB// should pa
6800: 73 73 20 69 6e 20 6b 65 79 73 3f 0a 3b 3b 0a 28 ss in keys?.;;.(
6810: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6f 70 65 define (runs:ope
6820: 72 61 74 65 2d 6f 6e 20 64 62 20 61 63 74 69 6f rate-on db actio
6830: 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 74 65 n runnamepatt te
6840: 73 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 stpatt itempatt
6850: 23 21 6b 65 79 20 28 73 74 61 74 65 20 23 66 29 #!key (state #f)
6860: 28 73 74 61 74 75 73 20 23 66 29 28 6e 65 77 2d (status #f)(new-
6870: 73 74 61 74 65 2d 73 74 61 74 75 73 20 23 66 29 state-status #f)
6880: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 ). (let* ((keys
6890: 20 20 20 20 20 20 20 20 20 28 72 64 62 3a 67 65 (rdb:ge
68a0: 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 20 28 72 t-keys db)).. (r
68b0: 75 6e 64 61 74 20 20 20 20 20 20 20 28 72 75 6e undat (run
68c0: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 s:get-runs-by-pa
68d0: 74 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 tt db keys runna
68e0: 6d 65 70 61 74 74 29 29 0a 09 20 28 68 65 61 64 mepatt)).. (head
68f0: 65 72 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 er (vector
6900: 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a -ref rundat 0)).
6910: 09 20 28 72 75 6e 73 20 20 20 20 20 20 20 20 20 . (runs
6920: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
6930: 61 74 20 31 29 29 0a 09 20 28 73 74 61 74 65 73 at 1)).. (states
6940: 20 20 20 20 20 20 20 28 69 66 20 73 74 61 74 65 (if state
6950: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 (string-split
6960: 73 74 61 74 65 20 20 22 2c 22 29 20 27 28 29 29 state ",") '())
6970: 29 0a 09 20 28 73 74 61 74 75 73 65 73 20 20 20 ).. (statuses
6980: 20 20 28 69 66 20 73 74 61 74 75 73 20 28 73 74 (if status (st
6990: 72 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 75 ring-split statu
69a0: 73 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 s ",") '())).. (
69b0: 73 74 61 74 65 2d 73 74 61 74 75 73 20 28 69 66 state-status (if
69c0: 20 28 73 74 72 69 6e 67 3f 20 6e 65 77 2d 73 74 (string? new-st
69d0: 61 74 65 2d 73 74 61 74 75 73 29 20 28 73 74 72 ate-status) (str
69e0: 69 6e 67 2d 73 70 6c 69 74 20 6e 65 77 2d 73 74 ing-split new-st
69f0: 61 74 65 2d 73 74 61 74 75 73 20 22 2c 22 29 20 ate-status ",")
6a00: 27 28 23 66 20 23 66 29 29 29 29 0a 20 20 20 20 '(#f #f)))).
6a10: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 (debug:print 2 "
6a20: 48 65 61 64 65 72 3a 20 22 20 68 65 61 64 65 72 Header: " header
6a30: 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 63 74 " action: " act
6a40: 69 6f 6e 20 22 20 6e 65 77 2d 73 74 61 74 65 2d ion " new-state-
6a50: 73 74 61 74 75 73 3a 20 22 20 6e 65 77 2d 73 74 status: " new-st
6a60: 61 74 65 2d 73 74 61 74 75 73 29 0a 20 20 20 20 ate-status).
6a70: 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 (for-each. (
6a80: 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 20 20 20 lambda (run).
6a90: 20 20 20 20 28 6c 65 74 20 28 28 72 75 6e 6b 65 (let ((runke
6aa0: 79 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 y (string-inters
6ab0: 70 65 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 perse (map (lamb
6ac0: 64 61 20 28 6b 29 0a 09 09 09 09 09 09 28 64 62 da (k).......(db
6ad0: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
6ae0: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
6af0: 28 76 65 63 74 6f 72 2d 72 65 66 20 6b 20 30 29 (vector-ref k 0)
6b00: 29 29 20 6b 65 79 73 29 20 22 2f 22 29 29 0a 09 )) keys) "/"))..
6b10: 20 20 20 20 20 28 64 69 72 73 2d 74 6f 2d 72 65 (dirs-to-re
6b20: 6d 6f 76 65 20 28 6d 61 6b 65 2d 68 61 73 68 2d move (make-hash-
6b30: 74 61 62 6c 65 29 29 29 0a 09 20 28 6c 65 74 2a table))).. (let*
6b40: 20 28 28 72 75 6e 2d 69 64 20 20 20 20 28 64 62 ((run-id (db
6b50: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
6b60: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
6b70: 22 69 64 22 29 29 0a 09 09 28 72 75 6e 2d 73 74 "id"))...(run-st
6b80: 61 74 65 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 ate (db:get-valu
6b90: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
6ba0: 68 65 61 64 65 72 20 22 73 74 61 74 65 22 29 29 header "state"))
6bb0: 0a 09 09 28 74 65 73 74 73 20 20 20 20 20 28 69 ...(tests (i
6bc0: 66 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 72 f (not (equal? r
6bd0: 75 6e 2d 73 74 61 74 65 20 22 6c 6f 63 6b 65 64 un-state "locked
6be0: 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 72 ")).... (r
6bf0: 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 db:get-tests-for
6c00: 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 2d -run db (db:get-
6c10: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
6c20: 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 run header "id")
6c30: 0a 09 09 09 09 09 09 20 20 20 20 20 20 74 65 73 ....... tes
6c40: 74 70 61 74 74 20 69 74 65 6d 70 61 74 74 20 73 tpatt itempatt s
6c50: 74 61 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 tates statuses..
6c60: 09 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 ..... not-i
6c70: 6e 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 n: #f.......
6c80: 20 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 sort-by: (cas
6c90: 65 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 e action........
6ca0: 09 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 . ((remove-runs)
6cb0: 20 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 'rundir).......
6cc0: 09 09 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 .. (else
6cd0: 20 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 'event_time)))
6ce0: 0a 09 09 09 20 20 20 20 20 20 20 27 28 29 29 29 .... '()))
6cf0: 0a 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f ...(lasttpath "/
6d00: 64 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 does/not/exist/I
6d10: 2f 68 6f 70 65 22 29 29 0a 0a 09 20 20 20 28 69 /hope"))... (i
6d20: 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 65 f (not (null? te
6d30: 73 74 73 29 29 0a 09 20 20 20 20 20 20 20 28 62 sts)).. (b
6d40: 65 67 69 6e 0a 09 09 20 28 63 61 73 65 20 61 63 egin... (case ac
6d50: 74 69 6f 6e 0a 09 09 20 20 20 28 28 72 65 6d 6f tion... ((remo
6d60: 76 65 2d 72 75 6e 73 29 0a 09 09 20 20 20 20 28 ve-runs)... (
6d70: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 debug:print 1 "R
6d80: 65 6d 6f 76 69 6e 67 20 74 65 73 74 73 20 66 6f emoving tests fo
6d90: 72 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 r run: " runkey
6da0: 22 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 " " (db:get-valu
6db0: 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 e-by-header run
6dc0: 68 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 header "runname"
6dd0: 29 29 29 0a 09 09 20 20 20 28 28 73 65 74 2d 73 )))... ((set-s
6de0: 74 61 74 65 2d 73 74 61 74 75 73 29 0a 09 09 20 tate-status)...
6df0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6e00: 31 20 22 4d 6f 64 69 66 79 69 6e 67 20 73 74 61 1 "Modifying sta
6e10: 74 65 20 61 6e 64 20 73 74 61 75 73 20 66 6f 72 te and staus for
6e20: 20 74 65 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 tests for run:
6e30: 22 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 " runkey " " (db
6e40: 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 :get-value-by-he
6e50: 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 ader run header
6e60: 22 72 75 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 "runname")))...
6e70: 20 20 28 65 6c 73 65 0a 09 09 20 20 20 20 28 70 (else... (p
6e80: 72 69 6e 74 20 22 49 4e 46 4f 3a 20 61 63 74 69 rint "INFO: acti
6e90: 6f 6e 20 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 on not recognise
6ea0: 64 20 22 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 d " action)))...
6eb0: 20 28 66 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 (for-each... (
6ec0: 6c 61 6d 62 64 61 20 28 74 65 73 74 29 0a 09 09 lambda (test)...
6ed0: 20 20 20 20 28 6c 65 74 2a 20 28 28 69 74 65 6d (let* ((item
6ee0: 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d 67 -path (db:test-g
6ef0: 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 73 et-item-path tes
6f00: 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d t)).... (test-
6f10: 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d 67 65 name (db:test-ge
6f20: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 t-testname test)
6f30: 29 0a 09 09 09 20 20 20 28 72 75 6e 2d 64 69 72 ).... (run-dir
6f40: 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d (db:test-get-
6f50: 72 75 6e 64 69 72 20 74 65 73 74 29 29 29 0a 09 rundir test)))..
6f60: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
6f70: 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 3a 74 int 1 " " (db:t
6f80: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
6f90: 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 20 28 test) " id: " (
6fa0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
6fb0: 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d 70 61 est) " " item-pa
6fc0: 74 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 20 61 th " action: " a
6fd0: 63 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 20 28 ction)... (
6fe0: 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 09 28 case action....(
6ff0: 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 09 (remove-runs)...
7000: 09 20 28 72 64 62 3a 64 65 6c 65 74 65 2d 74 65 . (rdb:delete-te
7010: 73 74 2d 72 65 63 6f 72 64 73 20 64 62 20 28 64 st-records db (d
7020: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
7030: 73 74 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a st)).... (debug:
7040: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 print 1 "INFO: A
7050: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d ttempting to rem
7060: 6f 76 65 20 64 69 72 20 22 20 72 75 6e 2d 64 69 ove dir " run-di
7070: 72 29 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 r).... (if (and
7080: 28 3e 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 (> (string-lengt
7090: 68 20 72 75 6e 2d 64 69 72 29 20 35 29 0a 09 09 h run-dir) 5)...
70a0: 09 09 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 .. (file-exists
70b0: 3f 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 62 ? run-dir)) ;; b
70c0: 61 64 20 68 65 75 72 69 73 74 69 63 20 62 75 74 ad heuristic but
70d0: 20 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 should prevent
70e0: 2f 74 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a /tmp /home etc..
70f0: 09 09 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 ... (let* ((
7100: 72 65 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 realpath (resolv
7110: 65 2d 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 e-pathname run-d
7120: 69 72 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 ir)))....
7130: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
7140: 49 4e 46 4f 3a 20 52 65 61 6c 20 70 61 74 68 20 INFO: Real path
7150: 6f 66 20 69 73 20 22 20 72 65 61 6c 70 61 74 68 of is " realpath
7160: 29 0a 09 09 09 20 20 20 20 20 20 20 28 69 66 20 ).... (if
7170: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 (file-exists? re
7180: 61 6c 70 61 74 68 29 0a 09 09 09 09 20 20 20 28 alpath)..... (
7190: 69 66 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 if (> (system (c
71a0: 6f 6e 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 onc "rm -rf " re
71b0: 61 6c 70 61 74 68 29 29 20 30 29 0a 09 09 09 09 alpath)) 0).....
71c0: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
71d0: 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 int 0 "ERROR: Th
71e0: 65 72 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 ere was a proble
71f0: 6d 20 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 m removing " rea
7200: 6c 70 61 74 68 20 22 20 77 69 74 68 20 72 6d 20 lpath " with rm
7210: 2d 66 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 -f"))..... (de
7220: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
7230: 4e 49 4e 47 3a 20 74 65 73 74 20 72 75 6e 20 64 NING: test run d
7240: 69 72 20 22 20 72 65 61 6c 70 61 74 68 20 22 20 ir " realpath "
7250: 61 70 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 appears to not e
7260: 78 69 73 74 22 29 29 0a 09 09 09 20 20 20 20 20 xist"))....
7270: 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 (if (file-exis
7280: 74 73 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b 20 ts? run-dir) ;;
7290: 74 68 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20 20 the link.....
72a0: 28 69 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 (if (symbolic-li
72b0: 6e 6b 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 nk? run-dir)....
72c0: 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d . (delete-
72d0: 66 69 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 file run-dir)...
72e0: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 64 69 .. (if (di
72f0: 72 65 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 rectory? run-dir
7300: 29 0a 09 09 09 09 09 20 20 20 28 69 66 20 28 3e )...... (if (>
7310: 20 28 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 (directory-fold
7320: 20 28 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b (lambda (f x)(+
7330: 20 31 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72 1 x)) 0 run-dir
7340: 29 20 30 29 0a 09 09 09 09 09 20 20 20 20 20 20 ) 0)......
7350: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
7360: 22 57 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 "WARNING: refusi
7370: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 ng to remove " r
7380: 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 un-dir " as it i
7390: 73 20 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 s not empty")...
73a0: 09 09 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 ... (delet
73b0: 65 2d 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d e-directory run-
73c0: 64 69 72 29 29 20 3b 3b 20 69 74 20 73 68 6f 75 dir)) ;; it shou
73d0: 6c 64 20 62 65 20 65 6d 70 74 79 20 62 79 20 68 ld be empty by h
73e0: 65 72 65 20 42 55 47 20 42 55 47 2c 20 61 64 64 ere BUG BUG, add
73f0: 20 65 72 72 6f 72 20 63 61 74 63 68 0a 09 09 09 error catch....
7400: 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e .. (debug:prin
7410: 74 20 30 20 22 45 52 52 4f 52 3a 20 72 65 66 75 t 0 "ERROR: refu
7420: 73 69 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 sing to remove "
7430: 20 72 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 run-dir " as it
7440: 20 69 73 20 6e 65 69 74 68 65 72 20 61 20 73 79 is neither a sy
7450: 6d 6c 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72 65 mlink nor a dire
7460: 63 74 6f 72 79 22 29 0a 09 09 09 09 09 20 20 20 ctory")......
7470: 29 29 29 29 0a 09 09 09 20 20 20 20 20 28 64 65 )))).... (de
7480: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 bug:print 0 "WAR
7490: 4e 49 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20 NING: directory
74a0: 61 6c 72 65 61 64 79 20 72 65 6d 6f 76 65 64 20 already removed
74b0: 22 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 " run-dir)))....
74c0: 28 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 ((set-state-stat
74d0: 75 73 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 us).... (debug:p
74e0: 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e 65 rint 2 "INFO: ne
74f0: 77 20 73 74 61 74 65 20 22 20 28 63 61 72 20 73 w state " (car s
7500: 74 61 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 tate-status) ",
7510: 6e 65 77 20 73 74 61 74 75 73 20 22 20 28 63 61 new status " (ca
7520: 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 dr state-status)
7530: 29 0a 09 09 09 20 28 64 62 3a 74 65 73 74 2d 73 ).... (db:test-s
7540: 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 2d et-state-status-
7550: 62 79 2d 69 64 20 64 62 20 28 64 62 3a 74 65 73 by-id db (db:tes
7560: 74 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 28 t-get-id test) (
7570: 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 car state-status
7580: 29 28 63 61 64 72 20 73 74 61 74 65 2d 73 74 61 )(cadr state-sta
7590: 74 75 73 29 20 23 66 29 29 29 29 29 0a 09 09 20 tus) #f)))))...
75a0: 20 74 65 73 74 73 29 29 29 0a 09 20 20 20 0a 09 tests))).. ..
75b0: 20 20 20 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 ;; remove the
75c0: 20 72 75 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 run if zero tes
75d0: 74 73 20 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 ts remain.. (i
75e0: 66 20 28 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 f (eq? action 'r
75f0: 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 emove-runs)..
7600: 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d 74 65 (let ((remte
7610: 73 74 73 20 28 72 64 62 3a 67 65 74 2d 74 65 73 sts (rdb:get-tes
7620: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 ts-for-run db (d
7630: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
7640: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
7650: 20 22 69 64 22 29 20 23 66 20 23 66 20 27 28 29 "id") #f #f '()
7660: 20 27 28 29 29 29 29 0a 09 09 20 28 69 66 20 28 '())))... (if (
7670: 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 null? remtests)
7680: 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 ;; no more tests
7690: 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 remaining...
76a0: 20 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 73 (let* ((dparts
76b0: 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 (string-split
76c0: 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 0a lasttpath "/")).
76d0: 09 09 09 20 20 20 20 28 72 75 6e 70 61 74 68 20 ... (runpath
76e0: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e (conc "/" (strin
76f0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 g-intersperse ..
7700: 09 09 09 09 09 28 74 61 6b 65 20 64 70 61 72 74 .....(take dpart
7710: 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 s (- (length dpa
7720: 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 09 22 rts) 1))......."
7730: 2f 22 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 /"))))...
7740: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
7750: 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 Removing run: "
7760: 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 runkey " " (db:g
7770: 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 et-value-by-head
7780: 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 er run header "r
7790: 75 6e 6e 61 6d 65 22 29 29 0a 09 09 20 20 20 20 unname"))...
77a0: 20 20 20 28 64 62 3a 64 65 6c 65 74 65 2d 72 75 (db:delete-ru
77b0: 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 20 n db run-id)...
77c0: 20 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f ;; need to
77d0: 20 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 figure out the
77e0: 70 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 path to the run
77f0: 64 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 dir and remove i
7800: 74 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 t if empty...
7810: 20 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e ;; (if (n
7820: 75 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 ull? (glob (conc
7830: 20 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 runpath "/*")))
7840: 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 ... ;;
7850: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 (begin...
7860: 20 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a ;; . (debug:
7870: 70 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e print 1 "Removin
7880: 67 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 g run dir " runp
7890: 61 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b 3b ath)... ;;
78a0: 20 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 . (system (conc
78b0: 20 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e "rmdir -p " run
78c0: 70 61 74 68 29 29 29 29 0a 09 09 20 20 20 20 20 path))))...
78d0: 20 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20 20 ))))).. )).
78e0: 20 20 72 75 6e 73 29 29 29 0a 0a 3b 3b 3d 3d 3d runs)))..;;===
78f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7900: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7910: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7920: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7930: 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 6e 65 73 20 ===.;; Routines
7940: 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 for manipulating
7950: 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d runs.;;========
7960: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7970: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7980: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
7990: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a ==============..
79a0: 3b 3b 20 53 69 6e 63 65 20 6d 61 6e 79 20 63 61 ;; Since many ca
79b0: 6c 6c 73 20 74 6f 20 61 20 72 75 6e 20 72 65 71 lls to a run req
79c0: 75 69 72 65 20 70 72 65 74 74 79 20 6d 75 63 68 uire pretty much
79d0: 20 74 68 65 20 73 61 6d 65 20 73 65 74 75 70 20 the same setup
79e0: 0a 3b 3b 20 74 68 69 73 20 77 72 61 70 70 65 72 .;; this wrapper
79f0: 20 69 73 20 75 73 65 64 20 74 6f 20 72 65 64 75 is used to redu
7a00: 63 65 20 74 68 65 20 72 65 70 6c 69 63 61 74 69 ce the replicati
7a10: 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 64 65 66 69 on of code.(defi
7a20: 6e 65 20 28 67 65 6e 65 72 61 6c 2d 72 75 6e 2d ne (general-run-
7a30: 63 61 6c 6c 20 73 77 69 74 63 68 6e 61 6d 65 20 call switchname
7a40: 61 63 74 69 6f 6e 2d 64 65 73 63 20 70 72 6f 63 action-desc proc
7a50: 29 0a 20 20 28 6c 65 74 20 28 28 72 75 6e 6e 61 ). (let ((runna
7a60: 6d 65 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 me (args:get-arg
7a70: 20 22 3a 72 75 6e 6e 61 6d 65 22 29 29 0a 09 28 ":runname"))..(
7a80: 74 61 72 67 65 74 20 20 28 69 66 20 28 61 72 67 target (if (arg
7a90: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
7aa0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 et")... (arg
7ab0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 s:get-arg "-targ
7ac0: 65 74 22 29 0a 09 09 20 20 20 20 20 28 61 72 67 et")... (arg
7ad0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
7ae0: 61 72 67 22 29 29 29 0a 09 28 74 68 31 20 20 20 arg")))..(th1
7af0: 20 20 23 66 29 29 0a 20 20 20 20 28 63 6f 6e 64 #f)). (cond
7b00: 0a 20 20 20 20 20 28 28 6e 6f 74 20 74 61 72 67 . ((not targ
7b10: 65 74 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 et). (debug
7b20: 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a :print 0 "ERROR:
7b30: 20 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 Missing require
7b40: 64 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 d parameter for
7b50: 22 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 " switchname ",
7b60: 79 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 you must specify
7b70: 20 74 68 65 20 74 61 72 67 65 74 20 77 69 74 68 the target with
7b80: 20 2d 74 61 72 67 65 74 22 29 0a 20 20 20 20 20 -target").
7b90: 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 20 (exit 3)).
7ba0: 28 28 6e 6f 74 20 72 75 6e 6e 61 6d 65 29 0a 20 ((not runname).
7bb0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
7bc0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 t 0 "ERROR: Miss
7bd0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 ing required par
7be0: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 ameter for " swi
7bf0: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d tchname ", you m
7c00: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 ust specify the
7c10: 72 75 6e 20 6e 61 6d 65 20 77 69 74 68 20 3a 72 run name with :r
7c20: 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 6d 65 22 29 unname runname")
7c30: 0a 20 20 20 20 20 20 28 65 78 69 74 20 33 29 29 . (exit 3))
7c40: 0a 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 . (else.
7c50: 20 20 28 6c 65 74 20 28 28 64 62 20 20 20 23 66 (let ((db #f
7c60: 29 0a 09 20 20 20 20 28 6b 65 79 73 20 23 66 29 ).. (keys #f)
7c70: 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 73 65 74 )..(if (not (set
7c80: 75 70 2d 66 6f 72 2d 72 75 6e 29 29 0a 09 20 20 up-for-run))..
7c90: 20 20 28 62 65 67 69 6e 20 0a 09 20 20 20 20 20 (begin ..
7ca0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
7cb0: 22 46 61 69 6c 65 64 20 74 6f 20 73 65 74 75 70 "Failed to setup
7cc0: 2c 20 65 78 69 74 69 6e 67 22 29 0a 09 20 20 20 , exiting")..
7cd0: 20 20 20 28 65 78 69 74 20 31 29 29 29 0a 09 28 (exit 1)))..(
7ce0: 73 65 74 21 20 64 62 20 20 20 28 6f 70 65 6e 2d set! db (open-
7cf0: 64 62 29 29 0a 09 28 69 66 20 28 61 72 67 73 3a db))..(if (args:
7d00: 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 get-arg "-server
7d10: 22 29 0a 09 20 20 20 20 28 73 65 72 76 65 72 3a ").. (server:
7d20: 73 74 61 72 74 20 64 62 20 28 61 72 67 73 3a 67 start db (args:g
7d30: 65 74 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 et-arg "-server"
7d40: 29 29 0a 09 20 20 20 20 28 69 66 20 28 6e 6f 74 )).. (if (not
7d50: 20 28 6f 72 20 28 61 72 67 73 3a 67 65 74 2d 61 (or (args:get-a
7d60: 72 67 20 22 2d 72 75 6e 61 6c 6c 22 29 0a 09 09 rg "-runall")...
7d70: 09 20 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 . (args:get-arg
7d80: 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 29 0a "-runtests"))).
7d90: 09 09 28 73 65 72 76 65 72 3a 63 6c 69 65 6e 74 ..(server:client
7da0: 2d 73 65 74 75 70 20 64 62 29 29 29 0a 09 28 73 -setup db)))..(s
7db0: 65 74 21 20 6b 65 79 73 20 28 72 64 62 3a 67 65 et! keys (rdb:ge
7dc0: 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 t-keys db))..;;
7dd0: 68 61 76 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 have enough to p
7de0: 72 6f 63 65 73 73 20 2d 74 61 72 67 65 74 20 6f rocess -target o
7df0: 72 20 2d 72 65 71 74 61 72 67 20 68 65 72 65 0a r -reqtarg here.
7e00: 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 .(if (args:get-a
7e10: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 0a 09 rg "-reqtarg")..
7e20: 20 20 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 (let* ((runc
7e30: 6f 6e 66 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 onfigf (conc *t
7e40: 6f 70 70 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e oppath* "/runcon
7e50: 66 69 67 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b figs.config")) ;
7e60: 3b 20 44 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 ; DO NOT EVALUAT
7e70: 45 20 41 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e E ALL ... (run
7e80: 63 6f 6e 66 69 67 20 20 28 72 65 61 64 2d 63 6f config (read-co
7e90: 6e 66 69 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 nfig runconfigf
7ea0: 23 66 20 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 #f #f environ-pa
7eb0: 74 74 3a 20 23 66 29 29 29 20 0a 09 20 20 20 20 tt: #f))) ..
7ec0: 20 20 28 69 66 20 28 68 61 73 68 2d 74 61 62 6c (if (hash-tabl
7ed0: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 72 75 e-ref/default ru
7ee0: 6e 63 6f 6e 66 69 67 20 28 61 72 67 73 3a 67 65 nconfig (args:ge
7ef0: 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 t-arg "-reqtarg"
7f00: 29 20 23 66 29 0a 09 09 20 20 28 6b 65 79 73 3a ) #f)... (keys:
7f10: 74 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 target-set-args
7f20: 6b 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 keys (args:get-a
7f30: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 61 rg "-reqtarg") a
7f40: 72 67 73 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 rgs:arg-hash)...
7f50: 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 (begin... (
7f60: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 debug:print 0 "E
7f70: 52 52 4f 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 RROR: [" (args:g
7f80: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 et-arg "-reqtarg
7f90: 22 29 20 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 ") "] not found
7fa0: 69 6e 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 in " runconfigf)
7fb0: 0a 09 09 20 20 20 20 28 73 71 6c 69 74 65 33 3a ... (sqlite3:
7fc0: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 0a 09 09 finalize! db)...
7fd0: 20 20 20 20 28 65 78 69 74 20 31 29 29 29 29 0a (exit 1)))).
7fe0: 09 20 20 20 20 28 69 66 20 28 61 72 67 73 3a 67 . (if (args:g
7ff0: 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 et-arg "-target"
8000: 29 0a 09 09 28 6b 65 79 73 3a 74 61 72 67 65 74 )...(keys:target
8010: 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 73 20 28 -set-args keys (
8020: 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 args:get-arg "-t
8030: 61 72 67 65 74 22 20 61 72 67 73 3a 61 72 67 2d arget" args:arg-
8040: 68 61 73 68 29 20 61 72 67 73 3a 61 72 67 2d 68 hash) args:arg-h
8050: 61 73 68 29 29 29 0a 09 28 69 66 20 28 6e 6f 74 ash)))..(if (not
8060: 20 28 63 61 72 20 2a 63 6f 6e 66 69 67 69 6e 66 (car *configinf
8070: 6f 2a 29 29 0a 09 20 20 20 20 28 62 65 67 69 6e o*)).. (begin
8080: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
8090: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 41 rint 0 "ERROR: A
80a0: 74 74 65 6d 70 74 65 64 20 74 6f 20 22 20 61 63 ttempted to " ac
80b0: 74 69 6f 6e 2d 64 65 73 63 20 22 20 62 75 74 20 tion-desc " but
80c0: 72 75 6e 20 61 72 65 61 20 63 6f 6e 66 69 67 20 run area config
80d0: 66 69 6c 65 20 6e 6f 74 20 66 6f 75 6e 64 22 29 file not found")
80e0: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
80f0: 29 0a 09 20 20 20 20 3b 3b 20 45 78 74 72 61 63 ).. ;; Extrac
8100: 74 20 6f 75 74 20 73 74 75 66 66 20 6e 65 65 64 t out stuff need
8110: 65 64 20 69 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 ed in most or ma
8120: 6e 79 20 63 61 6c 6c 73 0a 09 20 20 20 20 3b 3b ny calls.. ;;
8130: 20 68 65 72 65 20 74 68 65 6e 20 63 61 6c 6c 20 here then call
8140: 70 72 6f 63 0a 09 20 20 20 20 28 6c 65 74 2a 20 proc.. (let*
8150: 28 28 6b 65 79 6e 61 6d 65 73 20 20 20 28 6d 61 ((keynames (ma
8160: 70 20 6b 65 79 3a 67 65 74 2d 66 69 65 6c 64 6e p key:get-fieldn
8170: 61 6d 65 20 6b 65 79 73 29 29 0a 09 09 20 20 20 ame keys))...
8180: 28 6b 65 79 76 61 6c 6c 73 74 20 20 28 6b 65 79 (keyvallst (key
8190: 73 2d 3e 76 61 6c 6c 69 73 74 20 6b 65 79 73 20 s->vallist keys
81a0: 23 74 29 29 29 0a 09 20 20 20 20 20 20 28 70 72 #t))).. (pr
81b0: 6f 63 20 64 62 20 74 61 72 67 65 74 20 72 75 6e oc db target run
81c0: 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e 61 6d name keys keynam
81d0: 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 29 0a es keyvallst))).
81e0: 09 28 69 66 20 74 68 31 20 28 74 68 72 65 61 64 .(if th1 (thread
81f0: 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 28 73 -join! th1))..(s
8200: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 qlite3:finalize!
8210: 20 64 62 29 0a 09 28 73 65 74 21 20 2a 64 69 64 db)..(set! *did
8220: 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 29 something* #t)))
8230: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
8240: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8270: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
8280: 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 6e Lock/unlock run
8290: 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d s.;;============
82a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
82b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
82c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
82d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 ==========..(def
82e0: 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c 65 ine (runs:handle
82f0: 2d 6c 6f 63 6b 69 6e 67 20 64 62 20 74 61 72 67 -locking db targ
8300: 65 74 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 et keys runname
8310: 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 lock unlock user
8320: 29 0a 20 20 28 6c 65 74 2a 20 28 28 72 75 6e 64 ). (let* ((rund
8330: 61 74 20 20 20 28 72 75 6e 73 3a 67 65 74 2d 72 at (runs:get-r
8340: 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b uns-by-patt db k
8350: 65 79 73 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 eys runname))..
8360: 28 68 65 61 64 65 72 20 20 20 28 76 65 63 74 6f (header (vecto
8370: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 30 29 29 r-ref rundat 0))
8380: 0a 09 20 28 72 75 6e 73 20 20 20 20 20 28 76 65 .. (runs (ve
8390: 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 61 74 20 ctor-ref rundat
83a0: 31 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 1))). (for-ea
83b0: 63 68 20 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 ch (lambda (run)
83c0: 0a 09 09 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 ...(let ((run-id
83d0: 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 (db:get-value-b
83e0: 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 y-header run hea
83f0: 64 65 72 20 22 69 64 22 29 29 29 0a 09 09 20 20 der "id")))...
8400: 28 69 66 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 (if (or lock....
8410: 20 20 28 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 (and unlock...
8420: 09 20 20 20 20 20 20 20 28 62 65 67 69 6e 0a 09 . (begin..
8430: 09 09 09 20 28 70 72 69 6e 74 20 22 44 6f 20 79 ... (print "Do y
8440: 6f 75 20 72 65 61 6c 6c 79 20 77 69 73 68 20 74 ou really wish t
8450: 6f 20 75 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 o unlock run " r
8460: 75 6e 2d 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e un-id "?\n y/n
8470: 3a 20 22 29 0a 09 09 09 09 20 28 65 71 75 61 6c : ")..... (equal
8480: 3f 20 22 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 ? "y" (read-line
8490: 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 )))))... (d
84a0: 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 b:lock/unlock-ru
84b0: 6e 20 64 62 20 72 75 6e 2d 69 64 20 6c 6f 63 6b n db run-id lock
84c0: 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a 09 09 unlock user)...
84d0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
84e0: 6e 74 20 30 20 22 49 4e 46 4f 3a 20 53 6b 69 70 nt 0 "INFO: Skip
84f0: 70 69 6e 67 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b ping lock/unlock
8500: 20 6f 6e 20 22 20 72 75 6e 2d 69 64 29 29 29 29 on " run-id))))
8510: 0a 09 20 20 20 20 20 20 72 75 6e 73 29 29 29 0a .. runs))).
8520: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
8530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8560: 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c ========.;; Roll
8570: 75 70 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d up runs.;;======
8580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8590: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
85a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
85b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
85c0: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 68 65 20 ..;; Update the
85d0: 74 65 73 74 5f 6d 65 74 61 20 74 61 62 6c 65 20 test_meta table
85e0: 66 6f 72 20 74 68 69 73 20 74 65 73 74 0a 28 64 for this test.(d
85f0: 65 66 69 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 efine (runs:upda
8600: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
8610: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
8620: 6f 6e 66 29 0a 20 20 28 6c 65 74 20 28 28 63 75 onf). (let ((cu
8630: 72 72 72 65 63 6f 72 64 20 28 64 62 3a 74 65 73 rrrecord (db:tes
8640: 74 6d 65 74 61 2d 67 65 74 2d 72 65 63 6f 72 64 tmeta-get-record
8650: 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 db test-name)))
8660: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 63 75 . (if (not cu
8670: 72 72 72 65 63 6f 72 64 29 0a 09 28 62 65 67 69 rrrecord)..(begi
8680: 6e 0a 09 20 20 28 73 65 74 21 20 63 75 72 72 72 n.. (set! currr
8690: 65 63 6f 72 64 20 28 6d 61 6b 65 2d 76 65 63 74 ecord (make-vect
86a0: 6f 72 20 31 30 20 23 66 29 29 0a 09 20 20 28 64 or 10 #f)).. (d
86b0: 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 64 2d 72 b:testmeta-add-r
86c0: 65 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 ecord db test-na
86d0: 6d 65 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 me))). (for-e
86e0: 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 ach . (lambd
86f0: 61 20 28 6b 65 79 29 0a 20 20 20 20 20 20 20 28 a (key). (
8700: 6c 65 74 2a 20 28 28 69 64 78 20 28 63 61 64 72 let* ((idx (cadr
8710: 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 28 66 key)).. (f
8720: 6c 64 20 28 63 61 72 20 20 6b 65 79 29 29 0a 09 ld (car key))..
8730: 20 20 20 20 20 20 28 76 61 6c 20 28 63 6f 6e 66 (val (conf
8740: 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 74 2d 63 ig-lookup test-c
8750: 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 61 22 20 onf "test_meta"
8760: 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 64 65 62 fld))).. ;; (deb
8770: 75 67 3a 70 72 69 6e 74 20 35 20 22 69 64 78 3a ug:print 5 "idx:
8780: 20 22 20 69 64 78 20 22 20 66 6c 64 3a 20 22 20 " idx " fld: "
8790: 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 76 61 6c fld " val: " val
87a0: 29 0a 09 20 28 69 66 20 28 61 6e 64 20 76 61 6c ).. (if (and val
87b0: 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 28 76 (not (equal? (v
87c0: 65 63 74 6f 72 2d 72 65 66 20 63 75 72 72 72 65 ector-ref currre
87d0: 63 6f 72 64 20 69 64 78 29 20 76 61 6c 29 29 29 cord idx) val)))
87e0: 0a 09 20 20 20 20 20 28 62 65 67 69 6e 0a 09 20 .. (begin..
87f0: 20 20 20 20 20 20 28 70 72 69 6e 74 20 22 55 70 (print "Up
8800: 64 61 74 69 6e 67 20 22 20 74 65 73 74 2d 6e 61 dating " test-na
8810: 6d 65 20 22 20 22 20 66 6c 64 20 22 20 74 6f 20 me " " fld " to
8820: 22 20 76 61 6c 29 0a 09 20 20 20 20 20 20 20 28 " val).. (
8830: 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 64 61 db:testmeta-upda
8840: 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 73 74 te-field db test
8850: 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 29 29 -name fld val)))
8860: 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 74 68 )). '(("auth
8870: 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 20 33 or" 2)("owner" 3
8880: 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 22 20 )("description"
8890: 34 29 28 22 72 65 76 69 65 77 65 64 22 20 35 29 4)("reviewed" 5)
88a0: 28 22 74 61 67 73 22 20 39 29 29 29 29 29 0a 0a ("tags" 9)))))..
88b0: 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 5f 6d ;; Update test_m
88c0: 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 73 74 eta for all test
88d0: 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a s.(define (runs:
88e0: 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 74 5f update-all-test_
88f0: 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 74 20 meta db). (let
8900: 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 67 65 ((test-names (ge
8910: 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 73 74 t-all-legal-test
8920: 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 s))). (for-ea
8930: 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ch . (lambda
8940: 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 20 20 (test-name).
8950: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 (let* ((test
8960: 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a -path (conc *
8970: 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 toppath* "/tests
8980: 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 0a 09 /" test-name))..
8990: 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 (test-conf
89a0: 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 2d 70 igf (conc test-p
89b0: 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 69 67 ath "/testconfig
89c0: 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 ")).. (test
89d0: 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 28 66 exists (and (f
89e0: 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 73 74 ile-exists? test
89f0: 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 2d 72 -configf)(file-r
8a00: 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 73 74 ead-access? test
8a10: 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 20 20 -configf)))..
8a20: 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e 66 69 ;; read confi
8a30: 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 20 74 gs with tricks t
8a40: 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 2e 20 urned off (i.e.
8a50: 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 20 20 no system)..
8a60: 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 (test-conf
8a70: 28 69 66 20 74 65 73 74 65 78 69 73 74 73 20 28 (if testexists (
8a80: 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 73 74 read-config test
8a90: 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 29 28 -configf #f #f)(
8aa0: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
8ab0: 29 29 29 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 ))).. (runs:upda
8ac0: 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 20 te-test_meta db
8ad0: 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 test-name test-c
8ae0: 6f 6e 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 onf))). test
8af0: 2d 6e 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 -names)))..;; Th
8b00: 69 73 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c is could probabl
8b10: 79 20 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 y be refactored
8b20: 69 6e 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 into one complex
8b30: 20 71 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 query ....(defi
8b40: 6e 65 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d ne (runs:rollup-
8b50: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
8b60: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 75 73 allst runname us
8b70: 65 72 29 20 3b 3b 20 77 61 73 20 74 61 72 67 65 er) ;; was targe
8b80: 74 2c 20 6e 6f 77 20 6b 65 79 76 61 6c 6c 73 74 t, now keyvallst
8b90: 0a 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 . (debug:print
8ba0: 34 20 22 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 4 "runs:rollup-r
8bb0: 75 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 un, keys: " keys
8bc0: 20 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 " keyvallst: "
8bd0: 6b 65 79 76 61 6c 6c 73 74 20 22 20 3a 72 75 6e keyvallst " :run
8be0: 6e 61 6d 65 20 22 20 72 75 6e 6e 61 6d 65 20 22 name " runname "
8bf0: 20 75 73 65 72 3a 20 22 20 75 73 65 72 29 0a 20 user: " user).
8c00: 20 28 6c 65 74 2a 20 28 3b 20 28 6b 65 79 76 61 (let* (; (keyva
8c10: 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 73 lllst (keys
8c20: 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c 20 :target->keyval
8c30: 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 20 keys target))..
8c40: 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 20 (new-run-id
8c50: 20 28 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d (runs:register-
8c60: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
8c70: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
8c80: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
8c90: 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 .. (prev-tests
8ca0: 20 20 20 20 28 74 65 73 74 3a 67 65 74 2d 6d 61 (test:get-ma
8cb0: 74 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d tching-previous-
8cc0: 74 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 test-run-records
8cd0: 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 db new-run-id "
8ce0: 25 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 %" "%")).. (curr
8cf0: 2d 74 65 73 74 73 20 20 20 20 20 20 28 72 64 62 -tests (rdb
8d00: 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 :get-tests-for-r
8d10: 75 6e 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 un db new-run-id
8d20: 20 22 25 22 20 22 25 22 20 27 28 29 20 27 28 29 "%" "%" '() '()
8d30: 29 29 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 )).. (curr-tests
8d40: 2d 68 61 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 -hash (make-hash
8d50: 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 28 64 -table))). (d
8d60: 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d 65 76 65 b:update-run-eve
8d70: 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 77 2d 72 nt_time db new-r
8d80: 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b 20 69 6e un-id). ;; in
8d90: 64 65 78 20 74 68 65 20 61 6c 72 65 61 64 79 20 dex the already
8da0: 73 61 76 65 64 20 74 65 73 74 73 20 62 79 20 74 saved tests by t
8db0: 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 74 65 6d estname and item
8dc0: 64 61 74 20 69 6e 20 63 75 72 72 2d 74 65 73 74 dat in curr-test
8dd0: 73 2d 68 61 73 68 0a 20 20 20 20 28 66 6f 72 2d s-hash. (for-
8de0: 65 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 each. (lambd
8df0: 61 20 28 74 65 73 74 64 61 74 29 0a 20 20 20 20 a (testdat).
8e00: 20 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 6e (let* ((testn
8e10: 61 6d 65 20 20 28 64 62 3a 74 65 73 74 2d 67 65 ame (db:test-ge
8e20: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 64 t-testname testd
8e30: 61 74 29 29 0a 09 20 20 20 20 20 20 28 69 74 65 at)).. (ite
8e40: 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 73 74 2d m-path (db:test-
8e50: 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 65 get-item-path te
8e60: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
8e70: 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 full-name (conc
8e80: 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 testname "/" ite
8e90: 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 68 61 73 m-path))).. (has
8ea0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
8eb0: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
8ec0: 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 l-name testdat))
8ed0: 29 0a 20 20 20 20 20 63 75 72 72 2d 74 65 73 74 ). curr-test
8ee0: 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 s). ;; NOPE:
8ef0: 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 70 70 72 Non-optimal appr
8f00: 6f 61 63 68 2e 20 54 72 79 20 74 68 69 73 20 69 oach. Try this i
8f10: 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b 3b 20 20 nstead.. ;;
8f20: 20 31 2e 20 74 65 73 74 73 20 61 72 65 20 72 65 1. tests are re
8f30: 63 65 69 76 65 64 20 69 6e 20 61 20 6c 69 73 74 ceived in a list
8f40: 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 66 69 , most recent fi
8f50: 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 32 2e 20 rst. ;; 2.
8f60: 72 65 70 6c 61 63 65 20 74 68 65 20 72 6f 6c 6c replace the roll
8f70: 75 70 20 74 65 73 74 20 77 69 74 68 20 74 68 65 up test with the
8f80: 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a 0a 20 20 new *always*.
8f90: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
8fa0: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 64 (lambda (testd
8fb0: 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a at). (let*
8fc0: 20 28 28 74 65 73 74 6e 61 6d 65 20 20 28 64 62 ((testname (db
8fd0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
8fe0: 6d 65 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 me testdat))..
8ff0: 20 20 20 20 28 69 74 65 6d 2d 70 61 74 68 20 28 (item-path (
9000: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 6d db:test-get-item
9010: 2d 70 61 74 68 20 74 65 73 74 64 61 74 29 29 0a -path testdat)).
9020: 09 20 20 20 20 20 20 28 66 75 6c 6c 2d 6e 61 6d . (full-nam
9030: 65 20 28 63 6f 6e 63 20 74 65 73 74 6e 61 6d 65 e (conc testname
9040: 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 68 29 29 "/" item-path))
9050: 0a 09 20 20 20 20 20 20 28 70 72 65 76 2d 74 65 .. (prev-te
9060: 73 74 2d 64 61 74 20 28 68 61 73 68 2d 74 61 62 st-dat (hash-tab
9070: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 le-ref/default c
9080: 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 urr-tests-hash f
9090: 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 0a 09 20 ull-name #f))..
90a0: 20 20 20 20 20 28 74 65 73 74 2d 73 74 65 70 73 (test-steps
90b0: 20 20 20 20 20 20 28 64 62 3a 67 65 74 2d 73 74 (db:get-st
90c0: 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 62 20 eps-for-test db
90d0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
90e0: 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 20 20 testdat)))..
90f0: 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f (new-test-reco
9100: 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 65 70 rd #f)).. ;; rep
9110: 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 68 20 lace these with
9120: 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c 65 63 insert ... selec
9130: 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c 69 74 t.. (apply sqlit
9140: 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 64 62 e3:execute ...db
9150: 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 45 52 ...(conc "INSER
9160: 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 T OR REPLACE INT
9170: 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 64 2c O tests (run_id,
9180: 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 2c 73 testname,state,s
9190: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 tatus,event_time
91a0: 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c 64 69 ,host,cpuload,di
91b0: 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 75 6e skfree,uname,run
91c0: 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c 72 75 dir,item_path,ru
91d0: 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e 61 6c n_duration,final
91e0: 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 20 22 _logf,comment) "
91f0: 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 45 53 ... "VALUES
9200: 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c (?,?,?,?,?,?,?,
9210: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 ?,?,?,?,?,?,?);"
9220: 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 20 28 )...new-run-id (
9230: 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e 6c 69 cddr (vector->li
9240: 73 74 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 st testdat)))..
9250: 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 64 61 (set! new-testda
9260: 74 20 28 63 61 72 20 28 72 64 62 3a 67 65 74 2d t (car (rdb:get-
9270: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
9280: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 74 65 73 74 new-run-id test
9290: 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 20 27 name item-path '
92a0: 28 29 20 27 28 29 29 29 29 0a 09 20 28 68 61 73 () '()))).. (has
92b0: 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 63 75 72 h-table-set! cur
92c0: 72 2d 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c r-tests-hash ful
92d0: 6c 2d 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 64 l-name new-testd
92e0: 61 74 29 20 3b 3b 20 74 68 69 73 20 63 6f 75 6c at) ;; this coul
92f0: 64 20 62 65 20 63 6f 6e 66 75 73 69 6e 67 2c 20 d be confusing,
9300: 77 68 69 63 68 20 72 65 63 6f 72 64 20 73 68 6f which record sho
9310: 75 6c 64 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 uld go into the
9320: 6c 6f 6f 6b 75 70 20 74 61 62 6c 65 3f 0a 09 20 lookup table?..
9330: 3b 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 ;; Now duplicate
9340: 20 74 68 65 20 74 65 73 74 20 73 74 65 70 73 0a the test steps.
9350: 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 . (debug:print 4
9360: 20 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 "Copying record
9370: 73 20 69 6e 20 74 65 73 74 5f 73 74 65 70 73 20 s in test_steps
9380: 66 72 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 from test_id=" (
9390: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
93a0: 65 73 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 estdat) " to " (
93b0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e db:test-get-id n
93c0: 65 77 2d 74 65 73 74 64 61 74 29 29 0a 09 20 28 ew-testdat)).. (
93d0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
93e0: 0a 09 20 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 .. db .. (conc
93f0: 20 22 49 4e 53 45 52 54 20 4f 52 20 52 45 50 4c "INSERT OR REPL
9400: 41 43 45 20 49 4e 54 4f 20 74 65 73 74 5f 73 74 ACE INTO test_st
9410: 65 70 73 20 28 74 65 73 74 5f 69 64 2c 73 74 65 eps (test_id,ste
9420: 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 pname,state,stat
9430: 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f us,event_time,co
9440: 6d 6d 65 6e 74 29 20 22 0a 09 09 22 53 45 4c 45 mment) "..."SELE
9450: 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 CT " (db:test-ge
9460: 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 74 t-id new-testdat
9470: 29 20 22 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 ) ",stepname,sta
9480: 74 65 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f te,status,event_
9490: 74 69 6d 65 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f time,comment FRO
94a0: 4d 20 74 65 73 74 5f 73 74 65 70 73 20 57 48 45 M test_steps WHE
94b0: 52 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a RE test_id=?;").
94c0: 09 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d . (db:test-get-
94d0: 69 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 3b id testdat)).. ;
94e0: 3b 20 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 ; Now duplicate
94f0: 74 68 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 the test data..
9500: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
9510: 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 Copying records
9520: 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f in test_data fro
9530: 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a m test_id=" (db:
9540: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
9550: 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a dat) " to " (db:
9560: 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d test-get-id new-
9570: 74 65 73 74 64 61 74 29 29 0a 09 20 28 73 71 6c testdat)).. (sql
9580: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 ite3:execute ..
9590: 20 64 62 20 0a 09 20 20 28 63 6f 6e 63 20 22 49 db .. (conc "I
95a0: 4e 53 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 NSERT OR REPLACE
95b0: 20 49 4e 54 4f 20 74 65 73 74 5f 64 61 74 61 20 INTO test_data
95c0: 28 74 65 73 74 5f 69 64 2c 63 61 74 65 67 6f 72 (test_id,categor
95d0: 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 y,variable,value
95e0: 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e ,expected,tol,un
95f0: 69 74 73 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 its,comment) "..
9600: 09 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 ."SELECT " (db:t
9610: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 est-get-id new-t
9620: 65 73 74 64 61 74 29 20 22 2c 63 61 74 65 67 6f estdat) ",catego
9630: 72 79 2c 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 ry,variable,valu
9640: 65 2c 65 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 e,expected,tol,u
9650: 6e 69 74 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f nits,comment FRO
9660: 4d 20 74 65 73 74 5f 64 61 74 61 20 57 48 45 52 M test_data WHER
9670: 45 20 74 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 E test_id=?;")..
9680: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 (db:test-get-i
9690: 64 20 74 65 73 74 64 61 74 29 29 0a 09 20 29 29 d testdat)).. ))
96a0: 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 . prev-tests
96b0: 29 29 29 0a 09 20 0a 20 20 20 20 20 0a ))).. . .