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: 29 20 3b 3b 20 74 65 73 74 2d 6e 61 6d 65 29 0a ) ;; test-name).
0460: 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 76 61 6c (let* ((keyval
0470: 6c 73 74 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 lst (keys->valli
0480: 73 74 20 6b 65 79 73 29 29 0a 09 20 28 74 6d 70 st keys)).. (tmp
0490: 20 20 20 20 20 20 28 72 75 6e 73 3a 67 65 74 2d (runs:get-
04a0: 73 74 64 2d 72 75 6e 2d 66 69 65 6c 64 73 20 6b std-run-fields k
04b0: 65 79 73 20 27 28 22 69 64 22 20 22 72 75 6e 6e eys '("id" "runn
04c0: 61 6d 65 22 20 22 73 74 61 74 65 22 20 22 73 74 ame" "state" "st
04d0: 61 74 75 73 22 20 22 6f 77 6e 65 72 22 20 22 65 atus" "owner" "e
04e0: 76 65 6e 74 5f 74 69 6d 65 22 29 29 29 0a 09 20 vent_time")))..
04f0: 28 6b 65 79 73 74 72 20 20 20 28 63 61 72 20 74 (keystr (car t
0500: 6d 70 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 mp)).. (header
0510: 20 28 63 61 64 72 20 74 6d 70 29 29 0a 09 20 28 (cadr tmp)).. (
0520: 72 65 73 20 20 20 20 20 27 28 29 29 0a 09 20 28 res '()).. (
0530: 6b 65 79 2d 70 61 74 74 20 22 22 29 0a 09 20 28 key-patt "").. (
0540: 72 75 6e 77 69 6c 64 74 79 70 65 20 28 69 66 20 runwildtype (if
0550: 28 73 75 62 73 74 72 69 6e 67 2d 69 6e 64 65 78 (substring-index
0560: 20 22 25 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 "%" runnamepatt
0570: 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f 62 22 29 ) "like" "glob")
0580: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
0590: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c (lambda (keyval
05a0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20 )...(let* ((key
05b0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b (vector-ref k
05c0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20 eyval 0))...
05d0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63 (fulkey (conc
05e0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20 ":" key))...
05f0: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67 (patt (arg
0600: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79 s:get-arg fulkey
0610: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c ))... (wil
0620: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74 dtype (if (subst
0630: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70 ring-index "%" p
0640: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f att) "like" "glo
0650: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61 b")))... (if pa
0660: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21 tt... (set!
0670: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20 key-patt (conc
0680: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22 key-patt " AND "
0690: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70 key " " wildtyp
06a0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29 e " '" patt "'")
06b0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e )... (begin
06c0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ....(debug:print
06d0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63 0 "ERROR: searc
06e0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69 hing for runs wi
06f0: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65 th no pattern se
0700: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a t for " fulkey).
0710: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a ...(exit 6))))).
0720: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20 . keys).
0730: 20 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 (sqlite3:for-ea
0740: 63 68 2d 72 6f 77 20 0a 20 20 20 20 20 28 6c 61 ch-row . (la
0750: 6d 62 64 61 20 28 61 20 2e 20 72 29 0a 20 20 20 mbda (a . r).
0760: 20 20 20 20 28 73 65 74 21 20 72 65 73 20 28 63 (set! res (c
0770: 6f 6e 73 20 28 6c 69 73 74 2d 3e 76 65 63 74 6f ons (list->vecto
0780: 72 20 28 63 6f 6e 73 20 61 20 72 29 29 20 72 65 r (cons a r)) re
0790: 73 29 29 29 0a 20 20 20 20 20 64 62 20 0a 20 20 s))). db .
07a0: 20 20 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 54 (conc "SELECT
07b0: 20 22 20 6b 65 79 73 74 72 20 22 20 46 52 4f 4d " keystr " FROM
07c0: 20 72 75 6e 73 20 57 48 45 52 45 20 72 75 6e 6e runs WHERE runn
07d0: 61 6d 65 20 22 20 72 75 6e 77 69 6c 64 74 79 70 ame " runwildtyp
07e0: 65 20 22 20 3f 20 22 20 6b 65 79 2d 70 61 74 74 e " ? " key-patt
07f0: 20 22 3b 22 29 0a 20 20 20 20 20 72 75 6e 6e 61 ";"). runna
0800: 6d 65 70 61 74 74 29 0a 20 20 20 20 28 76 65 63 mepatt). (vec
0810: 74 6f 72 20 68 65 61 64 65 72 20 72 65 73 29 29 tor header res))
0820: 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 )..(define (runs
0830: 3a 74 65 73 74 2d 67 65 74 2d 66 75 6c 6c 2d 70 :test-get-full-p
0840: 61 74 68 20 74 65 73 74 29 0a 20 20 28 6c 65 74 ath test). (let
0850: 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 28 64 62 * ((testname (db
0860: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
0870: 6d 65 20 20 20 74 65 73 74 29 29 0a 09 20 28 69 me test)).. (i
0880: 74 65 6d 70 61 74 68 20 28 64 62 3a 74 65 73 74 tempath (db:test
0890: 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 20 74 -get-item-path t
08a0: 65 73 74 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 est))). (conc
08b0: 20 74 65 73 74 6e 61 6d 65 20 28 69 66 20 28 65 testname (if (e
08c0: 71 75 61 6c 3f 20 69 74 65 6d 70 61 74 68 20 22 qual? itempath "
08d0: 22 29 20 22 22 20 28 63 6f 6e 63 20 22 28 22 20 ") "" (conc "("
08e0: 69 74 65 6d 70 61 74 68 20 22 29 22 29 29 29 29 itempath ")"))))
08f0: 29 0a 0a 3b 3b 20 41 77 66 75 6c 2e 20 50 6c 65 )..;; Awful. Ple
0900: 61 73 65 20 46 49 58 4d 45 0a 28 64 65 66 69 6e ase FIXME.(defin
0910: 65 20 2a 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 e *env-vars-by-r
0920: 75 6e 2d 69 64 2a 20 28 6d 61 6b 65 2d 68 61 73 un-id* (make-has
0930: 68 2d 74 61 62 6c 65 29 29 0a 28 64 65 66 69 6e h-table)).(defin
0940: 65 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e 2d 6e e *current-run-n
0950: 61 6d 65 2a 20 20 20 23 66 29 0a 0a 28 64 65 66 ame* #f)..(def
0960: 69 6e 65 20 28 73 65 74 2d 6d 65 67 61 74 65 73 ine (set-megates
0970: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 t-env-vars db ru
0980: 6e 2d 69 64 29 0a 20 20 28 6c 65 74 20 28 28 6b n-id). (let ((k
0990: 65 79 73 20 28 64 62 3a 67 65 74 2d 6b 65 79 73 eys (db:get-keys
09a0: 20 64 62 29 29 0a 09 28 76 61 6c 73 20 28 68 61 db))..(vals (ha
09b0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
09c0: 61 75 6c 74 20 2a 65 6e 76 2d 76 61 72 73 2d 62 ault *env-vars-b
09d0: 79 2d 72 75 6e 2d 69 64 2a 20 72 75 6e 2d 69 64 y-run-id* run-id
09e0: 20 23 66 29 29 29 0a 20 20 20 20 3b 3b 20 67 65 #f))). ;; ge
09f0: 74 20 74 68 65 20 69 6e 66 6f 20 66 72 6f 6d 20 t the info from
0a00: 74 68 65 20 64 62 20 61 6e 64 20 70 75 74 20 69 the db and put i
0a10: 74 20 69 6e 20 74 68 65 20 63 61 63 68 65 0a 20 t in the cache.
0a20: 20 20 20 28 69 66 20 28 6e 6f 74 20 76 61 6c 73 (if (not vals
0a30: 29 0a 09 28 6c 65 74 20 28 28 68 74 20 28 6d 61 )..(let ((ht (ma
0a40: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 ke-hash-table)))
0a50: 0a 09 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d .. (hash-table-
0a60: 73 65 74 21 20 2a 65 6e 76 2d 76 61 72 73 2d 62 set! *env-vars-b
0a70: 79 2d 72 75 6e 2d 69 64 2a 20 72 75 6e 2d 69 64 y-run-id* run-id
0a80: 20 68 74 29 0a 09 20 20 28 73 65 74 21 20 76 61 ht).. (set! va
0a90: 6c 73 20 68 74 29 0a 09 20 20 28 66 6f 72 2d 65 ls ht).. (for-e
0aa0: 61 63 68 0a 09 20 20 20 28 6c 61 6d 62 64 61 20 ach.. (lambda
0ab0: 28 6b 65 79 29 0a 09 20 20 20 20 20 28 73 71 6c (key).. (sql
0ac0: 69 74 65 33 3a 66 6f 72 2d 65 61 63 68 2d 72 6f ite3:for-each-ro
0ad0: 77 0a 09 20 20 20 20 20 20 28 6c 61 6d 62 64 61 w.. (lambda
0ae0: 20 28 76 61 6c 29 0a 09 09 28 68 61 73 68 2d 74 (val)...(hash-t
0af0: 61 62 6c 65 2d 73 65 74 21 20 76 61 6c 73 20 6b able-set! vals k
0b00: 65 79 20 76 61 6c 29 29 0a 09 20 20 20 20 20 20 ey val))..
0b10: 64 62 20 0a 09 20 20 20 20 20 20 28 63 6f 6e 63 db .. (conc
0b20: 20 22 53 45 4c 45 43 54 20 22 20 28 6b 65 79 3a "SELECT " (key:
0b30: 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 65 get-fieldname ke
0b40: 79 29 20 22 20 46 52 4f 4d 20 72 75 6e 73 20 57 y) " FROM runs W
0b50: 48 45 52 45 20 69 64 3d 3f 3b 22 29 0a 09 20 20 HERE id=?;")..
0b60: 20 20 20 20 72 75 6e 2d 69 64 29 29 0a 09 20 20 run-id))..
0b70: 20 6b 65 79 73 29 29 29 0a 20 20 20 20 3b 3b 20 keys))). ;;
0b80: 66 72 6f 6d 20 74 68 65 20 63 61 63 68 65 64 20 from the cached
0b90: 64 61 74 61 20 73 65 74 20 74 68 65 20 76 61 72 data set the var
0ba0: 73 0a 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c s. (hash-tabl
0bb0: 65 2d 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 e-for-each.
0bc0: 76 61 6c 73 0a 20 20 20 20 20 28 6c 61 6d 62 64 vals. (lambd
0bd0: 61 20 28 6b 65 79 20 76 61 6c 29 0a 20 20 20 20 a (key val).
0be0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
0bf0: 32 20 22 73 65 74 65 6e 76 20 22 20 28 6b 65 79 2 "setenv " (key
0c00: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b :get-fieldname k
0c10: 65 79 29 20 22 20 22 20 76 61 6c 29 0a 20 20 20 ey) " " val).
0c20: 20 20 20 20 28 73 65 74 65 6e 76 20 28 6b 65 79 (setenv (key
0c30: 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b :get-fieldname k
0c40: 65 79 29 20 76 61 6c 29 29 29 0a 20 20 20 20 28 ey) val))). (
0c50: 61 6c 69 73 74 2d 3e 65 6e 76 2d 76 61 72 73 20 alist->env-vars
0c60: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
0c70: 64 65 66 61 75 6c 74 20 2a 63 6f 6e 66 69 67 64 default *configd
0c80: 61 74 2a 20 22 65 6e 76 2d 6f 76 65 72 72 69 64 at* "env-overrid
0c90: 65 22 20 27 28 29 29 29 0a 20 20 20 20 3b 3b 20 e" '())). ;;
0ca0: 4c 65 74 73 20 75 73 65 20 74 68 69 73 20 61 73 Lets use this as
0cb0: 20 61 6e 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 an opportunity
0cc0: 74 6f 20 70 75 74 20 4d 54 5f 52 55 4e 4e 41 4d to put MT_RUNNAM
0cd0: 45 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e E in the environ
0ce0: 6d 65 6e 74 0a 20 20 20 20 28 69 66 20 28 6e 6f ment. (if (no
0cf0: 74 20 2a 63 75 72 72 65 6e 74 2d 72 75 6e 2d 6e t *current-run-n
0d00: 61 6d 65 2a 29 0a 09 28 73 71 6c 69 74 65 33 3a ame*)..(sqlite3:
0d10: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 20 28 for-each-row.. (
0d20: 6c 61 6d 62 64 61 20 28 72 75 6e 6e 61 6d 65 29 lambda (runname)
0d30: 0a 09 20 20 20 28 73 65 74 21 20 2a 63 75 72 72 .. (set! *curr
0d40: 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 20 72 75 ent-run-name* ru
0d50: 6e 6e 61 6d 65 29 29 0a 0a 09 20 64 62 0a 09 20 nname))... db..
0d60: 22 53 45 4c 45 43 54 20 72 75 6e 6e 61 6d 65 20 "SELECT runname
0d70: 46 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 FROM runs WHERE
0d80: 69 64 3d 3f 3b 22 0a 09 20 72 75 6e 2d 69 64 29 id=?;".. run-id)
0d90: 29 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 4d ). (setenv "M
0da0: 54 5f 52 55 4e 4e 41 4d 45 22 20 2a 63 75 72 72 T_RUNNAME" *curr
0db0: 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 29 0a 20 ent-run-name*).
0dc0: 20 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 (setenv "MT_R
0dd0: 55 4e 5f 41 52 45 41 5f 48 4f 4d 45 22 20 2a 74 UN_AREA_HOME" *t
0de0: 6f 70 70 61 74 68 2a 29 0a 20 20 20 20 29 29 0a oppath*). )).
0df0: 0a 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 74 .(define (set-it
0e00: 65 6d 2d 65 6e 76 2d 76 61 72 73 20 69 74 65 6d em-env-vars item
0e10: 64 61 74 29 0a 20 20 28 66 6f 72 2d 65 61 63 68 dat). (for-each
0e20: 20 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 29 0a (lambda (item).
0e30: 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 . (debug:pr
0e40: 69 6e 74 20 32 20 22 73 65 74 65 6e 76 20 22 20 int 2 "setenv "
0e50: 28 63 61 72 20 69 74 65 6d 29 20 22 20 22 20 28 (car item) " " (
0e60: 63 61 64 72 20 69 74 65 6d 29 29 0a 09 20 20 20 cadr item))..
0e70: 20 20 20 28 73 65 74 65 6e 76 20 28 63 61 72 20 (setenv (car
0e80: 69 74 65 6d 29 20 28 63 61 64 72 20 69 74 65 6d item) (cadr item
0e90: 29 29 29 0a 09 20 20 20 20 69 74 65 6d 64 61 74 ))).. itemdat
0ea0: 29 29 0a 0a 28 64 65 66 69 6e 65 20 2a 6c 61 73 ))..(define *las
0eb0: 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 t-num-running-te
0ec0: 73 74 73 2a 20 30 29 0a 28 64 65 66 69 6e 65 20 sts* 0).(define
0ed0: 28 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f (runs:can-run-mo
0ee0: 72 65 2d 74 65 73 74 73 20 64 62 20 74 65 73 74 re-tests db test
0ef0: 2d 72 65 63 6f 72 64 29 0a 20 20 28 6c 65 74 2a -record). (let*
0f00: 20 28 28 74 63 6f 6e 66 69 67 20 20 20 20 20 20 ((tconfig
0f10: 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 (test
0f20: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
0f30: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d testconfig test-
0f40: 72 65 63 6f 72 64 29 29 0a 09 20 28 6a 6f 62 67 record)).. (jobg
0f50: 72 6f 75 70 20 20 20 20 20 20 20 20 20 20 20 20 roup
0f60: 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b (config-look
0f70: 75 70 20 74 63 6f 6e 66 69 67 20 22 72 65 71 75 up tconfig "requ
0f80: 69 72 65 6d 65 6e 74 73 22 20 22 6a 6f 62 67 72 irements" "jobgr
0f90: 6f 75 70 22 29 29 0a 09 20 28 6e 75 6d 2d 72 75 oup")).. (num-ru
0fa0: 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 nning
0fb0: 20 20 28 64 62 3a 67 65 74 2d 63 6f 75 6e 74 2d (db:get-count-
0fc0: 74 65 73 74 73 2d 72 75 6e 6e 69 6e 67 20 64 62 tests-running db
0fd0: 29 29 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e )).. (num-runnin
0fe0: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 64 g-in-jobgroup (d
0ff0: 62 3a 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 b:get-count-test
1000: 73 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 s-running-in-job
1010: 67 72 6f 75 70 20 64 62 20 6a 6f 62 67 72 6f 75 group db jobgrou
1020: 70 29 29 0a 09 20 28 6d 61 78 2d 63 6f 6e 63 75 p)).. (max-concu
1030: 72 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 rrent-jobs (
1040: 6c 65 74 20 28 28 6d 63 6a 20 28 63 6f 6e 66 69 let ((mcj (confi
1050: 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 g-lookup *config
1060: 64 61 74 2a 20 22 73 65 74 75 70 22 20 20 20 20 dat* "setup"
1070: 20 22 6d 61 78 5f 63 6f 6e 63 75 72 72 65 6e 74 "max_concurrent
1080: 5f 6a 6f 62 73 22 29 29 29 0a 09 09 09 09 20 20 _jobs"))).....
1090: 20 20 28 69 66 20 28 61 6e 64 20 6d 63 6a 20 28 (if (and mcj (
10a0: 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 20 6d string->number m
10b0: 63 6a 29 29 0a 09 09 09 09 09 28 73 74 72 69 6e cj))......(strin
10c0: 67 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 0a 09 g->number mcj)..
10d0: 09 09 09 09 23 66 29 29 29 0a 09 20 28 6a 6f 62 ....#f))).. (job
10e0: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 20 20 -group-limit
10f0: 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f (config-loo
1100: 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 kup *configdat*
1110: 22 6a 6f 62 67 72 6f 75 70 73 22 20 6a 6f 62 67 "jobgroups" jobg
1120: 72 6f 75 70 29 29 29 0a 20 20 20 20 28 69 66 20 roup))). (if
1130: 28 6e 6f 74 20 28 65 71 3f 20 2a 6c 61 73 74 2d (not (eq? *last-
1140: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 num-running-test
1150: 73 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 s* num-running))
1160: 0a 09 28 62 65 67 69 6e 0a 09 20 20 28 64 65 62 ..(begin.. (deb
1170: 75 67 3a 70 72 69 6e 74 20 32 20 22 6d 61 78 2d ug:print 2 "max-
1180: 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 3a concurrent-jobs:
1190: 20 22 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e " max-concurren
11a0: 74 2d 6a 6f 62 73 20 22 2c 20 6e 75 6d 2d 72 75 t-jobs ", num-ru
11b0: 6e 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e nning: " num-run
11c0: 6e 69 6e 67 29 0a 09 20 20 28 73 65 74 21 20 2a ning).. (set! *
11d0: 6c 61 73 74 2d 6e 75 6d 2d 72 75 6e 6e 69 6e 67 last-num-running
11e0: 2d 74 65 73 74 73 2a 20 6e 75 6d 2d 72 75 6e 6e -tests* num-runn
11f0: 69 6e 67 29 29 29 0a 20 20 20 20 28 69 66 20 28 ing))). (if (
1200: 6e 6f 74 20 28 65 71 3f 20 30 20 2a 67 6c 6f 62 not (eq? 0 *glob
1210: 61 6c 65 78 69 74 73 74 61 74 75 73 2a 29 29 0a alexitstatus*)).
1220: 09 28 6c 69 73 74 20 23 66 20 6e 75 6d 2d 72 75 .(list #f num-ru
1230: 6e 6e 69 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e nning num-runnin
1240: 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 g-in-jobgroup ma
1250: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
1260: 73 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 s job-group-limi
1270: 74 29 0a 09 28 6c 65 74 20 28 28 63 61 6e 2d 6e t)..(let ((can-n
1280: 6f 74 2d 72 75 6e 2d 6d 6f 72 65 20 28 63 6f 6e ot-run-more (con
1290: 64 0a 09 09 09 09 20 3b 3b 20 69 66 20 6d 61 78 d..... ;; if max
12a0: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
12b0: 20 69 73 20 73 65 74 20 61 6e 64 20 74 68 65 20 is set and the
12c0: 6e 75 6d 62 65 72 20 72 75 6e 6e 69 6e 67 20 69 number running i
12d0: 73 20 67 72 65 61 74 65 72 20 0a 09 09 09 09 20 s greater .....
12e0: 3b 3b 20 74 68 61 6e 20 69 74 20 74 68 61 6e 20 ;; than it than
12f0: 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f 72 65 20 cannot run more
1300: 6a 6f 62 73 0a 09 09 09 09 20 28 28 61 6e 64 20 jobs..... ((and
1310: 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a max-concurrent-j
1320: 6f 62 73 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e obs (>= num-runn
1330: 69 6e 67 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 ing max-concurre
1340: 6e 74 2d 6a 6f 62 73 29 29 0a 09 09 09 09 20 20 nt-jobs)).....
1350: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
1360: 57 41 52 4e 49 4e 47 3a 20 4d 61 78 20 72 75 6e WARNING: Max run
1370: 6e 69 6e 67 20 6a 6f 62 73 20 65 78 63 65 65 64 ning jobs exceed
1380: 65 64 2c 20 63 75 72 72 65 6e 74 20 6e 75 6d 62 ed, current numb
1390: 65 72 20 72 75 6e 6e 69 6e 67 3a 20 22 20 6e 75 er running: " nu
13a0: 6d 2d 72 75 6e 6e 69 6e 67 20 0a 09 09 09 09 09 m-running ......
13b0: 20 20 20 20 20 20 20 22 2c 20 6d 61 78 5f 63 6f ", max_co
13c0: 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 3a 20 22 ncurrent_jobs: "
13d0: 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d max-concurrent-
13e0: 6a 6f 62 73 29 0a 09 09 09 09 20 20 23 74 29 0a jobs)..... #t).
13f0: 09 09 09 09 20 3b 3b 20 69 66 20 6a 6f 62 2d 67 .... ;; if job-g
1400: 72 6f 75 70 2d 6c 69 6d 69 74 20 69 73 20 73 65 roup-limit is se
1410: 74 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 t and number of
1420: 6a 6f 62 73 20 69 6e 20 74 68 65 20 67 72 6f 75 jobs in the grou
1430: 70 20 69 73 20 67 72 65 61 74 65 72 0a 09 09 09 p is greater....
1440: 09 20 3b 3b 20 74 68 61 6e 20 74 68 65 20 6c 69 . ;; than the li
1450: 6d 69 74 20 74 68 65 6e 20 63 61 6e 6e 6f 74 20 mit then cannot
1460: 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 20 6f 66 run more jobs of
1470: 20 74 68 69 73 20 6b 69 6e 64 0a 09 09 09 09 20 this kind.....
1480: 28 28 61 6e 64 20 6a 6f 62 2d 67 72 6f 75 70 2d ((and job-group-
1490: 6c 69 6d 69 74 0a 09 09 09 09 20 20 20 20 20 20 limit.....
14a0: 20 28 3e 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 (>= num-running
14b0: 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 6a 6f 62 -in-jobgroup job
14c0: 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 0a 09 -group-limit))..
14d0: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ... (debug:prin
14e0: 74 20 31 20 22 57 41 52 4e 49 4e 47 3a 20 6e 75 t 1 "WARNING: nu
14f0: 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 22 20 6e mber of jobs " n
1500: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f um-running-in-jo
1510: 62 67 72 6f 75 70 20 0a 09 09 09 09 09 20 20 20 bgroup ......
1520: 20 20 20 20 22 20 69 6e 20 22 20 6a 6f 62 67 72 " in " jobgr
1530: 6f 75 70 20 22 20 65 78 63 65 65 64 65 64 2c 20 oup " exceeded,
1540: 77 69 6c 6c 20 6e 6f 74 20 72 75 6e 20 22 20 28 will not run " (
1550: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
1560: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 get-testname tes
1570: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 09 09 20 t-record)).....
1580: 20 23 74 29 0a 09 09 09 09 20 28 65 6c 73 65 20 #t)..... (else
1590: 23 66 29 29 29 29 0a 09 20 20 28 6c 69 73 74 20 #f)))).. (list
15a0: 28 6e 6f 74 20 63 61 6e 2d 6e 6f 74 2d 72 75 6e (not can-not-run
15b0: 2d 6d 6f 72 65 29 20 6e 75 6d 2d 72 75 6e 6e 69 -more) num-runni
15c0: 6e 67 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 ng num-running-i
15d0: 6e 2d 6a 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 n-jobgroup max-c
15e0: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a oncurrent-jobs j
15f0: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 29 29 ob-group-limit))
1600: 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d )))..;;=========
1610: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1620: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1630: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1640: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
1650: 20 4e 65 77 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 New methodology
1660: 2e 20 54 68 65 73 65 20 72 6f 75 74 69 6e 65 73 . These routines
1670: 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 20 74 68 will replace th
1680: 65 20 61 62 6f 76 65 20 69 6e 20 74 69 6d 65 2e e above in time.
1690: 20 46 6f 72 0a 3b 3b 20 6e 6f 77 20 74 68 65 20 For.;; now the
16a0: 63 6f 64 65 20 69 73 20 64 75 70 6c 69 63 61 74 code is duplicat
16b0: 65 64 2e 20 54 68 69 73 20 73 74 75 66 66 20 69 ed. This stuff i
16c0: 73 20 69 6e 69 74 69 61 6c 6c 79 20 75 73 65 64 s initially used
16d0: 20 69 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 0a in the monitor.
16e0: 3b 3b 20 62 61 73 65 64 20 63 6f 64 65 2e 0a 3b ;; based code..;
16f0: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
1700: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1710: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1720: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1730: 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 72 65 67 69 =======..;; regi
1740: 73 74 65 72 20 61 20 74 65 73 74 20 72 75 6e 20 ster a test run
1750: 77 69 74 68 20 74 68 65 20 64 62 0a 28 64 65 66 with the db.(def
1760: 69 6e 65 20 28 72 75 6e 73 3a 72 65 67 69 73 74 ine (runs:regist
1770: 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 6b er-run db keys k
1780: 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 eyvallst runname
1790: 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 73 state status us
17a0: 65 72 29 0a 20 20 28 64 65 62 75 67 3a 70 72 69 er). (debug:pri
17b0: 6e 74 20 33 20 22 72 75 6e 73 3a 72 65 67 69 73 nt 3 "runs:regis
17c0: 74 65 72 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 ter-run, keys: "
17d0: 20 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 keys " keyvalls
17e0: 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 t: " keyvallst "
17f0: 20 72 75 6e 6e 61 6d 65 3a 20 22 20 72 75 6e 6e runname: " runn
1800: 61 6d 65 20 22 20 73 74 61 74 65 3a 20 22 20 73 ame " state: " s
1810: 74 61 74 65 20 22 20 73 74 61 74 75 73 3a 20 22 tate " status: "
1820: 20 73 74 61 74 75 73 20 22 20 75 73 65 72 3a 20 status " user:
1830: 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a 20 " user). (let*
1840: 28 28 6b 65 79 73 74 72 20 20 20 20 28 6b 65 79 ((keystr (key
1850: 73 2d 3e 6b 65 79 73 74 72 20 6b 65 79 73 29 29 s->keystr keys))
1860: 0a 09 20 28 63 6f 6d 6d 61 20 20 20 20 20 28 69 .. (comma (i
1870: 66 20 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 f (> (length key
1880: 73 29 20 30 29 20 22 2c 22 20 22 22 29 29 0a 09 s) 0) "," ""))..
1890: 20 28 61 6e 64 73 74 72 20 20 20 20 28 69 66 20 (andstr (if
18a0: 28 3e 20 28 6c 65 6e 67 74 68 20 6b 65 79 73 29 (> (length keys)
18b0: 20 30 29 20 22 20 41 4e 44 20 22 20 22 22 29 29 0) " AND " ""))
18c0: 0a 09 20 28 76 61 6c 73 6c 6f 74 73 20 20 28 6b .. (valslots (k
18d0: 65 79 73 2d 3e 76 61 6c 73 6c 6f 74 73 20 6b 65 eys->valslots ke
18e0: 79 73 29 29 20 3b 3b 20 3f 2c 3f 2c 3f 20 2e 2e ys)) ;; ?,?,? ..
18f0: 2e 0a 09 20 28 6b 65 79 76 61 6c 73 20 20 20 28 ... (keyvals (
1900: 6d 61 70 20 63 61 64 72 20 6b 65 79 76 61 6c 6c map cadr keyvall
1910: 73 74 29 29 0a 09 20 28 61 6c 6c 76 61 6c 73 20 st)).. (allvals
1920: 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 (append (list
1930: 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 20 73 74 runname state st
1940: 61 74 75 73 20 75 73 65 72 29 20 6b 65 79 76 61 atus user) keyva
1950: 6c 73 29 29 0a 09 20 28 71 72 79 76 61 6c 73 20 ls)).. (qryvals
1960: 20 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74 20 (append (list
1970: 72 75 6e 6e 61 6d 65 29 20 6b 65 79 76 61 6c 73 runname) keyvals
1980: 29 29 0a 09 20 28 6b 65 79 3d 3f 73 74 72 20 20 )).. (key=?str
1990: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
19a0: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 rse (map (lambda
19b0: 20 28 6b 29 28 63 6f 6e 63 20 28 6b 65 79 3a 67 (k)(conc (key:g
19c0: 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 6b 29 20 et-fieldname k)
19d0: 22 3d 3f 22 29 29 20 6b 65 79 73 29 20 22 20 41 "=?")) keys) " A
19e0: 4e 44 20 22 29 29 29 0a 20 20 20 20 28 64 65 62 ND "))). (deb
19f0: 75 67 3a 70 72 69 6e 74 20 33 20 22 6b 65 79 73 ug:print 3 "keys
1a00: 3a 20 22 20 6b 65 79 73 20 22 20 61 6c 6c 76 61 : " keys " allva
1a10: 6c 73 3a 20 22 20 61 6c 6c 76 61 6c 73 20 22 20 ls: " allvals "
1a20: 6b 65 79 76 61 6c 73 3a 20 22 20 6b 65 79 76 61 keyvals: " keyva
1a30: 6c 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ls). (debug:p
1a40: 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a 20 75 73 rint 2 "NOTE: us
1a50: 69 6e 67 20 74 61 72 67 65 74 20 22 20 28 73 74 ing target " (st
1a60: 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 ring-intersperse
1a70: 20 6b 65 79 76 61 6c 73 20 22 2f 22 29 20 22 20 keyvals "/") "
1a80: 66 6f 72 20 74 68 69 73 20 72 75 6e 22 29 0a 20 for this run").
1a90: 20 20 20 28 69 66 20 28 61 6e 64 20 72 75 6e 6e (if (and runn
1aa0: 61 6d 65 20 28 6e 75 6c 6c 3f 20 28 66 69 6c 74 ame (null? (filt
1ab0: 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e er (lambda (x)(n
1ac0: 6f 74 20 78 29 29 20 6b 65 79 76 61 6c 73 29 29 ot x)) keyvals))
1ad0: 29 20 3b 3b 20 74 68 65 72 65 20 6d 75 73 74 20 ) ;; there must
1ae0: 62 65 20 61 20 62 65 74 74 65 72 20 77 61 79 20 be a better way
1af0: 74 6f 20 22 61 70 70 6c 79 20 61 6e 64 22 0a 09 to "apply and"..
1b00: 28 6c 65 74 20 28 28 72 65 73 20 23 66 29 29 0a (let ((res #f)).
1b10: 09 20 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 . (apply sqlite
1b20: 33 3a 65 78 65 63 75 74 65 20 64 62 20 28 63 6f 3:execute db (co
1b30: 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 49 47 nc "INSERT OR IG
1b40: 4e 4f 52 45 20 49 4e 54 4f 20 72 75 6e 73 20 28 NORE INTO runs (
1b50: 72 75 6e 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 runname,state,st
1b60: 61 74 75 73 2c 6f 77 6e 65 72 2c 65 76 65 6e 74 atus,owner,event
1b70: 5f 74 69 6d 65 22 20 63 6f 6d 6d 61 20 6b 65 79 _time" comma key
1b80: 73 74 72 20 22 29 20 56 41 4c 55 45 53 20 28 3f str ") VALUES (?
1b90: 2c 3f 2c 3f 2c 3f 2c 73 74 72 66 74 69 6d 65 28 ,?,?,?,strftime(
1ba0: 27 25 73 27 2c 27 6e 6f 77 27 29 22 20 63 6f 6d '%s','now')" com
1bb0: 6d 61 20 76 61 6c 73 6c 6f 74 73 20 22 29 3b 22 ma valslots ");"
1bc0: 29 0a 09 09 20 61 6c 6c 76 61 6c 73 29 0a 09 20 )... allvals)..
1bd0: 20 28 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a (apply sqlite3:
1be0: 66 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 09 20 for-each-row ..
1bf0: 20 20 28 6c 61 6d 62 64 61 20 28 69 64 29 0a 09 (lambda (id)..
1c00: 20 20 20 20 20 28 73 65 74 21 20 72 65 73 20 69 (set! res i
1c10: 64 29 29 0a 09 20 20 20 64 62 0a 09 20 20 20 28 d)).. db.. (
1c20: 6c 65 74 20 28 28 71 72 79 20 28 63 6f 6e 63 20 let ((qry (conc
1c30: 22 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 "SELECT id FROM
1c40: 72 75 6e 73 20 57 48 45 52 45 20 28 72 75 6e 6e runs WHERE (runn
1c50: 61 6d 65 3d 3f 20 22 20 61 6e 64 73 74 72 20 6b ame=? " andstr k
1c60: 65 79 3d 3f 73 74 72 20 22 29 3b 22 29 29 29 0a ey=?str ");"))).
1c70: 09 20 20 20 20 20 3b 28 64 65 62 75 67 3a 70 72 . ;(debug:pr
1c80: 69 6e 74 20 34 20 22 71 72 79 3a 20 22 20 71 72 int 4 "qry: " qr
1c90: 79 29 20 0a 09 20 20 20 20 20 71 72 79 29 0a 09 y) .. qry)..
1ca0: 20 20 20 71 72 79 76 61 6c 73 29 0a 09 20 20 28 qryvals).. (
1cb0: 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 sqlite3:execute
1cc0: 64 62 20 22 55 50 44 41 54 45 20 72 75 6e 73 20 db "UPDATE runs
1cd0: 53 45 54 20 73 74 61 74 65 3d 3f 2c 73 74 61 74 SET state=?,stat
1ce0: 75 73 3d 3f 20 57 48 45 52 45 20 69 64 3d 3f 3b us=? WHERE id=?;
1cf0: 22 20 73 74 61 74 65 20 73 74 61 74 75 73 20 72 " state status r
1d00: 65 73 29 0a 09 20 20 72 65 73 29 20 0a 09 28 62 es).. res) ..(b
1d10: 65 67 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 egin.. (debug:p
1d20: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 43 rint 0 "ERROR: C
1d30: 61 6c 6c 65 64 20 77 69 74 68 6f 75 74 20 61 6c alled without al
1d40: 6c 20 6e 65 63 65 73 73 61 72 79 20 6b 65 79 73 l necessary keys
1d50: 22 29 0a 09 20 20 23 66 29 29 29 29 0a 0a 3b 3b ").. #f))))..;;
1d60: 20 54 68 69 73 20 69 73 20 61 20 64 75 70 6c 69 This is a dupli
1d70: 63 61 74 65 20 6f 66 20 72 75 6e 2d 74 65 73 74 cate of run-test
1d80: 73 20 28 77 68 69 63 68 20 68 61 73 20 62 65 65 s (which has bee
1d90: 6e 20 64 65 70 72 65 63 61 74 65 64 29 2e 20 55 n deprecated). U
1da0: 73 65 20 74 68 69 73 20 6f 6e 65 20 69 6e 73 74 se this one inst
1db0: 65 61 64 20 6f 66 20 72 75 6e 20 74 65 73 74 73 ead of run tests
1dc0: 2e 0a 3b 3b 20 6b 65 79 76 61 6c 73 0a 28 64 65 ..;; keyvals.(de
1dd0: 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 fine (runs:run-t
1de0: 65 73 74 73 20 74 61 72 67 65 74 20 72 75 6e 6e ests target runn
1df0: 61 6d 65 20 74 65 73 74 2d 70 61 74 74 73 20 75 ame test-patts u
1e00: 73 65 72 20 66 6c 61 67 73 29 0a 20 20 28 6c 65 ser flags). (le
1e10: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 t* ((db
1e20: 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 #f).. (keys
1e30: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
1e40: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 ose db:get-keys
1e50: 64 62 29 29 0a 09 20 28 6b 65 79 76 61 6c 6c 73 db)).. (keyvalls
1e60: 74 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 74 t (keys:target
1e70: 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 61 ->keyval keys ta
1e80: 72 67 65 74 29 29 0a 09 20 28 72 75 6e 2d 69 64 rget)).. (run-id
1e90: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
1ea0: 63 6c 6f 73 65 20 72 75 6e 73 3a 72 65 67 69 73 close runs:regis
1eb0: 74 65 72 2d 72 75 6e 20 64 62 20 6b 65 79 73 20 ter-run db keys
1ec0: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d keyvallst runnam
1ed0: 65 20 22 6e 65 77 22 20 22 6e 2f 61 22 20 75 73 e "new" "n/a" us
1ee0: 65 72 29 29 20 20 3b 3b 20 20 74 65 73 74 2d 6e er)) ;; test-n
1ef0: 61 6d 65 29 29 29 0a 09 20 28 64 65 66 65 72 72 ame))).. (deferr
1f00: 65 64 20 20 20 20 27 28 29 29 20 3b 3b 20 64 65 ed '()) ;; de
1f10: 6c 61 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 73 lay running thes
1f20: 65 20 73 69 6e 63 65 20 74 68 65 79 20 68 61 76 e since they hav
1f30: 65 20 61 20 77 61 69 74 6f 6e 20 63 6c 61 75 73 e a waiton claus
1f40: 65 0a 09 20 3b 3b 20 6b 65 65 70 67 6f 69 6e 67 e.. ;; keepgoing
1f50: 20 69 73 20 74 68 65 20 64 65 66 61 63 74 6f 20 is the defacto
1f60: 6d 6f 64 61 6c 69 74 79 20 6e 6f 77 2c 20 77 69 modality now, wi
1f70: 6c 6c 20 61 64 64 20 68 69 74 2d 6e 2d 72 75 6e ll add hit-n-run
1f80: 20 61 20 62 69 74 20 6c 61 74 65 72 0a 09 20 3b a bit later.. ;
1f90: 3b 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 28 ; (keepgoing (
1fa0: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
1fb0: 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 6b efault flags "-k
1fc0: 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a 09 eepgoing" #f))..
1fd0: 20 28 74 65 73 74 2d 6e 61 6d 65 73 20 20 27 28 (test-names '(
1fe0: 29 29 0a 09 20 28 72 75 6e 63 6f 6e 66 69 67 66 )).. (runconfigf
1ff0: 20 20 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 61 (conc *toppa
2000: 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 73 th* "/runconfigs
2010: 2e 63 6f 6e 66 69 67 22 29 29 0a 09 20 28 72 65 .config")).. (re
2020: 71 75 69 72 65 64 2d 74 65 73 74 73 20 27 28 29 quired-tests '()
2030: 29 0a 09 20 28 74 65 73 74 2d 72 65 63 6f 72 64 ).. (test-record
2040: 73 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 s (make-hash-tab
2050: 6c 65 29 29 29 0a 0a 20 20 20 20 28 6f 70 65 6e le))).. (open
2060: 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d -run-close set-m
2070: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
2080: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 db run-id) ;; t
2090: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 hese may be need
20a0: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 ed by the launch
20b0: 69 6e 67 20 70 72 6f 63 65 73 73 0a 0a 20 20 20 ing process..
20c0: 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 (if (file-exist
20d0: 73 3f 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 s? runconfigf)..
20e0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
20f0: 73 65 74 75 70 2d 65 6e 76 2d 64 65 66 61 75 6c setup-env-defaul
2100: 74 73 20 64 62 20 72 75 6e 63 6f 6e 66 69 67 66 ts db runconfigf
2110: 20 72 75 6e 2d 69 64 20 2a 61 6c 72 65 61 64 79 run-id *already
2120: 2d 73 65 65 6e 2d 72 75 6e 63 6f 6e 66 69 67 2d -seen-runconfig-
2130: 69 6e 66 6f 2a 20 22 70 72 65 2d 6c 61 75 6e 63 info* "pre-launc
2140: 68 2d 65 6e 76 2d 76 61 72 73 22 29 0a 09 28 64 h-env-vars")..(d
2150: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 41 ebug:print 0 "WA
2160: 52 4e 49 4e 47 3a 20 59 6f 75 20 64 6f 20 6e 6f RNING: You do no
2170: 74 20 68 61 76 65 20 61 20 72 75 6e 20 63 6f 6e t have a run con
2180: 66 69 67 20 66 69 6c 65 3a 20 22 20 72 75 6e 63 fig file: " runc
2190: 6f 6e 66 69 67 66 29 29 0a 20 20 20 20 0a 20 20 onfigf)). .
21a0: 20 20 3b 3b 20 6c 6f 6f 6b 20 75 70 20 61 6c 6c ;; look up all
21b0: 20 74 65 73 74 73 20 6d 61 74 63 68 69 6e 67 20 tests matching
21c0: 74 68 65 20 63 6f 6d 6d 61 20 73 65 70 61 72 61 the comma separa
21d0: 74 65 64 20 6c 69 73 74 20 6f 66 20 67 6c 6f 62 ted list of glob
21e0: 73 20 69 6e 0a 20 20 20 20 3b 3b 20 74 65 73 74 s in. ;; test
21f0: 2d 70 61 74 74 73 20 28 75 73 69 6e 67 20 25 20 -patts (using %
2200: 61 73 20 77 69 6c 64 63 61 72 64 29 0a 20 20 20 as wildcard).
2210: 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 (for-each .
2220: 20 28 6c 61 6d 62 64 61 20 28 70 61 74 74 29 0a (lambda (patt).
2230: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 (let ((te
2240: 73 74 73 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 sts (glob (conc
2250: 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 74 *toppath* "/test
2260: 73 2f 22 20 28 73 74 72 69 6e 67 2d 74 72 61 6e s/" (string-tran
2270: 73 6c 61 74 65 20 70 61 74 74 20 22 25 22 20 22 slate patt "%" "
2280: 2a 22 29 29 29 29 29 0a 09 20 28 73 65 74 21 20 *"))))).. (set!
2290: 74 65 73 74 73 20 28 66 69 6c 74 65 72 20 28 6c tests (filter (l
22a0: 61 6d 62 64 61 20 28 74 65 73 74 29 28 66 69 6c ambda (test)(fil
22b0: 65 2d 65 78 69 73 74 73 3f 20 28 63 6f 6e 63 20 e-exists? (conc
22c0: 74 65 73 74 20 22 2f 74 65 73 74 63 6f 6e 66 69 test "/testconfi
22d0: 67 22 29 29 29 20 74 65 73 74 73 29 29 0a 09 20 g"))) tests))..
22e0: 28 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 (set! test-names
22f0: 20 28 61 70 70 65 6e 64 20 74 65 73 74 2d 6e 61 (append test-na
2300: 6d 65 73 20 0a 09 09 09 09 20 20 28 6d 61 70 20 mes ..... (map
2310: 28 6c 61 6d 62 64 61 20 28 74 65 73 74 70 29 0a (lambda (testp).
2320: 09 09 09 09 09 20 28 6c 61 73 74 20 28 73 74 72 ..... (last (str
2330: 69 6e 67 2d 73 70 6c 69 74 20 74 65 73 74 70 20 ing-split testp
2340: 22 2f 22 29 29 29 0a 09 09 09 09 20 20 20 20 20 "/"))).....
2350: 20 20 74 65 73 74 73 29 29 29 29 29 0a 20 20 20 tests))))).
2360: 20 20 28 69 66 20 74 65 73 74 2d 70 61 74 74 73 (if test-patts
2370: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 74 (string-split t
2380: 65 73 74 2d 70 61 74 74 73 20 22 2c 22 29 28 6c est-patts ",")(l
2390: 69 73 74 20 22 25 22 29 29 29 0a 0a 20 20 20 20 ist "%")))..
23a0: 20 3b 3b 20 6e 6f 77 20 72 65 6d 6f 76 65 20 64 ;; now remove d
23b0: 75 70 6c 69 63 61 74 65 73 0a 20 20 20 20 28 73 uplicates. (s
23c0: 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 et! test-names (
23d0: 64 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 delete-duplicate
23e0: 73 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 0a s test-names))..
23f0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
2400: 20 30 20 22 49 4e 46 4f 3a 20 74 65 73 74 20 6e 0 "INFO: test n
2410: 61 6d 65 73 20 22 20 74 65 73 74 2d 6e 61 6d 65 ames " test-name
2420: 73 29 0a 0a 20 20 20 20 3b 3b 20 6f 6e 20 74 68 s).. ;; on th
2430: 65 20 66 69 72 73 74 20 70 61 73 73 20 6f 72 20 e first pass or
2440: 63 61 6c 6c 20 74 6f 20 72 75 6e 2d 74 65 73 74 call to run-test
2450: 73 20 73 65 74 20 46 41 49 4c 53 20 74 6f 20 4e s set FAILS to N
2460: 4f 54 5f 53 54 41 52 54 45 44 20 69 66 0a 20 20 OT_STARTED if.
2470: 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 20 ;; -keepgoing
2480: 69 73 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 is specified.
2490: 20 28 69 66 20 28 65 71 3f 20 2a 70 61 73 73 6e (if (eq? *passn
24a0: 75 6d 2a 20 30 29 0a 09 28 62 65 67 69 6e 0a 09 um* 0)..(begin..
24b0: 20 20 3b 3b 20 68 61 76 65 20 74 6f 20 64 65 6c ;; have to del
24c0: 65 74 65 20 74 65 73 74 20 72 65 63 6f 72 64 73 ete test records
24d0: 20 77 68 65 72 65 20 4e 4f 54 5f 53 54 41 52 54 where NOT_START
24e0: 45 44 20 73 69 6e 63 65 20 74 68 65 79 20 63 61 ED since they ca
24f0: 6e 20 63 61 75 73 65 20 2d 6b 65 65 70 67 6f 69 n cause -keepgoi
2500: 6e 67 20 74 6f 20 0a 09 20 20 3b 3b 20 67 65 74 ng to .. ;; get
2510: 20 73 74 75 63 6b 20 64 75 65 20 74 6f 20 62 65 stuck due to be
2520: 63 6f 6d 69 6e 67 20 69 6e 61 63 63 65 73 73 69 coming inaccessi
2530: 62 6c 65 20 66 72 6f 6d 20 61 20 66 61 69 6c 65 ble from a faile
2540: 64 20 74 65 73 74 2e 20 49 2e 65 2e 20 69 66 20 d test. I.e. if
2550: 74 65 73 74 20 42 20 64 65 70 65 6e 64 73 20 0a test B depends .
2560: 09 20 20 3b 3b 20 6f 6e 20 74 65 73 74 20 41 20 . ;; on test A
2570: 62 75 74 20 74 65 73 74 20 42 20 72 65 61 63 68 but test B reach
2580: 65 64 20 74 68 65 20 70 6f 69 6e 74 20 6f 6e 20 ed the point on
2590: 62 65 69 6e 67 20 72 65 67 69 73 74 65 72 65 64 being registered
25a0: 20 61 73 20 4e 4f 54 5f 53 54 41 52 54 45 44 20 as NOT_STARTED
25b0: 61 6e 64 20 74 65 73 74 0a 09 20 20 3b 3b 20 41 and test.. ;; A
25c0: 20 66 61 69 6c 65 64 20 66 6f 72 20 73 6f 6d 65 failed for some
25d0: 20 72 65 61 73 6f 6e 20 74 68 65 6e 20 6f 6e 20 reason then on
25e0: 72 65 2d 72 75 6e 20 75 73 69 6e 67 20 2d 6b 65 re-run using -ke
25f0: 65 70 67 6f 69 6e 67 20 74 68 65 20 72 75 6e 20 epgoing the run
2600: 63 61 6e 20 6e 65 76 65 72 20 63 6f 6d 70 6c 65 can never comple
2610: 74 65 2e 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e te... (open-run
2620: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 -close db:delete
2630: 2d 74 65 73 74 73 2d 69 6e 2d 73 74 61 74 65 20 -tests-in-state
2640: 64 62 20 72 75 6e 2d 69 64 20 22 4e 4f 54 5f 53 db run-id "NOT_S
2650: 54 41 52 54 45 44 22 29 0a 09 20 20 28 6f 70 65 TARTED").. (ope
2660: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 n-run-close db:s
2670: 65 74 2d 74 65 73 74 73 2d 73 74 61 74 65 2d 73 et-tests-state-s
2680: 74 61 74 75 73 20 64 62 20 72 75 6e 2d 69 64 20 tatus db run-id
2690: 74 65 73 74 2d 6e 61 6d 65 73 20 23 66 20 22 46 test-names #f "F
26a0: 41 49 4c 22 20 22 4e 4f 54 5f 53 54 41 52 54 45 AIL" "NOT_STARTE
26b0: 44 22 20 22 46 41 49 4c 22 29 29 29 0a 0a 20 20 D" "FAIL")))..
26c0: 20 20 3b 3b 20 66 72 6f 6d 20 68 65 72 65 20 6f ;; from here o
26d0: 6e 20 6f 75 74 20 74 68 65 20 64 62 20 77 69 6c n out the db wil
26e0: 6c 20 62 65 20 6f 70 65 6e 65 64 20 61 6e 64 20 l be opened and
26f0: 63 6c 6f 73 65 64 20 6f 6e 20 65 76 65 72 79 20 closed on every
2700: 63 61 6c 6c 20 72 75 6e 73 3a 72 75 6e 2d 74 65 call runs:run-te
2710: 73 74 73 2d 71 75 65 75 65 0a 20 20 20 20 3b 3b sts-queue. ;;
2720: 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 (sqlite3:finali
2730: 7a 65 21 20 64 62 29 20 0a 20 20 20 20 3b 3b 20 ze! db) . ;;
2740: 6e 6f 77 20 61 64 64 20 6e 6f 6e 2d 64 69 72 65 now add non-dire
2750: 63 74 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 ctly referenced
2760: 64 65 70 65 6e 64 65 6e 63 69 65 73 20 28 69 2e dependencies (i.
2770: 65 2e 20 77 61 69 74 6f 6e 29 0a 20 20 20 20 28 e. waiton). (
2780: 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 if (not (null? t
2790: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 est-names))..(le
27a0: 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 28 63 61 t loop ((hed (ca
27b0: 72 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 r test-names))..
27c0: 09 20 20 20 28 74 61 6c 20 28 63 64 72 20 74 65 . (tal (cdr te
27d0: 73 74 2d 6e 61 6d 65 73 29 29 29 20 20 20 20 20 st-names)))
27e0: 20 20 20 20 3b 3b 20 27 72 65 74 75 72 6e 2d 70 ;; 'return-p
27f0: 72 6f 63 73 20 74 65 6c 6c 73 20 74 68 65 20 63 rocs tells the c
2800: 6f 6e 66 69 67 20 72 65 61 64 65 72 20 74 6f 20 onfig reader to
2810: 70 72 65 70 20 72 75 6e 6e 69 6e 67 20 73 79 73 prep running sys
2820: 74 65 6d 20 62 75 74 20 72 65 74 75 72 6e 20 61 tem but return a
2830: 20 70 72 6f 63 0a 09 20 20 28 64 65 62 75 67 3a proc.. (debug:
2840: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 68 print 4 "INFO: h
2850: 65 64 3d 22 20 68 65 64 20 22 20 61 74 20 74 6f ed=" hed " at to
2860: 70 20 6f 66 20 6c 6f 6f 70 22 29 0a 09 20 20 28 p of loop").. (
2870: 6c 65 74 2a 20 28 28 63 6f 6e 66 69 67 20 20 28 let* ((config (
2880: 74 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f tests:get-testco
2890: 6e 66 69 67 20 68 65 64 20 27 72 65 74 75 72 6e nfig hed 'return
28a0: 2d 70 72 6f 63 73 29 29 0a 09 09 20 28 77 61 69 -procs))... (wai
28b0: 74 6f 6e 73 20 28 69 66 20 63 6f 6e 66 69 67 20 tons (if config
28c0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 28 6c (string-split (l
28d0: 65 74 20 28 28 77 20 28 63 6f 6e 66 69 67 2d 6c et ((w (config-l
28e0: 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 22 72 65 ookup config "re
28f0: 71 75 69 72 65 6d 65 6e 74 73 22 20 22 77 61 69 quirements" "wai
2900: 74 6f 6e 22 29 29 29 0a 09 09 09 09 09 09 20 20 ton"))).......
2910: 20 20 20 28 69 66 20 77 20 77 20 22 22 29 29 29 (if w w "")))
2920: 0a 09 09 09 20 20 20 20 20 20 28 62 65 67 69 6e .... (begin
2930: 0a 09 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e .....(debug:prin
2940: 74 20 30 20 22 45 52 52 4f 52 3a 20 6e 6f 6e 2d t 0 "ERROR: non-
2950: 65 78 69 73 74 65 6e 74 20 72 65 71 75 69 72 65 existent require
2960: 64 20 74 65 73 74 20 5c 22 22 20 68 65 64 20 22 d test \"" hed "
2970: 5c 22 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 \"").
2980: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2990: 20 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c (if db (sql
29a0: 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 ite3:finalize! d
29b0: 62 29 29 0a 09 09 09 09 28 65 78 69 74 20 31 29 b)).....(exit 1)
29c0: 29 29 29 29 0a 09 20 20 20 20 3b 3b 20 63 68 65 )))).. ;; che
29d0: 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 61 ck for hed in wa
29e0: 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 6f itons => this wo
29f0: 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 2c uld be circular,
2a00: 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 69 remove it and i
2a10: 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b 20 ssue an.. ;;
2a20: 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 28 error.. (if (
2a30: 6d 65 6d 62 65 72 20 68 65 64 20 77 61 69 74 6f member hed waito
2a40: 6e 73 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 ns)...(begin...
2a50: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 (debug:print 0
2a60: 22 45 52 52 4f 52 3a 20 74 65 73 74 20 22 20 68 "ERROR: test " h
2a70: 65 64 20 22 20 68 61 73 20 6c 69 73 74 65 64 20 ed " has listed
2a80: 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 69 74 itself as a wait
2a90: 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 72 65 on, please corre
2aa0: 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 20 28 ct this!")... (
2ab0: 73 65 74 21 20 77 61 69 74 6f 6e 73 20 28 66 69 set! waitons (fi
2ac0: 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 lter (lambda (x)
2ad0: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 68 (not (equal? x h
2ae0: 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 29 ed))) waitons)))
2af0: 29 0a 09 20 20 20 20 0a 09 20 20 20 20 3b 3b 20 ).. .. ;;
2b00: 28 69 74 65 6d 73 20 20 20 28 69 74 65 6d 73 3a (items (items:
2b10: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 get-items-from-c
2b20: 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 29 0a onfig config))).
2b30: 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 . (if (not (h
2b40: 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 ash-table-ref/de
2b50: 66 61 75 6c 74 20 74 65 73 74 2d 72 65 63 6f 72 fault test-recor
2b60: 64 73 20 68 65 64 20 23 66 29 29 0a 09 09 28 68 ds hed #f))...(h
2b70: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 ash-table-set! t
2b80: 65 73 74 2d 72 65 63 6f 72 64 73 0a 09 09 09 09 est-records.....
2b90: 20 68 65 64 20 28 76 65 63 74 6f 72 20 68 65 64 hed (vector hed
2ba0: 20 20 20 20 20 3b 3b 20 30 0a 09 09 09 09 09 20 ;; 0......
2bb0: 20 20 20 20 63 6f 6e 66 69 67 20 20 3b 3b 20 31 config ;; 1
2bc0: 0a 09 09 09 09 09 20 20 20 20 20 77 61 69 74 6f ...... waito
2bd0: 6e 73 20 3b 3b 20 32 0a 09 09 09 09 09 20 20 20 ns ;; 2......
2be0: 20 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 (config-lookup
2bf0: 20 63 6f 6e 66 69 67 20 22 72 65 71 75 69 72 65 config "require
2c00: 6d 65 6e 74 73 22 20 22 70 72 69 6f 72 69 74 79 ments" "priority
2c10: 22 29 20 20 20 20 20 3b 3b 20 70 72 69 6f 72 69 ") ;; priori
2c20: 74 79 20 33 0a 09 09 09 09 09 20 20 20 20 20 28 ty 3...... (
2c30: 6c 65 74 20 28 28 69 74 65 6d 73 20 20 20 20 20 let ((items
2c40: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
2c50: 2f 64 65 66 61 75 6c 74 20 63 6f 6e 66 69 67 20 /default config
2c60: 22 69 74 65 6d 73 22 20 23 66 29 29 20 3b 3b 20 "items" #f)) ;;
2c70: 69 74 65 6d 73 20 34 0a 09 09 09 09 09 09 20 20 items 4.......
2c80: 20 28 69 74 65 6d 73 74 61 62 6c 65 20 28 68 61 (itemstable (ha
2c90: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
2ca0: 61 75 6c 74 20 63 6f 6e 66 69 67 20 22 69 74 65 ault config "ite
2cb0: 6d 73 74 61 62 6c 65 22 20 23 66 29 29 29 20 0a mstable" #f))) .
2cc0: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 ..... ;; i
2cd0: 66 20 65 69 74 68 65 72 20 69 74 65 6d 73 20 6f f either items o
2ce0: 72 20 69 74 65 6d 73 20 74 61 62 6c 65 20 69 73 r items table is
2cf0: 20 61 20 70 72 6f 63 20 72 65 74 75 72 6e 20 69 a proc return i
2d00: 74 20 73 6f 20 74 65 73 74 20 72 75 6e 6e 69 6e t so test runnin
2d10: 67 0a 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b g...... ;;
2d20: 20 70 72 6f 63 65 73 73 20 63 61 6e 20 6b 6e 6f process can kno
2d30: 77 20 74 6f 20 63 61 6c 6c 20 69 74 65 6d 73 3a w to call items:
2d40: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 get-items-from-c
2d50: 6f 6e 66 69 67 0a 09 09 09 09 09 20 20 20 20 20 onfig......
2d60: 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 20 69 ;; if either i
2d70: 73 20 61 20 6c 69 73 74 20 61 6e 64 20 6e 6f 6e s a list and non
2d80: 65 20 69 73 20 61 20 70 72 6f 63 20 67 6f 20 61 e is a proc go a
2d90: 68 65 61 64 20 61 6e 64 20 63 61 6c 6c 20 67 65 head and call ge
2da0: 74 2d 69 74 65 6d 73 0a 09 09 09 09 09 20 20 20 t-items......
2db0: 20 20 20 20 3b 3b 20 6f 74 68 65 72 77 69 73 65 ;; otherwise
2dc0: 20 72 65 74 75 72 6e 20 23 66 20 2d 20 74 68 69 return #f - thi
2dd0: 73 20 69 73 20 6e 6f 74 20 61 6e 20 69 74 65 72 s is not an iter
2de0: 61 74 65 64 20 74 65 73 74 0a 09 09 09 09 09 20 ated test......
2df0: 20 20 20 20 20 20 28 63 6f 6e 64 0a 09 09 09 09 (cond.....
2e00: 09 09 28 28 70 72 6f 63 65 64 75 72 65 3f 20 69 ..((procedure? i
2e10: 74 65 6d 73 29 20 20 20 20 20 20 0a 09 09 09 09 tems) .....
2e20: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
2e30: 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 69 4 "INFO: items i
2e40: 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 s a procedure, w
2e50: 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 ill calc later")
2e60: 0a 09 09 09 09 09 09 20 69 74 65 6d 73 29 20 20 ....... items)
2e70: 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c ;; cal
2e80: 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 c later.......((
2e90: 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 procedure? items
2ea0: 74 61 62 6c 65 29 0a 09 09 09 09 09 09 20 28 64 table)....... (d
2eb0: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e ebug:print 4 "IN
2ec0: 46 4f 3a 20 69 74 65 6d 73 74 61 62 6c 65 20 69 FO: itemstable i
2ed0: 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 s a procedure, w
2ee0: 69 6c 6c 20 63 61 6c 63 20 6c 61 74 65 72 22 29 ill calc later")
2ef0: 0a 09 09 09 09 09 09 20 69 74 65 6d 73 74 61 62 ....... itemstab
2f00: 6c 65 29 20 20 20 20 20 20 20 3b 3b 20 63 61 6c le) ;; cal
2f10: 63 20 6c 61 74 65 72 0a 09 09 09 09 09 09 28 28 c later.......((
2f20: 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 filter (lambda (
2f30: 78 29 0a 09 09 09 09 09 09 09 20 20 20 28 6c 65 x)........ (le
2f40: 74 20 28 28 76 61 6c 20 28 63 61 72 20 78 29 29 t ((val (car x))
2f50: 29 0a 09 09 09 09 09 09 09 20 20 20 20 20 28 69 )........ (i
2f60: 66 20 28 70 72 6f 63 65 64 75 72 65 3f 20 76 61 f (procedure? va
2f70: 6c 29 20 76 61 6c 20 23 66 29 29 29 0a 09 09 09 l) val #f)))....
2f80: 09 09 09 09 20 28 61 70 70 65 6e 64 20 28 69 66 .... (append (if
2f90: 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 (list? items) i
2fa0: 74 65 6d 73 20 27 28 29 29 0a 09 09 09 09 09 09 tems '()).......
2fb0: 09 09 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 .. (if (list? it
2fc0: 65 6d 73 74 61 62 6c 65 29 20 69 74 65 6d 73 74 emstable) itemst
2fd0: 61 62 6c 65 20 27 28 29 29 29 29 0a 09 09 09 09 able '()))).....
2fe0: 09 09 20 27 68 61 76 65 2d 70 72 6f 63 65 64 75 .. 'have-procedu
2ff0: 72 65 29 0a 09 09 09 09 09 09 28 28 6f 72 20 28 re).......((or (
3000: 6c 69 73 74 3f 20 69 74 65 6d 73 29 28 6c 69 73 list? items)(lis
3010: 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 29 20 t? itemstable))
3020: 3b 3b 20 63 61 6c 63 20 6e 6f 77 0a 09 09 09 09 ;; calc now.....
3030: 09 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 .. (debug:print
3040: 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d 73 20 61 4 "INFO: items a
3050: 6e 64 20 69 74 65 6d 73 74 61 62 6c 65 20 61 72 nd itemstable ar
3060: 65 20 6c 69 73 74 73 2c 20 63 61 6c 63 20 6e 6f e lists, calc no
3070: 77 5c 6e 22 0a 09 09 09 09 09 09 09 20 20 20 20 w\n"........
3080: 20 20 22 20 20 20 20 69 74 65 6d 73 3a 20 22 20 " items: "
3090: 69 74 65 6d 73 20 22 20 69 74 65 6d 73 74 61 62 items " itemstab
30a0: 6c 65 3a 20 22 20 69 74 65 6d 73 74 61 62 6c 65 le: " itemstable
30b0: 29 0a 09 09 09 09 09 09 20 28 69 74 65 6d 73 3a )....... (items:
30c0: 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 get-items-from-c
30d0: 6f 6e 66 69 67 20 63 6f 6e 66 69 67 29 29 0a 09 onfig config))..
30e0: 09 09 09 09 09 28 65 6c 73 65 20 23 66 29 29 29 .....(else #f)))
30f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3100: 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 6e 6f ;; no
3110: 74 20 69 74 65 72 61 74 65 64 0a 09 09 09 09 09 t iterated......
3120: 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 #f ;;
3130: 69 74 65 6d 73 64 61 74 20 35 0a 09 09 09 09 09 itemsdat 5......
3140: 20 20 20 20 20 23 66 20 20 20 20 20 20 3b 3b 20 #f ;;
3150: 73 70 61 72 65 20 2d 20 75 73 65 64 20 66 6f 72 spare - used for
3160: 20 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 09 09 item-path......
3170: 20 20 20 20 20 29 29 29 0a 09 20 20 20 20 28 66 ))).. (f
3180: 6f 72 2d 65 61 63 68 20 0a 09 20 20 20 20 20 28 or-each .. (
3190: 6c 61 6d 62 64 61 20 28 77 61 69 74 6f 6e 29 0a lambda (waiton).
31a0: 09 20 20 20 20 20 20 20 28 69 66 20 28 61 6e 64 . (if (and
31b0: 20 77 61 69 74 6f 6e 20 28 6e 6f 74 20 28 6d 65 waiton (not (me
31c0: 6d 62 65 72 20 77 61 69 74 6f 6e 20 74 65 73 74 mber waiton test
31d0: 2d 6e 61 6d 65 73 29 29 29 0a 09 09 20 20 20 28 -names)))... (
31e0: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 73 65 begin... (se
31f0: 74 21 20 72 65 71 75 69 72 65 64 2d 74 65 73 74 t! required-test
3200: 73 20 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 72 s (cons waiton r
3210: 65 71 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a equired-tests)).
3220: 09 09 20 20 20 20 20 28 73 65 74 21 20 74 65 73 .. (set! tes
3230: 74 2d 6e 61 6d 65 73 20 28 63 6f 6e 73 20 77 61 t-names (cons wa
3240: 69 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 iton test-names)
3250: 29 29 29 29 20 3b 3b 20 77 61 73 20 61 6e 20 61 )))) ;; was an a
3260: 70 70 65 6e 64 2c 20 6e 6f 77 20 61 20 63 6f 6e ppend, now a con
3270: 73 0a 09 20 20 20 20 20 77 61 69 74 6f 6e 73 29 s.. waitons)
3280: 0a 09 20 20 20 20 28 6c 65 74 20 28 28 72 65 6d .. (let ((rem
3290: 74 65 73 74 73 20 28 64 65 6c 65 74 65 2d 64 75 tests (delete-du
32a0: 70 6c 69 63 61 74 65 73 20 28 61 70 70 65 6e 64 plicates (append
32b0: 20 77 61 69 74 6f 6e 73 20 74 61 6c 29 29 29 29 waitons tal))))
32c0: 0a 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 .. (if (not
32d0: 20 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 (null? remtests
32e0: 29 29 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 ))... (loop (ca
32f0: 72 20 72 65 6d 74 65 73 74 73 29 28 63 64 72 20 r remtests)(cdr
3300: 72 65 6d 74 65 73 74 73 29 29 29 29 29 29 29 0a remtests))))))).
3310: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e . (if (not (n
3320: 75 6c 6c 3f 20 72 65 71 75 69 72 65 64 2d 74 65 ull? required-te
3330: 73 74 73 29 29 0a 09 28 64 65 62 75 67 3a 70 72 sts))..(debug:pr
3340: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 64 64 int 1 "INFO: Add
3350: 69 6e 67 20 22 20 72 65 71 75 69 72 65 64 2d 74 ing " required-t
3360: 65 73 74 73 20 22 20 74 6f 20 74 68 65 20 72 75 ests " to the ru
3370: 6e 20 71 75 65 75 65 22 29 29 0a 20 20 20 20 3b n queue")). ;
3380: 3b 20 4e 4f 54 45 3a 20 74 68 65 73 65 20 61 72 ; NOTE: these ar
3390: 65 20 61 6c 6c 20 70 61 72 65 6e 74 20 74 65 73 e all parent tes
33a0: 74 73 2c 20 69 74 65 6d 73 20 61 72 65 20 6e 6f ts, items are no
33b0: 74 20 65 78 70 61 6e 64 65 64 20 79 65 74 2e 0a t expanded yet..
33c0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
33d0: 20 34 20 22 49 4e 46 4f 3a 20 74 65 73 74 2d 72 4 "INFO: test-r
33e0: 65 63 6f 72 64 73 3d 22 20 28 68 61 73 68 2d 74 ecords=" (hash-t
33f0: 61 62 6c 65 2d 3e 61 6c 69 73 74 20 74 65 73 74 able->alist test
3400: 2d 72 65 63 6f 72 64 73 29 29 0a 20 20 20 20 28 -records)). (
3410: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 runs:run-tests-q
3420: 75 65 75 65 20 72 75 6e 2d 69 64 20 72 75 6e 6e ueue run-id runn
3430: 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 64 73 ame test-records
3440: 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c 61 67 73 keyvallst flags
3450: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 ). (debug:pri
3460: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 6c 6c 20 nt 4 "INFO: All
3470: 64 6f 6e 65 20 62 79 20 68 65 72 65 22 29 29 29 done by here")))
3480: 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
3490: 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 calc-fails prere
34a0: 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 qs-not-met). (f
34b0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 74 ilter (lambda (t
34c0: 65 73 74 29 0a 09 20 20 20 20 28 61 6e 64 20 28 est).. (and (
34d0: 76 65 63 74 6f 72 3f 20 74 65 73 74 29 20 3b 3b vector? test) ;;
34e0: 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f 20 74 65 not (string? te
34f0: 73 74 29 29 0a 09 09 20 28 65 71 75 61 6c 3f 20 st))... (equal?
3500: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 (db:test-get-sta
3510: 74 65 20 74 65 73 74 29 20 22 43 4f 4d 50 4c 45 te test) "COMPLE
3520: 54 45 44 22 29 0a 09 09 20 28 6e 6f 74 20 28 6d TED")... (not (m
3530: 65 6d 62 65 72 20 28 64 62 3a 74 65 73 74 2d 67 ember (db:test-g
3540: 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 29 0a et-status test).
3550: 09 09 09 20 20 20 20 20 20 27 28 22 50 41 53 53 ... '("PASS
3560: 22 20 22 57 41 52 4e 22 20 22 43 48 45 43 4b 22 " "WARN" "CHECK"
3570: 20 22 57 41 49 56 45 44 22 29 29 29 29 29 0a 09 "WAIVED")))))..
3580: 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 prereqs-not-me
3590: 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 t))..(define (ru
35a0: 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 ns:calc-not-comp
35b0: 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f leted prereqs-no
35c0: 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c 74 65 72 t-met). (filter
35d0: 0a 20 20 20 28 6c 61 6d 62 64 61 20 28 74 29 0a . (lambda (t).
35e0: 20 20 20 20 20 28 6f 72 20 28 6e 6f 74 20 28 76 (or (not (v
35f0: 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 28 6e 6f ector? t)).. (no
3600: 74 20 28 65 71 75 61 6c 3f 20 22 43 4f 4d 50 4c t (equal? "COMPL
3610: 45 54 45 44 22 20 28 64 62 3a 74 65 73 74 2d 67 ETED" (db:test-g
3620: 65 74 2d 73 74 61 74 65 20 74 29 29 29 29 29 0a et-state t))))).
3630: 20 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d prereqs-not-m
3640: 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 et))..(define (r
3650: 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 72 69 6e uns:pretty-strin
3660: 67 20 6c 73 74 29 0a 20 20 28 6d 61 70 20 28 6c g lst). (map (l
3670: 61 6d 62 64 61 20 28 74 29 0a 09 20 28 69 66 20 ambda (t).. (if
3680: 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f 20 74 29 (not (vector? t)
3690: 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 74 29 ).. (conc t)
36a0: 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 28 64 62 .. (conc (db
36b0: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
36c0: 6d 65 20 74 29 20 22 3a 22 20 28 64 62 3a 74 65 me t) ":" (db:te
36d0: 73 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 st-get-state t)
36e0: 22 2f 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 "/" (db:test-get
36f0: 2d 73 74 61 74 75 73 20 74 29 29 29 29 0a 20 20 -status t)))).
3700: 20 20 20 20 20 6c 73 74 29 29 0a 0a 28 64 65 66 lst))..(def
3710: 69 6e 65 20 28 72 75 6e 73 3a 6d 61 6b 65 2d 66 ine (runs:make-f
3720: 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 74 65 ull-test-name te
3730: 73 74 6e 61 6d 65 20 69 74 65 6d 70 61 74 68 29 stname itempath)
3740: 0a 20 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 . (if (equal? i
3750: 74 65 6d 70 61 74 68 20 22 22 29 20 74 65 73 74 tempath "") test
3760: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e name (conc testn
3770: 61 6d 65 20 22 2f 22 20 69 74 65 6d 70 61 74 68 ame "/" itempath
3780: 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d 72 65 63 )))..;; test-rec
3790: 6f 72 64 73 20 69 73 20 61 20 68 61 73 68 20 74 ords is a hash t
37a0: 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 3a 69 74 able testname:it
37b0: 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 63 74 6f em_path => vecto
37c0: 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 74 65 73 r < testname tes
37d0: 74 63 6f 6e 66 69 67 20 77 61 69 74 6f 6e 73 20 tconfig waitons
37e0: 70 72 69 6f 72 69 74 79 20 69 74 65 6d 73 2d 69 priority items-i
37f0: 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 66 69 6e nfo ... >.(defin
3800: 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 e (runs:run-test
3810: 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 64 20 72 s-queue run-id r
3820: 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f unname test-reco
3830: 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 20 66 6c rds keyvallst fl
3840: 61 67 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 ags). ;; At t
3850: 68 69 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 his point the li
3860: 73 74 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 st of parent tes
3870: 74 73 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a ts is expanded .
3880: 20 20 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 ;; NB// Shou
3890: 6c 64 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 ld expand items
38a0: 68 65 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e here and then in
38b0: 73 65 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 sert into the ru
38c0: 6e 20 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 n queue.. (debu
38d0: 67 3a 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d g:print 5 "test-
38e0: 72 65 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d records: " test-
38f0: 72 65 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 records ", keyva
3900: 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 llst: " keyvalls
3910: 74 20 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 t " flags: " (ha
3920: 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 sh-table->alist
3930: 66 6c 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 flags)). (let (
3940: 28 73 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d (sorted-test-nam
3950: 65 73 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 es (tests:sort-b
3960: 79 2d 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 y-priority-and-w
3970: 61 69 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 aiton test-recor
3980: 64 73 29 29 0a 09 28 69 74 65 6d 2d 70 61 74 74 ds))..(item-patt
3990: 73 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 s (hash-t
39a0: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
39b0: 20 66 6c 61 67 73 20 22 2d 69 74 65 6d 70 61 74 flags "-itempat
39c0: 74 22 20 23 66 29 29 0a 09 28 74 65 73 74 2d 72 t" #f))..(test-r
39d0: 65 67 69 73 74 65 72 79 20 20 20 20 28 6d 61 6b egistery (mak
39e0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 0a 09 e-hash-table))..
39f0: 28 6e 75 6d 2d 72 65 74 72 69 65 73 20 20 20 20 (num-retries
3a00: 20 20 20 20 30 29 0a 09 28 6d 61 78 2d 72 65 74 0)..(max-ret
3a10: 72 69 65 73 20 20 20 20 20 20 20 28 63 6f 6e 66 ries (conf
3a20: 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 6f 6e 66 69 ig-lookup *confi
3a30: 67 64 61 74 2a 20 22 73 65 74 75 70 22 20 22 6d gdat* "setup" "m
3a40: 61 78 72 65 74 72 69 65 73 22 29 29 29 0a 20 20 axretries"))).
3a50: 20 20 28 73 65 74 21 20 6d 61 78 2d 72 65 74 72 (set! max-retr
3a60: 69 65 73 20 28 69 66 20 28 61 6e 64 20 6d 61 78 ies (if (and max
3a70: 2d 72 65 74 72 69 65 73 20 28 73 74 72 69 6e 67 -retries (string
3a80: 2d 3e 6e 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 ->number max-ret
3a90: 72 69 65 73 29 29 28 73 74 72 69 6e 67 2d 3e 6e ries))(string->n
3aa0: 75 6d 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 umber max-retrie
3ab0: 73 29 20 31 30 30 29 29 0a 20 20 20 20 28 69 66 s) 100)). (if
3ac0: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 73 6f 72 (not (null? sor
3ad0: 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 ted-test-names))
3ae0: 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65 ..(let loop ((he
3af0: 64 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73 d (car s
3b00: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 orted-test-names
3b10: 29 29 0a 09 09 20 20 20 28 74 61 6c 20 20 20 20 ))... (tal
3b20: 20 20 20 20 20 28 63 64 72 20 73 6f 72 74 65 64 (cdr sorted
3b30: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 -test-names))...
3b40: 20 20 20 28 72 65 72 75 6e 73 20 20 20 20 20 20 (reruns
3b50: 27 28 29 29 29 0a 09 20 20 28 69 66 20 28 6e 6f '())).. (if (no
3b60: 74 20 28 6e 75 6c 6c 3f 20 72 65 72 75 6e 73 29 t (null? reruns)
3b70: 29 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 )(debug:print 4
3b80: 22 49 4e 46 4f 3a 20 72 65 72 75 6e 73 3d 22 20 "INFO: reruns="
3b90: 72 65 72 75 6e 73 29 29 0a 09 20 20 3b 3b 20 28 reruns)).. ;; (
3ba0: 70 72 69 6e 74 20 22 54 6f 70 20 6f 66 20 6c 6f print "Top of lo
3bb0: 6f 70 2c 20 68 65 64 3d 22 20 68 65 64 20 22 2c op, hed=" hed ",
3bc0: 20 74 61 6c 3d 22 20 74 61 6c 20 22 20 2c 72 65 tal=" tal " ,re
3bd0: 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 29 0a 09 runs=" reruns)..
3be0: 20 20 28 6c 65 74 2a 20 28 28 74 65 73 74 2d 72 (let* ((test-r
3bf0: 65 63 6f 72 64 20 28 68 61 73 68 2d 74 61 62 6c ecord (hash-tabl
3c00: 65 2d 72 65 66 20 74 65 73 74 2d 72 65 63 6f 72 e-ref test-recor
3c10: 64 73 20 68 65 64 29 29 0a 09 09 20 28 74 65 73 ds hed))... (tes
3c20: 74 2d 6e 61 6d 65 20 20 20 28 74 65 73 74 73 3a t-name (tests:
3c30: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
3c40: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f stname test-reco
3c50: 72 64 29 29 0a 09 09 20 28 74 63 6f 6e 66 69 67 rd))... (tconfig
3c60: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 (tests:test
3c70: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f queue-get-testco
3c80: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 nfig test-record
3c90: 29 29 0a 09 09 20 28 74 65 73 74 6d 6f 64 65 20 ))... (testmode
3ca0: 20 20 20 28 6c 65 74 20 28 28 6d 20 28 63 6f 6e (let ((m (con
3cb0: 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f 6e 66 fig-lookup tconf
3cc0: 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e 74 73 ig "requirements
3cd0: 22 20 22 6d 6f 64 65 22 29 29 29 0a 09 09 09 09 " "mode"))).....
3ce0: 28 69 66 20 6d 20 28 73 74 72 69 6e 67 2d 3e 73 (if m (string->s
3cf0: 79 6d 62 6f 6c 20 6d 29 20 27 6e 6f 72 6d 61 6c ymbol m) 'normal
3d00: 29 29 29 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 )))... (waitons
3d10: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
3d20: 75 65 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 ueue-get-waitons
3d30: 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 test-record)
3d40: 29 0a 09 09 20 28 70 72 69 6f 72 69 74 79 20 20 )... (priority
3d50: 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 (tests:testque
3d60: 75 65 2d 67 65 74 2d 70 72 69 6f 72 69 74 79 20 ue-get-priority
3d70: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
3d80: 09 09 20 28 69 74 65 6d 64 61 74 20 20 20 20 20 .. (itemdat
3d90: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3da0: 2d 67 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 -get-itemdat
3db0: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 20 3b 3b test-record)) ;;
3dc0: 20 69 74 65 6d 64 61 74 20 63 61 6e 20 62 65 20 itemdat can be
3dd0: 61 20 73 74 72 69 6e 67 2c 20 6c 69 73 74 20 6f a string, list o
3de0: 72 20 23 66 0a 09 09 20 28 69 74 65 6d 73 20 20 r #f... (items
3df0: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 (tests:test
3e00: 71 75 65 75 65 2d 67 65 74 2d 69 74 65 6d 73 20 queue-get-items
3e10: 20 20 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 test-record
3e20: 29 29 0a 09 09 20 28 69 74 65 6d 2d 70 61 74 68 ))... (item-path
3e30: 20 20 20 28 69 74 65 6d 2d 6c 69 73 74 2d 3e 70 (item-list->p
3e40: 61 74 68 20 69 74 65 6d 64 61 74 29 29 0a 09 09 ath itemdat))...
3e50: 20 28 6e 65 77 74 61 6c 20 20 20 20 20 20 28 61 (newtal (a
3e60: 70 70 65 6e 64 20 74 61 6c 20 28 6c 69 73 74 20 ppend tal (list
3e70: 68 65 64 29 29 29 29 0a 09 20 20 20 20 0a 09 20 hed)))).. ..
3e80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
3e90: 36 0a 09 09 09 20 22 74 65 73 74 2d 6e 61 6d 65 6.... "test-name
3ea0: 3a 20 22 20 74 65 73 74 2d 6e 61 6d 65 0a 09 09 : " test-name...
3eb0: 09 20 22 5c 6e 20 20 68 65 64 3a 20 20 20 20 20 . "\n hed:
3ec0: 20 20 20 20 22 20 68 65 64 0a 09 09 09 20 22 5c " hed.... "\
3ed0: 6e 20 20 69 74 65 6d 64 61 74 3a 20 20 20 20 20 n itemdat:
3ee0: 22 20 69 74 65 6d 64 61 74 0a 09 09 09 20 22 5c " itemdat.... "\
3ef0: 6e 20 20 69 74 65 6d 73 3a 20 20 20 20 20 20 20 n items:
3f00: 22 20 69 74 65 6d 73 0a 09 09 09 20 22 5c 6e 20 " items.... "\n
3f10: 20 69 74 65 6d 2d 70 61 74 68 3a 20 20 20 22 20 item-path: "
3f20: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 22 5c item-path.... "\
3f30: 6e 20 20 77 61 69 74 6f 6e 73 3a 20 20 20 20 20 n waitons:
3f40: 22 20 77 61 69 74 6f 6e 73 0a 09 09 09 20 22 5c " waitons.... "\
3f50: 6e 20 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 n num-retries:
3f60: 22 20 6e 75 6d 2d 72 65 74 72 69 65 73 0a 09 09 " num-retries...
3f70: 09 20 22 5c 6e 20 20 74 61 6c 3a 20 20 20 20 20 . "\n tal:
3f80: 20 20 20 20 22 20 74 61 6c 0a 09 09 09 20 22 5c " tal.... "\
3f90: 6e 20 20 72 65 72 75 6e 73 3a 20 20 20 20 20 20 n reruns:
3fa0: 22 20 72 65 72 75 6e 73 29 0a 0a 09 20 20 20 20 " reruns)...
3fb0: 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 65 64 ;; check for hed
3fc0: 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e 20 74 in waitons => t
3fd0: 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 69 72 his would be cir
3fe0: 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 69 74 cular, remove it
3ff0: 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a 09 20 and issue an..
4000: 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 20 20 ;; error..
4010: 20 28 69 66 20 28 6d 65 6d 62 65 72 20 74 65 73 (if (member tes
4020: 74 2d 6e 61 6d 65 20 77 61 69 74 6f 6e 73 29 0a t-name waitons).
4030: 09 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 ..(begin... (de
4040: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
4050: 4f 52 3a 20 74 65 73 74 20 22 20 74 65 73 74 2d OR: test " test-
4060: 6e 61 6d 65 20 22 20 68 61 73 20 6c 69 73 74 65 name " has liste
4070: 64 20 69 74 73 65 6c 66 20 61 73 20 61 20 77 61 d itself as a wa
4080: 69 74 6f 6e 2c 20 70 6c 65 61 73 65 20 63 6f 72 iton, please cor
4090: 72 65 63 74 20 74 68 69 73 21 22 29 0a 09 09 20 rect this!")...
40a0: 20 28 73 65 74 21 20 77 61 69 74 6f 6e 20 28 66 (set! waiton (f
40b0: 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 ilter (lambda (x
40c0: 29 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 78 20 )(not (equal? x
40d0: 68 65 64 29 29 29 20 77 61 69 74 6f 6e 73 29 29 hed))) waitons))
40e0: 29 29 0a 0a 09 20 20 20 20 28 63 6f 6e 64 20 3b ))... (cond ;
40f0: 3b 20 4f 55 54 45 52 20 43 4f 4e 44 0a 09 20 20 ; OUTER COND..
4100: 20 20 20 28 28 6e 6f 74 20 69 74 65 6d 73 29 20 ((not items)
4110: 3b 3b 20 77 68 65 6e 20 66 61 6c 73 65 20 74 68 ;; when false th
4120: 65 20 74 65 73 74 20 69 73 20 6f 6b 20 74 6f 20 e test is ok to
4130: 62 65 20 68 61 6e 64 65 64 20 6f 66 66 20 74 6f be handed off to
4140: 20 6c 61 75 6e 63 68 20 28 62 75 74 20 6e 6f 74 launch (but not
4150: 20 62 65 66 6f 72 65 29 0a 09 20 20 20 20 20 20 before)..
4160: 28 6c 65 74 2a 20 28 28 72 75 6e 2d 6c 69 6d 69 (let* ((run-limi
4170: 74 73 2d 69 6e 66 6f 20 20 20 20 20 20 20 20 20 ts-info
4180: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
4190: 72 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 runs:can-run-mor
41a0: 65 2d 74 65 73 74 73 20 23 66 20 74 65 73 74 2d e-tests #f test-
41b0: 72 65 63 6f 72 64 29 29 20 3b 3b 20 6c 6f 6f 6b record)) ;; look
41c0: 20 61 74 20 74 68 65 20 74 65 73 74 20 6a 6f 62 at the test job
41d0: 67 72 6f 75 70 20 61 6e 64 20 74 6f 74 20 6a 6f group and tot jo
41e0: 62 73 20 72 75 6e 6e 69 6e 67 0a 09 09 20 20 20 bs running...
41f0: 20 20 28 68 61 76 65 2d 72 65 73 6f 75 72 63 65 (have-resource
4200: 73 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 s (car
4210: 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 run-limits-info)
4220: 29 0a 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 )... (num-ru
4230: 6e 6e 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 nning
4240: 20 20 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d (list-ref run-
4250: 6c 69 6d 69 74 73 2d 69 6e 66 6f 20 31 29 29 0a limits-info 1)).
4260: 09 09 20 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e .. (num-runn
4270: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 ing-in-jobgroup
4280: 28 6c 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 (list-ref run-li
4290: 6d 69 74 73 2d 69 6e 66 6f 20 32 29 29 0a 09 09 mits-info 2))...
42a0: 20 20 20 20 20 28 6d 61 78 2d 63 6f 6e 63 75 72 (max-concur
42b0: 72 65 6e 74 2d 6a 6f 62 73 20 20 20 20 20 28 6c rent-jobs (l
42c0: 69 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 ist-ref run-limi
42d0: 74 73 2d 69 6e 66 6f 20 33 29 29 0a 09 09 20 20 ts-info 3))...
42e0: 20 20 20 28 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 (job-group-li
42f0: 6d 69 74 20 20 20 20 20 20 20 20 20 28 6c 69 73 mit (lis
4300: 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 t-ref run-limits
4310: 2d 69 6e 66 6f 20 34 29 29 0a 09 09 20 20 20 20 -info 4))...
4320: 20 28 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 (prereqs-not-me
4330: 74 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d t (open-
4340: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 run-close db:get
4350: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 -prereqs-not-met
4360: 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f #f run-id waito
4370: 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 ns item-path mod
4380: 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 e: testmode))...
4390: 20 20 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 (fails
43a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 (r
43b0: 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 uns:calc-fails p
43c0: 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 29 rereqs-not-met))
43d0: 0a 09 09 20 20 20 20 20 28 6e 6f 6e 2d 63 6f 6d ... (non-com
43e0: 70 6c 65 74 65 64 20 20 20 20 20 20 20 20 20 20 pleted
43f0: 20 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d (runs:calc-not-
4400: 63 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 completed prereq
4410: 73 2d 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 28 s-not-met)))...(
4420: 64 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49 debug:print 8 "I
4430: 4e 46 4f 3a 20 68 61 76 65 2d 72 65 73 6f 75 72 NFO: have-resour
4440: 63 65 73 3a 20 22 20 68 61 76 65 2d 72 65 73 6f ces: " have-reso
4450: 75 72 63 65 73 20 22 20 70 72 65 72 65 71 73 2d urces " prereqs-
4460: 6e 6f 74 2d 6d 65 74 3a 20 22 20 0a 09 09 09 20 not-met: " ....
4470: 20 20 20 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 (string-inte
4480: 72 73 70 65 72 73 65 20 0a 09 09 09 20 20 20 20 rsperse ....
4490: 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 (map (lambda (
44a0: 74 29 0a 09 09 09 09 20 20 20 20 20 28 69 66 20 t)..... (if
44b0: 28 76 65 63 74 6f 72 3f 20 74 29 0a 09 09 09 09 (vector? t).....
44c0: 09 20 28 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 . (conc (db:test
44d0: 2d 67 65 74 2d 73 74 61 74 65 20 74 29 20 22 2f -get-state t) "/
44e0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 " (db:test-get-s
44f0: 74 61 74 75 73 20 74 29 29 0a 09 09 09 09 09 20 tatus t))......
4500: 28 63 6f 6e 63 20 22 20 57 41 52 4e 49 4e 47 3a (conc " WARNING:
4510: 20 74 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 t is not a vect
4520: 6f 72 3d 22 20 74 20 29 29 29 0a 09 09 09 09 20 or=" t ))).....
4530: 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 prereqs-not-me
4540: 74 29 20 22 2c 20 22 29 20 22 20 66 61 69 6c 73 t) ", ") " fails
4550: 3a 20 22 20 66 61 69 6c 73 29 0a 09 09 28 64 65 : " fails)...(de
4560: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
4570: 4f 3a 20 68 65 64 3d 22 20 68 65 64 29 0a 0a 09 O: hed=" hed)...
4580: 09 3b 3b 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 61 .;; Don't know a
4590: 74 20 74 68 69 73 20 74 69 6d 65 20 69 66 20 74 t this time if t
45a0: 68 65 20 74 65 73 74 20 68 61 76 65 20 62 65 65 he test have bee
45b0: 6e 20 6c 61 75 6e 63 68 65 64 20 61 74 20 73 6f n launched at so
45c0: 6d 65 20 74 69 6d 65 20 69 6e 20 74 68 65 20 70 me time in the p
45d0: 61 73 74 0a 09 09 3b 3b 20 69 2e 65 2e 20 69 73 ast...;; i.e. is
45e0: 20 74 68 69 73 20 61 20 72 65 2d 6c 61 75 6e 63 this a re-launc
45f0: 68 3f 0a 09 09 28 64 65 62 75 67 3a 70 72 69 6e h?...(debug:prin
4600: 74 20 34 20 22 49 4e 46 4f 3a 20 72 75 6e 2d 6c t 4 "INFO: run-l
4610: 69 6d 69 74 73 2d 69 6e 66 6f 20 3d 20 22 20 72 imits-info = " r
4620: 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f 29 0a un-limits-info).
4630: 09 09 28 63 6f 6e 64 20 3b 3b 20 49 4e 4e 45 52 ..(cond ;; INNER
4640: 20 43 4f 4e 44 20 23 31 20 66 6f 72 20 61 20 6c COND #1 for a l
4650: 61 75 6e 63 68 61 62 6c 65 20 74 65 73 74 0a 09 aunchable test..
4660: 09 20 3b 3b 20 43 68 65 63 6b 20 69 74 65 6d 20 . ;; Check item
4670: 70 61 74 68 20 61 67 61 69 6e 73 74 20 69 74 65 path against ite
4680: 6d 2d 70 61 74 74 73 0a 09 09 20 28 28 61 6e 64 m-patts... ((and
4690: 20 28 6e 6f 74 20 28 70 61 74 74 2d 6c 69 73 74 (not (patt-list
46a0: 2d 6d 61 74 63 68 20 69 74 65 6d 2d 70 61 74 68 -match item-path
46b0: 20 69 74 65 6d 2d 70 61 74 74 73 29 29 0a 09 09 item-patts))...
46c0: 20 20 20 20 20 20 20 28 6e 6f 74 20 28 65 71 75 (not (equ
46d0: 61 6c 3f 20 69 74 65 6d 2d 70 61 74 68 20 22 22 al? item-path ""
46e0: 29 29 29 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 )))... ;; else
46f0: 74 68 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b the run is stuck
4700: 2c 20 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 , temporarily or
4710: 20 70 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 permanently...
4720: 20 3b 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 ;; but should c
4730: 68 65 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 heck if it is du
4740: 65 20 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 e to lack of res
4750: 6f 75 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 ources vs. prere
4760: 71 75 69 73 69 74 65 73 0a 09 09 20 20 28 64 65 quisites... (de
4770: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 bug:print 1 "INF
4780: 4f 3a 20 53 6b 69 70 70 69 6e 67 20 22 20 28 74 O: Skipping " (t
4790: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
47a0: 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 et-testname test
47b0: 2d 72 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 -record) " " ite
47c0: 6d 2d 70 61 74 68 20 22 20 61 73 20 69 74 20 64 m-path " as it d
47d0: 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 22 20 69 oesn't match " i
47e0: 74 65 6d 2d 70 61 74 74 73 29 0a 09 09 20 20 28 tem-patts)... (
47f0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
4800: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
4810: 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c (if (not (null
4820: 3f 20 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 ? tal))...
4830: 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 (loop (car tal)(
4840: 63 64 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 cdr tal) reruns)
4850: 29 29 0a 09 09 20 28 28 61 6e 64 20 28 6e 6f 74 ))... ((and (not
4860: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
4870: 2f 64 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 /default test-re
4880: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 gistery (runs:ma
4890: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d ke-full-test-nam
48a0: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d e test-name item
48b0: 2d 70 61 74 68 29 20 23 66 29 29 0a 09 09 20 20 -path) #f))...
48c0: 20 20 20 20 20 28 61 6e 64 20 6d 61 78 2d 63 6f (and max-co
48d0: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e ncurrent-jobs (>
48e0: 20 28 2d 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 (- max-concurre
48f0: 6e 74 2d 6a 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e nt-jobs num-runn
4900: 69 6e 67 29 20 35 29 29 29 0a 09 09 20 20 28 6f ing) 5)))... (o
4910: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
4920: 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d :tests-register-
4930: 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 74 test #f run-id t
4940: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
4950: 74 68 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61 th)... (hash-ta
4960: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 ble-set! test-re
4970: 67 69 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 gistery (runs:ma
4980: 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d ke-full-test-nam
4990: 65 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d e test-name item
49a0: 2d 70 61 74 68 29 20 23 74 29 0a 09 09 20 20 28 -path) #t)... (
49b0: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
49c0: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
49d0: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 (loop (car new
49e0: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 tal)(cdr newtal)
49f0: 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e reruns))... ((n
4a00: 6f 74 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 ot have-resource
4a10: 73 29 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 s) ;; simply try
4a20: 20 61 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 again after wai
4a30: 74 69 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 ting a second...
4a40: 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 (thread-sleep!
4a50: 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 (+ 1 *global-de
4a60: 6c 74 61 2a 29 29 0a 09 09 20 20 28 64 65 62 75 lta*))... (debu
4a70: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a g:print 1 "INFO:
4a80: 20 6e 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f no resources to
4a90: 20 72 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 run new tests,
4aa0: 77 61 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 waiting ...")...
4ab0: 20 20 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 ;; could have
4ac0: 64 6f 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 done hed tal her
4ad0: 65 20 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f e but doing car/
4ae0: 63 64 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f cdr of newtal to
4af0: 20 72 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 rotate tests...
4b00: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 (loop (car new
4b10: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 tal)(cdr newtal)
4b20: 20 72 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61 reruns))... ((a
4b30: 6e 64 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 nd have-resource
4b40: 73 0a 09 09 20 20 20 20 20 20 20 28 6f 72 20 28 s... (or (
4b50: 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f null? prereqs-no
4b60: 74 2d 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e t-met).... (an
4b70: 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 d (eq? testmode
4b80: 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28 'toplevel).....(
4b90: 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 null? non-comple
4ba0: 74 65 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e ted))))... (run
4bb0: 3a 74 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e :test run-id run
4bc0: 6e 61 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 name keyvallst t
4bd0: 65 73 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 est-record flags
4be0: 20 23 66 29 0a 09 09 20 20 28 74 68 72 65 61 64 #f)... (thread
4bf0: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d -sleep! *global-
4c00: 64 65 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20 delta*)... (if
4c10: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 (not (null? tal)
4c20: 29 0a 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 )... (loop
4c30: 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 (car tal)(cdr ta
4c40: 6c 29 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 l) reruns)))...
4c50: 28 65 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 (else ;; must be
4c60: 20 77 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70 we have unmet p
4c70: 72 65 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 rerequisites...
4c80: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
4c90: 34 20 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 4 "FAILS: " fail
4ca0: 73 29 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f s)... ;; If o
4cb0: 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 ne or more of th
4cc0: 65 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 e prereqs-not-me
4cd0: 74 20 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20 t are FAIL then
4ce0: 77 65 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20 we can issue...
4cf0: 20 20 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 ;; a message
4d00: 61 6e 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f and drop hed fro
4d10: 6d 20 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62 m the items to b
4d20: 65 20 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 e processed....
4d30: 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 (if (null? fa
4d40: 69 6c 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 ils)....(begin..
4d50: 09 09 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 .. ;; couldn't
4d60: 72 75 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 run, take a brea
4d70: 74 68 65 72 0a 09 09 09 20 20 28 64 65 62 75 67 ther.... (debug
4d80: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 :print 4 "INFO:
4d90: 53 68 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 Shouldn't really
4da0: 20 67 65 74 20 68 65 72 65 2c 20 72 61 63 65 20 get here, race
4db0: 63 6f 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c condition? Unabl
4dc0: 65 20 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 e to launch more
4dd0: 20 74 65 73 74 73 20 61 74 20 74 68 69 73 20 6d tests at this m
4de0: 6f 6d 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 oment, killing t
4df0: 69 6d 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 28 ime ...").... (
4e00: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b thread-sleep! (+
4e10: 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 1 *global-delta
4e20: 2a 29 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 *)) ;; long slee
4e30: 70 20 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f p here - no reso
4e40: 75 72 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65 urces, may as we
4e50: 6c 6c 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09 ll be patient...
4e60: 09 20 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 . ;; we made ne
4e70: 77 20 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e w tal by stickin
4e80: 67 20 68 65 64 20 61 74 20 74 68 65 20 62 61 63 g hed at the bac
4e90: 6b 20 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09 k of the list...
4ea0: 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 . (loop (car ne
4eb0: 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c wtal)(cdr newtal
4ec0: 29 20 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b ) reruns))....;;
4ed0: 20 74 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46 the waiton is F
4ee0: 41 49 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 AIL so no point
4ef0: 69 6e 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e in trying to run
4f00: 20 68 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a hed ever again.
4f10: 09 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c ...(if (not (nul
4f20: 6c 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 l? tal))....
4f30: 28 69 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64 (if (vector? hed
4f40: 29 0a 09 09 09 09 28 62 65 67 69 6e 20 28 64 65 ).....(begin (de
4f50: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 bug:print 1 "WAR
4f60: 4e 3a 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 N: Dropping test
4f70: 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d " (db:test-get-
4f80: 74 65 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f testname hed) "/
4f90: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 " (db:test-get-i
4fa0: 74 65 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09 tem-path hed)...
4fb0: 09 09 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74 .... " from t
4fc0: 68 65 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 he launch list a
4fd0: 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75 s it has prerequ
4fe0: 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46 istes that are F
4ff0: 41 49 4c 22 29 0a 09 09 09 09 20 20 20 20 20 20 AIL").....
5000: 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 (thread-sleep!
5010: 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a *global-delta*).
5020: 09 09 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70 .... (loop
5030: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 (car tal)(cdr t
5040: 61 6c 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65 al) (cons hed re
5050: 72 75 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67 runs))).....(beg
5060: 69 6e 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a in..... (debug:
5070: 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54 print 1 "WARN: T
5080: 65 73 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65 est not processe
5090: 64 20 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75 d correctly. Cou
50a0: 6c 64 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e ld be a race con
50b0: 64 69 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74 dition in your t
50c0: 65 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 est implementati
50d0: 6f 6e 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22 on? " hed) ;; "
50e0: 20 61 73 20 69 74 20 68 61 73 20 70 72 65 72 65 as it has prere
50f0: 71 75 69 73 74 65 73 20 74 68 61 74 20 61 72 65 quistes that are
5100: 20 46 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65 FAIL. (NOTE: he
5110: 64 20 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f d is not a vecto
5120: 72 29 22 29 0a 09 09 09 09 20 20 28 74 68 72 65 r)")..... (thre
5130: 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 ad-sleep! *globa
5140: 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 l-delta*).....
5150: 28 6c 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 (loop hed tal re
5160: 72 75 6e 73 29 29 29 29 29 29 29 29 29 20 3b 3b runs))))))))) ;;
5170: 20 45 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f END OF INNER CO
5180: 4e 44 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 ND.. ..
5190: 3b 3b 20 63 61 73 65 20 77 68 65 72 65 20 61 6e ;; case where an
51a0: 20 69 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 items came in a
51b0: 73 20 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 s a list been pr
51c0: 6f 63 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 ocessed.. ((
51d0: 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 and (list? items
51e0: 29 20 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 ) ;; thus we
51f0: 20 6b 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 know our items
5200: 61 72 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 are already calc
5210: 75 6c 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 ulated... (not
5220: 20 20 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 itemdat)) ;;
5230: 61 6e 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 and not yet expa
5240: 6e 64 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 nded into the li
5250: 73 74 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 st of things to
5260: 62 65 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 be done.. (
5270: 69 66 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 if (and (>= *ver
5280: 62 6f 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 bosity* 1)...
5290: 20 20 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 (> (length i
52a0: 74 65 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 tems) 0)...
52b0: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 (> (length (ca
52c0: 72 20 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 r items)) 0))...
52d0: 20 20 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 (pp items))..
52e0: 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 (for-each..
52f0: 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 (lambda (
5300: 6d 79 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 my-itemdat)... (
5310: 6c 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d let* ((new-test-
5320: 72 65 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 record (let ((ne
5330: 77 72 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 wrec (make-tests
5340: 3a 74 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 :testqueue)))...
5350: 09 09 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f ... (vector-co
5360: 70 79 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 py! test-record
5370: 6e 65 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 newrec)......
5380: 6e 65 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d newrec))....(my-
5390: 69 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d item-path (item-
53a0: 6c 69 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 list->path my-it
53b0: 65 6d 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 emdat)))... (i
53c0: 66 20 28 70 61 74 74 2d 6c 69 73 74 2d 6d 61 74 f (patt-list-mat
53d0: 63 68 20 6d 79 2d 69 74 65 6d 2d 70 61 74 68 20 ch my-item-path
53e0: 69 74 65 6d 2d 70 61 74 74 73 29 20 20 20 20 20 item-patts)
53f0: 20 20 20 20 20 20 3b 3b 20 79 65 73 2c 20 77 65 ;; yes, we
5400: 20 77 61 6e 74 20 74 6f 20 70 72 6f 63 65 73 73 want to process
5410: 20 74 68 69 73 20 69 74 65 6d 2c 20 4e 4f 54 45 this item, NOTE
5420: 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 : Should not nee
5430: 64 20 74 68 69 73 20 63 68 65 63 6b 20 68 65 72 d this check her
5440: 65 21 0a 09 09 20 20 20 20 20 20 20 28 6c 65 74 e!... (let
5450: 20 28 28 6e 65 77 74 65 73 74 6e 61 6d 65 20 28 ((newtestname (
5460: 72 75 6e 73 3a 6d 61 6b 65 2d 66 75 6c 6c 2d 74 runs:make-full-t
5470: 65 73 74 2d 6e 61 6d 65 20 68 65 64 20 6d 79 2d est-name hed my-
5480: 69 74 65 6d 2d 70 61 74 68 29 29 29 20 20 20 20 item-path)))
5490: 3b 3b 20 74 65 73 74 20 6e 61 6d 65 73 20 61 72 ;; test names ar
54a0: 65 20 75 6e 69 71 75 65 20 6f 6e 20 74 65 73 74 e unique on test
54b0: 6e 61 6d 65 2f 69 74 65 6d 2d 70 61 74 68 0a 09 name/item-path..
54c0: 09 09 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 .. (tests:testqu
54d0: 65 75 65 2d 73 65 74 2d 69 74 65 6d 73 21 20 20 eue-set-items!
54e0: 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f new-test-reco
54f0: 72 64 20 23 66 29 0a 09 09 09 20 28 74 65 73 74 rd #f).... (test
5500: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d s:testqueue-set-
5510: 69 74 65 6d 64 61 74 21 20 20 20 6e 65 77 2d 74 itemdat! new-t
5520: 65 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 est-record my-it
5530: 65 6d 64 61 74 29 0a 09 09 09 20 28 74 65 73 74 emdat).... (test
5540: 73 3a 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d s:testqueue-set-
5550: 69 74 65 6d 5f 70 61 74 68 21 20 6e 65 77 2d 74 item_path! new-t
5560: 65 73 74 2d 72 65 63 6f 72 64 20 6d 79 2d 69 74 est-record my-it
5570: 65 6d 2d 70 61 74 68 29 0a 09 09 09 20 28 68 61 em-path).... (ha
5580: 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 74 65 sh-table-set! te
5590: 73 74 2d 72 65 63 6f 72 64 73 20 6e 65 77 74 65 st-records newte
55a0: 73 74 6e 61 6d 65 20 6e 65 77 2d 74 65 73 74 2d stname new-test-
55b0: 72 65 63 6f 72 64 29 0a 09 09 09 20 28 73 65 74 record).... (set
55c0: 21 20 74 61 6c 20 28 63 6f 6e 73 20 6e 65 77 74 ! tal (cons newt
55d0: 65 73 74 6e 61 6d 65 20 74 61 6c 29 29 29 29 29 estname tal)))))
55e0: 29 20 3b 3b 20 73 69 6e 63 65 20 74 68 65 73 65 ) ;; since these
55f0: 20 61 72 65 20 69 74 65 6d 69 7a 65 64 20 63 72 are itemized cr
5600: 65 61 74 65 20 6e 65 77 20 74 65 73 74 20 6e 61 eate new test na
5610: 6d 65 73 20 74 65 73 74 6e 61 6d 65 2f 69 74 65 mes testname/ite
5620: 6d 70 61 74 68 0a 09 20 20 20 20 20 20 20 69 74 mpath.. it
5630: 65 6d 73 29 0a 09 20 20 20 20 20 20 28 69 66 20 ems).. (if
5640: 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 (not (null? tal)
5650: 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 )... (begin...
5660: 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 (thread-sleep
5670: 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a ! *global-delta*
5680: 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 )... (debug:p
5690: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 45 6e rint 4 "INFO: En
56a0: 64 20 6f 66 20 69 74 65 6d 73 20 6c 69 73 74 2c d of items list,
56b0: 20 6c 6f 6f 70 69 6e 67 20 77 69 74 68 20 6e 65 looping with ne
56c0: 78 74 22 29 0a 09 09 20 20 20 20 28 6c 6f 6f 70 xt")... (loop
56d0: 20 28 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 (car tal)(cdr t
56e0: 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 0a 0a al) reruns))))..
56f0: 09 20 20 20 20 20 3b 3b 20 69 66 20 69 74 65 6d . ;; if item
5700: 73 20 69 73 20 61 20 70 72 6f 63 20 74 68 65 6e s is a proc then
5710: 20 6e 65 65 64 20 74 6f 20 72 75 6e 20 69 74 65 need to run ite
5720: 6d 73 3a 67 65 74 2d 69 74 65 6d 73 2d 66 72 6f ms:get-items-fro
5730: 6d 2d 63 6f 6e 66 69 67 2c 20 67 65 74 20 74 68 m-config, get th
5740: 65 20 6c 69 73 74 20 61 6e 64 20 6c 6f 6f 70 20 e list and loop
5750: 0a 09 20 20 20 20 20 3b 3b 20 20 20 20 2d 20 62 .. ;; - b
5760: 75 74 20 6f 6e 6c 79 20 64 6f 20 74 68 61 74 20 ut only do that
5770: 69 66 20 72 65 73 6f 75 72 63 65 73 20 65 78 69 if resources exi
5780: 73 74 20 74 6f 20 6b 69 63 6b 20 6f 66 66 20 74 st to kick off t
5790: 68 65 20 6a 6f 62 0a 09 20 20 20 20 20 28 28 6f he job.. ((o
57a0: 72 20 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 r (procedure? it
57b0: 65 6d 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 ems)(eq? items '
57c0: 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 have-procedure))
57d0: 0a 09 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 .. (let ((c
57e0: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 20 20 20 20 28 an-run-more (
57f0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 open-run-close r
5800: 75 6e 73 3a 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 uns:can-run-more
5810: 2d 74 65 73 74 73 20 23 66 20 74 65 73 74 2d 72 -tests #f test-r
5820: 65 63 6f 72 64 29 29 29 0a 09 09 28 69 66 20 63 ecord)))...(if c
5830: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 0a 09 09 20 20 an-run-more...
5840: 20 20 28 6c 65 74 2a 20 28 28 70 72 65 72 65 71 (let* ((prereq
5850: 73 2d 6e 6f 74 2d 6d 65 74 20 28 6f 70 65 6e 2d s-not-met (open-
5860: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 run-close db:get
5870: 2d 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 -prereqs-not-met
5880: 20 23 66 20 72 75 6e 2d 69 64 20 77 61 69 74 6f #f run-id waito
5890: 6e 73 20 69 74 65 6d 2d 70 61 74 68 20 6d 6f 64 ns item-path mod
58a0: 65 3a 20 74 65 73 74 6d 6f 64 65 29 29 0a 09 09 e: testmode))...
58b0: 09 20 20 20 28 66 61 69 6c 73 20 20 20 20 20 20 . (fails
58c0: 20 20 20 20 20 28 72 75 6e 73 3a 63 61 6c 63 2d (runs:calc-
58d0: 66 61 69 6c 73 20 70 72 65 72 65 71 73 2d 6e 6f fails prereqs-no
58e0: 74 2d 6d 65 74 29 29 0a 09 09 09 20 20 20 28 6e t-met)).... (n
58f0: 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 20 20 20 28 on-completed (
5900: 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f runs:calc-not-co
5910: 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 2d mpleted prereqs-
5920: 6e 6f 74 2d 6d 65 74 29 29 29 0a 09 09 20 20 20 not-met)))...
5930: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
5940: 38 20 22 49 4e 46 4f 3a 20 63 61 6e 2d 72 75 6e 8 "INFO: can-run
5950: 2d 6d 6f 72 65 3a 20 22 20 63 61 6e 2d 72 75 6e -more: " can-run
5960: 2d 6d 6f 72 65 0a 09 09 09 09 20 20 20 22 5c 6e -more..... "\n
5970: 20 74 65 73 74 6e 61 6d 65 3a 20 20 20 20 20 20 testname:
5980: 20 20 22 20 68 65 64 0a 09 09 09 09 20 20 20 22 " hed..... "
5990: 5c 6e 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d \n prereqs-not-m
59a0: 65 74 3a 20 22 20 28 72 75 6e 73 3a 70 72 65 74 et: " (runs:pret
59b0: 74 79 2d 73 74 72 69 6e 67 20 70 72 65 72 65 71 ty-string prereq
59c0: 73 2d 6e 6f 74 2d 6d 65 74 29 0a 09 09 09 09 20 s-not-met).....
59d0: 20 20 22 5c 6e 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 "\n non-comple
59e0: 74 65 64 3a 20 20 20 22 20 28 72 75 6e 73 3a 70 ted: " (runs:p
59f0: 72 65 74 74 79 2d 73 74 72 69 6e 67 20 6e 6f 6e retty-string non
5a00: 2d 63 6f 6d 70 6c 65 74 65 64 29 20 0a 09 09 09 -completed) ....
5a10: 09 20 20 20 22 5c 6e 20 66 61 69 6c 73 3a 20 20 . "\n fails:
5a20: 20 20 20 20 20 20 20 20 20 22 20 28 72 75 6e 73 " (runs
5a30: 3a 70 72 65 74 74 79 2d 73 74 72 69 6e 67 20 66 :pretty-string f
5a40: 61 69 6c 73 29 0a 09 09 09 09 20 20 20 22 5c 6e ails)..... "\n
5a50: 20 74 65 73 74 6d 6f 64 65 3a 20 20 20 20 20 20 testmode:
5a60: 20 20 22 20 74 65 73 74 6d 6f 64 65 0a 09 09 09 " testmode....
5a70: 09 20 20 20 22 5c 6e 20 6e 75 6d 2d 72 65 74 72 . "\n num-retr
5a80: 69 65 73 3a 20 20 20 20 20 22 20 6e 75 6d 2d 72 ies: " num-r
5a90: 65 74 72 69 65 73 0a 09 09 09 09 20 20 20 22 5c etries..... "\
5aa0: 6e 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 n (eq? testmode
5ab0: 27 74 6f 70 6c 65 76 65 6c 29 3a 20 22 20 28 65 'toplevel): " (e
5ac0: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 q? testmode 'top
5ad0: 6c 65 76 65 6c 29 0a 09 09 09 09 20 20 20 22 5c level)..... "\
5ae0: 6e 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d n (null? non-com
5af0: 70 6c 65 74 65 64 29 3a 20 20 20 20 22 20 28 6e pleted): " (n
5b00: 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 ull? non-complet
5b10: 65 64 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 72 ed)..... "\n r
5b20: 65 72 75 6e 73 3a 20 22 20 72 65 72 75 6e 73 29 eruns: " reruns)
5b30: 0a 0a 09 09 20 20 20 20 20 20 28 63 6f 6e 64 20 .... (cond
5b40: 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 20 23 32 ;; INNER COND #2
5b50: 0a 09 09 20 20 20 20 20 20 20 28 28 6f 72 20 28 ... ((or (
5b60: 6e 75 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f null? prereqs-no
5b70: 74 2d 6d 65 74 29 20 3b 3b 20 61 6c 6c 20 70 72 t-met) ;; all pr
5b80: 65 72 65 71 73 20 6d 65 74 2c 20 66 69 72 65 20 ereqs met, fire
5b90: 6f 66 66 20 74 68 65 20 74 65 73 74 0a 09 09 09 off the test....
5ba0: 20 20 20 20 3b 3b 20 6f 72 2c 20 69 66 20 69 74 ;; or, if it
5bb0: 20 69 73 20 61 20 27 74 6f 70 6c 65 76 65 6c 20 is a 'toplevel
5bc0: 74 65 73 74 20 61 6e 64 20 61 6c 6c 20 70 72 65 test and all pre
5bd0: 72 65 71 73 20 6e 6f 74 20 6d 65 74 20 61 72 65 reqs not met are
5be0: 20 43 4f 4d 50 4c 45 54 45 44 20 74 68 65 6e 20 COMPLETED then
5bf0: 6c 61 75 6e 63 68 0a 09 09 09 20 20 20 20 28 61 launch.... (a
5c00: 6e 64 20 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 nd (eq? testmode
5c10: 20 27 74 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 'toplevel).....
5c20: 20 28 6e 75 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 (null? non-comp
5c30: 6c 65 74 65 64 29 29 29 0a 09 09 09 28 6c 65 74 leted)))....(let
5c40: 20 28 28 74 65 73 74 2d 6e 61 6d 65 20 28 74 65 ((test-name (te
5c50: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
5c60: 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d t-testname test-
5c70: 72 65 63 6f 72 64 29 29 29 0a 09 09 09 20 20 28 record))).... (
5c80: 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f setenv "MT_TEST_
5c90: 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 NAME" test-name)
5ca0: 20 3b 3b 20 0a 09 09 09 20 20 28 73 65 74 65 6e ;; .... (seten
5cb0: 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 v "MT_RUNNAME"
5cc0: 20 72 75 6e 6e 61 6d 65 29 0a 09 09 09 20 20 28 runname).... (
5cd0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 open-run-close s
5ce0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
5cf0: 76 61 72 73 20 23 66 20 72 75 6e 2d 69 64 29 20 vars #f run-id)
5d00: 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 20 ;; these may be
5d10: 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c 61 needed by the la
5d20: 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 0a unching process.
5d30: 09 09 09 20 20 28 6c 65 74 20 28 28 69 74 65 6d ... (let ((item
5d40: 73 2d 6c 69 73 74 20 28 69 74 65 6d 73 3a 67 65 s-list (items:ge
5d50: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e t-items-from-con
5d60: 66 69 67 20 74 63 6f 6e 66 69 67 29 29 29 0a 09 fig tconfig)))..
5d70: 09 09 20 20 20 20 28 69 66 20 28 6c 69 73 74 3f .. (if (list?
5d80: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 items-list)....
5d90: 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 28 74 .(begin..... (t
5da0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 ests:testqueue-s
5db0: 65 74 2d 69 74 65 6d 73 21 20 74 65 73 74 2d 72 et-items! test-r
5dc0: 65 63 6f 72 64 20 69 74 65 6d 73 2d 6c 69 73 74 ecord items-list
5dd0: 29 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 2d )..... (thread-
5de0: 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 sleep! *global-d
5df0: 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 6c 6f elta*)..... (lo
5e00: 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 6e op hed tal rerun
5e10: 73 29 29 0a 09 09 09 09 28 62 65 67 69 6e 0a 09 s)).....(begin..
5e20: 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 69 6e ... (debug:prin
5e30: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 20 t 0 "ERROR: The
5e40: 70 72 6f 63 20 66 72 6f 6d 20 72 65 61 64 69 6e proc from readin
5e50: 67 20 74 68 65 20 73 65 74 75 70 20 64 69 64 20 g the setup did
5e60: 6e 6f 74 20 79 69 65 6c 64 20 61 20 6c 69 73 74 not yield a list
5e70: 20 2d 20 70 6c 65 61 73 65 20 72 65 70 6f 72 74 - please report
5e80: 20 74 68 69 73 22 29 0a 09 09 09 09 20 20 28 65 this")..... (e
5e90: 78 69 74 20 31 29 29 29 29 29 29 0a 09 09 20 20 xit 1))))))...
5ea0: 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 66 61 69 ((null? fai
5eb0: 6c 73 29 0a 09 09 09 28 64 65 62 75 67 3a 70 72 ls)....(debug:pr
5ec0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 66 61 69 int 4 "INFO: fai
5ed0: 6c 73 20 69 73 20 6e 75 6c 6c 2c 20 6d 6f 76 69 ls is null, movi
5ee0: 6e 67 20 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 ng on in the que
5ef0: 75 65 20 62 75 74 20 6b 65 65 70 69 6e 67 20 22 ue but keeping "
5f00: 20 68 65 64 20 22 20 66 6f 72 20 6e 6f 77 22 29 hed " for now")
5f10: 0a 09 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 ....(thread-slee
5f20: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 p! *global-delta
5f30: 2a 29 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 *)....(loop (car
5f40: 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 newtal)(cdr new
5f50: 74 61 6c 29 20 72 65 72 75 6e 73 29 29 20 3b 3b tal) reruns)) ;;
5f60: 20 61 6e 20 69 73 73 75 65 20 77 69 74 68 20 70 an issue with p
5f70: 72 65 72 65 71 73 20 6e 6f 74 20 79 65 74 20 6d rereqs not yet m
5f80: 65 74 3f 0a 09 09 20 20 20 20 20 20 20 28 28 61 et?... ((a
5f90: 6e 64 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 66 nd (not (null? f
5fa0: 61 69 6c 73 29 29 28 65 71 3f 20 74 65 73 74 6d ails))(eq? testm
5fb0: 6f 64 65 20 27 6e 6f 72 6d 61 6c 29 29 0a 09 09 ode 'normal))...
5fc0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 .(debug:print 1
5fd0: 22 49 4e 46 4f 3a 20 74 65 73 74 20 22 20 20 68 "INFO: test " h
5fe0: 65 64 20 22 20 28 6d 6f 64 65 3d 22 20 74 65 73 ed " (mode=" tes
5ff0: 74 6d 6f 64 65 20 22 29 20 68 61 73 20 66 61 69 tmode ") has fai
6000: 6c 65 64 20 70 72 65 72 65 71 75 69 73 69 74 65 led prerequisite
6010: 28 73 29 3b 20 22 0a 09 09 09 09 20 20 20 20 20 (s); ".....
6020: 28 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 (string-interspe
6030: 72 73 65 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 rse (map (lambda
6040: 20 28 74 29 28 63 6f 6e 63 20 28 64 62 3a 74 65 (t)(conc (db:te
6050: 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 st-get-testname
6060: 74 29 20 22 3a 22 20 28 64 62 3a 74 65 73 74 2d t) ":" (db:test-
6070: 67 65 74 2d 73 74 61 74 65 20 74 29 22 2f 22 28 get-state t)"/"(
6080: 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 db:test-get-stat
6090: 75 73 20 74 29 29 29 20 66 61 69 6c 73 29 20 22 us t))) fails) "
60a0: 2c 20 22 29 0a 09 09 09 09 20 20 20 20 20 22 2c , ")..... ",
60b0: 20 72 65 6d 6f 76 69 6e 67 20 69 74 20 66 72 6f removing it fro
60c0: 6d 20 74 6f 2d 64 6f 20 6c 69 73 74 22 29 0a 09 m to-do list")..
60d0: 09 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c ..(if (not (null
60e0: 3f 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 ? tal)).... (
60f0: 62 65 67 69 6e 0a 09 09 09 20 20 20 20 20 20 28 begin.... (
6100: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
6110: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
6120: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 . (loop (ca
6130: 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 28 r tal)(cdr tal)(
6140: 63 6f 6e 73 20 68 65 64 20 72 65 72 75 6e 73 29 cons hed reruns)
6150: 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 65 ))))... (e
6160: 6c 73 65 0a 09 09 09 28 64 65 62 75 67 3a 70 72 lse....(debug:pr
6170: 69 6e 74 20 38 20 22 45 52 52 4f 52 3a 20 4e 6f int 8 "ERROR: No
6180: 20 68 61 6e 64 6c 65 72 20 66 6f 72 20 74 68 69 handler for thi
6190: 73 20 63 6f 6e 64 69 74 69 6f 6e 2e 22 29 0a 09 s condition.")..
61a0: 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 ..(thread-sleep!
61b0: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 *global-delta*)
61c0: 0a 09 09 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e ....(loop (car n
61d0: 65 77 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 ewtal)(cdr newta
61e0: 6c 29 20 72 65 72 75 6e 73 29 29 29 29 20 3b 3b l) reruns)))) ;;
61f0: 20 45 4e 44 20 4f 46 20 49 46 20 43 41 4e 20 52 END OF IF CAN R
6200: 55 4e 20 4d 4f 52 45 0a 0a 09 09 20 20 20 20 3b UN MORE.... ;
6210: 3b 20 69 66 20 63 61 6e 27 74 20 72 75 6e 20 6d ; if can't run m
6220: 6f 72 65 20 6a 75 73 74 20 6c 6f 6f 70 20 77 69 ore just loop wi
6230: 74 68 20 6e 65 78 74 20 70 6f 73 73 69 62 6c 65 th next possible
6240: 20 74 65 73 74 0a 09 09 20 20 20 20 28 62 65 67 test... (beg
6250: 69 6e 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 in... (debu
6260: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a g:print 4 "INFO:
6270: 20 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 processing the
6280: 63 61 73 65 20 77 69 74 68 20 61 20 6c 61 6d 62 case with a lamb
6290: 64 61 20 66 6f 72 20 69 74 65 6d 73 20 6f 72 20 da for items or
62a0: 27 68 61 76 65 2d 70 72 6f 63 65 64 75 72 65 2e 'have-procedure.
62b0: 20 4d 6f 76 69 6e 67 20 74 68 72 6f 75 67 68 20 Moving through
62c0: 74 68 65 20 71 75 65 75 65 20 77 69 74 68 6f 75 the queue withou
62d0: 74 20 64 72 6f 70 70 69 6e 67 20 22 20 68 65 64 t dropping " hed
62e0: 29 0a 09 09 20 20 20 20 20 20 28 74 68 72 65 61 )... (threa
62f0: 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 20 2a 67 d-sleep! (+ 1 *g
6300: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 29 0a 09 lobal-delta*))..
6310: 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 . (loop (ca
6320: 72 20 6e 65 77 74 61 6c 29 28 63 64 72 20 6e 65 r newtal)(cdr ne
6330: 77 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 29 wtal) reruns))))
6340: 29 20 3b 3b 20 45 4e 44 20 4f 46 20 28 6f 72 20 ) ;; END OF (or
6350: 28 70 72 6f 63 65 64 75 72 65 3f 20 69 74 65 6d (procedure? item
6360: 73 29 28 65 71 3f 20 69 74 65 6d 73 20 27 68 61 s)(eq? items 'ha
6370: 76 65 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 09 ve-procedure))..
6380: 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b 20 74 .. ;; t
6390: 68 69 73 20 63 61 73 65 20 73 68 6f 75 6c 64 20 his case should
63a0: 6e 6f 74 20 68 61 70 70 65 6e 2c 20 61 64 64 65 not happen, adde
63b0: 64 20 74 6f 20 68 65 6c 70 20 63 61 74 63 68 20 d to help catch
63c0: 61 6e 79 20 62 75 67 73 0a 09 20 20 20 20 20 28 any bugs.. (
63d0: 28 61 6e 64 20 28 6c 69 73 74 3f 20 69 74 65 6d (and (list? item
63e0: 73 29 20 69 74 65 6d 64 61 74 29 0a 09 20 20 20 s) itemdat)..
63f0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6400: 30 20 22 45 52 52 4f 52 3a 20 53 68 6f 75 6c 64 0 "ERROR: Should
6410: 20 6e 6f 74 20 68 61 76 65 20 61 20 6c 69 73 74 not have a list
6420: 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 61 20 74 of items in a t
6430: 65 73 74 20 61 6e 64 20 74 68 65 20 69 74 65 6d est and the item
6440: 73 70 61 74 68 20 73 65 74 20 2d 20 70 6c 65 61 spath set - plea
6450: 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 22 29 se report this")
6460: 0a 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 .. (exit 1)
6470: 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 6e ).. ((not (n
6480: 75 6c 6c 3f 20 72 65 72 75 6e 73 29 29 0a 09 20 ull? reruns))..
6490: 20 20 20 20 20 28 6c 65 74 2a 20 28 28 6e 65 77 (let* ((new
64a0: 6c 73 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c lst (open-run-cl
64b0: 6f 73 65 20 74 65 73 74 73 3a 66 69 6c 74 65 72 ose tests:filter
64c0: 2d 6e 6f 6e 2d 72 75 6e 6e 61 62 6c 65 20 23 66 -non-runnable #f
64d0: 20 72 75 6e 2d 69 64 20 74 61 6c 20 74 65 73 74 run-id tal test
64e0: 2d 72 65 63 6f 72 64 73 29 29 20 3b 3b 20 69 2e -records)) ;; i.
64f0: 65 2e 20 6e 6f 74 20 46 41 49 4c 2c 20 57 41 49 e. not FAIL, WAI
6500: 56 45 44 2c 20 49 4e 43 4f 4d 50 4c 45 54 45 2c VED, INCOMPLETE,
6510: 20 50 41 53 53 2c 20 4b 49 4c 4c 45 44 2c 0a 09 PASS, KILLED,..
6520: 09 20 20 20 20 20 28 6a 75 6e 6b 65 64 20 28 6c . (junked (l
6530: 73 65 74 2d 64 69 66 66 65 72 65 6e 63 65 20 65 set-difference e
6540: 71 75 61 6c 3f 20 74 61 6c 20 6e 65 77 6c 73 74 qual? tal newlst
6550: 29 29 29 0a 09 09 28 64 65 62 75 67 3a 70 72 69 )))...(debug:pri
6560: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 66 75 6c 6c nt 4 "INFO: full
6570: 20 64 72 6f 70 20 74 68 72 6f 75 67 68 2c 20 69 drop through, i
6580: 66 20 72 65 72 75 6e 73 20 69 73 20 6c 65 73 73 f reruns is less
6590: 20 74 68 61 6e 20 31 30 30 20 77 65 20 77 69 6c than 100 we wil
65a0: 6c 20 66 6f 72 63 65 20 72 65 74 72 79 20 74 68 l force retry th
65b0: 65 6d 2c 20 72 65 72 75 6e 73 3d 22 20 72 65 72 em, reruns=" rer
65c0: 75 6e 73 20 22 2c 20 74 61 6c 3d 22 20 74 61 6c uns ", tal=" tal
65d0: 29 0a 09 09 28 69 66 20 28 3c 20 6e 75 6d 2d 72 )...(if (< num-r
65e0: 65 74 72 69 65 73 20 6d 61 78 2d 72 65 74 72 69 etries max-retri
65f0: 65 73 29 0a 09 09 20 20 20 20 28 73 65 74 21 20 es)... (set!
6600: 6e 65 77 6c 73 74 20 28 61 70 70 65 6e 64 20 72 newlst (append r
6610: 65 72 75 6e 73 20 6e 65 77 6c 73 74 29 29 29 0a eruns newlst))).
6620: 09 09 28 73 65 74 21 20 6e 75 6d 2d 72 65 74 72 ..(set! num-retr
6630: 69 65 73 20 28 2b 20 6e 75 6d 2d 72 65 74 72 69 ies (+ num-retri
6640: 65 73 20 31 29 29 0a 09 09 28 74 68 72 65 61 64 es 1))...(thread
6650: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d -sleep! *global-
6660: 64 65 6c 74 61 2a 29 0a 09 09 28 69 66 20 28 6e delta*)...(if (n
6670: 6f 74 20 28 6e 75 6c 6c 3f 20 6e 65 77 6c 73 74 ot (null? newlst
6680: 29 29 0a 09 09 20 20 20 20 3b 3b 20 73 69 6e 63 ))... ;; sinc
6690: 65 20 72 65 72 75 6e 73 20 68 61 76 65 20 62 65 e reruns have be
66a0: 65 6e 20 74 61 63 6b 65 64 20 6f 6e 20 74 6f 20 en tacked on to
66b0: 6e 65 77 6c 73 74 20 63 72 65 61 74 65 20 6e 65 newlst create ne
66c0: 77 20 72 65 72 75 6e 73 20 66 72 6f 6d 20 6a 75 w reruns from ju
66d0: 6e 6b 65 64 0a 09 09 20 20 20 20 28 6c 6f 6f 70 nked... (loop
66e0: 20 28 63 61 72 20 6e 65 77 6c 73 74 29 28 63 64 (car newlst)(cd
66f0: 72 20 6e 65 77 6c 73 74 29 28 64 65 6c 65 74 65 r newlst)(delete
6700: 2d 64 75 70 6c 69 63 61 74 65 73 20 6a 75 6e 6b -duplicates junk
6710: 65 64 29 29 29 29 29 0a 09 20 20 20 20 20 28 28 ed))))).. ((
6720: 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 not (null? tal))
6730: 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 .. (debug:p
6740: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 49 27 rint 4 "INFO: I'
6750: 6d 20 70 72 65 74 74 79 20 73 75 72 65 20 49 20 m pretty sure I
6760: 73 68 6f 75 6c 64 6e 27 74 20 67 65 74 20 68 65 shouldn't get he
6770: 72 65 2e 22 29 29 0a 09 20 20 20 20 20 28 65 6c re.")).. (el
6780: 73 65 0a 09 20 20 20 20 20 20 28 64 65 62 75 67 se.. (debug
6790: 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 :print 4 "INFO:
67a0: 45 78 69 74 69 6e 67 20 6c 6f 6f 70 20 77 69 74 Exiting loop wit
67b0: 68 2e 2e 2e 5c 6e 20 20 68 65 64 3d 22 20 68 65 h...\n hed=" he
67c0: 64 20 22 5c 6e 20 20 74 61 6c 3d 22 20 74 61 6c d "\n tal=" tal
67d0: 20 22 5c 6e 20 20 72 65 72 75 6e 73 3d 22 20 72 "\n reruns=" r
67e0: 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20 29 29 eruns)).. ))
67f0: 29 29 20 3b 3b 20 4c 45 54 2a 20 28 28 74 65 73 )) ;; LET* ((tes
6800: 74 2d 72 65 63 6f 72 64 0a 0a 20 20 20 20 3b 3b t-record.. ;;
6810: 20 77 65 20 67 65 74 20 68 65 72 65 20 6f 6e 20 we get here on
6820: 22 64 72 6f 70 20 74 68 72 6f 75 67 68 22 20 2d "drop through" -
6830: 20 6c 6f 6f 70 20 66 6f 72 20 6e 65 78 74 20 74 loop for next t
6840: 65 73 74 20 69 6e 20 71 75 65 75 65 0a 20 20 20 est in queue.
6850: 20 3b 3b 20 46 49 58 4d 45 21 21 21 21 20 54 48 ;; FIXME!!!! TH
6860: 49 53 20 53 48 4f 55 4c 44 20 4e 4f 54 20 52 45 IS SHOULD NOT RE
6870: 51 55 49 52 45 20 41 4e 20 45 58 49 54 21 21 21 QUIRE AN EXIT!!!
6880: 21 21 21 21 0a 20 20 20 20 0a 20 20 20 20 28 64 !!!!. . (d
6890: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e ebug:print 1 "IN
68a0: 46 4f 3a 20 41 6c 6c 20 74 65 73 74 73 20 6c 61 FO: All tests la
68b0: 75 6e 63 68 65 64 22 29 0a 20 20 20 20 28 74 68 unched"). (th
68c0: 72 65 61 64 2d 73 6c 65 65 70 21 20 30 2e 35 29 read-sleep! 0.5)
68d0: 0a 20 20 20 20 3b 3b 20 46 49 58 4d 45 21 20 54 . ;; FIXME! T
68e0: 68 69 73 20 68 61 72 73 68 20 65 78 69 74 20 73 his harsh exit s
68f0: 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 hould not be nec
6900: 65 73 73 61 72 79 2e 2e 2e 2e 0a 20 20 20 20 3b essary..... ;
6910: 3b 20 28 69 66 20 28 6e 6f 74 20 2a 72 75 6e 72 ; (if (not *runr
6920: 65 6d 6f 74 65 2a 29 28 65 78 69 74 29 29 20 3b emote*)(exit)) ;
6930: 3b 20 0a 20 20 20 20 23 66 29 29 20 3b 3b 20 72 ; . #f)) ;; r
6940: 65 74 75 72 6e 20 61 20 23 66 20 61 73 20 61 20 eturn a #f as a
6950: 68 69 6e 74 20 74 68 61 74 20 77 65 20 61 72 65 hint that we are
6960: 20 64 6f 6e 65 0a 20 20 3b 3b 20 48 65 72 65 20 done. ;; Here
6970: 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b we need to check
6980: 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 74 65 that all the te
6990: 73 74 73 20 72 65 6d 61 69 6e 69 6e 67 20 74 6f sts remaining to
69a0: 20 62 65 20 72 75 6e 20 61 72 65 20 65 6c 69 67 be run are elig
69b0: 69 62 6c 65 20 74 6f 20 72 75 6e 0a 20 20 3b 3b ible to run. ;;
69c0: 20 61 6e 64 20 61 72 65 20 6e 6f 74 20 62 6c 6f and are not blo
69d0: 63 6b 65 64 20 62 79 20 66 61 69 6c 65 64 0a 20 cked by failed.
69e0: 20 0a 0a 3b 3b 20 70 61 72 65 6e 74 2d 74 65 73 ..;; parent-tes
69f0: 74 20 69 73 20 74 68 65 72 65 20 61 73 20 61 20 t is there as a
6a00: 70 6c 61 63 65 68 6f 6c 64 65 72 20 66 6f 72 20 placeholder for
6a10: 77 68 65 6e 20 70 61 72 65 6e 74 2d 74 65 73 74 when parent-test
6a20: 73 20 63 61 6e 20 62 65 20 72 75 6e 20 61 73 20 s can be run as
6a30: 61 20 73 65 74 75 70 20 73 74 65 70 0a 28 64 65 a setup step.(de
6a40: 66 69 6e 65 20 28 72 75 6e 3a 74 65 73 74 20 72 fine (run:test r
6a50: 75 6e 2d 69 64 20 72 75 6e 6e 61 6d 65 20 6b 65 un-id runname ke
6a60: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 72 65 63 yvallst test-rec
6a70: 6f 72 64 20 66 6c 61 67 73 20 70 61 72 65 6e 74 ord flags parent
6a80: 2d 74 65 73 74 29 0a 20 20 3b 3b 20 41 6c 6c 20 -test). ;; All
6a90: 74 68 65 73 65 20 76 61 72 73 20 6d 69 67 68 74 these vars might
6aa0: 20 62 65 20 72 65 66 65 72 65 6e 63 65 64 20 62 be referenced b
6ab0: 79 20 74 68 65 20 74 65 73 74 63 6f 6e 66 69 67 y the testconfig
6ac0: 20 66 69 6c 65 20 72 65 61 64 65 72 0a 20 20 28 file reader. (
6ad0: 6c 65 74 2a 20 28 28 74 65 73 74 2d 6e 61 6d 65 let* ((test-name
6ae0: 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 (tests:testq
6af0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d ueue-get-testnam
6b00: 65 20 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 e test-record)
6b10: 29 0a 09 20 28 74 65 73 74 2d 77 61 69 74 6f 6e ).. (test-waiton
6b20: 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 s (tests:testque
6b30: 75 65 2d 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 ue-get-waitons
6b40: 20 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a test-record)).
6b50: 09 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 20 20 . (test-conf
6b60: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
6b70: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 -get-testconfig
6b80: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 test-record))..
6b90: 28 69 74 65 6d 64 61 74 20 20 20 20 20 20 28 74 (itemdat (t
6ba0: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 ests:testqueue-g
6bb0: 65 74 2d 69 74 65 6d 64 61 74 20 20 20 20 74 65 et-itemdat te
6bc0: 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 st-record)).. (t
6bd0: 65 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e est-path (con
6be0: 63 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 c *toppath* "/te
6bf0: 73 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 sts/" test-name)
6c00: 29 20 3b 3b 20 63 6f 75 6c 64 20 75 73 65 20 74 ) ;; could use t
6c10: 65 73 74 73 3a 67 65 74 2d 74 65 73 74 63 6f 6e ests:get-testcon
6c20: 66 69 67 20 68 65 72 65 20 2e 2e 2e 0a 09 20 28 fig here ..... (
6c30: 66 6f 72 63 65 20 20 20 20 20 20 20 20 28 68 61 force (ha
6c40: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
6c50: 61 75 6c 74 20 66 6c 61 67 73 20 22 2d 66 6f 72 ault flags "-for
6c60: 63 65 22 20 23 66 29 29 0a 09 20 28 72 65 72 75 ce" #f)).. (reru
6c70: 6e 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 n (hash-t
6c80: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
6c90: 20 66 6c 61 67 73 20 22 2d 72 65 72 75 6e 22 20 flags "-rerun"
6ca0: 23 66 29 29 0a 09 20 28 6b 65 65 70 67 6f 69 6e #f)).. (keepgoin
6cb0: 67 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 g (hash-table
6cc0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 -ref/default fla
6cd0: 67 73 20 22 2d 6b 65 65 70 67 6f 69 6e 67 22 20 gs "-keepgoing"
6ce0: 23 66 29 29 0a 09 20 28 69 74 65 6d 2d 70 61 74 #f)).. (item-pat
6cf0: 68 20 20 20 20 20 22 22 29 0a 09 20 28 64 62 20 h "").. (db
6d00: 20 20 20 20 20 20 20 20 20 20 23 66 29 29 0a 20 #f)).
6d10: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6d20: 34 0a 09 09 20 22 74 65 73 74 2d 63 6f 6e 66 69 4... "test-confi
6d30: 67 3a 20 22 20 28 68 61 73 68 2d 74 61 62 6c 65 g: " (hash-table
6d40: 2d 3e 61 6c 69 73 74 20 74 65 73 74 2d 63 6f 6e ->alist test-con
6d50: 66 29 0a 09 09 20 22 5c 6e 20 20 20 69 74 65 6d f)... "\n item
6d60: 64 61 74 3a 20 22 20 69 74 65 6d 64 61 74 0a 09 dat: " itemdat..
6d70: 09 20 29 0a 20 20 20 20 3b 3b 20 73 65 74 74 69 . ). ;; setti
6d80: 6e 67 20 69 74 65 6d 64 61 74 20 74 6f 20 61 20 ng itemdat to a
6d90: 6c 69 73 74 20 69 66 20 69 74 20 69 73 20 23 66 list if it is #f
6da0: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 69 74 . (if (not it
6db0: 65 6d 64 61 74 29 28 73 65 74 21 20 69 74 65 6d emdat)(set! item
6dc0: 64 61 74 20 27 28 29 29 29 0a 20 20 20 20 28 73 dat '())). (s
6dd0: 65 74 21 20 69 74 65 6d 2d 70 61 74 68 20 28 69 et! item-path (i
6de0: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 tem-list->path i
6df0: 74 65 6d 64 61 74 29 29 0a 20 20 20 20 28 64 65 temdat)). (de
6e00: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 41 74 74 bug:print 2 "Att
6e10: 65 6d 70 74 69 6e 67 20 74 6f 20 6c 61 75 6e 63 empting to launc
6e20: 68 20 74 65 73 74 20 22 20 74 65 73 74 2d 6e 61 h test " test-na
6e30: 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 69 me (if (equal? i
6e40: 74 65 6d 2d 70 61 74 68 20 22 2f 22 29 20 22 2f tem-path "/") "/
6e50: 22 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 20 20 " item-path)).
6e60: 20 20 28 73 65 74 65 6e 76 20 22 4d 54 5f 54 45 (setenv "MT_TE
6e70: 53 54 5f 4e 41 4d 45 22 20 74 65 73 74 2d 6e 61 ST_NAME" test-na
6e80: 6d 65 29 20 3b 3b 20 0a 20 20 20 20 28 73 65 74 me) ;; . (set
6e90: 65 6e 76 20 22 4d 54 5f 52 55 4e 4e 41 4d 45 22 env "MT_RUNNAME"
6ea0: 20 20 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 runname).
6eb0: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
6ec0: 73 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 set-megatest-env
6ed0: 2d 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 -vars db run-id)
6ee0: 20 3b 3b 20 74 68 65 73 65 20 6d 61 79 20 62 65 ;; these may be
6ef0: 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 6c needed by the l
6f00: 61 75 6e 63 68 69 6e 67 20 70 72 6f 63 65 73 73 aunching process
6f10: 0a 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 . (change-dir
6f20: 65 63 74 6f 72 79 20 2a 74 6f 70 70 61 74 68 2a ectory *toppath*
6f30: 29 0a 0a 20 20 20 20 3b 3b 20 48 65 72 65 20 69 ).. ;; Here i
6f40: 73 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 s where the test
6f50: 5f 6d 65 74 61 20 74 61 62 6c 65 20 69 73 20 62 _meta table is b
6f60: 65 73 74 20 75 70 64 61 74 65 64 0a 20 20 20 20 est updated.
6f70: 3b 3b 20 59 65 73 2c 20 61 6e 6f 74 68 65 72 20 ;; Yes, another
6f80: 75 73 65 20 6f 66 20 61 20 67 6c 6f 62 61 6c 20 use of a global
6f90: 66 6f 72 20 63 61 63 68 69 6e 67 2e 20 4e 65 65 for caching. Nee
6fa0: 64 20 61 20 62 65 74 74 65 72 20 77 61 79 3f 0a d a better way?.
6fb0: 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 68 61 (if (not (ha
6fc0: 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 sh-table-ref/def
6fd0: 61 75 6c 74 20 2a 74 65 73 74 2d 6d 65 74 61 2d ault *test-meta-
6fe0: 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d 6e 61 updated* test-na
6ff0: 6d 65 20 23 66 29 29 0a 20 20 20 20 20 20 20 20 me #f)).
7000: 28 62 65 67 69 6e 0a 09 20 20 20 28 68 61 73 68 (begin.. (hash
7010: 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a 74 65 73 -table-set! *tes
7020: 74 2d 6d 65 74 61 2d 75 70 64 61 74 65 64 2a 20 t-meta-updated*
7030: 74 65 73 74 2d 6e 61 6d 65 20 23 74 29 0a 20 20 test-name #t).
7040: 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 (open-r
7050: 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 75 70 un-close runs:up
7060: 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 61 20 64 date-test_meta d
7070: 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 65 73 74 b test-name test
7080: 2d 63 6f 6e 66 29 29 29 0a 20 20 20 20 0a 20 20 -conf))). .
7090: 20 20 3b 3b 20 28 6c 61 6d 62 64 61 20 28 69 74 ;; (lambda (it
70a0: 65 6d 64 61 74 29 20 3b 3b 3b 20 28 28 72 69 70 emdat) ;;; ((rip
70b0: 65 6e 65 73 73 20 22 6f 76 65 72 72 69 70 65 22 eness "overripe"
70c0: 29 20 28 74 65 6d 70 65 72 61 74 75 72 65 20 22 ) (temperature "
70d0: 63 6f 6f 6c 22 29 20 28 73 65 61 73 6f 6e 20 22 cool") (season "
70e0: 73 75 6d 6d 65 72 22 29 29 0a 20 20 20 20 28 6c summer")). (l
70f0: 65 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 70 et* ((new-test-p
7100: 61 74 68 20 28 73 74 72 69 6e 67 2d 69 6e 74 65 ath (string-inte
7110: 72 73 70 65 72 73 65 20 28 63 6f 6e 73 20 74 65 rsperse (cons te
7120: 73 74 2d 70 61 74 68 20 28 6d 61 70 20 63 61 64 st-path (map cad
7130: 72 20 69 74 65 6d 64 61 74 29 29 20 22 2f 22 29 r itemdat)) "/")
7140: 29 0a 09 20 20 20 28 6e 65 77 2d 74 65 73 74 2d ).. (new-test-
7150: 6e 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f name (if (equal?
7160: 20 69 74 65 6d 2d 70 61 74 68 20 22 22 29 20 74 item-path "") t
7170: 65 73 74 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 est-name (conc t
7180: 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 est-name "/" ite
7190: 6d 2d 70 61 74 68 29 29 29 20 3b 3b 20 6a 75 73 m-path))) ;; jus
71a0: 74 20 6e 65 65 64 20 69 74 20 74 6f 20 62 65 20 t need it to be
71b0: 75 6e 69 71 75 65 0a 09 20 20 20 28 74 65 73 74 unique.. (test
71c0: 2d 69 64 20 20 20 20 20 20 20 28 6f 70 65 6e 2d -id (open-
71d0: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 run-close db:get
71e0: 2d 74 65 73 74 2d 69 64 20 64 62 20 20 72 75 6e -test-id db run
71f0: 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 -id test-name it
7200: 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 20 28 74 em-path)).. (t
7210: 65 73 74 64 61 74 20 20 20 20 20 20 20 28 6f 70 estdat (op
7220: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
7230: 67 65 74 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 get-test-info-by
7240: 2d 69 64 20 64 62 20 74 65 73 74 2d 69 64 29 29 -id db test-id))
7250: 29 0a 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 ). (if (not
7260: 20 74 65 73 74 64 61 74 29 0a 09 20 20 28 62 65 testdat).. (be
7270: 67 69 6e 0a 09 20 20 20 20 3b 3b 20 65 6e 73 75 gin.. ;; ensu
7280: 72 65 20 74 68 61 74 20 74 68 65 20 70 61 74 68 re that the path
7290: 20 65 78 69 73 74 73 20 62 65 66 6f 72 65 20 72 exists before r
72a0: 65 67 69 73 74 65 72 69 6e 67 20 74 68 65 20 74 egistering the t
72b0: 65 73 74 0a 09 20 20 20 20 3b 3b 20 4e 4f 50 45 est.. ;; NOPE
72c0: 3a 20 43 61 6e 6e 6f 74 21 20 44 6f 6e 27 74 20 : Cannot! Don't
72d0: 6b 6e 6f 77 20 79 65 74 20 77 68 69 63 68 20 64 know yet which d
72e0: 69 73 6b 20 61 72 65 61 20 77 69 6c 6c 20 62 65 isk area will be
72f0: 20 61 73 73 69 67 6e 65 64 2e 2e 2e 2e 0a 09 20 assigned......
7300: 20 20 20 3b 3b 20 28 73 79 73 74 65 6d 20 28 63 ;; (system (c
7310: 6f 6e 63 20 22 6d 6b 64 69 72 20 2d 70 20 22 20 onc "mkdir -p "
7320: 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 29 29 0a new-test-path)).
7330: 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 . ;;.. ;;
7340: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
7350: 74 65 73 74 73 3a 72 65 67 69 73 74 65 72 2d 74 tests:register-t
7360: 65 73 74 20 64 62 20 72 75 6e 2d 69 64 20 74 65 est db run-id te
7370: 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 st-name item-pat
7380: 68 29 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 h).. ;;..
7390: 3b 3b 20 4e 42 2f 2f 20 66 6f 72 20 74 68 65 20 ;; NB// for the
73a0: 61 62 6f 76 65 20 6c 69 6e 65 2e 20 49 20 77 61 above line. I wa
73b0: 6e 74 20 74 68 65 20 74 65 73 74 20 74 6f 20 62 nt the test to b
73c0: 65 20 72 65 67 69 73 74 65 72 65 64 20 6c 6f 6e e registered lon
73d0: 67 20 62 65 66 6f 72 65 20 74 68 69 73 20 72 6f g before this ro
73e0: 75 74 69 6e 65 20 67 65 74 73 20 63 61 6c 6c 65 utine gets calle
73f0: 64 21 0a 09 20 20 20 20 3b 3b 0a 09 20 20 20 20 d!.. ;;..
7400: 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f (set! test-id (o
7410: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
7420: 3a 67 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 :get-test-id db
7430: 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 run-id test-name
7440: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 item-path))..
7450: 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 2d (if (not test-
7460: 69 64 29 0a 09 09 28 62 65 67 69 6e 0a 09 09 20 id)...(begin...
7470: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
7480: 22 57 41 52 4e 3a 20 54 65 73 74 20 6e 6f 74 20 "WARN: Test not
7490: 70 72 65 2d 63 72 65 61 74 65 64 3f 20 74 65 73 pre-created? tes
74a0: 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 t-name=" test-na
74b0: 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d me ", item-path=
74c0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 2c 20 72 " item-path ", r
74d0: 75 6e 2d 69 64 3d 22 20 72 75 6e 2d 69 64 29 0a un-id=" run-id).
74e0: 09 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c .. (open-run-cl
74f0: 6f 73 65 20 64 62 3a 74 65 73 74 73 2d 72 65 67 ose db:tests-reg
7500: 69 73 74 65 72 2d 74 65 73 74 20 23 66 20 72 75 ister-test #f ru
7510: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
7520: 74 65 6d 2d 70 61 74 68 29 0a 09 09 20 20 28 73 tem-path)... (s
7530: 65 74 21 20 74 65 73 74 2d 69 64 20 28 6f 70 65 et! test-id (ope
7540: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 n-run-close db:g
7550: 65 74 2d 74 65 73 74 2d 69 64 20 64 62 20 72 75 et-test-id db ru
7560: 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 n-id test-name i
7570: 74 65 6d 2d 70 61 74 68 29 29 29 29 0a 09 20 20 tem-path))))..
7580: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 (debug:print 4
7590: 20 22 49 4e 46 4f 3a 20 74 65 73 74 2d 69 64 3d "INFO: test-id=
75a0: 22 20 74 65 73 74 2d 69 64 20 22 2c 20 72 75 6e " test-id ", run
75b0: 2d 69 64 3d 22 20 72 75 6e 2d 69 64 20 22 2c 20 -id=" run-id ",
75c0: 74 65 73 74 2d 6e 61 6d 65 3d 22 20 74 65 73 74 test-name=" test
75d0: 2d 6e 61 6d 65 20 22 2c 20 69 74 65 6d 2d 70 61 -name ", item-pa
75e0: 74 68 3d 5c 22 22 20 69 74 65 6d 2d 70 61 74 68 th=\"" item-path
75f0: 20 22 5c 22 22 29 0a 09 20 20 20 20 28 73 65 74 "\"").. (set
7600: 21 20 74 65 73 74 64 61 74 20 28 6f 70 65 6e 2d ! testdat (open-
7610: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 run-close db:get
7620: 2d 74 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 -test-info-by-id
7630: 20 64 62 20 74 65 73 74 2d 69 64 29 29 29 29 0a db test-id)))).
7640: 20 20 20 20 20 20 28 73 65 74 21 20 74 65 73 74 (set! test
7650: 2d 69 64 20 28 64 62 3a 74 65 73 74 2d 67 65 74 -id (db:test-get
7660: 2d 69 64 20 74 65 73 74 64 61 74 29 29 0a 20 20 -id testdat)).
7670: 20 20 20 20 28 63 68 61 6e 67 65 2d 64 69 72 65 (change-dire
7680: 63 74 6f 72 79 20 74 65 73 74 2d 70 61 74 68 29 ctory test-path)
7690: 0a 20 20 20 20 20 20 28 63 61 73 65 20 28 69 66 . (case (if
76a0: 20 66 6f 72 63 65 20 3b 3b 20 28 61 72 67 73 3a force ;; (args:
76b0: 67 65 74 2d 61 72 67 20 22 2d 66 6f 72 63 65 22 get-arg "-force"
76c0: 29 0a 09 09 27 4e 4f 54 5f 53 54 41 52 54 45 44 )...'NOT_STARTED
76d0: 0a 09 09 28 69 66 20 74 65 73 74 64 61 74 0a 09 ...(if testdat..
76e0: 09 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 . (string->sy
76f0: 6d 62 6f 6c 20 28 74 65 73 74 3a 67 65 74 2d 73 mbol (test:get-s
7700: 74 61 74 65 20 74 65 73 74 64 61 74 29 29 0a 09 tate testdat))..
7710: 09 20 20 20 20 27 66 61 69 6c 65 64 2d 74 6f 2d . 'failed-to-
7720: 69 6e 73 65 72 74 29 29 0a 09 28 28 66 61 69 6c insert))..((fail
7730: 65 64 2d 74 6f 2d 69 6e 73 65 72 74 29 0a 09 20 ed-to-insert)..
7740: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
7750: 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f ERROR: Failed to
7760: 20 69 6e 73 65 72 74 20 74 68 65 20 72 65 63 6f insert the reco
7770: 72 64 20 69 6e 74 6f 20 74 68 65 20 64 62 22 29 rd into the db")
7780: 29 0a 09 28 28 4e 4f 54 5f 53 54 41 52 54 45 44 )..((NOT_STARTED
7790: 20 43 4f 4d 50 4c 45 54 45 44 20 44 45 4c 45 54 COMPLETED DELET
77a0: 45 44 29 0a 09 20 28 6c 65 74 20 28 28 72 75 6e ED).. (let ((run
77b0: 66 6c 61 67 20 23 66 29 29 0a 09 20 20 20 28 63 flag #f)).. (c
77c0: 6f 6e 64 0a 09 20 20 20 20 3b 3b 20 2d 66 6f 72 ond.. ;; -for
77d0: 63 65 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 74 65 ce, run no matte
77e0: 72 20 77 68 61 74 0a 09 20 20 20 20 28 66 6f 72 r what.. (for
77f0: 63 65 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 ce (set! runflag
7800: 20 23 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 4f #t)).. ;; NO
7810: 54 5f 53 54 41 52 54 45 44 2c 20 72 75 6e 20 6e T_STARTED, run n
7820: 6f 20 6d 61 74 74 65 72 20 77 68 61 74 0a 09 20 o matter what..
7830: 20 20 20 28 28 6d 65 6d 62 65 72 20 28 74 65 73 ((member (tes
7840: 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 74 t:get-state test
7850: 64 61 74 29 20 27 28 22 44 45 4c 45 54 45 44 22 dat) '("DELETED"
7860: 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 29 "NOT_STARTED"))
7870: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
7880: 29 29 0a 09 20 20 20 20 3b 3b 20 6e 6f 74 20 2d )).. ;; not -
7890: 72 65 72 75 6e 20 61 6e 64 20 50 41 53 53 2c 20 rerun and PASS,
78a0: 57 41 52 4e 20 6f 72 20 43 48 45 43 4b 2c 20 64 WARN or CHECK, d
78b0: 6f 20 6e 6f 20 72 75 6e 0a 09 20 20 20 20 28 28 o no run.. ((
78c0: 61 6e 64 20 28 6f 72 20 28 6e 6f 74 20 72 65 72 and (or (not rer
78d0: 75 6e 29 0a 09 09 20 20 20 20 20 20 6b 65 65 70 un)... keep
78e0: 67 6f 69 6e 67 29 0a 09 09 20 20 3b 3b 20 52 65 going)... ;; Re
78f0: 71 75 69 72 65 20 74 6f 20 66 6f 72 63 65 20 72 quire to force r
7900: 65 2d 72 75 6e 20 66 6f 72 20 43 4f 4d 50 4c 45 e-run for COMPLE
7910: 54 45 44 20 6f 72 20 2a 61 6e 79 74 68 69 6e 67 TED or *anything
7920: 2a 20 2b 20 50 41 53 53 2c 57 41 52 4e 20 6f 72 * + PASS,WARN or
7930: 20 43 48 45 43 4b 0a 09 09 20 20 28 6f 72 20 28 CHECK... (or (
7940: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 member (test:get
7950: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
7960: 20 27 28 22 50 41 53 53 22 20 22 57 41 52 4e 22 '("PASS" "WARN"
7970: 20 22 43 48 45 43 4b 22 29 29 0a 09 09 20 20 20 "CHECK"))...
7980: 20 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 (member (test
7990: 3a 67 65 74 2d 73 74 61 74 65 20 20 74 65 73 74 :get-state test
79a0: 64 61 74 29 20 27 28 22 43 4f 4d 50 4c 45 54 45 dat) '("COMPLETE
79b0: 44 22 29 29 29 29 20 0a 09 20 20 20 20 20 28 64 D")))) .. (d
79c0: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e ebug:print 2 "IN
79d0: 46 4f 3a 20 72 75 6e 6e 69 6e 67 20 74 65 73 74 FO: running test
79e0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 " test-name "/"
79f0: 20 69 74 65 6d 2d 70 61 74 68 20 22 20 73 75 70 item-path " sup
7a00: 70 72 65 73 73 65 64 20 61 73 20 69 74 20 69 73 pressed as it is
7a10: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
7a20: 74 65 20 74 65 73 74 64 61 74 29 20 22 20 61 6e te testdat) " an
7a30: 64 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 d " (test:get-st
7a40: 61 74 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 atus testdat))..
7a50: 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 6c (set! runfl
7a60: 61 67 20 23 66 29 29 0a 09 20 20 20 20 3b 3b 20 ag #f)).. ;;
7a70: 2d 72 65 72 75 6e 20 61 6e 64 20 73 74 61 74 75 -rerun and statu
7a80: 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 s is one of the
7a90: 73 70 65 63 69 66 65 64 2c 20 72 75 6e 20 69 74 specifed, run it
7aa0: 0a 09 20 20 20 20 28 28 61 6e 64 20 72 65 72 75 .. ((and reru
7ab0: 6e 0a 09 09 20 20 28 6c 65 74 2a 20 28 28 72 65 n... (let* ((re
7ac0: 72 75 6e 6c 73 74 20 20 20 28 73 74 72 69 6e 67 runlst (string
7ad0: 2d 73 70 6c 69 74 20 72 65 72 75 6e 20 22 2c 22 -split rerun ","
7ae0: 29 29 0a 09 09 09 20 28 6d 75 73 74 2d 72 65 72 )).... (must-rer
7af0: 75 6e 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 un (member (test
7b00: 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 :get-status test
7b10: 64 61 74 29 20 72 65 72 75 6e 6c 73 74 29 29 29 dat) rerunlst)))
7b20: 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 ... (debug:pr
7b30: 69 6e 74 20 33 20 22 49 4e 46 4f 3a 20 2d 72 65 int 3 "INFO: -re
7b40: 72 75 6e 20 6c 69 73 74 3a 20 22 20 72 65 72 75 run list: " reru
7b50: 6e 20 22 2c 20 74 65 73 74 2d 73 74 61 74 75 73 n ", test-status
7b60: 3a 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 : " (test:get-st
7b70: 61 74 75 73 20 74 65 73 74 64 61 74 29 22 2c 20 atus testdat)",
7b80: 6d 75 73 74 2d 72 65 72 75 6e 3a 20 22 20 6d 75 must-rerun: " mu
7b90: 73 74 2d 72 65 72 75 6e 29 0a 09 09 20 20 20 20 st-rerun)...
7ba0: 6d 75 73 74 2d 72 65 72 75 6e 29 29 0a 09 20 20 must-rerun))..
7bb0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
7bc0: 32 20 22 49 4e 46 4f 3a 20 52 65 72 75 6e 20 66 2 "INFO: Rerun f
7bd0: 6f 72 63 65 64 20 66 6f 72 20 74 65 73 74 20 22 orced for test "
7be0: 20 74 65 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 test-name "/" i
7bf0: 74 65 6d 2d 70 61 74 68 29 0a 09 20 20 20 20 20 tem-path)..
7c00: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 (set! runflag #t
7c10: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 6b 65 65 70 )).. ;; -keep
7c20: 67 6f 69 6e 67 2c 20 64 6f 20 6e 6f 74 20 72 65 going, do not re
7c30: 72 75 6e 20 46 41 49 4c 0a 09 20 20 20 20 28 28 run FAIL.. ((
7c40: 61 6e 64 20 6b 65 65 70 67 6f 69 6e 67 0a 09 09 and keepgoing...
7c50: 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 74 3a (member (test:
7c60: 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 74 64 get-status testd
7c70: 61 74 29 20 27 28 22 46 41 49 4c 22 29 29 29 0a at) '("FAIL"))).
7c80: 09 20 20 20 20 20 28 73 65 74 21 20 72 75 6e 66 . (set! runf
7c90: 6c 61 67 20 23 66 29 29 0a 09 20 20 20 20 28 28 lag #f)).. ((
7ca0: 61 6e 64 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a and (not rerun).
7cb0: 09 09 20 20 28 6d 65 6d 62 65 72 20 28 74 65 73 .. (member (tes
7cc0: 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t:get-status tes
7cd0: 74 64 61 74 29 20 27 28 22 46 41 49 4c 22 20 22 tdat) '("FAIL" "
7ce0: 6e 2f 61 22 29 29 29 0a 09 20 20 20 20 20 28 73 n/a"))).. (s
7cf0: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
7d00: 0a 09 20 20 20 20 28 65 6c 73 65 20 28 73 65 74 .. (else (set
7d10: 21 20 72 75 6e 66 6c 61 67 20 23 66 29 29 29 0a ! runflag #f))).
7d20: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 . (debug:print
7d30: 20 36 20 22 52 55 4e 4e 49 4e 47 20 3d 3e 20 72 6 "RUNNING => r
7d40: 75 6e 66 6c 61 67 3a 20 22 20 72 75 6e 66 6c 61 unflag: " runfla
7d50: 67 20 22 20 53 54 41 54 45 3a 20 22 20 28 74 65 g " STATE: " (te
7d60: 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 73 st:get-state tes
7d70: 74 64 61 74 29 20 22 20 53 54 41 54 55 53 3a 20 tdat) " STATUS:
7d80: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
7d90: 75 73 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 us testdat))..
7da0: 20 28 69 66 20 28 6e 6f 74 20 72 75 6e 66 6c 61 (if (not runfla
7db0: 67 29 0a 09 20 20 20 20 20 20 20 28 69 66 20 28 g).. (if (
7dc0: 6e 6f 74 20 70 61 72 65 6e 74 2d 74 65 73 74 29 not parent-test)
7dd0: 0a 09 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 ... (debug:pri
7de0: 6e 74 20 31 20 22 4e 4f 54 45 3a 20 4e 6f 74 20 nt 1 "NOTE: Not
7df0: 73 74 61 72 74 69 6e 67 20 74 65 73 74 20 22 20 starting test "
7e00: 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 22 20 new-test-name "
7e10: 61 73 20 69 74 20 69 73 20 73 74 61 74 65 20 5c as it is state \
7e20: 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 "" (test:get-sta
7e30: 74 65 20 74 65 73 74 64 61 74 29 20 0a 09 09 09 te testdat) ....
7e40: 09 22 5c 22 20 61 6e 64 20 73 74 61 74 75 73 20 ."\" and status
7e50: 5c 22 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 \"" (test:get-st
7e60: 61 74 75 73 20 74 65 73 74 64 61 74 29 20 22 5c atus testdat) "\
7e70: 22 2c 20 75 73 65 20 2d 72 65 72 75 6e 20 5c 22 ", use -rerun \"
7e80: 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 " (test:get-stat
7e90: 75 73 20 74 65 73 74 64 61 74 29 0a 20 20 20 20 us testdat).
7ea0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7eb0: 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 "\"
7ec0: 6f 72 20 2d 66 6f 72 63 65 20 74 6f 20 6f 76 65 or -force to ove
7ed0: 72 72 69 64 65 22 29 29 0a 09 20 20 20 20 20 20 rride"))..
7ee0: 20 3b 3b 20 4e 4f 54 45 3a 20 4e 6f 20 6c 6f 6e ;; NOTE: No lon
7ef0: 67 65 72 20 62 65 20 63 68 65 63 6b 69 6e 67 20 ger be checking
7f00: 70 72 65 72 65 71 75 69 73 69 74 65 73 20 68 65 prerequisites he
7f10: 72 65 21 20 57 69 6c 6c 20 6e 65 76 65 72 20 67 re! Will never g
7f20: 65 74 20 68 65 72 65 20 75 6e 6c 65 73 73 20 70 et here unless p
7f30: 72 65 72 65 71 73 20 61 72 65 0a 09 20 20 20 20 rereqs are..
7f40: 20 20 20 3b 3b 20 20 20 20 20 20 20 61 6c 72 65 ;; alre
7f50: 61 64 79 20 6d 65 74 2e 0a 09 20 20 20 20 20 20 ady met...
7f60: 20 28 69 66 20 28 6e 6f 74 20 28 6c 61 75 6e 63 (if (not (launc
7f70: 68 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 h-test #f run-id
7f80: 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 63 6f runname test-co
7f90: 6e 66 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 nf keyvallst tes
7fa0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 70 61 74 68 t-name test-path
7fb0: 20 69 74 65 6d 64 61 74 20 66 6c 61 67 73 29 29 itemdat flags))
7fc0: 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 20 ... (begin...
7fd0: 20 20 20 20 28 70 72 69 6e 74 20 22 45 52 52 4f (print "ERRO
7fe0: 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c 61 75 R: Failed to lau
7ff0: 6e 63 68 20 74 68 65 20 74 65 73 74 2e 20 45 78 nch the test. Ex
8000: 69 74 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 iting as soon as
8010: 20 70 6f 73 73 69 62 6c 65 22 29 0a 09 09 20 20 possible")...
8020: 20 20 20 28 73 65 74 21 20 2a 67 6c 6f 62 61 6c (set! *global
8030: 65 78 69 74 73 74 61 74 75 73 2a 20 31 29 20 3b exitstatus* 1) ;
8040: 3b 20 0a 09 09 20 20 20 20 20 28 70 72 6f 63 65 ; ... (proce
8050: 73 73 2d 73 69 67 6e 61 6c 20 28 63 75 72 72 65 ss-signal (curre
8060: 6e 74 2d 70 72 6f 63 65 73 73 2d 69 64 29 20 73 nt-process-id) s
8070: 69 67 6e 61 6c 2f 6b 69 6c 6c 29 29 29 29 29 29 ignal/kill))))))
8080: 0a 09 28 28 4b 49 4c 4c 45 44 29 20 0a 09 20 28 ..((KILLED) .. (
8090: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 4e debug:print 1 "N
80a0: 4f 54 45 3a 20 22 20 6e 65 77 2d 74 65 73 74 2d OTE: " new-test-
80b0: 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 65 61 64 name " is alread
80c0: 79 20 72 75 6e 6e 69 6e 67 20 6f 72 20 77 61 73 y running or was
80d0: 20 65 78 70 6c 69 63 74 6c 79 20 6b 69 6c 6c 65 explictly kille
80e0: 64 2c 20 75 73 65 20 2d 66 6f 72 63 65 20 74 6f d, use -force to
80f0: 20 6c 61 75 6e 63 68 20 69 74 2e 22 29 29 0a 09 launch it."))..
8100: 28 28 4c 41 55 4e 43 48 45 44 20 52 45 4d 4f 54 ((LAUNCHED REMOT
8110: 45 48 4f 53 54 53 54 41 52 54 20 52 55 4e 4e 49 EHOSTSTART RUNNI
8120: 4e 47 29 20 20 0a 09 20 28 69 66 20 28 3e 20 28 NG) .. (if (> (
8130: 2d 20 28 63 75 72 72 65 6e 74 2d 73 65 63 6f 6e - (current-secon
8140: 64 73 29 28 2b 20 28 64 62 3a 74 65 73 74 2d 67 ds)(+ (db:test-g
8150: 65 74 2d 65 76 65 6e 74 5f 74 69 6d 65 20 74 65 et-event_time te
8160: 73 74 64 61 74 29 0a 09 09 09 09 20 20 20 20 20 stdat).....
8170: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 (db:test-get-r
8180: 75 6e 5f 64 75 72 61 74 69 6f 6e 20 74 65 73 74 un_duration test
8190: 64 61 74 29 29 29 0a 09 09 36 30 30 29 20 3b 3b dat)))...600) ;;
81a0: 20 69 2e 65 2e 20 6e 6f 20 75 70 64 61 74 65 20 i.e. no update
81b0: 66 6f 72 20 6d 6f 72 65 20 74 68 61 6e 20 36 30 for more than 60
81c0: 30 20 73 65 63 6f 6e 64 73 0a 09 20 20 20 20 20 0 seconds..
81d0: 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 28 (begin.. (
81e0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
81f0: 41 52 4e 49 4e 47 3a 20 54 65 73 74 20 22 20 74 ARNING: Test " t
8200: 65 73 74 2d 6e 61 6d 65 20 22 20 61 70 70 65 61 est-name " appea
8210: 72 73 20 74 6f 20 62 65 20 64 65 61 64 2e 20 46 rs to be dead. F
8220: 6f 72 63 69 6e 67 20 69 74 20 74 6f 20 73 74 61 orcing it to sta
8230: 74 65 20 49 4e 43 4f 4d 50 4c 45 54 45 20 61 6e te INCOMPLETE an
8240: 64 20 73 74 61 74 75 73 20 53 54 55 43 4b 2f 44 d status STUCK/D
8250: 45 41 44 22 29 0a 09 20 20 20 20 20 20 20 28 74 EAD").. (t
8260: 65 73 74 73 3a 74 65 73 74 2d 73 65 74 2d 73 74 ests:test-set-st
8270: 61 74 75 73 21 20 74 65 73 74 2d 69 64 20 22 49 atus! test-id "I
8280: 4e 43 4f 4d 50 4c 45 54 45 22 20 22 53 54 55 43 NCOMPLETE" "STUC
8290: 4b 2f 44 45 41 44 22 20 22 54 65 73 74 20 69 73 K/DEAD" "Test is
82a0: 20 73 74 75 63 6b 20 6f 72 20 64 65 61 64 22 20 stuck or dead"
82b0: 23 66 29 29 0a 09 20 20 20 20 20 28 64 65 62 75 #f)).. (debu
82c0: 67 3a 70 72 69 6e 74 20 32 20 22 4e 4f 54 45 3a g:print 2 "NOTE:
82d0: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 69 " test-name " i
82e0: 73 20 61 6c 72 65 61 64 79 20 72 75 6e 6e 69 6e s already runnin
82f0: 67 22 29 29 29 0a 09 28 65 6c 73 65 20 20 20 20 g")))..(else
8300: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
8310: 30 20 22 45 52 52 4f 52 3a 20 46 61 69 6c 65 64 0 "ERROR: Failed
8320: 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 74 20 to launch test
8330: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 " new-test-name
8340: 22 2e 20 55 6e 72 65 63 6f 67 6e 69 73 65 64 20 ". Unrecognised
8350: 73 74 61 74 65 20 22 20 28 74 65 73 74 3a 67 65 state " (test:ge
8360: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
8370: 29 29 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d ))))))..;;======
8380: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8390: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
83a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
83b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
83c0: 0a 3b 3b 20 45 4e 44 20 4f 46 20 4e 45 57 20 53 .;; END OF NEW S
83d0: 54 55 46 46 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d TUFF.;;=========
83e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
83f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8400: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8410: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 =============..(
8420: 64 65 66 69 6e 65 20 28 67 65 74 2d 64 69 72 2d define (get-dir-
8430: 75 70 2d 6e 20 64 69 72 20 2e 20 70 61 72 61 6d up-n dir . param
8440: 73 29 20 0a 20 20 28 6c 65 74 20 28 28 64 70 61 s) . (let ((dpa
8450: 72 74 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c rts (string-spl
8460: 69 74 20 64 69 72 20 22 2f 22 29 29 0a 09 28 63 it dir "/"))..(c
8470: 6f 75 6e 74 20 20 20 28 69 66 20 28 6e 75 6c 6c ount (if (null
8480: 3f 20 70 61 72 61 6d 73 29 20 31 20 28 63 61 72 ? params) 1 (car
8490: 20 70 61 72 61 6d 73 29 29 29 29 0a 20 20 20 20 params)))).
84a0: 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 6e (conc "/" (strin
84b0: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a 09 g-intersperse ..
84c0: 20 20 20 20 20 20 20 28 74 61 6b 65 20 64 70 61 (take dpa
84d0: 72 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 rts (- (length d
84e0: 70 61 72 74 73 29 20 63 6f 75 6e 74 29 29 0a 09 parts) count))..
84f0: 20 20 20 20 20 20 20 22 2f 22 29 29 29 29 0a 3b "/")))).;
8500: 3b 20 52 65 6d 6f 76 65 20 72 75 6e 73 0a 3b 3b ; Remove runs.;;
8510: 20 66 69 65 6c 64 73 20 61 72 65 20 70 61 73 73 fields are pass
8520: 69 6e 67 20 69 6e 20 74 68 72 6f 75 67 68 20 0a ing in through .
8530: 3b 3b 20 61 63 74 69 6f 6e 3a 0a 3b 3b 20 20 20 ;; action:.;;
8540: 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 0a 3b 3b 'remove-runs.;;
8550: 20 20 20 20 27 73 65 74 2d 73 74 61 74 65 2d 73 'set-state-s
8560: 74 61 74 75 73 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f tatus.;;.;; NB//
8570: 20 73 68 6f 75 6c 64 20 70 61 73 73 20 69 6e 20 should pass in
8580: 6b 65 79 73 3f 0a 3b 3b 0a 28 64 65 66 69 6e 65 keys?.;;.(define
8590: 20 28 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f (runs:operate-o
85a0: 6e 20 61 63 74 69 6f 6e 20 72 75 6e 6e 61 6d 65 n action runname
85b0: 70 61 74 74 20 74 65 73 74 70 61 74 74 20 69 74 patt testpatt it
85c0: 65 6d 70 61 74 74 20 23 21 6b 65 79 20 28 73 74 empatt #!key (st
85d0: 61 74 65 20 23 66 29 28 73 74 61 74 75 73 20 23 ate #f)(status #
85e0: 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 f)(new-state-sta
85f0: 74 75 73 20 23 66 29 29 0a 20 20 28 6c 65 74 2a tus #f)). (let*
8600: 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 20 ((db
8610: 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 20 20 #f).. (keys
8620: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
8630: 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 73 20 ose db:get-keys
8640: 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 20 20 db)).. (rundat
8650: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
8660: 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 lose runs:get-ru
8670: 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 ns-by-patt db ke
8680: 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 29 29 ys runnamepatt))
8690: 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 20 20 .. (header
86a0: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e (vector-ref run
86b0: 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 dat 0)).. (runs
86c0: 20 20 20 20 20 20 20 20 28 76 65 63 74 6f 72 2d (vector-
86d0: 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 0a 09 ref rundat 1))..
86e0: 20 28 73 74 61 74 65 73 20 20 20 20 20 20 20 28 (states (
86f0: 69 66 20 73 74 61 74 65 20 20 28 73 74 72 69 6e if state (strin
8700: 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 20 22 g-split state "
8710: 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 74 61 ,") '())).. (sta
8720: 74 75 73 65 73 20 20 20 20 20 28 69 66 20 73 74 tuses (if st
8730: 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 70 6c atus (string-spl
8740: 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 20 27 it status ",") '
8750: 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d 73 74 ())).. (state-st
8760: 61 74 75 73 20 28 69 66 20 28 73 74 72 69 6e 67 atus (if (string
8770: 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 ? new-state-stat
8780: 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 us) (string-spli
8790: 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 t new-state-stat
87a0: 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 66 29 us ",") '(#f #f)
87b0: 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 ))). (debug:p
87c0: 72 69 6e 74 20 32 20 22 48 65 61 64 65 72 3a 20 rint 2 "Header:
87d0: 22 20 68 65 61 64 65 72 20 22 20 61 63 74 69 6f " header " actio
87e0: 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 6e 65 n: " action " ne
87f0: 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 3a 20 w-state-status:
8800: 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 " new-state-stat
8810: 75 73 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 us). (for-eac
8820: 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 h. (lambda (
8830: 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 run). (let
8840: 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 69 6e ((runkey (strin
8850: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d g-intersperse (m
8860: 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 0a 09 ap (lambda (k)..
8870: 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 61 6c .....(db:get-val
8880: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
8890: 20 68 65 61 64 65 72 20 28 76 65 63 74 6f 72 2d header (vector-
88a0: 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 73 29 ref k 0))) keys)
88b0: 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 64 69 "/")).. (di
88c0: 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 6d 61 rs-to-remove (ma
88d0: 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 ke-hash-table)))
88e0: 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e 2d 69 .. (let* ((run-i
88f0: 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 61 6c d (db:get-val
8900: 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e ue-by-header run
8910: 20 68 65 61 64 65 72 20 22 69 64 22 29 29 0a 09 header "id"))..
8920: 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 62 3a .(run-state (db:
8930: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
8940: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
8950: 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 73 74 state"))...(test
8960: 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 s (if (not (
8970: 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 74 65 equal? run-state
8980: 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 09 20 "locked"))....
8990: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
89a0: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 close db:get-tes
89b0: 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 28 64 ts-for-run db (d
89c0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
89d0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
89e0: 20 22 69 64 22 29 0a 09 09 09 09 09 09 20 20 20 "id").......
89f0: 20 20 20 74 65 73 74 70 61 74 74 20 69 74 65 6d testpatt item
8a00: 70 61 74 74 20 73 74 61 74 65 73 20 73 74 61 74 patt states stat
8a10: 75 73 65 73 0a 09 09 09 09 09 09 20 20 20 20 20 uses.......
8a20: 20 6e 6f 74 2d 69 6e 3a 20 20 23 66 0a 09 09 09 not-in: #f....
8a30: 09 09 09 20 20 20 20 20 20 73 6f 72 74 2d 62 79 ... sort-by
8a40: 3a 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 : (case action..
8a50: 09 09 09 09 09 09 09 20 28 28 72 65 6d 6f 76 65 ....... ((remove
8a60: 2d 72 75 6e 73 29 20 27 72 75 6e 64 69 72 29 0a -runs) 'rundir).
8a70: 09 09 09 09 09 09 09 09 20 28 65 6c 73 65 20 20 ........ (else
8a80: 20 20 20 20 20 20 20 20 27 65 76 65 6e 74 5f 74 'event_t
8a90: 69 6d 65 29 29 29 0a 09 09 09 20 20 20 20 20 20 ime)))....
8aa0: 20 27 28 29 29 29 0a 09 09 28 6c 61 73 74 74 70 '()))...(lasttp
8ab0: 61 74 68 20 22 2f 64 6f 65 73 2f 6e 6f 74 2f 65 ath "/does/not/e
8ac0: 78 69 73 74 2f 49 2f 68 6f 70 65 22 29 29 0a 0a xist/I/hope"))..
8ad0: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 . (if (not (nu
8ae0: 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 ll? tests))..
8af0: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 (begin... (c
8b00: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 ase action...
8b10: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 ((remove-runs)..
8b20: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
8b30: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 t 1 "Removing te
8b40: 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 sts for run: " r
8b50: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 unkey " " (db:ge
8b60: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
8b70: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 r run header "ru
8b80: 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 nname")))... (
8b90: 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 (set-state-statu
8ba0: 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a s)... (debug:
8bb0: 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 print 1 "Modifyi
8bc0: 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 ng state and sta
8bd0: 75 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 us for tests for
8be0: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 run: " runkey "
8bf0: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 " (db:get-value
8c00: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
8c10: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 eader "runname")
8c20: 29 29 0a 09 09 20 20 20 28 65 6c 73 65 0a 09 09 ))... (else...
8c30: 20 20 20 20 28 70 72 69 6e 74 20 22 49 4e 46 4f (print "INFO
8c40: 3a 20 61 63 74 69 6f 6e 20 6e 6f 74 20 72 65 63 : action not rec
8c50: 6f 67 6e 69 73 65 64 20 22 20 61 63 74 69 6f 6e ognised " action
8c60: 29 29 29 0a 09 09 20 28 66 6f 72 2d 65 61 63 68 )))... (for-each
8c70: 0a 09 09 20 20 28 6c 61 6d 62 64 61 20 28 74 65 ... (lambda (te
8c80: 73 74 29 0a 09 09 20 20 20 20 28 6c 65 74 2a 20 st)... (let*
8c90: 28 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a ((item-path (db:
8ca0: 74 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 test-get-item-pa
8cb0: 74 68 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 th test))....
8cc0: 28 74 65 73 74 2d 6e 61 6d 65 20 28 64 62 3a 74 (test-name (db:t
8cd0: 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 est-get-testname
8ce0: 20 74 65 73 74 29 29 0a 09 09 09 20 20 20 28 72 test)).... (r
8cf0: 75 6e 2d 64 69 72 20 20 20 28 64 62 3a 74 65 73 un-dir (db:tes
8d00: 74 2d 67 65 74 2d 72 75 6e 64 69 72 20 74 65 73 t-get-rundir tes
8d10: 74 29 29 0a 09 09 09 20 20 20 28 74 65 73 74 2d t)).... (test-
8d20: 69 64 20 20 20 28 64 62 3a 74 65 73 74 2d 67 65 id (db:test-ge
8d30: 74 2d 69 64 20 74 65 73 74 29 29 29 0a 09 09 20 t-id test)))...
8d40: 20 20 20 20 20 3b 3b 20 20 20 28 74 64 62 20 20 ;; (tdb
8d50: 20 20 20 20 20 28 64 62 3a 6f 70 65 6e 2d 74 65 (db:open-te
8d60: 73 74 2d 64 62 20 72 75 6e 2d 64 69 72 29 29 29 st-db run-dir)))
8d70: 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 67 3a ... (debug:
8d80: 70 72 69 6e 74 20 31 20 22 20 20 22 20 28 64 62 print 1 " " (db
8d90: 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 74 6e 61 :test-get-testna
8da0: 6d 65 20 74 65 73 74 29 20 22 20 69 64 3a 20 22 me test) " id: "
8db0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 (db:test-get-id
8dc0: 20 74 65 73 74 29 20 22 20 22 20 69 74 65 6d 2d test) " " item-
8dd0: 70 61 74 68 20 22 20 61 63 74 69 6f 6e 3a 20 22 path " action: "
8de0: 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 20 20 action)...
8df0: 20 28 63 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 (case action...
8e00: 09 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 .((remove-runs)
8e10: 3b 3b 20 74 68 65 20 74 64 62 20 69 73 20 66 6f ;; the tdb is fo
8e20: 72 20 66 75 74 75 72 65 20 70 6f 73 73 69 62 6c r future possibl
8e30: 65 2e 20 0a 09 09 09 20 28 6f 70 65 6e 2d 72 75 e. .... (open-ru
8e40: 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 n-close db:delet
8e50: 65 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 e-test-records d
8e60: 62 20 23 66 20 28 64 62 3a 74 65 73 74 2d 67 65 b #f (db:test-ge
8e70: 74 2d 69 64 20 74 65 73 74 29 29 0a 09 09 09 20 t-id test))....
8e80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
8e90: 49 4e 46 4f 3a 20 41 74 74 65 6d 70 74 69 6e 67 INFO: Attempting
8ea0: 20 74 6f 20 72 65 6d 6f 76 65 20 64 69 72 20 22 to remove dir "
8eb0: 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 20 28 69 run-dir).... (i
8ec0: 66 20 28 61 6e 64 20 28 3e 20 28 73 74 72 69 6e f (and (> (strin
8ed0: 67 2d 6c 65 6e 67 74 68 20 72 75 6e 2d 64 69 72 g-length run-dir
8ee0: 29 20 35 29 0a 09 09 09 09 20 20 28 66 69 6c 65 ) 5)..... (file
8ef0: 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 69 72 -exists? run-dir
8f00: 29 29 20 3b 3b 20 62 61 64 20 68 65 75 72 69 73 )) ;; bad heuris
8f10: 74 69 63 20 62 75 74 20 73 68 6f 75 6c 64 20 70 tic but should p
8f20: 72 65 76 65 6e 74 20 2f 74 6d 70 20 2f 68 6f 6d revent /tmp /hom
8f30: 65 20 65 74 63 2e 0a 09 09 09 20 20 20 20 20 28 e etc..... (
8f40: 6c 65 74 2a 20 28 28 72 65 61 6c 70 61 74 68 20 let* ((realpath
8f50: 28 72 65 73 6f 6c 76 65 2d 70 61 74 68 6e 61 6d (resolve-pathnam
8f60: 65 20 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 e run-dir)))....
8f70: 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 (debug:pr
8f80: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 52 65 61 int 1 "INFO: Rea
8f90: 6c 20 70 61 74 68 20 6f 66 20 69 73 20 22 20 72 l path of is " r
8fa0: 65 61 6c 70 61 74 68 29 0a 09 09 09 20 20 20 20 ealpath)....
8fb0: 20 20 20 28 69 66 20 28 66 69 6c 65 2d 65 78 69 (if (file-exi
8fc0: 73 74 73 3f 20 72 65 61 6c 70 61 74 68 29 0a 09 sts? realpath)..
8fd0: 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 73 79 ... (if (> (sy
8fe0: 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 20 2d stem (conc "rm -
8ff0: 72 66 20 22 20 72 65 61 6c 70 61 74 68 29 29 20 rf " realpath))
9000: 30 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 0)..... (d
9010: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
9020: 52 4f 52 3a 20 54 68 65 72 65 20 77 61 73 20 61 ROR: There was a
9030: 20 70 72 6f 62 6c 65 6d 20 72 65 6d 6f 76 69 6e problem removin
9040: 67 20 22 20 72 65 61 6c 70 61 74 68 20 22 20 77 g " realpath " w
9050: 69 74 68 20 72 6d 20 2d 66 22 29 29 0a 09 09 09 ith rm -f"))....
9060: 09 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 . (debug:print
9070: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 74 65 73 0 "WARNING: tes
9080: 74 20 72 75 6e 20 64 69 72 20 22 20 72 65 61 6c t run dir " real
9090: 70 61 74 68 20 22 20 61 70 70 65 61 72 73 20 74 path " appears t
90a0: 6f 20 6e 6f 74 20 65 78 69 73 74 22 29 29 0a 09 o not exist"))..
90b0: 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 69 .. (if (fi
90c0: 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e 2d 64 le-exists? run-d
90d0: 69 72 29 20 3b 3b 20 74 68 65 20 6c 69 6e 6b 0a ir) ;; the link.
90e0: 09 09 09 09 20 20 20 28 69 66 20 28 73 79 6d 62 .... (if (symb
90f0: 6f 6c 69 63 2d 6c 69 6e 6b 3f 20 72 75 6e 2d 64 olic-link? run-d
9100: 69 72 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 ir)..... (
9110: 64 65 6c 65 74 65 2d 66 69 6c 65 20 72 75 6e 2d delete-file run-
9120: 64 69 72 29 0a 09 09 09 09 20 20 20 20 20 20 20 dir).....
9130: 28 69 66 20 28 64 69 72 65 63 74 6f 72 79 3f 20 (if (directory?
9140: 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 09 20 20 run-dir)......
9150: 20 28 69 66 20 28 3e 20 28 64 69 72 65 63 74 6f (if (> (directo
9160: 72 79 2d 66 6f 6c 64 20 28 6c 61 6d 62 64 61 20 ry-fold (lambda
9170: 28 66 20 78 29 28 2b 20 31 20 78 29 29 20 30 20 (f x)(+ 1 x)) 0
9180: 72 75 6e 2d 64 69 72 29 20 30 29 0a 09 09 09 09 run-dir) 0).....
9190: 09 20 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 . (debug:p
91a0: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
91b0: 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 65 6d refusing to rem
91c0: 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 22 20 ove " run-dir "
91d0: 61 73 20 69 74 20 69 73 20 6e 6f 74 20 65 6d 70 as it is not emp
91e0: 74 79 22 29 0a 09 09 09 09 09 20 20 20 20 20 20 ty")......
91f0: 20 28 64 65 6c 65 74 65 2d 64 69 72 65 63 74 6f (delete-directo
9200: 72 79 20 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 ry run-dir)) ;;
9210: 69 74 20 73 68 6f 75 6c 64 20 62 65 20 65 6d 70 it should be emp
9220: 74 79 20 62 79 20 68 65 72 65 20 42 55 47 20 42 ty by here BUG B
9230: 55 47 2c 20 61 64 64 20 65 72 72 6f 72 20 63 61 UG, add error ca
9240: 74 63 68 0a 09 09 09 09 09 20 20 20 28 64 65 62 tch...... (deb
9250: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
9260: 52 3a 20 72 65 66 75 73 69 6e 67 20 74 6f 20 72 R: refusing to r
9270: 65 6d 6f 76 65 20 22 20 72 75 6e 2d 64 69 72 20 emove " run-dir
9280: 22 20 61 73 20 69 74 20 69 73 20 6e 65 69 74 68 " as it is neith
9290: 65 72 20 61 20 73 79 6d 6c 69 6e 6b 20 6e 6f 72 er a symlink nor
92a0: 20 61 20 64 69 72 65 63 74 6f 72 79 22 29 0a 09 a directory")..
92b0: 09 09 09 09 20 20 20 29 29 29 29 0a 09 09 09 20 .... ))))....
92c0: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
92d0: 20 30 20 22 57 41 52 4e 49 4e 47 3a 20 64 69 72 0 "WARNING: dir
92e0: 65 63 74 6f 72 79 20 61 6c 72 65 61 64 79 20 72 ectory already r
92f0: 65 6d 6f 76 65 64 20 22 20 72 75 6e 2d 64 69 72 emoved " run-dir
9300: 29 29 29 0a 09 09 09 28 28 73 65 74 2d 73 74 61 )))....((set-sta
9310: 74 65 2d 73 74 61 74 75 73 29 0a 09 09 09 20 28 te-status).... (
9320: 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 debug:print 2 "I
9330: 4e 46 4f 3a 20 6e 65 77 20 73 74 61 74 65 20 22 NFO: new state "
9340: 20 28 63 61 72 20 73 74 61 74 65 2d 73 74 61 74 (car state-stat
9350: 75 73 29 20 22 2c 20 6e 65 77 20 73 74 61 74 75 us) ", new statu
9360: 73 20 22 20 28 63 61 64 72 20 73 74 61 74 65 2d s " (cadr state-
9370: 73 74 61 74 75 73 29 29 0a 09 09 09 20 28 6f 70 status)).... (op
9380: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a en-run-close db:
9390: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 65 2d 73 test-set-state-s
93a0: 74 61 74 75 73 2d 62 79 2d 69 64 20 64 62 20 28 tatus-by-id db (
93b0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
93c0: 65 73 74 29 20 28 63 61 72 20 73 74 61 74 65 2d est) (car state-
93d0: 73 74 61 74 75 73 29 28 63 61 64 72 20 73 74 61 status)(cadr sta
93e0: 74 65 2d 73 74 61 74 75 73 29 20 23 66 29 29 29 te-status) #f)))
93f0: 29 29 0a 09 09 20 20 74 65 73 74 73 29 29 29 0a ))... tests))).
9400: 09 20 20 20 0a 09 20 20 20 3b 3b 20 72 65 6d 6f . .. ;; remo
9410: 76 65 20 74 68 65 20 72 75 6e 20 69 66 20 7a 65 ve the run if ze
9420: 72 6f 20 74 65 73 74 73 20 72 65 6d 61 69 6e 0a ro tests remain.
9430: 09 20 20 20 28 69 66 20 28 65 71 3f 20 61 63 74 . (if (eq? act
9440: 69 6f 6e 20 27 72 65 6d 6f 76 65 2d 72 75 6e 73 ion 'remove-runs
9450: 29 0a 09 20 20 20 20 20 20 20 28 6c 65 74 20 28 ).. (let (
9460: 28 72 65 6d 74 65 73 74 73 20 28 6f 70 65 6e 2d (remtests (open-
9470: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 run-close db:get
9480: 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 -tests-for-run d
9490: 62 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d b (db:get-value-
94a0: 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 by-header run he
94b0: 61 64 65 72 20 22 69 64 22 29 20 23 66 20 23 66 ader "id") #f #f
94c0: 20 27 28 22 44 45 4c 45 54 45 44 22 29 20 27 28 '("DELETED") '(
94d0: 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 6e 3a 20 23 "n/a") not-in: #
94e0: 74 29 29 29 0a 09 09 20 28 69 66 20 28 6e 75 6c t)))... (if (nul
94f0: 6c 3f 20 72 65 6d 74 65 73 74 73 29 20 3b 3b 20 l? remtests) ;;
9500: 6e 6f 20 6d 6f 72 65 20 74 65 73 74 73 20 72 65 no more tests re
9510: 6d 61 69 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 maining... (
9520: 6c 65 74 2a 20 28 28 64 70 61 72 74 73 20 20 28 let* ((dparts (
9530: 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 6c 61 73 string-split las
9540: 74 74 70 61 74 68 20 22 2f 22 29 29 0a 09 09 09 ttpath "/"))....
9550: 20 20 20 20 28 72 75 6e 70 61 74 68 20 28 63 6f (runpath (co
9560: 6e 63 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 nc "/" (string-i
9570: 6e 74 65 72 73 70 65 72 73 65 20 0a 09 09 09 09 ntersperse .....
9580: 09 09 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 ..(take dparts (
9590: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
95a0: 29 20 31 29 29 0a 09 09 09 09 09 09 22 2f 22 29 ) 1))......."/")
95b0: 29 29 29 0a 09 09 20 20 20 20 20 20 20 28 64 65 )))... (de
95c0: 62 75 67 3a 70 72 69 6e 74 20 31 20 22 52 65 6d bug:print 1 "Rem
95d0: 6f 76 69 6e 67 20 72 75 6e 3a 20 22 20 72 75 6e oving run: " run
95e0: 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 74 2d key " " (db:get-
95f0: 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 value-by-header
9600: 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 6e 6e run header "runn
9610: 61 6d 65 22 29 20 22 20 61 6e 64 20 72 65 6c 61 ame") " and rela
9620: 74 65 64 20 72 65 63 6f 72 64 22 29 0a 09 09 20 ted record")...
9630: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
9640: 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 2d close db:delete-
9650: 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 run db run-id)..
9660: 09 20 20 20 20 20 20 20 3b 3b 20 54 68 69 73 20 . ;; This
9670: 69 73 20 61 20 70 72 65 74 74 79 20 67 6f 6f 64 is a pretty good
9680: 20 70 6c 61 63 65 20 74 6f 20 70 75 72 67 65 20 place to purge
9690: 6f 6c 64 20 44 45 4c 45 54 45 44 20 74 65 73 74 old DELETED test
96a0: 73 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e s... (open
96b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 -run-close db:de
96c0: 6c 65 74 65 2d 74 65 73 74 73 2d 66 6f 72 2d 72 lete-tests-for-r
96d0: 75 6e 20 64 62 20 72 75 6e 2d 69 64 29 0a 09 09 un db run-id)...
96e0: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e (open-run
96f0: 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c 65 74 65 -close db:delete
9700: 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 2d 74 65 73 -old-deleted-tes
9710: 74 2d 72 65 63 6f 72 64 73 20 64 62 29 0a 09 09 t-records db)...
9720: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e (open-run
9730: 2d 63 6c 6f 73 65 20 64 62 3a 73 65 74 2d 76 61 -close db:set-va
9740: 72 20 64 62 20 22 44 45 4c 45 54 45 44 5f 54 45 r db "DELETED_TE
9750: 53 54 53 22 20 28 63 75 72 72 65 6e 74 2d 73 65 STS" (current-se
9760: 63 6f 6e 64 73 29 29 0a 09 09 20 20 20 20 20 20 conds))...
9770: 20 3b 3b 20 6e 65 65 64 20 74 6f 20 66 69 67 75 ;; need to figu
9780: 72 65 20 6f 75 74 20 74 68 65 20 70 61 74 68 20 re out the path
9790: 74 6f 20 74 68 65 20 72 75 6e 20 64 69 72 20 61 to the run dir a
97a0: 6e 64 20 72 65 6d 6f 76 65 20 69 74 20 69 66 20 nd remove it if
97b0: 65 6d 70 74 79 0a 09 09 20 20 20 20 20 20 20 3b empty... ;
97c0: 3b 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 ; (if (null?
97d0: 28 67 6c 6f 62 20 28 63 6f 6e 63 20 72 75 6e 70 (glob (conc runp
97e0: 61 74 68 20 22 2f 2a 22 29 29 29 0a 09 09 20 20 ath "/*")))...
97f0: 20 20 20 20 20 3b 3b 20 20 20 20 20 20 20 20 28 ;; (
9800: 62 65 67 69 6e 0a 09 09 20 20 20 20 20 20 20 3b begin... ;
9810: 3b 20 09 20 28 64 65 62 75 67 3a 70 72 69 6e 74 ; . (debug:print
9820: 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 1 "Removing run
9830: 20 64 69 72 20 22 20 72 75 6e 70 61 74 68 29 0a dir " runpath).
9840: 09 09 20 20 20 20 20 20 20 3b 3b 20 09 20 28 73 .. ;; . (s
9850: 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 72 6d 64 ystem (conc "rmd
9860: 69 72 20 2d 70 20 22 20 72 75 6e 70 61 74 68 29 ir -p " runpath)
9870: 29 29 29 0a 09 09 20 20 20 20 20 20 20 29 29 29 )))... )))
9880: 29 29 0a 09 20 29 29 0a 20 20 20 20 20 72 75 6e )).. )). run
9890: 73 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d s)))..;;========
98a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
98b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
98c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
98d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
98e0: 3b 20 52 6f 75 74 69 6e 65 73 20 66 6f 72 20 6d ; Routines for m
98f0: 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 75 6e 73 anipulating runs
9900: 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .;;=============
9910: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9920: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9930: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
9940: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 53 69 =========..;; Si
9950: 6e 63 65 20 6d 61 6e 79 20 63 61 6c 6c 73 20 74 nce many calls t
9960: 6f 20 61 20 72 75 6e 20 72 65 71 75 69 72 65 20 o a run require
9970: 70 72 65 74 74 79 20 6d 75 63 68 20 74 68 65 20 pretty much the
9980: 73 61 6d 65 20 73 65 74 75 70 20 0a 3b 3b 20 74 same setup .;; t
9990: 68 69 73 20 77 72 61 70 70 65 72 20 69 73 20 75 his wrapper is u
99a0: 73 65 64 20 74 6f 20 72 65 64 75 63 65 20 74 68 sed to reduce th
99b0: 65 20 72 65 70 6c 69 63 61 74 69 6f 6e 20 6f 66 e replication of
99c0: 20 63 6f 64 65 0a 28 64 65 66 69 6e 65 20 28 67 code.(define (g
99d0: 65 6e 65 72 61 6c 2d 72 75 6e 2d 63 61 6c 6c 20 eneral-run-call
99e0: 73 77 69 74 63 68 6e 61 6d 65 20 61 63 74 69 6f switchname actio
99f0: 6e 2d 64 65 73 63 20 70 72 6f 63 29 0a 20 20 28 n-desc proc). (
9a00: 6c 65 74 20 28 28 72 75 6e 6e 61 6d 65 20 28 61 let ((runname (a
9a10: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 3a 72 75 rgs:get-arg ":ru
9a20: 6e 6e 61 6d 65 22 29 29 0a 09 28 74 61 72 67 65 nname"))..(targe
9a30: 74 20 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 t (if (args:get
9a40: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a -arg "-target").
9a50: 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 .. (args:get
9a60: 2d 61 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a -arg "-target").
9a70: 09 09 20 20 20 20 20 28 61 72 67 73 3a 67 65 74 .. (args:get
9a80: 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 -arg "-reqtarg")
9a90: 29 29 0a 09 28 74 68 31 20 20 20 20 20 23 66 29 ))..(th1 #f)
9aa0: 29 0a 20 20 20 20 28 63 6f 6e 64 0a 20 20 20 20 ). (cond.
9ab0: 20 28 28 6e 6f 74 20 74 61 72 67 65 74 29 0a 20 ((not target).
9ac0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
9ad0: 74 20 30 20 22 45 52 52 4f 52 3a 20 4d 69 73 73 t 0 "ERROR: Miss
9ae0: 69 6e 67 20 72 65 71 75 69 72 65 64 20 70 61 72 ing required par
9af0: 61 6d 65 74 65 72 20 66 6f 72 20 22 20 73 77 69 ameter for " swi
9b00: 74 63 68 6e 61 6d 65 20 22 2c 20 79 6f 75 20 6d tchname ", you m
9b10: 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 20 ust specify the
9b20: 74 61 72 67 65 74 20 77 69 74 68 20 2d 74 61 72 target with -tar
9b30: 67 65 74 22 29 0a 20 20 20 20 20 20 28 65 78 69 get"). (exi
9b40: 74 20 33 29 29 0a 20 20 20 20 20 28 28 6e 6f 74 t 3)). ((not
9b50: 20 72 75 6e 6e 61 6d 65 29 0a 20 20 20 20 20 20 runname).
9b60: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
9b70: 45 52 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 ERROR: Missing r
9b80: 65 71 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 equired paramete
9b90: 72 20 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 r for " switchna
9ba0: 6d 65 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 me ", you must s
9bb0: 70 65 63 69 66 79 20 74 68 65 20 72 75 6e 20 6e pecify the run n
9bc0: 61 6d 65 20 77 69 74 68 20 3a 72 75 6e 6e 61 6d ame with :runnam
9bd0: 65 20 72 75 6e 6e 61 6d 65 22 29 0a 20 20 20 20 e runname").
9be0: 20 20 28 65 78 69 74 20 33 29 29 0a 20 20 20 20 (exit 3)).
9bf0: 20 28 65 6c 73 65 0a 20 20 20 20 20 20 28 6c 65 (else. (le
9c00: 74 20 28 28 64 62 20 20 20 23 66 29 0a 09 20 20 t ((db #f)..
9c10: 20 20 28 6b 65 79 73 20 23 66 29 29 0a 09 28 69 (keys #f))..(i
9c20: 66 20 28 6e 6f 74 20 28 73 65 74 75 70 2d 66 6f f (not (setup-fo
9c30: 72 2d 72 75 6e 29 29 0a 09 20 20 20 20 28 62 65 r-run)).. (be
9c40: 67 69 6e 20 0a 09 20 20 20 20 20 20 28 64 65 62 gin .. (deb
9c50: 75 67 3a 70 72 69 6e 74 20 30 20 22 46 61 69 6c ug:print 0 "Fail
9c60: 65 64 20 74 6f 20 73 65 74 75 70 2c 20 65 78 69 ed to setup, exi
9c70: 74 69 6e 67 22 29 0a 09 20 20 20 20 20 20 28 65 ting").. (e
9c80: 78 69 74 20 31 29 29 29 0a 09 28 69 66 20 28 61 xit 1)))..(if (a
9c90: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 rgs:get-arg "-se
9ca0: 72 76 65 72 22 29 0a 09 20 20 20 20 28 6f 70 65 rver").. (ope
9cb0: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 72 76 n-run-close serv
9cc0: 65 72 3a 73 74 61 72 74 20 64 62 20 28 61 72 67 er:start db (arg
9cd0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 73 65 72 76 s:get-arg "-serv
9ce0: 65 72 22 29 29 0a 20 09 20 20 20 20 28 69 66 20 er")). . (if
9cf0: 28 6e 6f 74 20 28 6f 72 20 28 61 72 67 73 3a 67 (not (or (args:g
9d00: 65 74 2d 61 72 67 20 22 2d 72 75 6e 61 6c 6c 22 et-arg "-runall"
9d10: 29 20 20 20 20 20 3b 3b 20 72 75 6e 61 6c 6c 20 ) ;; runall
9d20: 61 6e 64 20 72 75 6e 74 65 73 74 73 20 61 72 65 and runtests are
9d30: 20 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 73 allowed to be s
9d40: 65 72 76 65 72 73 0a 20 09 09 09 20 28 61 72 67 ervers. ... (arg
9d50: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 75 6e 74 s:get-arg "-runt
9d60: 65 73 74 73 22 29 29 29 0a 09 09 28 73 65 72 76 ests")))...(serv
9d70: 65 72 3a 63 6c 69 65 6e 74 2d 73 65 74 75 70 29 er:client-setup)
9d80: 29 29 0a 09 28 73 65 74 21 20 6b 65 79 73 20 28 ))..(set! keys (
9d90: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
9da0: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b:get-keys db)).
9db0: 09 3b 3b 20 68 61 76 65 20 65 6e 6f 75 67 68 20 .;; have enough
9dc0: 74 6f 20 70 72 6f 63 65 73 73 20 2d 74 61 72 67 to process -targ
9dd0: 65 74 20 6f 72 20 2d 72 65 71 74 61 72 67 20 68 et or -reqtarg h
9de0: 65 72 65 0a 09 28 69 66 20 28 61 72 67 73 3a 67 ere..(if (args:g
9df0: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 et-arg "-reqtarg
9e00: 22 29 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 ").. (let* ((
9e10: 72 75 6e 63 6f 6e 66 69 67 66 20 28 63 6f 6e 63 runconfigf (conc
9e20: 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 72 75 *toppath* "/ru
9e30: 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 67 22 nconfigs.config"
9e40: 29 29 20 3b 3b 20 44 4f 20 4e 4f 54 20 45 56 41 )) ;; DO NOT EVA
9e50: 4c 55 41 54 45 20 41 4c 4c 20 0a 09 09 20 20 20 LUATE ALL ...
9e60: 28 72 75 6e 63 6f 6e 66 69 67 20 20 28 72 65 61 (runconfig (rea
9e70: 64 2d 63 6f 6e 66 69 67 20 72 75 6e 63 6f 6e 66 d-config runconf
9e80: 69 67 66 20 23 66 20 23 66 20 65 6e 76 69 72 6f igf #f #f enviro
9e90: 6e 2d 70 61 74 74 3a 20 23 66 29 29 29 20 0a 09 n-patt: #f))) ..
9ea0: 20 20 20 20 20 20 28 69 66 20 28 68 61 73 68 2d (if (hash-
9eb0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
9ec0: 74 20 72 75 6e 63 6f 6e 66 69 67 20 28 61 72 67 t runconfig (arg
9ed0: 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 74 s:get-arg "-reqt
9ee0: 61 72 67 22 29 20 23 66 29 0a 09 09 20 20 28 6b arg") #f)... (k
9ef0: 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 2d 61 eys:target-set-a
9f00: 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 3a 67 rgs keys (args:g
9f10: 65 74 2d 61 72 67 20 22 2d 72 65 71 74 61 72 67 et-arg "-reqtarg
9f20: 22 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 ") args:arg-hash
9f30: 29 0a 09 09 20 20 28 62 65 67 69 6e 0a 09 09 20 )... (begin...
9f40: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
9f50: 30 20 22 45 52 52 4f 52 3a 20 5b 22 20 28 61 72 0 "ERROR: [" (ar
9f60: 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 72 65 71 gs:get-arg "-req
9f70: 74 61 72 67 22 29 20 22 5d 20 6e 6f 74 20 66 6f targ") "] not fo
9f80: 75 6e 64 20 69 6e 20 22 20 72 75 6e 63 6f 6e 66 und in " runconf
9f90: 69 67 66 29 0a 09 09 20 20 20 20 28 69 66 20 64 igf)... (if d
9fa0: 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e 61 6c b (sqlite3:final
9fb0: 69 7a 65 21 20 64 62 29 29 0a 09 09 20 20 20 20 ize! db))...
9fc0: 28 65 78 69 74 20 31 29 29 29 29 0a 09 20 20 20 (exit 1))))..
9fd0: 20 28 69 66 20 28 61 72 67 73 3a 67 65 74 2d 61 (if (args:get-a
9fe0: 72 67 20 22 2d 74 61 72 67 65 74 22 29 0a 09 09 rg "-target")...
9ff0: 28 6b 65 79 73 3a 74 61 72 67 65 74 2d 73 65 74 (keys:target-set
a000: 2d 61 72 67 73 20 6b 65 79 73 20 28 61 72 67 73 -args keys (args
a010: 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 72 67 65 :get-arg "-targe
a020: 74 22 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 t" args:arg-hash
a030: 29 20 61 72 67 73 3a 61 72 67 2d 68 61 73 68 29 ) args:arg-hash)
a040: 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 28 63 61 ))..(if (not (ca
a050: 72 20 2a 63 6f 6e 66 69 67 69 6e 66 6f 2a 29 29 r *configinfo*))
a060: 0a 09 20 20 20 20 28 62 65 67 69 6e 0a 09 20 20 .. (begin..
a070: 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 (debug:print
a080: 20 30 20 22 45 52 52 4f 52 3a 20 41 74 74 65 6d 0 "ERROR: Attem
a090: 70 74 65 64 20 74 6f 20 22 20 61 63 74 69 6f 6e pted to " action
a0a0: 2d 64 65 73 63 20 22 20 62 75 74 20 72 75 6e 20 -desc " but run
a0b0: 61 72 65 61 20 63 6f 6e 66 69 67 20 66 69 6c 65 area config file
a0c0: 20 6e 6f 74 20 66 6f 75 6e 64 22 29 0a 09 20 20 not found")..
a0d0: 20 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 (exit 1))..
a0e0: 20 20 20 3b 3b 20 45 78 74 72 61 63 74 20 6f 75 ;; Extract ou
a0f0: 74 20 73 74 75 66 66 20 6e 65 65 64 65 64 20 69 t stuff needed i
a100: 6e 20 6d 6f 73 74 20 6f 72 20 6d 61 6e 79 20 63 n most or many c
a110: 61 6c 6c 73 0a 09 20 20 20 20 3b 3b 20 68 65 72 alls.. ;; her
a120: 65 20 74 68 65 6e 20 63 61 6c 6c 20 70 72 6f 63 e then call proc
a130: 0a 09 20 20 20 20 28 6c 65 74 2a 20 28 28 6b 65 .. (let* ((ke
a140: 79 6e 61 6d 65 73 20 20 20 28 6d 61 70 20 6b 65 ynames (map ke
a150: 79 3a 67 65 74 2d 66 69 65 6c 64 6e 61 6d 65 20 y:get-fieldname
a160: 6b 65 79 73 29 29 0a 09 09 20 20 20 28 6b 65 79 keys))... (key
a170: 76 61 6c 6c 73 74 20 20 28 6b 65 79 73 2d 3e 76 vallst (keys->v
a180: 61 6c 6c 69 73 74 20 6b 65 79 73 20 23 74 29 29 allist keys #t))
a190: 29 0a 09 20 20 20 20 20 20 28 70 72 6f 63 20 74 ).. (proc t
a1a0: 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 6b 65 arget runname ke
a1b0: 79 73 20 6b 65 79 6e 61 6d 65 73 20 6b 65 79 76 ys keynames keyv
a1c0: 61 6c 6c 73 74 29 29 29 0a 09 28 69 66 20 74 68 allst)))..(if th
a1d0: 31 20 28 74 68 72 65 61 64 2d 6a 6f 69 6e 21 20 1 (thread-join!
a1e0: 74 68 31 29 29 0a 09 28 69 66 20 64 62 20 28 73 th1))..(if db (s
a1f0: 71 6c 69 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 qlite3:finalize!
a200: 20 64 62 29 29 0a 09 28 73 65 74 21 20 2a 64 69 db))..(set! *di
a210: 64 73 6f 6d 65 74 68 69 6e 67 2a 20 23 74 29 29 dsomething* #t))
a220: 29 29 29 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d ))))..;;========
a230: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a240: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a250: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a260: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b ==============.;
a270: 3b 20 4c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 72 75 ; Lock/unlock ru
a280: 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ns.;;===========
a290: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a2a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a2b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a2c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 ===========..(de
a2d0: 66 69 6e 65 20 28 72 75 6e 73 3a 68 61 6e 64 6c fine (runs:handl
a2e0: 65 2d 6c 6f 63 6b 69 6e 67 20 74 61 72 67 65 74 e-locking target
a2f0: 20 6b 65 79 73 20 72 75 6e 6e 61 6d 65 20 6c 6f keys runname lo
a300: 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 72 29 0a ck unlock user).
a310: 20 20 28 6c 65 74 2a 20 28 28 64 62 20 20 20 20 (let* ((db
a320: 20 20 20 23 66 29 0a 09 20 28 72 75 6e 64 61 74 #f).. (rundat
a330: 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f (open-run-clo
a340: 73 65 20 72 75 6e 73 3a 67 65 74 2d 72 75 6e 73 se runs:get-runs
a350: 2d 62 79 2d 70 61 74 74 20 64 62 20 6b 65 79 73 -by-patt db keys
a360: 20 72 75 6e 6e 61 6d 65 29 29 0a 09 20 28 68 65 runname)).. (he
a370: 61 64 65 72 20 20 20 28 76 65 63 74 6f 72 2d 72 ader (vector-r
a380: 65 66 20 72 75 6e 64 61 74 20 30 29 29 0a 09 20 ef rundat 0))..
a390: 28 72 75 6e 73 20 20 20 20 20 28 76 65 63 74 6f (runs (vecto
a3a0: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 r-ref rundat 1))
a3b0: 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 ). (for-each
a3c0: 28 6c 61 6d 62 64 61 20 28 72 75 6e 29 0a 09 09 (lambda (run)...
a3d0: 28 6c 65 74 20 28 28 72 75 6e 2d 69 64 20 28 64 (let ((run-id (d
a3e0: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
a3f0: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
a400: 20 22 69 64 22 29 29 29 0a 09 09 20 20 28 69 66 "id")))... (if
a410: 20 28 6f 72 20 6c 6f 63 6b 0a 09 09 09 20 20 28 (or lock.... (
a420: 61 6e 64 20 75 6e 6c 6f 63 6b 0a 09 09 09 20 20 and unlock....
a430: 20 20 20 20 20 28 62 65 67 69 6e 0a 09 09 09 09 (begin.....
a440: 20 28 70 72 69 6e 74 20 22 44 6f 20 79 6f 75 20 (print "Do you
a450: 72 65 61 6c 6c 79 20 77 69 73 68 20 74 6f 20 75 really wish to u
a460: 6e 6c 6f 63 6b 20 72 75 6e 20 22 20 72 75 6e 2d nlock run " run-
a470: 69 64 20 22 3f 5c 6e 20 20 20 79 2f 6e 3a 20 22 id "?\n y/n: "
a480: 29 0a 09 09 09 09 20 28 65 71 75 61 6c 3f 20 22 )..... (equal? "
a490: 79 22 20 28 72 65 61 64 2d 6c 69 6e 65 29 29 29 y" (read-line)))
a4a0: 29 29 0a 09 09 20 20 20 20 20 20 28 6f 70 65 6e ))... (open
a4b0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 6c 6f -run-close db:lo
a4c0: 63 6b 2f 75 6e 6c 6f 63 6b 2d 72 75 6e 20 64 62 ck/unlock-run db
a4d0: 20 72 75 6e 2d 69 64 20 6c 6f 63 6b 20 75 6e 6c run-id lock unl
a4e0: 6f 63 6b 20 75 73 65 72 29 0a 09 09 20 20 20 20 ock user)...
a4f0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
a500: 20 22 49 4e 46 4f 3a 20 53 6b 69 70 70 69 6e 67 "INFO: Skipping
a510: 20 6c 6f 63 6b 2f 75 6e 6c 6f 63 6b 20 6f 6e 20 lock/unlock on
a520: 22 20 72 75 6e 2d 69 64 29 29 29 29 0a 09 20 20 " run-id))))..
a530: 20 20 20 20 72 75 6e 73 29 29 29 0a 3b 3b 3d 3d runs))).;;==
a540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a560: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a570: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a580: 3d 3d 3d 3d 0a 3b 3b 20 52 6f 6c 6c 75 70 20 72 ====.;; Rollup r
a590: 75 6e 73 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d uns.;;==========
a5a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a5b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a5c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
a5d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 3b 3b ============..;;
a5e0: 20 55 70 64 61 74 65 20 74 68 65 20 74 65 73 74 Update the test
a5f0: 5f 6d 65 74 61 20 74 61 62 6c 65 20 66 6f 72 20 _meta table for
a600: 74 68 69 73 20 74 65 73 74 0a 28 64 65 66 69 6e this test.(defin
a610: 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d 74 e (runs:update-t
a620: 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 74 est_meta db test
a630: 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 29 -name test-conf)
a640: 0a 20 20 28 6c 65 74 20 28 28 63 75 72 72 72 65 . (let ((currre
a650: 63 6f 72 64 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 cord (open-run-c
a660: 6c 6f 73 65 20 64 62 3a 74 65 73 74 6d 65 74 61 lose db:testmeta
a670: 2d 67 65 74 2d 72 65 63 6f 72 64 20 64 62 20 74 -get-record db t
a680: 65 73 74 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 est-name))).
a690: 28 69 66 20 28 6e 6f 74 20 63 75 72 72 72 65 63 (if (not currrec
a6a0: 6f 72 64 29 0a 09 28 62 65 67 69 6e 0a 09 20 20 ord)..(begin..
a6b0: 28 73 65 74 21 20 63 75 72 72 72 65 63 6f 72 64 (set! currrecord
a6c0: 20 28 6d 61 6b 65 2d 76 65 63 74 6f 72 20 31 30 (make-vector 10
a6d0: 20 23 66 29 29 0a 09 20 20 28 6f 70 65 6e 2d 72 #f)).. (open-r
a6e0: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 un-close db:test
a6f0: 6d 65 74 61 2d 61 64 64 2d 72 65 63 6f 72 64 20 meta-add-record
a700: 64 62 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 0a db test-name))).
a710: 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 (for-each .
a720: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 (lambda (key
a730: 29 0a 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 ). (let* (
a740: 28 69 64 78 20 28 63 61 64 72 20 6b 65 79 29 29 (idx (cadr key))
a750: 0a 09 20 20 20 20 20 20 28 66 6c 64 20 28 63 61 .. (fld (ca
a760: 72 20 20 6b 65 79 29 29 0a 09 20 20 20 20 20 20 r key))..
a770: 28 76 61 6c 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f (val (config-loo
a780: 6b 75 70 20 74 65 73 74 2d 63 6f 6e 66 20 22 74 kup test-conf "t
a790: 65 73 74 5f 6d 65 74 61 22 20 66 6c 64 29 29 29 est_meta" fld)))
a7a0: 0a 09 20 3b 3b 20 28 64 65 62 75 67 3a 70 72 69 .. ;; (debug:pri
a7b0: 6e 74 20 35 20 22 69 64 78 3a 20 22 20 69 64 78 nt 5 "idx: " idx
a7c0: 20 22 20 66 6c 64 3a 20 22 20 66 6c 64 20 22 20 " fld: " fld "
a7d0: 76 61 6c 3a 20 22 20 76 61 6c 29 0a 09 20 28 69 val: " val).. (i
a7e0: 66 20 28 61 6e 64 20 76 61 6c 20 28 6e 6f 74 20 f (and val (not
a7f0: 28 65 71 75 61 6c 3f 20 28 76 65 63 74 6f 72 2d (equal? (vector-
a800: 72 65 66 20 63 75 72 72 72 65 63 6f 72 64 20 69 ref currrecord i
a810: 64 78 29 20 76 61 6c 29 29 29 0a 09 20 20 20 20 dx) val)))..
a820: 20 28 62 65 67 69 6e 0a 09 20 20 20 20 20 20 20 (begin..
a830: 28 70 72 69 6e 74 20 22 55 70 64 61 74 69 6e 67 (print "Updating
a840: 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 20 22 " test-name " "
a850: 20 66 6c 64 20 22 20 74 6f 20 22 20 76 61 6c 29 fld " to " val)
a860: 0a 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 .. (open-r
a870: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 65 73 74 un-close db:test
a880: 6d 65 74 61 2d 75 70 64 61 74 65 2d 66 69 65 6c meta-update-fiel
a890: 64 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 66 d db test-name f
a8a0: 6c 64 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 ld val))))).
a8b0: 20 27 28 28 22 61 75 74 68 6f 72 22 20 32 29 28 '(("author" 2)(
a8c0: 22 6f 77 6e 65 72 22 20 33 29 28 22 64 65 73 63 "owner" 3)("desc
a8d0: 72 69 70 74 69 6f 6e 22 20 34 29 28 22 72 65 76 ription" 4)("rev
a8e0: 69 65 77 65 64 22 20 35 29 28 22 74 61 67 73 22 iewed" 5)("tags"
a8f0: 20 39 29 29 29 29 29 0a 0a 3b 3b 20 55 70 64 61 9)))))..;; Upda
a900: 74 65 20 74 65 73 74 5f 6d 65 74 61 20 66 6f 72 te test_meta for
a910: 20 61 6c 6c 20 74 65 73 74 73 0a 28 64 65 66 69 all tests.(defi
a920: 6e 65 20 28 72 75 6e 73 3a 75 70 64 61 74 65 2d ne (runs:update-
a930: 61 6c 6c 2d 74 65 73 74 5f 6d 65 74 61 20 64 62 all-test_meta db
a940: 29 0a 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d ). (let ((test-
a950: 6e 61 6d 65 73 20 28 67 65 74 2d 61 6c 6c 2d 6c names (get-all-l
a960: 65 67 61 6c 2d 74 65 73 74 73 29 29 29 0a 20 20 egal-tests))).
a970: 20 20 28 66 6f 72 2d 65 61 63 68 20 0a 20 20 20 (for-each .
a980: 20 20 28 6c 61 6d 62 64 61 20 28 74 65 73 74 2d (lambda (test-
a990: 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 name). (le
a9a0: 74 2a 20 28 28 74 65 73 74 2d 70 61 74 68 20 20 t* ((test-path
a9b0: 20 20 28 63 6f 6e 63 20 2a 74 6f 70 70 61 74 68 (conc *toppath
a9c0: 2a 20 22 2f 74 65 73 74 73 2f 22 20 74 65 73 74 * "/tests/" test
a9d0: 2d 6e 61 6d 65 29 29 0a 09 20 20 20 20 20 20 28 -name)).. (
a9e0: 74 65 73 74 2d 63 6f 6e 66 69 67 66 20 28 63 6f test-configf (co
a9f0: 6e 63 20 74 65 73 74 2d 70 61 74 68 20 22 2f 74 nc test-path "/t
aa00: 65 73 74 63 6f 6e 66 69 67 22 29 29 0a 09 20 20 estconfig"))..
aa10: 20 20 20 20 28 74 65 73 74 65 78 69 73 74 73 20 (testexists
aa20: 20 20 28 61 6e 64 20 28 66 69 6c 65 2d 65 78 69 (and (file-exi
aa30: 73 74 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 sts? test-config
aa40: 66 29 28 66 69 6c 65 2d 72 65 61 64 2d 61 63 63 f)(file-read-acc
aa50: 65 73 73 3f 20 74 65 73 74 2d 63 6f 6e 66 69 67 ess? test-config
aa60: 66 29 29 29 0a 09 20 20 20 20 20 20 3b 3b 20 72 f))).. ;; r
aa70: 65 61 64 20 63 6f 6e 66 69 67 73 20 77 69 74 68 ead configs with
aa80: 20 74 72 69 63 6b 73 20 74 75 72 6e 65 64 20 6f tricks turned o
aa90: 66 66 20 28 69 2e 65 2e 20 6e 6f 20 73 79 73 74 ff (i.e. no syst
aaa0: 65 6d 29 0a 09 20 20 20 20 20 20 28 74 65 73 74 em).. (test
aab0: 2d 63 6f 6e 66 20 20 20 20 28 69 66 20 74 65 73 -conf (if tes
aac0: 74 65 78 69 73 74 73 20 28 72 65 61 64 2d 63 6f texists (read-co
aad0: 6e 66 69 67 20 74 65 73 74 2d 63 6f 6e 66 69 67 nfig test-config
aae0: 66 20 23 66 20 23 66 29 28 6d 61 6b 65 2d 68 61 f #f #f)(make-ha
aaf0: 73 68 2d 74 61 62 6c 65 29 29 29 29 0a 09 20 3b sh-table)))).. ;
ab00: 3b 20 75 73 65 20 74 68 65 20 6f 70 65 6e 2d 72 ; use the open-r
ab10: 75 6e 2d 63 6c 6f 73 65 20 69 6e 73 74 65 61 64 un-close instead
ab20: 20 6f 66 20 70 61 73 73 69 6e 67 20 69 6e 20 64 of passing in d
ab30: 62 0a 09 20 28 72 75 6e 73 3a 75 70 64 61 74 65 b.. (runs:update
ab40: 2d 74 65 73 74 5f 6d 65 74 61 20 23 66 20 74 65 -test_meta #f te
ab50: 73 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e st-name test-con
ab60: 66 29 29 29 0a 20 20 20 20 20 74 65 73 74 2d 6e f))). test-n
ab70: 61 6d 65 73 29 29 29 0a 0a 3b 3b 20 54 68 69 73 ames)))..;; This
ab80: 20 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 could probably
ab90: 62 65 20 72 65 66 61 63 74 6f 72 65 64 20 69 6e be refactored in
aba0: 74 6f 20 6f 6e 65 20 63 6f 6d 70 6c 65 78 20 71 to one complex q
abb0: 75 65 72 79 20 2e 2e 2e 0a 28 64 65 66 69 6e 65 uery ....(define
abc0: 20 28 72 75 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 (runs:rollup-ru
abd0: 6e 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 n keys keyvallst
abe0: 20 72 75 6e 6e 61 6d 65 20 75 73 65 72 29 20 3b runname user) ;
abf0: 3b 20 77 61 73 20 74 61 72 67 65 74 2c 20 6e 6f ; was target, no
ac00: 77 20 6b 65 79 76 61 6c 6c 73 74 0a 20 20 28 64 w keyvallst. (d
ac10: 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 72 75 ebug:print 4 "ru
ac20: 6e 73 3a 72 6f 6c 6c 75 70 2d 72 75 6e 2c 20 6b ns:rollup-run, k
ac30: 65 79 73 3a 20 22 20 6b 65 79 73 20 22 20 6b 65 eys: " keys " ke
ac40: 79 76 61 6c 6c 73 74 3a 20 22 20 6b 65 79 76 61 yvallst: " keyva
ac50: 6c 6c 73 74 20 22 20 3a 72 75 6e 6e 61 6d 65 20 llst " :runname
ac60: 22 20 72 75 6e 6e 61 6d 65 20 22 20 75 73 65 72 " runname " user
ac70: 3a 20 22 20 75 73 65 72 29 0a 20 20 28 6c 65 74 : " user). (let
ac80: 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 20 * ((db
ac90: 20 20 20 20 23 66 29 20 3b 3b 20 28 6b 65 79 76 #f) ;; (keyv
aca0: 61 6c 6c 6c 73 74 20 20 20 20 20 20 28 6b 65 79 alllst (key
acb0: 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 61 6c s:target->keyval
acc0: 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 0a 09 keys target))..
acd0: 20 28 6e 65 77 2d 72 75 6e 2d 69 64 20 20 20 20 (new-run-id
ace0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
acf0: 65 20 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d e runs:register-
ad00: 72 75 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 run db keys keyv
ad10: 61 6c 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e allst runname "n
ad20: 65 77 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 ew" "n/a" user))
ad30: 0a 09 20 28 70 72 65 76 2d 74 65 73 74 73 20 20 .. (prev-tests
ad40: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
ad50: 6f 73 65 20 74 65 73 74 3a 67 65 74 2d 6d 61 74 ose test:get-mat
ad60: 63 68 69 6e 67 2d 70 72 65 76 69 6f 75 73 2d 74 ching-previous-t
ad70: 65 73 74 2d 72 75 6e 2d 72 65 63 6f 72 64 73 20 est-run-records
ad80: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 db new-run-id "%
ad90: 22 20 22 25 22 29 29 0a 09 20 28 63 75 72 72 2d " "%")).. (curr-
ada0: 74 65 73 74 73 20 20 20 20 20 20 28 6f 70 65 6e tests (open
adb0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 -run-close db:ge
adc0: 74 2d 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 t-tests-for-run
add0: 64 62 20 6e 65 77 2d 72 75 6e 2d 69 64 20 22 25 db new-run-id "%
ade0: 22 20 22 25 22 20 27 28 29 20 27 28 29 29 29 0a " "%" '() '())).
adf0: 09 20 28 63 75 72 72 2d 74 65 73 74 73 2d 68 61 . (curr-tests-ha
ae00: 73 68 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 sh (make-hash-ta
ae10: 62 6c 65 29 29 29 0a 20 20 20 20 28 6f 70 65 6e ble))). (open
ae20: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 75 70 -run-close db:up
ae30: 64 61 74 65 2d 72 75 6e 2d 65 76 65 6e 74 5f 74 date-run-event_t
ae40: 69 6d 65 20 64 62 20 6e 65 77 2d 72 75 6e 2d 69 ime db new-run-i
ae50: 64 29 0a 20 20 20 20 3b 3b 20 69 6e 64 65 78 20 d). ;; index
ae60: 74 68 65 20 61 6c 72 65 61 64 79 20 73 61 76 65 the already save
ae70: 64 20 74 65 73 74 73 20 62 79 20 74 65 73 74 6e d tests by testn
ae80: 61 6d 65 20 61 6e 64 20 69 74 65 6d 64 61 74 20 ame and itemdat
ae90: 69 6e 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 in curr-tests-ha
aea0: 73 68 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 sh. (for-each
aeb0: 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 . (lambda (t
aec0: 65 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 estdat). (
aed0: 6c 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 let* ((testname
aee0: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
aef0: 73 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 stname testdat))
af00: 0a 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 .. (item-pa
af10: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
af20: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 item-path testda
af30: 74 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c t)).. (full
af40: 2d 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 -name (conc test
af50: 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 name "/" item-pa
af60: 74 68 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 th))).. (hash-ta
af70: 62 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 ble-set! curr-te
af80: 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 sts-hash full-na
af90: 6d 65 20 74 65 73 74 64 61 74 29 29 29 0a 20 20 me testdat))).
afa0: 20 20 20 63 75 72 72 2d 74 65 73 74 73 29 0a 20 curr-tests).
afb0: 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 4e 6f 6e 2d ;; NOPE: Non-
afc0: 6f 70 74 69 6d 61 6c 20 61 70 70 72 6f 61 63 68 optimal approach
afd0: 2e 20 54 72 79 20 74 68 69 73 20 69 6e 73 74 65 . Try this inste
afe0: 61 64 2e 0a 20 20 20 20 3b 3b 20 20 20 31 2e 20 ad.. ;; 1.
aff0: 74 65 73 74 73 20 61 72 65 20 72 65 63 65 69 76 tests are receiv
b000: 65 64 20 69 6e 20 61 20 6c 69 73 74 2c 20 6d 6f ed in a list, mo
b010: 73 74 20 72 65 63 65 6e 74 20 66 69 72 73 74 0a st recent first.
b020: 20 20 20 20 3b 3b 20 20 20 32 2e 20 72 65 70 6c ;; 2. repl
b030: 61 63 65 20 74 68 65 20 72 6f 6c 6c 75 70 20 74 ace the rollup t
b040: 65 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 est with the new
b050: 20 2a 61 6c 77 61 79 73 2a 0a 20 20 20 20 28 66 *always*. (f
b060: 6f 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c or-each . (l
b070: 61 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a ambda (testdat).
b080: 20 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 (let* ((t
b090: 65 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 estname (db:tes
b0a0: 74 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 t-get-testname t
b0b0: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 estdat))..
b0c0: 28 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 (item-path (db:t
b0d0: 65 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 est-get-item-pat
b0e0: 68 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 h testdat))..
b0f0: 20 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 (full-name (c
b100: 6f 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 onc testname "/"
b110: 20 69 74 65 6d 2d 70 61 74 68 29 29 0a 09 20 20 item-path))..
b120: 20 20 20 20 28 70 72 65 76 2d 74 65 73 74 2d 64 (prev-test-d
b130: 61 74 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 at (hash-table-r
b140: 65 66 2f 64 65 66 61 75 6c 74 20 63 75 72 72 2d ef/default curr-
b150: 74 65 73 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d tests-hash full-
b160: 6e 61 6d 65 20 23 66 29 29 0a 09 20 20 20 20 20 name #f))..
b170: 20 28 74 65 73 74 2d 73 74 65 70 73 20 20 20 20 (test-steps
b180: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
b190: 65 20 64 62 3a 67 65 74 2d 73 74 65 70 73 2d 66 e db:get-steps-f
b1a0: 6f 72 2d 74 65 73 74 20 64 62 20 28 64 62 3a 74 or-test db (db:t
b1b0: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
b1c0: 61 74 29 29 29 0a 09 20 20 20 20 20 20 28 6e 65 at))).. (ne
b1d0: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 w-test-record #f
b1e0: 29 29 0a 09 20 3b 3b 20 72 65 70 6c 61 63 65 20 )).. ;; replace
b1f0: 74 68 65 73 65 20 77 69 74 68 20 69 6e 73 65 72 these with inser
b200: 74 20 2e 2e 2e 20 73 65 6c 65 63 74 0a 09 20 28 t ... select.. (
b210: 61 70 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 apply sqlite3:ex
b220: 65 63 75 74 65 20 0a 09 09 64 62 20 0a 09 09 28 ecute ...db ...(
b230: 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 conc "INSERT OR
b240: 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 REPLACE INTO tes
b250: 74 73 20 28 72 75 6e 5f 69 64 2c 74 65 73 74 6e ts (run_id,testn
b260: 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 ame,state,status
b270: 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 68 6f 73 74 ,event_time,host
b280: 2c 63 70 75 6c 6f 61 64 2c 64 69 73 6b 66 72 65 ,cpuload,diskfre
b290: 65 2c 75 6e 61 6d 65 2c 72 75 6e 64 69 72 2c 69 e,uname,rundir,i
b2a0: 74 65 6d 5f 70 61 74 68 2c 72 75 6e 5f 64 75 72 tem_path,run_dur
b2b0: 61 74 69 6f 6e 2c 66 69 6e 61 6c 5f 6c 6f 67 66 ation,final_logf
b2c0: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 ,comment) "...
b2d0: 20 20 20 20 22 56 41 4c 55 45 53 20 28 3f 2c 3f "VALUES (?,?
b2e0: 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f ,?,?,?,?,?,?,?,?
b2f0: 2c 3f 2c 3f 2c 3f 2c 3f 29 3b 22 29 0a 09 09 6e ,?,?,?,?);")...n
b300: 65 77 2d 72 75 6e 2d 69 64 20 28 63 64 64 72 20 ew-run-id (cddr
b310: 28 76 65 63 74 6f 72 2d 3e 6c 69 73 74 20 74 65 (vector->list te
b320: 73 74 64 61 74 29 29 29 0a 09 20 28 73 65 74 21 stdat))).. (set!
b330: 20 6e 65 77 2d 74 65 73 74 64 61 74 20 28 63 61 new-testdat (ca
b340: 72 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 r (open-run-clos
b350: 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 e db:get-tests-f
b360: 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d 72 75 or-run db new-ru
b370: 6e 2d 69 64 20 74 65 73 74 6e 61 6d 65 20 69 74 n-id testname it
b380: 65 6d 2d 70 61 74 68 20 27 28 29 20 27 28 29 29 em-path '() '())
b390: 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 6c 65 )).. (hash-table
b3a0: 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 74 73 -set! curr-tests
b3b0: 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 -hash full-name
b3c0: 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b 3b 20 new-testdat) ;;
b3d0: 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 63 6f this could be co
b3e0: 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 20 72 nfusing, which r
b3f0: 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 6f 20 ecord should go
b400: 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 70 20 into the lookup
b410: 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f 77 20 table?.. ;; Now
b420: 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 74 65 duplicate the te
b430: 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 62 75 st steps.. (debu
b440: 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 79 69 g:print 4 "Copyi
b450: 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 74 65 ng records in te
b460: 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 74 65 st_steps from te
b470: 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 73 74 st_id=" (db:test
b480: 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 74 29 -get-id testdat)
b490: 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 73 74 " to " (db:test
b4a0: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 -get-id new-test
b4b0: 64 61 74 29 29 0a 09 20 28 6f 70 65 6e 2d 72 75 dat)).. (open-ru
b4c0: 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28 6c 61 6d n-close .. (lam
b4d0: 62 64 61 20 28 29 0a 09 20 20 20 20 28 73 71 6c bda ().. (sql
b4e0: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 20 ite3:execute ..
b4f0: 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 28 63 db .. (c
b500: 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 20 52 onc "INSERT OR R
b510: 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 73 74 EPLACE INTO test
b520: 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 64 2c _steps (test_id,
b530: 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 2c 73 stepname,state,s
b540: 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 6d 65 tatus,event_time
b550: 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 ,comment) "...
b560: 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 3a 74 "SELECT " (db:t
b570: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 est-get-id new-t
b580: 65 73 74 64 61 74 29 20 22 2c 73 74 65 70 6e 61 estdat) ",stepna
b590: 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c me,state,status,
b5a0: 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d 6d 65 event_time,comme
b5b0: 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 74 65 nt FROM test_ste
b5c0: 70 73 20 57 48 45 52 45 20 74 65 73 74 5f 69 64 ps WHERE test_id
b5d0: 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 62 3a =?;").. (db:
b5e0: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
b5f0: 64 61 74 29 29 0a 09 20 20 20 20 3b 3b 20 4e 6f dat)).. ;; No
b600: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 w duplicate the
b610: 74 65 73 74 20 64 61 74 61 0a 09 20 20 20 20 28 test data.. (
b620: 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 debug:print 4 "C
b630: 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 opying records i
b640: 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 6f 6d n test_data from
b650: 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 test_id=" (db:t
b660: 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 est-get-id testd
b670: 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 at) " to " (db:t
b680: 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 est-get-id new-t
b690: 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 28 73 estdat)).. (s
b6a0: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a qlite3:execute .
b6b0: 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 . db ..
b6c0: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
b6d0: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
b6e0: 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f 69 64 st_data (test_id
b6f0: 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 61 62 ,category,variab
b700: 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 74 65 le,value,expecte
b710: 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f 6d 6d d,tol,units,comm
b720: 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 45 4c ent) "... "SEL
b730: 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 2d 67 ECT " (db:test-g
b740: 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 64 61 et-id new-testda
b750: 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c 76 61 t) ",category,va
b760: 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 riable,value,exp
b770: 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c ected,tol,units,
b780: 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 comment FROM tes
b790: 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 65 73 t_data WHERE tes
b7a0: 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 t_id=?;")..
b7b0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 (db:test-get-id
b7c0: 74 65 73 74 64 61 74 29 29 29 29 0a 09 20 29 29 testdat)))).. ))
b7d0: 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 74 73 . prev-tests
b7e0: 29 29 29 0a 09 20 0a 20 20 20 20 20 0a ))).. . .