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 0a 09 20 28 71 72 79 2d 73 74 72 20 20 23 66 ).. (qry-str #f
0590: 29 29 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 )). (for-each
05a0: 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 76 61 6c (lambda (keyval
05b0: 29 0a 09 09 28 6c 65 74 2a 20 28 28 6b 65 79 20 )...(let* ((key
05c0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 6b (vector-ref k
05d0: 65 79 76 61 6c 20 30 29 29 0a 09 09 20 20 20 20 eyval 0))...
05e0: 20 20 20 28 66 75 6c 6b 65 79 20 28 63 6f 6e 63 (fulkey (conc
05f0: 20 22 3a 22 20 6b 65 79 29 29 0a 09 09 20 20 20 ":" key))...
0600: 20 20 20 20 28 70 61 74 74 20 20 20 28 61 72 67 (patt (arg
0610: 73 3a 67 65 74 2d 61 72 67 20 66 75 6c 6b 65 79 s:get-arg fulkey
0620: 29 29 0a 09 09 20 20 20 20 20 20 20 28 77 69 6c ))... (wil
0630: 64 74 79 70 65 20 28 69 66 20 28 73 75 62 73 74 dtype (if (subst
0640: 72 69 6e 67 2d 69 6e 64 65 78 20 22 25 22 20 70 ring-index "%" p
0650: 61 74 74 29 20 22 6c 69 6b 65 22 20 22 67 6c 6f att) "like" "glo
0660: 62 22 29 29 29 0a 09 09 20 20 28 69 66 20 70 61 b")))... (if pa
0670: 74 74 0a 09 09 20 20 20 20 20 20 28 73 65 74 21 tt... (set!
0680: 20 6b 65 79 2d 70 61 74 74 20 28 63 6f 6e 63 20 key-patt (conc
0690: 6b 65 79 2d 70 61 74 74 20 22 20 41 4e 44 20 22 key-patt " AND "
06a0: 20 6b 65 79 20 22 20 22 20 77 69 6c 64 74 79 70 key " " wildtyp
06b0: 65 20 22 20 27 22 20 70 61 74 74 20 22 27 22 29 e " '" patt "'")
06c0: 29 0a 09 09 20 20 20 20 20 20 28 62 65 67 69 6e )... (begin
06d0: 0a 09 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 ....(debug:print
06e0: 20 30 20 22 45 52 52 4f 52 3a 20 73 65 61 72 63 0 "ERROR: searc
06f0: 68 69 6e 67 20 66 6f 72 20 72 75 6e 73 20 77 69 hing for runs wi
0700: 74 68 20 6e 6f 20 70 61 74 74 65 72 6e 20 73 65 th no pattern se
0710: 74 20 66 6f 72 20 22 20 66 75 6c 6b 65 79 29 0a t for " fulkey).
0720: 09 09 09 28 65 78 69 74 20 36 29 29 29 29 29 0a ...(exit 6))))).
0730: 09 20 20 20 20 20 20 6b 65 79 73 29 0a 20 20 20 . keys).
0740: 20 28 73 65 74 21 20 71 72 79 2d 73 74 72 20 28 (set! qry-str (
0750: 63 6f 6e 63 20 22 53 45 4c 45 43 54 20 22 20 6b conc "SELECT " k
0760: 65 79 73 74 72 20 22 20 46 52 4f 4d 20 72 75 6e eystr " FROM run
0770: 73 20 57 48 45 52 45 20 72 75 6e 6e 61 6d 65 20 s WHERE runname
0780: 22 20 72 75 6e 77 69 6c 64 74 79 70 65 20 22 20 " runwildtype "
0790: 3f 20 22 20 6b 65 79 2d 70 61 74 74 20 22 3b 22 ? " key-patt ";"
07a0: 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 )). (debug:pr
07b0: 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 72 75 6e int 4 "INFO: run
07c0: 73 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 s:get-runs-by-pa
07d0: 74 74 20 71 72 79 3d 22 20 71 72 79 2d 73 74 72 tt qry=" qry-str
07e0: 20 22 20 22 20 72 75 6e 6e 61 6d 65 70 61 74 74 " " runnamepatt
07f0: 29 0a 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 ). (sqlite3:f
0800: 6f 72 2d 65 61 63 68 2d 72 6f 77 20 0a 20 20 20 or-each-row .
0810: 20 20 28 6c 61 6d 62 64 61 20 28 61 20 2e 20 72 (lambda (a . r
0820: 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 72 ). (set! r
0830: 65 73 20 28 63 6f 6e 73 20 28 6c 69 73 74 2d 3e es (cons (list->
0840: 76 65 63 74 6f 72 20 28 63 6f 6e 73 20 61 20 72 vector (cons a r
0850: 29 29 20 72 65 73 29 29 29 0a 20 20 20 20 20 64 )) res))). d
0860: 62 20 0a 20 20 20 20 20 71 72 79 2d 73 74 72 0a b . qry-str.
0870: 20 20 20 20 20 72 75 6e 6e 61 6d 65 70 61 74 74 runnamepatt
0880: 29 0a 20 20 20 20 28 76 65 63 74 6f 72 20 68 65 ). (vector he
0890: 61 64 65 72 20 72 65 73 29 29 29 0a 0a 28 64 65 ader res)))..(de
08a0: 66 69 6e 65 20 28 72 75 6e 73 3a 74 65 73 74 2d fine (runs:test-
08b0: 67 65 74 2d 66 75 6c 6c 2d 70 61 74 68 20 74 65 get-full-path te
08c0: 73 74 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 65 st). (let* ((te
08d0: 73 74 6e 61 6d 65 20 28 64 62 3a 74 65 73 74 2d stname (db:test-
08e0: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 get-testname t
08f0: 65 73 74 29 29 0a 09 20 28 69 74 65 6d 70 61 74 est)).. (itempat
0900: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 h (db:test-get-i
0910: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 29 tem-path test)))
0920: 0a 20 20 20 20 28 63 6f 6e 63 20 74 65 73 74 6e . (conc testn
0930: 61 6d 65 20 28 69 66 20 28 65 71 75 61 6c 3f 20 ame (if (equal?
0940: 69 74 65 6d 70 61 74 68 20 22 22 29 20 22 22 20 itempath "") ""
0950: 28 63 6f 6e 63 20 22 28 22 20 69 74 65 6d 70 61 (conc "(" itempa
0960: 74 68 20 22 29 22 29 29 29 29 29 0a 0a 3b 3b 20 th ")")))))..;;
0970: 41 77 66 75 6c 2e 20 50 6c 65 61 73 65 20 46 49 Awful. Please FI
0980: 58 4d 45 0a 28 64 65 66 69 6e 65 20 2a 65 6e 76 XME.(define *env
0990: 2d 76 61 72 73 2d 62 79 2d 72 75 6e 2d 69 64 2a -vars-by-run-id*
09a0: 20 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c (make-hash-tabl
09b0: 65 29 29 0a 28 64 65 66 69 6e 65 20 2a 63 75 72 e)).(define *cur
09c0: 72 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 20 20 rent-run-name*
09d0: 20 23 66 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 #f)..(define (s
09e0: 65 74 2d 6d 65 67 61 74 65 73 74 2d 65 6e 76 2d et-megatest-env-
09f0: 76 61 72 73 20 64 62 20 72 75 6e 2d 69 64 29 0a vars db run-id).
0a00: 20 20 28 6c 65 74 20 28 28 6b 65 79 73 20 28 64 (let ((keys (d
0a10: 62 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a b:get-keys db)).
0a20: 09 28 76 61 6c 73 20 28 68 61 73 68 2d 74 61 62 .(vals (hash-tab
0a30: 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 2a le-ref/default *
0a40: 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e 2d env-vars-by-run-
0a50: 69 64 2a 20 72 75 6e 2d 69 64 20 23 66 29 29 29 id* run-id #f)))
0a60: 0a 20 20 20 20 3b 3b 20 67 65 74 20 74 68 65 20 . ;; get the
0a70: 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 64 62 info from the db
0a80: 20 61 6e 64 20 70 75 74 20 69 74 20 69 6e 20 74 and put it in t
0a90: 68 65 20 63 61 63 68 65 0a 20 20 20 20 28 69 66 he cache. (if
0aa0: 20 28 6e 6f 74 20 76 61 6c 73 29 0a 09 28 6c 65 (not vals)..(le
0ab0: 74 20 28 28 68 74 20 28 6d 61 6b 65 2d 68 61 73 t ((ht (make-has
0ac0: 68 2d 74 61 62 6c 65 29 29 29 0a 09 20 20 28 68 h-table))).. (h
0ad0: 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 2a ash-table-set! *
0ae0: 65 6e 76 2d 76 61 72 73 2d 62 79 2d 72 75 6e 2d env-vars-by-run-
0af0: 69 64 2a 20 72 75 6e 2d 69 64 20 68 74 29 0a 09 id* run-id ht)..
0b00: 20 20 28 73 65 74 21 20 76 61 6c 73 20 68 74 29 (set! vals ht)
0b10: 0a 09 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 .. (for-each..
0b20: 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 29 0a (lambda (key).
0b30: 09 20 20 20 20 20 28 73 71 6c 69 74 65 33 3a 66 . (sqlite3:f
0b40: 6f 72 2d 65 61 63 68 2d 72 6f 77 0a 09 20 20 20 or-each-row..
0b50: 20 20 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 29 (lambda (val)
0b60: 0a 09 09 28 68 61 73 68 2d 74 61 62 6c 65 2d 73 ...(hash-table-s
0b70: 65 74 21 20 76 61 6c 73 20 6b 65 79 20 76 61 6c et! vals key val
0b80: 29 29 0a 09 20 20 20 20 20 20 64 62 20 0a 09 20 )).. db ..
0b90: 20 20 20 20 20 28 63 6f 6e 63 20 22 53 45 4c 45 (conc "SELE
0ba0: 43 54 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 69 CT " (key:get-fi
0bb0: 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 46 eldname key) " F
0bc0: 52 4f 4d 20 72 75 6e 73 20 57 48 45 52 45 20 69 ROM runs WHERE i
0bd0: 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 20 72 75 d=?;").. ru
0be0: 6e 2d 69 64 29 29 0a 09 20 20 20 6b 65 79 73 29 n-id)).. keys)
0bf0: 29 29 0a 20 20 20 20 3b 3b 20 66 72 6f 6d 20 74 )). ;; from t
0c00: 68 65 20 63 61 63 68 65 64 20 64 61 74 61 20 73 he cached data s
0c10: 65 74 20 74 68 65 20 76 61 72 73 0a 20 20 20 20 et the vars.
0c20: 28 68 61 73 68 2d 74 61 62 6c 65 2d 66 6f 72 2d (hash-table-for-
0c30: 65 61 63 68 0a 20 20 20 20 20 76 61 6c 73 0a 20 each. vals.
0c40: 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6b 65 79 (lambda (key
0c50: 20 76 61 6c 29 0a 20 20 20 20 20 20 20 28 64 65 val). (de
0c60: 62 75 67 3a 70 72 69 6e 74 20 32 20 22 73 65 74 bug:print 2 "set
0c70: 65 6e 76 20 22 20 28 6b 65 79 3a 67 65 74 2d 66 env " (key:get-f
0c80: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 22 20 ieldname key) "
0c90: 22 20 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 " val). (s
0ca0: 65 74 65 6e 76 20 28 6b 65 79 3a 67 65 74 2d 66 etenv (key:get-f
0cb0: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 29 20 76 61 ieldname key) va
0cc0: 6c 29 29 29 0a 20 20 20 20 28 61 6c 69 73 74 2d l))). (alist-
0cd0: 3e 65 6e 76 2d 76 61 72 73 20 28 68 61 73 68 2d >env-vars (hash-
0ce0: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
0cf0: 74 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 65 t *configdat* "e
0d00: 6e 76 2d 6f 76 65 72 72 69 64 65 22 20 27 28 29 nv-override" '()
0d10: 29 29 0a 20 20 20 20 3b 3b 20 4c 65 74 73 20 75 )). ;; Lets u
0d20: 73 65 20 74 68 69 73 20 61 73 20 61 6e 20 6f 70 se this as an op
0d30: 70 6f 72 74 75 6e 69 74 79 20 74 6f 20 70 75 74 portunity to put
0d40: 20 4d 54 5f 52 55 4e 4e 41 4d 45 20 69 6e 20 74 MT_RUNNAME in t
0d50: 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 he environment.
0d60: 20 20 20 28 69 66 20 28 6e 6f 74 20 2a 63 75 72 (if (not *cur
0d70: 72 65 6e 74 2d 72 75 6e 2d 6e 61 6d 65 2a 29 0a rent-run-name*).
0d80: 09 28 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 .(sqlite3:for-ea
0d90: 63 68 2d 72 6f 77 0a 09 20 28 6c 61 6d 62 64 61 ch-row.. (lambda
0da0: 20 28 72 75 6e 6e 61 6d 65 29 0a 09 20 20 20 28 (runname).. (
0db0: 73 65 74 21 20 2a 63 75 72 72 65 6e 74 2d 72 75 set! *current-ru
0dc0: 6e 2d 6e 61 6d 65 2a 20 72 75 6e 6e 61 6d 65 29 n-name* runname)
0dd0: 29 0a 0a 09 20 64 62 0a 09 20 22 53 45 4c 45 43 )... db.. "SELEC
0de0: 54 20 72 75 6e 6e 61 6d 65 20 46 52 4f 4d 20 72 T runname FROM r
0df0: 75 6e 73 20 57 48 45 52 45 20 69 64 3d 3f 3b 22 uns WHERE id=?;"
0e00: 0a 09 20 72 75 6e 2d 69 64 29 29 0a 20 20 20 20 .. run-id)).
0e10: 28 73 65 74 65 6e 76 20 22 4d 54 5f 52 55 4e 4e (setenv "MT_RUNN
0e20: 41 4d 45 22 20 2a 63 75 72 72 65 6e 74 2d 72 75 AME" *current-ru
0e30: 6e 2d 6e 61 6d 65 2a 29 0a 20 20 20 20 28 73 65 n-name*). (se
0e40: 74 65 6e 76 20 22 4d 54 5f 52 55 4e 5f 41 52 45 tenv "MT_RUN_ARE
0e50: 41 5f 48 4f 4d 45 22 20 2a 74 6f 70 70 61 74 68 A_HOME" *toppath
0e60: 2a 29 0a 20 20 20 20 29 29 0a 0a 28 64 65 66 69 *). ))..(defi
0e70: 6e 65 20 28 73 65 74 2d 69 74 65 6d 2d 65 6e 76 ne (set-item-env
0e80: 2d 76 61 72 73 20 69 74 65 6d 64 61 74 29 0a 20 -vars itemdat).
0e90: 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 (for-each (lamb
0ea0: 64 61 20 28 69 74 65 6d 29 0a 09 20 20 20 20 20 da (item)..
0eb0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 20 (debug:print 2
0ec0: 22 73 65 74 65 6e 76 20 22 20 28 63 61 72 20 69 "setenv " (car i
0ed0: 74 65 6d 29 20 22 20 22 20 28 63 61 64 72 20 69 tem) " " (cadr i
0ee0: 74 65 6d 29 29 0a 09 20 20 20 20 20 20 28 73 65 tem)).. (se
0ef0: 74 65 6e 76 20 28 63 61 72 20 69 74 65 6d 29 20 tenv (car item)
0f00: 28 63 61 64 72 20 69 74 65 6d 29 29 29 0a 09 20 (cadr item)))..
0f10: 20 20 20 69 74 65 6d 64 61 74 29 29 0a 0a 28 64 itemdat))..(d
0f20: 65 66 69 6e 65 20 2a 6c 61 73 74 2d 6e 75 6d 2d efine *last-num-
0f30: 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 30 running-tests* 0
0f40: 29 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ).(define (runs:
0f50: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
0f60: 74 73 20 64 62 20 74 65 73 74 2d 72 65 63 6f 72 ts db test-recor
0f70: 64 29 0a 20 20 28 6c 65 74 2a 20 28 28 74 63 6f d). (let* ((tco
0f80: 6e 66 69 67 20 20 20 20 20 20 20 20 20 20 20 20 nfig
0f90: 20 20 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 (tests:test
0fa0: 71 75 65 75 65 2d 67 65 74 2d 74 65 73 74 63 6f queue-get-testco
0fb0: 6e 66 69 67 20 74 65 73 74 2d 72 65 63 6f 72 64 nfig test-record
0fc0: 29 29 0a 09 20 28 6a 6f 62 67 72 6f 75 70 20 20 )).. (jobgroup
0fd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 (c
0fe0: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 63 6f onfig-lookup tco
0ff0: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e nfig "requiremen
1000: 74 73 22 20 22 6a 6f 62 67 72 6f 75 70 22 29 29 ts" "jobgroup"))
1010: 0a 09 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 .. (num-running
1020: 20 20 20 20 20 20 20 20 20 20 20 20 28 64 62 3a (db:
1030: 67 65 74 2d 63 6f 75 6e 74 2d 74 65 73 74 73 2d get-count-tests-
1040: 72 75 6e 6e 69 6e 67 20 64 62 29 29 0a 09 20 28 running db)).. (
1050: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
1060: 6f 62 67 72 6f 75 70 20 28 64 62 3a 67 65 74 2d obgroup (db:get-
1070: 63 6f 75 6e 74 2d 74 65 73 74 73 2d 72 75 6e 6e count-tests-runn
1080: 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 20 ing-in-jobgroup
1090: 64 62 20 6a 6f 62 67 72 6f 75 70 29 29 0a 09 20 db jobgroup))..
10a0: 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d (max-concurrent-
10b0: 6a 6f 62 73 20 20 20 20 20 28 6c 65 74 20 28 28 jobs (let ((
10c0: 6d 63 6a 20 28 63 6f 6e 66 69 67 2d 6c 6f 6f 6b mcj (config-look
10d0: 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a 20 22 up *configdat* "
10e0: 73 65 74 75 70 22 20 20 20 20 20 22 6d 61 78 5f setup" "max_
10f0: 63 6f 6e 63 75 72 72 65 6e 74 5f 6a 6f 62 73 22 concurrent_jobs"
1100: 29 29 29 0a 09 09 09 09 20 20 20 20 28 69 66 20 )))..... (if
1110: 28 61 6e 64 20 6d 63 6a 20 28 73 74 72 69 6e 67 (and mcj (string
1120: 2d 3e 6e 75 6d 62 65 72 20 6d 63 6a 29 29 0a 09 ->number mcj))..
1130: 09 09 09 09 28 73 74 72 69 6e 67 2d 3e 6e 75 6d ....(string->num
1140: 62 65 72 20 6d 63 6a 29 0a 09 09 09 09 09 23 66 ber mcj)......#f
1150: 29 29 29 0a 09 20 28 6a 6f 62 2d 67 72 6f 75 70 ))).. (job-group
1160: 2d 6c 69 6d 69 74 20 20 20 20 20 20 20 20 20 28 -limit (
1170: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 2a 63 config-lookup *c
1180: 6f 6e 66 69 67 64 61 74 2a 20 22 6a 6f 62 67 72 onfigdat* "jobgr
1190: 6f 75 70 73 22 20 6a 6f 62 67 72 6f 75 70 29 29 oups" jobgroup))
11a0: 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 ). (if (not (
11b0: 65 71 3f 20 2a 6c 61 73 74 2d 6e 75 6d 2d 72 75 eq? *last-num-ru
11c0: 6e 6e 69 6e 67 2d 74 65 73 74 73 2a 20 6e 75 6d nning-tests* num
11d0: 2d 72 75 6e 6e 69 6e 67 29 29 0a 09 28 62 65 67 -running))..(beg
11e0: 69 6e 0a 09 20 20 28 64 65 62 75 67 3a 70 72 69 in.. (debug:pri
11f0: 6e 74 20 32 20 22 6d 61 78 2d 63 6f 6e 63 75 72 nt 2 "max-concur
1200: 72 65 6e 74 2d 6a 6f 62 73 3a 20 22 20 6d 61 78 rent-jobs: " max
1210: 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 -concurrent-jobs
1220: 20 22 2c 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 3a ", num-running:
1230: 20 22 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 0a " num-running).
1240: 09 20 20 28 73 65 74 21 20 2a 6c 61 73 74 2d 6e . (set! *last-n
1250: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 74 65 73 74 73 um-running-tests
1260: 2a 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 29 29 29 * num-running)))
1270: 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 65 . (if (not (e
1280: 71 3f 20 30 20 2a 67 6c 6f 62 61 6c 65 78 69 74 q? 0 *globalexit
1290: 73 74 61 74 75 73 2a 29 29 0a 09 28 6c 69 73 74 status*))..(list
12a0: 20 23 66 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 #f num-running
12b0: 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a num-running-in-j
12c0: 6f 62 67 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63 obgroup max-conc
12d0: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d urrent-jobs job-
12e0: 67 72 6f 75 70 2d 6c 69 6d 69 74 29 0a 09 28 6c group-limit)..(l
12f0: 65 74 20 28 28 63 61 6e 2d 6e 6f 74 2d 72 75 6e et ((can-not-run
1300: 2d 6d 6f 72 65 20 28 63 6f 6e 64 0a 09 09 09 09 -more (cond.....
1310: 20 3b 3b 20 69 66 20 6d 61 78 2d 63 6f 6e 63 75 ;; if max-concu
1320: 72 72 65 6e 74 2d 6a 6f 62 73 20 69 73 20 73 65 rrent-jobs is se
1330: 74 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 65 72 t and the number
1340: 20 72 75 6e 6e 69 6e 67 20 69 73 20 67 72 65 61 running is grea
1350: 74 65 72 20 0a 09 09 09 09 20 3b 3b 20 74 68 61 ter ..... ;; tha
1360: 6e 20 69 74 20 74 68 61 6e 20 63 61 6e 6e 6f 74 n it than cannot
1370: 20 72 75 6e 20 6d 6f 72 65 20 6a 6f 62 73 0a 09 run more jobs..
1380: 09 09 09 20 28 28 61 6e 64 20 6d 61 78 2d 63 6f ... ((and max-co
1390: 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e ncurrent-jobs (>
13a0: 3d 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6d 61 = num-running ma
13b0: 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 x-concurrent-job
13c0: 73 29 29 0a 09 09 09 09 20 20 28 64 65 62 75 67 s))..... (debug
13d0: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e :print 0 "WARNIN
13e0: 47 3a 20 4d 61 78 20 72 75 6e 6e 69 6e 67 20 6a G: Max running j
13f0: 6f 62 73 20 65 78 63 65 65 64 65 64 2c 20 63 75 obs exceeded, cu
1400: 72 72 65 6e 74 20 6e 75 6d 62 65 72 20 72 75 6e rrent number run
1410: 6e 69 6e 67 3a 20 22 20 6e 75 6d 2d 72 75 6e 6e ning: " num-runn
1420: 69 6e 67 20 0a 09 09 09 09 09 20 20 20 20 20 20 ing ......
1430: 20 22 2c 20 6d 61 78 5f 63 6f 6e 63 75 72 72 65 ", max_concurre
1440: 6e 74 5f 6a 6f 62 73 3a 20 22 20 6d 61 78 2d 63 nt_jobs: " max-c
1450: 6f 6e 63 75 72 72 65 6e 74 2d 6a 6f 62 73 29 0a oncurrent-jobs).
1460: 09 09 09 09 20 20 23 74 29 0a 09 09 09 09 20 3b .... #t)..... ;
1470: 3b 20 69 66 20 6a 6f 62 2d 67 72 6f 75 70 2d 6c ; if job-group-l
1480: 69 6d 69 74 20 69 73 20 73 65 74 20 61 6e 64 20 imit is set and
1490: 6e 75 6d 62 65 72 20 6f 66 20 6a 6f 62 73 20 69 number of jobs i
14a0: 6e 20 74 68 65 20 67 72 6f 75 70 20 69 73 20 67 n the group is g
14b0: 72 65 61 74 65 72 0a 09 09 09 09 20 3b 3b 20 74 reater..... ;; t
14c0: 68 61 6e 20 74 68 65 20 6c 69 6d 69 74 20 74 68 han the limit th
14d0: 65 6e 20 63 61 6e 6e 6f 74 20 72 75 6e 20 6d 6f en cannot run mo
14e0: 72 65 20 6a 6f 62 73 20 6f 66 20 74 68 69 73 20 re jobs of this
14f0: 6b 69 6e 64 0a 09 09 09 09 20 28 28 61 6e 64 20 kind..... ((and
1500: 6a 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 0a job-group-limit.
1510: 09 09 09 09 20 20 20 20 20 20 20 28 3e 3d 20 6e .... (>= n
1520: 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f um-running-in-jo
1530: 62 67 72 6f 75 70 20 6a 6f 62 2d 67 72 6f 75 70 bgroup job-group
1540: 2d 6c 69 6d 69 74 29 29 0a 09 09 09 09 20 20 28 -limit))..... (
1550: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 57 debug:print 1 "W
1560: 41 52 4e 49 4e 47 3a 20 6e 75 6d 62 65 72 20 6f ARNING: number o
1570: 66 20 6a 6f 62 73 20 22 20 6e 75 6d 2d 72 75 6e f jobs " num-run
1580: 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 72 6f 75 70 ning-in-jobgroup
1590: 20 0a 09 09 09 09 09 20 20 20 20 20 20 20 22 20 ...... "
15a0: 69 6e 20 22 20 6a 6f 62 67 72 6f 75 70 20 22 20 in " jobgroup "
15b0: 65 78 63 65 65 64 65 64 2c 20 77 69 6c 6c 20 6e exceeded, will n
15c0: 6f 74 20 72 75 6e 20 22 20 28 74 65 73 74 73 3a ot run " (tests:
15d0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 testqueue-get-te
15e0: 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f stname test-reco
15f0: 72 64 29 29 0a 09 09 09 09 20 20 23 74 29 0a 09 rd))..... #t)..
1600: 09 09 09 20 28 65 6c 73 65 20 23 66 29 29 29 29 ... (else #f))))
1610: 0a 09 20 20 28 6c 69 73 74 20 28 6e 6f 74 20 63 .. (list (not c
1620: 61 6e 2d 6e 6f 74 2d 72 75 6e 2d 6d 6f 72 65 29 an-not-run-more)
1630: 20 6e 75 6d 2d 72 75 6e 6e 69 6e 67 20 6e 75 6d num-running num
1640: 2d 72 75 6e 6e 69 6e 67 2d 69 6e 2d 6a 6f 62 67 -running-in-jobg
1650: 72 6f 75 70 20 6d 61 78 2d 63 6f 6e 63 75 72 72 roup max-concurr
1660: 65 6e 74 2d 6a 6f 62 73 20 6a 6f 62 2d 67 72 6f ent-jobs job-gro
1670: 75 70 2d 6c 69 6d 69 74 29 29 29 29 29 0a 0a 3b up-limit)))))..;
1680: 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;===============
1690: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
16a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
16b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
16c0: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4e 65 77 20 6d =======.;; New m
16d0: 65 74 68 6f 64 6f 6c 6f 67 79 2e 20 54 68 65 73 ethodology. Thes
16e0: 65 20 72 6f 75 74 69 6e 65 73 20 77 69 6c 6c 20 e routines will
16f0: 72 65 70 6c 61 63 65 20 74 68 65 20 61 62 6f 76 replace the abov
1700: 65 20 69 6e 20 74 69 6d 65 2e 20 46 6f 72 0a 3b e in time. For.;
1710: 3b 20 6e 6f 77 20 74 68 65 20 63 6f 64 65 20 69 ; now the code i
1720: 73 20 64 75 70 6c 69 63 61 74 65 64 2e 20 54 68 s duplicated. Th
1730: 69 73 20 73 74 75 66 66 20 69 73 20 69 6e 69 74 is stuff is init
1740: 69 61 6c 6c 79 20 75 73 65 64 20 69 6e 20 74 68 ially used in th
1750: 65 20 6d 6f 6e 69 74 6f 72 0a 3b 3b 20 62 61 73 e monitor.;; bas
1760: 65 64 20 63 6f 64 65 2e 0a 3b 3b 3d 3d 3d 3d 3d ed code..;;=====
1770: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1780: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
1790: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
17a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
17b0: 3d 0a 0a 3b 3b 20 72 65 67 69 73 74 65 72 20 61 =..;; register a
17c0: 20 74 65 73 74 20 72 75 6e 20 77 69 74 68 20 74 test run with t
17d0: 68 65 20 64 62 0a 28 64 65 66 69 6e 65 20 28 72 he db.(define (r
17e0: 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 6e uns:register-run
17f0: 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c 6c db keys keyvall
1800: 73 74 20 72 75 6e 6e 61 6d 65 20 73 74 61 74 65 st runname state
1810: 20 73 74 61 74 75 73 20 75 73 65 72 29 0a 20 20 status user).
1820: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 20 22 (debug:print 3 "
1830: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 runs:register-ru
1840: 6e 2c 20 6b 65 79 73 3a 20 22 20 6b 65 79 73 20 n, keys: " keys
1850: 22 20 6b 65 79 76 61 6c 6c 73 74 3a 20 22 20 6b " keyvallst: " k
1860: 65 79 76 61 6c 6c 73 74 20 22 20 72 75 6e 6e 61 eyvallst " runna
1870: 6d 65 3a 20 22 20 72 75 6e 6e 61 6d 65 20 22 20 me: " runname "
1880: 73 74 61 74 65 3a 20 22 20 73 74 61 74 65 20 22 state: " state "
1890: 20 73 74 61 74 75 73 3a 20 22 20 73 74 61 74 75 status: " statu
18a0: 73 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 72 s " user: " user
18b0: 29 0a 20 20 28 6c 65 74 2a 20 28 28 6b 65 79 73 ). (let* ((keys
18c0: 74 72 20 20 20 20 28 6b 65 79 73 2d 3e 6b 65 79 tr (keys->key
18d0: 73 74 72 20 6b 65 79 73 29 29 0a 09 20 28 63 6f str keys)).. (co
18e0: 6d 6d 61 20 20 20 20 20 28 69 66 20 28 3e 20 28 mma (if (> (
18f0: 6c 65 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 length keys) 0)
1900: 22 2c 22 20 22 22 29 29 0a 09 20 28 61 6e 64 73 "," "")).. (ands
1910: 74 72 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 tr (if (> (le
1920: 6e 67 74 68 20 6b 65 79 73 29 20 30 29 20 22 20 ngth keys) 0) "
1930: 41 4e 44 20 22 20 22 22 29 29 0a 09 20 28 76 61 AND " "")).. (va
1940: 6c 73 6c 6f 74 73 20 20 28 6b 65 79 73 2d 3e 76 lslots (keys->v
1950: 61 6c 73 6c 6f 74 73 20 6b 65 79 73 29 29 20 3b alslots keys)) ;
1960: 3b 20 3f 2c 3f 2c 3f 20 2e 2e 2e 0a 09 20 28 6b ; ?,?,? ..... (k
1970: 65 79 76 61 6c 73 20 20 20 28 6d 61 70 20 63 61 eyvals (map ca
1980: 64 72 20 6b 65 79 76 61 6c 6c 73 74 29 29 0a 09 dr keyvallst))..
1990: 20 28 61 6c 6c 76 61 6c 73 20 20 20 28 61 70 70 (allvals (app
19a0: 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d end (list runnam
19b0: 65 20 73 74 61 74 65 20 73 74 61 74 75 73 20 75 e state status u
19c0: 73 65 72 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 ser) keyvals))..
19d0: 20 28 71 72 79 76 61 6c 73 20 20 20 28 61 70 70 (qryvals (app
19e0: 65 6e 64 20 28 6c 69 73 74 20 72 75 6e 6e 61 6d end (list runnam
19f0: 65 29 20 6b 65 79 76 61 6c 73 29 29 0a 09 20 28 e) keyvals)).. (
1a00: 6b 65 79 3d 3f 73 74 72 20 20 28 73 74 72 69 6e key=?str (strin
1a10: 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 6d g-intersperse (m
1a20: 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 28 63 ap (lambda (k)(c
1a30: 6f 6e 63 20 28 6b 65 79 3a 67 65 74 2d 66 69 65 onc (key:get-fie
1a40: 6c 64 6e 61 6d 65 20 6b 29 20 22 3d 3f 22 29 29 ldname k) "=?"))
1a50: 20 6b 65 79 73 29 20 22 20 41 4e 44 20 22 29 29 keys) " AND "))
1a60: 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 ). (debug:pri
1a70: 6e 74 20 33 20 22 6b 65 79 73 3a 20 22 20 6b 65 nt 3 "keys: " ke
1a80: 79 73 20 22 20 61 6c 6c 76 61 6c 73 3a 20 22 20 ys " allvals: "
1a90: 61 6c 6c 76 61 6c 73 20 22 20 6b 65 79 76 61 6c allvals " keyval
1aa0: 73 3a 20 22 20 6b 65 79 76 61 6c 73 29 0a 20 20 s: " keyvals).
1ab0: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 32 (debug:print 2
1ac0: 20 22 4e 4f 54 45 3a 20 75 73 69 6e 67 20 74 61 "NOTE: using ta
1ad0: 72 67 65 74 20 22 20 28 73 74 72 69 6e 67 2d 69 rget " (string-i
1ae0: 6e 74 65 72 73 70 65 72 73 65 20 6b 65 79 76 61 ntersperse keyva
1af0: 6c 73 20 22 2f 22 29 20 22 20 66 6f 72 20 74 68 ls "/") " for th
1b00: 69 73 20 72 75 6e 22 29 0a 20 20 20 20 28 69 66 is run"). (if
1b10: 20 28 61 6e 64 20 72 75 6e 6e 61 6d 65 20 28 6e (and runname (n
1b20: 75 6c 6c 3f 20 28 66 69 6c 74 65 72 20 28 6c 61 ull? (filter (la
1b30: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 78 29 29 mbda (x)(not x))
1b40: 20 6b 65 79 76 61 6c 73 29 29 29 20 3b 3b 20 74 keyvals))) ;; t
1b50: 68 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 here must be a b
1b60: 65 74 74 65 72 20 77 61 79 20 74 6f 20 22 61 70 etter way to "ap
1b70: 70 6c 79 20 61 6e 64 22 0a 09 28 6c 65 74 20 28 ply and"..(let (
1b80: 28 72 65 73 20 23 66 29 29 0a 09 20 20 28 61 70 (res #f)).. (ap
1b90: 70 6c 79 20 73 71 6c 69 74 65 33 3a 65 78 65 63 ply sqlite3:exec
1ba0: 75 74 65 20 64 62 20 28 63 6f 6e 63 20 22 49 4e ute db (conc "IN
1bb0: 53 45 52 54 20 4f 52 20 49 47 4e 4f 52 45 20 49 SERT OR IGNORE I
1bc0: 4e 54 4f 20 72 75 6e 73 20 28 72 75 6e 6e 61 6d NTO runs (runnam
1bd0: 65 2c 73 74 61 74 65 2c 73 74 61 74 75 73 2c 6f e,state,status,o
1be0: 77 6e 65 72 2c 65 76 65 6e 74 5f 74 69 6d 65 22 wner,event_time"
1bf0: 20 63 6f 6d 6d 61 20 6b 65 79 73 74 72 20 22 29 comma keystr ")
1c00: 20 56 41 4c 55 45 53 20 28 3f 2c 3f 2c 3f 2c 3f VALUES (?,?,?,?
1c10: 2c 73 74 72 66 74 69 6d 65 28 27 25 73 27 2c 27 ,strftime('%s','
1c20: 6e 6f 77 27 29 22 20 63 6f 6d 6d 61 20 76 61 6c now')" comma val
1c30: 73 6c 6f 74 73 20 22 29 3b 22 29 0a 09 09 20 61 slots ");")... a
1c40: 6c 6c 76 61 6c 73 29 0a 09 20 20 28 61 70 70 6c llvals).. (appl
1c50: 79 20 73 71 6c 69 74 65 33 3a 66 6f 72 2d 65 61 y sqlite3:for-ea
1c60: 63 68 2d 72 6f 77 20 0a 09 20 20 20 28 6c 61 6d ch-row .. (lam
1c70: 62 64 61 20 28 69 64 29 0a 09 20 20 20 20 20 28 bda (id).. (
1c80: 73 65 74 21 20 72 65 73 20 69 64 29 29 0a 09 20 set! res id))..
1c90: 20 20 64 62 0a 09 20 20 20 28 6c 65 74 20 28 28 db.. (let ((
1ca0: 71 72 79 20 28 63 6f 6e 63 20 22 53 45 4c 45 43 qry (conc "SELEC
1cb0: 54 20 69 64 20 46 52 4f 4d 20 72 75 6e 73 20 57 T id FROM runs W
1cc0: 48 45 52 45 20 28 72 75 6e 6e 61 6d 65 3d 3f 20 HERE (runname=?
1cd0: 22 20 61 6e 64 73 74 72 20 6b 65 79 3d 3f 73 74 " andstr key=?st
1ce0: 72 20 22 29 3b 22 29 29 29 0a 09 20 20 20 20 20 r ");")))..
1cf0: 3b 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 ;(debug:print 4
1d00: 22 71 72 79 3a 20 22 20 71 72 79 29 20 0a 09 20 "qry: " qry) ..
1d10: 20 20 20 20 71 72 79 29 0a 09 20 20 20 71 72 79 qry).. qry
1d20: 76 61 6c 73 29 0a 09 20 20 28 73 71 6c 69 74 65 vals).. (sqlite
1d30: 33 3a 65 78 65 63 75 74 65 20 64 62 20 22 55 50 3:execute db "UP
1d40: 44 41 54 45 20 72 75 6e 73 20 53 45 54 20 73 74 DATE runs SET st
1d50: 61 74 65 3d 3f 2c 73 74 61 74 75 73 3d 3f 20 57 ate=?,status=? W
1d60: 48 45 52 45 20 69 64 3d 3f 3b 22 20 73 74 61 74 HERE id=?;" stat
1d70: 65 20 73 74 61 74 75 73 20 72 65 73 29 0a 09 20 e status res)..
1d80: 20 72 65 73 29 20 0a 09 28 62 65 67 69 6e 0a 09 res) ..(begin..
1d90: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 (debug:print 0
1da0: 20 22 45 52 52 4f 52 3a 20 43 61 6c 6c 65 64 20 "ERROR: Called
1db0: 77 69 74 68 6f 75 74 20 61 6c 6c 20 6e 65 63 65 without all nece
1dc0: 73 73 61 72 79 20 6b 65 79 73 22 29 0a 09 20 20 ssary keys")..
1dd0: 23 66 29 29 29 29 0a 0a 3b 3b 20 54 68 69 73 20 #f))))..;; This
1de0: 69 73 20 61 20 64 75 70 6c 69 63 61 74 65 20 6f is a duplicate o
1df0: 66 20 72 75 6e 2d 74 65 73 74 73 20 28 77 68 69 f run-tests (whi
1e00: 63 68 20 68 61 73 20 62 65 65 6e 20 64 65 70 72 ch has been depr
1e10: 65 63 61 74 65 64 29 2e 20 55 73 65 20 74 68 69 ecated). Use thi
1e20: 73 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 s one instead of
1e30: 20 72 75 6e 20 74 65 73 74 73 2e 0a 3b 3b 20 6b run tests..;; k
1e40: 65 79 76 61 6c 73 0a 28 64 65 66 69 6e 65 20 28 eyvals.(define (
1e50: 72 75 6e 73 3a 72 75 6e 2d 74 65 73 74 73 20 74 runs:run-tests t
1e60: 61 72 67 65 74 20 72 75 6e 6e 61 6d 65 20 74 65 arget runname te
1e70: 73 74 2d 70 61 74 74 73 20 75 73 65 72 20 66 6c st-patts user fl
1e80: 61 67 73 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 ags). (let* ((d
1e90: 62 20 20 20 20 20 20 20 20 20 20 23 66 29 0a 09 b #f)..
1ea0: 20 28 6b 65 79 73 20 20 20 20 20 20 20 20 28 6f (keys (o
1eb0: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
1ec0: 3a 67 65 74 2d 6b 65 79 73 20 64 62 29 29 0a 09 :get-keys db))..
1ed0: 20 28 6b 65 79 76 61 6c 6c 73 74 20 20 20 28 6b (keyvallst (k
1ee0: 65 79 73 3a 74 61 72 67 65 74 2d 3e 6b 65 79 76 eys:target->keyv
1ef0: 61 6c 20 6b 65 79 73 20 74 61 72 67 65 74 29 29 al keys target))
1f00: 0a 09 20 28 72 75 6e 2d 69 64 20 20 20 20 20 20 .. (run-id
1f10: 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 (open-run-close
1f20: 72 75 6e 73 3a 72 65 67 69 73 74 65 72 2d 72 75 runs:register-ru
1f30: 6e 20 64 62 20 6b 65 79 73 20 6b 65 79 76 61 6c n db keys keyval
1f40: 6c 73 74 20 72 75 6e 6e 61 6d 65 20 22 6e 65 77 lst runname "new
1f50: 22 20 22 6e 2f 61 22 20 75 73 65 72 29 29 20 20 " "n/a" user))
1f60: 3b 3b 20 20 74 65 73 74 2d 6e 61 6d 65 29 29 29 ;; test-name)))
1f70: 0a 09 20 28 64 65 66 65 72 72 65 64 20 20 20 20 .. (deferred
1f80: 27 28 29 29 20 3b 3b 20 64 65 6c 61 79 20 72 75 '()) ;; delay ru
1f90: 6e 6e 69 6e 67 20 74 68 65 73 65 20 73 69 6e 63 nning these sinc
1fa0: 65 20 74 68 65 79 20 68 61 76 65 20 61 20 77 61 e they have a wa
1fb0: 69 74 6f 6e 20 63 6c 61 75 73 65 0a 09 20 3b 3b iton clause.. ;;
1fc0: 20 6b 65 65 70 67 6f 69 6e 67 20 69 73 20 74 68 keepgoing is th
1fd0: 65 20 64 65 66 61 63 74 6f 20 6d 6f 64 61 6c 69 e defacto modali
1fe0: 74 79 20 6e 6f 77 2c 20 77 69 6c 6c 20 61 64 64 ty now, will add
1ff0: 20 68 69 74 2d 6e 2d 72 75 6e 20 61 20 62 69 74 hit-n-run a bit
2000: 20 6c 61 74 65 72 0a 09 20 3b 3b 20 28 6b 65 65 later.. ;; (kee
2010: 70 67 6f 69 6e 67 20 20 20 28 68 61 73 68 2d 74 pgoing (hash-t
2020: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
2030: 20 66 6c 61 67 73 20 22 2d 6b 65 65 70 67 6f 69 flags "-keepgoi
2040: 6e 67 22 20 23 66 29 29 0a 09 20 28 74 65 73 74 ng" #f)).. (test
2050: 2d 6e 61 6d 65 73 20 20 27 28 29 29 0a 09 20 28 -names '()).. (
2060: 72 75 6e 63 6f 6e 66 69 67 66 20 20 20 28 63 6f runconfigf (co
2070: 6e 63 20 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f nc *toppath* "/
2080: 72 75 6e 63 6f 6e 66 69 67 73 2e 63 6f 6e 66 69 runconfigs.confi
2090: 67 22 29 29 0a 09 20 28 72 65 71 75 69 72 65 64 g")).. (required
20a0: 2d 74 65 73 74 73 20 27 28 29 29 0a 09 20 28 74 -tests '()).. (t
20b0: 65 73 74 2d 72 65 63 6f 72 64 73 20 28 6d 61 6b est-records (mak
20c0: 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a e-hash-table))).
20d0: 0a 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 . (open-run-c
20e0: 6c 6f 73 65 20 73 65 74 2d 6d 65 67 61 74 65 73 lose set-megates
20f0: 74 2d 65 6e 76 2d 76 61 72 73 20 64 62 20 72 75 t-env-vars db ru
2100: 6e 2d 69 64 29 20 3b 3b 20 74 68 65 73 65 20 6d n-id) ;; these m
2110: 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 20 ay be needed by
2120: 74 68 65 20 6c 61 75 6e 63 68 69 6e 67 20 70 72 the launching pr
2130: 6f 63 65 73 73 0a 0a 20 20 20 20 28 69 66 20 28 ocess.. (if (
2140: 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 75 6e file-exists? run
2150: 63 6f 6e 66 69 67 66 29 0a 09 28 6f 70 65 6e 2d configf)..(open-
2160: 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 75 70 2d run-close setup-
2170: 65 6e 76 2d 64 65 66 61 75 6c 74 73 20 64 62 20 env-defaults db
2180: 72 75 6e 63 6f 6e 66 69 67 66 20 72 75 6e 2d 69 runconfigf run-i
2190: 64 20 2a 61 6c 72 65 61 64 79 2d 73 65 65 6e 2d d *already-seen-
21a0: 72 75 6e 63 6f 6e 66 69 67 2d 69 6e 66 6f 2a 20 runconfig-info*
21b0: 22 70 72 65 2d 6c 61 75 6e 63 68 2d 65 6e 76 2d "pre-launch-env-
21c0: 76 61 72 73 22 29 0a 09 28 64 65 62 75 67 3a 70 vars")..(debug:p
21d0: 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e 47 3a rint 0 "WARNING:
21e0: 20 59 6f 75 20 64 6f 20 6e 6f 74 20 68 61 76 65 You do not have
21f0: 20 61 20 72 75 6e 20 63 6f 6e 66 69 67 20 66 69 a run config fi
2200: 6c 65 3a 20 22 20 72 75 6e 63 6f 6e 66 69 67 66 le: " runconfigf
2210: 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 6c )). . ;; l
2220: 6f 6f 6b 20 75 70 20 61 6c 6c 20 74 65 73 74 73 ook up all tests
2230: 20 6d 61 74 63 68 69 6e 67 20 74 68 65 20 63 6f matching the co
2240: 6d 6d 61 20 73 65 70 61 72 61 74 65 64 20 6c 69 mma separated li
2250: 73 74 20 6f 66 20 67 6c 6f 62 73 20 69 6e 0a 20 st of globs in.
2260: 20 20 20 3b 3b 20 74 65 73 74 2d 70 61 74 74 73 ;; test-patts
2270: 20 28 75 73 69 6e 67 20 25 20 61 73 20 77 69 6c (using % as wil
2280: 64 63 61 72 64 29 0a 0a 20 20 20 20 28 73 65 74 dcard).. (set
2290: 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 28 74 65 ! test-names (te
22a0: 73 74 73 3a 67 65 74 2d 76 61 6c 69 64 2d 74 65 sts:get-valid-te
22b0: 73 74 73 20 2a 74 6f 70 70 61 74 68 2a 20 74 65 sts *toppath* te
22c0: 73 74 2d 70 61 74 74 73 20 74 65 73 74 2d 6e 61 st-patts test-na
22d0: 6d 65 73 3a 20 74 65 73 74 2d 6e 61 6d 65 73 29 mes: test-names)
22e0: 29 0a 20 20 20 20 28 73 65 74 21 20 74 65 73 74 ). (set! test
22f0: 2d 6e 61 6d 65 73 20 28 64 65 6c 65 74 65 2d 64 -names (delete-d
2300: 75 70 6c 69 63 61 74 65 73 20 74 65 73 74 2d 6e uplicates test-n
2310: 61 6d 65 73 29 29 0a 0a 20 20 20 20 28 64 65 62 ames)).. (deb
2320: 75 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f ug:print 0 "INFO
2330: 3a 20 74 65 73 74 20 6e 61 6d 65 73 20 22 20 74 : test names " t
2340: 65 73 74 2d 6e 61 6d 65 73 29 0a 0a 20 20 20 20 est-names)..
2350: 3b 3b 20 6f 6e 20 74 68 65 20 66 69 72 73 74 20 ;; on the first
2360: 70 61 73 73 20 6f 72 20 63 61 6c 6c 20 74 6f 20 pass or call to
2370: 72 75 6e 2d 74 65 73 74 73 20 73 65 74 20 46 41 run-tests set FA
2380: 49 4c 53 20 74 6f 20 4e 4f 54 5f 53 54 41 52 54 ILS to NOT_START
2390: 45 44 20 69 66 0a 20 20 20 20 3b 3b 20 2d 6b 65 ED if. ;; -ke
23a0: 65 70 67 6f 69 6e 67 20 69 73 20 73 70 65 63 69 epgoing is speci
23b0: 66 69 65 64 0a 20 20 20 20 28 69 66 20 28 65 71 fied. (if (eq
23c0: 3f 20 2a 70 61 73 73 6e 75 6d 2a 20 30 29 0a 09 ? *passnum* 0)..
23d0: 28 62 65 67 69 6e 0a 09 20 20 3b 3b 20 68 61 76 (begin.. ;; hav
23e0: 65 20 74 6f 20 64 65 6c 65 74 65 20 74 65 73 74 e to delete test
23f0: 20 72 65 63 6f 72 64 73 20 77 68 65 72 65 20 4e records where N
2400: 4f 54 5f 53 54 41 52 54 45 44 20 73 69 6e 63 65 OT_STARTED since
2410: 20 74 68 65 79 20 63 61 6e 20 63 61 75 73 65 20 they can cause
2420: 2d 6b 65 65 70 67 6f 69 6e 67 20 74 6f 20 0a 09 -keepgoing to ..
2430: 20 20 3b 3b 20 67 65 74 20 73 74 75 63 6b 20 64 ;; get stuck d
2440: 75 65 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 69 ue to becoming i
2450: 6e 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d naccessible from
2460: 20 61 20 66 61 69 6c 65 64 20 74 65 73 74 2e 20 a failed test.
2470: 49 2e 65 2e 20 69 66 20 74 65 73 74 20 42 20 64 I.e. if test B d
2480: 65 70 65 6e 64 73 20 0a 09 20 20 3b 3b 20 6f 6e epends .. ;; on
2490: 20 74 65 73 74 20 41 20 62 75 74 20 74 65 73 74 test A but test
24a0: 20 42 20 72 65 61 63 68 65 64 20 74 68 65 20 70 B reached the p
24b0: 6f 69 6e 74 20 6f 6e 20 62 65 69 6e 67 20 72 65 oint on being re
24c0: 67 69 73 74 65 72 65 64 20 61 73 20 4e 4f 54 5f gistered as NOT_
24d0: 53 54 41 52 54 45 44 20 61 6e 64 20 74 65 73 74 STARTED and test
24e0: 0a 09 20 20 3b 3b 20 41 20 66 61 69 6c 65 64 20 .. ;; A failed
24f0: 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 20 for some reason
2500: 74 68 65 6e 20 6f 6e 20 72 65 2d 72 75 6e 20 75 then on re-run u
2510: 73 69 6e 67 20 2d 6b 65 65 70 67 6f 69 6e 67 20 sing -keepgoing
2520: 74 68 65 20 72 75 6e 20 63 61 6e 20 6e 65 76 65 the run can neve
2530: 72 20 63 6f 6d 70 6c 65 74 65 2e 0a 09 20 20 28 r complete... (
2540: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
2550: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 69 b:delete-tests-i
2560: 6e 2d 73 74 61 74 65 20 64 62 20 72 75 6e 2d 69 n-state db run-i
2570: 64 20 22 4e 4f 54 5f 53 54 41 52 54 45 44 22 29 d "NOT_STARTED")
2580: 0a 09 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c .. (open-run-cl
2590: 6f 73 65 20 64 62 3a 73 65 74 2d 74 65 73 74 73 ose db:set-tests
25a0: 2d 73 74 61 74 65 2d 73 74 61 74 75 73 20 64 62 -state-status db
25b0: 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 6d run-id test-nam
25c0: 65 73 20 23 66 20 22 46 41 49 4c 22 20 22 4e 4f es #f "FAIL" "NO
25d0: 54 5f 53 54 41 52 54 45 44 22 20 22 46 41 49 4c T_STARTED" "FAIL
25e0: 22 29 29 29 0a 0a 20 20 20 20 3b 3b 20 66 72 6f "))).. ;; fro
25f0: 6d 20 68 65 72 65 20 6f 6e 20 6f 75 74 20 74 68 m here on out th
2600: 65 20 64 62 20 77 69 6c 6c 20 62 65 20 6f 70 65 e db will be ope
2610: 6e 65 64 20 61 6e 64 20 63 6c 6f 73 65 64 20 6f ned and closed o
2620: 6e 20 65 76 65 72 79 20 63 61 6c 6c 20 72 75 6e n every call run
2630: 73 3a 72 75 6e 2d 74 65 73 74 73 2d 71 75 65 75 s:run-tests-queu
2640: 65 0a 20 20 20 20 3b 3b 20 28 73 71 6c 69 74 65 e. ;; (sqlite
2650: 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 20 3:finalize! db)
2660: 0a 20 20 20 20 3b 3b 20 6e 6f 77 20 61 64 64 20 . ;; now add
2670: 6e 6f 6e 2d 64 69 72 65 63 74 6c 79 20 72 65 66 non-directly ref
2680: 65 72 65 6e 63 65 64 20 64 65 70 65 6e 64 65 6e erenced dependen
2690: 63 69 65 73 20 28 69 2e 65 2e 20 77 61 69 74 6f cies (i.e. waito
26a0: 6e 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 20 n). (if (not
26b0: 28 6e 75 6c 6c 3f 20 74 65 73 74 2d 6e 61 6d 65 (null? test-name
26c0: 73 29 29 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 s))..(let loop (
26d0: 28 68 65 64 20 28 63 61 72 20 74 65 73 74 2d 6e (hed (car test-n
26e0: 61 6d 65 73 29 29 0a 09 09 20 20 20 28 74 61 6c ames))... (tal
26f0: 20 28 63 64 72 20 74 65 73 74 2d 6e 61 6d 65 73 (cdr test-names
2700: 29 29 29 20 20 20 20 20 20 20 20 20 3b 3b 20 27 ))) ;; '
2710: 72 65 74 75 72 6e 2d 70 72 6f 63 73 20 74 65 6c return-procs tel
2720: 6c 73 20 74 68 65 20 63 6f 6e 66 69 67 20 72 65 ls the config re
2730: 61 64 65 72 20 74 6f 20 70 72 65 70 20 72 75 6e ader to prep run
2740: 6e 69 6e 67 20 73 79 73 74 65 6d 20 62 75 74 20 ning system but
2750: 72 65 74 75 72 6e 20 61 20 70 72 6f 63 0a 09 20 return a proc..
2760: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
2770: 22 49 4e 46 4f 3a 20 68 65 64 3d 22 20 68 65 64 "INFO: hed=" hed
2780: 20 22 20 61 74 20 74 6f 70 20 6f 66 20 6c 6f 6f " at top of loo
2790: 70 22 29 0a 09 20 20 28 6c 65 74 2a 20 28 28 63 p").. (let* ((c
27a0: 6f 6e 66 69 67 20 20 28 74 65 73 74 73 3a 67 65 onfig (tests:ge
27b0: 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 65 64 t-testconfig hed
27c0: 20 27 72 65 74 75 72 6e 2d 70 72 6f 63 73 29 29 'return-procs))
27d0: 0a 09 09 20 28 77 61 69 74 6f 6e 73 20 28 69 66 ... (waitons (if
27e0: 20 63 6f 6e 66 69 67 20 28 73 74 72 69 6e 67 2d config (string-
27f0: 73 70 6c 69 74 20 28 6c 65 74 20 28 28 77 20 28 split (let ((w (
2800: 63 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 63 6f config-lookup co
2810: 6e 66 69 67 20 22 72 65 71 75 69 72 65 6d 65 6e nfig "requiremen
2820: 74 73 22 20 22 77 61 69 74 6f 6e 22 29 29 29 0a ts" "waiton"))).
2830: 09 09 09 09 09 09 20 20 20 20 20 28 69 66 20 77 ...... (if w
2840: 20 77 20 22 22 29 29 29 0a 09 09 09 20 20 20 20 w "")))....
2850: 20 20 28 62 65 67 69 6e 0a 09 09 09 09 28 64 65 (begin.....(de
2860: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
2870: 4f 52 3a 20 6e 6f 6e 2d 65 78 69 73 74 65 6e 74 OR: non-existent
2880: 20 72 65 71 75 69 72 65 64 20 74 65 73 74 20 5c required test \
2890: 22 22 20 68 65 64 20 22 5c 22 22 29 0a 20 20 20 "" hed "\"").
28a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
28b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 (if
28c0: 20 64 62 20 28 73 71 6c 69 74 65 33 3a 66 69 6e db (sqlite3:fin
28d0: 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 09 09 09 alize! db)).....
28e0: 28 65 78 69 74 20 31 29 29 29 29 29 0a 09 20 20 (exit 1)))))..
28f0: 20 20 3b 3b 20 63 68 65 63 6b 20 66 6f 72 20 68 ;; check for h
2900: 65 64 20 69 6e 20 77 61 69 74 6f 6e 73 20 3d 3e ed in waitons =>
2910: 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 63 this would be c
2920: 69 72 63 75 6c 61 72 2c 20 72 65 6d 6f 76 65 20 ircular, remove
2930: 69 74 20 61 6e 64 20 69 73 73 75 65 20 61 6e 0a it and issue an.
2940: 09 20 20 20 20 3b 3b 20 65 72 72 6f 72 0a 09 20 . ;; error..
2950: 20 20 20 28 69 66 20 28 6d 65 6d 62 65 72 20 68 (if (member h
2960: 65 64 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 ed waitons)...(b
2970: 65 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a egin... (debug:
2980: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
2990: 74 65 73 74 20 22 20 68 65 64 20 22 20 68 61 73 test " hed " has
29a0: 20 6c 69 73 74 65 64 20 69 74 73 65 6c 66 20 61 listed itself a
29b0: 73 20 61 20 77 61 69 74 6f 6e 2c 20 70 6c 65 61 s a waiton, plea
29c0: 73 65 20 63 6f 72 72 65 63 74 20 74 68 69 73 21 se correct this!
29d0: 22 29 0a 09 09 20 20 28 73 65 74 21 20 77 61 69 ")... (set! wai
29e0: 74 6f 6e 73 20 28 66 69 6c 74 65 72 20 28 6c 61 tons (filter (la
29f0: 6d 62 64 61 20 28 78 29 28 6e 6f 74 20 28 65 71 mbda (x)(not (eq
2a00: 75 61 6c 3f 20 78 20 68 65 64 29 29 29 20 77 61 ual? x hed))) wa
2a10: 69 74 6f 6e 73 29 29 29 29 0a 09 20 20 20 20 0a itons)))).. .
2a20: 09 20 20 20 20 3b 3b 20 28 69 74 65 6d 73 20 20 . ;; (items
2a30: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d (items:get-item
2a40: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f s-from-config co
2a50: 6e 66 69 67 29 29 29 0a 09 20 20 20 20 28 69 66 nfig))).. (if
2a60: 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 62 6c (not (hash-tabl
2a70: 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 74 65 e-ref/default te
2a80: 73 74 2d 72 65 63 6f 72 64 73 20 68 65 64 20 23 st-records hed #
2a90: 66 29 29 0a 09 09 28 68 61 73 68 2d 74 61 62 6c f))...(hash-tabl
2aa0: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 63 6f e-set! test-reco
2ab0: 72 64 73 0a 09 09 09 09 20 68 65 64 20 28 76 65 rds..... hed (ve
2ac0: 63 74 6f 72 20 68 65 64 20 20 20 20 20 3b 3b 20 ctor hed ;;
2ad0: 30 0a 09 09 09 09 09 20 20 20 20 20 63 6f 6e 66 0...... conf
2ae0: 69 67 20 20 3b 3b 20 31 0a 09 09 09 09 09 20 20 ig ;; 1......
2af0: 20 20 20 77 61 69 74 6f 6e 73 20 3b 3b 20 32 0a waitons ;; 2.
2b00: 09 09 09 09 09 20 20 20 20 20 28 63 6f 6e 66 69 ..... (confi
2b10: 67 2d 6c 6f 6f 6b 75 70 20 63 6f 6e 66 69 67 20 g-lookup config
2b20: 22 72 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 "requirements" "
2b30: 70 72 69 6f 72 69 74 79 22 29 20 20 20 20 20 3b priority") ;
2b40: 3b 20 70 72 69 6f 72 69 74 79 20 33 0a 09 09 09 ; priority 3....
2b50: 09 09 20 20 20 20 20 28 6c 65 74 20 28 28 69 74 .. (let ((it
2b60: 65 6d 73 20 20 20 20 20 20 28 68 61 73 68 2d 74 ems (hash-t
2b70: 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 able-ref/default
2b80: 20 63 6f 6e 66 69 67 20 22 69 74 65 6d 73 22 20 config "items"
2b90: 23 66 29 29 20 3b 3b 20 69 74 65 6d 73 20 34 0a #f)) ;; items 4.
2ba0: 09 09 09 09 09 09 20 20 20 28 69 74 65 6d 73 74 ...... (itemst
2bb0: 61 62 6c 65 20 28 68 61 73 68 2d 74 61 62 6c 65 able (hash-table
2bc0: 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 63 6f 6e -ref/default con
2bd0: 66 69 67 20 22 69 74 65 6d 73 74 61 62 6c 65 22 fig "itemstable"
2be0: 20 23 66 29 29 29 20 0a 09 09 09 09 09 20 20 20 #f))) ......
2bf0: 20 20 20 20 3b 3b 20 69 66 20 65 69 74 68 65 72 ;; if either
2c00: 20 69 74 65 6d 73 20 6f 72 20 69 74 65 6d 73 20 items or items
2c10: 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 20 table is a proc
2c20: 72 65 74 75 72 6e 20 69 74 20 73 6f 20 74 65 73 return it so tes
2c30: 74 20 72 75 6e 6e 69 6e 67 0a 09 09 09 09 09 20 t running......
2c40: 20 20 20 20 20 20 3b 3b 20 70 72 6f 63 65 73 73 ;; process
2c50: 20 63 61 6e 20 6b 6e 6f 77 20 74 6f 20 63 61 6c can know to cal
2c60: 6c 20 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d l items:get-item
2c70: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 0a 09 09 s-from-config...
2c80: 09 09 09 20 20 20 20 20 20 20 3b 3b 20 69 66 20 ... ;; if
2c90: 65 69 74 68 65 72 20 69 73 20 61 20 6c 69 73 74 either is a list
2ca0: 20 61 6e 64 20 6e 6f 6e 65 20 69 73 20 61 20 70 and none is a p
2cb0: 72 6f 63 20 67 6f 20 61 68 65 61 64 20 61 6e 64 roc go ahead and
2cc0: 20 63 61 6c 6c 20 67 65 74 2d 69 74 65 6d 73 0a call get-items.
2cd0: 09 09 09 09 09 20 20 20 20 20 20 20 3b 3b 20 6f ..... ;; o
2ce0: 74 68 65 72 77 69 73 65 20 72 65 74 75 72 6e 20 therwise return
2cf0: 23 66 20 2d 20 74 68 69 73 20 69 73 20 6e 6f 74 #f - this is not
2d00: 20 61 6e 20 69 74 65 72 61 74 65 64 20 74 65 73 an iterated tes
2d10: 74 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 63 t...... (c
2d20: 6f 6e 64 0a 09 09 09 09 09 09 28 28 70 72 6f 63 ond.......((proc
2d30: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 20 20 20 edure? items)
2d40: 20 20 20 0a 09 09 09 09 09 09 20 28 64 65 62 75 ....... (debu
2d50: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a g:print 4 "INFO:
2d60: 20 69 74 65 6d 73 20 69 73 20 61 20 70 72 6f 63 items is a proc
2d70: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 edure, will calc
2d80: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 later").......
2d90: 69 74 65 6d 73 29 20 20 20 20 20 20 20 20 20 20 items)
2da0: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a ;; calc later.
2db0: 09 09 09 09 09 09 28 28 70 72 6f 63 65 64 75 72 ......((procedur
2dc0: 65 3f 20 69 74 65 6d 73 74 61 62 6c 65 29 0a 09 e? itemstable)..
2dd0: 09 09 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 ..... (debug:pri
2de0: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 69 74 65 6d nt 4 "INFO: item
2df0: 73 74 61 62 6c 65 20 69 73 20 61 20 70 72 6f 63 stable is a proc
2e00: 65 64 75 72 65 2c 20 77 69 6c 6c 20 63 61 6c 63 edure, will calc
2e10: 20 6c 61 74 65 72 22 29 0a 09 09 09 09 09 09 20 later").......
2e20: 69 74 65 6d 73 74 61 62 6c 65 29 20 20 20 20 20 itemstable)
2e30: 20 20 3b 3b 20 63 61 6c 63 20 6c 61 74 65 72 0a ;; calc later.
2e40: 09 09 09 09 09 09 28 28 66 69 6c 74 65 72 20 28 ......((filter (
2e50: 6c 61 6d 62 64 61 20 28 78 29 0a 09 09 09 09 09 lambda (x)......
2e60: 09 09 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 .. (let ((val
2e70: 28 63 61 72 20 78 29 29 29 0a 09 09 09 09 09 09 (car x))).......
2e80: 09 20 20 20 20 20 28 69 66 20 28 70 72 6f 63 65 . (if (proce
2e90: 64 75 72 65 3f 20 76 61 6c 29 20 76 61 6c 20 23 dure? val) val #
2ea0: 66 29 29 29 0a 09 09 09 09 09 09 09 20 28 61 70 f)))........ (ap
2eb0: 70 65 6e 64 20 28 69 66 20 28 6c 69 73 74 3f 20 pend (if (list?
2ec0: 69 74 65 6d 73 29 20 69 74 65 6d 73 20 27 28 29 items) items '()
2ed0: 29 0a 09 09 09 09 09 09 09 09 20 28 69 66 20 28 )......... (if (
2ee0: 6c 69 73 74 3f 20 69 74 65 6d 73 74 61 62 6c 65 list? itemstable
2ef0: 29 20 69 74 65 6d 73 74 61 62 6c 65 20 27 28 29 ) itemstable '()
2f00: 29 29 29 0a 09 09 09 09 09 09 20 27 68 61 76 65 )))....... 'have
2f10: 2d 70 72 6f 63 65 64 75 72 65 29 0a 09 09 09 09 -procedure).....
2f20: 09 09 28 28 6f 72 20 28 6c 69 73 74 3f 20 69 74 ..((or (list? it
2f30: 65 6d 73 29 28 6c 69 73 74 3f 20 69 74 65 6d 73 ems)(list? items
2f40: 74 61 62 6c 65 29 29 20 3b 3b 20 63 61 6c 63 20 table)) ;; calc
2f50: 6e 6f 77 0a 09 09 09 09 09 09 20 28 64 65 62 75 now....... (debu
2f60: 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a g:print 4 "INFO:
2f70: 20 69 74 65 6d 73 20 61 6e 64 20 69 74 65 6d 73 items and items
2f80: 74 61 62 6c 65 20 61 72 65 20 6c 69 73 74 73 2c table are lists,
2f90: 20 63 61 6c 63 20 6e 6f 77 5c 6e 22 0a 09 09 09 calc now\n"....
2fa0: 09 09 09 09 20 20 20 20 20 20 22 20 20 20 20 69 .... " i
2fb0: 74 65 6d 73 3a 20 22 20 69 74 65 6d 73 20 22 20 tems: " items "
2fc0: 69 74 65 6d 73 74 61 62 6c 65 3a 20 22 20 69 74 itemstable: " it
2fd0: 65 6d 73 74 61 62 6c 65 29 0a 09 09 09 09 09 09 emstable).......
2fe0: 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 6d (items:get-item
2ff0: 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 63 6f s-from-config co
3000: 6e 66 69 67 29 29 0a 09 09 09 09 09 09 28 65 6c nfig)).......(el
3010: 73 65 20 23 66 29 29 29 20 20 20 20 20 20 20 20 se #f)))
3020: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3030: 20 20 20 3b 3b 20 6e 6f 74 20 69 74 65 72 61 74 ;; not iterat
3040: 65 64 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 ed...... #f
3050: 20 20 20 20 20 3b 3b 20 69 74 65 6d 73 64 61 74 ;; itemsdat
3060: 20 35 0a 09 09 09 09 09 20 20 20 20 20 23 66 20 5...... #f
3070: 20 20 20 20 20 3b 3b 20 73 70 61 72 65 20 2d 20 ;; spare -
3080: 75 73 65 64 20 66 6f 72 20 69 74 65 6d 2d 70 61 used for item-pa
3090: 74 68 0a 09 09 09 09 09 20 20 20 20 20 29 29 29 th...... )))
30a0: 0a 09 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 .. (for-each
30b0: 0a 09 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 .. (lambda (
30c0: 77 61 69 74 6f 6e 29 0a 09 20 20 20 20 20 20 20 waiton)..
30d0: 28 69 66 20 28 61 6e 64 20 77 61 69 74 6f 6e 20 (if (and waiton
30e0: 28 6e 6f 74 20 28 6d 65 6d 62 65 72 20 77 61 69 (not (member wai
30f0: 74 6f 6e 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 ton test-names))
3100: 29 0a 09 09 20 20 20 28 62 65 67 69 6e 0a 09 09 )... (begin...
3110: 20 20 20 20 20 28 73 65 74 21 20 72 65 71 75 69 (set! requi
3120: 72 65 64 2d 74 65 73 74 73 20 28 63 6f 6e 73 20 red-tests (cons
3130: 77 61 69 74 6f 6e 20 72 65 71 75 69 72 65 64 2d waiton required-
3140: 74 65 73 74 73 29 29 0a 09 09 20 20 20 20 20 28 tests))... (
3150: 73 65 74 21 20 74 65 73 74 2d 6e 61 6d 65 73 20 set! test-names
3160: 28 63 6f 6e 73 20 77 61 69 74 6f 6e 20 74 65 73 (cons waiton tes
3170: 74 2d 6e 61 6d 65 73 29 29 29 29 29 20 3b 3b 20 t-names))))) ;;
3180: 77 61 73 20 61 6e 20 61 70 70 65 6e 64 2c 20 6e was an append, n
3190: 6f 77 20 61 20 63 6f 6e 73 0a 09 20 20 20 20 20 ow a cons..
31a0: 77 61 69 74 6f 6e 73 29 0a 09 20 20 20 20 28 6c waitons).. (l
31b0: 65 74 20 28 28 72 65 6d 74 65 73 74 73 20 28 64 et ((remtests (d
31c0: 65 6c 65 74 65 2d 64 75 70 6c 69 63 61 74 65 73 elete-duplicates
31d0: 20 28 61 70 70 65 6e 64 20 77 61 69 74 6f 6e 73 (append waitons
31e0: 20 74 61 6c 29 29 29 29 0a 09 20 20 20 20 20 20 tal))))..
31f0: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
3200: 72 65 6d 74 65 73 74 73 29 29 0a 09 09 20 20 28 remtests))... (
3210: 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 74 65 73 loop (car remtes
3220: 74 73 29 28 63 64 72 20 72 65 6d 74 65 73 74 73 ts)(cdr remtests
3230: 29 29 29 29 29 29 29 0a 0a 20 20 20 20 28 69 66 ))))))).. (if
3240: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 72 65 71 (not (null? req
3250: 75 69 72 65 64 2d 74 65 73 74 73 29 29 0a 09 28 uired-tests))..(
3260: 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 debug:print 1 "I
3270: 4e 46 4f 3a 20 41 64 64 69 6e 67 20 22 20 72 65 NFO: Adding " re
3280: 71 75 69 72 65 64 2d 74 65 73 74 73 20 22 20 74 quired-tests " t
3290: 6f 20 74 68 65 20 72 75 6e 20 71 75 65 75 65 22 o the run queue"
32a0: 29 29 0a 20 20 20 20 3b 3b 20 4e 4f 54 45 3a 20 )). ;; NOTE:
32b0: 74 68 65 73 65 20 61 72 65 20 61 6c 6c 20 70 61 these are all pa
32c0: 72 65 6e 74 20 74 65 73 74 73 2c 20 69 74 65 6d rent tests, item
32d0: 73 20 61 72 65 20 6e 6f 74 20 65 78 70 61 6e 64 s are not expand
32e0: 65 64 20 79 65 74 2e 0a 20 20 20 20 28 64 65 62 ed yet.. (deb
32f0: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f ug:print 4 "INFO
3300: 3a 20 74 65 73 74 2d 72 65 63 6f 72 64 73 3d 22 : test-records="
3310: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c (hash-table->al
3320: 69 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 73 ist test-records
3330: 29 29 0a 20 20 20 20 28 72 75 6e 73 3a 72 75 6e )). (runs:run
3340: 2d 74 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e -tests-queue run
3350: 2d 69 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 -id runname test
3360: 2d 72 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c -records keyvall
3370: 73 74 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 st flags test-pa
3380: 74 74 73 29 0a 20 20 20 20 28 64 65 62 75 67 3a tts). (debug:
3390: 70 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 41 print 4 "INFO: A
33a0: 6c 6c 20 64 6f 6e 65 20 62 79 20 68 65 72 65 22 ll done by here"
33b0: 29 29 29 0a 0a 28 64 65 66 69 6e 65 20 28 72 75 )))..(define (ru
33c0: 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 20 70 72 ns:calc-fails pr
33d0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 0a 20 ereqs-not-met).
33e0: 20 28 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 (filter (lambda
33f0: 20 28 74 65 73 74 29 0a 09 20 20 20 20 28 61 6e (test).. (an
3400: 64 20 28 76 65 63 74 6f 72 3f 20 74 65 73 74 29 d (vector? test)
3410: 20 3b 3b 20 6e 6f 74 20 28 73 74 72 69 6e 67 3f ;; not (string?
3420: 20 74 65 73 74 29 29 0a 09 09 20 28 65 71 75 61 test))... (equa
3430: 6c 3f 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d l? (db:test-get-
3440: 73 74 61 74 65 20 74 65 73 74 29 20 22 43 4f 4d state test) "COM
3450: 50 4c 45 54 45 44 22 29 0a 09 09 20 28 6e 6f 74 PLETED")... (not
3460: 20 28 6d 65 6d 62 65 72 20 28 64 62 3a 74 65 73 (member (db:tes
3470: 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 65 73 t-get-status tes
3480: 74 29 0a 09 09 09 20 20 20 20 20 20 27 28 22 50 t).... '("P
3490: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 ASS" "WARN" "CHE
34a0: 43 4b 22 20 22 57 41 49 56 45 44 22 29 29 29 29 CK" "WAIVED"))))
34b0: 29 0a 09 20 20 70 72 65 72 65 71 73 2d 6e 6f 74 ).. prereqs-not
34c0: 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 20 -met))..(define
34d0: 28 72 75 6e 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 (runs:calc-not-c
34e0: 6f 6d 70 6c 65 74 65 64 20 70 72 65 72 65 71 73 ompleted prereqs
34f0: 2d 6e 6f 74 2d 6d 65 74 29 0a 20 20 28 66 69 6c -not-met). (fil
3500: 74 65 72 0a 20 20 20 28 6c 61 6d 62 64 61 20 28 ter. (lambda (
3510: 74 29 0a 20 20 20 20 20 28 6f 72 20 28 6e 6f 74 t). (or (not
3520: 20 28 76 65 63 74 6f 72 3f 20 74 29 29 0a 09 20 (vector? t))..
3530: 28 6e 6f 74 20 28 65 71 75 61 6c 3f 20 22 43 4f (not (equal? "CO
3540: 4d 50 4c 45 54 45 44 22 20 28 64 62 3a 74 65 73 MPLETED" (db:tes
3550: 74 2d 67 65 74 2d 73 74 61 74 65 20 74 29 29 29 t-get-state t)))
3560: 29 29 0a 20 20 20 70 72 65 72 65 71 73 2d 6e 6f )). prereqs-no
3570: 74 2d 6d 65 74 29 29 0a 0a 28 64 65 66 69 6e 65 t-met))..(define
3580: 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 (runs:pretty-st
3590: 72 69 6e 67 20 6c 73 74 29 0a 20 20 28 6d 61 70 ring lst). (map
35a0: 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 20 28 (lambda (t).. (
35b0: 69 66 20 28 6e 6f 74 20 28 76 65 63 74 6f 72 3f if (not (vector?
35c0: 20 74 29 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 t)).. (conc
35d0: 20 74 29 0a 09 20 20 20 20 20 28 63 6f 6e 63 20 t).. (conc
35e0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
35f0: 74 6e 61 6d 65 20 74 29 20 22 3a 22 20 28 64 62 tname t) ":" (db
3600: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 65 20 :test-get-state
3610: 74 29 20 22 2f 22 20 28 64 62 3a 74 65 73 74 2d t) "/" (db:test-
3620: 67 65 74 2d 73 74 61 74 75 73 20 74 29 29 29 29 get-status t))))
3630: 0a 20 20 20 20 20 20 20 6c 73 74 29 29 0a 0a 28 . lst))..(
3640: 64 65 66 69 6e 65 20 28 72 75 6e 73 3a 6d 61 6b define (runs:mak
3650: 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 e-full-test-name
3660: 20 74 65 73 74 6e 61 6d 65 20 69 74 65 6d 70 61 testname itempa
3670: 74 68 29 0a 20 20 28 69 66 20 28 65 71 75 61 6c th). (if (equal
3680: 3f 20 69 74 65 6d 70 61 74 68 20 22 22 29 20 74 ? itempath "") t
3690: 65 73 74 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 estname (conc te
36a0: 73 74 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 70 stname "/" itemp
36b0: 61 74 68 29 29 29 0a 0a 3b 3b 20 74 65 73 74 2d ath)))..;; test-
36c0: 72 65 63 6f 72 64 73 20 69 73 20 61 20 68 61 73 records is a has
36d0: 68 20 74 61 62 6c 65 20 74 65 73 74 6e 61 6d 65 h table testname
36e0: 3a 69 74 65 6d 5f 70 61 74 68 20 3d 3e 20 76 65 :item_path => ve
36f0: 63 74 6f 72 20 3c 20 74 65 73 74 6e 61 6d 65 20 ctor < testname
3700: 74 65 73 74 63 6f 6e 66 69 67 20 77 61 69 74 6f testconfig waito
3710: 6e 73 20 70 72 69 6f 72 69 74 79 20 69 74 65 6d ns priority item
3720: 73 2d 69 6e 66 6f 20 2e 2e 2e 20 3e 0a 28 64 65 s-info ... >.(de
3730: 66 69 6e 65 20 28 72 75 6e 73 3a 72 75 6e 2d 74 fine (runs:run-t
3740: 65 73 74 73 2d 71 75 65 75 65 20 72 75 6e 2d 69 ests-queue run-i
3750: 64 20 72 75 6e 6e 61 6d 65 20 74 65 73 74 2d 72 d runname test-r
3760: 65 63 6f 72 64 73 20 6b 65 79 76 61 6c 6c 73 74 ecords keyvallst
3770: 20 66 6c 61 67 73 20 74 65 73 74 2d 70 61 74 74 flags test-patt
3780: 73 29 0a 20 20 20 20 3b 3b 20 41 74 20 74 68 69 s). ;; At thi
3790: 73 20 70 6f 69 6e 74 20 74 68 65 20 6c 69 73 74 s point the list
37a0: 20 6f 66 20 70 61 72 65 6e 74 20 74 65 73 74 73 of parent tests
37b0: 20 69 73 20 65 78 70 61 6e 64 65 64 20 0a 20 20 is expanded .
37c0: 20 20 3b 3b 20 4e 42 2f 2f 20 53 68 6f 75 6c 64 ;; NB// Should
37d0: 20 65 78 70 61 6e 64 20 69 74 65 6d 73 20 68 65 expand items he
37e0: 72 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 73 65 re and then inse
37f0: 72 74 20 69 6e 74 6f 20 74 68 65 20 72 75 6e 20 rt into the run
3800: 71 75 65 75 65 2e 0a 20 20 28 64 65 62 75 67 3a queue.. (debug:
3810: 70 72 69 6e 74 20 35 20 22 74 65 73 74 2d 72 65 print 5 "test-re
3820: 63 6f 72 64 73 3a 20 22 20 74 65 73 74 2d 72 65 cords: " test-re
3830: 63 6f 72 64 73 20 22 2c 20 6b 65 79 76 61 6c 6c cords ", keyvall
3840: 73 74 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 st: " keyvallst
3850: 22 20 66 6c 61 67 73 3a 20 22 20 28 68 61 73 68 " flags: " (hash
3860: 2d 74 61 62 6c 65 2d 3e 61 6c 69 73 74 20 66 6c -table->alist fl
3870: 61 67 73 29 29 0a 20 20 28 6c 65 74 20 28 28 73 ags)). (let ((s
3880: 6f 72 74 65 64 2d 74 65 73 74 2d 6e 61 6d 65 73 orted-test-names
3890: 20 28 74 65 73 74 73 3a 73 6f 72 74 2d 62 79 2d (tests:sort-by-
38a0: 70 72 69 6f 72 69 74 79 2d 61 6e 64 2d 77 61 69 priority-and-wai
38b0: 74 6f 6e 20 74 65 73 74 2d 72 65 63 6f 72 64 73 ton test-records
38c0: 29 29 0a 09 28 74 65 73 74 2d 72 65 67 69 73 74 ))..(test-regist
38d0: 65 72 79 20 20 20 20 28 6d 61 6b 65 2d 68 61 73 ery (make-has
38e0: 68 2d 74 61 62 6c 65 29 29 0a 09 28 6e 75 6d 2d h-table))..(num-
38f0: 72 65 74 72 69 65 73 20 20 20 20 20 20 20 20 30 retries 0
3900: 29 0a 09 28 6d 61 78 2d 72 65 74 72 69 65 73 20 )..(max-retries
3910: 20 20 20 20 20 20 28 63 6f 6e 66 69 67 2d 6c 6f (config-lo
3920: 6f 6b 75 70 20 2a 63 6f 6e 66 69 67 64 61 74 2a okup *configdat*
3930: 20 22 73 65 74 75 70 22 20 22 6d 61 78 72 65 74 "setup" "maxret
3940: 72 69 65 73 22 29 29 29 0a 20 20 20 20 28 73 65 ries"))). (se
3950: 74 21 20 6d 61 78 2d 72 65 74 72 69 65 73 20 28 t! max-retries (
3960: 69 66 20 28 61 6e 64 20 6d 61 78 2d 72 65 74 72 if (and max-retr
3970: 69 65 73 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d ies (string->num
3980: 62 65 72 20 6d 61 78 2d 72 65 74 72 69 65 73 29 ber max-retries)
3990: 29 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62 65 72 )(string->number
39a0: 20 6d 61 78 2d 72 65 74 72 69 65 73 29 20 31 30 max-retries) 10
39b0: 30 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f 74 0)). (if (not
39c0: 20 28 6e 75 6c 6c 3f 20 73 6f 72 74 65 64 2d 74 (null? sorted-t
39d0: 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 28 6c 65 est-names))..(le
39e0: 74 20 6c 6f 6f 70 20 28 28 68 65 64 20 20 20 20 t loop ((hed
39f0: 20 20 20 20 20 28 63 61 72 20 73 6f 72 74 65 64 (car sorted
3a00: 2d 74 65 73 74 2d 6e 61 6d 65 73 29 29 0a 09 09 -test-names))...
3a10: 20 20 20 28 74 61 6c 20 20 20 20 20 20 20 20 20 (tal
3a20: 28 63 64 72 20 73 6f 72 74 65 64 2d 74 65 73 74 (cdr sorted-test
3a30: 2d 6e 61 6d 65 73 29 29 0a 09 09 20 20 20 28 72 -names))... (r
3a40: 65 72 75 6e 73 20 20 20 20 20 20 27 28 29 29 29 eruns '()))
3a50: 0a 09 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 .. (if (not (nu
3a60: 6c 6c 3f 20 72 65 72 75 6e 73 29 29 28 64 65 62 ll? reruns))(deb
3a70: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f ug:print 4 "INFO
3a80: 3a 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e : reruns=" rerun
3a90: 73 29 29 0a 09 20 20 3b 3b 20 28 70 72 69 6e 74 s)).. ;; (print
3aa0: 20 22 54 6f 70 20 6f 66 20 6c 6f 6f 70 2c 20 68 "Top of loop, h
3ab0: 65 64 3d 22 20 68 65 64 20 22 2c 20 74 61 6c 3d ed=" hed ", tal=
3ac0: 22 20 74 61 6c 20 22 20 2c 72 65 72 75 6e 73 3d " tal " ,reruns=
3ad0: 22 20 72 65 72 75 6e 73 29 0a 09 20 20 28 6c 65 " reruns).. (le
3ae0: 74 2a 20 28 28 74 65 73 74 2d 72 65 63 6f 72 64 t* ((test-record
3af0: 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 (hash-table-ref
3b00: 20 74 65 73 74 2d 72 65 63 6f 72 64 73 20 68 65 test-records he
3b10: 64 29 29 0a 09 09 20 28 74 65 73 74 2d 6e 61 6d d))... (test-nam
3b20: 65 20 20 20 28 74 65 73 74 73 3a 74 65 73 74 71 e (tests:testq
3b30: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d ueue-get-testnam
3b40: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a e test-record)).
3b50: 09 09 20 28 74 63 6f 6e 66 69 67 20 20 20 20 20 .. (tconfig
3b60: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3b70: 2d 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 -get-testconfig
3b80: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 test-record))...
3b90: 20 28 74 65 73 74 6d 6f 64 65 20 20 20 20 28 6c (testmode (l
3ba0: 65 74 20 28 28 6d 20 28 63 6f 6e 66 69 67 2d 6c et ((m (config-l
3bb0: 6f 6f 6b 75 70 20 74 63 6f 6e 66 69 67 20 22 72 ookup tconfig "r
3bc0: 65 71 75 69 72 65 6d 65 6e 74 73 22 20 22 6d 6f equirements" "mo
3bd0: 64 65 22 29 29 29 0a 09 09 09 09 28 69 66 20 6d de"))).....(if m
3be0: 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c (string->symbol
3bf0: 20 6d 29 20 27 6e 6f 72 6d 61 6c 29 29 29 0a 09 m) 'normal)))..
3c00: 09 20 28 77 61 69 74 6f 6e 73 20 20 20 20 20 28 . (waitons (
3c10: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
3c20: 67 65 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 get-waitons t
3c30: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 est-record))...
3c40: 28 70 72 69 6f 72 69 74 79 20 20 20 20 28 74 65 (priority (te
3c50: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
3c60: 74 2d 70 72 69 6f 72 69 74 79 20 20 20 74 65 73 t-priority tes
3c70: 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 20 28 69 t-record))... (i
3c80: 74 65 6d 64 61 74 20 20 20 20 20 28 74 65 73 74 temdat (test
3c90: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
3ca0: 69 74 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d itemdat test-
3cb0: 72 65 63 6f 72 64 29 29 20 3b 3b 20 69 74 65 6d record)) ;; item
3cc0: 64 61 74 20 63 61 6e 20 62 65 20 61 20 73 74 72 dat can be a str
3cd0: 69 6e 67 2c 20 6c 69 73 74 20 6f 72 20 23 66 0a ing, list or #f.
3ce0: 09 09 20 28 69 74 65 6d 73 20 20 20 20 20 20 20 .. (items
3cf0: 28 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 (tests:testqueue
3d00: 2d 67 65 74 2d 69 74 65 6d 73 20 20 20 20 20 20 -get-items
3d10: 74 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 09 test-record))...
3d20: 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 28 69 (item-path (i
3d30: 74 65 6d 2d 6c 69 73 74 2d 3e 70 61 74 68 20 69 tem-list->path i
3d40: 74 65 6d 64 61 74 29 29 0a 09 09 20 28 6e 65 77 temdat))... (new
3d50: 74 61 6c 20 20 20 20 20 20 28 61 70 70 65 6e 64 tal (append
3d60: 20 74 61 6c 20 28 6c 69 73 74 20 68 65 64 29 29 tal (list hed))
3d70: 29 29 0a 09 20 20 20 20 0a 09 20 20 20 20 28 64 )).. .. (d
3d80: 65 62 75 67 3a 70 72 69 6e 74 20 36 0a 09 09 09 ebug:print 6....
3d90: 20 22 74 65 73 74 2d 6e 61 6d 65 3a 20 22 20 74 "test-name: " t
3da0: 65 73 74 2d 6e 61 6d 65 0a 09 09 09 20 22 5c 6e est-name.... "\n
3db0: 20 20 68 65 64 3a 20 20 20 20 20 20 20 20 20 22 hed: "
3dc0: 20 68 65 64 0a 09 09 09 20 22 5c 6e 20 20 69 74 hed.... "\n it
3dd0: 65 6d 64 61 74 3a 20 20 20 20 20 22 20 69 74 65 emdat: " ite
3de0: 6d 64 61 74 0a 09 09 09 20 22 5c 6e 20 20 69 74 mdat.... "\n it
3df0: 65 6d 73 3a 20 20 20 20 20 20 20 22 20 69 74 65 ems: " ite
3e00: 6d 73 0a 09 09 09 20 22 5c 6e 20 20 69 74 65 6d ms.... "\n item
3e10: 2d 70 61 74 68 3a 20 20 20 22 20 69 74 65 6d 2d -path: " item-
3e20: 70 61 74 68 0a 09 09 09 20 22 5c 6e 20 20 77 61 path.... "\n wa
3e30: 69 74 6f 6e 73 3a 20 20 20 20 20 22 20 77 61 69 itons: " wai
3e40: 74 6f 6e 73 0a 09 09 09 20 22 5c 6e 20 20 6e 75 tons.... "\n nu
3e50: 6d 2d 72 65 74 72 69 65 73 3a 20 22 20 6e 75 6d m-retries: " num
3e60: 2d 72 65 74 72 69 65 73 0a 09 09 09 20 22 5c 6e -retries.... "\n
3e70: 20 20 74 61 6c 3a 20 20 20 20 20 20 20 20 20 22 tal: "
3e80: 20 74 61 6c 0a 09 09 09 20 22 5c 6e 20 20 72 65 tal.... "\n re
3e90: 72 75 6e 73 3a 20 20 20 20 20 20 22 20 72 65 72 runs: " rer
3ea0: 75 6e 73 29 0a 0a 09 20 20 20 20 3b 3b 20 63 68 uns)... ;; ch
3eb0: 65 63 6b 20 66 6f 72 20 68 65 64 20 69 6e 20 77 eck for hed in w
3ec0: 61 69 74 6f 6e 73 20 3d 3e 20 74 68 69 73 20 77 aitons => this w
3ed0: 6f 75 6c 64 20 62 65 20 63 69 72 63 75 6c 61 72 ould be circular
3ee0: 2c 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 20 , remove it and
3ef0: 69 73 73 75 65 20 61 6e 0a 09 20 20 20 20 3b 3b issue an.. ;;
3f00: 20 65 72 72 6f 72 0a 09 20 20 20 20 28 69 66 20 error.. (if
3f10: 28 6d 65 6d 62 65 72 20 74 65 73 74 2d 6e 61 6d (member test-nam
3f20: 65 20 77 61 69 74 6f 6e 73 29 0a 09 09 28 62 65 e waitons)...(be
3f30: 67 69 6e 0a 09 09 20 20 28 64 65 62 75 67 3a 70 gin... (debug:p
3f40: 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 74 rint 0 "ERROR: t
3f50: 65 73 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 est " test-name
3f60: 22 20 68 61 73 20 6c 69 73 74 65 64 20 69 74 73 " has listed its
3f70: 65 6c 66 20 61 73 20 61 20 77 61 69 74 6f 6e 2c elf as a waiton,
3f80: 20 70 6c 65 61 73 65 20 63 6f 72 72 65 63 74 20 please correct
3f90: 74 68 69 73 21 22 29 0a 09 09 20 20 28 73 65 74 this!")... (set
3fa0: 21 20 77 61 69 74 6f 6e 20 28 66 69 6c 74 65 72 ! waiton (filter
3fb0: 20 28 6c 61 6d 62 64 61 20 28 78 29 28 6e 6f 74 (lambda (x)(not
3fc0: 20 28 65 71 75 61 6c 3f 20 78 20 68 65 64 29 29 (equal? x hed))
3fd0: 29 20 77 61 69 74 6f 6e 73 29 29 29 29 0a 0a 09 ) waitons))))...
3fe0: 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 4f 55 54 (cond ;; OUT
3ff0: 45 52 20 43 4f 4e 44 0a 09 20 20 20 20 20 28 28 ER COND.. ((
4000: 6e 6f 74 20 69 74 65 6d 73 29 20 3b 3b 20 77 68 not items) ;; wh
4010: 65 6e 20 66 61 6c 73 65 20 74 68 65 20 74 65 73 en false the tes
4020: 74 20 69 73 20 6f 6b 20 74 6f 20 62 65 20 68 61 t is ok to be ha
4030: 6e 64 65 64 20 6f 66 66 20 74 6f 20 6c 61 75 6e nded off to laun
4040: 63 68 20 28 62 75 74 20 6e 6f 74 20 62 65 66 6f ch (but not befo
4050: 72 65 29 0a 09 20 20 20 20 20 20 28 6c 65 74 2a re).. (let*
4060: 20 28 28 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e ((run-limits-in
4070: 66 6f 20 20 20 20 20 20 20 20 20 28 6f 70 65 6e fo (open
4080: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a -run-close runs:
4090: 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 can-run-more-tes
40a0: 74 73 20 23 66 20 74 65 73 74 2d 72 65 63 6f 72 ts #f test-recor
40b0: 64 29 29 20 3b 3b 20 6c 6f 6f 6b 20 61 74 20 74 d)) ;; look at t
40c0: 68 65 20 74 65 73 74 20 6a 6f 62 67 72 6f 75 70 he test jobgroup
40d0: 20 61 6e 64 20 74 6f 74 20 6a 6f 62 73 20 72 75 and tot jobs ru
40e0: 6e 6e 69 6e 67 0a 09 09 20 20 20 20 20 28 68 61 nning... (ha
40f0: 76 65 2d 72 65 73 6f 75 72 63 65 73 20 20 20 20 ve-resources
4100: 20 20 20 20 20 20 28 63 61 72 20 72 75 6e 2d 6c (car run-l
4110: 69 6d 69 74 73 2d 69 6e 66 6f 29 29 0a 09 09 20 imits-info))...
4120: 20 20 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 (num-running
4130: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 (li
4140: 73 74 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 st-ref run-limit
4150: 73 2d 69 6e 66 6f 20 31 29 29 0a 09 09 20 20 20 s-info 1))...
4160: 20 20 28 6e 75 6d 2d 72 75 6e 6e 69 6e 67 2d 69 (num-running-i
4170: 6e 2d 6a 6f 62 67 72 6f 75 70 20 28 6c 69 73 74 n-jobgroup (list
4180: 2d 72 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d -ref run-limits-
4190: 69 6e 66 6f 20 32 29 29 0a 09 09 20 20 20 20 20 info 2))...
41a0: 28 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 2d (max-concurrent-
41b0: 6a 6f 62 73 20 20 20 20 20 28 6c 69 73 74 2d 72 jobs (list-r
41c0: 65 66 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e ef run-limits-in
41d0: 66 6f 20 33 29 29 0a 09 09 20 20 20 20 20 28 6a fo 3))... (j
41e0: 6f 62 2d 67 72 6f 75 70 2d 6c 69 6d 69 74 20 20 ob-group-limit
41f0: 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 (list-ref
4200: 20 72 75 6e 2d 6c 69 6d 69 74 73 2d 69 6e 66 6f run-limits-info
4210: 20 34 29 29 0a 09 09 20 20 20 20 20 28 70 72 65 4))... (pre
4220: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 20 20 20 reqs-not-met
4230: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
4240: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72 lose db:get-prer
4250: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 eqs-not-met #f r
4260: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 un-id waitons it
4270: 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 em-path mode: te
4280: 73 74 6d 6f 64 65 29 29 0a 09 09 20 20 20 20 20 stmode))...
4290: 28 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 (fails
42a0: 20 20 20 20 20 20 20 20 20 28 72 75 6e 73 3a 63 (runs:c
42b0: 61 6c 63 2d 66 61 69 6c 73 20 70 72 65 72 65 71 alc-fails prereq
42c0: 73 2d 6e 6f 74 2d 6d 65 74 29 29 0a 09 09 20 20 s-not-met))...
42d0: 20 20 20 28 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 (non-complete
42e0: 64 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6e d (run
42f0: 73 3a 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c s:calc-not-compl
4300: 65 74 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 eted prereqs-not
4310: 2d 6d 65 74 29 29 29 0a 09 09 28 64 65 62 75 67 -met)))...(debug
4320: 3a 70 72 69 6e 74 20 38 20 22 49 4e 46 4f 3a 20 :print 8 "INFO:
4330: 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 3a 20 have-resources:
4340: 22 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 " have-resources
4350: 20 22 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d " prereqs-not-m
4360: 65 74 3a 20 22 20 0a 09 09 09 20 20 20 20 20 28 et: " .... (
4370: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
4380: 73 65 20 0a 09 09 09 20 20 20 20 20 20 28 6d 61 se .... (ma
4390: 70 20 28 6c 61 6d 62 64 61 20 28 74 29 0a 09 09 p (lambda (t)...
43a0: 09 09 20 20 20 20 20 28 69 66 20 28 76 65 63 74 .. (if (vect
43b0: 6f 72 3f 20 74 29 0a 09 09 09 09 09 20 28 63 6f or? t)...... (co
43c0: 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d nc (db:test-get-
43d0: 73 74 61 74 65 20 74 29 20 22 2f 22 20 28 64 62 state t) "/" (db
43e0: 3a 74 65 73 74 2d 67 65 74 2d 73 74 61 74 75 73 :test-get-status
43f0: 20 74 29 29 0a 09 09 09 09 09 20 28 63 6f 6e 63 t))...... (conc
4400: 20 22 20 57 41 52 4e 49 4e 47 3a 20 74 20 69 73 " WARNING: t is
4410: 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 3d 22 20 not a vector="
4420: 74 20 29 29 29 0a 09 09 09 09 20 20 20 70 72 65 t )))..... pre
4430: 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 29 20 22 2c reqs-not-met) ",
4440: 20 22 29 20 22 20 66 61 69 6c 73 3a 20 22 20 66 ") " fails: " f
4450: 61 69 6c 73 29 0a 09 09 28 64 65 62 75 67 3a 70 ails)...(debug:p
4460: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 68 65 rint 4 "INFO: he
4470: 64 3d 22 20 68 65 64 29 0a 0a 09 09 3b 3b 20 44 d=" hed)....;; D
4480: 6f 6e 27 74 20 6b 6e 6f 77 20 61 74 20 74 68 69 on't know at thi
4490: 73 20 74 69 6d 65 20 69 66 20 74 68 65 20 74 65 s time if the te
44a0: 73 74 20 68 61 76 65 20 62 65 65 6e 20 6c 61 75 st have been lau
44b0: 6e 63 68 65 64 20 61 74 20 73 6f 6d 65 20 74 69 nched at some ti
44c0: 6d 65 20 69 6e 20 74 68 65 20 70 61 73 74 0a 09 me in the past..
44d0: 09 3b 3b 20 69 2e 65 2e 20 69 73 20 74 68 69 73 .;; i.e. is this
44e0: 20 61 20 72 65 2d 6c 61 75 6e 63 68 3f 0a 09 09 a re-launch?...
44f0: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 22 (debug:print 4 "
4500: 49 4e 46 4f 3a 20 72 75 6e 2d 6c 69 6d 69 74 73 INFO: run-limits
4510: 2d 69 6e 66 6f 20 3d 20 22 20 72 75 6e 2d 6c 69 -info = " run-li
4520: 6d 69 74 73 2d 69 6e 66 6f 29 0a 09 09 28 63 6f mits-info)...(co
4530: 6e 64 20 3b 3b 20 49 4e 4e 45 52 20 43 4f 4e 44 nd ;; INNER COND
4540: 20 23 31 20 66 6f 72 20 61 20 6c 61 75 6e 63 68 #1 for a launch
4550: 61 62 6c 65 20 74 65 73 74 0a 09 09 20 3b 3b 20 able test... ;;
4560: 43 68 65 63 6b 20 69 74 65 6d 20 70 61 74 68 20 Check item path
4570: 61 67 61 69 6e 73 74 20 69 74 65 6d 2d 70 61 74 against item-pat
4580: 74 73 0a 09 09 20 28 28 6e 6f 74 20 28 74 65 73 ts... ((not (tes
4590: 74 73 3a 6d 61 74 63 68 20 74 65 73 74 2d 70 61 ts:match test-pa
45a0: 74 74 73 20 28 74 65 73 74 73 3a 74 65 73 74 71 tts (tests:testq
45b0: 75 65 75 65 2d 67 65 74 2d 74 65 73 74 6e 61 6d ueue-get-testnam
45c0: 65 20 74 65 73 74 2d 72 65 63 6f 72 64 29 20 69 e test-record) i
45d0: 74 65 6d 2d 70 61 74 68 29 29 20 3b 3b 20 54 68 tem-path)) ;; Th
45e0: 69 73 20 74 65 73 74 2f 69 74 65 6d 70 61 74 68 is test/itempath
45f0: 20 69 73 20 6e 6f 74 20 74 6f 20 62 65 20 72 75 is not to be ru
4600: 6e 0a 09 09 20 20 3b 3b 20 65 6c 73 65 20 74 68 n... ;; else th
4610: 65 20 72 75 6e 20 69 73 20 73 74 75 63 6b 2c 20 e run is stuck,
4620: 74 65 6d 70 6f 72 61 72 69 6c 79 20 6f 72 20 70 temporarily or p
4630: 65 72 6d 61 6e 65 6e 74 6c 79 0a 09 09 20 20 3b ermanently... ;
4640: 3b 20 62 75 74 20 73 68 6f 75 6c 64 20 63 68 65 ; but should che
4650: 63 6b 20 69 66 20 69 74 20 69 73 20 64 75 65 20 ck if it is due
4660: 74 6f 20 6c 61 63 6b 20 6f 66 20 72 65 73 6f 75 to lack of resou
4670: 72 63 65 73 20 76 73 2e 20 70 72 65 72 65 71 75 rces vs. prerequ
4680: 69 73 69 74 65 73 0a 09 09 20 20 28 64 65 62 75 isites... (debu
4690: 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a g:print 1 "INFO:
46a0: 20 53 6b 69 70 70 69 6e 67 20 22 20 28 74 65 73 Skipping " (tes
46b0: 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 ts:testqueue-get
46c0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 2d 72 -testname test-r
46d0: 65 63 6f 72 64 29 20 22 20 22 20 69 74 65 6d 2d ecord) " " item-
46e0: 70 61 74 68 20 22 20 61 73 20 69 74 20 64 6f 65 path " as it doe
46f0: 73 6e 27 74 20 6d 61 74 63 68 20 22 20 74 65 73 sn't match " tes
4700: 74 2d 70 61 74 74 73 29 0a 09 09 20 20 28 74 68 t-patts)... (th
4710: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f read-sleep! *glo
4720: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 bal-delta*)...
4730: 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 (if (not (null?
4740: 74 61 6c 29 29 0a 09 09 20 20 20 20 20 20 28 6c tal))... (l
4750: 6f 6f 70 20 28 63 61 72 20 74 61 6c 29 28 63 64 oop (car tal)(cd
4760: 72 20 74 61 6c 29 20 72 65 72 75 6e 73 29 29 29 r tal) reruns)))
4770: 0a 09 09 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 ... ((and (not (
4780: 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f 64 hash-table-ref/d
4790: 65 66 61 75 6c 74 20 74 65 73 74 2d 72 65 67 69 efault test-regi
47a0: 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 stery (runs:make
47b0: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 -full-test-name
47c0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
47d0: 61 74 68 29 20 23 66 29 29 0a 09 09 20 20 20 20 ath) #f))...
47e0: 20 20 20 28 61 6e 64 20 6d 61 78 2d 63 6f 6e 63 (and max-conc
47f0: 75 72 72 65 6e 74 2d 6a 6f 62 73 20 28 3e 20 28 urrent-jobs (> (
4800: 2d 20 6d 61 78 2d 63 6f 6e 63 75 72 72 65 6e 74 - max-concurrent
4810: 2d 6a 6f 62 73 20 6e 75 6d 2d 72 75 6e 6e 69 6e -jobs num-runnin
4820: 67 29 20 35 29 29 29 0a 09 09 20 20 28 6f 70 65 g) 5)))... (ope
4830: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 74 n-run-close db:t
4840: 65 73 74 73 2d 72 65 67 69 73 74 65 72 2d 74 65 ests-register-te
4850: 73 74 20 23 66 20 72 75 6e 2d 69 64 20 74 65 73 st #f run-id tes
4860: 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 74 68 t-name item-path
4870: 29 0a 09 09 20 20 28 68 61 73 68 2d 74 61 62 6c )... (hash-tabl
4880: 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 67 69 e-set! test-regi
4890: 73 74 65 72 79 20 28 72 75 6e 73 3a 6d 61 6b 65 stery (runs:make
48a0: 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e 61 6d 65 20 -full-test-name
48b0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
48c0: 61 74 68 29 20 23 74 29 0a 09 09 20 20 28 74 68 ath) #t)... (th
48d0: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f read-sleep! *glo
48e0: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 20 bal-delta*)...
48f0: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 (loop (car newta
4900: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 l)(cdr newtal) r
4910: 65 72 75 6e 73 29 29 0a 09 09 20 28 28 6e 6f 74 eruns))... ((not
4920: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 29 have-resources)
4930: 20 3b 3b 20 73 69 6d 70 6c 79 20 74 72 79 20 61 ;; simply try a
4940: 67 61 69 6e 20 61 66 74 65 72 20 77 61 69 74 69 gain after waiti
4950: 6e 67 20 61 20 73 65 63 6f 6e 64 0a 09 09 20 20 ng a second...
4960: 28 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 28 (thread-sleep! (
4970: 2b 20 31 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 + 1 *global-delt
4980: 61 2a 29 29 0a 09 09 20 20 28 64 65 62 75 67 3a a*))... (debug:
4990: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 6e print 1 "INFO: n
49a0: 6f 20 72 65 73 6f 75 72 63 65 73 20 74 6f 20 72 o resources to r
49b0: 75 6e 20 6e 65 77 20 74 65 73 74 73 2c 20 77 61 un new tests, wa
49c0: 69 74 69 6e 67 20 2e 2e 2e 22 29 0a 09 09 20 20 iting ...")...
49d0: 3b 3b 20 63 6f 75 6c 64 20 68 61 76 65 20 64 6f ;; could have do
49e0: 6e 65 20 68 65 64 20 74 61 6c 20 68 65 72 65 20 ne hed tal here
49f0: 62 75 74 20 64 6f 69 6e 67 20 63 61 72 2f 63 64 but doing car/cd
4a00: 72 20 6f 66 20 6e 65 77 74 61 6c 20 74 6f 20 72 r of newtal to r
4a10: 6f 74 61 74 65 20 74 65 73 74 73 0a 09 09 20 20 otate tests...
4a20: 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 (loop (car newta
4a30: 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 l)(cdr newtal) r
4a40: 65 72 75 6e 73 29 29 0a 09 09 20 28 28 61 6e 64 eruns))... ((and
4a50: 20 68 61 76 65 2d 72 65 73 6f 75 72 63 65 73 0a have-resources.
4a60: 09 09 20 20 20 20 20 20 20 28 6f 72 20 28 6e 75 .. (or (nu
4a70: 6c 6c 3f 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d ll? prereqs-not-
4a80: 6d 65 74 29 0a 09 09 09 20 20 20 28 61 6e 64 20 met).... (and
4a90: 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 (eq? testmode 't
4aa0: 6f 70 6c 65 76 65 6c 29 0a 09 09 09 09 28 6e 75 oplevel).....(nu
4ab0: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 ll? non-complete
4ac0: 64 29 29 29 29 0a 09 09 20 20 28 72 75 6e 3a 74 d))))... (run:t
4ad0: 65 73 74 20 72 75 6e 2d 69 64 20 72 75 6e 6e 61 est run-id runna
4ae0: 6d 65 20 6b 65 79 76 61 6c 6c 73 74 20 74 65 73 me keyvallst tes
4af0: 74 2d 72 65 63 6f 72 64 20 66 6c 61 67 73 20 23 t-record flags #
4b00: 66 29 0a 09 09 20 20 28 74 68 72 65 61 64 2d 73 f)... (thread-s
4b10: 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 leep! *global-de
4b20: 6c 74 61 2a 29 0a 09 09 20 20 28 69 66 20 28 6e lta*)... (if (n
4b30: 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a ot (null? tal)).
4b40: 09 09 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 .. (loop (c
4b50: 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 ar tal)(cdr tal)
4b60: 20 72 65 72 75 6e 73 29 29 29 0a 09 09 20 28 65 reruns)))... (e
4b70: 6c 73 65 20 3b 3b 20 6d 75 73 74 20 62 65 20 77 lse ;; must be w
4b80: 65 20 68 61 76 65 20 75 6e 6d 65 74 20 70 72 65 e have unmet pre
4b90: 72 65 71 75 69 73 69 74 65 73 0a 09 09 20 20 20 requisites...
4ba0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
4bb0: 22 46 41 49 4c 53 3a 20 22 20 66 61 69 6c 73 29 "FAILS: " fails)
4bc0: 0a 09 09 20 20 20 20 3b 3b 20 49 66 20 6f 6e 65 ... ;; If one
4bd0: 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 or more of the
4be0: 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 prereqs-not-met
4bf0: 61 72 65 20 46 41 49 4c 20 74 68 65 6e 20 77 65 are FAIL then we
4c00: 20 63 61 6e 20 69 73 73 75 65 0a 09 09 20 20 20 can issue...
4c10: 20 3b 3b 20 61 20 6d 65 73 73 61 67 65 20 61 6e ;; a message an
4c20: 64 20 64 72 6f 70 20 68 65 64 20 66 72 6f 6d 20 d drop hed from
4c30: 74 68 65 20 69 74 65 6d 73 20 74 6f 20 62 65 20 the items to be
4c40: 70 72 6f 63 65 73 73 65 64 2e 0a 09 09 20 20 20 processed....
4c50: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 66 61 69 6c (if (null? fail
4c60: 73 29 0a 09 09 09 28 62 65 67 69 6e 0a 09 09 09 s)....(begin....
4c70: 20 20 3b 3b 20 63 6f 75 6c 64 6e 27 74 20 72 75 ;; couldn't ru
4c80: 6e 2c 20 74 61 6b 65 20 61 20 62 72 65 61 74 68 n, take a breath
4c90: 65 72 0a 09 09 09 20 20 28 64 65 62 75 67 3a 70 er.... (debug:p
4ca0: 72 69 6e 74 20 34 20 22 49 4e 46 4f 3a 20 53 68 rint 4 "INFO: Sh
4cb0: 6f 75 6c 64 6e 27 74 20 72 65 61 6c 6c 79 20 67 ouldn't really g
4cc0: 65 74 20 68 65 72 65 2c 20 72 61 63 65 20 63 6f et here, race co
4cd0: 6e 64 69 74 69 6f 6e 3f 20 55 6e 61 62 6c 65 20 ndition? Unable
4ce0: 74 6f 20 6c 61 75 6e 63 68 20 6d 6f 72 65 20 74 to launch more t
4cf0: 65 73 74 73 20 61 74 20 74 68 69 73 20 6d 6f 6d ests at this mom
4d00: 65 6e 74 2c 20 6b 69 6c 6c 69 6e 67 20 74 69 6d ent, killing tim
4d10: 65 20 2e 2e 2e 22 29 0a 09 09 09 20 20 28 74 68 e ...").... (th
4d20: 72 65 61 64 2d 73 6c 65 65 70 21 20 28 2b 20 31 read-sleep! (+ 1
4d30: 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 *global-delta*)
4d40: 29 20 3b 3b 20 6c 6f 6e 67 20 73 6c 65 65 70 20 ) ;; long sleep
4d50: 68 65 72 65 20 2d 20 6e 6f 20 72 65 73 6f 75 72 here - no resour
4d60: 63 65 73 2c 20 6d 61 79 20 61 73 20 77 65 6c 6c ces, may as well
4d70: 20 62 65 20 70 61 74 69 65 6e 74 0a 09 09 09 20 be patient....
4d80: 20 3b 3b 20 77 65 20 6d 61 64 65 20 6e 65 77 20 ;; we made new
4d90: 74 61 6c 20 62 79 20 73 74 69 63 6b 69 6e 67 20 tal by sticking
4da0: 68 65 64 20 61 74 20 74 68 65 20 62 61 63 6b 20 hed at the back
4db0: 6f 66 20 74 68 65 20 6c 69 73 74 0a 09 09 09 20 of the list....
4dc0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 (loop (car newt
4dd0: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 al)(cdr newtal)
4de0: 72 65 72 75 6e 73 29 29 0a 09 09 09 3b 3b 20 74 reruns))....;; t
4df0: 68 65 20 77 61 69 74 6f 6e 20 69 73 20 46 41 49 he waiton is FAI
4e00: 4c 20 73 6f 20 6e 6f 20 70 6f 69 6e 74 20 69 6e L so no point in
4e10: 20 74 72 79 69 6e 67 20 74 6f 20 72 75 6e 20 68 trying to run h
4e20: 65 64 20 65 76 65 72 20 61 67 61 69 6e 0a 09 09 ed ever again...
4e30: 09 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f .(if (not (null?
4e40: 20 74 61 6c 29 29 0a 09 09 09 20 20 20 20 28 69 tal)).... (i
4e50: 66 20 28 76 65 63 74 6f 72 3f 20 68 65 64 29 0a f (vector? hed).
4e60: 09 09 09 09 28 62 65 67 69 6e 20 28 64 65 62 75 ....(begin (debu
4e70: 67 3a 70 72 69 6e 74 20 31 20 22 57 41 52 4e 3a g:print 1 "WARN:
4e80: 20 44 72 6f 70 70 69 6e 67 20 74 65 73 74 20 22 Dropping test "
4e90: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 (db:test-get-te
4ea0: 73 74 6e 61 6d 65 20 68 65 64 29 20 22 2f 22 20 stname hed) "/"
4eb0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 74 65 (db:test-get-ite
4ec0: 6d 2d 70 61 74 68 20 68 65 64 29 0a 09 09 09 09 m-path hed).....
4ed0: 09 09 20 20 20 20 22 20 66 72 6f 6d 20 74 68 65 .. " from the
4ee0: 20 6c 61 75 6e 63 68 20 6c 69 73 74 20 61 73 20 launch list as
4ef0: 69 74 20 68 61 73 20 70 72 65 72 65 71 75 69 73 it has prerequis
4f00: 74 65 73 20 74 68 61 74 20 61 72 65 20 46 41 49 tes that are FAI
4f10: 4c 22 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 L")..... (
4f20: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
4f30: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
4f40: 09 09 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 .. (loop (
4f50: 63 61 72 20 74 61 6c 29 28 63 64 72 20 74 61 6c car tal)(cdr tal
4f60: 29 20 28 63 6f 6e 73 20 68 65 64 20 72 65 72 75 ) (cons hed reru
4f70: 6e 73 29 29 29 0a 09 09 09 09 28 62 65 67 69 6e ns))).....(begin
4f80: 0a 09 09 09 09 20 20 28 64 65 62 75 67 3a 70 72 ..... (debug:pr
4f90: 69 6e 74 20 31 20 22 57 41 52 4e 3a 20 54 65 73 int 1 "WARN: Tes
4fa0: 74 20 6e 6f 74 20 70 72 6f 63 65 73 73 65 64 20 t not processed
4fb0: 63 6f 72 72 65 63 74 6c 79 2e 20 43 6f 75 6c 64 correctly. Could
4fc0: 20 62 65 20 61 20 72 61 63 65 20 63 6f 6e 64 69 be a race condi
4fd0: 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 74 65 73 tion in your tes
4fe0: 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e t implementation
4ff0: 3f 20 22 20 68 65 64 29 20 3b 3b 20 20 22 20 61 ? " hed) ;; " a
5000: 73 20 69 74 20 68 61 73 20 70 72 65 72 65 71 75 s it has prerequ
5010: 69 73 74 65 73 20 74 68 61 74 20 61 72 65 20 46 istes that are F
5020: 41 49 4c 2e 20 28 4e 4f 54 45 3a 20 68 65 64 20 AIL. (NOTE: hed
5030: 69 73 20 6e 6f 74 20 61 20 76 65 63 74 6f 72 29 is not a vector)
5040: 22 29 0a 09 09 09 09 20 20 28 74 68 72 65 61 64 ")..... (thread
5050: 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c 2d -sleep! *global-
5060: 64 65 6c 74 61 2a 29 0a 09 09 09 09 20 20 28 6c delta*)..... (l
5070: 6f 6f 70 20 68 65 64 20 74 61 6c 20 72 65 72 75 oop hed tal reru
5080: 6e 73 29 29 29 29 29 29 29 29 29 20 3b 3b 20 45 ns))))))))) ;; E
5090: 4e 44 20 4f 46 20 49 4e 4e 45 52 20 43 4f 4e 44 ND OF INNER COND
50a0: 0a 09 20 20 20 20 20 0a 09 20 20 20 20 20 3b 3b .. .. ;;
50b0: 20 63 61 73 65 20 77 68 65 72 65 20 61 6e 20 69 case where an i
50c0: 74 65 6d 73 20 63 61 6d 65 20 69 6e 20 61 73 20 tems came in as
50d0: 61 20 6c 69 73 74 20 62 65 65 6e 20 70 72 6f 63 a list been proc
50e0: 65 73 73 65 64 0a 09 20 20 20 20 20 28 28 61 6e essed.. ((an
50f0: 64 20 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 d (list? items)
5100: 20 20 20 20 3b 3b 20 74 68 75 73 20 77 65 20 6b ;; thus we k
5110: 6e 6f 77 20 6f 75 72 20 69 74 65 6d 73 20 61 72 now our items ar
5120: 65 20 61 6c 72 65 61 64 79 20 63 61 6c 63 75 6c e already calcul
5130: 61 74 65 64 0a 09 09 20 20 20 28 6e 6f 74 20 20 ated... (not
5140: 20 69 74 65 6d 64 61 74 29 29 20 3b 3b 20 61 6e itemdat)) ;; an
5150: 64 20 6e 6f 74 20 79 65 74 20 65 78 70 61 6e 64 d not yet expand
5160: 65 64 20 69 6e 74 6f 20 74 68 65 20 6c 69 73 74 ed into the list
5170: 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 62 65 of things to be
5180: 20 64 6f 6e 65 0a 09 20 20 20 20 20 20 28 69 66 done.. (if
5190: 20 28 61 6e 64 20 28 3e 3d 20 2a 76 65 72 62 6f (and (>= *verbo
51a0: 73 69 74 79 2a 20 31 29 0a 09 09 20 20 20 20 20 sity* 1)...
51b0: 20 20 28 3e 20 28 6c 65 6e 67 74 68 20 69 74 65 (> (length ite
51c0: 6d 73 29 20 30 29 0a 09 09 20 20 20 20 20 20 20 ms) 0)...
51d0: 28 3e 20 28 6c 65 6e 67 74 68 20 28 63 61 72 20 (> (length (car
51e0: 69 74 65 6d 73 29 29 20 30 29 29 0a 09 09 20 20 items)) 0))...
51f0: 28 70 70 20 69 74 65 6d 73 29 29 0a 09 20 20 20 (pp items))..
5200: 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 09 20 20 (for-each..
5210: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 79 (lambda (my
5220: 2d 69 74 65 6d 64 61 74 29 0a 09 09 20 28 6c 65 -itemdat)... (le
5230: 74 2a 20 28 28 6e 65 77 2d 74 65 73 74 2d 72 65 t* ((new-test-re
5240: 63 6f 72 64 20 28 6c 65 74 20 28 28 6e 65 77 72 cord (let ((newr
5250: 65 63 20 28 6d 61 6b 65 2d 74 65 73 74 73 3a 74 ec (make-tests:t
5260: 65 73 74 71 75 65 75 65 29 29 29 0a 09 09 09 09 estqueue))).....
5270: 09 20 20 20 28 76 65 63 74 6f 72 2d 63 6f 70 79 . (vector-copy
5280: 21 20 74 65 73 74 2d 72 65 63 6f 72 64 20 6e 65 ! test-record ne
5290: 77 72 65 63 29 0a 09 09 09 09 09 20 20 20 6e 65 wrec)...... ne
52a0: 77 72 65 63 29 29 0a 09 09 09 28 6d 79 2d 69 74 wrec))....(my-it
52b0: 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c 69 em-path (item-li
52c0: 73 74 2d 3e 70 61 74 68 20 6d 79 2d 69 74 65 6d st->path my-item
52d0: 64 61 74 29 29 29 0a 09 09 20 20 20 28 69 66 20 dat)))... (if
52e0: 28 74 65 73 74 73 3a 6d 61 74 63 68 20 74 65 73 (tests:match tes
52f0: 74 2d 70 61 74 74 73 20 68 65 64 20 6d 79 2d 69 t-patts hed my-i
5300: 74 65 6d 2d 70 61 74 68 29 20 3b 3b 20 28 70 61 tem-path) ;; (pa
5310: 74 74 2d 6c 69 73 74 2d 6d 61 74 63 68 20 6d 79 tt-list-match my
5320: 2d 69 74 65 6d 2d 70 61 74 68 20 69 74 65 6d 2d -item-path item-
5330: 70 61 74 74 73 29 20 20 20 20 20 20 20 20 20 20 patts)
5340: 20 3b 3b 20 79 65 73 2c 20 77 65 20 77 61 6e 74 ;; yes, we want
5350: 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 69 73 to process this
5360: 20 69 74 65 6d 2c 20 4e 4f 54 45 3a 20 53 68 6f item, NOTE: Sho
5370: 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 uld not need thi
5380: 73 20 63 68 65 63 6b 20 68 65 72 65 21 0a 09 09 s check here!...
5390: 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 (let ((ne
53a0: 77 74 65 73 74 6e 61 6d 65 20 28 72 75 6e 73 3a wtestname (runs:
53b0: 6d 61 6b 65 2d 66 75 6c 6c 2d 74 65 73 74 2d 6e make-full-test-n
53c0: 61 6d 65 20 68 65 64 20 6d 79 2d 69 74 65 6d 2d ame hed my-item-
53d0: 70 61 74 68 29 29 29 20 20 20 20 3b 3b 20 74 65 path))) ;; te
53e0: 73 74 20 6e 61 6d 65 73 20 61 72 65 20 75 6e 69 st names are uni
53f0: 71 75 65 20 6f 6e 20 74 65 73 74 6e 61 6d 65 2f que on testname/
5400: 69 74 65 6d 2d 70 61 74 68 0a 09 09 09 20 28 74 item-path.... (t
5410: 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 73 ests:testqueue-s
5420: 65 74 2d 69 74 65 6d 73 21 20 20 20 20 20 6e 65 et-items! ne
5430: 77 2d 74 65 73 74 2d 72 65 63 6f 72 64 20 23 66 w-test-record #f
5440: 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 ).... (tests:tes
5450: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 64 tqueue-set-itemd
5460: 61 74 21 20 20 20 6e 65 77 2d 74 65 73 74 2d 72 at! new-test-r
5470: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 64 61 74 ecord my-itemdat
5480: 29 0a 09 09 09 20 28 74 65 73 74 73 3a 74 65 73 ).... (tests:tes
5490: 74 71 75 65 75 65 2d 73 65 74 2d 69 74 65 6d 5f tqueue-set-item_
54a0: 70 61 74 68 21 20 6e 65 77 2d 74 65 73 74 2d 72 path! new-test-r
54b0: 65 63 6f 72 64 20 6d 79 2d 69 74 65 6d 2d 70 61 ecord my-item-pa
54c0: 74 68 29 0a 09 09 09 20 28 68 61 73 68 2d 74 61 th).... (hash-ta
54d0: 62 6c 65 2d 73 65 74 21 20 74 65 73 74 2d 72 65 ble-set! test-re
54e0: 63 6f 72 64 73 20 6e 65 77 74 65 73 74 6e 61 6d cords newtestnam
54f0: 65 20 6e 65 77 2d 74 65 73 74 2d 72 65 63 6f 72 e new-test-recor
5500: 64 29 0a 09 09 09 20 28 73 65 74 21 20 74 61 6c d).... (set! tal
5510: 20 28 63 6f 6e 73 20 6e 65 77 74 65 73 74 6e 61 (cons newtestna
5520: 6d 65 20 74 61 6c 29 29 29 29 29 29 20 3b 3b 20 me tal)))))) ;;
5530: 73 69 6e 63 65 20 74 68 65 73 65 20 61 72 65 20 since these are
5540: 69 74 65 6d 69 7a 65 64 20 63 72 65 61 74 65 20 itemized create
5550: 6e 65 77 20 74 65 73 74 20 6e 61 6d 65 73 20 74 new test names t
5560: 65 73 74 6e 61 6d 65 2f 69 74 65 6d 70 61 74 68 estname/itempath
5570: 0a 09 20 20 20 20 20 20 20 69 74 65 6d 73 29 0a .. items).
5580: 09 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 . (if (not
5590: 28 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 09 20 (null? tal))...
55a0: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 28 74 (begin... (t
55b0: 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c hread-sleep! *gl
55c0: 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 20 obal-delta*)...
55d0: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
55e0: 34 20 22 49 4e 46 4f 3a 20 45 6e 64 20 6f 66 20 4 "INFO: End of
55f0: 69 74 65 6d 73 20 6c 69 73 74 2c 20 6c 6f 6f 70 items list, loop
5600: 69 6e 67 20 77 69 74 68 20 6e 65 78 74 22 29 0a ing with next").
5610: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 .. (loop (car
5620: 20 74 61 6c 29 28 63 64 72 20 74 61 6c 29 20 72 tal)(cdr tal) r
5630: 65 72 75 6e 73 29 29 29 29 0a 0a 09 20 20 20 20 eruns))))...
5640: 20 3b 3b 20 69 66 20 69 74 65 6d 73 20 69 73 20 ;; if items is
5650: 61 20 70 72 6f 63 20 74 68 65 6e 20 6e 65 65 64 a proc then need
5660: 20 74 6f 20 72 75 6e 20 69 74 65 6d 73 3a 67 65 to run items:ge
5670: 74 2d 69 74 65 6d 73 2d 66 72 6f 6d 2d 63 6f 6e t-items-from-con
5680: 66 69 67 2c 20 67 65 74 20 74 68 65 20 6c 69 73 fig, get the lis
5690: 74 20 61 6e 64 20 6c 6f 6f 70 20 0a 09 20 20 20 t and loop ..
56a0: 20 20 3b 3b 20 20 20 20 2d 20 62 75 74 20 6f 6e ;; - but on
56b0: 6c 79 20 64 6f 20 74 68 61 74 20 69 66 20 72 65 ly do that if re
56c0: 73 6f 75 72 63 65 73 20 65 78 69 73 74 20 74 6f sources exist to
56d0: 20 6b 69 63 6b 20 6f 66 66 20 74 68 65 20 6a 6f kick off the jo
56e0: 62 0a 09 20 20 20 20 20 28 28 6f 72 20 28 70 72 b.. ((or (pr
56f0: 6f 63 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 ocedure? items)(
5700: 65 71 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d eq? items 'have-
5710: 70 72 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20 procedure))..
5720: 20 20 20 28 6c 65 74 20 28 28 63 61 6e 2d 72 75 (let ((can-ru
5730: 6e 2d 6d 6f 72 65 20 20 20 20 28 6f 70 65 6e 2d n-more (open-
5740: 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 63 run-close runs:c
5750: 61 6e 2d 72 75 6e 2d 6d 6f 72 65 2d 74 65 73 74 an-run-more-test
5760: 73 20 23 66 20 74 65 73 74 2d 72 65 63 6f 72 64 s #f test-record
5770: 29 29 29 0a 09 09 28 69 66 20 63 61 6e 2d 72 75 )))...(if can-ru
5780: 6e 2d 6d 6f 72 65 0a 09 09 20 20 20 20 28 6c 65 n-more... (le
5790: 74 2a 20 28 28 70 72 65 72 65 71 73 2d 6e 6f 74 t* ((prereqs-not
57a0: 2d 6d 65 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 -met (open-run-c
57b0: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 70 72 65 72 lose db:get-prer
57c0: 65 71 73 2d 6e 6f 74 2d 6d 65 74 20 23 66 20 72 eqs-not-met #f r
57d0: 75 6e 2d 69 64 20 77 61 69 74 6f 6e 73 20 69 74 un-id waitons it
57e0: 65 6d 2d 70 61 74 68 20 6d 6f 64 65 3a 20 74 65 em-path mode: te
57f0: 73 74 6d 6f 64 65 29 29 0a 09 09 09 20 20 20 28 stmode)).... (
5800: 66 61 69 6c 73 20 20 20 20 20 20 20 20 20 20 20 fails
5810: 28 72 75 6e 73 3a 63 61 6c 63 2d 66 61 69 6c 73 (runs:calc-fails
5820: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
5830: 29 29 0a 09 09 09 20 20 20 28 6e 6f 6e 2d 63 6f )).... (non-co
5840: 6d 70 6c 65 74 65 64 20 20 20 28 72 75 6e 73 3a mpleted (runs:
5850: 63 61 6c 63 2d 6e 6f 74 2d 63 6f 6d 70 6c 65 74 calc-not-complet
5860: 65 64 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d ed prereqs-not-m
5870: 65 74 29 29 29 0a 09 09 20 20 20 20 20 20 28 64 et)))... (d
5880: 65 62 75 67 3a 70 72 69 6e 74 20 38 20 22 49 4e ebug:print 8 "IN
5890: 46 4f 3a 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 FO: can-run-more
58a0: 3a 20 22 20 63 61 6e 2d 72 75 6e 2d 6d 6f 72 65 : " can-run-more
58b0: 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74 ..... "\n test
58c0: 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 22 20 68 name: " h
58d0: 65 64 0a 09 09 09 09 20 20 20 22 5c 6e 20 70 72 ed..... "\n pr
58e0: 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 3a 20 22 ereqs-not-met: "
58f0: 20 28 72 75 6e 73 3a 70 72 65 74 74 79 2d 73 74 (runs:pretty-st
5900: 72 69 6e 67 20 70 72 65 72 65 71 73 2d 6e 6f 74 ring prereqs-not
5910: 2d 6d 65 74 29 0a 09 09 09 09 20 20 20 22 5c 6e -met)..... "\n
5920: 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 3a 20 non-completed:
5930: 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 74 79 " (runs:pretty
5940: 2d 73 74 72 69 6e 67 20 6e 6f 6e 2d 63 6f 6d 70 -string non-comp
5950: 6c 65 74 65 64 29 20 0a 09 09 09 09 20 20 20 22 leted) ..... "
5960: 5c 6e 20 66 61 69 6c 73 3a 20 20 20 20 20 20 20 \n fails:
5970: 20 20 20 20 22 20 28 72 75 6e 73 3a 70 72 65 74 " (runs:pret
5980: 74 79 2d 73 74 72 69 6e 67 20 66 61 69 6c 73 29 ty-string fails)
5990: 0a 09 09 09 09 20 20 20 22 5c 6e 20 74 65 73 74 ..... "\n test
59a0: 6d 6f 64 65 3a 20 20 20 20 20 20 20 20 22 20 74 mode: " t
59b0: 65 73 74 6d 6f 64 65 0a 09 09 09 09 20 20 20 22 estmode..... "
59c0: 5c 6e 20 6e 75 6d 2d 72 65 74 72 69 65 73 3a 20 \n num-retries:
59d0: 20 20 20 20 22 20 6e 75 6d 2d 72 65 74 72 69 65 " num-retrie
59e0: 73 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 65 71 s..... "\n (eq
59f0: 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 6c ? testmode 'topl
5a00: 65 76 65 6c 29 3a 20 22 20 28 65 71 3f 20 74 65 evel): " (eq? te
5a10: 73 74 6d 6f 64 65 20 27 74 6f 70 6c 65 76 65 6c stmode 'toplevel
5a20: 29 0a 09 09 09 09 20 20 20 22 5c 6e 20 28 6e 75 )..... "\n (nu
5a30: 6c 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 ll? non-complete
5a40: 64 29 3a 20 20 20 20 22 20 28 6e 75 6c 6c 3f 20 d): " (null?
5a50: 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 29 0a 09 non-completed)..
5a60: 09 09 09 20 20 20 22 5c 6e 20 72 65 72 75 6e 73 ... "\n reruns
5a70: 3a 20 22 20 72 65 72 75 6e 73 29 0a 0a 09 09 20 : " reruns)....
5a80: 20 20 20 20 20 28 63 6f 6e 64 20 3b 3b 20 49 4e (cond ;; IN
5a90: 4e 45 52 20 43 4f 4e 44 20 23 32 0a 09 09 20 20 NER COND #2...
5aa0: 20 20 20 20 20 28 28 6f 72 20 28 6e 75 6c 6c 3f ((or (null?
5ab0: 20 70 72 65 72 65 71 73 2d 6e 6f 74 2d 6d 65 74 prereqs-not-met
5ac0: 29 20 3b 3b 20 61 6c 6c 20 70 72 65 72 65 71 73 ) ;; all prereqs
5ad0: 20 6d 65 74 2c 20 66 69 72 65 20 6f 66 66 20 74 met, fire off t
5ae0: 68 65 20 74 65 73 74 0a 09 09 09 20 20 20 20 3b he test.... ;
5af0: 3b 20 6f 72 2c 20 69 66 20 69 74 20 69 73 20 61 ; or, if it is a
5b00: 20 27 74 6f 70 6c 65 76 65 6c 20 74 65 73 74 20 'toplevel test
5b10: 61 6e 64 20 61 6c 6c 20 70 72 65 72 65 71 73 20 and all prereqs
5b20: 6e 6f 74 20 6d 65 74 20 61 72 65 20 43 4f 4d 50 not met are COMP
5b30: 4c 45 54 45 44 20 74 68 65 6e 20 6c 61 75 6e 63 LETED then launc
5b40: 68 0a 09 09 09 20 20 20 20 28 61 6e 64 20 28 65 h.... (and (e
5b50: 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 74 6f 70 q? testmode 'top
5b60: 6c 65 76 65 6c 29 0a 09 09 09 09 20 28 6e 75 6c level)..... (nul
5b70: 6c 3f 20 6e 6f 6e 2d 63 6f 6d 70 6c 65 74 65 64 l? non-completed
5b80: 29 29 29 0a 09 09 09 28 6c 65 74 20 28 28 74 65 )))....(let ((te
5b90: 73 74 2d 6e 61 6d 65 20 28 74 65 73 74 73 3a 74 st-name (tests:t
5ba0: 65 73 74 71 75 65 75 65 2d 67 65 74 2d 74 65 73 estqueue-get-tes
5bb0: 74 6e 61 6d 65 20 74 65 73 74 2d 72 65 63 6f 72 tname test-recor
5bc0: 64 29 29 29 0a 09 09 09 20 20 28 73 65 74 65 6e d))).... (seten
5bd0: 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 4d 45 22 v "MT_TEST_NAME"
5be0: 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b 3b 20 0a test-name) ;; .
5bf0: 09 09 09 20 20 28 73 65 74 65 6e 76 20 22 4d 54 ... (setenv "MT
5c00: 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 6e 6e _RUNNAME" runn
5c10: 61 6d 65 29 0a 09 09 09 20 20 28 6f 70 65 6e 2d ame).... (open-
5c20: 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d 65 run-close set-me
5c30: 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 20 gatest-env-vars
5c40: 23 66 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 68 #f run-id) ;; th
5c50: 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 65 ese may be neede
5c60: 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 69 d by the launchi
5c70: 6e 67 20 70 72 6f 63 65 73 73 0a 09 09 09 20 20 ng process....
5c80: 28 6c 65 74 20 28 28 69 74 65 6d 73 2d 6c 69 73 (let ((items-lis
5c90: 74 20 28 69 74 65 6d 73 3a 67 65 74 2d 69 74 65 t (items:get-ite
5ca0: 6d 73 2d 66 72 6f 6d 2d 63 6f 6e 66 69 67 20 74 ms-from-config t
5cb0: 63 6f 6e 66 69 67 29 29 29 0a 09 09 09 20 20 20 config)))....
5cc0: 20 28 69 66 20 28 6c 69 73 74 3f 20 69 74 65 6d (if (list? item
5cd0: 73 2d 6c 69 73 74 29 0a 09 09 09 09 28 62 65 67 s-list).....(beg
5ce0: 69 6e 0a 09 09 09 09 20 20 28 74 65 73 74 73 3a in..... (tests:
5cf0: 74 65 73 74 71 75 65 75 65 2d 73 65 74 2d 69 74 testqueue-set-it
5d00: 65 6d 73 21 20 74 65 73 74 2d 72 65 63 6f 72 64 ems! test-record
5d10: 20 69 74 65 6d 73 2d 6c 69 73 74 29 0a 09 09 09 items-list)....
5d20: 09 20 20 28 74 68 72 65 61 64 2d 73 6c 65 65 70 . (thread-sleep
5d30: 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a ! *global-delta*
5d40: 29 0a 09 09 09 09 20 20 28 6c 6f 6f 70 20 68 65 )..... (loop he
5d50: 64 20 74 61 6c 20 72 65 72 75 6e 73 29 29 0a 09 d tal reruns))..
5d60: 09 09 09 28 62 65 67 69 6e 0a 09 09 09 09 20 20 ...(begin.....
5d70: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 (debug:print 0 "
5d80: 45 52 52 4f 52 3a 20 54 68 65 20 70 72 6f 63 20 ERROR: The proc
5d90: 66 72 6f 6d 20 72 65 61 64 69 6e 67 20 74 68 65 from reading the
5da0: 20 73 65 74 75 70 20 64 69 64 20 6e 6f 74 20 79 setup did not y
5db0: 69 65 6c 64 20 61 20 6c 69 73 74 20 2d 20 70 6c ield a list - pl
5dc0: 65 61 73 65 20 72 65 70 6f 72 74 20 74 68 69 73 ease report this
5dd0: 22 29 0a 09 09 09 09 20 20 28 65 78 69 74 20 31 ")..... (exit 1
5de0: 29 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 20 ))))))...
5df0: 28 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 0a 09 ((null? fails)..
5e00: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 ..(debug:print 4
5e10: 20 22 49 4e 46 4f 3a 20 66 61 69 6c 73 20 69 73 "INFO: fails is
5e20: 20 6e 75 6c 6c 2c 20 6d 6f 76 69 6e 67 20 6f 6e null, moving on
5e30: 20 69 6e 20 74 68 65 20 71 75 65 75 65 20 62 75 in the queue bu
5e40: 74 20 6b 65 65 70 69 6e 67 20 22 20 68 65 64 20 t keeping " hed
5e50: 22 20 66 6f 72 20 6e 6f 77 22 29 0a 09 09 09 28 " for now")....(
5e60: 74 68 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 thread-sleep! *g
5e70: 6c 6f 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 lobal-delta*)...
5e80: 09 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 .(loop (car newt
5e90: 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 al)(cdr newtal)
5ea0: 72 65 72 75 6e 73 29 29 20 3b 3b 20 61 6e 20 69 reruns)) ;; an i
5eb0: 73 73 75 65 20 77 69 74 68 20 70 72 65 72 65 71 ssue with prereq
5ec0: 73 20 6e 6f 74 20 79 65 74 20 6d 65 74 3f 0a 09 s not yet met?..
5ed0: 09 20 20 20 20 20 20 20 28 28 61 6e 64 20 28 6e . ((and (n
5ee0: 6f 74 20 28 6e 75 6c 6c 3f 20 66 61 69 6c 73 29 ot (null? fails)
5ef0: 29 28 65 71 3f 20 74 65 73 74 6d 6f 64 65 20 27 )(eq? testmode '
5f00: 6e 6f 72 6d 61 6c 29 29 0a 09 09 09 28 64 65 62 normal))....(deb
5f10: 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e 46 4f ug:print 1 "INFO
5f20: 3a 20 74 65 73 74 20 22 20 20 68 65 64 20 22 20 : test " hed "
5f30: 28 6d 6f 64 65 3d 22 20 74 65 73 74 6d 6f 64 65 (mode=" testmode
5f40: 20 22 29 20 68 61 73 20 66 61 69 6c 65 64 20 70 ") has failed p
5f50: 72 65 72 65 71 75 69 73 69 74 65 28 73 29 3b 20 rerequisite(s);
5f60: 22 0a 09 09 09 09 20 20 20 20 20 28 73 74 72 69 "..... (stri
5f70: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 28 ng-intersperse (
5f80: 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 74 29 28 map (lambda (t)(
5f90: 63 6f 6e 63 20 28 64 62 3a 74 65 73 74 2d 67 65 conc (db:test-ge
5fa0: 74 2d 74 65 73 74 6e 61 6d 65 20 74 29 20 22 3a t-testname t) ":
5fb0: 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 73 " (db:test-get-s
5fc0: 74 61 74 65 20 74 29 22 2f 22 28 64 62 3a 74 65 tate t)"/"(db:te
5fd0: 73 74 2d 67 65 74 2d 73 74 61 74 75 73 20 74 29 st-get-status t)
5fe0: 29 29 20 66 61 69 6c 73 29 20 22 2c 20 22 29 0a )) fails) ", ").
5ff0: 09 09 09 09 20 20 20 20 20 22 2c 20 72 65 6d 6f .... ", remo
6000: 76 69 6e 67 20 69 74 20 66 72 6f 6d 20 74 6f 2d ving it from to-
6010: 64 6f 20 6c 69 73 74 22 29 0a 09 09 09 28 69 66 do list")....(if
6020: 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 74 61 6c (not (null? tal
6030: 29 29 0a 09 09 09 20 20 20 20 28 62 65 67 69 6e )).... (begin
6040: 0a 09 09 09 20 20 20 20 20 20 28 74 68 72 65 61 .... (threa
6050: 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f 62 61 6c d-sleep! *global
6060: 2d 64 65 6c 74 61 2a 29 0a 09 09 09 20 20 20 20 -delta*)....
6070: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 74 61 6c (loop (car tal
6080: 29 28 63 64 72 20 74 61 6c 29 28 63 6f 6e 73 20 )(cdr tal)(cons
6090: 68 65 64 20 72 65 72 75 6e 73 29 29 29 29 29 0a hed reruns))))).
60a0: 09 09 20 20 20 20 20 20 20 28 65 6c 73 65 0a 09 .. (else..
60b0: 09 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 38 ..(debug:print 8
60c0: 20 22 45 52 52 4f 52 3a 20 4e 6f 20 68 61 6e 64 "ERROR: No hand
60d0: 6c 65 72 20 66 6f 72 20 74 68 69 73 20 63 6f 6e ler for this con
60e0: 64 69 74 69 6f 6e 2e 22 29 0a 09 09 09 28 74 68 dition.")....(th
60f0: 72 65 61 64 2d 73 6c 65 65 70 21 20 2a 67 6c 6f read-sleep! *glo
6100: 62 61 6c 2d 64 65 6c 74 61 2a 29 0a 09 09 09 28 bal-delta*)....(
6110: 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 74 61 6c loop (car newtal
6120: 29 28 63 64 72 20 6e 65 77 74 61 6c 29 20 72 65 )(cdr newtal) re
6130: 72 75 6e 73 29 29 29 29 20 3b 3b 20 45 4e 44 20 runs)))) ;; END
6140: 4f 46 20 49 46 20 43 41 4e 20 52 55 4e 20 4d 4f OF IF CAN RUN MO
6150: 52 45 0a 0a 09 09 20 20 20 20 3b 3b 20 69 66 20 RE.... ;; if
6160: 63 61 6e 27 74 20 72 75 6e 20 6d 6f 72 65 20 6a can't run more j
6170: 75 73 74 20 6c 6f 6f 70 20 77 69 74 68 20 6e 65 ust loop with ne
6180: 78 74 20 70 6f 73 73 69 62 6c 65 20 74 65 73 74 xt possible test
6190: 0a 09 09 20 20 20 20 28 62 65 67 69 6e 0a 09 09 ... (begin...
61a0: 20 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 (debug:pri
61b0: 6e 74 20 34 20 22 49 4e 46 4f 3a 20 70 72 6f 63 nt 4 "INFO: proc
61c0: 65 73 73 69 6e 67 20 74 68 65 20 63 61 73 65 20 essing the case
61d0: 77 69 74 68 20 61 20 6c 61 6d 62 64 61 20 66 6f with a lambda fo
61e0: 72 20 69 74 65 6d 73 20 6f 72 20 27 68 61 76 65 r items or 'have
61f0: 2d 70 72 6f 63 65 64 75 72 65 2e 20 4d 6f 76 69 -procedure. Movi
6200: 6e 67 20 74 68 72 6f 75 67 68 20 74 68 65 20 71 ng through the q
6210: 75 65 75 65 20 77 69 74 68 6f 75 74 20 64 72 6f ueue without dro
6220: 70 70 69 6e 67 20 22 20 68 65 64 29 0a 09 09 20 pping " hed)...
6230: 20 20 20 20 20 28 74 68 72 65 61 64 2d 73 6c 65 (thread-sle
6240: 65 70 21 20 28 2b 20 31 20 2a 67 6c 6f 62 61 6c ep! (+ 1 *global
6250: 2d 64 65 6c 74 61 2a 29 29 0a 09 09 20 20 20 20 -delta*))...
6260: 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 6e 65 77 (loop (car new
6270: 74 61 6c 29 28 63 64 72 20 6e 65 77 74 61 6c 29 tal)(cdr newtal)
6280: 20 72 65 72 75 6e 73 29 29 29 29 29 20 3b 3b 20 reruns))))) ;;
6290: 45 4e 44 20 4f 46 20 28 6f 72 20 28 70 72 6f 63 END OF (or (proc
62a0: 65 64 75 72 65 3f 20 69 74 65 6d 73 29 28 65 71 edure? items)(eq
62b0: 3f 20 69 74 65 6d 73 20 27 68 61 76 65 2d 70 72 ? items 'have-pr
62c0: 6f 63 65 64 75 72 65 29 29 0a 09 20 20 20 20 20 ocedure))..
62d0: 0a 09 20 20 20 20 20 3b 3b 20 74 68 69 73 20 63 .. ;; this c
62e0: 61 73 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 ase should not h
62f0: 61 70 70 65 6e 2c 20 61 64 64 65 64 20 74 6f 20 appen, added to
6300: 68 65 6c 70 20 63 61 74 63 68 20 61 6e 79 20 62 help catch any b
6310: 75 67 73 0a 09 20 20 20 20 20 28 28 61 6e 64 20 ugs.. ((and
6320: 28 6c 69 73 74 3f 20 69 74 65 6d 73 29 20 69 74 (list? items) it
6330: 65 6d 64 61 74 29 0a 09 20 20 20 20 20 20 28 64 emdat).. (d
6340: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
6350: 52 4f 52 3a 20 53 68 6f 75 6c 64 20 6e 6f 74 20 ROR: Should not
6360: 68 61 76 65 20 61 20 6c 69 73 74 20 6f 66 20 69 have a list of i
6370: 74 65 6d 73 20 69 6e 20 61 20 74 65 73 74 20 61 tems in a test a
6380: 6e 64 20 74 68 65 20 69 74 65 6d 73 70 61 74 68 nd the itemspath
6390: 20 73 65 74 20 2d 20 70 6c 65 61 73 65 20 72 65 set - please re
63a0: 70 6f 72 74 20 74 68 69 73 22 29 0a 09 20 20 20 port this")..
63b0: 20 20 20 28 65 78 69 74 20 31 29 29 0a 09 20 20 (exit 1))..
63c0: 20 20 20 28 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 ((not (null?
63d0: 72 65 72 75 6e 73 29 29 0a 09 20 20 20 20 20 20 reruns))..
63e0: 28 6c 65 74 2a 20 28 28 6e 65 77 6c 73 74 20 28 (let* ((newlst (
63f0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 open-run-close t
6400: 65 73 74 73 3a 66 69 6c 74 65 72 2d 6e 6f 6e 2d ests:filter-non-
6410: 72 75 6e 6e 61 62 6c 65 20 23 66 20 72 75 6e 2d runnable #f run-
6420: 69 64 20 74 61 6c 20 74 65 73 74 2d 72 65 63 6f id tal test-reco
6430: 72 64 73 29 29 20 3b 3b 20 69 2e 65 2e 20 6e 6f rds)) ;; i.e. no
6440: 74 20 46 41 49 4c 2c 20 57 41 49 56 45 44 2c 20 t FAIL, WAIVED,
6450: 49 4e 43 4f 4d 50 4c 45 54 45 2c 20 50 41 53 53 INCOMPLETE, PASS
6460: 2c 20 4b 49 4c 4c 45 44 2c 0a 09 09 20 20 20 20 , KILLED,...
6470: 20 28 6a 75 6e 6b 65 64 20 28 6c 73 65 74 2d 64 (junked (lset-d
6480: 69 66 66 65 72 65 6e 63 65 20 65 71 75 61 6c 3f ifference equal?
6490: 20 74 61 6c 20 6e 65 77 6c 73 74 29 29 29 0a 09 tal newlst)))..
64a0: 09 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 .(debug:print 4
64b0: 22 49 4e 46 4f 3a 20 66 75 6c 6c 20 64 72 6f 70 "INFO: full drop
64c0: 20 74 68 72 6f 75 67 68 2c 20 69 66 20 72 65 72 through, if rer
64d0: 75 6e 73 20 69 73 20 6c 65 73 73 20 74 68 61 6e uns is less than
64e0: 20 31 30 30 20 77 65 20 77 69 6c 6c 20 66 6f 72 100 we will for
64f0: 63 65 20 72 65 74 72 79 20 74 68 65 6d 2c 20 72 ce retry them, r
6500: 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 20 22 eruns=" reruns "
6510: 2c 20 74 61 6c 3d 22 20 74 61 6c 29 0a 09 09 28 , tal=" tal)...(
6520: 69 66 20 28 3c 20 6e 75 6d 2d 72 65 74 72 69 65 if (< num-retrie
6530: 73 20 6d 61 78 2d 72 65 74 72 69 65 73 29 0a 09 s max-retries)..
6540: 09 20 20 20 20 28 73 65 74 21 20 6e 65 77 6c 73 . (set! newls
6550: 74 20 28 61 70 70 65 6e 64 20 72 65 72 75 6e 73 t (append reruns
6560: 20 6e 65 77 6c 73 74 29 29 29 0a 09 09 28 73 65 newlst)))...(se
6570: 74 21 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 28 t! num-retries (
6580: 2b 20 6e 75 6d 2d 72 65 74 72 69 65 73 20 31 29 + num-retries 1)
6590: 29 0a 09 09 28 74 68 72 65 61 64 2d 73 6c 65 65 )...(thread-slee
65a0: 70 21 20 2a 67 6c 6f 62 61 6c 2d 64 65 6c 74 61 p! *global-delta
65b0: 2a 29 0a 09 09 28 69 66 20 28 6e 6f 74 20 28 6e *)...(if (not (n
65c0: 75 6c 6c 3f 20 6e 65 77 6c 73 74 29 29 0a 09 09 ull? newlst))...
65d0: 20 20 20 20 3b 3b 20 73 69 6e 63 65 20 72 65 72 ;; since rer
65e0: 75 6e 73 20 68 61 76 65 20 62 65 65 6e 20 74 61 uns have been ta
65f0: 63 6b 65 64 20 6f 6e 20 74 6f 20 6e 65 77 6c 73 cked on to newls
6600: 74 20 63 72 65 61 74 65 20 6e 65 77 20 72 65 72 t create new rer
6610: 75 6e 73 20 66 72 6f 6d 20 6a 75 6e 6b 65 64 0a uns from junked.
6620: 09 09 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 .. (loop (car
6630: 20 6e 65 77 6c 73 74 29 28 63 64 72 20 6e 65 77 newlst)(cdr new
6640: 6c 73 74 29 28 64 65 6c 65 74 65 2d 64 75 70 6c lst)(delete-dupl
6650: 69 63 61 74 65 73 20 6a 75 6e 6b 65 64 29 29 29 icates junked)))
6660: 29 29 0a 09 20 20 20 20 20 28 28 6e 6f 74 20 28 )).. ((not (
6670: 6e 75 6c 6c 3f 20 74 61 6c 29 29 0a 09 20 20 20 null? tal))..
6680: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
6690: 34 20 22 49 4e 46 4f 3a 20 49 27 6d 20 70 72 65 4 "INFO: I'm pre
66a0: 74 74 79 20 73 75 72 65 20 49 20 73 68 6f 75 6c tty sure I shoul
66b0: 64 6e 27 74 20 67 65 74 20 68 65 72 65 2e 22 29 dn't get here.")
66c0: 29 0a 09 20 20 20 20 20 28 65 6c 73 65 0a 09 20 ).. (else..
66d0: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
66e0: 74 20 34 20 22 49 4e 46 4f 3a 20 45 78 69 74 69 t 4 "INFO: Exiti
66f0: 6e 67 20 6c 6f 6f 70 20 77 69 74 68 2e 2e 2e 5c ng loop with...\
6700: 6e 20 20 68 65 64 3d 22 20 68 65 64 20 22 5c 6e n hed=" hed "\n
6710: 20 20 74 61 6c 3d 22 20 74 61 6c 20 22 5c 6e 20 tal=" tal "\n
6720: 20 72 65 72 75 6e 73 3d 22 20 72 65 72 75 6e 73 reruns=" reruns
6730: 29 29 0a 09 20 20 20 20 20 29 29 29 29 20 3b 3b )).. )))) ;;
6740: 20 4c 45 54 2a 20 28 28 74 65 73 74 2d 72 65 63 LET* ((test-rec
6750: 6f 72 64 0a 0a 20 20 20 20 3b 3b 20 77 65 20 67 ord.. ;; we g
6760: 65 74 20 68 65 72 65 20 6f 6e 20 22 64 72 6f 70 et here on "drop
6770: 20 74 68 72 6f 75 67 68 22 20 2d 20 6c 6f 6f 70 through" - loop
6780: 20 66 6f 72 20 6e 65 78 74 20 74 65 73 74 20 69 for next test i
6790: 6e 20 71 75 65 75 65 0a 20 20 20 20 3b 3b 20 46 n queue. ;; F
67a0: 49 58 4d 45 21 21 21 21 20 54 48 49 53 20 53 48 IXME!!!! THIS SH
67b0: 4f 55 4c 44 20 4e 4f 54 20 52 45 51 55 49 52 45 OULD NOT REQUIRE
67c0: 20 41 4e 20 45 58 49 54 21 21 21 21 21 21 21 0a AN EXIT!!!!!!!.
67d0: 20 20 20 20 0a 20 20 20 20 28 64 65 62 75 67 3a . (debug:
67e0: 70 72 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 print 1 "INFO: A
67f0: 6c 6c 20 74 65 73 74 73 20 6c 61 75 6e 63 68 65 ll tests launche
6800: 64 22 29 0a 20 20 20 20 28 74 68 72 65 61 64 2d d"). (thread-
6810: 73 6c 65 65 70 21 20 30 2e 35 29 0a 20 20 20 20 sleep! 0.5).
6820: 3b 3b 20 46 49 58 4d 45 21 20 54 68 69 73 20 68 ;; FIXME! This h
6830: 61 72 73 68 20 65 78 69 74 20 73 68 6f 75 6c 64 arsh exit should
6840: 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72 not be necessar
6850: 79 2e 2e 2e 2e 0a 20 20 20 20 3b 3b 20 28 69 66 y..... ;; (if
6860: 20 28 6e 6f 74 20 2a 72 75 6e 72 65 6d 6f 74 65 (not *runremote
6870: 2a 29 28 65 78 69 74 29 29 20 3b 3b 20 0a 20 20 *)(exit)) ;; .
6880: 20 20 23 66 29 29 20 3b 3b 20 72 65 74 75 72 6e #f)) ;; return
6890: 20 61 20 23 66 20 61 73 20 61 20 68 69 6e 74 20 a #f as a hint
68a0: 74 68 61 74 20 77 65 20 61 72 65 20 64 6f 6e 65 that we are done
68b0: 0a 20 20 3b 3b 20 48 65 72 65 20 77 65 20 6e 65 . ;; Here we ne
68c0: 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68 61 74 ed to check that
68d0: 20 61 6c 6c 20 74 68 65 20 74 65 73 74 73 20 72 all the tests r
68e0: 65 6d 61 69 6e 69 6e 67 20 74 6f 20 62 65 20 72 emaining to be r
68f0: 75 6e 20 61 72 65 20 65 6c 69 67 69 62 6c 65 20 un are eligible
6900: 74 6f 20 72 75 6e 0a 20 20 3b 3b 20 61 6e 64 20 to run. ;; and
6910: 61 72 65 20 6e 6f 74 20 62 6c 6f 63 6b 65 64 20 are not blocked
6920: 62 79 20 66 61 69 6c 65 64 0a 20 20 0a 0a 3b 3b by failed. ..;;
6930: 20 70 61 72 65 6e 74 2d 74 65 73 74 20 69 73 20 parent-test is
6940: 74 68 65 72 65 20 61 73 20 61 20 70 6c 61 63 65 there as a place
6950: 68 6f 6c 64 65 72 20 66 6f 72 20 77 68 65 6e 20 holder for when
6960: 70 61 72 65 6e 74 2d 74 65 73 74 73 20 63 61 6e parent-tests can
6970: 20 62 65 20 72 75 6e 20 61 73 20 61 20 73 65 74 be run as a set
6980: 75 70 20 73 74 65 70 0a 28 64 65 66 69 6e 65 20 up step.(define
6990: 28 72 75 6e 3a 74 65 73 74 20 72 75 6e 2d 69 64 (run:test run-id
69a0: 20 72 75 6e 6e 61 6d 65 20 6b 65 79 76 61 6c 6c runname keyvall
69b0: 73 74 20 74 65 73 74 2d 72 65 63 6f 72 64 20 66 st test-record f
69c0: 6c 61 67 73 20 70 61 72 65 6e 74 2d 74 65 73 74 lags parent-test
69d0: 29 0a 20 20 3b 3b 20 41 6c 6c 20 74 68 65 73 65 ). ;; All these
69e0: 20 76 61 72 73 20 6d 69 67 68 74 20 62 65 20 72 vars might be r
69f0: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 eferenced by the
6a00: 20 74 65 73 74 63 6f 6e 66 69 67 20 66 69 6c 65 testconfig file
6a10: 20 72 65 61 64 65 72 0a 20 20 28 6c 65 74 2a 20 reader. (let*
6a20: 28 28 74 65 73 74 2d 6e 61 6d 65 20 20 20 20 28 ((test-name (
6a30: 74 65 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d tests:testqueue-
6a40: 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 20 20 74 get-testname t
6a50: 65 73 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 est-record)).. (
6a60: 74 65 73 74 2d 77 61 69 74 6f 6e 73 20 28 74 65 test-waitons (te
6a70: 73 74 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 sts:testqueue-ge
6a80: 74 2d 77 61 69 74 6f 6e 73 20 20 20 20 74 65 73 t-waitons tes
6a90: 74 2d 72 65 63 6f 72 64 29 29 0a 09 20 28 74 65 t-record)).. (te
6aa0: 73 74 2d 63 6f 6e 66 20 20 20 20 28 74 65 73 74 st-conf (test
6ab0: 73 3a 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d s:testqueue-get-
6ac0: 74 65 73 74 63 6f 6e 66 69 67 20 74 65 73 74 2d testconfig test-
6ad0: 72 65 63 6f 72 64 29 29 0a 09 20 28 69 74 65 6d record)).. (item
6ae0: 64 61 74 20 20 20 20 20 20 28 74 65 73 74 73 3a dat (tests:
6af0: 74 65 73 74 71 75 65 75 65 2d 67 65 74 2d 69 74 testqueue-get-it
6b00: 65 6d 64 61 74 20 20 20 20 74 65 73 74 2d 72 65 emdat test-re
6b10: 63 6f 72 64 29 29 0a 09 20 28 74 65 73 74 2d 70 cord)).. (test-p
6b20: 61 74 68 20 20 20 20 28 63 6f 6e 63 20 2a 74 6f ath (conc *to
6b30: 70 70 61 74 68 2a 20 22 2f 74 65 73 74 73 2f 22 ppath* "/tests/"
6b40: 20 74 65 73 74 2d 6e 61 6d 65 29 29 20 3b 3b 20 test-name)) ;;
6b50: 63 6f 75 6c 64 20 75 73 65 20 74 65 73 74 73 3a could use tests:
6b60: 67 65 74 2d 74 65 73 74 63 6f 6e 66 69 67 20 68 get-testconfig h
6b70: 65 72 65 20 2e 2e 2e 0a 09 20 28 66 6f 72 63 65 ere ..... (force
6b80: 20 20 20 20 20 20 20 20 28 68 61 73 68 2d 74 61 (hash-ta
6b90: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
6ba0: 66 6c 61 67 73 20 22 2d 66 6f 72 63 65 22 20 23 flags "-force" #
6bb0: 66 29 29 0a 09 20 28 72 65 72 75 6e 20 20 20 20 f)).. (rerun
6bc0: 20 20 20 20 28 68 61 73 68 2d 74 61 62 6c 65 2d (hash-table-
6bd0: 72 65 66 2f 64 65 66 61 75 6c 74 20 66 6c 61 67 ref/default flag
6be0: 73 20 22 2d 72 65 72 75 6e 22 20 23 66 29 29 0a s "-rerun" #f)).
6bf0: 09 20 28 6b 65 65 70 67 6f 69 6e 67 20 20 20 20 . (keepgoing
6c00: 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 65 66 2f (hash-table-ref/
6c10: 64 65 66 61 75 6c 74 20 66 6c 61 67 73 20 22 2d default flags "-
6c20: 6b 65 65 70 67 6f 69 6e 67 22 20 23 66 29 29 0a keepgoing" #f)).
6c30: 09 20 28 69 74 65 6d 2d 70 61 74 68 20 20 20 20 . (item-path
6c40: 20 22 22 29 0a 09 20 28 64 62 20 20 20 20 20 20 "").. (db
6c50: 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 64 #f)). (d
6c60: 65 62 75 67 3a 70 72 69 6e 74 20 34 0a 09 09 20 ebug:print 4...
6c70: 22 74 65 73 74 2d 63 6f 6e 66 69 67 3a 20 22 20 "test-config: "
6c80: 28 68 61 73 68 2d 74 61 62 6c 65 2d 3e 61 6c 69 (hash-table->ali
6c90: 73 74 20 74 65 73 74 2d 63 6f 6e 66 29 0a 09 09 st test-conf)...
6ca0: 20 22 5c 6e 20 20 20 69 74 65 6d 64 61 74 3a 20 "\n itemdat:
6cb0: 22 20 69 74 65 6d 64 61 74 0a 09 09 20 29 0a 20 " itemdat... ).
6cc0: 20 20 20 3b 3b 20 73 65 74 74 69 6e 67 20 69 74 ;; setting it
6cd0: 65 6d 64 61 74 20 74 6f 20 61 20 6c 69 73 74 20 emdat to a list
6ce0: 69 66 20 69 74 20 69 73 20 23 66 0a 20 20 20 20 if it is #f.
6cf0: 28 69 66 20 28 6e 6f 74 20 69 74 65 6d 64 61 74 (if (not itemdat
6d00: 29 28 73 65 74 21 20 69 74 65 6d 64 61 74 20 27 )(set! itemdat '
6d10: 28 29 29 29 0a 20 20 20 20 28 73 65 74 21 20 69 ())). (set! i
6d20: 74 65 6d 2d 70 61 74 68 20 28 69 74 65 6d 2d 6c tem-path (item-l
6d30: 69 73 74 2d 3e 70 61 74 68 20 69 74 65 6d 64 61 ist->path itemda
6d40: 74 29 29 0a 20 20 20 20 28 64 65 62 75 67 3a 70 t)). (debug:p
6d50: 72 69 6e 74 20 32 20 22 41 74 74 65 6d 70 74 69 rint 2 "Attempti
6d60: 6e 67 20 74 6f 20 6c 61 75 6e 63 68 20 74 65 73 ng to launch tes
6d70: 74 20 22 20 74 65 73 74 2d 6e 61 6d 65 20 28 69 t " test-name (i
6d80: 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d 2d 70 f (equal? item-p
6d90: 61 74 68 20 22 2f 22 29 20 22 2f 22 20 69 74 65 ath "/") "/" ite
6da0: 6d 2d 70 61 74 68 29 29 0a 20 20 20 20 28 73 65 m-path)). (se
6db0: 74 65 6e 76 20 22 4d 54 5f 54 45 53 54 5f 4e 41 tenv "MT_TEST_NA
6dc0: 4d 45 22 20 74 65 73 74 2d 6e 61 6d 65 29 20 3b ME" test-name) ;
6dd0: 3b 20 0a 20 20 20 20 28 73 65 74 65 6e 76 20 22 ; . (setenv "
6de0: 4d 54 5f 52 55 4e 4e 41 4d 45 22 20 20 20 72 75 MT_RUNNAME" ru
6df0: 6e 6e 61 6d 65 29 0a 20 20 20 20 28 6f 70 65 6e nname). (open
6e00: 2d 72 75 6e 2d 63 6c 6f 73 65 20 73 65 74 2d 6d -run-close set-m
6e10: 65 67 61 74 65 73 74 2d 65 6e 76 2d 76 61 72 73 egatest-env-vars
6e20: 20 64 62 20 72 75 6e 2d 69 64 29 20 3b 3b 20 74 db run-id) ;; t
6e30: 68 65 73 65 20 6d 61 79 20 62 65 20 6e 65 65 64 hese may be need
6e40: 65 64 20 62 79 20 74 68 65 20 6c 61 75 6e 63 68 ed by the launch
6e50: 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 20 ing process.
6e60: 28 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 (change-director
6e70: 79 20 2a 74 6f 70 70 61 74 68 2a 29 0a 0a 20 20 y *toppath*)..
6e80: 20 20 3b 3b 20 48 65 72 65 20 69 73 20 77 68 65 ;; Here is whe
6e90: 72 65 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 re the test_meta
6ea0: 20 74 61 62 6c 65 20 69 73 20 62 65 73 74 20 75 table is best u
6eb0: 70 64 61 74 65 64 0a 20 20 20 20 3b 3b 20 59 65 pdated. ;; Ye
6ec0: 73 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 20 6f s, another use o
6ed0: 66 20 61 20 67 6c 6f 62 61 6c 20 66 6f 72 20 63 f a global for c
6ee0: 61 63 68 69 6e 67 2e 20 4e 65 65 64 20 61 20 62 aching. Need a b
6ef0: 65 74 74 65 72 20 77 61 79 3f 0a 20 20 20 20 28 etter way?. (
6f00: 69 66 20 28 6e 6f 74 20 28 68 61 73 68 2d 74 61 if (not (hash-ta
6f10: 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c 74 20 ble-ref/default
6f20: 2a 74 65 73 74 2d 6d 65 74 61 2d 75 70 64 61 74 *test-meta-updat
6f30: 65 64 2a 20 74 65 73 74 2d 6e 61 6d 65 20 23 66 ed* test-name #f
6f40: 29 29 0a 20 20 20 20 20 20 20 20 28 62 65 67 69 )). (begi
6f50: 6e 0a 09 20 20 20 28 68 61 73 68 2d 74 61 62 6c n.. (hash-tabl
6f60: 65 2d 73 65 74 21 20 2a 74 65 73 74 2d 6d 65 74 e-set! *test-met
6f70: 61 2d 75 70 64 61 74 65 64 2a 20 74 65 73 74 2d a-updated* test-
6f80: 6e 61 6d 65 20 23 74 29 0a 20 20 20 20 20 20 20 name #t).
6f90: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
6fa0: 6f 73 65 20 72 75 6e 73 3a 75 70 64 61 74 65 2d ose runs:update-
6fb0: 74 65 73 74 5f 6d 65 74 61 20 64 62 20 74 65 73 test_meta db tes
6fc0: 74 2d 6e 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 t-name test-conf
6fd0: 29 29 29 0a 20 20 20 20 0a 20 20 20 20 3b 3b 20 ))). . ;;
6fe0: 28 6c 61 6d 62 64 61 20 28 69 74 65 6d 64 61 74 (lambda (itemdat
6ff0: 29 20 3b 3b 3b 20 28 28 72 69 70 65 6e 65 73 73 ) ;;; ((ripeness
7000: 20 22 6f 76 65 72 72 69 70 65 22 29 20 28 74 65 "overripe") (te
7010: 6d 70 65 72 61 74 75 72 65 20 22 63 6f 6f 6c 22 mperature "cool"
7020: 29 20 28 73 65 61 73 6f 6e 20 22 73 75 6d 6d 65 ) (season "summe
7030: 72 22 29 29 0a 20 20 20 20 28 6c 65 74 2a 20 28 r")). (let* (
7040: 28 6e 65 77 2d 74 65 73 74 2d 70 61 74 68 20 28 (new-test-path (
7050: 73 74 72 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 string-intersper
7060: 73 65 20 28 63 6f 6e 73 20 74 65 73 74 2d 70 61 se (cons test-pa
7070: 74 68 20 28 6d 61 70 20 63 61 64 72 20 69 74 65 th (map cadr ite
7080: 6d 64 61 74 29 29 20 22 2f 22 29 29 0a 09 20 20 mdat)) "/"))..
7090: 20 28 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 (new-test-name
70a0: 28 69 66 20 28 65 71 75 61 6c 3f 20 69 74 65 6d (if (equal? item
70b0: 2d 70 61 74 68 20 22 22 29 20 74 65 73 74 2d 6e -path "") test-n
70c0: 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 2d 6e ame (conc test-n
70d0: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
70e0: 68 29 29 29 20 3b 3b 20 6a 75 73 74 20 6e 65 65 h))) ;; just nee
70f0: 64 20 69 74 20 74 6f 20 62 65 20 75 6e 69 71 75 d it to be uniqu
7100: 65 0a 09 20 20 20 28 74 65 73 74 2d 69 64 20 20 e.. (test-id
7110: 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 (open-run-c
7120: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 lose db:get-test
7130: 2d 69 64 20 64 62 20 20 72 75 6e 2d 69 64 20 74 -id db run-id t
7140: 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 61 est-name item-pa
7150: 74 68 29 29 0a 09 20 20 20 28 74 65 73 74 64 61 th)).. (testda
7160: 74 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 t (open-ru
7170: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 n-close db:get-t
7180: 65 73 74 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64 est-info-by-id d
7190: 62 20 74 65 73 74 2d 69 64 29 29 29 0a 20 20 20 b test-id))).
71a0: 20 20 20 28 69 66 20 28 6e 6f 74 20 74 65 73 74 (if (not test
71b0: 64 61 74 29 0a 09 20 20 28 62 65 67 69 6e 0a 09 dat).. (begin..
71c0: 20 20 20 20 3b 3b 20 65 6e 73 75 72 65 20 74 68 ;; ensure th
71d0: 61 74 20 74 68 65 20 70 61 74 68 20 65 78 69 73 at the path exis
71e0: 74 73 20 62 65 66 6f 72 65 20 72 65 67 69 73 74 ts before regist
71f0: 65 72 69 6e 67 20 74 68 65 20 74 65 73 74 0a 09 ering the test..
7200: 20 20 20 20 3b 3b 20 4e 4f 50 45 3a 20 43 61 6e ;; NOPE: Can
7210: 6e 6f 74 21 20 44 6f 6e 27 74 20 6b 6e 6f 77 20 not! Don't know
7220: 79 65 74 20 77 68 69 63 68 20 64 69 73 6b 20 61 yet which disk a
7230: 72 65 61 20 77 69 6c 6c 20 62 65 20 61 73 73 69 rea will be assi
7240: 67 6e 65 64 2e 2e 2e 2e 0a 09 20 20 20 20 3b 3b gned...... ;;
7250: 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 22 (system (conc "
7260: 6d 6b 64 69 72 20 2d 70 20 22 20 6e 65 77 2d 74 mkdir -p " new-t
7270: 65 73 74 2d 70 61 74 68 29 29 0a 09 20 20 20 20 est-path))..
7280: 3b 3b 0a 09 20 20 20 20 3b 3b 20 28 6f 70 65 6e ;;.. ;; (open
7290: 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 74 73 -run-close tests
72a0: 3a 72 65 67 69 73 74 65 72 2d 74 65 73 74 20 64 :register-test d
72b0: 62 20 72 75 6e 2d 69 64 20 74 65 73 74 2d 6e 61 b run-id test-na
72c0: 6d 65 20 69 74 65 6d 2d 70 61 74 68 29 0a 09 20 me item-path)..
72d0: 20 20 20 3b 3b 0a 09 20 20 20 20 3b 3b 20 4e 42 ;;.. ;; NB
72e0: 2f 2f 20 66 6f 72 20 74 68 65 20 61 62 6f 76 65 // for the above
72f0: 20 6c 69 6e 65 2e 20 49 20 77 61 6e 74 20 74 68 line. I want th
7300: 65 20 74 65 73 74 20 74 6f 20 62 65 20 72 65 67 e test to be reg
7310: 69 73 74 65 72 65 64 20 6c 6f 6e 67 20 62 65 66 istered long bef
7320: 6f 72 65 20 74 68 69 73 20 72 6f 75 74 69 6e 65 ore this routine
7330: 20 67 65 74 73 20 63 61 6c 6c 65 64 21 0a 09 20 gets called!..
7340: 20 20 20 3b 3b 0a 09 20 20 20 20 28 73 65 74 21 ;;.. (set!
7350: 20 74 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 test-id (open-r
7360: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
7370: 74 65 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 test-id db run-i
7380: 64 20 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d d test-name item
7390: 2d 70 61 74 68 29 29 0a 09 20 20 20 20 28 69 66 -path)).. (if
73a0: 20 28 6e 6f 74 20 74 65 73 74 2d 69 64 29 0a 09 (not test-id)..
73b0: 09 28 62 65 67 69 6e 0a 09 09 20 20 28 64 65 62 .(begin... (deb
73c0: 75 67 3a 70 72 69 6e 74 20 32 20 22 57 41 52 4e ug:print 2 "WARN
73d0: 3a 20 54 65 73 74 20 6e 6f 74 20 70 72 65 2d 63 : Test not pre-c
73e0: 72 65 61 74 65 64 3f 20 74 65 73 74 2d 6e 61 6d reated? test-nam
73f0: 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 20 22 2c e=" test-name ",
7400: 20 69 74 65 6d 2d 70 61 74 68 3d 22 20 69 74 65 item-path=" ite
7410: 6d 2d 70 61 74 68 20 22 2c 20 72 75 6e 2d 69 64 m-path ", run-id
7420: 3d 22 20 72 75 6e 2d 69 64 29 0a 09 09 20 20 28 =" run-id)... (
7430: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
7440: 62 3a 74 65 73 74 73 2d 72 65 67 69 73 74 65 72 b:tests-register
7450: 2d 74 65 73 74 20 23 66 20 72 75 6e 2d 69 64 20 -test #f run-id
7460: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
7470: 61 74 68 29 0a 09 09 20 20 28 73 65 74 21 20 74 ath)... (set! t
7480: 65 73 74 2d 69 64 20 28 6f 70 65 6e 2d 72 75 6e est-id (open-run
7490: 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 -close db:get-te
74a0: 73 74 2d 69 64 20 64 62 20 72 75 6e 2d 69 64 20 st-id db run-id
74b0: 74 65 73 74 2d 6e 61 6d 65 20 69 74 65 6d 2d 70 test-name item-p
74c0: 61 74 68 29 29 29 29 0a 09 20 20 20 20 28 64 65 ath)))).. (de
74d0: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 bug:print 4 "INF
74e0: 4f 3a 20 74 65 73 74 2d 69 64 3d 22 20 74 65 73 O: test-id=" tes
74f0: 74 2d 69 64 20 22 2c 20 72 75 6e 2d 69 64 3d 22 t-id ", run-id="
7500: 20 72 75 6e 2d 69 64 20 22 2c 20 74 65 73 74 2d run-id ", test-
7510: 6e 61 6d 65 3d 22 20 74 65 73 74 2d 6e 61 6d 65 name=" test-name
7520: 20 22 2c 20 69 74 65 6d 2d 70 61 74 68 3d 5c 22 ", item-path=\"
7530: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 5c 22 22 " item-path "\""
7540: 29 0a 09 20 20 20 20 28 73 65 74 21 20 74 65 73 ).. (set! tes
7550: 74 64 61 74 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 tdat (open-run-c
7560: 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 lose db:get-test
7570: 2d 69 6e 66 6f 2d 62 79 2d 69 64 20 64 62 20 74 -info-by-id db t
7580: 65 73 74 2d 69 64 29 29 29 29 0a 20 20 20 20 20 est-id)))).
7590: 20 28 73 65 74 21 20 74 65 73 74 2d 69 64 20 28 (set! test-id (
75a0: 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 db:test-get-id t
75b0: 65 73 74 64 61 74 29 29 0a 20 20 20 20 20 20 28 estdat)). (
75c0: 63 68 61 6e 67 65 2d 64 69 72 65 63 74 6f 72 79 change-directory
75d0: 20 74 65 73 74 2d 70 61 74 68 29 0a 20 20 20 20 test-path).
75e0: 20 20 28 63 61 73 65 20 28 69 66 20 66 6f 72 63 (case (if forc
75f0: 65 20 3b 3b 20 28 61 72 67 73 3a 67 65 74 2d 61 e ;; (args:get-a
7600: 72 67 20 22 2d 66 6f 72 63 65 22 29 0a 09 09 27 rg "-force")...'
7610: 4e 4f 54 5f 53 54 41 52 54 45 44 0a 09 09 28 69 NOT_STARTED...(i
7620: 66 20 74 65 73 74 64 61 74 0a 09 09 20 20 20 20 f testdat...
7630: 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 20 (string->symbol
7640: 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 (test:get-state
7650: 74 65 73 74 64 61 74 29 29 0a 09 09 20 20 20 20 testdat))...
7660: 27 66 61 69 6c 65 64 2d 74 6f 2d 69 6e 73 65 72 'failed-to-inser
7670: 74 29 29 0a 09 28 28 66 61 69 6c 65 64 2d 74 6f t))..((failed-to
7680: 2d 69 6e 73 65 72 74 29 0a 09 20 28 64 65 62 75 -insert).. (debu
7690: 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 g:print 0 "ERROR
76a0: 3a 20 46 61 69 6c 65 64 20 74 6f 20 69 6e 73 65 : Failed to inse
76b0: 72 74 20 74 68 65 20 72 65 63 6f 72 64 20 69 6e rt the record in
76c0: 74 6f 20 74 68 65 20 64 62 22 29 29 0a 09 28 28 to the db"))..((
76d0: 4e 4f 54 5f 53 54 41 52 54 45 44 20 43 4f 4d 50 NOT_STARTED COMP
76e0: 4c 45 54 45 44 20 44 45 4c 45 54 45 44 29 0a 09 LETED DELETED)..
76f0: 20 28 6c 65 74 20 28 28 72 75 6e 66 6c 61 67 20 (let ((runflag
7700: 23 66 29 29 0a 09 20 20 20 28 63 6f 6e 64 0a 09 #f)).. (cond..
7710: 20 20 20 20 3b 3b 20 2d 66 6f 72 63 65 2c 20 72 ;; -force, r
7720: 75 6e 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 61 un no matter wha
7730: 74 0a 09 20 20 20 20 28 66 6f 72 63 65 20 28 73 t.. (force (s
7740: 65 74 21 20 72 75 6e 66 6c 61 67 20 23 74 29 29 et! runflag #t))
7750: 0a 09 20 20 20 20 3b 3b 20 4e 4f 54 5f 53 54 41 .. ;; NOT_STA
7760: 52 54 45 44 2c 20 72 75 6e 20 6e 6f 20 6d 61 74 RTED, run no mat
7770: 74 65 72 20 77 68 61 74 0a 09 20 20 20 20 28 28 ter what.. ((
7780: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 member (test:get
7790: 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 20 -state testdat)
77a0: 27 28 22 44 45 4c 45 54 45 44 22 20 22 4e 4f 54 '("DELETED" "NOT
77b0: 5f 53 54 41 52 54 45 44 22 29 29 28 73 65 74 21 _STARTED"))(set!
77c0: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 runflag #t))..
77d0: 20 20 20 3b 3b 20 6e 6f 74 20 2d 72 65 72 75 6e ;; not -rerun
77e0: 20 61 6e 64 20 50 41 53 53 2c 20 57 41 52 4e 20 and PASS, WARN
77f0: 6f 72 20 43 48 45 43 4b 2c 20 64 6f 20 6e 6f 20 or CHECK, do no
7800: 72 75 6e 0a 09 20 20 20 20 28 28 61 6e 64 20 28 run.. ((and (
7810: 6f 72 20 28 6e 6f 74 20 72 65 72 75 6e 29 0a 09 or (not rerun)..
7820: 09 20 20 20 20 20 20 6b 65 65 70 67 6f 69 6e 67 . keepgoing
7830: 29 0a 09 09 20 20 3b 3b 20 52 65 71 75 69 72 65 )... ;; Require
7840: 20 74 6f 20 66 6f 72 63 65 20 72 65 2d 72 75 6e to force re-run
7850: 20 66 6f 72 20 43 4f 4d 50 4c 45 54 45 44 20 6f for COMPLETED o
7860: 72 20 2a 61 6e 79 74 68 69 6e 67 2a 20 2b 20 50 r *anything* + P
7870: 41 53 53 2c 57 41 52 4e 20 6f 72 20 43 48 45 43 ASS,WARN or CHEC
7880: 4b 0a 09 09 20 20 28 6f 72 20 28 6d 65 6d 62 65 K... (or (membe
7890: 72 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 74 r (test:get-stat
78a0: 75 73 20 74 65 73 74 64 61 74 29 20 27 28 22 50 us testdat) '("P
78b0: 41 53 53 22 20 22 57 41 52 4e 22 20 22 43 48 45 ASS" "WARN" "CHE
78c0: 43 4b 22 29 29 0a 09 09 20 20 20 20 20 20 28 6d CK"))... (m
78d0: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d ember (test:get-
78e0: 73 74 61 74 65 20 20 74 65 73 74 64 61 74 29 20 state testdat)
78f0: 27 28 22 43 4f 4d 50 4c 45 54 45 44 22 29 29 29 '("COMPLETED")))
7900: 29 20 0a 09 20 20 20 20 20 28 64 65 62 75 67 3a ) .. (debug:
7910: 70 72 69 6e 74 20 32 20 22 49 4e 46 4f 3a 20 72 print 2 "INFO: r
7920: 75 6e 6e 69 6e 67 20 74 65 73 74 20 22 20 74 65 unning test " te
7930: 73 74 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d st-name "/" item
7940: 2d 70 61 74 68 20 22 20 73 75 70 70 72 65 73 73 -path " suppress
7950: 65 64 20 61 73 20 69 74 20 69 73 20 22 20 28 74 ed as it is " (t
7960: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
7970: 73 74 64 61 74 29 20 22 20 61 6e 64 20 22 20 28 stdat) " and " (
7980: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
7990: 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 testdat))..
79a0: 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 66 (set! runflag #f
79b0: 29 29 0a 09 20 20 20 20 3b 3b 20 2d 72 65 72 75 )).. ;; -reru
79c0: 6e 20 61 6e 64 20 73 74 61 74 75 73 20 69 73 20 n and status is
79d0: 6f 6e 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 one of the speci
79e0: 66 65 64 2c 20 72 75 6e 20 69 74 0a 09 20 20 20 fed, run it..
79f0: 20 28 28 61 6e 64 20 72 65 72 75 6e 0a 09 09 20 ((and rerun...
7a00: 20 28 6c 65 74 2a 20 28 28 72 65 72 75 6e 6c 73 (let* ((rerunls
7a10: 74 20 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 t (string-spli
7a20: 74 20 72 65 72 75 6e 20 22 2c 22 29 29 0a 09 09 t rerun ","))...
7a30: 09 20 28 6d 75 73 74 2d 72 65 72 75 6e 20 28 6d . (must-rerun (m
7a40: 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d ember (test:get-
7a50: 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 status testdat)
7a60: 72 65 72 75 6e 6c 73 74 29 29 29 0a 09 09 20 20 rerunlst)))...
7a70: 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 33 (debug:print 3
7a80: 20 22 49 4e 46 4f 3a 20 2d 72 65 72 75 6e 20 6c "INFO: -rerun l
7a90: 69 73 74 3a 20 22 20 72 65 72 75 6e 20 22 2c 20 ist: " rerun ",
7aa0: 74 65 73 74 2d 73 74 61 74 75 73 3a 20 22 20 28 test-status: " (
7ab0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
7ac0: 74 65 73 74 64 61 74 29 22 2c 20 6d 75 73 74 2d testdat)", must-
7ad0: 72 65 72 75 6e 3a 20 22 20 6d 75 73 74 2d 72 65 rerun: " must-re
7ae0: 72 75 6e 29 0a 09 09 20 20 20 20 6d 75 73 74 2d run)... must-
7af0: 72 65 72 75 6e 29 29 0a 09 20 20 20 20 20 28 64 rerun)).. (d
7b00: 65 62 75 67 3a 70 72 69 6e 74 20 32 20 22 49 4e ebug:print 2 "IN
7b10: 46 4f 3a 20 52 65 72 75 6e 20 66 6f 72 63 65 64 FO: Rerun forced
7b20: 20 66 6f 72 20 74 65 73 74 20 22 20 74 65 73 74 for test " test
7b30: 2d 6e 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 -name "/" item-p
7b40: 61 74 68 29 0a 09 20 20 20 20 20 28 73 65 74 21 ath).. (set!
7b50: 20 72 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 runflag #t))..
7b60: 20 20 20 3b 3b 20 2d 6b 65 65 70 67 6f 69 6e 67 ;; -keepgoing
7b70: 2c 20 64 6f 20 6e 6f 74 20 72 65 72 75 6e 20 46 , do not rerun F
7b80: 41 49 4c 0a 09 20 20 20 20 28 28 61 6e 64 20 6b AIL.. ((and k
7b90: 65 65 70 67 6f 69 6e 67 0a 09 09 20 20 28 6d 65 eepgoing... (me
7ba0: 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 2d 73 mber (test:get-s
7bb0: 74 61 74 75 73 20 74 65 73 74 64 61 74 29 20 27 tatus testdat) '
7bc0: 28 22 46 41 49 4c 22 29 29 29 0a 09 20 20 20 20 ("FAIL")))..
7bd0: 20 28 73 65 74 21 20 72 75 6e 66 6c 61 67 20 23 (set! runflag #
7be0: 66 29 29 0a 09 20 20 20 20 28 28 61 6e 64 20 28 f)).. ((and (
7bf0: 6e 6f 74 20 72 65 72 75 6e 29 0a 09 09 20 20 28 not rerun)... (
7c00: 6d 65 6d 62 65 72 20 28 74 65 73 74 3a 67 65 74 member (test:get
7c10: 2d 73 74 61 74 75 73 20 74 65 73 74 64 61 74 29 -status testdat)
7c20: 20 27 28 22 46 41 49 4c 22 20 22 6e 2f 61 22 29 '("FAIL" "n/a")
7c30: 29 29 0a 09 20 20 20 20 20 28 73 65 74 21 20 72 )).. (set! r
7c40: 75 6e 66 6c 61 67 20 23 74 29 29 0a 09 20 20 20 unflag #t))..
7c50: 20 28 65 6c 73 65 20 28 73 65 74 21 20 72 75 6e (else (set! run
7c60: 66 6c 61 67 20 23 66 29 29 29 0a 09 20 20 20 28 flag #f))).. (
7c70: 64 65 62 75 67 3a 70 72 69 6e 74 20 36 20 22 52 debug:print 6 "R
7c80: 55 4e 4e 49 4e 47 20 3d 3e 20 72 75 6e 66 6c 61 UNNING => runfla
7c90: 67 3a 20 22 20 72 75 6e 66 6c 61 67 20 22 20 53 g: " runflag " S
7ca0: 54 41 54 45 3a 20 22 20 28 74 65 73 74 3a 67 65 TATE: " (test:ge
7cb0: 74 2d 73 74 61 74 65 20 74 65 73 74 64 61 74 29 t-state testdat)
7cc0: 20 22 20 53 54 41 54 55 53 3a 20 22 20 28 74 65 " STATUS: " (te
7cd0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
7ce0: 73 74 64 61 74 29 29 0a 09 20 20 20 28 69 66 20 stdat)).. (if
7cf0: 28 6e 6f 74 20 72 75 6e 66 6c 61 67 29 0a 09 20 (not runflag)..
7d00: 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 (if (not p
7d10: 61 72 65 6e 74 2d 74 65 73 74 29 0a 09 09 20 20 arent-test)...
7d20: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
7d30: 22 4e 4f 54 45 3a 20 4e 6f 74 20 73 74 61 72 74 "NOTE: Not start
7d40: 69 6e 67 20 74 65 73 74 20 22 20 6e 65 77 2d 74 ing test " new-t
7d50: 65 73 74 2d 6e 61 6d 65 20 22 20 61 73 20 69 74 est-name " as it
7d60: 20 69 73 20 73 74 61 74 65 20 5c 22 22 20 28 74 is state \"" (t
7d70: 65 73 74 3a 67 65 74 2d 73 74 61 74 65 20 74 65 est:get-state te
7d80: 73 74 64 61 74 29 20 0a 09 09 09 09 22 5c 22 20 stdat) ....."\"
7d90: 61 6e 64 20 73 74 61 74 75 73 20 5c 22 22 20 28 and status \"" (
7da0: 74 65 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 test:get-status
7db0: 74 65 73 74 64 61 74 29 20 22 5c 22 2c 20 75 73 testdat) "\", us
7dc0: 65 20 2d 72 65 72 75 6e 20 5c 22 22 20 28 74 65 e -rerun \"" (te
7dd0: 73 74 3a 67 65 74 2d 73 74 61 74 75 73 20 74 65 st:get-status te
7de0: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 stdat).
7df0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7e00: 20 20 20 20 20 20 20 22 5c 22 20 6f 72 20 2d 66 "\" or -f
7e10: 6f 72 63 65 20 74 6f 20 6f 76 65 72 72 69 64 65 orce to override
7e20: 22 29 29 0a 09 20 20 20 20 20 20 20 3b 3b 20 4e ")).. ;; N
7e30: 4f 54 45 3a 20 4e 6f 20 6c 6f 6e 67 65 72 20 62 OTE: No longer b
7e40: 65 20 63 68 65 63 6b 69 6e 67 20 70 72 65 72 65 e checking prere
7e50: 71 75 69 73 69 74 65 73 20 68 65 72 65 21 20 57 quisites here! W
7e60: 69 6c 6c 20 6e 65 76 65 72 20 67 65 74 20 68 65 ill never get he
7e70: 72 65 20 75 6e 6c 65 73 73 20 70 72 65 72 65 71 re unless prereq
7e80: 73 20 61 72 65 0a 09 20 20 20 20 20 20 20 3b 3b s are.. ;;
7e90: 20 20 20 20 20 20 20 61 6c 72 65 61 64 79 20 6d already m
7ea0: 65 74 2e 0a 09 20 20 20 20 20 20 20 28 69 66 20 et... (if
7eb0: 28 6e 6f 74 20 28 6c 61 75 6e 63 68 2d 74 65 73 (not (launch-tes
7ec0: 74 20 23 66 20 72 75 6e 2d 69 64 20 72 75 6e 6e t #f run-id runn
7ed0: 61 6d 65 20 74 65 73 74 2d 63 6f 6e 66 20 6b 65 ame test-conf ke
7ee0: 79 76 61 6c 6c 73 74 20 74 65 73 74 2d 6e 61 6d yvallst test-nam
7ef0: 65 20 74 65 73 74 2d 70 61 74 68 20 69 74 65 6d e test-path item
7f00: 64 61 74 20 66 6c 61 67 73 29 29 0a 09 09 20 20 dat flags))...
7f10: 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 20 28 (begin... (
7f20: 70 72 69 6e 74 20 22 45 52 52 4f 52 3a 20 46 61 print "ERROR: Fa
7f30: 69 6c 65 64 20 74 6f 20 6c 61 75 6e 63 68 20 74 iled to launch t
7f40: 68 65 20 74 65 73 74 2e 20 45 78 69 74 69 6e 67 he test. Exiting
7f50: 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f 73 73 as soon as poss
7f60: 69 62 6c 65 22 29 0a 09 09 20 20 20 20 20 28 73 ible")... (s
7f70: 65 74 21 20 2a 67 6c 6f 62 61 6c 65 78 69 74 73 et! *globalexits
7f80: 74 61 74 75 73 2a 20 31 29 20 3b 3b 20 0a 09 09 tatus* 1) ;; ...
7f90: 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 73 69 (process-si
7fa0: 67 6e 61 6c 20 28 63 75 72 72 65 6e 74 2d 70 72 gnal (current-pr
7fb0: 6f 63 65 73 73 2d 69 64 29 20 73 69 67 6e 61 6c ocess-id) signal
7fc0: 2f 6b 69 6c 6c 29 29 29 29 29 29 0a 09 28 28 4b /kill))))))..((K
7fd0: 49 4c 4c 45 44 29 20 0a 09 20 28 64 65 62 75 67 ILLED) .. (debug
7fe0: 3a 70 72 69 6e 74 20 31 20 22 4e 4f 54 45 3a 20 :print 1 "NOTE:
7ff0: 22 20 6e 65 77 2d 74 65 73 74 2d 6e 61 6d 65 20 " new-test-name
8000: 22 20 69 73 20 61 6c 72 65 61 64 79 20 72 75 6e " is already run
8010: 6e 69 6e 67 20 6f 72 20 77 61 73 20 65 78 70 6c ning or was expl
8020: 69 63 74 6c 79 20 6b 69 6c 6c 65 64 2c 20 75 73 ictly killed, us
8030: 65 20 2d 66 6f 72 63 65 20 74 6f 20 6c 61 75 6e e -force to laun
8040: 63 68 20 69 74 2e 22 29 29 0a 09 28 28 4c 41 55 ch it."))..((LAU
8050: 4e 43 48 45 44 20 52 45 4d 4f 54 45 48 4f 53 54 NCHED REMOTEHOST
8060: 53 54 41 52 54 20 52 55 4e 4e 49 4e 47 29 20 20 START RUNNING)
8070: 0a 09 20 28 69 66 20 28 3e 20 28 2d 20 28 63 75 .. (if (> (- (cu
8080: 72 72 65 6e 74 2d 73 65 63 6f 6e 64 73 29 28 2b rrent-seconds)(+
8090: 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 65 76 (db:test-get-ev
80a0: 65 6e 74 5f 74 69 6d 65 20 74 65 73 74 64 61 74 ent_time testdat
80b0: 29 0a 09 09 09 09 20 20 20 20 20 20 20 28 64 62 )..... (db
80c0: 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e 5f 64 75 :test-get-run_du
80d0: 72 61 74 69 6f 6e 20 74 65 73 74 64 61 74 29 29 ration testdat))
80e0: 29 0a 09 09 36 30 30 29 20 3b 3b 20 69 2e 65 2e )...600) ;; i.e.
80f0: 20 6e 6f 20 75 70 64 61 74 65 20 66 6f 72 20 6d no update for m
8100: 6f 72 65 20 74 68 61 6e 20 36 30 30 20 73 65 63 ore than 600 sec
8110: 6f 6e 64 73 0a 09 20 20 20 20 20 28 62 65 67 69 onds.. (begi
8120: 6e 0a 09 20 20 20 20 20 20 20 28 64 65 62 75 67 n.. (debug
8130: 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 4e :print 0 "WARNIN
8140: 47 3a 20 54 65 73 74 20 22 20 74 65 73 74 2d 6e G: Test " test-n
8150: 61 6d 65 20 22 20 61 70 70 65 61 72 73 20 74 6f ame " appears to
8160: 20 62 65 20 64 65 61 64 2e 20 46 6f 72 63 69 6e be dead. Forcin
8170: 67 20 69 74 20 74 6f 20 73 74 61 74 65 20 49 4e g it to state IN
8180: 43 4f 4d 50 4c 45 54 45 20 61 6e 64 20 73 74 61 COMPLETE and sta
8190: 74 75 73 20 53 54 55 43 4b 2f 44 45 41 44 22 29 tus STUCK/DEAD")
81a0: 0a 09 20 20 20 20 20 20 20 28 74 65 73 74 73 3a .. (tests:
81b0: 74 65 73 74 2d 73 65 74 2d 73 74 61 74 75 73 21 test-set-status!
81c0: 20 74 65 73 74 2d 69 64 20 22 49 4e 43 4f 4d 50 test-id "INCOMP
81d0: 4c 45 54 45 22 20 22 53 54 55 43 4b 2f 44 45 41 LETE" "STUCK/DEA
81e0: 44 22 20 22 54 65 73 74 20 69 73 20 73 74 75 63 D" "Test is stuc
81f0: 6b 20 6f 72 20 64 65 61 64 22 20 23 66 29 29 0a k or dead" #f)).
8200: 09 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 . (debug:pri
8210: 6e 74 20 32 20 22 4e 4f 54 45 3a 20 22 20 74 65 nt 2 "NOTE: " te
8220: 73 74 2d 6e 61 6d 65 20 22 20 69 73 20 61 6c 72 st-name " is alr
8230: 65 61 64 79 20 72 75 6e 6e 69 6e 67 22 29 29 29 eady running")))
8240: 0a 09 28 65 6c 73 65 20 20 20 20 20 20 20 28 64 ..(else (d
8250: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
8260: 52 4f 52 3a 20 46 61 69 6c 65 64 20 74 6f 20 6c ROR: Failed to l
8270: 61 75 6e 63 68 20 74 65 73 74 20 22 20 6e 65 77 aunch test " new
8280: 2d 74 65 73 74 2d 6e 61 6d 65 20 22 2e 20 55 6e -test-name ". Un
8290: 72 65 63 6f 67 6e 69 73 65 64 20 73 74 61 74 65 recognised state
82a0: 20 22 20 28 74 65 73 74 3a 67 65 74 2d 73 74 61 " (test:get-sta
82b0: 74 65 20 74 65 73 74 64 61 74 29 29 29 29 29 29 te testdat))))))
82c0: 29 0a 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d )..;;===========
82d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
82e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
82f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8300: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 45 ===========.;; E
8310: 4e 44 20 4f 46 20 4e 45 57 20 53 54 55 46 46 0a ND OF NEW STUFF.
8320: 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ;;==============
8330: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8340: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8350: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
8360: 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e ========..(defin
8370: 65 20 28 67 65 74 2d 64 69 72 2d 75 70 2d 6e 20 e (get-dir-up-n
8380: 64 69 72 20 2e 20 70 61 72 61 6d 73 29 20 0a 20 dir . params) .
8390: 20 28 6c 65 74 20 28 28 64 70 61 72 74 73 20 20 (let ((dparts
83a0: 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 64 69 (string-split di
83b0: 72 20 22 2f 22 29 29 0a 09 28 63 6f 75 6e 74 20 r "/"))..(count
83c0: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 72 (if (null? par
83d0: 61 6d 73 29 20 31 20 28 63 61 72 20 70 61 72 61 ams) 1 (car para
83e0: 6d 73 29 29 29 29 0a 20 20 20 20 28 63 6f 6e 63 ms)))). (conc
83f0: 20 22 2f 22 20 28 73 74 72 69 6e 67 2d 69 6e 74 "/" (string-int
8400: 65 72 73 70 65 72 73 65 20 0a 09 20 20 20 20 20 ersperse ..
8410: 20 20 28 74 61 6b 65 20 64 70 61 72 74 73 20 28 (take dparts (
8420: 2d 20 28 6c 65 6e 67 74 68 20 64 70 61 72 74 73 - (length dparts
8430: 29 20 63 6f 75 6e 74 29 29 0a 09 20 20 20 20 20 ) count))..
8440: 20 20 22 2f 22 29 29 29 29 0a 3b 3b 20 52 65 6d "/")))).;; Rem
8450: 6f 76 65 20 72 75 6e 73 0a 3b 3b 20 66 69 65 6c ove runs.;; fiel
8460: 64 73 20 61 72 65 20 70 61 73 73 69 6e 67 20 69 ds are passing i
8470: 6e 20 74 68 72 6f 75 67 68 20 0a 3b 3b 20 61 63 n through .;; ac
8480: 74 69 6f 6e 3a 0a 3b 3b 20 20 20 20 27 72 65 6d tion:.;; 'rem
8490: 6f 76 65 2d 72 75 6e 73 0a 3b 3b 20 20 20 20 27 ove-runs.;; '
84a0: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 set-state-status
84b0: 0a 3b 3b 0a 3b 3b 20 4e 42 2f 2f 20 73 68 6f 75 .;;.;; NB// shou
84c0: 6c 64 20 70 61 73 73 20 69 6e 20 6b 65 79 73 3f ld pass in keys?
84d0: 0a 3b 3b 0a 28 64 65 66 69 6e 65 20 28 72 75 6e .;;.(define (run
84e0: 73 3a 6f 70 65 72 61 74 65 2d 6f 6e 20 61 63 74 s:operate-on act
84f0: 69 6f 6e 20 72 75 6e 6e 61 6d 65 70 61 74 74 20 ion runnamepatt
8500: 74 65 73 74 70 61 74 74 20 23 21 6b 65 79 20 28 testpatt #!key (
8510: 73 74 61 74 65 20 23 66 29 28 73 74 61 74 75 73 state #f)(status
8520: 20 23 66 29 28 6e 65 77 2d 73 74 61 74 65 2d 73 #f)(new-state-s
8530: 74 61 74 75 73 20 23 66 29 29 0a 20 20 28 6c 65 tatus #f)). (le
8540: 74 2a 20 28 28 64 62 20 20 20 20 20 20 20 20 20 t* ((db
8550: 20 20 23 66 29 0a 09 20 28 6b 65 79 73 20 20 20 #f).. (keys
8560: 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d (open-run-
8570: 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b 65 79 close db:get-key
8580: 73 20 64 62 29 29 0a 09 20 28 72 75 6e 64 61 74 s db)).. (rundat
8590: 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e (open-run
85a0: 2d 63 6c 6f 73 65 20 72 75 6e 73 3a 67 65 74 2d -close runs:get-
85b0: 72 75 6e 73 2d 62 79 2d 70 61 74 74 20 64 62 20 runs-by-patt db
85c0: 6b 65 79 73 20 72 75 6e 6e 61 6d 65 70 61 74 74 keys runnamepatt
85d0: 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 20 )).. (header
85e0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 (vector-ref r
85f0: 75 6e 64 61 74 20 30 29 29 0a 09 20 28 72 75 6e undat 0)).. (run
8600: 73 20 20 20 20 20 20 20 20 20 28 76 65 63 74 6f s (vecto
8610: 72 2d 72 65 66 20 72 75 6e 64 61 74 20 31 29 29 r-ref rundat 1))
8620: 0a 09 20 28 73 74 61 74 65 73 20 20 20 20 20 20 .. (states
8630: 20 28 69 66 20 73 74 61 74 65 20 20 28 73 74 72 (if state (str
8640: 69 6e 67 2d 73 70 6c 69 74 20 73 74 61 74 65 20 ing-split state
8650: 20 22 2c 22 29 20 27 28 29 29 29 0a 09 20 28 73 ",") '())).. (s
8660: 74 61 74 75 73 65 73 20 20 20 20 20 28 69 66 20 tatuses (if
8670: 73 74 61 74 75 73 20 28 73 74 72 69 6e 67 2d 73 status (string-s
8680: 70 6c 69 74 20 73 74 61 74 75 73 20 22 2c 22 29 plit status ",")
8690: 20 27 28 29 29 29 0a 09 20 28 73 74 61 74 65 2d '())).. (state-
86a0: 73 74 61 74 75 73 20 28 69 66 20 28 73 74 72 69 status (if (stri
86b0: 6e 67 3f 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 ng? new-state-st
86c0: 61 74 75 73 29 20 28 73 74 72 69 6e 67 2d 73 70 atus) (string-sp
86d0: 6c 69 74 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 lit new-state-st
86e0: 61 74 75 73 20 22 2c 22 29 20 27 28 23 66 20 23 atus ",") '(#f #
86f0: 66 29 29 29 29 0a 20 20 20 20 28 64 65 62 75 67 f)))). (debug
8700: 3a 70 72 69 6e 74 20 32 20 22 48 65 61 64 65 72 :print 2 "Header
8710: 3a 20 22 20 68 65 61 64 65 72 20 22 20 61 63 74 : " header " act
8720: 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 20 22 20 ion: " action "
8730: 6e 65 77 2d 73 74 61 74 65 2d 73 74 61 74 75 73 new-state-status
8740: 3a 20 22 20 6e 65 77 2d 73 74 61 74 65 2d 73 74 : " new-state-st
8750: 61 74 75 73 29 0a 20 20 20 20 28 66 6f 72 2d 65 atus). (for-e
8760: 61 63 68 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 ach. (lambda
8770: 20 28 72 75 6e 29 0a 20 20 20 20 20 20 20 28 6c (run). (l
8780: 65 74 20 28 28 72 75 6e 6b 65 79 20 28 73 74 72 et ((runkey (str
8790: 69 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 ing-intersperse
87a0: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6b 29 (map (lambda (k)
87b0: 0a 09 09 09 09 09 09 28 64 62 3a 67 65 74 2d 76 .......(db:get-v
87c0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
87d0: 75 6e 20 68 65 61 64 65 72 20 28 76 65 63 74 6f un header (vecto
87e0: 72 2d 72 65 66 20 6b 20 30 29 29 29 20 6b 65 79 r-ref k 0))) key
87f0: 73 29 20 22 2f 22 29 29 0a 09 20 20 20 20 20 28 s) "/")).. (
8800: 64 69 72 73 2d 74 6f 2d 72 65 6d 6f 76 65 20 28 dirs-to-remove (
8810: 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c 65 29 make-hash-table)
8820: 29 29 0a 09 20 28 6c 65 74 2a 20 28 28 72 75 6e )).. (let* ((run
8830: 2d 69 64 20 20 20 20 28 64 62 3a 67 65 74 2d 76 -id (db:get-v
8840: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
8850: 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 un header "id"))
8860: 0a 09 09 28 72 75 6e 2d 73 74 61 74 65 20 28 64 ...(run-state (d
8870: 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 b:get-value-by-h
8880: 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 eader run header
8890: 20 22 73 74 61 74 65 22 29 29 0a 09 09 28 74 65 "state"))...(te
88a0: 73 74 73 20 20 20 20 20 28 69 66 20 28 6e 6f 74 sts (if (not
88b0: 20 28 65 71 75 61 6c 3f 20 72 75 6e 2d 73 74 61 (equal? run-sta
88c0: 74 65 20 22 6c 6f 63 6b 65 64 22 29 29 0a 09 09 te "locked"))...
88d0: 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 75 . (open-ru
88e0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 74 n-close db:get-t
88f0: 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 20 ests-for-run db
8900: 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 2d 62 79 (db:get-value-by
8910: 2d 68 65 61 64 65 72 20 72 75 6e 20 68 65 61 64 -header run head
8920: 65 72 20 22 69 64 22 29 0a 09 09 09 09 09 09 20 er "id").......
8930: 20 20 20 20 20 74 65 73 74 70 61 74 74 20 73 74 testpatt st
8940: 61 74 65 73 20 73 74 61 74 75 73 65 73 0a 09 09 ates statuses...
8950: 09 09 09 09 20 20 20 20 20 20 6e 6f 74 2d 69 6e .... not-in
8960: 3a 20 20 23 66 0a 09 09 09 09 09 09 20 20 20 20 : #f.......
8970: 20 20 73 6f 72 74 2d 62 79 3a 20 28 63 61 73 65 sort-by: (case
8980: 20 61 63 74 69 6f 6e 0a 09 09 09 09 09 09 09 09 action.........
8990: 20 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 20 ((remove-runs)
89a0: 27 72 75 6e 64 69 72 29 0a 09 09 09 09 09 09 09 'rundir)........
89b0: 09 20 28 65 6c 73 65 20 20 20 20 20 20 20 20 20 . (else
89c0: 20 27 65 76 65 6e 74 5f 74 69 6d 65 29 29 29 0a 'event_time))).
89d0: 09 09 09 20 20 20 20 20 20 20 27 28 29 29 29 0a ... '())).
89e0: 09 09 28 6c 61 73 74 74 70 61 74 68 20 22 2f 64 ..(lasttpath "/d
89f0: 6f 65 73 2f 6e 6f 74 2f 65 78 69 73 74 2f 49 2f oes/not/exist/I/
8a00: 68 6f 70 65 22 29 29 0a 09 20 20 20 28 64 65 62 hope")).. (deb
8a10: 75 67 3a 70 72 69 6e 74 20 34 20 22 49 4e 46 4f ug:print 4 "INFO
8a20: 3a 20 72 75 6e 73 3a 6f 70 65 72 61 74 65 2d 6f : runs:operate-o
8a30: 6e 20 72 75 6e 3d 22 20 72 75 6e 20 22 2c 20 68 n run=" run ", h
8a40: 65 61 64 65 72 3d 22 20 68 65 61 64 65 72 29 0a eader=" header).
8a50: 09 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 . (if (not (nu
8a60: 6c 6c 3f 20 74 65 73 74 73 29 29 0a 09 20 20 20 ll? tests))..
8a70: 20 20 20 20 28 62 65 67 69 6e 0a 09 09 20 28 63 (begin... (c
8a80: 61 73 65 20 61 63 74 69 6f 6e 0a 09 09 20 20 20 ase action...
8a90: 28 28 72 65 6d 6f 76 65 2d 72 75 6e 73 29 0a 09 ((remove-runs)..
8aa0: 09 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e . (debug:prin
8ab0: 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 20 74 65 t 1 "Removing te
8ac0: 73 74 73 20 66 6f 72 20 72 75 6e 3a 20 22 20 72 sts for run: " r
8ad0: 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a 67 65 unkey " " (db:ge
8ae0: 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 t-value-by-heade
8af0: 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 72 75 r run header "ru
8b00: 6e 6e 61 6d 65 22 29 29 29 0a 09 09 20 20 20 28 nname")))... (
8b10: 28 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 (set-state-statu
8b20: 73 29 0a 09 09 20 20 20 20 28 64 65 62 75 67 3a s)... (debug:
8b30: 70 72 69 6e 74 20 31 20 22 4d 6f 64 69 66 79 69 print 1 "Modifyi
8b40: 6e 67 20 73 74 61 74 65 20 61 6e 64 20 73 74 61 ng state and sta
8b50: 75 73 20 66 6f 72 20 74 65 73 74 73 20 66 6f 72 us for tests for
8b60: 20 72 75 6e 3a 20 22 20 72 75 6e 6b 65 79 20 22 run: " runkey "
8b70: 20 22 20 28 64 62 3a 67 65 74 2d 76 61 6c 75 65 " (db:get-value
8b80: 2d 62 79 2d 68 65 61 64 65 72 20 72 75 6e 20 68 -by-header run h
8b90: 65 61 64 65 72 20 22 72 75 6e 6e 61 6d 65 22 29 eader "runname")
8ba0: 29 29 0a 09 09 20 20 20 28 28 70 72 69 6e 74 2d ))... ((print-
8bb0: 72 75 6e 29 0a 09 09 20 20 20 20 28 64 65 62 75 run)... (debu
8bc0: 67 3a 70 72 69 6e 74 20 31 20 22 50 72 69 6e 74 g:print 1 "Print
8bd0: 69 6e 67 20 69 6e 66 6f 20 66 6f 72 20 72 75 6e ing info for run
8be0: 20 22 20 72 75 6e 6b 65 79 20 22 2c 20 72 75 6e " runkey ", run
8bf0: 3d 22 20 72 75 6e 20 22 2c 20 74 65 73 74 73 3d =" run ", tests=
8c00: 22 20 74 65 73 74 73 20 22 2c 20 68 65 61 64 65 " tests ", heade
8c10: 72 3d 22 20 68 65 61 64 65 72 29 0a 09 09 20 20 r=" header)...
8c20: 20 20 61 63 74 69 6f 6e 29 0a 09 09 20 20 20 28 action)... (
8c30: 65 6c 73 65 0a 09 09 20 20 20 20 28 70 72 69 6e else... (prin
8c40: 74 20 22 49 4e 46 4f 3a 20 61 63 74 69 6f 6e 20 t "INFO: action
8c50: 6e 6f 74 20 72 65 63 6f 67 6e 69 73 65 64 20 22 not recognised "
8c60: 20 61 63 74 69 6f 6e 29 29 29 0a 09 09 20 28 66 action)))... (f
8c70: 6f 72 2d 65 61 63 68 0a 09 09 20 20 28 6c 61 6d or-each... (lam
8c80: 62 64 61 20 28 74 65 73 74 29 0a 09 09 20 20 20 bda (test)...
8c90: 20 28 6c 65 74 2a 20 28 28 69 74 65 6d 2d 70 61 (let* ((item-pa
8ca0: 74 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d th (db:test-get-
8cb0: 69 74 65 6d 2d 70 61 74 68 20 74 65 73 74 29 29 item-path test))
8cc0: 0a 09 09 09 20 20 20 28 74 65 73 74 2d 6e 61 6d .... (test-nam
8cd0: 65 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 e (db:test-get-t
8ce0: 65 73 74 6e 61 6d 65 20 74 65 73 74 29 29 0a 09 estname test))..
8cf0: 09 09 20 20 20 28 72 75 6e 2d 64 69 72 20 20 20 .. (run-dir
8d00: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 72 75 6e (db:test-get-run
8d10: 64 69 72 20 74 65 73 74 29 29 0a 09 09 09 20 20 dir test))....
8d20: 20 28 74 65 73 74 2d 69 64 20 20 20 28 64 62 3a (test-id (db:
8d30: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
8d40: 29 29 29 0a 09 09 20 20 20 20 20 20 3b 3b 20 20 )))... ;;
8d50: 20 28 74 64 62 20 20 20 20 20 20 20 28 64 62 3a (tdb (db:
8d60: 6f 70 65 6e 2d 74 65 73 74 2d 64 62 20 72 75 6e open-test-db run
8d70: 2d 64 69 72 29 29 29 0a 09 09 20 20 20 20 20 20 -dir)))...
8d80: 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 (debug:print 1 "
8d90: 20 20 22 20 28 64 62 3a 74 65 73 74 2d 67 65 74 " (db:test-get
8da0: 2d 74 65 73 74 6e 61 6d 65 20 74 65 73 74 29 20 -testname test)
8db0: 22 20 69 64 3a 20 22 20 28 64 62 3a 74 65 73 74 " id: " (db:test
8dc0: 2d 67 65 74 2d 69 64 20 74 65 73 74 29 20 22 20 -get-id test) "
8dd0: 22 20 69 74 65 6d 2d 70 61 74 68 20 22 20 61 63 " item-path " ac
8de0: 74 69 6f 6e 3a 20 22 20 61 63 74 69 6f 6e 29 0a tion: " action).
8df0: 09 09 20 20 20 20 20 20 28 63 61 73 65 20 61 63 .. (case ac
8e00: 74 69 6f 6e 0a 09 09 09 28 28 72 65 6d 6f 76 65 tion....((remove
8e10: 2d 72 75 6e 73 29 20 3b 3b 20 74 68 65 20 74 64 -runs) ;; the td
8e20: 62 20 69 73 20 66 6f 72 20 66 75 74 75 72 65 20 b is for future
8e30: 70 6f 73 73 69 62 6c 65 2e 20 0a 09 09 09 20 28 possible. .... (
8e40: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
8e50: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 2d 72 65 b:delete-test-re
8e60: 63 6f 72 64 73 20 64 62 20 23 66 20 28 64 62 3a cords db #f (db:
8e70: 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 test-get-id test
8e80: 29 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 )).... (debug:pr
8e90: 69 6e 74 20 31 20 22 49 4e 46 4f 3a 20 41 74 74 int 1 "INFO: Att
8ea0: 65 6d 70 74 69 6e 67 20 74 6f 20 72 65 6d 6f 76 empting to remov
8eb0: 65 20 64 69 72 20 22 20 72 75 6e 2d 64 69 72 29 e dir " run-dir)
8ec0: 0a 09 09 09 20 28 69 66 20 28 61 6e 64 20 28 3e .... (if (and (>
8ed0: 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 (string-length
8ee0: 72 75 6e 2d 64 69 72 29 20 35 29 0a 09 09 09 09 run-dir) 5).....
8ef0: 20 20 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 (file-exists?
8f00: 72 75 6e 2d 64 69 72 29 29 20 3b 3b 20 62 61 64 run-dir)) ;; bad
8f10: 20 68 65 75 72 69 73 74 69 63 20 62 75 74 20 73 heuristic but s
8f20: 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 2f 74 hould prevent /t
8f30: 6d 70 20 2f 68 6f 6d 65 20 65 74 63 2e 0a 09 09 mp /home etc....
8f40: 09 20 20 20 20 20 28 6c 65 74 2a 20 28 28 72 65 . (let* ((re
8f50: 61 6c 70 61 74 68 20 28 72 65 73 6f 6c 76 65 2d alpath (resolve-
8f60: 70 61 74 68 6e 61 6d 65 20 72 75 6e 2d 64 69 72 pathname run-dir
8f70: 29 29 29 0a 09 09 09 20 20 20 20 20 20 20 28 64 ))).... (d
8f80: 65 62 75 67 3a 70 72 69 6e 74 20 31 20 22 49 4e ebug:print 1 "IN
8f90: 46 4f 3a 20 52 65 61 6c 20 70 61 74 68 20 6f 66 FO: Real path of
8fa0: 20 69 73 20 22 20 72 65 61 6c 70 61 74 68 29 0a is " realpath).
8fb0: 09 09 09 20 20 20 20 20 20 20 28 69 66 20 28 66 ... (if (f
8fc0: 69 6c 65 2d 65 78 69 73 74 73 3f 20 72 65 61 6c ile-exists? real
8fd0: 70 61 74 68 29 0a 09 09 09 09 20 20 20 28 69 66 path)..... (if
8fe0: 20 28 3e 20 28 73 79 73 74 65 6d 20 28 63 6f 6e (> (system (con
8ff0: 63 20 22 72 6d 20 2d 72 66 20 22 20 72 65 61 6c c "rm -rf " real
9000: 70 61 74 68 29 29 20 30 29 0a 09 09 09 09 20 20 path)) 0).....
9010: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
9020: 74 20 30 20 22 45 52 52 4f 52 3a 20 54 68 65 72 t 0 "ERROR: Ther
9030: 65 20 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 e was a problem
9040: 72 65 6d 6f 76 69 6e 67 20 22 20 72 65 61 6c 70 removing " realp
9050: 61 74 68 20 22 20 77 69 74 68 20 72 6d 20 2d 66 ath " with rm -f
9060: 22 29 29 0a 09 09 09 09 20 20 20 28 64 65 62 75 "))..... (debu
9070: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
9080: 4e 47 3a 20 74 65 73 74 20 72 75 6e 20 64 69 72 NG: test run dir
9090: 20 22 20 72 65 61 6c 70 61 74 68 20 22 20 61 70 " realpath " ap
90a0: 70 65 61 72 73 20 74 6f 20 6e 6f 74 20 65 78 69 pears to not exi
90b0: 73 74 22 29 29 0a 09 09 09 20 20 20 20 20 20 20 st"))....
90c0: 28 69 66 20 28 66 69 6c 65 2d 65 78 69 73 74 73 (if (file-exists
90d0: 3f 20 72 75 6e 2d 64 69 72 29 20 3b 3b 20 74 68 ? run-dir) ;; th
90e0: 65 20 6c 69 6e 6b 0a 09 09 09 09 20 20 20 28 69 e link..... (i
90f0: 66 20 28 73 79 6d 62 6f 6c 69 63 2d 6c 69 6e 6b f (symbolic-link
9100: 3f 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 20 ? run-dir).....
9110: 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 66 69 (delete-fi
9120: 6c 65 20 72 75 6e 2d 64 69 72 29 0a 09 09 09 09 le run-dir).....
9130: 20 20 20 20 20 20 20 28 69 66 20 28 64 69 72 65 (if (dire
9140: 63 74 6f 72 79 3f 20 72 75 6e 2d 64 69 72 29 0a ctory? run-dir).
9150: 09 09 09 09 09 20 20 20 28 69 66 20 28 3e 20 28 ..... (if (> (
9160: 64 69 72 65 63 74 6f 72 79 2d 66 6f 6c 64 20 28 directory-fold (
9170: 6c 61 6d 62 64 61 20 28 66 20 78 29 28 2b 20 31 lambda (f x)(+ 1
9180: 20 78 29 29 20 30 20 72 75 6e 2d 64 69 72 29 20 x)) 0 run-dir)
9190: 30 29 0a 09 09 09 09 09 20 20 20 20 20 20 20 28 0)...... (
91a0: 64 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 57 debug:print 0 "W
91b0: 41 52 4e 49 4e 47 3a 20 72 65 66 75 73 69 6e 67 ARNING: refusing
91c0: 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 75 6e to remove " run
91d0: 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 73 20 -dir " as it is
91e0: 6e 6f 74 20 65 6d 70 74 79 22 29 0a 09 09 09 09 not empty").....
91f0: 09 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d . (delete-
9200: 64 69 72 65 63 74 6f 72 79 20 72 75 6e 2d 64 69 directory run-di
9210: 72 29 29 20 3b 3b 20 69 74 20 73 68 6f 75 6c 64 r)) ;; it should
9220: 20 62 65 20 65 6d 70 74 79 20 62 79 20 68 65 72 be empty by her
9230: 65 20 42 55 47 20 42 55 47 2c 20 61 64 64 20 65 e BUG BUG, add e
9240: 72 72 6f 72 20 63 61 74 63 68 0a 09 09 09 09 09 rror catch......
9250: 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 (debug:print
9260: 30 20 22 45 52 52 4f 52 3a 20 72 65 66 75 73 69 0 "ERROR: refusi
9270: 6e 67 20 74 6f 20 72 65 6d 6f 76 65 20 22 20 72 ng to remove " r
9280: 75 6e 2d 64 69 72 20 22 20 61 73 20 69 74 20 69 un-dir " as it i
9290: 73 20 6e 65 69 74 68 65 72 20 61 20 73 79 6d 6c s neither a syml
92a0: 69 6e 6b 20 6e 6f 72 20 61 20 64 69 72 65 63 74 ink nor a direct
92b0: 6f 72 79 22 29 0a 09 09 09 09 09 20 20 20 29 29 ory")...... ))
92c0: 29 29 0a 09 09 09 20 20 20 20 20 28 64 65 62 75 )).... (debu
92d0: 67 3a 70 72 69 6e 74 20 30 20 22 57 41 52 4e 49 g:print 0 "WARNI
92e0: 4e 47 3a 20 64 69 72 65 63 74 6f 72 79 20 61 6c NG: directory al
92f0: 72 65 61 64 79 20 72 65 6d 6f 76 65 64 20 22 20 ready removed "
9300: 72 75 6e 2d 64 69 72 29 29 29 0a 09 09 09 28 28 run-dir)))....((
9310: 73 65 74 2d 73 74 61 74 65 2d 73 74 61 74 75 73 set-state-status
9320: 29 0a 09 09 09 20 28 64 65 62 75 67 3a 70 72 69 ).... (debug:pri
9330: 6e 74 20 32 20 22 49 4e 46 4f 3a 20 6e 65 77 20 nt 2 "INFO: new
9340: 73 74 61 74 65 20 22 20 28 63 61 72 20 73 74 61 state " (car sta
9350: 74 65 2d 73 74 61 74 75 73 29 20 22 2c 20 6e 65 te-status) ", ne
9360: 77 20 73 74 61 74 75 73 20 22 20 28 63 61 64 72 w status " (cadr
9370: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 29 0a state-status)).
9380: 09 09 09 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c ... (open-run-cl
9390: 6f 73 65 20 64 62 3a 74 65 73 74 2d 73 65 74 2d ose db:test-set-
93a0: 73 74 61 74 65 2d 73 74 61 74 75 73 2d 62 79 2d state-status-by-
93b0: 69 64 20 64 62 20 28 64 62 3a 74 65 73 74 2d 67 id db (db:test-g
93c0: 65 74 2d 69 64 20 74 65 73 74 29 20 28 63 61 72 et-id test) (car
93d0: 20 73 74 61 74 65 2d 73 74 61 74 75 73 29 28 63 state-status)(c
93e0: 61 64 72 20 73 74 61 74 65 2d 73 74 61 74 75 73 adr state-status
93f0: 29 20 23 66 29 29 29 29 29 0a 09 09 20 20 74 65 ) #f)))))... te
9400: 73 74 73 29 29 29 0a 09 20 20 20 0a 09 20 20 20 sts))).. ..
9410: 3b 3b 20 72 65 6d 6f 76 65 20 74 68 65 20 72 75 ;; remove the ru
9420: 6e 20 69 66 20 7a 65 72 6f 20 74 65 73 74 73 20 n if zero tests
9430: 72 65 6d 61 69 6e 0a 09 20 20 20 28 69 66 20 28 remain.. (if (
9440: 65 71 3f 20 61 63 74 69 6f 6e 20 27 72 65 6d 6f eq? action 'remo
9450: 76 65 2d 72 75 6e 73 29 0a 09 20 20 20 20 20 20 ve-runs)..
9460: 20 28 6c 65 74 20 28 28 72 65 6d 74 65 73 74 73 (let ((remtests
9470: 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 (open-run-close
9480: 20 64 62 3a 67 65 74 2d 74 65 73 74 73 2d 66 6f db:get-tests-fo
9490: 72 2d 72 75 6e 20 64 62 20 28 64 62 3a 67 65 74 r-run db (db:get
94a0: 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 -value-by-header
94b0: 20 72 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 run header "id"
94c0: 29 20 23 66 20 27 28 22 44 45 4c 45 54 45 44 22 ) #f '("DELETED"
94d0: 29 20 27 28 22 6e 2f 61 22 29 20 6e 6f 74 2d 69 ) '("n/a") not-i
94e0: 6e 3a 20 23 74 29 29 29 0a 09 09 20 28 69 66 20 n: #t)))... (if
94f0: 28 6e 75 6c 6c 3f 20 72 65 6d 74 65 73 74 73 29 (null? remtests)
9500: 20 3b 3b 20 6e 6f 20 6d 6f 72 65 20 74 65 73 74 ;; no more test
9510: 73 20 72 65 6d 61 69 6e 69 6e 67 0a 09 09 20 20 s remaining...
9520: 20 20 20 28 6c 65 74 2a 20 28 28 64 70 61 72 74 (let* ((dpart
9530: 73 20 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 s (string-split
9540: 20 6c 61 73 74 74 70 61 74 68 20 22 2f 22 29 29 lasttpath "/"))
9550: 0a 09 09 09 20 20 20 20 28 72 75 6e 70 61 74 68 .... (runpath
9560: 20 28 63 6f 6e 63 20 22 2f 22 20 28 73 74 72 69 (conc "/" (stri
9570: 6e 67 2d 69 6e 74 65 72 73 70 65 72 73 65 20 0a ng-intersperse .
9580: 09 09 09 09 09 09 28 74 61 6b 65 20 64 70 61 72 ......(take dpar
9590: 74 73 20 28 2d 20 28 6c 65 6e 67 74 68 20 64 70 ts (- (length dp
95a0: 61 72 74 73 29 20 31 29 29 0a 09 09 09 09 09 09 arts) 1)).......
95b0: 22 2f 22 29 29 29 29 0a 09 09 20 20 20 20 20 20 "/"))))...
95c0: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 31 20 (debug:print 1
95d0: 22 52 65 6d 6f 76 69 6e 67 20 72 75 6e 3a 20 22 "Removing run: "
95e0: 20 72 75 6e 6b 65 79 20 22 20 22 20 28 64 62 3a runkey " " (db:
95f0: 67 65 74 2d 76 61 6c 75 65 2d 62 79 2d 68 65 61 get-value-by-hea
9600: 64 65 72 20 72 75 6e 20 68 65 61 64 65 72 20 22 der run header "
9610: 72 75 6e 6e 61 6d 65 22 29 20 22 20 61 6e 64 20 runname") " and
9620: 72 65 6c 61 74 65 64 20 72 65 63 6f 72 64 22 29 related record")
9630: 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e 2d ... (open-
9640: 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 6c run-close db:del
9650: 65 74 65 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 ete-run db run-i
9660: 64 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 54 d)... ;; T
9670: 68 69 73 20 69 73 20 61 20 70 72 65 74 74 79 20 his is a pretty
9680: 67 6f 6f 64 20 70 6c 61 63 65 20 74 6f 20 70 75 good place to pu
9690: 72 67 65 20 6f 6c 64 20 44 45 4c 45 54 45 44 20 rge old DELETED
96a0: 74 65 73 74 73 0a 09 09 20 20 20 20 20 20 20 28 tests... (
96b0: 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 open-run-close d
96c0: 62 3a 64 65 6c 65 74 65 2d 74 65 73 74 73 2d 66 b:delete-tests-f
96d0: 6f 72 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 or-run db run-id
96e0: 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e )... (open
96f0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 64 65 -run-close db:de
9700: 6c 65 74 65 2d 6f 6c 64 2d 64 65 6c 65 74 65 64 lete-old-deleted
9710: 2d 74 65 73 74 2d 72 65 63 6f 72 64 73 20 64 62 -test-records db
9720: 29 0a 09 09 20 20 20 20 20 20 20 28 6f 70 65 6e )... (open
9730: 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 73 65 -run-close db:se
9740: 74 2d 76 61 72 20 64 62 20 22 44 45 4c 45 54 45 t-var db "DELETE
9750: 44 5f 54 45 53 54 53 22 20 28 63 75 72 72 65 6e D_TESTS" (curren
9760: 74 2d 73 65 63 6f 6e 64 73 29 29 0a 09 09 20 20 t-seconds))...
9770: 20 20 20 20 20 3b 3b 20 6e 65 65 64 20 74 6f 20 ;; need to
9780: 66 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 70 figure out the p
9790: 61 74 68 20 74 6f 20 74 68 65 20 72 75 6e 20 64 ath to the run d
97a0: 69 72 20 61 6e 64 20 72 65 6d 6f 76 65 20 69 74 ir and remove it
97b0: 20 69 66 20 65 6d 70 74 79 0a 09 09 20 20 20 20 if empty...
97c0: 20 20 20 3b 3b 20 20 20 20 28 69 66 20 28 6e 75 ;; (if (nu
97d0: 6c 6c 3f 20 28 67 6c 6f 62 20 28 63 6f 6e 63 20 ll? (glob (conc
97e0: 72 75 6e 70 61 74 68 20 22 2f 2a 22 29 29 29 0a runpath "/*"))).
97f0: 09 09 20 20 20 20 20 20 20 3b 3b 20 20 20 20 20 .. ;;
9800: 20 20 20 28 62 65 67 69 6e 0a 09 09 20 20 20 20 (begin...
9810: 20 20 20 3b 3b 20 09 20 28 64 65 62 75 67 3a 70 ;; . (debug:p
9820: 72 69 6e 74 20 31 20 22 52 65 6d 6f 76 69 6e 67 rint 1 "Removing
9830: 20 72 75 6e 20 64 69 72 20 22 20 72 75 6e 70 61 run dir " runpa
9840: 74 68 29 0a 09 09 20 20 20 20 20 20 20 3b 3b 20 th)... ;;
9850: 09 20 28 73 79 73 74 65 6d 20 28 63 6f 6e 63 20 . (system (conc
9860: 22 72 6d 64 69 72 20 2d 70 20 22 20 72 75 6e 70 "rmdir -p " runp
9870: 61 74 68 29 29 29 29 0a 09 09 20 20 20 20 20 20 ath))))...
9880: 20 29 29 29 29 29 0a 09 20 29 29 0a 20 20 20 20 ))))).. )).
9890: 20 72 75 6e 73 29 29 0a 20 20 23 74 29 0a 0a 3b runs)). #t)..;
98a0: 3b 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 3d 3d ================
98e0: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 52 6f 75 74 69 =======.;; Routi
98f0: 6e 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 nes for manipula
9900: 74 69 6e 67 20 72 75 6e 73 0a 3b 3b 3d 3d 3d 3d ting runs.;;====
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 3d 3d 3d 3d 3d 3d 3d ================
9950: 3d 3d 0a 0a 3b 3b 20 53 69 6e 63 65 20 6d 61 6e ==..;; Since man
9960: 79 20 63 61 6c 6c 73 20 74 6f 20 61 20 72 75 6e y calls to a run
9970: 20 72 65 71 75 69 72 65 20 70 72 65 74 74 79 20 require pretty
9980: 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 73 65 much the same se
9990: 74 75 70 20 0a 3b 3b 20 74 68 69 73 20 77 72 61 tup .;; this wra
99a0: 70 70 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 pper is used to
99b0: 72 65 64 75 63 65 20 74 68 65 20 72 65 70 6c 69 reduce the repli
99c0: 63 61 74 69 6f 6e 20 6f 66 20 63 6f 64 65 0a 28 cation of code.(
99d0: 64 65 66 69 6e 65 20 28 67 65 6e 65 72 61 6c 2d define (general-
99e0: 72 75 6e 2d 63 61 6c 6c 20 73 77 69 74 63 68 6e run-call switchn
99f0: 61 6d 65 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 ame action-desc
9a00: 70 72 6f 63 29 0a 20 20 28 6c 65 74 20 28 28 72 proc). (let ((r
9a10: 75 6e 6e 61 6d 65 20 28 61 72 67 73 3a 67 65 74 unname (args:get
9a20: 2d 61 72 67 20 22 3a 72 75 6e 6e 61 6d 65 22 29 -arg ":runname")
9a30: 29 0a 09 28 74 61 72 67 65 74 20 20 28 69 66 20 )..(target (if
9a40: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
9a50: 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 target")...
9a60: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
9a70: 74 61 72 67 65 74 22 29 0a 09 09 20 20 20 20 20 target")...
9a80: 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d (args:get-arg "-
9a90: 72 65 71 74 61 72 67 22 29 29 29 0a 09 28 74 68 reqtarg")))..(th
9aa0: 31 20 20 20 20 20 23 66 29 29 0a 20 20 20 20 28 1 #f)). (
9ab0: 63 6f 6e 64 0a 20 20 20 20 20 28 28 6e 6f 74 20 cond. ((not
9ac0: 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 28 64 target). (d
9ad0: 65 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 ebug:print 0 "ER
9ae0: 52 4f 52 3a 20 4d 69 73 73 69 6e 67 20 72 65 71 ROR: Missing req
9af0: 75 69 72 65 64 20 70 61 72 61 6d 65 74 65 72 20 uired parameter
9b00: 66 6f 72 20 22 20 73 77 69 74 63 68 6e 61 6d 65 for " switchname
9b10: 20 22 2c 20 79 6f 75 20 6d 75 73 74 20 73 70 65 ", you must spe
9b20: 63 69 66 79 20 74 68 65 20 74 61 72 67 65 74 20 cify the target
9b30: 77 69 74 68 20 2d 74 61 72 67 65 74 22 29 0a 20 with -target").
9b40: 20 20 20 20 20 28 65 78 69 74 20 33 29 29 0a 20 (exit 3)).
9b50: 20 20 20 20 28 28 6e 6f 74 20 72 75 6e 6e 61 6d ((not runnam
9b60: 65 29 0a 20 20 20 20 20 20 28 64 65 62 75 67 3a e). (debug:
9b70: 70 72 69 6e 74 20 30 20 22 45 52 52 4f 52 3a 20 print 0 "ERROR:
9b80: 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 Missing required
9b90: 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 22 parameter for "
9ba0: 20 73 77 69 74 63 68 6e 61 6d 65 20 22 2c 20 79 switchname ", y
9bb0: 6f 75 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 ou must specify
9bc0: 74 68 65 20 72 75 6e 20 6e 61 6d 65 20 77 69 74 the run name wit
9bd0: 68 20 3a 72 75 6e 6e 61 6d 65 20 72 75 6e 6e 61 h :runname runna
9be0: 6d 65 22 29 0a 20 20 20 20 20 20 28 65 78 69 74 me"). (exit
9bf0: 20 33 29 29 0a 20 20 20 20 20 28 65 6c 73 65 0a 3)). (else.
9c00: 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 62 20 (let ((db
9c10: 20 20 23 66 29 0a 09 20 20 20 20 28 6b 65 79 73 #f).. (keys
9c20: 20 23 66 29 29 0a 09 28 69 66 20 28 6e 6f 74 20 #f))..(if (not
9c30: 28 73 65 74 75 70 2d 66 6f 72 2d 72 75 6e 29 29 (setup-for-run))
9c40: 0a 09 20 20 20 20 28 62 65 67 69 6e 20 0a 09 20 .. (begin ..
9c50: 20 20 20 20 20 28 64 65 62 75 67 3a 70 72 69 6e (debug:prin
9c60: 74 20 30 20 22 46 61 69 6c 65 64 20 74 6f 20 73 t 0 "Failed to s
9c70: 65 74 75 70 2c 20 65 78 69 74 69 6e 67 22 29 0a etup, exiting").
9c80: 09 20 20 20 20 20 20 28 65 78 69 74 20 31 29 29 . (exit 1))
9c90: 29 0a 09 28 69 66 20 28 61 72 67 73 3a 67 65 74 )..(if (args:get
9ca0: 2d 61 72 67 20 22 2d 73 65 72 76 65 72 22 29 0a -arg "-server").
9cb0: 09 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 . (open-run-c
9cc0: 6c 6f 73 65 20 73 65 72 76 65 72 3a 73 74 61 72 lose server:star
9cd0: 74 20 64 62 20 28 61 72 67 73 3a 67 65 74 2d 61 t db (args:get-a
9ce0: 72 67 20 22 2d 73 65 72 76 65 72 22 29 29 0a 20 rg "-server")).
9cf0: 09 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6f . (if (not (o
9d00: 72 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 r (args:get-arg
9d10: 22 2d 72 75 6e 61 6c 6c 22 29 20 20 20 20 20 3b "-runall") ;
9d20: 3b 20 72 75 6e 61 6c 6c 20 61 6e 64 20 72 75 6e ; runall and run
9d30: 74 65 73 74 73 20 61 72 65 20 61 6c 6c 6f 77 65 tests are allowe
9d40: 64 20 74 6f 20 62 65 20 73 65 72 76 65 72 73 0a d to be servers.
9d50: 20 09 09 09 20 28 61 72 67 73 3a 67 65 74 2d 61 ... (args:get-a
9d60: 72 67 20 22 2d 72 75 6e 74 65 73 74 73 22 29 29 rg "-runtests"))
9d70: 29 0a 09 09 28 73 65 72 76 65 72 3a 63 6c 69 65 )...(server:clie
9d80: 6e 74 2d 73 65 74 75 70 29 29 29 0a 09 28 73 65 nt-setup)))..(se
9d90: 74 21 20 6b 65 79 73 20 28 6f 70 65 6e 2d 72 75 t! keys (open-ru
9da0: 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d 6b n-close db:get-k
9db0: 65 79 73 20 64 62 29 29 0a 09 3b 3b 20 68 61 76 eys db))..;; hav
9dc0: 65 20 65 6e 6f 75 67 68 20 74 6f 20 70 72 6f 63 e enough to proc
9dd0: 65 73 73 20 2d 74 61 72 67 65 74 20 6f 72 20 2d ess -target or -
9de0: 72 65 71 74 61 72 67 20 68 65 72 65 0a 09 28 69 reqtarg here..(i
9df0: 66 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 f (args:get-arg
9e00: 22 2d 72 65 71 74 61 72 67 22 29 0a 09 20 20 20 "-reqtarg")..
9e10: 20 28 6c 65 74 2a 20 28 28 72 75 6e 63 6f 6e 66 (let* ((runconf
9e20: 69 67 66 20 28 63 6f 6e 63 20 20 2a 74 6f 70 70 igf (conc *topp
9e30: 61 74 68 2a 20 22 2f 72 75 6e 63 6f 6e 66 69 67 ath* "/runconfig
9e40: 73 2e 63 6f 6e 66 69 67 22 29 29 20 3b 3b 20 44 s.config")) ;; D
9e50: 4f 20 4e 4f 54 20 45 56 41 4c 55 41 54 45 20 41 O NOT EVALUATE A
9e60: 4c 4c 20 0a 09 09 20 20 20 28 72 75 6e 63 6f 6e LL ... (runcon
9e70: 66 69 67 20 20 28 72 65 61 64 2d 63 6f 6e 66 69 fig (read-confi
9e80: 67 20 72 75 6e 63 6f 6e 66 69 67 66 20 23 66 20 g runconfigf #f
9e90: 23 66 20 65 6e 76 69 72 6f 6e 2d 70 61 74 74 3a #f environ-patt:
9ea0: 20 23 66 29 29 29 20 0a 09 20 20 20 20 20 20 28 #f))) .. (
9eb0: 69 66 20 28 68 61 73 68 2d 74 61 62 6c 65 2d 72 if (hash-table-r
9ec0: 65 66 2f 64 65 66 61 75 6c 74 20 72 75 6e 63 6f ef/default runco
9ed0: 6e 66 69 67 20 28 61 72 67 73 3a 67 65 74 2d 61 nfig (args:get-a
9ee0: 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 23 rg "-reqtarg") #
9ef0: 66 29 0a 09 09 20 20 28 6b 65 79 73 3a 74 61 72 f)... (keys:tar
9f00: 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b 65 79 get-set-args key
9f10: 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 67 20 s (args:get-arg
9f20: 22 2d 72 65 71 74 61 72 67 22 29 20 61 72 67 73 "-reqtarg") args
9f30: 3a 61 72 67 2d 68 61 73 68 29 0a 09 09 20 20 28 :arg-hash)... (
9f40: 62 65 67 69 6e 0a 09 09 20 20 20 20 28 64 65 62 begin... (deb
9f50: 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 4f ug:print 0 "ERRO
9f60: 52 3a 20 5b 22 20 28 61 72 67 73 3a 67 65 74 2d R: [" (args:get-
9f70: 61 72 67 20 22 2d 72 65 71 74 61 72 67 22 29 20 arg "-reqtarg")
9f80: 22 5d 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 "] not found in
9f90: 22 20 72 75 6e 63 6f 6e 66 69 67 66 29 0a 09 09 " runconfigf)...
9fa0: 20 20 20 20 28 69 66 20 64 62 20 28 73 71 6c 69 (if db (sqli
9fb0: 74 65 33 3a 66 69 6e 61 6c 69 7a 65 21 20 64 62 te3:finalize! db
9fc0: 29 29 0a 09 09 20 20 20 20 28 65 78 69 74 20 31 ))... (exit 1
9fd0: 29 29 29 29 0a 09 20 20 20 20 28 69 66 20 28 61 )))).. (if (a
9fe0: 72 67 73 3a 67 65 74 2d 61 72 67 20 22 2d 74 61 rgs:get-arg "-ta
9ff0: 72 67 65 74 22 29 0a 09 09 28 6b 65 79 73 3a 74 rget")...(keys:t
a000: 61 72 67 65 74 2d 73 65 74 2d 61 72 67 73 20 6b arget-set-args k
a010: 65 79 73 20 28 61 72 67 73 3a 67 65 74 2d 61 72 eys (args:get-ar
a020: 67 20 22 2d 74 61 72 67 65 74 22 20 61 72 67 73 g "-target" args
a030: 3a 61 72 67 2d 68 61 73 68 29 20 61 72 67 73 3a :arg-hash) args:
a040: 61 72 67 2d 68 61 73 68 29 29 29 0a 09 28 69 66 arg-hash)))..(if
a050: 20 28 6e 6f 74 20 28 63 61 72 20 2a 63 6f 6e 66 (not (car *conf
a060: 69 67 69 6e 66 6f 2a 29 29 0a 09 20 20 20 20 28 iginfo*)).. (
a070: 62 65 67 69 6e 0a 09 20 20 20 20 20 20 28 64 65 begin.. (de
a080: 62 75 67 3a 70 72 69 6e 74 20 30 20 22 45 52 52 bug:print 0 "ERR
a090: 4f 52 3a 20 41 74 74 65 6d 70 74 65 64 20 74 6f OR: Attempted to
a0a0: 20 22 20 61 63 74 69 6f 6e 2d 64 65 73 63 20 22 " action-desc "
a0b0: 20 62 75 74 20 72 75 6e 20 61 72 65 61 20 63 6f but run area co
a0c0: 6e 66 69 67 20 66 69 6c 65 20 6e 6f 74 20 66 6f nfig file not fo
a0d0: 75 6e 64 22 29 0a 09 20 20 20 20 20 20 28 65 78 und").. (ex
a0e0: 69 74 20 31 29 29 0a 09 20 20 20 20 3b 3b 20 45 it 1)).. ;; E
a0f0: 78 74 72 61 63 74 20 6f 75 74 20 73 74 75 66 66 xtract out stuff
a100: 20 6e 65 65 64 65 64 20 69 6e 20 6d 6f 73 74 20 needed in most
a110: 6f 72 20 6d 61 6e 79 20 63 61 6c 6c 73 0a 09 20 or many calls..
a120: 20 20 20 3b 3b 20 68 65 72 65 20 74 68 65 6e 20 ;; here then
a130: 63 61 6c 6c 20 70 72 6f 63 0a 09 20 20 20 20 28 call proc.. (
a140: 6c 65 74 2a 20 28 28 6b 65 79 6e 61 6d 65 73 20 let* ((keynames
a150: 20 20 28 6d 61 70 20 6b 65 79 3a 67 65 74 2d 66 (map key:get-f
a160: 69 65 6c 64 6e 61 6d 65 20 6b 65 79 73 29 29 0a ieldname keys)).
a170: 09 09 20 20 20 28 6b 65 79 76 61 6c 6c 73 74 20 .. (keyvallst
a180: 20 28 6b 65 79 73 2d 3e 76 61 6c 6c 69 73 74 20 (keys->vallist
a190: 6b 65 79 73 20 23 74 29 29 29 0a 09 20 20 20 20 keys #t)))..
a1a0: 20 20 28 70 72 6f 63 20 74 61 72 67 65 74 20 72 (proc target r
a1b0: 75 6e 6e 61 6d 65 20 6b 65 79 73 20 6b 65 79 6e unname keys keyn
a1c0: 61 6d 65 73 20 6b 65 79 76 61 6c 6c 73 74 29 29 ames keyvallst))
a1d0: 29 0a 09 28 69 66 20 74 68 31 20 28 74 68 72 65 )..(if th1 (thre
a1e0: 61 64 2d 6a 6f 69 6e 21 20 74 68 31 29 29 0a 09 ad-join! th1))..
a1f0: 28 69 66 20 64 62 20 28 73 71 6c 69 74 65 33 3a (if db (sqlite3:
a200: 66 69 6e 61 6c 69 7a 65 21 20 64 62 29 29 0a 09 finalize! db))..
a210: 28 73 65 74 21 20 2a 64 69 64 73 6f 6d 65 74 68 (set! *didsometh
a220: 69 6e 67 2a 20 23 74 29 29 29 29 29 29 0a 0a 3b ing* #t))))))..;
a230: 3b 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 3d 3d ================
a270: 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b 20 4c 6f 63 6b 2f =======.;; Lock/
a280: 75 6e 6c 6f 63 6b 20 72 75 6e 73 0a 3b 3b 3d 3d unlock runs.;;==
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 3d 3d 3d 3d 3d ================
a2d0: 3d 3d 3d 3d 0a 0a 28 64 65 66 69 6e 65 20 28 72 ====..(define (r
a2e0: 75 6e 73 3a 68 61 6e 64 6c 65 2d 6c 6f 63 6b 69 uns:handle-locki
a2f0: 6e 67 20 74 61 72 67 65 74 20 6b 65 79 73 20 72 ng target keys r
a300: 75 6e 6e 61 6d 65 20 6c 6f 63 6b 20 75 6e 6c 6f unname lock unlo
a310: 63 6b 20 75 73 65 72 29 0a 20 20 28 6c 65 74 2a ck user). (let*
a320: 20 28 28 64 62 20 20 20 20 20 20 20 23 66 29 0a ((db #f).
a330: 09 20 28 72 75 6e 64 61 74 20 20 20 28 6f 70 65 . (rundat (ope
a340: 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 n-run-close runs
a350: 3a 67 65 74 2d 72 75 6e 73 2d 62 79 2d 70 61 74 :get-runs-by-pat
a360: 74 20 64 62 20 6b 65 79 73 20 72 75 6e 6e 61 6d t db keys runnam
a370: 65 29 29 0a 09 20 28 68 65 61 64 65 72 20 20 20 e)).. (header
a380: 28 76 65 63 74 6f 72 2d 72 65 66 20 72 75 6e 64 (vector-ref rund
a390: 61 74 20 30 29 29 0a 09 20 28 72 75 6e 73 20 20 at 0)).. (runs
a3a0: 20 20 20 28 76 65 63 74 6f 72 2d 72 65 66 20 72 (vector-ref r
a3b0: 75 6e 64 61 74 20 31 29 29 29 0a 20 20 20 20 28 undat 1))). (
a3c0: 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 for-each (lambda
a3d0: 20 28 72 75 6e 29 0a 09 09 28 6c 65 74 20 28 28 (run)...(let ((
a3e0: 72 75 6e 2d 69 64 20 28 64 62 3a 67 65 74 2d 76 run-id (db:get-v
a3f0: 61 6c 75 65 2d 62 79 2d 68 65 61 64 65 72 20 72 alue-by-header r
a400: 75 6e 20 68 65 61 64 65 72 20 22 69 64 22 29 29 un header "id"))
a410: 29 0a 09 09 20 20 28 69 66 20 28 6f 72 20 6c 6f )... (if (or lo
a420: 63 6b 0a 09 09 09 20 20 28 61 6e 64 20 75 6e 6c ck.... (and unl
a430: 6f 63 6b 0a 09 09 09 20 20 20 20 20 20 20 28 62 ock.... (b
a440: 65 67 69 6e 0a 09 09 09 09 20 28 70 72 69 6e 74 egin..... (print
a450: 20 22 44 6f 20 79 6f 75 20 72 65 61 6c 6c 79 20 "Do you really
a460: 77 69 73 68 20 74 6f 20 75 6e 6c 6f 63 6b 20 72 wish to unlock r
a470: 75 6e 20 22 20 72 75 6e 2d 69 64 20 22 3f 5c 6e un " run-id "?\n
a480: 20 20 20 79 2f 6e 3a 20 22 29 0a 09 09 09 09 20 y/n: ").....
a490: 28 65 71 75 61 6c 3f 20 22 79 22 20 28 72 65 61 (equal? "y" (rea
a4a0: 64 2d 6c 69 6e 65 29 29 29 29 29 0a 09 09 20 20 d-line)))))...
a4b0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
a4c0: 6f 73 65 20 64 62 3a 6c 6f 63 6b 2f 75 6e 6c 6f ose db:lock/unlo
a4d0: 63 6b 2d 72 75 6e 20 64 62 20 72 75 6e 2d 69 64 ck-run db run-id
a4e0: 20 6c 6f 63 6b 20 75 6e 6c 6f 63 6b 20 75 73 65 lock unlock use
a4f0: 72 29 0a 09 09 20 20 20 20 20 20 28 64 65 62 75 r)... (debu
a500: 67 3a 70 72 69 6e 74 20 30 20 22 49 4e 46 4f 3a g:print 0 "INFO:
a510: 20 53 6b 69 70 70 69 6e 67 20 6c 6f 63 6b 2f 75 Skipping lock/u
a520: 6e 6c 6f 63 6b 20 6f 6e 20 22 20 72 75 6e 2d 69 nlock on " run-i
a530: 64 29 29 29 29 0a 09 20 20 20 20 20 20 72 75 6e d)))).. run
a540: 73 29 29 29 0a 3b 3b 3d 3d 3d 3d 3d 3d 3d 3d 3d s))).;;=========
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 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 3b 3b =============.;;
a590: 20 52 6f 6c 6c 75 70 20 72 75 6e 73 0a 3b 3b 3d Rollup runs.;;=
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 3d 3d 3d 3d ================
a5e0: 3d 3d 3d 3d 3d 0a 0a 3b 3b 20 55 70 64 61 74 65 =====..;; Update
a5f0: 20 74 68 65 20 74 65 73 74 5f 6d 65 74 61 20 74 the test_meta t
a600: 61 62 6c 65 20 66 6f 72 20 74 68 69 73 20 74 65 able for this te
a610: 73 74 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 st.(define (runs
a620: 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d 65 74 :update-test_met
a630: 61 20 64 62 20 74 65 73 74 2d 6e 61 6d 65 20 74 a db test-name t
a640: 65 73 74 2d 63 6f 6e 66 29 0a 20 20 28 6c 65 74 est-conf). (let
a650: 20 28 28 63 75 72 72 72 65 63 6f 72 64 20 28 6f ((currrecord (o
a660: 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 64 62 pen-run-close db
a670: 3a 74 65 73 74 6d 65 74 61 2d 67 65 74 2d 72 65 :testmeta-get-re
a680: 63 6f 72 64 20 64 62 20 74 65 73 74 2d 6e 61 6d cord db test-nam
a690: 65 29 29 29 0a 20 20 20 20 28 69 66 20 28 6e 6f e))). (if (no
a6a0: 74 20 63 75 72 72 72 65 63 6f 72 64 29 0a 09 28 t currrecord)..(
a6b0: 62 65 67 69 6e 0a 09 20 20 28 73 65 74 21 20 63 begin.. (set! c
a6c0: 75 72 72 72 65 63 6f 72 64 20 28 6d 61 6b 65 2d urrrecord (make-
a6d0: 76 65 63 74 6f 72 20 31 30 20 23 66 29 29 0a 09 vector 10 #f))..
a6e0: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
a6f0: 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 61 64 e db:testmeta-ad
a700: 64 2d 72 65 63 6f 72 64 20 64 62 20 74 65 73 74 d-record db test
a710: 2d 6e 61 6d 65 29 29 29 0a 20 20 20 20 28 66 6f -name))). (fo
a720: 72 2d 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 r-each . (la
a730: 6d 62 64 61 20 28 6b 65 79 29 0a 20 20 20 20 20 mbda (key).
a740: 20 20 28 6c 65 74 2a 20 28 28 69 64 78 20 28 63 (let* ((idx (c
a750: 61 64 72 20 6b 65 79 29 29 0a 09 20 20 20 20 20 adr key))..
a760: 20 28 66 6c 64 20 28 63 61 72 20 20 6b 65 79 29 (fld (car key)
a770: 29 0a 09 20 20 20 20 20 20 28 76 61 6c 20 28 63 ).. (val (c
a780: 6f 6e 66 69 67 2d 6c 6f 6f 6b 75 70 20 74 65 73 onfig-lookup tes
a790: 74 2d 63 6f 6e 66 20 22 74 65 73 74 5f 6d 65 74 t-conf "test_met
a7a0: 61 22 20 66 6c 64 29 29 29 0a 09 20 3b 3b 20 28 a" fld))).. ;; (
a7b0: 64 65 62 75 67 3a 70 72 69 6e 74 20 35 20 22 69 debug:print 5 "i
a7c0: 64 78 3a 20 22 20 69 64 78 20 22 20 66 6c 64 3a dx: " idx " fld:
a7d0: 20 22 20 66 6c 64 20 22 20 76 61 6c 3a 20 22 20 " fld " val: "
a7e0: 76 61 6c 29 0a 09 20 28 69 66 20 28 61 6e 64 20 val).. (if (and
a7f0: 76 61 6c 20 28 6e 6f 74 20 28 65 71 75 61 6c 3f val (not (equal?
a800: 20 28 76 65 63 74 6f 72 2d 72 65 66 20 63 75 72 (vector-ref cur
a810: 72 72 65 63 6f 72 64 20 69 64 78 29 20 76 61 6c rrecord idx) val
a820: 29 29 29 0a 09 20 20 20 20 20 28 62 65 67 69 6e ))).. (begin
a830: 0a 09 20 20 20 20 20 20 20 28 70 72 69 6e 74 20 .. (print
a840: 22 55 70 64 61 74 69 6e 67 20 22 20 74 65 73 74 "Updating " test
a850: 2d 6e 61 6d 65 20 22 20 22 20 66 6c 64 20 22 20 -name " " fld "
a860: 74 6f 20 22 20 76 61 6c 29 0a 09 20 20 20 20 20 to " val)..
a870: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
a880: 65 20 64 62 3a 74 65 73 74 6d 65 74 61 2d 75 70 e db:testmeta-up
a890: 64 61 74 65 2d 66 69 65 6c 64 20 64 62 20 74 65 date-field db te
a8a0: 73 74 2d 6e 61 6d 65 20 66 6c 64 20 76 61 6c 29 st-name fld val)
a8b0: 29 29 29 29 0a 20 20 20 20 20 27 28 28 22 61 75 )))). '(("au
a8c0: 74 68 6f 72 22 20 32 29 28 22 6f 77 6e 65 72 22 thor" 2)("owner"
a8d0: 20 33 29 28 22 64 65 73 63 72 69 70 74 69 6f 6e 3)("description
a8e0: 22 20 34 29 28 22 72 65 76 69 65 77 65 64 22 20 " 4)("reviewed"
a8f0: 35 29 28 22 74 61 67 73 22 20 39 29 29 29 29 29 5)("tags" 9)))))
a900: 0a 0a 3b 3b 20 55 70 64 61 74 65 20 74 65 73 74 ..;; Update test
a910: 5f 6d 65 74 61 20 66 6f 72 20 61 6c 6c 20 74 65 _meta for all te
a920: 73 74 73 0a 28 64 65 66 69 6e 65 20 28 72 75 6e sts.(define (run
a930: 73 3a 75 70 64 61 74 65 2d 61 6c 6c 2d 74 65 73 s:update-all-tes
a940: 74 5f 6d 65 74 61 20 64 62 29 0a 20 20 28 6c 65 t_meta db). (le
a950: 74 20 28 28 74 65 73 74 2d 6e 61 6d 65 73 20 28 t ((test-names (
a960: 67 65 74 2d 61 6c 6c 2d 6c 65 67 61 6c 2d 74 65 get-all-legal-te
a970: 73 74 73 29 29 29 0a 20 20 20 20 28 66 6f 72 2d sts))). (for-
a980: 65 61 63 68 20 0a 20 20 20 20 20 28 6c 61 6d 62 each . (lamb
a990: 64 61 20 28 74 65 73 74 2d 6e 61 6d 65 29 0a 20 da (test-name).
a9a0: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 (let* ((te
a9b0: 73 74 2d 70 61 74 68 20 20 20 20 28 63 6f 6e 63 st-path (conc
a9c0: 20 2a 74 6f 70 70 61 74 68 2a 20 22 2f 74 65 73 *toppath* "/tes
a9d0: 74 73 2f 22 20 74 65 73 74 2d 6e 61 6d 65 29 29 ts/" test-name))
a9e0: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 63 6f .. (test-co
a9f0: 6e 66 69 67 66 20 28 63 6f 6e 63 20 74 65 73 74 nfigf (conc test
aa00: 2d 70 61 74 68 20 22 2f 74 65 73 74 63 6f 6e 66 -path "/testconf
aa10: 69 67 22 29 29 0a 09 20 20 20 20 20 20 28 74 65 ig")).. (te
aa20: 73 74 65 78 69 73 74 73 20 20 20 28 61 6e 64 20 stexists (and
aa30: 28 66 69 6c 65 2d 65 78 69 73 74 73 3f 20 74 65 (file-exists? te
aa40: 73 74 2d 63 6f 6e 66 69 67 66 29 28 66 69 6c 65 st-configf)(file
aa50: 2d 72 65 61 64 2d 61 63 63 65 73 73 3f 20 74 65 -read-access? te
aa60: 73 74 2d 63 6f 6e 66 69 67 66 29 29 29 0a 09 20 st-configf)))..
aa70: 20 20 20 20 20 3b 3b 20 72 65 61 64 20 63 6f 6e ;; read con
aa80: 66 69 67 73 20 77 69 74 68 20 74 72 69 63 6b 73 figs with tricks
aa90: 20 74 75 72 6e 65 64 20 6f 66 66 20 28 69 2e 65 turned off (i.e
aaa0: 2e 20 6e 6f 20 73 79 73 74 65 6d 29 0a 09 20 20 . no system)..
aab0: 20 20 20 20 28 74 65 73 74 2d 63 6f 6e 66 20 20 (test-conf
aac0: 20 20 28 69 66 20 74 65 73 74 65 78 69 73 74 73 (if testexists
aad0: 20 28 72 65 61 64 2d 63 6f 6e 66 69 67 20 74 65 (read-config te
aae0: 73 74 2d 63 6f 6e 66 69 67 66 20 23 66 20 23 66 st-configf #f #f
aaf0: 29 28 6d 61 6b 65 2d 68 61 73 68 2d 74 61 62 6c )(make-hash-tabl
ab00: 65 29 29 29 29 0a 09 20 3b 3b 20 75 73 65 20 74 e)))).. ;; use t
ab10: 68 65 20 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 he open-run-clos
ab20: 65 20 69 6e 73 74 65 61 64 20 6f 66 20 70 61 73 e instead of pas
ab30: 73 69 6e 67 20 69 6e 20 64 62 0a 09 20 28 72 75 sing in db.. (ru
ab40: 6e 73 3a 75 70 64 61 74 65 2d 74 65 73 74 5f 6d ns:update-test_m
ab50: 65 74 61 20 23 66 20 74 65 73 74 2d 6e 61 6d 65 eta #f test-name
ab60: 20 74 65 73 74 2d 63 6f 6e 66 29 29 29 0a 20 20 test-conf))).
ab70: 20 20 20 74 65 73 74 2d 6e 61 6d 65 73 29 29 29 test-names)))
ab80: 0a 0a 3b 3b 20 54 68 69 73 20 63 6f 75 6c 64 20 ..;; This could
ab90: 70 72 6f 62 61 62 6c 79 20 62 65 20 72 65 66 61 probably be refa
aba0: 63 74 6f 72 65 64 20 69 6e 74 6f 20 6f 6e 65 20 ctored into one
abb0: 63 6f 6d 70 6c 65 78 20 71 75 65 72 79 20 2e 2e complex query ..
abc0: 2e 0a 28 64 65 66 69 6e 65 20 28 72 75 6e 73 3a ..(define (runs:
abd0: 72 6f 6c 6c 75 70 2d 72 75 6e 20 6b 65 79 73 20 rollup-run keys
abe0: 6b 65 79 76 61 6c 6c 73 74 20 72 75 6e 6e 61 6d keyvallst runnam
abf0: 65 20 75 73 65 72 29 20 3b 3b 20 77 61 73 20 74 e user) ;; was t
ac00: 61 72 67 65 74 2c 20 6e 6f 77 20 6b 65 79 76 61 arget, now keyva
ac10: 6c 6c 73 74 0a 20 20 28 64 65 62 75 67 3a 70 72 llst. (debug:pr
ac20: 69 6e 74 20 34 20 22 72 75 6e 73 3a 72 6f 6c 6c int 4 "runs:roll
ac30: 75 70 2d 72 75 6e 2c 20 6b 65 79 73 3a 20 22 20 up-run, keys: "
ac40: 6b 65 79 73 20 22 20 6b 65 79 76 61 6c 6c 73 74 keys " keyvallst
ac50: 3a 20 22 20 6b 65 79 76 61 6c 6c 73 74 20 22 20 : " keyvallst "
ac60: 3a 72 75 6e 6e 61 6d 65 20 22 20 72 75 6e 6e 61 :runname " runna
ac70: 6d 65 20 22 20 75 73 65 72 3a 20 22 20 75 73 65 me " user: " use
ac80: 72 29 0a 20 20 28 6c 65 74 2a 20 28 28 64 62 20 r). (let* ((db
ac90: 20 20 20 20 20 20 20 20 20 20 20 20 20 23 66 29 #f)
aca0: 20 3b 3b 20 28 6b 65 79 76 61 6c 6c 6c 73 74 20 ;; (keyvalllst
acb0: 20 20 20 20 20 28 6b 65 79 73 3a 74 61 72 67 65 (keys:targe
acc0: 74 2d 3e 6b 65 79 76 61 6c 20 6b 65 79 73 20 74 t->keyval keys t
acd0: 61 72 67 65 74 29 29 0a 09 20 28 6e 65 77 2d 72 arget)).. (new-r
ace0: 75 6e 2d 69 64 20 20 20 20 20 20 28 6f 70 65 6e un-id (open
acf0: 2d 72 75 6e 2d 63 6c 6f 73 65 20 72 75 6e 73 3a -run-close runs:
ad00: 72 65 67 69 73 74 65 72 2d 72 75 6e 20 64 62 20 register-run db
ad10: 6b 65 79 73 20 6b 65 79 76 61 6c 6c 73 74 20 72 keys keyvallst r
ad20: 75 6e 6e 61 6d 65 20 22 6e 65 77 22 20 22 6e 2f unname "new" "n/
ad30: 61 22 20 75 73 65 72 29 29 0a 09 20 28 70 72 65 a" user)).. (pre
ad40: 76 2d 74 65 73 74 73 20 20 20 20 20 20 28 6f 70 v-tests (op
ad50: 65 6e 2d 72 75 6e 2d 63 6c 6f 73 65 20 74 65 73 en-run-close tes
ad60: 74 3a 67 65 74 2d 6d 61 74 63 68 69 6e 67 2d 70 t:get-matching-p
ad70: 72 65 76 69 6f 75 73 2d 74 65 73 74 2d 72 75 6e revious-test-run
ad80: 2d 72 65 63 6f 72 64 73 20 64 62 20 6e 65 77 2d -records db new-
ad90: 72 75 6e 2d 69 64 20 22 25 22 20 22 25 22 29 29 run-id "%" "%"))
ada0: 0a 09 20 28 63 75 72 72 2d 74 65 73 74 73 20 20 .. (curr-tests
adb0: 20 20 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c (open-run-cl
adc0: 6f 73 65 20 64 62 3a 67 65 74 2d 74 65 73 74 73 ose db:get-tests
add0: 2d 66 6f 72 2d 72 75 6e 20 64 62 20 6e 65 77 2d -for-run db new-
ade0: 72 75 6e 2d 69 64 20 22 25 2f 25 22 20 27 28 29 run-id "%/%" '()
adf0: 20 27 28 29 29 29 0a 09 20 28 63 75 72 72 2d 74 '())).. (curr-t
ae00: 65 73 74 73 2d 68 61 73 68 20 28 6d 61 6b 65 2d ests-hash (make-
ae10: 68 61 73 68 2d 74 61 62 6c 65 29 29 29 0a 20 20 hash-table))).
ae20: 20 20 28 6f 70 65 6e 2d 72 75 6e 2d 63 6c 6f 73 (open-run-clos
ae30: 65 20 64 62 3a 75 70 64 61 74 65 2d 72 75 6e 2d e db:update-run-
ae40: 65 76 65 6e 74 5f 74 69 6d 65 20 64 62 20 6e 65 event_time db ne
ae50: 77 2d 72 75 6e 2d 69 64 29 0a 20 20 20 20 3b 3b w-run-id). ;;
ae60: 20 69 6e 64 65 78 20 74 68 65 20 61 6c 72 65 61 index the alrea
ae70: 64 79 20 73 61 76 65 64 20 74 65 73 74 73 20 62 dy saved tests b
ae80: 79 20 74 65 73 74 6e 61 6d 65 20 61 6e 64 20 69 y testname and i
ae90: 74 65 6d 64 61 74 20 69 6e 20 63 75 72 72 2d 74 temdat in curr-t
aea0: 65 73 74 73 2d 68 61 73 68 0a 20 20 20 20 28 66 ests-hash. (f
aeb0: 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 28 6c 61 or-each. (la
aec0: 6d 62 64 61 20 28 74 65 73 74 64 61 74 29 0a 20 mbda (testdat).
aed0: 20 20 20 20 20 20 28 6c 65 74 2a 20 28 28 74 65 (let* ((te
aee0: 73 74 6e 61 6d 65 20 20 28 64 62 3a 74 65 73 74 stname (db:test
aef0: 2d 67 65 74 2d 74 65 73 74 6e 61 6d 65 20 74 65 -get-testname te
af00: 73 74 64 61 74 29 29 0a 09 20 20 20 20 20 20 28 stdat)).. (
af10: 69 74 65 6d 2d 70 61 74 68 20 28 64 62 3a 74 65 item-path (db:te
af20: 73 74 2d 67 65 74 2d 69 74 65 6d 2d 70 61 74 68 st-get-item-path
af30: 20 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 testdat))..
af40: 20 20 28 66 75 6c 6c 2d 6e 61 6d 65 20 28 63 6f (full-name (co
af50: 6e 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 nc testname "/"
af60: 69 74 65 6d 2d 70 61 74 68 29 29 29 0a 09 20 28 item-path))).. (
af70: 68 61 73 68 2d 74 61 62 6c 65 2d 73 65 74 21 20 hash-table-set!
af80: 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 68 20 curr-tests-hash
af90: 66 75 6c 6c 2d 6e 61 6d 65 20 74 65 73 74 64 61 full-name testda
afa0: 74 29 29 29 0a 20 20 20 20 20 63 75 72 72 2d 74 t))). curr-t
afb0: 65 73 74 73 29 0a 20 20 20 20 3b 3b 20 4e 4f 50 ests). ;; NOP
afc0: 45 3a 20 4e 6f 6e 2d 6f 70 74 69 6d 61 6c 20 61 E: Non-optimal a
afd0: 70 70 72 6f 61 63 68 2e 20 54 72 79 20 74 68 69 pproach. Try thi
afe0: 73 20 69 6e 73 74 65 61 64 2e 0a 20 20 20 20 3b s instead.. ;
aff0: 3b 20 20 20 31 2e 20 74 65 73 74 73 20 61 72 65 ; 1. tests are
b000: 20 72 65 63 65 69 76 65 64 20 69 6e 20 61 20 6c received in a l
b010: 69 73 74 2c 20 6d 6f 73 74 20 72 65 63 65 6e 74 ist, most recent
b020: 20 66 69 72 73 74 0a 20 20 20 20 3b 3b 20 20 20 first. ;;
b030: 32 2e 20 72 65 70 6c 61 63 65 20 74 68 65 20 72 2. replace the r
b040: 6f 6c 6c 75 70 20 74 65 73 74 20 77 69 74 68 20 ollup test with
b050: 74 68 65 20 6e 65 77 20 2a 61 6c 77 61 79 73 2a the new *always*
b060: 0a 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 0a . (for-each .
b070: 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 74 65 (lambda (te
b080: 73 74 64 61 74 29 0a 20 20 20 20 20 20 20 28 6c stdat). (l
b090: 65 74 2a 20 28 28 74 65 73 74 6e 61 6d 65 20 20 et* ((testname
b0a0: 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 74 65 73 (db:test-get-tes
b0b0: 74 6e 61 6d 65 20 74 65 73 74 64 61 74 29 29 0a tname testdat)).
b0c0: 09 20 20 20 20 20 20 28 69 74 65 6d 2d 70 61 74 . (item-pat
b0d0: 68 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 h (db:test-get-i
b0e0: 74 65 6d 2d 70 61 74 68 20 74 65 73 74 64 61 74 tem-path testdat
b0f0: 29 29 0a 09 20 20 20 20 20 20 28 66 75 6c 6c 2d )).. (full-
b100: 6e 61 6d 65 20 28 63 6f 6e 63 20 74 65 73 74 6e name (conc testn
b110: 61 6d 65 20 22 2f 22 20 69 74 65 6d 2d 70 61 74 ame "/" item-pat
b120: 68 29 29 0a 09 20 20 20 20 20 20 28 70 72 65 76 h)).. (prev
b130: 2d 74 65 73 74 2d 64 61 74 20 28 68 61 73 68 2d -test-dat (hash-
b140: 74 61 62 6c 65 2d 72 65 66 2f 64 65 66 61 75 6c table-ref/defaul
b150: 74 20 63 75 72 72 2d 74 65 73 74 73 2d 68 61 73 t curr-tests-has
b160: 68 20 66 75 6c 6c 2d 6e 61 6d 65 20 23 66 29 29 h full-name #f))
b170: 0a 09 20 20 20 20 20 20 28 74 65 73 74 2d 73 74 .. (test-st
b180: 65 70 73 20 20 20 20 20 20 28 6f 70 65 6e 2d 72 eps (open-r
b190: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
b1a0: 73 74 65 70 73 2d 66 6f 72 2d 74 65 73 74 20 64 steps-for-test d
b1b0: 62 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 b (db:test-get-i
b1c0: 64 20 74 65 73 74 64 61 74 29 29 29 0a 09 20 20 d testdat)))..
b1d0: 20 20 20 20 28 6e 65 77 2d 74 65 73 74 2d 72 65 (new-test-re
b1e0: 63 6f 72 64 20 23 66 29 29 0a 09 20 3b 3b 20 72 cord #f)).. ;; r
b1f0: 65 70 6c 61 63 65 20 74 68 65 73 65 20 77 69 74 eplace these wit
b200: 68 20 69 6e 73 65 72 74 20 2e 2e 2e 20 73 65 6c h insert ... sel
b210: 65 63 74 0a 09 20 28 61 70 70 6c 79 20 73 71 6c ect.. (apply sql
b220: 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a 09 09 ite3:execute ...
b230: 64 62 20 0a 09 09 28 63 6f 6e 63 20 22 49 4e 53 db ...(conc "INS
b240: 45 52 54 20 4f 52 20 52 45 50 4c 41 43 45 20 49 ERT OR REPLACE I
b250: 4e 54 4f 20 74 65 73 74 73 20 28 72 75 6e 5f 69 NTO tests (run_i
b260: 64 2c 74 65 73 74 6e 61 6d 65 2c 73 74 61 74 65 d,testname,state
b270: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
b280: 6d 65 2c 68 6f 73 74 2c 63 70 75 6c 6f 61 64 2c me,host,cpuload,
b290: 64 69 73 6b 66 72 65 65 2c 75 6e 61 6d 65 2c 72 diskfree,uname,r
b2a0: 75 6e 64 69 72 2c 69 74 65 6d 5f 70 61 74 68 2c undir,item_path,
b2b0: 72 75 6e 5f 64 75 72 61 74 69 6f 6e 2c 66 69 6e run_duration,fin
b2c0: 61 6c 5f 6c 6f 67 66 2c 63 6f 6d 6d 65 6e 74 29 al_logf,comment)
b2d0: 20 22 0a 09 09 20 20 20 20 20 20 22 56 41 4c 55 "... "VALU
b2e0: 45 53 20 28 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c ES (?,?,?,?,?,?,
b2f0: 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 2c 3f 29 ?,?,?,?,?,?,?,?)
b300: 3b 22 29 0a 09 09 6e 65 77 2d 72 75 6e 2d 69 64 ;")...new-run-id
b310: 20 28 63 64 64 72 20 28 76 65 63 74 6f 72 2d 3e (cddr (vector->
b320: 6c 69 73 74 20 74 65 73 74 64 61 74 29 29 29 0a list testdat))).
b330: 09 20 28 73 65 74 21 20 6e 65 77 2d 74 65 73 74 . (set! new-test
b340: 64 61 74 20 28 63 61 72 20 28 6f 70 65 6e 2d 72 dat (car (open-r
b350: 75 6e 2d 63 6c 6f 73 65 20 64 62 3a 67 65 74 2d un-close db:get-
b360: 74 65 73 74 73 2d 66 6f 72 2d 72 75 6e 20 64 62 tests-for-run db
b370: 20 6e 65 77 2d 72 75 6e 2d 69 64 20 28 63 6f 6e new-run-id (con
b380: 63 20 74 65 73 74 6e 61 6d 65 20 22 2f 22 20 69 c testname "/" i
b390: 74 65 6d 2d 70 61 74 68 29 20 27 28 29 20 27 28 tem-path) '() '(
b3a0: 29 29 29 29 0a 09 20 28 68 61 73 68 2d 74 61 62 )))).. (hash-tab
b3b0: 6c 65 2d 73 65 74 21 20 63 75 72 72 2d 74 65 73 le-set! curr-tes
b3c0: 74 73 2d 68 61 73 68 20 66 75 6c 6c 2d 6e 61 6d ts-hash full-nam
b3d0: 65 20 6e 65 77 2d 74 65 73 74 64 61 74 29 20 3b e new-testdat) ;
b3e0: 3b 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 ; this could be
b3f0: 63 6f 6e 66 75 73 69 6e 67 2c 20 77 68 69 63 68 confusing, which
b400: 20 72 65 63 6f 72 64 20 73 68 6f 75 6c 64 20 67 record should g
b410: 6f 20 69 6e 74 6f 20 74 68 65 20 6c 6f 6f 6b 75 o into the looku
b420: 70 20 74 61 62 6c 65 3f 0a 09 20 3b 3b 20 4e 6f p table?.. ;; No
b430: 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 w duplicate the
b440: 74 65 73 74 20 73 74 65 70 73 0a 09 20 28 64 65 test steps.. (de
b450: 62 75 67 3a 70 72 69 6e 74 20 34 20 22 43 6f 70 bug:print 4 "Cop
b460: 79 69 6e 67 20 72 65 63 6f 72 64 73 20 69 6e 20 ying records in
b470: 74 65 73 74 5f 73 74 65 70 73 20 66 72 6f 6d 20 test_steps from
b480: 74 65 73 74 5f 69 64 3d 22 20 28 64 62 3a 74 65 test_id=" (db:te
b490: 73 74 2d 67 65 74 2d 69 64 20 74 65 73 74 64 61 st-get-id testda
b4a0: 74 29 20 22 20 74 6f 20 22 20 28 64 62 3a 74 65 t) " to " (db:te
b4b0: 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 st-get-id new-te
b4c0: 73 74 64 61 74 29 29 0a 09 20 28 6f 70 65 6e 2d stdat)).. (open-
b4d0: 72 75 6e 2d 63 6c 6f 73 65 20 0a 09 20 20 28 6c run-close .. (l
b4e0: 61 6d 62 64 61 20 28 29 0a 09 20 20 20 20 28 73 ambda ().. (s
b4f0: 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 20 0a qlite3:execute .
b500: 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 20 20 . db ..
b510: 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 4f 52 (conc "INSERT OR
b520: 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 74 65 REPLACE INTO te
b530: 73 74 5f 73 74 65 70 73 20 28 74 65 73 74 5f 69 st_steps (test_i
b540: 64 2c 73 74 65 70 6e 61 6d 65 2c 73 74 61 74 65 d,stepname,state
b550: 2c 73 74 61 74 75 73 2c 65 76 65 6e 74 5f 74 69 ,status,event_ti
b560: 6d 65 2c 63 6f 6d 6d 65 6e 74 29 20 22 0a 09 09 me,comment) "...
b570: 20 20 20 22 53 45 4c 45 43 54 20 22 20 28 64 62 "SELECT " (db
b580: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
b590: 2d 74 65 73 74 64 61 74 29 20 22 2c 73 74 65 70 -testdat) ",step
b5a0: 6e 61 6d 65 2c 73 74 61 74 65 2c 73 74 61 74 75 name,state,statu
b5b0: 73 2c 65 76 65 6e 74 5f 74 69 6d 65 2c 63 6f 6d s,event_time,com
b5c0: 6d 65 6e 74 20 46 52 4f 4d 20 74 65 73 74 5f 73 ment FROM test_s
b5d0: 74 65 70 73 20 57 48 45 52 45 20 74 65 73 74 5f teps WHERE test_
b5e0: 69 64 3d 3f 3b 22 29 0a 09 20 20 20 20 20 28 64 id=?;").. (d
b5f0: 62 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 b:test-get-id te
b600: 73 74 64 61 74 29 29 0a 09 20 20 20 20 3b 3b 20 stdat)).. ;;
b610: 4e 6f 77 20 64 75 70 6c 69 63 61 74 65 20 74 68 Now duplicate th
b620: 65 20 74 65 73 74 20 64 61 74 61 0a 09 20 20 20 e test data..
b630: 20 28 64 65 62 75 67 3a 70 72 69 6e 74 20 34 20 (debug:print 4
b640: 22 43 6f 70 79 69 6e 67 20 72 65 63 6f 72 64 73 "Copying records
b650: 20 69 6e 20 74 65 73 74 5f 64 61 74 61 20 66 72 in test_data fr
b660: 6f 6d 20 74 65 73 74 5f 69 64 3d 22 20 28 64 62 om test_id=" (db
b670: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 74 65 73 :test-get-id tes
b680: 74 64 61 74 29 20 22 20 74 6f 20 22 20 28 64 62 tdat) " to " (db
b690: 3a 74 65 73 74 2d 67 65 74 2d 69 64 20 6e 65 77 :test-get-id new
b6a0: 2d 74 65 73 74 64 61 74 29 29 0a 09 20 20 20 20 -testdat))..
b6b0: 28 73 71 6c 69 74 65 33 3a 65 78 65 63 75 74 65 (sqlite3:execute
b6c0: 20 0a 09 20 20 20 20 20 64 62 20 0a 09 20 20 20 .. db ..
b6d0: 20 20 28 63 6f 6e 63 20 22 49 4e 53 45 52 54 20 (conc "INSERT
b6e0: 4f 52 20 52 45 50 4c 41 43 45 20 49 4e 54 4f 20 OR REPLACE INTO
b6f0: 74 65 73 74 5f 64 61 74 61 20 28 74 65 73 74 5f test_data (test_
b700: 69 64 2c 63 61 74 65 67 6f 72 79 2c 76 61 72 69 id,category,vari
b710: 61 62 6c 65 2c 76 61 6c 75 65 2c 65 78 70 65 63 able,value,expec
b720: 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 73 2c 63 6f ted,tol,units,co
b730: 6d 6d 65 6e 74 29 20 22 0a 09 09 20 20 20 22 53 mment) "... "S
b740: 45 4c 45 43 54 20 22 20 28 64 62 3a 74 65 73 74 ELECT " (db:test
b750: 2d 67 65 74 2d 69 64 20 6e 65 77 2d 74 65 73 74 -get-id new-test
b760: 64 61 74 29 20 22 2c 63 61 74 65 67 6f 72 79 2c dat) ",category,
b770: 76 61 72 69 61 62 6c 65 2c 76 61 6c 75 65 2c 65 variable,value,e
b780: 78 70 65 63 74 65 64 2c 74 6f 6c 2c 75 6e 69 74 xpected,tol,unit
b790: 73 2c 63 6f 6d 6d 65 6e 74 20 46 52 4f 4d 20 74 s,comment FROM t
b7a0: 65 73 74 5f 64 61 74 61 20 57 48 45 52 45 20 74 est_data WHERE t
b7b0: 65 73 74 5f 69 64 3d 3f 3b 22 29 0a 09 20 20 20 est_id=?;")..
b7c0: 20 20 28 64 62 3a 74 65 73 74 2d 67 65 74 2d 69 (db:test-get-i
b7d0: 64 20 74 65 73 74 64 61 74 29 29 29 29 0a 09 20 d testdat))))..
b7e0: 29 29 0a 20 20 20 20 20 70 72 65 76 2d 74 65 73 )). prev-tes
b7f0: 74 73 29 29 29 0a 09 20 0a 20 20 20 20 20 0a ts))).. . .